1 /* SPDX-License-Identifier: GPL-2.0 */
9 * One struct ghes is created for each generic hardware error source.
10 * It provides the context for APEI hardware error timer/IRQ/SCI/NMI
13 * estatus: memory buffer for error status block, allocated during
16 #define GHES_EXITING 0x0002
20 struct acpi_hest_generic *generic;
21 struct acpi_hest_generic_v2 *generic_v2;
23 struct acpi_hest_generic_status *estatus;
26 struct list_head list;
27 struct timer_list timer;
31 struct list_head elist;
34 struct ghes_estatus_node {
35 struct llist_node llnode;
36 struct acpi_hest_generic *generic;
40 struct callback_head task_work;
43 struct ghes_estatus_cache {
46 struct acpi_hest_generic *generic;
47 unsigned long long time_in;
53 GHES_SEV_CORRECTED = 0x1,
54 GHES_SEV_RECOVERABLE = 0x2,
58 #ifdef CONFIG_ACPI_APEI_GHES
60 * ghes_register_vendor_record_notifier - register a notifier for vendor
61 * records that the kernel would otherwise ignore.
62 * @nb: pointer to the notifier_block structure of the event handler.
64 * return 0 : SUCCESS, non-zero : FAIL
66 int ghes_register_vendor_record_notifier(struct notifier_block *nb);
69 * ghes_unregister_vendor_record_notifier - unregister the previously
70 * registered vendor record notifier.
71 * @nb: pointer to the notifier_block structure of the vendor record handler.
73 void ghes_unregister_vendor_record_notifier(struct notifier_block *nb);
75 struct list_head *ghes_get_devices(void);
77 static inline struct list_head *ghes_get_devices(void) { return NULL; }
80 int ghes_estatus_pool_init(unsigned int num_ghes);
82 static inline int acpi_hest_get_version(struct acpi_hest_generic_data *gdata)
84 return gdata->revision >> 8;
87 static inline void *acpi_hest_get_payload(struct acpi_hest_generic_data *gdata)
89 if (acpi_hest_get_version(gdata) >= 3)
90 return (void *)(((struct acpi_hest_generic_data_v300 *)(gdata)) + 1);
95 static inline int acpi_hest_get_error_length(struct acpi_hest_generic_data *gdata)
97 return ((struct acpi_hest_generic_data *)(gdata))->error_data_length;
100 static inline int acpi_hest_get_size(struct acpi_hest_generic_data *gdata)
102 if (acpi_hest_get_version(gdata) >= 3)
103 return sizeof(struct acpi_hest_generic_data_v300);
105 return sizeof(struct acpi_hest_generic_data);
108 static inline int acpi_hest_get_record_size(struct acpi_hest_generic_data *gdata)
110 return (acpi_hest_get_size(gdata) + acpi_hest_get_error_length(gdata));
113 static inline void *acpi_hest_get_next(struct acpi_hest_generic_data *gdata)
115 return (void *)(gdata) + acpi_hest_get_record_size(gdata);
118 #define apei_estatus_for_each_section(estatus, section) \
119 for (section = (struct acpi_hest_generic_data *)(estatus + 1); \
120 (void *)section - (void *)(estatus + 1) < estatus->data_length; \
121 section = acpi_hest_get_next(section))
123 #ifdef CONFIG_ACPI_APEI_SEA
124 int ghes_notify_sea(void);
126 static inline int ghes_notify_sea(void) { return -ENOENT; }
129 struct notifier_block;
130 extern void ghes_register_report_chain(struct notifier_block *nb);
131 extern void ghes_unregister_report_chain(struct notifier_block *nb);