acnamesp.h 10.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7
/******************************************************************************
 *
 * Name: acnamesp.h - Namespace subcomponent prototypes and defines
 *
 *****************************************************************************/

/*
L
Len Brown 已提交
8
 * Copyright (C) 2000 - 2008, Intel Corp.
L
Linus Torvalds 已提交
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
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 */

#ifndef __ACNAMESP_H__
#define __ACNAMESP_H__

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

#define ACPI_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 ACPI_NS_NORMAL              0
L
Len Brown 已提交
56 57
#define ACPI_NS_NEWSCOPE            1	/* a definition of this type opens a name scope */
#define ACPI_NS_LOCAL               2	/* suppress search of enclosing scopes */
L
Linus Torvalds 已提交
58 59 60 61 62 63 64 65

/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */

#define ACPI_NS_NO_UPSEARCH         0
#define ACPI_NS_SEARCH_PARENT       0x01
#define ACPI_NS_DONT_OPEN_SCOPE     0x02
#define ACPI_NS_NO_PEER_SEARCH      0x04
#define ACPI_NS_ERROR_IF_FOUND      0x08
B
Bob Moore 已提交
66
#define ACPI_NS_PREFIX_IS_SCOPE     0x10
B
Bob Moore 已提交
67
#define ACPI_NS_EXTERNAL            0x20
68
#define ACPI_NS_TEMPORARY           0x40
L
Linus Torvalds 已提交
69

70 71 72 73 74
/* Flags for acpi_ns_walk_namespace */

#define ACPI_NS_WALK_NO_UNLOCK      0
#define ACPI_NS_WALK_UNLOCK         0x01
#define ACPI_NS_WALK_TEMP_NODES     0x02
L
Linus Torvalds 已提交
75

76 77 78 79 80 81 82 83
/* Object is not a package element */

#define ACPI_NOT_PACKAGE_ELEMENT    ACPI_UINT32_MAX

/* Always emit warning message, not dependent on node flags */

#define ACPI_WARN_ALWAYS            0

R
Robert Moore 已提交
84 85 86
/*
 * nsinit - Namespace initialization
 */
L
Len Brown 已提交
87
acpi_status acpi_ns_initialize_objects(void);
L
Linus Torvalds 已提交
88

L
Len Brown 已提交
89
acpi_status acpi_ns_initialize_devices(void);
L
Linus Torvalds 已提交
90

R
Robert Moore 已提交
91 92 93
/*
 * nsload -  Namespace loading
 */
L
Len Brown 已提交
94
acpi_status acpi_ns_load_namespace(void);
L
Linus Torvalds 已提交
95 96

acpi_status
97
acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
98

R
Robert Moore 已提交
99 100 101
/*
 * nswalk - walk the namespace
 */
L
Linus Torvalds 已提交
102
acpi_status
L
Len Brown 已提交
103 104 105
acpi_ns_walk_namespace(acpi_object_type type,
		       acpi_handle start_object,
		       u32 max_depth,
106
		       u32 flags,
L
Len Brown 已提交
107 108 109
		       acpi_walk_callback user_function,
		       void *context, void **return_value);

110 111 112
struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
						  *parent,
						  struct acpi_namespace_node
L
Len Brown 已提交
113
						  *child);
L
Linus Torvalds 已提交
114

115 116 117 118 119 120 121 122
struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
							struct
							acpi_namespace_node
							*parent,
							struct
							acpi_namespace_node
							*child);

R
Robert Moore 已提交
123 124 125
/*
 * nsparse - table parsing
 */
L
Linus Torvalds 已提交
126
acpi_status
127
acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);
L
Linus Torvalds 已提交
128 129

acpi_status
130 131
acpi_ns_one_complete_parse(u32 pass_number,
			   u32 table_index,
132
			   struct acpi_namespace_node *start_node);
L
Linus Torvalds 已提交
133 134

/*
R
Robert Moore 已提交
135
 * nsaccess - Top-level namespace access
L
Linus Torvalds 已提交
136
 */
L
Len Brown 已提交
137
acpi_status acpi_ns_root_initialize(void);
L
Linus Torvalds 已提交
138 139

acpi_status
L
Len Brown 已提交
140 141 142 143 144 145 146
acpi_ns_lookup(union acpi_generic_state *scope_info,
	       char *name,
	       acpi_object_type type,
	       acpi_interpreter_mode interpreter_mode,
	       u32 flags,
	       struct acpi_walk_state *walk_state,
	       struct acpi_namespace_node **ret_node);
L
Linus Torvalds 已提交
147 148

/*
R
Robert Moore 已提交
149
 * nsalloc - Named object allocation/deallocation
L
Linus Torvalds 已提交
150
 */
L
Len Brown 已提交
151
struct acpi_namespace_node *acpi_ns_create_node(u32 name);
L
Linus Torvalds 已提交
152

