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 0x01
29 #define ACPI_NS_DONT_OPEN_SCOPE 0x02
30 #define ACPI_NS_NO_PEER_SEARCH 0x04
31 #define ACPI_NS_ERROR_IF_FOUND 0x08
32 #define ACPI_NS_PREFIX_IS_SCOPE 0x10
33 #define ACPI_NS_EXTERNAL 0x20
34 #define ACPI_NS_TEMPORARY 0x40
35 #define ACPI_NS_OVERRIDE_IF_FOUND 0x80
37 /* Flags for acpi_ns_walk_namespace */
39 #define ACPI_NS_WALK_NO_UNLOCK 0
40 #define ACPI_NS_WALK_UNLOCK 0x01
41 #define ACPI_NS_WALK_TEMP_NODES 0x02
43 /* Object is not a package element */
45 #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX
46 #define ACPI_ALL_PACKAGE_ELEMENTS (ACPI_UINT32_MAX-1)
48 /* Always emit warning message, not dependent on node flags */
50 #define ACPI_WARN_ALWAYS 0
53 * nsinit - Namespace initialization
55 acpi_status
acpi_ns_initialize_objects(void);
57 acpi_status
acpi_ns_initialize_devices(u32 flags
);
60 * nsload - Namespace loading
62 acpi_status
acpi_ns_load_namespace(void);
65 acpi_ns_load_table(u32 table_index
, struct acpi_namespace_node
*node
);
68 * nswalk - walk the namespace
71 acpi_ns_walk_namespace(acpi_object_type type
,
72 acpi_handle start_object
,
75 acpi_walk_callback descending_callback
,
76 acpi_walk_callback ascending_callback
,
77 void *context
, void **return_value
);
79 struct acpi_namespace_node
*acpi_ns_get_next_node(struct acpi_namespace_node
81 struct acpi_namespace_node
84 struct acpi_namespace_node
*acpi_ns_get_next_node_typed(acpi_object_type type
,
93 * nsparse - table parsing
96 acpi_ns_parse_table(u32 table_index
, struct acpi_namespace_node
*start_node
);
99 acpi_ns_execute_table(u32 table_index
, struct acpi_namespace_node
*start_node
);
102 acpi_ns_one_complete_parse(u32 pass_number
,
104 struct acpi_namespace_node
*start_node
);
107 * nsaccess - Top-level namespace access
109 acpi_status
acpi_ns_root_initialize(void);
112 acpi_ns_lookup(union acpi_generic_state
*scope_info
,
114 acpi_object_type type
,
115 acpi_interpreter_mode interpreter_mode
,
117 struct acpi_walk_state
*walk_state
,
118 struct acpi_namespace_node
**ret_node
);
121 * nsalloc - Named object allocation/deallocation
123 struct acpi_namespace_node
*acpi_ns_create_node(u32 name
);
125 void acpi_ns_delete_node(struct acpi_namespace_node
*node
);
127 void acpi_ns_remove_node(struct acpi_namespace_node
*node
);
130 acpi_ns_delete_namespace_subtree(struct acpi_namespace_node
*parent_handle
);
132 void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id
);
134 void acpi_ns_detach_object(struct acpi_namespace_node
*node
);
136 void acpi_ns_delete_children(struct acpi_namespace_node
*parent
);
138 int acpi_ns_compare_names(char *name1
, char *name2
);
141 * nsconvert - Dynamic object conversion routines
144 acpi_ns_convert_to_integer(union acpi_operand_object
*original_object
,
145 union acpi_operand_object
**return_object
);
148 acpi_ns_convert_to_string(union acpi_operand_object
*original_object
,
149 union acpi_operand_object
**return_object
);
152 acpi_ns_convert_to_buffer(union acpi_operand_object
*original_object
,
153 union acpi_operand_object
**return_object
);
156 acpi_ns_convert_to_unicode(struct acpi_namespace_node
*scope
,
157 union acpi_operand_object
*original_object
,
158 union acpi_operand_object
**return_object
);
161 acpi_ns_convert_to_resource(struct acpi_namespace_node
*scope
,
162 union acpi_operand_object
*original_object
,
163 union acpi_operand_object
**return_object
);
166 acpi_ns_convert_to_reference(struct acpi_namespace_node
*scope
,
167 union acpi_operand_object
*original_object
,
168 union acpi_operand_object
**return_object
);
171 * nsdump - Namespace dump/print utilities
173 void acpi_ns_dump_tables(acpi_handle search_base
, u32 max_depth
);
175 void acpi_ns_dump_entry(acpi_handle handle
, u32 debug_level
);
178 acpi_ns_dump_pathname(acpi_handle handle
,
179 const char *msg
, u32 level
, u32 component
);
181 void acpi_ns_print_pathname(u32 num_segments
, const char *pathname
);
184 acpi_ns_dump_one_object(acpi_handle obj_handle
,
185 u32 level
, void *context
, void **return_value
);
188 acpi_ns_dump_objects(acpi_object_type type
,
191 acpi_owner_id owner_id
, acpi_handle start_handle
);
194 acpi_ns_dump_object_paths(acpi_object_type type
,
197 acpi_owner_id owner_id
, acpi_handle start_handle
);
200 * nseval - Namespace evaluation functions
202 acpi_status
acpi_ns_evaluate(struct acpi_evaluate_info
*info
);
204 void acpi_ns_exec_module_code_list(void);
207 * nsarguments - Argument count/type checking for predefined/reserved names
210 acpi_ns_check_argument_count(char *pathname
,
211 struct acpi_namespace_node
*node
,
212 u32 user_param_count
,
213 const union acpi_predefined_info
*info
);
216 acpi_ns_check_acpi_compliance(char *pathname
,
217 struct acpi_namespace_node
*node
,
218 const union acpi_predefined_info
*predefined
);
220 void acpi_ns_check_argument_types(struct acpi_evaluate_info
*info
);
223 * nspredef - Return value checking for predefined/reserved names
226 acpi_ns_check_return_value(struct acpi_namespace_node
*node
,
227 struct acpi_evaluate_info
*info
,
228 u32 user_param_count
,
229 acpi_status return_status
,
230 union acpi_operand_object
**return_object
);
233 acpi_ns_check_object_type(struct acpi_evaluate_info
*info
,
234 union acpi_operand_object
**return_object_ptr
,
235 u32 expected_btypes
, u32 package_index
);
238 * nsprepkg - Validation of predefined name packages
241 acpi_ns_check_package(struct acpi_evaluate_info
*info
,
242 union acpi_operand_object
**return_object_ptr
);
245 * nsnames - Name and Scope manipulation
247 u32
acpi_ns_opens_scope(acpi_object_type type
);
249 char *acpi_ns_get_external_pathname(struct acpi_namespace_node
*node
);
252 acpi_ns_build_normalized_path(struct acpi_namespace_node
*node
,
253 char *full_path
, u32 path_size
, u8 no_trailing
);
255 char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node
*node
,
258 char *acpi_ns_build_prefixed_pathname(union acpi_generic_state
*prefix_scope
,
259 const char *internal_path
);
261 char *acpi_ns_name_of_current_scope(struct acpi_walk_state
*walk_state
);
264 acpi_ns_handle_to_name(acpi_handle target_handle
, struct acpi_buffer
*buffer
);
267 acpi_ns_handle_to_pathname(acpi_handle target_handle
,
268 struct acpi_buffer
*buffer
, u8 no_trailing
);
271 acpi_ns_pattern_match(struct acpi_namespace_node
*obj_node
, char *search_for
);
274 acpi_ns_get_node_unlocked(struct acpi_namespace_node
*prefix_node
,
275 const char *external_pathname
,
276 u32 flags
, struct acpi_namespace_node
**out_node
);
279 acpi_ns_get_node(struct acpi_namespace_node
*prefix_node
,
280 const char *external_pathname
,
281 u32 flags
, struct acpi_namespace_node
**out_node
);
283 acpi_size
acpi_ns_get_pathname_length(struct acpi_namespace_node
*node
);
286 * nsobject - Object management for namespace nodes
289 acpi_ns_attach_object(struct acpi_namespace_node
*node
,
290 union acpi_operand_object
*object
, acpi_object_type type
);
292 union acpi_operand_object
*acpi_ns_get_attached_object(struct
296 union acpi_operand_object
*acpi_ns_get_secondary_object(union
301 acpi_ns_attach_data(struct acpi_namespace_node
*node
,
302 acpi_object_handler handler
, void *data
);
305 acpi_ns_detach_data(struct acpi_namespace_node
*node
,
306 acpi_object_handler handler
);
309 acpi_ns_get_attached_data(struct acpi_namespace_node
*node
,
310 acpi_object_handler handler
, void **data
);
313 * nsrepair - General return object repair for all
314 * predefined methods/objects
317 acpi_ns_simple_repair(struct acpi_evaluate_info
*info
,
320 union acpi_operand_object
**return_object_ptr
);
323 acpi_ns_wrap_with_package(struct acpi_evaluate_info
*info
,
324 union acpi_operand_object
*original_object
,
325 union acpi_operand_object
**obj_desc_ptr
);
328 acpi_ns_repair_null_element(struct acpi_evaluate_info
*info
,
331 union acpi_operand_object
**return_object_ptr
);
334 acpi_ns_remove_null_elements(struct acpi_evaluate_info
*info
,
336 union acpi_operand_object
*obj_desc
);
339 * nsrepair2 - Return object repair for specific
340 * predefined methods/objects
343 acpi_ns_complex_repairs(struct acpi_evaluate_info
*info
,
344 struct acpi_namespace_node
*node
,
345 acpi_status validate_status
,
346 union acpi_operand_object
**return_object_ptr
);
349 * nssearch - Namespace searching and entry
352 acpi_ns_search_and_enter(u32 entry_name
,
353 struct acpi_walk_state
*walk_state
,
354 struct acpi_namespace_node
*node
,
355 acpi_interpreter_mode interpreter_mode
,
356 acpi_object_type type
,
357 u32 flags
, struct acpi_namespace_node
**ret_node
);
360 acpi_ns_search_one_scope(u32 entry_name
,
361 struct acpi_namespace_node
*node
,
362 acpi_object_type type
,
363 struct acpi_namespace_node
**ret_node
);
366 acpi_ns_install_node(struct acpi_walk_state
*walk_state
,
367 struct acpi_namespace_node
*parent_node
,
368 struct acpi_namespace_node
*node
, acpi_object_type type
);
371 * nsutils - Utility functions
373 acpi_object_type
acpi_ns_get_type(struct acpi_namespace_node
*node
);
375 u32
acpi_ns_local(acpi_object_type type
);
378 acpi_ns_print_node_pathname(struct acpi_namespace_node
*node
, const char *msg
);
380 acpi_status
acpi_ns_build_internal_name(struct acpi_namestring_info
*info
);
382 void acpi_ns_get_internal_name_length(struct acpi_namestring_info
*info
);
385 acpi_ns_internalize_name(const char *dotted_name
, char **converted_name
);
388 acpi_ns_externalize_name(u32 internal_name_length
,
389 const char *internal_name
,
390 u32
* converted_name_length
, char **converted_name
);
392 struct acpi_namespace_node
*acpi_ns_validate_handle(acpi_handle handle
);
394 void acpi_ns_terminate(void);
396 #endif /* __ACNAMESP_H__ */