Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13335
-gerrit
commit d2533c99e44a8ae10127847b531421876bd68a99
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Thu Oct 29 17:48:14 2015 -0700
drivers/intel/fsp2_0: Define tentative coreboot <-> FSP 2.0 API
This defines the initial API between coreboot and FSP 2.0. The design
attempts to abstract from the common code as much of the FSP details
as possible.
Change-Id: I57f629eecb259cbe10c489d5dae56afe260b5197
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/drivers/intel/fsp2_0/include/fsp/api.h | 43 ++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/src/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h
new file mode 100644
index 0000000..75dcffe
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/include/fsp/api.h
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _FSP2_0_API_H_
+#define _FSP2_0_API_H_
+
+#include "FspUpdVpd.h"
+
+enum fsp_status {
+ FSP_SUCCESS = 0x00000000,
+ FSP_INVALID_PARAMETER = 0x80000002,
+ FSP_UNSUPPORTED = 0x80000003,
+ FSP_NOT_READY = 0x80000006,
+ FSP_DEVICE_ERROR = 0x80000007,
+ FSP_OUT_OF_RESOURCES = 0x80000009,
+ FSP_VOLUME_CORRUPTED = 0x8000000a,
+ FSP_NOT_FOUND = 0x8000000a,
+ FSP_TIMEOUT = 0x80000012,
+ FSP_ABORTED = 0x80000015,
+ FSP_INCOMPATIBLE_VERSION = 0x80000010,
+ FSP_SECURITY_VIOLATION = 0x8000001a,
+ FSP_CRC_ERROR = 0x8000001b,
+};
+
+/* Main FSP stages */
+enum fsp_status fsp_memory_init(void);
+enum fsp_status fsp_silicon_init(void);
+enum fsp_status fsp_notify(void);
+
+/* Callbacks for updating stage-specific parameters */
+void platform_fsp_memory_init_params_cb(struct MEMORY_INIT_UPD *memupd);
+void platform_fsp_silicon_init_params_cb(struct SILICON_INIT_UPD *silupd);
+
+#endif /* _FSP2_0_API_H_ */
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13341
-gerrit
commit af790f746fc5ebb6d24e956404698dbf935f0c74
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Mon Nov 2 15:18:34 2015 -0800
soc/apollolake: Implement post-raminit romstage and ramstage entry
In order to decompress ramstage, romstage needs significantly larger
stack than originally set up. To do this, we switch the stack to
memory right after raminit is done.
The new stack is allocated in a fashion similar to other soc
platforms, by reserving it in CBMEM.
Change-Id: I068c283a90f318ce9ee2ad370c3fc2ccb1f8a746
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/soc/intel/apollolake/Kconfig | 10 ++++++++
src/soc/intel/apollolake/include/soc/romstage.h | 3 ++-
src/soc/intel/apollolake/romstage/entry.inc | 13 ++++++++++
src/soc/intel/apollolake/romstage/romstage.c | 33 ++++++++++++++++++++++---
4 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index 8bc7ad4..eb9bd79 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -72,6 +72,16 @@ config DCACHE_RAM_BOOTBLOCK_STACK_SIZE
The amount of anticipated stack usage from the bootblock during
pre-romstage initialization.
+config ROMSTAGE_RAM_STACK_SIZE
+ hex
+ default 0x5000
+ help
+ The size of the romstage stack after memory is available. Because CAR
+ space is very crowded, only a very limited part of CAR is available
+ for stack. More than that is needed to decompress ramstage. This
+ variable indicates how much RAM to reserve for the stack after
+ raminit. The stack is automatically switched after romstage_main().
+
config IFD_BIOS_START
hex
default 0x1000
diff --git a/src/soc/intel/apollolake/include/soc/romstage.h b/src/soc/intel/apollolake/include/soc/romstage.h
index f57f26d..eb69558 100644
--- a/src/soc/intel/apollolake/include/soc/romstage.h
+++ b/src/soc/intel/apollolake/include/soc/romstage.h
@@ -15,6 +15,7 @@
#include <arch/cpu.h>
-asmlinkage void romstage_entry(void);
+asmlinkage void *romstage_entry(void);
+asmlinkage void romstage_after_raminit(void);
#endif /* _SOC_APOLLOLAKE_ROMSTAGE_H_ */
diff --git a/src/soc/intel/apollolake/romstage/entry.inc b/src/soc/intel/apollolake/romstage/entry.inc
index b04e17e..8c0670c 100644
--- a/src/soc/intel/apollolake/romstage/entry.inc
+++ b/src/soc/intel/apollolake/romstage/entry.inc
@@ -19,3 +19,16 @@ apollolake_entry:
mov esp, (CONFIG_DCACHE_RAM_BASE + 0x4000)
call romstage_entry
+
+ /*
+ * eax contains pointer to a region in RAM that we've been given the go
+ * ahead to use as stack. The old stack is empty at this point, so we
+ * don't have to relocate anything.
+ */
+ mov esp, eax
+
+ /*
+ * TODO: set up temporary cache for RAM
+ * We can't tear down CAR yet because romstage resides in CAR.
+ */
+ call romstage_after_raminit
diff --git a/src/soc/intel/apollolake/romstage/romstage.c b/src/soc/intel/apollolake/romstage/romstage.c
index 99953fd..6efbdd5 100644
--- a/src/soc/intel/apollolake/romstage/romstage.c
+++ b/src/soc/intel/apollolake/romstage/romstage.c
@@ -12,6 +12,8 @@
*/
#include <arch/io.h>
+#include <cbfs.h>
+#include <cbmem.h>
#include <console/console.h>
#include <cpu/x86/msr.h>
#include <device/pci_def.h>
@@ -50,7 +52,26 @@ static void soc_early_romstage_init(void)
pci_write_config32(PCI_DEV(0, 13, 0), 0x60, 1<<7);
}
-asmlinkage void romstage_entry(void)
+static void *alloc_stack_in_ram(void)
+{
+ uint8_t *ram_stack = cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
+ CONFIG_ROMSTAGE_RAM_STACK_SIZE);
+
+ /*
+ * If cbmem fails to give us a memory window, try to get a stack at
+ * 2 MiB, and hope we can go forward. The 2 MiB address is arbitrary.
+ */
+ if (ram_stack == NULL) {
+ printk(BIOS_ALERT, "Could not find place for stack\n");
+ return (void *)(2 * MiB);
+ }
+
+ /* The initial stack pointer should point at the top of the region */
+ ram_stack += CONFIG_ROMSTAGE_RAM_STACK_SIZE - sizeof(size_t);
+ return ram_stack;
+}
+
+asmlinkage void* romstage_entry(void)
{
/* Be careful. Bootblock might already have initialized the console */
if (!IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE)) {
@@ -64,7 +85,11 @@ asmlinkage void romstage_entry(void)
fsp_memory_init();
- /* This function must not return */
- while(1)
- ;
+ cbmem_initialize_empty();
+ return alloc_stack_in_ram();
+}
+
+asmlinkage void romstage_after_raminit(void)
+{
+ run_ramstage();
}
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13340
-gerrit
commit ec7d5f0b23a4be285e5743f88c2cadaa625d02ff
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Wed Oct 28 13:02:59 2015 -0700
soc/apollolake: Call into FSP memory init
This is suficient to initialize memory as long as the UPD in the FSP
binary matched the platform. A mechanism to provide platform-specific
UPD data is not implemented in this patch.
Change-Id: Ib500095ed5b73174f74e72a372529b095c4f8411
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/soc/intel/apollolake/romstage/romstage.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/soc/intel/apollolake/romstage/romstage.c b/src/soc/intel/apollolake/romstage/romstage.c
index 2cbf4a9..99953fd 100644
--- a/src/soc/intel/apollolake/romstage/romstage.c
+++ b/src/soc/intel/apollolake/romstage/romstage.c
@@ -15,6 +15,7 @@
#include <console/console.h>
#include <cpu/x86/msr.h>
#include <device/pci_def.h>
+#include <fsp/api.h>
#include <soc/iomap.h>
#include <soc/romstage.h>
#include <soc/uart.h>
@@ -61,6 +62,8 @@ asmlinkage void romstage_entry(void)
soc_early_romstage_init();
+ fsp_memory_init();
+
/* This function must not return */
while(1)
;
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13342
-gerrit
commit 23a9dc12ab34bcf2f0af952bc18fed618a89c8bb
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Wed Nov 4 16:25:47 2015 -0800
soc/apollolake: Add chip_operations structure to enable bus scans
With the chip_operations structure in place, PCI enumeration now works
in ramstage.
Change-Id: I9a39f4d6d7233a9cc696c71e96e0c17d4db3c925
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/soc/intel/apollolake/Makefile.inc | 1 +
src/soc/intel/apollolake/chip.c | 52 +++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/src/soc/intel/apollolake/Makefile.inc b/src/soc/intel/apollolake/Makefile.inc
index 7cddf5a..63c39b3 100644
--- a/src/soc/intel/apollolake/Makefile.inc
+++ b/src/soc/intel/apollolake/Makefile.inc
@@ -23,6 +23,7 @@ romstage-y += mmap_boot.c
romstage-y += romstage/romstage.c
romstage-y += uart_early.c
+ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += gpio.c
ramstage-y += memmap.c
diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c
new file mode 100644
index 0000000..2b6384a
--- /dev/null
+++ b/src/soc/intel/apollolake/chip.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <cpu/cpu.h>
+#include <device/device.h>
+#include <device/pci.h>
+
+static struct device_operations pci_domain_ops = {
+ .read_resources = pci_domain_read_resources,
+ .set_resources = DEVICE_NOOP,
+ .enable_resources = NULL,
+ .init = NULL,
+ .scan_bus = pci_domain_scan_bus,
+ .ops_pci_bus = pci_bus_default_ops,
+};
+
+static void cpu_bus_init(device_t dev)
+{
+ initialize_cpus(dev->link_list);
+}
+
+static struct device_operations cpu_bus_ops = {
+ .read_resources = DEVICE_NOOP,
+ .set_resources = DEVICE_NOOP,
+ .enable_resources = DEVICE_NOOP,
+ .init = cpu_bus_init,
+ .scan_bus = 0,
+};
+
+static void enable_dev(device_t dev)
+{
+ /* Set the operations if it is a special bus type */
+ if (dev->path.type == DEVICE_PATH_DOMAIN) {
+ dev->ops = &pci_domain_ops;
+ } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
+ dev->ops = &cpu_bus_ops;
+ }
+}
+
+struct chip_operations soc_intel_apollolake_ops = {
+ CHIP_NAME("Intel Apollolake SOC")
+ .enable_dev = &enable_dev,
+};