acnamesp.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. /******************************************************************************
  2. *
  3. * Name: acnamesp.h - Namespace subcomponent prototypes and defines
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2005, 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. /* Definitions of the predefined namespace names */
  54. #define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
  55. #define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
  56. #define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
  57. #define ACPI_NS_ROOT_PATH "\\"
  58. #define ACPI_NS_SYSTEM_BUS "_SB_"
  59. /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
  60. #define ACPI_NS_NO_UPSEARCH 0
  61. #define ACPI_NS_SEARCH_PARENT 0x01
  62. #define ACPI_NS_DONT_OPEN_SCOPE 0x02
  63. #define ACPI_NS_NO_PEER_SEARCH 0x04
  64. #define ACPI_NS_ERROR_IF_FOUND 0x08
  65. #define ACPI_NS_WALK_UNLOCK TRUE
  66. #define ACPI_NS_WALK_NO_UNLOCK FALSE
  67. acpi_status
  68. acpi_ns_load_namespace (
  69. void);
  70. acpi_status
  71. acpi_ns_initialize_objects (
  72. void);
  73. acpi_status
  74. acpi_ns_initialize_devices (
  75. void);
  76. /* Namespace init - nsxfinit */
  77. acpi_status
  78. acpi_ns_init_one_device (
  79. acpi_handle obj_handle,
  80. u32 nesting_level,
  81. void *context,
  82. void **return_value);
  83. acpi_status
  84. acpi_ns_init_one_object (
  85. acpi_handle obj_handle,
  86. u32 level,
  87. void *context,
  88. void **return_value);
  89. acpi_status
  90. acpi_ns_walk_namespace (
  91. acpi_object_type type,
  92. acpi_handle start_object,
  93. u32 max_depth,
  94. u8 unlock_before_callback,
  95. acpi_walk_callback user_function,
  96. void *context,
  97. void **return_value);
  98. struct acpi_namespace_node *
  99. acpi_ns_get_next_node (
  100. acpi_object_type type,
  101. struct acpi_namespace_node *parent,
  102. struct acpi_namespace_node *child);
  103. void
  104. acpi_ns_delete_namespace_by_owner (
  105. u16 table_id);
  106. /* Namespace loading - nsload */
  107. acpi_status
  108. acpi_ns_one_complete_parse (
  109. u32 pass_number,
  110. struct acpi_table_desc *table_desc);
  111. acpi_status
  112. acpi_ns_parse_table (
  113. struct acpi_table_desc *table_desc,
  114. struct acpi_namespace_node *scope);
  115. acpi_status
  116. acpi_ns_load_table (
  117. struct acpi_table_desc *table_desc,
  118. struct acpi_namespace_node *node);
  119. acpi_status
  120. acpi_ns_load_table_by_type (
  121. acpi_table_type table_type);
  122. /*
  123. * Top-level namespace access - nsaccess
  124. */
  125. acpi_status
  126. acpi_ns_root_initialize (
  127. void);
  128. acpi_status
  129. acpi_ns_lookup (
  130. union acpi_generic_state *scope_info,
  131. char *name,
  132. acpi_object_type type,
  133. acpi_interpreter_mode interpreter_mode,
  134. u32 flags,
  135. struct acpi_walk_state *walk_state,
  136. struct acpi_namespace_node **ret_node);
  137. /*
  138. * Named object allocation/deallocation - nsalloc
  139. */
  140. struct acpi_namespace_node *
  141. acpi_ns_create_node (
  142. u32 name);
  143. void
  144. acpi_ns_delete_node (
  145. struct acpi_namespace_node *node);
  146. void
  147. acpi_ns_delete_namespace_subtree (
  148. struct acpi_namespace_node *parent_handle);
  149. void
  150. acpi_ns_detach_object (
  151. struct acpi_namespace_node *node);
  152. void
  153. acpi_ns_delete_children (
  154. struct acpi_namespace_node *parent);
  155. int
  156. acpi_ns_compare_names (
  157. char *name1,
  158. char *name2);
  159. void
  160. acpi_ns_remove_reference (
  161. struct acpi_namespace_node *node);
  162. /*
  163. * Namespace modification - nsmodify
  164. */
  165. #ifdef ACPI_FUTURE_USAGE
  166. acpi_status
  167. acpi_ns_unload_namespace (
  168. acpi_handle handle);
  169. acpi_status
  170. acpi_ns_delete_subtree (
  171. acpi_handle start_handle);
  172. #endif
  173. /*
  174. * Namespace dump/print utilities - nsdump
  175. */
  176. #ifdef ACPI_FUTURE_USAGE
  177. void
  178. acpi_ns_dump_tables (
  179. acpi_handle search_base,
  180. u32 max_depth);
  181. #endif
  182. void
  183. acpi_ns_dump_entry (
  184. acpi_handle handle,
  185. u32 debug_level);
  186. void
  187. acpi_ns_dump_pathname (
  188. acpi_handle handle,
  189. char *msg,
  190. u32 level,
  191. u32 component);
  192. void
  193. acpi_ns_print_pathname (
  194. u32 num_segments,
  195. char *pathname);
  196. #ifdef ACPI_FUTURE_USAGE
  197. acpi_status
  198. acpi_ns_dump_one_device (
  199. acpi_handle obj_handle,
  200. u32 level,
  201. void *context,
  202. void **return_value);
  203. void
  204. acpi_ns_dump_root_devices (
  205. void);
  206. #endif /* ACPI_FUTURE_USAGE */
  207. acpi_status
  208. acpi_ns_dump_one_object (
  209. acpi_handle obj_handle,
  210. u32 level,
  211. void *context,
  212. void **return_value);
  213. #ifdef ACPI_FUTURE_USAGE
  214. void
  215. acpi_ns_dump_objects (
  216. acpi_object_type type,
  217. u8 display_type,
  218. u32 max_depth,
  219. u32 ownder_id,
  220. acpi_handle start_handle);
  221. #endif
  222. /*
  223. * Namespace evaluation functions - nseval
  224. */
  225. acpi_status
  226. acpi_ns_evaluate_by_handle (
  227. struct acpi_parameter_info *info);
  228. acpi_status
  229. acpi_ns_evaluate_by_name (
  230. char *pathname,
  231. struct acpi_parameter_info *info);
  232. acpi_status
  233. acpi_ns_evaluate_relative (
  234. char *pathname,
  235. struct acpi_parameter_info *info);
  236. acpi_status
  237. acpi_ns_execute_control_method (
  238. struct acpi_parameter_info *info);
  239. acpi_status
  240. acpi_ns_get_object_value (
  241. struct acpi_parameter_info *info);
  242. /*
  243. * Parent/Child/Peer utility functions
  244. */
  245. #ifdef ACPI_FUTURE_USAGE
  246. acpi_name
  247. acpi_ns_find_parent_name (
  248. struct acpi_namespace_node *node_to_search);
  249. #endif
  250. /*
  251. * Name and Scope manipulation - nsnames
  252. */
  253. u32
  254. acpi_ns_opens_scope (
  255. acpi_object_type type);
  256. void
  257. acpi_ns_build_external_path (
  258. struct acpi_namespace_node *node,
  259. acpi_size size,
  260. char *name_buffer);
  261. char *
  262. acpi_ns_get_external_pathname (
  263. struct acpi_namespace_node *node);
  264. char *
  265. acpi_ns_name_of_current_scope (
  266. struct acpi_walk_state *walk_state);
  267. acpi_status
  268. acpi_ns_handle_to_pathname (
  269. acpi_handle target_handle,
  270. struct acpi_buffer *buffer);
  271. u8
  272. acpi_ns_pattern_match (
  273. struct acpi_namespace_node *obj_node,
  274. char *search_for);
  275. acpi_status
  276. acpi_ns_get_node_by_path (
  277. char *external_pathname,
  278. struct acpi_namespace_node *in_prefix_node,
  279. u32 flags,
  280. struct acpi_namespace_node **out_node);
  281. acpi_size
  282. acpi_ns_get_pathname_length (
  283. struct acpi_namespace_node *node);
  284. /*
  285. * Object management for namespace nodes - nsobject
  286. */
  287. acpi_status
  288. acpi_ns_attach_object (
  289. struct acpi_namespace_node *node,
  290. union acpi_operand_object *object,
  291. acpi_object_type type);
  292. union acpi_operand_object *
  293. acpi_ns_get_attached_object (
  294. struct acpi_namespace_node *node);
  295. union acpi_operand_object *
  296. acpi_ns_get_secondary_object (
  297. union acpi_operand_object *obj_desc);
  298. acpi_status
  299. acpi_ns_attach_data (
  300. struct acpi_namespace_node *node,
  301. acpi_object_handler handler,
  302. void *data);
  303. acpi_status
  304. acpi_ns_detach_data (
  305. struct acpi_namespace_node *node,
  306. acpi_object_handler handler);
  307. acpi_status
  308. acpi_ns_get_attached_data (
  309. struct acpi_namespace_node *node,
  310. acpi_object_handler handler,
  311. void **data);
  312. /*
  313. * Namespace searching and entry - nssearch
  314. */
  315. acpi_status
  316. acpi_ns_search_and_enter (
  317. u32 entry_name,
  318. struct acpi_walk_state *walk_state,
  319. struct acpi_namespace_node *node,
  320. acpi_interpreter_mode interpreter_mode,
  321. acpi_object_type type,
  322. u32 flags,
  323. struct acpi_namespace_node **ret_node);
  324. acpi_status
  325. acpi_ns_search_node (
  326. u32 entry_name,
  327. struct acpi_namespace_node *node,
  328. acpi_object_type type,
  329. struct acpi_namespace_node **ret_node);
  330. void
  331. acpi_ns_install_node (
  332. struct acpi_walk_state *walk_state,
  333. struct acpi_namespace_node *parent_node,
  334. struct acpi_namespace_node *node,
  335. acpi_object_type type);
  336. /*
  337. * Utility functions - nsutils
  338. */
  339. u8
  340. acpi_ns_valid_root_prefix (
  341. char prefix);
  342. u8
  343. acpi_ns_valid_path_separator (
  344. char sep);
  345. acpi_object_type
  346. acpi_ns_get_type (
  347. struct acpi_namespace_node *node);
  348. u32
  349. acpi_ns_local (
  350. acpi_object_type type);
  351. void
  352. acpi_ns_report_error (
  353. char *module_name,
  354. u32 line_number,
  355. u32 component_id,
  356. char *internal_name,
  357. acpi_status lookup_status);
  358. void
  359. acpi_ns_report_method_error (
  360. char *module_name,
  361. u32 line_number,
  362. u32 component_id,
  363. char *message,
  364. struct acpi_namespace_node *node,
  365. char *path,
  366. acpi_status lookup_status);
  367. void
  368. acpi_ns_print_node_pathname (
  369. struct acpi_namespace_node *node,
  370. char *msg);
  371. acpi_status
  372. acpi_ns_build_internal_name (
  373. struct acpi_namestring_info *info);
  374. void
  375. acpi_ns_get_internal_name_length (
  376. struct acpi_namestring_info *info);
  377. acpi_status
  378. acpi_ns_internalize_name (
  379. char *dotted_name,
  380. char **converted_name);
  381. acpi_status
  382. acpi_ns_externalize_name (
  383. u32 internal_name_length,
  384. char *internal_name,
  385. u32 *converted_name_length,
  386. char **converted_name);
  387. struct acpi_namespace_node *
  388. acpi_ns_map_handle_to_node (
  389. acpi_handle handle);
  390. acpi_handle
  391. acpi_ns_convert_entry_to_handle(
  392. struct acpi_namespace_node *node);
  393. void
  394. acpi_ns_terminate (
  395. void);
  396. struct acpi_namespace_node *
  397. acpi_ns_get_parent_node (
  398. struct acpi_namespace_node *node);
  399. struct acpi_namespace_node *
  400. acpi_ns_get_next_valid_node (
  401. struct acpi_namespace_node *node);
  402. #endif /* __ACNAMESP_H__ */