x86: Store the coreboot table address in global_data
authorSimon Glass <sjg@chromium.org>
Fri, 17 Jul 2020 03:22:34 +0000 (21:22 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 17 Jul 2020 06:32:24 +0000 (14:32 +0800)
At present this information is used to locate and parse the tables but is
not stored. Store it so that we can display it to the user, e.g. with the
'bdinfo' command.

Note that now the GD_FLG_SKIP_LL_INIT flag is set in get_coreboot_info(),
so it is always set when booting from coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
arch/x86/cpu/coreboot/tables.c
arch/x86/cpu/i386/cpu.c
arch/x86/include/asm/global_data.h

index a5d31d1..1594b4a 100644 (file)
@@ -10,6 +10,8 @@
 #include <net.h>
 #include <asm/arch/sysinfo.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /*
  * This needs to be in the .data section so that it's copied over during
  * relocation. By default it's put in the .bss section which is simply filled
@@ -243,6 +245,10 @@ int get_coreboot_info(struct sysinfo_t *info)
        if (addr < 0)
                return addr;
        ret = cb_parse_header((void *)addr, 0x1000, info);
+       if (!ret)
+               return -ENOENT;
+       gd->arch.coreboot_table = addr;
+       gd->flags |= GD_FLG_SKIP_LL_INIT;
 
-       return ret == 1 ? 0 : -ENOENT;
+       return 0;
 }
index d27324c..a6a6afe 100644 (file)
@@ -455,10 +455,15 @@ int x86_cpu_init_f(void)
 
 int x86_cpu_reinit_f(void)
 {
+       long addr;
+
        setup_identity();
        setup_pci_ram_top();
-       if (locate_coreboot_table() >= 0)
+       addr = locate_coreboot_table();
+       if (addr >= 0) {
+               gd->arch.coreboot_table = addr;
                gd->flags |= GD_FLG_SKIP_LL_INIT;
+       }
 
        return 0;
 }
index 5bc251c..3e40445 100644 (file)
@@ -123,6 +123,7 @@ struct arch_global_data {
 #endif
        void *itss_priv;                /* Private ITSS data pointer */
        ulong acpi_start;               /* Start address of ACPI tables */
+       ulong coreboot_table;           /* Address of coreboot table */
 };
 
 #endif