acnamesp.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. /******************************************************************************
  2. *
  3. * Name: acnamesp.h - Namespace subcomponent prototypes and defines
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2015, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #ifndef __ACNAMESP_H__
  43. #define __ACNAMESP_H__
  44. /* To search the entire name space, pass this as search_base */
  45. #define ACPI_NS_ALL ((acpi_handle)0)
  46. /*
  47. * Elements of acpi_ns_properties are bit significant
  48. * and should be one-to-one with values of acpi_object_type
  49. */
  50. #define ACPI_NS_NORMAL 0
  51. #define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
  52. #define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
  53. /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
  54. #define ACPI_NS_NO_UPSEARCH 0
  55. #define ACPI_NS_SEARCH_PARENT 0x01
  56. #define ACPI_NS_DONT_OPEN_SCOPE 0x02
  57. #define ACPI_NS_NO_PEER_SEARCH 0x04
  58. #define ACPI_NS_ERROR_IF_FOUND 0x08
  59. #define ACPI_NS_PREFIX_IS_SCOPE 0x10
  60. #define ACPI_NS_EXTERNAL 0x20
  61. #define ACPI_NS_TEMPORARY 0x40
  62. #define ACPI_NS_OVERRIDE_IF_FOUND 0x80
  63. /* Flags for acpi_ns_walk_namespace */
  64. #define ACPI_NS_WALK_NO_UNLOCK 0
  65. #define ACPI_NS_WALK_UNLOCK 0x01
  66. #define ACPI_NS_WALK_TEMP_NODES 0x02
  67. /* Object is not a package element */
  68. #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX
  69. /* Always emit warning message, not dependent on node flags */
  70. #define ACPI_WARN_ALWAYS 0
  71. /*
  72. * nsinit - Namespace initialization
  73. */
  74. acpi_status acpi_ns_initialize_objects(void);
  75. acpi_status acpi_ns_initialize_devices(void);
  76. /*
  77. * nsload - Namespace loading
  78. */
  79. acpi_status acpi_ns_load_namespace(void);
  80. acpi_status
  81. acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node);
  82. /*
  83. * nswalk - walk the namespace
  84. */
  85. acpi_status
  86. acpi_ns_walk_namespace(acpi_object_type type,
  87. acpi_handle start_object,
  88. u32 max_depth,
  89. u32 flags,
  90. acpi_walk_callback descending_callback,
  91. acpi_walk_callback ascending_callback,
  92. void *context, void **return_value);
  93. struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
  94. *parent,
  95. struct acpi_namespace_node
  96. *child);
  97. struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
  98. struct
  99. acpi_namespace_node
  100. *parent,
  101. struct
  102. acpi_namespace_node
  103. *child);
  104. /*
  105. * nsparse - table parsing
  106. */
  107. acpi_status
  108. acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);
  109. acpi_status
  110. acpi_ns_one_complete_parse(u32 pass_number,
  111. u32 table_index,
  112. struct acpi_namespace_node *start_node);
  113. /*
  114. * nsaccess - Top-level namespace access
  115. */
  116. acpi_status acpi_ns_root_initialize(void);
  117. acpi_status
  118. acpi_ns_lookup(union acpi_generic_state *scope_info,
  119. char *name,
  120. acpi_object_type type,
  121. acpi_interpreter_mode interpreter_mode,
  122. u32 flags,
  123. struct acpi_walk_state *walk_state,
  124. struct acpi_namespace_node **ret_node);
  125. /*
  126. * nsalloc - Named object allocation/deallocation
  127. */
  128. struct acpi_namespace_node *acpi_ns_create_node(u32 name);
  129. void acpi_ns_delete_node(struct acpi_namespace_node *node);
  130. void acpi_ns_remove_node(struct acpi_namespace_node *node);
  131. void
  132. acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
  133. void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
  134. void acpi_ns_detach_object(struct acpi_namespace_node *node);
  135. void acpi_ns_delete_children(struct acpi_namespace_node *parent);
  136. int acpi_ns_compare_names(char *name1, char *name2);
  137. /*
  138. * nsconvert - Dynamic object conversion routines
  139. */
  140. acpi_status
  141. acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
  142. union acpi_operand_object **return_object);
  143. acpi_status
  144. acpi_ns_convert_to_string(union acpi_operand_object *original_object,
  145. union acpi_operand_object **return_object);
  146. acpi_status
  147. acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
  148. union acpi_operand_object **return_object);
  149. acpi_status
  150. acpi_ns_convert_to_unicode(union acpi_operand_object *original_object,
  151. union acpi_operand_object **return_object);
  152. acpi_status
  153. acpi_ns_convert_to_resource(union acpi_operand_object *original_object,
  154. union acpi_operand_object **return_object);
  155. /*
  156. * nsdump - Namespace dump/print utilities
  157. */
  158. void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
  159. void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
  160. void
  161. acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
  162. void acpi_ns_print_pathname(u32 num_segments, char *pathname);
  163. acpi_status
  164. acpi_ns_dump_one_object(acpi_handle obj_handle,
  165. u32 level, void *context, void **return_value);
  166. void
  167. acpi_ns_dump_objects(acpi_object_type type,
  168. u8 display_type,
  169. u32 max_depth,
  170. acpi_owner_id owner_id, acpi_handle start_handle);
  171. void
  172. acpi_ns_dump_object_paths(acpi_object_type type,
  173. u8 display_type,
  174. u32 max_depth,
  175. acpi_owner_id owner_id, acpi_handle start_handle);
  176. /*
  177. * nseval - Namespace evaluation functions
  178. */
  179. acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
  180. void acpi_ns_exec_module_code_list(void);
  181. /*
  182. * nsarguments - Argument count/type checking for predefined/reserved names
  183. */
  184. void
  185. acpi_ns_check_argument_count(char *pathname,
  186. struct acpi_namespace_node *node,
  187. u32 user_param_count,
  188. const union acpi_predefined_info *info);
  189. void
  190. acpi_ns_check_acpi_compliance(char *pathname,
  191. struct acpi_namespace_node *node,
  192. const union acpi_predefined_info *predefined);
  193. void acpi_ns_check_argument_types(struct acpi_evaluate_info *info);
  194. /*
  195. * nspredef - Return value checking for predefined/reserved names
  196. */
  197. acpi_status
  198. acpi_ns_check_return_value(struct acpi_namespace_node *node,
  199. struct acpi_evaluate_info *info,
  200. u32 user_param_count,
  201. acpi_status return_status,
  202. union acpi_operand_object **return_object);
  203. acpi_status
  204. acpi_ns_check_object_type(struct acpi_evaluate_info *info,
  205. union acpi_operand_object **return_object_ptr,
  206. u32 expected_btypes, u32 package_index);
  207. /*
  208. * nsprepkg - Validation of predefined name packages
  209. */
  210. acpi_status
  211. acpi_ns_check_package(struct acpi_evaluate_info *info,
  212. union acpi_operand_object **return_object_ptr);
  213. /*
  214. * nsnames - Name and Scope manipulation
  215. */
  216. u32 acpi_ns_opens_scope(acpi_object_type type);
  217. char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
  218. u32
  219. acpi_ns_build_normalized_path(struct acpi_namespace_node *node,
  220. char *full_path, u32 path_size, u8 no_trailing);
  221. char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
  222. u8 no_trailing);
  223. char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
  224. acpi_status
  225. acpi_ns_handle_to_pathname(acpi_handle target_handle,
  226. struct acpi_buffer *buffer, u8 no_trailing);
  227. u8
  228. acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
  229. acpi_status
  230. acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
  231. const char *external_pathname,
  232. u32 flags, struct acpi_namespace_node **out_node);
  233. acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
  234. /*
  235. * nsobject - Object management for namespace nodes
  236. */
  237. acpi_status
  238. acpi_ns_attach_object(struct acpi_namespace_node *node,
  239. union acpi_operand_object *object, acpi_object_type type);
  240. union acpi_operand_object *acpi_ns_get_attached_object(struct
  241. acpi_namespace_node
  242. *node);
  243. union acpi_operand_object *acpi_ns_get_secondary_object(union
  244. acpi_operand_object
  245. *obj_desc);
  246. acpi_status
  247. acpi_ns_attach_data(struct acpi_namespace_node *node,
  248. acpi_object_handler handler, void *data);
  249. acpi_status
  250. acpi_ns_detach_data(struct acpi_namespace_node *node,
  251. acpi_object_handler handler);
  252. acpi_status
  253. acpi_ns_get_attached_data(struct acpi_namespace_node *node,
  254. acpi_object_handler handler, void **data);
  255. /*
  256. * nsrepair - General return object repair for all
  257. * predefined methods/objects
  258. */
  259. acpi_status
  260. acpi_ns_simple_repair(struct acpi_evaluate_info *info,
  261. u32 expected_btypes,
  262. u32 package_index,
  263. union acpi_operand_object **return_object_ptr);
  264. acpi_status
  265. acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
  266. union acpi_operand_object *original_object,
  267. union acpi_operand_object **obj_desc_ptr);
  268. acpi_status
  269. acpi_ns_repair_null_element(struct acpi_evaluate_info *info,
  270. u32 expected_btypes,
  271. u32 package_index,
  272. union acpi_operand_object **return_object_ptr);
  273. void
  274. acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
  275. u8 package_type,
  276. union acpi_operand_object *obj_desc);
  277. /*
  278. * nsrepair2 - Return object repair for specific
  279. * predefined methods/objects
  280. */
  281. acpi_status
  282. acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
  283. struct acpi_namespace_node *node,
  284. acpi_status validate_status,
  285. union acpi_operand_object **return_object_ptr);
  286. /*
  287. * nssearch - Namespace searching and entry
  288. */
  289. acpi_status
  290. acpi_ns_search_and_enter(u32 entry_name,
  291. struct acpi_walk_state *walk_state,
  292. struct acpi_namespace_node *node,
  293. acpi_interpreter_mode interpreter_mode,
  294. acpi_object_type type,
  295. u32 flags, struct acpi_namespace_node **ret_node);
  296. acpi_status
  297. acpi_ns_search_one_scope(u32 entry_name,
  298. struct acpi_namespace_node *node,
  299. acpi_object_type type,
  300. struct acpi_namespace_node **ret_node);
  301. void
  302. acpi_ns_install_node(struct acpi_walk_state *walk_state,
  303. struct acpi_namespace_node *parent_node,
  304. struct acpi_namespace_node *node, acpi_object_type type);
  305. /*
  306. * nsutils - Utility functions
  307. */
  308. acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
  309. u32 acpi_ns_local(acpi_object_type type);
  310. void
  311. acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg);
  312. acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
  313. void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
  314. acpi_status
  315. acpi_ns_internalize_name(const char *dotted_name, char **converted_name);
  316. acpi_status
  317. acpi_ns_externalize_name(u32 internal_name_length,
  318. const char *internal_name,
  319. u32 * converted_name_length, char **converted_name);
  320. struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
  321. void acpi_ns_terminate(void);
  322. #endif /* __ACNAMESP_H__ */