Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16211
-gerrit
commit cb84485c5762f0a0b24e0d11dbf9a219b5c04829
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Aug 12 15:00:10 2016 -0500
Kconfig: introduce writable boot device notion
Indicate to the build system that a platform provides support
for a writable boot device. The following will provide the
necessary support:
COMMON_CBFS_SPI_WRAPPER users
soc/intel/apollolake
soc/intel/baytrail
soc/intel/braswell
soc/intel/broadwell
soc/intel/skylake
The SPI_FLASH option is auto-selected if the platform provides
write supoprt for the boot device and SPI flash is the boot
device.
Other platforms may provide similar support, but they do that
in a device specific manner such as selecting SPI_FLASH
explicitly. This provides clearance against build failures
where chipsets don't provide SPI API implementations even
though the platform may use a SPI flash to boot.
BUG=chrome-os-partner:56151
Change-Id: If78160f231c8312a313f9b9753607d044345d274
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/Kconfig | 7 +++++++
src/drivers/spi/Kconfig | 3 ++-
src/soc/intel/apollolake/Kconfig | 1 +
src/soc/intel/baytrail/Kconfig | 1 +
src/soc/intel/braswell/Kconfig | 1 +
src/soc/intel/broadwell/Kconfig | 1 +
src/soc/intel/skylake/Kconfig | 1 +
7 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/Kconfig b/src/Kconfig
index fd98cc8..7db491f 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -482,6 +482,13 @@ config BOOT_DEVICE_MEMORY_MAPPED
help
Inform system if SPI is memory-mapped or not.
+config BOOT_DEVICE_SUPPORTS_WRITES
+ bool
+ default n
+ help
+ Indicate that the platform has writable boot device
+ support.
+
config RTC
bool
default n
diff --git a/src/drivers/spi/Kconfig b/src/drivers/spi/Kconfig
index 030fa6c..5eb9b56 100644
--- a/src/drivers/spi/Kconfig
+++ b/src/drivers/spi/Kconfig
@@ -18,12 +18,13 @@ config COMMON_CBFS_SPI_WRAPPER
default n
depends on !ARCH_X86
depends on BOOT_DEVICE_SPI_FLASH
+ select BOOT_DEVICE_SUPPORTS_WRITES
help
Use common wrapper to interface CBFS to SPI bootrom.
config SPI_FLASH
bool
- default y if BOOT_DEVICE_SPI_FLASH
+ default y if BOOT_DEVICE_SPI_FLASH && BOOT_DEVICE_SUPPORTS_WRITES
default n
help
Select this option if your chipset driver needs to store certain
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index dfc2d4a..0c7f27a 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -12,6 +12,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_RAMSTAGE_X86_32
select ARCH_ROMSTAGE_X86_32
select ARCH_VERSTAGE_X86_32
+ select BOOT_DEVICE_SUPPORTS_WRITES
# CPU specific options
select CPU_INTEL_FIRMWARE_INTERFACE_TABLE
select IOAPIC
diff --git a/src/soc/intel/baytrail/Kconfig b/src/soc/intel/baytrail/Kconfig
index b790008..4009785 100644
--- a/src/soc/intel/baytrail/Kconfig
+++ b/src/soc/intel/baytrail/Kconfig
@@ -12,6 +12,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_VERSTAGE_X86_32
select ARCH_ROMSTAGE_X86_32
select ARCH_RAMSTAGE_X86_32
+ select BOOT_DEVICE_SUPPORTS_WRITES
select CACHE_MRC_SETTINGS
select CPU_INTEL_TURBO_NOT_PACKAGE_SCOPED
select SUPPORT_CPU_UCODE_IN_CBFS
diff --git a/src/soc/intel/braswell/Kconfig b/src/soc/intel/braswell/Kconfig
index c652d96..b587988 100644
--- a/src/soc/intel/braswell/Kconfig
+++ b/src/soc/intel/braswell/Kconfig
@@ -12,6 +12,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_RAMSTAGE_X86_32
select ARCH_ROMSTAGE_X86_32
select ARCH_VERSTAGE_X86_32
+ select BOOT_DEVICE_SUPPORTS_WRITES
select CACHE_MRC_SETTINGS
select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM if RELOCATABLE_RAMSTAGE
select COLLECT_TIMESTAMPS
diff --git a/src/soc/intel/broadwell/Kconfig b/src/soc/intel/broadwell/Kconfig
index f8ec500..03934d2 100644
--- a/src/soc/intel/broadwell/Kconfig
+++ b/src/soc/intel/broadwell/Kconfig
@@ -12,6 +12,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_VERSTAGE_X86_32
select ARCH_ROMSTAGE_X86_32
select ARCH_RAMSTAGE_X86_32
+ select BOOT_DEVICE_SUPPORTS_WRITES
select CACHE_MRC_SETTINGS
select MRC_SETTINGS_PROTECT
select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM if RELOCATABLE_RAMSTAGE
diff --git a/src/soc/intel/skylake/Kconfig b/src/soc/intel/skylake/Kconfig
index 8c8b1b7..909dcec 100644
--- a/src/soc/intel/skylake/Kconfig
+++ b/src/soc/intel/skylake/Kconfig
@@ -13,6 +13,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_ROMSTAGE_X86_32
select ARCH_VERSTAGE_X86_32
select ACPI_NHLT
+ select BOOT_DEVICE_SUPPORTS_WRITES
select CACHE_MRC_SETTINGS
select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM if RELOCATABLE_RAMSTAGE
select C_ENVIRONMENT_BOOTBLOCK
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16194
-gerrit
commit 36de8ad76903186e186517a759a9266d15e4acd0
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Wed Aug 10 11:42:42 2016 -0500
lib/boot_device: add RW boot device construct
The current boot device usage assumes read-only semantics to
the boot device. Any time someone wants to write to the
boot device a device-specific API is invoked such as SPI flash.
Instead, provide a mechanism to retrieve an object that can
be used to perform writes to the boot device. On systems where
the implementations are symmetric these devices can be treated
one-in-the-same. However, for x86 systems with memory mapped SPI
the read-only boot device provides different operations.
BUG=chrome-os-partner:55932
Change-Id: I0af324824f9e1a8e897c2453c36e865b59c4e004
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/include/boot_device.h | 16 ++++++++++++++++
src/lib/boot_device.c | 24 ++++++++++++++++++------
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/src/include/boot_device.h b/src/include/boot_device.h
index 3964a95..cc70442 100644
--- a/src/include/boot_device.h
+++ b/src/include/boot_device.h
@@ -18,9 +18,18 @@
#include <commonlib/region.h>
+/*
+ * Please note that the read-only boot device may not be coherent with
+ * the read-write boot device. Thus, mixing mmap() and writeat() is
+ * most likely not to work so don't rely on such semantics.
+ */
+
/* Return the region_device for the read-only boot device. */
const struct region_device *boot_device_ro(void);
+/* Return the region_device for the read-write boot device. */
+const struct region_device *boot_device_rw(void);
+
/*
* Create a sub-region of the read-only boot device.
* Returns 0 on success, < 0 on error.
@@ -29,6 +38,13 @@ int boot_device_ro_subregion(const struct region *sub,
struct region_device *subrd);
/*
+ * Create a sub-region of the read-write boot device.
+ * Returns 0 on success, < 0 on error.
+ */
+int boot_device_rw_subregion(const struct region *sub,
+ struct region_device *subrd);
+
+/*
* Initialize the boot device. This may be called multiple times within
* a stage so boot device implementations should account for this behavior.
**/
diff --git a/src/lib/boot_device.c b/src/lib/boot_device.c
index 42fe5df..e7968f4 100644
--- a/src/lib/boot_device.c
+++ b/src/lib/boot_device.c
@@ -20,18 +20,30 @@ void __attribute__((weak)) boot_device_init(void)
/* Provide weak do-nothing init. */
}
+static int boot_device_subregion(const struct region *sub,
+ struct region_device *subrd,
+ const struct region_device *parent)
+{
+ if (parent == NULL)
+ return -1;
+
+ return rdev_chain(subrd, parent, region_offset(sub), region_sz(sub));
+}
+
int boot_device_ro_subregion(const struct region *sub,
struct region_device *subrd)
{
- const struct region_device *boot_dev;
-
/* Ensure boot device has been initialized at least once. */
boot_device_init();
- boot_dev = boot_device_ro();
+ return boot_device_subregion(sub, subrd, boot_device_ro());
+}
- if (boot_dev == NULL)
- return -1;
+int boot_device_rw_subregion(const struct region *sub,
+ struct region_device *subrd)
+{
+ /* Ensure boot device has been initialized at least once. */
+ boot_device_init();
- return rdev_chain(subrd, boot_dev, region_offset(sub), region_sz(sub));
+ return boot_device_subregion(sub, subrd, boot_device_rw());
}
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16195
-gerrit
commit c600065f729c76f6f1a1ec8c22c2f81c0416b745
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Aug 11 17:09:57 2016 -0500
soc/intel/apollolake: make SPI support early stages
Using malloc() in SPI code is unnecessary as there's only
one SPI device that the SoC support code handles: boot
device. Therefore, use CAR to for the storage to work around
the current limiations of the SPI API which expects one to
return pointers to objects that are writable.
BUG=chrome-os-partner:56151
Change-Id: If4f5484e27d68b2dd1b17a281cf0b760086850a7
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/soc/intel/apollolake/spi.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/src/soc/intel/apollolake/spi.c b/src/soc/intel/apollolake/spi.c
index 7b390bb..139d36c 100644
--- a/src/soc/intel/apollolake/spi.c
+++ b/src/soc/intel/apollolake/spi.c
@@ -17,6 +17,7 @@
#define __SIMPLE_DEVICE__
+#include <arch/early_variables.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
@@ -315,6 +316,9 @@ static int nuclear_spi_status(struct spi_flash *flash, uint8_t *reg)
return E_NOT_IMPLEMENTED;
}
+static struct spi_slave boot_spi CAR_GLOBAL;
+static struct spi_flash boot_flash CAR_GLOBAL;
+
/*
* We can't use FDOC and FDOD to read FLCOMP, as previous platforms did.
* For details see:
@@ -328,11 +332,7 @@ static struct spi_flash *nuclear_flash_probe(struct spi_slave *spi)
struct spi_flash *flash;
uint32_t flash_bits;
- flash = malloc(sizeof(*flash));
- if (!flash) {
- printk(BIOS_ERR, "%s(): Could not allocate memory\n", __func__);
- return NULL;
- }
+ flash = car_get_var_ptr(&boot_flash);
/*
* bytes = (bits + 1) / 8;
@@ -371,14 +371,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
if ((bus != 0) || (cs != 0))
return NULL;
- struct spi_slave *slave = malloc(sizeof(*slave));
-
- if (!slave) {
- printk(BIOS_ERR, "%s(): Could not allocate memory\n", __func__);
- return NULL;
- }
-
- memset(slave, 0, sizeof(*slave));
+ struct spi_slave *slave = car_get_var_ptr(&boot_spi);
slave->bus = bus;
slave->cs = cs;
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16206
-gerrit
commit 41eb74ec78798630c3b6183f4c82a3d6d5ea6a2b
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Aug 12 12:48:58 2016 -0500
vboot/vbnv_flash: make I/O connection agnostic
There's no need to be SPI specific w.r.t. how the flash is
connected. Therefore, use the RW boot device to write the
contents of VBNV. The erasable check was dropped because that
information isn't available. All regions should be aligned
accordingly on the platform for the underlying hardware
implementation. And once the VBNV region fills the erase
will fail.
BUG=chrome-os-partner:56151
Change-Id: I07fdc8613e0b3884e132a2f158ffeabeaa6da6ce
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/vboot/Kconfig | 3 +-
src/vboot/vbnv_flash.c | 82 +++++++++-----------------------------------------
2 files changed, 16 insertions(+), 69 deletions(-)
diff --git a/src/vboot/Kconfig b/src/vboot/Kconfig
index a008208..30d322e 100644
--- a/src/vboot/Kconfig
+++ b/src/vboot/Kconfig
@@ -29,7 +29,7 @@ config VBOOT_VBNV_CMOS
config VBOOT_VBNV_CMOS_BACKUP_TO_FLASH
bool "Back up Vboot non-volatile storage from CMOS to flash."
default n
- depends on VBOOT_VBNV_CMOS
+ depends on VBOOT_VBNV_CMOS && BOOT_DEVICE_SUPPORTS_WRITES
help
Vboot non-volatile storage data will be backed up from CMOS to flash
and restored from flash if the CMOS is invalid due to power loss.
@@ -42,6 +42,7 @@ config VBOOT_VBNV_EC
config VBOOT_VBNV_FLASH
def_bool n
+ depends on BOOT_DEVICE_SUPPORTS_WRITES
help
VBNV is stored in flash storage
diff --git a/src/vboot/vbnv_flash.c b/src/vboot/vbnv_flash.c
index 717ff23..d061228 100644
--- a/src/vboot/vbnv_flash.c
+++ b/src/vboot/vbnv_flash.c
@@ -17,7 +17,6 @@
#include <assert.h>
#include <commonlib/region.h>
#include <console/console.h>
-#include <spi_flash.h>
#include <string.h>
#include <vb2_api.h>
#include <vboot_nvstorage.h>
@@ -31,17 +30,14 @@ struct vbnv_flash_ctx {
/* VBNV flash is initialized */
int initialized;
- /* Offset of the current nvdata in SPI flash */
+ /* Offset of the current nvdata in flash */
int blob_offset;
- /* Offset of the topmost nvdata blob in SPI flash */
+ /* Offset of the topmost nvdata blob in flash */
int top_offset;
- /* SPI flash handler used when saving data */
- struct spi_flash *flash;
-
- /* FMAP descriptor of the NVRAM area */
- struct region_device region;
+ /* Region to store and retrieve the VBNV contents. */
+ struct region_device vbnv_dev;
/* Cache of the current nvdata */
uint8_t cache[BLOB_SIZE];
@@ -66,13 +62,14 @@ static inline int can_overwrite(uint8_t current, uint8_t new)
static int init_vbnv(void)
{
struct vbnv_flash_ctx *ctx = car_get_var_ptr(&vbnv_flash);
+ struct region_device *rdev = &ctx->vbnv_dev;
uint8_t buf[BLOB_SIZE];
uint8_t empty_blob[BLOB_SIZE];
int offset;
int i;
- if (vboot_named_region_device("RW_NVRAM", &ctx->region) ||
- region_device_sz(&ctx->region) < BLOB_SIZE) {
+ if (vboot_named_region_device_rw("RW_NVRAM", rdev) ||
+ region_device_sz(rdev) < BLOB_SIZE) {
printk(BIOS_ERR, "%s: failed to locate NVRAM\n", __func__);
return 1;
}
@@ -82,7 +79,7 @@ static int init_vbnv(void)
empty_blob[i] = erase_value();
offset = 0;
- ctx->top_offset = region_device_sz(&ctx->region) - BLOB_SIZE;
+ ctx->top_offset = region_device_sz(rdev) - BLOB_SIZE;
/*
* after the loop, offset is supposed to point the blob right before
@@ -91,7 +88,7 @@ static int init_vbnv(void)
* used.
*/
for (i = 0; i <= ctx->top_offset; i += BLOB_SIZE) {
- if (rdev_readat(&ctx->region, buf, i, BLOB_SIZE) < 0) {
+ if (rdev_readat(rdev, buf, i, BLOB_SIZE) < 0) {
printk(BIOS_ERR, "failed to read nvdata\n");
return 1;
}
@@ -101,7 +98,7 @@ static int init_vbnv(void)
}
/* reread the nvdata and write it to the cache */
- if (rdev_readat(&ctx->region, ctx->cache, offset, BLOB_SIZE) < 0) {
+ if (rdev_readat(rdev, ctx->cache, offset, BLOB_SIZE) < 0) {
printk(BIOS_ERR, "failed to read nvdata\n");
return 1;
}
@@ -112,61 +109,12 @@ static int init_vbnv(void)
return 0;
}
-static void vbnv_is_erasable(void)
-{
- /*
- * We check whether the region is aligned or not in advance to ensure
- * we can erase the region when it's all used up.
- *
- * The region offset & size are determined by fmap.dts yet the check can
- * be confidently done only by the spi flash driver. We use the same
- * check as the one used by spi_flash_cmd_erase, which happens to be
- * common to all the spi flash parts we support.
- *
- * TODO: Check by calling can_erase implemented by each spi flash driver
- */
- struct vbnv_flash_ctx *ctx = car_get_var_ptr(&vbnv_flash);
-
- assert(!(region_device_offset(&ctx->region) % ctx->flash->sector_size));
- assert(!(region_device_sz(&ctx->region) % ctx->flash->sector_size));
-}
-
-static int vbnv_flash_probe(void)
-{
- struct vbnv_flash_ctx *ctx = car_get_var_ptr(&vbnv_flash);
-
- if (!ctx->flash) {
- ctx->flash =
- spi_flash_probe(CONFIG_BOOT_DEVICE_SPI_FLASH_BUS, 0);
- if (!ctx->flash) {
- printk(BIOS_ERR, "failed to probe spi flash\n");
- return 1;
- }
- /*
- * Called here instead of init_vbnv to reduce impact on boot
- * speed.
- */
- vbnv_is_erasable();
- }
-
- /*
- * Handle the case where spi_flash_probe returns a CAR_GLOBAL
- * in early execution on x86 but then later is moved to RAM.
- */
- ctx->flash = car_get_var_ptr(ctx->flash);
-
- return 0;
-}
-
static int erase_nvram(void)
{
struct vbnv_flash_ctx *ctx = car_get_var_ptr(&vbnv_flash);
+ const struct region_device *rdev = &ctx->vbnv_dev;
- if (vbnv_flash_probe())
- return 1;
-
- if (ctx->flash->erase(ctx->flash, region_device_offset(&ctx->region),
- region_device_sz(&ctx->region))) {
+ if (rdev_eraseat(rdev, 0, region_device_sz(rdev)) < 0) {
printk(BIOS_ERR, "failed to erase nvram\n");
return 1;
}
@@ -191,6 +139,7 @@ void save_vbnv_flash(const uint8_t *vbnv_copy)
struct vbnv_flash_ctx *ctx = car_get_var_ptr(&vbnv_flash);
int new_offset;
int i;
+ const struct region_device *rdev = &ctx->vbnv_dev;
if (!ctx->initialized)
if (init_vbnv())
@@ -216,10 +165,7 @@ void save_vbnv_flash(const uint8_t *vbnv_copy)
}
}
- if (!vbnv_flash_probe() &&
- !ctx->flash->write(ctx->flash,
- region_device_offset(&ctx->region) + new_offset,
- BLOB_SIZE, vbnv_copy)) {
+ if (rdev_writeat(rdev, vbnv_copy, new_offset, BLOB_SIZE) < 0) {
/* write was successful. safely move pointer forward */
ctx->blob_offset = new_offset;
memcpy(ctx->cache, vbnv_copy, BLOB_SIZE);
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16205
-gerrit
commit 49520a60dd6be60e8ad9a0cf34f35d0623f7ac1f
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Aug 12 12:46:07 2016 -0500
vboot: provide RW region device support
Explicitly provide a RW view of an vboot FMAP region. This is
required for platforms which have separate implementations of
a RO boot device and a RW boot device.
BUG=chrome-os-partner:56151
Change-Id: If8bf2e1c7ca9bff536fc5c578fe0cf92ccbd2ebc
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/vboot/vboot_common.c | 5 +++++
src/vboot/vboot_common.h | 3 +++
2 files changed, 8 insertions(+)
diff --git a/src/vboot/vboot_common.c b/src/vboot/vboot_common.c
index 319e0de..7e1ca9d 100644
--- a/src/vboot/vboot_common.c
+++ b/src/vboot/vboot_common.c
@@ -30,6 +30,11 @@ int vboot_named_region_device(const char *name, struct region_device *rdev)
return fmap_locate_area_as_rdev(name, rdev);
}
+int vboot_named_region_device_rw(const char *name, struct region_device *rdev)
+{
+ return fmap_locate_area_as_rdev(name, rdev);
+}
+
/* ========================== VBOOT HANDOFF APIs =========================== */
int vboot_get_handoff_info(void **addr, uint32_t *size)
{
diff --git a/src/vboot/vboot_common.h b/src/vboot/vboot_common.h
index d64b5bb..59fd44c 100644
--- a/src/vboot/vboot_common.h
+++ b/src/vboot/vboot_common.h
@@ -23,6 +23,9 @@
/* Locate vboot area by name. Returns 0 on success and -1 on error. */
int vboot_named_region_device(const char *name, struct region_device *rdev);
+/* Like vboot_named_region_device() but provides a RW region device. */
+int vboot_named_region_device_rw(const char *name, struct region_device *rdev);
+
/*
* Function to check if there is a request to enter recovery mode. Returns
* reason code if request to enter recovery mode is present, otherwise 0.
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16202
-gerrit
commit eec4c8e19cf0cc08d2d8c7363d172d6ec9ad7da7
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Aug 11 23:55:39 2016 -0500
soc/intel/skylake: use SPI flash boot_device_rw() for ealy stages
If the boot device is SPI flash use use the common one in the
early stages. While tweaking the config don't auto select
SPI_FLASH as that is handled automatically by the rest of the
build system.
BUG=chrome-os-partner:56151
Change-Id: Ifd51a80fd008c336233d6e460c354190fcc0ef22
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/soc/intel/skylake/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/soc/intel/skylake/Kconfig b/src/soc/intel/skylake/Kconfig
index 909dcec..f13c84e 100644
--- a/src/soc/intel/skylake/Kconfig
+++ b/src/soc/intel/skylake/Kconfig
@@ -13,6 +13,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_ROMSTAGE_X86_32
select ARCH_VERSTAGE_X86_32
select ACPI_NHLT
+ select BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY if BOOT_DEVICE_SPI_FLASH
select BOOT_DEVICE_SUPPORTS_WRITES
select CACHE_MRC_SETTINGS
select CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM if RELOCATABLE_RAMSTAGE
@@ -46,7 +47,6 @@ config CPU_SPECIFIC_OPTIONS
select SOC_INTEL_COMMON_RESET
select SMM_TSEG
select SMP
- select SPI_FLASH
select SSE2
select SUPPORT_CPU_UCODE_IN_CBFS
select TSC_CONSTANT_RATE
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16203
-gerrit
commit 9eb4d7fccf167f67af6dcfd82224fd2dfa3ccc2d
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Aug 12 12:42:04 2016 -0500
lib/fmap: provide RW region device support
Explicitly provide a RW view of an FMAP region. This is required
for platforms which have separeate implemenations of a RO boot
device and a RW boot device.
BUG=chrome-os-partner:56151
Change-Id: Ibafa3dc534f53a3d90487f3190c0f8a2e82858c2
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/include/fmap.h | 4 ++++
src/lib/fmap.c | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/src/include/fmap.h b/src/include/fmap.h
index 684a05c..5834831 100644
--- a/src/include/fmap.h
+++ b/src/include/fmap.h
@@ -27,6 +27,10 @@ int find_fmap_directory(struct region_device *fmrd);
* 0 on success, < 0 on error. */
int fmap_locate_area_as_rdev(const char *name, struct region_device *area);
+/* Just like fmap_locate_area_as_rdev(), however the region device is
+ * created from the RW boot device. */
+int fmap_locate_area_as_rdev_rw(const char *name, struct region_device *area);
+
/* Locate the named area in the fmap and fill in a region with the
* offset and size of that area within the boot media. Return 0 on success,
* < 0 on error. */
diff --git a/src/lib/fmap.c b/src/lib/fmap.c
index bf99037..9602134 100644
--- a/src/lib/fmap.c
+++ b/src/lib/fmap.c
@@ -80,6 +80,16 @@ int fmap_locate_area_as_rdev(const char *name, struct region_device *area)
return boot_device_ro_subregion(&ar, area);
}
+int fmap_locate_area_as_rdev_rw(const char *name, struct region_device *area)
+{
+ struct region ar;
+
+ if (fmap_locate_area(name, &ar))
+ return -1;
+
+ return boot_device_rw_subregion(&ar, area);
+}
+
int fmap_locate_area(const char *name, struct region *ar)
{
struct region_device fmrd;
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16191
-gerrit
commit 8fe3375b3fc977a99eaae412d0ae89aec59fa110
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Aug 11 11:02:26 2016 -0500
Kconfig: lay groundwork for not assuming SPI flash boot device
Almost all boards and chipsets within the codebase assume or
use SPI flash as the boot device. Therefore, provide an option
for the boards/chipsets which don't currently support SPI flash
as the boot device. The default is to assume SPI flash is the
boot device unless otherwise instructed. This falls in line
with the current assumptions, but it also allows one to
differentiate a platform desiring SPI flash support while it not
being the actual boot device.
One thing to note is that while google/daisy does boot with SPI
flash part no SPI API interfaces were ever implemented. Therefore,
mark that board as not having a SPI boot device.
BUG=chrome-os-partner:56151
Change-Id: Id4e0b4ec5e440e41421fbb6d0ca2be4185b62a6e
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/Kconfig | 12 ++++++++++++
src/cpu/allwinner/a10/Kconfig | 1 +
src/cpu/ti/am335x/Kconfig | 1 +
src/drivers/spi/Kconfig | 1 +
src/mainboard/emulation/qemu-armv7/Kconfig | 1 +
src/mainboard/emulation/qemu-power8/Kconfig | 1 +
src/mainboard/emulation/qemu-riscv/Kconfig | 1 +
src/mainboard/emulation/spike-riscv/Kconfig | 1 +
src/mainboard/google/daisy/Kconfig | 1 +
9 files changed, 20 insertions(+)
diff --git a/src/Kconfig b/src/Kconfig
index 3af2769..04b8d24 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -471,6 +471,18 @@ endmenu
source "src/acpi/Kconfig"
+# This option is for the current boards/chipsets where SPI flash
+# is not the boot device. Currently nearly all boards/chipsets assume
+# SPI flash is the boot device.
+config BOOT_DEVICE_NOT_SPI_FLASH
+ bool
+ default n
+
+config BOOT_DEVICE_SPI_FLASH
+ bool
+ default y if !BOOT_DEVICE_NOT_SPI_FLASH
+ default n
+
config RTC
bool
default n
diff --git a/src/cpu/allwinner/a10/Kconfig b/src/cpu/allwinner/a10/Kconfig
index 0e5aba9..6451b4a 100644
--- a/src/cpu/allwinner/a10/Kconfig
+++ b/src/cpu/allwinner/a10/Kconfig
@@ -14,5 +14,6 @@ config CPU_SPECIFIC_OPTIONS
select HAVE_UART_SPECIAL
select BOOTBLOCK_CONSOLE
select UART_OVERRIDE_REFCLK
+ select BOOT_DEVICE_NOT_SPI_FLASH
endif # if CPU_ALLWINNER_A10
diff --git a/src/cpu/ti/am335x/Kconfig b/src/cpu/ti/am335x/Kconfig
index f44c69d..939bca7 100644
--- a/src/cpu/ti/am335x/Kconfig
+++ b/src/cpu/ti/am335x/Kconfig
@@ -8,5 +8,6 @@ config CPU_TI_AM335X
select BOOTBLOCK_CONSOLE
select GENERIC_UDELAY
select UART_OVERRIDE_REFCLK
+ select BOOT_DEVICE_NOT_SPI_FLASH
bool
default n
diff --git a/src/drivers/spi/Kconfig b/src/drivers/spi/Kconfig
index 194e61f..35435a6 100644
--- a/src/drivers/spi/Kconfig
+++ b/src/drivers/spi/Kconfig
@@ -15,6 +15,7 @@
config SPI_FLASH
bool
+ default y if BOOT_DEVICE_SPI_FLASH
default n
help
Select this option if your chipset driver needs to store certain
diff --git a/src/mainboard/emulation/qemu-armv7/Kconfig b/src/mainboard/emulation/qemu-armv7/Kconfig
index 2654f0f..e801ae3 100644
--- a/src/mainboard/emulation/qemu-armv7/Kconfig
+++ b/src/mainboard/emulation/qemu-armv7/Kconfig
@@ -31,6 +31,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select ARCH_ROMSTAGE_ARMV7
select ARCH_RAMSTAGE_ARMV7
select BOARD_ROMSIZE_KB_4096
+ select BOOT_DEVICE_NOT_SPI_FLASH
config MAINBOARD_DIR
string
diff --git a/src/mainboard/emulation/qemu-power8/Kconfig b/src/mainboard/emulation/qemu-power8/Kconfig
index 7946c3e..6adcf72 100644
--- a/src/mainboard/emulation/qemu-power8/Kconfig
+++ b/src/mainboard/emulation/qemu-power8/Kconfig
@@ -23,6 +23,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select ARCH_BOOTBLOCK_POWER8
select HAVE_UART_SPECIAL
select ARCH_POWER8
+ select BOOT_DEVICE_NOT_SPI_FLASH
config MAINBOARD_DIR
string
diff --git a/src/mainboard/emulation/qemu-riscv/Kconfig b/src/mainboard/emulation/qemu-riscv/Kconfig
index 37d787a..cd11f95 100644
--- a/src/mainboard/emulation/qemu-riscv/Kconfig
+++ b/src/mainboard/emulation/qemu-riscv/Kconfig
@@ -23,6 +23,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select BOARD_ROMSIZE_KB_4096
select ARCH_BOOTBLOCK_RISCV
select HAVE_UART_SPECIAL
+ select BOOT_DEVICE_NOT_SPI_FLASH
config MAINBOARD_DIR
string
diff --git a/src/mainboard/emulation/spike-riscv/Kconfig b/src/mainboard/emulation/spike-riscv/Kconfig
index a762220..574f23c 100644
--- a/src/mainboard/emulation/spike-riscv/Kconfig
+++ b/src/mainboard/emulation/spike-riscv/Kconfig
@@ -23,6 +23,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select BOARD_ROMSIZE_KB_4096
select ARCH_BOOTBLOCK_RISCV
select DRIVERS_UART_8250MEM
+ select BOOT_DEVICE_NOT_SPI_FLASH
config MAINBOARD_DIR
string
diff --git a/src/mainboard/google/daisy/Kconfig b/src/mainboard/google/daisy/Kconfig
index 9f6a615..cef3f61 100644
--- a/src/mainboard/google/daisy/Kconfig
+++ b/src/mainboard/google/daisy/Kconfig
@@ -17,6 +17,7 @@ if BOARD_GOOGLE_DAISY
config BOARD_SPECIFIC_OPTIONS # dummy
def_bool y
+ select BOOT_DEVICE_NOT_SPI_FLASH
select CPU_SAMSUNG_EXYNOS5250
select EC_GOOGLE_CHROMEEC
select EC_GOOGLE_CHROMEEC_I2C