blob: 8b3cdc3566b1312adb27767b5ba4ee379170414c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
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
83acpi_status
84acpi_ns_load_namespace (
85 void);
86
87acpi_status
88acpi_ns_initialize_objects (
89 void);
90
91acpi_status
92acpi_ns_initialize_devices (
93 void);
94
95
96/* Namespace init - nsxfinit */
97
98acpi_status
99acpi_ns_init_one_device (
100 acpi_handle obj_handle,
101 u32 nesting_level,
102 void *context,
103 void **return_value);
104
105acpi_status
106acpi_ns_init_one_object (
107 acpi_handle obj_handle,
108 u32 level,
109 void *context,
110 void **return_value);
111
112
113acpi_status
114acpi_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
123struct acpi_namespace_node *
124acpi_ns_get_next_node (
125 acpi_object_type type,
126 struct acpi_namespace_node *parent,
127 struct acpi_namespace_node *child);
128
129void
130acpi_ns_delete_namespace_by_owner (
131 u16 table_id);
132
133
134/* Namespace loading - nsload */
135
136acpi_status
137acpi_ns_one_complete_parse (
138 u32 pass_number,
139 struct acpi_table_desc *table_desc);
140
141acpi_status
142acpi_ns_parse_table (
143 struct acpi_table_desc *table_desc,
144 struct acpi_namespace_node *scope);
145
146acpi_status
147acpi_ns_load_table (
148 struct acpi_table_desc *table_desc,
149 struct acpi_namespace_node *node);
150
151acpi_status
152acpi_ns_load_table_by_type (
153 acpi_table_type table_type);
154
155
156/*
157 * Top-level namespace access - nsaccess
158 */
159
160acpi_status
161acpi_ns_root_initialize (
162 void);
163
164acpi_status
165acpi_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
179struct acpi_namespace_node *
180acpi_ns_create_node (
181 u32 name);
182
183void
184acpi_ns_delete_node (
185 struct acpi_namespace_node *node);
186
187void
188acpi_ns_delete_namespace_subtree (
189 struct acpi_namespace_node *parent_handle);
190
191void
192acpi_ns_detach_object (
193 struct acpi_namespace_node *node);
194
195void
196acpi_ns_delete_children (
197 struct acpi_namespace_node *parent);
198
199int
200acpi_ns_compare_names (
201 char *name1,
202 char *name2);
203
204void
205acpi_ns_remove_reference (
206 struct acpi_namespace_node *node);
207
208
209/*
210 * Namespace modification - nsmodify
211 */
212
213#ifdef ACPI_FUTURE_USAGE
214acpi_status
215acpi_ns_unload_namespace (
216 acpi_handle handle);
217
218acpi_status
219acpi_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
229void
230acpi_ns_dump_tables (
231 acpi_handle search_base,
232 u32 max_depth);
233#endif
234
235void
236acpi_ns_dump_entry (
237 acpi_handle handle,
238 u32 debug_level);
239
240void
241acpi_ns_dump_pathname (
242 acpi_handle handle,
243 char *msg,
244 u32 level,
245 u32 component);
246
247void
248acpi_ns_print_pathname (
249 u32 num_segments,
250 char *pathname);
251
252#ifdef ACPI_FUTURE_USAGE
253acpi_status
254acpi_ns_dump_one_device (
255 acpi_handle obj_handle,
256 u32 level,
257 void *context,
258 void **return_value);
259
260void
261acpi_ns_dump_root_devices (
262 void);
263#endif /* ACPI_FUTURE_USAGE */
264
265acpi_status
266acpi_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
273void
274acpi_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
287acpi_status
288acpi_ns_evaluate_by_handle (
289 struct acpi_parameter_info *info);
290
291acpi_status
292acpi_ns_evaluate_by_name (
293 char *pathname,
294 struct acpi_parameter_info *info);
295
296acpi_status
297acpi_ns_evaluate_relative (
298 char *pathname,
299 struct acpi_parameter_info *info);
300
301acpi_status
302acpi_ns_execute_control_method (
303 struct acpi_parameter_info *info);
304
305acpi_status
306acpi_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
315acpi_name
316acpi_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
325u32
326acpi_ns_opens_scope (
327 acpi_object_type type);
328
329void
330acpi_ns_build_external_path (
331 struct acpi_namespace_node *node,
332 acpi_size size,
333 char *name_buffer);
334
335char *
336acpi_ns_get_external_pathname (
337 struct acpi_namespace_node *node);
338
339char *
340acpi_ns_name_of_current_scope (
341 struct acpi_walk_state *walk_state);
342
343acpi_status
344acpi_ns_handle_to_pathname (
345 acpi_handle target_handle,
346 struct acpi_buffer *buffer);
347
348u8
349acpi_ns_pattern_match (
350 struct acpi_namespace_node *obj_node,
351 char *search_for);
352
353acpi_status
354acpi_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
360acpi_size
361acpi_ns_get_pathname_length (
362 struct acpi_namespace_node *node);
363
364
365/*
366 * Object management for namespace nodes - nsobject
367 */
368
369acpi_status
370acpi_ns_attach_object (
371 struct acpi_namespace_node *node,
372 union acpi_operand_object *object,
373 acpi_object_type type);
374
375union acpi_operand_object *
376acpi_ns_get_attached_object (
377 struct acpi_namespace_node *node);
378
379union acpi_operand_object *
380acpi_ns_get_secondary_object (
381 union acpi_operand_object *obj_desc);
382
383acpi_status
384acpi_ns_attach_data (
385 struct acpi_namespace_node *node,
386 acpi_object_handler handler,
387 void *data);
388
389acpi_status
390acpi_ns_detach_data (
391 struct acpi_namespace_node *node,
392 acpi_object_handler handler);
393
394acpi_status
395acpi_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
405acpi_status
406acpi_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
415acpi_status
416acpi_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
422void
423acpi_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
434u8
435acpi_ns_valid_root_prefix (
436 char prefix);
437
438u8
439acpi_ns_valid_path_separator (
440 char sep);
441
442acpi_object_type
443acpi_ns_get_type (
444 struct acpi_namespace_node *node);
445
446u32
447acpi_ns_local (
448 acpi_object_type type);
449
450void
451acpi_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
458void
459acpi_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
468void
469acpi_ns_print_node_pathname (
470 struct acpi_namespace_node *node,
471 char *msg);
472
473acpi_status
474acpi_ns_build_internal_name (
475 struct acpi_namestring_info *info);
476
477void
478acpi_ns_get_internal_name_length (
479 struct acpi_namestring_info *info);
480
481acpi_status
482acpi_ns_internalize_name (
483 char *dotted_name,
484 char **converted_name);
485
486acpi_status
487acpi_ns_externalize_name (
488 u32 internal_name_length,
489 char *internal_name,
490 u32 *converted_name_length,
491 char **converted_name);
492
493struct acpi_namespace_node *
494acpi_ns_map_handle_to_node (
495 acpi_handle handle);
496
497acpi_handle
498acpi_ns_convert_entry_to_handle(
499 struct acpi_namespace_node *node);
500
501void
502acpi_ns_terminate (
503 void);
504
505struct acpi_namespace_node *
506acpi_ns_get_parent_node (
507 struct acpi_namespace_node *node);
508
509
510struct acpi_namespace_node *
511acpi_ns_get_next_valid_node (
512 struct acpi_namespace_node *node);
513
514
515#endif /* __ACNAMESP_H__ */