File: /usr/src/linux/drivers/acpi/include/acnamesp.h
1 /******************************************************************************
2 *
3 * Name: acnamesp.h - Namespace subcomponent prototypes and defines
4 * $Revision: 107 $
5 *
6 *****************************************************************************/
7
8 /*
9 * Copyright (C) 2000, 2001 R. Byron Moore
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26 #ifndef __ACNAMESP_H__
27 #define __ACNAMESP_H__
28
29
30 /* To search the entire name space, pass this as Search_base */
31
32 #define NS_ALL ((acpi_handle)0)
33
34 /*
35 * Elements of Acpi_ns_properties are bit significant
36 * and should be one-to-one with values of acpi_object_type
37 */
38 #define NSP_NORMAL 0
39 #define NSP_NEWSCOPE 1 /* a definition of this type opens a name scope */
40 #define NSP_LOCAL 2 /* suppress search of enclosing scopes */
41
42
43 /* Definitions of the predefined namespace names */
44
45 #define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
46 #define ACPI_ROOT_NAME (u32) 0x2F202020 /* Root name is "/ " */
47 #define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
48
49 #define NS_ROOT_PATH "/"
50 #define NS_SYSTEM_BUS "_SB_"
51
52
53 /* Flags for Acpi_ns_lookup, Acpi_ns_search_and_enter */
54
55 #define NS_NO_UPSEARCH 0
56 #define NS_SEARCH_PARENT 0x01
57 #define NS_DONT_OPEN_SCOPE 0x02
58 #define NS_NO_PEER_SEARCH 0x04
59 #define NS_ERROR_IF_FOUND 0x08
60
61 #define NS_WALK_UNLOCK TRUE
62 #define NS_WALK_NO_UNLOCK FALSE
63
64
65 acpi_status
66 acpi_ns_load_namespace (
67 void);
68
69 acpi_status
70 acpi_ns_initialize_objects (
71 void);
72
73 acpi_status
74 acpi_ns_initialize_devices (
75 void);
76
77
78 /* Namespace init - nsxfinit */
79
80 acpi_status
81 acpi_ns_init_one_device (
82 acpi_handle obj_handle,
83 u32 nesting_level,
84 void *context,
85 void **return_value);
86
87 acpi_status
88 acpi_ns_init_one_object (
89 acpi_handle obj_handle,
90 u32 level,
91 void *context,
92 void **return_value);
93
94
95 acpi_status
96 acpi_ns_walk_namespace (
97 acpi_object_type8 type,
98 acpi_handle start_object,
99 u32 max_depth,
100 u8 unlock_before_callback,
101 ACPI_WALK_CALLBACK user_function,
102 void *context,
103 void **return_value);
104
105
106 acpi_namespace_node *
107 acpi_ns_get_next_object (
108 acpi_object_type8 type,
109 acpi_namespace_node *parent,
110 acpi_namespace_node *child);
111
112
113 acpi_status
114 acpi_ns_delete_namespace_by_owner (
115 u16 table_id);
116
117
118 /* Namespace loading - nsload */
119
120 acpi_status
121 acpi_ns_one_complete_parse (
122 u32 pass_number,
123 acpi_table_desc *table_desc);
124
125 acpi_status
126 acpi_ns_parse_table (
127 acpi_table_desc *table_desc,
128 acpi_namespace_node *scope);
129
130 acpi_status
131 acpi_ns_load_table (
132 acpi_table_desc *table_desc,
133 acpi_namespace_node *node);
134
135 acpi_status
136 acpi_ns_load_table_by_type (
137 acpi_table_type table_type);
138
139
140 /*
141 * Top-level namespace access - nsaccess
142 */
143
144
145 acpi_status
146 acpi_ns_root_initialize (
147 void);
148
149 acpi_status
150 acpi_ns_lookup (
151 acpi_generic_state *scope_info,
152 NATIVE_CHAR *name,
153 acpi_object_type8 type,
154 operating_mode interpreter_mode,
155 u32 flags,
156 acpi_walk_state *walk_state,
157 acpi_namespace_node **ret_node);
158
159
160 /*
161 * Named object allocation/deallocation - nsalloc
162 */
163
164
165 acpi_namespace_node *
166 acpi_ns_create_node (
167 u32 name);
168
169 void
170 acpi_ns_delete_node (
171 acpi_namespace_node *node);
172
173 acpi_status
174 acpi_ns_delete_namespace_subtree (
175 acpi_namespace_node *parent_handle);
176
177 void
178 acpi_ns_detach_object (
179 acpi_namespace_node *node);
180
181 void
182 acpi_ns_delete_children (
183 acpi_namespace_node *parent);
184
185
186 /*
187 * Namespace modification - nsmodify
188 */
189
190 acpi_status
191 acpi_ns_unload_namespace (
192 acpi_handle handle);
193
194 acpi_status
195 acpi_ns_delete_subtree (
196 acpi_handle start_handle);
197
198
199 /*
200 * Namespace dump/print utilities - nsdump
201 */
202
203 void
204 acpi_ns_dump_tables (
205 acpi_handle search_base,
206 u32 max_depth);
207
208 void
209 acpi_ns_dump_entry (
210 acpi_handle handle,
211 u32 debug_level);
212
213 acpi_status
214 acpi_ns_dump_pathname (
215 acpi_handle handle,
216 NATIVE_CHAR *msg,
217 u32 level,
218 u32 component);
219
220 void
221 acpi_ns_dump_root_devices (
222 void);
223
224 void
225 acpi_ns_dump_objects (
226 acpi_object_type8 type,
227 u32 max_depth,
228 u32 ownder_id,
229 acpi_handle start_handle);
230
231
232 /*
233 * Namespace evaluation functions - nseval
234 */
235
236 acpi_status
237 acpi_ns_evaluate_by_handle (
238 acpi_namespace_node *prefix_node,
239 acpi_operand_object **params,
240 acpi_operand_object **return_object);
241
242 acpi_status
243 acpi_ns_evaluate_by_name (
244 NATIVE_CHAR *pathname,
245 acpi_operand_object **params,
246 acpi_operand_object **return_object);
247
248 acpi_status
249 acpi_ns_evaluate_relative (
250 acpi_namespace_node *prefix_node,
251 NATIVE_CHAR *pathname,
252 acpi_operand_object **params,
253 acpi_operand_object **return_object);
254
255 acpi_status
256 acpi_ns_execute_control_method (
257 acpi_namespace_node *method_node,
258 acpi_operand_object **params,
259 acpi_operand_object **return_obj_desc);
260
261 acpi_status
262 acpi_ns_get_object_value (
263 acpi_namespace_node *object_node,
264 acpi_operand_object **return_obj_desc);
265
266
267 /*
268 * Parent/Child/Peer utility functions - nsfamily
269 */
270
271 acpi_name
272 acpi_ns_find_parent_name (
273 acpi_namespace_node *node_to_search);
274
275 u8
276 acpi_ns_exist_downstream_sibling (
277 acpi_namespace_node *this_node);
278
279
280 /*
281 * Scope manipulation - nsscope
282 */
283
284 u32
285 acpi_ns_opens_scope (
286 acpi_object_type8 type);
287
288 NATIVE_CHAR *
289 acpi_ns_get_table_pathname (
290 acpi_namespace_node *node);
291
292 NATIVE_CHAR *
293 acpi_ns_name_of_current_scope (
294 acpi_walk_state *walk_state);
295
296 acpi_status
297 acpi_ns_handle_to_pathname (
298 acpi_handle obj_handle,
299 u32 *buf_size,
300 NATIVE_CHAR *user_buffer);
301
302 u8
303 acpi_ns_pattern_match (
304 acpi_namespace_node *obj_node,
305 NATIVE_CHAR *search_for);
306
307
308 acpi_status
309 acpi_ns_get_node (
310 NATIVE_CHAR *pathname,
311 acpi_namespace_node *in_prefix_node,
312 acpi_namespace_node **out_node);
313
314 u32
315 acpi_ns_get_pathname_length (
316 acpi_namespace_node *node);
317
318
319 /*
320 * Object management for NTEs - nsobject
321 */
322
323 acpi_status
324 acpi_ns_attach_object (
325 acpi_namespace_node *node,
326 acpi_operand_object *object,
327 acpi_object_type8 type);
328
329
330 /*
331 * Namespace searching and entry - nssearch
332 */
333
334 acpi_status
335 acpi_ns_search_and_enter (
336 u32 entry_name,
337 acpi_walk_state *walk_state,
338 acpi_namespace_node *node,
339 operating_mode interpreter_mode,
340 acpi_object_type8 type,
341 u32 flags,
342 acpi_namespace_node **ret_node);
343
344 acpi_status
345 acpi_ns_search_node (
346 u32 entry_name,
347 acpi_namespace_node *node,
348 acpi_object_type8 type,
349 acpi_namespace_node **ret_node);
350
351 void
352 acpi_ns_install_node (
353 acpi_walk_state *walk_state,
354 acpi_namespace_node *parent_node, /* Parent */
355 acpi_namespace_node *node, /* New Child*/
356 acpi_object_type8 type);
357
358
359 /*
360 * Utility functions - nsutils
361 */
362
363 u8
364 acpi_ns_valid_root_prefix (
365 NATIVE_CHAR prefix);
366
367 u8
368 acpi_ns_valid_path_separator (
369 NATIVE_CHAR sep);
370
371 acpi_object_type8
372 acpi_ns_get_type (
373 acpi_namespace_node *node);
374
375 void *
376 acpi_ns_get_attached_object (
377 acpi_namespace_node *node);
378
379 u32
380 acpi_ns_local (
381 acpi_object_type8 type);
382
383 acpi_status
384 acpi_ns_build_internal_name (
385 ACPI_NAMESTRING_INFO *info);
386
387 acpi_status
388 acpi_ns_get_internal_name_length (
389 ACPI_NAMESTRING_INFO *info);
390
391 acpi_status
392 acpi_ns_internalize_name (
393 NATIVE_CHAR *dotted_name,
394 NATIVE_CHAR **converted_name);
395
396 acpi_status
397 acpi_ns_externalize_name (
398 u32 internal_name_length,
399 NATIVE_CHAR *internal_name,
400 u32 *converted_name_length,
401 NATIVE_CHAR **converted_name);
402
403 acpi_namespace_node *
404 acpi_ns_convert_handle_to_entry (
405 acpi_handle handle);
406
407 acpi_handle
408 acpi_ns_convert_entry_to_handle(
409 acpi_namespace_node *node);
410
411 void
412 acpi_ns_terminate (
413 void);
414
415 acpi_namespace_node *
416 acpi_ns_get_parent_object (
417 acpi_namespace_node *node);
418
419
420 acpi_namespace_node *
421 acpi_ns_get_next_valid_object (
422 acpi_namespace_node *node);
423
424
425 #endif /* __ACNAMESP_H__ */
426