diff options
-rw-r--r-- | app/aboot/fastboot.c | 26 | ||||
-rw-r--r-- | platform/mdm9x25/include/platform/iomap.h | 6 | ||||
-rw-r--r-- | platform/mdm9x25/platform.c | 41 |
3 files changed, 63 insertions, 10 deletions
diff --git a/app/aboot/fastboot.c b/app/aboot/fastboot.c index 4496fd04..5b9dc9a0 100644 --- a/app/aboot/fastboot.c +++ b/app/aboot/fastboot.c @@ -2,14 +2,16 @@ * Copyright (c) 2009, Google Inc. * All rights reserved. * + * Copyright (c) 2013, The Linux Foundation. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the + * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -19,7 +21,7 @@ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF @@ -113,7 +115,6 @@ void fastboot_publish(const char *name, const char *value) static event_t usb_online; static event_t txn_done; -static unsigned char buffer[4096]; static struct udc_endpoint *in, *out; static struct udc_request *req; int txn_status; @@ -212,7 +213,7 @@ oops: void fastboot_ack(const char *code, const char *reason) { - char response[MAX_RSP_SIZE]; + STACKBUF_DMA_ALIGN(response, MAX_RSP_SIZE); if (fastboot_state != STATE_COMMAND) return; @@ -229,7 +230,7 @@ void fastboot_ack(const char *code, const char *reason) void fastboot_info(const char *reason) { - char response[MAX_RSP_SIZE]; + STACKBUF_DMA_ALIGN(response, MAX_RSP_SIZE); if (fastboot_state != STATE_COMMAND) return; @@ -267,7 +268,7 @@ static void cmd_getvar(const char *arg, void *data, unsigned sz) static void cmd_download(const char *arg, void *data, unsigned sz) { - char response[MAX_RSP_SIZE]; + STACKBUF_DMA_ALIGN(response, MAX_RSP_SIZE); unsigned len = hex2unsigned(arg); int r; @@ -296,6 +297,12 @@ static void fastboot_command_loop(void) int r; dprintf(INFO,"fastboot: processing commands\n"); + uint8_t *buffer = (uint8_t *)memalign(CACHE_LINE, ROUNDUP(4096, CACHE_LINE)); + if (!buffer) + { + dprintf(CRITICAL, "Could not allocate memory for fastboot buffer\n."); + ASSERT(0); + } again: while (fastboot_state != STATE_ERROR) { r = usb_read(buffer, MAX_RSP_SIZE); @@ -319,6 +326,7 @@ again: } fastboot_state = STATE_OFFLINE; dprintf(INFO,"fastboot: oops!\n"); + free(buffer); } static int fastboot_handler(void *arg) diff --git a/platform/mdm9x25/include/platform/iomap.h b/platform/mdm9x25/include/platform/iomap.h index c9cc2af2..7801e4fd 100644 --- a/platform/mdm9x25/include/platform/iomap.h +++ b/platform/mdm9x25/include/platform/iomap.h @@ -50,7 +50,11 @@ #define PERIPH_SS_QPIC_BASE 0xF9AC4000 #define CLK_CTL_BASE 0xFC400000 /* GCC base */ -#define MPM2_MPM_PS_HOLD 0xFC4AB000 + +/* MPM2_MPM */ +#define MPM2_MPM_SLEEP_TIMETICK_COUNT_VAL 0xFC4A3000 +#define MPM2_MPM_PS_HOLD 0xFC4AB000 + #define SPMI_BASE 0xFC4C0000 #define SPMI_GENI_BASE (SPMI_BASE + 0xA000) #define SPMI_PIC_BASE (SPMI_BASE + 0xB000) diff --git a/platform/mdm9x25/platform.c b/platform/mdm9x25/platform.c index dc903b02..e499601d 100644 --- a/platform/mdm9x25/platform.c +++ b/platform/mdm9x25/platform.c @@ -38,6 +38,8 @@ #include <target.h> #include <smem.h> #include <reg.h> +#include <board.h> +#include <boot_stats.h> extern struct smem_ram_ptable* target_smem_ram_ptable_init(); @@ -78,6 +80,11 @@ mmu_section_t mmu_section_table[] = { {MSM_IOMAP_BASE, MSM_IOMAP_BASE, MSM_IOMAP_SIZE, IOMAP_MEMORY}, }; +/* Boot timestamps */ +#define BS_INFO_OFFSET (0x6B0) +#define BS_INFO_ADDR_V1 (MSM_SHARED_IMEM_BASE + BS_INFO_OFFSET) +#define BS_INFO_ADDR_V2 (MSM_SHARED_IMEM_BASE_V2 + BS_INFO_OFFSET) + void platform_early_init(void) { /* Initialize board identifier data */ @@ -98,6 +105,40 @@ void platform_init(void) dprintf(INFO, "platform_init()\n"); } +static uint32_t platform_get_sclk_count(void) +{ + return readl(MPM2_MPM_SLEEP_TIMETICK_COUNT_VAL); +} + +static uint32_t kernel_load_start; +void bs_set_timestamp(enum bs_entry bs_id) +{ + void *bs_imem; + uint32_t soc_ver = board_soc_version(); + + if (bs_id >= BS_MAX) { + dprintf(CRITICAL, "bad bs id: %u, max: %u\n", bs_id, BS_MAX); + ASSERT(0); + } + + if (bs_id == BS_KERNEL_LOAD_START) { + kernel_load_start = platform_get_sclk_count(); + return; + } + + if (soc_ver < BOARD_SOC_VERSION2) + bs_imem = (void *)BS_INFO_ADDR_V1; + else + bs_imem = (void *)BS_INFO_ADDR_V2; + + if(bs_id == BS_KERNEL_LOAD_DONE) + writel(platform_get_sclk_count() - kernel_load_start, + bs_imem + (sizeof(uint32_t) * BS_KERNEL_LOAD_TIME)); + else + writel(platform_get_sclk_count(), + bs_imem + (sizeof(uint32_t) * bs_id)); +} + void platform_uninit(void) { qtimer_uninit(); |