diff options
Diffstat (limited to 'drivers/acpi/apei/apei-internal.h')
-rw-r--r-- | drivers/acpi/apei/apei-internal.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h new file mode 100644 index 000000000000..86e041a42c44 --- /dev/null +++ b/drivers/acpi/apei/apei-internal.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * apei-internal.h - ACPI Platform Error Interface internal | ||
3 | * definations. | ||
4 | */ | ||
5 | |||
6 | #ifndef APEI_INTERNAL_H | ||
7 | #define APEI_INTERNAL_H | ||
8 | |||
9 | struct apei_exec_context; | ||
10 | |||
11 | typedef int (*apei_exec_ins_func_t)(struct apei_exec_context *ctx, | ||
12 | struct acpi_whea_header *entry); | ||
13 | |||
14 | #define APEI_EXEC_INS_ACCESS_REGISTER 0x0001 | ||
15 | |||
16 | struct apei_exec_ins_type { | ||
17 | u32 flags; | ||
18 | apei_exec_ins_func_t run; | ||
19 | }; | ||
20 | |||
21 | struct apei_exec_context { | ||
22 | u32 ip; | ||
23 | u64 value; | ||
24 | u64 var1; | ||
25 | u64 var2; | ||
26 | u64 src_base; | ||
27 | u64 dst_base; | ||
28 | struct apei_exec_ins_type *ins_table; | ||
29 | u32 instructions; | ||
30 | struct acpi_whea_header *action_table; | ||
31 | u32 entries; | ||
32 | }; | ||
33 | |||
34 | void apei_exec_ctx_init(struct apei_exec_context *ctx, | ||
35 | struct apei_exec_ins_type *ins_table, | ||
36 | u32 instructions, | ||
37 | struct acpi_whea_header *action_table, | ||
38 | u32 entries); | ||
39 | |||
40 | static inline void apei_exec_ctx_set_input(struct apei_exec_context *ctx, | ||
41 | u64 input) | ||
42 | { | ||
43 | ctx->value = input; | ||
44 | } | ||
45 | |||
46 | static inline u64 apei_exec_ctx_get_output(struct apei_exec_context *ctx) | ||
47 | { | ||
48 | return ctx->value; | ||
49 | } | ||
50 | |||
51 | int apei_exec_run(struct apei_exec_context *ctx, u8 action); | ||
52 | |||
53 | /* Common instruction implementation */ | ||
54 | |||
55 | /* IP has been set in instruction function */ | ||
56 | #define APEI_EXEC_SET_IP 1 | ||
57 | |||
58 | int __apei_exec_read_register(struct acpi_whea_header *entry, u64 *val); | ||
59 | int __apei_exec_write_register(struct acpi_whea_header *entry, u64 val); | ||
60 | int apei_exec_read_register(struct apei_exec_context *ctx, | ||
61 | struct acpi_whea_header *entry); | ||
62 | int apei_exec_read_register_value(struct apei_exec_context *ctx, | ||
63 | struct acpi_whea_header *entry); | ||
64 | int apei_exec_write_register(struct apei_exec_context *ctx, | ||
65 | struct acpi_whea_header *entry); | ||
66 | int apei_exec_write_register_value(struct apei_exec_context *ctx, | ||
67 | struct acpi_whea_header *entry); | ||
68 | int apei_exec_noop(struct apei_exec_context *ctx, | ||
69 | struct acpi_whea_header *entry); | ||
70 | int apei_exec_pre_map_gars(struct apei_exec_context *ctx); | ||
71 | int apei_exec_post_unmap_gars(struct apei_exec_context *ctx); | ||
72 | |||
73 | struct apei_resources { | ||
74 | struct list_head iomem; | ||
75 | struct list_head ioport; | ||
76 | }; | ||
77 | |||
78 | static inline void apei_resources_init(struct apei_resources *resources) | ||
79 | { | ||
80 | INIT_LIST_HEAD(&resources->iomem); | ||
81 | INIT_LIST_HEAD(&resources->ioport); | ||
82 | } | ||
83 | |||
84 | void apei_resources_fini(struct apei_resources *resources); | ||
85 | int apei_resources_sub(struct apei_resources *resources1, | ||
86 | struct apei_resources *resources2); | ||
87 | int apei_resources_request(struct apei_resources *resources, | ||
88 | const char *desc); | ||
89 | void apei_resources_release(struct apei_resources *resources); | ||
90 | int apei_exec_collect_resources(struct apei_exec_context *ctx, | ||
91 | struct apei_resources *resources); | ||
92 | |||
93 | struct dentry; | ||
94 | struct dentry *apei_get_debugfs_dir(void); | ||
95 | #endif | ||