X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=blobdiff_plain;f=arch%2Fx86%2Fcpu%2Fcoreboot%2Fsdram.c;h=786009c746d924255db184e22b998cc50de68c8e;hp=76274cb88e3824ea3b066afffd7068c2b97832d8;hb=8dc16cf9dd6196d99969d12741df186a61a2f9a3;hpb=96764df1b47ddebfb50fadf5af72530b07b5fc89 diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c index 76274cb88e..786009c746 100644 --- a/arch/x86/cpu/coreboot/sdram.c +++ b/arch/x86/cpu/coreboot/sdram.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -60,12 +61,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 +84,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)