2 * apei-internal.h - ACPI Platform Error Interface internal
6 #ifndef APEI_INTERNAL_H
7 #define APEI_INTERNAL_H
9 #include <linux/cper.h>
11 struct apei_exec_context
;
13 typedef int (*apei_exec_ins_func_t
)(struct apei_exec_context
*ctx
,
14 struct acpi_whea_header
*entry
);
16 #define APEI_EXEC_INS_ACCESS_REGISTER 0x0001
18 struct apei_exec_ins_type
{
20 apei_exec_ins_func_t run
;
23 struct apei_exec_context
{
30 struct apei_exec_ins_type
*ins_table
;
32 struct acpi_whea_header
*action_table
;
36 void apei_exec_ctx_init(struct apei_exec_context
*ctx
,
37 struct apei_exec_ins_type
*ins_table
,
39 struct acpi_whea_header
*action_table
,
42 static inline void apei_exec_ctx_set_input(struct apei_exec_context
*ctx
,
48 static inline u64
apei_exec_ctx_get_output(struct apei_exec_context
*ctx
)
53 int __apei_exec_run(struct apei_exec_context
*ctx
, u8 action
, bool optional
);
55 static inline int apei_exec_run(struct apei_exec_context
*ctx
, u8 action
)
57 return __apei_exec_run(ctx
, action
, 0);
60 /* It is optional whether the firmware provides the action */
61 static inline int apei_exec_run_optional(struct apei_exec_context
*ctx
, u8 action
)
63 return __apei_exec_run(ctx
, action
, 1);
66 /* Common instruction implementation */
68 /* IP has been set in instruction function */
69 #define APEI_EXEC_SET_IP 1
71 int __apei_exec_read_register(struct acpi_whea_header
*entry
, u64
*val
);
72 int __apei_exec_write_register(struct acpi_whea_header
*entry
, u64 val
);
73 int apei_exec_read_register(struct apei_exec_context
*ctx
,
74 struct acpi_whea_header
*entry
);
75 int apei_exec_read_register_value(struct apei_exec_context
*ctx
,
76 struct acpi_whea_header
*entry
);
77 int apei_exec_write_register(struct apei_exec_context
*ctx
,
78 struct acpi_whea_header
*entry
);
79 int apei_exec_write_register_value(struct apei_exec_context
*ctx
,
80 struct acpi_whea_header
*entry
);
81 int apei_exec_noop(struct apei_exec_context
*ctx
,
82 struct acpi_whea_header
*entry
);
83 int apei_exec_pre_map_gars(struct apei_exec_context
*ctx
);
84 int apei_exec_post_unmap_gars(struct apei_exec_context
*ctx
);
86 struct apei_resources
{
87 struct list_head iomem
;
88 struct list_head ioport
;
91 static inline void apei_resources_init(struct apei_resources
*resources
)
93 INIT_LIST_HEAD(&resources
->iomem
);
94 INIT_LIST_HEAD(&resources
->ioport
);
97 void apei_resources_fini(struct apei_resources
*resources
);
98 int apei_resources_add(struct apei_resources
*resources
,
99 unsigned long start
, unsigned long size
,
101 int apei_resources_sub(struct apei_resources
*resources1
,
102 struct apei_resources
*resources2
);
103 int apei_resources_request(struct apei_resources
*resources
,
105 void apei_resources_release(struct apei_resources
*resources
);
106 int apei_exec_collect_resources(struct apei_exec_context
*ctx
,
107 struct apei_resources
*resources
);
110 struct dentry
*apei_get_debugfs_dir(void);
112 #define apei_estatus_for_each_section(estatus, section) \
113 for (section = (struct acpi_hest_generic_data *)(estatus + 1); \
114 (void *)section - (void *)estatus < estatus->data_length; \
115 section = (void *)(section+1) + section->error_data_length)
117 static inline u32
apei_estatus_len(struct acpi_hest_generic_status
*estatus
)
119 if (estatus
->raw_data_length
)
120 return estatus
->raw_data_offset
+ \
121 estatus
->raw_data_length
;
123 return sizeof(*estatus
) + estatus
->data_length
;
126 void apei_estatus_print(const char *pfx
,
127 const struct acpi_hest_generic_status
*estatus
);
128 int apei_estatus_check_header(const struct acpi_hest_generic_status
*estatus
);
129 int apei_estatus_check(const struct acpi_hest_generic_status
*estatus
);
131 int apei_osc_setup(void);
This page took 0.055281 seconds and 5 git commands to generate.