From 8097d58931b42e88c74c1e88819f67b2e3cfb6bf Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 6 Apr 2016 22:43:50 -0600 Subject: [PATCH] WIP: Cache and dump boot registers This is the first step in exposing the FW-supplied DT. mkknlimg or equivalent also needs to be run for this to get a DT rather than ATAGS. Hopefully we'll find a way to build that directly into the U-Boot image to avoid reliance on external tools. Signed-off-by: Stephen Warren --- board/raspberrypi/rpi/rpi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index fbfbf6cbbc6..8f7c1901587 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -255,6 +255,21 @@ static struct mm_region bcm2837_mem_map[] = { struct mm_region *mem_map = bcm2837_mem_map; #endif +static uint32_t boot_r0 __attribute__ ((section(".data"))); +static uint32_t boot_r1 __attribute__ ((section(".data"))); +static uint32_t boot_r2 __attribute__ ((section(".data"))); +static uint32_t boot_r3 __attribute__ ((section(".data"))); + +void save_boot_params_ret(void); +void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) +{ + boot_r0 = r0; + boot_r1 = r1; + boot_r2 = r2; + boot_r3 = r3; + save_boot_params_ret(); +} + int dram_init(void) { ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_arm_mem, msg, 1); @@ -274,6 +289,13 @@ int dram_init(void) return 0; } +ulong board_get_usable_ram_top(ulong total_size) +{ + if ((gd->ram_top - boot_r2) > SZ_64M) + return gd->ram_top; + return boot_r2 & 0xffff0000; +} + static void set_fdtfile(void) { const char *fdtfile; @@ -441,6 +463,7 @@ static void get_board_rev(void) } printf("RPI %s (0x%x)\n", model->name, revision); + printf("boot regs: 0x%08x 0x%08x 0x%08x 0x%08x\n", boot_r0, boot_r1, boot_r2, boot_r3); } int board_init(void)