[coreboot-gerrit] Change in ...coreboot[master]: [WIP]drivers/smmstore: Allow using raw FMAP regions

Arthur Heymans (Code Review) gerrit at coreboot.org
Sat Dec 1 15:30:15 CET 2018


Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/29991


Change subject: [WIP]drivers/smmstore: Allow using raw FMAP regions
......................................................................

[WIP]drivers/smmstore: Allow using raw FMAP regions

Use a raw fmap region SMMSTORE for the SMMSTORE mechanism, while keeping the
initial option to use a cbfsfile.

I need a board with on which CONFIG_DEBUG_SMI is easy...

Change-Id: I8c2b9b3a0ed16b2d37e6a97e33c671fb54df8de0
Signed-off-by: Arthur Heymans <arthur at aheymans.xyz>
---
M src/drivers/smmstore/Kconfig
M src/drivers/smmstore/store.c
M src/southbridge/intel/common/Kconfig
3 files changed, 30 insertions(+), 10 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/29991/1

diff --git a/src/drivers/smmstore/Kconfig b/src/drivers/smmstore/Kconfig
index 4bb48f7..b4e9909 100644
--- a/src/drivers/smmstore/Kconfig
+++ b/src/drivers/smmstore/Kconfig
@@ -20,13 +20,21 @@
 	select SPI_FLASH_SMM if BOOT_DEVICE_SPI_FLASH_RW_NOMMAP
 
 if SMMSTORE
+config SMMSTORE_IN_CBFS
+	bool
+	default n
+	help
+	  Select this if you want to the SMMSTORE region in a
+	  cbfsfile in a cbfs FMAP region
+
 config SMMSTORE_REGION
-	string "fmap region in which SMM store file is kept"
+	string "fmap region in which SMM store file is kept" if SMMSTORE_IN_CBFS
 	default "RW_LEGACY" if CHROMEOS
 	default "COREBOOT"
+	default "SMMSTORE"
 
 config SMMSTORE_FILENAME
-	string "SMM store file name"
+	string "SMM store file name" if SMMSTORE_IN_CBFS
 	default "smm store"
 
 endif
diff --git a/src/drivers/smmstore/store.c b/src/drivers/smmstore/store.c
index 4463bad..409949a 100644
--- a/src/drivers/smmstore/store.c
+++ b/src/drivers/smmstore/store.c
@@ -15,6 +15,7 @@
 
 #include <boot_device.h>
 #include <cbfs.h>
+#include <fmap.h>
 #include <commonlib/region.h>
 #include <console/console.h>
 #include <smmstore.h>
@@ -57,15 +58,25 @@
 static int lookup_store(struct region_device *rstore)
 {
 	struct cbfsf file;
-	if (cbfs_locate_file_in_region(&file,
-		CONFIG_SMMSTORE_REGION, CONFIG_SMMSTORE_FILENAME, NULL) < 0) {
-		printk(BIOS_WARNING, "smm store: "
-			"Unable to find SMM store file in region '%s'\n",
-			CONFIG_SMMSTORE_REGION);
-		return -1;
-	}
+	if (IS_ENABLED(CONFIG_SMMSTORE_IN_CBFS)) {
+		if (cbfs_locate_file_in_region(&file,
+			       CONFIG_SMMSTORE_REGION,
+			       CONFIG_SMMSTORE_FILENAME, NULL) < 0) {
+			printk(BIOS_WARNING, "smm store: "
+			       "Unable to find SMM store file in region '%s'\n",
+			       CONFIG_SMMSTORE_REGION);
+			return -1;
+		}
 
-	cbfs_file_data(rstore, &file);
+		cbfs_file_data(rstore, &file);
+	} else {
+		if (fmap_locate_area_as_rdev_rw(CONFIG_SMMSTORE_REGION, rstore)) {
+			printk(BIOS_WARNING,
+			       "smm store: Unable to find SMM store FMAP region '%s'\n",
+			       CONFIG_SMMSTORE_REGION);
+			return -1;
+		}
+	}
 
 	return 0;
 }
diff --git a/src/southbridge/intel/common/Kconfig b/src/southbridge/intel/common/Kconfig
index 957faa5..0f3121f 100644
--- a/src/southbridge/intel/common/Kconfig
+++ b/src/southbridge/intel/common/Kconfig
@@ -16,6 +16,7 @@
 config SOUTHBRIDGE_INTEL_COMMON_SPI
 	def_bool n
 	select SPI_FLASH
+	select BOOT_DEVICE_SUPPORTS_WRITES
 
 config SOUTHBRIDGE_INTEL_COMMON_PIRQ_ACPI_GEN
 	def_bool n

-- 
To view, visit https://review.coreboot.org/c/coreboot/+/29991
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I8c2b9b3a0ed16b2d37e6a97e33c671fb54df8de0
Gerrit-Change-Number: 29991
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur at aheymans.xyz>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181201/a712bbf7/attachment.html>


More information about the coreboot-gerrit mailing list