summaryrefslogtreecommitdiff
path: root/src/include/reset.h
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-05-18 16:03:26 -0700
committerJulius Werner <jwerner@chromium.org>2017-06-13 20:53:09 +0200
commit01f9aa5e54cf55ecca1b35185373835e61f10615 (patch)
tree8cd1ecb517bd948ac2dc2616de789a84a999a911 /src/include/reset.h
parentd9762f70acc1cc2db5b3905756f5f5a995b9a21a (diff)
downloadcoreboot-01f9aa5e54cf55ecca1b35185373835e61f10615.tar.xz
Consolidate reset API, add generic reset_prepare mechanism
There are many good reasons why we may want to run some sort of generic callback before we're executing a reset. Unfortunateley, that is really hard right now: code that wants to reset simply calls the hard_reset() function (or one of its ill-differentiated cousins) which is directly implemented by a myriad of different mainboards, northbridges, SoCs, etc. More recent x86 SoCs have tried to solve the problem in their own little corner of soc/intel/common, but it's really something that would benefit all of coreboot. This patch expands the concept onto all boards: hard_reset() and friends get implemented in a generic location where they can run hooks before calling the platform-specific implementation that is now called do_hard_reset(). The existing Intel reset_prepare() gets generalized as soc_reset_prepare() (and other hooks for arch, mainboard, etc. can now easily be added later if necessary). We will also use this central point to ensure all platforms flush their cache before reset, which is generally useful for all cases where we're trying to persist information in RAM across reboots (like the new persistent CBMEM console does). Also remove cpu_reset() completely since it's not used anywhere and doesn't seem very useful compared to the others. Change-Id: I41b89ce4a923102f0748922496e1dd9bce8a610f Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/19789 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/include/reset.h')
-rw-r--r--src/include/reset.h37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/include/reset.h b/src/include/reset.h
index f7501b53da..934ed9b1fc 100644
--- a/src/include/reset.h
+++ b/src/include/reset.h
@@ -1,15 +1,30 @@
#ifndef RESET_H
#define RESET_H
-#if CONFIG_HAVE_HARD_RESET
-void hard_reset(void);
-#else
-#define hard_reset() do {} while (0)
-#endif
-void soft_reset(void);
-void cpu_reset(void);
-/* Some Intel SoCs use a special reset that is specific to SoC */
-void global_reset(void);
-/* Some Intel SoCs may need to prepare/wait before reset */
-void reset_prepare(void);
+/* Generic reset functions. Call from code that wants to trigger a reset. */
+
+/* Super-hard reset specific to some Intel SoCs. */
+__attribute__((noreturn)) void global_reset(void);
+/* Full board reset. Resets SoC and most/all board components (e.g. DRAM). */
+__attribute__((noreturn)) void hard_reset(void);
+/* Board reset. Resets SoC some board components (e.g. TPM but not DRAM). */
+__attribute__((noreturn)) void soft_reset(void);
+
+/* Reset implementations. Implement these in SoC or mainboard code. Implement
+ at least hard_reset() if possible, others fall back to it if necessary. */
+void do_global_reset(void);
+void do_hard_reset(void);
+void do_soft_reset(void);
+
+enum reset_type { /* listed in order of softness */
+ GLOBAL_RESET,
+ HARD_RESET,
+ SOFT_RESET,
+};
+
+/* Callback that an SoC may override to perform special actions before reset.
+ Take into account that softer resets may fall back to harder resets if not
+ implemented... this will *not* trigger another callback! */
+void soc_reset_prepare(enum reset_type reset_type);
+
#endif