summaryrefslogtreecommitdiff
path: root/include/sbi/sbi_system.h
diff options
context:
space:
mode:
authorNikita Shubin <n.shubin@yadro.com>2021-10-01 11:31:16 +0300
committerAnup Patel <anup@brainfault.org>2021-10-11 07:29:29 +0300
commit516161c46f0d3c73bf6a57e551d6e2489912fc03 (patch)
treea2186bbe2c1ac5817c9cce98cd79519e5e7a4752 /include/sbi/sbi_system.h
parent754d51192b6bf6a4afd9d46c5f736a9f6dd1b404 (diff)
downloadopensbi-516161c46f0d3c73bf6a57e551d6e2489912fc03.tar.xz
lib: sbi: convert reset to list
To support different handlers for different types of resets, we are adding a sbi_list of restart handlers. Instead of sbi_system_reset_set_device we use sbi_system_reset_add_device to reflect the actual meaning. Signed-off-by: Nikita Shubin <n.shubin@yadro.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'include/sbi/sbi_system.h')
-rw-r--r--include/sbi/sbi_system.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/sbi/sbi_system.h b/include/sbi/sbi_system.h
index a9fa546..84c2813 100644
--- a/include/sbi/sbi_system.h
+++ b/include/sbi/sbi_system.h
@@ -11,6 +11,7 @@
#define __SBI_SYSTEM_H__
#include <sbi/sbi_types.h>
+#include <sbi/sbi_list.h>
/** System reset hardware device */
struct sbi_system_reset_device {
@@ -22,11 +23,21 @@ struct sbi_system_reset_device {
/** Reset the system */
void (*system_reset)(u32 reset_type, u32 reset_reason);
+
+ /** List */
+ struct sbi_dlist node;
};
-const struct sbi_system_reset_device *sbi_system_reset_get_device(void);
+static inline struct sbi_system_reset_device *to_system_reset_device(
+ struct sbi_dlist *node)
+{
+ return container_of(node, struct sbi_system_reset_device, node);
+}
+
+const struct sbi_system_reset_device *sbi_system_reset_get_device(
+ u32 reset_type, u32 reset_reason);
-void sbi_system_reset_set_device(const struct sbi_system_reset_device *dev);
+void sbi_system_reset_add_device(struct sbi_system_reset_device *dev);
bool sbi_system_reset_supported(u32 reset_type, u32 reset_reason);