ghes.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <acpi/apei.h>
  2. #include <acpi/hed.h>
  3. /*
  4. * One struct ghes is created for each generic hardware error source.
  5. * It provides the context for APEI hardware error timer/IRQ/SCI/NMI
  6. * handler.
  7. *
  8. * estatus: memory buffer for error status block, allocated during
  9. * HEST parsing.
  10. */
  11. #define GHES_TO_CLEAR 0x0001
  12. #define GHES_EXITING 0x0002
  13. struct ghes {
  14. struct acpi_hest_generic *generic;
  15. struct acpi_hest_generic_status *estatus;
  16. u64 buffer_paddr;
  17. unsigned long flags;
  18. union {
  19. struct list_head list;
  20. struct timer_list timer;
  21. unsigned int irq;
  22. };
  23. };
  24. struct ghes_estatus_node {
  25. struct llist_node llnode;
  26. struct acpi_hest_generic *generic;
  27. struct ghes *ghes;
  28. };
  29. struct ghes_estatus_cache {
  30. u32 estatus_len;
  31. atomic_t count;
  32. struct acpi_hest_generic *generic;
  33. unsigned long long time_in;
  34. struct rcu_head rcu;
  35. };
  36. enum {
  37. GHES_SEV_NO = 0x0,
  38. GHES_SEV_CORRECTED = 0x1,
  39. GHES_SEV_RECOVERABLE = 0x2,
  40. GHES_SEV_PANIC = 0x3,
  41. };
  42. /* From drivers/edac/ghes_edac.c */
  43. #ifdef CONFIG_EDAC_GHES
  44. void ghes_edac_report_mem_error(struct ghes *ghes, int sev,
  45. struct cper_sec_mem_err *mem_err);
  46. int ghes_edac_register(struct ghes *ghes, struct device *dev);
  47. void ghes_edac_unregister(struct ghes *ghes);
  48. #else
  49. static inline void ghes_edac_report_mem_error(struct ghes *ghes, int sev,
  50. struct cper_sec_mem_err *mem_err)
  51. {
  52. }
  53. static inline int ghes_edac_register(struct ghes *ghes, struct device *dev)
  54. {
  55. return 0;
  56. }
  57. static inline void ghes_edac_unregister(struct ghes *ghes)
  58. {
  59. }
  60. #endif