L
Len Brown 已提交
153
void acpi_ns_delete_node(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
154

155 156
void acpi_ns_remove_node(struct acpi_namespace_node *node);

R
Robert Moore 已提交
157
void
L
Len Brown 已提交
158
acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
R
Robert Moore 已提交
159

L
Len Brown 已提交
160
void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
L
Linus Torvalds 已提交
161

L
Len Brown 已提交
162
void acpi_ns_detach_object(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
163

L
Len Brown 已提交
164
void acpi_ns_delete_children(struct acpi_namespace_node *parent);
L
Linus Torvalds 已提交
165

L
Len Brown 已提交
166
int acpi_ns_compare_names(char *name1, char *name2);
L
Linus Torvalds 已提交
167 168

/*
R
Robert Moore 已提交
169
 * nsdump - Namespace dump/print utilities
L
Linus Torvalds 已提交
170
 */
R
Robert Moore 已提交
171
#ifdef	ACPI_FUTURE_USAGE
L
Len Brown 已提交
172 173
void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
#endif				/* ACPI_FUTURE_USAGE */
L
Linus Torvalds 已提交
174

L
Len Brown 已提交
175
void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
L
Linus Torvalds 已提交
176 177

void
L
Len Brown 已提交
178
acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
L
Linus Torvalds 已提交
179

L
Len Brown 已提交
180
void acpi_ns_print_pathname(u32 num_segments, char *pathname);
L
Linus Torvalds 已提交
181 182

acpi_status
L
Len Brown 已提交
183 184
acpi_ns_dump_one_object(acpi_handle obj_handle,
			u32 level, void *context, void **return_value);
L
Linus Torvalds 已提交
185

R
Robert Moore 已提交
186
#ifdef	ACPI_FUTURE_USAGE
L
Linus Torvalds 已提交
187
void
L
Len Brown 已提交
188 189 190 191 192
acpi_ns_dump_objects(acpi_object_type type,
		     u8 display_type,
		     u32 max_depth,
		     acpi_owner_id owner_id, acpi_handle start_handle);
#endif				/* ACPI_FUTURE_USAGE */
L
Linus Torvalds 已提交
193 194

/*
R
Robert Moore 已提交
195
 * nseval - Namespace evaluation functions
L
Linus Torvalds 已提交
196
 */
B
Bob Moore 已提交
197
acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
L
Linus Torvalds 已提交
198

199 200 201 202 203
/*
 * nspredef - Support for predefined/reserved names
 */
acpi_status
acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
204 205
			       u32 user_param_count,
			       acpi_status return_status,
206
			       union acpi_operand_object **return_object);
207 208 209 210 211 212 213 214

const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
								    acpi_namespace_node
								    *node);

void
acpi_ns_check_parameter_count(char *pathname,
			      struct acpi_namespace_node *node,
215
			      u32 user_param_count,
216 217
			      const union acpi_predefined_info *info);

L
Linus Torvalds 已提交
218
/*
R
Robert Moore 已提交
219
 * nsnames - Name and Scope manipulation
L
Linus Torvalds 已提交
220
 */
L
Len Brown 已提交
221
u32 acpi_ns_opens_scope(acpi_object_type type);
L
Linus Torvalds 已提交
222

223
acpi_status
B
Bob Moore 已提交
224 225 226
acpi_ns_build_external_path(struct acpi_namespace_node *node,
			    acpi_size size, char *name_buffer);

L
Len Brown 已提交
227
char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
228

L
Len Brown 已提交
229
char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
L
Linus Torvalds 已提交
230 231

acpi_status
L
Len Brown 已提交
232 233
acpi_ns_handle_to_pathname(acpi_handle target_handle,
			   struct acpi_buffer *buffer);
L
Linus Torvalds 已提交
234 235

u8
L
Len Brown 已提交
236
acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
L
Linus Torvalds 已提交
237 238

acpi_status
B
Bob Moore 已提交
239
acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
240
		 const char *external_pathname,
B
Bob Moore 已提交
241
		 u32 flags, struct acpi_namespace_node **out_node);
L
Linus Torvalds 已提交
242

L
Len Brown 已提交
243
acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
244 245

/*
R
Robert Moore 已提交
246
 * nsobject - Object management for namespace nodes
L
Linus Torvalds 已提交
247 248
 */
acpi_status
L
Len Brown 已提交
249 250
acpi_ns_attach_object(struct acpi_namespace_node *node,
		      union acpi_operand_object *object, acpi_object_type type);
L
Linus Torvalds 已提交
251

L
Len Brown 已提交
252 253 254
union acpi_operand_object *acpi_ns_get_attached_object(struct
						       acpi_namespace_node
						       *node);
L
Linus Torvalds 已提交
255

