blob: d1b3ce80056f44f878dc53111c37c1768ae5318a [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070060/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
61
62#define ACPI_NS_NO_UPSEARCH 0
63#define ACPI_NS_SEARCH_PARENT 0x01
64#define ACPI_NS_DONT_OPEN_SCOPE 0x02
65#define ACPI_NS_NO_PEER_SEARCH 0x04
66#define ACPI_NS_ERROR_IF_FOUND 0x08
67
68#define ACPI_NS_WALK_UNLOCK TRUE
69#define ACPI_NS_WALK_NO_UNLOCK FALSE
70
71
Robert Moore44f6c012005-04-18 22:49:35 -040072/*
73 * nsinit - Namespace initialization
74 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070075acpi_status
76acpi_ns_initialize_objects (
77 void);
78
79acpi_status
80acpi_ns_initialize_devices (
81 void);
82
83
Robert Moore44f6c012005-04-18 22:49:35 -040084/*
85 * nsload - Namespace loading
86 */
87acpi_status
88acpi_ns_load_namespace (
89 void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
91acpi_status
Robert Moore44f6c012005-04-18 22:49:35 -040092acpi_ns_load_table (
93 struct acpi_table_desc *table_desc,
94 struct acpi_namespace_node *node);
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
96
Robert Moore44f6c012005-04-18 22:49:35 -040097/*
98 * nswalk - walk the namespace
99 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100acpi_status
101acpi_ns_walk_namespace (
102 acpi_object_type type,
103 acpi_handle start_object,
104 u32 max_depth,
105 u8 unlock_before_callback,
106 acpi_walk_callback user_function,
107 void *context,
108 void **return_value);
109
110struct acpi_namespace_node *
111acpi_ns_get_next_node (
112 acpi_object_type type,
113 struct acpi_namespace_node *parent,
114 struct acpi_namespace_node *child);
115
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
Robert Moore44f6c012005-04-18 22:49:35 -0400117/*
118 * nsparse - table parsing
119 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120acpi_status
121acpi_ns_parse_table (
122 struct acpi_table_desc *table_desc,
123 struct acpi_namespace_node *scope);
124
125acpi_status
Robert Moore44f6c012005-04-18 22:49:35 -0400126acpi_ns_one_complete_parse (
127 u32 pass_number,
128 struct acpi_table_desc *table_desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
130
131/*
Robert Moore44f6c012005-04-18 22:49:35 -0400132 * nsaccess - Top-level namespace access
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134acpi_status
135acpi_ns_root_initialize (
136 void);
137
138acpi_status
139acpi_ns_lookup (
140 union acpi_generic_state *scope_info,
141 char *name,
142 acpi_object_type type,
143 acpi_interpreter_mode interpreter_mode,
144 u32 flags,
145 struct acpi_walk_state *walk_state,
146 struct acpi_namespace_node **ret_node);
147
148
149/*
Robert Moore44f6c012005-04-18 22:49:35 -0400150 * nsalloc - Named object allocation/deallocation
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152struct acpi_namespace_node *
153acpi_ns_create_node (
154 u32 name);
155
156void
157acpi_ns_delete_node (
158 struct acpi_namespace_node *node);
159
160void
161acpi_ns_delete_namespace_subtree (
162 struct acpi_namespace_node *parent_handle);
163
164void
Robert Moore44f6c012005-04-18 22:49:35 -0400165acpi_ns_delete_namespace_by_owner (
166 u16 table_id);
167
168void
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169acpi_ns_detach_object (
170 struct acpi_namespace_node *node);
171
172void
173acpi_ns_delete_children (
174 struct acpi_namespace_node *parent);
175
176int
177acpi_ns_compare_names (
178 char *name1,
179 char *name2);
180
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181
182/*
Robert Moore44f6c012005-04-18 22:49:35 -0400183 * nsdump - Namespace dump/print utilities
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 */
Robert Moore44f6c012005-04-18 22:49:35 -0400185#ifdef ACPI_FUTURE_USAGE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186void
187acpi_ns_dump_tables (
188 acpi_handle search_base,
189 u32 max_depth);
Robert Moore44f6c012005-04-18 22:49:35 -0400190#endif /* ACPI_FUTURE_USAGE */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191
192void
193acpi_ns_dump_entry (
194 acpi_handle handle,
195 u32 debug_level);
196
197void
198acpi_ns_dump_pathname (
199 acpi_handle handle,
200 char *msg,
201 u32 level,
202 u32 component);
203
204void
205acpi_ns_print_pathname (
206 u32 num_segments,
207 char *pathname);
208
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209acpi_status
210acpi_ns_dump_one_object (
211 acpi_handle obj_handle,
212 u32 level,
213 void *context,
214 void **return_value);
215
Robert Moore44f6c012005-04-18 22:49:35 -0400216#ifdef ACPI_FUTURE_USAGE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217void
218acpi_ns_dump_objects (
219 acpi_object_type type,
220 u8 display_type,
221 u32 max_depth,
222 u32 ownder_id,
223 acpi_handle start_handle);
Robert Moore44f6c012005-04-18 22:49:35 -0400224#endif /* ACPI_FUTURE_USAGE */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225
226
227/*
Robert Moore44f6c012005-04-18 22:49:35 -0400228 * nseval - Namespace evaluation functions
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230acpi_status
231acpi_ns_evaluate_by_handle (
232 struct acpi_parameter_info *info);
233
234acpi_status
235acpi_ns_evaluate_by_name (
236 char *pathname,
237 struct acpi_parameter_info *info);
238
239acpi_status
240acpi_ns_evaluate_relative (
241 char *pathname,
242 struct acpi_parameter_info *info);
243
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
245/*
Robert Moore44f6c012005-04-18 22:49:35 -0400246 * nsnames - Name and Scope manipulation
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248u32
249acpi_ns_opens_scope (
250 acpi_object_type type);
251
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252char *
253acpi_ns_get_external_pathname (
254 struct acpi_namespace_node *node);
255
256char *
257acpi_ns_name_of_current_scope (
258 struct acpi_walk_state *walk_state);
259
260acpi_status
261acpi_ns_handle_to_pathname (
262 acpi_handle target_handle,
263 struct acpi_buffer *buffer);
264
265u8
266acpi_ns_pattern_match (
267 struct acpi_namespace_node *obj_node,
268 char *search_for);
269
270acpi_status
271acpi_ns_get_node_by_path (
272 char *external_pathname,
273 struct acpi_namespace_node *in_prefix_node,
274 u32 flags,
275 struct acpi_namespace_node **out_node);
276
277acpi_size
278acpi_ns_get_pathname_length (
279 struct acpi_namespace_node *node);
280
281
282/*
Robert Moore44f6c012005-04-18 22:49:35 -0400283 * nsobject - Object management for namespace nodes
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285acpi_status
286acpi_ns_attach_object (
287 struct acpi_namespace_node *node,
288 union acpi_operand_object *object,
289 acpi_object_type type);
290
291union acpi_operand_object *
292acpi_ns_get_attached_object (
293 struct acpi_namespace_node *node);
294
295union acpi_operand_object *
296acpi_ns_get_secondary_object (
297 union acpi_operand_object *obj_desc);
298
299acpi_status
300acpi_ns_attach_data (
301 struct acpi_namespace_node *node,
302 acpi_object_handler handler,
303 void *data);
304
305acpi_status
306acpi_ns_detach_data (
307 struct acpi_namespace_node *node,
308 acpi_object_handler handler);
309
310acpi_status
311acpi_ns_get_attached_data (
312 struct acpi_namespace_node *node,
313 acpi_object_handler handler,
314 void **data);
315
316
317/*
Robert Moore44f6c012005-04-18 22:49:35 -0400318 * nssearch - Namespace searching and entry
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320acpi_status
321acpi_ns_search_and_enter (
322 u32 entry_name,
323 struct acpi_walk_state *walk_state,
324 struct acpi_namespace_node *node,
325 acpi_interpreter_mode interpreter_mode,
326 acpi_object_type type,
327 u32 flags,
328 struct acpi_namespace_node **ret_node);
329
330acpi_status
331acpi_ns_search_node (
332 u32 entry_name,
333 struct acpi_namespace_node *node,
334 acpi_object_type type,
335 struct acpi_namespace_node **ret_node);
336
337void
338acpi_ns_install_node (
339 struct acpi_walk_state *walk_state,
340 struct acpi_namespace_node *parent_node,
341 struct acpi_namespace_node *node,
342 acpi_object_type type);
343
344
345/*
Robert Moore44f6c012005-04-18 22:49:35 -0400346 * nsutils - Utility functions
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348u8
349acpi_ns_valid_root_prefix (
350 char prefix);
351
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352acpi_object_type
353acpi_ns_get_type (
354 struct acpi_namespace_node *node);
355
356u32
357acpi_ns_local (
358 acpi_object_type type);
359
360void
361acpi_ns_report_error (
362 char *module_name,
363 u32 line_number,
364 u32 component_id,
365 char *internal_name,
366 acpi_status lookup_status);
367
368void
369acpi_ns_report_method_error (
370 char *module_name,
371 u32 line_number,
372 u32 component_id,
373 char *message,
374 struct acpi_namespace_node *node,
375 char *path,
376 acpi_status lookup_status);
377
378void
379acpi_ns_print_node_pathname (
380 struct acpi_namespace_node *node,
381 char *msg);
382
383acpi_status
384acpi_ns_build_internal_name (
385 struct acpi_namestring_info *info);
386
387void
388acpi_ns_get_internal_name_length (
389 struct acpi_namestring_info *info);
390
391acpi_status
392acpi_ns_internalize_name (
393 char *dotted_name,
394 char **converted_name);
395
396acpi_status
397acpi_ns_externalize_name (
398 u32 internal_name_length,
399 char *internal_name,
400 u32 *converted_name_length,
401 char **converted_name);
402
403struct acpi_namespace_node *
404acpi_ns_map_handle_to_node (
405 acpi_handle handle);
406
407acpi_handle
408acpi_ns_convert_entry_to_handle(
409 struct acpi_namespace_node *node);
410
411void
412acpi_ns_terminate (
413 void);
414
415struct acpi_namespace_node *
416acpi_ns_get_parent_node (
417 struct acpi_namespace_node *node);
418
419
420struct acpi_namespace_node *
421acpi_ns_get_next_valid_node (
422 struct acpi_namespace_node *node);
423
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424#endif /* __ACNAMESP_H__ */