1 /******************************************************************************
3 * Name: acnamesp.h - Namespace subcomponent prototypes and defines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2004, R. Byron Moore
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
44 #ifndef __ACNAMESP_H__
45 #define __ACNAMESP_H__
48 /* To search the entire name space, pass this as search_base */
50 #define ACPI_NS_ALL ((acpi_handle)0)
53 * Elements of acpi_ns_properties are bit significant
54 * and should be one-to-one with values of acpi_object_type
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 */
61 /* Definitions of the predefined namespace names */
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_" */
67 #define ACPI_NS_ROOT_PATH "\\"
68 #define ACPI_NS_SYSTEM_BUS "_SB_"
71 /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
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
79 #define ACPI_NS_WALK_UNLOCK TRUE
80 #define ACPI_NS_WALK_NO_UNLOCK FALSE
84 acpi_ns_load_namespace (
88 acpi_ns_initialize_objects (
92 acpi_ns_initialize_devices (
96 /* Namespace init - nsxfinit */
99 acpi_ns_init_one_device (
100 acpi_handle obj_handle,
103 void **return_value);
106 acpi_ns_init_one_object (
107 acpi_handle obj_handle,
110 void **return_value);
114 acpi_ns_walk_namespace (
115 acpi_object_type type,
116 acpi_handle start_object,
118 u8 unlock_before_callback,
119 acpi_walk_callback user_function,
121 void **return_value);
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);
130 acpi_ns_delete_namespace_by_owner (
134 /* Namespace loading - nsload */
137 acpi_ns_one_complete_parse (
139 struct acpi_table_desc *table_desc);
142 acpi_ns_parse_table (
143 struct acpi_table_desc *table_desc,
144 struct acpi_namespace_node *scope);
148 struct acpi_table_desc *table_desc,
149 struct acpi_namespace_node *node);
152 acpi_ns_load_table_by_type (
153 acpi_table_type table_type);
157 * Top-level namespace access - nsaccess
161 acpi_ns_root_initialize (
166 union acpi_generic_state *scope_info,
168 acpi_object_type type,
169 acpi_interpreter_mode interpreter_mode,
171 struct acpi_walk_state *walk_state,
172 struct acpi_namespace_node **ret_node);
176 * Named object allocation/deallocation - nsalloc
179 struct acpi_namespace_node *
180 acpi_ns_create_node (
184 acpi_ns_delete_node (
185 struct acpi_namespace_node *node);
188 acpi_ns_delete_namespace_subtree (
189 struct acpi_namespace_node *parent_handle);
192 acpi_ns_detach_object (
193 struct acpi_namespace_node *node);
196 acpi_ns_delete_children (
197 struct acpi_namespace_node *parent);
200 acpi_ns_compare_names (
205 acpi_ns_remove_reference (
206 struct acpi_namespace_node *node);
210 * Namespace modification - nsmodify
214 acpi_ns_unload_namespace (
218 acpi_ns_delete_subtree (
219 acpi_handle start_handle);
223 * Namespace dump/print utilities - nsdump
227 acpi_ns_dump_tables (
228 acpi_handle search_base,
237 acpi_ns_dump_pathname (
244 acpi_ns_print_pathname (
249 acpi_ns_dump_one_device (
250 acpi_handle obj_handle,
253 void **return_value);
256 acpi_ns_dump_root_devices (
260 acpi_ns_dump_one_object (
261 acpi_handle obj_handle,
264 void **return_value);
267 acpi_ns_dump_objects (
268 acpi_object_type type,
272 acpi_handle start_handle);
276 * Namespace evaluation functions - nseval
280 acpi_ns_evaluate_by_handle (
281 struct acpi_namespace_node *prefix_node,
282 union acpi_operand_object **params,
283 union acpi_operand_object **return_object);
286 acpi_ns_evaluate_by_name (
288 union acpi_operand_object **params,
289 union acpi_operand_object **return_object);
292 acpi_ns_evaluate_relative (
293 struct acpi_namespace_node *prefix_node,
295 union acpi_operand_object **params,
296 union acpi_operand_object **return_object);
299 acpi_ns_execute_control_method (
300 struct acpi_namespace_node *method_node,
301 union acpi_operand_object **params,
302 union acpi_operand_object **return_obj_desc);
305 acpi_ns_get_object_value (
306 struct acpi_namespace_node *object_node,
307 union acpi_operand_object **return_obj_desc);
311 * Parent/Child/Peer utility functions
315 acpi_ns_find_parent_name (
316 struct acpi_namespace_node *node_to_search);
320 * Name and Scope manipulation - nsnames
324 acpi_ns_opens_scope (
325 acpi_object_type type);
328 acpi_ns_build_external_path (
329 struct acpi_namespace_node *node,
334 acpi_ns_get_external_pathname (
335 struct acpi_namespace_node *node);
338 acpi_ns_name_of_current_scope (
339 struct acpi_walk_state *walk_state);
342 acpi_ns_handle_to_pathname (
343 acpi_handle target_handle,
344 struct acpi_buffer *buffer);
347 acpi_ns_pattern_match (
348 struct acpi_namespace_node *obj_node,
352 acpi_ns_get_node_by_path (
353 char *external_pathname,
354 struct acpi_namespace_node *in_prefix_node,
356 struct acpi_namespace_node **out_node);
359 acpi_ns_get_pathname_length (
360 struct acpi_namespace_node *node);
364 * Object management for namespace nodes - nsobject
368 acpi_ns_attach_object (
369 struct acpi_namespace_node *node,
370 union acpi_operand_object *object,
371 acpi_object_type type);
373 union acpi_operand_object *
374 acpi_ns_get_attached_object (
375 struct acpi_namespace_node *node);
377 union acpi_operand_object *
378 acpi_ns_get_secondary_object (
379 union acpi_operand_object *obj_desc);
382 acpi_ns_attach_data (
383 struct acpi_namespace_node *node,
384 acpi_object_handler handler,
388 acpi_ns_detach_data (
389 struct acpi_namespace_node *node,
390 acpi_object_handler handler);
393 acpi_ns_get_attached_data (
394 struct acpi_namespace_node *node,
395 acpi_object_handler handler,
400 * Namespace searching and entry - nssearch
404 acpi_ns_search_and_enter (
406 struct acpi_walk_state *walk_state,
407 struct acpi_namespace_node *node,
408 acpi_interpreter_mode interpreter_mode,
409 acpi_object_type type,
411 struct acpi_namespace_node **ret_node);
414 acpi_ns_search_node (
416 struct acpi_namespace_node *node,
417 acpi_object_type type,
418 struct acpi_namespace_node **ret_node);
421 acpi_ns_install_node (
422 struct acpi_walk_state *walk_state,
423 struct acpi_namespace_node *parent_node,
424 struct acpi_namespace_node *node,
425 acpi_object_type type);
429 * Utility functions - nsutils
433 acpi_ns_valid_root_prefix (
437 acpi_ns_valid_path_separator (
442 struct acpi_namespace_node *node);
446 acpi_object_type type);
449 acpi_ns_report_error (
454 acpi_status lookup_status);
457 acpi_ns_report_method_error (
462 struct acpi_namespace_node *node,
464 acpi_status lookup_status);
467 acpi_ns_print_node_pathname (
468 struct acpi_namespace_node *node,
472 acpi_ns_build_internal_name (
473 struct acpi_namestring_info *info);
476 acpi_ns_get_internal_name_length (
477 struct acpi_namestring_info *info);
480 acpi_ns_internalize_name (
482 char **converted_name);
485 acpi_ns_externalize_name (
486 u32 internal_name_length,
488 u32 *converted_name_length,
489 char **converted_name);
491 struct acpi_namespace_node *
492 acpi_ns_map_handle_to_node (
496 acpi_ns_convert_entry_to_handle(
497 struct acpi_namespace_node *node);
503 struct acpi_namespace_node *
504 acpi_ns_get_parent_node (
505 struct acpi_namespace_node *node);
508 struct acpi_namespace_node *
509 acpi_ns_get_next_valid_node (
510 struct acpi_namespace_node *node);
513 #endif /* __ACNAMESP_H__ */