summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/include/acnamesp.h
blob: 696a554ce9a080c7583e067119cf63ea75d909f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
/******************************************************************************
 *
 * Name: acnamesp.h - Namespace subcomponent prototypes and defines
 *       $Revision: 94 $
 *
 *****************************************************************************/

/*
 *  Copyright (C) 2000 R. Byron Moore
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __ACNAMESP_H__
#define __ACNAMESP_H__


/* To search the entire name space, pass this as Search_base */

#define NS_ALL                  ((ACPI_HANDLE)0)

/*
 * Elements of Acpi_ns_properties are bit significant
 * and should be one-to-one with values of ACPI_OBJECT_TYPE
 */
#define NSP_NORMAL              0
#define NSP_NEWSCOPE            1   /* a definition of this type opens a name scope */
#define NSP_LOCAL               2   /* suppress search of enclosing scopes */


/* Definitions of the predefined namespace names  */

#define ACPI_UNKNOWN_NAME       (u32) 0x3F3F3F3F     /* Unknown name is  "????" */
#define ACPI_ROOT_NAME          (u32) 0x2F202020     /* Root name is     "/   " */
#define ACPI_SYS_BUS_NAME       (u32) 0x5F53425F     /* Sys bus name is  "_SB_" */

#define NS_ROOT_PATH            "/"
#define NS_SYSTEM_BUS           "_SB_"


/* Flags for Acpi_ns_lookup, Acpi_ns_search_and_enter */

#define NS_NO_UPSEARCH          0
#define NS_SEARCH_PARENT        0x01
#define NS_DONT_OPEN_SCOPE      0x02
#define NS_NO_PEER_SEARCH       0x04

#define NS_WALK_UNLOCK          TRUE
#define NS_WALK_NO_UNLOCK       FALSE


ACPI_STATUS
acpi_ns_walk_namespace (
	OBJECT_TYPE_INTERNAL    type,
	ACPI_HANDLE             start_object,
	u32                     max_depth,
	u8                      unlock_before_callback,
	WALK_CALLBACK           user_function,
	void                    *context,
	void                    **return_value);


ACPI_NAMESPACE_NODE *
acpi_ns_get_next_object (
	OBJECT_TYPE_INTERNAL    type,
	ACPI_NAMESPACE_NODE     *parent,
	ACPI_NAMESPACE_NODE     *child);


ACPI_STATUS
acpi_ns_delete_namespace_by_owner (
	u16                     table_id);


/* Namespace loading - nsload */

ACPI_STATUS
acpi_ns_parse_table (
	ACPI_TABLE_DESC         *table_desc,
	ACPI_NAMESPACE_NODE     *scope);

ACPI_STATUS
acpi_ns_load_table (
	ACPI_TABLE_DESC         *table_desc,
	ACPI_NAMESPACE_NODE     *node);

ACPI_STATUS
acpi_ns_load_table_by_type (
	ACPI_TABLE_TYPE         table_type);


/*
 * Top-level namespace access - nsaccess
 */


ACPI_STATUS
acpi_ns_root_initialize (
	void);

ACPI_STATUS
acpi_ns_lookup (
	ACPI_GENERIC_STATE      *scope_info,
	NATIVE_CHAR             *name,
	OBJECT_TYPE_INTERNAL    type,
	OPERATING_MODE          interpreter_mode,
	u32                     flags,
	ACPI_WALK_STATE         *walk_state,
	ACPI_NAMESPACE_NODE     **ret_node);


/*
 * Named object allocation/deallocation - nsalloc
 */


ACPI_NAMESPACE_NODE *
acpi_ns_create_node (
	u32                     acpi_name);

void
acpi_ns_delete_node (
	ACPI_NAMESPACE_NODE     *node);

ACPI_STATUS
acpi_ns_delete_namespace_subtree (
	ACPI_NAMESPACE_NODE     *parent_handle);

void
acpi_ns_detach_object (
	ACPI_NAMESPACE_NODE     *node);

void
acpi_ns_delete_children (
	ACPI_NAMESPACE_NODE     *parent);


/*
 * Namespace modification - nsmodify
 */

ACPI_STATUS
acpi_ns_unload_namespace (
	ACPI_HANDLE             handle);

ACPI_STATUS
acpi_ns_delete_subtree (
	ACPI_HANDLE             start_handle);


/*
 * Namespace dump/print utilities - nsdump
 */

void
acpi_ns_dump_tables (
	ACPI_HANDLE             search_base,
	u32                     max_depth);

void
acpi_ns_dump_entry (
	ACPI_HANDLE             handle,
	u32                     debug_level);

ACPI_STATUS
acpi_ns_dump_pathname (
	ACPI_HANDLE             handle,
	NATIVE_CHAR             *msg,
	u32                     level,
	u32                     component);

void
acpi_ns_dump_root_devices (
	void);

void
acpi_ns_dump_objects (
	OBJECT_TYPE_INTERNAL    type,
	u32                     max_depth,
	u32                     ownder_id,
	ACPI_HANDLE             start_handle);


/*
 * Namespace evaluation functions - nseval
 */

ACPI_STATUS
acpi_ns_evaluate_by_handle (
	ACPI_NAMESPACE_NODE     *prefix_node,
	ACPI_OPERAND_OBJECT     **params,
	ACPI_OPERAND_OBJECT     **return_object);

