Hello Martin Roth, Marc Jones, Johnny Lin, Angel Pons,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/45774
to review the following change.
Change subject: [RFC] Introduce vpd_get_option()
......................................................................
[RFC] Introduce vpd_get_option()
Allows to read options from VPD regions in flash. This is currently
very limited as type information is missing both in the get_option()
interface and the backend. Hence, every option to be queried needs
to be added manually to vpd_get_option().
Storing options in VPD should only be an interim solution, VPD doesn't
seem to be meant to be used like that. The lack of typing also makes
this a bit ugly. But this way, we can keep that local.
Change-Id: I825388f767d1d87f44923eff5ae6680105fa801e
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M src/Kconfig
M src/drivers/vpd/vpd.c
M src/drivers/vpd/vpd.h
M src/include/option.h
4 files changed, 58 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/45774/1
diff --git a/src/Kconfig b/src/Kconfig
index 40310bb..40e275b 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -135,6 +135,46 @@
every boot. Use this if you want the NVRAM configuration to
never be modified from its default values.
+config USE_VPD_OPTIONS
+ bool "Use VPD for configuration values"
+ depends on VPD
+ help
+ Enable this option if coreboot shall read options from the VPD
+ regions in flash.
+ This is currently very limited as type information is missing
+ both in the get_option() interface and the backend. Hence, every
+ option to be queried needs to be added manually to vpd_get_option().
+
+if USE_VPD_OPTIONS
+
+choice
+ prompt "VPD region to query"
+ default VPD_OPTION_REGION_RW_THEN_RO
+
+config VPD_OPTION_REGION_RO
+ bool "RO"
+
+config VPD_OPTION_REGION_RW
+ bool "RW"
+
+config VPD_OPTION_REGION_RO_THEN_RW
+ bool "RO, then RW"
+
+config VPD_OPTION_REGION_RW_THEN_RO
+ bool "RW, then RO"
+
+endchoice
+
+# Keep in sync with `drivers/vpd/vpd.h`.
+config VPD_OPTION_REGION
+ int
+ default 3 if VPD_OPTION_REGION_RW_THEN_RO
+ default 2 if VPD_OPTION_REGION_RO_THEN_RW
+ default 1 if VPD_OPTION_REGION_RW
+ default 0
+
+endif # USE_VPD_OPTIONS
+
config USE_MAINBOARD_OPTIONS
bool
help
diff --git a/src/drivers/vpd/vpd.c b/src/drivers/vpd/vpd.c
index d3ff370..727a616 100644
--- a/src/drivers/vpd/vpd.c
+++ b/src/drivers/vpd/vpd.c
@@ -5,6 +5,7 @@
#include <cbmem.h>
#include <ctype.h>
#include <fmap.h>
+#include <option.h>
#include <program_loading.h>
#include <string.h>
#include <timestamp.h>
@@ -297,4 +298,17 @@
return true;
}
+enum cb_err vpd_get_option(void *const dest, const char *const name)
+{
+ if (strcmp(name, "debug_level") == 0) {
+ int i;
+ if (vpd_get_int("coreboot_log_level", CONFIG_VPD_OPTION_REGION, &i)) {
+ *(char *)dest = (char)i;
+ return CB_SUCCESS;
+ }
+ }
+
+ return CB_CMOS_OPTION_NOT_FOUND;
+}
+
ROMSTAGE_CBMEM_INIT_HOOK(cbmem_add_cros_vpd)
diff --git a/src/drivers/vpd/vpd.h b/src/drivers/vpd/vpd.h
index 817867a..5c2a80f 100644
--- a/src/drivers/vpd/vpd.h
+++ b/src/drivers/vpd/vpd.h
@@ -7,6 +7,7 @@
#define GOOGLE_VPD_2_0_OFFSET 0x600
+/* Keep in sync with Kconfig VPD_OPTION_REGION. */
enum vpd_region {
VPD_RO,
VPD_RW,
diff --git a/src/include/option.h b/src/include/option.h
index 86c8ff1..2822bcb 100644
--- a/src/include/option.h
+++ b/src/include/option.h
@@ -11,6 +11,7 @@
enum cb_err cmos_get_option(void *dest, const char *name);
enum cb_err mainboard_get_option(void *dest, const char *name);
+enum cb_err vpd_get_option(void *dest, const char *name);
static inline enum cb_err set_option(const char *name, void *val)
{
@@ -26,6 +27,8 @@
if (CONFIG(USE_OPTION_TABLE))
ret = cmos_get_option(dest, name);
+ if (CONFIG(USE_VPD_OPTIONS) && ret != CB_SUCCESS)
+ ret = vpd_get_option(dest, name);
if (CONFIG(USE_MAINBOARD_OPTIONS) && ret != CB_SUCCESS)
ret = mainboard_get_option(dest, name);
--
To view, visit https://review.coreboot.org/c/coreboot/+/45774
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I825388f767d1d87f44923eff5ae6680105fa801e
Gerrit-Change-Number: 45774
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin(a)wiwynn.com>
Gerrit-Reviewer: Marc Jones <marc.jones(a)amd.corp-partner.google.com>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-MessageType: newchange
Name of user not set #1003174 has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47056 )
Change subject: Support for Zotac AD04 added (initial commit)
......................................................................
Support for Zotac AD04 added (initial commit)
Signed-off-by: moscovium-115 <3134c487(a)tutanota.com>
Change-Id: I184fb55b184c7739824d801524e2a3d1d2573f11
---
A Documentation/mainboard/zotac/ad04/ad04.md
A Documentation/mainboard/zotac/ad04/logs/acpidump.err.log
A Documentation/mainboard/zotac/ad04/logs/acpidump.log
A Documentation/mainboard/zotac/ad04/logs/biosdecode.err.log
A Documentation/mainboard/zotac/ad04/logs/biosdecode.log
A Documentation/mainboard/zotac/ad04/logs/codec#0
A Documentation/mainboard/zotac/ad04/logs/cpuinfo.err.log
A Documentation/mainboard/zotac/ad04/logs/cpuinfo.log
A Documentation/mainboard/zotac/ad04/logs/dmesg.err.log
A Documentation/mainboard/zotac/ad04/logs/dmesg.log
A Documentation/mainboard/zotac/ad04/logs/dmidecode.err.log
A Documentation/mainboard/zotac/ad04/logs/dmidecode.log
A Documentation/mainboard/zotac/ad04/logs/ectool.err.log
A Documentation/mainboard/zotac/ad04/logs/ectool.log
A Documentation/mainboard/zotac/ad04/logs/flashrom_info.err.log
A Documentation/mainboard/zotac/ad04/logs/flashrom_info.log
A Documentation/mainboard/zotac/ad04/logs/flashrom_read.err.log
A Documentation/mainboard/zotac/ad04/logs/flashrom_read.log
A Documentation/mainboard/zotac/ad04/logs/input_bustypes.log
A Documentation/mainboard/zotac/ad04/logs/inteltool.err.log
A Documentation/mainboard/zotac/ad04/logs/inteltool.log
A Documentation/mainboard/zotac/ad04/logs/ioports.err.log
A Documentation/mainboard/zotac/ad04/logs/ioports.log
A Documentation/mainboard/zotac/ad04/logs/log.sh
A Documentation/mainboard/zotac/ad04/logs/lspci.err.log
A Documentation/mainboard/zotac/ad04/logs/lspci.log
A Documentation/mainboard/zotac/ad04/logs/lsusb.err.log
A Documentation/mainboard/zotac/ad04/logs/lsusb.log
A Documentation/mainboard/zotac/ad04/logs/msrtool.err.log
A Documentation/mainboard/zotac/ad04/logs/msrtool.log
A Documentation/mainboard/zotac/ad04/logs/nvramtool.err.log
A Documentation/mainboard/zotac/ad04/logs/nvramtool.log
A Documentation/mainboard/zotac/ad04/logs/pin_hwC0D0
A Documentation/mainboard/zotac/ad04/logs/rom.bin
A Documentation/mainboard/zotac/ad04/logs/superiotool.err.log
A Documentation/mainboard/zotac/ad04/logs/superiotool.log
A configs/config.zotac_ad04
A src/mainboard/zotac/Kconfig
A src/mainboard/zotac/Kconfig.name
A src/mainboard/zotac/ad04/BiosCallOuts.c
A src/mainboard/zotac/ad04/Kconfig
A src/mainboard/zotac/ad04/Kconfig.name
A src/mainboard/zotac/ad04/Makefile.inc
A src/mainboard/zotac/ad04/OemCustomize.c
A src/mainboard/zotac/ad04/OptionsIds.h
A src/mainboard/zotac/ad04/acpi/buttons.asl
A src/mainboard/zotac/ad04/acpi/gpe.asl
A src/mainboard/zotac/ad04/acpi/gpio.asl
A src/mainboard/zotac/ad04/acpi/leds.asl
A src/mainboard/zotac/ad04/acpi/mainboard.asl
A src/mainboard/zotac/ad04/acpi/routing.asl
A src/mainboard/zotac/ad04/acpi/sata.asl
A src/mainboard/zotac/ad04/acpi/sleep.asl
A src/mainboard/zotac/ad04/acpi/superio.asl
A src/mainboard/zotac/ad04/acpi/usb_oc.asl
A src/mainboard/zotac/ad04/acpi_tables.c
A src/mainboard/zotac/ad04/board_info.txt
A src/mainboard/zotac/ad04/bootblock.c
A src/mainboard/zotac/ad04/buildOpts.c
A src/mainboard/zotac/ad04/cmos.default
A src/mainboard/zotac/ad04/cmos.layout
A src/mainboard/zotac/ad04/devicetree.cb
A src/mainboard/zotac/ad04/dsdt.asl
A src/mainboard/zotac/ad04/gpio_ftns.c
A src/mainboard/zotac/ad04/gpio_ftns.h
A src/mainboard/zotac/ad04/irq_tables.c
A src/mainboard/zotac/ad04/mainboard.c
A src/mainboard/zotac/ad04/mptable.c
A src/mainboard/zotac/ad04/platform_cfg.h
A src/mainboard/zotac/ad04/romstage.c
A src/mainboard/zotac/ad04/spd/HYNIX-H5TQ2G83CFR.spd.hex
A src/mainboard/zotac/ad04/spd/HYNIX-H5TQ4G83MFR.spd.hex
72 files changed, 17,792 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/56/47056/1
--
To view, visit https://review.coreboot.org/c/coreboot/+/47056
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I184fb55b184c7739824d801524e2a3d1d2573f11
Gerrit-Change-Number: 47056
Gerrit-PatchSet: 1
Gerrit-Owner: Name of user not set #1003174
Gerrit-MessageType: newchange