vserver 1.9.3
[linux-2.6.git] / include / acpi / acnamesp.h
1 /******************************************************************************
2  *
3  * Name: acnamesp.h - Namespace subcomponent prototypes and defines
4  *
5  *****************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2004, 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 acpi_status
214 acpi_ns_unload_namespace (
215         acpi_handle                     handle);
216
217 acpi_status
218 acpi_ns_delete_subtree (
219         acpi_handle                     start_handle);
220
221
222 /*
223  * Namespace dump/print utilities - nsdump
224  */
225
226 void
227 acpi_ns_dump_tables (
228         acpi_handle                     search_base,
229         u32                             max_depth);
230
231 void
232 acpi_ns_dump_entry (
233         acpi_handle                     handle,
234         u32                             debug_level);
235
236 void
237 acpi_ns_dump_pathname (
238         acpi_handle                     handle,
239         char                            *msg,
240         u32                             level,
241         u32                             component);
242
243 void
244 acpi_ns_print_pathname (
245         u32                             num_segments,
246         char                            *pathname);
247
248 acpi_status
249 acpi_ns_dump_one_device (
250         acpi_handle                     obj_handle,
251         u32                             level,
252         void                            *context,
253         void                            **return_value);
254
255 void
256 acpi_ns_dump_root_devices (
257         void);
258
259 acpi_status
260 acpi_ns_dump_one_object (
261         acpi_handle                     obj_handle,
262         u32                             level,
263         void                            *context,
264         void                            **return_value);
265
266 void
267 acpi_ns_dump_objects (
268         acpi_object_type                type,
269         u8                              display_type,
270         u32                             max_depth,
271         u32                             ownder_id,
272         acpi_handle                     start_handle);
273
274
275 /*
276  * Namespace evaluation functions - nseval
277  */
278
279 acpi_status
280 acpi_ns_evaluate_by_handle (
281         struct acpi_parameter_info      *info);
282
283 acpi_status
284 acpi_ns_evaluate_by_name (
285         char                            *pathname,
286         struct acpi_parameter_info      *info);
287
288 acpi_status
289 acpi_ns_evaluate_relative (
290         char                            *pathname,
291         struct acpi_parameter_info      *info);
292
293 acpi_status
294 acpi_ns_execute_control_method (
295         struct acpi_parameter_info      *info);
296
297 acpi_status
298 acpi_ns_get_object_value (
299         struct acpi_parameter_info      *info);
300
301
302 /*
303  * Parent/Child/Peer utility functions
304  */
305
306 acpi_name
307 acpi_ns_find_parent_name (
308         struct acpi_namespace_node      *node_to_search);
309
310
311 /*
312  * Name and Scope manipulation - nsnames
313  */
314
315 u32
316 acpi_ns_opens_scope (
317         acpi_object_type                type);
318
319 void
320 acpi_ns_build_external_path (
321         struct acpi_namespace_node      *node,
322         acpi_size                       size,
323         char                            *name_buffer);
324
325 char *
326 acpi_ns_get_external_pathname (
327         struct acpi_namespace_node      *node);
328
329 char *
330 acpi_ns_name_of_current_scope (
331         struct acpi_walk_state          *walk_state);
332
333 acpi_status
334 acpi_ns_handle_to_pathname (
335         acpi_handle                     target_handle,
336         struct acpi_buffer              *buffer);
337
338 u8
339 acpi_ns_pattern_match (
340         struct acpi_namespace_node      *obj_node,
341         char                            *search_for);
342
343 acpi_status
344 acpi_ns_get_node_by_path (
345         char                            *external_pathname,
346         struct acpi_namespace_node      *in_prefix_node,
347         u32                             flags,
348         struct acpi_namespace_node      **out_node);
349
350 acpi_size
351 acpi_ns_get_pathname_length (
352         struct acpi_namespace_node      *node);
353
354
355 /*
356  * Object management for namespace nodes - nsobject
357  */
358
359 acpi_status
360 acpi_ns_attach_object (
361         struct acpi_namespace_node      *node,
362         union acpi_operand_object       *object,
363         acpi_object_type                type);
364
365 union acpi_operand_object *
366 acpi_ns_get_attached_object (
367         struct acpi_namespace_node      *node);
368
369 union acpi_operand_object *
370 acpi_ns_get_secondary_object (
371         union acpi_operand_object       *obj_desc);
372
373 acpi_status
374 acpi_ns_attach_data (
375         struct acpi_namespace_node      *node,
376         acpi_object_handler             handler,
377         void                            *data);
378
379 acpi_status
380 acpi_ns_detach_data (
381         struct acpi_namespace_node      *node,
382         acpi_object_handler             handler);
383
384 acpi_status
385 acpi_ns_get_attached_data (
386         struct acpi_namespace_node      *node,
387         acpi_object_handler             handler,
388         void                            **data);
389
390
391 /*
392  * Namespace searching and entry - nssearch
393  */
394
395 acpi_status
396 acpi_ns_search_and_enter (
397         u32                             entry_name,
398         struct acpi_walk_state          *walk_state,
399         struct acpi_namespace_node      *node,
400         acpi_interpreter_mode           interpreter_mode,
401         acpi_object_type                type,
402         u32                             flags,
403         struct acpi_namespace_node      **ret_node);
404
405 acpi_status
406 acpi_ns_search_node (
407         u32                             entry_name,
408         struct acpi_namespace_node      *node,
409         acpi_object_type                type,
410         struct acpi_namespace_node      **ret_node);
411
412 void
413 acpi_ns_install_node (
414         struct acpi_walk_state          *walk_state,
415         struct acpi_namespace_node      *parent_node,
416         struct acpi_namespace_node      *node,
417         acpi_object_type                type);
418
419
420 /*
421  * Utility functions - nsutils
422  */
423
424 u8
425 acpi_ns_valid_root_prefix (
426         char                            prefix);
427
428 u8
429 acpi_ns_valid_path_separator (
430         char                            sep);
431
432 acpi_object_type
433 acpi_ns_get_type (
434         struct acpi_namespace_node      *node);
435
436 u32
437 acpi_ns_local (
438         acpi_object_type                type);
439
440 void
441 acpi_ns_report_error (
442         char                            *module_name,
443         u32                             line_number,
444         u32                             component_id,
445         char                            *internal_name,
446         acpi_status                     lookup_status);
447
448 void
449 acpi_ns_report_method_error (
450         char                            *module_name,
451         u32                             line_number,
452         u32                             component_id,
453         char                            *message,
454         struct acpi_namespace_node      *node,
455         char                            *path,
456         acpi_status                     lookup_status);
457
458 void
459 acpi_ns_print_node_pathname (
460         struct acpi_namespace_node      *node,
461         char                            *msg);
462
463 acpi_status
464 acpi_ns_build_internal_name (
465         struct acpi_namestring_info     *info);
466
467 void
468 acpi_ns_get_internal_name_length (
469         struct acpi_namestring_info     *info);
470
471 acpi_status
472 acpi_ns_internalize_name (
473         char                            *dotted_name,
474         char                            **converted_name);
475
476 acpi_status
477 acpi_ns_externalize_name (
478         u32                             internal_name_length,
479         char                            *internal_name,
480         u32                             *converted_name_length,
481         char                            **converted_name);
482
483 struct acpi_namespace_node *
484 acpi_ns_map_handle_to_node (
485         acpi_handle                     handle);
486
487 acpi_handle
488 acpi_ns_convert_entry_to_handle(
489         struct acpi_namespace_node      *node);
490
491 void
492 acpi_ns_terminate (
493         void);
494
495 struct acpi_namespace_node *
496 acpi_ns_get_parent_node (
497         struct acpi_namespace_node      *node);
498
499
500 struct acpi_namespace_node *
501 acpi_ns_get_next_valid_node (
502         struct acpi_namespace_node      *node);
503
504
505 #endif /* __ACNAMESP_H__ */