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

/*
8
 * Copyright (C) 2000 - 2015, 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
69
#define ACPI_NS_OVERRIDE_IF_FOUND   0x80
L
Linus Torvalds 已提交
70

71 72 73 74 75
/* 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 已提交
76

77 78 79 80 81 82 83 84
/* 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 已提交
85 86 87
/*
 * nsinit - Namespace initialization
 */
L
Len Brown 已提交
88
acpi_status acpi_ns_initialize_objects(void);
L
Linus Torvalds 已提交
89

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

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

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

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

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

117 118 119 120 121 122 123 124
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 已提交
125 126 127
/*
 * nsparse - table parsing
 */
L
Linus Torvalds 已提交
128
acpi_status
129
acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);
L
Linus Torvalds 已提交
130 131

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

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

acpi_status
L
Len Brown 已提交
142 143 144 145 146 147 148
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 已提交
149 150

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

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

157 158
void acpi_ns_remove_node(struct acpi_namespace_node *node);

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

L
Len Brown 已提交
162
void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
L
Linus Torvalds 已提交
163

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

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

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

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
/*
 * nsconvert - Dynamic object conversion routines
 */
acpi_status
acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
			   union acpi_operand_object **return_object);

acpi_status
acpi_ns_convert_to_string(union acpi_operand_object *original_object,
			  union acpi_operand_object **return_object);

acpi_status
acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
			  union acpi_operand_object **return_object);

185 186 187 188
acpi_status
acpi_ns_convert_to_unicode(union acpi_operand_object *original_object,
			   union acpi_operand_object **return_object);

189 190 191 192
acpi_status
acpi_ns_convert_to_resource(union acpi_operand_object *original_object,
			    union acpi_operand_object **return_object);

L
Linus Torvalds 已提交
193
/*
R
Robert Moore 已提交
194
 * nsdump - Namespace dump/print utilities
L
Linus Torvalds 已提交
195
 */
L
Len Brown 已提交
196
void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
L
Linus Torvalds 已提交
197

L
Len Brown 已提交
198
void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
L
Linus Torvalds 已提交
199 200

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

L
Len Brown 已提交
203
void acpi_ns_print_pathname(u32 num_segments, char *pathname);
L
Linus Torvalds 已提交
204 205

acpi_status
L
Len Brown 已提交
206 207
acpi_ns_dump_one_object(acpi_handle obj_handle,
			u32 level, void *context, void **return_value);
L
Linus Torvalds 已提交
208 209

void
L
Len Brown 已提交
210 211 212 213
acpi_ns_dump_objects(acpi_object_type type,
		     u8 display_type,
		     u32 max_depth,
		     acpi_owner_id owner_id, acpi_handle start_handle);
214 215 216 217 218 219

void
acpi_ns_dump_object_paths(acpi_object_type type,
			  u8 display_type,
			  u32 max_depth,
			  acpi_owner_id owner_id, acpi_handle start_handle);
L
Linus Torvalds 已提交
220 221

/*
R
Robert Moore 已提交
222
 * nseval - Namespace evaluation functions
L
Linus Torvalds 已提交
223
 */
B
Bob Moore 已提交
224
acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
L
Linus Torvalds 已提交
225

226 227
void acpi_ns_exec_module_code_list(void);

228
/*
229
 * nsarguments - Argument count/type checking for predefined/reserved names
230
 */
231 232 233 234 235
void
acpi_ns_check_argument_count(char *pathname,
			     struct acpi_namespace_node *node,
			     u32 user_param_count,
			     const union acpi_predefined_info *info);
236 237

void
238
acpi_ns_check_acpi_compliance(char *pathname,
239
			      struct acpi_namespace_node *node,
240 241 242 243 244 245 246 247 248 249 250 251 252
			      const union acpi_predefined_info *predefined);

void acpi_ns_check_argument_types(struct acpi_evaluate_info *info);

/*
 * nspredef - Return value checking for predefined/reserved names
 */
acpi_status
acpi_ns_check_return_value(struct acpi_namespace_node *node,
			   struct acpi_evaluate_info *info,
			   u32 user_param_count,
			   acpi_status return_status,
			   union acpi_operand_object **return_object);
253

254
acpi_status
255
acpi_ns_check_object_type(struct acpi_evaluate_info *info,
256 257 258 259 260 261 262
			  union acpi_operand_object **return_object_ptr,
			  u32 expected_btypes, u32 package_index);

/*
 * nsprepkg - Validation of predefined name packages
 */
acpi_status
263
acpi_ns_check_package(struct acpi_evaluate_info *info,
264 265
		      union acpi_operand_object **return_object_ptr);

L
Linus Torvalds 已提交
266
/*
R
Robert Moore 已提交
267
 * nsnames - Name and Scope manipulation
L
Linus Torvalds 已提交
268
 */
L
Len Brown 已提交
269
u32 acpi_ns_opens_scope(acpi_object_type type);
L
Linus Torvalds 已提交
270

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

