acnamesp.h 11.0 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 - 2013, 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,
107 108
		       acpi_walk_callback pre_order_visit,
		       acpi_walk_callback post_order_visit,
L
Len Brown 已提交
109 110
		       void *context, void **return_value);

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

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

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

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

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

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

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

156 157
void acpi_ns_remove_node(struct acpi_namespace_node *node);

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

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

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

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

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

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

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

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

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

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

R
Robert Moore 已提交
187
#ifdef	ACPI_FUTURE_USAGE
L
Linus Torvalds 已提交
188
void
L
Len Brown 已提交
189 190 191 192 193
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 已提交
194 195

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

200 201
void acpi_ns_exec_module_code_list(void);

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

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,
218
			      u32 user_param_count,
219 220
			      const union acpi_predefined_info *info);

221 222 223 224 225 226 227 228 229 230 231 232
acpi_status
acpi_ns_check_object_type(struct acpi_predefined_data *data,
			  union acpi_operand_object **return_object_ptr,
			  u32 expected_btypes, u32 package_index);

/*
 * nsprepkg - Validation of predefined name packages
 */
acpi_status
acpi_ns_check_package(struct acpi_predefined_data *data,
		      union acpi_operand_object **return_object_ptr);

L
Linus Torvalds 已提交
233
/*
R
Robert Moore 已提交
234
 * nsnames - Name and Scope manipulation
L
Linus Torvalds 已提交
235
 */
L
Len Brown 已提交
236
u32 acpi_ns_opens_scope(acpi_object_type type);
L
Linus Torvalds 已提交
237

238
acpi_status
B
Bob Moore 已提交
239 240 241
acpi_ns_build_external_path(struct acpi_namespace_node *node,
			    acpi_size size, char *name_buffer);

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

L
Len Brown 已提交
244
char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
L
Linus Torvalds 已提交
245 246

acpi_status
L
Len Brown 已提交
247 248
acpi_ns_handle_to_pathname(acpi_handle target_handle,
			   struct acpi_buffer *buffer);
L
Linus Torvalds 已提交
249 250

u8
L
Len Brown 已提交
251
acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
L
Linus Torvalds 已提交
252 253

acpi_status
B
Bob Moore 已提交
254
acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
255
		 const char *external_pathname,
B
Bob Moore 已提交
256
		 u32 flags, struct acpi_namespace_node **out_node);
L
Linus Torvalds 已提交
257

L
Len Brown 已提交
258
acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
259 260

/*
R
Robert Moore 已提交
261
 * nsobject - Object management for namespace nodes
L
Linus Torvalds 已提交
262 263
 */
acpi_status
L
Len Brown 已提交
264 265
acpi_ns_attach_object(struct acpi_namespace_node *node,
		      union acpi_operand_object *object, acpi_object_type type);
L
Linus Torvalds 已提交
266

L
Len Brown 已提交
267 268 269
union acpi_operand_object *acpi_ns_get_attached_object(struct
						       acpi_namespace_node
						       *node);
L
Linus Torvalds 已提交
270

L
Len Brown 已提交
271 272 273
union acpi_operand_object *acpi_ns_get_secondary_object(union
							acpi_operand_object
							*obj_desc);
L
Linus Torvalds 已提交
274 275

acpi_status
L
Len Brown 已提交
276 277
acpi_ns_attach_data(struct acpi_namespace_node *node,
		    acpi_object_handler handler, void *data);
L
Linus Torvalds 已提交
278 279

acpi_status
L
Len Brown 已提交
280 281
acpi_ns_detach_data(struct acpi_namespace_node *node,
		    acpi_object_handler handler);
L
Linus Torvalds 已提交
282 283

acpi_status
L
Len Brown 已提交
284 285
acpi_ns_get_attached_data(struct acpi_namespace_node *node,
			  acpi_object_handler handler, void **data);
L
Linus Torvalds 已提交
286

287
/*
288 289
 * nsrepair - General return object repair for all
 * predefined methods/objects
290 291
 */
acpi_status
292
acpi_ns_simple_repair(struct acpi_predefined_data *data,
293 294 295 296
		      u32 expected_btypes,
		      u32 package_index,
		      union acpi_operand_object **return_object_ptr);

297
acpi_status
298 299 300
acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
			  union acpi_operand_object *original_object,
			  union acpi_operand_object **obj_desc_ptr);
301

302 303 304 305 306 307 308 309 310 311 312
acpi_status
acpi_ns_repair_null_element(struct acpi_predefined_data *data,
			    u32 expected_btypes,
			    u32 package_index,
			    union acpi_operand_object **return_object_ptr);

void
acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
			     u8 package_type,
			     union acpi_operand_object *obj_desc);

313 314 315 316 317 318 319 320 321 322
/*
 * nsrepair2 - Return object repair for specific
 * predefined methods/objects
 */
acpi_status
acpi_ns_complex_repairs(struct acpi_predefined_data *data,
			struct acpi_namespace_node *node,
			acpi_status validate_status,
			union acpi_operand_object **return_object_ptr);

L
Linus Torvalds 已提交
323
/*
R
Robert Moore 已提交
324
 * nssearch - Namespace searching and entry
L
Linus Torvalds 已提交
325 326
 */
acpi_status
L
Len Brown 已提交
327 328 329 330 331 332
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 已提交
333 334

acpi_status
B
Bob Moore 已提交
335 336 337 338
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 已提交
339 340

void
L
Len Brown 已提交
341 342 343
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 已提交
344 345

/*
R
Robert Moore 已提交
346
 * nsutils - Utility functions
L
Linus Torvalds 已提交
347
 */
L
Len Brown 已提交
348
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
L
Linus Torvalds 已提交
349

L
Len Brown 已提交
350
u32 acpi_ns_local(acpi_object_type type);
L
Linus Torvalds 已提交
351

352 353
void
acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg);
L
Linus Torvalds 已提交
354

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

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

359 360
acpi_status
acpi_ns_internalize_name(const char *dotted_name, char **converted_name);
L
Linus Torvalds 已提交
361 362

acpi_status
L
Len Brown 已提交
363
acpi_ns_externalize_name(u32 internal_name_length,
364
			 const char *internal_name,
L
Len Brown 已提交
365
			 u32 * converted_name_length, char **converted_name);
L
Linus Torvalds 已提交
366

367
struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
L
Linus Torvalds 已提交
368

L
Len Brown 已提交
369
void acpi_ns_terminate(void);
L
Linus Torvalds 已提交
370

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