acnamesp.h 9.1 KB

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