diff options
author | Simon Glass <sjg@chromium.org> | 2013-02-28 19:26:10 +0000 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2013-03-04 15:56:46 -0800 |
commit | 5e98947f9baa5bdc9b819d365f9f8ef65a9b1e4d (patch) | |
tree | 3837fd16321542d20d654442752b419d84514709 /arch/x86/cpu | |
parent | 2536850d7cd90bdb75bf3ff86838f913392b68db (diff) | |
download | u-boot-imx-5e98947f9baa5bdc9b819d365f9f8ef65a9b1e4d.zip u-boot-imx-5e98947f9baa5bdc9b819d365f9f8ef65a9b1e4d.tar.gz u-boot-imx-5e98947f9baa5bdc9b819d365f9f8ef65a9b1e4d.tar.bz2 |
x86: Add function to get top of usable ram
The memory layout calculations are done in calculate_relocation_address(),
and coreboot has its own version of this function. But in fact all we
really need is to set the top of usable RAM, and then the base version
will work as is.
So instead of allowing the whole calculate_relocation_address() function
to be replaced, create board_get_usable_ram_top() which can be used by
a board to specify the top of the area where U-Boot relocations to.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86/cpu')
-rw-r--r-- | arch/x86/cpu/coreboot/sdram.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c index 76274cb..a8136a0 100644 --- a/arch/x86/cpu/coreboot/sdram.c +++ b/arch/x86/cpu/coreboot/sdram.c @@ -60,12 +60,8 @@ unsigned install_e820_map(unsigned max_entries, struct e820entry *entries) * address, and how far U-Boot is moved by relocation are set in the global * data structure. */ -int calculate_relocation_address(void) +ulong board_get_usable_ram_top(ulong total_size) { - const uint64_t uboot_size = (uintptr_t)&__bss_end - - (uintptr_t)&__text_start; - const uint64_t total_size = uboot_size + CONFIG_SYS_MALLOC_LEN + - CONFIG_SYS_STACK_SIZE; uintptr_t dest_addr = 0; int i; @@ -87,21 +83,15 @@ int calculate_relocation_address(void) continue; /* Use this address if it's the largest so far. */ - if (end - uboot_size > dest_addr) + if (end > dest_addr) dest_addr = end; } /* If no suitable area was found, return an error. */ if (!dest_addr) - return 1; + panic("No available memory found for relocation"); - dest_addr -= uboot_size; - dest_addr &= ~((1 << 12) - 1); - gd->relocaddr = dest_addr; - gd->reloc_off = dest_addr - (uintptr_t)&__text_start; - gd->start_addr_sp = dest_addr - CONFIG_SYS_MALLOC_LEN; - - return 0; + return (ulong)dest_addr; } int dram_init_f(void) |