Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14252
-gerrit
commit 77cd573add4f354967ae78473cc8f2f5df6f3a72
Author: Hannah Williams <hannah.williams(a)intel.com>
Date: Mon Mar 14 17:38:51 2016 -0700
soc/intel/apollolake: Enable CACHE_MRC_SETTINGS
Change-Id: I0248001892ef763c39097848b5adc8c1befed1f0
Signed-off-by: Hannah Williams <hannah.williams(a)intel.com>
---
src/soc/intel/apollolake/Kconfig | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index 30ee7e5..c911338 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -100,4 +100,8 @@ config ROMSTAGE_ADDR
help
The base address (in CAR) where romstage should be linked
+config CACHE_MRC_SETTINGS
+ bool
+ default y
+
endif
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14247
-gerrit
commit 5e382119808080a0e42b379940f0519da6298504
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Thu Mar 3 10:58:30 2016 -0800
soc/intel/common/nvm: Allow overriding to_flash_offset() function
On apollolake, the flash is memory-mapped differently, and the default
MMIO to flash calculation does not produce correct results. While the
long-term solution is to rewrite the NVM functionality to keep the
flash offset as part of its context, as a temporary measure, allow
overriding the to_flash_offset() function by declaring it weak.
Change-Id: Ic54baeba2441a08cfe1a47e235747797f6efb59b
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/soc/intel/common/nvm.c | 22 +++++++++++++++++-----
src/soc/intel/common/nvm.h | 3 +++
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/soc/intel/common/nvm.c b/src/soc/intel/common/nvm.c
index fe73408..3e8ca4f 100644
--- a/src/soc/intel/common/nvm.c
+++ b/src/soc/intel/common/nvm.c
@@ -46,8 +46,20 @@ static int nvm_init(void)
return 0;
}
-/* Convert memory mapped pointer to flash offset. */
-static inline uint32_t to_flash_offset(void *p)
+/*
+ * Convert memory mapped pointer to flash offset.
+ *
+ * This is weak because not every platforms memory-maps the NVM media in the
+ * same manner. This is a stop-gap solution.
+ *
+ * The root of the problem is that users of this API work in memory space for
+ * both reads and writes, but erase and write must be done in flash space. This
+ * also only works when the media is memory-mapped, which is no longer
+ * universally true. The long-term approach should be to rewrite this and its
+ * users to work in flash space, while using rdev_read() instead of rdev_mmap().
+ */
+__attribute__((weak))
+uint32_t nvm_mmio_to_flash_offset(void *p)
{
return CONFIG_ROM_SIZE + (uintptr_t)p;
}
@@ -70,7 +82,7 @@ int nvm_erase(void *start, size_t size)
{
if (nvm_init() < 0)
return -1;
- return flash->erase(flash, to_flash_offset(start), size);
+ return flash->erase(flash, nvm_mmio_to_flash_offset(start), size);
}
/* Write data to NVM. Returns 0 on success < 0 on error. */
@@ -78,7 +90,7 @@ int nvm_write(void *start, const void *data, size_t size)
{
if (nvm_init() < 0)
return -1;
- return flash->write(flash, to_flash_offset(start), size, data);
+ return flash->write(flash, nvm_mmio_to_flash_offset(start), size, data);
}
/* Read flash status register to determine if write protect is active */
@@ -115,7 +127,7 @@ int nvm_protect(void *start, size_t size)
#if IS_ENABLED(CONFIG_MRC_SETTINGS_PROTECT)
if (nvm_init() < 0)
return -1;
- return spi_flash_protect(to_flash_offset(start), size);
+ return spi_flash_protect(nvm_media_mmio_to_flash_offset(start), size);
#else
return -1;
#endif
diff --git a/src/soc/intel/common/nvm.h b/src/soc/intel/common/nvm.h
index feae5c3..074a2ce 100644
--- a/src/soc/intel/common/nvm.h
+++ b/src/soc/intel/common/nvm.h
@@ -33,4 +33,7 @@ int nvm_is_write_protected(void);
/* Apply protection to a range of flash */
int nvm_protect(void *start, size_t size);
+/* Map MMIO address to actual address in flash */
+uint32_t nvm_mmio_to_flash_offset(void *p);
+
#endif /* _COMMON_NVM_H_ */
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13375
-gerrit
commit ba9895795d84981af9b81978206e226feecbae38
Author: Lance Zhao <lijian.zhao(a)intel.com>
Date: Mon Nov 16 18:13:23 2015 -0800
soc/apollolake/acpi: Fill ACPI MCFG table
ACPI MCFG table is required for OS to support Enhanced
Configuration Space Access.Apollolake will only support
1 PCI Segment Group, so all the pci bus number from 0
to 0xff will belong to that group.
Change-Id: I3a680eb9c83290cd531159d7e796382a132cd283
Signed-off-by: Lance Zhao <lijian.zhao(a)intel.com>
---
src/soc/intel/apollolake/acpi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/soc/intel/apollolake/acpi.c b/src/soc/intel/apollolake/acpi.c
index 5fd2b74..3677477 100644
--- a/src/soc/intel/apollolake/acpi.c
+++ b/src/soc/intel/apollolake/acpi.c
@@ -18,6 +18,10 @@
unsigned long acpi_fill_mcfg(unsigned long current)
{
+ /* PCI Segment Group 0, Start Bus Number 0, End Bus Number is 255 */
+ current += acpi_create_mcfg_mmconfig((void *) current,
+ CONFIG_MMCONF_BASE_ADDRESS, 0, 0,
+ 255);
return current;
}
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13356
-gerrit
commit ca7b92a8de2116c97405620bf2f1369323b8a5ad
Author: Lance Zhao <lijian.zhao(a)intel.com>
Date: Thu Nov 12 18:19:41 2015 -0800
soc/apollolake: Add lpc device driver
A dedicated pci device driver required for LPC devices as the legacy
IO range need to be included to avoid IO resource confilict. Blindly
set to 0~0x1000 to also avoid the IO resource of COMA/COMB/LPT/FDD
and LPC.Without this driver system will have assertion on load
RTC DXE driver in UEFI payloads.
Change-Id: Icc462c159c2cf39cc1030d55acee79e73a6bfb35
Signed-off-by: Lance Zhao <lijian.zhao(a)intel.com>
---
src/soc/intel/apollolake/Makefile.inc | 1 +
src/soc/intel/apollolake/lpc.c | 48 +++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/src/soc/intel/apollolake/Makefile.inc b/src/soc/intel/apollolake/Makefile.inc
index 70ab515..98db608 100644
--- a/src/soc/intel/apollolake/Makefile.inc
+++ b/src/soc/intel/apollolake/Makefile.inc
@@ -34,6 +34,7 @@ ramstage-y += chip.c
ramstage-y += placeholders.c
ramstage-y += gpio.c
ramstage-$(CONFIG_SOC_UART_DEBUG) += uart_early.c
+ramstage-y += lpc.c
ramstage-y += memmap.c
ramstage-y += mmap_boot.c
ramstage-y += uart.c
diff --git a/src/soc/intel/apollolake/lpc.c b/src/soc/intel/apollolake/lpc.c
new file mode 100644
index 0000000..abc5245
--- /dev/null
+++ b/src/soc/intel/apollolake/lpc.c
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ * (Written by Lance Zhao <lijian.zhao(a)intel.com> for Intel Corp.)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <soc/pci_ids.h>
+
+static void soc_lpc_add_io_resources(device_t dev)
+{
+ struct resource *res;
+
+ /* Add the default claimed legacy IO range for the LPC device. */
+ res = new_resource(dev, 0);
+ res->base = 0;
+ res->size = 0x1000;
+ res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+}
+
+static void soc_lpc_read_resources(device_t dev)
+{
+ /* Get the PCI resources of this device. */
+ pci_dev_read_resources(dev);
+
+ /* Add IO resources to LPC. */
+ soc_lpc_add_io_resources(dev);
+}
+
+static struct device_operations device_ops = {
+ .read_resources = &soc_lpc_read_resources,
+ .set_resources = &pci_dev_set_resources,
+ .enable_resources = &pci_dev_enable_resources,
+};
+
+static const struct pci_driver soc_lpc __pci_driver = {
+ .ops = &device_ops,
+ .vendor = PCI_VENDOR_ID_INTEL,
+ .device = PCI_DEVICE_ID_APOLLOLAKE_LPC,
+};