1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 #ifndef GHES_H << 3 #define GHES_H << 4 << 5 #include <acpi/apei.h> 1 #include <acpi/apei.h> 6 #include <acpi/hed.h> 2 #include <acpi/hed.h> 7 3 8 /* 4 /* 9 * One struct ghes is created for each generic 5 * One struct ghes is created for each generic hardware error source. 10 * It provides the context for APEI hardware e 6 * It provides the context for APEI hardware error timer/IRQ/SCI/NMI 11 * handler. 7 * handler. 12 * 8 * 13 * estatus: memory buffer for error status blo 9 * estatus: memory buffer for error status block, allocated during 14 * HEST parsing. 10 * HEST parsing. 15 */ 11 */ >> 12 #define GHES_TO_CLEAR 0x0001 16 #define GHES_EXITING 0x0002 13 #define GHES_EXITING 0x0002 17 14 18 struct ghes { 15 struct ghes { 19 union { !! 16 struct acpi_hest_generic *generic; 20 struct acpi_hest_generic *gene << 21 struct acpi_hest_generic_v2 *g << 22 }; << 23 struct acpi_hest_generic_status *estat 17 struct acpi_hest_generic_status *estatus; >> 18 u64 buffer_paddr; 24 unsigned long flags; 19 unsigned long flags; 25 union { 20 union { 26 struct list_head list; 21 struct list_head list; 27 struct timer_list timer; 22 struct timer_list timer; 28 unsigned int irq; 23 unsigned int irq; 29 }; 24 }; 30 struct device *dev; << 31 struct list_head elist; << 32 }; 25 }; 33 26 34 struct ghes_estatus_node { 27 struct ghes_estatus_node { 35 struct llist_node llnode; 28 struct llist_node llnode; 36 struct acpi_hest_generic *generic; 29 struct acpi_hest_generic *generic; 37 struct ghes *ghes; 30 struct ghes *ghes; 38 << 39 int task_work_cpu; << 40 struct callback_head task_work; << 41 }; 31 }; 42 32 43 struct ghes_estatus_cache { 33 struct ghes_estatus_cache { 44 u32 estatus_len; 34 u32 estatus_len; 45 atomic_t count; 35 atomic_t count; 46 struct acpi_hest_generic *generic; 36 struct acpi_hest_generic *generic; 47 unsigned long long time_in; 37 unsigned long long time_in; 48 struct rcu_head rcu; 38 struct rcu_head rcu; 49 }; 39 }; 50 40 51 enum { 41 enum { 52 GHES_SEV_NO = 0x0, 42 GHES_SEV_NO = 0x0, 53 GHES_SEV_CORRECTED = 0x1, 43 GHES_SEV_CORRECTED = 0x1, 54 GHES_SEV_RECOVERABLE = 0x2, 44 GHES_SEV_RECOVERABLE = 0x2, 55 GHES_SEV_PANIC = 0x3, 45 GHES_SEV_PANIC = 0x3, 56 }; 46 }; 57 47 58 #ifdef CONFIG_ACPI_APEI_GHES !! 48 /* From drivers/edac/ghes_edac.c */ 59 /** << 60 * ghes_register_vendor_record_notifier - regi << 61 * records that the kernel would otherwise ign << 62 * @nb: pointer to the notifier_block structur << 63 * << 64 * return 0 : SUCCESS, non-zero : FAIL << 65 */ << 66 int ghes_register_vendor_record_notifier(struc << 67 << 68 /** << 69 * ghes_unregister_vendor_record_notifier - un << 70 * registered vendor record notifier. << 71 * @nb: pointer to the notifier_block structur << 72 */ << 73 void ghes_unregister_vendor_record_notifier(st << 74 << 75 struct list_head *ghes_get_devices(void); << 76 << 77 void ghes_estatus_pool_region_free(unsigned lo << 78 #else << 79 static inline struct list_head *ghes_get_devic << 80 << 81 static inline void ghes_estatus_pool_region_fr << 82 #endif << 83 << 84 int ghes_estatus_pool_init(unsigned int num_gh << 85 49 86 static inline int acpi_hest_get_version(struct !! 50 #ifdef CONFIG_EDAC_GHES 87 { !! 51 void ghes_edac_report_mem_error(struct ghes *ghes, int sev, 88 return gdata->revision >> 8; !! 52 struct cper_sec_mem_err *mem_err); 89 } << 90 53 91 static inline void *acpi_hest_get_payload(stru !! 54 int ghes_edac_register(struct ghes *ghes, struct device *dev); 92 { << 93 if (acpi_hest_get_version(gdata) >= 3) << 94 return (void *)(((struct acpi_ << 95 55 96 return gdata + 1; !! 56 void ghes_edac_unregister(struct ghes *ghes); 97 } << 98 << 99 static inline int acpi_hest_get_error_length(s << 100 { << 101 return ((struct acpi_hest_generic_data << 102 } << 103 57 104 static inline int acpi_hest_get_size(struct ac !! 58 #else >> 59 static inline void ghes_edac_report_mem_error(struct ghes *ghes, int sev, >> 60 struct cper_sec_mem_err *mem_err) 105 { 61 { 106 if (acpi_hest_get_version(gdata) >= 3) << 107 return sizeof(struct acpi_hest << 108 << 109 return sizeof(struct acpi_hest_generic << 110 } 62 } 111 63 112 static inline int acpi_hest_get_record_size(st !! 64 static inline int ghes_edac_register(struct ghes *ghes, struct device *dev) 113 { 65 { 114 return (acpi_hest_get_size(gdata) + ac !! 66 return 0; 115 } 67 } 116 68 117 static inline void *acpi_hest_get_next(struct !! 69 static inline void ghes_edac_unregister(struct ghes *ghes) 118 { 70 { 119 return (void *)(gdata) + acpi_hest_get << 120 } 71 } 121 << 122 #define apei_estatus_for_each_section(estatus, << 123 for (section = (struct acpi_hest_gener << 124 (void *)section - (void *)(estatu << 125 section = acpi_hest_get_next(sect << 126 << 127 #ifdef CONFIG_ACPI_APEI_SEA << 128 int ghes_notify_sea(void); << 129 #else << 130 static inline int ghes_notify_sea(void) { retu << 131 #endif 72 #endif 132 << 133 struct notifier_block; << 134 extern void ghes_register_report_chain(struct << 135 extern void ghes_unregister_report_chain(struc << 136 #endif /* GHES_H */ << 137 73
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.