ACPI_STATUS
acpi_ns_evaluate_by_name (
	NATIVE_CHAR             *pathname,
	ACPI_OPERAND_OBJECT     **params,
	ACPI_OPERAND_OBJECT     **return_object);

ACPI_STATUS
acpi_ns_evaluate_relative (
	ACPI_NAMESPACE_NODE     *prefix_node,
	NATIVE_CHAR             *pathname,
	ACPI_OPERAND_OBJECT     **params,
	ACPI_OPERAND_OBJECT     **return_object);

ACPI_STATUS
acpi_ns_execute_control_method (
	ACPI_NAMESPACE_NODE     *method_node,
	ACPI_OPERAND_OBJECT     **params,
	ACPI_OPERAND_OBJECT     **return_obj_desc);

ACPI_STATUS
acpi_ns_get_object_value (
	ACPI_NAMESPACE_NODE     *object_node,
	ACPI_OPERAND_OBJECT     **return_obj_desc);


/*
 * Parent/Child/Peer utility functions - nsfamily
 */

ACPI_NAME
acpi_ns_find_parent_name (
	ACPI_NAMESPACE_NODE     *node_to_search);

u8
acpi_ns_exist_downstream_sibling (
	ACPI_NAMESPACE_NODE     *this_node);


/*
 * Scope manipulation - nsscope
 */

u32
acpi_ns_opens_scope (
	OBJECT_TYPE_INTERNAL    type);

NATIVE_CHAR *
acpi_ns_get_table_pathname (
	ACPI_NAMESPACE_NODE     *node);

NATIVE_CHAR *
acpi_ns_name_of_current_scope (
	ACPI_WALK_STATE         *walk_state);

ACPI_STATUS
acpi_ns_handle_to_pathname (
	ACPI_HANDLE             obj_handle,
	u32                     *buf_size,
	NATIVE_CHAR             *user_buffer);

u8
acpi_ns_pattern_match (
	ACPI_NAMESPACE_NODE     *obj_node,
	NATIVE_CHAR             *search_for);

ACPI_STATUS
acpi_ns_name_compare (
	ACPI_HANDLE             obj_handle,
	u32                     level,
	void                    *context,
	void                    **return_value);

ACPI_STATUS
acpi_ns_get_node (
	NATIVE_CHAR             *pathname,
	ACPI_NAMESPACE_NODE     *in_prefix_node,
	ACPI_NAMESPACE_NODE     **out_node);

/*
 * Object management for NTEs - nsobject
 */

ACPI_STATUS
acpi_ns_attach_object (
	ACPI_NAMESPACE_NODE     *node,
	ACPI_OPERAND_OBJECT     *object,
	OBJECT_TYPE_INTERNAL    type);


void *
acpi_ns_compare_value (
	ACPI_HANDLE             obj_handle,
	u32                     level,
	void                    *obj_desc);


/*
 * Namespace searching and entry - nssearch
 */

ACPI_STATUS
acpi_ns_search_and_enter (
	u32                     entry_name,
	ACPI_WALK_STATE         *walk_state,
	ACPI_NAMESPACE_NODE     *node,
	OPERATING_MODE          interpreter_mode,
	OBJECT_TYPE_INTERNAL    type,
	u32                     flags,
	ACPI_NAMESPACE_NODE     **ret_node);

ACPI_STATUS
acpi_ns_search_node (
	u32                     entry_name,
	ACPI_NAMESPACE_NODE     *node,
	OBJECT_TYPE_INTERNAL    type,
	ACPI_NAMESPACE_NODE     **ret_node);

ACPI_NAMESPACE_NODE *
acpi_ns_create_node (
	u32                     acpi_name);

void
acpi_ns_install_node (
	ACPI_WALK_STATE         *walk_state,
	ACPI_NAMESPACE_NODE     *parent_node,   /* Parent */
	ACPI_NAMESPACE_NODE     *node,      /* New Child*/
	OBJECT_TYPE_INTERNAL    type);


/*
 * Utility functions - nsutils
 */

u8
acpi_ns_valid_root_prefix (
	NATIVE_CHAR             prefix);

u8
acpi_ns_valid_path_separator (
	NATIVE_CHAR             sep);

OBJECT_TYPE_INTERNAL
acpi_ns_get_type (
	ACPI_HANDLE             obj_handle);

void *
acpi_ns_get_attached_object (
	ACPI_HANDLE             obj_handle);

u32
acpi_ns_local (
	OBJECT_TYPE_INTERNAL    type);

ACPI_STATUS
acpi_ns_internalize_name (
	NATIVE_CHAR             *dotted_name,
	NATIVE_CHAR             **converted_name);

ACPI_STATUS
acpi_ns_externalize_name (
	u32                     internal_name_length,
	NATIVE_CHAR             *internal_name,
	u32                     *converted_name_length,
	NATIVE_CHAR             **converted_name);

ACPI_NAMESPACE_NODE *
acpi_ns_convert_handle_to_entry (
	ACPI_HANDLE             handle);

ACPI_HANDLE
acpi_ns_convert_entry_to_handle(
	ACPI_NAMESPACE_NODE     *node);

void
acpi_ns_terminate (
	void);

ACPI_NAMESPACE_NODE *
acpi_ns_get_parent_object (
	ACPI_NAMESPACE_NODE     *node);


ACPI_NAMESPACE_NODE *
acpi_ns_get_next_valid_object (
	ACPI_NAMESPACE_NODE     *node);


#endif /* __ACNAMESP_H__ */