]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/x86/cpu/coreboot/sdram.c
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / arch / x86 / cpu / coreboot / sdram.c
index 76274cb88e3824ea3b066afffd7068c2b97832d8..786009c746d924255db184e22b998cc50de68c8e 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/u-boot-x86.h>
 #include <asm/global_data.h>
 #include <asm/processor.h>
+#include <asm/sections.h>
 #include <asm/arch/sysinfo.h>
 #include <asm/arch/tables.h>
 
@@ -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)