L
Len Brown 已提交
256 257 258
union acpi_operand_object *acpi_ns_get_secondary_object(union
							acpi_operand_object
							*obj_desc);
L
Linus Torvalds 已提交
259 260

acpi_status
L
Len Brown 已提交
261 262
acpi_ns_attach_data(struct acpi_namespace_node *node,
		    acpi_object_handler handler, void *data);
L
Linus Torvalds 已提交
263 264

acpi_status
L
Len Brown 已提交
265 266
acpi_ns_detach_data(struct acpi_namespace_node *node,
		    acpi_object_handler handler);
L
Linus Torvalds 已提交
267 268

acpi_status
L
Len Brown 已提交
269 270
acpi_ns_get_attached_data(struct acpi_namespace_node *node,
			  acpi_object_handler handler, void **data);
L
Linus Torvalds 已提交
271

272 273 274 275 276 277 278 279 280
/*
 * nsrepair - return object repair for predefined methods/objects
 */
acpi_status
acpi_ns_repair_object(struct acpi_predefined_data *data,
		      u32 expected_btypes,
		      u32 package_index,
		      union acpi_operand_object **return_object_ptr);

281 282 283 284
acpi_status
acpi_ns_repair_package_list(struct acpi_predefined_data *data,
			    union acpi_operand_object **obj_desc_ptr);

L
Linus Torvalds 已提交
285
/*
R
Robert Moore 已提交
286
 * nssearch - Namespace searching and entry
L
Linus Torvalds 已提交
287 288
 */
acpi_status
L
Len Brown 已提交
289 290 291 292 293 294
acpi_ns_search_and_enter(u32 entry_name,
			 struct acpi_walk_state *walk_state,
			 struct acpi_namespace_node *node,
			 acpi_interpreter_mode interpreter_mode,
			 acpi_object_type type,
			 u32 flags, struct acpi_namespace_node **ret_node);
L
Linus Torvalds 已提交
295 296

acpi_status
B
Bob Moore 已提交
297 298 299 300
acpi_ns_search_one_scope(u32 entry_name,
			 struct acpi_namespace_node *node,
			 acpi_object_type type,
			 struct acpi_namespace_node **ret_node);
L
Linus Torvalds 已提交
301 302

void
L
Len Brown 已提交
303 304 305
acpi_ns_install_node(struct acpi_walk_state *walk_state,
		     struct acpi_namespace_node *parent_node,
		     struct acpi_namespace_node *node, acpi_object_type type);
L
Linus Torvalds 已提交
306 307

/*
R
Robert Moore 已提交
308
 * nsutils - Utility functions
L
Linus Torvalds 已提交
309
 */
L
Len Brown 已提交
310
u8 acpi_ns_valid_root_prefix(char prefix);
L
Linus Torvalds 已提交
311

L
Len Brown 已提交
312
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
313

L
Len Brown 已提交
314
u32 acpi_ns_local(acpi_object_type type);
L
Linus Torvalds 已提交
315 316

void
317
acpi_ns_report_error(const char *module_name,
L
Len Brown 已提交
318
		     u32 line_number,
319
		     const char *internal_name, acpi_status lookup_status);
L
Linus Torvalds 已提交
320 321

void
322
acpi_ns_report_method_error(const char *module_name,
L
Len Brown 已提交
323
			    u32 line_number,
324
			    const char *message,
L
Len Brown 已提交
325
			    struct acpi_namespace_node *node,
326
			    const char *path, acpi_status lookup_status);
L
Linus Torvalds 已提交
327

328 329
void
acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg);
L
Linus Torvalds 已提交
330

L
Len Brown 已提交
331
acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
L
Linus Torvalds 已提交
332

L
Len Brown 已提交
333
void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
L
Linus Torvalds 已提交
334

335 336
acpi_status
acpi_ns_internalize_name(const char *dotted_name, char **converted_name);
L
Linus Torvalds 已提交
337 338

acpi_status
L
Len Brown 已提交
339
acpi_ns_externalize_name(u32 internal_name_length,
340
			 const char *internal_name,
L
Len Brown 已提交
341
			 u32 * converted_name_length, char **converted_name);
L
Linus Torvalds 已提交
342

L
Len Brown 已提交
343
struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle);
L
Linus Torvalds 已提交
344

L
Len Brown 已提交
345
acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
346

L
Len Brown 已提交
347
void acpi_ns_terminate(void);
L
Linus Torvalds 已提交
348

L
Len Brown 已提交
349 350
struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
						    *node);
L
Linus Torvalds 已提交
351

L
Len Brown 已提交
352 353 354
struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
							acpi_namespace_node
							*node);
L
Linus Torvalds 已提交
355

L
Len Brown 已提交
356
#endif				/* __ACNAMESP_H__ */