treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / acpi / acpica / acapps.h
blob173447d50acfa7b02c8f3bd5a863408ea9a26ee7
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /******************************************************************************
4 * Module Name: acapps - common include for ACPI applications/tools
6 * Copyright (C) 2000 - 2020, Intel Corp.
8 *****************************************************************************/
10 #ifndef _ACAPPS
11 #define _ACAPPS
13 #ifdef ACPI_USE_STANDARD_HEADERS
14 #include <sys/stat.h>
15 #endif /* ACPI_USE_STANDARD_HEADERS */
17 /* Common info for tool signons */
19 #define ACPICA_NAME "Intel ACPI Component Architecture"
20 #define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2020 Intel Corporation"
22 #if ACPI_MACHINE_WIDTH == 64
23 #define ACPI_WIDTH " (64-bit version)"
25 #elif ACPI_MACHINE_WIDTH == 32
26 #define ACPI_WIDTH " (32-bit version)"
28 #else
29 #error unknown ACPI_MACHINE_WIDTH
30 #define ACPI_WIDTH " (unknown bit width, not 32 or 64)"
32 #endif
34 /* Macros for signons and file headers */
36 #define ACPI_COMMON_SIGNON(utility_name) \
37 "\n%s\n%s version %8.8X\n%s\n\n", \
38 ACPICA_NAME, \
39 utility_name, ((u32) ACPI_CA_VERSION), \
40 ACPICA_COPYRIGHT
42 #define ACPI_COMMON_HEADER(utility_name, prefix) \
43 "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
44 prefix, ACPICA_NAME, \
45 prefix, utility_name, ((u32) ACPI_CA_VERSION), ACPI_WIDTH, \
46 prefix, ACPICA_COPYRIGHT, \
47 prefix
49 #define ACPI_COMMON_BUILD_TIME \
50 "Build date/time: %s %s\n", __DATE__, __TIME__
52 /* Macros for usage messages */
54 #define ACPI_USAGE_HEADER(usage) \
55 printf ("Usage: %s\nOptions:\n", usage);
57 #define ACPI_USAGE_TEXT(description) \
58 printf (description);
60 #define ACPI_OPTION(name, description) \
61 printf (" %-20s%s\n", name, description);
63 /* Check for unexpected exceptions */
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__); \
72 /* Check for unexpected non-AE_OK errors */
74 #define ACPI_CHECK_OK(name, status) ACPI_CHECK_STATUS (name, status, AE_OK);
76 #define FILE_SUFFIX_DISASSEMBLY "dsl"
77 #define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */
79 /* acfileio */
81 acpi_status
82 ac_get_all_tables_from_file(char *filename,
83 u8 get_only_aml_tables,
84 struct acpi_new_table_desc **return_list_head);
86 void ac_delete_table_list(struct acpi_new_table_desc *list_head);
88 u8 ac_is_file_binary(FILE * file);
90 acpi_status ac_validate_table_header(FILE * file, long table_offset);
92 /* Values for get_only_aml_tables */
94 #define ACPI_GET_ONLY_AML_TABLES TRUE
95 #define ACPI_GET_ALL_TABLES FALSE
98 * getopt
100 int acpi_getopt(int argc, char **argv, char *opts);
102 int acpi_getopt_argument(int argc, char **argv);
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;
110 * cmfsize - Common get file size function
112 u32 cm_get_file_size(ACPI_FILE file);
115 * adwalk
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);
122 void acpi_dm_dump_tree(union acpi_parse_object *origin);
124 void acpi_dm_find_orphan_methods(union acpi_parse_object *origin);
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);
131 void
132 acpi_dm_convert_parse_objects(union acpi_parse_object *parse_tree_root,
133 struct acpi_namespace_node *namespace_root);
136 * adfile
138 acpi_status ad_initialize(void);
140 char *fl_generate_filename(char *input_filename, char *suffix);
142 acpi_status
143 fl_split_input_pathname(char *input_path,
144 char **out_directory_path, char **out_filename);
146 char *fl_get_file_basename(char *file_pathname);
148 char *ad_generate_filename(char *prefix, char *table_id);
150 void
151 ad_write_table(struct acpi_table_header *table,
152 u32 length, char *table_name, char *oem_table_id);
154 #endif /* _ACAPPS */