ghes.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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