Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / x86 / cpu / i386 / cpu.c
index 2b27617ca3a466fdd0c827a28317753f7cf2d6d7..435e50edada7d368613c00a92442bb36a63c534b 100644 (file)
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <spl.h>
 #include <asm/control_regs.h>
+#include <asm/coreboot_tables.h>
 #include <asm/cpu.h>
 #include <asm/mp.h>
 #include <asm/msr.h>
@@ -135,10 +137,14 @@ void arch_setup_gd(gd_t *new_gd)
        /* DS: data, read/write, 4 GB, base 0 */
        gdt_addr[X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff);
 
-       /* FS: data, read/write, 4 GB, base (Global Data Pointer) */
+       /*
+        * FS: data, read/write, sizeof (Global Data Pointer),
+        * base (Global Data Pointer)
+        */
        new_gd->arch.gd_addr = new_gd;
-       gdt_addr[X86_GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0xc093,
-                    (ulong)&new_gd->arch.gd_addr, 0xfffff);
+       gdt_addr[X86_GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0x8093,
+                                       (ulong)&new_gd->arch.gd_addr,
+                                       sizeof(new_gd->arch.gd_addr) - 1);
 
        /* 16-bit CS: code, read/execute, 64 kB, base 0 */
        gdt_addr[X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x009b, 0, 0x0ffff);
@@ -446,6 +452,8 @@ int x86_cpu_reinit_f(void)
 {
        setup_identity();
        setup_pci_ram_top();
+       if (locate_coreboot_table() >= 0)
+               gd->flags |= GD_FLG_SKIP_LL_INIT;
 
        return 0;
 }
@@ -606,16 +614,6 @@ int cpu_jump_to_64bit_uboot(ulong target)
 
        func = (func_t)ptr;
 
-       /*
-        * Copy U-Boot from ROM
-        * TODO(sjg@chromium.org): Figure out a way to get the text base
-        * correctly here, and in the device-tree binman definition.
-        *
-        * Also consider using FIT so we get the correct image length and
-        * parameters.
-        */
-       memcpy((char *)target, (char *)0xfff00000, 0x100000);
-
        /* Jump to U-Boot */
        func((ulong)pgtable, 0, (ulong)target);