[coreboot-gerrit] Change in coreboot[master]: [WIP] driver/option_table: RO_VPD option table

Marcello Sylvester Bauer (Code Review) gerrit at coreboot.org
Fri Apr 6 23:00:01 CEST 2018


Marcello Sylvester Bauer has uploaded this change for review. ( https://review.coreboot.org/25550


Change subject: [WIP] driver/option_table: RO_VPD option table
......................................................................

[WIP] driver/option_table: RO_VPD option table

Add a read-only VPD section as option table. This will benefit non-x86
boards without nvram.

Change-Id: I5aeafedf29c80e29c6cf00b821af6b4370e15baf
Signed-off-by: Marcello Sylvester Bauer <info at marcellobauer.com>
---
M Makefile.inc
M src/Kconfig
M src/drivers/option_table/Makefile.inc
A src/drivers/option_table/option_table_vpd.c
M util/cbfstool/default-x86.fmd
M util/cbfstool/default.fmd
6 files changed, 72 insertions(+), 8 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/25550/1

diff --git a/Makefile.inc b/Makefile.inc
index b11f6e2..d71bf5c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -820,14 +820,28 @@
 endif # ifeq ($(CONFIG_CACHE_MRC_SETTINGS),y)
 
 #
+# RW VPD region
+#
+#
+ifeq ($(CONFIG_USE_OPTION_TABLE_VPD),y)
+FMAP_RO_VPD_BASE := $(call int-add,$(FMAP_FMAP_BASE) $(FMAP_FMAP_SIZE) $(FMAP_CONSOLE_SIZE) \
+	$(FMAP_MRC_CACHE_SIZE))
+#FIX ME: use optional size instead of hardcoded value
+FMAP_RO_VPD_SIZE := 0x1000
+FMAP_RO_VPD_ENTRY := RO_VPD@$(FMAP_RO_VPD_BASE) $(FMAP_RO_VPD_SIZE)
+else # ifeq($(CONFIG_USE_OPTION_TABLE_VPD))
+FMAP_RO_VPD_BASE := 0
+FMAP_RO_VPD_SIZE := 0
+FMAP_RO_VPD_ENTRY :=
+endif # ifeq($(CONFIG_USE_OPTION_TABLE_VPD))
+
+#
 # X86 COREBOOT default cbfs FMAP region
 #
 # position and size of CBFS, relative to BIOS_BASE
-ifeq ($(CONFIG_CACHE_MRC_SETTINGS),y)
-FMAP_CBFS_BASE := $(call int-add, $(FMAP_MRC_CACHE_BASE) $(FMAP_MRC_CACHE_SIZE))
-else
-FMAP_CBFS_BASE := $(call int-add, $(FMAP_CONSOLE_SIZE) $(FMAP_FMAP_SIZE))
-endif
+FMAP_CBFS_BASE := $(call int-add, $(FMAP_CONSOLE_SIZE) $(FMAP_FMAP_SIZE) \
+	$(FMAP_MRC_CACHE_SIZE) $(FMAP_RO_VPD_SIZE))
+
 FMAP_CBFS_SIZE := $(call int-subtract, $(FMAP_BIOS_SIZE) $(FMAP_CBFS_BASE))
 else # ifeq ($(CONFIG_ARCH_X86),y)
 DEFAULT_FLASHMAP:=$(top)/util/cbfstool/default.fmd
@@ -881,7 +895,7 @@
 #
 # position and size of CBFS, relative to BIOS_BASE
 FMAP_CBFS_BASE := $(call int-add,$(FMAP_FMAP_BASE) $(FMAP_FMAP_SIZE) $(FMAP_CONSOLE_SIZE) \
-	$(FMAP_MRC_CACHE_SIZE))
+	$(FMAP_MRC_CACHE_SIZE) $(FMAP_RO_VPD_SIZE))
 FMAP_CBFS_SIZE := $(call int-subtract,$(FMAP_BIOS_SIZE) $(FMAP_CBFS_BASE))
 endif # ifeq ($(CONFIG_ARCH_X86),y)
 
@@ -894,6 +908,7 @@
 	    -e "s,##FMAP_SIZE##,$(FMAP_FMAP_SIZE)," \
 	    -e "s,##CONSOLE_ENTRY##,$(FMAP_CONSOLE_ENTRY)," \
 	    -e "s,##MRC_CACHE_ENTRY##,$(FMAP_MRC_CACHE_ENTRY)," \
