summaryrefslogtreecommitdiff
path: root/arch/x86/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/cpu')
-rw-r--r--arch/x86/cpu/apollolake/fsp_s.c2
-rw-r--r--arch/x86/cpu/coreboot/tables.c24
-rw-r--r--arch/x86/cpu/cpu.c4
-rw-r--r--arch/x86/cpu/i386/cpu.c27
-rw-r--r--arch/x86/cpu/i386/interrupt.c6
-rw-r--r--arch/x86/cpu/start_from_spl.S16
6 files changed, 59 insertions, 20 deletions
diff --git a/arch/x86/cpu/apollolake/fsp_s.c b/arch/x86/cpu/apollolake/fsp_s.c
index 17cf1682ad..7ef169b147 100644
--- a/arch/x86/cpu/apollolake/fsp_s.c
+++ b/arch/x86/cpu/apollolake/fsp_s.c
@@ -566,6 +566,8 @@ int arch_fsp_init_r(void)
struct udevice *dev, *itss;
int ret;
+ if (!ll_boot_init())
+ return 0;
/*
* This must be called before any devices are probed. Put any probing
* into arch_fsps_preinit() above.
diff --git a/arch/x86/cpu/coreboot/tables.c b/arch/x86/cpu/coreboot/tables.c
index 37e0424b5e..0f04c4f8e9 100644
--- a/arch/x86/cpu/coreboot/tables.c
+++ b/arch/x86/cpu/coreboot/tables.c
@@ -115,20 +115,11 @@ __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr)
static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
{
+ unsigned char *ptr = addr;
struct cb_header *header;
- unsigned char *ptr = (unsigned char *)addr;
int i;
- for (i = 0; i < len; i += 16, ptr += 16) {
- header = (struct cb_header *)ptr;
- if (!strncmp((const char *)header->signature, "LBIO", 4))
- break;
- }
-
- /* We walked the entire space and didn't find anything. */
- if (i >= len)
- return -1;
-
+ header = (struct cb_header *)ptr;
if (!header->table_bytes)
return 0;
@@ -231,10 +222,13 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
int get_coreboot_info(struct sysinfo_t *info)
{
- int ret = cb_parse_header((void *)0x00000000, 0x1000, info);
+ long addr;
+ int ret;
- if (ret != 1)
- ret = cb_parse_header((void *)0x000f0000, 0x1000, info);
+ addr = locate_coreboot_table();
+ if (addr < 0)
+ return addr;
+ ret = cb_parse_header((void *)addr, 0x1000, info);
- return (ret == 1) ? 0 : -1;
+ return ret == 1 ? 0 : -ENOENT;
}
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index cec04b481b..8526e856d7 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -239,8 +239,10 @@ int cpu_init_r(void)
struct udevice *dev;
int ret;
- if (!ll_boot_init())
+ if (!ll_boot_init()) {
+ uclass_first_device(UCLASS_PCI, &dev);
return 0;
+ }
ret = x86_init_cpus();
if (ret)
diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index c8da7f10e9..0312a26bbb 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -447,10 +447,37 @@ int x86_cpu_init_f(void)
return 0;
}
+long detect_coreboot_table_at(ulong start, ulong size)
+{
+ u32 *ptr, *end;
+
+ size /= 4;
+ for (ptr = (void *)start, end = ptr + size; ptr < end; ptr += 4) {
+ if (*ptr == 0x4f49424c) /* "LBIO" */
+ return (long)ptr;
+ }
+
+ return -ENOENT;
+}
+
+long locate_coreboot_table(void)
+{
+ long addr;
+
+ /* We look for LBIO in the first 4K of RAM and again at 960KB */
+ addr = detect_coreboot_table_at(0x0, 0x1000);
+ if (addr < 0)
+ addr = detect_coreboot_table_at(0xf0000, 0x1000);
+
+ return addr;
+}
+
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;
}
diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c
index 4c7e9ea215..e67a116ac1 100644
--- a/arch/x86/cpu/i386/interrupt.c
+++ b/arch/x86/cpu/i386/interrupt.c
@@ -264,6 +264,9 @@ int interrupt_init(void)
struct udevice *dev;
int ret;
+ if (!ll_boot_init())
+ return 0;
+
/* Try to set up the interrupt router, but don't require one */
ret = irq_first_device_type(X86_IRQT_BASE, &dev);
if (ret && ret != -ENODEV)
@@ -295,8 +298,7 @@ int interrupt_init(void)
* TODO(sjg@chromium.org): But we don't handle these correctly when
* booted from EFI.
*/
- if (ll_boot_init())
- enable_interrupts();
+ enable_interrupts();
#endif
return 0;
diff --git a/arch/x86/cpu/start_from_spl.S b/arch/x86/cpu/start_from_spl.S
index 22cab2dd6c..905c825cdc 100644
--- a/arch/x86/cpu/start_from_spl.S
+++ b/arch/x86/cpu/start_from_spl.S
@@ -14,18 +14,30 @@
.globl _start
.type _start, @function
_start:
- /* Set up memory using the existing stack */
+ /*
+ * If running from coreboot, CAR is no-longer available. Use the
+ * existing stack, which is large enough.
+ */
+ call locate_coreboot_table
+ cmp $0, %eax
+ jge use_existing_stack
+
movl $(CONFIG_SYS_CAR_ADDR + CONFIG_SYS_CAR_SIZE - 4), %eax
#ifdef CONFIG_DCACHE_RAM_MRC_VAR_SIZE
subl $CONFIG_DCACHE_RAM_MRC_VAR_SIZE, %eax
#endif
+ jmp 2f
/*
- * We don't subject CONFIG_DCACHE_RAM_MRC_VAR_SIZE since memory is
+ * We don't subtract CONFIG_DCACHE_RAM_MRC_VAR_SIZE since memory is
* already set up. This has the happy side-effect of putting gd in a
* new place separate from SPL, so the memset() in
* board_init_f_init_reserve() does not cause any problems (otherwise
* it would zero out the gd and crash)
*/
+ /* Set up memory using the existing stack */
+use_existing_stack:
+ mov %esp, %eax
+2:
call board_init_f_alloc_reserve
mov %eax, %esp