]>
Commit | Line | Data |
---|---|---|
95857638 | 1 | /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ |
506f57dd LZ |
2 | /****************************************************************************** |
3 | * | |
4 | * Module Name: acapps - common include for ACPI applications/tools | |
5 | * | |
da6f8320 | 6 | * Copyright (C) 2000 - 2018, Intel Corp. |
506f57dd | 7 | * |
95857638 | 8 | *****************************************************************************/ |
506f57dd LZ |
9 | |
10 | #ifndef _ACAPPS | |
11 | #define _ACAPPS | |
12 | ||
e323c02d LZ |
13 | #ifdef ACPI_USE_STANDARD_HEADERS |
14 | #include <sys/stat.h> | |
15 | #endif /* ACPI_USE_STANDARD_HEADERS */ | |
16 | ||
506f57dd LZ |
17 | /* Common info for tool signons */ |
18 | ||
19 | #define ACPICA_NAME "Intel ACPI Component Architecture" | |
da6f8320 | 20 | #define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2018 Intel Corporation" |
506f57dd LZ |
21 | |
22 | #if ACPI_MACHINE_WIDTH == 64 | |
892411dd | 23 | #define ACPI_WIDTH " (64-bit version)" |
506f57dd LZ |
24 | |
25 | #elif ACPI_MACHINE_WIDTH == 32 | |
892411dd | 26 | #define ACPI_WIDTH " (32-bit version)" |
506f57dd LZ |
27 | |
28 | #else | |
29 | #error unknown ACPI_MACHINE_WIDTH | |
892411dd | 30 | #define ACPI_WIDTH " (unknown bit width, not 32 or 64)" |
506f57dd LZ |
31 | |
32 | #endif | |
33 | ||
34 | /* Macros for signons and file headers */ | |
35 | ||
36 | #define ACPI_COMMON_SIGNON(utility_name) \ | |
892411dd | 37 | "\n%s\n%s version %8.8X\n%s\n\n", \ |
506f57dd | 38 | ACPICA_NAME, \ |
892411dd | 39 | utility_name, ((u32) ACPI_CA_VERSION), \ |
506f57dd LZ |
40 | ACPICA_COPYRIGHT |
41 | ||
42 | #define ACPI_COMMON_HEADER(utility_name, prefix) \ | |
1797d379 | 43 | "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \ |
506f57dd | 44 | prefix, ACPICA_NAME, \ |
1797d379 | 45 | prefix, utility_name, ((u32) ACPI_CA_VERSION), ACPI_WIDTH, \ |
506f57dd LZ |
46 | prefix, ACPICA_COPYRIGHT, \ |
47 | prefix | |
48 | ||
90adf776 BM |
49 | #define ACPI_COMMON_BUILD_TIME \ |
50 | "Build date/time: %s %s\n", __DATE__, __TIME__ | |
51 | ||
506f57dd LZ |
52 | /* Macros for usage messages */ |
53 | ||
54 | #define ACPI_USAGE_HEADER(usage) \ | |
911a9b84 | 55 | printf ("Usage: %s\nOptions:\n", usage); |
d9cf147d LZ |
56 | |
57 | #define ACPI_USAGE_TEXT(description) \ | |
911a9b84 | 58 | printf (description); |
506f57dd LZ |
59 | |
60 | #define ACPI_OPTION(name, description) \ | |
911a9b84 | 61 | printf (" %-20s%s\n", name, description); |
506f57dd | 62 | |
3727ec2a BM |
63 | /* Check for unexpected exceptions */ |
64 | ||
65 | #define ACPI_CHECK_STATUS(name, status, expected) \ | |
66 | if (status != expected) \ | |
67 | { \ | |
68 | acpi_os_printf ("Unexpected %s from %s (%s-%d)\n", \ | |
69 | acpi_format_exception (status), #name, _acpi_module_name, __LINE__); \ | |
70 | } | |
71 | ||
72 | /* Check for unexpected non-AE_OK errors */ | |
73 | ||
74 | #define ACPI_CHECK_OK(name, status) ACPI_CHECK_STATUS (name, status, AE_OK); | |
75 | ||
506f57dd | 76 | #define FILE_SUFFIX_DISASSEMBLY "dsl" |
842e7133 | 77 | #define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */ |
506f57dd | 78 | |
2ba7379b BM |
79 | /* acfileio */ |
80 | ||
81 | acpi_status | |
395ec731 BM |
82 | ac_get_all_tables_from_file(char *filename, |
83 | u8 get_only_aml_tables, | |
84 | struct acpi_new_table_desc **return_list_head); | |
85 | ||
ff7993a7 EK |
86 | void ac_delete_table_list(struct acpi_new_table_desc *list_head); |
87 | ||
395ec731 BM |
88 | u8 ac_is_file_binary(FILE * file); |
89 | ||
90 | acpi_status ac_validate_table_header(FILE * file, long table_offset); | |
2ba7379b BM |
91 | |
92 | /* Values for get_only_aml_tables */ | |
93 | ||
94 | #define ACPI_GET_ONLY_AML_TABLES TRUE | |
95 | #define ACPI_GET_ALL_TABLES FALSE | |
96 | ||
506f57dd LZ |
97 | /* |
98 | * getopt | |
99 | */ | |
100 | int acpi_getopt(int argc, char **argv, char *opts); | |
101 | ||
102 | int acpi_getopt_argument(int argc, char **argv); | |
103 | ||
104 | extern int acpi_gbl_optind; | |
105 | extern int acpi_gbl_opterr; | |
106 | extern int acpi_gbl_sub_opt_char; | |
107 | extern char *acpi_gbl_optarg; | |
108 | ||
109 | /* | |
110 | * cmfsize - Common get file size function | |
111 | */ | |
3c9349c9 | 112 | u32 cm_get_file_size(ACPI_FILE file); |
506f57dd | 113 | |
506f57dd LZ |
114 | /* |
115 | * adwalk | |
116 | */ | |
117 | void | |
118 | acpi_dm_cross_reference_namespace(union acpi_parse_object *parse_tree_root, | |
119 | struct acpi_namespace_node *namespace_root, | |
120 | acpi_owner_id owner_id); | |
121 | ||
122 | void acpi_dm_dump_tree(union acpi_parse_object *origin); | |
123 | ||
124 | void acpi_dm_find_orphan_methods(union acpi_parse_object *origin); | |
125 | ||
126 | void | |
127 | acpi_dm_finish_namespace_load(union acpi_parse_object *parse_tree_root, | |
128 | struct acpi_namespace_node *namespace_root, | |
129 | acpi_owner_id owner_id); | |
130 | ||
131 | void | |
a86c856e DB |
132 | acpi_dm_convert_parse_objects(union acpi_parse_object *parse_tree_root, |
133 | struct acpi_namespace_node *namespace_root); | |
506f57dd LZ |
134 | |
135 | /* | |
136 | * adfile | |
137 | */ | |
138 | acpi_status ad_initialize(void); | |
139 | ||
140 | char *fl_generate_filename(char *input_filename, char *suffix); | |
141 | ||
142 | acpi_status | |
143 | fl_split_input_pathname(char *input_path, | |
144 | char **out_directory_path, char **out_filename); | |
145 | ||
146 | char *ad_generate_filename(char *prefix, char *table_id); | |
147 | ||
148 | void | |
149 | ad_write_table(struct acpi_table_header *table, | |
150 | u32 length, char *table_name, char *oem_table_id); | |
506f57dd LZ |
151 | |
152 | #endif /* _ACAPPS */ |