1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /******************************************************************************
4 * Name: acnamesp.h - Namespace subcomponent prototypes and defines
6 * Copyright (C) 2000 - 2018, Intel Corp.
8 *****************************************************************************/
10 #ifndef __ACNAMESP_H__
11 #define __ACNAMESP_H__
13 /* To search the entire name space, pass this as search_base */
15 #define ACPI_NS_ALL ((acpi_handle)0)
18 * Elements of acpi_ns_properties are bit significant
19 * and should be one-to-one with values of acpi_object_type
21 #define ACPI_NS_NORMAL 0
22 #define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
23 #define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
25 /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
27 #define ACPI_NS_NO_UPSEARCH 0
28 #define ACPI_NS_SEARCH_PARENT 0x0001
29 #define ACPI_NS_DONT_OPEN_SCOPE 0x0002
30 #define ACPI_NS_NO_PEER_SEARCH 0x0004
31 #define ACPI_NS_ERROR_IF_FOUND 0x0008
32 #define ACPI_NS_PREFIX_IS_SCOPE 0x0010
33 #define ACPI_NS_EXTERNAL 0x0020
34 #define ACPI_NS_TEMPORARY 0x0040
35 #define ACPI_NS_OVERRIDE_IF_FOUND 0x0080
36 #define ACPI_NS_EARLY_INIT 0x0100
38 /* Flags for acpi_ns_walk_namespace */
40 #define ACPI_NS_WALK_NO_UNLOCK 0
41 #define ACPI_NS_WALK_UNLOCK 0x01
42 #define ACPI_NS_WALK_TEMP_NODES 0x02
44 /* Object is not a package element */
46 #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX
47 #define ACPI_ALL_PACKAGE_ELEMENTS (ACPI_UINT32_MAX-1)
49 /* Always emit warning message, not dependent on node flags */
51 #define ACPI_WARN_ALWAYS 0
54 * nsinit - Namespace initialization
56 acpi_status
acpi_ns_initialize_objects(void);
58 acpi_status
acpi_ns_initialize_devices(u32 flags
);
61 acpi_ns_init_one_package(acpi_handle obj_handle
,
62 u32 level
, void *context
, void **return_value
);
65 * nsload - Namespace loading
67 acpi_status
acpi_ns_load_namespace(void);
70 acpi_ns_load_table(u32 table_index
, struct acpi_namespace_node
*node
);
73 * nswalk - walk the namespace
76 acpi_ns_walk_namespace(acpi_object_type type
,
77 acpi_handle start_object
,
80 acpi_walk_callback descending_callback
,
81 acpi_walk_callback ascending_callback
,
82 void *context
, void **return_value
);
84 struct acpi_namespace_node
*acpi_ns_get_next_node(struct acpi_namespace_node
86 struct acpi_namespace_node
89 struct acpi_namespace_node
*acpi_ns_get_next_node_typed(acpi_object_type type
,
98 * nsparse - table parsing
101 acpi_ns_parse_table(u32 table_index
, struct acpi_namespace_node
*start_node
);
104 acpi_ns_execute_table(u32 table_index
, struct acpi_namespace_node
*start_node
);
107 acpi_ns_one_complete_parse(u32 pass_number
,
109 struct acpi_namespace_node
*start_node
);
112 * nsaccess - Top-level namespace access
114 acpi_status
acpi_ns_root_initialize(void);
117 acpi_ns_lookup(union acpi_generic_state
*scope_info
,
119 acpi_object_type type
,
120 acpi_interpreter_mode interpreter_mode
,
122 struct acpi_walk_state
*walk_state
,
123 struct acpi_namespace_node
**ret_node
);
126 * nsalloc - Named object allocation/deallocation
128 struct acpi_namespace_node
*acpi_ns_create_node(u32 name
);
130 void acpi_ns_delete_node(struct acpi_namespace_node
*node
);
132 void acpi_ns_remove_node(struct acpi_namespace_node
*node
);
135 acpi_ns_delete_namespace_subtree(struct acpi_namespace_node
*parent_handle
);
137 void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id
);
139 void acpi_ns_detach_object(struct acpi_namespace_node
*node
);
141 void acpi_ns_delete_children(struct acpi_namespace_node
*parent
);
143 int acpi_ns_compare_names(char *name1
, char *name2
);
146 * nsconvert - Dynamic object conversion routines
149 acpi_ns_convert_to_integer(union acpi_operand_object
*original_object
,
150 union acpi_operand_object
**return_object
);
153 acpi_ns_convert_to_string(union acpi_operand_object
*original_object
,
154 union acpi_operand_object
**return_object
);
157 acpi_ns_convert_to_buffer(union acpi_operand_object
*original_object
,
158 union acpi_operand_object
**return_object
);
161 acpi_ns_convert_to_unicode(struct acpi_namespace_node
*scope
,
162 union acpi_operand_object
*original_object
,
163 union acpi_operand_object
**return_object
);
166 acpi_ns_convert_to_resource(struct acpi_namespace_node
*scope
,
167 union acpi_operand_object
*original_object
,
168 union acpi_operand_object
**return_object
);
171 acpi_ns_convert_to_reference(struct acpi_namespace_node
*scope
,
172 union acpi_operand_object
*original_object
,
173 union acpi_operand_object
**return_object
);
176 * nsdump - Namespace dump/print utilities
178 void acpi_ns_dump_tables(acpi_handle search_base
, u32 max_depth
);
180 void acpi_ns_dump_entry(acpi_handle handle
, u32 debug_level
);
183 acpi_ns_dump_pathname(acpi_handle handle
,
184 const char *msg
, u32 level
, u32 component
);
186 void acpi_ns_print_pathname(u32 num_segments
, const char *pathname
);
189 acpi_ns_dump_one_object(acpi_handle obj_handle
,
190 u32 level
, void *context
, void **return_value
);
193 acpi_ns_dump_objects(acpi_object_type type
,
196 acpi_owner_id owner_id
, acpi_handle start_handle
);
199 acpi_ns_dump_object_paths(acpi_object_type type
,
202 acpi_owner_id owner_id
, acpi_handle start_handle
);
205 * nseval - Namespace evaluation functions
207 acpi_status
acpi_ns_evaluate(struct acpi_evaluate_info
*info
);
209 void acpi_ns_exec_module_code_list(void);
212 * nsarguments - Argument count/type checking for predefined/reserved names
215 acpi_ns_check_argument_count(char *pathname
,
216 struct acpi_namespace_node
*node
,
217 u32 user_param_count
,
218 const union acpi_predefined_info
*info
);
221 acpi_ns_check_acpi_compliance(char *pathname
,
222 struct acpi_namespace_node
*node
,
223 const union acpi_predefined_info
*predefined
);
225 void acpi_ns_check_argument_types(struct acpi_evaluate_info
*info
);
228 * nspredef - Return value checking for predefined/reserved names
231 acpi_ns_check_return_value(struct acpi_namespace_node
*node
,
232 struct acpi_evaluate_info
*info
,
233 u32 user_param_count
,
234 acpi_status return_status
,
235 union acpi_operand_object
**return_object
);
238 acpi_ns_check_object_type(struct acpi_evaluate_info
*info
,
239 union acpi_operand_object
**return_object_ptr
,
240 u32 expected_btypes
, u32 package_index
);
243 * nsprepkg - Validation of predefined name packages
246 acpi_ns_check_package(struct acpi_evaluate_info
*info
,
247 union acpi_operand_object
**return_object_ptr
);
250 * nsnames - Name and Scope manipulation
252 u32
acpi_ns_opens_scope(acpi_object_type type
);
254 char *acpi_ns_get_external_pathname(struct acpi_namespace_node
*node
);
257 acpi_ns_build_normalized_path(struct acpi_namespace_node
*node
,
258 char *full_path
, u32 path_size
, u8 no_trailing
);
260 char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node
*node
,
263 char *acpi_ns_build_prefixed_pathname(union acpi_generic_state
*prefix_scope
,
264 const char *internal_path
);
266 char *acpi_ns_name_of_current_scope(struct acpi_walk_state
*walk_state
);
269 acpi_ns_handle_to_name(acpi_handle target_handle
, struct acpi_buffer
*buffer
);
272 acpi_ns_handle_to_pathname(acpi_handle target_handle
,
273 struct acpi_buffer
*buffer
, u8 no_trailing
);
276 acpi_ns_pattern_match(struct acpi_namespace_node
*obj_node
, char *search_for
);
279 acpi_ns_get_node_unlocked(struct acpi_namespace_node
*prefix_node
,
280 const char *external_pathname
,
281 u32 flags
, struct acpi_namespace_node
**out_node
);
284 acpi_ns_get_node(struct acpi_namespace_node
*prefix_node
,
285 const char *external_pathname
,
286 u32 flags
, struct acpi_namespace_node
**out_node
);
288 acpi_size
acpi_ns_get_pathname_length(struct acpi_namespace_node
*node
);
291 * nsobject - Object management for namespace nodes
294 acpi_ns_attach_object(struct acpi_namespace_node
*node
,
295 union acpi_operand_object
*object
, acpi_object_type type
);
297 union acpi_operand_object
*acpi_ns_get_attached_object(struct
301 union acpi_operand_object
*acpi_ns_get_secondary_object(union
306 acpi_ns_attach_data(struct acpi_namespace_node
*node
,
307 acpi_object_handler handler
, void *data
);
310 acpi_ns_detach_data(struct acpi_namespace_node
*node
,
311 acpi_object_handler handler
);
314 acpi_ns_get_attached_data(struct acpi_namespace_node
*node
,
315 acpi_object_handler handler
, void **data
);
318 * nsrepair - General return object repair for all
319 * predefined methods/objects
322 acpi_ns_simple_repair(struct acpi_evaluate_info
*info
,
325 union acpi_operand_object
**return_object_ptr
);
328 acpi_ns_wrap_with_package(struct acpi_evaluate_info
*info
,
329 union acpi_operand_object
*original_object
,
330 union acpi_operand_object
**obj_desc_ptr
);
333 acpi_ns_repair_null_element(struct acpi_evaluate_info
*info
,
336 union acpi_operand_object
**return_object_ptr
);
339 acpi_ns_remove_null_elements(struct acpi_evaluate_info
*info
,
341 union acpi_operand_object
*obj_desc
);
344 * nsrepair2 - Return object repair for specific
345 * predefined methods/objects
348 acpi_ns_complex_repairs(struct acpi_evaluate_info
*info
,
349 struct acpi_namespace_node
*node
,
350 acpi_status validate_status
,
351 union acpi_operand_object
**return_object_ptr
);
354 * nssearch - Namespace searching and entry
357 acpi_ns_search_and_enter(u32 entry_name
,
358 struct acpi_walk_state
*walk_state
,
359 struct acpi_namespace_node
*node
,
360 acpi_interpreter_mode interpreter_mode
,
361 acpi_object_type type
,
362 u32 flags
, struct acpi_namespace_node
**ret_node
);
365 acpi_ns_search_one_scope(u32 entry_name
,
366 struct acpi_namespace_node
*node
,
367 acpi_object_type type
,
368 struct acpi_namespace_node
**ret_node
);
371 acpi_ns_install_node(struct acpi_walk_state
*walk_state
,
372 struct acpi_namespace_node
*parent_node
,
373 struct acpi_namespace_node
*node
, acpi_object_type type
);
376 * nsutils - Utility functions
378 acpi_object_type
acpi_ns_get_type(struct acpi_namespace_node
*node
);
380 u32
acpi_ns_local(acpi_object_type type
);
383 acpi_ns_print_node_pathname(struct acpi_namespace_node
*node
, const char *msg
);
385 acpi_status
acpi_ns_build_internal_name(struct acpi_namestring_info
*info
);
387 void acpi_ns_get_internal_name_length(struct acpi_namestring_info
*info
);
390 acpi_ns_internalize_name(const char *dotted_name
, char **converted_name
);
393 acpi_ns_externalize_name(u32 internal_name_length
,
394 const char *internal_name
,
395 u32
* converted_name_length
, char **converted_name
);
397 struct acpi_namespace_node
*acpi_ns_validate_handle(acpi_handle handle
);
399 void acpi_ns_terminate(void);
401 #endif /* __ACNAMESP_H__ */