sbi_system.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2019 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. */
  9. #ifndef __SBI_SYSTEM_H__
  10. #define __SBI_SYSTEM_H__
  11. #include <sbi/sbi_types.h>
  12. #include <sbi/sbi_list.h>
  13. /** System reset hardware device */
  14. struct sbi_system_reset_device {
  15. /** Name of the system reset device */
  16. char name[32];
  17. /* Check whether reset type and reason supported by the device */
  18. int (*system_reset_check)(u32 reset_type, u32 reset_reason);
  19. /** Reset the system */
  20. void (*system_reset)(u32 reset_type, u32 reset_reason);
  21. /** List */
  22. struct sbi_dlist node;
  23. };
  24. static inline struct sbi_system_reset_device *to_system_reset_device(
  25. struct sbi_dlist *node)
  26. {
  27. return container_of(node, struct sbi_system_reset_device, node);
  28. }
  29. const struct sbi_system_reset_device *sbi_system_reset_get_device(
  30. u32 reset_type, u32 reset_reason);
  31. void sbi_system_reset_add_device(struct sbi_system_reset_device *dev);
  32. bool sbi_system_reset_supported(u32 reset_type, u32 reset_reason);
  33. void __noreturn sbi_system_reset(u32 reset_type, u32 reset_reason);
  34. #endif