Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Name: acnamesp.h - Namespace subcomponent prototypes and defines |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
| 8 | * Copyright (C) 2000 - 2005, R. Byron Moore |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions, and the following disclaimer, |
| 16 | * without modification. |
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 20 | * including a substantially similar Disclaimer requirement for further |
| 21 | * binary redistribution. |
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 23 | * of any contributors may be used to endorse or promote products derived |
| 24 | * from this software without specific prior written permission. |
| 25 | * |
| 26 | * Alternatively, this software may be distributed under the terms of the |
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 28 | * Software Foundation. |
| 29 | * |
| 30 | * NO WARRANTY |
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ |
| 43 | |
| 44 | #ifndef __ACNAMESP_H__ |
| 45 | #define __ACNAMESP_H__ |
| 46 | |
| 47 | |
| 48 | /* To search the entire name space, pass this as search_base */ |
| 49 | |
| 50 | #define ACPI_NS_ALL ((acpi_handle)0) |
| 51 | |
| 52 | /* |
| 53 | * Elements of acpi_ns_properties are bit significant |
| 54 | * and should be one-to-one with values of acpi_object_type |
| 55 | */ |
| 56 | #define ACPI_NS_NORMAL 0 |
| 57 | #define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ |
| 58 | #define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ |
| 59 | |
| 60 | |
| 61 | /* Definitions of the predefined namespace names */ |
| 62 | |
| 63 | #define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ |
| 64 | #define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ |
| 65 | #define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ |
| 66 | |
| 67 | #define ACPI_NS_ROOT_PATH "\\" |
| 68 | #define ACPI_NS_SYSTEM_BUS "_SB_" |
| 69 | |
| 70 | |
| 71 | /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ |
| 72 | |
| 73 | #define ACPI_NS_NO_UPSEARCH 0 |
| 74 | #define ACPI_NS_SEARCH_PARENT 0x01 |
| 75 | #define ACPI_NS_DONT_OPEN_SCOPE 0x02 |
| 76 | #define ACPI_NS_NO_PEER_SEARCH 0x04 |
| 77 | #define ACPI_NS_ERROR_IF_FOUND 0x08 |
| 78 | |
| 79 | #define ACPI_NS_WALK_UNLOCK TRUE |
| 80 | #define ACPI_NS_WALK_NO_UNLOCK FALSE |
| 81 | |
| 82 | |
| 83 | acpi_status |
| 84 | acpi_ns_load_namespace ( |
| 85 | void); |
| 86 | |
| 87 | acpi_status |
| 88 | acpi_ns_initialize_objects ( |
| 89 | void); |
| 90 | |
| 91 | acpi_status |
| 92 | acpi_ns_initialize_devices ( |
| 93 | void); |
| 94 | |
| 95 | |
| 96 | /* Namespace init - nsxfinit */ |
| 97 | |
| 98 | acpi_status |
| 99 | acpi_ns_init_one_device ( |
| 100 | acpi_handle obj_handle, |
| 101 | u32 nesting_level, |
| 102 | void *context, |
| 103 | void **return_value); |
| 104 | |
| 105 | acpi_status |
| 106 | acpi_ns_init_one_object ( |
| 107 | acpi_handle obj_handle, |
| 108 | u32 level, |
| 109 | void *context, |
| 110 | void **return_value); |
| 111 | |
| 112 | |
| 113 | acpi_status |
| 114 | acpi_ns_walk_namespace ( |
| 115 | acpi_object_type type, |
| 116 | acpi_handle start_object, |
| 117 | u32 max_depth, |
| 118 | u8 unlock_before_callback, |
| 119 | acpi_walk_callback user_function, |
| 120 | void *context, |
| 121 | void **return_value); |
| 122 | |
| 123 | struct acpi_namespace_node * |
| 124 | acpi_ns_get_next_node ( |
| 125 | acpi_object_type type, |
| 126 | struct acpi_namespace_node *parent, |
| 127 | struct acpi_namespace_node *child); |
| 128 | |
| 129 | void |
| 130 | acpi_ns_delete_namespace_by_owner ( |
| 131 | u16 table_id); |
| 132 | |
| 133 | |
| 134 | /* Namespace loading - nsload */ |
| 135 | |
| 136 | acpi_status |
| 137 | acpi_ns_one_complete_parse ( |
| 138 | u32 pass_number, |
| 139 | struct acpi_table_desc *table_desc); |
| 140 | |
| 141 | acpi_status |
| 142 | acpi_ns_parse_table ( |
| 143 | struct acpi_table_desc *table_desc, |
| 144 | struct acpi_namespace_node *scope); |
| 145 | |
| 146 | acpi_status |
| 147 | acpi_ns_load_table ( |
| 148 | struct acpi_table_desc *table_desc, |
| 149 | struct acpi_namespace_node *node); |
| 150 | |
| 151 | acpi_status |
| 152 | acpi_ns_load_table_by_type ( |
| 153 | acpi_table_type table_type); |
| 154 | |
| 155 | |
| 156 | /* |
| 157 | * Top-level namespace access - nsaccess |
| 158 | */ |
| 159 | |
| 160 | acpi_status |
| 161 | acpi_ns_root_initialize ( |
| 162 | void); |
| 163 | |
| 164 | acpi_status |
| 165 | acpi_ns_lookup ( |
| 166 | union acpi_generic_state *scope_info, |
| 167 | char *name, |
| 168 | acpi_object_type type, |
| 169 | acpi_interpreter_mode interpreter_mode, |
| 170 | u32 flags, |
| 171 | struct acpi_walk_state *walk_state, |
| 172 | struct acpi_namespace_node **ret_node); |
| 173 | |
| 174 | |
| 175 | /* |
| 176 | * Named object allocation/deallocation - nsalloc |
| 177 | */ |
| 178 | |
| 179 | struct acpi_namespace_node * |
| 180 | acpi_ns_create_node ( |
| 181 | u32 name); |
| 182 | |
| 183 | void |
| 184 | acpi_ns_delete_node ( |
| 185 | struct acpi_namespace_node *node); |
| 186 | |
| 187 | void |
| 188 | acpi_ns_delete_namespace_subtree ( |
| 189 | struct acpi_namespace_node *parent_handle); |
| 190 | |
| 191 | void |
| 192 | acpi_ns_detach_object ( |
| 193 | struct acpi_namespace_node *node); |
| 194 | |
| 195 | void |
| 196 | acpi_ns_delete_children ( |
| 197 | struct acpi_namespace_node *parent); |
| 198 | |
| 199 | int |
| 200 | acpi_ns_compare_names ( |
| 201 | char *name1, |
| 202 | char *name2); |
| 203 | |
| 204 | void |
| 205 | acpi_ns_remove_reference ( |
| 206 | struct acpi_namespace_node *node); |
| 207 | |
| 208 | |
| 209 | /* |
| 210 | * Namespace modification - nsmodify |
| 211 | */ |
| 212 | |
| 213 | #ifdef ACPI_FUTURE_USAGE |
| 214 | acpi_status |
| 215 | acpi_ns_unload_namespace ( |
| 216 | acpi_handle handle); |
| 217 | |
| 218 | acpi_status |
| 219 | acpi_ns_delete_subtree ( |
| 220 | acpi_handle start_handle); |
| 221 | #endif |
| 222 | |
| 223 | |
| 224 | /* |
| 225 | * Namespace dump/print utilities - nsdump |
| 226 | */ |
| 227 | |
| 228 | #ifdef ACPI_FUTURE_USAGE |
| 229 | void |
| 230 | acpi_ns_dump_tables ( |
| 231 | acpi_handle search_base, |
| 232 | u32 max_depth); |
| 233 | #endif |
| 234 | |
| 235 | void |
| 236 | acpi_ns_dump_entry ( |
| 237 | acpi_handle handle, |
| 238 | u32 debug_level); |
| 239 | |
| 240 | void |
| 241 | acpi_ns_dump_pathname ( |
| 242 | acpi_handle handle, |
| 243 | char *msg, |
| 244 | u32 level, |
| 245 | u32 component); |
| 246 | |
| 247 | void |
| 248 | acpi_ns_print_pathname ( |
| 249 | u32 num_segments, |
| 250 | char *pathname); |
| 251 | |
| 252 | #ifdef ACPI_FUTURE_USAGE |
| 253 | acpi_status |
| 254 | acpi_ns_dump_one_device ( |
| 255 | acpi_handle obj_handle, |
| 256 | u32 level, |
| 257 | void *context, |
| 258 | void **return_value); |
| 259 | |
| 260 | void |
| 261 | acpi_ns_dump_root_devices ( |
| 262 | void); |
| 263 | #endif /* ACPI_FUTURE_USAGE */ |
| 264 | |
| 265 | acpi_status |
| 266 | acpi_ns_dump_one_object ( |
| 267 | acpi_handle obj_handle, |
| 268 | u32 level, |
| 269 | void *context, |
| 270 | void **return_value); |
| 271 | |
| 272 | #ifdef ACPI_FUTURE_USAGE |
| 273 | void |
| 274 | acpi_ns_dump_objects ( |
| 275 | acpi_object_type type, |
| 276 | u8 display_type, |
| 277 | u32 max_depth, |
| 278 | u32 ownder_id, |
| 279 | acpi_handle start_handle); |
| 280 | #endif |
| 281 | |
| 282 | |
| 283 | /* |
| 284 | * Namespace evaluation functions - nseval |
| 285 | */ |
| 286 | |
| 287 | acpi_status |
| 288 | acpi_ns_evaluate_by_handle ( |
| 289 | struct acpi_parameter_info *info); |
| 290 | |
| 291 | acpi_status |
| 292 | acpi_ns_evaluate_by_name ( |
| 293 | char *pathname, |
| 294 | struct acpi_parameter_info *info); |
| 295 | |
| 296 | acpi_status |
| 297 | acpi_ns_evaluate_relative ( |
| 298 | char *pathname, |
| 299 | struct acpi_parameter_info *info); |
| 300 | |
| 301 | acpi_status |
| 302 | acpi_ns_execute_control_method ( |
| 303 | struct acpi_parameter_info *info); |
| 304 | |
| 305 | acpi_status |
| 306 | acpi_ns_get_object_value ( |
| 307 | struct acpi_parameter_info *info); |
| 308 | |
| 309 | |
| 310 | /* |
| 311 | * Parent/Child/Peer utility functions |
| 312 | */ |
| 313 | |
| 314 | #ifdef ACPI_FUTURE_USAGE |
| 315 | acpi_name |
| 316 | acpi_ns_find_parent_name ( |
| 317 | struct acpi_namespace_node *node_to_search); |
| 318 | #endif |
| 319 | |
| 320 | |
| 321 | /* |
| 322 | * Name and Scope manipulation - nsnames |
| 323 | */ |
| 324 | |
| 325 | u32 |
| 326 | acpi_ns_opens_scope ( |
| 327 | acpi_object_type type); |
| 328 | |
| 329 | void |
| 330 | acpi_ns_build_external_path ( |
| 331 | struct acpi_namespace_node *node, |
| 332 | acpi_size size, |
| 333 | char *name_buffer); |
| 334 | |
| 335 | char * |
| 336 | acpi_ns_get_external_pathname ( |
| 337 | struct acpi_namespace_node *node); |
| 338 | |
| 339 | char * |
| 340 | acpi_ns_name_of_current_scope ( |
| 341 | struct acpi_walk_state *walk_state); |
| 342 | |
| 343 | acpi_status |
| 344 | acpi_ns_handle_to_pathname ( |
| 345 | acpi_handle target_handle, |
| 346 | struct acpi_buffer *buffer); |
| 347 | |
| 348 | u8 |
| 349 | acpi_ns_pattern_match ( |
| 350 | struct acpi_namespace_node *obj_node, |
| 351 | char *search_for); |
| 352 | |
| 353 | acpi_status |
| 354 | acpi_ns_get_node_by_path ( |
| 355 | char *external_pathname, |
| 356 | struct acpi_namespace_node *in_prefix_node, |
| 357 | u32 flags, |
| 358 | struct acpi_namespace_node **out_node); |
| 359 | |
| 360 | acpi_size |
| 361 | acpi_ns_get_pathname_length ( |
| 362 | struct acpi_namespace_node *node); |
| 363 | |
| 364 | |
| 365 | /* |
| 366 | * Object management for namespace nodes - nsobject |
| 367 | */ |
| 368 | |
| 369 | acpi_status |
| 370 | acpi_ns_attach_object ( |
| 371 | struct acpi_namespace_node *node, |
| 372 | union acpi_operand_object *object, |
| 373 | acpi_object_type type); |
| 374 | |
| 375 | union acpi_operand_object * |
| 376 | acpi_ns_get_attached_object ( |
| 377 | struct acpi_namespace_node *node); |
| 378 | |
| 379 | union acpi_operand_object * |
| 380 | acpi_ns_get_secondary_object ( |
| 381 | union acpi_operand_object *obj_desc); |
| 382 | |
| 383 | acpi_status |
| 384 | acpi_ns_attach_data ( |
| 385 | struct acpi_namespace_node *node, |
| 386 | acpi_object_handler handler, |
| 387 | void *data); |
| 388 | |
| 389 | acpi_status |
| 390 | acpi_ns_detach_data ( |
| 391 | struct acpi_namespace_node *node, |
| 392 | acpi_object_handler handler); |
| 393 | |
| 394 | acpi_status |
| 395 | acpi_ns_get_attached_data ( |
| 396 | struct acpi_namespace_node *node, |
| 397 | acpi_object_handler handler, |
| 398 | void **data); |
| 399 | |
| 400 | |
| 401 | /* |
| 402 | * Namespace searching and entry - nssearch |
| 403 | */ |
| 404 | |
| 405 | acpi_status |
| 406 | acpi_ns_search_and_enter ( |
| 407 | u32 entry_name, |
| 408 | struct acpi_walk_state *walk_state, |
| 409 | struct acpi_namespace_node *node, |
| 410 | acpi_interpreter_mode interpreter_mode, |
| 411 | acpi_object_type type, |
| 412 | u32 flags, |
| 413 | struct acpi_namespace_node **ret_node); |
| 414 | |
| 415 | acpi_status |
| 416 | acpi_ns_search_node ( |
| 417 | u32 entry_name, |
| 418 | struct acpi_namespace_node *node, |
| 419 | acpi_object_type type, |
| 420 | struct acpi_namespace_node **ret_node); |
| 421 | |
| 422 | void |
| 423 | acpi_ns_install_node ( |
| 424 | struct acpi_walk_state *walk_state, |
| 425 | struct acpi_namespace_node *parent_node, |
| 426 | struct acpi_namespace_node *node, |
| 427 | acpi_object_type type); |
| 428 | |
| 429 | |
| 430 | /* |
| 431 | * Utility functions - nsutils |
| 432 | */ |
| 433 | |
| 434 | u8 |
| 435 | acpi_ns_valid_root_prefix ( |
| 436 | char prefix); |
| 437 | |
| 438 | u8 |
| 439 | acpi_ns_valid_path_separator ( |
| 440 | char sep); |
| 441 | |
| 442 | acpi_object_type |
| 443 | acpi_ns_get_type ( |
| 444 | struct acpi_namespace_node *node); |
| 445 | |
| 446 | u32 |
| 447 | acpi_ns_local ( |
| 448 | acpi_object_type type); |
| 449 | |
| 450 | void |
| 451 | acpi_ns_report_error ( |
| 452 | char *module_name, |
| 453 | u32 line_number, |
| 454 | u32 component_id, |
| 455 | char *internal_name, |
| 456 | acpi_status lookup_status); |
| 457 | |
| 458 | void |
| 459 | acpi_ns_report_method_error ( |
| 460 | char *module_name, |
| 461 | u32 line_number, |
| 462 | u32 component_id, |
| 463 | char *message, |
| 464 | struct acpi_namespace_node *node, |
| 465 | char *path, |
| 466 | acpi_status lookup_status); |
| 467 | |
| 468 | void |
| 469 | acpi_ns_print_node_pathname ( |
| 470 | struct acpi_namespace_node *node, |
| 471 | char *msg); |
| 472 | |
| 473 | acpi_status |
| 474 | acpi_ns_build_internal_name ( |
| 475 | struct acpi_namestring_info *info); |
| 476 | |
| 477 | void |
| 478 | acpi_ns_get_internal_name_length ( |
| 479 | struct acpi_namestring_info *info); |
| 480 | |
| 481 | acpi_status |
| 482 | acpi_ns_internalize_name ( |
| 483 | char *dotted_name, |
| 484 | char **converted_name); |
| 485 | |
| 486 | acpi_status |
| 487 | acpi_ns_externalize_name ( |
| 488 | u32 internal_name_length, |
| 489 | char *internal_name, |
| 490 | u32 *converted_name_length, |
| 491 | char **converted_name); |
| 492 | |
| 493 | struct acpi_namespace_node * |
| 494 | acpi_ns_map_handle_to_node ( |
| 495 | acpi_handle handle); |
| 496 | |
| 497 | acpi_handle |
| 498 | acpi_ns_convert_entry_to_handle( |
| 499 | struct acpi_namespace_node *node); |
| 500 | |
| 501 | void |
| 502 | acpi_ns_terminate ( |
| 503 | void); |
| 504 | |
| 505 | struct acpi_namespace_node * |
| 506 | acpi_ns_get_parent_node ( |
| 507 | struct acpi_namespace_node *node); |
| 508 | |
| 509 | |
| 510 | struct acpi_namespace_node * |
| 511 | acpi_ns_get_next_valid_node ( |
| 512 | struct acpi_namespace_node *node); |
| 513 | |
| 514 | |
| 515 | #endif /* __ACNAMESP_H__ */ |