acnamesp.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. /******************************************************************************
  2. *
  3. * Name: acnamesp.h - Namespace subcomponent prototypes and defines
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2011, 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. /* Flags for acpi_ns_walk_namespace */
  63. #define ACPI_NS_WALK_NO_UNLOCK 0
  64. #define ACPI_NS_WALK_UNLOCK 0x01
  65. #define ACPI_NS_WALK_TEMP_NODES 0x02
  66. /* Object is not a package element */
  67. #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX
  68. /* Always emit warning message, not dependent on node flags */
  69. #define ACPI_WARN_ALWAYS 0
  70. /*
  71. * nsinit - Namespace initialization
  72. */
  73. acpi_status acpi_ns_initialize_objects(void);
  74. acpi_status acpi_ns_initialize_devices(void);
  75. /*
  76. * nsload - Namespace loading
  77. */
  78. acpi_status acpi_ns_load_namespace(void);
  79. acpi_status
  80. acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node);
  81. /*
  82. * nswalk - walk the namespace
  83. */
  84. acpi_status
  85. acpi_ns_walk_namespace(acpi_object_type type,
  86. acpi_handle start_object,
  87. u32 max_depth,
  88. u32 flags,
  89. acpi_walk_callback pre_order_visit,
  90. acpi_walk_callback post_order_visit,
  91. void *context, void **return_value);
  92. struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
  93. *parent,
  94. struct acpi_namespace_node
  95. *child);
  96. struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
  97. struct
  98. acpi_namespace_node
  99. *parent,
  100. struct
  101. acpi_namespace_node
  102. *child);
  103. /*
  104. * nsparse - table parsing
  105. */
  106. acpi_status
  107. acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);
  108. acpi_status
  109. acpi_ns_one_complete_parse(u32 pass_number,
  110. u32 table_index,
  111. struct acpi_namespace_node *start_node);
  112. /*
  113. * nsaccess - Top-level namespace access
  114. */
  115. acpi_status acpi_ns_root_initialize(void);
  116. acpi_status
  117. acpi_ns_lookup(union acpi_generic_state *scope_info,
  118. char *name,
  119. acpi_object_type type,
  120. acpi_interpreter_mode interpreter_mode,
  121. u32 flags,
  122. struct acpi_walk_state *walk_state,
  123. struct acpi_namespace_node **ret_node);
  124. /*
  125. * nsalloc - Named object allocation/deallocation
  126. */
  127. struct acpi_namespace_node *acpi_ns_create_node(u32 name);
  128. void acpi_ns_delete_node(struct acpi_namespace_node *node);
  129. void acpi_ns_remove_node(struct acpi_namespace_node *node);
  130. void
  131. acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
  132. void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
  133. void acpi_ns_detach_object(struct acpi_namespace_node *node);
  134. void acpi_ns_delete_children(struct acpi_namespace_node *parent);
  135. int acpi_ns_compare_names(char *name1, char *name2);
  136. /*
  137. * nsdump - Namespace dump/print utilities
  138. */
  139. #ifdef ACPI_FUTURE_USAGE
  140. void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
  141. #endif /* ACPI_FUTURE_USAGE */
  142. void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
  143. void
  144. acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
  145. void acpi_ns_print_pathname(u32 num_segments, char *pathname);
  146. acpi_status
  147. acpi_ns_dump_one_object(acpi_handle obj_handle,
  148. u32 level, void *context, void **return_value);
  149. #ifdef ACPI_FUTURE_USAGE
  150. void
  151. acpi_ns_dump_objects(acpi_object_type type,
  152. u8 display_type,
  153. u32 max_depth,
  154. acpi_owner_id owner_id, acpi_handle start_handle);
  155. #endif /* ACPI_FUTURE_USAGE */
  156. /*
  157. * nseval - Namespace evaluation functions
  158. */
  159. acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
  160. void acpi_ns_exec_module_code_list(void);
  161. /*
  162. * nspredef - Support for predefined/reserved names
  163. */
  164. acpi_status
  165. acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
  166. u32 user_param_count,
  167. acpi_status return_status,
  168. union acpi_operand_object **return_object);
  169. const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
  170. acpi_namespace_node
  171. *node);
  172. void
  173. acpi_ns_check_parameter_count(char *pathname,
  174. struct acpi_namespace_node *node,
  175. u32 user_param_count,
  176. const union acpi_predefined_info *info);
  177. /*
  178. * nsnames - Name and Scope manipulation
  179. */
  180. u32 acpi_ns_opens_scope(acpi_object_type type);
  181. acpi_status
  182. acpi_ns_build_external_path(struct acpi_namespace_node *node,
  183. acpi_size size, char *name_buffer);
  184. char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
  185. char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
  186. acpi_status
  187. acpi_ns_handle_to_pathname(acpi_handle target_handle,
  188. struct acpi_buffer *buffer);
  189. u8
  190. acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
  191. acpi_status
  192. acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
  193. const char *external_pathname,
  194. u32 flags, struct acpi_namespace_node **out_node);
  195. acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
  196. /*
  197. * nsobject - Object management for namespace nodes
  198. */
  199. acpi_status
  200. acpi_ns_attach_object(struct acpi_namespace_node *node,
  201. union acpi_operand_object *object, acpi_object_type type);
  202. union acpi_operand_object *acpi_ns_get_attached_object(struct
  203. acpi_namespace_node
  204. *node);
  205. union acpi_operand_object *acpi_ns_get_secondary_object(union
  206. acpi_operand_object
  207. *obj_desc);
  208. acpi_status
  209. acpi_ns_attach_data(struct acpi_namespace_node *node,
  210. acpi_object_handler handler, void *data);
  211. acpi_status
  212. acpi_ns_detach_data(struct acpi_namespace_node *node,
  213. acpi_object_handler handler);
  214. acpi_status
  215. acpi_ns_get_attached_data(struct acpi_namespace_node *node,
  216. acpi_object_handler handler, void **data);
  217. /*
  218. * nsrepair - General return object repair for all
  219. * predefined methods/objects
  220. */
  221. acpi_status
  222. acpi_ns_repair_object(struct acpi_predefined_data *data,
  223. u32 expected_btypes,
  224. u32 package_index,
  225. union acpi_operand_object **return_object_ptr);
  226. acpi_status
  227. acpi_ns_repair_package_list(struct acpi_predefined_data *data,
  228. union acpi_operand_object **obj_desc_ptr);
  229. acpi_status
  230. acpi_ns_repair_null_element(struct acpi_predefined_data *data,
  231. u32 expected_btypes,
  232. u32 package_index,
  233. union acpi_operand_object **return_object_ptr);
  234. void
  235. acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
  236. u8 package_type,
  237. union acpi_operand_object *obj_desc);
  238. /*
  239. * nsrepair2 - Return object repair for specific
  240. * predefined methods/objects
  241. */
  242. acpi_status
  243. acpi_ns_complex_repairs(struct acpi_predefined_data *data,
  244. struct acpi_namespace_node *node,
  245. acpi_status validate_status,
  246. union acpi_operand_object **return_object_ptr);
  247. /*
  248. * nssearch - Namespace searching and entry
  249. */
  250. acpi_status
  251. acpi_ns_search_and_enter(u32 entry_name,
  252. struct acpi_walk_state *walk_state,
  253. struct acpi_namespace_node *node,
  254. acpi_interpreter_mode interpreter_mode,
  255. acpi_object_type type,
  256. u32 flags, struct acpi_namespace_node **ret_node);
  257. acpi_status
  258. acpi_ns_search_one_scope(u32 entry_name,
  259. struct acpi_namespace_node *node,
  260. acpi_object_type type,
  261. struct acpi_namespace_node **ret_node);
  262. void
  263. acpi_ns_install_node(struct acpi_walk_state *walk_state,
  264. struct acpi_namespace_node *parent_node,
  265. struct acpi_namespace_node *node, acpi_object_type type);
  266. /*
  267. * nsutils - Utility functions
  268. */
  269. u8 acpi_ns_valid_root_prefix(char prefix);
  270. acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
  271. u32 acpi_ns_local(acpi_object_type type);
  272. void
  273. acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg);
  274. acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
  275. void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
  276. acpi_status
  277. acpi_ns_internalize_name(const char *dotted_name, char **converted_name);
  278. acpi_status
  279. acpi_ns_externalize_name(u32 internal_name_length,
  280. const char *internal_name,
  281. u32 * converted_name_length, char **converted_name);
  282. struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
  283. void acpi_ns_terminate(void);
  284. #endif /* __ACNAMESP_H__ */