mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-06-22 22:28:19 +00:00
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>
This commit is contained in:
parent
754d51192b
commit
516161c46f
10 changed files with 50 additions and 25 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
void sbi_system_reset_set_device(const struct sbi_system_reset_device *dev);
|
||||
const struct sbi_system_reset_device *sbi_system_reset_get_device(
|
||||
u32 reset_type, u32 reset_reason);
|
||||
|
||||
void sbi_system_reset_add_device(struct sbi_system_reset_device *dev);
|
||||
|
||||
bool sbi_system_reset_supported(u32 reset_type, u32 reset_reason);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue