<p>Julien Viard de Galbert has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/23712">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">console: Introduce a way for mainboard to override the loglevel<br><br>This change add a weak function to allow mainboard to override the<br>default console loglevel.<br>This allows a mainboard to sample a GPIO to switch the loglevel<br>value between different environments (qualification vs production)<br>without re-flashing.<br><br>Change-Id: Id6cc72b8fe5c4c50a6f83ce80e6440b078eec6e2<br>Signed-off-by: Julien Viard de Galbert <jviarddegalbert@online.net><br>---<br>M src/console/init.c<br>M src/include/console/console.h<br>2 files changed, 17 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/23712/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/console/init.c b/src/console/init.c</span><br><span>index 422315a..b14dc3d 100644</span><br><span>--- a/src/console/init.c</span><br><span>+++ b/src/console/init.c</span><br><span>@@ -29,12 +29,20 @@</span><br><span> #define CONSOLE_LEVEL_CONST 0</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+__attribute__((weak)) const int mainboard_get_default_console_loglevel(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;</span><br><span> </span><br><span> static inline int get_log_level(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-     if (CONSOLE_LEVEL_CONST)</span><br><span style="color: hsl(120, 100%, 40%);">+      if (CONSOLE_LEVEL_CONST) {</span><br><span style="color: hsl(120, 100%, 40%);">+            int lvl = mainboard_get_default_console_loglevel();</span><br><span style="color: hsl(120, 100%, 40%);">+           if (lvl >= 0) return lvl;</span><br><span>                 return CONFIG_DEFAULT_CONSOLE_LOGLEVEL;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span> </span><br><span>        return console_loglevel;</span><br><span> }</span><br><span>@@ -54,6 +62,9 @@</span><br><span>    if (CONSOLE_LEVEL_CONST)</span><br><span>             return;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   int lvl = mainboard_get_default_console_loglevel();</span><br><span style="color: hsl(120, 100%, 40%);">+   if (lvl >= 0) debug_level = lvl;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>        get_option(&debug_level, "debug_level");</span><br><span> </span><br><span>   set_log_level(debug_level);</span><br><span>diff --git a/src/include/console/console.h b/src/include/console/console.h</span><br><span>index aa935e4..d21b3c4 100644</span><br><span>--- a/src/include/console/console.h</span><br><span>+++ b/src/include/console/console.h</span><br><span>@@ -64,6 +64,11 @@</span><br><span> #define printk(LEVEL, fmt, args...) \</span><br><span>   do { do_printk(LEVEL, fmt, ##args); } while (0)</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * this function is weak and can be overridden by a mainboard function.</span><br><span style="color: hsl(120, 100%, 40%);">+ * return -1 to not override the configuration default.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+const int mainboard_get_default_console_loglevel(void);</span><br><span> #else</span><br><span> static inline void console_init(void) {}</span><br><span> static inline int console_log_level(int msg_level) { return 0; }</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/23712">change 23712</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/23712"/><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: Id6cc72b8fe5c4c50a6f83ce80e6440b078eec6e2 </div>
<div style="display:none"> Gerrit-Change-Number: 23712 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Julien Viard de Galbert <jviarddegalbert@online.net> </div>