<p>Marcello Sylvester Bauer has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25397">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">[wip] driver/option_table: add option table interface<br><br>introduce an interface for option table,<br>so that other non-volatile storage can be used.<br>This will benefit machines without CMOS<br>as well as those without a battery-backed CMOS<br>TODO: Support VPD read-write section as option table<br><br>Change-Id: I19b0215170e940c4973e60cbad3d7186a3063cc2<br>Signed-off-by: Marcello Sylvester Bauer <marcello.bauer@9elements.com><br>---<br>M src/Kconfig<br>A src/drivers/option_table/Makefile.inc<br>A src/drivers/option_table/option_table_cmos.c<br>M src/drivers/pc80/rtc/mc146818rtc.c<br>M src/include/option.h<br>M src/include/pc80/mc146818rtc.h<br>6 files changed, 48 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/25397/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/Kconfig b/src/Kconfig</span><br><span>index 99a704d..38cf13a 100644</span><br><span>--- a/src/Kconfig</span><br><span>+++ b/src/Kconfig</span><br><span>@@ -113,11 +113,23 @@</span><br><span>      Otherwise, say N to use the provided pregenerated scanner/parser.</span><br><span> </span><br><span> config USE_OPTION_TABLE</span><br><span style="color: hsl(0, 100%, 40%);">-      bool "Use CMOS for configuration values"</span><br><span style="color: hsl(120, 100%, 40%);">+    bool "Use an option table for configuration values"</span><br><span style="color: hsl(120, 100%, 40%);">+ help</span><br><span style="color: hsl(120, 100%, 40%);">+    Enable this option if coreboot shall use an option table</span><br><span style="color: hsl(120, 100%, 40%);">+      instead of hard-coded values.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+choice</span><br><span style="color: hsl(120, 100%, 40%);">+     prompt "option table to use"</span><br><span style="color: hsl(120, 100%, 40%);">+        depends on USE_OPTION_TABLE</span><br><span style="color: hsl(120, 100%, 40%);">+   default USE_OPTION_TABLE_CMOS</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+config USE_OPTION_TABLE_CMOS</span><br><span style="color: hsl(120, 100%, 40%);">+ bool "CMOS"</span><br><span>        depends on HAVE_OPTION_TABLE</span><br><span>         help</span><br><span style="color: hsl(0, 100%, 40%);">-      Enable this option if coreboot shall read options from the "CMOS"</span><br><span style="color: hsl(0, 100%, 40%);">-     NVRAM instead of using hard-coded values.</span><br><span style="color: hsl(120, 100%, 40%);">+     read options from the "CMOS" NVRAM</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+endchoice</span><br><span> </span><br><span> config STATIC_OPTION_TABLE</span><br><span>        bool "Load default configuration values into CMOS on each boot"</span><br><span>diff --git a/src/drivers/option_table/Makefile.inc b/src/drivers/option_table/Makefile.inc</span><br><span>new file mode 100644</span><br><span>index 0000000..5c07e34</span><br><span>--- /dev/null</span><br><span>+++ b/src/drivers/option_table/Makefile.inc</span><br><span>@@ -0,0 +1,3 @@</span><br><span style="color: hsl(120, 100%, 40%);">+ifeq ($(CONFIG_USE_OPTION_TABLE_CMOS),y)</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-y += option_table_cmos.c</span><br><span style="color: hsl(120, 100%, 40%);">+endif</span><br><span>diff --git a/src/drivers/option_table/option_table_cmos.c b/src/drivers/option_table/option_table_cmos.c</span><br><span>new file mode 100644</span><br><span>index 0000000..b839f74</span><br><span>--- /dev/null</span><br><span>+++ b/src/drivers/option_table/option_table_cmos.c</span><br><span>@@ -0,0 +1,23 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2014 The Chromium OS Authors. All rights reserved.</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <option.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <pc80/mc146818rtc.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+enum cb_err get_option(void *dest, const char *name)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  return get_option_cmos(dest, name);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c</span><br><span>index 928b403..f75dd27 100644</span><br><span>--- a/src/drivers/pc80/rtc/mc146818rtc.c</span><br><span>+++ b/src/drivers/pc80/rtc/mc146818rtc.c</span><br><span>@@ -240,7 +240,7 @@</span><br><span>    return CB_SUCCESS;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-enum cb_err get_option(void *dest, const char *name)</span><br><span style="color: hsl(120, 100%, 40%);">+enum cb_err get_option_cmos(void *dest, const char *name)</span><br><span> {</span><br><span>      struct cmos_option_table *ct;</span><br><span>        struct cmos_entries *ce;</span><br><span>diff --git a/src/include/option.h b/src/include/option.h</span><br><span>index f6ede96..07ee4b6 100644</span><br><span>--- a/src/include/option.h</span><br><span>+++ b/src/include/option.h</span><br><span>@@ -6,10 +6,12 @@</span><br><span>  * storage can be used. This will benefit machines without CMOS as well as those</span><br><span>  * without a battery-backed CMOS (e.g. some laptops).</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-#if IS_ENABLED(CONFIG_USE_OPTION_TABLE)</span><br><span style="color: hsl(0, 100%, 40%);">-#include <pc80/mc146818rtc.h></span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #include <types.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#if IS_ENABLED(CONFIG_USE_OPTION_TABLE)</span><br><span style="color: hsl(120, 100%, 40%);">+enum cb_err get_option(void *dest, const char *name);</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span> static inline enum cb_err get_option(void *dest, const char *name)</span><br><span> {</span><br><span>       return CB_CMOS_OTABLE_DISABLED;</span><br><span>diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h</span><br><span>index 5d7497d..bc6c99e 100644</span><br><span>--- a/src/include/pc80/mc146818rtc.h</span><br><span>+++ b/src/include/pc80/mc146818rtc.h</span><br><span>@@ -183,7 +183,7 @@</span><br><span> void cmos_check_update_date(void);</span><br><span> </span><br><span> enum cb_err set_option(const char *name, void *val);</span><br><span style="color: hsl(0, 100%, 40%);">-enum cb_err get_option(void *dest, const char *name);</span><br><span style="color: hsl(120, 100%, 40%);">+enum cb_err get_option_cmos(void *dest, const char *name);</span><br><span> unsigned int read_option_lowlevel(unsigned int start, unsigned int size,</span><br><span>    unsigned int def);</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25397">change 25397</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/25397"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I19b0215170e940c4973e60cbad3d7186a3063cc2 </div>
<div style="display:none"> Gerrit-Change-Number: 25397 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Marcello Sylvester Bauer <marcello.bauer@9elements.com> </div>