+	    -e "s,##RO_VPD_ENTRY##,$(FMAP_RO_VPD_ENTRY)," \
 	    -e "s,##CBFS_BASE##,$(FMAP_CBFS_BASE)," \
 	    -e "s,##CBFS_SIZE##,$(FMAP_CBFS_SIZE)," \
 		$(DEFAULT_FLASHMAP) > $@.tmp
diff --git a/src/Kconfig b/src/Kconfig
index 60a2977..ecde912 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -130,6 +130,11 @@
 	help
 	  read options from the "CMOS" NVRAM
 
+config USE_OPTION_TABLE_VPD
+	bool "VPD"
+	help
+	  read options from the a RV_VPD partition
+
 endchoice
 
 config STATIC_OPTION_TABLE_CMOS
@@ -495,8 +500,8 @@
 
 config HAVE_OPTION_TABLE
 	bool
-	default y if HAVE_OPTION_TABLE_CMOS
-	default n if !HAVE_OPTION_TABLE_CMOS
+	default y if (HAVE_OPTION_TABLE_CMOS || HAVE_OPTION_TABLE_VPD)
+	default n if !(HAVE_OPTION_TABLE_CMOS || HAVE_OPTION_TABLE_VPD)
 
 config HAVE_OPTION_TABLE_CMOS
 	bool
@@ -506,6 +511,10 @@
 	  file containing NVRAM/CMOS bit definitions.
 	  It defaults to 'n' but can be selected in mainboard/*/Kconfig.
 
+config HAVE_OPTION_TABLE_VPD
+	bool
+	default y
+
 config PIRQ_ROUTE
 	bool
 	default n
diff --git a/src/drivers/option_table/Makefile.inc b/src/drivers/option_table/Makefile.inc
index b099474..24a359b 100644
--- a/src/drivers/option_table/Makefile.inc
+++ b/src/drivers/option_table/Makefile.inc
@@ -7,3 +7,12 @@
 smm-y += option_table_cmos.c
 postcar-y += option_table_cmos.c
 endif
+
+ifeq ($(CONFIG_USE_OPTION_TABLE_VPD),y)
+bootblock-y += option_table_vpd.c
+verstage-y += option_table_vpd.c
+romstage-y += option_table_vpd.c
+ramstage-y += option_table_vpd.c
+smm-y += option_table_vpd.c
+postcar-y += option_table_vpd.c
+endif
diff --git a/src/drivers/option_table/option_table_vpd.c b/src/drivers/option_table/option_table_vpd.c
new file mode 100644
index 0000000..41d35a2
--- /dev/null
+++ b/src/drivers/option_table/option_table_vpd.c
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 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 <option.h>
+#include <types.h>
+
+//[WIP] dummy function
+enum cb_err get_option(void *dest, const char *name)
+{
+	return CB_CMOS_ACCESS_ERROR;
+}
+
+//[WIP] dummy function
+enum cb_err set_option(const char *name, void *value)
+{
+	return CB_CMOS_ACCESS_ERROR;
+}
diff --git a/util/cbfstool/default-x86.fmd b/util/cbfstool/default-x86.fmd
index 1f1aa43..39706fe 100644
--- a/util/cbfstool/default-x86.fmd
+++ b/util/cbfstool/default-x86.fmd
@@ -12,6 +12,7 @@
 		FMAP@##FMAP_BASE## ##FMAP_SIZE##
 		##CONSOLE_ENTRY##
 		##MRC_CACHE_ENTRY##
+		##RO_VPD_ENTRY##
 		COREBOOT(CBFS)@##CBFS_BASE## ##CBFS_SIZE##
 	}
 }
diff --git a/util/cbfstool/default.fmd b/util/cbfstool/default.fmd
index 8f4819e..61de02f 100644
--- a/util/cbfstool/default.fmd
+++ b/util/cbfstool/default.fmd
@@ -15,6 +15,7 @@
 		FMAP@##FMAP_BASE## ##FMAP_SIZE##
 		##CONSOLE_ENTRY##
 		##MRC_CACHE_ENTRY##
+		##RO_VPD_ENTRY##
 		COREBOOT(CBFS)@##CBFS_BASE## ##CBFS_SIZE##
 	}
 }

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5aeafedf29c80e29c6cf00b821af6b4370e15baf
Gerrit-Change-Number: 25550
Gerrit-PatchSet: 1
Gerrit-Owner: Marcello Sylvester Bauer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180406/170e7013/attachment-0001.html>


More information about the coreboot-gerrit mailing list