diff --git a/3rdparty/fsp b/3rdparty/fsp
index 1d2b7e1a94..59964173e1 160000
--- a/3rdparty/fsp
+++ b/3rdparty/fsp
@@ -1 +1 @@
-Subproject commit 1d2b7e1a94c6a7c25a6fed1ac37caebf500f5f1a
+Subproject commit 59964173e18950debcc6b8856c5c928935ce0b4f
diff --git a/Documentation/arch/x86/index.md b/Documentation/arch/x86/index.md
index 3ecb9803a4..73c982385a 100644
--- a/Documentation/arch/x86/index.md
+++ b/Documentation/arch/x86/index.md
@@ -2,6 +2,8 @@
This section contains documentation about coreboot on x86 architecture.
+* [x86 PAE support](pae.md)
+
## State of x86_64 support
At the moment there's no single board that supports x86_64 or to be exact
`ARCH_RAMSTAGE_X86_64` and `ARCH_ROMSTAGE_X86_64`.
diff --git a/Documentation/arch/x86/pae.md b/Documentation/arch/x86/pae.md
new file mode 100644
index 0000000000..54cd82f2e4
--- /dev/null
+++ b/Documentation/arch/x86/pae.md
@@ -0,0 +1,15 @@
+# x86_32 PAE documentation
+
+Due to missing x86_64 support it's required to use PAE enabled x86_32 code.
+The corresponding functions can be found in ``src/cpu/x86/pae/``.
+
+## Memory clearing helper functions
+
+To clear all DRAM on request of the
+[Security API](../../security/memory_clearing.md), a helper function can be used
+called `memset_pae`.
+The function has additional requirements in contrast to `memset`, and has more
+overhead as it uses virtual memory to access memory above 4GiB.
+Memory is cleared in 2MiB chunks, which might take a while.
+
+Make sure to enable caches through MTRRs, otherwise `memset_pae` will be slow!
diff --git a/Documentation/security/memory_clearing.md b/Documentation/security/memory_clearing.md
index 3d985925d9..e5c19256b9 100644
--- a/Documentation/security/memory_clearing.md
+++ b/Documentation/security/memory_clearing.md
@@ -42,3 +42,7 @@ Without MTRRs (and caches enabled) clearing memory takes multiple seconds.
As some platforms place code and stack in DRAM (FSP1.0), the regions can be
skipped.
+
+## Architecture specific implementations
+
+* [x86 PAE](../arch/x86/pae.md)
diff --git a/Documentation/soc/intel/fsp/index.md b/Documentation/soc/intel/fsp/index.md
index d7f44c6dee..6269445ff3 100644
--- a/Documentation/soc/intel/fsp/index.md
+++ b/Documentation/soc/intel/fsp/index.md
@@ -2,6 +2,39 @@
This section contains documentation about Intel-FSP in public domain.
+## Bugs
+As Intel doesn't even list known bugs, they are collected here until
+those are fixed. If possible a workaround is described here as well.
+
+### BroadwellDEFsp
+
+* IA32_FEATURE_CONTROL MSR is locked in FSP-M
+ * Release MR2
+ * Writing the MSR is required in ramstage for Intel TXT
+ * Workaround: none
+ * Issue on public tracker: [Issue 10]
+
+* FSP-S asserts if the thermal PCI device 00:1f.6 is disabled
+ * Release MR2
+ * FSP expects the PCI device to be enabled
+ * FSP expects BARs to be properly assigned
+ * Workaround: Don't disable this PCI device
+ * Issue on public tracker: [Issue 13]
+
+### KabylakeFsp
+* MfgId and ModulePartNum in the DIMM_INFO struct are empty
+ * Release 3.7.1
+ * Those values are typically consumed by SMBIOS type 17
+ * Workaround: none
+ * Issue on public tracker: [Issue 22]
+
+### BraswellFsp
+* Internal UART can't be disabled using PcdEnableHsuart*
+ * Release MR2
+ * Workaround: Disable internal UART manually after calling FSP
+ * Issue on public tracker: [Issue 10]
+
+
## Open Source Intel FSP specification
* [About Intel FSP](https://firmware.intel.com/learn/fsp/about-intel-fsp)
@@ -15,3 +48,13 @@ This section contains documentation about Intel-FSP in public domain.
## Additional Features in FSP 2.1 specification
- [PPI](ppi/ppi.md)
+
+## Official bugtracker
+
+- [IntelFSP/FSP](https://github.com/IntelFsp/FSP/issues)
+
+[Issue 10]: https://github.com/IntelFsp/FSP/issues/10
+[Issue 13]: https://github.com/IntelFsp/FSP/issues/13
+[Issue 15]: https://github.com/IntelFsp/FSP/issues/15
+[Issue 22]: https://github.com/IntelFsp/FSP/issues/22
+
diff --git a/Documentation/soc/intel/mp_init/mp_init.md b/Documentation/soc/intel/mp_init/mp_init.md
index f81ffc143e..7284e8a1c5 100644
--- a/Documentation/soc/intel/mp_init/mp_init.md
+++ b/Documentation/soc/intel/mp_init/mp_init.md
@@ -27,9 +27,9 @@ Considering these facts, there are 3 possible solutions to perform MP
initialization from coreboot + FSP space.
1. coreboot to perform complete MP initialization by its own. This includes
-BSP and AP programming of CPU features mostly non-restricted one. Preferred
-Kconfig is USE_COREBOOT_NATIVE_MP_INIT. SoCs like SKL, KBL, APL are okay to
-make use of same Kconfig option for MP initialization.
+BSP and AP programming of CPU features mostly non-restricted one. This is
+the default configuration. Most SoCs like SKL, KBL, APL are okay to make use
+of this MP initialization method.
2. Alternatively, SoC users also can skip coreboot doing MP initialization
and make use of FSP binary to perform same task. This can be achieved by using
diff --git a/Makefile.inc b/Makefile.inc
index 362243eb6a..28f1363131 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -514,6 +514,7 @@ FMAPTOOL:=$(objutil)/cbfstool/fmaptool
RMODTOOL:=$(objutil)/cbfstool/rmodtool
IFWITOOL:=$(objutil)/cbfstool/ifwitool
IFITTOOL:=$(objutil)/cbfstool/ifittool
+AMDCOMPRESS:=$(objutil)/cbfstool/amdcompress
$(obj)/cbfstool: $(CBFSTOOL)
cp $< $@
@@ -530,6 +531,9 @@ $(obj)/ifwitool: $(IFWITOOL)
$(obj)/ifittool: $(IFITTOOL)
cp $< $@
+$(obj)/amdcompress: $(AMDCOMPRESS)
+ cp $< $@
+
_WINCHECK=$(shell uname -o 2> /dev/null)
STACK=
ifeq ($(_WINCHECK),Msys)
@@ -642,7 +646,7 @@ install-git-commit-clangfmt:
include util/crossgcc/Makefile.inc
.PHONY: tools
-tools: $(objutil)/kconfig/conf $(CBFSTOOL) $(objutil)/cbfstool/cbfs-compression-tool $(FMAPTOOL) $(RMODTOOL) $(IFWITOOL) $(objutil)/nvramtool/nvramtool $(ROMCC_BIN) $(objutil)/sconfig/sconfig $(IFDTOOL) $(CBOOTIMAGE) $(AMDFWTOOL) $(FUTILITY) $(BINCFG) $(IFITTOOL)
+tools: $(objutil)/kconfig/conf $(CBFSTOOL) $(objutil)/cbfstool/cbfs-compression-tool $(FMAPTOOL) $(RMODTOOL) $(IFWITOOL) $(objutil)/nvramtool/nvramtool $(ROMCC_BIN) $(objutil)/sconfig/sconfig $(IFDTOOL) $(CBOOTIMAGE) $(AMDFWTOOL) $(AMDCOMPRESS) $(FUTILITY) $(BINCFG) $(IFITTOOL)
###########################################################################
# Common recipes for all stages
diff --git a/configs/config.lenovo_t400_all_debug_and_option_table b/configs/config.lenovo_t400_all_debug_and_option_table
index 0ceee167d5..dc407478c7 100644
--- a/configs/config.lenovo_t400_all_debug_and_option_table
+++ b/configs/config.lenovo_t400_all_debug_and_option_table
@@ -7,7 +7,6 @@ CONFIG_DEBUG_CBFS=y
CONFIG_DEBUG_RAM_SETUP=y
CONFIG_DEBUG_SMBUS=y
CONFIG_DEBUG_SMI=y
-CONFIG_DEBUG_SMM_RELOCATION=y
CONFIG_DEBUG_MALLOC=y
CONFIG_DEBUG_ACPI=y
CONFIG_DEBUG_BOOT_STATE=y
diff --git a/configs/config.lenovo_thinkpad_t430_all_debug_and_option_table b/configs/config.lenovo_thinkpad_t430_all_debug_and_option_table
index 2c387340cf..cb1da1e619 100644
--- a/configs/config.lenovo_thinkpad_t430_all_debug_and_option_table
+++ b/configs/config.lenovo_thinkpad_t430_all_debug_and_option_table
@@ -9,7 +9,6 @@ CONFIG_GENERIC_LINEAR_FRAMEBUFFER=y
CONFIG_DEBUG_RAM_SETUP=y
CONFIG_DEBUG_SMBUS=y
CONFIG_DEBUG_SMI=y
-CONFIG_DEBUG_SMM_RELOCATION=y
CONFIG_DEBUG_SPI_FLASH=y
CONFIG_DEBUG_BOOT_STATE=y
CONFIG_DEBUG_ADA_CODE=y
diff --git a/configs/config.lenovo_x201_all_debug_option_table_bt_on_wifi b/configs/config.lenovo_x201_all_debug_option_table_bt_on_wifi
index 697c26db5d..1579aa3e1f 100644
--- a/configs/config.lenovo_x201_all_debug_option_table_bt_on_wifi
+++ b/configs/config.lenovo_x201_all_debug_option_table_bt_on_wifi
@@ -6,7 +6,6 @@ CONFIG_FATAL_ASSERTS=y
CONFIG_DEBUG_CBFS=y
CONFIG_DEBUG_SMBUS=y
CONFIG_DEBUG_SMI=y
-CONFIG_DEBUG_SMM_RELOCATION=y
CONFIG_DEBUG_MALLOC=y
CONFIG_DEBUG_ACPI=y
CONFIG_DEBUG_SPI_FLASH=y
diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile
index 50659d3c0b..1e9eb80d20 100644
--- a/payloads/coreinfo/Makefile
+++ b/payloads/coreinfo/Makefile
@@ -83,7 +83,8 @@ OBJCOPY := $(OBJCOPY_$(ARCH-y))
LPCC := CC="$(CC)" $(LIBPAYLOAD_OBJ)/bin/lpgcc
LPAS := AS="$(AS)" $(LIBPAYLOAD_OBJ)/bin/lpas
-CFLAGS += -Wall -Werror -Os -fno-builtin $(CFLAGS_$(ARCH-y)) $(INCLUDES)
+CFLAGS += -Wall -Wextra -Wmissing-prototypes -Werror
+CFLAGS += -Os -fno-builtin $(CFLAGS_$(ARCH-y)) $(INCLUDES)
ifneq ($(strip $(HAVE_DOTCONFIG)),)
include $(src)/.config
diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c
index d294288cf7..e56ce68ed6 100644
--- a/payloads/coreinfo/coreboot_module.c
+++ b/payloads/coreinfo/coreboot_module.c
@@ -37,7 +37,7 @@ static struct {
static int tables_good = 0;
-int coreboot_module_redraw(WINDOW *win)
+static int coreboot_module_redraw(WINDOW *win)
{
int row = 2;
int i;
@@ -195,7 +195,7 @@ static int parse_header(void *addr, int len)
/* Now, walk the tables. */
ptr += header->header_bytes;
- for (i = 0; i < header->table_entries; i++) {
+ for (u32 j = 0; j < header->table_entries; j++) {
struct cb_record *rec = (struct cb_record *)ptr;
switch (rec->tag) {
diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c
index 649bfde837..b731abfbf5 100644
--- a/payloads/coreinfo/coreinfo.c
+++ b/payloads/coreinfo/coreinfo.c
@@ -132,7 +132,7 @@ static void print_time_and_date(void)
static void print_menu(void)
{
- int i, j;
+ int j;
char menu[80];
char *ptr = menu;
@@ -140,11 +140,11 @@ static void print_menu(void)
for (j = 0; j < SCREEN_X; j++)
waddch(menuwin, ' ');
- for (i = 0; i < ARRAY_SIZE(categories); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(categories); i++) {
if (categories[i].count == 0)
continue;
- ptr += sprintf(ptr, "F%d: %s ", i + 1, categories[i].name);
+ ptr += sprintf(ptr, "F%zu: %s ", i + 1, categories[i].name);
}
mvwprintw(menuwin, 1, 0, menu);
@@ -215,9 +215,9 @@ static void handle_category_key(struct coreinfo_cat *cat, int key)
static void print_no_modules_selected(void)
{
- int height = getmaxy(stdscr), i;
+ int height = getmaxy(stdscr);
- for (i = 0; i < ARRAY_SIZE(categories); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(categories); i++)
if (categories[i].count > 0)
return;
@@ -227,9 +227,7 @@ static void print_no_modules_selected(void)
static int first_nonempty_category(void)
{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(categories); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(categories); i++)
if (categories[i].count > 0)
return i;
return 0;
@@ -268,7 +266,7 @@ static void loop(void)
if (key >= '1' && key <= '9')
ch = key - '1';
- if (ch >= 0 && ch <= ARRAY_SIZE(categories)) {
+ if (ch >= 0 && (unsigned int)ch <= ARRAY_SIZE(categories)) {
if (ch == ARRAY_SIZE(categories))
continue;
if (categories[ch].count == 0)
@@ -289,7 +287,7 @@ static void loop(void)
int main(void)
{
- int i, j;
+ int j;
if (CONFIG(LP_USB))
usb_initialize();
@@ -310,7 +308,7 @@ int main(void)
werase(modwin);
- for (i = 0; i < ARRAY_SIZE(categories); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(categories); i++) {
for (j = 0; j < categories[i].count; j++)
categories[i].modules[j]->init();
}
diff --git a/payloads/coreinfo/coreinfo.h b/payloads/coreinfo/coreinfo.h
index 073c5f9a87..03e59c9bb1 100644
--- a/payloads/coreinfo/coreinfo.h
+++ b/payloads/coreinfo/coreinfo.h
@@ -27,8 +27,7 @@ struct coreinfo_module {
int (*handle) (int);
};
-extern void docpuid(int, unsigned long *, unsigned long *, unsigned long *,
- unsigned long *);
+extern void docpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
void print_module_title(WINDOW *win, const char *title);
diff --git a/payloads/coreinfo/cpuinfo_module.c b/payloads/coreinfo/cpuinfo_module.c
index 0ea2dfce46..94379f3077 100644
--- a/payloads/coreinfo/cpuinfo_module.c
+++ b/payloads/coreinfo/cpuinfo_module.c
@@ -85,7 +85,7 @@ static const char *amd_cap_extended_ecx_flags[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
-static unsigned long vendor;
+static uint32_t vendor;
static unsigned int cpu_khz;
static void decode_flags(WINDOW *win, unsigned long reg, const char **flags,
@@ -114,7 +114,7 @@ static void decode_flags(WINDOW *win, unsigned long reg, const char **flags,
static void get_features(WINDOW *win, int *row)
{
- unsigned long eax, ebx, ecx, edx;
+ uint32_t eax, ebx, ecx, edx;
int lrow = *row;
wmove(win, lrow++, 1);
@@ -150,12 +150,12 @@ static void get_features(WINDOW *win, int *row)
static void do_name(WINDOW *win, int row)
{
char name[49], *p;
- unsigned long eax, ebx, ecx, edx;
- int i, t;
+ uint32_t eax, ebx, ecx, edx;
+ int t;
p = name;
- for (i = 0x80000002; i <= 0x80000004; i++) {
+ for (uint32_t i = 0x80000002; i <= 0x80000004; i++) {
docpuid(i, &eax, &ebx, &ecx, &edx);
if (eax == 0)
@@ -176,7 +176,7 @@ static void do_name(WINDOW *win, int row)
static int cpuinfo_module_redraw(WINDOW *win)
{
- unsigned long eax, ebx, ecx, edx;
+ uint32_t eax, ebx, ecx, edx;
unsigned int brand;
char *vstr;
int row = 2;
diff --git a/payloads/coreinfo/multiboot_module.c b/payloads/coreinfo/multiboot_module.c
index e394dbd732..865561d973 100644
--- a/payloads/coreinfo/multiboot_module.c
+++ b/payloads/coreinfo/multiboot_module.c
@@ -32,7 +32,7 @@ static struct {
static int tables_good = 0;
-int multiboot_module_redraw(WINDOW *win)
+static int multiboot_module_redraw(WINDOW *win)
{
int row = 2;
int i;
diff --git a/payloads/coreinfo/pci_module.c b/payloads/coreinfo/pci_module.c
index 3060161fe0..cb53ed69f7 100644
--- a/payloads/coreinfo/pci_module.c
+++ b/payloads/coreinfo/pci_module.c
@@ -51,7 +51,7 @@ static void swap(struct pci_devices *a, struct pci_devices *b)
static int partition(struct pci_devices *list, int len)
{
- int val = list[len / 2].device;
+ pcidev_t val = list[len / 2].device;
int index = 0;
int i;
diff --git a/payloads/coreinfo/timestamps_module.c b/payloads/coreinfo/timestamps_module.c
index fe2d2b5c6b..5468844f89 100644
--- a/payloads/coreinfo/timestamps_module.c
+++ b/payloads/coreinfo/timestamps_module.c
@@ -29,9 +29,7 @@ static unsigned long tick_freq_mhz;
static const char *timestamp_name(uint32_t id)
{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(timestamp_ids); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(timestamp_ids); i++) {
if (timestamp_ids[i].id == id)
return timestamp_ids[i].name;
}
@@ -184,7 +182,7 @@ static int timestamps_module_init(void)
prev_stamp = base_time;
total_time = 0;
- for (int i = 0; i < n_entries; i++) {
+ for (u32 i = 0; i < n_entries; i++) {
uint64_t stamp;
const struct timestamp_entry *tse = ×tamps->entries[i];
diff --git a/payloads/external/GRUB2/Kconfig b/payloads/external/GRUB2/Kconfig
index c4edab9d11..552f06a523 100644
--- a/payloads/external/GRUB2/Kconfig
+++ b/payloads/external/GRUB2/Kconfig
@@ -5,7 +5,7 @@ choice
default GRUB2_STABLE
config GRUB2_STABLE
- bool "2.02"
+ bool "2.04"
help
Stable GRUB2 version
diff --git a/payloads/external/GRUB2/Makefile b/payloads/external/GRUB2/Makefile
index 31c40665fe..43da597eb7 100644
--- a/payloads/external/GRUB2/Makefile
+++ b/payloads/external/GRUB2/Makefile
@@ -1,9 +1,9 @@
TAG-$(CONFIG_GRUB2_MASTER)=
TAG-$(CONFIG_GRUB2_REVISION)=$(CONFIG_GRUB2_REVISION_ID)
-TAG-$(CONFIG_GRUB2_STABLE)=e54c99aaff5e5f6f5d3b06028506c57e66d8ef77
+TAG-$(CONFIG_GRUB2_STABLE)=grub-2.04
NAME-$(CONFIG_GRUB2_MASTER)=HEAD
NAME-$(CONFIG_GRUB2_REVISION)=$(CONFIG_GRUB2_REVISION_ID)
-NAME-$(CONFIG_GRUB2_STABLE)=2.02
+NAME-$(CONFIG_GRUB2_STABLE)=2.04
project_git_repo=https://git.savannah.gnu.org/git/grub.git/
project_dir=grub2
@@ -28,7 +28,7 @@ grub2/build/config.h: $(CONFIG_DEP) | checkout
echo " CONFIG GRUB2 $(NAME-y)"
rm -rf grub2/build
mkdir grub2/build
- cd grub2 && ./autogen.sh
+ cd grub2 && ./bootstrap.sh ; ./autogen.sh
cd grub2/build && ../configure CC="$(HOSTCC)" LD="$(LD)" \
FREETYPE="pkg-config freetype2" BUILD_FREETYPE="pkg-config freetype2" \
TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" \
diff --git a/payloads/external/Memtest86Plus/Makefile b/payloads/external/Memtest86Plus/Makefile
index 4b3132ddf5..b799f9ea71 100644
--- a/payloads/external/Memtest86Plus/Makefile
+++ b/payloads/external/Memtest86Plus/Makefile
@@ -15,7 +15,7 @@
TAG-$(CONFIG_MEMTEST_MASTER)=origin/master
NAME-$(CONFIG_MEMTEST_MASTER)=Master
-TAG-$(CONFIG_MEMTEST_STABLE)=3754fd440f4009b62244e0f95c56bbb12c2fffcb
+TAG-$(CONFIG_MEMTEST_STABLE)=0bd34c22604660e4283316331f3e7bf8a3863753
NAME-$(CONFIG_MEMTEST_STABLE)=Stable
TAG-$(CONFIG_MEMTEST_REVISION)=$(CONFIG_MEMTEST_REVISION_ID)
diff --git a/payloads/libpayload/Makefile.inc b/payloads/libpayload/Makefile.inc
index 7787762b43..1fa07f9a7a 100644
--- a/payloads/libpayload/Makefile.inc
+++ b/payloads/libpayload/Makefile.inc
@@ -130,6 +130,7 @@ junit.xml:
echo '' > $@.tmp
for i in $(filter-out %.old,$(wildcard configs/*)); do \
$(MAKE) clean; \
+ echo "Building libpayload for $$i"; \
cp "$$i" junit_config; \
$(MAKE) olddefconfig DOTCONFIG=junit_config V=$(V) Q=$(Q) 2>/dev/null >/dev/null; \
echo "" >> $@.tmp; \
@@ -146,6 +147,7 @@ junit.xml:
echo "" >> $@.tmp; \
done
echo "" >> $@.tmp
+ echo "libpayload build complete, test results in $@"
mv $@.tmp $@
test-configs:
diff --git a/payloads/libpayload/drivers/usb/dwc2.c b/payloads/libpayload/drivers/usb/dwc2.c
index 34de3bc42b..963ae84762 100644
--- a/payloads/libpayload/drivers/usb/dwc2.c
+++ b/payloads/libpayload/drivers/usb/dwc2.c
@@ -146,6 +146,8 @@ static int dwc2_disconnected(hci_t *controller)
return !(hprt.prtena && hprt.prtconnsts);
}
+#define DWC2_SLEEP_TIME_US 5
+
/*
* This function returns the actual transfer length when the transfer succeeded
* or an error code if the transfer failed
@@ -157,14 +159,14 @@ wait_for_complete(endpoint_t *ep, uint32_t ch_num)
hcchar_t hcchar;
hctsiz_t hctsiz;
dwc2_reg_t *reg = DWC2_REG(ep->dev->controller);
- int timeout = 600000; /* time out after 600000 * 5us == 3s */
+ int timeout = USB_MAX_PROCESSING_TIME_US / DWC2_SLEEP_TIME_US;
/*
* TODO: We should take care of up to three times of transfer error
* retry here, according to the USB 2.0 spec 4.5.2
*/
do {
- udelay(5);
+ udelay(DWC2_SLEEP_TIME_US);
hcint.d32 = readl(®->host.hchn[ch_num].hcintn);
hctsiz.d32 = readl(®->host.hchn[ch_num].hctsizn);
@@ -374,12 +376,15 @@ static int dwc2_need_split(usbdev_t *dev, split_info_t *split)
return 1;
}
+#define USB_FULL_LOW_SPEED_FRAME_US 1000
+
static int
dwc2_transfer(endpoint_t *ep, int size, int pid, ep_dir_t dir, uint32_t ch_num,
u8 *src, uint8_t skip_nak)
{
split_info_t split;
- int ret, short_pkt, transferred = 0, timeout = 3000;
+ int ret, short_pkt, transferred = 0;
+ int timeout = USB_MAX_PROCESSING_TIME_US / USB_FULL_LOW_SPEED_FRAME_US;
ep->toggle = pid;
@@ -393,11 +398,11 @@ nak_retry:
/*
* dwc2_split_transfer() waits for the next FullSpeed
- * frame boundary, so we have one try per millisecond.
- * It's 3s timeout for each split transfer.
+ * frame boundary, so we only need to delay 500 us
+ * here to have one try per millisecond.
*/
if (ret == -HCSTAT_NAK && !skip_nak && --timeout) {
- udelay(500);
+ udelay(USB_FULL_LOW_SPEED_FRAME_US / 2);
goto nak_retry;
}
} else {
diff --git a/payloads/libpayload/drivers/usb/ehci.c b/payloads/libpayload/drivers/usb/ehci.c
index 3d6c077b31..68763402af 100644
--- a/payloads/libpayload/drivers/usb/ehci.c
+++ b/payloads/libpayload/drivers/usb/ehci.c
@@ -247,6 +247,8 @@ static void free_qh_and_tds(ehci_qh_t *qh, qtd_t *cur)
free((void *)qh);
}
+#define EHCI_SLEEP_TIME_US 50
+
static int wait_for_tds(qtd_t *head)
{
/* returns the amount of bytes *not* transmitted, or -1 for error */
@@ -256,18 +258,10 @@ static int wait_for_tds(qtd_t *head)
if (0) dump_td(virt_to_phys(cur));
/* wait for results */
- /* how long to wait?
- * tested with some USB2.0 flash sticks:
- * TUR turn around took
- * about 2.2s for the slowest (13fe:3800)
- * max. 250ms for the others
- * slowest non-TUR turn around took about 1.3s
- * set to 3s to be safe as a failed TUR can be fatal
- */
- int timeout = 60000; /* time out after 60000 * 50us == 3s */
+ int timeout = USB_MAX_PROCESSING_TIME_US / EHCI_SLEEP_TIME_US;
while ((cur->token & QTD_ACTIVE) && !(cur->token & QTD_HALTED)
&& timeout--)
- udelay(50);
+ udelay(EHCI_SLEEP_TIME_US);
if (timeout < 0) {
usb_debug("Error: ehci: queue transfer "
"processing timed out.\n");
diff --git a/payloads/libpayload/drivers/usb/ohci.c b/payloads/libpayload/drivers/usb/ohci.c
index ecd1084005..f1dc081656 100644
--- a/payloads/libpayload/drivers/usb/ohci.c
+++ b/payloads/libpayload/drivers/usb/ohci.c
@@ -292,14 +292,13 @@ ohci_stop (hci_t *controller)
OHCI_INST (controller)->opreg->HcControl &= ~PeriodicListEnable;
}
+#define OHCI_SLEEP_TIME_US 1000
+
static int
wait_for_ed(usbdev_t *dev, ed_t *head, int pages)
{
/* wait for results */
- /* TOTEST: how long to wait?
- * give 2s per TD (2 pages) plus another 2s for now
- */
- int timeout = pages*1000 + 2000;
+ int timeout = USB_MAX_PROCESSING_TIME_US / OHCI_SLEEP_TIME_US;
while (((head->head_pointer & ~3) != head->tail_pointer) &&
!(head->head_pointer & 1) &&
((((td_t*)phys_to_virt(head->head_pointer & ~3))->config
@@ -315,9 +314,9 @@ wait_for_ed(usbdev_t *dev, ed_t *head, int pages)
((td_t*)phys_to_virt(head->head_pointer & ~3))->next_td,
head->tail_pointer,
(((td_t*)phys_to_virt(head->head_pointer & ~3))->config & TD_CC_MASK) >> TD_CC_SHIFT);
- mdelay(1);
+ udelay(OHCI_SLEEP_TIME_US);
}
- if (timeout < 0)
+ if (timeout <= 0)
usb_debug("Error: ohci: endpoint "
"descriptor processing timed out.\n");
/* Clear the done queue. */
diff --git a/payloads/libpayload/drivers/usb/uhci.c b/payloads/libpayload/drivers/usb/uhci.c
index e62fd25a2d..32d40901a0 100644
--- a/payloads/libpayload/drivers/usb/uhci.c
+++ b/payloads/libpayload/drivers/usb/uhci.c
@@ -272,21 +272,23 @@ uhci_stop (hci_t *controller)
uhci_reg_read16(controller, USBCMD) & ~1); // stop work on schedule
}
+#define UHCI_SLEEP_TIME_US 30
+#define UHCI_TIMEOUT (USB_MAX_PROCESSING_TIME_US / UHCI_SLEEP_TIME_US)
#define GET_TD(x) ((void*)(((unsigned int)(x))&~0xf))
static td_t *
wait_for_completed_qh (hci_t *controller, qh_t *qh)
{
- int timeout = 1000; /* max 30 ms. */
+ int timeout = UHCI_TIMEOUT;
void *current = GET_TD (qh->elementlinkptr);
while (((qh->elementlinkptr & FLISTP_TERMINATE) == 0) && (timeout-- > 0)) {
if (current != GET_TD (qh->elementlinkptr)) {
current = GET_TD (qh->elementlinkptr);
- timeout = 1000;
+ timeout = UHCI_TIMEOUT;
}
uhci_reg_write16(controller, USBSTS,
uhci_reg_read16(controller, USBSTS) | 0); // clear resettable registers
- udelay (30);
+ udelay(UHCI_SLEEP_TIME_US);
}
return (GET_TD (qh->elementlinkptr) ==
0) ? 0 : GET_TD (phys_to_virt (qh->elementlinkptr));
diff --git a/payloads/libpayload/drivers/usb/xhci_events.c b/payloads/libpayload/drivers/usb/xhci_events.c
index dacb5d8618..c21797de93 100644
--- a/payloads/libpayload/drivers/usb/xhci_events.c
+++ b/payloads/libpayload/drivers/usb/xhci_events.c
@@ -236,7 +236,7 @@ xhci_wait_for_command_aborted(xhci_t *const xhci, const trb_t *const address)
* we don't get a response after 5s. Still, let the caller decide,
* what to do then.
*/
- unsigned long timeout_us = 5 * 1000 * 1000; /* 5s */
+ unsigned long timeout_us = USB_MAX_PROCESSING_TIME_US; /* 5s */
int cc = TIMEOUT;
/*
* Expects two command completion events:
@@ -280,13 +280,7 @@ xhci_wait_for_command_done(xhci_t *const xhci,
const trb_t *const address,
const int clear_event)
{
- /*
- * The Address Device Command should take most time, as it has to
- * communicate with the USB device. Set address processing shouldn't
- * take longer than 50ms (at the slave). Let's take a timeout of
- * 100ms.
- */
- unsigned long timeout_us = 100 * 1000; /* 100ms */
+ unsigned long timeout_us = USB_MAX_PROCESSING_TIME_US; /* 5s */
int cc = TIMEOUT;
while (xhci_wait_for_event_type(xhci, TRB_EV_CMD_CMPL, &timeout_us)) {
if ((xhci->er.cur->ptr_low == virt_to_phys(address)) &&
@@ -311,8 +305,8 @@ int
xhci_wait_for_transfer(xhci_t *const xhci, const int slot_id, const int ep_id)
{
xhci_spew("Waiting for transfer on ID %d EP %d\n", slot_id, ep_id);
- /* 3s for all types of transfers */ /* TODO: test, wait longer? */
- unsigned long timeout_us = 3 * 1000 * 1000;
+ /* 5s for all types of transfers */
+ unsigned long timeout_us = USB_MAX_PROCESSING_TIME_US;
int ret = TIMEOUT;
while (xhci_wait_for_event_type(xhci, TRB_EV_TRANSFER, &timeout_us)) {
if (TRB_GET(ID, xhci->er.cur) == slot_id &&
diff --git a/payloads/libpayload/include/usb/usb.h b/payloads/libpayload/include/usb/usb.h
index 79c4586c4a..db7ec57d57 100644
--- a/payloads/libpayload/include/usb/usb.h
+++ b/payloads/libpayload/include/usb/usb.h
@@ -71,6 +71,24 @@ typedef enum {
/* SetAddress() recovery interval (USB 2.0 specification 9.2.6.3 */
#define SET_ADDRESS_MDELAY 2
+/*
+ * USB sets an upper limit of 5 seconds for any transfer to be completed.
+ *
+ * Data originally from EHCI driver:
+ * Tested with some USB2.0 flash sticks:
+ * TUR turn around took about 2.2s for the slowest (13fe:3800), maximum
+ * of 250ms for the others.
+ *
+ * SET ADDRESS on xHCI controllers.
+ * The USB specification indicates that devices must complete processing
+ * of a SET ADDRESS request within 50 ms. However, some hubs were found
+ * to take more than 100 ms to complete a SET ADDRESS request on a
+ * downstream port.
+ */
+#define USB_MAX_PROCESSING_TIME_US (5 * 1000 * 1000)
+
+#define USB_FULL_LOW_SPEED_FRAME_US 1000
+
typedef struct {
unsigned char bDescLength;
unsigned char bDescriptorType;
diff --git a/src/Kconfig b/src/Kconfig
index 919d257c62..2bb5bfeab0 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -241,7 +241,6 @@ config NO_RELOCATABLE_RAMSTAGE
config RELOCATABLE_RAMSTAGE
bool
- depends on HAVE_RAMSTAGE
default !NO_RELOCATABLE_RAMSTAGE
select RELOCATABLE_MODULES
help
@@ -501,14 +500,20 @@ config HAVE_ROMSTAGE_MICROCODE_CBFS_SPINLOCK
bool
default n
-config HAVE_MONOTONIC_TIMER
+config NO_MONOTONIC_TIMER
def_bool n
+
+config HAVE_MONOTONIC_TIMER
+ bool
+ depends on !NO_MONOTONIC_TIMER
+ default y
help
The board/chipset provides a monotonic timer.
config GENERIC_UDELAY
- def_bool n
+ bool
depends on HAVE_MONOTONIC_TIMER
+ default y if !ARCH_X86
help
The board/chipset uses a generic udelay function utilizing the
monotonic timer.
@@ -543,14 +548,6 @@ config HAVE_OPTION_TABLE
file containing NVRAM/CMOS bit definitions.
It defaults to 'n' but can be selected in mainboard/*/Kconfig.
-config PIRQ_ROUTE
- bool
- default n
-
-config HAVE_SMI_HANDLER
- bool
- default n
-
config PCI_IO_CFG_EXT
bool
default n
@@ -591,17 +588,6 @@ config HAVE_PIRQ_TABLE
Whether or not the PIRQ table is actually generated by coreboot
is configurable by the user via GENERATE_PIRQ_TABLE.
-config MAX_PIRQ_LINKS
- int
- default 4
- help
- This variable specifies the number of PIRQ interrupt links which are
- routable. On most chipsets, this is 4, INTA through INTD. Some
- chipsets offer more than four links, commonly up to INTH. They may
- also have a separate link for ATA or IOAPIC interrupts. When the PIRQ
- table specifies links greater than 4, pirq_route_irqs will not
- function properly, unless this variable is correctly set.
-
config COMMON_FADT
bool
default n
diff --git a/src/arch/arm/armv7/mmu.c b/src/arch/arm/armv7/mmu.c
index b3133a08b7..e9d10e2a3d 100644
--- a/src/arch/arm/armv7/mmu.c
+++ b/src/arch/arm/armv7/mmu.c
@@ -165,7 +165,7 @@ static pte_t *mmu_create_subtable(pte_t *pgd_entry)
/* We assume that *pgd_entry must already be a valid block mapping. */
uintptr_t start_addr = (uintptr_t)(*pgd_entry & BLOCK_MASK);
- printk(BIOS_DEBUG, "Creating new subtable @%p for [%#.8x:%#.8lx)\n",
+ printk(BIOS_DEBUG, "Creating new subtable @%p for [%#.8lx:%#.8lx)\n",
table, start_addr, start_addr + BLOCK_SIZE);
/* Initialize the new subtable with entries of the same attributes
diff --git a/src/arch/arm/include/stdint.h b/src/arch/arm/include/stdint.h
deleted file mode 100644
index ede0ec9aef..0000000000
--- a/src/arch/arm/include/stdint.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef ARM_STDINT_H
-#define ARM_STDINT_H
-
-#if defined(__GNUC__)
-#define __HAVE_LONG_LONG__ 1
-#else
-#define __HAVE_LONG_LONG__ 0
-#endif
-
-/* Exact integral types */
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint64_t;
-typedef signed long long int64_t;
-#endif
-
-/* Small types */
-typedef unsigned char uint_least8_t;
-typedef signed char int_least8_t;
-
-typedef unsigned short uint_least16_t;
-typedef signed short int_least16_t;
-
-typedef unsigned int uint_least32_t;
-typedef signed int int_least32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint_least64_t;
-typedef signed long long int_least64_t;
-#endif
-
-/* Fast Types */
-typedef unsigned char uint_fast8_t;
-typedef signed char int_fast8_t;
-
-typedef unsigned int uint_fast16_t;
-typedef signed int int_fast16_t;
-
-typedef unsigned int uint_fast32_t;
-typedef signed int int_fast32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint_fast64_t;
-typedef signed long long int_fast64_t;
-#endif
-
-/* Types for `void *' pointers. */
-typedef int intptr_t;
-typedef unsigned int uintptr_t;
-
-/* Largest integral types */
-#if __HAVE_LONG_LONG__
-typedef long long int intmax_t;
-typedef unsigned long long uintmax_t;
-#else
-typedef long int intmax_t;
-typedef unsigned long int uintmax_t;
-#endif
-
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-#if __HAVE_LONG_LONG__
-typedef uint64_t u64;
-#endif
-typedef int8_t s8;
-typedef int16_t s16;
-typedef int32_t s32;
-
-typedef uint8_t bool;
-#define true 1
-#define false 0
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-#ifndef UINT64_MAX
-# define UINT64_MAX (18446744073709551615ULL)
-#endif
-#ifndef UINT64_C
-#define UINT64_C(c) c ## ULL
-#endif
-#ifndef PRIu64
-#define PRIu64 "llu"
-#endif
-
-#undef __HAVE_LONG_LONG__
-
-#endif /* ARM_STDINT_H */
diff --git a/src/arch/arm64/include/stdint.h b/src/arch/arm64/include/stdint.h
deleted file mode 100644
index cb07a07c86..0000000000
--- a/src/arch/arm64/include/stdint.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef ARM64_STDINT_H
-#define ARM64_STDINT_H
-
-/* Exact integral types */
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-
-typedef unsigned long long uint64_t;
-typedef signed long long int64_t;
-
-/* Small types */
-typedef unsigned char uint_least8_t;
-typedef signed char int_least8_t;
-
-typedef unsigned short uint_least16_t;
-typedef signed short int_least16_t;
-
-typedef unsigned int uint_least32_t;
-typedef signed int int_least32_t;
-
-typedef unsigned long long uint_least64_t;
-typedef signed long long int_least64_t;
-
-/* Fast Types */
-typedef unsigned char uint_fast8_t;
-typedef signed char int_fast8_t;
-
-typedef unsigned int uint_fast16_t;
-typedef signed int int_fast16_t;
-
-typedef unsigned int uint_fast32_t;
-typedef signed int int_fast32_t;
-
-typedef unsigned long long uint_fast64_t;
-typedef signed long long int_fast64_t;
-
-typedef long long int intmax_t;
-typedef unsigned long long uintmax_t;
-
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-typedef int8_t s8;
-typedef int16_t s16;
-typedef int32_t s32;
-typedef int64_t s64;
-
-typedef uint8_t bool;
-#define true 1
-#define false 0
-
-/* Types for `void *' pointers. */
-typedef s64 intptr_t;
-typedef u64 uintptr_t;
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-#ifndef UINT64_MAX
-# define UINT64_MAX (18446744073709551615ULL)
-#endif
-#ifndef PRIu64
-#define PRIu64 "llu"
-#endif
-
-#endif /* ARM64_STDINT_H */
diff --git a/src/arch/mips/Kconfig b/src/arch/mips/Kconfig
index 9e51d9cf13..b8570c1c5d 100644
--- a/src/arch/mips/Kconfig
+++ b/src/arch/mips/Kconfig
@@ -16,12 +16,12 @@
config ARCH_MIPS
bool
- default n
+
+if ARCH_MIPS
config ARCH_BOOTBLOCK_MIPS
bool
default n
- select ARCH_MIPS
select BOOTBLOCK_CUSTOM
select C_ENVIRONMENT_BOOTBLOCK
@@ -36,3 +36,5 @@ config ARCH_ROMSTAGE_MIPS
config ARCH_RAMSTAGE_MIPS
bool
default n
+
+endif # if ARCH_MIPS
diff --git a/src/arch/mips/include/stdint.h b/src/arch/mips/include/stdint.h
deleted file mode 100644
index cdfea2e8fc..0000000000
--- a/src/arch/mips/include/stdint.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Based on src/arch/armv7/include/stdint.h
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef __MIPS_STDINT_H
-#define __MIPS_STDINT_H
-
-#if defined(__GNUC__)
-#define __HAVE_LONG_LONG__ 1
-#else
-#define __HAVE_LONG_LONG__ 0
-#endif
-
-/* Exact integral types */
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint64_t;
-typedef signed long long int64_t;
-#endif
-
-/* Small types */
-typedef unsigned char uint_least8_t;
-typedef signed char int_least8_t;
-
-typedef unsigned short uint_least16_t;
-typedef signed short int_least16_t;
-
-typedef unsigned int uint_least32_t;
-typedef signed int int_least32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint_least64_t;
-typedef signed long long int_least64_t;
-#endif
-
-/* Fast Types */
-typedef unsigned char uint_fast8_t;
-typedef signed char int_fast8_t;
-
-typedef unsigned int uint_fast16_t;
-typedef signed int int_fast16_t;
-
-typedef unsigned int uint_fast32_t;
-typedef signed int int_fast32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint_fast64_t;
-typedef signed long long int_fast64_t;
-#endif
-
-/* Types for `void *' pointers. */
-typedef int intptr_t;
-typedef unsigned int uintptr_t;
-
-/* Largest integral types */
-#if __HAVE_LONG_LONG__
-typedef long long int intmax_t;
-typedef unsigned long long uintmax_t;
-#else
-typedef long int intmax_t;
-typedef unsigned long int uintmax_t;
-#endif
-
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-#if __HAVE_LONG_LONG__
-typedef uint64_t u64;
-#endif
-typedef int8_t s8;
-typedef int16_t s16;
-typedef int32_t s32;
-
-typedef uint8_t bool;
-#define true 1
-#define false 0
-
-
-#undef __HAVE_LONG_LONG__
-
-#endif /* __MIPS_STDINT_H */
diff --git a/src/arch/ppc64/include/stdint.h b/src/arch/ppc64/include/stdint.h
deleted file mode 100644
index 6425824439..0000000000
--- a/src/arch/ppc64/include/stdint.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef PPC64_STDINT_H
-#define PPC64_STDINT_H
-
-/* Exact integral types */
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-
-typedef unsigned long long uint64_t;
-typedef signed long long int64_t;
-
-/* Small types */
-typedef unsigned char uint_least8_t;
-typedef signed char int_least8_t;
-
-typedef unsigned short uint_least16_t;
-typedef signed short int_least16_t;
-
-typedef unsigned int uint_least32_t;
-typedef signed int int_least32_t;
-
-typedef unsigned long long uint_least64_t;
-typedef signed long long int_least64_t;
-
-/* Fast Types */
-typedef unsigned char uint_fast8_t;
-typedef signed char int_fast8_t;
-
-typedef unsigned int uint_fast16_t;
-typedef signed int int_fast16_t;
-
-typedef unsigned int uint_fast32_t;
-typedef signed int int_fast32_t;
-
-typedef unsigned long long uint_fast64_t;
-typedef signed long long int_fast64_t;
-
-typedef long long int intmax_t;
-typedef unsigned long long uintmax_t;
-
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-typedef int8_t s8;
-typedef int16_t s16;
-typedef int32_t s32;
-typedef int64_t s64;
-
-typedef uint8_t bool;
-#define true 1
-#define false 0
-
-/* Types for `void *' pointers. */
-typedef s64 intptr_t;
-typedef u64 uintptr_t;
-
-#endif /* PPC64_STDINT_H */
diff --git a/src/arch/riscv/Kconfig b/src/arch/riscv/Kconfig
index 25a398068a..a4f1788497 100644
--- a/src/arch/riscv/Kconfig
+++ b/src/arch/riscv/Kconfig
@@ -1,6 +1,15 @@
+config ARCH_RISCV_RV64
+ bool
+ select ARCH_RISCV
+
+config ARCH_RISCV_RV32
+ bool
+ select ARCH_RISCV
+
config ARCH_RISCV
bool
- default n
+
+if ARCH_RISCV
config RISCV_ARCH
string
@@ -37,16 +46,6 @@ config ARCH_RISCV_U
bool
default n
-config ARCH_RISCV_RV64
- bool
- default n
- select ARCH_RISCV
-
-config ARCH_RISCV_RV32
- bool
- default n
- select ARCH_RISCV
-
config ARCH_RISCV_PMP
bool
default n
@@ -74,3 +73,5 @@ config RISCV_USE_ARCH_TIMER
config RISCV_WORKING_HARTID
int
+
+endif # if ARCH_RISCV
diff --git a/src/arch/riscv/include/stdint.h b/src/arch/riscv/include/stdint.h
deleted file mode 100644
index 76f0d1b778..0000000000
--- a/src/arch/riscv/include/stdint.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef RISCV_STDINT_H
-#define RISCV_STDINT_H
-
-/* Exact integral types */
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-
-typedef unsigned long long uint64_t;
-typedef signed long long int64_t;
-
-/* Small types */
-typedef unsigned char uint_least8_t;
-typedef signed char int_least8_t;
-
-typedef unsigned short uint_least16_t;
-typedef signed short int_least16_t;
-
-typedef unsigned int uint_least32_t;
-typedef signed int int_least32_t;
-
-typedef unsigned long long uint_least64_t;
-typedef signed long long int_least64_t;
-
-/* Fast Types */
-typedef unsigned char uint_fast8_t;
-typedef signed char int_fast8_t;
-
-typedef unsigned int uint_fast16_t;
-typedef signed int int_fast16_t;
-
-typedef unsigned int uint_fast32_t;
-typedef signed int int_fast32_t;
-
-typedef unsigned long long uint_fast64_t;
-typedef signed long long int_fast64_t;
-
-typedef long long int intmax_t;
-typedef unsigned long long uintmax_t;
-
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-typedef int8_t s8;
-typedef int16_t s16;
-typedef int32_t s32;
-typedef int64_t s64;
-
-typedef uint8_t bool;
-#define true 1
-#define false 0
-
-/* Types for `void *' pointers. */
-typedef long intptr_t;
-typedef unsigned long uintptr_t;
-
-/* FIXME: This is used in some print code and may be removed in the future. */
-#define PRIu64 "llu"
-
-#endif /* RISCV_STDINT_H */
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 06aadedae6..631d981e45 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -329,3 +329,19 @@ config HAVE_CF9_RESET
config HAVE_CF9_RESET_PREPARE
bool
depends on HAVE_CF9_RESET
+
+config PIRQ_ROUTE
+ bool
+ default n
+
+config MAX_PIRQ_LINKS
+ int
+ default 4
+ depends on PIRQ_ROUTE
+ help
+ This variable specifies the number of PIRQ interrupt links which are
+ routable. On most chipsets, this is 4, INTA through INTD. Some
+ chipsets offer more than four links, commonly up to INTH. They may
+ also have a separate link for ATA or IOAPIC interrupts. When the PIRQ
+ table specifies links greater than 4, pirq_route_irqs will not
+ function properly, unless this variable is correctly set.
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 025b933dba..32e0173804 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -404,8 +404,6 @@ smm-y += memmove.c
smm-y += memset.c
smm-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
-ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),)
smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c
endif
-endif
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c
index 80923e3edd..8ab993ec48 100644
--- a/src/arch/x86/acpi.c
+++ b/src/arch/x86/acpi.c
@@ -763,11 +763,14 @@ void acpi_create_vfct(struct device *device,
memcpy(header->asl_compiler_id, ASLC, 4);
header->asl_compiler_revision = asl_revision;
- header->length = sizeof(struct acpi_vfct);
header->revision = get_acpi_table_revision(VFCT);
current = acpi_fill_vfct(device, vfct, current);
+ /* If no BIOS image, return with header->length == 0. */
+ if (!vfct->VBIOSImageOffset)
+ return;
+
/* (Re)calculate length and checksum. */
header->length = current - (unsigned long)vfct;
header->checksum = acpi_checksum((void *)vfct, header->length);
diff --git a/src/arch/x86/acpi_device.c b/src/arch/x86/acpi_device.c
index 57fbc89064..0fb8f3b000 100644
--- a/src/arch/x86/acpi_device.c
+++ b/src/arch/x86/acpi_device.c
@@ -148,7 +148,7 @@ const char *acpi_device_scope(struct device *dev)
const char *acpi_device_path_join(struct device *dev, const char *name)
{
static char buf[DEVICE_PATH_MAX] = {};
- size_t len;
+ ssize_t len;
if (!dev)
return NULL;
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 74cd25a858..f9af10229e 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -1115,7 +1115,7 @@ void acpigen_write_uuid(const char *uuid)
void acpigen_write_power_res(const char *name, uint8_t level, uint16_t order,
const char *dev_states[], size_t dev_states_count)
{
- int i;
+ size_t i;
for (i = 0; i < dev_states_count; i++) {
acpigen_write_name(dev_states[i]);
acpigen_write_package(1);
diff --git a/src/arch/x86/cpu_common.c b/src/arch/x86/cpu_common.c
index 119122786d..0fd0af016f 100644
--- a/src/arch/x86/cpu_common.c
+++ b/src/arch/x86/cpu_common.c
@@ -49,7 +49,7 @@ int cpu_have_cpuid(void)
}
#endif
-int cpu_cpuid_extended_level(void)
+unsigned int cpu_cpuid_extended_level(void)
{
return cpuid_eax(0x80000000);
}
diff --git a/src/arch/x86/include/arch/bert_storage.h b/src/arch/x86/include/arch/bert_storage.h
index c96918c990..5c87aed8b0 100644
--- a/src/arch/x86/include/arch/bert_storage.h
+++ b/src/arch/x86/include/arch/bert_storage.h
@@ -67,7 +67,7 @@ size_t bert_storage_remaining(void);
/* Find if errors were added, a BERT region is present, and ACPI table needed */
int bert_errors_present(void);
-/* Get the number of entries accociated with status */
+/* Get the number of entries associated with status */
static inline size_t bert_entry_count(acpi_generic_error_status_t *status)
{
return (status->block_status & GENERIC_ERR_STS_ENTRY_COUNT_MASK)
diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h
index ff1a33b9ea..293ca02158 100644
--- a/src/arch/x86/include/arch/cpu.h
+++ b/src/arch/x86/include/arch/cpu.h
@@ -200,17 +200,19 @@ static inline unsigned int cpuid_edx(unsigned int op)
#define CPUID_CACHE_NO_OF_SETS_MASK 0xffffffff
#define CPUID_CACHE_NO_OF_SETS(res) CPUID_CACHE(NO_OF_SETS, (res).ecx)
-int cpu_cpuid_extended_level(void);
+unsigned int cpu_cpuid_extended_level(void);
int cpu_have_cpuid(void);
+/* Only with !PARALLEL_MP. */
void smm_init(void);
void smm_init_completion(void);
-void smm_lock(void);
+
void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
static inline bool cpu_is_amd(void)
{
- return CONFIG(CPU_AMD_AGESA) || CONFIG(CPU_AMD_PI);
+ return CONFIG(CPU_AMD_AGESA) || CONFIG(CPU_AMD_PI)
+ || CONFIG(SOC_AMD_COMMON) || CONFIG(CPU_AMD_MODEL_10XXX);
}
static inline bool cpu_is_intel(void)
@@ -309,8 +311,9 @@ struct postcar_frame {
};
/*
- * Initialize postcar_frame object allocating stack size in cbmem
- * with the provided size. Returns 0 on success, < 0 on error.
+ * Initialize postcar_frame object allocating stack from cbmem,
+ * with stack_size == 0, default 4 KiB is allocated.
+ * Returns 0 on success, < 0 on error.
*/
int postcar_frame_init(struct postcar_frame *pcf, size_t stack_size);
diff --git a/src/northbridge/intel/e7505/debug.h b/src/arch/x86/include/arch/memory_clear.h
similarity index 58%
rename from src/northbridge/intel/e7505/debug.h
rename to src/arch/x86/include/arch/memory_clear.h
index 98ca848ea0..87ad7ada85 100644
--- a/src/northbridge/intel/e7505/debug.h
+++ b/src/arch/x86/include/arch/memory_clear.h
@@ -1,6 +1,9 @@
/*
* This file is part of the coreboot project.
*
+ * Copyright (C) 2019 9elements Agency GmbH
+ * Copyright (C) 2019 Facebook Inc.
+ *
* 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; version 2 of the License.
@@ -11,16 +14,11 @@
* GNU General Public License for more details.
*/
-#ifndef E7505_DEBUG_H
-#define E7505_DEBUG_H
+#ifndef MEMORY_CLEAR_H
+#define MEMORY_CLEAR_H
-void print_debug_pci_dev(unsigned dev);
-void print_pci_devices(void);
-void dump_pci_device(unsigned dev);
-void dump_pci_devices(void);
-void dump_pci_devices_on_bus(unsigned busn);
-void dump_spd_registers(const struct mem_controller *ctrl);
-void dump_smbus_registers(void);
-void dump_io_resources(unsigned port);
+#include
-#endif
+int arch_clear_memranges(const struct memranges *mem_reserved);
+
+#endif /* MEMORY_CLEAR_H */
diff --git a/src/arch/x86/include/stdint.h b/src/arch/x86/include/stdint.h
deleted file mode 100644
index 6c400021b0..0000000000
--- a/src/arch/x86/include/stdint.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef X86_STDINT_H
-#define X86_STDINT_H
-
-#if defined(__GNUC__)
-#define __HAVE_LONG_LONG__ 1
-#else
-#define __HAVE_LONG_LONG__ 0
-#endif
-
-/* Exact integral types */
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint64_t;
-typedef signed long long int64_t;
-#endif
-
-/* Small types */
-typedef unsigned char uint_least8_t;
-typedef signed char int_least8_t;
-
-typedef unsigned short uint_least16_t;
-typedef signed short int_least16_t;
-
-typedef unsigned int uint_least32_t;
-typedef signed int int_least32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint_least64_t;
-typedef signed long long int_least64_t;
-#endif
-
-/* Fast Types */
-typedef unsigned char uint_fast8_t;
-typedef signed char int_fast8_t;
-
-typedef unsigned int uint_fast16_t;
-typedef signed int int_fast16_t;
-
-typedef unsigned int uint_fast32_t;
-typedef signed int int_fast32_t;
-
-#if __HAVE_LONG_LONG__
-typedef unsigned long long uint_fast64_t;
-typedef signed long long int_fast64_t;
-#endif
-
-/* Types for `void *' pointers. */
-typedef long intptr_t;
-typedef unsigned long uintptr_t;
-
-/* Largest integral types */
-#if __HAVE_LONG_LONG__
-typedef long long int intmax_t;
-typedef unsigned long long uintmax_t;
-#else
-typedef long int intmax_t;
-typedef unsigned long int uintmax_t;
-#endif
-
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-#if __HAVE_LONG_LONG__
-typedef uint64_t u64;
-#endif
-typedef int8_t s8;
-typedef int16_t s16;
-typedef int32_t s32;
-
-typedef uint8_t bool;
-#define true 1
-#define false 0
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-#ifndef UINT64_MAX
-# define UINT64_MAX (18446744073709551615ULL)
-#endif
-
-#ifndef UINT64_C
-#define UINT64_C(c) c ## ULL
-#endif
-#ifndef PRIu64
-#define PRIu64 "llu"
-
-#endif
-
-
-#undef __HAVE_LONG_LONG__
-
-#endif /* X86_STDINT_H */
diff --git a/src/arch/x86/pirq_routing.c b/src/arch/x86/pirq_routing.c
index 15d7411b3f..9d1f5910e9 100644
--- a/src/arch/x86/pirq_routing.c
+++ b/src/arch/x86/pirq_routing.c
@@ -20,10 +20,6 @@
#include
#include
-void __weak pirq_assign_irqs(const unsigned char pirq[CONFIG_MAX_PIRQ_LINKS])
-{
-}
-
static void check_pirq_routing_table(struct irq_routing_table *rt)
{
uint8_t *addr = (uint8_t *)rt;
@@ -146,8 +142,11 @@ static void pirq_route_irqs(unsigned long addr)
/* Set PCI IRQs. */
for (i = 0; i < num_entries; i++) {
+ u8 bus = pirq_tbl->slots[i].bus;
+ u8 devfn = pirq_tbl->slots[i].devfn;
+
printk(BIOS_DEBUG, "PIRQ Entry %d Dev/Fn: %X Slot: %d\n", i,
- pirq_tbl->slots[i].devfn >> 3, pirq_tbl->slots[i].slot);
+ devfn >> 3, pirq_tbl->slots[i].slot);
for (intx = 0; intx < MAX_INTX_ENTRIES; intx++) {
@@ -178,8 +177,7 @@ static void pirq_route_irqs(unsigned long addr)
}
/* Bus, device, slots IRQs for {A,B,C,D}. */
- pci_assign_irqs(pirq_tbl->slots[i].bus,
- pirq_tbl->slots[i].devfn >> 3, irq_slot);
+ pci_assign_irqs(pcidev_path_on_bus(bus, devfn), irq_slot);
}
for (i = 0; i < CONFIG_MAX_PIRQ_LINKS; i++)
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c
index 732b767bf6..35e139fe1c 100644
--- a/src/arch/x86/postcar_loader.c
+++ b/src/arch/x86/postcar_loader.c
@@ -48,6 +48,15 @@ int postcar_frame_init(struct postcar_frame *pcf, size_t stack_size)
{
void *stack;
+ /*
+ * Use default postcar stack size of 4 KiB. This value should
+ * not be decreased, because if mainboards use vboot, 1 KiB will
+ * not be enough anymore.
+ */
+
+ if (stack_size == 0)
+ stack_size = 4 * KiB;
+
stack = cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK, stack_size);
if (stack == NULL) {
printk(BIOS_ERR, "Couldn't add %zd byte stack in cbmem.\n",
diff --git a/src/console/Kconfig b/src/console/Kconfig
index 61ba667d59..4cb407e785 100644
--- a/src/console/Kconfig
+++ b/src/console/Kconfig
@@ -79,13 +79,13 @@ config TTYS0_BASE
Map the COM port number to the respective I/O port.
comment "Serial port base address = 0x3f8"
-depends on UART_FOR_CONSOLE = 0
+depends on DRIVERS_UART_8250IO && UART_FOR_CONSOLE = 0
comment "Serial port base address = 0x2f8"
-depends on UART_FOR_CONSOLE = 1
+depends on DRIVERS_UART_8250IO && UART_FOR_CONSOLE = 1
comment "Serial port base address = 0x3e8"
-depends on UART_FOR_CONSOLE = 2
+depends on DRIVERS_UART_8250IO && UART_FOR_CONSOLE = 2
comment "Serial port base address = 0x2e8"
-depends on UART_FOR_CONSOLE = 3
+depends on DRIVERS_UART_8250IO && UART_FOR_CONSOLE = 3
config UART_OVERRIDE_BAUDRATE
boolean
diff --git a/src/console/Makefile.inc b/src/console/Makefile.inc
index 4f0c2ef613..3311849941 100644
--- a/src/console/Makefile.inc
+++ b/src/console/Makefile.inc
@@ -8,8 +8,8 @@ ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.adb
endif
smm-$(CONFIG_DEBUG_SMI) += init.c console.c vtxprintf.c printk.c
-smm-$(CONFIG_SMM_TSEG) += die.c
-smm-$(CONFIG_SMM_TSEG) += post.c
+smm-y += die.c
+smm-y += post.c
verstage-y += init.c
verstage-y += printk.c
diff --git a/src/console/vtxprintf.c b/src/console/vtxprintf.c
index 01091c82e8..848ad501ce 100644
--- a/src/console/vtxprintf.c
+++ b/src/console/vtxprintf.c
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
#define call_tx(x) tx_byte(x, data)
@@ -38,7 +39,7 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
void *data)
{
char c, sign, tmp[66];
- const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
+ const char *digits = "0123456789abcdef";
int i;
int count = 0;
#ifdef SUPPORT_64BIT_INTS
@@ -57,11 +58,9 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
#endif
if (type & LARGE)
- digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ digits = "0123456789ABCDEF";
if (type & LEFT)
type &= ~ZEROPAD;
- if (base < 2 || base > 36)
- return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
@@ -108,7 +107,10 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
call_tx('0'), count++;
else if (base == 16) {
call_tx('0'), count++;
- call_tx(digits[33]), count++;
+ if (type & LARGE)
+ call_tx('X'), count++;
+ else
+ call_tx('x'), count++;
}
}
if (!(type & LEFT)) {
@@ -138,7 +140,7 @@ int vtxprintf(void (*tx_byte)(unsigned char byte, void *data),
int field_width; /* width of output field */
int precision; /* min. # of digits for integers; max
number of chars for from string */
- int qualifier; /* 'h', 'H', 'l', or 'L' for integer fields */
+ int qualifier; /* 'h', 'H', 'l', 'L', 'z', or 'j' for integer fields */
int count;
@@ -192,7 +194,7 @@ repeat:
/* get the conversion qualifier */
qualifier = -1;
- if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'z') {
+ if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'z' || *fmt == 'j') {
qualifier = *fmt;
++fmt;
if (*fmt == 'l') {
@@ -293,6 +295,8 @@ repeat:
num = va_arg(args, unsigned long);
} else if (qualifier == 'z') {
num = va_arg(args, size_t);
+ } else if (qualifier == 'j') {
+ num = va_arg(args, uintmax_t);
} else if (qualifier == 'h') {
num = (unsigned short) va_arg(args, int);
if (flags & SIGN)
diff --git a/src/cpu/allwinner/a10/Kconfig b/src/cpu/allwinner/a10/Kconfig
index 87693ed600..0b5d9bf60d 100644
--- a/src/cpu/allwinner/a10/Kconfig
+++ b/src/cpu/allwinner/a10/Kconfig
@@ -10,7 +10,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_VERSTAGE_ARMV7
select ARCH_ROMSTAGE_ARMV7
select ARCH_RAMSTAGE_ARMV7
- select HAVE_MONOTONIC_TIMER
+ select NO_MONOTONIC_TIMER
select HAVE_UART_SPECIAL
select UART_OVERRIDE_REFCLK
select BOOT_DEVICE_NOT_SPI_FLASH
diff --git a/src/cpu/allwinner/a10/Makefile.inc b/src/cpu/allwinner/a10/Makefile.inc
index a6cd4b48a7..cbdb5ae856 100644
--- a/src/cpu/allwinner/a10/Makefile.inc
+++ b/src/cpu/allwinner/a10/Makefile.inc
@@ -17,7 +17,6 @@ ramstage-y += bootblock_media.c
ramstage-y += cbmem.c
ramstage-y += clock.c
ramstage-y += cpu.c
-ramstage-y += monotonic_timer.c
ramstage-y += timer.c
ramstage-y += twi.c
diff --git a/src/cpu/amd/agesa/Kconfig b/src/cpu/amd/agesa/Kconfig
index 5f7e0f9987..4c5463cc8a 100644
--- a/src/cpu/amd/agesa/Kconfig
+++ b/src/cpu/amd/agesa/Kconfig
@@ -30,6 +30,7 @@ config CPU_AMD_AGESA
select LAPIC_MONOTONIC_TIMER
select SPI_FLASH if HAVE_ACPI_RESUME
select POSTCAR_STAGE
+ select SMM_ASEG
if CPU_AMD_AGESA
diff --git a/src/cpu/amd/agesa/family15tn/Makefile.inc b/src/cpu/amd/agesa/family15tn/Makefile.inc
index 98a7050c21..46ae346282 100644
--- a/src/cpu/amd/agesa/family15tn/Makefile.inc
+++ b/src/cpu/amd/agesa/family15tn/Makefile.inc
@@ -19,7 +19,7 @@ ramstage-y += fixme.c
ramstage-y += chip_name.c
ramstage-y += model_15_init.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += udelay.c
+smm-y += udelay.c
subdirs-y += ../../mtrr
subdirs-y += ../../smm
diff --git a/src/cpu/amd/family_10h-family_15h/Kconfig b/src/cpu/amd/family_10h-family_15h/Kconfig
index 8ff685f0c1..df6549987e 100644
--- a/src/cpu/amd/family_10h-family_15h/Kconfig
+++ b/src/cpu/amd/family_10h-family_15h/Kconfig
@@ -7,7 +7,6 @@ config CPU_AMD_MODEL_10XXX
select SSE2
select TSC_SYNC_LFENCE
select UDELAY_LAPIC
- select HAVE_MONOTONIC_TIMER
select SUPPORT_CPU_UCODE_IN_CBFS
select CPU_MICROCODE_MULTIPLE_FILES
select ACPI_HUGE_LOWMEM_BACKUP
diff --git a/src/cpu/amd/family_10h-family_15h/fidvid.c b/src/cpu/amd/family_10h-family_15h/fidvid.c
index 2c6e08cf0a..c5d523a74c 100644
--- a/src/cpu/amd/family_10h-family_15h/fidvid.c
+++ b/src/cpu/amd/family_10h-family_15h/fidvid.c
@@ -91,6 +91,7 @@ b.- prep_fid_change(...)
#include
#include
+#include
#include
#include
diff --git a/src/cpu/amd/pi/00630F01/Makefile.inc b/src/cpu/amd/pi/00630F01/Makefile.inc
index 98a7050c21..46ae346282 100644
--- a/src/cpu/amd/pi/00630F01/Makefile.inc
+++ b/src/cpu/amd/pi/00630F01/Makefile.inc
@@ -19,7 +19,7 @@ ramstage-y += fixme.c
ramstage-y += chip_name.c
ramstage-y += model_15_init.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += udelay.c
+smm-y += udelay.c
subdirs-y += ../../mtrr
subdirs-y += ../../smm
diff --git a/src/cpu/amd/pi/Kconfig b/src/cpu/amd/pi/Kconfig
index 8dc7f5abf9..a902089099 100644
--- a/src/cpu/amd/pi/Kconfig
+++ b/src/cpu/amd/pi/Kconfig
@@ -29,6 +29,7 @@ config CPU_AMD_PI
select LAPIC_MONOTONIC_TIMER
select SPI_FLASH if HAVE_ACPI_RESUME
select POSTCAR_STAGE if !BINARYPI_LEGACY_WRAPPER
+ select SMM_ASEG
if CPU_AMD_PI
diff --git a/src/cpu/amd/pi/romstage.c b/src/cpu/amd/pi/romstage.c
index aa14826149..cfd41648ba 100644
--- a/src/cpu/amd/pi/romstage.c
+++ b/src/cpu/amd/pi/romstage.c
@@ -40,8 +40,7 @@ void *asmlinkage romstage_main(unsigned long bist)
romstage_handoff_init(s3resume);
- uintptr_t stack_top = romstage_ram_stack_base(HIGH_ROMSTAGE_STACK_SIZE,
- ROMSTAGE_STACK_CBMEM);
+ char *stack_top = cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK, HIGH_ROMSTAGE_STACK_SIZE);
stack_top += HIGH_ROMSTAGE_STACK_SIZE;
printk(BIOS_DEBUG, "Move CAR stack.\n");
diff --git a/src/cpu/amd/smm/smm_init.c b/src/cpu/amd/smm/smm_init.c
index 3efb964165..60e506c4e5 100644
--- a/src/cpu/amd/smm/smm_init.c
+++ b/src/cpu/amd/smm/smm_init.c
@@ -70,11 +70,6 @@ void smm_init(void)
/* CPU MSR are set in CPU init */
}
-void smm_lock(void)
-{
- /* We lock SMM in CPU init */
-}
-
void smm_init_completion(void)
{
}
diff --git a/src/cpu/intel/common/Makefile.inc b/src/cpu/intel/common/Makefile.inc
index b67ca85f0e..2fc6da908b 100644
--- a/src/cpu/intel/common/Makefile.inc
+++ b/src/cpu/intel/common/Makefile.inc
@@ -2,4 +2,4 @@ ramstage-y += common_init.c
romstage-$(CONFIG_UDELAY_LAPIC) += fsb.c
ramstage-$(CONFIG_UDELAY_LAPIC) += fsb.c
postcar-$(CONFIG_UDELAY_LAPIC) += fsb.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += fsb.c
+smm-y += fsb.c
diff --git a/src/cpu/intel/fsp_model_406dx/Kconfig b/src/cpu/intel/fsp_model_406dx/Kconfig
index f40842fce8..6bf8dc7eec 100644
--- a/src/cpu/intel/fsp_model_406dx/Kconfig
+++ b/src/cpu/intel/fsp_model_406dx/Kconfig
@@ -35,6 +35,7 @@ config CPU_SPECIFIC_OPTIONS
select TSC_SYNC_MFENCE
select LAPIC_MONOTONIC_TIMER
select CPU_INTEL_COMMON
+ select NO_SMM
# Microcode header files are delivered in FSP package
select USES_MICROCODE_HEADER_FILES if HAVE_FSP_BIN
diff --git a/src/cpu/intel/haswell/Kconfig b/src/cpu/intel/haswell/Kconfig
index 5936953b52..8f91b60953 100644
--- a/src/cpu/intel/haswell/Kconfig
+++ b/src/cpu/intel/haswell/Kconfig
@@ -10,13 +10,12 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_VERSTAGE_X86_32
select ARCH_ROMSTAGE_X86_32
select ARCH_RAMSTAGE_X86_32
- select HAVE_MONOTONIC_TIMER
select SMP
select MMX
select SSE2
select UDELAY_TSC
select TSC_CONSTANT_RATE
- select SMM_TSEG
+ select TSC_MONOTONIC_TIMER
select SUPPORT_CPU_UCODE_IN_CBFS
#select AP_IN_SIPI_WAIT
select TSC_SYNC_MFENCE
diff --git a/src/cpu/intel/haswell/Makefile.inc b/src/cpu/intel/haswell/Makefile.inc
index 72f66ef7b8..f9606486c2 100644
--- a/src/cpu/intel/haswell/Makefile.inc
+++ b/src/cpu/intel/haswell/Makefile.inc
@@ -13,16 +13,8 @@ ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.c
romstage-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += stage_cache.c
postcar-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += stage_cache.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += finalize.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += tsc_freq.c
-
-ifneq ($(CONFIG_TSC_MONOTONIC_TIMER),y)
-bootblock-y += monotonic_timer.c
-romstage-y += monotonic_timer.c
-postcar-y += monotonic_timer.c
-ramstage-y += monotonic_timer.c
-smm-y += monotonic_timer.c
-endif
+smm-y += finalize.c
+smm-y += tsc_freq.c
bootblock-y += ../car/non-evict/cache_as_ram.S
bootblock-y += ../car/bootblock.c
diff --git a/src/cpu/intel/haswell/haswell.h b/src/cpu/intel/haswell/haswell.h
index 4ebbe183b7..cd8d5cb52b 100644
--- a/src/cpu/intel/haswell/haswell.h
+++ b/src/cpu/intel/haswell/haswell.h
@@ -166,6 +166,7 @@ void smm_info(uintptr_t *perm_smbase, size_t *perm_smsize,
size_t *smm_save_state_size);
void smm_initialize(void);
void smm_relocate(void);
+void smm_lock(void);
struct bus;
void bsp_init_and_start_aps(struct bus *cpu_bus);
/* Determine if HyperThreading is disabled. The variable is not valid until
diff --git a/src/cpu/intel/haswell/monotonic_timer.c b/src/cpu/intel/haswell/monotonic_timer.c
deleted file mode 100644
index 63500a4d26..0000000000
--- a/src/cpu/intel/haswell/monotonic_timer.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2013 Google, Inc.
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-#include
-#include
-#include
-
-#define MSR_COUNTER_24_MHz 0x637
-static struct monotonic_counter {
- int initialized;
- struct mono_time time;
- uint32_t last_value;
-} mono_counter;
-
-static inline uint32_t read_counter_msr(void)
-{
- /* Even though the MSR is 64-bit it is assumed that the hardware
- * is polled frequently enough to only use the lower 32-bits. */
- msr_t counter_msr;
-
- counter_msr = rdmsr(MSR_COUNTER_24_MHz);
-
- return counter_msr.lo;
-}
-
-void timer_monotonic_get(struct mono_time *mt)
-{
- uint32_t current_tick;
- uint32_t usecs_elapsed;
-
- if (!mono_counter.initialized) {
- mono_counter.last_value = read_counter_msr();
- mono_counter.initialized = 1;
- }
-
- current_tick = read_counter_msr();
- usecs_elapsed = (current_tick - mono_counter.last_value) / 24;
-
- /* Update current time and tick values only if a full tick occurred. */
- if (usecs_elapsed) {
- mono_time_add_usecs(&mono_counter.time, usecs_elapsed);
- mono_counter.last_value = current_tick;
- }
-
- /* Save result. */
- *mt = mono_counter.time;
-}
diff --git a/src/cpu/intel/haswell/romstage.c b/src/cpu/intel/haswell/romstage.c
index 3cbdf44c1d..47b9976786 100644
--- a/src/cpu/intel/haswell/romstage.c
+++ b/src/cpu/intel/haswell/romstage.c
@@ -38,8 +38,6 @@
#include
#include "haswell.h"
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
* and continues execution in postcar stage. */
@@ -48,7 +46,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
postcar_frame_add_romcache(&pcf, MTRR_TYPE_WRPROT);
diff --git a/src/cpu/intel/model_1067x/Makefile.inc b/src/cpu/intel/model_1067x/Makefile.inc
index caeab563a4..743e780a36 100644
--- a/src/cpu/intel/model_1067x/Makefile.inc
+++ b/src/cpu/intel/model_1067x/Makefile.inc
@@ -2,6 +2,6 @@ ramstage-y += model_1067x_init.c
ramstage-$(CONFIG_PARALLEL_MP) += mp_init.c
subdirs-y += ../../x86/name
subdirs-y += ../common
-subdirs-$(CONFIG_SMM_TSEG) += ../smm/gen1
+subdirs-y += ../smm/gen1
cpu_microcode_bins += $(wildcard 3rdparty/intel-microcode/intel-ucode/06-17-*)
diff --git a/src/cpu/intel/model_106cx/Makefile.inc b/src/cpu/intel/model_106cx/Makefile.inc
index a1f2d0d1f0..6701e6fc18 100644
--- a/src/cpu/intel/model_106cx/Makefile.inc
+++ b/src/cpu/intel/model_106cx/Makefile.inc
@@ -1,7 +1,7 @@
ramstage-y += model_106cx_init.c
subdirs-y += ../../x86/name
subdirs-y += ../common
-subdirs-$(CONFIG_SMM_TSEG) += ../smm/gen1
+subdirs-y += ../smm/gen1
ramstage-$(CONFIG_PARALLEL_MP) += ../model_1067x/mp_init.c
cpu_microcode_bins += $(wildcard 3rdparty/intel-microcode/intel-ucode/06-1c-*)
diff --git a/src/cpu/intel/model_2065x/Kconfig b/src/cpu/intel/model_2065x/Kconfig
index d8c016867c..089b3fead0 100644
--- a/src/cpu/intel/model_2065x/Kconfig
+++ b/src/cpu/intel/model_2065x/Kconfig
@@ -13,7 +13,7 @@ config CPU_SPECIFIC_OPTIONS
select SSE2
select UDELAY_TSC
select TSC_CONSTANT_RATE
- select SMM_TSEG
+ select TSC_MONOTONIC_TIMER
select SUPPORT_CPU_UCODE_IN_CBFS
select PARALLEL_CPU_INIT
#select AP_IN_SIPI_WAIT
diff --git a/src/cpu/intel/model_2065x/Makefile.inc b/src/cpu/intel/model_2065x/Makefile.inc
index f494e9b049..9a11b06e4d 100644
--- a/src/cpu/intel/model_2065x/Makefile.inc
+++ b/src/cpu/intel/model_2065x/Makefile.inc
@@ -13,11 +13,11 @@ subdirs-y += ../common
ramstage-y += tsc_freq.c
romstage-y += tsc_freq.c
postcar-y += tsc_freq.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += tsc_freq.c
+smm-y += tsc_freq.c
ramstage-y += acpi.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += finalize.c
+smm-y += finalize.c
romstage-y += stage_cache.c
ramstage-y += stage_cache.c
diff --git a/src/cpu/intel/model_206ax/Kconfig b/src/cpu/intel/model_206ax/Kconfig
index dbb8982121..2af63d6079 100644
--- a/src/cpu/intel/model_206ax/Kconfig
+++ b/src/cpu/intel/model_206ax/Kconfig
@@ -15,7 +15,6 @@ config CPU_SPECIFIC_OPTIONS
select UDELAY_TSC
select TSC_CONSTANT_RATE
select TSC_MONOTONIC_TIMER
- select SMM_TSEG
select SUPPORT_CPU_UCODE_IN_CBFS
#select AP_IN_SIPI_WAIT
select TSC_SYNC_MFENCE
diff --git a/src/cpu/intel/model_206ax/Makefile.inc b/src/cpu/intel/model_206ax/Makefile.inc
index 78a6283a5d..f5de8c38fa 100644
--- a/src/cpu/intel/model_206ax/Makefile.inc
+++ b/src/cpu/intel/model_206ax/Makefile.inc
@@ -15,14 +15,14 @@ ramstage-y += acpi.c
ramstage-y += common.c
romstage-y += common.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += common.c
+smm-y += common.c
ramstage-y += tsc_freq.c
romstage-y += tsc_freq.c
postcar-y += tsc_freq.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += tsc_freq.c
+smm-y += tsc_freq.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += finalize.c
+smm-y += finalize.c
romstage-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += stage_cache.c
postcar-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += stage_cache.c
diff --git a/src/cpu/intel/model_6ex/Makefile.inc b/src/cpu/intel/model_6ex/Makefile.inc
index cef2b0be86..e1491e6fb4 100644
--- a/src/cpu/intel/model_6ex/Makefile.inc
+++ b/src/cpu/intel/model_6ex/Makefile.inc
@@ -1,7 +1,7 @@
ramstage-y += model_6ex_init.c
subdirs-y += ../../x86/name
subdirs-y += ../common
-subdirs-$(CONFIG_SMM_TSEG) += ../smm/gen1
+subdirs-y += ../smm/gen1
ramstage-y += ../model_1067x/mp_init.c
cpu_microcode_bins += $(wildcard 3rdparty/intel-microcode/intel-ucode/06-0e-*)
diff --git a/src/cpu/intel/model_6fx/Makefile.inc b/src/cpu/intel/model_6fx/Makefile.inc
index 9121e3b64a..f1d64b7454 100644
--- a/src/cpu/intel/model_6fx/Makefile.inc
+++ b/src/cpu/intel/model_6fx/Makefile.inc
@@ -2,6 +2,6 @@ ramstage-y += model_6fx_init.c
subdirs-y += ../../x86/name
subdirs-y += ../common
ramstage-$(CONFIG_PARALLEL_MP) += ../model_1067x/mp_init.c
-subdirs-$(CONFIG_SMM_TSEG) += ../smm/gen1
+subdirs-y += ../smm/gen1
cpu_microcode_bins += $(wildcard 3rdparty/intel-microcode/intel-ucode/06-0f-*)
diff --git a/src/cpu/intel/model_f2x/Kconfig b/src/cpu/intel/model_f2x/Kconfig
index 5ef1539995..9e70775650 100644
--- a/src/cpu/intel/model_f2x/Kconfig
+++ b/src/cpu/intel/model_f2x/Kconfig
@@ -6,3 +6,4 @@ config CPU_INTEL_MODEL_F2X
select ARCH_RAMSTAGE_X86_32
select SMP
select SUPPORT_CPU_UCODE_IN_CBFS
+ select SMM_ASEG
diff --git a/src/cpu/intel/model_f3x/Makefile.inc b/src/cpu/intel/model_f3x/Makefile.inc
index ed1eb5f7d8..1f2b564dac 100644
--- a/src/cpu/intel/model_f3x/Makefile.inc
+++ b/src/cpu/intel/model_f3x/Makefile.inc
@@ -1,5 +1,5 @@
ramstage-y += model_f3x_init.c
-subdirs-$(CONFIG_SMM_TSEG) += ../smm/gen1
+subdirs-y += ../smm/gen1
ramstage-$(CONFIG_PARALLEL_MP) += ../model_1067x/mp_init.c
cpu_microcode_bins += $(wildcard 3rdparty/intel-microcode/intel-ucode/0f-03-*)
diff --git a/src/cpu/intel/model_f4x/Makefile.inc b/src/cpu/intel/model_f4x/Makefile.inc
index 196d63e462..7e853b07da 100644
--- a/src/cpu/intel/model_f4x/Makefile.inc
+++ b/src/cpu/intel/model_f4x/Makefile.inc
@@ -1,5 +1,5 @@
ramstage-y += model_f4x_init.c
-subdirs-$(CONFIG_SMM_TSEG) += ../smm/gen1
+subdirs-y += ../smm/gen1
ramstage-$(CONFIG_PARALLEL_MP) += ../model_1067x/mp_init.c
cpu_microcode_bins += $(wildcard 3rdparty/intel-microcode/intel-ucode/0f-04-*)
diff --git a/src/cpu/intel/slot_1/Kconfig b/src/cpu/intel/slot_1/Kconfig
index ab6663258f..adfc2da75a 100644
--- a/src/cpu/intel/slot_1/Kconfig
+++ b/src/cpu/intel/slot_1/Kconfig
@@ -25,6 +25,8 @@ config SLOT_SPECIFIC_OPTIONS # dummy
select CPU_INTEL_MODEL_68X
select CPU_INTEL_MODEL_6BX
select CPU_INTEL_MODEL_6XX
+ select NO_SMM
+ select NO_MONOTONIC_TIMER
config DCACHE_RAM_BASE
hex
diff --git a/src/cpu/intel/smm/gen1/smi.h b/src/cpu/intel/smm/gen1/smi.h
index 05c507c09c..3d5149a430 100644
--- a/src/cpu/intel/smm/gen1/smi.h
+++ b/src/cpu/intel/smm/gen1/smi.h
@@ -31,3 +31,4 @@ void southbridge_smm_clear_state(void);
void smm_relocation_handler(int cpu, uintptr_t curr_smbase,
uintptr_t staggered_smbase);
void smm_relocate(void);
+void smm_lock(void);
diff --git a/src/cpu/intel/smm/gen1/smmrelocate.c b/src/cpu/intel/smm/gen1/smmrelocate.c
index d52043f047..986929c9cb 100644
--- a/src/cpu/intel/smm/gen1/smmrelocate.c
+++ b/src/cpu/intel/smm/gen1/smmrelocate.c
@@ -57,7 +57,6 @@ struct smm_relocation_params {
/* This gets filled in and used during relocation. */
static struct smm_relocation_params smm_reloc_params;
-static void *default_smm_area = NULL;
/* On model_6fx, model_1067x and model_106cx SMRR functions slightly
differently. The MSR are at different location from the rest
@@ -168,11 +167,6 @@ static void setup_ied_area(struct smm_relocation_params *params)
memset(ied_base + (1 << 20), 0, (32 << 10));
}
-void smm_init_completion(void)
-{
- restore_default_smm_area(default_smm_area);
-}
-
void smm_lock(void)
{
/* LOCK the SMM memory window and enable normal SMM.
diff --git a/src/cpu/intel/socket_mPGA604/Kconfig b/src/cpu/intel/socket_mPGA604/Kconfig
index ca2f7b36ee..1453f9962b 100644
--- a/src/cpu/intel/socket_mPGA604/Kconfig
+++ b/src/cpu/intel/socket_mPGA604/Kconfig
@@ -9,6 +9,7 @@ config SOCKET_SPECIFIC_OPTIONS # dummy
select MMX
select SSE
select UDELAY_TSC
+ select TSC_MONOTONIC_TIMER
select SIPI_VECTOR_IN_ROM
select C_ENVIRONMENT_BOOTBLOCK
diff --git a/src/cpu/qemu-power8/Kconfig b/src/cpu/qemu-power8/Kconfig
index c1f8309795..ef995b6398 100644
--- a/src/cpu/qemu-power8/Kconfig
+++ b/src/cpu/qemu-power8/Kconfig
@@ -19,3 +19,4 @@ config CPU_QEMU_POWER8
select ARCH_VERSTAGE_PPC64
select ARCH_ROMSTAGE_PPC64
select ARCH_RAMSTAGE_PPC64
+ select NO_MONOTONIC_TIMER
diff --git a/src/cpu/qemu-x86/Kconfig b/src/cpu/qemu-x86/Kconfig
index 70cce9b705..141749eca4 100644
--- a/src/cpu/qemu-x86/Kconfig
+++ b/src/cpu/qemu-x86/Kconfig
@@ -21,4 +21,6 @@ config CPU_QEMU_X86
select ARCH_RAMSTAGE_X86_32
select SMP
select UDELAY_TSC
+ select NO_MONOTONIC_TIMER
select C_ENVIRONMENT_BOOTBLOCK
+ select SMM_ASEG
diff --git a/src/cpu/ti/am335x/Kconfig b/src/cpu/ti/am335x/Kconfig
index 20e7458baf..6de5eb4df3 100644
--- a/src/cpu/ti/am335x/Kconfig
+++ b/src/cpu/ti/am335x/Kconfig
@@ -3,9 +3,7 @@ config CPU_TI_AM335X
select ARCH_VERSTAGE_ARMV7
select ARCH_ROMSTAGE_ARMV7
select ARCH_RAMSTAGE_ARMV7
- select HAVE_MONOTONIC_TIMER
select HAVE_UART_SPECIAL
- select GENERIC_UDELAY
select UART_OVERRIDE_REFCLK
select BOOT_DEVICE_NOT_SPI_FLASH
bool
diff --git a/src/cpu/via/nano/Kconfig b/src/cpu/via/nano/Kconfig
index c7e7060957..de1c2155e5 100644
--- a/src/cpu/via/nano/Kconfig
+++ b/src/cpu/via/nano/Kconfig
@@ -26,6 +26,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_ROMSTAGE_X86_32
select ARCH_RAMSTAGE_X86_32
select UDELAY_TSC
+ select NO_MONOTONIC_TIMER
select MMX
select SSE2
select SUPPORT_CPU_UCODE_IN_CBFS
diff --git a/src/cpu/x86/Kconfig b/src/cpu/x86/Kconfig
index 608afd7a28..caee5dbd10 100644
--- a/src/cpu/x86/Kconfig
+++ b/src/cpu/x86/Kconfig
@@ -17,11 +17,6 @@ config PARALLEL_MP_AP_WORK
Allow APs to do other work after initialization instead of going
to sleep.
-config UDELAY_IO
- bool
- default y if !UDELAY_LAPIC && !UDELAY_TSC && !UDELAY_TIMER2 && !GENERIC_UDELAY
- default n
-
config UDELAY_LAPIC
bool
default n
@@ -29,7 +24,6 @@ config UDELAY_LAPIC
config LAPIC_MONOTONIC_TIMER
def_bool n
depends on UDELAY_LAPIC
- select HAVE_MONOTONIC_TIMER
help
Expose monotonic time using the local APIC.
@@ -50,15 +44,9 @@ config TSC_CONSTANT_RATE
config TSC_MONOTONIC_TIMER
def_bool n
depends on UDELAY_TSC
- select HAVE_MONOTONIC_TIMER
help
Expose monotonic time using the TSC.
-# This option is used in code but never selected.
-config UDELAY_TIMER2
- bool
- default n
-
config TSC_SYNC_LFENCE
bool
default n
@@ -98,14 +86,30 @@ config LOGICAL_CPUS
bool
default y
-config SMM_TSEG
+config HAVE_SMI_HANDLER
bool
default n
+ depends on (SMM_ASEG || SMM_TSEG)
+
+config NO_SMM
+ bool
+ default n
+
+config SMM_ASEG
+ bool
+ default n
+ depends on !NO_SMM
+
+config SMM_TSEG
+ bool
+ default y
+ depends on !(NO_SMM || SMM_ASEG)
+
+if SMM_TSEG
config SMM_MODULE_HEAP_SIZE
hex
default 0x4000
- depends on SMM_TSEG
help
This option determines the size of the heap within the SMM handler
modules.
@@ -113,7 +117,6 @@ config SMM_MODULE_HEAP_SIZE
config SMM_MODULE_STACK_SIZE
hex
default 0x400
- depends on SMM_TSEG
help
This option determines the size of the stack within the SMM handler
modules.
@@ -121,11 +124,12 @@ config SMM_MODULE_STACK_SIZE
config SMM_STUB_STACK_SIZE
hex
default 0x400
- depends on SMM_TSEG
help
This option determines the size of the stack within the SMM handler
modules.
+endif
+
config SMM_LAPIC_REMAP_MITIGATION
bool
default y if NORTHBRIDGE_INTEL_I945
diff --git a/src/cpu/x86/Kconfig.debug b/src/cpu/x86/Kconfig.debug
index 1c615f94d4..056934107c 100644
--- a/src/cpu/x86/Kconfig.debug
+++ b/src/cpu/x86/Kconfig.debug
@@ -14,4 +14,4 @@ config DISPLAY_MTRRS
config DEBUG_SMM_RELOCATION
bool "Debug SMM relocation code"
- depends on HAVE_SMI_HANDLER
+ depends on HAVE_SMI_HANDLER && SMM_ASEG
diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c
index 0f73e71331..cbbc10df31 100644
--- a/src/cpu/x86/lapic/lapic_cpu_init.c
+++ b/src/cpu/x86/lapic/lapic_cpu_init.c
@@ -417,7 +417,7 @@ asmlinkage void secondary_cpu_init(unsigned int index)
* Seems that CR4 was cleared when AP start via lapic_start_cpu()
* Turn on CR4.OSFXSR and CR4.OSXMMEXCPT when SSE options enabled
*/
- u32 cr4_val;
+ CRx_TYPE cr4_val;
cr4_val = read_cr4();
cr4_val |= (CR4_OSFXSR | CR4_OSXMMEXCPT);
write_cr4(cr4_val);
diff --git a/src/cpu/x86/pae/pgtbl.c b/src/cpu/x86/pae/pgtbl.c
index 9c921342f1..f54a1c35db 100644
--- a/src/cpu/x86/pae/pgtbl.c
+++ b/src/cpu/x86/pae/pgtbl.c
@@ -2,6 +2,8 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2005 Yinghai Lu
+ * Copyright (C) 2019 9elements Agency GmbH
+ * Copyright (C) 2019 Facebook Inc.
*
* 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
@@ -22,6 +24,7 @@
#include
#include
#include
+#include
#define PDPTE_PRES (1ULL << 0)
#define PDPTE_ADDR_MASK (~((1ULL << 12) - 1))
@@ -59,9 +62,20 @@
#define PTE_IDX_SHIFT 12
#define PTE_IDX_MASK 0x1ff
+#define OVERLAP(a, b, s, e) ((b) > (s) && (a) < (e))
+
static const size_t s2MiB = 2 * MiB;
static const size_t s4KiB = 4 * KiB;
+struct pde {
+ uint32_t addr_lo;
+ uint32_t addr_hi;
+} __packed;
+struct pg_table {
+ struct pde pd[2048];
+ struct pde pdp[512];
+} __packed;
+
void paging_enable_pae_cr3(uintptr_t cr3)
{
/* Load the page table address */
@@ -101,6 +115,119 @@ void paging_disable_pae(void)
write_cr4(cr4);
}
+/*
+ * Use PAE to map a page and then memset it with the pattern specified.
+ * In order to use PAE pagetables for virtual addressing are set up and reloaded
+ * on a 2MiB boundary. After the function is done, virtual addressing mode is
+ * disabled again. The PAT are set to all cachable, but MTRRs still apply.
+ *
+ * Requires a scratch memory for pagetables and a virtual address for
+ * non identity mapped memory.
+ *
+ * The scratch memory area containing pagetables must not overlap with the
+ * memory range to be cleared.
+ * The scratch memory area containing pagetables must not overlap with the
+ * virtual address for non identity mapped memory.
+ *
+ * @param vmem_addr Where the virtual non identity mapped page resides, must
+ * be 2 aligned MiB and at least 2 MiB in size.
+ * Content at physical address is preserved.
+ * @param pgtbl Where pagetables reside, must be 4 KiB aligned and 20 KiB in
+ * size.
+ * Must not overlap memory range pointed to by dest.
+ * Must not overlap memory range pointed to by vmem_addr.
+ * Content at physical address isn't preserved.
+ * @param length The length of the memory segment to memset
+ * @param dest Physical memory address to memset
+ * @param pat The pattern to write to the pyhsical memory
+ * @return 0 on success, 1 on error
+ */
+int memset_pae(uint64_t dest, unsigned char pat, uint64_t length, void *pgtbl,
+ void *vmem_addr)
+{
+ struct pg_table *pgtbl_buf = (struct pg_table *)pgtbl;
+ ssize_t offset;
+
+ printk(BIOS_DEBUG, "%s: Using virtual address %p as scratchpad\n",
+ __func__, vmem_addr);
+ printk(BIOS_DEBUG, "%s: Using address %p for page tables\n",
+ __func__, pgtbl_buf);
+
+ /* Cover some basic error conditions */
+ if (!IS_ALIGNED((uintptr_t)pgtbl_buf, s4KiB) ||
+ !IS_ALIGNED((uintptr_t)vmem_addr, s2MiB)) {
+ printk(BIOS_ERR, "%s: Invalid alignment\n", __func__);
+ return 1;
+ }
+ const uintptr_t pgtbl_s = (uintptr_t)pgtbl_buf;
+ const uintptr_t pgtbl_e = pgtbl_s + sizeof(struct pg_table);
+
+ if (OVERLAP(dest, dest + length, pgtbl_s, pgtbl_e)) {
+ printk(BIOS_ERR, "%s: destination overlaps page tables\n",
+ __func__);
+ return 1;
+ }
+
+ if (OVERLAP((uintptr_t)vmem_addr, (uintptr_t)vmem_addr + s2MiB,
+ pgtbl_s, pgtbl_e)) {
+ printk(BIOS_ERR, "%s: vmem address overlaps page tables\n",
+ __func__);
+ return 1;
+ }
+
+ paging_disable_pae();
+
+ struct pde *pd = pgtbl_buf->pd, *pdp = pgtbl_buf->pdp;
+ /* Point the page directory pointers at the page directories. */
+ memset(pgtbl_buf->pdp, 0, sizeof(pgtbl_buf->pdp));
+
+ pdp[0].addr_lo = ((uintptr_t)&pd[512*0]) | PDPTE_PRES;
+ pdp[1].addr_lo = ((uintptr_t)&pd[512*1]) | PDPTE_PRES;
+ pdp[2].addr_lo = ((uintptr_t)&pd[512*2]) | PDPTE_PRES;
+ pdp[3].addr_lo = ((uintptr_t)&pd[512*3]) | PDPTE_PRES;
+
+ offset = dest - ALIGN_DOWN(dest, s2MiB);
+ dest = ALIGN_DOWN(dest, s2MiB);
+
+ /* Identity map the whole 32-bit address space */
+ for (size_t i = 0; i < 2048; i++) {
+ pd[i].addr_lo = (i << PDE_IDX_SHIFT) | PDE_PS | PDE_PRES | PDE_RW;
+ pd[i].addr_hi = 0;
+ }
+
+ /* Get pointer to PD that's not identity mapped */
+ pd = &pgtbl_buf->pd[((uintptr_t)vmem_addr) >> PDE_IDX_SHIFT];
+
+ paging_enable_pae_cr3((uintptr_t)pdp);
+
+ do {
+ const size_t len = MIN(length, s2MiB - offset);
+
+ /*
+ * Map a page using PAE at virtual address vmem_addr.
+ * dest is already 2 MiB aligned.
+ */
+ pd->addr_lo = dest | PDE_PS | PDE_PRES | PDE_RW;
+ pd->addr_hi = dest >> 32;
+
+ /* Update page tables */
+ asm volatile ("invlpg (%0)" :: "b"(vmem_addr) : "memory");
+
+ printk(BIOS_SPEW, "%s: Clearing %llx[%lx] - %zx\n", __func__,
+ dest + offset, (uintptr_t)vmem_addr + offset, len);
+
+ memset(vmem_addr + offset, pat, len);
+
+ dest += s2MiB;
+ length -= len;
+ offset = 0;
+ } while (length > 0);
+
+ paging_disable_pae();
+
+ return 0;
+}
+
#if ENV_RAMSTAGE
void *map_2M_page(unsigned long page)
{
diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc
index e6add1d0d0..5c7aab3ffc 100644
--- a/src/cpu/x86/smm/Makefile.inc
+++ b/src/cpu/x86/smm/Makefile.inc
@@ -36,13 +36,16 @@ $(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smm.manual): $(obj)/smm/smm
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
cd $(dir $<); $(OBJCOPY_smm) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
+ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
+ramstage-srcs += $(obj)/cpu/x86/smm/smm.manual
+endif
+
ifeq ($(CONFIG_SMM_TSEG),y)
smmstub-y += smm_stub.S
smm-y += smm_module_handler.c
-ramstage-srcs += $(obj)/cpu/x86/smm/smm.manual
ramstage-srcs += $(obj)/cpu/x86/smm/smmstub.manual
# SMM Stub Module. The stub is used as a trampoline for relocation and normal
@@ -82,10 +85,6 @@ $(obj)/smm/smm: $(obj)/smm/smm.o $(src)/cpu/x86/smm/smm.ld
$(NM_smm) -n $(obj)/smm/smm.elf | sort > $(obj)/smm/smm.map
$(OBJCOPY_smm) -O binary $(obj)/smm/smm.elf $@
-ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
-ramstage-srcs += $(obj)/cpu/x86/smm/smm.manual
-endif
-
smm-y += smmhandler.S
smm-y += smihandler.c
diff --git a/src/cpu/x86/smm/smihandler.c b/src/cpu/x86/smm/smihandler.c
index 0ffa46537c..bc01522291 100644
--- a/src/cpu/x86/smm/smihandler.c
+++ b/src/cpu/x86/smm/smihandler.c
@@ -47,7 +47,7 @@ static int smi_obtain_lock(void)
return (ret == SMI_UNLOCKED);
}
-void smi_release_lock(void)
+static void smi_release_lock(void)
{
asm volatile (
"movb %1, %%al\n"
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index b3ffb3d318..fb5c5f33e9 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -185,7 +185,7 @@ static int smm_module_setup_stub(void *smbase, struct smm_loader_params *params,
void *stacks_top;
size_t size;
char *base;
- int i;
+ size_t i;
struct smm_stub_params *stub_params;
struct rmodule smm_stub;
diff --git a/src/cpu/x86/smm/smmrelocate.S b/src/cpu/x86/smm/smmrelocate.S
index c282904de9..e23b082aa7 100644
--- a/src/cpu/x86/smm/smmrelocate.S
+++ b/src/cpu/x86/smm/smmrelocate.S
@@ -32,10 +32,9 @@
// ADDR32() macro
#include
-#if CONFIG(SMM_TSEG)
-#error "Don't use this file with TSEG."
-
-#endif /* CONFIG_SMM_TSEG */
+#if !CONFIG(SMM_ASEG)
+#error "Only use this file with ASEG."
+#endif /* CONFIG_SMM_ASEG */
#define LAPIC_ID 0xfee00020
diff --git a/src/cpu/x86/tsc/Makefile.inc b/src/cpu/x86/tsc/Makefile.inc
index 9751cacc87..ab7453f262 100644
--- a/src/cpu/x86/tsc/Makefile.inc
+++ b/src/cpu/x86/tsc/Makefile.inc
@@ -3,6 +3,4 @@ ramstage-$(CONFIG_UDELAY_TSC) += delay_tsc.c
romstage-$(CONFIG_TSC_CONSTANT_RATE) += delay_tsc.c
verstage-$(CONFIG_TSC_CONSTANT_RATE) += delay_tsc.c
postcar-$(CONFIG_TSC_CONSTANT_RATE) += delay_tsc.c
-ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
smm-$(CONFIG_TSC_CONSTANT_RATE) += delay_tsc.c
-endif
diff --git a/src/device/device_const.c b/src/device/device_const.c
index 6ce1d18c93..c1b0b063ff 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -183,10 +183,42 @@ DEVTREE_CONST struct device *pcidev_path_behind(
return find_dev_path(parent, &path);
}
-DEVTREE_CONST struct device *pcidev_path_on_root(pci_devfn_t devfn)
+DEVTREE_CONST struct device *pcidev_path_on_bus(unsigned int bus, pci_devfn_t devfn)
+{
+ DEVTREE_CONST struct bus *parent = pci_root_bus();
+ DEVTREE_CONST struct device *dev = parent->children;
+
+ /* FIXME: Write the loop with topology links. */
+ while (dev) {
+ if (dev->path.type != DEVICE_PATH_PCI) {
+ dev = dev->next;
+ continue;
+ }
+ if (dev->bus->secondary == bus)
+ return pcidev_path_behind(dev->bus, devfn);
+ dev = dev->next;
+ }
+ return NULL;
+}
+
+DEVTREE_CONST struct bus *pci_root_bus(void)
{
DEVTREE_CONST struct device *pci_domain;
+ MAYBE_STATIC DEVTREE_CONST struct bus *pci_root = NULL;
+ if (pci_root)
+ return pci_root;
+
+ pci_domain = dev_find_path(NULL, DEVICE_PATH_DOMAIN);
+ if (!pci_domain)
+ return NULL;
+
+ pci_root = pci_domain->link_list;
+ return pci_root;
+}
+
+DEVTREE_CONST struct device *pcidev_path_on_root(pci_devfn_t devfn)
+{
/* Work around pcidev_path_behind() below failing
* due tue complicated devicetree with topology
* being manipulated on-the-fly.
@@ -194,11 +226,7 @@ DEVTREE_CONST struct device *pcidev_path_on_root(pci_devfn_t devfn)
if (CONFIG(NORTHBRIDGE_AMD_AMDFAM10))
return dev_find_slot(0, devfn);
- pci_domain = dev_find_path(NULL, DEVICE_PATH_DOMAIN);
- if (!pci_domain)
- return NULL;
-
- return pcidev_path_behind(pci_domain->link_list, devfn);
+ return pcidev_path_behind(pci_root_bus(), devfn);
}
DEVTREE_CONST struct device *pcidev_on_root(uint8_t dev, uint8_t fn)
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 11954a1982..7ded1df435 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -145,7 +145,7 @@ u32 dev_path_encode(const struct device *dev)
ret |= dev->path.spi.cs;
break;
case DEVICE_PATH_USB:
- ret |= dev->path.usb.port_type << 8 || dev->path.usb.port_id;
+ ret |= dev->path.usb.port_type << 8 | dev->path.usb.port_id;
break;
case DEVICE_PATH_NONE:
case DEVICE_PATH_MMIO: /* don't care */
diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c
index ccad5ce5a5..027c3ef1d4 100644
--- a/src/device/hypertransport.c
+++ b/src/device/hypertransport.c
@@ -291,7 +291,6 @@ static unsigned int do_hypertransport_scan_chain(struct bus *bus, unsigned min_d
prev.freq_cap_off = PCI_HT_CAP_HOST_FREQ_CAP;
/* If present, assign unitid to a hypertransport chain. */
- last_unitid = min_unitid -1;
max_unitid = next_unitid = min_unitid;
do {
u8 pos;
diff --git a/src/device/oprom/realmode/x86_interrupts.c b/src/device/oprom/realmode/x86_interrupts.c
index 2629ab9166..8e3a51e450 100644
--- a/src/device/oprom/realmode/x86_interrupts.c
+++ b/src/device/oprom/realmode/x86_interrupts.c
@@ -174,7 +174,7 @@ int int1a_handler(void)
devfn = X86_EBX & 0xff;
bus = X86_EBX >> 8;
reg = X86_EDI;
- dev = dev_find_slot(bus, devfn);
+ dev = pcidev_path_on_bus(bus, devfn);
if (!dev) {
printk(BIOS_DEBUG, "0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
// Or are we supposed to return PCIBIOS_NODEV?
diff --git a/src/device/oprom/yabel/device.h b/src/device/oprom/yabel/device.h
index 8e8450a1ed..4f28a59dfa 100644
--- a/src/device/oprom/yabel/device.h
+++ b/src/device/oprom/yabel/device.h
@@ -85,7 +85,9 @@ typedef struct {
u8 devfn;
#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
struct device* dev;
+ u64 puid; /* unused */
#else
+ void *dev;
u64 puid;
phandle_t phandle;
ihandle_t ihandle;
diff --git a/src/device/oprom/yabel/interrupt.c b/src/device/oprom/yabel/interrupt.c
index ea2a8036aa..338156f8ed 100644
--- a/src/device/oprom/yabel/interrupt.c
+++ b/src/device/oprom/yabel/interrupt.c
@@ -343,7 +343,8 @@ handleInt1a(void)
{
// function number in AX
u8 bus, devfn, offs;
- struct device* dev;
+ struct device *dev = NULL;
+
switch (M.x86.R_AX) {
case 0xb101:
// Installation check
@@ -361,30 +362,28 @@ handleInt1a(void)
//
DEBUG_PRINTF_INTR("%s(): function: %x: PCI Find Device\n",
__func__, M.x86.R_AX);
- /* FixME: support SI != 0 */
-#if CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)
- dev = dev_find_device(M.x86.R_DX, M.x86.R_CX, 0);
- if (dev != 0) {
- DEBUG_PRINTF_INTR
- ("%s(): function %x: PCI Find Device --> 0x%04x\n",
- __func__, M.x86.R_AX, M.x86.R_BX);
- M.x86.R_BH = dev->bus->secondary;
- M.x86.R_BL = dev->path.pci.devfn;
- M.x86.R_AH = 0x00; // return code: success
- CLEAR_FLAG(F_CF);
-#else
+ /* FixME: support SI != 0 */
+
// only allow the device to find itself...
if ((M.x86.R_CX == bios_device.pci_device_id)
&& (M.x86.R_DX == bios_device.pci_vendor_id)
// device index must be 0
&& (M.x86.R_SI == 0)) {
- CLEAR_FLAG(F_CF);
- M.x86.R_AH = 0x00; // return code: success
+ dev = bios_device.dev;
M.x86.R_BH = bios_device.bus;
M.x86.R_BL = bios_device.devfn;
-#endif
- } else {
+ } else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) {
+ dev = dev_find_device(M.x86.R_DX, M.x86.R_CX, 0);
+ if (dev != NULL) {
+ M.x86.R_BH = dev->bus->secondary;
+ M.x86.R_BL = dev->path.pci.devfn;
+ DEBUG_PRINTF_INTR
+ ("%s(): function %x: PCI Find Device --> 0x%04x\n",
+ __func__, M.x86.R_AX, M.x86.R_BX);
+ }
+ }
+ if (dev == NULL) {
DEBUG_PRINTF_INTR
("%s(): function %x: invalid device/vendor/device index! (%04x/%04x/%02x expected: %04x/%04x/00)\n",
__func__, M.x86.R_AX, M.x86.R_CX, M.x86.R_DX,
@@ -393,7 +392,10 @@ handleInt1a(void)
SET_FLAG(F_CF);
M.x86.R_AH = 0x86; // return code: device not found
+ return;
}
+ CLEAR_FLAG(F_CF);
+ M.x86.R_AH = 0x00; // return code: success
break;
case 0xb108: //read configuration byte
case 0xb109: //read configuration word
@@ -403,18 +405,16 @@ handleInt1a(void)
offs = M.x86.R_DI;
DEBUG_PRINTF_INTR("%s(): function: %x: PCI Config Read from device: bus: %02x, devfn: %02x, offset: %02x\n",
__func__, M.x86.R_AX, bus, devfn, offs);
-#if CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)
- dev = dev_find_slot(bus, devfn);
- DEBUG_PRINTF_INTR("%s(): function: %x: dev_find_slot() returned: %s\n",
+
+ if ((bus == bios_device.bus) && (devfn == bios_device.devfn)) {
+ dev = bios_device.dev;
+ } else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) {
+ dev = pcidev_path_on_bus(bus, devfn);
+ DEBUG_PRINTF_INTR("%s(): function: %x: pcidev_path_on_bus() returned: %s\n",
__func__, M.x86.R_AX, dev_path(dev));
- if (dev == 0) {
- // fail accesses to non-existent devices...
-#else
- dev = bios_device.dev;
- if ((bus != bios_device.bus)
- || (devfn != bios_device.devfn)) {
- // fail accesses to any device but ours...
-#endif
+ }
+
+ if (dev == NULL) {
printf
("%s(): Config read access invalid device! bus: %02x (%02x), devfn: %02x (%02x), offs: %02x\n",
__func__, bus, bios_device.bus, devfn,
@@ -423,57 +423,54 @@ handleInt1a(void)
M.x86.R_AH = 0x87; //return code: bad pci register
HALT_SYS();
return;
- } else {
- switch (M.x86.R_AX) {
- case 0xb108:
- M.x86.R_CL =
-#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
- pci_read_config8(dev, offs);
-#else
- (u8) rtas_pci_config_read(bios_device.
- puid, 1,
- bus, devfn,
- offs);
-#endif
- DEBUG_PRINTF_INTR
- ("%s(): function %x: PCI Config Read @%02x --> 0x%02x\n",
- __func__, M.x86.R_AX, offs,
- M.x86.R_CL);
- break;
- case 0xb109:
- M.x86.R_CX =
-#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
- pci_read_config16(dev, offs);
-#else
- (u16) rtas_pci_config_read(bios_device.
- puid, 2,
- bus, devfn,
- offs);
-#endif
- DEBUG_PRINTF_INTR
- ("%s(): function %x: PCI Config Read @%02x --> 0x%04x\n",
- __func__, M.x86.R_AX, offs,
- M.x86.R_CX);
- break;
- case 0xb10a:
- M.x86.R_ECX =
-#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
- pci_read_config32(dev, offs);
-#else
- (u32) rtas_pci_config_read(bios_device.
- puid, 4,
- bus, devfn,
- offs);
-#endif
- DEBUG_PRINTF_INTR
- ("%s(): function %x: PCI Config Read @%02x --> 0x%08x\n",
- __func__, M.x86.R_AX, offs,
- M.x86.R_ECX);
- break;
- }
- CLEAR_FLAG(F_CF);
- M.x86.R_AH = 0x0; // return code: success
}
+
+ switch (M.x86.R_AX) {
+ case 0xb108:
+ M.x86.R_CL =
+#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
+ pci_read_config8(dev, offs);
+#else
+ (u8) rtas_pci_config_read(bios_device.puid, 1,
+ bus, devfn,
+ offs);
+#endif
+ DEBUG_PRINTF_INTR
+ ("%s(): function %x: PCI Config Read @%02x --> 0x%02x\n",
+ __func__, M.x86.R_AX, offs,
+ M.x86.R_CL);
+ break;
+ case 0xb109:
+ M.x86.R_CX =
+#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
+ pci_read_config16(dev, offs);
+#else
+ (u16) rtas_pci_config_read(bios_device.puid, 2,
+ bus, devfn,
+ offs);
+#endif
+ DEBUG_PRINTF_INTR
+ ("%s(): function %x: PCI Config Read @%02x --> 0x%04x\n",
+ __func__, M.x86.R_AX, offs,
+ M.x86.R_CX);
+ break;
+ case 0xb10a:
+ M.x86.R_ECX =
+#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
+ pci_read_config32(dev, offs);
+#else
+ (u32) rtas_pci_config_read(bios_device.puid, 4,
+ bus, devfn,
+ offs);
+#endif
+ DEBUG_PRINTF_INTR
+ ("%s(): function %x: PCI Config Read @%02x --> 0x%08x\n",
+ __func__, M.x86.R_AX, offs,
+ M.x86.R_ECX);
+ break;
+ }
+ CLEAR_FLAG(F_CF);
+ M.x86.R_AH = 0x0; // return code: success
break;
case 0xb10b: //write configuration byte
case 0xb10c: //write configuration word
@@ -481,9 +478,12 @@ handleInt1a(void)
bus = M.x86.R_BH;
devfn = M.x86.R_BL;
offs = M.x86.R_DI;
- if ((bus != bios_device.bus)
- || (devfn != bios_device.devfn)) {
- // fail accesses to any device but ours...
+
+ if ((bus == bios_device.bus) && (devfn == bios_device.devfn)) {
+ dev = bios_device.dev;
+ }
+
+ if (dev == NULL) {
printf
("%s(): Config read access invalid! bus: %x (%x), devfn: %x (%x), offs: %x\n",
__func__, bus, bios_device.bus, devfn,
@@ -492,48 +492,48 @@ handleInt1a(void)
M.x86.R_AH = 0x87; //return code: bad pci register
HALT_SYS();
return;
- } else {
- switch (M.x86.R_AX) {
- case 0xb10b:
-#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
- pci_write_config8(bios_device.dev, offs, M.x86.R_CL);
-#else
- rtas_pci_config_write(bios_device.puid, 1, bus,
- devfn, offs, M.x86.R_CL);
-#endif
- DEBUG_PRINTF_INTR
- ("%s(): function %x: PCI Config Write @%02x <-- 0x%02x\n",
- __func__, M.x86.R_AX, offs,
- M.x86.R_CL);
- break;
- case 0xb10c:
-#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
- pci_write_config16(bios_device.dev, offs, M.x86.R_CX);
-#else
- rtas_pci_config_write(bios_device.puid, 2, bus,
- devfn, offs, M.x86.R_CX);
-#endif
- DEBUG_PRINTF_INTR
- ("%s(): function %x: PCI Config Write @%02x <-- 0x%04x\n",
- __func__, M.x86.R_AX, offs,
- M.x86.R_CX);
- break;
- case 0xb10d:
-#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
- pci_write_config32(bios_device.dev, offs, M.x86.R_ECX);
-#else
- rtas_pci_config_write(bios_device.puid, 4, bus,
- devfn, offs, M.x86.R_ECX);
-#endif
- DEBUG_PRINTF_INTR
- ("%s(): function %x: PCI Config Write @%02x <-- 0x%08x\n",
- __func__, M.x86.R_AX, offs,
- M.x86.R_ECX);
- break;
- }
- CLEAR_FLAG(F_CF);
- M.x86.R_AH = 0x0; // return code: success
}
+
+ switch (M.x86.R_AX) {
+ case 0xb10b:
+#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
+ pci_write_config8(dev, offs, M.x86.R_CL);
+#else
+ rtas_pci_config_write(bios_device.puid, 1, bus,
+ devfn, offs, M.x86.R_CL);
+#endif
+ DEBUG_PRINTF_INTR
+ ("%s(): function %x: PCI Config Write @%02x <-- 0x%02x\n",
+ __func__, M.x86.R_AX, offs,
+ M.x86.R_CL);
+ break;
+ case 0xb10c:
+#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
+ pci_write_config16(dev, offs, M.x86.R_CX);
+#else
+ rtas_pci_config_write(bios_device.puid, 2, bus,
+ devfn, offs, M.x86.R_CX);
+#endif
+ DEBUG_PRINTF_INTR
+ ("%s(): function %x: PCI Config Write @%02x <-- 0x%04x\n",
+ __func__, M.x86.R_AX, offs,
+ M.x86.R_CX);
+ break;
+ case 0xb10d:
+#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
+ pci_write_config32(dev, offs, M.x86.R_ECX);
+#else
+ rtas_pci_config_write(bios_device.puid, 4, bus,
+ devfn, offs, M.x86.R_ECX);
+#endif
+ DEBUG_PRINTF_INTR
+ ("%s(): function %x: PCI Config Write @%02x <-- 0x%08x\n",
+ __func__, M.x86.R_AX, offs,
+ M.x86.R_ECX);
+ break;
+ }
+ CLEAR_FLAG(F_CF);
+ M.x86.R_AH = 0x0; // return code: success
break;
default:
printf("%s(): unknown function (%x) for int1a handler.\n",
diff --git a/src/device/oprom/yabel/io.c b/src/device/oprom/yabel/io.c
index 7117a6eed4..e8c41ce24a 100644
--- a/src/device/oprom/yabel/io.c
+++ b/src/device/oprom/yabel/io.c
@@ -410,118 +410,124 @@ my_outl(X86EMU_pioAddr addr, u32 val)
u32
pci_cfg_read(X86EMU_pioAddr addr, u8 size)
{
+ u32 port_cf8_val = 0;
u32 rval = 0xFFFFFFFF;
- struct device * dev;
- if ((addr >= 0xCFC) && ((addr + size) <= 0xD00)) {
- // PCI Configuration Mechanism 1 step 1
- // write to 0xCF8, sets bus, device, function and Config Space offset
- // later read from 0xCFC-0xCFF returns the value...
- u8 bus, devfn, offs;
- u32 port_cf8_val = my_inl(0xCF8);
- if ((port_cf8_val & 0x80000000) != 0) {
- //highest bit enables config space mapping
- bus = (port_cf8_val & 0x00FF0000) >> 16;
- devfn = (port_cf8_val & 0x0000FF00) >> 8;
- offs = (port_cf8_val & 0x000000FF);
- offs += (addr - 0xCFC); // if addr is not 0xcfc, the offset is moved accordingly
- DEBUG_PRINTF_INTR("%s(): PCI Config Read from device: bus: %02x, devfn: %02x, offset: %02x\n",
- __func__, bus, devfn, offs);
-#if CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)
- dev = dev_find_slot(bus, devfn);
- DEBUG_PRINTF_INTR("%s(): dev_find_slot() returned: %s\n",
- __func__, dev_path(dev));
- if (dev == 0) {
- // fail accesses to non-existent devices...
-#else
- dev = bios_device.dev;
- if ((bus != bios_device.bus)
- || (devfn != bios_device.devfn)) {
- // fail accesses to any device but ours...
-#endif
- printf
- ("%s(): Config read access invalid device! bus: %02x (%02x), devfn: %02x (%02x), offs: %02x\n",
- __func__, bus, bios_device.bus, devfn,
- bios_device.devfn, offs);
- SET_FLAG(F_CF);
- HALT_SYS();
- return 0;
- } else {
-#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
- switch (size) {
- case 1:
- rval = pci_read_config8(dev, offs);
- break;
- case 2:
- rval = pci_read_config16(dev, offs);
- break;
- case 4:
- rval = pci_read_config32(dev, offs);
- break;
- }
-#else
- rval =
- (u32) rtas_pci_config_read(bios_device.
- puid, size,
- bus, devfn,
- offs);
-#endif
- DEBUG_PRINTF_IO
- ("%s(%04x) PCI Config Read @%02x, size: %d --> 0x%08x\n",
- __func__, addr, offs, size, rval);
- }
- }
+ struct device *dev = NULL;
+ u8 bus, devfn, offs;
+
+ // PCI Configuration Mechanism 1 step 1
+ // write to 0xCF8, sets bus, device, function and Config Space offset
+ // later read from 0xCFC-0xCFF returns the value...
+ if ((addr >= 0xCFC) && ((addr + size) <= 0xD00))
+ port_cf8_val = my_inl(0xCF8);
+
+ if ((port_cf8_val & 0x80000000) == 0)
+ return rval;
+
+ //highest bit enables config space mapping
+ bus = (port_cf8_val & 0x00FF0000) >> 16;
+ devfn = (port_cf8_val & 0x0000FF00) >> 8;
+ offs = (port_cf8_val & 0x000000FF);
+ offs += (addr - 0xCFC); // if addr is not 0xcfc, the offset is moved accordingly
+ DEBUG_PRINTF_INTR("%s(): PCI Config Read from device: bus: %02x, devfn: %02x, offset: %02x\n",
+ __func__, bus, devfn, offs);
+
+ if ((bus == bios_device.bus) && (devfn == bios_device.devfn)) {
+ dev = bios_device.dev;
+ } else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) {
+ dev = pcidev_path_on_bus(bus, devfn);
+ DEBUG_PRINTF_INTR("%s(): pcidev_path_on_bus() returned: %s\n",
+ __func__, dev_path(dev));
}
+
+ if (dev == NULL) {
+ printf
+ ("%s(): Config read access invalid device! bus: %02x (%02x), devfn: %02x (%02x), offs: %02x\n",
+ __func__, bus, bios_device.bus, devfn,
+ bios_device.devfn, offs);
+ SET_FLAG(F_CF);
+ HALT_SYS();
+ return 0;
+ }
+
+ if (CONFIG(PCI_OPTION_ROM_RUN_YABEL)) {
+ switch (size) {
+ case 1:
+ rval = pci_read_config8(dev, offs);
+ break;
+ case 2:
+ rval = pci_read_config16(dev, offs);
+ break;
+ case 4:
+ rval = pci_read_config32(dev, offs);
+ break;
+ }
+ } else {
+ rval = (u32) rtas_pci_config_read(bios_device.puid, size, bus, devfn, offs);
+ }
+
+ DEBUG_PRINTF_IO
+ ("%s(%04x) PCI Config Read @%02x, size: %d --> 0x%08x\n",
+ __func__, addr, offs, size, rval);
+
return rval;
}
void
pci_cfg_write(X86EMU_pioAddr addr, u32 val, u8 size)
{
- if ((addr >= 0xCFC) && ((addr + size) <= 0xD00)) {
- // PCI Configuration Mechanism 1 step 1
- // write to 0xCF8, sets bus, device, function and Config Space offset
- // later write to 0xCFC-0xCFF sets the value...
- u8 bus, devfn, offs;
- u32 port_cf8_val = my_inl(0xCF8);
- if ((port_cf8_val & 0x80000000) != 0) {
- //highest bit enables config space mapping
- bus = (port_cf8_val & 0x00FF0000) >> 16;
- devfn = (port_cf8_val & 0x0000FF00) >> 8;
- offs = (port_cf8_val & 0x000000FF);
- offs += (addr - 0xCFC); // if addr is not 0xcfc, the offset is moved accordingly
- if ((bus != bios_device.bus)
- || (devfn != bios_device.devfn)) {
- // fail accesses to any device but ours...
- printf
- ("Config write access invalid! PCI device %x:%x.%x, offs: %x\n",
- bus, devfn >> 3, devfn & 7, offs);
-#if !CONFIG(YABEL_PCI_FAKE_WRITING_OTHER_DEVICES_CONFIG)
- HALT_SYS();
-#endif
- } else {
-#if CONFIG(PCI_OPTION_ROM_RUN_YABEL)
- switch (size) {
- case 1:
- pci_write_config8(bios_device.dev, offs, val);
- break;
- case 2:
- pci_write_config16(bios_device.dev, offs, val);
- break;
- case 4:
- pci_write_config32(bios_device.dev, offs, val);
- break;
- }
-#else
- rtas_pci_config_write(bios_device.puid,
- size, bus, devfn, offs,
- val);
-#endif
- DEBUG_PRINTF_IO
- ("%s(%04x) PCI Config Write @%02x, size: %d <-- 0x%08x\n",
- __func__, addr, offs, size, val);
- }
- }
+ struct device *dev = NULL;
+ u32 port_cf8_val = 0;
+ u8 bus, devfn, offs;
+
+ // PCI Configuration Mechanism 1 step 1
+ // write to 0xCF8, sets bus, device, function and Config Space offset
+ // later write to 0xCFC-0xCFF sets the value...
+
+ if ((addr >= 0xCFC) && ((addr + size) <= 0xD00))
+ port_cf8_val = my_inl(0xCF8);
+
+ if ((port_cf8_val & 0x80000000) == 0)
+ return;
+
+ //highest bit enables config space mapping
+ bus = (port_cf8_val & 0x00FF0000) >> 16;
+ devfn = (port_cf8_val & 0x0000FF00) >> 8;
+ offs = (port_cf8_val & 0x000000FF);
+ offs += (addr - 0xCFC); // if addr is not 0xcfc, the offset is moved accordingly
+
+ if ((bus == bios_device.bus) && (devfn == bios_device.devfn)) {
+ dev = bios_device.dev;
+ } else {
+ printf
+ ("Config write access invalid! PCI device %x:%x.%x, offs: %x\n",
+ bus, devfn >> 3, devfn & 7, offs);
+
+ if (CONFIG(YABEL_PCI_FAKE_WRITING_OTHER_DEVICES_CONFIG))
+ return;
+ // fail accesses to any device but ours...
+ HALT_SYS();
}
+
+ if (CONFIG(PCI_OPTION_ROM_RUN_YABEL)) {
+ switch (size) {
+ case 1:
+ pci_write_config8(dev, offs, val);
+ break;
+ case 2:
+ pci_write_config16(dev, offs, val);
+ break;
+ case 4:
+ pci_write_config32(dev, offs, val);
+ break;
+ }
+ } else {
+ rtas_pci_config_write(bios_device.puid, size, bus, devfn, offs, val);
+ }
+
+ DEBUG_PRINTF_IO
+ ("%s(%04x) PCI Config Write @%02x, size: %d <-- 0x%08x\n",
+ __func__, addr, offs, size, val);
}
u8
diff --git a/src/device/pci_device.c b/src/device/pci_device.c
index 31c35dc02e..9c47085152 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -101,73 +101,6 @@ u32 pci_moving_config32(struct device *dev, unsigned int reg)
return ones ^ zeroes;
}
-/**
- * Given a device, a capability type, and a last position, return the next
- * matching capability. Always start at the head of the list.
- *
- * @param dev Pointer to the device structure.
- * @param cap PCI_CAP_LIST_ID of the PCI capability we're looking for.
- * @param last Location of the PCI capability register to start from.
- * @return The next matching capability.
- */
-unsigned pci_find_next_capability(struct device *dev, unsigned cap,
- unsigned last)
-{
- unsigned pos = 0;
- u16 status;
- unsigned reps = 48;
-
- status = pci_read_config16(dev, PCI_STATUS);
- if (!(status & PCI_STATUS_CAP_LIST))
- return 0;
-
- switch (dev->hdr_type & 0x7f) {
- case PCI_HEADER_TYPE_NORMAL:
- case PCI_HEADER_TYPE_BRIDGE:
- pos = PCI_CAPABILITY_LIST;
- break;
- case PCI_HEADER_TYPE_CARDBUS:
- pos = PCI_CB_CAPABILITY_LIST;
- break;
- default:
- return 0;
- }
-
- pos = pci_read_config8(dev, pos);
- while (reps-- && (pos >= 0x40)) { /* Loop through the linked list. */
- int this_cap;
-
- pos &= ~3;
- this_cap = pci_read_config8(dev, pos + PCI_CAP_LIST_ID);
- printk(BIOS_SPEW, "Capability: type 0x%02x @ 0x%02x\n",
- this_cap, pos);
- if (this_cap == 0xff)
- break;
-
- if (!last && (this_cap == cap))
- return pos;
-
- if (last == pos)
- last = 0;
-
- pos = pci_read_config8(dev, pos + PCI_CAP_LIST_NEXT);
- }
- return 0;
-}
-
-/**
- * Given a device, and a capability type, return the next matching
- * capability. Always start at the head of the list.
- *
- * @param dev Pointer to the device structure.
- * @param cap PCI_CAP_LIST_ID of the PCI capability we're looking for.
- * @return The next matching capability.
- */
-unsigned int pci_find_capability(struct device *dev, unsigned int cap)
-{
- return pci_find_next_capability(dev, cap, 0);
-}
-
/**
* Given a device and register, read the size of the BAR for that register.
*
@@ -659,11 +592,12 @@ void pci_dev_set_resources(struct device *dev)
void pci_dev_enable_resources(struct device *dev)
{
- const struct pci_operations *ops;
+ const struct pci_operations *ops = NULL;
u16 command;
/* Set the subsystem vendor and device ID for mainboard devices. */
- ops = ops_pci(dev);
+ if (dev->ops)
+ ops = dev->ops->ops_pci;
if (dev->on_mainboard && ops && ops->set_subsystem) {
if (CONFIG_SUBSYSTEM_VENDOR_ID)
dev->subsystem_vendor = CONFIG_SUBSYSTEM_VENDOR_ID;
@@ -1566,27 +1500,24 @@ int get_pci_irq_pins(struct device *dev, struct device **parent_bdg)
*
* This function should be called for each PCI slot in your system.
*
- * @param bus Pointer to the bus structure.
- * @param slot TODO
+ * @param dev Pointer to dev structure.
* @param pIntAtoD An array of IRQ #s that are assigned to PINTA through PINTD
* of this slot. The particular IRQ #s that are passed in depend on the
* routing inside your southbridge and on your board.
*/
-void pci_assign_irqs(unsigned bus, unsigned slot,
- const unsigned char pIntAtoD[4])
+void pci_assign_irqs(struct device *dev, const unsigned char pIntAtoD[4])
{
- unsigned int funct;
- struct device *pdev;
- u8 line, irq;
+ u8 slot, line, irq;
- /* Each slot may contain up to eight functions. */
- for (funct = 0; funct < 8; funct++) {
- pdev = dev_find_slot(bus, (slot << 3) + funct);
+ /* Each device may contain up to eight functions. */
+ slot = dev->path.pci.devfn >> 3;
- if (!pdev)
- continue;
+ for (; dev ; dev = dev->sibling) {
- line = pci_read_config8(pdev, PCI_INTERRUPT_PIN);
+ if (dev->path.pci.devfn >> 3 != slot)
+ break;
+
+ line = pci_read_config8(dev, PCI_INTERRUPT_PIN);
/* PCI spec says all values except 1..4 are reserved. */
if ((line < 1) || (line > 4))
@@ -1594,11 +1525,9 @@ void pci_assign_irqs(unsigned bus, unsigned slot,
irq = pIntAtoD[line - 1];
- printk(BIOS_DEBUG, "Assigning IRQ %d to %d:%x.%d\n",
- irq, bus, slot, funct);
+ printk(BIOS_DEBUG, "Assigning IRQ %d to %s\n", irq, dev_path(dev));
- pci_write_config8(pdev, PCI_INTERRUPT_LINE,
- pIntAtoD[line - 1]);
+ pci_write_config8(dev, PCI_INTERRUPT_LINE, pIntAtoD[line - 1]);
#ifdef PARANOID_IRQ_ASSIGNMENTS
irq = pci_read_config8(pdev, PCI_INTERRUPT_LINE);
diff --git a/src/device/pci_early.c b/src/device/pci_early.c
index 5a1fb22681..7c9ea005c6 100644
--- a/src/device/pci_early.c
+++ b/src/device/pci_early.c
@@ -21,54 +21,6 @@
#include
#include
-unsigned pci_find_next_capability(pci_devfn_t dev, unsigned cap, unsigned last)
-{
- unsigned pos = 0;
- u16 status;
- unsigned reps = 48;
-
- status = pci_read_config16(dev, PCI_STATUS);
- if (!(status & PCI_STATUS_CAP_LIST))
- return 0;
-
- u8 hdr_type = pci_read_config8(dev, PCI_HEADER_TYPE);
- switch (hdr_type & 0x7f) {
- case PCI_HEADER_TYPE_NORMAL:
- case PCI_HEADER_TYPE_BRIDGE:
- pos = PCI_CAPABILITY_LIST;
- break;
- case PCI_HEADER_TYPE_CARDBUS:
- pos = PCI_CB_CAPABILITY_LIST;
- break;
- default:
- return 0;
- }
-
- pos = pci_read_config8(dev, pos);
- while (reps-- && (pos >= 0x40)) { /* Loop through the linked list. */
- int this_cap;
-
- pos &= ~3;
- this_cap = pci_read_config8(dev, pos + PCI_CAP_LIST_ID);
- if (this_cap == 0xff)
- break;
-
- if (!last && (this_cap == cap))
- return pos;
-
- if (last == pos)
- last = 0;
-
- pos = pci_read_config8(dev, pos + PCI_CAP_LIST_NEXT);
- }
- return 0;
-}
-
-unsigned pci_find_capability(pci_devfn_t dev, unsigned cap)
-{
- return pci_find_next_capability(dev, cap, 0);
-}
-
static void pci_bridge_reset_secondary(pci_devfn_t p2p_bridge)
{
u16 reg16;
diff --git a/src/device/pci_ops.c b/src/device/pci_ops.c
index 34f9d1e5b5..96133155be 100644
--- a/src/device/pci_ops.c
+++ b/src/device/pci_ops.c
@@ -11,6 +11,77 @@
* GNU General Public License for more details.
*/
+#define __SIMPLE_DEVICE__
+
#include
+#include
+#include
+#include
+#include
u8 *const pci_mmconf = (void *)(uintptr_t)CONFIG_MMCONF_BASE_ADDRESS;
+
+/**
+ * Given a device, a capability type, and a last position, return the next
+ * matching capability. Always start at the head of the list.
+ *
+ * @param dev Pointer to the device structure.
+ * @param cap PCI_CAP_LIST_ID of the PCI capability we're looking for.
+ * @param last Location of the PCI capability register to start from.
+ * @return The next matching capability.
+ */
+u16 pci_s_find_next_capability(pci_devfn_t dev, u16 cap, u16 last)
+{
+ u16 pos = 0;
+ u16 status;
+ int reps = 48;
+
+ status = pci_s_read_config16(dev, PCI_STATUS);
+ if (!(status & PCI_STATUS_CAP_LIST))
+ return 0;
+
+ u8 hdr_type = pci_s_read_config8(dev, PCI_HEADER_TYPE);
+ switch (hdr_type & 0x7f) {
+ case PCI_HEADER_TYPE_NORMAL:
+ case PCI_HEADER_TYPE_BRIDGE:
+ pos = PCI_CAPABILITY_LIST;
+ break;
+ case PCI_HEADER_TYPE_CARDBUS:
+ pos = PCI_CB_CAPABILITY_LIST;
+ break;
+ default:
+ return 0;
+ }
+
+ pos = pci_s_read_config8(dev, pos);
+ while (reps-- && (pos >= 0x40)) { /* Loop through the linked list. */
+ int this_cap;
+
+ pos &= ~3;
+ this_cap = pci_s_read_config8(dev, pos + PCI_CAP_LIST_ID);
+ if (this_cap == 0xff)
+ break;
+
+ if (!last && (this_cap == cap))
+ return pos;
+
+ if (last == pos)
+ last = 0;
+
+ pos = pci_s_read_config8(dev, pos + PCI_CAP_LIST_NEXT);
+ }
+ return 0;
+}
+
+/**
+ * Given a device, and a capability type, return the next matching
+ * capability. Always start at the head of the list.
+ *
+ * @param dev Pointer to the device structure.
+ * @param cap PCI_CAP_LIST_ID of the PCI capability we're looking for.
+ * @return The next matching capability.
+ */
+u16 pci_s_find_capability(pci_devfn_t dev, u16 cap)
+{
+ return pci_s_find_next_capability(dev, cap, 0);
+}
diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c
index 3160c2041b..34a9a81a52 100644
--- a/src/device/pci_rom.c
+++ b/src/device/pci_rom.c
@@ -56,9 +56,9 @@ struct rom_header *pci_rom_probe(struct device *dev)
printk(BIOS_DEBUG, "In CBFS, ROM address for %s = %p\n",
dev_path(dev), rom_header);
} else if (!CONFIG(ON_DEVICE_ROM_LOAD)) {
- printk(BIOS_DEBUG, "PCI Option ROM loading disabled "
- "for %s\n", dev_path(dev));
- return NULL;
+ printk(BIOS_DEBUG, "PCI Option ROM loading disabled for %s\n",
+ dev_path(dev));
+ return NULL;
} else {
uintptr_t rom_address;
@@ -77,6 +77,8 @@ struct rom_header *pci_rom_probe(struct device *dev)
rom_address|PCI_ROM_ADDRESS_ENABLE);
}
+ rom_address &= PCI_ROM_ADDRESS_MASK;
+
printk(BIOS_DEBUG, "Option ROM address for %s = %lx\n",
dev_path(dev), (unsigned long)rom_address);
rom_header = (struct rom_header *)rom_address;
@@ -207,8 +209,6 @@ pci_rom_acpi_fill_vfct(struct device *device, struct acpi_vfct *vfct_struct,
struct acpi_vfct_image_hdr *header = &vfct_struct->image_hdr;
struct rom_header *rom;
- vfct_struct->VBIOSImageOffset = (size_t)header - (size_t)vfct_struct;
-
rom = check_initialized(device);
if (!rom)
rom = pci_rom_probe(device);
@@ -231,6 +231,8 @@ pci_rom_acpi_fill_vfct(struct device *device, struct acpi_vfct *vfct_struct,
header->ImageLength = rom->size * 512;
memcpy((void *)&header->VbiosContent, rom, header->ImageLength);
+ vfct_struct->VBIOSImageOffset = (size_t)header - (size_t)vfct_struct;
+
current += header->ImageLength;
return current;
}
@@ -239,9 +241,6 @@ unsigned long
pci_rom_write_acpi_tables(struct device *device, unsigned long current,
struct acpi_rsdp *rsdp)
{
- struct acpi_vfct *vfct;
- struct rom_header *rom;
-
/* Only handle VGA devices */
if ((device->class >> 8) != PCI_CLASS_DISPLAY_VGA)
return current;
@@ -250,19 +249,18 @@ pci_rom_write_acpi_tables(struct device *device, unsigned long current,
if (!device->enabled)
return current;
- /* Probe for option rom */
- rom = pci_rom_probe(device);
- if (!rom)
- return current;
-
/* AMD/ATI uses VFCT */
if (device->vendor == PCI_VENDOR_ID_ATI) {
+ struct acpi_vfct *vfct;
+
current = ALIGN_UP(current, 8);
- printk(BIOS_DEBUG, "ACPI: * VFCT at %lx\n", current);
vfct = (struct acpi_vfct *)current;
acpi_create_vfct(device, vfct, pci_rom_acpi_fill_vfct);
- current += vfct->header.length;
- acpi_add_table(rsdp, vfct);
+ if (vfct->header.length) {
+ printk(BIOS_DEBUG, "ACPI: * VFCT at %lx\n", current);
+ current += vfct->header.length;
+ acpi_add_table(rsdp, vfct);
+ }
}
return current;
diff --git a/src/drivers/amd/agesa/oem_s3.c b/src/drivers/amd/agesa/oem_s3.c
index acd34b8edf..9514bcdf5e 100644
--- a/src/drivers/amd/agesa/oem_s3.c
+++ b/src/drivers/amd/agesa/oem_s3.c
@@ -18,7 +18,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -122,8 +121,6 @@ AGESA_STATUS OemS3Save(AMD_S3_PARAMS *dataBlock)
u32 MTRRStorageSize = 0;
uintptr_t pos, size;
- romstage_ram_stack_base(HIGH_ROMSTAGE_STACK_SIZE, ROMSTAGE_STACK_CBMEM);
-
/* To be consumed in AmdInitResume. */
get_s3nv_data(S3DataTypeNonVolatile, &pos, &size);
if (size && dataBlock->NvStorageSize)
diff --git a/src/drivers/elog/Kconfig b/src/drivers/elog/Kconfig
index da8a5fa220..4a66e788bb 100644
--- a/src/drivers/elog/Kconfig
+++ b/src/drivers/elog/Kconfig
@@ -42,10 +42,8 @@ config ELOG_PRERAM
help
This option will enable event logging from the preram stage.
-endif
-
config ELOG_GSMI
- depends on ELOG && SMM_TSEG
+ depends on HAVE_SMI_HANDLER
bool "SMI interface to write and clear event log"
select SPI_FLASH_SMM if BOOT_DEVICE_SPI_FLASH_RW_NOMMAP
default n
@@ -55,7 +53,6 @@ config ELOG_GSMI
kernel reset/shutdown messages to the event log.
config ELOG_BOOT_COUNT
- depends on ELOG
bool "Maintain a monotonic boot number in CMOS"
default n
help
@@ -64,9 +61,11 @@ config ELOG_BOOT_COUNT
counter will be logged as part of the System Boot event.
config ELOG_BOOT_COUNT_CMOS_OFFSET
- depends on ELOG && ELOG_BOOT_COUNT && !USE_OPTION_TABLE
+ depends on ELOG_BOOT_COUNT && !USE_OPTION_TABLE
int "Offset in CMOS to store the boot count"
default 0
help
This value must be greater than 16 bytes so as not to interfere
with the standard RTC region. Requires 8 bytes.
+
+endif
diff --git a/src/drivers/intel/fsp1_1/car.c b/src/drivers/intel/fsp1_1/car.c
index bd3f4787a0..19eb041eac 100644
--- a/src/drivers/intel/fsp1_1/car.c
+++ b/src/drivers/intel/fsp1_1/car.c
@@ -14,6 +14,7 @@
*/
#include
+#include
#include
#include
#include
@@ -22,9 +23,6 @@
#include
#include
#include
-#include
-
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
@@ -32,10 +30,9 @@
void platform_enter_postcar(void)
{
struct postcar_frame pcf;
- size_t alignment;
- uint32_t aligned_ram;
+ uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
postcar_frame_add_mtrr(&pcf, CACHE_ROM_BASE, CACHE_ROM_SIZE,
@@ -44,53 +41,11 @@ void platform_enter_postcar(void)
/* Cache RAM as WB from 0 -> CACHE_TMP_RAMTOP. */
postcar_frame_add_mtrr(&pcf, 0, CACHE_TMP_RAMTOP, MTRR_TYPE_WRBACK);
- /*
- * +-------------------------+ Top of RAM (aligned)
- * | System Management Mode |
- * | code and data | Length: CONFIG_TSEG_SIZE
- * | (TSEG) |
- * +-------------------------+ SMM base (aligned)
- * | |
- * | Chipset Reserved Memory | Length: Multiple of CONFIG_TSEG_SIZE
- * | |
- * +-------------------------+ top_of_ram (aligned)
- * | |
- * | CBMEM Root |
- * | |
- * +-------------------------+
- * | |
- * | FSP Reserved Memory |
- * | |
- * +-------------------------+
- * | |
- * | Various CBMEM Entries |
- * | |
- * +-------------------------+ top_of_stack (8 byte aligned)
- * | |
- * | stack (CBMEM Entry) |
- * | |
- * +-------------------------+
- */
-
- alignment = mmap_region_granularity();
- aligned_ram = ALIGN_DOWN(romstage_ram_stack_bottom(), alignment);
- postcar_frame_add_mtrr(&pcf, aligned_ram, alignment, MTRR_TYPE_WRBACK);
-
- if (CONFIG(HAVE_SMI_HANDLER)) {
- void *smm_base;
- size_t smm_size;
-
- /*
- * Cache the TSEG region at the top of ram. This region is not
- * restricted to SMM mode until SMM has been relocated. By
- * setting the region to cacheable it provides faster access
- * when relocating the SMM handler as well as using the TSEG
- * region for other purposes.
- */
- smm_region(&smm_base, &smm_size);
- postcar_frame_add_mtrr(&pcf, (uintptr_t)smm_base, alignment,
- MTRR_TYPE_WRBACK);
- }
+ /* Cache at least 8 MiB below the top of ram, and at most 8 MiB
+ * above top of the ram. This satisfies MTRR alignment requirement
+ * with different TSEG size configurations. */
+ top_of_ram = ALIGN_DOWN((uintptr_t)cbmem_top(), 8*MiB);
+ postcar_frame_add_mtrr(&pcf, top_of_ram - 8*MiB, 16*MiB, MTRR_TYPE_WRBACK);
run_postcar_phase(&pcf);
}
diff --git a/src/drivers/intel/fsp1_1/raminit.c b/src/drivers/intel/fsp1_1/raminit.c
index 7c20b258e2..e71c9a2ddf 100644
--- a/src/drivers/intel/fsp1_1/raminit.c
+++ b/src/drivers/intel/fsp1_1/raminit.c
@@ -2,7 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2014-2016 Intel Corporation
- * Copyright (C) 2018 Eltan B.V.
+ * Copyright (C) 2018-2019 Eltan B.V.
*
* 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
@@ -52,10 +52,9 @@ void raminit(struct romstage_params *params)
VPD_DATA_REGION *vpd_ptr;
UPD_DATA_REGION *upd_ptr;
int fsp_verification_failure = 0;
-#if CONFIG(DISPLAY_HOBS)
- unsigned long int data;
EFI_PEI_HOB_POINTERS hob_ptr;
-#endif
+ char *smm_base;
+ size_t smm_size;
/*
* Find and copy the UPD region to the stack so the platform can modify
@@ -139,7 +138,7 @@ void raminit(struct romstage_params *params)
fsp_memory = get_next_resource_hob(&fsp_reserved_guid, hob_list_ptr);
if (fsp_memory == NULL) {
fsp_verification_failure = 1;
- printk(BIOS_DEBUG,
+ printk(BIOS_ERR,
"7.2: FSP_RESERVED_MEMORY_RESOURCE_HOB missing!\n");
} else {
fsp_reserved_bytes = fsp_memory->ResourceLength;
@@ -148,14 +147,11 @@ void raminit(struct romstage_params *params)
}
/* Display SMM area */
-#if CONFIG(HAVE_SMI_HANDLER)
- char *smm_base;
- size_t smm_size;
-
- smm_region((void **)&smm_base, &smm_size);
- printk(BIOS_DEBUG, "0x%08x: smm_size\n", (unsigned int)smm_size);
- printk(BIOS_DEBUG, "0x%p: smm_base\n", smm_base);
-#endif
+ if (CONFIG(HAVE_SMI_HANDLER)) {
+ smm_region((void **)&smm_base, &smm_size);
+ printk(BIOS_DEBUG, "0x%08x: smm_size\n", (unsigned int)smm_size);
+ printk(BIOS_DEBUG, "0x%p: smm_base\n", smm_base);
+ }
/* Migrate CAR data */
printk(BIOS_DEBUG, "0x%p: cbmem_top\n", cbmem_top());
@@ -190,64 +186,36 @@ void raminit(struct romstage_params *params)
if (memory_info_hob == NULL) {
printk(BIOS_ERR, "FSP_SMBIOS_MEMORY_INFO HOB missing!\n");
fsp_verification_failure = 1;
- } else {
- printk(BIOS_DEBUG,
- "FSP_SMBIOS_MEMORY_INFO HOB: 0x%p\n",
- memory_info_hob);
}
-#if CONFIG(DISPLAY_HOBS)
+ if (hob_list_ptr == NULL)
+ die_with_post_code(POST_RAM_FAILURE,
+ "ERROR - HOB pointer is NULL!\n");
+
/*
* Verify that FSP is generating the required HOBs:
* 7.1: FSP_BOOTLOADER_TEMP_MEMORY_HOB only produced for FSP 1.0
* 7.2: FSP_RESERVED_MEMORY_RESOURCE_HOB verified above
* 7.3: FSP_NON_VOLATILE_STORAGE_HOB only produced when
- * new NVS data is generated, verified below
+ * new NVS data is generated, verified below
* 7.4: FSP_BOOTLOADER_TOLUM_HOB verified above
* 7.5: EFI_PEI_GRAPHICS_INFO_HOB produced by SiliconInit
* FSP_SMBIOS_MEMORY_INFO HOB verified above
*/
- if (cbmem_root != NULL) {
- printk(BIOS_DEBUG,
- "7.4: FSP_BOOTLOADER_TOLUM_HOB: 0x%p\n",
- cbmem_root);
- data = cbmem_root->PhysicalStart;
- printk(BIOS_DEBUG, " 0x%016lx: PhysicalStart\n", data);
- data = cbmem_root->ResourceLength;
- printk(BIOS_DEBUG, " 0x%016lx: ResourceLength\n", data);
- }
hob_ptr.Raw = get_next_guid_hob(&mrc_guid, hob_list_ptr);
- if (hob_ptr.Raw == NULL) {
- if (params->saved_data == NULL) {
- printk(BIOS_ERR, "7.3: FSP_NON_VOLATILE_STORAGE_HOB missing!\n");
- fsp_verification_failure = 1;
- }
- } else {
- printk(BIOS_DEBUG,
- "7.3: FSP_NON_VOLATILE_STORAGE_HOB: 0x%p\n",
- hob_ptr.Raw);
- }
- if (fsp_memory != NULL) {
- printk(BIOS_DEBUG,
- "7.2: FSP_RESERVED_MEMORY_RESOURCE_HOB: 0x%p\n",
- fsp_memory);
- data = fsp_memory->PhysicalStart;
- printk(BIOS_DEBUG, " 0x%016lx: PhysicalStart\n", data);
- data = fsp_memory->ResourceLength;
- printk(BIOS_DEBUG, " 0x%016lx: ResourceLength\n", data);
+ if ((hob_ptr.Raw == NULL) && (params->saved_data == NULL)) {
+ printk(BIOS_ERR, "7.3: FSP_NON_VOLATILE_STORAGE_HOB missing!\n");
+ fsp_verification_failure = 1;
}
/* Verify all the HOBs are present */
if (fsp_verification_failure)
- printk(BIOS_DEBUG,
+ printk(BIOS_ERR,
"ERROR - Missing one or more required FSP HOBs!\n");
/* Display the HOBs */
- if (hob_list_ptr != NULL)
+ if (CONFIG(DISPLAY_HOBS))
print_hob_type_structure(0, hob_list_ptr);
- else
- printk(BIOS_ERR, "ERROR - HOB pointer is NULL!\n");
-#endif
/* Get the address of the CBMEM region for the FSP reserved memory */
fsp_reserved_memory_area = cbmem_find(CBMEM_ID_FSP_RESERVED_MEMORY);
@@ -258,7 +226,7 @@ void raminit(struct romstage_params *params)
if ((fsp_memory != NULL) && (cbmem_root != NULL) &&
(cbmem_root->PhysicalStart <= fsp_memory->PhysicalStart)) {
fsp_verification_failure = 1;
- printk(BIOS_DEBUG,
+ printk(BIOS_ERR,
"ERROR - FSP reserved memory above CBMEM root!\n");
}
@@ -267,19 +235,18 @@ void raminit(struct romstage_params *params)
(fsp_memory->PhysicalStart !=
(unsigned int)fsp_reserved_memory_area))) {
fsp_verification_failure = 1;
- printk(BIOS_DEBUG, "ERROR - Reserving FSP memory area!\n");
-#if CONFIG(HAVE_SMI_HANDLER)
- if (cbmem_root != NULL) {
+ printk(BIOS_ERR, "ERROR - Reserving FSP memory area!\n");
+
+ if (CONFIG(HAVE_SMI_HANDLER) && cbmem_root != NULL) {
size_t delta_bytes = (unsigned int)smm_base
- cbmem_root->PhysicalStart
- cbmem_root->ResourceLength;
- printk(BIOS_DEBUG,
+ printk(BIOS_ERR,
"0x%08x: Chipset reserved bytes reported by FSP\n",
(unsigned int)delta_bytes);
die_with_post_code(POST_INVALID_VENDOR_BINARY,
"Please verify the chipset reserved size\n");
}
-#endif
}
/* Verify the FSP 1.1 HOB interface */
@@ -292,7 +259,7 @@ void raminit(struct romstage_params *params)
/* Locate the memory configuration data to speed up the next reboot */
mrc_hob = get_next_guid_hob(&mrc_guid, hob_list_ptr);
- if (mrc_hob == NULL)
+ if ((mrc_hob == NULL) && CONFIG(DISPLAY_HOBS))
printk(BIOS_DEBUG,
"Memory Configuration Data Hob not present\n");
else if (!vboot_recovery_mode_enabled()) {
diff --git a/src/drivers/intel/fsp1_1/ramstage.c b/src/drivers/intel/fsp1_1/ramstage.c
index 814bddf007..52a886ce30 100644
--- a/src/drivers/intel/fsp1_1/ramstage.c
+++ b/src/drivers/intel/fsp1_1/ramstage.c
@@ -52,19 +52,16 @@ static void smm_memory_map(void)
static void display_hob_info(FSP_INFO_HEADER *fsp_info_header)
{
const EFI_GUID graphics_info_guid = EFI_PEI_GRAPHICS_INFO_HOB_GUID;
- int missing_hob = 0;
void *hob_list_ptr = get_hob_list();
- if (!CONFIG(DISPLAY_HOBS))
- return;
-
/* Verify the HOBs */
if (hob_list_ptr == NULL) {
- printk(BIOS_INFO, "ERROR - HOB pointer is NULL!\n");
+ printk(BIOS_ERR, "ERROR - HOB pointer is NULL!\n");
return;
}
- print_hob_type_structure(0, hob_list_ptr);
+ if (CONFIG(DISPLAY_HOBS))
+ print_hob_type_structure(0, hob_list_ptr);
/*
* Verify that FSP is generating the required HOBs:
@@ -77,14 +74,12 @@ static void display_hob_info(FSP_INFO_HEADER *fsp_info_header)
* FSP_SMBIOS_MEMORY_INFO HOB verified by raminit
*/
if ((fsp_info_header->ImageAttribute & GRAPHICS_SUPPORT_BIT) &&
- !get_next_guid_hob(&graphics_info_guid, hob_list_ptr)) {
- printk(BIOS_INFO, "7.5: EFI_PEI_GRAPHICS_INFO_HOB missing!\n");
- missing_hob = 1;
- }
-
- if (missing_hob)
- printk(BIOS_INFO,
+ !get_next_guid_hob(&graphics_info_guid, hob_list_ptr) &&
+ CONFIG(DISPLAY_HOBS)) {
+ printk(BIOS_ERR, "7.5: EFI_PEI_GRAPHICS_INFO_HOB missing!\n");
+ printk(BIOS_ERR,
"ERROR - Missing one or more required FSP HOBs!\n");
+ }
}
void fsp_run_silicon_init(FSP_INFO_HEADER *fsp_info_header, int is_s3_wakeup)
diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc
index d627a3dbb1..b0a1f2b4e2 100644
--- a/src/drivers/intel/fsp2_0/Makefile.inc
+++ b/src/drivers/intel/fsp2_0/Makefile.inc
@@ -23,7 +23,6 @@ romstage-$(CONFIG_DISPLAY_UPD_DATA) += upd_display.c
romstage-$(CONFIG_VERIFY_HOBS) += hob_verify.c
romstage-y += util.c
romstage-y += memory_init.c
-romstage-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += stage_cache.c
romstage-$(CONFIG_MMA) += mma_core.c
ramstage-y += debug.c
@@ -34,12 +33,10 @@ ramstage-$(CONFIG_DISPLAY_HOBS) += hob_display.c
ramstage-$(CONFIG_VERIFY_HOBS) += hob_verify.c
ramstage-y += notify.c
ramstage-y += silicon_init.c
-ramstage-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += stage_cache.c
ramstage-$(CONFIG_DISPLAY_UPD_DATA) += upd_display.c
ramstage-y += util.c
ramstage-$(CONFIG_MMA) += mma_core.c
-postcar-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += stage_cache.c
postcar-$(CONFIG_FSP_CAR) += temp_ram_exit.c
postcar-$(CONFIG_FSP_CAR) += util.c
postcar-$(CONFIG_DISPLAY_FSP_HEADER) += header_display.c
diff --git a/src/drivers/intel/wifi/Kconfig b/src/drivers/intel/wifi/Kconfig
index 4dc4d7faeb..fb60c6fbe1 100644
--- a/src/drivers/intel/wifi/Kconfig
+++ b/src/drivers/intel/wifi/Kconfig
@@ -1,53 +1,8 @@
config DRIVERS_INTEL_WIFI
bool "Support Intel PCI-e WiFi adapters"
- depends on ARCH_X86
+ depends on PCI
default y if PCIEXP_PLUGIN_SUPPORT
+ select DRIVERS_GENERIC_WIFI if HAVE_ACPI_TABLES
help
When enabled, add identifiers in ACPI and SMBIOS tables to
make OS drivers work with certain Intel PCI-e WiFi chipsets.
-
-config USE_SAR
- bool
- default n
- help
- Enable it when wifi driver uses SAR configuration feature.
- VPD entry "wifi_sar" is read to get SAR settings, if its
- not found driver may look into CBFS for default settigs.
- WIFI_SAR_CBFS is option to enable CBFS lookup.
-
-config SAR_ENABLE
- bool
- default n
- depends on USE_SAR
-
-config DSAR_ENABLE
- bool
- default n
- depends on USE_SAR
-
-config GEO_SAR_ENABLE
- bool
- default n
- depends on USE_SAR
-
-config WIFI_SAR_CBFS
- bool "Enable SAR table addition to CBFS"
- default n
- depends on USE_SAR
- help
- wifi driver would look for "wifi_sar" vpd key and load SAR settings from
- it, if the vpd key is not found then the driver tries to look for sar
- settings from CBFS with file name wifi_sar_defaults.hex.
- So OEM/ODM can override wifi sar with VPD.
-
-config WIFI_SAR_CBFS_FILEPATH
- string "The cbfs file which has WIFI SAR defaults"
- depends on WIFI_SAR_CBFS
- default "src/mainboard/$(MAINBOARDDIR)/wifi_sar_defaults.hex"
-
-config DSAR_SET_NUM
- hex "Number of SAR sets when D-SAR is enabled"
- default 0x3
- depends on USE_SAR
- help
- There can be up to 3 optional SAR table sets.
diff --git a/src/drivers/intel/wifi/chip.h b/src/drivers/intel/wifi/chip.h
index 1b3c2a5834..21803108ca 100644
--- a/src/drivers/intel/wifi/chip.h
+++ b/src/drivers/intel/wifi/chip.h
@@ -13,26 +13,11 @@
* GNU General Public License for more details.
*/
-#ifndef _WIFI_CHIP_H_
-#define _WIFI_CHIP_H_
-
-/* WRDS Spec Revision */
-#define WRDS_REVISION 0x0
-
-/* EWRD Spec Revision */
-#define EWRD_REVISION 0x0
-
-/* WRDS Domain type */
-#define WRDS_DOMAIN_TYPE_WIFI 0x7
-
-/* EWRD Domain type */
-#define EWRD_DOMAIN_TYPE_WIFI 0x7
-
-/* WGDS Domain type */
-#define WGDS_DOMAIN_TYPE_WIFI 0x7
+#ifndef _INTEL_WIFI_CHIP_H_
+#define _INTEL_WIFI_CHIP_H_
struct drivers_intel_wifi_config {
- unsigned wake; /* Wake pin for ACPI _PRW */
+ unsigned int wake; /* Wake pin for ACPI _PRW */
};
-#endif /* _WIFI_CHIP_H_ */
+#endif /* _INTEL_WIFI_CHIP_H_ */
diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c
index 83cfaa925c..926905c26b 100644
--- a/src/drivers/intel/wifi/wifi.c
+++ b/src/drivers/intel/wifi/wifi.c
@@ -15,19 +15,16 @@
* GNU General Public License for more details.
*/
-#include
-#include
#include
#include
#include
#include
#include
#include
-#include
#include
#include
-#include
#include "chip.h"
+#include "drivers/wifi/generic_wifi.h"
#define PMCS_DR 0xcc
#define PME_STS (1 << 15)
@@ -65,194 +62,18 @@ static int smbios_write_wifi(struct device *dev, int *handle,
}
#endif
-__weak
-int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
-{
- return -1;
-}
-
#if CONFIG(HAVE_ACPI_TABLES)
-static void emit_sar_acpi_structures(void)
-{
- int i, j, package_size;
- struct wifi_sar_limits sar_limits;
- struct wifi_sar_delta_table *wgds;
-
- /* Retrieve the sar limits data */
- if (get_wifi_sar_limits(&sar_limits) < 0) {
- printk(BIOS_ERR, "Error: failed from getting SAR limits!\n");
- return;
- }
-
- /*
- * Name ("WRDS", Package () {
- * Revision,
- * Package () {
- * Domain Type, // 0x7:WiFi
- * WiFi SAR BIOS, // BIOS SAR Enable/disable
- * SAR Table Set // Set#1 of SAR Table (10 bytes)
- * }
- * })
- */
- acpigen_write_name("WRDS");
- acpigen_write_package(2);
- acpigen_write_dword(WRDS_REVISION);
- /* Emit 'Domain Type' + 'WiFi SAR BIOS' + 10 bytes for Set#1 */
- package_size = 1 + 1 + BYTES_PER_SAR_LIMIT;
- acpigen_write_package(package_size);
- acpigen_write_dword(WRDS_DOMAIN_TYPE_WIFI);
- acpigen_write_dword(CONFIG(SAR_ENABLE));
- for (i = 0; i < BYTES_PER_SAR_LIMIT; i++)
- acpigen_write_byte(sar_limits.sar_limit[0][i]);
- acpigen_pop_len();
- acpigen_pop_len();
-
- /*
- * Name ("EWRD", Package () {
- * Revision,
- * Package () {
- * Domain Type, // 0x7:WiFi
- * Dynamic SAR Enable, // Dynamic SAR Enable/disable
- * Extended SAR sets, // Number of optional SAR table sets
- * SAR Table Set, // Set#2 of SAR Table (10 bytes)
- * SAR Table Set, // Set#3 of SAR Table (10 bytes)
- * SAR Table Set // Set#4 of SAR Table (10 bytes)
- * }
- * })
- */
- acpigen_write_name("EWRD");
- acpigen_write_package(2);
- acpigen_write_dword(EWRD_REVISION);
- /*
- * Emit 'Domain Type' + "Dynamic SAR Enable' + 'Extended SAR sets'
- * + number of bytes for Set#2 & 3 & 4
- */
- package_size = 1 + 1 + 1 + (NUM_SAR_LIMITS - 1) * BYTES_PER_SAR_LIMIT;
- acpigen_write_package(package_size);
- acpigen_write_dword(EWRD_DOMAIN_TYPE_WIFI);
- acpigen_write_dword(CONFIG(DSAR_ENABLE));
- acpigen_write_dword(CONFIG_DSAR_SET_NUM);
- for (i = 1; i < NUM_SAR_LIMITS; i++)
- for (j = 0; j < BYTES_PER_SAR_LIMIT; j++)
- acpigen_write_byte(sar_limits.sar_limit[i][j]);
- acpigen_pop_len();
- acpigen_pop_len();
-
-
- if (!CONFIG(GEO_SAR_ENABLE))
- return;
-
- /*
- * Name ("WGDS", Package() {
- * Revision,
- * Package() {
- * DomainType, // 0x7:WiFi
- * WgdsWiFiSarDeltaGroup1PowerMax1, // Group 1 FCC 2400 Max
- * WgdsWiFiSarDeltaGroup1PowerChainA1, // Group 1 FCC 2400 A Offset
- * WgdsWiFiSarDeltaGroup1PowerChainB1, // Group 1 FCC 2400 B Offset
- * WgdsWiFiSarDeltaGroup1PowerMax2, // Group 1 FCC 5200 Max
- * WgdsWiFiSarDeltaGroup1PowerChainA2, // Group 1 FCC 5200 A Offset
- * WgdsWiFiSarDeltaGroup1PowerChainB2, // Group 1 FCC 5200 B Offset
- * WgdsWiFiSarDeltaGroup2PowerMax1, // Group 2 EC Jap 2400 Max
- * WgdsWiFiSarDeltaGroup2PowerChainA1, // Group 2 EC Jap 2400 A Offset
- * WgdsWiFiSarDeltaGroup2PowerChainB1, // Group 2 EC Jap 2400 B Offset
- * WgdsWiFiSarDeltaGroup2PowerMax2, // Group 2 EC Jap 5200 Max
- * WgdsWiFiSarDeltaGroup2PowerChainA2, // Group 2 EC Jap 5200 A Offset
- * WgdsWiFiSarDeltaGroup2PowerChainB2, // Group 2 EC Jap 5200 B Offset
- * WgdsWiFiSarDeltaGroup3PowerMax1, // Group 3 ROW 2400 Max
- * WgdsWiFiSarDeltaGroup3PowerChainA1, // Group 3 ROW 2400 A Offset
- * WgdsWiFiSarDeltaGroup3PowerChainB1, // Group 3 ROW 2400 B Offset
- * WgdsWiFiSarDeltaGroup3PowerMax2, // Group 3 ROW 5200 Max
- * WgdsWiFiSarDeltaGroup3PowerChainA2, // Group 3 ROW 5200 A Offset
- * WgdsWiFiSarDeltaGroup3PowerChainB2, // Group 3 ROW 5200 B Offset
- * }
- * })
- */
-
- wgds = &sar_limits.wgds;
- acpigen_write_name("WGDS");
- acpigen_write_package(2);
- acpigen_write_dword(wgds->version);
- /* Emit 'Domain Type' +
- * Group specific delta of power (6 bytes * NUM_WGDS_SAR_GROUPS)
- */
- package_size = sizeof(sar_limits.wgds.group) + 1;
- acpigen_write_package(package_size);
- acpigen_write_dword(WGDS_DOMAIN_TYPE_WIFI);
- for (i = 0; i < SAR_NUM_WGDS_GROUPS; i++) {
- acpigen_write_byte(wgds->group[i].power_max_2400mhz);
- acpigen_write_byte(wgds->group[i].power_chain_a_2400mhz);
- acpigen_write_byte(wgds->group[i].power_chain_b_2400mhz);
- acpigen_write_byte(wgds->group[i].power_max_5200mhz);
- acpigen_write_byte(wgds->group[i].power_chain_a_5200mhz);
- acpigen_write_byte(wgds->group[i].power_chain_b_5200mhz);
- }
-
- acpigen_pop_len();
- acpigen_pop_len();
-}
-
static void intel_wifi_fill_ssdt(struct device *dev)
{
struct drivers_intel_wifi_config *config = dev->chip_info;
- const char *path = acpi_device_path(dev->bus->dev);
- u32 address;
+ struct generic_wifi_config generic_config;
- if (!path || !dev->enabled)
- return;
-
- /* Device */
- acpigen_write_scope(path);
- acpigen_write_device(acpi_device_name(dev));
- acpigen_write_name_integer("_UID", 0);
- if (dev->chip_ops)
- acpigen_write_name_string("_DDN", dev->chip_ops->name);
-
- /* Address */
- address = PCI_SLOT(dev->path.pci.devfn) & 0xffff;
- address <<= 16;
- address |= PCI_FUNC(dev->path.pci.devfn) & 0xffff;
- acpigen_write_name_dword("_ADR", address);
-
- /* Wake capabilities */
- if (config && config->wake)
- acpigen_write_PRW(config->wake, 3);
-
- /* Fill regulatory domain structure */
- if (CONFIG(HAVE_REGULATORY_DOMAIN)) {
- /*
- * Name ("WRDD", Package () {
- * WRDD_REVISION, // Revision
- * Package () {
- * WRDD_DOMAIN_TYPE_WIFI, // Domain Type, 7:WiFi
- * wifi_regulatory_domain() // Country Identifier
- * }
- * })
- */
- acpigen_write_name("WRDD");
- acpigen_write_package(2);
- acpigen_write_integer(WRDD_REVISION);
- acpigen_write_package(2);
- acpigen_write_dword(WRDD_DOMAIN_TYPE_WIFI);
- acpigen_write_dword(wifi_regulatory_domain());
- acpigen_pop_len();
- acpigen_pop_len();
+ if (config) {
+ generic_config.wake = config->wake;
+ /* By default, all intel wifi chips wake from S3 */
+ generic_config.maxsleep = 3;
}
-
- /* Fill Wifi sar related ACPI structures */
- if (CONFIG(USE_SAR))
- emit_sar_acpi_structures();
-
- acpigen_pop_len(); /* Device */
- acpigen_pop_len(); /* Scope */
-
- printk(BIOS_INFO, "%s.%s: %s %s\n", path, acpi_device_name(dev),
- dev->chip_ops ? dev->chip_ops->name : "", dev_path(dev));
-}
-
-static const char *intel_wifi_acpi_name(const struct device *dev)
-{
- return "WIFI";
+ generic_wifi_fill_ssdt(dev, config ? &generic_config : NULL);
}
#endif
@@ -282,7 +103,7 @@ struct device_operations device_ops = {
#endif
.ops_pci = &pci_ops,
#if CONFIG(HAVE_ACPI_TABLES)
- .acpi_name = intel_wifi_acpi_name,
+ .acpi_name = generic_wifi_acpi_name,
.acpi_fill_ssdt_generator = intel_wifi_fill_ssdt,
#endif
};
diff --git a/src/drivers/pc80/pc/Kconfig b/src/drivers/pc80/pc/Kconfig
index c44cf9144d..bba45f6a64 100644
--- a/src/drivers/pc80/pc/Kconfig
+++ b/src/drivers/pc80/pc/Kconfig
@@ -1,10 +1,11 @@
+if PC80_SYSTEM
+
# Might be removed (alongside with the PS/2 init code) once payloads
# reliably support PS/2 init themselves.
config DRIVERS_PS2_KEYBOARD
bool "PS/2 keyboard init"
default n
- depends on PC80_SYSTEM
help
Enable this option to initialize PS/2 keyboards found connected
to the PS/2 port.
@@ -16,3 +17,14 @@ config DRIVERS_PS2_KEYBOARD
If you know you will only use a payload which does not require
this option, then you can say N here to speed up boot time.
Otherwise say Y.
+
+config UDELAY_IO
+ bool
+ default n
+
+# This option is used in code but never selected.
+config UDELAY_TIMER2
+ bool
+ default n
+
+endif
diff --git a/src/drivers/pc80/rtc/mc146818rtc_boot.c b/src/drivers/pc80/rtc/mc146818rtc_boot.c
index 26bcac5acf..0ac06b3152 100644
--- a/src/drivers/pc80/rtc/mc146818rtc_boot.c
+++ b/src/drivers/pc80/rtc/mc146818rtc_boot.c
@@ -67,7 +67,7 @@ void sanitize_cmos(void)
CBFS_COMPONENT_CMOS_DEFAULT, &length);
#endif
if (cmos_default) {
- int i;
+ size_t i;
cmos_disable_rtc();
for (i = 14; i < MIN(128, length); i++)
cmos_write_inner(cmos_default[i], i);
diff --git a/src/drivers/usb/pci_ehci.c b/src/drivers/usb/pci_ehci.c
index 5621b37da9..34684cb09a 100644
--- a/src/drivers/usb/pci_ehci.c
+++ b/src/drivers/usb/pci_ehci.c
@@ -49,7 +49,7 @@ int ehci_debug_hw_enable(unsigned int *base, unsigned int *dbg_offset)
if (class != PCI_EHCI_CLASSCODE)
return -1;
- u8 pm_cap = pci_find_capability(dev, PCI_CAP_ID_PM);
+ u8 pm_cap = pci_s_find_capability(dbg_dev, PCI_CAP_ID_PM);
if (pm_cap) {
u16 pm_ctrl = pci_read_config16(dev, pm_cap + PCI_PM_CTRL);
/* Set to D0 and disable PM events. */
@@ -58,7 +58,7 @@ int ehci_debug_hw_enable(unsigned int *base, unsigned int *dbg_offset)
pci_write_config16(dev, pm_cap + PCI_PM_CTRL, pm_ctrl);
}
- u8 pos = pci_find_capability(dev, PCI_CAP_ID_EHCI_DEBUG);
+ u8 pos = pci_s_find_capability(dbg_dev, PCI_CAP_ID_EHCI_DEBUG);
if (!pos)
return -1;
diff --git a/src/drivers/wifi/Kconfig b/src/drivers/wifi/Kconfig
new file mode 100644
index 0000000000..9b87f844f6
--- /dev/null
+++ b/src/drivers/wifi/Kconfig
@@ -0,0 +1,57 @@
+config DRIVERS_GENERIC_WIFI
+ bool
+ default n
+ depends on HAVE_ACPI_TABLES
+ help
+ When enabled, add identifiers in ACPI tables that are common
+ to WiFi chipsets from multiple vendors.
+
+if DRIVERS_GENERIC_WIFI
+
+config USE_SAR
+ bool
+ default n
+ help
+ Enable it when wifi driver uses SAR configuration feature.
+ VPD entry "wifi_sar" is read to get SAR settings, if its
+ not found driver may look into CBFS for default settigs.
+ WIFI_SAR_CBFS is option to enable CBFS lookup.
+
+config SAR_ENABLE
+ bool
+ default n
+ depends on USE_SAR
+
+config DSAR_ENABLE
+ bool
+ default n
+ depends on USE_SAR
+
+config GEO_SAR_ENABLE
+ bool
+ default n
+ depends on USE_SAR
+
+config WIFI_SAR_CBFS
+ bool "Enable SAR table addition to CBFS"
+ default n
+ depends on USE_SAR
+ help
+ wifi driver would look for "wifi_sar" vpd key and load SAR settings from
+ it, if the vpd key is not found then the driver tries to look for sar
+ settings from CBFS with file name wifi_sar_defaults.hex.
+ So OEM/ODM can override wifi sar with VPD.
+
+config WIFI_SAR_CBFS_FILEPATH
+ string "The cbfs file which has WIFI SAR defaults"
+ depends on WIFI_SAR_CBFS
+ default "src/mainboard/$(MAINBOARDDIR)/wifi_sar_defaults.hex"
+
+config DSAR_SET_NUM
+ hex "Number of SAR sets when D-SAR is enabled"
+ default 0x3
+ depends on USE_SAR
+ help
+ There can be up to 3 optional SAR table sets.
+
+endif # DRIVERS_GENERIC_WIFI
diff --git a/src/drivers/wifi/Makefile.inc b/src/drivers/wifi/Makefile.inc
new file mode 100644
index 0000000000..d37015c7d3
--- /dev/null
+++ b/src/drivers/wifi/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_DRIVERS_GENERIC_WIFI) += generic.c
diff --git a/src/drivers/wifi/generic.c b/src/drivers/wifi/generic.c
new file mode 100644
index 0000000000..b593ffe8bc
--- /dev/null
+++ b/src/drivers/wifi/generic.c
@@ -0,0 +1,245 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google LLC
+ *
+ * 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; version 2 or (at your option)
+ * any later version of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "generic_wifi.h"
+
+/* WRDS Spec Revision */
+#define WRDS_REVISION 0x0
+
+/* EWRD Spec Revision */
+#define EWRD_REVISION 0x0
+
+/* WRDS Domain type */
+#define WRDS_DOMAIN_TYPE_WIFI 0x7
+
+/* EWRD Domain type */
+#define EWRD_DOMAIN_TYPE_WIFI 0x7
+
+/* WGDS Domain type */
+#define WGDS_DOMAIN_TYPE_WIFI 0x7
+
+/*
+ * WIFI ACPI NAME = "WF" + hex value of last 8 bits of dev_path_encode + '\0'
+ * The above representation returns unique and consistent name every time
+ * generate_wifi_acpi_name is invoked. The last 8 bits of dev_path_encode is
+ * chosen since it contains the bus address of the device.
+ */
+#define WIFI_ACPI_NAME_MAX_LEN 5
+
+__weak
+int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
+{
+ return -1;
+}
+
+static void emit_sar_acpi_structures(void)
+{
+ int i, j, package_size;
+ struct wifi_sar_limits sar_limits;
+ struct wifi_sar_delta_table *wgds;
+
+ /* Retrieve the sar limits data */
+ if (get_wifi_sar_limits(&sar_limits) < 0) {
+ printk(BIOS_ERR, "Error: failed from getting SAR limits!\n");
+ return;
+ }
+
+ /*
+ * Name ("WRDS", Package () {
+ * Revision,
+ * Package () {
+ * Domain Type, // 0x7:WiFi
+ * WiFi SAR BIOS, // BIOS SAR Enable/disable
+ * SAR Table Set // Set#1 of SAR Table (10 bytes)
+ * }
+ * })
+ */
+ acpigen_write_name("WRDS");
+ acpigen_write_package(2);
+ acpigen_write_dword(WRDS_REVISION);
+ /* Emit 'Domain Type' + 'WiFi SAR BIOS' + 10 bytes for Set#1 */
+ package_size = 1 + 1 + BYTES_PER_SAR_LIMIT;
+ acpigen_write_package(package_size);
+ acpigen_write_dword(WRDS_DOMAIN_TYPE_WIFI);
+ acpigen_write_dword(CONFIG(SAR_ENABLE));
+ for (i = 0; i < BYTES_PER_SAR_LIMIT; i++)
+ acpigen_write_byte(sar_limits.sar_limit[0][i]);
+ acpigen_pop_len();
+ acpigen_pop_len();
+
+ /*
+ * Name ("EWRD", Package () {
+ * Revision,
+ * Package () {
+ * Domain Type, // 0x7:WiFi
+ * Dynamic SAR Enable, // Dynamic SAR Enable/disable
+ * Extended SAR sets, // Number of optional SAR table sets
+ * SAR Table Set, // Set#2 of SAR Table (10 bytes)
+ * SAR Table Set, // Set#3 of SAR Table (10 bytes)
+ * SAR Table Set // Set#4 of SAR Table (10 bytes)
+ * }
+ * })
+ */
+ acpigen_write_name("EWRD");
+ acpigen_write_package(2);
+ acpigen_write_dword(EWRD_REVISION);
+ /*
+ * Emit 'Domain Type' + "Dynamic SAR Enable' + 'Extended SAR sets'
+ * + number of bytes for Set#2 & 3 & 4
+ */
+ package_size = 1 + 1 + 1 + (NUM_SAR_LIMITS - 1) * BYTES_PER_SAR_LIMIT;
+ acpigen_write_package(package_size);
+ acpigen_write_dword(EWRD_DOMAIN_TYPE_WIFI);
+ acpigen_write_dword(CONFIG(DSAR_ENABLE));
+ acpigen_write_dword(CONFIG_DSAR_SET_NUM);
+ for (i = 1; i < NUM_SAR_LIMITS; i++)
+ for (j = 0; j < BYTES_PER_SAR_LIMIT; j++)
+ acpigen_write_byte(sar_limits.sar_limit[i][j]);
+ acpigen_pop_len();
+ acpigen_pop_len();
+
+
+ if (!CONFIG(GEO_SAR_ENABLE))
+ return;
+
+ /*
+ * Name ("WGDS", Package() {
+ * Revision,
+ * Package() {
+ * DomainType, // 0x7:WiFi
+ * WgdsWiFiSarDeltaGroup1PowerMax1, // Group 1 FCC 2400 Max
+ * WgdsWiFiSarDeltaGroup1PowerChainA1, // Group 1 FCC 2400 A Offset
+ * WgdsWiFiSarDeltaGroup1PowerChainB1, // Group 1 FCC 2400 B Offset
+ * WgdsWiFiSarDeltaGroup1PowerMax2, // Group 1 FCC 5200 Max
+ * WgdsWiFiSarDeltaGroup1PowerChainA2, // Group 1 FCC 5200 A Offset
+ * WgdsWiFiSarDeltaGroup1PowerChainB2, // Group 1 FCC 5200 B Offset
+ * WgdsWiFiSarDeltaGroup2PowerMax1, // Group 2 EC Jap 2400 Max
+ * WgdsWiFiSarDeltaGroup2PowerChainA1, // Group 2 EC Jap 2400 A Offset
+ * WgdsWiFiSarDeltaGroup2PowerChainB1, // Group 2 EC Jap 2400 B Offset
+ * WgdsWiFiSarDeltaGroup2PowerMax2, // Group 2 EC Jap 5200 Max
+ * WgdsWiFiSarDeltaGroup2PowerChainA2, // Group 2 EC Jap 5200 A Offset
+ * WgdsWiFiSarDeltaGroup2PowerChainB2, // Group 2 EC Jap 5200 B Offset
+ * WgdsWiFiSarDeltaGroup3PowerMax1, // Group 3 ROW 2400 Max
+ * WgdsWiFiSarDeltaGroup3PowerChainA1, // Group 3 ROW 2400 A Offset
+ * WgdsWiFiSarDeltaGroup3PowerChainB1, // Group 3 ROW 2400 B Offset
+ * WgdsWiFiSarDeltaGroup3PowerMax2, // Group 3 ROW 5200 Max
+ * WgdsWiFiSarDeltaGroup3PowerChainA2, // Group 3 ROW 5200 A Offset
+ * WgdsWiFiSarDeltaGroup3PowerChainB2, // Group 3 ROW 5200 B Offset
+ * }
+ * })
+ */
+
+ wgds = &sar_limits.wgds;
+ acpigen_write_name("WGDS");
+ acpigen_write_package(2);
+ acpigen_write_dword(wgds->version);
+ /* Emit 'Domain Type' +
+ * Group specific delta of power (6 bytes * NUM_WGDS_SAR_GROUPS)
+ */
+ package_size = sizeof(sar_limits.wgds.group) + 1;
+ acpigen_write_package(package_size);
+ acpigen_write_dword(WGDS_DOMAIN_TYPE_WIFI);
+ for (i = 0; i < SAR_NUM_WGDS_GROUPS; i++) {
+ acpigen_write_byte(wgds->group[i].power_max_2400mhz);
+ acpigen_write_byte(wgds->group[i].power_chain_a_2400mhz);
+ acpigen_write_byte(wgds->group[i].power_chain_b_2400mhz);
+ acpigen_write_byte(wgds->group[i].power_max_5200mhz);
+ acpigen_write_byte(wgds->group[i].power_chain_a_5200mhz);
+ acpigen_write_byte(wgds->group[i].power_chain_b_5200mhz);
+ }
+
+ acpigen_pop_len();
+ acpigen_pop_len();
+}
+
+void generic_wifi_fill_ssdt(struct device *dev,
+ const struct generic_wifi_config *config)
+{
+ const char *path;
+ u32 address;
+
+ if (!dev->enabled)
+ return;
+
+ path = acpi_device_path(dev->bus->dev);
+ if (!path)
+ return;
+
+ /* Device */
+ acpigen_write_scope(path);
+ acpigen_write_device(acpi_device_name(dev));
+ acpigen_write_name_integer("_UID", 0);
+ if (dev->chip_ops)
+ acpigen_write_name_string("_DDN", dev->chip_ops->name);
+
+ /* Address */
+ address = PCI_SLOT(dev->path.pci.devfn) & 0xffff;
+ address <<= 16;
+ address |= PCI_FUNC(dev->path.pci.devfn) & 0xffff;
+ acpigen_write_name_dword("_ADR", address);
+
+ /* Wake capabilities */
+ if (config)
+ acpigen_write_PRW(config->wake, config->maxsleep);
+
+ /* Fill regulatory domain structure */
+ if (CONFIG(HAVE_REGULATORY_DOMAIN)) {
+ /*
+ * Name ("WRDD", Package () {
+ * WRDD_REVISION, // Revision
+ * Package () {
+ * WRDD_DOMAIN_TYPE_WIFI, // Domain Type, 7:WiFi
+ * wifi_regulatory_domain() // Country Identifier
+ * }
+ * })
+ */
+ acpigen_write_name("WRDD");
+ acpigen_write_package(2);
+ acpigen_write_integer(WRDD_REVISION);
+ acpigen_write_package(2);
+ acpigen_write_dword(WRDD_DOMAIN_TYPE_WIFI);
+ acpigen_write_dword(wifi_regulatory_domain());
+ acpigen_pop_len();
+ acpigen_pop_len();
+ }
+
+ /* Fill Wifi sar related ACPI structures */
+ if (CONFIG(USE_SAR))
+ emit_sar_acpi_structures();
+
+ acpigen_pop_len(); /* Device */
+ acpigen_pop_len(); /* Scope */
+
+ printk(BIOS_INFO, "%s.%s: %s %s\n", path, acpi_device_name(dev),
+ dev->chip_ops ? dev->chip_ops->name : "", dev_path(dev));
+}
+
+const char *generic_wifi_acpi_name(const struct device *dev)
+{
+ static char wifi_acpi_name[WIFI_ACPI_NAME_MAX_LEN];
+
+ snprintf(wifi_acpi_name, sizeof(wifi_acpi_name), "WF%02x",
+ (dev_path_encode(dev) & 0xff));
+ return wifi_acpi_name;
+}
diff --git a/src/drivers/wifi/generic_wifi.h b/src/drivers/wifi/generic_wifi.h
new file mode 100644
index 0000000000..5f17c3e297
--- /dev/null
+++ b/src/drivers/wifi/generic_wifi.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google LLC
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _GENERIC_WIFI_H_
+#define _GENERIC_WIFI_H_
+
+/**
+ * struct generic_wifi_config - Data structure to contain common wifi config
+ * @wake: Wake pin for ACPI _PRW
+ * @maxsleep: Maximum sleep state to wake from
+ */
+struct generic_wifi_config {
+ unsigned int wake;
+ unsigned int maxsleep;
+};
+
+/**
+ * wifi_fill_ssdt() - Fill ACPI SSDT table for WiFi controller
+ * @dev: Device structure corresponding to WiFi controller.
+ * @config: Common wifi config required to fill ACPI SSDT table.
+ *
+ * This function implements common device operation to help fill ACPI SSDT
+ * table for WiFi controller.
+ */
+void generic_wifi_fill_ssdt(struct device *dev,
+ const struct generic_wifi_config *config);
+
+/**
+ * wifi_acpi_name() - Get ACPI name for WiFi controller
+ * @dev: Device structure corresponding to WiFi controller.
+ *
+ * This function implements common device operation to get the ACPI name for
+ * WiFi controller.
+ *
+ * Return: string representing the ACPI name for WiFi controller.
+ */
+const char *generic_wifi_acpi_name(const struct device *dev);
+
+#endif /* _GENERIC_WIFI_H_ */
diff --git a/src/ec/acpi/Makefile.inc b/src/ec/acpi/Makefile.inc
index 34fc307d5c..fae8fbf6b3 100644
--- a/src/ec/acpi/Makefile.inc
+++ b/src/ec/acpi/Makefile.inc
@@ -2,6 +2,6 @@ ifeq ($(CONFIG_EC_ACPI),y)
ramstage-y += ec.c
romstage-y += ec.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += ec.c
+smm-y += ec.c
endif
diff --git a/src/ec/lenovo/pmh7/Makefile.inc b/src/ec/lenovo/pmh7/Makefile.inc
index a619cc7a3f..d5524dca1f 100644
--- a/src/ec/lenovo/pmh7/Makefile.inc
+++ b/src/ec/lenovo/pmh7/Makefile.inc
@@ -1,7 +1,7 @@
ifeq ($(CONFIG_EC_LENOVO_PMH7),y)
ramstage-y += pmh7.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += pmh7.c
+smm-y += pmh7.c
romstage-y += pmh7.c
endif
diff --git a/src/include/cpu/amd/msr.h b/src/include/cpu/amd/msr.h
index 5d7b5e4fda..0f88e516d1 100644
--- a/src/include/cpu/amd/msr.h
+++ b/src/include/cpu/amd/msr.h
@@ -39,7 +39,7 @@
#define MSR_INTPEND 0xC0010055
#define MMIO_CONF_BASE 0xC0010058
#define MMIO_RANGE_EN (1 << 0)
-#define MMIO_BUS_RANGE_SHIFT (1 << 1)
+#define MMIO_BUS_RANGE_SHIFT 2
/* P-state Current Limit Register */
#define PS_LIM_REG 0xC0010061
/* P-state Maximum Value shift position */
diff --git a/src/include/cpu/x86/cache.h b/src/include/cpu/x86/cache.h
index c8d26abad4..7f135e5390 100644
--- a/src/include/cpu/x86/cache.h
+++ b/src/include/cpu/x86/cache.h
@@ -67,7 +67,7 @@ static inline void clflush(void *addr)
*/
static __always_inline void enable_cache(void)
{
- unsigned long cr0;
+ CRx_TYPE cr0;
cr0 = read_cr0();
cr0 &= ~(CR0_CD | CR0_NW);
write_cr0(cr0);
@@ -76,7 +76,7 @@ static __always_inline void enable_cache(void)
static __always_inline void disable_cache(void)
{
/* Disable and write back the cache */
- unsigned long cr0;
+ CRx_TYPE cr0;
cr0 = read_cr0();
cr0 |= CR0_CD;
wbinvd();
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 49ed462952..29256c8d46 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -120,7 +120,7 @@ asmlinkage void soc_enable_mtrrs(void);
/* fms: find most significant bit set, stolen from Linux Kernel Source. */
static inline unsigned int fms(unsigned int x)
{
- int r;
+ unsigned int r;
__asm__("bsrl %1,%0\n\t"
"jnz 1f\n\t"
@@ -132,7 +132,7 @@ static inline unsigned int fms(unsigned int x)
/* fls: find least significant bit set */
static inline unsigned int fls(unsigned int x)
{
- int r;
+ unsigned int r;
__asm__("bsfl %1,%0\n\t"
"jnz 1f\n\t"
diff --git a/src/include/cpu/x86/pae.h b/src/include/cpu/x86/pae.h
index 7627187a52..72bae53d68 100644
--- a/src/include/cpu/x86/pae.h
+++ b/src/include/cpu/x86/pae.h
@@ -1,3 +1,19 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 9elements Agency GmbH
+ * Copyright (C) 2019 Facebook Inc.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
#ifndef CPU_X86_PAE_H
#define CPU_X86_PAE_H
@@ -41,4 +57,13 @@ int paging_identity_map_addr(uintptr_t base, size_t size, int pat);
#define MAPPING_ERROR ((void *)0xffffffffUL)
void *map_2M_page(unsigned long page);
+/* To be used with memset_pae */
+#define MEMSET_PAE_VMEM_ALIGN (2 * MiB)
+#define MEMSET_PAE_VMEM_SIZE (2 * MiB)
+#define MEMSET_PAE_PGTL_ALIGN (4 * KiB)
+#define MEMSET_PAE_PGTL_SIZE (20 * KiB)
+
+int memset_pae(uint64_t dest, unsigned char pat, uint64_t length, void *pgtbl,
+ void *vmem_addr);
+
#endif /* CPU_X86_PAE_H */
diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h
index ffcc2a1958..3071106080 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -501,10 +501,6 @@ void mainboard_smi_gpi(u32 gpi_sts);
int mainboard_smi_apmc(u8 data);
void mainboard_smi_sleep(u8 slp_typ);
-#if !CONFIG(SMM_TSEG)
-void smi_release_lock(void);
-#endif
-
/* This is the SMM handler. */
extern unsigned char _binary_smm_start[];
extern unsigned char _binary_smm_end[];
diff --git a/src/include/cpu/x86/tsc.h b/src/include/cpu/x86/tsc.h
index 8dd9b7519c..dd333e8930 100644
--- a/src/include/cpu/x86/tsc.h
+++ b/src/include/cpu/x86/tsc.h
@@ -11,8 +11,6 @@
#define TSC_SYNC
#endif
-#define MSR_PLATFORM_INFO 0xce
-
struct tsc_struct {
unsigned int lo;
unsigned int hi;
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 8e9454c4e1..676da65263 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -137,8 +137,8 @@ struct device {
*/
DEVTREE_CONST struct bus *link_list;
- struct device_operations *ops;
#if !DEVTREE_EARLY
+ struct device_operations *ops;
struct chip_operations *chip_ops;
const char *name;
#if CONFIG(GENERATE_SMBIOS_TABLES)
@@ -288,7 +288,9 @@ DEVTREE_CONST struct device *dev_bus_each_child(const struct bus *parent,
DEVTREE_CONST struct device *pcidev_path_behind(const struct bus *parent,
pci_devfn_t devfn);
DEVTREE_CONST struct device *pcidev_path_on_root(pci_devfn_t devfn);
+DEVTREE_CONST struct device *pcidev_path_on_bus(unsigned int bus, pci_devfn_t devfn);
DEVTREE_CONST struct device *pcidev_on_root(uint8_t dev, uint8_t fn);
+DEVTREE_CONST struct bus *pci_root_bus(void);
void scan_smbus(struct device *bus);
void scan_generic_bus(struct device *bus);
diff --git a/src/include/device/pci.h b/src/include/device/pci.h
index f1de7bffa2..fa695d440f 100644
--- a/src/include/device/pci.h
+++ b/src/include/device/pci.h
@@ -98,8 +98,7 @@ unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev);
const char *pin_to_str(int pin);
int get_pci_irq_pins(struct device *dev, struct device **parent_bdg);
-void pci_assign_irqs(unsigned int bus, unsigned int slot,
- const unsigned char pIntAtoD[4]);
+void pci_assign_irqs(struct device *dev, const unsigned char pIntAtoD[4]);
const char *get_pci_class_name(struct device *dev);
const char *get_pci_subclass_name(struct device *dev);
@@ -110,31 +109,12 @@ struct msix_entry *pci_msix_get_table(struct device *dev);
#define PCI_IO_BRIDGE_ALIGN 4096
#define PCI_MEM_BRIDGE_ALIGN (1024*1024)
-static inline const struct pci_operations *ops_pci(struct device *dev)
-{
- const struct pci_operations *pops;
- pops = 0;
- if (dev && dev->ops)
- pops = dev->ops->ops_pci;
- return pops;
-}
-
#define PCI_ID(VENDOR_ID, DEVICE_ID) \
((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
pci_devfn_t pci_locate_device(unsigned int pci_id, pci_devfn_t dev);
pci_devfn_t pci_locate_device_on_bus(unsigned int pci_id, unsigned int bus);
-#ifdef __SIMPLE_DEVICE__
-unsigned int pci_find_next_capability(pci_devfn_t dev, unsigned int cap,
- unsigned int last);
-unsigned int pci_find_capability(pci_devfn_t dev, unsigned int cap);
-#else /* !__SIMPLE_DEVICE__ */
-unsigned int pci_find_next_capability(struct device *dev, unsigned int cap,
- unsigned int last);
-unsigned int pci_find_capability(struct device *dev, unsigned int cap);
-#endif /* __SIMPLE_DEVICE__ */
-
void pci_early_mmio_window(pci_devfn_t p2p_bridge, u32 mmio_base,
u32 mmio_size);
int pci_early_device_probe(u8 bus, u8 dev, u32 mmio_base);
diff --git a/src/include/device/pci_ids.h b/src/include/device/pci_ids.h
index 35c457a636..0c846c64d9 100644
--- a/src/include/device/pci_ids.h
+++ b/src/include/device/pci_ids.h
@@ -2730,6 +2730,7 @@
#define PCI_DEVICE_ID_INTEL_CNL_Y_PREMIUM_LPC 0x9d83
#define PCI_DEVICE_ID_INTEL_CNP_H_LPC_Q370 0xa306
#define PCI_DEVICE_ID_INTEL_CNP_H_LPC_QM370 0xa30c
+#define PCI_DEVICE_ID_INTEL_CNP_H_LPC_CM246 0xa30e
#define PCI_DEVICE_ID_INTEL_ICL_U_SUPER_U_ESPI 0x3480
#define PCI_DEVICE_ID_INTEL_ICL_U_SUPER_U_ESPI_REV0 0x3481
#define PCI_DEVICE_ID_INTEL_ICL_U_PREMIUM_ESPI 0x3482
@@ -3042,6 +3043,7 @@
#define PCI_DEVICE_ID_INTEL_CFL_GT2_ULT 0x3EA5
#define PCI_DEVICE_ID_INTEL_CFL_H_GT2 0x3e9b
#define PCI_DEVICE_ID_INTEL_CFL_S_GT2 0x3e92
+#define PCI_DEVICE_ID_INTEL_CFL_H_XEON_GT2 0x3e94
#define PCI_DEVICE_ID_INTEL_ICL_GT0_ULT 0x8A70
#define PCI_DEVICE_ID_INTEL_ICL_GT0_5_ULT 0x8A71
#define PCI_DEVICE_ID_INTEL_ICL_GT1_ULT 0x8A40
@@ -3194,17 +3196,6 @@
/* Intel EMMC device Ids */
#define PCI_DEVICE_ID_INTEL_SKL_EMMC 0x9d2b
-/* Intel PCH Ids */
-#define PCH_CNL_LP_M_SUPER 0x9d80
-#define PCH_CNL_LP_M_SUPER_UNLOCK 0x9d81
-#define PCH_CNL_LP_M_SUPER_LOCK 0x9d82
-#define PCH_CNL_LP_Y_PREMIUM 0x9d83
-#define PCH_CNL_LP_U_PREMIUM 0x9d84
-#define PCH_CNL_LP_U_BASE 0x9d85
-#define PCH_CNL_H_DT_SUPER 0xa280
-#define PCH_CNP_H_MOBILE_Q370 0xa306
-#define PCH_CNP_H_MOBILE_QM370 0xa30c
-
/* Intel WIFI Ids */
#define PCI_DEVICE_ID_1000_SERIES_WIFI 0x0084
#define PCI_DEVICE_ID_6005_SERIES_WIFI 0x0085
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h
index 454795f519..9a9c575e3c 100644
--- a/src/include/device/pci_ops.h
+++ b/src/include/device/pci_ops.h
@@ -175,4 +175,21 @@ void pci_update_config32(const struct device *dev, u16 reg, u32 mask, u32 or)
pci_write_config32(dev, reg, reg32);
}
+u16 pci_s_find_next_capability(pci_devfn_t dev, u16 cap, u16 last);
+u16 pci_s_find_capability(pci_devfn_t dev, u16 cap);
+
+#ifndef __SIMPLE_DEVICE__
+static __always_inline
+u16 pci_find_next_capability(const struct device *dev, u16 cap, u16 last)
+{
+ return pci_s_find_next_capability(PCI_BDF(dev), cap, last);
+}
+
+static __always_inline
+u16 pci_find_capability(const struct device *dev, u16 cap)
+{
+ return pci_s_find_capability(PCI_BDF(dev), cap);
+}
+#endif
+
#endif /* PCI_OPS_H */
diff --git a/src/include/program_loading.h b/src/include/program_loading.h
index 7be59e2878..5ac74bf238 100644
--- a/src/include/program_loading.h
+++ b/src/include/program_loading.h
@@ -173,12 +173,6 @@ void run_romstage(void);
/* Run ramstage from romstage. */
void run_ramstage(void);
-/* Determine where stack for ramstage loader is located. */
-enum { ROMSTAGE_STACK_CBMEM, ROMSTAGE_STACK_LOW_MEM };
-uintptr_t romstage_ram_stack_base(size_t size, int src);
-uintptr_t romstage_ram_stack_top(void);
-uintptr_t romstage_ram_stack_bottom(void);
-
/* Backup OS memory to CBMEM_ID_RESUME on ACPI S3 resume path,
* if ramstage overwrites low memory. */
void backup_ramstage_section(uintptr_t base, size_t size);
diff --git a/src/include/stdint.h b/src/include/stdint.h
new file mode 100644
index 0000000000..f363aab08a
--- /dev/null
+++ b/src/include/stdint.h
@@ -0,0 +1,119 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef STDINT_H
+#define STDINT_H
+
+/* romcc does not support long long, _Static_assert, or _Bool, so we must ifdef that code out.
+ Also, GCC can provide its own implementation of stdint.h, so in theory we could use that
+ instead of this custom file once romcc is no more. */
+
+/* Fixed width integer types */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+
+#ifndef __ROMCC__
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+#endif
+
+/* Types for 'void *' pointers */
+typedef signed long intptr_t;
+typedef unsigned long uintptr_t;
+
+/* Ensure that the widths are all correct */
+#ifndef __ROMCC__
+_Static_assert(sizeof(int8_t) == 1, "Size of int8_t is incorrect");
+_Static_assert(sizeof(uint8_t) == 1, "Size of uint8_t is incorrect");
+
+_Static_assert(sizeof(int16_t) == 2, "Size of int16_t is incorrect");
+_Static_assert(sizeof(uint16_t) == 2, "Size of uint16_t is incorrect");
+
+_Static_assert(sizeof(int32_t) == 4, "Size of int32_t is incorrect");
+_Static_assert(sizeof(uint32_t) == 4, "Size of uint32_t is incorrect");
+
+_Static_assert(sizeof(int64_t) == 8, "Size of int64_t is incorrect");
+_Static_assert(sizeof(uint64_t) == 8, "Size of uint64_t is incorrect");
+
+_Static_assert(sizeof(intptr_t) == sizeof(void *), "Size of intptr_t is incorrect");
+_Static_assert(sizeof(uintptr_t) == sizeof(void *), "Size of uintptr_t is incorrect");
+#endif
+
+/* Maximum width integer types */
+#ifndef __ROMCC__
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+#endif
+
+/* Convenient typedefs */
+typedef int8_t s8;
+typedef uint8_t u8;
+
+typedef int16_t s16;
+typedef uint16_t u16;
+
+typedef int32_t s32;
+typedef uint32_t u32;
+
+#ifndef __ROMCC__
+typedef int64_t s64;
+typedef uint64_t u64;
+#endif
+
+/* Limits of integer types */
+#define INT8_MIN ((int8_t)0x80)
+#define INT8_MAX ((int8_t)0x7F)
+#define UINT8_MAX ((uint8_t)0xFF)
+
+#define INT16_MIN ((int16_t)0x8000)
+#define INT16_MAX ((int16_t)0x7FFF)
+#define UINT16_MAX ((uint16_t)0xFFFF)
+
+#define INT32_MIN ((int32_t)0x80000000)
+#define INT32_MAX ((int32_t)0x7FFFFFFF)
+#define UINT32_MAX ((uint32_t)0xFFFFFFFF)
+
+#ifndef __ROMCC__
+#define INT64_MIN ((int64_t)0x8000000000000000)
+#define INT64_MAX ((int64_t)0x7FFFFFFFFFFFFFFF)
+#define UINT64_MAX ((uint64_t)0xFFFFFFFFFFFFFFFF)
+#endif
+
+#ifndef __ROMCC__
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+#endif
+
+/* TODO: move into stdbool.h */
+#ifdef __ROMCC__
+typedef uint8_t bool;
+#else
+typedef _Bool bool;
+#endif
+#define true 1
+#define false 0
+
+/* TODO: move into inttypes.h */
+#ifndef __ROMCC__
+#define PRIu64 "llu"
+#define PRIxPTR "lx"
+#endif
+
+#endif /* STDINT_H */
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 16d5c649b2..f0738eef4e 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -89,9 +89,7 @@ ramstage-y += region_file.c
romstage-y += region_file.c
ramstage-y += romstage_handoff.c
romstage-y += romstage_handoff.c
-romstage-y += romstage_stack.c
romstage-y += selfboot.c
-ramstage-y += romstage_stack.c
romstage-y += stack.c
ramstage-y += rtc.c
@@ -119,7 +117,6 @@ ramstage-y += fmap.c
ramstage-y += memchr.c
ramstage-y += memcmp.c
ramstage-y += malloc.c
-smm-$(CONFIG_SMM_TSEG) += malloc.c
ramstage-y += dimm_info_util.c
ramstage-y += delay.c
ramstage-y += fallback_boot.c
@@ -192,6 +189,7 @@ romstage-y += boot_device.c
ramstage-y += boot_device.c
smm-y += boot_device.c
+smm-y += malloc.c
smm-y += delay.c
smm-y += fmap.c
smm-y += cbfs.c memcmp.c
diff --git a/src/lib/bootblock.c b/src/lib/bootblock.c
index c28a67aceb..3925e90afe 100644
--- a/src/lib/bootblock.c
+++ b/src/lib/bootblock.c
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
DECLARE_OPTIONAL_REGION(timestamp);
diff --git a/src/lib/bootmode.c b/src/lib/bootmode.c
index 737dcf93d0..083fd9d49d 100644
--- a/src/lib/bootmode.c
+++ b/src/lib/bootmode.c
@@ -2,6 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* 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
@@ -15,7 +16,7 @@
#include
#include
-#include
+#include
static int gfx_init_done = -1;
@@ -33,8 +34,7 @@ void gfx_set_init_done(int done)
int display_init_required(void)
{
- /* For vboot, always honor VBOOT_WD_FLAG_DISPLAY_INIT. */
- if (CONFIG(VBOOT)) {
+ if (CONFIG(VBOOT_MAY_SKIP_DISPLAY_INIT)) {
/* Must always select MUST_REQUEST_DISPLAY when using this
function. */
if (!CONFIG(VBOOT_MUST_REQUEST_DISPLAY))
diff --git a/src/lib/decompressor.c b/src/lib/decompressor.c
index 0529d11390..eb7f16cd88 100644
--- a/src/lib/decompressor.c
+++ b/src/lib/decompressor.c
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
extern u8 compressed_bootblock[];
asm (
diff --git a/src/lib/fit_payload.c b/src/lib/fit_payload.c
index 8e75915806..a4d370540e 100644
--- a/src/lib/fit_payload.c
+++ b/src/lib/fit_payload.c
@@ -228,7 +228,7 @@ void fit_payload(struct prog *payload)
/* Collect infos for fit_payload_arch */
kernel.size = config->kernel->size;
- fdt.size = dt ? dt_flat_size(dt) : 0;
+ fdt.size = dt_flat_size(dt);
initrd.size = config->ramdisk ? config->ramdisk->size : 0;
/* Invoke arch specific payload placement and fixups */
diff --git a/src/lib/romstage_stack.c b/src/lib/romstage_stack.c
deleted file mode 100644
index ed6f09b4cb..0000000000
--- a/src/lib/romstage_stack.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2013 Google Inc.
- * Copyright (C) 2015-2016 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include
-#include
-
-/*
- * Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage.
- */
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
-uintptr_t romstage_ram_stack_base(size_t size, int src)
-{
- /* cbmem_add() does a find() before add(). */
- if (src == ROMSTAGE_STACK_CBMEM)
- return (uintptr_t)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK, size);
- if (src == ROMSTAGE_STACK_LOW_MEM)
- return CONFIG_RAMTOP - size;
- return 0;
-}
-
-uintptr_t romstage_ram_stack_bottom(void)
-{
- return romstage_ram_stack_base(ROMSTAGE_RAM_STACK_SIZE,
- ROMSTAGE_STACK_CBMEM);
-}
-
-uintptr_t romstage_ram_stack_top(void)
-{
- uintptr_t stack_top = romstage_ram_stack_base(ROMSTAGE_RAM_STACK_SIZE,
- ROMSTAGE_STACK_CBMEM);
- stack_top += ROMSTAGE_RAM_STACK_SIZE;
-
- /* Make it aligned to a 8-byte boundary. */
- stack_top = ALIGN_DOWN(stack_top, 8);
- return stack_top;
-}
diff --git a/src/mainboard/advansus/a785e-i/romstage.c b/src/mainboard/advansus/a785e-i/romstage.c
index 4a817cf844..ca32977e10 100644
--- a/src/mainboard/advansus/a785e-i/romstage.c
+++ b/src/mainboard/advansus/a785e-i/romstage.c
@@ -45,13 +45,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl)
-{
-}
int spd_read_byte(u32 device, u32 address)
{
@@ -60,7 +55,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/amd/bimini_fam10/romstage.c b/src/mainboard/amd/bimini_fam10/romstage.c
index 7b2f0513a4..e2142f2791 100644
--- a/src/mainboard/amd/bimini_fam10/romstage.c
+++ b/src/mainboard/amd/bimini_fam10/romstage.c
@@ -41,13 +41,8 @@
#include "cpu/amd/quadcore/quadcore.c"
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl)
-{
-}
int spd_read_byte(u32 device, u32 address)
{
@@ -56,7 +51,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/amd/mahogany_fam10/romstage.c b/src/mainboard/amd/mahogany_fam10/romstage.c
index c73eb0d388..3397d26d96 100644
--- a/src/mainboard/amd/mahogany_fam10/romstage.c
+++ b/src/mainboard/amd/mahogany_fam10/romstage.c
@@ -45,11 +45,8 @@
#include "cpu/amd/quadcore/quadcore.c"
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -59,7 +56,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/amd/serengeti_cheetah_fam10/romstage.c b/src/mainboard/amd/serengeti_cheetah_fam10/romstage.c
index a525154eb3..3871c592d5 100644
--- a/src/mainboard/amd/serengeti_cheetah_fam10/romstage.c
+++ b/src/mainboard/amd/serengeti_cheetah_fam10/romstage.c
@@ -41,9 +41,7 @@
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
static void memreset_setup(void)
{
@@ -168,7 +166,7 @@ static const u8 spd_addr[] = {
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/amd/tilapia_fam10/romstage.c b/src/mainboard/amd/tilapia_fam10/romstage.c
index a45d8f6510..702e9db9df 100644
--- a/src/mainboard/amd/tilapia_fam10/romstage.c
+++ b/src/mainboard/amd/tilapia_fam10/romstage.c
@@ -43,11 +43,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, IT8718F_SP1)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -57,7 +54,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/aopen/dxplplusu/Kconfig b/src/mainboard/aopen/dxplplusu/Kconfig
index 905ddd5800..738a2ea0ae 100644
--- a/src/mainboard/aopen/dxplplusu/Kconfig
+++ b/src/mainboard/aopen/dxplplusu/Kconfig
@@ -7,9 +7,6 @@ config BOARD_SPECIFIC_OPTIONS
select SOUTHBRIDGE_INTEL_I82870
select SOUTHBRIDGE_INTEL_I82801DX
select SUPERIO_SMSC_LPC47M10X
-# select HAVE_PIRQ_TABLE
-# select PIRQ_ROUTE
- select UDELAY_TSC
select HAVE_ACPI_TABLES
select BOARD_ROMSIZE_KB_2048
diff --git a/src/mainboard/aopen/dxplplusu/acpi_tables.c b/src/mainboard/aopen/dxplplusu/acpi_tables.c
index 039e4ecc6a..cc6835b939 100644
--- a/src/mainboard/aopen/dxplplusu/acpi_tables.c
+++ b/src/mainboard/aopen/dxplplusu/acpi_tables.c
@@ -20,13 +20,17 @@
#include
#include
-#include
-#include "bus.h"
+
+#define IOAPIC_ICH4 2
+#define IOAPIC_P64H2_BUS_B 3 /* IOAPIC 3 at 02:1c.0 */
+#define IOAPIC_P64H2_BUS_A 4 /* IOAPIC 4 at 02:1e.0 */
+
+#define INTEL_IOAPIC_NUM_INTERRUPTS 24 /* Both ICH-4 and P64-H2 */
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int irq_start = 0;
- struct device *dev = NULL;
+ struct device *bdev, *dev = NULL;
struct resource* res = NULL;
/* SJM: Hard-code CPU LAPIC entries for now */
@@ -36,25 +40,30 @@ unsigned long acpi_fill_madt(unsigned long current)
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, 3, 7);
/* Southbridge IOAPIC */
- current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, IOAPIC_ICH4, 0xfec00000, irq_start);
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, IOAPIC_ICH4,
+ 0xfec00000, irq_start);
irq_start += INTEL_IOAPIC_NUM_INTERRUPTS;
+ bdev = pcidev_on_root(2, 0);
/* P64H2 Bus B IOAPIC */
- dev = dev_find_slot(PCI_BUS_E7501_HI_B, PCI_DEVFN(28, 0));
- if (!dev)
- BUG(); /* Config.lb error? */
- res = find_resource(dev, PCI_BASE_ADDRESS_0);
- current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, IOAPIC_P64H2_BUS_B, res->base, irq_start);
- irq_start += INTEL_IOAPIC_NUM_INTERRUPTS;
+ if (bdev)
+ dev = pcidev_path_behind(bdev->link_list, PCI_DEVFN(28, 0));
+ if (dev) {
+ res = find_resource(dev, PCI_BASE_ADDRESS_0);
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current,
+ IOAPIC_P64H2_BUS_B, res->base, irq_start);
+ irq_start += INTEL_IOAPIC_NUM_INTERRUPTS;
+ }
/* P64H2 Bus A IOAPIC */
- dev = dev_find_slot(PCI_BUS_E7501_HI_B, PCI_DEVFN(30, 0));
- if (!dev)
- BUG(); /* Config.lb error? */
- res = find_resource(dev, PCI_BASE_ADDRESS_0);
- current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, IOAPIC_P64H2_BUS_A, res->base, irq_start);
- irq_start += INTEL_IOAPIC_NUM_INTERRUPTS;
-
+ if (bdev)
+ dev = pcidev_path_behind(bdev->link_list, PCI_DEVFN(28, 0));
+ if (dev) {
+ res = find_resource(dev, PCI_BASE_ADDRESS_0);
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current,
+ IOAPIC_P64H2_BUS_A, res->base, irq_start);
+ irq_start += INTEL_IOAPIC_NUM_INTERRUPTS;
+ }
/* Map ISA IRQ 0 to IRQ 2 */
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 1, 0, 2, 0);
diff --git a/src/mainboard/aopen/dxplplusu/bus.h b/src/mainboard/aopen/dxplplusu/bus.h
deleted file mode 100644
index 12eef12381..0000000000
--- a/src/mainboard/aopen/dxplplusu/bus.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2011 Kyösti Mälkki
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef DXPLPLUSU_BUS_H_INCLUDED
-#define DXPLPLUSU_BUS_H_INCLUDED
-
-/* These were determined by seeing how coreboot enumerates the various
- * PCI (and PCI-like) buses on the board.
- */
-
-#define PCI_BUS_ROOT 0
-#define PCI_BUS_AGP 1 /* AGP */
-#define PCI_BUS_E7501_HI_B 2 /* P64H2#1 */
-#define PCI_BUS_P64H2_B 3 /* P64H2#1 bus B */
-#define PCI_BUS_P64H2_A 4 /* P64H2#1 bus A */
-#define PCI_BUS_ICH4 5 /* ICH4 */
-
-/* IOAPIC addresses determined by coreboot enumeration. */
-/* Someday add functions to get APIC IDs and versions from the chips themselves. */
-
-#define IOAPIC_ICH4 2
-#define IOAPIC_P64H2_BUS_B 3 /* IOAPIC 3 at 02:1c.0 MBAR = fe300000 DataAddr = fe300010 */
-#define IOAPIC_P64H2_BUS_A 4 /* IOAPIC 4 at 02:1e.0 MBAR = fe301000 DataAddr = fe301010 */
-
-#define INTEL_IOAPIC_NUM_INTERRUPTS 24 /* Both ICH-4 and P64-H2 */
-
-#endif
diff --git a/src/mainboard/aopen/dxplplusu/irq_tables.c b/src/mainboard/aopen/dxplplusu/irq_tables.c
deleted file mode 100644
index b7e1187162..0000000000
--- a/src/mainboard/aopen/dxplplusu/irq_tables.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2011 Kyösti Mälkki
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include
-#include
-#include
-#include "bus.h"
-
-#define UNUSED_INTERRUPT {0, 0}
-#define PIRQ_A 0x60
-#define PIRQ_B 0x61
-#define PIRQ_C 0x62
-#define PIRQ_D 0x63
-#define PIRQ_E 0x68
-#define PIRQ_F 0x69
-#define PIRQ_G 0x6A
-#define PIRQ_H 0x6B
-
-static const struct irq_routing_table intel_irq_routing_table = {
- PIRQ_SIGNATURE,
- PIRQ_VERSION,
- 32 + 16 * CONFIG_IRQ_SLOT_COUNT, /* Size of this struct in bytes */
- 0, /* PCI bus number on which the interrupt router resides */
- PCI_DEVFN(31, 0), /* PCI device/function number of the interrupt router */
- 0, /* PCI-exclusive IRQ bitmap */
- PCI_VENDOR_ID_INTEL, /* Vendor ID of compatible PCI interrupt router */
- PCI_DEVICE_ID_INTEL_82801DB_LPC, /* Device ID of compatible PCI interrupt router */
- 0, /* Additional miniport information */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* Reserved, must be zero */
- 0xB1, /* Checksum of the entire structure (causes 8-bit sum == 0) */
- {
- /* NOTE: For 82801, a nonzero link value is a pointer to a PIRQ[n]_ROUT register in PCI configuration space */
- /* This was determined from linux-2.6.11/arch/i386/pci/irq.c */
- /* bitmap of 0xdcf8 == routable to IRQ3-IRQ7, IRQ10-IRQ12, or IRQ14-IRQ15 */
- /* ICH-3 doesn't allow SERIRQ or PCI message to generate IRQ0, IRQ2, IRQ8, or IRQ13 */
- /* Not sure why IRQ9 isn't routable (inherited from Tyan S2735) */
-
- /* INTA# INTB# INTC# INTD# */
- /* bus, device # {link , bitmap}, {link , bitmap}, {link , bitmap}, {link , bitmap}, slot, rfu */
-
- {PCI_BUS_ROOT, PCI_DEVFN(31, 0), {{PIRQ_C, 0xdcf8}, {PIRQ_B, 0xdcf8}, UNUSED_INTERRUPT, UNUSED_INTERRUPT}, 0, 0}, /* IDE / SMBus */
- {PCI_BUS_ROOT, PCI_DEVFN(29, 0), {{PIRQ_A, 0xdcf8}, {PIRQ_D, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_H, 0xdcf8}}, 0, 0}, /* USB 1.1 */
-
- {PCI_BUS_P64H2_B, PCI_DEVFN(2, 0) , {{PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}}, 0, 0},
- {PCI_BUS_P64H2_B, PCI_DEVFN(3, 0) , {{PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}}, 0, 0},
- {PCI_BUS_P64H2_B, PCI_DEVFN(4, 0) , {{PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}}, 0, 0}, /* GbE */
-
- {PCI_BUS_P64H2_A, PCI_DEVFN(2, 0) , {{PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}}, 0, 0},
- {PCI_BUS_P64H2_A, PCI_DEVFN(3, 0) , {{PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}}, 0, 0},
- {PCI_BUS_P64H2_A, PCI_DEVFN(4, 0) , {{PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}, {PIRQ_C, 0xdcf8}}, 0, 0}, /* SCSI */
-
- {PCI_BUS_ICH4, PCI_DEVFN(3, 0), {{PIRQ_E, 0xdcf8}, {PIRQ_F, 0xdcf8}, {PIRQ_G, 0xdcf8}, {PIRQ_H, 0xdcf8}}, 0, 0}, /* 32-bit slot */
-
- }
-};
-
-unsigned long write_pirq_routing_table(unsigned long addr)
-{
- return copy_pirq_routing_table(addr, &intel_irq_routing_table);
-}
diff --git a/src/mainboard/asrock/h81m-hds/Kconfig b/src/mainboard/asrock/h81m-hds/Kconfig
index 928a01042e..6974cda95f 100644
--- a/src/mainboard/asrock/h81m-hds/Kconfig
+++ b/src/mainboard/asrock/h81m-hds/Kconfig
@@ -34,7 +34,6 @@ config BOARD_SPECIFIC_OPTIONS
select SOUTHBRIDGE_INTEL_LYNXPOINT
select SUPERIO_NUVOTON_NCT6776
select SUPERIO_NUVOTON_NCT6776_COM_A
- select TSC_MONOTONIC_TIMER
config CBFS_SIZE
hex
diff --git a/src/mainboard/asus/kcma-d8/romstage.c b/src/mainboard/asus/kcma-d8/romstage.c
index 6c40627823..51d178fe88 100644
--- a/src/mainboard/asus/kcma-d8/romstage.c
+++ b/src/mainboard/asus/kcma-d8/romstage.c
@@ -50,9 +50,7 @@
#define SERIAL_0_DEV PNP_DEV(0x2e, W83667HG_A_SP1)
#define SERIAL_1_DEV PNP_DEV(0x2e, W83667HG_A_SP2)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
inline int spd_read_byte(unsigned int device, unsigned int address)
{
@@ -356,7 +354,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
: "=r" (esp)
);
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
/* Limit the maximum HT speed to 2.6GHz to prevent lockups
* due to HT CPU <--> CPU wiring not being validated to 3.2GHz
diff --git a/src/mainboard/asus/kfsn4-dre/romstage.c b/src/mainboard/asus/kfsn4-dre/romstage.c
index dbf704b288..7b20243863 100644
--- a/src/mainboard/asus/kfsn4-dre/romstage.c
+++ b/src/mainboard/asus/kfsn4-dre/romstage.c
@@ -53,9 +53,7 @@
#define GPIO3_DEV PNP_DEV(0x2e, W83627THG_GPIO3)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
int spd_read_byte(unsigned int device, unsigned int address)
{
@@ -170,7 +168,8 @@ static const uint8_t spd_addr[] = {
RC01, DIMM0, DIMM2, DIMM4, DIMM6, DIMM1, DIMM3, DIMM5, DIMM7,
};
-void activate_spd_rom(const struct mem_controller *ctrl) {
+void activate_spd_rom(const struct mem_controller *ctrl)
+{
printk(BIOS_DEBUG, "activate_spd_rom() for node %02x\n", ctrl->node_id);
if (ctrl->node_id == 0) {
printk(BIOS_DEBUG, "enable_spd_node0()\n");
@@ -184,7 +183,7 @@ void activate_spd_rom(const struct mem_controller *ctrl) {
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
u32 bsp_apicid = 0, val, wants_reset;
msr_t msr;
diff --git a/src/mainboard/asus/kgpe-d16/romstage.c b/src/mainboard/asus/kgpe-d16/romstage.c
index d017b0616a..637ec42109 100644
--- a/src/mainboard/asus/kgpe-d16/romstage.c
+++ b/src/mainboard/asus/kgpe-d16/romstage.c
@@ -51,9 +51,7 @@
#define SERIAL_0_DEV PNP_DEV(0x2e, W83667HG_A_SP1)
#define SERIAL_1_DEV PNP_DEV(0x2e, W83667HG_A_SP2)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
int spd_read_byte(unsigned int device, unsigned int address)
{
@@ -179,8 +177,9 @@ static const uint8_t spd_addr_fam10[] = {
RC01, DIMM0, DIMM1, 0, 0, DIMM2, DIMM3, 0, 0,
};
-void activate_spd_rom(const struct mem_controller *ctrl) {
- struct sys_info *sysinfo = &sysinfo_car;
+void activate_spd_rom(const struct mem_controller *ctrl)
+{
+ struct sys_info *sysinfo = get_sysinfo();
printk(BIOS_DEBUG, "activate_spd_rom() for node %02x\n", ctrl->node_id);
if (ctrl->node_id == 0) {
printk(BIOS_DEBUG, "enable_spd_node0()\n");
@@ -467,7 +466,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
: "=r" (esp)
);
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
/* Limit the maximum HT speed to 2.6GHz to prevent lockups
* due to HT CPU <--> CPU wiring not being validated to 3.2GHz
diff --git a/src/mainboard/asus/m4a78-em/romstage.c b/src/mainboard/asus/m4a78-em/romstage.c
index c99179e48e..c52b35b22f 100644
--- a/src/mainboard/asus/m4a78-em/romstage.c
+++ b/src/mainboard/asus/m4a78-em/romstage.c
@@ -46,11 +46,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, IT8712F_SP1)
#define GPIO_DEV PNP_DEV(0x2e, IT8712F_GPIO)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -59,7 +56,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/asus/m4a785-m/romstage.c b/src/mainboard/asus/m4a785-m/romstage.c
index 1d5921440d..b7af9e2cf5 100644
--- a/src/mainboard/asus/m4a785-m/romstage.c
+++ b/src/mainboard/asus/m4a785-m/romstage.c
@@ -46,11 +46,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, IT8712F_SP1)
#define GPIO_DEV PNP_DEV(0x2e, IT8712F_GPIO)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -59,7 +56,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/asus/m5a88-v/romstage.c b/src/mainboard/asus/m5a88-v/romstage.c
index 9216ecb910..1309d67d88 100644
--- a/src/mainboard/asus/m5a88-v/romstage.c
+++ b/src/mainboard/asus/m5a88-v/romstage.c
@@ -46,13 +46,8 @@
#define SERIAL_DEV PNP_DEV(0x4e, IT8721F_SP1)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl)
-{
-}
int spd_read_byte(u32 device, u32 address)
{
@@ -62,7 +57,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/asus/p8h61-m_pro/gpio.c b/src/mainboard/asus/p8h61-m_pro/gpio.c
index 1cf848f0b1..b1b819eca0 100644
--- a/src/mainboard/asus/p8h61-m_pro/gpio.c
+++ b/src/mainboard/asus/p8h61-m_pro/gpio.c
@@ -105,7 +105,7 @@ static const struct pch_gpio_set2 pch_gpio_set2_mode = {
.gpio43 = GPIO_MODE_NATIVE,
.gpio44 = GPIO_MODE_NATIVE,
.gpio45 = GPIO_MODE_NATIVE,
- .gpio46 = GPIO_MODE_GPIO,
+ .gpio46 = GPIO_MODE_GPIO, /* wired to GPU Boost switch */
.gpio47 = GPIO_MODE_NATIVE,
.gpio48 = GPIO_MODE_NATIVE,
.gpio49 = GPIO_MODE_GPIO,
diff --git a/src/mainboard/avalue/eax-785e/romstage.c b/src/mainboard/avalue/eax-785e/romstage.c
index 934791926c..b4b536e1e4 100644
--- a/src/mainboard/avalue/eax-785e/romstage.c
+++ b/src/mainboard/avalue/eax-785e/romstage.c
@@ -45,13 +45,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
#define CLK_DEV PNP_DEV(0x2e, W83627HF_SP1)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl)
-{
-}
int spd_read_byte(u32 device, u32 address)
{
@@ -60,7 +55,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/emulation/qemu-armv7/Kconfig b/src/mainboard/emulation/qemu-armv7/Kconfig
index 0bb5f3abc5..fc770cf27d 100644
--- a/src/mainboard/emulation/qemu-armv7/Kconfig
+++ b/src/mainboard/emulation/qemu-armv7/Kconfig
@@ -35,6 +35,7 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_4096
select BOOT_DEVICE_NOT_SPI_FLASH
select MISSING_BOARD_RESET
+ select NO_MONOTONIC_TIMER
config MAINBOARD_DIR
string
diff --git a/src/mainboard/emulation/qemu-i440fx/mainboard.c b/src/mainboard/emulation/qemu-i440fx/mainboard.c
index 4886fe1830..0b3689731e 100644
--- a/src/mainboard/emulation/qemu-i440fx/mainboard.c
+++ b/src/mainboard/emulation/qemu-i440fx/mainboard.c
@@ -41,7 +41,7 @@ static void qemu_nb_init(struct device *dev)
/* setup IRQ routing */
for (i = 0; i < 32; i++)
- pci_assign_irqs(0, i, qemu_i440fx_irqs + (i % 4));
+ pci_assign_irqs(pcidev_on_root(i, 0), qemu_i440fx_irqs + (i % 4));
}
static struct device_operations nb_operations = {
diff --git a/src/mainboard/emulation/qemu-i440fx/romstage.c b/src/mainboard/emulation/qemu-i440fx/romstage.c
index e1d4f62708..6b1883ccbd 100644
--- a/src/mainboard/emulation/qemu-i440fx/romstage.c
+++ b/src/mainboard/emulation/qemu-i440fx/romstage.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
+#include
#include
#include
#include
@@ -31,11 +32,7 @@ asmlinkage void car_stage_entry(void)
timestamp_add_now(TS_START_ROMSTAGE);
- /**
- * The LZMA decoder needs about 4 KiB stack.
- * Leave 1 KiB stack for general postcar code.
- */
- if (postcar_frame_init(&pcf, 5 * KiB))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/**
diff --git a/src/mainboard/emulation/qemu-power8/Kconfig b/src/mainboard/emulation/qemu-power8/Kconfig
index 66a3d8c25f..c3a9904986 100644
--- a/src/mainboard/emulation/qemu-power8/Kconfig
+++ b/src/mainboard/emulation/qemu-power8/Kconfig
@@ -19,6 +19,7 @@ if BOARD_EMULATION_QEMU_POWER8
config BOARD_SPECIFIC_OPTIONS
def_bool y
+ select CPU_QEMU_POWER8
select BOARD_ROMSIZE_KB_4096
select ARCH_BOOTBLOCK_PPC64
select HAVE_UART_SPECIAL
diff --git a/src/mainboard/emulation/qemu-q35/bootblock.c b/src/mainboard/emulation/qemu-q35/bootblock.c
index 13550f7e3d..d5ca7f9ce7 100644
--- a/src/mainboard/emulation/qemu-q35/bootblock.c
+++ b/src/mainboard/emulation/qemu-q35/bootblock.c
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
/* Just define these here, there is no gm35.h file to include. */
#define D0F0_PCIEXBAR_LO 0x60
@@ -39,6 +40,12 @@ static void bootblock_northbridge_init(void)
pci_io_write_config32(PCI_DEV(0,0,0), D0F0_PCIEXBAR_HI, reg);
reg = CONFIG_MMCONF_BASE_ADDRESS | 1; /* 256MiB - 0-255 buses. */
pci_io_write_config32(PCI_DEV(0,0,0), D0F0_PCIEXBAR_LO, reg);
+
+ /* MCFG is now active. If it's not qemu was started for machine PC */
+ if (CONFIG(BOOTBLOCK_CONSOLE) &&
+ (pci_read_config32(PCI_DEV(0, 0, 0), D0F0_PCIEXBAR_LO) !=
+ (CONFIG_MMCONF_BASE_ADDRESS | 1)))
+ die("You must run qemu for machine Q35 (-M q35)");
}
static void enable_spi_prefetch(void)
diff --git a/src/mainboard/emulation/qemu-q35/mainboard.c b/src/mainboard/emulation/qemu-q35/mainboard.c
index 90a32f4000..ae3f96a158 100644
--- a/src/mainboard/emulation/qemu-q35/mainboard.c
+++ b/src/mainboard/emulation/qemu-q35/mainboard.c
@@ -61,10 +61,10 @@ static void qemu_nb_init(struct device *dev)
/* setup IRQ routing for pci slots */
for (i = 0; i < 25; i++)
- pci_assign_irqs(0, i, qemu_q35_irqs + (i % 4));
+ pci_assign_irqs(pcidev_on_root(i, 0), qemu_q35_irqs + (i % 4));
/* setup IRQ routing southbridge devices */
for (i = 25; i < 32; i++)
- pci_assign_irqs(0, i, qemu_q35_irqs);
+ pci_assign_irqs(pcidev_on_root(i, 0), qemu_q35_irqs);
}
static void qemu_nb_read_resources(struct device *dev)
diff --git a/src/mainboard/emulation/qemu-q35/romstage.c b/src/mainboard/emulation/qemu-q35/romstage.c
index 3e0870ffec..dbaead982a 100644
--- a/src/mainboard/emulation/qemu-q35/romstage.c
+++ b/src/mainboard/emulation/qemu-q35/romstage.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
+#include
#include
#include
#include
@@ -21,6 +22,18 @@
#include
#include
#include
+#include
+
+#define D0F0_PCIEXBAR_LO 0x60
+
+static void mainboard_machine_check(void)
+{
+ /* Check that MCFG is active. If it's not qemu was started for machine PC */
+ if (!CONFIG(BOOTBLOCK_CONSOLE) &&
+ (pci_read_config32(PCI_DEV(0, 0, 0), D0F0_PCIEXBAR_LO) !=
+ (CONFIG_MMCONF_BASE_ADDRESS | 1)))
+ die("You must run qemu for machine Q35 (-M q35)");
+}
asmlinkage void car_stage_entry(void)
{
@@ -28,15 +41,13 @@ asmlinkage void car_stage_entry(void)
i82801ix_early_init();
console_init();
+ mainboard_machine_check();
+
cbmem_recovery(0);
timestamp_add_now(TS_START_ROMSTAGE);
- /**
- * The LZMA decoder needs about 4 KiB stack.
- * Leave 1 KiB stack for general postcar code.
- */
- if (postcar_frame_init(&pcf, 5 * KiB))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/**
diff --git a/src/mainboard/esd/atom15/Kconfig b/src/mainboard/esd/atom15/Kconfig
index 94dae0882b..5726461539 100644
--- a/src/mainboard/esd/atom15/Kconfig
+++ b/src/mainboard/esd/atom15/Kconfig
@@ -22,7 +22,6 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_8192
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
- select TSC_MONOTONIC_TIMER
config MAINBOARD_DIR
string
diff --git a/src/mainboard/getac/p470/romstage.c b/src/mainboard/getac/p470/romstage.c
index aaa3422c02..d14b1c8719 100644
--- a/src/mainboard/getac/p470/romstage.c
+++ b/src/mainboard/getac/p470/romstage.c
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/src/mainboard/gigabyte/ma785gm/romstage.c b/src/mainboard/gigabyte/ma785gm/romstage.c
index 4ca318a4d8..0d1f45d7af 100644
--- a/src/mainboard/gigabyte/ma785gm/romstage.c
+++ b/src/mainboard/gigabyte/ma785gm/romstage.c
@@ -46,11 +46,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, IT8718F_SP1)
#define GPIO_DEV PNP_DEV(0x2e, IT8718F_GPIO)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -59,7 +56,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/gigabyte/ma785gmt/romstage.c b/src/mainboard/gigabyte/ma785gmt/romstage.c
index 746be76642..384eccdb11 100644
--- a/src/mainboard/gigabyte/ma785gmt/romstage.c
+++ b/src/mainboard/gigabyte/ma785gmt/romstage.c
@@ -46,11 +46,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, IT8718F_SP1)
#define GPIO_DEV PNP_DEV(0x2e, IT8718F_GPIO)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -59,7 +56,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/gigabyte/ma78gm/romstage.c b/src/mainboard/gigabyte/ma78gm/romstage.c
index 4d23bac7b8..48af367817 100644
--- a/src/mainboard/gigabyte/ma78gm/romstage.c
+++ b/src/mainboard/gigabyte/ma78gm/romstage.c
@@ -46,11 +46,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, IT8718F_SP1)
#define GPIO_DEV PNP_DEV(0x2e, IT8718F_GPIO)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -59,7 +56,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/google/auron/Makefile.inc b/src/mainboard/google/auron/Makefile.inc
index d2b6d0eb9a..6b1de0536c 100644
--- a/src/mainboard/google/auron/Makefile.inc
+++ b/src/mainboard/google/auron/Makefile.inc
@@ -19,7 +19,7 @@ romstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
bootblock-$(CONFIG_CHROMEOS) += chromeos.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += variants/$(VARIANT_DIR)/pei_data.c
ramstage-y += variants/$(VARIANT_DIR)/pei_data.c
diff --git a/src/mainboard/google/beltino/Makefile.inc b/src/mainboard/google/beltino/Makefile.inc
index bb90e9780b..e1bebc1369 100644
--- a/src/mainboard/google/beltino/Makefile.inc
+++ b/src/mainboard/google/beltino/Makefile.inc
@@ -18,7 +18,7 @@ ramstage-$(CONFIG_CHROMEOS) += chromeos.c
verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += chromeos.c
ramstage-y += lan.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c variants/$(VARIANT_DIR)/led.c
+smm-y += smihandler.c variants/$(VARIANT_DIR)/led.c
romstage-y += variants/$(VARIANT_DIR)/led.c
diff --git a/src/mainboard/google/butterfly/Makefile.inc b/src/mainboard/google/butterfly/Makefile.inc
index 8033e1c325..b6654b8c0a 100644
--- a/src/mainboard/google/butterfly/Makefile.inc
+++ b/src/mainboard/google/butterfly/Makefile.inc
@@ -19,6 +19,6 @@ romstage-y += chromeos.c
ramstage-y += chromeos.c
romstage-y += gpio.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c
+smm-y += mainboard_smi.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/google/cyan/Makefile.inc b/src/mainboard/google/cyan/Makefile.inc
index 027c49cc8f..86198a61dc 100644
--- a/src/mainboard/google/cyan/Makefile.inc
+++ b/src/mainboard/google/cyan/Makefile.inc
@@ -24,7 +24,7 @@ ramstage-y += ec.c
ramstage-y += irqroute.c
ramstage-y += w25q64.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/$(VARIANT_DIR)
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/google/dragonegg/Makefile.inc b/src/mainboard/google/dragonegg/Makefile.inc
index 39e94d0119..dcd8cbccbc 100644
--- a/src/mainboard/google/dragonegg/Makefile.inc
+++ b/src/mainboard/google/dragonegg/Makefile.inc
@@ -26,7 +26,7 @@ ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
ramstage-y += mainboard.c
ramstage-y += ramstage.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/baseboard
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/google/eve/Makefile.inc b/src/mainboard/google/eve/Makefile.inc
index c96e23ea49..d853404a45 100644
--- a/src/mainboard/google/eve/Makefile.inc
+++ b/src/mainboard/google/eve/Makefile.inc
@@ -26,4 +26,4 @@ ramstage-y += mainboard.c
ramstage-y += ramstage.c
ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
diff --git a/src/mainboard/google/fizz/Makefile.inc b/src/mainboard/google/fizz/Makefile.inc
index 59f84b543a..5514090d4e 100644
--- a/src/mainboard/google/fizz/Makefile.inc
+++ b/src/mainboard/google/fizz/Makefile.inc
@@ -25,7 +25,7 @@ ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
ramstage-y += mainboard.c
ramstage-y += ramstage.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/baseboard
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/google/fizz/variants/karma/Makefile.inc b/src/mainboard/google/fizz/variants/karma/Makefile.inc
index 747552267d..ec115e4655 100644
--- a/src/mainboard/google/fizz/variants/karma/Makefile.inc
+++ b/src/mainboard/google/fizz/variants/karma/Makefile.inc
@@ -3,4 +3,4 @@ bootblock-y += gpio.c
ramstage-y += gpio.c
ramstage-y += nhlt.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
diff --git a/src/mainboard/google/glados/Makefile.inc b/src/mainboard/google/glados/Makefile.inc
index ccfeb8506f..da9de29521 100644
--- a/src/mainboard/google/glados/Makefile.inc
+++ b/src/mainboard/google/glados/Makefile.inc
@@ -29,7 +29,7 @@ ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
ramstage-y += mainboard.c
ramstage-y += ramstage.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/$(VARIANT_DIR)
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/google/glados/variants/caroline/Makefile.inc b/src/mainboard/google/glados/variants/caroline/Makefile.inc
index 73d7090953..21b20e6912 100644
--- a/src/mainboard/google/glados/variants/caroline/Makefile.inc
+++ b/src/mainboard/google/glados/variants/caroline/Makefile.inc
@@ -16,7 +16,7 @@
romstage-y += variant.c
ramstage-y += variant.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += variant.c
+smm-y += variant.c
SPD_BIN = $(obj)/spd.bin
diff --git a/src/mainboard/google/glados/variants/cave/Makefile.inc b/src/mainboard/google/glados/variants/cave/Makefile.inc
index 5d95e348af..f3b52c2398 100644
--- a/src/mainboard/google/glados/variants/cave/Makefile.inc
+++ b/src/mainboard/google/glados/variants/cave/Makefile.inc
@@ -16,7 +16,7 @@
romstage-y += variant.c
ramstage-y += variant.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += variant.c
+smm-y += variant.c
SPD_BIN = $(obj)/spd.bin
diff --git a/src/mainboard/google/glados/variants/chell/Makefile.inc b/src/mainboard/google/glados/variants/chell/Makefile.inc
index 2eff4b1f1d..986bdd8552 100644
--- a/src/mainboard/google/glados/variants/chell/Makefile.inc
+++ b/src/mainboard/google/glados/variants/chell/Makefile.inc
@@ -16,7 +16,7 @@
romstage-y += variant.c
ramstage-y += variant.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += variant.c
+smm-y += variant.c
SPD_BIN = $(obj)/spd.bin
diff --git a/src/mainboard/google/glados/variants/glados/Makefile.inc b/src/mainboard/google/glados/variants/glados/Makefile.inc
index 82dbcade42..b6dbbd4562 100644
--- a/src/mainboard/google/glados/variants/glados/Makefile.inc
+++ b/src/mainboard/google/glados/variants/glados/Makefile.inc
@@ -16,7 +16,7 @@
romstage-y += variant.c
ramstage-y += variant.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += variant.c
+smm-y += variant.c
SPD_BIN = $(obj)/spd.bin
diff --git a/src/mainboard/google/hatch/Makefile.inc b/src/mainboard/google/hatch/Makefile.inc
index 3f35f8266e..01a1eb85dd 100644
--- a/src/mainboard/google/hatch/Makefile.inc
+++ b/src/mainboard/google/hatch/Makefile.inc
@@ -24,7 +24,7 @@ romstage-y += romstage.c
romstage-$(CONFIG_CHROMEOS) += chromeos.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/baseboard
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/google/hatch/dsdt.asl b/src/mainboard/google/hatch/dsdt.asl
index 243c6270e2..e2959a788a 100644
--- a/src/mainboard/google/hatch/dsdt.asl
+++ b/src/mainboard/google/hatch/dsdt.asl
@@ -41,6 +41,9 @@ DefinitionBlock(
#include
#include
}
+
+ /* Mainboard hooks */
+ #include "mainboard.asl"
}
#if CONFIG(CHROMEOS)
@@ -51,6 +54,9 @@ DefinitionBlock(
/* Chipset specific sleep states */
#include
+ /* Low power idle table */
+ #include
+
/* Chrome OS Embedded Controller */
Scope (\_SB.PCI0.LPCB)
{
diff --git a/src/mainboard/google/hatch/mainboard.asl b/src/mainboard/google/hatch/mainboard.asl
new file mode 100644
index 0000000000..dff1a75959
--- /dev/null
+++ b/src/mainboard/google/hatch/mainboard.asl
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google, LLC
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+
+Method (LOCL, 1, Serialized)
+{
+ For (Local0 = 0, Local0 < 5, Local0++)
+ {
+ \_SB.PCI0.CGPM (Local0, Arg0)
+ }
+}
+
+/*
+ * Method called from _PTS prior to system sleep state entry
+ * Enables dynamic clock gating for all 5 GPIO communities
+ */
+Method (MPTS, 1, Serialized)
+{
+ LOCL (MISCCFG_ENABLE_GPIO_PM_CONFIG)
+}
+
+/*
+ * Method called from _WAK prior to system sleep state wakeup
+ * Disables dynamic clock gating for all 5 GPIO communities
+ */
+Method (MWAK, 1, Serialized)
+{
+ LOCL (0)
+}
+
+/*
+ * S0ix Entry/Exit Notifications
+ * Called from \_SB.LPID._DSM
+ */
+Method (MS0X, 1, Serialized)
+{
+ If (Arg0 == 1) {
+ /* S0ix Entry */
+ LOCL (MISCCFG_ENABLE_GPIO_PM_CONFIG)
+ } Else {
+ /* S0ix Exit */
+ LOCL (0)
+ }
+}
diff --git a/src/mainboard/google/hatch/variants/baseboard/devicetree.cb b/src/mainboard/google/hatch/variants/baseboard/devicetree.cb
index 9a9125396c..6ff90f8d9d 100644
--- a/src/mainboard/google/hatch/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/hatch/variants/baseboard/devicetree.cb
@@ -47,6 +47,82 @@ chip soc/intel/cannonlake
# Unlock GPIO pads
register "PchUnlockGpioPads" = "1"
+ # VR Settings Configuration for 4 Domains
+ #+----------------+-------+-------+-------+-------+
+ #| Domain/Setting | SA | IA | GTUS | GTS |
+ #+----------------+-------+-------+-------+-------+
+ #| Psi1Threshold | 20A | 20A | 20A | 20A |
+ #| Psi2Threshold | 5A | 5A | 5A | 5A |
+ #| Psi3Threshold | 1A | 1A | 1A | 1A |
+ #| Psi3Enable | 1 | 1 | 1 | 1 |
+ #| Psi4Enable | 1 | 1 | 1 | 1 |
+ #| ImonSlope | 0 | 0 | 0 | 0 |
+ #| ImonOffset | 0 | 0 | 0 | 0 |
+ #| IccMax | 6A | 70A | 31A | 31A |
+ #| VrVoltageLimit | 1.52V | 1.52V | 1.52V | 1.52V |
+ #| AcLoadline | 10.3 | 1.8 | 3.1 | 3.1 |
+ #| DcLoadline | 10.3 | 1.8 | 3.1 | 3.1 |
+ #+----------------+-------+-------+-------+-------+
+ register "domain_vr_config[VR_SYSTEM_AGENT]" = "{
+ .vr_config_enable = 1,
+ .psi1threshold = VR_CFG_AMP(20),
+ .psi2threshold = VR_CFG_AMP(5),
+ .psi3threshold = VR_CFG_AMP(1),
+ .psi3enable = 1,
+ .psi4enable = 1,
+ .imon_slope = 0x0,
+ .imon_offset = 0x0,
+ .icc_max = VR_CFG_AMP(6),
+ .voltage_limit = 1520,
+ .ac_loadline = 1030,
+ .dc_loadline = 1030,
+ }"
+
+ register "domain_vr_config[VR_IA_CORE]" = "{
+ .vr_config_enable = 1,
+ .psi1threshold = VR_CFG_AMP(20),
+ .psi2threshold = VR_CFG_AMP(5),
+ .psi3threshold = VR_CFG_AMP(1),
+ .psi3enable = 1,
+ .psi4enable = 1,
+ .imon_slope = 0x0,
+ .imon_offset = 0x0,
+ .icc_max = VR_CFG_AMP(70),
+ .voltage_limit = 1520,
+ .ac_loadline = 180,
+ .dc_loadline = 180,
+ }"
+
+ register "domain_vr_config[VR_GT_UNSLICED]" = "{
+ .vr_config_enable = 1,
+ .psi1threshold = VR_CFG_AMP(20),
+ .psi2threshold = VR_CFG_AMP(5),
+ .psi3threshold = VR_CFG_AMP(1),
+ .psi3enable = 1,
+ .psi4enable = 1,
+ .imon_slope = 0x0,
+ .imon_offset = 0x0,
+ .icc_max = VR_CFG_AMP(31),
+ .voltage_limit = 1520,
+ .ac_loadline = 310,
+ .dc_loadline = 310,
+ }"
+
+ register "domain_vr_config[VR_GT_SLICED]" = "{
+ .vr_config_enable = 1,
+ .psi1threshold = VR_CFG_AMP(20),
+ .psi2threshold = VR_CFG_AMP(5),
+ .psi3threshold = VR_CFG_AMP(1),
+ .psi3enable = 1,
+ .psi4enable = 1,
+ .imon_slope = 0x0,
+ .imon_offset = 0x0,
+ .icc_max = VR_CFG_AMP(31),
+ .voltage_limit = 1520,
+ .ac_loadline = 310,
+ .dc_loadline = 310,
+ }"
+
register "PchPmSlpS3MinAssert" = "2" # 50ms
register "PchPmSlpS4MinAssert" = "1" # 1s
register "PchPmSlpSusMinAssert" = "1" # 500ms
@@ -95,12 +171,12 @@ chip soc/intel/cannonlake
register "gpio_override_pm" = "1"
# GPIO community PM configuration
- register "gpio_pm[COMM_0]" = "MISCCFG_ENABLE_GPIO_PM_CONFIG"
- register "gpio_pm[COMM_1]" = "MISCCFG_ENABLE_GPIO_PM_CONFIG"
- register "gpio_pm[COMM_2]" = "MISCCFG_ENABLE_GPIO_PM_CONFIG"
- register "gpio_pm[COMM_3]" = "MISCCFG_ENABLE_GPIO_PM_CONFIG"
- # Disable clock gating on this community so that cr50's short irq
- # pulses won't be missed.
+ # Disable dynamic clock gating; with bits 0-5 set in these registers,
+ # some short interrupt pulses were missed (esp. cr50 irq)
+ register "gpio_pm[COMM_0]" = "0"
+ register "gpio_pm[COMM_1]" = "0"
+ register "gpio_pm[COMM_2]" = "0"
+ register "gpio_pm[COMM_3]" = "0"
register "gpio_pm[COMM_4]" = "0"
device cpu_cluster 0 on
diff --git a/src/mainboard/google/hatch/variants/baseboard/gpio.c b/src/mainboard/google/hatch/variants/baseboard/gpio.c
index 9529cc750a..a466972048 100644
--- a/src/mainboard/google/hatch/variants/baseboard/gpio.c
+++ b/src/mainboard/google/hatch/variants/baseboard/gpio.c
@@ -52,21 +52,14 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_GPO(GPP_A18, 1, DEEP),
/* A19 : WWAN_RADIO_DISABLE_1V8_ODL */
PAD_CFG_GPO(GPP_A19, 1, DEEP),
- /* A20 : M2_INT_L */
- PAD_CFG_GPI_APIC(GPP_A20, NONE, PLTRST, LEVEL, NONE),
- /*
- * A21 : TRACKPAD_INT_ODL (wake)
- * TODO Combine into single gpio, when ITSS IPCx configuration
- * is fixed in FSP.
- */
- PAD_CFG_GPI_SCI(GPP_A21, NONE, DEEP, EDGE_SINGLE, INVERT),
+ /* A20 : WLAN_INT_L */
+ PAD_CFG_GPI_APIC(GPP_A20, NONE, PLTRST, LEVEL, INVERT),
+ /* A21 : TRACKPAD_INT_ODL */
+ PAD_CFG_GPI_IRQ_WAKE(GPP_A21, NONE, DEEP, LEVEL, INVERT),
/* A22 : FPMCU_PCH_BOOT0 */
PAD_CFG_GPO(GPP_A22, 0, DEEP),
- /* A23 : FPMCU_PCH_INT_ODL
- * TODO Configure it back to invert mode, when
- * ITSS IPCx configuration is fixed in FSP.
- */
- PAD_CFG_GPI_APIC(GPP_A23, NONE, PLTRST, LEVEL, NONE),
+ /* A23 : FPMCU_PCH_INT_ODL */
+ PAD_CFG_GPI_APIC(GPP_A23, NONE, PLTRST, LEVEL, INVERT),
/* B0 : CORE_VID0 */
PAD_CFG_NF(GPP_B0, NONE, DEEP, NF1),
@@ -106,8 +99,8 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_NF(GPP_B17, NONE, DEEP, NF1),
/* B18 : H1_SLAVE_SPI_MOSI_R */
PAD_CFG_NF(GPP_B18, NONE, DEEP, NF1),
- /* B19 : GPP_B19 ==> NC */
- PAD_NC(GPP_B19, NONE),
+ /* B19 : Set to NF1 to match FSP setting it to NF1, i.e., GSPI1_CS0# */
+ PAD_CFG_NF(GPP_B19, NONE, DEEP, NF1),
/* B20 : PCH_SPI_FPMCU_CLK_R */
PAD_CFG_NF(GPP_B20, NONE, DEEP, NF1),
/* B21 : PCH_SPI_FPMCU_MISO */
@@ -143,11 +136,8 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_GPO(GPP_C11, 1, DEEP),
/* C12 : GPP_C12 ==> NC */
PAD_NC(GPP_C12, NONE),
- /* C13 : EC_PCH_INT_L
- * TODO Configure it back to invert mode, when
- * ITSS IPCx configuration is fixed in FSP.
- */
- PAD_CFG_GPI_APIC(GPP_C13, NONE, PLTRST, LEVEL, NONE),
+ /* C13 : EC_PCH_INT_L */
+ PAD_CFG_GPI_APIC(GPP_C13, NONE, PLTRST, LEVEL, INVERT),
/* C14 : BT_DISABLE_L */
PAD_CFG_GPO(GPP_C14, 1, DEEP),
/* C15 : WWAN_DPR_SAR_ODL
@@ -166,12 +156,8 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_NF(GPP_C19, NONE, DEEP, NF1),
/* C20 : PCH_WP_OD */
PAD_CFG_GPI(GPP_C20, NONE, DEEP),
- /*
- * C21 : H1_PCH_INT_ODL
- * TODO Configure it back to invert mode, when
- * ITSS IPCx configuration is fixed in FSP.
- */
- PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, NONE),
+ /* C21 : H1_PCH_INT_ODL */
+ PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, INVERT),
/* C22 : EC_IN_RW_OD */
PAD_CFG_GPI(GPP_C22, NONE, DEEP),
/* C23 : WLAN_PE_RST# */
@@ -195,8 +181,8 @@ static const struct pad_config gpio_table[] = {
PAD_NC(GPP_D7, NONE),
/* D8 : WWAN_CONFIG_3 */
PAD_NC(GPP_D8, NONE),
- /* D9 : GPP_D9 ==> NC */
- PAD_NC(GPP_D9, NONE),
+ /* D9 : GPP_D9 ==> EN_PP3300_DX_TOUCHSCREEN */
+ PAD_CFG_GPO(GPP_D9, 0, DEEP),
/* D10 : GPP_D10 ==> NC */
PAD_NC(GPP_D10, NONE),
/* D11 : GPP_D11 ==> NC */
@@ -219,12 +205,8 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_NF(GPP_D19, NONE, DEEP, NF1),
/* D20 : DMIC_DATA_0_SNDW4_DATA */
PAD_CFG_NF(GPP_D20, NONE, DEEP, NF1),
- /*
- * D21 : TRACKPAD_INT_ODL
- * TODO Combine into single gpio with invert mode, when ITSS
- * IPCx configuration is fixed in FSP.
- */
- PAD_CFG_GPI_APIC(GPP_D21, NONE, PLTRST, LEVEL, NONE),
+ /* D21 : GPP_D21 ==> NC */
+ PAD_NC(GPP_D21, NONE),
/* D22 : GPP_D22 ==> NC */
PAD_NC(GPP_D22, NONE),
/* D23 : SPP_MCLK */
@@ -329,15 +311,15 @@ static const struct pad_config gpio_table[] = {
PAD_NC(GPP_F23, NONE),
/* G0 : SD_CMD */
- PAD_CFG_NF(GPP_G0, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_G0, NATIVE, DEEP, NF1),
/* G1 : SD_DATA0 */
- PAD_CFG_NF(GPP_G1, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_G1, NATIVE, DEEP, NF1),
/* G2 : SD_DATA1 */
- PAD_CFG_NF(GPP_G2, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_G2, NATIVE, DEEP, NF1),
/* G3 : SD_DATA2 */
- PAD_CFG_NF(GPP_G3, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_G3, NATIVE, DEEP, NF1),
/* G4 : SD_DATA3 */
- PAD_CFG_NF(GPP_G4, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_G4, NATIVE, DEEP, NF1),
/* G5 : SD_CD# */
PAD_CFG_NF(GPP_G5, NONE, PLTRST, NF1),
/* G6 : SD_CLK */
@@ -347,7 +329,7 @@ static const struct pad_config gpio_table[] = {
/*
* H0 : HP_INT_L
*/
- PAD_CFG_GPI_INT(GPP_H0, NONE, PLTRST, LEVEL),
+ PAD_CFG_GPI_INT(GPP_H0, NONE, PLTRST, EDGE_BOTH),
/* H1 : CNV_RF_RESET_L */
PAD_CFG_NF(GPP_H1, NONE, DEEP, NF3),
/* H2 : CNV_CLKREQ0 */
@@ -451,12 +433,8 @@ static const struct pad_config early_gpio_table[] = {
PAD_CFG_NF(GPP_B18, NONE, DEEP, NF1),
/* PCH_WP_OD */
PAD_CFG_GPI(GPP_C20, NONE, DEEP),
- /*
- * C21 : H1_PCH_INT_ODL
- * TODO Configure it back to invert mode, when
- * ITSS IPCx configuration is fixed in FSP.
- */
- PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, NONE),
+ /* C21 : H1_PCH_INT_ODL */
+ PAD_CFG_GPI_APIC(GPP_C21, NONE, PLTRST, LEVEL, INVERT),
/* C23 : WLAN_PE_RST# */
PAD_CFG_GPO(GPP_C23, 1, DEEP),
/* F2 : MEM_CH_SEL */
diff --git a/src/mainboard/google/hatch/variants/hatch/gpio.c b/src/mainboard/google/hatch/variants/hatch/gpio.c
index 7e73724387..f95e0220f1 100644
--- a/src/mainboard/google/hatch/variants/hatch/gpio.c
+++ b/src/mainboard/google/hatch/variants/hatch/gpio.c
@@ -19,11 +19,8 @@
#include
static const struct pad_config gpio_table[] = {
- /* C13 : EC_PCH_INT_L
- * TODO Configure it back to invert mode, when
- * ITSS IPCx configuration is fixed in FSP.
- */
- PAD_CFG_GPI_APIC(GPP_C13, UP_20K, PLTRST, LEVEL, NONE)};
+ /* C13 : EC_PCH_INT_L */
+ PAD_CFG_GPI_APIC(GPP_C13, UP_20K, PLTRST, LEVEL, INVERT)};
const struct pad_config *override_gpio_table(size_t *num)
{
diff --git a/src/mainboard/google/hatch/variants/hatch/overridetree.cb b/src/mainboard/google/hatch/variants/hatch/overridetree.cb
index d676843720..e40a566482 100644
--- a/src/mainboard/google/hatch/variants/hatch/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/hatch/overridetree.cb
@@ -63,7 +63,7 @@ chip soc/intel/cannonlake
chip drivers/i2c/generic
register "hid" = ""ELAN0000""
register "desc" = ""ELAN Touchpad""
- register "irq" = "ACPI_IRQ_EDGE_LOW(GPP_D21_IRQ)"
+ register "irq" = "ACPI_IRQ_WAKE_EDGE_LOW(GPP_A21_IRQ)"
register "wake" = "GPE0_DW0_21"
device i2c 15 on end
end
@@ -90,7 +90,9 @@ chip soc/intel/cannonlake
register "generic.reset_gpio" =
"ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D15)"
register "generic.reset_delay_ms" = "10"
- register "generic.reset_off_delay_ms" = "1"
+ register "generic.reset_off_delay_ms" = "3"
+ register "generic.enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D9)"
+ register "generic.enable_delay_ms" = "12"
register "generic.has_power_resource" = "1"
register "hid_desc_reg_offset" = "0x01"
device i2c 5d on end
diff --git a/src/mainboard/google/hatch/variants/hatch_whl/overridetree.cb b/src/mainboard/google/hatch/variants/hatch_whl/overridetree.cb
index 373438cf8a..03218675c0 100644
--- a/src/mainboard/google/hatch/variants/hatch_whl/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/hatch_whl/overridetree.cb
@@ -81,7 +81,9 @@ chip soc/intel/cannonlake
register "generic.reset_gpio" =
"ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D15)"
register "generic.reset_delay_ms" = "10"
- register "generic.reset_off_delay_ms" = "1"
+ register "generic.reset_off_delay_ms" = "3"
+ register "generic.enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D9)"
+ register "generic.enable_delay_ms" = "12"
register "generic.has_power_resource" = "1"
register "hid_desc_reg_offset" = "0x01"
device i2c 5d on end
diff --git a/src/mainboard/google/hatch/variants/helios/overridetree.cb b/src/mainboard/google/hatch/variants/helios/overridetree.cb
index 405f85f210..1907289621 100644
--- a/src/mainboard/google/hatch/variants/helios/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/helios/overridetree.cb
@@ -72,7 +72,7 @@ chip soc/intel/cannonlake
chip drivers/i2c/generic
register "hid" = ""ELAN0000""
register "desc" = ""ELAN Touchpad""
- register "irq" = "ACPI_IRQ_EDGE_LOW(GPP_A20_IRQ)"
+ register "irq" = "ACPI_IRQ_WAKE_EDGE_LOW(GPP_A21_IRQ)"
register "wake" = "GPE0_DW0_21"
device i2c 15 on end
end
diff --git a/src/mainboard/google/hatch/variants/kindred/gpio.c b/src/mainboard/google/hatch/variants/kindred/gpio.c
index 43948a35f8..f6aeb690c5 100644
--- a/src/mainboard/google/hatch/variants/kindred/gpio.c
+++ b/src/mainboard/google/hatch/variants/kindred/gpio.c
@@ -23,6 +23,30 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_GPI(GPP_F3, NONE, PLTRST),
/* F10 : MEM_STRAP_2 */
PAD_CFG_GPI(GPP_F10, NONE, PLTRST),
+ /* F11 : EMMC_CMD ==> EMMC_CMD */
+ PAD_CFG_NF(GPP_F11, NONE, DEEP, NF1),
+ /* F12 : EMMC_DATA0 ==> EMMC_DAT0 */
+ PAD_CFG_NF(GPP_F12, NONE, DEEP, NF1),
+ /* F13 : EMMC_DATA1 ==> EMMC_DAT1 */
+ PAD_CFG_NF(GPP_F13, NONE, DEEP, NF1),
+ /* F14 : EMMC_DATA2 ==> EMMC_DAT2 */
+ PAD_CFG_NF(GPP_F14, NONE, DEEP, NF1),
+ /* F15 : EMMC_DATA3 ==> EMMC_DAT3 */
+ PAD_CFG_NF(GPP_F15, NONE, DEEP, NF1),
+ /* F16 : EMMC_DATA4 ==> EMMC_DAT4 */
+ PAD_CFG_NF(GPP_F16, NONE, DEEP, NF1),
+ /* F17 : EMMC_DATA5 ==> EMMC_DAT5 */
+ PAD_CFG_NF(GPP_F17, NONE, DEEP, NF1),
+ /* F18 : EMMC_DATA6 ==> EMMC_DAT6 */
+ PAD_CFG_NF(GPP_F18, NONE, DEEP, NF1),
+ /* F19 : EMMC_DATA7 ==> EMMC_DAT7 */
+ PAD_CFG_NF(GPP_F19, NONE, DEEP, NF1),
+ /* F20 : EMMC_RCLK ==> EMMC_RCLK */
+ PAD_CFG_NF(GPP_F20, NONE, DEEP, NF1),
+ /* F21 : EMMC_CLK ==> EMMC_CLK */
+ PAD_CFG_NF(GPP_F21, NONE, DEEP, NF1),
+ /* F22 : EMMC_RESET# ==> EMMC_RST_L */
+ PAD_CFG_NF(GPP_F22, NONE, DEEP, NF1),
/* H19 : MEM_STRAP_0 */
PAD_CFG_GPI(GPP_H19, NONE, PLTRST),
/* H22 : MEM_STRAP_1 */
diff --git a/src/mainboard/google/hatch/variants/kindred/overridetree.cb b/src/mainboard/google/hatch/variants/kindred/overridetree.cb
index 562bb8b229..becfc49cae 100644
--- a/src/mainboard/google/hatch/variants/kindred/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/kindred/overridetree.cb
@@ -47,15 +47,28 @@ chip soc/intel/cannonlake
# GPIO for SD card detect
register "sdcard_cd_gpio" = "vSD3_CD_B"
+ # Enable eMMC HS400
+ register "ScsEmmcHs400Enabled" = "1"
+
device domain 0 on
device pci 15.0 on
chip drivers/i2c/generic
register "hid" = ""ELAN0000""
register "desc" = ""ELAN Touchpad""
- register "irq" = "ACPI_IRQ_EDGE_LOW(GPP_D21_IRQ)"
+ register "irq" = "ACPI_IRQ_WAKE_EDGE_LOW(GPP_A21_IRQ)"
register "wake" = "GPE0_DW0_21"
+ register "probed" = "1"
device i2c 15 on end
end
+ chip drivers/i2c/hid
+ register "generic.hid" = ""PNP0C50""
+ register "generic.desc" = ""Synaptics Touchpad""
+ register "generic.irq" = "ACPI_IRQ_WAKE_EDGE_LOW(GPP_A21_IRQ)"
+ register "generic.wake" = "GPE0_DW0_21"
+ register "generic.probed" = "1"
+ register "hid_desc_reg_offset" = "0x20"
+ device i2c 0x2c on end
+ end
end # I2C #0
device pci 15.1 on
chip drivers/i2c/generic
@@ -71,6 +84,17 @@ chip soc/intel/cannonlake
register "stop_off_delay_ms" = "5"
device i2c 49 on end
end
+ chip drivers/i2c/generic
+ register "hid" = ""RAYD0001""
+ register "desc" = ""Raydium Touchscreen""
+ register "irq" = "ACPI_IRQ_EDGE_LOW(GPP_D16_IRQ)"
+ register "probed" = "1"
+ register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_D15)"
+ register "reset_delay_ms" = "1"
+ register "reset_off_delay_ms" = "2"
+ register "has_power_resource" = "1"
+ device i2c 39 on end
+ end
chip drivers/i2c/hid
register "generic.hid" = ""GDIX0000""
register "generic.desc" = ""Goodix Touchscreen""
@@ -143,6 +167,7 @@ chip soc/intel/cannonlake
device i2c 1a on end
end
end #I2C #4
+ device pci 1a.0 on end # eMMC
device pci 1e.3 on
chip drivers/spi/acpi
register "name" = ""CRFP""
diff --git a/src/mainboard/google/hatch/variants/kohaku/overridetree.cb b/src/mainboard/google/hatch/variants/kohaku/overridetree.cb
index cf422ed01d..18cc1d4b36 100644
--- a/src/mainboard/google/hatch/variants/kohaku/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/kohaku/overridetree.cb
@@ -64,11 +64,9 @@ chip soc/intel/cannonlake
chip drivers/i2c/hid
register "generic.hid" = ""PNP0C50""
register "generic.desc" = ""Synaptics Touchpad""
- # TODO: enable this when b/123967687 is fixed.
- # register "generic.wake" = "GPE0_DW2_27"
- # also set next line to ACPI_IRQ_WAKE_EDGE_LOW
- register "generic.irq" = "ACPI_IRQ_EDGE_LOW(GPP_D21_IRQ)"
+ register "generic.irq" = "ACPI_IRQ_WAKE_EDGE_LOW(GPP_A21_IRQ)"
register "generic.probed" = "1"
+ register "generic.wake" = "GPE0_DW0_21"
register "hid_desc_reg_offset" = "0x20"
device i2c 0x20 on end
end
diff --git a/src/mainboard/google/jecht/Makefile.inc b/src/mainboard/google/jecht/Makefile.inc
index 116792fab7..9ea24f6aa0 100644
--- a/src/mainboard/google/jecht/Makefile.inc
+++ b/src/mainboard/google/jecht/Makefile.inc
@@ -19,7 +19,7 @@ ramstage-$(CONFIG_CHROMEOS) += chromeos.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-y += lan.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c led.c
+smm-y += smihandler.c led.c
romstage-y += variants/$(VARIANT_DIR)/pei_data.c
ramstage-y += variants/$(VARIANT_DIR)/pei_data.c
diff --git a/src/mainboard/google/kahlee/Makefile.inc b/src/mainboard/google/kahlee/Makefile.inc
index 770a999eca..0abd8840ec 100644
--- a/src/mainboard/google/kahlee/Makefile.inc
+++ b/src/mainboard/google/kahlee/Makefile.inc
@@ -29,7 +29,7 @@ ramstage-y += OemCustomize.c
verstage-y += chromeos.c
verstage-y += ec.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/baseboard
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/google/kukui/boardid.c b/src/mainboard/google/kukui/boardid.c
index 71f051f312..ad7fb364df 100644
--- a/src/mainboard/google/kukui/boardid.c
+++ b/src/mainboard/google/kukui/boardid.c
@@ -51,15 +51,15 @@ static const int lcm_voltages[ADC_LEVELS] = {
/* ID : Voltage (unit: uV) */
/* 0 : */ 0,
/* 1 : */ 283000,
- /* 2 : */ 440000,
+ /* 2 : */ 394000,
/* 3 : */ 503000,
/* 4 : */ 608000,
- /* 5 : */ 703000,
- /* 6 : */ 830000,
- /* 7 : */ 865000,
- /* 8 : */ 953000,
- /* 9 : */ 1079000,
- /* 10 : */ 1128000,
+ /* 5 : */ 712000,
+ /* 6 : */ 823000,
+ /* 7 : */ 937000,
+ /* 8 : */ 1046000,
+ /* 9 : */ 1155000,
+ /* 10 : */ 1277000,
/* 11 : */ 1434000,
};
@@ -82,15 +82,7 @@ static uint32_t get_adc_index(unsigned int channel)
for (id = 0; id < ADC_LEVELS - 1; id++)
if (value < (voltages[id] + voltages[id + 1]) / 2)
break;
-
- /* The last level is NC and may be larger than standard tolerance. */
- const int tolerance = 10000; /* 10,000 uV */
- if (id < ADC_LEVELS - 1 && ABS(value - voltages[id]) > tolerance) {
- printk(BIOS_ERR, "ADC channel %u value out of range: %d\n",
- channel, value);
- assert(0);
- }
-
+ printk(BIOS_DEBUG, "ADC[%d]: Raw value=%d ID=%d\n", channel, value, id);
return id;
}
diff --git a/src/mainboard/google/link/Makefile.inc b/src/mainboard/google/link/Makefile.inc
index 89bb365023..e6c7be181c 100644
--- a/src/mainboard/google/link/Makefile.inc
+++ b/src/mainboard/google/link/Makefile.inc
@@ -19,7 +19,7 @@ romstage-y += chromeos.c
ramstage-y += chromeos.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
-smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c
+smm-y += mainboard_smi.c
SPD_BIN = $(obj)/spd.bin
# Order of names in SPD_SOURCES is important!
diff --git a/src/mainboard/google/octopus/Makefile.inc b/src/mainboard/google/octopus/Makefile.inc
index 1a9adbcd8c..aa055246d2 100644
--- a/src/mainboard/google/octopus/Makefile.inc
+++ b/src/mainboard/google/octopus/Makefile.inc
@@ -8,7 +8,7 @@ ramstage-y += ec.c
ramstage-y += mainboard.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/baseboard
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/google/octopus/variants/baseboard/memory.c b/src/mainboard/google/octopus/variants/baseboard/memory.c
index 604295b283..233ef84b80 100644
--- a/src/mainboard/google/octopus/variants/baseboard/memory.c
+++ b/src/mainboard/google/octopus/variants/baseboard/memory.c
@@ -178,17 +178,6 @@ static const struct lpddr4_sku cbi_skus[] = {
.ch0_rank_density = LP4_8Gb_DENSITY,
.ch0_dual_rank = 1,
},
- /* Single Channel Configs 4GiB System Capacity Ch1 populated. */
- [5] = {
- .speed = LP4_SPEED_2400,
- .ch1_rank_density = LP4_16Gb_DENSITY,
- },
- /* Single Channel Configs 4GiB System Capacity Ch1 populated. */
- [6] = {
- .speed = LP4_SPEED_2400,
- .ch1_rank_density = LP4_8Gb_DENSITY,
- .ch1_dual_rank = 1,
- },
/* Dual Channel Config 6GiB System Capacity */
[7] = {
.speed = LP4_SPEED_2400,
diff --git a/src/mainboard/google/octopus/variants/bloog/Makefile.inc b/src/mainboard/google/octopus/variants/bloog/Makefile.inc
index 9fb63f5f43..ba865e9f82 100644
--- a/src/mainboard/google/octopus/variants/bloog/Makefile.inc
+++ b/src/mainboard/google/octopus/variants/bloog/Makefile.inc
@@ -1,3 +1,4 @@
bootblock-y += gpio.c
ramstage-y += gpio.c
+ramstage-y += variant.c
diff --git a/src/mainboard/google/octopus/variants/bloog/variant.c b/src/mainboard/google/octopus/variants/bloog/variant.c
new file mode 100644
index 0000000000..58b3bc4cd2
--- /dev/null
+++ b/src/mainboard/google/octopus/variants/bloog/variant.c
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google LLC
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+
+#define SKU_UNKNOWN 0xFFFFFFFF
+
+const char *get_wifi_sar_cbfs_filename(void)
+{
+ const char *filename = NULL;
+ uint32_t sku_id;
+ sku_id = get_board_sku();
+
+ if (sku_id == SKU_UNKNOWN)
+ return NULL;
+
+ if (sku_id == 49 || sku_id == 50 || sku_id == 51 || sku_id == 52)
+ filename = "wifi_sar-blooguard.hex";
+
+ return filename;
+}
diff --git a/src/mainboard/google/octopus/variants/casta/Makefile.inc b/src/mainboard/google/octopus/variants/casta/Makefile.inc
index 9fb63f5f43..ba865e9f82 100644
--- a/src/mainboard/google/octopus/variants/casta/Makefile.inc
+++ b/src/mainboard/google/octopus/variants/casta/Makefile.inc
@@ -1,3 +1,4 @@
bootblock-y += gpio.c
ramstage-y += gpio.c
+ramstage-y += variant.c
diff --git a/src/drivers/intel/fsp2_0/stage_cache.c b/src/mainboard/google/octopus/variants/casta/variant.c
similarity index 57%
rename from src/drivers/intel/fsp2_0/stage_cache.c
rename to src/mainboard/google/octopus/variants/casta/variant.c
index a9ec154d38..89b1033886 100644
--- a/src/drivers/intel/fsp2_0/stage_cache.c
+++ b/src/mainboard/google/octopus/variants/casta/variant.c
@@ -1,8 +1,7 @@
/*
* This file is part of the coreboot project.
*
- * Copyright (C) 2013 Google Inc.
- * Copyright (C) 2015 Intel Corp.
+ * Copyright 2019 Google LLC
*
* 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
@@ -14,16 +13,16 @@
* GNU General Public License for more details.
*/
-#include
-#include
-#include
-#include
+#include
+#include
-void stage_cache_external_region(void **base, size_t *size)
+const char *get_wifi_sar_cbfs_filename(void)
{
- if (smm_subregion(SMM_SUBREGION_CACHE, base, size)) {
- printk(BIOS_ERR, "ERROR: No cache SMM subregion.\n");
- *base = NULL;
- *size = 0;
- }
+ const char *filename = NULL;
+ uint32_t sku_id = get_board_sku();
+
+ if (sku_id == 2)
+ filename = "wifi_sar-bluebird.hex";
+
+ return filename;
}
diff --git a/src/mainboard/google/octopus/variants/fleex/gpio.c b/src/mainboard/google/octopus/variants/fleex/gpio.c
index 89adfb8cb6..d2d0d641dc 100644
--- a/src/mainboard/google/octopus/variants/fleex/gpio.c
+++ b/src/mainboard/google/octopus/variants/fleex/gpio.c
@@ -30,7 +30,8 @@ static const struct pad_config default_override_table[] = {
PAD_NC(GPIO_138, UP_20K),
PAD_NC(GPIO_139, UP_20K),
- PAD_NC(GPIO_140, UP_20K),
+ /* GPIO_140 -- PEN_RESET */
+ PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
PAD_NC(GPIO_143, UP_20K),
PAD_NC(GPIO_144, UP_20K),
PAD_NC(GPIO_145, UP_20K),
diff --git a/src/mainboard/google/octopus/variants/fleex/overridetree.cb b/src/mainboard/google/octopus/variants/fleex/overridetree.cb
index 19246e0a51..da4e701641 100644
--- a/src/mainboard/google/octopus/variants/fleex/overridetree.cb
+++ b/src/mainboard/google/octopus/variants/fleex/overridetree.cb
@@ -61,6 +61,9 @@ chip soc/intel/apollolake
.speed_mhz = 1,
.early_init = 1,
},
+ .i2c[0] = {
+ .speed = I2C_SPEED_FAST,
+ },
.i2c[5] = {
.speed = I2C_SPEED_FAST,
.rise_time_ns = 104,
@@ -80,7 +83,20 @@ chip soc/intel/apollolake
}"
device domain 0 on
- device pci 16.0 off end # - I2C 0
+ device pci 16.0 on
+ chip drivers/i2c/hid
+ register "generic.hid" = ""WCOM50C1""
+ register "generic.desc" = ""WCOM Digitizer""
+ register "generic.irq" = "ACPI_IRQ_LEVEL_LOW(GPIO_139_IRQ)"
+ register "generic.reset_gpio" =
+ "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_140)"
+ register "generic.reset_delay_ms" = "20"
+ register "generic.has_power_resource" = "1"
+ register "generic.probed" = "1"
+ register "hid_desc_reg_offset" = "0x1"
+ device i2c 0x9 on end
+ end
+ end # - I2C 0
device pci 16.1 off end # - I2C 1
device pci 17.1 on
chip drivers/i2c/da7219
diff --git a/src/mainboard/google/octopus/variants/garg/gpio.c b/src/mainboard/google/octopus/variants/garg/gpio.c
index a4362409b5..90601ce850 100644
--- a/src/mainboard/google/octopus/variants/garg/gpio.c
+++ b/src/mainboard/google/octopus/variants/garg/gpio.c
@@ -19,6 +19,12 @@
#include
#include
+enum {
+ SKU_1_2A2C = 1,
+ SKU_9_HDMI = 9,
+ SKU_17_LTE = 17,
+};
+
static const struct pad_config default_override_table[] = {
PAD_NC(GPIO_104, UP_20K),
@@ -29,9 +35,34 @@ static const struct pad_config default_override_table[] = {
PAD_NC(GPIO_213, DN_20K),
};
+static const struct pad_config hdmi_override_table[] = {
+ PAD_NC(GPIO_104, UP_20K),
+
+ /* HV_DDI1_DDC_SDA */
+ PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_126, NONE, DEEP, NF1, HIZCRx1,
+ DISPUPD),
+ /* HV_DDI1_DDC_SCL */
+ PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_127, NONE, DEEP, NF1, HIZCRx1,
+ DISPUPD),
+
+ /* EN_PP3300_TOUCHSCREEN */
+ PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0,
+ DISPUPD),
+
+ PAD_NC(GPIO_213, DN_20K),
+};
+
const struct pad_config *variant_override_gpio_table(size_t *num)
{
- *num = ARRAY_SIZE(default_override_table);
+ uint32_t sku_id;
+ sku_id = get_board_sku();
- return default_override_table;
+ switch (sku_id) {
+ case SKU_9_HDMI:
+ *num = ARRAY_SIZE(hdmi_override_table);
+ return hdmi_override_table;
+ default:
+ *num = ARRAY_SIZE(default_override_table);
+ return default_override_table;
+ }
}
diff --git a/src/mainboard/google/poppy/Makefile.inc b/src/mainboard/google/poppy/Makefile.inc
index 86754e62eb..030cf1da2d 100644
--- a/src/mainboard/google/poppy/Makefile.inc
+++ b/src/mainboard/google/poppy/Makefile.inc
@@ -25,7 +25,7 @@ ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
ramstage-y += mainboard.c
ramstage-y += ramstage.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
smm-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
subdirs-y += variants/baseboard
diff --git a/src/mainboard/google/poppy/variants/nami/Makefile.inc b/src/mainboard/google/poppy/variants/nami/Makefile.inc
index 0033c60ee7..7c1e4808a6 100644
--- a/src/mainboard/google/poppy/variants/nami/Makefile.inc
+++ b/src/mainboard/google/poppy/variants/nami/Makefile.inc
@@ -35,7 +35,7 @@ ramstage-y += gpio.c
ramstage-y += nhlt.c
ramstage-y += mainboard.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
# Add OEM ID table
cbfs-files-y += oem.bin
diff --git a/src/mainboard/google/poppy/variants/nautilus/Makefile.inc b/src/mainboard/google/poppy/variants/nautilus/Makefile.inc
index c71520601a..3a36b83bda 100644
--- a/src/mainboard/google/poppy/variants/nautilus/Makefile.inc
+++ b/src/mainboard/google/poppy/variants/nautilus/Makefile.inc
@@ -14,5 +14,5 @@ ramstage-y += nhlt.c
ramstage-y += mainboard.c
ramstage-y += sku.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += sku.c
+smm-y += smihandler.c
+smm-y += sku.c
diff --git a/src/mainboard/google/poppy/variants/nocturne/Makefile.inc b/src/mainboard/google/poppy/variants/nocturne/Makefile.inc
index 260d9c0bf3..371655a94e 100644
--- a/src/mainboard/google/poppy/variants/nocturne/Makefile.inc
+++ b/src/mainboard/google/poppy/variants/nocturne/Makefile.inc
@@ -22,4 +22,4 @@ ramstage-y += nhlt.c
ramstage-y += mainboard.c
ramstage-y += ec.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += ec.c
+smm-y += ec.c
diff --git a/src/mainboard/google/rambi/Makefile.inc b/src/mainboard/google/rambi/Makefile.inc
index 7c0fb35abf..0e80b64252 100644
--- a/src/mainboard/google/rambi/Makefile.inc
+++ b/src/mainboard/google/rambi/Makefile.inc
@@ -19,7 +19,7 @@ ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
ramstage-y += irqroute.c
ramstage-y += w25q64.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c
+smm-y += mainboard_smi.c
ramstage-y += variants/$(VARIANT_DIR)/gpio.c
diff --git a/src/mainboard/google/reef/Makefile.inc b/src/mainboard/google/reef/Makefile.inc
index 3701a91344..a115677773 100644
--- a/src/mainboard/google/reef/Makefile.inc
+++ b/src/mainboard/google/reef/Makefile.inc
@@ -8,7 +8,7 @@ ramstage-y += ec.c
ramstage-y += mainboard.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/baseboard
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/google/reef/variants/baseboard/memory.c b/src/mainboard/google/reef/variants/baseboard/memory.c
index f298cae95e..76731070db 100644
--- a/src/mainboard/google/reef/variants/baseboard/memory.c
+++ b/src/mainboard/google/reef/variants/baseboard/memory.c
@@ -140,8 +140,8 @@ static const struct lpddr4_sku skus[] = {
/* K4F6E3S4HM-MGCJ - both logical channels */
[7] = {
.speed = LP4_SPEED_2400,
- .ch0_rank_density = LP4_8Gb_DENSITY,
- .ch1_rank_density = LP4_8Gb_DENSITY,
+ .ch0_rank_density = LP4_16Gb_DENSITY,
+ .ch1_rank_density = LP4_16Gb_DENSITY,
.part_num = "K4F6E3S4HM-MGCJ",
},
};
diff --git a/src/mainboard/google/sarien/Makefile.inc b/src/mainboard/google/sarien/Makefile.inc
index 7c37bc9901..7e230447aa 100644
--- a/src/mainboard/google/sarien/Makefile.inc
+++ b/src/mainboard/google/sarien/Makefile.inc
@@ -20,7 +20,7 @@ ramstage-y += sku.c
romstage-y += romstage.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
bootblock-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
diff --git a/src/mainboard/google/sarien/chromeos.c b/src/mainboard/google/sarien/chromeos.c
index fafc469270..7aaf4015b5 100644
--- a/src/mainboard/google/sarien/chromeos.c
+++ b/src/mainboard/google/sarien/chromeos.c
@@ -122,6 +122,6 @@ void mainboard_prepare_cr50_reset(void)
{
#if ENV_RAMSTAGE
/* Ensure system powers up after CR50 reset */
- pmc_set_afterg3(PCH_DEV_PMC, MAINBOARD_POWER_STATE_ON);
+ pmc_set_afterg3(MAINBOARD_POWER_STATE_ON);
#endif
}
diff --git a/src/mainboard/google/sarien/variants/arcada/devicetree.cb b/src/mainboard/google/sarien/variants/arcada/devicetree.cb
index ce960a74c0..cd1925840a 100644
--- a/src/mainboard/google/sarien/variants/arcada/devicetree.cb
+++ b/src/mainboard/google/sarien/variants/arcada/devicetree.cb
@@ -175,6 +175,7 @@ chip soc/intel/cannonlake
.speed = I2C_SPEED_FAST,
.rise_time_ns = 52,
.fall_time_ns = 110,
+ .data_hold_time_ns = 330,
},
.i2c[4] = {
.early_init = 1,
diff --git a/src/mainboard/google/slippy/Makefile.inc b/src/mainboard/google/slippy/Makefile.inc
index 53e8dffd85..921f9e7585 100644
--- a/src/mainboard/google/slippy/Makefile.inc
+++ b/src/mainboard/google/slippy/Makefile.inc
@@ -18,7 +18,7 @@ ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
romstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += variants/$(VARIANT_DIR)/romstage.c
diff --git a/src/mainboard/google/stout/Makefile.inc b/src/mainboard/google/stout/Makefile.inc
index be1f0fe91f..f4f2284de4 100644
--- a/src/mainboard/google/stout/Makefile.inc
+++ b/src/mainboard/google/stout/Makefile.inc
@@ -18,8 +18,8 @@ ramstage-y += ec.c
romstage-y += chromeos.c
ramstage-y += chromeos.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += ec.c
+smm-y += mainboard_smi.c
+smm-y += ec.c
SRC_ROOT = $(src)/mainboard/google/stout
romstage-y += gpio.c
diff --git a/src/mainboard/hp/dl165_g6_fam10/romstage.c b/src/mainboard/hp/dl165_g6_fam10/romstage.c
index c02b0e624e..354bf125be 100644
--- a/src/mainboard/hp/dl165_g6_fam10/romstage.c
+++ b/src/mainboard/hp/dl165_g6_fam10/romstage.c
@@ -52,11 +52,9 @@
#define SERIAL_DEV PNP_DEV(0x2e, PILOT_SP1)
#define RTC_DEV PNP_DEV(0x4e, PC87417_RTC)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-inline void activate_spd_rom(const struct mem_controller *ctrl)
+void activate_spd_rom(const struct mem_controller *ctrl)
{
u8 val;
outb(0x3d, 0x0cd6);
@@ -84,7 +82,7 @@ static const u8 spd_addr[] = {
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc b/src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc
index 80dd0d2785..f030989b36 100644
--- a/src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc
+++ b/src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc
@@ -22,4 +22,4 @@ ramstage-y += BiosCallOuts.c
ramstage-y += OemCustomize.c
ramstage-y += ec.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c
+smm-y += mainboard_smi.c
diff --git a/src/mainboard/iei/kino-780am2-fam10/romstage.c b/src/mainboard/iei/kino-780am2-fam10/romstage.c
index 421e613072..d8afd67e94 100644
--- a/src/mainboard/iei/kino-780am2-fam10/romstage.c
+++ b/src/mainboard/iei/kino-780am2-fam10/romstage.c
@@ -45,11 +45,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, F71859_SP1)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -58,7 +55,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/intel/baskingridge/Makefile.inc b/src/mainboard/intel/baskingridge/Makefile.inc
index 06e86c1d6c..e34704d79d 100644
--- a/src/mainboard/intel/baskingridge/Makefile.inc
+++ b/src/mainboard/intel/baskingridge/Makefile.inc
@@ -17,4 +17,4 @@ romstage-y += chromeos.c
ramstage-y += chromeos.c
verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += chromeos.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c
+smm-y += mainboard_smi.c
diff --git a/src/mainboard/intel/bayleybay_fsp/Kconfig b/src/mainboard/intel/bayleybay_fsp/Kconfig
index c849438028..4a08fb1f78 100644
--- a/src/mainboard/intel/bayleybay_fsp/Kconfig
+++ b/src/mainboard/intel/bayleybay_fsp/Kconfig
@@ -23,7 +23,6 @@ config BOARD_SPECIFIC_OPTIONS
select HAVE_OPTION_TABLE
select ENABLE_BUILTIN_COM1 if FSP_PACKAGE_DEFAULT
select HAVE_FSP_BIN if FSP_PACKAGE_DEFAULT
- select TSC_MONOTONIC_TIMER
config MAINBOARD_DIR
string
diff --git a/src/mainboard/intel/camelbackmountain_fsp/Kconfig b/src/mainboard/intel/camelbackmountain_fsp/Kconfig
index 2829b8441c..696fbf440c 100644
--- a/src/mainboard/intel/camelbackmountain_fsp/Kconfig
+++ b/src/mainboard/intel/camelbackmountain_fsp/Kconfig
@@ -6,7 +6,6 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_2048
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
- select TSC_MONOTONIC_TIMER
select INTEGRATED_UART if FSP_PACKAGE_DEFAULT
select HAVE_FSP_BIN if FSP_PACKAGE_DEFAULT
select SERIRQ_CONTINUOUS_MODE
diff --git a/src/mainboard/intel/cannonlake_rvp/Makefile.inc b/src/mainboard/intel/cannonlake_rvp/Makefile.inc
index c18fd9b34d..d98477118d 100644
--- a/src/mainboard/intel/cannonlake_rvp/Makefile.inc
+++ b/src/mainboard/intel/cannonlake_rvp/Makefile.inc
@@ -27,7 +27,7 @@ romstage-y += romstage_fsp_params.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-y += mainboard.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/baseboard
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/intel/coffeelake_rvp/Kconfig b/src/mainboard/intel/coffeelake_rvp/Kconfig
index e75fe2ab6d..13e55b3f93 100644
--- a/src/mainboard/intel/coffeelake_rvp/Kconfig
+++ b/src/mainboard/intel/coffeelake_rvp/Kconfig
@@ -53,7 +53,8 @@ config CHROMEOS
config MAX_CPUS
int
- default 12 if BOARD_INTEL_COFFEELAKE_RVP11 || BOARD_INTEL_COFFEELAKE_RVP8
+ default 12 if BOARD_INTEL_COFFEELAKE_RVP11
+ default 16 if BOARD_INTEL_COFFEELAKE_RVP8
default 8
config UART_FOR_CONSOLE
diff --git a/src/mainboard/intel/dcp847ske/Makefile.inc b/src/mainboard/intel/dcp847ske/Makefile.inc
index 4d516f6204..96bac06a0a 100644
--- a/src/mainboard/intel/dcp847ske/Makefile.inc
+++ b/src/mainboard/intel/dcp847ske/Makefile.inc
@@ -1,4 +1,4 @@
romstage-y += early_southbridge.c
romstage-y += gpio.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
diff --git a/src/mainboard/intel/glkrvp/Makefile.inc b/src/mainboard/intel/glkrvp/Makefile.inc
index f2da3794d5..ea5b2c65c6 100644
--- a/src/mainboard/intel/glkrvp/Makefile.inc
+++ b/src/mainboard/intel/glkrvp/Makefile.inc
@@ -10,7 +10,7 @@ ramstage-y += ec.c
ramstage-y += mainboard.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/baseboard
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include
diff --git a/src/mainboard/intel/kblrvp/Makefile.inc b/src/mainboard/intel/kblrvp/Makefile.inc
index 6da41ae02f..ffed7a257d 100644
--- a/src/mainboard/intel/kblrvp/Makefile.inc
+++ b/src/mainboard/intel/kblrvp/Makefile.inc
@@ -33,7 +33,7 @@ ramstage-y += ramstage.c
ramstage-y += hda_verb.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
subdirs-y += variants/$(VARIANT_DIR)
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include
diff --git a/src/mainboard/intel/kunimitsu/Makefile.inc b/src/mainboard/intel/kunimitsu/Makefile.inc
index 3330a0aab8..933074b4c5 100644
--- a/src/mainboard/intel/kunimitsu/Makefile.inc
+++ b/src/mainboard/intel/kunimitsu/Makefile.inc
@@ -28,7 +28,7 @@ ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
ramstage-y += mainboard.c
ramstage-y += ramstage.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
ifeq ($(CONFIG_PLATFORM_USES_FSP2_0),y)
romstage-srcs := $(subst $(MAINBOARDDIR)/romstage.c,$(MAINBOARDDIR)/romstage_fsp20.c,$(romstage-srcs))
diff --git a/src/mainboard/intel/minnowmax/Kconfig b/src/mainboard/intel/minnowmax/Kconfig
index 59172e3190..ca24c92aa6 100644
--- a/src/mainboard/intel/minnowmax/Kconfig
+++ b/src/mainboard/intel/minnowmax/Kconfig
@@ -22,7 +22,6 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_8192
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
- select TSC_MONOTONIC_TIMER
config MAINBOARD_DIR
string
diff --git a/src/mainboard/intel/strago/Makefile.inc b/src/mainboard/intel/strago/Makefile.inc
index e6f0c9e652..3f88b3d64e 100644
--- a/src/mainboard/intel/strago/Makefile.inc
+++ b/src/mainboard/intel/strago/Makefile.inc
@@ -25,4 +25,4 @@ ramstage-y += irqroute.c
ramstage-y += ramstage.c
ramstage-y += w25q64.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
diff --git a/src/mainboard/jetway/pa78vm5/romstage.c b/src/mainboard/jetway/pa78vm5/romstage.c
index 7fcb594391..33d40b8876 100644
--- a/src/mainboard/jetway/pa78vm5/romstage.c
+++ b/src/mainboard/jetway/pa78vm5/romstage.c
@@ -50,11 +50,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, F71863FG_SP1)
#endif
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
int spd_read_byte(u32 device, u32 address)
{
@@ -63,7 +60,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0, };
u32 bsp_apicid = 0, val;
msr_t msr;
diff --git a/src/mainboard/kontron/986lcd-m/romstage.c b/src/mainboard/kontron/986lcd-m/romstage.c
index 85a82c5acb..b51e4b44d0 100644
--- a/src/mainboard/kontron/986lcd-m/romstage.c
+++ b/src/mainboard/kontron/986lcd-m/romstage.c
@@ -17,6 +17,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/mainboard/lenovo/g505s/Kconfig b/src/mainboard/lenovo/g505s/Kconfig
index 883ef27286..b80019ecf4 100644
--- a/src/mainboard/lenovo/g505s/Kconfig
+++ b/src/mainboard/lenovo/g505s/Kconfig
@@ -55,4 +55,8 @@ config VGA_BIOS_ID
string
default "1002,990b"
+config PAYLOAD_CONFIGFILE
+ string
+ default "$(top)/src/mainboard/$(MAINBOARDDIR)/config_seabios" if PAYLOAD_SEABIOS
+
endif # BOARD_LENOVO_G505S
diff --git a/src/mainboard/lenovo/g505s/Makefile.inc b/src/mainboard/lenovo/g505s/Makefile.inc
index 80dd0d2785..f030989b36 100644
--- a/src/mainboard/lenovo/g505s/Makefile.inc
+++ b/src/mainboard/lenovo/g505s/Makefile.inc
@@ -22,4 +22,4 @@ ramstage-y += BiosCallOuts.c
ramstage-y += OemCustomize.c
ramstage-y += ec.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c
+smm-y += mainboard_smi.c
diff --git a/src/mainboard/lenovo/g505s/config_seabios b/src/mainboard/lenovo/g505s/config_seabios
new file mode 100644
index 0000000000..1959fa35c2
--- /dev/null
+++ b/src/mainboard/lenovo/g505s/config_seabios
@@ -0,0 +1,7 @@
+###
+### SeaBIOS custom configuration for Lenovo G505S
+###
+# CONFIG_MEGASAS is not set
+# CONFIG_NVME is not set
+# CONFIG_TCGBIOS is not set
+#
diff --git a/src/mainboard/lenovo/l520/Makefile.inc b/src/mainboard/lenovo/l520/Makefile.inc
index 2aa7f0f6c9..2ce116f90c 100644
--- a/src/mainboard/lenovo/l520/Makefile.inc
+++ b/src/mainboard/lenovo/l520/Makefile.inc
@@ -15,6 +15,6 @@
romstage-y += romstage.c
romstage-y += gpio.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/s230u/Makefile.inc b/src/mainboard/lenovo/s230u/Makefile.inc
index dea2e4e582..88626a275a 100644
--- a/src/mainboard/lenovo/s230u/Makefile.inc
+++ b/src/mainboard/lenovo/s230u/Makefile.inc
@@ -1,6 +1,6 @@
romstage-y += gpio.c
ramstage-y += ec.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
# FIXME: SPD images for samsung_8gb and hynix_8gb are missing.
# It's possible that no mainboards with that variation were manufactured.
diff --git a/src/mainboard/lenovo/t420/Makefile.inc b/src/mainboard/lenovo/t420/Makefile.inc
index 2dab9507f1..30cf715194 100644
--- a/src/mainboard/lenovo/t420/Makefile.inc
+++ b/src/mainboard/lenovo/t420/Makefile.inc
@@ -13,7 +13,7 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += gpio.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/t420s/Makefile.inc b/src/mainboard/lenovo/t420s/Makefile.inc
index 2dab9507f1..30cf715194 100644
--- a/src/mainboard/lenovo/t420s/Makefile.inc
+++ b/src/mainboard/lenovo/t420s/Makefile.inc
@@ -13,7 +13,7 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += gpio.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/t430/Makefile.inc b/src/mainboard/lenovo/t430/Makefile.inc
index ada25f7136..558ab0a966 100644
--- a/src/mainboard/lenovo/t430/Makefile.inc
+++ b/src/mainboard/lenovo/t430/Makefile.inc
@@ -1,5 +1,5 @@
romstage-y += romstage.c
romstage-y += gpio.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/t430s/Makefile.inc b/src/mainboard/lenovo/t430s/Makefile.inc
index d70c22e6e3..4008f5ab07 100644
--- a/src/mainboard/lenovo/t430s/Makefile.inc
+++ b/src/mainboard/lenovo/t430s/Makefile.inc
@@ -13,7 +13,7 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += variants/$(VARIANT_DIR)/gpio.c
romstage-y += variants/$(VARIANT_DIR)/romstage.c
ramstage-y += variants/$(VARIANT_DIR)/hda_verb.c
diff --git a/src/mainboard/lenovo/t520/Makefile.inc b/src/mainboard/lenovo/t520/Makefile.inc
index 7187013da4..ee4669c055 100644
--- a/src/mainboard/lenovo/t520/Makefile.inc
+++ b/src/mainboard/lenovo/t520/Makefile.inc
@@ -13,7 +13,7 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += variants/$(VARIANT_DIR)/gpio.c
romstage-y += variants/$(VARIANT_DIR)/romstage.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/t530/Makefile.inc b/src/mainboard/lenovo/t530/Makefile.inc
index 7187013da4..ee4669c055 100644
--- a/src/mainboard/lenovo/t530/Makefile.inc
+++ b/src/mainboard/lenovo/t530/Makefile.inc
@@ -13,7 +13,7 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += variants/$(VARIANT_DIR)/gpio.c
romstage-y += variants/$(VARIANT_DIR)/romstage.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/t60/Makefile.inc b/src/mainboard/lenovo/t60/Makefile.inc
index 8473a13505..f646af8fd5 100644
--- a/src/mainboard/lenovo/t60/Makefile.inc
+++ b/src/mainboard/lenovo/t60/Makefile.inc
@@ -13,6 +13,6 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += dock.c
+smm-y += dock.c
romstage-y += dock.c
romstage-y += gpio.c
diff --git a/src/mainboard/lenovo/t60/mainboard.c b/src/mainboard/lenovo/t60/mainboard.c
index b78d862d41..5f599465a1 100644
--- a/src/mainboard/lenovo/t60/mainboard.c
+++ b/src/mainboard/lenovo/t60/mainboard.c
@@ -31,7 +31,7 @@
static acpi_cstate_t cst_entries[] = {
{ 1, 1, 1000, { 0x7f, 1, 2, 0, 1, 0 } },
{ 2, 1, 500, { 0x01, 8, 0, 0, DEFAULT_PMBASE + LV2, 0 } },
- { 2, 17, 250, { 0x01, 8, 0, 0, DEFAULT_PMBASE + LV3, 0 } },
+ { 3, 17, 250, { 0x01, 8, 0, 0, DEFAULT_PMBASE + LV3, 0 } },
};
int get_cst_entries(acpi_cstate_t **entries)
diff --git a/src/mainboard/lenovo/t60/romstage.c b/src/mainboard/lenovo/t60/romstage.c
index 820cd5265e..cfe2d237db 100644
--- a/src/mainboard/lenovo/t60/romstage.c
+++ b/src/mainboard/lenovo/t60/romstage.c
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/mainboard/lenovo/x1_carbon_gen1/Makefile.inc b/src/mainboard/lenovo/x1_carbon_gen1/Makefile.inc
index ee08d78642..63b41a49a2 100644
--- a/src/mainboard/lenovo/x1_carbon_gen1/Makefile.inc
+++ b/src/mainboard/lenovo/x1_carbon_gen1/Makefile.inc
@@ -15,7 +15,7 @@
subdirs-y += spd
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += gpio.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/x201/Makefile.inc b/src/mainboard/lenovo/x201/Makefile.inc
index f7ff93b626..f97235612e 100644
--- a/src/mainboard/lenovo/x201/Makefile.inc
+++ b/src/mainboard/lenovo/x201/Makefile.inc
@@ -13,8 +13,8 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += dock.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += dock.c
+smm-y += smihandler.c
romstage-y += dock.c
ramstage-y += dock.c
romstage-y += gpio.c
diff --git a/src/mainboard/lenovo/x201/mainboard.c b/src/mainboard/lenovo/x201/mainboard.c
index 70b393cc18..96033f88df 100644
--- a/src/mainboard/lenovo/x201/mainboard.c
+++ b/src/mainboard/lenovo/x201/mainboard.c
@@ -28,34 +28,6 @@
#include
#include
-static void mainboard_init(struct device *dev)
-{
- printk(BIOS_SPEW, "starting SPI configuration\n");
-
- /* Configure SPI. */
- RCBA32(0x3800) = 0x07ff0500;
- RCBA32(0x3804) = 0x3f046008;
- RCBA32(0x3808) = 0x0058efc0;
- RCBA32(0x384c) = 0x92000000;
- RCBA32(0x3850) = 0x00000a0b;
- RCBA32(0x3858) = 0x07ff0500;
- RCBA32(0x385c) = 0x04ff0003;
- RCBA32(0x3860) = 0x00020001;
- RCBA32(0x3864) = 0x00000fff;
- RCBA32(0x3874) = 0;
- RCBA32(0x3890) = 0xf8400000;
- RCBA32(0x3894) = 0x143b5006;
- RCBA32(0x3898) = 0x05200302;
- RCBA32(0x389c) = 0x0601209f;
- RCBA32(0x38b0) = 0x00000004;
- RCBA32(0x38b4) = 0x03040002;
- RCBA32(0x38c8) = 0x00002005;
- RCBA32(0x38c4) = 0x00802005;
- RCBA32(0x3804) = 0x3f04e008;
-
- printk(BIOS_SPEW, "SPI configured\n");
-}
-
static void fill_ssdt(struct device *device)
{
drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0);
@@ -65,7 +37,6 @@ static void mainboard_enable(struct device *dev)
{
u16 pmbase;
- dev->ops->init = mainboard_init;
dev->ops->acpi_fill_ssdt_generator = fill_ssdt;
pmbase = pci_read_config32(pcidev_on_root(0x1f, 0),
diff --git a/src/mainboard/lenovo/x220/Makefile.inc b/src/mainboard/lenovo/x220/Makefile.inc
index 2c52c21d33..a1cbc4cea5 100644
--- a/src/mainboard/lenovo/x220/Makefile.inc
+++ b/src/mainboard/lenovo/x220/Makefile.inc
@@ -13,7 +13,7 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += variants/$(VARIANT_DIR)/gpio.c
romstage-y += variants/$(VARIANT_DIR)/romstage.c
diff --git a/src/mainboard/lenovo/x230/Makefile.inc b/src/mainboard/lenovo/x230/Makefile.inc
index 2dab9507f1..30cf715194 100644
--- a/src/mainboard/lenovo/x230/Makefile.inc
+++ b/src/mainboard/lenovo/x230/Makefile.inc
@@ -13,7 +13,7 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
romstage-y += gpio.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/x60/Makefile.inc b/src/mainboard/lenovo/x60/Makefile.inc
index 4b17ea8e6c..a7ad539a1f 100644
--- a/src/mainboard/lenovo/x60/Makefile.inc
+++ b/src/mainboard/lenovo/x60/Makefile.inc
@@ -13,7 +13,7 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += dock.c
+smm-y += dock.c
romstage-y += dock.c
ramstage-y += dock.c
romstage-y += gpio.c
diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c
index b66ef66871..fc0c678b77 100644
--- a/src/mainboard/lenovo/x60/romstage.c
+++ b/src/mainboard/lenovo/x60/romstage.c
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/mainboard/lenovo/z61t/Makefile.inc b/src/mainboard/lenovo/z61t/Makefile.inc
index 8473a13505..f646af8fd5 100644
--- a/src/mainboard/lenovo/z61t/Makefile.inc
+++ b/src/mainboard/lenovo/z61t/Makefile.inc
@@ -13,6 +13,6 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += dock.c
+smm-y += dock.c
romstage-y += dock.c
romstage-y += gpio.c
diff --git a/src/mainboard/lenovo/z61t/romstage.c b/src/mainboard/lenovo/z61t/romstage.c
index 716be16dad..c31301e4d1 100644
--- a/src/mainboard/lenovo/z61t/romstage.c
+++ b/src/mainboard/lenovo/z61t/romstage.c
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/mainboard/msi/ms9652_fam10/romstage.c b/src/mainboard/msi/ms9652_fam10/romstage.c
index 2da427d710..2fc6fb42f0 100644
--- a/src/mainboard/msi/ms9652_fam10/romstage.c
+++ b/src/mainboard/msi/ms9652_fam10/romstage.c
@@ -44,11 +44,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, W83627EHG_SP1)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
inline int spd_read_byte(unsigned int device, unsigned int address)
{
@@ -102,7 +99,7 @@ static const u8 spd_addr[] = {
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
u32 bsp_apicid = 0, val, wants_reset;
u8 reg;
msr_t msr;
diff --git a/src/mainboard/ocp/monolake/Kconfig b/src/mainboard/ocp/monolake/Kconfig
index 037c322620..13d7876cea 100644
--- a/src/mainboard/ocp/monolake/Kconfig
+++ b/src/mainboard/ocp/monolake/Kconfig
@@ -6,7 +6,6 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_16384
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
- select TSC_MONOTONIC_TIMER
select INTEGRATED_UART if FSP_PACKAGE_DEFAULT
select HAVE_FSP_BIN if FSP_PACKAGE_DEFAULT
select SERIRQ_CONTINUOUS_MODE
diff --git a/src/mainboard/ocp/wedge100s/Kconfig b/src/mainboard/ocp/wedge100s/Kconfig
index 491829a084..ef0fe88082 100644
--- a/src/mainboard/ocp/wedge100s/Kconfig
+++ b/src/mainboard/ocp/wedge100s/Kconfig
@@ -6,7 +6,6 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_16384
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
- select TSC_MONOTONIC_TIMER
select HAVE_FSP_BIN if FSP_PACKAGE_DEFAULT
select SERIRQ_CONTINUOUS_MODE
select FSP_EHCI1_ENABLE
diff --git a/src/mainboard/opencellular/rotundu/Kconfig b/src/mainboard/opencellular/rotundu/Kconfig
index f5d9340114..fe1cbf94e6 100644
--- a/src/mainboard/opencellular/rotundu/Kconfig
+++ b/src/mainboard/opencellular/rotundu/Kconfig
@@ -22,7 +22,6 @@ config BOARD_OPENCELLULAR_BASEBOARD_ROTUNDU
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
select ENABLE_BUILTIN_COM1
- select TSC_MONOTONIC_TIMER
select ENABLE_FSP_FAST_BOOT
select HAVE_ACPI_RESUME
select USE_BLOBS
diff --git a/src/mainboard/packardbell/ms2290/Makefile.inc b/src/mainboard/packardbell/ms2290/Makefile.inc
index da1f50d115..b23d2e5560 100644
--- a/src/mainboard/packardbell/ms2290/Makefile.inc
+++ b/src/mainboard/packardbell/ms2290/Makefile.inc
@@ -13,6 +13,6 @@
## GNU General Public License for more details.
##
-smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c
+smm-y += smihandler.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/packardbell/ms2290/mainboard.c b/src/mainboard/packardbell/ms2290/mainboard.c
index 28d3bb0958..785e6e8103 100644
--- a/src/mainboard/packardbell/ms2290/mainboard.c
+++ b/src/mainboard/packardbell/ms2290/mainboard.c
@@ -35,31 +35,6 @@ static void mainboard_enable(struct device *dev)
{
u16 pmbase;
- printk(BIOS_SPEW, "starting SPI configuration\n");
-
- /* Configure SPI. */
- RCBA32(0x3800) = 0x07ff0500;
- RCBA32(0x3804) = 0x3f046008;
- RCBA32(0x3808) = 0x0058efc0;
- RCBA32(0x384c) = 0x92000000;
- RCBA32(0x3850) = 0x00000a0b;
- RCBA32(0x3858) = 0x07ff0500;
- RCBA32(0x385c) = 0x04ff0003;
- RCBA32(0x3860) = 0x00020001;
- RCBA32(0x3864) = 0x00000fff;
- RCBA32(0x3874) = 0;
- RCBA32(0x3890) = 0xf8400000;
- RCBA32(0x3894) = 0x143b5006;
- RCBA32(0x3898) = 0x05200302;
- RCBA32(0x389c) = 0x0601209f;
- RCBA32(0x38b0) = 0x00000004;
- RCBA32(0x38b4) = 0x03040002;
- RCBA32(0x38c8) = 0x00002005;
- RCBA32(0x38c4) = 0x00802005;
- RCBA32(0x3804) = 0x3f04e008;
-
- printk(BIOS_SPEW, "SPI configured\n");
-
int i;
const u8 dmp[256] = {
0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x89, 0xe4, 0x30, 0x00, 0x40, 0x14, 0x00, 0x00, 0x00, 0x11,
diff --git a/src/mainboard/pcengines/apu1/mainboard.c b/src/mainboard/pcengines/apu1/mainboard.c
index e5e30e031c..088c839239 100644
--- a/src/mainboard/pcengines/apu1/mainboard.c
+++ b/src/mainboard/pcengines/apu1/mainboard.c
@@ -206,17 +206,23 @@ static void mainboard_enable(struct device *dev)
const char *smbios_mainboard_serial_number(void)
{
static char serial[10];
- struct device *nic_dev;
+ struct device *dev;
uintptr_t bar18;
u32 mac_addr = 0;
int i;
- nic_dev = dev_find_slot(1, PCI_DEVFN(0, 0));
- if ((serial[0] != 0) || !nic_dev)
+ /* Already initialized. */
+ if (serial[0] != 0)
+ return serial;
+
+ dev = pcidev_on_root(4, 0);
+ if (dev)
+ dev = pcidev_path_behind(dev->link_list, PCI_DEVFN(0, 0));
+ if (!dev)
return serial;
/* Read in the last 3 bytes of NIC's MAC address. */
- bar18 = pci_read_config32(nic_dev, 0x18);
+ bar18 = pci_read_config32(dev, 0x18);
bar18 &= 0xFFFFFC00;
for (i = 3; i < 6; i++) {
mac_addr <<= 8;
diff --git a/src/mainboard/pcengines/apu2/mainboard.c b/src/mainboard/pcengines/apu2/mainboard.c
index 5a19d20efc..682120bc65 100644
--- a/src/mainboard/pcengines/apu2/mainboard.c
+++ b/src/mainboard/pcengines/apu2/mainboard.c
@@ -197,22 +197,15 @@ const char *smbios_mainboard_serial_number(void)
struct device *dev;
uintptr_t bar10;
u32 mac_addr = 0;
- u32 bus_no;
int i;
- /*
- * In case we have PCIe module connected to mPCIe2 slot, BDF 1:0.0 may
- * not be a NIC, because mPCIe2 slot is routed to the very first PCIe
- * bridge and the first NIC is connected to the second PCIe bridge.
- * Read secondary bus number from the PCIe bridge where the first NIC is
- * connected.
- */
- dev = pcidev_on_root(2, 2);
- if ((serial[0] != 0) || !dev)
+ /* Already initialized. */
+ if (serial[0] != 0)
return serial;
- bus_no = dev->link_list->secondary;
- dev = dev_find_slot(bus_no, PCI_DEVFN(0, 0));
+ dev = pcidev_on_root(2, 2);
+ if (dev)
+ dev = pcidev_path_behind(dev->link_list, PCI_DEVFN(0, 0));
if (!dev)
return serial;
diff --git a/src/mainboard/roda/rk886ex/romstage.c b/src/mainboard/roda/rk886ex/romstage.c
index 2bdad276c1..efd739c52e 100644
--- a/src/mainboard/roda/rk886ex/romstage.c
+++ b/src/mainboard/roda/rk886ex/romstage.c
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/src/mainboard/scaleway/tagada/Makefile.inc b/src/mainboard/scaleway/tagada/Makefile.inc
index c33e993c30..8370c8aaac 100644
--- a/src/mainboard/scaleway/tagada/Makefile.inc
+++ b/src/mainboard/scaleway/tagada/Makefile.inc
@@ -26,6 +26,6 @@ bootblock-y += bmcinfo.c
postcar-y += bmcinfo.c
romstage-y += bmcinfo.c
ramstage-y += bmcinfo.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += bmcinfo.c
+smm-y += bmcinfo.c
CPPFLAGS_common += -Isrc/mainboard/$(MAINBOARDDIR)/
diff --git a/src/mainboard/siemens/mc_apl1/variants/baseboard/gpio.c b/src/mainboard/siemens/mc_apl1/variants/baseboard/gpio.c
index 5ca91efece..91a30bfe0e 100644
--- a/src/mainboard/siemens/mc_apl1/variants/baseboard/gpio.c
+++ b/src/mainboard/siemens/mc_apl1/variants/baseboard/gpio.c
@@ -49,7 +49,7 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_GPI(GPIO_166, DN_20K, DEEP), /* SDIO_CLK */
PAD_CFG_GPI(GPIO_167, NONE, DEEP), /* SDIO_D0 */
/* Configure SDIO to enable power gating. */
- PAD_CFG_GPI(GPIO_168, NONE, DEEP), /* SDIO_D1 */
+ PAD_CFG_NF(GPIO_168, UP_20K, DEEP, NF1), /* SDIO_D1 */
PAD_CFG_GPI(GPIO_169, NONE, DEEP), /* SDIO_D2 */
PAD_CFG_GPI(GPIO_170, NONE, DEEP), /* SDIO_D3 */
PAD_CFG_GPI(GPIO_171, NONE, DEEP), /* SDIO_CMD */
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl1/devicetree.cb b/src/mainboard/siemens/mc_apl1/variants/mc_apl1/devicetree.cb
index 55e610565f..d65ac4e0a4 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl1/devicetree.cb
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl1/devicetree.cb
@@ -44,7 +44,7 @@ chip soc/intel/apollolake
register "emmc_rx_cmd_data_cntl2" = "0x10008"
# 0:HS400(Default), 1:HS200, 2:DDR50
- register "emmc_host_max_speed" = "2"
+ register "emmc_host_max_speed" = "1"
# Intel Common SoC Config
#+-------------------+---------------------------+
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl2/devicetree.cb b/src/mainboard/siemens/mc_apl1/variants/mc_apl2/devicetree.cb
index a627e3e4aa..bee531f2fa 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl2/devicetree.cb
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl2/devicetree.cb
@@ -45,7 +45,7 @@ chip soc/intel/apollolake
register "emmc_rx_cmd_data_cntl2" = "0x10008"
# 0:HS400(Default), 1:HS200, 2:DDR50
- register "emmc_host_max_speed" = "2"
+ register "emmc_host_max_speed" = "1"
# Enable Vtd feature
register "enable_vtd" = "1"
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl3/devicetree.cb b/src/mainboard/siemens/mc_apl1/variants/mc_apl3/devicetree.cb
index a03f3836ac..e1e79b44ae 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl3/devicetree.cb
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl3/devicetree.cb
@@ -44,7 +44,7 @@ chip soc/intel/apollolake
register "emmc_rx_cmd_data_cntl2" = "0x10008"
# 0:HS400(Default), 1:HS200, 2:DDR50
- register "emmc_host_max_speed" = "2"
+ register "emmc_host_max_speed" = "1"
device domain 0 on
device pci 00.0 on end # - Host Bridge
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl3/gpio.c b/src/mainboard/siemens/mc_apl1/variants/mc_apl3/gpio.c
index acf276c01c..e0fec7c786 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl3/gpio.c
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl3/gpio.c
@@ -49,7 +49,7 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_GPI(GPIO_166, DN_20K, DEEP), /* SDIO_CLK */
PAD_CFG_GPI(GPIO_167, UP_20K, DEEP), /* SDIO_D0 */
/* Configure SDIO to enable power gating. */
- PAD_CFG_GPI(GPIO_168, UP_20K, DEEP), /* SDIO_D1 */
+ PAD_CFG_NF(GPIO_168, UP_20K, DEEP, NF1), /* SDIO_D1 */
PAD_CFG_GPI(GPIO_169, UP_20K, DEEP), /* SDIO_D2 */
PAD_CFG_GPI(GPIO_170, UP_20K, DEEP), /* SDIO_D3 */
PAD_CFG_GPI(GPIO_171, UP_20K, DEEP), /* SDIO_CMD */
@@ -325,8 +325,9 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_GPI(GPIO_39, DN_20K, DEEP), /* LPSS_UART0_TXD - unused */
PAD_CFG_GPI(GPIO_40, DN_20K, DEEP), /* LPSS_UART0_RTS - unused */
PAD_CFG_GPI(GPIO_41, UP_20K, DEEP), /* LPSS_UART0_CTS - unused */
- PAD_CFG_GPI(GPIO_42, UP_20K, DEEP), /* LPSS_UART1_RXD - unused */
- PAD_CFG_GPI(GPIO_43, DN_20K, DEEP), /* LPSS_UART1_TXD - unused */
+ PAD_CFG_NF(GPIO_42, UP_20K, DEEP, NF1), /* LPSS_UART1_RXD */
+ /* LPSS_UART1_TXD */
+ PAD_CFG_NF_IOSSTATE(GPIO_43, NATIVE, DEEP, NF1, Tx1RxDCRx0),
PAD_CFG_GPI(GPIO_44, UP_20K, DEEP), /* LPSS_UART1_RTS - unused */
PAD_CFG_GPI(GPIO_45, UP_20K, DEEP), /* LPSS_UART1_CTS - unused */
PAD_CFG_NF(GPIO_46, UP_20K, DEEP, NF1), /* LPSS_UART2_RXD */
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl4/devicetree.cb b/src/mainboard/siemens/mc_apl1/variants/mc_apl4/devicetree.cb
index 50207e0e54..fc9885ce7f 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl4/devicetree.cb
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl4/devicetree.cb
@@ -45,7 +45,7 @@ chip soc/intel/apollolake
register "emmc_rx_cmd_data_cntl2" = "0x10008"
# 0:HS400(Default), 1:HS200, 2:DDR50
- register "emmc_host_max_speed" = "2"
+ register "emmc_host_max_speed" = "1"
device domain 0 on
device pci 00.0 on end # - Host Bridge
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl4/gpio.c b/src/mainboard/siemens/mc_apl1/variants/mc_apl4/gpio.c
index 2bd56b89da..c7262cad9e 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl4/gpio.c
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl4/gpio.c
@@ -47,7 +47,7 @@ static const struct pad_config gpio_table[] = {
/* SDIO - unused */
PAD_CFG_GPI(GPIO_166, DN_20K, DEEP),
PAD_CFG_GPI(GPIO_167, DN_20K, DEEP),
- PAD_CFG_GPI(GPIO_168, DN_20K, DEEP),
+ PAD_CFG_NF(GPIO_168, UP_20K, DEEP, NF1),
PAD_CFG_GPI(GPIO_169, DN_20K, DEEP),
PAD_CFG_GPI(GPIO_170, DN_20K, DEEP),
PAD_CFG_GPI(GPIO_171, DN_20K, DEEP),
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/devicetree.cb b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/devicetree.cb
index 5f1c9857d4..3b28a26396 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/devicetree.cb
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/devicetree.cb
@@ -44,7 +44,7 @@ chip soc/intel/apollolake
register "emmc_rx_cmd_data_cntl2" = "0x10008"
# 0:HS400(Default), 1:HS200, 2:DDR50
- register "emmc_host_max_speed" = "2"
+ register "emmc_host_max_speed" = "1"
# Enable Vtd feature
register "enable_vtd" = "1"
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/gpio.c b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/gpio.c
index f9b258d199..1fb0c89b78 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/gpio.c
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/gpio.c
@@ -49,7 +49,7 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_GPI(GPIO_166, DN_20K, DEEP), /* SDIO_CLK */
PAD_CFG_GPI(GPIO_167, NONE, DEEP), /* SDIO_D0 */
/* Configure SDIO to enable power gating. */
- PAD_CFG_GPI(GPIO_168, NONE, DEEP), /* SDIO_D1 */
+ PAD_CFG_NF(GPIO_168, UP_20K, DEEP, NF1), /* SDIO_D1 */
PAD_CFG_GPI(GPIO_169, NONE, DEEP), /* SDIO_D2 */
PAD_CFG_GPI(GPIO_170, NONE, DEEP), /* SDIO_D3 */
PAD_CFG_GPI(GPIO_171, NONE, DEEP), /* SDIO_CMD */
diff --git a/src/mainboard/siemens/mc_bdx1/Kconfig b/src/mainboard/siemens/mc_bdx1/Kconfig
index d99fea8a0a..6feb1cf563 100644
--- a/src/mainboard/siemens/mc_bdx1/Kconfig
+++ b/src/mainboard/siemens/mc_bdx1/Kconfig
@@ -6,7 +6,6 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_16384
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
- select TSC_MONOTONIC_TIMER
select HAVE_FSP_BIN if FSP_PACKAGE_DEFAULT
select CBFS_AUTOGEN_ATTRIBUTES
select USE_SIEMENS_HWILIB
diff --git a/src/mainboard/siemens/mc_tcu3/Kconfig b/src/mainboard/siemens/mc_tcu3/Kconfig
index db0fd247f4..508aaebefb 100644
--- a/src/mainboard/siemens/mc_tcu3/Kconfig
+++ b/src/mainboard/siemens/mc_tcu3/Kconfig
@@ -24,7 +24,6 @@ config BOARD_SPECIFIC_OPTIONS
select ENABLE_BUILTIN_COM1
select HAVE_FSP_BIN if FSP_PACKAGE_DEFAULT
select ENABLE_FSP_FAST_BOOT
- select TSC_MONOTONIC_TIMER
select DRIVER_INTEL_I210
select SOC_INTEL_FSP_BAYTRAIL_MD
select USE_BLOBS
diff --git a/src/mainboard/supermicro/h8dmr_fam10/romstage.c b/src/mainboard/supermicro/h8dmr_fam10/romstage.c
index 4d6846c2de..2750129859 100644
--- a/src/mainboard/supermicro/h8dmr_fam10/romstage.c
+++ b/src/mainboard/supermicro/h8dmr_fam10/romstage.c
@@ -47,11 +47,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
#define SUPERIO_DEV PNP_DEV(0x2e, 0)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
inline int spd_read_byte(unsigned int device, unsigned int address)
{
@@ -103,7 +100,7 @@ static const u8 spd_addr[] = {
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
u32 bsp_apicid = 0, val, wants_reset;
msr_t msr;
diff --git a/src/mainboard/supermicro/h8qme_fam10/romstage.c b/src/mainboard/supermicro/h8qme_fam10/romstage.c
index 051cd61efb..56d9f35ef2 100644
--- a/src/mainboard/supermicro/h8qme_fam10/romstage.c
+++ b/src/mainboard/supermicro/h8qme_fam10/romstage.c
@@ -50,11 +50,9 @@
#define SMBUS_SWITCH1 0x70
#define SMBUS_SWITCH2 0x72
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-inline void activate_spd_rom(const struct mem_controller *ctrl)
+void activate_spd_rom(const struct mem_controller *ctrl)
{
smbus_send_byte(SMBUS_SWITCH1, 5 & 0x0f);
smbus_send_byte(SMBUS_SWITCH2, (5 >> 4) & 0x0f);
@@ -155,7 +153,7 @@ static void write_GPIO(void)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
u32 bsp_apicid = 0, val, wants_reset;
msr_t msr;
diff --git a/src/mainboard/supermicro/h8scm_fam10/romstage.c b/src/mainboard/supermicro/h8scm_fam10/romstage.c
index f3958f8d61..302e86f4e8 100644
--- a/src/mainboard/supermicro/h8scm_fam10/romstage.c
+++ b/src/mainboard/supermicro/h8scm_fam10/romstage.c
@@ -42,13 +42,8 @@
#include "cpu/amd/quadcore/quadcore.c"
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl)
-{
-}
int spd_read_byte(u32 device, u32 address)
{
@@ -57,7 +52,7 @@ int spd_read_byte(u32 device, u32 address)
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
static const u8 spd_addr[] = {
RC00, 0x52, 0x53, 0, 0, 0x50, 0x51, 0, 0,
//RC00, DIMM2, DIMM3, 0, 0, DIMM0, DIMM1, 0, 0,
diff --git a/src/mainboard/supermicro/x10slm-f/Kconfig b/src/mainboard/supermicro/x10slm-f/Kconfig
index 430bed379a..3945c090cc 100644
--- a/src/mainboard/supermicro/x10slm-f/Kconfig
+++ b/src/mainboard/supermicro/x10slm-f/Kconfig
@@ -30,7 +30,6 @@ config BOARD_SPECIFIC_OPTIONS
select SOUTHBRIDGE_INTEL_LYNXPOINT
select SUPERIO_NUVOTON_NCT6776
select SUPERIO_NUVOTON_NCT6776_COM_A
- select TSC_MONOTONIC_TIMER
config CBFS_SIZE
hex
diff --git a/src/mainboard/tyan/s2912_fam10/romstage.c b/src/mainboard/tyan/s2912_fam10/romstage.c
index 3f504e1957..f44346bbb6 100644
--- a/src/mainboard/tyan/s2912_fam10/romstage.c
+++ b/src/mainboard/tyan/s2912_fam10/romstage.c
@@ -43,11 +43,8 @@
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
-void activate_spd_rom(const struct mem_controller *ctrl);
int spd_read_byte(unsigned int device, unsigned int address);
-extern struct sys_info sysinfo_car;
-void activate_spd_rom(const struct mem_controller *ctrl) { }
inline int spd_read_byte(unsigned int device, unsigned int address)
{
@@ -106,7 +103,7 @@ static const u8 spd_addr[] = {
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
- struct sys_info *sysinfo = &sysinfo_car;
+ struct sys_info *sysinfo = get_sysinfo();
u32 bsp_apicid = 0, val, wants_reset;
msr_t msr;
diff --git a/src/mainboard/up/squared/devicetree.cb b/src/mainboard/up/squared/devicetree.cb
index a71405f0fe..2a49db6a9e 100644
--- a/src/mainboard/up/squared/devicetree.cb
+++ b/src/mainboard/up/squared/devicetree.cb
@@ -1,5 +1,7 @@
chip soc/intel/apollolake
+ register "enable_vtd" = "1"
+
device cpu_cluster 0 on
device lapic 0 on end
end
diff --git a/src/northbridge/amd/amdfam10/amdfam10.h b/src/northbridge/amd/amdfam10/amdfam10.h
index d2a05287df..0fbcea687c 100644
--- a/src/northbridge/amd/amdfam10/amdfam10.h
+++ b/src/northbridge/amd/amdfam10/amdfam10.h
@@ -989,12 +989,6 @@ struct sys_info {
struct DCTStatStruc DCTstatA[NODE_NUMS];
} __packed;
-
-/*
-#ifdef __PRE_RAM__
-extern struct sys_info sysinfo_car;
-#endif
-*/
#ifndef __PRE_RAM__
struct device *get_node_pci(u32 nodeid, u32 fn);
#endif
diff --git a/src/northbridge/amd/amdfam10/raminit.h b/src/northbridge/amd/amdfam10/raminit.h
index 029fa0e32a..c9c57ff2c2 100644
--- a/src/northbridge/amd/amdfam10/raminit.h
+++ b/src/northbridge/amd/amdfam10/raminit.h
@@ -24,10 +24,13 @@ struct sys_info;
struct DCTStatStruc;
struct MCTStatStruc;
+void activate_spd_rom(const struct mem_controller *ctrl);
+
int mctRead_SPD(u32 smaddr, u32 reg);
void mctSMBhub_Init(u32 node);
void mctGet_DIMMAddr(struct DCTStatStruc *pDCTstat, u32 node);
void set_sysinfo_in_ram(u32 val);
+struct sys_info *get_sysinfo(void);
void raminit_amdmct(struct sys_info *sysinfo);
void amdmct_cbmem_store_info(struct sys_info *sysinfo);
void fill_mem_ctrl(u32 controllers, struct mem_controller *ctrl_a, const u8 *spd_addr);
diff --git a/src/northbridge/amd/amdfam10/raminit_amdmct.c b/src/northbridge/amd/amdfam10/raminit_amdmct.c
index 4f31a5e848..440a02635b 100644
--- a/src/northbridge/amd/amdfam10/raminit_amdmct.c
+++ b/src/northbridge/amd/amdfam10/raminit_amdmct.c
@@ -29,12 +29,20 @@
/* Global allocation of sysinfo_car */
#include
-struct sys_info sysinfo_car CAR_GLOBAL;
+static struct sys_info sysinfo_car CAR_GLOBAL;
+
+struct sys_info *get_sysinfo(void)
+{
+ return car_get_var_ptr(&sysinfo_car);
+}
struct mem_controller;
-extern void activate_spd_rom(const struct mem_controller *ctrl);
extern int spd_read_byte(unsigned int device, unsigned int address);
+void __weak activate_spd_rom(const struct mem_controller *ctrl)
+{
+}
+
void fam15h_switch_dct(uint32_t dev, uint8_t dct)
{
uint32_t dword;
diff --git a/src/northbridge/amd/amdmct/mct/mctdqs_d.c b/src/northbridge/amd/amdmct/mct/mctdqs_d.c
index 36ee3ab332..2e52a39619 100644
--- a/src/northbridge/amd/amdmct/mct/mctdqs_d.c
+++ b/src/northbridge/amd/amdmct/mct/mctdqs_d.c
@@ -278,7 +278,7 @@ static void TrainDQSRdWrPos_D(struct MCTStatStruc *pMCTstat,
u8 dqsWrDelay_end;
u32 addr;
- u32 cr4;
+ CRx_TYPE cr4;
u32 lo, hi;
print_debug_dqs("\nTrainDQSRdWrPos: Node_ID ", pDCTstat->Node_ID, 0);
diff --git a/src/northbridge/amd/amdmct/mct/mctsrc.c b/src/northbridge/amd/amdmct/mct/mctsrc.c
index 649c1c85c2..406547e0f8 100644
--- a/src/northbridge/amd/amdmct/mct/mctsrc.c
+++ b/src/northbridge/amd/amdmct/mct/mctsrc.c
@@ -129,7 +129,7 @@ static void dqsTrainRcvrEn_SW(struct MCTStatStruc *pMCTstat,
u32 index_reg;
u32 ch_start, ch_end, ch;
u32 msr;
- u32 cr4;
+ CRx_TYPE cr4;
u32 lo, hi;
u8 valid;
diff --git a/src/northbridge/amd/amdmct/mct/mcttmrl.c b/src/northbridge/amd/amdmct/mct/mcttmrl.c
index a78d42df85..6ec4d648d8 100644
--- a/src/northbridge/amd/amdmct/mct/mcttmrl.c
+++ b/src/northbridge/amd/amdmct/mct/mcttmrl.c
@@ -122,7 +122,7 @@ static void maxRdLatencyTrain_D(struct MCTStatStruc *pMCTstat,
u32 PatternBuffer[60]; // FIXME: why not 48 + 4
u32 Margin;
u32 addr;
- u32 cr4;
+ CRx_TYPE cr4;
u32 lo, hi;
u8 valid;
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c b/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c
index 34b13ea306..6b31294586 100644
--- a/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c
@@ -16,6 +16,7 @@
#include
#include
+#include
#include
#include
#include
@@ -405,7 +406,7 @@ static void TrainDQSRdWrPos_D_Fam10(struct MCTStatStruc *pMCTstat,
u32 dev;
u32 addr;
u8 valid;
- u32 cr4;
+ CRx_TYPE cr4;
u32 lo, hi;
u32 index_reg;
uint32_t TestAddr;
@@ -1617,7 +1618,7 @@ static void TrainDQSReceiverEnCyc_D_Fam15(struct MCTStatStruc *pMCTstat,
u8 _Wrap32Dis = 0, _SSE2 = 0;
u32 addr;
- u32 cr4;
+ CRx_TYPE cr4;
u32 lo, hi;
uint8_t dct;
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c b/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c
index a6faf90e0c..032152c39d 100644
--- a/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -612,7 +613,7 @@ static void dqsTrainRcvrEn_SW_Fam10(struct MCTStatStruc *pMCTstat,
u32 index_reg;
u32 ch_start, ch_end, ch;
msr_t msr;
- u32 cr4;
+ CRx_TYPE cr4;
uint32_t dword;
uint8_t dimm;
@@ -1186,7 +1187,7 @@ static void dqsTrainRcvrEn_SW_Fam15(struct MCTStatStruc *pMCTstat,
u32 index_reg;
u32 ch_start, ch_end, ch;
u32 msr;
- u32 cr4;
+ CRx_TYPE cr4;
u32 lo, hi;
uint32_t dword;
@@ -1583,7 +1584,7 @@ void dqsTrainMaxRdLatency_SW_Fam15(struct MCTStatStruc *pMCTstat,
u32 index_reg;
u32 ch_start, ch_end;
u32 msr;
- u32 cr4;
+ CRx_TYPE cr4;
u32 lo, hi;
uint32_t dword;
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mcttmrl.c b/src/northbridge/amd/amdmct/mct_ddr3/mcttmrl.c
index e7b7883f13..ec9b8e4327 100644
--- a/src/northbridge/amd/amdmct/mct_ddr3/mcttmrl.c
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mcttmrl.c
@@ -21,7 +21,7 @@
#include
#include
#include
-
+#include
#include "mct_d.h"
#include "mct_d_gcc.h"
@@ -119,7 +119,7 @@ static void maxRdLatencyTrain_D(struct MCTStatStruc *pMCTstat,
u32 PatternBuffer[60]; /* FIXME: why not 48 + 4 */
u32 Margin;
u32 addr;
- u32 cr4;
+ CRx_TYPE cr4;
u32 lo, hi;
u8 valid;
diff --git a/src/northbridge/intel/e7505/Makefile.inc b/src/northbridge/intel/e7505/Makefile.inc
index 7f7c5e40aa..4eda3d1049 100644
--- a/src/northbridge/intel/e7505/Makefile.inc
+++ b/src/northbridge/intel/e7505/Makefile.inc
@@ -4,7 +4,6 @@ ramstage-y += northbridge.c
ramstage-y += memmap.c
romstage-y += raminit.c
-romstage-y += debug.c
romstage-y += memmap.c
postcar-y += memmap.c
diff --git a/src/northbridge/intel/e7505/debug.c b/src/northbridge/intel/e7505/debug.c
deleted file mode 100644
index 357a9633b6..0000000000
--- a/src/northbridge/intel/e7505/debug.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "raminit.h"
-#include "debug.h"
-
-/*
- * generic debug code, used by mainboard specific romstage.c
- *
- */
-
-void print_debug_pci_dev(unsigned dev)
-{
- printk(BIOS_DEBUG, "PCI: %02x:%02x.%x",
- (dev >> 16) & 0xff, (dev >> 11) & 0x1f, (dev >> 8) & 7);
-}
-
-void print_pci_devices(void)
-{
- pci_devfn_t dev;
- for (dev = PCI_DEV(0, 0, 0);
- dev <= PCI_DEV(0xff, 0x1f, 0x7);
- dev += PCI_DEV(0,0,1)) {
- uint32_t id;
- id = pci_read_config32(dev, PCI_VENDOR_ID);
- if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
- (((id >> 16) & 0xffff) == 0xffff) ||
- (((id >> 16) & 0xffff) == 0x0000)) {
- continue;
- }
- print_debug_pci_dev(dev);
- printk(BIOS_DEBUG, "\n");
- }
-}
-
-void dump_pci_device(unsigned dev)
-{
- int i;
- print_debug_pci_dev(dev);
-
- for (i = 0; i < 256; i++) {
- unsigned char val;
- if ((i & 0x0f) == 0)
- printk(BIOS_DEBUG, "\n%02x:",i);
- val = pci_read_config8(dev, i);
- printk(BIOS_DEBUG, " %02x", val);
- }
- printk(BIOS_DEBUG, "\n");
-}
-
-void dump_pci_devices(void)
-{
- pci_devfn_t dev;
- for (dev = PCI_DEV(0, 0, 0);
- dev <= PCI_DEV(0xff, 0x1f, 0x7);
- dev += PCI_DEV(0,0,1)) {
- uint32_t id;
- id = pci_read_config32(dev, PCI_VENDOR_ID);
- if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
- (((id >> 16) & 0xffff) == 0xffff) ||
- (((id >> 16) & 0xffff) == 0x0000)) {
- continue;
- }
- dump_pci_device(dev);
- }
-}
-
-void dump_pci_devices_on_bus(unsigned busn)
-{
- pci_devfn_t dev;
- for (dev = PCI_DEV(busn, 0, 0);
- dev <= PCI_DEV(busn, 0x1f, 0x7);
- dev += PCI_DEV(0,0,1)) {
- uint32_t id;
- id = pci_read_config32(dev, PCI_VENDOR_ID);
- if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
- (((id >> 16) & 0xffff) == 0xffff) ||
- (((id >> 16) & 0xffff) == 0x0000)) {
- continue;
- }
- dump_pci_device(dev);
- }
-}
-
-void dump_spd_registers(const struct mem_controller *ctrl)
-{
- int i;
- printk(BIOS_DEBUG, "\n");
- for (i = 0; i < 4; i++) {
- unsigned device;
- device = ctrl->channel0[i];
- if (device) {
- int j;
- printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device);
- for (j = 0; j < 128; j++) {
- int status;
- unsigned char byte;
- if ((j & 0xf) == 0)
- printk(BIOS_DEBUG, "\n%02x: ", j);
- status = spd_read_byte(device, j);
- if (status < 0) {
- break;
- }
- byte = status & 0xff;
- printk(BIOS_DEBUG, "%02x ", byte);
- }
- printk(BIOS_DEBUG, "\n");
- }
- device = ctrl->channel1[i];
- if (device) {
- int j;
- printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device);
- for (j = 0; j < 128; j++) {
- int status;
- unsigned char byte;
- if ((j & 0xf) == 0)
- printk(BIOS_DEBUG, "\n%02x: ", j);
- status = spd_read_byte(device, j);
- if (status < 0) {
- break;
- }
- byte = status & 0xff;
- printk(BIOS_DEBUG, "%02x ", byte);
- }
- printk(BIOS_DEBUG, "\n");
- }
- }
-}
-void dump_smbus_registers(void)
-{
- unsigned device;
- printk(BIOS_DEBUG, "\n");
- for (device = 1; device < 0x80; device++) {
- int j;
- if (spd_read_byte(device, 0) < 0)
- continue;
- printk(BIOS_DEBUG, "smbus: %02x", device);
- for (j = 0; j < 256; j++) {
- int status;
- unsigned char byte;
- status = spd_read_byte(device, j);
- if (status < 0) {
- break;
- }
- if ((j & 0xf) == 0)
- printk(BIOS_DEBUG, "\n%02x: ",j);
- byte = status & 0xff;
- printk(BIOS_DEBUG, "%02x ", byte);
- }
- printk(BIOS_DEBUG, "\n");
- }
-}
-
-void dump_io_resources(unsigned port)
-{
- int i;
- printk(BIOS_DEBUG, "%04x:\n", port);
- for (i = 0; i < 256; i++) {
- uint8_t val;
- if ((i & 0x0f) == 0)
- printk(BIOS_DEBUG, "%02x:", i);
- val = inb(port);
- printk(BIOS_DEBUG, " %02x",val);
- if ((i & 0x0f) == 0x0f) {
- printk(BIOS_DEBUG, "\n");
- }
- port++;
- }
-}
diff --git a/src/northbridge/intel/e7505/e7505.h b/src/northbridge/intel/e7505/e7505.h
index b80d8a8a52..faf91440e8 100644
--- a/src/northbridge/intel/e7505/e7505.h
+++ b/src/northbridge/intel/e7505/e7505.h
@@ -42,6 +42,8 @@
#define DRC 0x7C /* DRAM Controller Mode register, 32 bit */
#define DRDCTL 0x80 /* DRAM Read Timing Control register, 16 bit? (if similar to 855PM) */
#define CKDIS 0x8C /* Clock disable register, 8 bit */
+#define SMRAMC 0x9D
+#define ESMRAMC 0x9E
#define APSIZE 0xB4
#define TOLM 0xC4 /* Top of Low Memory register, 16 bit */
#define REMAPBASE 0xC6 /* Remap Base Address register, 16 bit */
diff --git a/src/northbridge/intel/e7505/memmap.c b/src/northbridge/intel/e7505/memmap.c
index f7a08bc28d..b954c6af74 100644
--- a/src/northbridge/intel/e7505/memmap.c
+++ b/src/northbridge/intel/e7505/memmap.c
@@ -35,7 +35,13 @@ void *cbmem_top(void)
return (void *)tolm;
}
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
+void northbridge_write_smram(u8 smram);
+
+void northbridge_write_smram(u8 smram)
+{
+ pci_devfn_t mch = PCI_DEV(0, 0, 0);
+ pci_write_config8(mch, SMRAMC, smram);
+}
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
@@ -45,7 +51,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/*
diff --git a/src/northbridge/intel/e7505/raminit.c b/src/northbridge/intel/e7505/raminit.c
index 3bb1f67b59..8a336e6f0a 100644
--- a/src/northbridge/intel/e7505/raminit.c
+++ b/src/northbridge/intel/e7505/raminit.c
@@ -43,7 +43,6 @@
#include "raminit.h"
#include "e7505.h"
-#include "debug.h"
/*-----------------------------------------------------------------------------
Definitions:
@@ -58,12 +57,10 @@ Definitions:
#define RAM_DEBUG_MESSAGE(x) printk(BIOS_DEBUG, x)
#define RAM_DEBUG_HEX32(x) printk(BIOS_DEBUG, "%08x", x)
#define RAM_DEBUG_HEX8(x) printk(BIOS_DEBUG, "%02x", x)
-#define DUMPNORTH() dump_pci_device(MCHDEV)
#else
#define RAM_DEBUG_MESSAGE(x)
#define RAM_DEBUG_HEX32(x)
#define RAM_DEBUG_HEX8(x)
-#define DUMPNORTH()
#endif
#define E7501_SDRAM_MODE (SDRAM_BURST_INTERLEAVED | SDRAM_BURST_4)
@@ -1768,9 +1765,6 @@ static void sdram_set_registers(const struct mem_controller *ctrl)
*/
void e7505_mch_init(const struct mem_controller *memctrl)
{
- RAM_DEBUG_MESSAGE("Northbridge prior to SDRAM init:\n");
- DUMPNORTH();
-
timestamp_add_now(TS_BEFORE_INITRAM);
sdram_set_registers(memctrl);
@@ -1783,9 +1777,6 @@ void e7505_mch_done(const struct mem_controller *memctrl)
sdram_post_ecc(memctrl);
timestamp_add_now(TS_AFTER_INITRAM);
-
- RAM_DEBUG_MESSAGE("Northbridge following SDRAM init:\n");
- DUMPNORTH();
}
int e7505_mch_is_ready(void)
diff --git a/src/northbridge/intel/fsp_rangeley/Makefile.inc b/src/northbridge/intel/fsp_rangeley/Makefile.inc
index 410a308249..f9bf0507dc 100644
--- a/src/northbridge/intel/fsp_rangeley/Makefile.inc
+++ b/src/northbridge/intel/fsp_rangeley/Makefile.inc
@@ -27,7 +27,7 @@ romstage-y += raminit.c
romstage-y += ../../../arch/x86/walkcbfs.S
romstage-y += port_access.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += udelay.c
+smm-y += udelay.c
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)
diff --git a/src/northbridge/intel/fsp_rangeley/udelay.c b/src/northbridge/intel/fsp_rangeley/udelay.c
index 01989abb37..08301a37f6 100644
--- a/src/northbridge/intel/fsp_rangeley/udelay.c
+++ b/src/northbridge/intel/fsp_rangeley/udelay.c
@@ -18,6 +18,8 @@
#include
#include
+#define MSR_PLATFORM_INFO 0xce
+
/**
* Intel Rangeley CPUs always run the TSC at BCLK = 100MHz
*/
diff --git a/src/northbridge/intel/gm45/Kconfig b/src/northbridge/intel/gm45/Kconfig
index f1318ebc93..c3d24820a5 100644
--- a/src/northbridge/intel/gm45/Kconfig
+++ b/src/northbridge/intel/gm45/Kconfig
@@ -28,7 +28,6 @@ config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
select INTEL_GMA_SSC_ALTERNATE_REF
select POSTCAR_STAGE
select POSTCAR_CONSOLE
- select SMM_TSEG
select PARALLEL_MP
select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM
diff --git a/src/northbridge/intel/gm45/Makefile.inc b/src/northbridge/intel/gm45/Makefile.inc
index 16a9ddb648..e74f475987 100644
--- a/src/northbridge/intel/gm45/Makefile.inc
+++ b/src/northbridge/intel/gm45/Makefile.inc
@@ -35,7 +35,7 @@ ramstage-y += ram_calc.c
ramstage-y += northbridge.c
ramstage-y += gma.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += ../../../cpu/x86/lapic/apic_timer.c
+smm-y += ../../../cpu/x86/lapic/apic_timer.c
postcar-y += ram_calc.c
diff --git a/src/northbridge/intel/gm45/ram_calc.c b/src/northbridge/intel/gm45/ram_calc.c
index c1307c48f5..c6140824f0 100644
--- a/src/northbridge/intel/gm45/ram_calc.c
+++ b/src/northbridge/intel/gm45/ram_calc.c
@@ -123,8 +123,6 @@ void *cbmem_top(void)
return (void *) top_of_ram;
}
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
* and continues execution in postcar stage. */
@@ -133,7 +131,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
diff --git a/src/northbridge/intel/haswell/Makefile.inc b/src/northbridge/intel/haswell/Makefile.inc
index 7abbccacd2..ca1c04fa13 100644
--- a/src/northbridge/intel/haswell/Makefile.inc
+++ b/src/northbridge/intel/haswell/Makefile.inc
@@ -29,7 +29,7 @@ romstage-y += raminit.c
romstage-y += early_init.c
romstage-y += report_platform.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += finalize.c
+smm-y += finalize.c
# We don't ship that, but booting without it is bound to fail
cbfs-files-$(CONFIG_HAVE_MRC) += mrc.bin
diff --git a/src/northbridge/intel/i440bx/ram_calc.c b/src/northbridge/intel/i440bx/ram_calc.c
index 09a3b03272..495ca8682a 100644
--- a/src/northbridge/intel/i440bx/ram_calc.c
+++ b/src/northbridge/intel/i440bx/ram_calc.c
@@ -15,6 +15,7 @@
#define __SIMPLE_DEVICE__
+#include
#include
#include
#include
@@ -67,8 +68,6 @@ void *cbmem_top(void)
return (void *)tom;
}
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
* and continues execution in postcar stage. */
@@ -77,7 +76,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
diff --git a/src/northbridge/intel/i945/Kconfig b/src/northbridge/intel/i945/Kconfig
index 93251965c1..b151e8fb92 100644
--- a/src/northbridge/intel/i945/Kconfig
+++ b/src/northbridge/intel/i945/Kconfig
@@ -29,7 +29,6 @@ config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
select HAVE_VGA_TEXT_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT
select POSTCAR_STAGE
select POSTCAR_CONSOLE
- select SMM_TSEG
select PARALLEL_MP
select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM
diff --git a/src/northbridge/intel/i945/ram_calc.c b/src/northbridge/intel/i945/ram_calc.c
index 752c8f901c..525a5b9c0e 100644
--- a/src/northbridge/intel/i945/ram_calc.c
+++ b/src/northbridge/intel/i945/ram_calc.c
@@ -88,8 +88,6 @@ u32 decode_igd_memory_size(const u32 gms)
return ggc2uma[gms] << 10;
}
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
* and continues execution in postcar stage. */
@@ -98,7 +96,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
diff --git a/src/northbridge/intel/i945/raminit.c b/src/northbridge/intel/i945/raminit.c
index 281e7b2679..c42c34cf39 100644
--- a/src/northbridge/intel/i945/raminit.c
+++ b/src/northbridge/intel/i945/raminit.c
@@ -16,6 +16,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/northbridge/intel/i945/raminit.h b/src/northbridge/intel/i945/raminit.h
index e9e66d13e1..d417169c62 100644
--- a/src/northbridge/intel/i945/raminit.h
+++ b/src/northbridge/intel/i945/raminit.h
@@ -68,5 +68,4 @@ struct sys_info {
void receive_enable_adjust(struct sys_info *sysinfo);
void sdram_initialize(int boot_path, const u8 *sdram_addresses);
int fixup_i945_errata(void);
-void udelay(u32 us);
#endif /* RAMINIT_H */
diff --git a/src/northbridge/intel/nehalem/Kconfig b/src/northbridge/intel/nehalem/Kconfig
index 1e504593ca..02b6e80832 100644
--- a/src/northbridge/intel/nehalem/Kconfig
+++ b/src/northbridge/intel/nehalem/Kconfig
@@ -18,7 +18,6 @@ config NORTHBRIDGE_INTEL_NEHALEM
select CPU_INTEL_MODEL_2065X
select VGA
select INTEL_EDID
- select TSC_MONOTONIC_TIMER
select INTEL_GMA_ACPI
select CACHE_MRC_SETTINGS
select POSTCAR_STAGE
diff --git a/src/northbridge/intel/nehalem/Makefile.inc b/src/northbridge/intel/nehalem/Makefile.inc
index 6722621ba1..c0d46c9a0c 100644
--- a/src/northbridge/intel/nehalem/Makefile.inc
+++ b/src/northbridge/intel/nehalem/Makefile.inc
@@ -27,7 +27,7 @@ romstage-y += raminit.c
romstage-y += early_init.c
romstage-y += ../../../arch/x86/walkcbfs.S
-smm-$(CONFIG_HAVE_SMI_HANDLER) += finalize.c
+smm-y += finalize.c
postcar-y += ram_calc.c
diff --git a/src/northbridge/intel/nehalem/ram_calc.c b/src/northbridge/intel/nehalem/ram_calc.c
index e32190f519..ba3761065b 100644
--- a/src/northbridge/intel/nehalem/ram_calc.c
+++ b/src/northbridge/intel/nehalem/ram_calc.c
@@ -43,8 +43,6 @@ void *cbmem_top(void)
return (void *) smm_region_start();
}
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
* and continues execution in postcar stage. */
@@ -53,7 +51,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c
index 2b71c81825..b4ff85cdd4 100644
--- a/src/northbridge/intel/nehalem/raminit.c
+++ b/src/northbridge/intel/nehalem/raminit.c
@@ -1010,6 +1010,9 @@ static void compute_derived_timings(struct raminfo *info)
}
}
+ if (count == 0)
+ die("No memory ranks found for channel %u\n", channel);
+
info->avg4044[channel] = sum / count;
info->max4048[channel] = max_of_unk;
}
@@ -1431,14 +1434,17 @@ static void program_total_memory_map(struct raminfo *info)
memory_map[2] = TOUUD | 1;
quickpath_reserved = 0;
- {
- u32 t;
+ u32 t = pci_read_config32(PCI_DEV(QUICKPATH_BUS, 0, 1), 0x68);
- gav(t = pci_read_config32(PCI_DEV(QUICKPATH_BUS, 0, 1), 0x68));
- if (t & 0x800)
- quickpath_reserved =
- (1 << find_lowest_bit_set32(t >> 20));
+ gav(t);
+
+ if (t & 0x800) {
+ u32 shift = t >> 20;
+ if (shift == 0)
+ die("Quickpath value is 0\n");
+ quickpath_reserved = (u32)1 << find_lowest_bit_set32(shift);
}
+
if (memory_remap)
TOUUD -= quickpath_reserved;
diff --git a/src/northbridge/intel/pineview/Kconfig b/src/northbridge/intel/pineview/Kconfig
index 2b4f502c61..37959dd2e6 100644
--- a/src/northbridge/intel/pineview/Kconfig
+++ b/src/northbridge/intel/pineview/Kconfig
@@ -30,7 +30,6 @@ config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
select INTEL_GMA_ACPI
select POSTCAR_STAGE
select POSTCAR_CONSOLE
- select SMM_TSEG
select PARALLEL_MP
select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM
select C_ENVIRONMENT_BOOTBLOCK
diff --git a/src/northbridge/intel/pineview/ram_calc.c b/src/northbridge/intel/pineview/ram_calc.c
index a789956ea3..d1b43aa42d 100644
--- a/src/northbridge/intel/pineview/ram_calc.c
+++ b/src/northbridge/intel/pineview/ram_calc.c
@@ -16,6 +16,7 @@
#define __SIMPLE_DEVICE__
+#include
#include
#include
#include
@@ -137,8 +138,6 @@ void *cbmem_top(void)
}
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
* and continues execution in postcar stage. */
@@ -147,7 +146,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
diff --git a/src/northbridge/intel/sandybridge/Makefile.inc b/src/northbridge/intel/sandybridge/Makefile.inc
index c77f3bac6a..8a0b67b2c9 100644
--- a/src/northbridge/intel/sandybridge/Makefile.inc
+++ b/src/northbridge/intel/sandybridge/Makefile.inc
@@ -26,7 +26,7 @@ romstage-y += ram_calc.c
ramstage-y += common.c
romstage-y += common.c
-smm-$(CONFIG_HAVE_SMI_HANDLER) += common.c
+smm-y += common.c
ifeq ($(CONFIG_USE_NATIVE_RAMINIT),y)
romstage-y += early_dmi.c
@@ -46,7 +46,7 @@ romstage-y += romstage.c
romstage-y += early_init.c
romstage-y += ../../../arch/x86/walkcbfs.S
-smm-$(CONFIG_HAVE_SMI_HANDLER) += finalize.c
+smm-y += finalize.c
postcar-y += ram_calc.c
diff --git a/src/northbridge/intel/sandybridge/ram_calc.c b/src/northbridge/intel/sandybridge/ram_calc.c
index 5cda8a33fe..343ae62711 100644
--- a/src/northbridge/intel/sandybridge/ram_calc.c
+++ b/src/northbridge/intel/sandybridge/ram_calc.c
@@ -43,8 +43,6 @@ void *cbmem_top(void)
return (void *) smm_region_start();
}
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
* and continues execution in postcar stage. */
@@ -53,7 +51,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
diff --git a/src/northbridge/intel/x4x/Kconfig b/src/northbridge/intel/x4x/Kconfig
index 7cae91e324..ce43936c37 100644
--- a/src/northbridge/intel/x4x/Kconfig
+++ b/src/northbridge/intel/x4x/Kconfig
@@ -28,7 +28,6 @@ config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
select CACHE_MRC_SETTINGS
select POSTCAR_STAGE
select POSTCAR_CONSOLE
- select SMM_TSEG
select PARALLEL_MP
select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM
diff --git a/src/northbridge/intel/x4x/ram_calc.c b/src/northbridge/intel/x4x/ram_calc.c
index 371496985f..be9c10f001 100644
--- a/src/northbridge/intel/x4x/ram_calc.c
+++ b/src/northbridge/intel/x4x/ram_calc.c
@@ -134,8 +134,6 @@ void *cbmem_top(void)
return (void *) top_of_ram;
}
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-
/* platform_enter_postcar() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use,
* and continues execution in postcar stage. */
@@ -144,7 +142,7 @@ void platform_enter_postcar(void)
struct postcar_frame pcf;
uintptr_t top_of_ram;
- if (postcar_frame_init(&pcf, ROMSTAGE_RAM_STACK_SIZE))
+ if (postcar_frame_init(&pcf, 0))
die("Unable to initialize postcar frame.\n");
/* Cache the ROM as WP just below 4GiB. */
diff --git a/src/northbridge/via/vx900/early_host_bus_ctl.c b/src/northbridge/via/vx900/early_host_bus_ctl.c
index 92bb44dda0..1ef29449fd 100644
--- a/src/northbridge/via/vx900/early_host_bus_ctl.c
+++ b/src/northbridge/via/vx900/early_host_bus_ctl.c
@@ -14,6 +14,8 @@
* GNU General Public License for more details.
*/
+#include
+
#include "early_vx900.h"
static void vx900_cpu_bus_preram_setup(void)
diff --git a/src/northbridge/via/vx900/pci_util.c b/src/northbridge/via/vx900/pci_util.c
index 07a9a71f73..e6eb91ac95 100644
--- a/src/northbridge/via/vx900/pci_util.c
+++ b/src/northbridge/via/vx900/pci_util.c
@@ -15,6 +15,7 @@
*/
#include
+#include
#include "vx900.h"
diff --git a/src/security/memory/Kconfig b/src/security/memory/Kconfig
index 5436119ba5..d84b80d382 100644
--- a/src/security/memory/Kconfig
+++ b/src/security/memory/Kconfig
@@ -17,7 +17,9 @@ menu "Memory initialization"
config PLATFORM_HAS_DRAM_CLEAR
bool
+ default y if ARCH_X86
default n
+ depends on RELOCATABLE_RAMSTAGE
help
Selected by platforms that support clearing all DRAM
after DRAM initialization.
diff --git a/src/security/memory/Makefile.inc b/src/security/memory/Makefile.inc
index 525c4dbb4d..0882ca3660 100644
--- a/src/security/memory/Makefile.inc
+++ b/src/security/memory/Makefile.inc
@@ -1,3 +1,5 @@
romstage-$(CONFIG_PLATFORM_HAS_DRAM_CLEAR) += memory.c
postcar-$(CONFIG_PLATFORM_HAS_DRAM_CLEAR) += memory.c
ramstage-$(CONFIG_PLATFORM_HAS_DRAM_CLEAR) += memory.c
+
+ramstage-$(CONFIG_PLATFORM_HAS_DRAM_CLEAR) += memory_clear.c
diff --git a/src/security/memory/memory_clear.c b/src/security/memory/memory_clear.c
new file mode 100644
index 0000000000..638c41a929
--- /dev/null
+++ b/src/security/memory/memory_clear.c
@@ -0,0 +1,160 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 9elements Agency GmbH
+ * Copyright (C) 2019 Facebook Inc.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#if CONFIG(ARCH_X86)
+#include
+#else
+#define memset_pae(a, b, c, d, e) 0
+#define MEMSET_PAE_PGTL_ALIGN 0
+#define MEMSET_PAE_PGTL_SIZE 0
+#define MEMSET_PAE_PGTL_SIZE 0
+#define MEMSET_PAE_VMEM_ALIGN 0
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* Helper to find free space for memset_pae. */
+static uintptr_t get_free_memory_range(struct memranges *mem,
+ const resource_t align,
+ const resource_t size)
+{
+ const struct range_entry *r;
+
+ /* Find a spot for virtual memory address */
+ memranges_each_entry(r, mem) {
+ if (range_entry_tag(r) != BM_MEM_RAM)
+ continue;
+
+ if (ALIGN_UP(range_entry_base(r) + size, align) + size >
+ range_entry_end(r))
+ continue;
+
+ return ALIGN_UP(range_entry_base(r) + size, align);
+ }
+ printk(BIOS_ERR, "%s: Couldn't find free memory range\n", __func__);
+
+ return 0;
+}
+
+/*
+ * Clears all memory regions marked as BM_MEM_RAM.
+ * Uses memset_pae if the memory region can't be accessed by memset and
+ * architecture is x86.
+ *
+ * @return 0 on success, 1 on error
+ */
+static void clear_memory(void *unused)
+{
+ const struct range_entry *r;
+ struct memranges mem;
+ uintptr_t pgtbl, vmem_addr;
+
+ if (acpi_is_wakeup_s3())
+ return;
+
+ if (!security_clear_dram_request())
+ return;
+
+ /* FSP1.0 is marked as MMIO and won't appear here */
+
+ memranges_init(&mem, IORESOURCE_MEM | IORESOURCE_FIXED |
+ IORESOURCE_STORED | IORESOURCE_ASSIGNED |
+ IORESOURCE_CACHEABLE,
+ IORESOURCE_MEM | IORESOURCE_FIXED |
+ IORESOURCE_STORED | IORESOURCE_ASSIGNED |
+ IORESOURCE_CACHEABLE,
+ BM_MEM_RAM);
+
+ /* Add reserved entries */
+ void *baseptr = NULL;
+ size_t size = 0;
+
+ /* Only skip CBMEM, as RELOCATABLE_RAMSTAGE is a requirement, no need
+ * to separately protect stack or heap */
+
+ cbmem_get_region(&baseptr, &size);
+ memranges_insert(&mem, (uintptr_t)baseptr, size, BM_MEM_TABLE);
+
+ if (CONFIG(PLATFORM_USES_FSP1_0)) {
+ /* Protect CBMEM pointer */
+ memranges_insert(&mem, CBMEM_FSP_HOB_PTR, sizeof(void *),
+ BM_MEM_TABLE);
+ }
+
+ if (CONFIG(ARCH_X86)) {
+ /* Find space for PAE enabled memset */
+ pgtbl = get_free_memory_range(&mem, MEMSET_PAE_PGTL_ALIGN,
+ MEMSET_PAE_PGTL_SIZE);
+
+ /* Don't touch page tables while clearing */
+ memranges_insert(&mem, pgtbl, MEMSET_PAE_PGTL_SIZE,
+ BM_MEM_TABLE);
+
+ vmem_addr = get_free_memory_range(&mem, MEMSET_PAE_VMEM_ALIGN,
+ MEMSET_PAE_PGTL_SIZE);
+
+ printk(BIOS_SPEW, "%s: pgtbl at %p, virt memory at %p\n",
+ __func__, (void *)pgtbl, (void *)vmem_addr);
+ }
+
+ /* Now clear all useable DRAM */
+ memranges_each_entry(r, &mem) {
+ if (range_entry_tag(r) != BM_MEM_RAM)
+ continue;
+ printk(BIOS_DEBUG, "%s: Clearing DRAM %016llx-%016llx\n",
+ __func__, range_entry_base(r), range_entry_end(r));
+
+ /* Does regular memset work? */
+ if (!(range_entry_end(r) >> sizeof(void *) * 8)) {
+ /* fastpath */
+ memset((void *)(uintptr_t)range_entry_base(r), 0,
+ range_entry_size(r));
+ }
+ /* Use PAE if available */
+ else if (CONFIG(ARCH_X86)) {
+ if (memset_pae(range_entry_base(r), 0,
+ range_entry_size(r), (void *)pgtbl,
+ (void *)vmem_addr))
+ printk(BIOS_ERR, "%s: Failed to memset "
+ "memory\n", __func__);
+ } else {
+ printk(BIOS_ERR, "%s: Failed to memset memory\n",
+ __func__);
+ }
+ }
+
+ if (CONFIG(ARCH_X86)) {
+ /* Clear previously skipped memory reserved for pagetables */
+ printk(BIOS_DEBUG, "%s: Clearing DRAM %016lx-%016lx\n",
+ __func__, pgtbl, pgtbl + MEMSET_PAE_PGTL_SIZE);
+
+ memset((void *)pgtbl, 0, MEMSET_PAE_PGTL_SIZE);
+ }
+
+ memranges_teardown(&mem);
+}
+
+/* After DEV_INIT as MTRRs needs to be configured on x86 */
+BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, clear_memory, NULL);
diff --git a/src/security/vboot/Kconfig b/src/security/vboot/Kconfig
index 66bcc1ed6f..fa9893520a 100644
--- a/src/security/vboot/Kconfig
+++ b/src/security/vboot/Kconfig
@@ -107,21 +107,6 @@ config VBOOT_STARTS_IN_ROMSTAGE
memory initialization). This implies that vboot working data is
allocated in CBMEM.
-config VBOOT_MIGRATE_WORKING_DATA
- bool
- default y if CACHE_AS_RAM
- depends on !VBOOT_STARTS_IN_ROMSTAGE
- help
- In order to make vboot data structures available downstream,
- migrate verified boot working data to CBMEM after CBMEM comes
- online, when VBOOT_STARTS_IN_BOOTBLOCK is employed. This should
- always be enabled on x86 architectures to migrate data from CAR
- before losing access in ramstage, and should almost always be
- disabled in SRAM architectures, where access to SRAM is usually
- retained. Any SRAM platform where the original location of the
- VBOOT_WORKBUF region becomes inaccessible in later stages should
- manually select this option.
-
config VBOOT_MOCK_SECDATA
bool "Mock secdata for firmware verification"
default n
@@ -169,10 +154,21 @@ config VBOOT_SAVE_RECOVERY_REASON_ON_REBOOT
reboots caused after vboot verification is run. e.g. reboots caused by
FSP components on Intel platforms.
+config VBOOT_MAY_SKIP_DISPLAY_INIT
+ bool "Skip display initialization in normal mode"
+ default y if CHROMEOS
+ default n
+ help
+ Set this option to indicate that coreboot should skip display
+ initialization on a normal (non-recovery, non-developer) boot.
+ This is useful for platforms that do not support firmware
+ user-interface in normal mode.
+
config VBOOT_MUST_REQUEST_DISPLAY
bool
default y if VGA_ROM_RUN
default n
+ depends on VBOOT_MAY_SKIP_DISPLAY_INIT
help
Set this option to indicate to vboot that this platform will skip its
display initialization on a normal (non-recovery, non-developer) boot.
diff --git a/src/security/vboot/common.c b/src/security/vboot/common.c
index bd72683e00..626fbc52a4 100644
--- a/src/security/vboot/common.c
+++ b/src/security/vboot/common.c
@@ -117,13 +117,12 @@ int vboot_is_slot_selected(void)
return reg->size > 0;
}
-#if CONFIG(VBOOT_MIGRATE_WORKING_DATA)
+#if CONFIG(VBOOT_STARTS_IN_BOOTBLOCK)
/*
* For platforms that do not employ VBOOT_STARTS_IN_ROMSTAGE, vboot
* verification occurs before CBMEM is brought online, using pre-RAM.
* In order to make vboot data structures available downstream, copy
- * vboot_working_data from SRAM/CAR into CBMEM on platforms where this
- * memory later becomes unavailable.
+ * vboot_working_data from SRAM/CAR into CBMEM.
*/
static void vboot_migrate_cbmem(int unused)
{
@@ -140,7 +139,7 @@ static void vboot_migrate_cbmem(int unused)
memcpy(wd_cbmem, wd_preram, cbmem_size);
}
ROMSTAGE_CBMEM_INIT_HOOK(vboot_migrate_cbmem)
-#elif CONFIG(VBOOT_STARTS_IN_ROMSTAGE)
+#else
static void vboot_setup_cbmem(int unused)
{
struct vboot_working_data *wd_cbmem =
diff --git a/src/security/vboot/vboot_loader.c b/src/security/vboot/vboot_loader.c
index 9e2cd00404..af4a3fd880 100644
--- a/src/security/vboot/vboot_loader.c
+++ b/src/security/vboot/vboot_loader.c
@@ -26,9 +26,6 @@
_Static_assert(CONFIG(VBOOT_STARTS_IN_BOOTBLOCK) +
CONFIG(VBOOT_STARTS_IN_ROMSTAGE) == 1,
"vboot must either start in bootblock or romstage (not both!)");
-_Static_assert(CONFIG(VBOOT_STARTS_IN_BOOTBLOCK) ||
- !CONFIG(VBOOT_MIGRATE_WORKING_DATA),
- "no need to migrate working data after CBMEM is already up!");
_Static_assert(!CONFIG(VBOOT_SEPARATE_VERSTAGE) ||
CONFIG(VBOOT_STARTS_IN_BOOTBLOCK),
"stand-alone verstage must start in (i.e. after) bootblock");
diff --git a/src/soc/amd/Kconfig b/src/soc/amd/Kconfig
index 0c33b54cb2..7c08f031b0 100644
--- a/src/soc/amd/Kconfig
+++ b/src/soc/amd/Kconfig
@@ -1,4 +1,5 @@
# Load all chipsets before common
+source "src/soc/amd/picasso/Kconfig"
source "src/soc/amd/stoneyridge/Kconfig"
# Load common defaults last
diff --git a/src/soc/amd/common/block/hda/hda.c b/src/soc/amd/common/block/hda/hda.c
index f4ea732fba..49fc1a6648 100644
--- a/src/soc/amd/common/block/hda/hda.c
+++ b/src/soc/amd/common/block/hda/hda.c
@@ -21,6 +21,8 @@
static const unsigned short pci_device_ids[] = {
PCI_DEVICE_ID_AMD_SB900_HDA,
PCI_DEVICE_ID_AMD_CZ_HDA,
+ PCI_DEVICE_ID_AMD_PCO_HDA0,
+ PCI_DEVICE_ID_AMD_PCO_HDA1,
0
};
diff --git a/src/soc/amd/common/block/iommu/iommu.c b/src/soc/amd/common/block/iommu/iommu.c
index 1c982ca00d..c068501d49 100644
--- a/src/soc/amd/common/block/iommu/iommu.c
+++ b/src/soc/amd/common/block/iommu/iommu.c
@@ -49,6 +49,7 @@ static struct device_operations iommu_ops = {
static const unsigned short pci_device_ids[] = {
PCI_DEVICE_ID_AMD_15H_MODEL_303F_NB_IOMMU,
PCI_DEVICE_ID_AMD_15H_MODEL_707F_NB_IOMMU,
+ PCI_DEVICE_ID_AMD_17H_MODEL_101F_NB_IOMMU,
0
};
diff --git a/src/soc/amd/common/block/lpc/lpc.c b/src/soc/amd/common/block/lpc/lpc.c
index b896517214..c7946015cb 100644
--- a/src/soc/amd/common/block/lpc/lpc.c
+++ b/src/soc/amd/common/block/lpc/lpc.c
@@ -337,6 +337,7 @@ static struct device_operations lpc_ops = {
static const unsigned short pci_device_ids[] = {
PCI_DEVICE_ID_AMD_SB900_LPC,
PCI_DEVICE_ID_AMD_CZ_LPC,
+ PCI_DEVICE_ID_AMD_PCO_LPC,
0
};
static const struct pci_driver lpc_driver __pci_driver = {
diff --git a/src/soc/amd/picasso/Kconfig b/src/soc/amd/picasso/Kconfig
new file mode 100644
index 0000000000..d654e9494e
--- /dev/null
+++ b/src/soc/amd/picasso/Kconfig
@@ -0,0 +1,317 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2017 Advanced Micro Devices, Inc.
+##
+## 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; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+
+config SOC_AMD_PICASSO
+ bool
+ help
+ AMD Picasso support
+
+if SOC_AMD_PICASSO
+
+config CPU_SPECIFIC_OPTIONS
+ def_bool y
+ select ARCH_BOOTBLOCK_X86_32
+ select ARCH_VERSTAGE_X86_32
+ select ARCH_ROMSTAGE_X86_32
+ select ARCH_RAMSTAGE_X86_32
+ select X86_AMD_FIXED_MTRRS
+ select ACPI_AMD_HARDWARE_SLEEP_VALUES
+ select COLLECT_TIMESTAMPS_NO_TSC
+ select DRIVERS_I2C_DESIGNWARE
+ select GENERIC_GPIO_LIB
+ select GENERIC_UDELAY
+ select IOAPIC
+ select HAVE_USBDEBUG_OPTIONS
+ select SPI_FLASH if HAVE_ACPI_RESUME
+ select TSC_SYNC_LFENCE
+ select COLLECT_TIMESTAMPS
+ select SOC_AMD_PI
+ select SOC_AMD_COMMON
+ select SOC_AMD_COMMON_BLOCK
+ select SOC_AMD_COMMON_BLOCK_IOMMU
+ select SOC_AMD_COMMON_BLOCK_ACPIMMIO
+ select SOC_AMD_COMMON_BLOCK_BANKED_GPIOS
+ select SOC_AMD_COMMON_BLOCK_ACPI
+ select SOC_AMD_COMMON_BLOCK_LPC
+ select SOC_AMD_COMMON_BLOCK_PCI
+ select SOC_AMD_COMMON_BLOCK_HDA
+ select SOC_AMD_COMMON_BLOCK_SATA
+ select SOC_AMD_COMMON_BLOCK_S3
+ select C_ENVIRONMENT_BOOTBLOCK
+ select BOOT_DEVICE_SUPPORTS_WRITES if BOOT_DEVICE_SPI_FLASH
+ select BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY if BOOT_DEVICE_SPI_FLASH
+ select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM
+ select PARALLEL_MP
+ select PARALLEL_MP_AP_WORK
+ select HAVE_SMI_HANDLER
+ select POSTCAR_STAGE
+ select POSTCAR_CONSOLE
+ select SSE2
+ select RTC
+
+config VBOOT
+ select VBOOT_SEPARATE_VERSTAGE
+ select VBOOT_STARTS_IN_BOOTBLOCK
+ select VBOOT_SAVE_RECOVERY_REASON_ON_REBOOT
+ select VBOOT_VBNV_CMOS
+ select VBOOT_VBNV_CMOS_BACKUP_TO_FLASH
+
+config UDELAY_LAPIC_FIXED_FSB
+ int
+ default 200
+
+# TODO: Sync these with definitions in PI vendorcode.
+# DCACHE_RAM_BASE must equal BSP_STACK_BASE_ADDR.
+# DCACHE_RAM_SIZE must equal BSP_STACK_SIZE.
+
+config DCACHE_RAM_BASE
+ hex
+ default 0x30000
+
+config DCACHE_RAM_SIZE
+ hex
+ default 0x10000
+
+config DCACHE_BSP_STACK_SIZE
+ depends on C_ENVIRONMENT_BOOTBLOCK
+ hex
+ default 0x4000
+ help
+ The amount of anticipated stack usage in CAR by bootblock and
+ other stages.
+
+config PRERAM_CBMEM_CONSOLE_SIZE
+ hex
+ default 0x1600
+ help
+ Increase this value if preram cbmem console is getting truncated
+
+config CPU_ADDR_BITS
+ int
+ default 48
+
+config MMCONF_BASE_ADDRESS
+ hex
+ default 0xF8000000
+
+config MMCONF_BUS_NUMBER
+ int
+ default 64
+
+config VGA_BIOS_ID
+ string
+ default "1002,98e4"
+ help
+ The default VGA BIOS PCI vendor/device ID should be set to the
+ result of the map_oprom_vendev() function in northbridge.c.
+
+config VGA_BIOS_FILE
+ string
+ default "3rdparty/blobs/soc/amd/picasso/VBIOS.bin"
+
+config S3_VGA_ROM_RUN
+ bool
+ default n
+
+config HEAP_SIZE
+ hex
+ default 0xc0000
+
+config EHCI_BAR
+ hex
+ default 0xfef00000
+
+config AMD_PUBKEY_FILE
+ string "AMD public Key"
+ default "3rdparty/blobs/soc/amd/picasso/PSP/AmdPubKeyST.bin"
+
+config PICASSO_SATA_MODE
+ int "SATA Mode"
+ default 0
+ range 0 6
+ help
+ Select the mode in which SATA should be driven.
+ The default is NATIVE.
+ 0: NATIVE mode does not require a ROM.
+ 2: AHCI may work with or without AHCI ROM. It depends on the payload support.
+ For example, seabios does not require the AHCI ROM.
+ 3: LEGACY IDE
+ 4: IDE to AHCI
+ 5: AHCI7804: ROM Required, and AMD driver required in the OS.
+ 6: IDE to AHCI7804: ROM Required, and AMD driver required in the OS.
+
+comment "NATIVE"
+ depends on PICASSO_SATA_MODE = 0
+
+comment "AHCI"
+ depends on PICASSO_SATA_MODE = 2
+
+comment "LEGACY IDE"
+ depends on PICASSO_SATA_MODE = 3
+
+comment "IDE to AHCI"
+ depends on PICASSO_SATA_MODE = 4
+
+comment "AHCI7804"
+ depends on PICASSO_SATA_MODE = 5
+
+comment "IDE to AHCI7804"
+ depends on PICASSO_SATA_MODE = 6
+
+if PICASSO_SATA_MODE = 2 || PICASSO_SATA_MODE = 5
+
+config AHCI_ROM_ID
+ string "AHCI device PCI IDs"
+ default "1022,7801" if PICASSO_SATA_MODE = 2
+ default "1022,7804" if PICASSO_SATA_MODE = 5
+
+endif # PICASSO_SATA_MODE = 2 || PICASSO_SATA_MODE = 5
+
+config PICASSO_LEGACY_FREE
+ bool "System is legacy free"
+ help
+ Select y if there is no keyboard controller in the system.
+ This sets a variable in ACPI.
+
+config SERIRQ_CONTINUOUS_MODE
+ bool
+ default n
+ help
+ Set this option to y for serial IRQ in continuous mode.
+ Otherwise it is in quiet mode.
+
+config PICASSO_ACPI_IO_BASE
+ hex
+ default 0x400
+ help
+ Base address for the ACPI registers.
+
+config PICASSO_UART
+ bool "UART controller on Picasso"
+ default n
+ select DRIVERS_UART_8250MEM
+ select DRIVERS_UART_8250MEM_32
+ select NO_UART_ON_SUPERIO
+ select UART_OVERRIDE_REFCLK
+ help
+ There are two UART controllers in Picasso.
+ The UART registers are memory-mapped. UART
+ controller 0 registers range from FEDC_6000h
+ to FEDC_6FFFh. UART controller 1 registers
+ range from FEDC_8000h to FEDC_8FFFh.
+
+config CONSOLE_UART_BASE_ADDRESS
+ depends on CONSOLE_SERIAL
+ hex
+ default 0xfedc6000
+
+config SMM_TSEG_SIZE
+ hex
+ default 0x800000 if SMM_TSEG && HAVE_SMI_HANDLER
+ default 0x0
+
+config SMM_RESERVED_SIZE
+ hex
+ default 0x150000
+
+config SMM_MODULE_STACK_SIZE
+ hex
+ default 0x800
+
+config ACPI_CPU_STRING
+ string
+ default "\\_PR.P%03d"
+
+config ACPI_BERT
+ bool "Build ACPI BERT Table"
+ default y
+ depends on HAVE_ACPI_TABLES
+ help
+ Report Machine Check errors identified in POST to the OS in an
+ ACPI Boot Error Record Table. This option reserves an 8MB region
+ for building the error structures.
+
+config USE_PSPSECUREOS
+ bool "Include PSP SecureOS blobs in AMD firmware"
+ default y
+ help
+ Include the PspSecureOs, PspTrustlet and TrustletKey binaries
+ in the amdfw section.
+
+ If unsure, answer 'y'
+
+config AMDFW_OUTSIDE_CBFS
+ bool "The AMD firmware is outside CBFS"
+ default n
+ help
+ The AMDFW (PSP) is typically locatable in cbfs. Select this
+ option to manually attach the generated amdfw.rom outside of
+ cbfs. The location is selected by the FWM position.
+
+config AMD_FWM_POSITION_INDEX
+ int "Firmware Directory Table location (0 to 5)"
+ range 0 5
+ default 0 if BOARD_ROMSIZE_KB_512
+ default 1 if BOARD_ROMSIZE_KB_1024
+ default 2 if BOARD_ROMSIZE_KB_2048
+ default 3 if BOARD_ROMSIZE_KB_4096
+ default 4 if BOARD_ROMSIZE_KB_8192
+ default 5 if BOARD_ROMSIZE_KB_16384
+ help
+ Typically this is calculated by the ROM size, but there may
+ be situations where you want to put the firmware directory
+ table in a different location.
+ 0: 512 KB - 0xFFFA0000
+ 1: 1 MB - 0xFFF20000
+ 2: 2 MB - 0xFFE20000
+ 3: 4 MB - 0xFFC20000
+ 4: 8 MB - 0xFF820000
+ 5: 16 MB - 0xFF020000
+
+comment "AMD Firmware Directory Table set to location for 512KB ROM"
+ depends on AMD_FWM_POSITION_INDEX = 0
+comment "AMD Firmware Directory Table set to location for 1MB ROM"
+ depends on AMD_FWM_POSITION_INDEX = 1
+comment "AMD Firmware Directory Table set to location for 2MB ROM"
+ depends on AMD_FWM_POSITION_INDEX = 2
+comment "AMD Firmware Directory Table set to location for 4MB ROM"
+ depends on AMD_FWM_POSITION_INDEX = 3
+comment "AMD Firmware Directory Table set to location for 8MB ROM"
+ depends on AMD_FWM_POSITION_INDEX = 4
+comment "AMD Firmware Directory Table set to location for 16MB ROM"
+ depends on AMD_FWM_POSITION_INDEX = 5
+
+config DIMM_SPD_SIZE
+ int
+ default 512 # DDR4
+
+config RO_REGION_ONLY
+ string
+ depends on CHROMEOS
+ default "apu/amdfw"
+
+config DRIVERS_I2C_DESIGNWARE_CLOCK_MHZ
+ int
+ default 133
+
+config MAINBOARD_POWER_RESTORE
+ def_bool n
+ help
+ This option determines what state to go to once power is restored
+ after having been lost in S0. Select this option to automatically
+ return to S0. Otherwise the system will remain in S5 once power
+ is restored.
+
+endif # SOC_AMD_PICASSO
diff --git a/src/soc/amd/picasso/Makefile.inc b/src/soc/amd/picasso/Makefile.inc
new file mode 100644
index 0000000000..93a8bbbbf2
--- /dev/null
+++ b/src/soc/amd/picasso/Makefile.inc
@@ -0,0 +1,267 @@
+#*****************************************************************************
+#
+# Copyright (c) 2012, 2016-2017 Advanced Micro Devices, Inc.
+# 2013 - 2014 Sage Electronic Engineering, LLC
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Advanced Micro Devices, Inc. nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#*****************************************************************************
+ifeq ($(CONFIG_SOC_AMD_PICASSO),y)
+
+subdirs-y += ../../../cpu/amd/mtrr/
+subdirs-y += ../../../cpu/x86/tsc
+subdirs-y += ../../../cpu/x86/lapic
+subdirs-y += ../../../cpu/x86/cache
+subdirs-y += ../../../cpu/x86/mtrr
+subdirs-y += ../../../cpu/x86/pae
+subdirs-y += ../../../cpu/x86/smm
+
+# TODO: Make coreboot modifications so bootblock can be removed. This soc
+# also selects C_ENVIRONMENT_BOOTBLOCK to enforce certain codepaths
+# in romstage. As a result, the bootblock build also needs a
+# dummy cache_as_ram.S
+bootblock-y += cache_as_ram.S
+bootblock-y += bootblock/bootblock.c
+
+romstage-y += i2c.c
+romstage-y += romstage.c
+romstage-y += gpio.c
+romstage-y += monotonic_timer.c
+romstage-y += pmutil.c
+romstage-y += reset.c
+romstage-y += smbus.c
+romstage-y += ramtop.c
+romstage-$(CONFIG_PICASSO_UART) += uart.c
+romstage-y += tsc_freq.c
+romstage-y += southbridge.c
+romstage-$(CONFIG_SPI_FLASH) += spi.c
+romstage-$(CONFIG_HAVE_SMI_HANDLER) += smi_util.c
+
+verstage-y += gpio.c
+verstage-y += i2c.c
+verstage-y += monotonic_timer.c
+verstage-y += pmutil.c
+verstage-y += reset.c
+verstage-$(CONFIG_PICASSO_UART) += uart.c
+verstage-y += tsc_freq.c
+verstage-$(CONFIG_SPI_FLASH) += spi.c
+
+postcar-y += monotonic_timer.c
+postcar-$(CONFIG_PICASSO_UART) += uart.c
+postcar-y += ramtop.c
+postcar-$(CONFIG_VBOOT_MEASURED_BOOT) += i2c.c
+postcar-y += tsc_freq.c
+
+ramstage-y += i2c.c
+ramstage-y += chip.c
+ramstage-y += cpu.c
+ramstage-y += mca.c
+ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
+ramstage-y += gpio.c
+ramstage-y += monotonic_timer.c
+ramstage-y += southbridge.c
+ramstage-y += northbridge.c
+ramstage-y += pmutil.c
+ramstage-y += reset.c
+ramstage-y += sata.c
+ramstage-y += sm.c
+ramstage-y += smbus.c
+ramstage-y += ramtop.c
+ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi.c
+ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smi_util.c
+ramstage-$(CONFIG_PICASSO_UART) += uart.c
+ramstage-y += usb.c
+ramstage-y += tsc_freq.c
+ramstage-$(CONFIG_SPI_FLASH) += spi.c
+ramstage-y += finalize.c
+
+smm-y += monotonic_timer.c
+smm-y += smihandler.c
+smm-y += smi_util.c
+smm-y += tsc_freq.c
+smm-$(CONFIG_DEBUG_SMI) += uart.c
+smm-$(CONFIG_SPI_FLASH) += spi.c
+smm-y += gpio.c
+
+CPPFLAGS_common += -I$(src)/soc/amd/picasso
+CPPFLAGS_common += -I$(src)/soc/amd/picasso/include
+CPPFLAGS_common += -I$(src)/soc/amd/picasso/acpi
+
+# ROMSIG Normally At ROMBASE + 0x20000
+# Overridden by CONFIG_AMD_FWM_POSITION_INDEX
+# +-----------+---------------+----------------+------------+
+# |0x55AA55AA |EC ROM Address |GEC ROM Address |USB3 ROM |
+# +-----------+---------------+----------------+------------+
+# |PSPDIR ADDR|
+# +-----------+
+#
+# EC ROM should be 64K aligned.
+PICASSO_FWM_POSITION=$(call int-add, \
+ $(call int-subtract, 0xffffffff \
+ $(call int-shift-left, \
+ 0x80000 $(CONFIG_AMD_FWM_POSITION_INDEX))) 0x20000 1)
+
+### 0
+FIRMWARE_LOCATE=$(dir $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)))
+FIRMWARE_TYPE=ST
+
+###5
+PUBSIGNEDKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/RtmPubSigned$(FIRMWARE_TYPE).key
+
+###1
+PSPBTLDR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspBootLoader_prod_$(FIRMWARE_TYPE).sbin
+
+###3
+PSPRCVR_FILE=$(top)/$(FIRMWARE_LOCATE)/PspRecoveryBootLoader_prod_$(FIRMWARE_TYPE).sbin
+
+###4
+PSPNVRAM_FILE=$(top)/$(FIRMWARE_LOCATE)/PspNvram$(FIRMWARE_TYPE).bin
+
+###8 - Check for SMU firmware named either *.sbin or *.csbin
+### TODO: Remove *.sbin section after the blobs repo is updated.
+SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware_$(FIRMWARE_TYPE).csbin
+ifeq ("$(wildcard $(SMUFWM_FILE))","")
+SMUFWM_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware$(FIRMWARE_TYPE).sbin
+endif
+
+###95
+SMUSCS_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuScs$(FIRMWARE_TYPE).bin
+
+###9
+PSPSECUREDEBUG_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureDebug$(FIRMWARE_TYPE).Key
+
+ifeq ($(CONFIG_USE_PSPSECUREOS),y)
+###2
+PSPSCUREOS_FILE=$(top)/$(FIRMWARE_LOCATE)/PspSecureOs_prod_$(FIRMWARE_TYPE).csbin
+
+###12
+PSPTRUSTLETS_FILE=$(wildcard $(top)/$(FIRMWARE_LOCATE)/PspTrustlets*_prod_$(FIRMWARE_TYPE).cbin)
+
+###13
+TRUSTLETKEY_FILE=$(top)/$(FIRMWARE_LOCATE)/TrustletKey_prod_$(FIRMWARE_TYPE).sbin
+endif
+
+###18- Check for SMU firmware2 named either *.sbin or *.csbin
+### TODO: Remove *.sbin section after the blobs repo is updated.
+SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE).csbin
+ifeq ("$(wildcard $(SMUFIRMWARE2_FILE))","")
+SMUFIRMWARE2_FILE=$(top)/$(FIRMWARE_LOCATE)/SmuFirmware2_prod_$(FIRMWARE_TYPE).sbin
+endif
+
+add_opt_prefix=$(if $(call strip_quotes, $(1)), $(2) $(call strip_quotes, $(1)), )
+
+OPT_AMD_PUBKEY_FILE=$(call add_opt_prefix, $(CONFIG_AMD_PUBKEY_FILE), --pubkey)
+OPT_PSPBTLDR_FILE=$(call add_opt_prefix, $(PSPBTLDR_FILE), --bootloader)
+OPT_SMUFWM_FILE=$(call add_opt_prefix, $(SMUFWM_FILE), --smufirmware)
+OPT_PSPRCVR_FILE=$(call add_opt_prefix, $(PSPRCVR_FILE), --recovery)
+OPT_PUBSIGNEDKEY_FILE=$(call add_opt_prefix, $(PUBSIGNEDKEY_FILE), --rtmpubkey)
+OPT_PSPNVRAM_FILE=$(call add_opt_prefix, $(PSPNVRAM_FILE), --nvram)
+OPT_PSPSECUREDEBUG_FILE=$(call add_opt_prefix, $(PSPSECUREDEBUG_FILE), --securedebug)
+ifeq ($(CONFIG_USE_PSPSECUREOS),y)
+OPT_PSPSCUREOS_FILE=$(call add_opt_prefix, $(PSPSCUREOS_FILE), --secureos)
+OPT_PSPTRUSTLETS_FILE=$(call add_opt_prefix, $(PSPTRUSTLETS_FILE), --trustlets)
+OPT_TRUSTLETKEY_FILE=$(call add_opt_prefix, $(TRUSTLETKEY_FILE), --trustletkey)
+endif
+OPT_SMUFIRMWARE2_FILE=$(call add_opt_prefix, $(SMUFIRMWARE2_FILE), --smufirmware2)
+OPT_SMUSCS_FILE=$(call add_opt_prefix, $(SMUSCS_FILE), --smuscs)
+
+$(obj)/amdfw.rom: $(call strip_quotes, $(CONFIG_AMD_PUBKEY_FILE)) \
+ $(call strip_quotes, $(PUBSIGNEDKEY_FILE)) \
+ $(call strip_quotes, $(PSPBTLDR_FILE)) \
+ $(call strip_quotes, $(PSPRCVR_FILE)) \
+ $(call strip_quotes, $(PSPSCUREOS_FILE)) \
+ $(call strip_quotes, $(PSPNVRAM_FILE)) \
+ $(call strip_quotes, $(SMUFWM_FILE)) \
+ $(call strip_quotes, $(SMUSCS_FILE)) \
+ $(call strip_quotes, $(PSPSECUREDEBUG_FILE)) \
+ $(call strip_quotes, $(PSPTRUSTLETS_FILE)) \
+ $(call strip_quotes, $(TRUSTLETKEY_FILE)) \
+ $(call strip_quotes, $(SMUFIRMWARE2_FILE)) \
+ $(AMDFWTOOL)
+ rm -f $@
+ @printf " AMDFWTOOL $(subst $(obj)/,,$(@))\n"
+ $(AMDFWTOOL) \
+ $(OPT_AMD_PUBKEY_FILE) \
+ $(OPT_PSPBTLDR_FILE) \
+ $(OPT_SMUFWM_FILE) \
+ $(OPT_PSPRCVR_FILE) \
+ $(OPT_PUBSIGNEDKEY_FILE) \
+ $(OPT_PSPSCUREOS_FILE) \
+ $(OPT_PSPNVRAM_FILE) \
+ $(OPT_PSPSECUREDEBUG_FILE) \
+ $(OPT_PSPTRUSTLETS_FILE) \
+ $(OPT_TRUSTLETKEY_FILE) \
+ $(OPT_SMUFIRMWARE2_FILE) \
+ $(OPT_SMUSCS_FILE) \
+ $(OPT_AMD_PUBKEY_FILE) \
+ $(OPT_PSPBTLDR_FILE) \
+ $(OPT_SMUFWM_FILE) \
+ $(OPT_PSPRCVR_FILE) \
+ $(OPT_PUBSIGNEDKEY_FILE) \
+ $(OPT_PSPSCUREOS_FILE) \
+ $(OPT_PSPNVRAM_FILE) \
+ $(OPT_PSPSECUREDEBUG_FILE) \
+ $(OPT_PSPTRUSTLETS_FILE) \
+ $(OPT_TRUSTLETKEY_FILE) \
+ $(OPT_SMUFIRMWARE2_FILE) \
+ $(OPT_SMUSCS_FILE) \
+ --combo-capable \
+ --flashsize $(CONFIG_ROM_SIZE) \
+ --location $(shell printf "0x%x" $(PICASSO_FWM_POSITION)) \
+ --output $@
+
+ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
+PHONY+=add_amdfw
+INTERMEDIATE+=add_amdfw
+
+# Calculate firmware position inside the ROM
+PICASSO_FWM_ROM_POSITION=$(call int-add, \
+ $(call int-subtract, $(CONFIG_ROM_SIZE) \
+ $(call int-shift-left, \
+ 0x80000 $(CONFIG_AMD_FWM_POSITION_INDEX))) 0x20000)
+
+add_amdfw: $(obj)/coreboot.pre $(obj)/amdfw.rom
+ printf " DD Adding AMD Firmware at ROM offset 0x%x\n" \
+ "$(PICASSO_FWM_ROM_POSITION)"
+ dd if=$(obj)/amdfw.rom \
+ of=$(obj)/coreboot.pre conv=notrunc bs=1 \
+ seek=$(PICASSO_FWM_ROM_POSITION) >/dev/null 2>&1
+
+else # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
+
+cbfs-files-y += apu/amdfw
+apu/amdfw-file := $(obj)/amdfw.rom
+apu/amdfw-position := $(PICASSO_FWM_POSITION)
+apu/amdfw-type := raw
+
+endif # ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
+
+cbfs-files-y += smu_fw
+cbfs-files-y += smu_fw2
+smu_fw-file := $(SMUFWM_FILE)
+smu_fw-type := raw
+smu_fw2-file := $(SMUFIRMWARE2_FILE)
+smu_fw2-type := raw
+
+endif # ($(CONFIG_SOC_AMD_PICASSO),y)
diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c
new file mode 100644
index 0000000000..daeb7b60b4
--- /dev/null
+++ b/src/soc/amd/picasso/acpi.c
@@ -0,0 +1,406 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012, 2017 Advanced Micro Devices, Inc.
+ * Copyright (C) 2014 Google Inc.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * ACPI - create the Fixed ACPI Description Tables (FADT)
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+unsigned long acpi_fill_madt(unsigned long current)
+{
+ /* create all subtables for processors */
+ current = acpi_create_madt_lapics(current);
+
+ /* Write Kern IOAPIC, only one */
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current,
+ CONFIG_MAX_CPUS, IO_APIC_ADDR, 0);
+
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current,
+ CONFIG_MAX_CPUS+1, IO_APIC2_ADDR, 24);
+
+ /* 0: mean bus 0--->ISA */
+ /* 0: PIC 0 */
+ /* 2: APIC 2 */
+ /* 5 mean: 0101 --> Edge-triggered, Active high */
+ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
+ current, 0, 0, 2, 0);
+ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
+ current, 0, 9, 9, 0xf);
+
+ /* create all subtables for processors */
+ current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
+ 0xff, 5, 1);
+ /* 1: LINT1 connect to NMI */
+
+ return current;
+}
+
+/*
+ * Reference section 5.2.9 Fixed ACPI Description Table (FADT)
+ * in the ACPI 3.0b specification.
+ */
+void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt)
+{
+ acpi_header_t *header = &(fadt->header);
+
+ printk(BIOS_DEBUG, "pm_base: 0x%04x\n", PICASSO_ACPI_IO_BASE);
+
+ /* Prepare the header */
+ memset((void *)fadt, 0, sizeof(acpi_fadt_t));
+ memcpy(header->signature, "FACP", 4);
+ header->length = sizeof(acpi_fadt_t);
+ header->revision = get_acpi_table_revision(FADT);
+ memcpy(header->oem_id, OEM_ID, 6);
+ memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
+ memcpy(header->asl_compiler_id, ASLC, 4);
+ header->asl_compiler_revision = asl_revision;
+
+ fadt->firmware_ctrl = (u32) facs;
+ fadt->dsdt = (u32) dsdt;
+ fadt->reserved = 0; /* reserved, should be 0 ACPI 3.0 */
+ fadt->preferred_pm_profile = FADT_PM_PROFILE;
+ fadt->sci_int = 9; /* IRQ 09 - ACPI SCI */
+
+ if (CONFIG(HAVE_SMI_HANDLER)) {
+ fadt->smi_cmd = APM_CNT;
+ fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
+ fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
+ fadt->s4bios_req = 0; /* Not supported */
+ fadt->pstate_cnt = 0; /* Not supported */
+ fadt->cst_cnt = 0; /* Not supported */
+ acpi_disable_sci();
+ } else {
+ fadt->smi_cmd = 0; /* disable system management mode */
+ fadt->acpi_enable = 0; /* unused if SMI_CMD = 0 */
+ fadt->acpi_disable = 0; /* unused if SMI_CMD = 0 */
+ fadt->s4bios_req = 0; /* unused if SMI_CMD = 0 */
+ fadt->pstate_cnt = 0; /* unused if SMI_CMD = 0 */
+ fadt->cst_cnt = 0x00; /* unused if SMI_CMD = 0 */
+ acpi_enable_sci();
+ }
+
+ fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK;
+ fadt->pm1b_evt_blk = 0x0000;
+ fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK;
+ fadt->pm1b_cnt_blk = 0x0000;
+ fadt->pm2_cnt_blk = 0x0000;
+ fadt->pm_tmr_blk = ACPI_PM_TMR_BLK;
+ fadt->gpe0_blk = ACPI_GPE0_BLK;
+ fadt->gpe1_blk = 0x0000; /* No gpe1 block */
+
+ fadt->pm1_evt_len = 4; /* 32 bits */
+ fadt->pm1_cnt_len = 2; /* 16 bits */
+ fadt->pm2_cnt_len = 0;
+ fadt->pm_tmr_len = 4; /* 32 bits */
+ fadt->gpe0_blk_len = 8; /* 64 bits */
+ fadt->gpe1_blk_len = 0;
+ fadt->gpe1_base = 0;
+
+ fadt->p_lvl2_lat = ACPI_FADT_C2_NOT_SUPPORTED;
+ fadt->p_lvl3_lat = ACPI_FADT_C3_NOT_SUPPORTED;
+ fadt->flush_size = 0; /* set to 0 if WBINVD is 1 in flags */
+ fadt->flush_stride = 0; /* set to 0 if WBINVD is 1 in flags */
+ fadt->duty_offset = 1; /* CLK_VAL bits 3:1 */
+ fadt->duty_width = 3; /* CLK_VAL bits 3:1 */
+ fadt->day_alrm = 0; /* 0x7d these have to be */
+ fadt->mon_alrm = 0; /* 0x7e added to cmos.layout */
+ fadt->century = 0; /* 0x7f to make rtc alarm work */
+ fadt->iapc_boot_arch = FADT_BOOT_ARCH; /* See table 5-10 */
+ fadt->res2 = 0; /* reserved, MUST be 0 ACPI 3.0 */
+ fadt->flags = ACPI_FADT_WBINVD | /* See table 5-10 ACPI 3.0a spec */
+ ACPI_FADT_C1_SUPPORTED |
+ ACPI_FADT_SLEEP_BUTTON |
+ ACPI_FADT_S4_RTC_WAKE |
+ ACPI_FADT_32BIT_TIMER |
+ ACPI_FADT_RESET_REGISTER |
+ ACPI_FADT_PCI_EXPRESS_WAKE |
+ ACPI_FADT_PLATFORM_CLOCK |
+ ACPI_FADT_S4_RTC_VALID |
+ ACPI_FADT_REMOTE_POWER_ON;
+
+ /* Format is from 5.2.3.1: Generic Address Structure */
+ /* reset_reg: see section 4.7.3.6 ACPI 3.0a spec */
+ /* 8 bit write of value 0x06 to 0xCF9 in IO space */
+ fadt->reset_reg.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->reset_reg.bit_width = 8;
+ fadt->reset_reg.bit_offset = 0;
+ fadt->reset_reg.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS;
+ fadt->reset_reg.addrl = SYS_RESET;
+ fadt->reset_reg.addrh = 0x0;
+
+ fadt->reset_value = 6;
+
+ fadt->ARM_boot_arch = 0; /* MUST be 0 ACPI 3.0 */
+ fadt->FADT_MinorVersion = 0; /* MUST be 0 ACPI 3.0 */
+
+ fadt->x_firmware_ctl_l = 0; /* set to 0 if firmware_ctrl is used */
+ fadt->x_firmware_ctl_h = 0;
+ fadt->x_dsdt_l = (u32) dsdt;
+ fadt->x_dsdt_h = 0;
+
+ fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->x_pm1a_evt_blk.bit_width = 32;
+ fadt->x_pm1a_evt_blk.bit_offset = 0;
+ fadt->x_pm1a_evt_blk.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS;
+ fadt->x_pm1a_evt_blk.addrl = ACPI_PM_EVT_BLK;
+ fadt->x_pm1a_evt_blk.addrh = 0x0;
+
+ fadt->x_pm1b_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->x_pm1b_evt_blk.bit_width = 0;
+ fadt->x_pm1b_evt_blk.bit_offset = 0;
+ fadt->x_pm1b_evt_blk.access_size = 0;
+ fadt->x_pm1b_evt_blk.addrl = 0x0;
+ fadt->x_pm1b_evt_blk.addrh = 0x0;
+
+
+ fadt->x_pm1a_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->x_pm1a_cnt_blk.bit_width = 16;
+ fadt->x_pm1a_cnt_blk.bit_offset = 0;
+ fadt->x_pm1a_cnt_blk.access_size = 0;
+ fadt->x_pm1a_cnt_blk.addrl = ACPI_PM1_CNT_BLK;
+ fadt->x_pm1a_cnt_blk.addrh = 0x0;
+
+ fadt->x_pm1b_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->x_pm1b_cnt_blk.bit_width = 0;
+ fadt->x_pm1b_cnt_blk.bit_offset = 0;
+ fadt->x_pm1b_cnt_blk.access_size = 0;
+ fadt->x_pm1b_cnt_blk.addrl = 0x0;
+ fadt->x_pm1b_cnt_blk.addrh = 0x0;
+
+ /*
+ * Note: Under this current AMD C state implementation, this is no
+ * longer used and should not be reported to OS.
+ */
+ fadt->x_pm2_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->x_pm2_cnt_blk.bit_width = 0;
+ fadt->x_pm2_cnt_blk.bit_offset = 0;
+ fadt->x_pm2_cnt_blk.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS;
+ fadt->x_pm2_cnt_blk.addrl = 0;
+ fadt->x_pm2_cnt_blk.addrh = 0x0;
+
+
+ fadt->x_pm_tmr_blk.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->x_pm_tmr_blk.bit_width = 32;
+ fadt->x_pm_tmr_blk.bit_offset = 0;
+ fadt->x_pm_tmr_blk.access_size = ACPI_ACCESS_SIZE_DWORD_ACCESS;
+ fadt->x_pm_tmr_blk.addrl = ACPI_PM_TMR_BLK;
+ fadt->x_pm_tmr_blk.addrh = 0x0;
+
+
+ fadt->x_gpe0_blk.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->x_gpe0_blk.bit_width = 64; /* EventStatus + Event Enable */
+ fadt->x_gpe0_blk.bit_offset = 0;
+ fadt->x_gpe0_blk.access_size = ACPI_ACCESS_SIZE_DWORD_ACCESS;
+ fadt->x_gpe0_blk.addrl = ACPI_GPE0_BLK;
+ fadt->x_gpe0_blk.addrh = 0x0;
+
+
+ fadt->x_gpe1_blk.space_id = ACPI_ADDRESS_SPACE_IO;
+ fadt->x_gpe1_blk.bit_width = 0;
+ fadt->x_gpe1_blk.bit_offset = 0;
+ fadt->x_gpe1_blk.access_size = 0;
+ fadt->x_gpe1_blk.addrl = 0;
+ fadt->x_gpe1_blk.addrh = 0x0;
+
+ header->checksum = acpi_checksum((void *)fadt, sizeof(acpi_fadt_t));
+}
+
+void generate_cpu_entries(struct device *device)
+{
+ int cores, cpu;
+
+ /* Picasso is single node, just report # of cores */
+ cores = pci_read_config32(SOC_NB_DEV, NB_CAPABILITIES2) & CMP_CAP_MASK;
+ cores++; /* number of cores is CmpCap+1 */
+
+ printk(BIOS_DEBUG, "ACPI \\_PR report %d core(s)\n", cores);
+
+ /* Generate BSP \_PR.P000 */
+ acpigen_write_processor(0, ACPI_GPE0_BLK, 6);
+ acpigen_pop_len();
+
+ /* Generate AP \_PR.Pxxx */
+ for (cpu = 1; cpu < cores; cpu++) {
+ acpigen_write_processor(cpu, 0, 0);
+ acpigen_pop_len();
+ }
+}
+
+unsigned long southbridge_write_acpi_tables(struct device *device,
+ unsigned long current,
+ struct acpi_rsdp *rsdp)
+{
+ return acpi_write_hpet(device, current, rsdp);
+}
+
+static void acpi_create_gnvs(struct global_nvs_t *gnvs)
+{
+ /* Clear out GNVS. */
+ memset(gnvs, 0, sizeof(*gnvs));
+
+ if (CONFIG(CONSOLE_CBMEM))
+ gnvs->cbmc = (uintptr_t)cbmem_find(CBMEM_ID_CONSOLE);
+
+ if (CONFIG(CHROMEOS)) {
+ /* Initialize Verified Boot data */
+ chromeos_init_chromeos_acpi(&gnvs->chromeos);
+ gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO;
+ }
+
+ /* Set unknown wake source */
+ gnvs->pm1i = ~0ULL;
+ gnvs->gpei = ~0ULL;
+
+ /* CPU core count */
+ gnvs->pcnt = dev_count_cpu();
+}
+
+void southbridge_inject_dsdt(struct device *device)
+{
+ struct global_nvs_t *gnvs;
+
+ gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
+
+ if (gnvs) {
+ acpi_create_gnvs(gnvs);
+
+ /* Add it to DSDT */
+ acpigen_write_scope("\\");
+ acpigen_write_name_dword("NVSA", (uintptr_t)gnvs);
+ acpigen_pop_len();
+ }
+}
+
+static void acpigen_soc_get_gpio_in_local5(uintptr_t addr)
+{
+ /*
+ * Store (\_SB.GPR2 (addr), Local5)
+ * \_SB.GPR2 is used to read control byte 2 from control register.
+ * / It is defined in gpio_lib.asl.
+ */
+ acpigen_write_store();
+ acpigen_emit_namestring("\\_SB.GPR2");
+ acpigen_write_integer(addr);
+ acpigen_emit_byte(LOCAL5_OP);
+}
+
+static int acpigen_soc_get_gpio_val(unsigned int gpio_num, uint32_t mask)
+{
+ if (gpio_num >= SOC_GPIO_TOTAL_PINS) {
+ printk(BIOS_WARNING, "Warning: Pin %d should be smaller than"
+ " %d\n", gpio_num, SOC_GPIO_TOTAL_PINS);
+ return -1;
+ }
+ uintptr_t addr = (uintptr_t) gpio_get_address(gpio_num);
+
+ acpigen_soc_get_gpio_in_local5(addr);
+
+ /* If (And (Local5, mask)) */
+ acpigen_write_if_and(LOCAL5_OP, mask);
+
+ /* Store (One, Local0) */
+ acpigen_write_store_ops(ONE_OP, LOCAL0_OP);
+
+ acpigen_pop_len(); /* If */
+
+ /* Else */
+ acpigen_write_else();
+
+ /* Store (Zero, Local0) */
+ acpigen_write_store_ops(ZERO_OP, LOCAL0_OP);
+
+ acpigen_pop_len(); /* Else */
+
+ return 0;
+}
+
+static int acpigen_soc_set_gpio_val(unsigned int gpio_num, uint32_t val)
+{
+ if (gpio_num >= SOC_GPIO_TOTAL_PINS) {
+ printk(BIOS_WARNING, "Warning: Pin %d should be smaller than"
+ " %d\n", gpio_num, SOC_GPIO_TOTAL_PINS);
+ return -1;
+ }
+ uintptr_t addr = (uintptr_t) gpio_get_address(gpio_num);
+
+ /* Store (0x40, Local0) */
+ acpigen_write_store();
+ acpigen_write_integer(GPIO_PIN_OUT);
+ acpigen_emit_byte(LOCAL0_OP);
+
+ acpigen_soc_get_gpio_in_local5(addr);
+
+ if (val) {
+ /* Or (Local5, GPIO_PIN_OUT, Local5) */
+ acpigen_write_or(LOCAL5_OP, LOCAL0_OP, LOCAL5_OP);
+ } else {
+ /* Not (GPIO_PIN_OUT, Local6) */
+ acpigen_write_not(LOCAL0_OP, LOCAL6_OP);
+
+ /* And (Local5, Local6, Local5) */
+ acpigen_write_and(LOCAL5_OP, LOCAL6_OP, LOCAL5_OP);
+ }
+
+ /*
+ * SB.GPW2 (addr, Local5)
+ * \_SB.GPW2 is used to write control byte in control register
+ * / byte 2. It is defined in gpio_lib.asl.
+ */
+ acpigen_emit_namestring("\\_SB.GPW2");
+ acpigen_write_integer(addr);
+ acpigen_emit_byte(LOCAL5_OP);
+
+ return 0;
+}
+
+int acpigen_soc_read_rx_gpio(unsigned int gpio_num)
+{
+ return acpigen_soc_get_gpio_val(gpio_num, GPIO_PIN_IN);
+}
+
+int acpigen_soc_get_tx_gpio(unsigned int gpio_num)
+{
+ return acpigen_soc_get_gpio_val(gpio_num, GPIO_PIN_OUT);
+}
+
+int acpigen_soc_set_tx_gpio(unsigned int gpio_num)
+{
+ return acpigen_soc_set_gpio_val(gpio_num, 1);
+}
+
+int acpigen_soc_clear_tx_gpio(unsigned int gpio_num)
+{
+ return acpigen_soc_set_gpio_val(gpio_num, 0);
+}
diff --git a/src/cpu/allwinner/a10/monotonic_timer.c b/src/soc/amd/picasso/acpi/acpi_wake_source.asl
similarity index 60%
rename from src/cpu/allwinner/a10/monotonic_timer.c
rename to src/soc/amd/picasso/acpi/acpi_wake_source.asl
index 479dee9471..fa01802618 100644
--- a/src/cpu/allwinner/a10/monotonic_timer.c
+++ b/src/soc/amd/picasso/acpi/acpi_wake_source.asl
@@ -1,25 +1,32 @@
/*
* This file is part of the coreboot project.
*
- * Copyright (C) 2013 Alexandru Gagniuc
+ * Copyright (C) 2015 Google Inc.
*
* 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; version 2 of the Licenseor (at your option)
- * any later version.
+ * the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * Placeholder for code to come (needed to complete build)
- *
*/
-#include
-
-void timer_monotonic_get(struct mono_time *mt)
+Scope (\_SB)
{
- (void)mt;
+ Method (_SWS)
+ {
+ /* Index into PM1 for device that caused wake */
+ Return (\PM1I)
+ }
+}
+
+Scope (\_GPE)
+{
+ Method (_SWS)
+ {
+ /* Index into GPE for device that caused wake */
+ Return (\GPEI)
+ }
}
diff --git a/src/soc/amd/picasso/acpi/cpu.asl b/src/soc/amd/picasso/acpi/cpu.asl
new file mode 100644
index 0000000000..414326ecf1
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/cpu.asl
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Sage Electronic Engineering, LLC
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/* Required function by EC, Notify OS to re-read CPU tables */
+Method (PNOT)
+{
+}
+
+/*
+ * Processor Object
+ */
+/* These devices are created at runtime */
+External (\_PR.P000, DeviceObj)
+External (\_PR.P001, DeviceObj)
+External (\_PR.P002, DeviceObj)
+External (\_PR.P003, DeviceObj)
+External (\_PR.P004, DeviceObj)
+External (\_PR.P005, DeviceObj)
+External (\_PR.P006, DeviceObj)
+External (\_PR.P007, DeviceObj)
+
+/* Return a package containing enabled processor entries */
+Method (PPKG)
+{
+ If (LGreaterEqual (\PCNT, 2)) {
+ Return (Package ()
+ {
+ \_PR.P000,
+ \_PR.P001
+ })
+ } Else {
+ Return (Package ()
+ {
+ \_PR.P000
+ })
+ }
+}
diff --git a/src/soc/amd/picasso/acpi/globalnvs.asl b/src/soc/amd/picasso/acpi/globalnvs.asl
new file mode 100644
index 0000000000..cc264e6f85
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/globalnvs.asl
@@ -0,0 +1,66 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ * (Written by Alexandru Gagniuc 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * NOTE: The layout of the GNVS structure below must match the layout in
+ * soc/amd/picasso/include/soc/nvs.h !!!
+ *
+ */
+
+External (NVSA)
+
+OperationRegion (GNVS, SystemMemory, NVSA, 0x1000)
+Field (GNVS, ByteAcc, NoLock, Preserve)
+{
+ /* Miscellaneous */
+ Offset (0x00),
+ PCNT, 8, // 0x00 - Processor Count
+ PPCM, 8, // 0x01 - Max PPC State
+ LIDS, 8, // 0x02 - LID State
+ PWRS, 8, // 0x03 - AC Power State
+ DPTE, 8, // 0x04 - Enable DPTF
+ CBMC, 32, // 0x05 - 0x08 - coreboot Memory Console
+ PM1I, 64, // 0x09 - 0x10 - System Wake Source - PM1 Index
+ GPEI, 64, // 0x11 - 0x18 - GPE Wake Source
+ NHLA, 64, // 0x19 - 0x20 - NHLT Address
+ NHLL, 32, // 0x21 - 0x24 - NHLT Length
+ PRT0, 32, // 0x25 - 0x28 - PERST_0 Address
+ SCDP, 8, // 0x29 - SD_CD GPIO portid
+ SCDO, 8, // 0x2A - GPIO pad offset relative to the community
+ TMPS, 8, // 0x2B - Temperature Sensor ID
+ TLVL, 8, // 0x2C - Throttle Level Limit
+ FLVL, 8, // 0x2D - Current FAN Level
+ TCRT, 8, // 0x2E - Critical Threshold
+ TPSV, 8, // 0x2F - Passive Threshold
+ TMAX, 8, // 0x30 - CPU Tj_max
+ Offset (0x34), // 0x34 - AOAC Device Enables
+ , 5,
+ IC0E, 1, // I2C0, 5
+ IC1E, 1, // I2C1, 6
+ IC2E, 1, // I2C2, 7
+ IC3E, 1, // I2C3, 8
+ , 2,
+ UT0E, 1, // UART0, 11
+ UT1E, 1, // UART1, 12
+ , 2,
+ ST_E, 1, // SATA, 15
+ , 11,
+ ESPI, 1, // ESPI, 27
+ /* ChromeOS stuff (0x100 -> 0xfff, size 0xeff) */
+ Offset (0x100),
+ #include
+}
diff --git a/src/soc/amd/picasso/acpi/northbridge.asl b/src/soc/amd/picasso/acpi/northbridge.asl
new file mode 100644
index 0000000000..fe78534403
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/northbridge.asl
@@ -0,0 +1,134 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Sage Electronic Engineering, LLC
+ * Copyright (C) 2016 Advanced Micro Devices, Inc.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/* Note: Only need HID on Primary Bus */
+External (TOM1)
+External (TOM2)
+Name(_HID, EISAID("PNP0A08")) /* PCI Express Root Bridge */
+Name(_CID, EISAID("PNP0A03")) /* PCI Root Bridge */
+Name(_ADR, 0x00180000) /* Dev# = BSP Dev#, Func# = 0 */
+
+/* Describe the Northbridge devices */
+
+Method(_BBN, 0, NotSerialized) /* Bus number = 0 */
+{
+ Return(Zero)
+}
+
+Method(_STA, 0, NotSerialized)
+{
+ Return(0x0B) /* Status is visible */
+}
+
+Method(_PRT,0, NotSerialized)
+{
+ If(PMOD)
+ {
+ Return(APR0) /* APIC mode */
+ }
+ Return (PR0) /* PIC Mode */
+}
+
+Device(AMRT) {
+ Name(_ADR, 0x00000000)
+} /* end AMRT */
+
+/* Internal Graphics */
+Device(IGFX) {
+ Name(_ADR, 0x00010000)
+}
+
+/* Gpp 0 */
+Device(PBR4) {
+ Name(_ADR, 0x00020001)
+ Method(_PRT,0) {
+ If(PMOD){ Return(APS4) } /* APIC mode */
+ Return (PS4) /* PIC Mode */
+ } /* end _PRT */
+} /* end PBR4 */
+
+/* Gpp 1 */
+Device(PBR5) {
+ Name(_ADR, 0x00020002)
+ Method(_PRT,0) {
+ If(PMOD){ Return(APS5) } /* APIC mode */
+ Return (PS5) /* PIC Mode */
+ } /* end _PRT */
+} /* end PBR5 */
+
+/* Gpp 2 */
+Device(PBR6) {
+ Name(_ADR, 0x00020003)
+ Method(_PRT,0) {
+ If(PMOD){ Return(APS6) } /* APIC mode */
+ Return (PS6) /* PIC Mode */
+ } /* end _PRT */
+} /* end PBR6 */
+
+/* Gpp 3 */
+Device(PBR7) {
+ Name(_ADR, 0x00020004)
+ Method(_PRT,0) {
+ If(PMOD){ Return(APS7) } /* APIC mode */
+ Return (PS7) /* PIC Mode */
+ } /* end _PRT */
+} /* end PBR7 */
+
+/* Gpp 4 */
+Device(PBR8) {
+ Name(_ADR, 0x00020005)
+ Method(_PRT,0) {
+ If(PMOD){ Return(APS8) } /* APIC mode */
+ Return (PS8) /* PIC Mode */
+ } /* end _PRT */
+} /* end PBR8 */
+
+Device(AZHD) { /* 0:9.2 - HD Audio */
+ Name(_ADR, 0x00090002)
+ OperationRegion(AZPD, PCI_Config, 0x00, 0x100)
+ Field(AZPD, AnyAcc, NoLock, Preserve) {
+ offset (0x42),
+ NSDI, 1,
+ NSDO, 1,
+ NSEN, 1,
+ offset (0x44),
+ IPCR, 4,
+ offset (0x54),
+ PWST, 2,
+ , 6,
+ PMEB, 1,
+ , 6,
+ PMST, 1,
+ offset (0x62),
+ MMCR, 1,
+ offset (0x64),
+ MMLA, 32,
+ offset (0x68),
+ MMHA, 32,
+ offset (0x6c),
+ MMDT, 16,
+ }
+
+ Method (_INI, 0, NotSerialized)
+ {
+ If (LEqual (OSVR, 0x03))
+ {
+ Store (Zero, NSEN)
+ Store (One, NSDO)
+ Store (One, NSDI)
+ }
+ }
+} /* end AZHD */
diff --git a/src/soc/amd/picasso/acpi/pci_int.asl b/src/soc/amd/picasso/acpi/pci_int.asl
new file mode 100644
index 0000000000..617b9eb86c
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/pci_int.asl
@@ -0,0 +1,469 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Sage Electronic Engineering, LLC
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+ /* PCIe Configuration Space for CONFIG_MMCONF_BUS_NUMBER busses */
+ OperationRegion(PCFG, SystemMemory, PCBA, PCLN) /* Each bus consumes 1MB */
+ Field(PCFG, ByteAcc, NoLock, Preserve) {
+ /* Byte offsets are computed using the following technique:
+ * ((bus number + 1) * ((device number * 8) * 4096)) + register offset
+ * The 8 comes from 8 functions per device, and 4096 bytes per function config space
+ */
+ Offset(0x00088024), /* Byte offset to SATA register 24h - Bus 0, Device 17, Function 0 */
+ STB5, 32,
+ Offset(0x00098042), /* Byte offset to OHCI0 register 42h - Bus 0, Device 19, Function 0 */
+ PT0D, 1,
+ PT1D, 1,
+ PT2D, 1,
+ PT3D, 1,
+ PT4D, 1,
+ PT5D, 1,
+ PT6D, 1,
+ PT7D, 1,
+ PT8D, 1,
+ PT9D, 1,
+ Offset(0x000a0004), /* Byte offset to SMBUS register 4h - Bus 0, Device 20, Function 0 */
+ SBIE, 1,
+ SBME, 1,
+ Offset(0x000a0008), /* Byte offset to SMBUS register 8h - Bus 0, Device 20, Function 0 */
+ SBRI, 8,
+ Offset(0x000a0014), /* Byte offset to SMBUS register 14h - Bus 0, Device 20, Function 0 */
+ SBB1, 32,
+ Offset(0x000a0078), /* Byte offset to SMBUS register 78h - Bus 0, Device 20, Function 0 */
+ ,14,
+ P92E, 1, /* Port92 decode enable */
+ }
+
+ OperationRegion(SB5, SystemMemory, STB5, 0x1000)
+ Field(SB5, AnyAcc, NoLock, Preserve){
+ /* Port 0 */
+ Offset(0x120), /* Port 0 Task file status */
+ P0ER, 1,
+ , 2,
+ P0DQ, 1,
+ , 3,
+ P0BY, 1,
+ Offset(0x128), /* Port 0 Serial ATA status */
+ P0DD, 4,
+ , 4,
+ P0IS, 4,
+ Offset(0x12c), /* Port 0 Serial ATA control */
+ P0DI, 4,
+ Offset(0x130), /* Port 0 Serial ATA error */
+ , 16,
+ P0PR, 1,
+
+ /* Port 1 */
+ offset(0x1a0), /* Port 1 Task file status */
+ P1ER, 1,
+ , 2,
+ P1DQ, 1,
+ , 3,
+ P1BY, 1,
+ Offset(0x1a8), /* Port 1 Serial ATA status */
+ P1DD, 4,
+ , 4,
+ P1IS, 4,
+ Offset(0x1ac), /* Port 1 Serial ATA control */
+ P1DI, 4,
+ Offset(0x1b0), /* Port 1 Serial ATA error */
+ , 16,
+ P1PR, 1,
+
+ /* Port 2 */
+ Offset(0x220), /* Port 2 Task file status */
+ P2ER, 1,
+ , 2,
+ P2DQ, 1,
+ , 3,
+ P2BY, 1,
+ Offset(0x228), /* Port 2 Serial ATA status */
+ P2DD, 4,
+ , 4,
+ P2IS, 4,
+ Offset(0x22c), /* Port 2 Serial ATA control */
+ P2DI, 4,
+ Offset(0x230), /* Port 2 Serial ATA error */
+ , 16,
+ P2PR, 1,
+
+ /* Port 3 */
+ Offset(0x2a0), /* Port 3 Task file status */
+ P3ER, 1,
+ , 2,
+ P3DQ, 1,
+ , 3,
+ P3BY, 1,
+ Offset(0x2a8), /* Port 3 Serial ATA status */
+ P3DD, 4,
+ , 4,
+ P3IS, 4,
+ Offset(0x2aC), /* Port 3 Serial ATA control */
+ P3DI, 4,
+ Offset(0x2b0), /* Port 3 Serial ATA error */
+ , 16,
+ P3PR, 1,
+ }
+
+ Method(_PIC, 0x01, NotSerialized)
+ {
+ If (Arg0)
+ {
+ \_SB.CIRQ()
+ }
+ Store(Arg0, PMOD)
+ }
+
+ Method(CIRQ, 0x00, NotSerialized){
+ }
+
+ Name(IRQB, ResourceTemplate(){
+ IRQ(Level,ActiveLow,Shared){15}
+ })
+
+ Name(IRQP, ResourceTemplate(){
+ IRQ(Level,ActiveLow,Exclusive){3, 4, 5, 7, 10, 11, 12, 15}
+ })
+
+ Name(PITF, ResourceTemplate(){
+ IRQ(Level,ActiveLow,Exclusive){9}
+ })
+
+ Device(INTA) {
+ Name(_HID, EISAID("PNP0C0F"))
+ Name(_UID, 1)
+
+ Method(_STA, 0) {
+ if (PIRA) {
+ Return(0x0b) /* sata is invisible */
+ } else {
+ Return(0x09) /* sata is disabled */
+ }
+ } /* End Method(_SB.INTA._STA) */
+
+ Method(_DIS ,0) {
+ /* DBGO("\\_SB\\LNKA\\_DIS\n") */
+ } /* End Method(_SB.INTA._DIS) */
+
+ Method(_PRS ,0) {
+ /* DBGO("\\_SB\\LNKA\\_PRS\n") */
+ Return(IRQP)
+ } /* Method(_SB.INTA._PRS) */
+
+ Method(_CRS ,0) {
+ /* DBGO("\\_SB\\LNKA\\_CRS\n") */
+ CreateWordField(IRQB, 0x1, IRQN)
+ ShiftLeft(1, PIRA, IRQN)
+ Return(IRQB)
+ } /* Method(_SB.INTA._CRS) */
+
+ Method(_SRS, 1) {
+ /* DBGO("\\_SB\\LNKA\\_SRS\n") */
+ CreateWordField(ARG0, 1, IRQM)
+
+ /* Use lowest available IRQ */
+ FindSetRightBit(IRQM, Local0)
+ if (Local0) {
+ Decrement(Local0)
+ }
+ Store(Local0, PIRA)
+ } /* End Method(_SB.INTA._SRS) */
+ } /* End Device(INTA) */
+
+ Device(INTB) {
+ Name(_HID, EISAID("PNP0C0F"))
+ Name(_UID, 2)
+
+ Method(_STA, 0) {
+ if (PIRB) {
+ Return(0x0b) /* sata is invisible */
+ } else {
+ Return(0x09) /* sata is disabled */
+ }
+ } /* End Method(_SB.INTB._STA) */
+
+ Method(_DIS ,0) {
+ /* DBGO("\\_SB\\LNKB\\_DIS\n") */
+ } /* End Method(_SB.INTB._DIS) */
+
+ Method(_PRS ,0) {
+ /* DBGO("\\_SB\\LNKB\\_PRS\n") */
+ Return(IRQP)
+ } /* Method(_SB.INTB._PRS) */
+
+ Method(_CRS ,0) {
+ /* DBGO("\\_SB\\LNKB\\_CRS\n") */
+ CreateWordField(IRQB, 0x1, IRQN)
+ ShiftLeft(1, PIRB, IRQN)
+ Return(IRQB)
+ } /* Method(_SB.INTB._CRS) */
+
+ Method(_SRS, 1) {
+ /* DBGO("\\_SB\\LNKB\\_CRS\n") */
+ CreateWordField(ARG0, 1, IRQM)
+
+ /* Use lowest available IRQ */
+ FindSetRightBit(IRQM, Local0)
+ if (Local0) {
+ Decrement(Local0)
+ }
+ Store(Local0, PIRB)
+ } /* End Method(_SB.INTB._SRS) */
+ } /* End Device(INTB) */
+
+ Device(INTC) {
+ Name(_HID, EISAID("PNP0C0F"))
+ Name(_UID, 3)
+
+ Method(_STA, 0) {
+ if (PIRC) {
+ Return(0x0b) /* sata is invisible */
+ } else {
+ Return(0x09) /* sata is disabled */
+ }
+ } /* End Method(_SB.INTC._STA) */
+
+ Method(_DIS ,0) {
+ /* DBGO("\\_SB\\LNKC\\_DIS\n") */
+ } /* End Method(_SB.INTC._DIS) */
+
+ Method(_PRS ,0) {
+ /* DBGO("\\_SB\\LNKC\\_PRS\n") */
+ Return(IRQP)
+ } /* Method(_SB.INTC._PRS) */
+
+ Method(_CRS ,0) {
+ /* DBGO("\\_SB\\LNKC\\_CRS\n") */
+ CreateWordField(IRQB, 0x1, IRQN)
+ ShiftLeft(1, PIRC, IRQN)
+ Return(IRQB)
+ } /* Method(_SB.INTC._CRS) */
+
+ Method(_SRS, 1) {
+ /* DBGO("\\_SB\\LNKC\\_CRS\n") */
+ CreateWordField(ARG0, 1, IRQM)
+
+ /* Use lowest available IRQ */
+ FindSetRightBit(IRQM, Local0)
+ if (Local0) {
+ Decrement(Local0)
+ }
+ Store(Local0, PIRC)
+ } /* End Method(_SB.INTC._SRS) */
+ } /* End Device(INTC) */
+
+ Device(INTD) {
+ Name(_HID, EISAID("PNP0C0F"))
+ Name(_UID, 4)
+
+ Method(_STA, 0) {
+ if (PIRD) {
+ Return(0x0b) /* sata is invisible */
+ } else {
+ Return(0x09) /* sata is disabled */
+ }
+ } /* End Method(_SB.INTD._STA) */
+
+ Method(_DIS ,0) {
+ /* DBGO("\\_SB\\LNKD\\_DIS\n") */
+ } /* End Method(_SB.INTD._DIS) */
+
+ Method(_PRS ,0) {
+ /* DBGO("\\_SB\\LNKD\\_PRS\n") */
+ Return(IRQP)
+ } /* Method(_SB.INTD._PRS) */
+
+ Method(_CRS ,0) {
+ /* DBGO("\\_SB\\LNKD\\_CRS\n") */
+ CreateWordField(IRQB, 0x1, IRQN)
+ ShiftLeft(1, PIRD, IRQN)
+ Return(IRQB)
+ } /* Method(_SB.INTD._CRS) */
+
+ Method(_SRS, 1) {
+ /* DBGO("\\_SB\\LNKD\\_CRS\n") */
+ CreateWordField(ARG0, 1, IRQM)
+
+ /* Use lowest available IRQ */
+ FindSetRightBit(IRQM, Local0)
+ if (Local0) {
+ Decrement(Local0)
+ }
+ Store(Local0, PIRD)
+ } /* End Method(_SB.INTD._SRS) */
+ } /* End Device(INTD) */
+
+ Device(INTE) {
+ Name(_HID, EISAID("PNP0C0F"))
+ Name(_UID, 5)
+
+ Method(_STA, 0) {
+ if (PIRE) {
+ Return(0x0b) /* sata is invisible */
+ } else {
+ Return(0x09) /* sata is disabled */
+ }
+ } /* End Method(_SB.INTE._STA) */
+
+ Method(_DIS ,0) {
+ /* DBGO("\\_SB\\LNKE\\_DIS\n") */
+ } /* End Method(_SB.INTE._DIS) */
+
+ Method(_PRS ,0) {
+ /* DBGO("\\_SB\\LNKE\\_PRS\n") */
+ Return(IRQP)
+ } /* Method(_SB.INTE._PRS) */
+
+ Method(_CRS ,0) {
+ /* DBGO("\\_SB\\LNKE\\_CRS\n") */
+ CreateWordField(IRQB, 0x1, IRQN)
+ ShiftLeft(1, PIRE, IRQN)
+ Return(IRQB)
+ } /* Method(_SB.INTE._CRS) */
+
+ Method(_SRS, 1) {
+ /* DBGO("\\_SB\\LNKE\\_CRS\n") */
+ CreateWordField(ARG0, 1, IRQM)
+
+ /* Use lowest available IRQ */
+ FindSetRightBit(IRQM, Local0)
+ if (Local0) {
+ Decrement(Local0)
+ }
+ Store(Local0, PIRE)
+ } /* End Method(_SB.INTE._SRS) */
+ } /* End Device(INTE) */
+
+ Device(INTF) {
+ Name(_HID, EISAID("PNP0C0F"))
+ Name(_UID, 6)
+
+ Method(_STA, 0) {
+ if (PIRF) {
+ Return(0x0b) /* sata is invisible */
+ } else {
+ Return(0x09) /* sata is disabled */
+ }
+ } /* End Method(_SB.INTF._STA) */
+
+ Method(_DIS ,0) {
+ /* DBGO("\\_SB\\LNKF\\_DIS\n") */
+ } /* End Method(_SB.INTF._DIS) */
+
+ Method(_PRS ,0) {
+ /* DBGO("\\_SB\\LNKF\\_PRS\n") */
+ Return(PITF)
+ } /* Method(_SB.INTF._PRS) */
+
+ Method(_CRS ,0) {
+ /* DBGO("\\_SB\\LNKF\\_CRS\n") */
+ CreateWordField(IRQB, 0x1, IRQN)
+ ShiftLeft(1, PIRF, IRQN)
+ Return(IRQB)
+ } /* Method(_SB.INTF._CRS) */
+
+ Method(_SRS, 1) {
+ /* DBGO("\\_SB\\LNKF\\_CRS\n") */
+ CreateWordField(ARG0, 1, IRQM)
+
+ /* Use lowest available IRQ */
+ FindSetRightBit(IRQM, Local0)
+ if (Local0) {
+ Decrement(Local0)
+ }
+ Store(Local0, PIRF)
+ } /* End Method(_SB.INTF._SRS) */
+ } /* End Device(INTF) */
+
+ Device(INTG) {
+ Name(_HID, EISAID("PNP0C0F"))
+ Name(_UID, 7)
+
+ Method(_STA, 0) {
+ if (PIRG) {
+ Return(0x0b) /* sata is invisible */
+ } else {
+ Return(0x09) /* sata is disabled */
+ }
+ } /* End Method(_SB.INTG._STA) */
+
+ Method(_DIS ,0) {
+ /* DBGO("\\_SB\\LNKG\\_DIS\n") */
+ } /* End Method(_SB.INTG._DIS) */
+
+ Method(_PRS ,0) {
+ /* DBGO("\\_SB\\LNKG\\_PRS\n") */
+ Return(IRQP)
+ } /* Method(_SB.INTG._CRS) */
+
+ Method(_CRS ,0) {
+ /* DBGO("\\_SB\\LNKG\\_CRS\n") */
+ CreateWordField(IRQB, 0x1, IRQN)
+ ShiftLeft(1, PIRG, IRQN)
+ Return(IRQB)
+ } /* Method(_SB.INTG._CRS) */
+
+ Method(_SRS, 1) {
+ /* DBGO("\\_SB\\LNKG\\_CRS\n") */
+ CreateWordField(ARG0, 1, IRQM)
+
+ /* Use lowest available IRQ */
+ FindSetRightBit(IRQM, Local0)
+ if (Local0) {
+ Decrement(Local0)
+ }
+ Store(Local0, PIRG)
+ } /* End Method(_SB.INTG._SRS) */
+ } /* End Device(INTG) */
+
+ Device(INTH) {
+ Name(_HID, EISAID("PNP0C0F"))
+ Name(_UID, 8)
+
+ Method(_STA, 0) {
+ if (PIRH) {
+ Return(0x0b) /* sata is invisible */
+ } else {
+ Return(0x09) /* sata is disabled */
+ }
+ } /* End Method(_SB.INTH._STA) */
+
+ Method(_DIS ,0) {
+ /* DBGO("\\_SB\\LNKH\\_DIS\n") */
+ } /* End Method(_SB.INTH._DIS) */
+
+ Method(_PRS ,0) {
+ /* DBGO("\\_SB\\LNKH\\_PRS\n") */
+ Return(IRQP)
+ } /* Method(_SB.INTH._CRS) */
+
+ Method(_CRS ,0) {
+ /* DBGO("\\_SB\\LNKH\\_CRS\n") */
+ CreateWordField(IRQB, 0x1, IRQN)
+ ShiftLeft(1, PIRH, IRQN)
+ Return(IRQB)
+ } /* Method(_SB.INTH._CRS) */
+
+ Method(_SRS, 1) {
+ /* DBGO("\\_SB\\LNKH\\_CRS\n") */
+ CreateWordField(ARG0, 1, IRQM)
+
+ /* Use lowest available IRQ */
+ FindSetRightBit(IRQM, Local0)
+ if (Local0) {
+ Decrement(Local0)
+ }
+ Store(Local0, PIRH)
+ } /* End Method(_SB.INTH._SRS) */
+ } /* End Device(INTH) */
diff --git a/src/soc/amd/picasso/acpi/pcie.asl b/src/soc/amd/picasso/acpi/pcie.asl
new file mode 100644
index 0000000000..925187209c
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/pcie.asl
@@ -0,0 +1,99 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Sage Electronic Engineering, LLC
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+ /* PCI IRQ mapping registers, C00h-C01h. */
+ OperationRegion(PRQM, SystemIO, 0x00000c00, 0x00000002)
+ Field(PRQM, ByteAcc, NoLock, Preserve) {
+ PRQI, 0x00000008,
+ PRQD, 0x00000008, /* Offset: 1h */
+ }
+ IndexField(PRQI, PRQD, ByteAcc, NoLock, Preserve) {
+ PIRA, 0x00000008, /* Index 0 */
+ PIRB, 0x00000008, /* Index 1 */
+ PIRC, 0x00000008, /* Index 2 */
+ PIRD, 0x00000008, /* Index 3 */
+ PIRE, 0x00000008, /* Index 4 */
+ PIRF, 0x00000008, /* Index 5 */
+ PIRG, 0x00000008, /* Index 6 */
+ PIRH, 0x00000008, /* Index 7 */
+ }
+
+ /* PCI Error control register */
+ OperationRegion(PERC, SystemIO, 0x00000c14, 0x00000001)
+ Field(PERC, ByteAcc, NoLock, Preserve) {
+ SENS, 0x00000001,
+ PENS, 0x00000001,
+ SENE, 0x00000001,
+ PENE, 0x00000001,
+ }
+
+ /* Client Management index/data registers */
+ OperationRegion(CMT, SystemIO, 0x00000c50, 0x00000002)
+ Field(CMT, ByteAcc, NoLock, Preserve) {
+ CMTI, 8,
+ /* Client Management Data register */
+ G64E, 1,
+ G64O, 1,
+ G32O, 2,
+ , 2,
+ GPSL, 2,
+ }
+
+ /* GPM Port register */
+ OperationRegion(GPT, SystemIO, 0x00000c52, 0x00000001)
+ Field(GPT, ByteAcc, NoLock, Preserve) {
+ GPB0,1,
+ GPB1,1,
+ GPB2,1,
+ GPB3,1,
+ GPB4,1,
+ GPB5,1,
+ GPB6,1,
+ GPB7,1,
+ }
+
+ /* Flash ROM program enable register */
+ OperationRegion(FRE, SystemIO, 0x00000c6F, 0x00000001)
+ Field(FRE, ByteAcc, NoLock, Preserve) {
+ , 0x00000006,
+ FLRE, 0x00000001,
+ }
+
+ /* PM2 index/data registers */
+ OperationRegion(PM2R, SystemIO, 0x00000Cd0, 0x00000002)
+ Field(PM2R, ByteAcc, NoLock, Preserve) {
+ PM2I, 0x00000008,
+ PM2D, 0x00000008,
+ }
+
+ /* Power Management I/O registers, TODO:PMIO is quite different in SB800. */
+ OperationRegion(PIOR, SystemIO, 0x00000Cd6, 0x00000002)
+ Field(PIOR, ByteAcc, NoLock, Preserve) {
+ PIOI, 0x00000008,
+ PIOD, 0x00000008,
+ }
+
+ IndexField (PIOI, PIOD, ByteAcc, NoLock, Preserve) {
+ Offset(0x60), /* AcpiPm1EvgBlk */
+ P1EB, 16,
+ Offset(0xee),
+ UPWS, 3,
+ }
+ OperationRegion (P1E0, SystemIO, P1EB, 0x04)
+ Field (P1E0, ByteAcc, Nolock, Preserve) {
+ Offset(0x02),
+ , 14,
+ PEWD, 1,
+ }
diff --git a/src/soc/amd/picasso/acpi/sb_fch.asl b/src/soc/amd/picasso/acpi/sb_fch.asl
new file mode 100644
index 0000000000..e7975f8d94
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/sb_fch.asl
@@ -0,0 +1,153 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015-2016 Advanced Micro Devices, Inc.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+
+Device (AAHB)
+{
+ Name (_HID, "AAHB0000")
+ Name (_UID, 0x0)
+ Name (_CRS, ResourceTemplate()
+ {
+ Memory32Fixed (ReadWrite, ALINK_AHB_ADDRESS, 0x2000)
+ })
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
+
+Device (GPIO)
+{
+ Name (_HID, GPIO_DEVICE_NAME)
+ Name (_CID, GPIO_DEVICE_NAME)
+ Name (_UID, 0)
+ Name (_DDN, GPIO_DEVICE_DESC)
+
+ Name (_CRS, ResourceTemplate()
+ {
+ Interrupt (ResourceConsumer, Level, ActiveLow, Shared, , , )
+ { 7 }
+ Memory32Fixed (ReadWrite, 0xFED81500, 0x300)
+ })
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
+
+Device (FUR0)
+{
+ Name (_HID, "AMD0020")
+ Name (_UID, 0x0)
+ Name (_CRS, ResourceTemplate()
+ {
+ IRQ (Edge, ActiveHigh, Exclusive) { 10 }
+ Memory32Fixed (ReadWrite, 0xFEDC6000, 0x2000)
+ })
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
+
+Device (FUR1) {
+ Name (_HID, "AMD0020")
+ Name (_UID, 0x1)
+ Name (_CRS, ResourceTemplate()
+ {
+ IRQ (Edge, ActiveHigh, Exclusive) { 11 }
+ Memory32Fixed (ReadWrite, 0xFEDC8000, 0x2000)
+ })
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
+
+Device (I2CA) {
+ Name (_HID, "AMD0010")
+ Name (_UID, 0x0)
+ Name (_CRS, ResourceTemplate()
+ {
+ IRQ (Edge, ActiveHigh, Exclusive) { 3 }
+ Memory32Fixed (ReadWrite, 0xFEDC2000, 0x1000)
+ })
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
+
+Device (I2CB)
+{
+ Name (_HID, "AMD0010")
+ Name (_UID, 0x1)
+ Name (_CRS, ResourceTemplate()
+ {
+ IRQ (Edge, ActiveHigh, Exclusive) { 15 }
+ Memory32Fixed (ReadWrite, 0xFEDC3000, 0x1000)
+ })
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
+
+Device (I2CC) {
+ Name (_HID, "AMD0010")
+ Name (_UID, 0x2)
+ Name (_CRS, ResourceTemplate()
+ {
+ IRQ (Edge, ActiveHigh, Exclusive) { 6 }
+ Memory32Fixed (ReadWrite, 0xFEDC4000, 0x1000)
+ })
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
+
+Device (I2CD)
+{
+ Name (_HID, "AMD0010")
+ Name (_UID, 0x3)
+ Name (_CRS, ResourceTemplate() {
+ IRQ (Edge, ActiveHigh, Exclusive) { 14 }
+ Memory32Fixed(ReadWrite, 0xFEDC5000, 0x1000)
+ })
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
+
+Device (MISC)
+{
+ Name (_HID, "AMD0040")
+ Name (_UID, 0x3)
+ Name (_CRS, ResourceTemplate() {
+ Memory32Fixed(ReadWrite, ACPIMMIO_MISC_BASE, 0x100)
+ })
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+}
diff --git a/src/soc/amd/picasso/acpi/sb_pci0_fch.asl b/src/soc/amd/picasso/acpi/sb_pci0_fch.asl
new file mode 100644
index 0000000000..206fdfd0e1
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/sb_pci0_fch.asl
@@ -0,0 +1,532 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Advanced Micro Devices, Inc.
+ * Copyright (C) 2013 Sage Electronic Engineering, LLC
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+External(\_SB.ALIB, MethodObj)
+
+/* System Bus */
+/* _SB.PCI0 */
+
+/* Operating System Capabilities Method */
+Method(_OSC,4)
+{
+ /* Check for proper PCI/PCIe UUID */
+ If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766")))
+ {
+ /* Let OS control everything */
+ Return (Arg3)
+ } Else {
+ CreateDWordField(Arg3,0,CDW1)
+ Or(CDW1,4,CDW1) // Unrecognized UUID
+ Return(Arg3)
+ }
+}
+
+/* Describe the Southbridge devices */
+
+/* 0:11.0 - SATA */
+Device(STCR) {
+ Name(_ADR, 0x00110000)
+} /* end STCR */
+
+/* 0:14.0 - SMBUS */
+Device(SBUS) {
+ Name(_ADR, 0x00140000)
+} /* end SBUS */
+
+#include "usb.asl"
+
+/* 0:14.2 - I2S Audio */
+
+/* 0:14.3 - LPC */
+#include
+
+Name(CRES, ResourceTemplate() {
+ /* Set the Bus number and Secondary Bus number for the PCI0 device
+ * The Secondary bus range for PCI0 lets the system
+ * know what bus values are allowed on the downstream
+ * side of this PCI bus if there is a PCI-PCI bridge.
+ * PCI busses can have 256 secondary busses which
+ * range from [0-0xFF] but they do not need to be
+ * sequential.
+ */
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ 0x0000, /* address granularity */
+ 0x0000, /* range minimum */
+ 0x00ff, /* range maximum */
+ 0x0000, /* translation */
+ 0x0100, /* length */
+ ,, PSB0) /* ResourceSourceIndex, ResourceSource, DescriptorName */
+
+ IO(Decode16, 0x0cf8, 0x0cf8, 1, 8)
+
+ WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000, /* address granularity */
+ 0x0000, /* range minimum */
+ 0x0cf7, /* range maximum */
+ 0x0000, /* translation */
+ 0x0cf8 /* length */
+ )
+ WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000, /* address granularity */
+ 0x03b0, /* range minimum */
+ 0x03df, /* range maximum */
+ 0x0000, /* translation */
+ 0x0030 /* length */
+ )
+
+ WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000, /* address granularity */
+ 0x0d00, /* range minimum */
+ 0xffff, /* range maximum */
+ 0x0000, /* translation */
+ 0xf300 /* length */
+ )
+
+ Memory32Fixed(READONLY, 0x000a0000, 0x00020000, VGAM) /* VGA memory space */
+ Memory32Fixed(READONLY, 0x000c0000, 0x00020000, EMM1) /* Assume C0000-E0000 empty */
+
+ /* memory space for PCI BARs below 4GB */
+ Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, MMIO)
+}) /* End Name(_SB.PCI0.CRES) */
+
+Method(_CRS, 0) {
+ /* DBGO("\\_SB\\PCI0\\_CRS\n") */
+ CreateDWordField(CRES, ^MMIO._BAS, MM1B)
+ CreateDWordField(CRES, ^MMIO._LEN, MM1L)
+
+ /*
+ * Declare memory between TOM1 and 4GB as available
+ * for PCI MMIO.
+ * Use ShiftLeft to avoid 64bit constant (for XP).
+ * This will work even if the OS does 32bit arithmetic, as
+ * 32bit (0x00000000 - TOM1) will wrap and give the same
+ * result as 64bit (0x100000000 - TOM1).
+ */
+ Store(TOM1, MM1B)
+ ShiftLeft(0x10000000, 4, Local0)
+ Subtract(Local0, TOM1, Local0)
+ Store(Local0, MM1L)
+
+ Return(CRES) /* note to change the Name buffer */
+} /* end of Method(_SB.PCI0._CRS) */
+
+/*
+ *
+ * FIRST METHOD CALLED UPON BOOT
+ *
+ * 1. If debugging, print current OS and ACPI interpreter.
+ * 2. Get PCI Interrupt routing from ACPI VSM, this
+ * value is based on user choice in BIOS setup.
+ */
+Method(_INI, 0, Serialized) {
+ /* DBGO("\\_SB\\_INI\n") */
+ /* DBGO(" DSDT.ASL code from ") */
+ /* DBGO(__DATE__) */
+ /* DBGO(" ") */
+ /* DBGO(__TIME__) */
+ /* DBGO("\n Sleep states supported: ") */
+ /* DBGO("\n") */
+ /* DBGO(" \\_OS=") */
+ /* DBGO(\_OS) */
+ /* DBGO("\n \\_REV=") */
+ /* DBGO(\_REV) */
+ /* DBGO("\n") */
+
+ /* Determine the OS we're running on */
+ OSFL()
+
+ /* Send ALIB Function 1 the AC/DC state */
+ Name(F1BF, Buffer(0x03){})
+ CreateWordField(F1BF, 0, F1SZ)
+ CreateByteField(F1BF, 2, F1DA)
+
+ Store(3, F1SZ)
+ Store(\PWRS, F1DA)
+
+ \_SB.ALIB(1, F1BF)
+
+} /* End Method(_SB._INI) */
+
+Method(OSFL, 0){
+
+ if (LNotEqual(OSVR, Ones)) {Return(OSVR)} /* OS version was already detected */
+
+ if (CondRefOf(\_OSI))
+ {
+ Store(1, OSVR) /* Assume some form of XP */
+ if (\_OSI("Windows 2006")) /* Vista */
+ {
+ Store(2, OSVR)
+ }
+ } else {
+ If(WCMP(\_OS,"Linux")) {
+ Store(3, OSVR) /* Linux */
+ } Else {
+ Store(4, OSVR) /* Gotta be WinCE */
+ }
+ }
+ Return(OSVR)
+}
+
+OperationRegion(SMIC, SystemMemory, 0xfed80000, 0x80000)
+Field( SMIC, ByteAcc, NoLock, Preserve) {
+ /* MISC registers */
+ offset (0x03ee),
+ U3PS, 2, /* Usb3PowerSel */
+
+ offset (0x0e28),
+ ,29 ,
+ SARP, 1, /* Sata Ref Clock Powerdown */
+ U2RP, 1, /* Usb2 Ref Clock Powerdown */
+ U3RP, 1, /* Usb3 Ref Clock Powerdown */
+
+ /* AOAC Registers */
+ offset (0x1e4a), /* I2C0 D3 Control */
+ I0TD, 2,
+ , 1,
+ I0PD, 1,
+ offset (0x1e4b), /* I2C0 D3 State */
+ I0DS, 3,
+
+ offset (0x1e4c), /* I2C1 D3 Control */
+ I1TD, 2,
+ , 1,
+ I1PD, 1,
+ offset (0x1e4d), /* I2C1 D3 State */
+ I1DS, 3,
+
+ offset (0x1e4e), /* I2C2 D3 Control */
+ I2TD, 2,
+ , 1,
+ I2PD, 1,
+ offset (0x1e4f), /* I2C2 D3 State */
+ I2DS, 3,
+
+ offset (0x1e50), /* I2C3 D3 Control */
+ I3TD, 2,
+ , 1,
+ I3PD, 1,
+ offset (0x1e51), /* I2C3 D3 State */
+ I3DS, 3,
+
+ offset (0x1e56), /* UART0 D3 Control */
+ U0TD, 2,
+ , 1,
+ U0PD, 1,
+ offset (0x1e57), /* UART0 D3 State */
+ U0DS, 3,
+
+ offset (0x1e58), /* UART1 D3 Control */
+ U1TD, 2,
+ , 1,
+ U1PD, 1,
+ offset (0x1e59), /* UART1 D3 State */
+ U1DS, 3,
+
+ offset (0x1e5e), /* SATA D3 Control */
+ SATD, 2,
+ , 1,
+ SAPD, 1,
+ offset (0x1e5f), /* SATA D3 State */
+ SADS, 3,
+
+ offset (0x1e64), /* USB2 D3 Control */
+ U2TD, 2,
+ , 1,
+ U2PD, 1,
+ offset (0x1e65), /* USB2 D3 State */
+ U2DS, 3,
+
+ offset (0x1e6e), /* USB3 D3 Control */
+ U3TD, 2,
+ , 1,
+ U3PD, 1,
+ offset (0x1e6f), /* USB3 D3 State */
+ U3DS, 3,
+
+ offset (0x1e71), /* SD D3 State */
+ SDDS, 3,
+
+ offset (0x1e80), /* Shadow Register Request */
+ , 15,
+ RQ15, 1,
+ , 2,
+ RQ18, 1,
+ , 4,
+ RQ23, 1,
+ RQ24, 1,
+ , 5,
+ RQTY, 1,
+ offset (0x1e84), /* Shadow Register Status */
+ , 15,
+ SASR, 1, /* SATA 15 Shadow Reg Request Status Register */
+ , 2,
+ U2SR, 1, /* USB2 18 Shadow Reg Request Status Register */
+ , 4,
+ U3SR, 1, /* USB3 23 Shadow Reg Request Status Register */
+ SDSR, 1, /* SD 24 Shadow Reg Request Status Register */
+
+ offset (0x1ea0), /* PwrGood Control */
+ PG1A, 1,
+ PG2_, 1,
+ ,1,
+ U3PG, 1, /* Usb3 Power Good BIT3 */
+
+ offset (0x1ea3), /* PwrGood Control b[31:24] */
+ PGA3, 8 ,
+}
+
+OperationRegion(FCFG, SystemMemory, PCBA, 0x01000000)
+Field(FCFG, DwordAcc, NoLock, Preserve)
+{
+ /* XHCI */
+ Offset(0x00080010), /* Base address */
+ XHBA, 32,
+ Offset(0x0008002c), /* Subsystem ID / Vendor ID */
+ XH2C, 32,
+
+ Offset(0x00080048), /* Indirect PCI Index Register */
+ IDEX, 32,
+ DATA, 32,
+ Offset(0x00080054), /* PME Control / Status */
+ U_PS, 2,
+
+ /* EHCI */
+ Offset(0x00090004), /* Control */
+ , 1,
+ EHME, 1,
+ Offset(0x00090010), /* Base address */
+ EHBA, 32,
+ Offset(0x0009002c), /* Subsystem ID / Vendor ID */
+ EH2C, 32,
+ Offset(0x00090054), /* EHCI Spare 1 */
+ EH54, 8,
+ Offset(0x00090064), /* Misc Control 2 */
+ EH64, 8,
+
+ Offset(0x000900c4), /* PME Control / Status */
+ E_PS, 2,
+
+ /* LPC Bridge */
+ Offset(0x000a30cb), /* ClientRomProtect[31:24] */
+ , 7,
+ AUSS, 1, /* AutoSizeStart */
+}
+
+/*
+ * Arg0:device:
+ * 5=I2C0, 6=I2C1, 7=I2C2, 8=I2C3, 11=UART0, 12=UART1,
+ * 15=SATA, 18=EHCI, 23=xHCI, 24=SD
+ * Arg1:D-state
+ */
+Mutex (FDAS, 0) /* FCH Device AOAC Semophore */
+Method(FDDC, 2, Serialized)
+{
+ Acquire(FDAS, 0xffff)
+
+ if(LEqual(Arg1, 0)) {
+ Switch(ToInteger(Arg0)) {
+ Case(Package() {5, 15, 24}) {
+ Store(One, PG1A)
+ }
+ Case(Package() {6, 7, 8, 11, 12, 18}) {
+ Store(One, PG2_)
+ }
+ }
+ /* put device into D0 */
+ Switch(ToInteger(Arg0))
+ {
+ Case(5) {
+ Store(0x00, I0TD)
+ Store(One, I0PD)
+ Store(I0DS, Local0)
+ while(LNotEqual(Local0,0x7)) {
+ Store(I0DS, Local0)
+ }
+ }
+ Case(6) {
+ Store(0x00, I1TD)
+ Store(One, I1PD)
+ Store(I1DS, Local0)
+ while(LNotEqual(Local0,0x7)) {
+ Store(I1DS, Local0)
+ }
+ }
+ Case(7) {
+ Store(0x00, I2TD)
+ Store(One, I2PD)
+ Store(I2DS, Local0)
+ while(LNotEqual(Local0,0x7)) {
+ Store(I2DS, Local0)
+ }
+ }
+ Case(8) {Store(0x00, I3TD)
+ Store(One, I3PD)
+ Store(I3DS, Local0)
+ while(LNotEqual(Local0,0x7)) {
+ Store(I3DS, Local0)
+ }
+ }
+ Case(11) {
+ Store(0x00, U0TD)
+ Store(One, U0PD)
+ Store(U0DS, Local0)
+ while(LNotEqual(Local0,0x7)) {
+ Store(U0DS, Local0)
+ }
+ }
+ Case(12) {
+ Store(0x00, U1TD)
+ Store(One, U1PD)
+ Store(U1DS, Local0)
+ while(LNotEqual(Local0,0x7)) {
+ Store(U1DS, Local0)
+ }
+ }
+/* todo Case(15) { STD0()} */ /* SATA */
+ }
+ } else {
+ /* put device into D3cold */
+ Switch(ToInteger(Arg0))
+ {
+ Case(5) {
+ Store(Zero, I0PD)
+ Store(I0DS, Local0)
+ while(LNotEqual(Local0,0x0)) {
+ Store(I0DS, Local0)
+ }
+ Store(0x03, I0TD)
+ }
+ Case(6) {
+ Store(Zero, I1PD)
+ Store(I1DS, Local0)
+ while(LNotEqual(Local0,0x0)) {
+ Store(I1DS, Local0)
+ }
+ Store(0x03, I1TD)
+ }
+ Case(7) {
+ Store(Zero, I2PD)
+ Store(I2DS, Local0)
+ while(LNotEqual(Local0,0x0)) {
+ Store(I2DS, Local0)
+ }
+ Store(0x03, I2TD)}
+ Case(8) {
+ Store(Zero, I3PD)
+ Store(I3DS, Local0)
+ while(LNotEqual(Local0,0x0)) {
+ Store(I3DS, Local0)
+ }
+ Store(0x03, I3TD)
+ }
+ Case(11) {
+ Store(Zero, U0PD)
+ Store(U0DS, Local0)
+ while(LNotEqual(Local0,0x0)) {
+ Store(U0DS, Local0)
+ }
+ Store(0x03, U0TD)
+ }
+ Case(12) {
+ Store(Zero, U1PD)
+ Store(U1DS, Local0)
+ while(LNotEqual(Local0,0x0)) {
+ Store(U1DS, Local0)
+ }
+ Store(0x03, U1TD)
+ }
+/* todo Case(15) { STD3()} */ /* SATA */
+ }
+ if(LEqual(I1TD, 3)) {
+ if(LEqual(I2TD, 3)) {
+ if(LEqual(I3TD, 3)) {
+ if(LEqual(U0TD, 3)) {
+ if(LEqual(U1TD, 3)) {
+ if(LEqual(U2TD, 3)) {
+ Store(Zero, PG2_)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ Release(FDAS)
+}
+
+Method(FPTS,0, Serialized) /* FCH _PTS */
+{
+}
+
+Method(FWAK,0, Serialized) /* FCH _WAK */
+{
+ if(LEqual(\UT0E, zero)) {
+ if(LNotEqual(U0TD, 0x03)) {
+ FDDC(11, 3)
+ }
+ }
+ if(LEqual(\UT1E, zero)) {
+ if(LNotEqual(U1TD, 0x03)) {
+ FDDC(12, 3)
+ }
+ }
+ if(LEqual(\IC0E, zero)) {
+ if(LNotEqual(I0TD, 0x03)) {
+ FDDC(5, 3)
+ }
+ }
+ if(LEqual(\IC1E, zero)) {
+ if(LNotEqual(I1TD, 0x03)) {
+ FDDC(6, 3)
+ }
+ }
+ if(LEqual(\IC2E, zero)) {
+ if(LNotEqual(I2TD, 0x03)) {
+ FDDC(7, 3)
+ }
+ }
+ if(LEqual(\IC3E, zero)) {
+ if(LNotEqual(I3TD, 0x03)) {
+ FDDC(8, 3)
+ }
+ }
+}
+
+/*
+ * Helper for setting a bit in AOACxA0 PwrGood Control
+ * Arg0: bit to set or clear
+ * Arg1: 0 = clear bit[Arg0], non-zero = set bit[Arg0]
+ */
+Method(PWGC,2, Serialized)
+{
+ And (PGA3, 0xdf, Local0) /* do SwUsb3SlpShutdown below */
+ if(Arg1) {
+ Or(Arg0, Local0, Local0)
+ } else {
+ Not(Arg0, Local1)
+ And(Local1, Local0, Local0)
+ }
+ Store(Local0, PGA3)
+ if(LEqual(Arg0, 0x20)) { /* if SwUsb3SlpShutdown */
+ Store(PGA3, Local0)
+ And(Arg0, Local0, Local0)
+ while(LNot(Local0)) { /* wait SwUsb3SlpShutdown to complete */
+ Store(PGA3, Local0)
+ And(Arg0, Local0, Local0)
+ }
+ }
+}
diff --git a/src/soc/amd/picasso/acpi/sleepstates.asl b/src/soc/amd/picasso/acpi/sleepstates.asl
new file mode 100644
index 0000000000..d4aabdb7af
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/sleepstates.asl
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/* S1 support: bit 0, S2 Support: bit 1, etc. S0 & S5 assumed */
+Name(SSFG, 0x09)
+If (CONFIG(HAVE_ACPI_RESUME)) {
+ Store(0x0D, SSFG)
+}
+
+/* Supported sleep states: */
+Name(\_S0, Package () {0x00, 0x00, 0x00, 0x00} ) /* (S0) - working state */
+
+If (And(SSFG, 0x01)) {
+ Name(\_S1, Package () {0x01, 0x01, 0x00, 0x00} ) /* (S1) - sleeping w/CPU context */
+}
+If (And(SSFG, 0x02)) {
+ Name(\_S2, Package () {0x02, 0x02, 0x00, 0x00} ) /* (S2) - "light" Suspend to RAM */
+}
+If (And(SSFG, 0x04)) {
+ Name(\_S3, Package () {0x03, 0x03, 0x00, 0x00} ) /* (S3) - Suspend to RAM */
+}
+If (And(SSFG, 0x08)) {
+ Name(\_S4, Package () {0x04, 0x04, 0x00, 0x00} ) /* (S4) - Suspend to Disk */
+}
+
+Name(\_S5, Package () {0x05, 0x05, 0x00, 0x00} ) /* (S5) - Soft Off */
diff --git a/src/soc/amd/picasso/acpi/soc.asl b/src/soc/amd/picasso/acpi/soc.asl
new file mode 100644
index 0000000000..52c7ee6c00
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/soc.asl
@@ -0,0 +1,31 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+Device(PCI0) {
+ /* Describe the AMD Northbridge */
+ #include "northbridge.asl"
+
+ /* Describe the AMD Fusion Controller Hub */
+ #include "sb_pci0_fch.asl"
+}
+
+/* Describe PCI INT[A-H] for the Southbridge */
+#include "pci_int.asl"
+
+/* Describe the devices in the Southbridge */
+#include "sb_fch.asl"
+
+/* Add GPIO library */
+#include
diff --git a/src/soc/amd/picasso/acpi/usb.asl b/src/soc/amd/picasso/acpi/usb.asl
new file mode 100644
index 0000000000..2af0c1a794
--- /dev/null
+++ b/src/soc/amd/picasso/acpi/usb.asl
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ *
+ * 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; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/* 0:12.0 - EHCI */
+Device(EHC0) {
+ Name(_ADR, 0x00120000)
+ Name(_PRW, Package() { 0xb, 3 })
+ Device (RHUB) {
+ Name (_ADR, Zero)
+ Device (HS01) { Name (_ADR, 1) }
+ Device (HS02) { Name (_ADR, 2) }
+ Device (HS03) { Name (_ADR, 3) }
+ Device (HS04) { Name (_ADR, 4) }
+ Device (HS05) { Name (_ADR, 5) }
+ Device (HS06) { Name (_ADR, 6) }
+ Device (HS07) { Name (_ADR, 7) }
+ Device (HS08) { Name (_ADR, 8) }
+ }
+
+ Method(_S0W,0) {
+ Return(0)
+ }
+
+ Method(_S3W,0) {
+ Return(4)
+ }
+
+ Method(_S4W,0) {
+ Return(4)
+ }
+} /* end EHC0 */
+
+
+/* 0:10.0 - XHCI 0*/
+Device(XHC0) {
+ Name(_ADR, 0x00100000)
+ Name(_PRW, Package() { 0xb, 3 })
+ Device (SS01) { Name (_ADR, 1) }
+ Device (SS02) { Name (_ADR, 2) }
+ Device (SS03) { Name (_ADR, 3) }
+
+ Method(_S0W,0) {
+ Return(0)
+ }
+
+ Method(_S3W,0) {
+ Return(4)
+ }
+
+ Method(_S4W,0) {
+ Return(4)
+ }
+
+} /* end XHC0 */
diff --git a/src/soc/amd/picasso/bootblock/bootblock.c b/src/soc/amd/picasso/bootblock/bootblock.c
new file mode 100644
index 0000000000..62e4e1589f
--- /dev/null
+++ b/src/soc/amd/picasso/bootblock/bootblock.c
@@ -0,0 +1,19 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+
+asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
+{
+ /* This function is here for building/linking only */
+}
diff --git a/src/soc/amd/picasso/cache_as_ram.S b/src/soc/amd/picasso/cache_as_ram.S
new file mode 100644
index 0000000000..28690628d6
--- /dev/null
+++ b/src/soc/amd/picasso/cache_as_ram.S
@@ -0,0 +1,20 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * TODO: This is a dummy file for making bootblock build and link. At some
+ * point, this should be removed from picasso since bootblock is
+ * ignored.
+ */
+.global bootblock_pre_c_entry
+bootblock_pre_c_entry:
diff --git a/src/soc/amd/picasso/chip.c b/src/soc/amd/picasso/chip.c
new file mode 100644
index 0000000000..65d98b127d
--- /dev/null
+++ b/src/soc/amd/picasso/chip.c
@@ -0,0 +1,147 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Advanced Micro Devices, Inc.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "chip.h"
+
+/* Supplied by i2c.c */
+extern struct device_operations picasso_i2c_mmio_ops;
+extern const char *i2c_acpi_name(const struct device *dev);
+
+struct device_operations cpu_bus_ops = {
+ .read_resources = DEVICE_NOOP,
+ .set_resources = DEVICE_NOOP,
+ .enable_resources = DEVICE_NOOP,
+ .init = picasso_init_cpus,
+ .acpi_fill_ssdt_generator = generate_cpu_entries,
+};
+
+const char *soc_acpi_name(const struct device *dev)
+{
+ if (dev->path.type == DEVICE_PATH_DOMAIN)
+ return "PCI0";
+
+ if (dev->path.type == DEVICE_PATH_USB) {
+ switch (dev->path.usb.port_type) {
+ case 0:
+ /* Root Hub */
+ return "RHUB";
+ case 2:
+ /* USB2 ports */
+ switch (dev->path.usb.port_id) {
+ case 0: return "HS01";
+ case 1: return "HS02";
+ case 2: return "HS03";
+ case 3: return "HS04";
+ case 4: return "HS05";
+ case 5: return "HS06";
+ case 6: return "HS07";
+ case 7: return "HS08";
+ }
+ break;
+ case 3:
+ /* USB3 ports */
+ switch (dev->path.usb.port_id) {
+ case 0: return "SS01";
+ case 1: return "SS02";
+ case 2: return "SS03";
+ }
+ break;
+ }
+ return NULL;
+ }
+
+ if (dev->path.type != DEVICE_PATH_PCI)
+ return NULL;
+
+ switch (dev->path.pci.devfn) {
+ case GFX_DEVFN:
+ return "IGFX";
+ case PCIE0_DEVFN:
+ return "PBR4";
+ case PCIE1_DEVFN:
+ return "PBR5";
+ case PCIE2_DEVFN:
+ return "PBR6";
+ case PCIE3_DEVFN:
+ return "PBR7";
+ case PCIE4_DEVFN:
+ return "PBR8";
+ case HDA1_DEVFN:
+ return "AZHD";
+ case LPC_DEVFN:
+ return "LPCB";
+ case SATA_DEVFN:
+ return "STCR";
+ case SMBUS_DEVFN:
+ return "SBUS";
+ case XHCI0_DEVFN:
+ return "XHC0";
+ case XHCI1_DEVFN:
+ return "XHC1";
+ default:
+ return NULL;
+ }
+};
+
+struct device_operations pci_domain_ops = {
+ .read_resources = pci_domain_read_resources,
+ .set_resources = domain_set_resources,
+ .scan_bus = pci_domain_scan_bus,
+ .acpi_name = soc_acpi_name,
+};
+
+static void enable_dev(struct device *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;
+ else if (dev->path.type == DEVICE_PATH_PCI)
+ sb_enable(dev);
+ else if (dev->path.type == DEVICE_PATH_MMIO)
+ if (i2c_acpi_name(dev) != NULL)
+ dev->ops = &picasso_i2c_mmio_ops;
+}
+
+static void soc_init(void *chip_info)
+{
+ southbridge_init(chip_info);
+ setup_bsp_ramtop();
+}
+
+static void soc_final(void *chip_info)
+{
+ southbridge_final(chip_info);
+}
+
+struct chip_operations soc_amd_picasso_ops = {
+ CHIP_NAME("AMD Picasso SOC")
+ .enable_dev = enable_dev,
+ .init = soc_init,
+ .final = soc_final
+};
diff --git a/src/soc/amd/picasso/chip.h b/src/soc/amd/picasso/chip.h
new file mode 100644
index 0000000000..39c70269da
--- /dev/null
+++ b/src/soc/amd/picasso/chip.h
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2010-2017 Advanced Micro Devices, Inc.
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __PICASSO_CHIP_H__
+#define __PICASSO_CHIP_H__
+
+#include