| xj | b04a402 | 2021-11-25 15:01:52 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ |
| 2 | /****************************************************************************** |
| 3 | * |
| 4 | * Name: acnamesp.h - Namespace subcomponent prototypes and defines |
| 5 | * |
| 6 | * Copyright (C) 2000 - 2018, Intel Corp. |
| 7 | * |
| 8 | *****************************************************************************/ |
| 9 | |
| 10 | #ifndef __ACNAMESP_H__ |
| 11 | #define __ACNAMESP_H__ |
| 12 | |
| 13 | /* To search the entire name space, pass this as search_base */ |
| 14 | |
| 15 | #define ACPI_NS_ALL ((acpi_handle)0) |
| 16 | |
| 17 | /* |
| 18 | * Elements of acpi_ns_properties are bit significant |
| 19 | * and should be one-to-one with values of acpi_object_type |
| 20 | */ |
| 21 | #define ACPI_NS_NORMAL 0 |
| 22 | #define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ |
| 23 | #define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ |
| 24 | |
| 25 | /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ |
| 26 | |
| 27 | #define ACPI_NS_NO_UPSEARCH 0 |
| 28 | #define ACPI_NS_SEARCH_PARENT 0x0001 |
| 29 | #define ACPI_NS_DONT_OPEN_SCOPE 0x0002 |
| 30 | #define ACPI_NS_NO_PEER_SEARCH 0x0004 |
| 31 | #define ACPI_NS_ERROR_IF_FOUND 0x0008 |
| 32 | #define ACPI_NS_PREFIX_IS_SCOPE 0x0010 |
| 33 | #define ACPI_NS_EXTERNAL 0x0020 |
| 34 | #define ACPI_NS_TEMPORARY 0x0040 |
| 35 | #define ACPI_NS_OVERRIDE_IF_FOUND 0x0080 |
| 36 | #define ACPI_NS_EARLY_INIT 0x0100 |
| 37 | |
| 38 | /* Flags for acpi_ns_walk_namespace */ |
| 39 | |
| 40 | #define ACPI_NS_WALK_NO_UNLOCK 0 |
| 41 | #define ACPI_NS_WALK_UNLOCK 0x01 |
| 42 | #define ACPI_NS_WALK_TEMP_NODES 0x02 |
| 43 | |
| 44 | /* Object is not a package element */ |
| 45 | |
| 46 | #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX |
| 47 | #define ACPI_ALL_PACKAGE_ELEMENTS (ACPI_UINT32_MAX-1) |
| 48 | |
| 49 | /* Always emit warning message, not dependent on node flags */ |
| 50 | |
| 51 | #define ACPI_WARN_ALWAYS 0 |
| 52 | |
| 53 | /* |
| 54 | * nsinit - Namespace initialization |
| 55 | */ |
| 56 | acpi_status acpi_ns_initialize_objects(void); |
| 57 | |
| 58 | acpi_status acpi_ns_initialize_devices(u32 flags); |
| 59 | |
| 60 | acpi_status |
| 61 | acpi_ns_init_one_package(acpi_handle obj_handle, |
| 62 | u32 level, void *context, void **return_value); |
| 63 | |
| 64 | /* |
| 65 | * nsload - Namespace loading |
| 66 | */ |
| 67 | acpi_status acpi_ns_load_namespace(void); |
| 68 | |
| 69 | acpi_status |
| 70 | acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node); |
| 71 | |
| 72 | /* |
| 73 | * nswalk - walk the namespace |
| 74 | */ |
| 75 | acpi_status |
| 76 | acpi_ns_walk_namespace(acpi_object_type type, |
| 77 | acpi_handle start_object, |
| 78 | u32 max_depth, |
| 79 | u32 flags, |
| 80 | acpi_walk_callback descending_callback, |
| 81 | acpi_walk_callback ascending_callback, |
| 82 | void *context, void **return_value); |
| 83 | |
| 84 | struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node |
| 85 | *parent, |
| 86 | struct acpi_namespace_node |
| 87 | *child); |
| 88 | |
| 89 | struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type, |
| 90 | struct |
| 91 | acpi_namespace_node |
| 92 | *parent, |
| 93 | struct |
| 94 | acpi_namespace_node |
| 95 | *child); |
| 96 | |
| 97 | /* |
| 98 | * nsparse - table parsing |
| 99 | */ |
| 100 | acpi_status |
| 101 | acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node); |
| 102 | |
| 103 | acpi_status |
| 104 | acpi_ns_execute_table(u32 table_index, struct acpi_namespace_node *start_node); |
| 105 | |
| 106 | acpi_status |
| 107 | acpi_ns_one_complete_parse(u32 pass_number, |
| 108 | u32 table_index, |
| 109 | struct acpi_namespace_node *start_node); |
| 110 | |
| 111 | /* |
| 112 | * nsaccess - Top-level namespace access |
| 113 | */ |
| 114 | acpi_status acpi_ns_root_initialize(void); |
| 115 | |
| 116 | acpi_status |
| 117 | acpi_ns_lookup(union acpi_generic_state *scope_info, |
| 118 | char *name, |
| 119 | acpi_object_type type, |
| 120 | acpi_interpreter_mode interpreter_mode, |
| 121 | u32 flags, |
| 122 | struct acpi_walk_state *walk_state, |
| 123 | struct acpi_namespace_node **ret_node); |
| 124 | |
| 125 | /* |
| 126 | * nsalloc - Named object allocation/deallocation |
| 127 | */ |
| 128 | struct acpi_namespace_node *acpi_ns_create_node(u32 name); |
| 129 | |
| 130 | void acpi_ns_delete_node(struct acpi_namespace_node *node); |
| 131 | |
| 132 | void acpi_ns_remove_node(struct acpi_namespace_node *node); |
| 133 | |
| 134 | void |
| 135 | acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle); |
| 136 | |
| 137 | void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id); |
| 138 | |
| 139 | void acpi_ns_detach_object(struct acpi_namespace_node *node); |
| 140 | |
| 141 | void acpi_ns_delete_children(struct acpi_namespace_node *parent); |
| 142 | |
| 143 | int acpi_ns_compare_names(char *name1, char *name2); |
| 144 | |
| 145 | /* |
| 146 | * nsconvert - Dynamic object conversion routines |
| 147 | */ |
| 148 | acpi_status |
| 149 | acpi_ns_convert_to_integer(union acpi_operand_object *original_object, |
| 150 | union acpi_operand_object **return_object); |
| 151 | |
| 152 | acpi_status |
| 153 | acpi_ns_convert_to_string(union acpi_operand_object *original_object, |
| 154 | union acpi_operand_object **return_object); |
| 155 | |
| 156 | acpi_status |
| 157 | acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, |
| 158 | union acpi_operand_object **return_object); |
| 159 | |
| 160 | acpi_status |
| 161 | acpi_ns_convert_to_unicode(struct acpi_namespace_node *scope, |
| 162 | union acpi_operand_object *original_object, |
| 163 | union acpi_operand_object **return_object); |
| 164 | |
| 165 | acpi_status |
| 166 | acpi_ns_convert_to_resource(struct acpi_namespace_node *scope, |
| 167 | union acpi_operand_object *original_object, |
| 168 | union acpi_operand_object **return_object); |
| 169 | |
| 170 | acpi_status |
| 171 | acpi_ns_convert_to_reference(struct acpi_namespace_node *scope, |
| 172 | union acpi_operand_object *original_object, |
| 173 | union acpi_operand_object **return_object); |
| 174 | |
| 175 | /* |
| 176 | * nsdump - Namespace dump/print utilities |
| 177 | */ |
| 178 | void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth); |
| 179 | |
| 180 | void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level); |
| 181 | |
| 182 | void |
| 183 | acpi_ns_dump_pathname(acpi_handle handle, |
| 184 | const char *msg, u32 level, u32 component); |
| 185 | |
| 186 | void acpi_ns_print_pathname(u32 num_segments, const char *pathname); |
| 187 | |
| 188 | acpi_status |
| 189 | acpi_ns_dump_one_object(acpi_handle obj_handle, |
| 190 | u32 level, void *context, void **return_value); |
| 191 | |
| 192 | void |
| 193 | acpi_ns_dump_objects(acpi_object_type type, |
| 194 | u8 display_type, |
| 195 | u32 max_depth, |
| 196 | acpi_owner_id owner_id, acpi_handle start_handle); |
| 197 | |
| 198 | void |
| 199 | acpi_ns_dump_object_paths(acpi_object_type type, |
| 200 | u8 display_type, |
| 201 | u32 max_depth, |
| 202 | acpi_owner_id owner_id, acpi_handle start_handle); |
| 203 | |
| 204 | /* |
| 205 | * nseval - Namespace evaluation functions |
| 206 | */ |
| 207 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); |
| 208 | |
| 209 | void acpi_ns_exec_module_code_list(void); |
| 210 | |
| 211 | /* |
| 212 | * nsarguments - Argument count/type checking for predefined/reserved names |
| 213 | */ |
| 214 | void |
| 215 | acpi_ns_check_argument_count(char *pathname, |
| 216 | struct acpi_namespace_node *node, |
| 217 | u32 user_param_count, |
| 218 | const union acpi_predefined_info *info); |
| 219 | |
| 220 | void |
| 221 | acpi_ns_check_acpi_compliance(char *pathname, |
| 222 | struct acpi_namespace_node *node, |
| 223 | const union acpi_predefined_info *predefined); |
| 224 | |
| 225 | void acpi_ns_check_argument_types(struct acpi_evaluate_info *info); |
| 226 | |
| 227 | /* |
| 228 | * nspredef - Return value checking for predefined/reserved names |
| 229 | */ |
| 230 | acpi_status |
| 231 | acpi_ns_check_return_value(struct acpi_namespace_node *node, |
| 232 | struct acpi_evaluate_info *info, |
| 233 | u32 user_param_count, |
| 234 | acpi_status return_status, |
| 235 | union acpi_operand_object **return_object); |
| 236 | |
| 237 | acpi_status |
| 238 | acpi_ns_check_object_type(struct acpi_evaluate_info *info, |
| 239 | union acpi_operand_object **return_object_ptr, |
| 240 | u32 expected_btypes, u32 package_index); |
| 241 | |
| 242 | /* |
| 243 | * nsprepkg - Validation of predefined name packages |
| 244 | */ |
| 245 | acpi_status |
| 246 | acpi_ns_check_package(struct acpi_evaluate_info *info, |
| 247 | union acpi_operand_object **return_object_ptr); |
| 248 | |
| 249 | /* |
| 250 | * nsnames - Name and Scope manipulation |
| 251 | */ |
| 252 | u32 acpi_ns_opens_scope(acpi_object_type type); |
| 253 | |
| 254 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); |
| 255 | |
| 256 | u32 |
| 257 | acpi_ns_build_normalized_path(struct acpi_namespace_node *node, |
| 258 | char *full_path, u32 path_size, u8 no_trailing); |
| 259 | |
| 260 | char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, |
| 261 | u8 no_trailing); |
| 262 | |
| 263 | char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope, |
| 264 | const char *internal_path); |
| 265 | |
| 266 | char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); |
| 267 | |
| 268 | acpi_status |
| 269 | acpi_ns_handle_to_name(acpi_handle target_handle, struct acpi_buffer *buffer); |
| 270 | |
| 271 | acpi_status |
| 272 | acpi_ns_handle_to_pathname(acpi_handle target_handle, |
| 273 | struct acpi_buffer *buffer, u8 no_trailing); |
| 274 | |
| 275 | u8 |
| 276 | acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); |
| 277 | |
| 278 | acpi_status |
| 279 | acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node, |
| 280 | const char *external_pathname, |
| 281 | u32 flags, struct acpi_namespace_node **out_node); |
| 282 | |
| 283 | acpi_status |
| 284 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
| 285 | const char *external_pathname, |
| 286 | u32 flags, struct acpi_namespace_node **out_node); |
| 287 | |
| 288 | acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); |
| 289 | |
| 290 | /* |
| 291 | * nsobject - Object management for namespace nodes |
| 292 | */ |
| 293 | acpi_status |
| 294 | acpi_ns_attach_object(struct acpi_namespace_node *node, |
| 295 | union acpi_operand_object *object, acpi_object_type type); |
| 296 | |
| 297 | union acpi_operand_object *acpi_ns_get_attached_object(struct |
| 298 | acpi_namespace_node |
| 299 | *node); |
| 300 | |
| 301 | union acpi_operand_object *acpi_ns_get_secondary_object(union |
| 302 | acpi_operand_object |
| 303 | *obj_desc); |
| 304 | |
| 305 | acpi_status |
| 306 | acpi_ns_attach_data(struct acpi_namespace_node *node, |
| 307 | acpi_object_handler handler, void *data); |
| 308 | |
| 309 | acpi_status |
| 310 | acpi_ns_detach_data(struct acpi_namespace_node *node, |
| 311 | acpi_object_handler handler); |
| 312 | |
| 313 | acpi_status |
| 314 | acpi_ns_get_attached_data(struct acpi_namespace_node *node, |
| 315 | acpi_object_handler handler, void **data); |
| 316 | |
| 317 | /* |
| 318 | * nsrepair - General return object repair for all |
| 319 | * predefined methods/objects |
| 320 | */ |
| 321 | acpi_status |
| 322 | acpi_ns_simple_repair(struct acpi_evaluate_info *info, |
| 323 | u32 expected_btypes, |
| 324 | u32 package_index, |
| 325 | union acpi_operand_object **return_object_ptr); |
| 326 | |
| 327 | acpi_status |
| 328 | acpi_ns_wrap_with_package(struct acpi_evaluate_info *info, |
| 329 | union acpi_operand_object *original_object, |
| 330 | union acpi_operand_object **obj_desc_ptr); |
| 331 | |
| 332 | acpi_status |
| 333 | acpi_ns_repair_null_element(struct acpi_evaluate_info *info, |
| 334 | u32 expected_btypes, |
| 335 | u32 package_index, |
| 336 | union acpi_operand_object **return_object_ptr); |
| 337 | |
| 338 | void |
| 339 | acpi_ns_remove_null_elements(struct acpi_evaluate_info *info, |
| 340 | u8 package_type, |
| 341 | union acpi_operand_object *obj_desc); |
| 342 | |
| 343 | /* |
| 344 | * nsrepair2 - Return object repair for specific |
| 345 | * predefined methods/objects |
| 346 | */ |
| 347 | acpi_status |
| 348 | acpi_ns_complex_repairs(struct acpi_evaluate_info *info, |
| 349 | struct acpi_namespace_node *node, |
| 350 | acpi_status validate_status, |
| 351 | union acpi_operand_object **return_object_ptr); |
| 352 | |
| 353 | /* |
| 354 | * nssearch - Namespace searching and entry |
| 355 | */ |
| 356 | acpi_status |
| 357 | acpi_ns_search_and_enter(u32 entry_name, |
| 358 | struct acpi_walk_state *walk_state, |
| 359 | struct acpi_namespace_node *node, |
| 360 | acpi_interpreter_mode interpreter_mode, |
| 361 | acpi_object_type type, |
| 362 | u32 flags, struct acpi_namespace_node **ret_node); |
| 363 | |
| 364 | acpi_status |
| 365 | acpi_ns_search_one_scope(u32 entry_name, |
| 366 | struct acpi_namespace_node *node, |
| 367 | acpi_object_type type, |
| 368 | struct acpi_namespace_node **ret_node); |
| 369 | |
| 370 | void |
| 371 | acpi_ns_install_node(struct acpi_walk_state *walk_state, |
| 372 | struct acpi_namespace_node *parent_node, |
| 373 | struct acpi_namespace_node *node, acpi_object_type type); |
| 374 | |
| 375 | /* |
| 376 | * nsutils - Utility functions |
| 377 | */ |
| 378 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); |
| 379 | |
| 380 | u32 acpi_ns_local(acpi_object_type type); |
| 381 | |
| 382 | void |
| 383 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); |
| 384 | |
| 385 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); |
| 386 | |
| 387 | void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info); |
| 388 | |
| 389 | acpi_status |
| 390 | acpi_ns_internalize_name(const char *dotted_name, char **converted_name); |
| 391 | |
| 392 | acpi_status |
| 393 | acpi_ns_externalize_name(u32 internal_name_length, |
| 394 | const char *internal_name, |
| 395 | u32 * converted_name_length, char **converted_name); |
| 396 | |
| 397 | struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle); |
| 398 | |
| 399 | void acpi_ns_terminate(void); |
| 400 | |
| 401 | #endif /* __ACNAMESP_H__ */ |