acnamesp.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. /******************************************************************************
  2. *
  3. * Name: acnamesp.h - Namespace subcomponent prototypes and defines
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2008, 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. /*
  67. * nsinit - Namespace initialization
  68. */
  69. acpi_status acpi_ns_initialize_objects(void);
  70. acpi_status acpi_ns_initialize_devices(void);
  71. /*
  72. * nsload - Namespace loading
  73. */
  74. acpi_status acpi_ns_load_namespace(void);
  75. acpi_status
  76. acpi_ns_load_table(acpi_native_uint table_index,
  77. struct acpi_namespace_node *node);
  78. /*
  79. * nswalk - walk the namespace
  80. */
  81. acpi_status
  82. acpi_ns_walk_namespace(acpi_object_type type,
  83. acpi_handle start_object,
  84. u32 max_depth,
  85. u32 flags,
  86. acpi_walk_callback user_function,
  87. void *context, void **return_value);
  88. struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node
  89. *parent, struct acpi_namespace_node
  90. *child);
  91. /*
  92. * nsparse - table parsing
  93. */
  94. acpi_status
  95. acpi_ns_parse_table(acpi_native_uint table_index,
  96. struct acpi_namespace_node *start_node);
  97. acpi_status
  98. acpi_ns_one_complete_parse(acpi_native_uint pass_number,
  99. acpi_native_uint table_index,
  100. struct acpi_namespace_node *start_node);
  101. /*
  102. * nsaccess - Top-level namespace access
  103. */
  104. acpi_status acpi_ns_root_initialize(void);
  105. acpi_status
  106. acpi_ns_lookup(union acpi_generic_state *scope_info,
  107. char *name,
  108. acpi_object_type type,
  109. acpi_interpreter_mode interpreter_mode,
  110. u32 flags,
  111. struct acpi_walk_state *walk_state,
  112. struct acpi_namespace_node **ret_node);
  113. /*
  114. * nsalloc - Named object allocation/deallocation
  115. */
  116. struct acpi_namespace_node *acpi_ns_create_node(u32 name);
  117. void acpi_ns_delete_node(struct acpi_namespace_node *node);
  118. void
  119. acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
  120. void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
  121. void acpi_ns_detach_object(struct acpi_namespace_node *node);
  122. void acpi_ns_delete_children(struct acpi_namespace_node *parent);
  123. int acpi_ns_compare_names(char *name1, char *name2);
  124. /*
  125. * nsdump - Namespace dump/print utilities
  126. */
  127. #ifdef ACPI_FUTURE_USAGE
  128. void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
  129. #endif /* ACPI_FUTURE_USAGE */
  130. void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
  131. void
  132. acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
  133. void acpi_ns_print_pathname(u32 num_segments, char *pathname);
  134. acpi_status
  135. acpi_ns_dump_one_object(acpi_handle obj_handle,
  136. u32 level, void *context, void **return_value);
  137. #ifdef ACPI_FUTURE_USAGE
  138. void
  139. acpi_ns_dump_objects(acpi_object_type type,
  140. u8 display_type,
  141. u32 max_depth,
  142. acpi_owner_id owner_id, acpi_handle start_handle);
  143. #endif /* ACPI_FUTURE_USAGE */
  144. /*
  145. * nseval - Namespace evaluation functions
  146. */
  147. acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
  148. /*
  149. * nsnames - Name and Scope manipulation
  150. */
  151. u32 acpi_ns_opens_scope(acpi_object_type type);
  152. void
  153. acpi_ns_build_external_path(struct acpi_namespace_node *node,
  154. acpi_size size, char *name_buffer);
  155. char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
  156. char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
  157. acpi_status
  158. acpi_ns_handle_to_pathname(acpi_handle target_handle,
  159. struct acpi_buffer *buffer);
  160. u8
  161. acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
  162. acpi_status
  163. acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
  164. char *external_pathname,
  165. u32 flags, struct acpi_namespace_node **out_node);
  166. acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
  167. /*
  168. * nsobject - Object management for namespace nodes
  169. */
  170. acpi_status
  171. acpi_ns_attach_object(struct acpi_namespace_node *node,
  172. union acpi_operand_object *object, acpi_object_type type);
  173. union acpi_operand_object *acpi_ns_get_attached_object(struct
  174. acpi_namespace_node
  175. *node);
  176. union acpi_operand_object *acpi_ns_get_secondary_object(union
  177. acpi_operand_object
  178. *obj_desc);
  179. acpi_status
  180. acpi_ns_attach_data(struct acpi_namespace_node *node,
  181. acpi_object_handler handler, void *data);
  182. acpi_status
  183. acpi_ns_detach_data(struct acpi_namespace_node *node,
  184. acpi_object_handler handler);
  185. acpi_status
  186. acpi_ns_get_attached_data(struct acpi_namespace_node *node,
  187. acpi_object_handler handler, void **data);
  188. /*
  189. * nssearch - Namespace searching and entry
  190. */
  191. acpi_status
  192. acpi_ns_search_and_enter(u32 entry_name,
  193. struct acpi_walk_state *walk_state,
  194. struct acpi_namespace_node *node,
  195. acpi_interpreter_mode interpreter_mode,
  196. acpi_object_type type,
  197. u32 flags, struct acpi_namespace_node **ret_node);
  198. acpi_status
  199. acpi_ns_search_one_scope(u32 entry_name,
  200. struct acpi_namespace_node *node,
  201. acpi_object_type type,
  202. struct acpi_namespace_node **ret_node);
  203. void
  204. acpi_ns_install_node(struct acpi_walk_state *walk_state,
  205. struct acpi_namespace_node *parent_node,
  206. struct acpi_namespace_node *node, acpi_object_type type);
  207. /*
  208. * nsutils - Utility functions
  209. */
  210. u8 acpi_ns_valid_root_prefix(char prefix);
  211. acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
  212. u32 acpi_ns_local(acpi_object_type type);
  213. void
  214. acpi_ns_report_error(char *module_name,
  215. u32 line_number,
  216. char *internal_name, acpi_status lookup_status);
  217. void
  218. acpi_ns_report_method_error(char *module_name,
  219. u32 line_number,
  220. char *message,
  221. struct acpi_namespace_node *node,
  222. char *path, acpi_status lookup_status);
  223. void acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *msg);
  224. acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
  225. void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
  226. acpi_status acpi_ns_internalize_name(char *dotted_name, char **converted_name);
  227. acpi_status
  228. acpi_ns_externalize_name(u32 internal_name_length,
  229. char *internal_name,
  230. u32 * converted_name_length, char **converted_name);
  231. struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle);
  232. acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
  233. void acpi_ns_terminate(void);
  234. struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
  235. *node);
  236. struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
  237. acpi_namespace_node
  238. *node);
  239. #endif /* __ACNAMESP_H__ */