273 274 275 276 277 278 279
u32
acpi_ns_build_normalized_path(struct acpi_namespace_node *node,
			      char *full_path, u32 path_size, u8 no_trailing);

char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
				      u8 no_trailing);

L
Len Brown 已提交
280
char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
L
Linus Torvalds 已提交
281 282

acpi_status
L
Len Brown 已提交
283
acpi_ns_handle_to_pathname(acpi_handle target_handle,
284
			   struct acpi_buffer *buffer, u8 no_trailing);
L
Linus Torvalds 已提交
285 286

u8
L
Len Brown 已提交
287
acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
L
Linus Torvalds 已提交
288 289

acpi_status
B
Bob Moore 已提交
290
acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
291
		 const char *external_pathname,
B
Bob Moore 已提交
292
		 u32 flags, struct acpi_namespace_node **out_node);
L
Linus Torvalds 已提交
293

L
Len Brown 已提交
294
acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
295 296

/*
R
Robert Moore 已提交
297
 * nsobject - Object management for namespace nodes
L
Linus Torvalds 已提交
298 299
 */
acpi_status
L
Len Brown 已提交
300 301
acpi_ns_attach_object(struct acpi_namespace_node *node,
		      union acpi_operand_object *object, acpi_object_type type);
L
Linus Torvalds 已提交
302

L
Len Brown 已提交
303 304 305
union acpi_operand_object *acpi_ns_get_attached_object(struct
						       acpi_namespace_node
						       *node);
L
Linus Torvalds 已提交
306

L
Len Brown 已提交
307 308 309
union acpi_operand_object *acpi_ns_get_secondary_object(union
							acpi_operand_object
							*obj_desc);
L
Linus Torvalds 已提交
310 311

acpi_status
L
Len Brown 已提交
312 313
acpi_ns_attach_data(struct acpi_namespace_node *node,
		    acpi_object_handler handler, void *data);
L
Linus Torvalds 已提交
314 315

acpi_status
L
Len Brown 已提交
316 317
acpi_ns_detach_data(struct acpi_namespace_node *node,
		    acpi_object_handler handler);
L
Linus Torvalds 已提交
318 319

acpi_status
L
Len Brown 已提交
320 321
acpi_ns_get_attached_data(struct acpi_namespace_node *node,
			  acpi_object_handler handler, void **data);
L
Linus Torvalds 已提交
322

323
/*
324 325
 * nsrepair - General return object repair for all
 * predefined methods/objects
326 327
 */
acpi_status
328
acpi_ns_simple_repair(struct acpi_evaluate_info *info,
329 330 331 332
		      u32 expected_btypes,
		      u32 package_index,
		      union acpi_operand_object **return_object_ptr);

333
acpi_status
334
acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
335 336
			  union acpi_operand_object *original_object,
			  union acpi_operand_object **obj_desc_ptr);
337

338
acpi_status
339
acpi_ns_repair_null_element(struct acpi_evaluate_info *info,
340 341 342 343 344
			    u32 expected_btypes,
			    u32 package_index,
			    union acpi_operand_object **return_object_ptr);

void
345
acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
346 347 348
			     u8 package_type,
			     union acpi_operand_object *obj_desc);

349 350 351 352 353
/*
 * nsrepair2 - Return object repair for specific
 * predefined methods/objects
 */
acpi_status
354
acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
355 356 357 358
			struct acpi_namespace_node *node,
			acpi_status validate_status,
			union acpi_operand_object **return_object_ptr);

L
Linus Torvalds 已提交
359
/*
R
Robert Moore 已提交
360
 * nssearch - Namespace searching and entry
L
Linus Torvalds 已提交
361 362
 */
acpi_status
L
Len Brown 已提交
363 364 365 366 367 368
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 已提交
369 370

acpi_status
B
Bob Moore 已提交
371 372 373 374
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 已提交
375 376

void
L
Len Brown 已提交
377 378 379
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 已提交
380 381

/*
R
Robert Moore 已提交
382
 * nsutils - Utility functions
L
Linus Torvalds 已提交
383
 */
L
Len Brown 已提交
384
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
385

L
Len Brown 已提交
386
u32 acpi_ns_local(acpi_object_type type);
L
Linus Torvalds 已提交
387

388 389
void
acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg);
L
Linus Torvalds 已提交
390

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

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

395 396
acpi_status
acpi_ns_internalize_name(const char *dotted_name, char **converted_name);
L
Linus Torvalds 已提交
397 398

acpi_status
L
Len Brown 已提交
399
acpi_ns_externalize_name(u32 internal_name_length,
400
			 const char *internal_name,
L
Len Brown 已提交
401
			 u32 * converted_name_length, char **converted_name);
L
Linus Torvalds 已提交
402

403
struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
L
Linus Torvalds 已提交
404

L
Len Brown 已提交
405
void acpi_ns_terminate(void);
L
Linus Torvalds 已提交
406

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