<p>Nico Huber has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/29047">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">reset: Declare new single-function reset API<br><br>board_reset() replaces the existing common reset API. There is no common<br>distinction between reset types across platforms, hence, common code<br>could never decide which one to call.<br><br>Currently only hard_reset() is used by common code. We'll replace these<br>calls after moving all implementations to the new API.<br><br>Change-Id: I274a8cee9cb38226b5a0bdff6a847c74ef0b3128<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>---<br>M src/include/reset.h<br>M src/lib/Kconfig<br>M src/lib/reset.c<br>3 files changed, 58 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/47/29047/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/include/reset.h b/src/include/reset.h</span><br><span>index cf9d574..47e71f0 100644</span><br><span>--- a/src/include/reset.h</span><br><span>+++ b/src/include/reset.h</span><br><span>@@ -1,7 +1,46 @@</span><br><span> #ifndef RESET_H</span><br><span> #define RESET_H</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/* Generic reset functions. Call from code that wants to trigger a reset. */</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Generic board reset function. Call from common code that</span><br><span style="color: hsl(120, 100%, 40%);">+ * wants to trigger a reset.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+__noreturn void board_reset(void);</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * SoC or board specific implementation of the board reset.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Implementations should perform a warm reset if the following</span><br><span style="color: hsl(120, 100%, 40%);">+ * criteria can be met:</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o For vboot support, the TPM MUST be reset.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o All SoC/chipset blocks SHOULD be reset except for those</span><br><span style="color: hsl(120, 100%, 40%);">+ *     that are intentionally meant to survive reset (e.g. tomb-</span><br><span style="color: hsl(120, 100%, 40%);">+ *     stone registers and that sort of stuff).</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o All external SoC pins MUST return to power-on reset values.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o The CPU MUST resume execution from power-on reset vector</span><br><span style="color: hsl(120, 100%, 40%);">+ *     (same as cold boot).</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o Other board components (e.g. PCI, SDIO and stuff) SHOULD</span><br><span style="color: hsl(120, 100%, 40%);">+ *     be reset.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o USB SHOULD be power-cycled.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o Board components that are intended to be fully independent</span><br><span style="color: hsl(120, 100%, 40%);">+ *     from SoC (e.g. EC and EC-attached devices, the Cr50 on</span><br><span style="color: hsl(120, 100%, 40%);">+ *     Chromebooks) SHOULD NOT be reset.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Otherwise a cold boot should be initiated.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * General recommendations:</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o DRAM SHOULD NOT lose power if possible.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *   o Reset time SHOULD be minimized</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void do_board_reset(void);</span><br><span> </span><br><span> /* Super-hard reset specific to some Intel SoCs. */</span><br><span> __noreturn void global_reset(void);</span><br><span>diff --git a/src/lib/Kconfig b/src/lib/Kconfig</span><br><span>index eb4c16e..fcad921 100644</span><br><span>--- a/src/lib/Kconfig</span><br><span>+++ b/src/lib/Kconfig</span><br><span>@@ -1,3 +1,6 @@</span><br><span style="color: hsl(120, 100%, 40%);">+config MISSING_BOARD_RESET</span><br><span style="color: hsl(120, 100%, 40%);">+      bool</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> config NO_EDID_FILL_FB</span><br><span>     bool</span><br><span>         default y if !MAINBOARD_DO_NATIVE_VGA_INIT</span><br><span>diff --git a/src/lib/reset.c b/src/lib/reset.c</span><br><span>index d828421..9c47adf 100644</span><br><span>--- a/src/lib/reset.c</span><br><span>+++ b/src/lib/reset.c</span><br><span>@@ -18,6 +18,21 @@</span><br><span> #include <halt.h></span><br><span> #include <reset.h></span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+__noreturn void board_reset(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     printk(BIOS_INFO, "%s() called!\n", __func__);</span><br><span style="color: hsl(120, 100%, 40%);">+      dcache_clean_all();</span><br><span style="color: hsl(120, 100%, 40%);">+   do_board_reset();</span><br><span style="color: hsl(120, 100%, 40%);">+     halt();</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%);">+#if IS_ENABLED(CONFIG_MISSING_BOARD_RESET)</span><br><span style="color: hsl(120, 100%, 40%);">+void do_board_reset(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        printk(BIOS_CRIT, "No board_reset implementation, hanging...\n");</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> __noreturn static void __hard_reset(void) {</span><br><span>      if (IS_ENABLED(CONFIG_HAVE_HARD_RESET))</span><br><span>              do_hard_reset();</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/29047">change 29047</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/29047"/><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: I274a8cee9cb38226b5a0bdff6a847c74ef0b3128 </div>
<div style="display:none"> Gerrit-Change-Number: 29047 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>