acutils.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. /******************************************************************************
  2. *
  3. * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2018, 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 _ACUTILS_H
  43. #define _ACUTILS_H
  44. extern const u8 acpi_gbl_resource_aml_sizes[];
  45. extern const u8 acpi_gbl_resource_aml_serial_bus_sizes[];
  46. /* Strings used by the disassembler and debugger resource dump routines */
  47. #if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
  48. extern const char *acpi_gbl_bm_decode[];
  49. extern const char *acpi_gbl_config_decode[];
  50. extern const char *acpi_gbl_consume_decode[];
  51. extern const char *acpi_gbl_dec_decode[];
  52. extern const char *acpi_gbl_he_decode[];
  53. extern const char *acpi_gbl_io_decode[];
  54. extern const char *acpi_gbl_ll_decode[];
  55. extern const char *acpi_gbl_max_decode[];
  56. extern const char *acpi_gbl_mem_decode[];
  57. extern const char *acpi_gbl_min_decode[];
  58. extern const char *acpi_gbl_mtp_decode[];
  59. extern const char *acpi_gbl_rng_decode[];
  60. extern const char *acpi_gbl_rw_decode[];
  61. extern const char *acpi_gbl_shr_decode[];
  62. extern const char *acpi_gbl_siz_decode[];
  63. extern const char *acpi_gbl_trs_decode[];
  64. extern const char *acpi_gbl_ttp_decode[];
  65. extern const char *acpi_gbl_typ_decode[];
  66. extern const char *acpi_gbl_ppc_decode[];
  67. extern const char *acpi_gbl_ior_decode[];
  68. extern const char *acpi_gbl_dts_decode[];
  69. extern const char *acpi_gbl_ct_decode[];
  70. extern const char *acpi_gbl_sbt_decode[];
  71. extern const char *acpi_gbl_am_decode[];
  72. extern const char *acpi_gbl_sm_decode[];
  73. extern const char *acpi_gbl_wm_decode[];
  74. extern const char *acpi_gbl_cph_decode[];
  75. extern const char *acpi_gbl_cpo_decode[];
  76. extern const char *acpi_gbl_dp_decode[];
  77. extern const char *acpi_gbl_ed_decode[];
  78. extern const char *acpi_gbl_bpb_decode[];
  79. extern const char *acpi_gbl_sb_decode[];
  80. extern const char *acpi_gbl_fc_decode[];
  81. extern const char *acpi_gbl_pt_decode[];
  82. extern const char *acpi_gbl_ptyp_decode[];
  83. #endif
  84. /*
  85. * For the iASL compiler case, the output is redirected to stderr so that
  86. * any of the various ACPI errors and warnings do not appear in the output
  87. * files, for either the compiler or disassembler portions of the tool.
  88. */
  89. #ifdef ACPI_ASL_COMPILER
  90. #include <stdio.h>
  91. #define ACPI_MSG_REDIRECT_BEGIN \
  92. FILE *output_file = acpi_gbl_output_file; \
  93. acpi_os_redirect_output (stderr);
  94. #define ACPI_MSG_REDIRECT_END \
  95. acpi_os_redirect_output (output_file);
  96. #else
  97. /*
  98. * non-iASL case - no redirection, nothing to do
  99. */
  100. #define ACPI_MSG_REDIRECT_BEGIN
  101. #define ACPI_MSG_REDIRECT_END
  102. #endif
  103. /*
  104. * Common error message prefixes
  105. */
  106. #ifndef ACPI_MSG_ERROR
  107. #define ACPI_MSG_ERROR "ACPI Error: "
  108. #endif
  109. #ifndef ACPI_MSG_WARNING
  110. #define ACPI_MSG_WARNING "ACPI Warning: "
  111. #endif
  112. #ifndef ACPI_MSG_INFO
  113. #define ACPI_MSG_INFO "ACPI: "
  114. #endif
  115. #ifndef ACPI_MSG_BIOS_ERROR
  116. #define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): "
  117. #endif
  118. #ifndef ACPI_MSG_BIOS_WARNING
  119. #define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): "
  120. #endif
  121. /*
  122. * Common message suffix
  123. */
  124. #define ACPI_MSG_SUFFIX \
  125. acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
  126. /* Flags to indicate implicit or explicit string-to-integer conversion */
  127. #define ACPI_IMPLICIT_CONVERSION TRUE
  128. #define ACPI_NO_IMPLICIT_CONVERSION FALSE
  129. /* Types for Resource descriptor entries */
  130. #define ACPI_INVALID_RESOURCE 0
  131. #define ACPI_FIXED_LENGTH 1
  132. #define ACPI_VARIABLE_LENGTH 2
  133. #define ACPI_SMALL_VARIABLE_LENGTH 3
  134. typedef
  135. acpi_status (*acpi_walk_aml_callback) (u8 *aml,
  136. u32 length,
  137. u32 offset,
  138. u8 resource_index, void **context);
  139. typedef
  140. acpi_status (*acpi_pkg_callback) (u8 object_type,
  141. union acpi_operand_object * source_object,
  142. union acpi_generic_state * state,
  143. void *context);
  144. struct acpi_pkg_info {
  145. u8 *free_space;
  146. acpi_size length;
  147. u32 object_space;
  148. u32 num_packages;
  149. };
  150. /* Object reference counts */
  151. #define REF_INCREMENT (u16) 0
  152. #define REF_DECREMENT (u16) 1
  153. /* acpi_ut_dump_buffer */
  154. #define DB_BYTE_DISPLAY 1
  155. #define DB_WORD_DISPLAY 2
  156. #define DB_DWORD_DISPLAY 4
  157. #define DB_QWORD_DISPLAY 8
  158. /*
  159. * utascii - ASCII utilities
  160. */
  161. u8 acpi_ut_valid_nameseg(char *signature);
  162. u8 acpi_ut_valid_name_char(char character, u32 position);
  163. void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count);
  164. /*
  165. * utnonansi - Non-ANSI C library functions
  166. */
  167. void acpi_ut_strupr(char *src_string);
  168. void acpi_ut_strlwr(char *src_string);
  169. int acpi_ut_stricmp(char *string1, char *string2);
  170. /*
  171. * utstrsuppt - string-to-integer conversion support functions
  172. */
  173. acpi_status acpi_ut_convert_octal_string(char *string, u64 *return_value);
  174. acpi_status acpi_ut_convert_decimal_string(char *string, u64 *return_value_ptr);
  175. acpi_status acpi_ut_convert_hex_string(char *string, u64 *return_value_ptr);
  176. char acpi_ut_remove_whitespace(char **string);
  177. char acpi_ut_remove_leading_zeros(char **string);
  178. u8 acpi_ut_detect_hex_prefix(char **string);
  179. u8 acpi_ut_detect_octal_prefix(char **string);
  180. /*
  181. * utstrtoul64 - string-to-integer conversion functions
  182. */
  183. acpi_status acpi_ut_strtoul64(char *string, u64 *ret_integer);
  184. u64 acpi_ut_explicit_strtoul64(char *string);
  185. u64 acpi_ut_implicit_strtoul64(char *string);
  186. /*
  187. * utglobal - Global data structures and procedures
  188. */
  189. acpi_status acpi_ut_init_globals(void);
  190. const char *acpi_ut_get_mutex_name(u32 mutex_id);
  191. #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
  192. const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type);
  193. #endif
  194. const char *acpi_ut_get_type_name(acpi_object_type type);
  195. const char *acpi_ut_get_node_name(void *object);
  196. const char *acpi_ut_get_descriptor_name(void *object);
  197. const char *acpi_ut_get_reference_name(union acpi_operand_object *object);
  198. const char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc);
  199. const char *acpi_ut_get_region_name(u8 space_id);
  200. const char *acpi_ut_get_event_name(u32 event_id);
  201. const char *acpi_ut_get_argument_type_name(u32 arg_type);
  202. char acpi_ut_hex_to_ascii_char(u64 integer, u32 position);
  203. acpi_status acpi_ut_ascii_to_hex_byte(char *two_ascii_chars, u8 *return_byte);
  204. u8 acpi_ut_ascii_char_to_hex(int hex_char);
  205. u8 acpi_ut_valid_object_type(acpi_object_type type);
  206. /*
  207. * utinit - miscellaneous initialization and shutdown
  208. */
  209. acpi_status acpi_ut_hardware_initialize(void);
  210. void acpi_ut_subsystem_shutdown(void);
  211. /*
  212. * utcopy - Object construction and conversion interfaces
  213. */
  214. acpi_status
  215. acpi_ut_build_simple_object(union acpi_operand_object *obj,
  216. union acpi_object *user_obj,
  217. u8 *data_space, u32 *buffer_space_used);
  218. acpi_status
  219. acpi_ut_build_package_object(union acpi_operand_object *obj,
  220. u8 *buffer, u32 *space_used);
  221. acpi_status
  222. acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
  223. struct acpi_buffer *ret_buffer);
  224. acpi_status
  225. acpi_ut_copy_eobject_to_iobject(union acpi_object *obj,
  226. union acpi_operand_object **internal_obj);
  227. acpi_status
  228. acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj,
  229. union acpi_operand_object *dest_obj);
  230. acpi_status
  231. acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
  232. union acpi_operand_object **dest_desc,
  233. struct acpi_walk_state *walk_state);
  234. /*
  235. * utcreate - Object creation
  236. */
  237. acpi_status
  238. acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action);
  239. /*
  240. * utdebug - Debug interfaces
  241. */
  242. void acpi_ut_init_stack_ptr_trace(void);
  243. void acpi_ut_track_stack_ptr(void);
  244. void
  245. acpi_ut_trace(u32 line_number,
  246. const char *function_name,
  247. const char *module_name, u32 component_id);
  248. void
  249. acpi_ut_trace_ptr(u32 line_number,
  250. const char *function_name,
  251. const char *module_name,
  252. u32 component_id, const void *pointer);
  253. void
  254. acpi_ut_trace_u32(u32 line_number,
  255. const char *function_name,
  256. const char *module_name, u32 component_id, u32 integer);
  257. void
  258. acpi_ut_trace_str(u32 line_number,
  259. const char *function_name,
  260. const char *module_name,
  261. u32 component_id, const char *string);
  262. void
  263. acpi_ut_exit(u32 line_number,
  264. const char *function_name,
  265. const char *module_name, u32 component_id);
  266. void
  267. acpi_ut_status_exit(u32 line_number,
  268. const char *function_name,
  269. const char *module_name,
  270. u32 component_id, acpi_status status);
  271. void
  272. acpi_ut_value_exit(u32 line_number,
  273. const char *function_name,
  274. const char *module_name, u32 component_id, u64 value);
  275. void
  276. acpi_ut_ptr_exit(u32 line_number,
  277. const char *function_name,
  278. const char *module_name, u32 component_id, u8 *ptr);
  279. void
  280. acpi_ut_str_exit(u32 line_number,
  281. const char *function_name,
  282. const char *module_name, u32 component_id, const char *string);
  283. void
  284. acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id);
  285. void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 offset);
  286. #ifdef ACPI_APPLICATION
  287. void
  288. acpi_ut_dump_buffer_to_file(ACPI_FILE file,
  289. u8 *buffer,
  290. u32 count, u32 display, u32 base_offset);
  291. #endif
  292. void acpi_ut_report_error(char *module_name, u32 line_number);
  293. void acpi_ut_report_info(char *module_name, u32 line_number);
  294. void acpi_ut_report_warning(char *module_name, u32 line_number);
  295. /*
  296. * utdelete - Object deletion and reference counts
  297. */
  298. void acpi_ut_add_reference(union acpi_operand_object *object);
  299. void acpi_ut_remove_reference(union acpi_operand_object *object);
  300. void acpi_ut_delete_internal_package_object(union acpi_operand_object *object);
  301. void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object);
  302. void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
  303. /*
  304. * uteval - object evaluation
  305. */
  306. acpi_status
  307. acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
  308. const char *path,
  309. u32 expected_return_btypes,
  310. union acpi_operand_object **return_desc);
  311. acpi_status
  312. acpi_ut_evaluate_numeric_object(const char *object_name,
  313. struct acpi_namespace_node *device_node,
  314. u64 *value);
  315. acpi_status
  316. acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags);
  317. acpi_status
  318. acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
  319. const char **method_names,
  320. u8 method_count, u8 *out_values);
  321. /*
  322. * utids - device ID support
  323. */
  324. acpi_status
  325. acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
  326. struct acpi_pnp_device_id ** return_id);
  327. acpi_status
  328. acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
  329. struct acpi_pnp_device_id ** return_id);
  330. acpi_status
  331. acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
  332. struct acpi_pnp_device_id_list ** return_cid_list);
  333. acpi_status
  334. acpi_ut_execute_CLS(struct acpi_namespace_node *device_node,
  335. struct acpi_pnp_device_id **return_id);
  336. /*
  337. * utlock - reader/writer locks
  338. */
  339. acpi_status acpi_ut_create_rw_lock(struct acpi_rw_lock *lock);
  340. void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock);
  341. acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock);
  342. acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock);
  343. acpi_status acpi_ut_acquire_write_lock(struct acpi_rw_lock *lock);
  344. void acpi_ut_release_write_lock(struct acpi_rw_lock *lock);
  345. /*
  346. * utobject - internal object create/delete/cache routines
  347. */
  348. union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
  349. *module_name,
  350. u32 line_number,
  351. u32 component_id,
  352. acpi_object_type
  353. type);
  354. void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
  355. u32 line_number, u32 component_id);
  356. #define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
  357. #define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
  358. void acpi_ut_delete_object_desc(union acpi_operand_object *object);
  359. u8 acpi_ut_valid_internal_object(void *object);
  360. union acpi_operand_object *acpi_ut_create_package_object(u32 count);
  361. union acpi_operand_object *acpi_ut_create_integer_object(u64 value);
  362. union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
  363. union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
  364. acpi_status
  365. acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size *obj_length);
  366. /*
  367. * utosi - Support for the _OSI predefined control method
  368. */
  369. acpi_status acpi_ut_initialize_interfaces(void);
  370. acpi_status acpi_ut_interface_terminate(void);
  371. acpi_status acpi_ut_install_interface(acpi_string interface_name);
  372. acpi_status acpi_ut_remove_interface(acpi_string interface_name);
  373. acpi_status acpi_ut_update_interfaces(u8 action);
  374. struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name);
  375. acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state);
  376. /*
  377. * utpredef - support for predefined names
  378. */
  379. const union acpi_predefined_info *acpi_ut_get_next_predefined_method(const union
  380. acpi_predefined_info
  381. *this_name);
  382. const union acpi_predefined_info *acpi_ut_match_predefined_method(char *name);
  383. void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes);
  384. #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
  385. const union acpi_predefined_info *acpi_ut_match_resource_name(char *name);
  386. void
  387. acpi_ut_display_predefined_method(char *buffer,
  388. const union acpi_predefined_info *this_name,
  389. u8 multi_line);
  390. u32 acpi_ut_get_resource_bit_width(char *buffer, u16 types);
  391. #endif
  392. /*
  393. * utstate - Generic state creation/cache routines
  394. */
  395. void
  396. acpi_ut_push_generic_state(union acpi_generic_state **list_head,
  397. union acpi_generic_state *state);
  398. union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
  399. **list_head);
  400. union acpi_generic_state *acpi_ut_create_generic_state(void);
  401. struct acpi_thread_state *acpi_ut_create_thread_state(void);
  402. union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
  403. *object, u16 action);
  404. union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
  405. void *external_object,
  406. u32 index);
  407. acpi_status
  408. acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
  409. u16 action,
  410. union acpi_generic_state **state_list);
  411. union acpi_generic_state *acpi_ut_create_control_state(void);
  412. void acpi_ut_delete_generic_state(union acpi_generic_state *state);
  413. /*
  414. * utmath
  415. */
  416. acpi_status
  417. acpi_ut_divide(u64 in_dividend,
  418. u64 in_divisor, u64 *out_quotient, u64 *out_remainder);
  419. acpi_status
  420. acpi_ut_short_divide(u64 in_dividend,
  421. u32 divisor, u64 *out_quotient, u32 *out_remainder);
  422. acpi_status
  423. acpi_ut_short_multiply(u64 in_multiplicand, u32 multiplier, u64 *outproduct);
  424. acpi_status acpi_ut_short_shift_left(u64 operand, u32 count, u64 *out_result);
  425. acpi_status acpi_ut_short_shift_right(u64 operand, u32 count, u64 *out_result);
  426. /*
  427. * utmisc
  428. */
  429. const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status
  430. status);
  431. u8 acpi_ut_is_pci_root_bridge(char *id);
  432. #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
  433. u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
  434. #endif
  435. acpi_status
  436. acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
  437. void *target_object,
  438. acpi_pkg_callback walk_callback, void *context);
  439. /* Values for Base above (16=Hex, 10=Decimal) */
  440. #define ACPI_ANY_BASE 0
  441. u32 acpi_ut_dword_byte_swap(u32 value);
  442. void acpi_ut_set_integer_width(u8 revision);
  443. #ifdef ACPI_DEBUG_OUTPUT
  444. void
  445. acpi_ut_display_init_pathname(u8 type,
  446. struct acpi_namespace_node *obj_handle,
  447. const char *path);
  448. #endif
  449. /*
  450. * utownerid - Support for Table/Method Owner IDs
  451. */
  452. acpi_status acpi_ut_allocate_owner_id(acpi_owner_id *owner_id);
  453. void acpi_ut_release_owner_id(acpi_owner_id *owner_id);
  454. /*
  455. * utresrc
  456. */
  457. acpi_status
  458. acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
  459. u8 *aml,
  460. acpi_size aml_length,
  461. acpi_walk_aml_callback user_function,
  462. void **context);
  463. acpi_status
  464. acpi_ut_validate_resource(struct acpi_walk_state *walk_state,
  465. void *aml, u8 *return_index);
  466. u32 acpi_ut_get_descriptor_length(void *aml);
  467. u16 acpi_ut_get_resource_length(void *aml);
  468. u8 acpi_ut_get_resource_header_length(void *aml);
  469. u8 acpi_ut_get_resource_type(void *aml);
  470. acpi_status
  471. acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag);
  472. /*
  473. * utstring - String and character utilities
  474. */
  475. void acpi_ut_print_string(char *string, u16 max_length);
  476. #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
  477. void ut_convert_backslashes(char *pathname);
  478. #endif
  479. void acpi_ut_repair_name(char *name);
  480. #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
  481. u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source);
  482. void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size);
  483. u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source);
  484. u8
  485. acpi_ut_safe_strncat(char *dest,
  486. acpi_size dest_size,
  487. char *source, acpi_size max_transfer_length);
  488. #endif
  489. /*
  490. * utmutex - mutex support
  491. */
  492. acpi_status acpi_ut_mutex_initialize(void);
  493. void acpi_ut_mutex_terminate(void);
  494. acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id);
  495. acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id);
  496. /*
  497. * utalloc - memory allocation and object caching
  498. */
  499. acpi_status acpi_ut_create_caches(void);
  500. acpi_status acpi_ut_delete_caches(void);
  501. acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer);
  502. acpi_status
  503. acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
  504. acpi_size required_length);
  505. #ifdef ACPI_DBG_TRACK_ALLOCATIONS
  506. void *acpi_ut_allocate_and_track(acpi_size size,
  507. u32 component, const char *module, u32 line);
  508. void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
  509. u32 component,
  510. const char *module, u32 line);
  511. void
  512. acpi_ut_free_and_track(void *address,
  513. u32 component, const char *module, u32 line);
  514. void acpi_ut_dump_allocation_info(void);
  515. void acpi_ut_dump_allocations(u32 component, const char *module);
  516. acpi_status
  517. acpi_ut_create_list(const char *list_name,
  518. u16 object_size, struct acpi_memory_list **return_cache);
  519. #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
  520. /*
  521. * utaddress - address range check
  522. */
  523. acpi_status
  524. acpi_ut_add_address_range(acpi_adr_space_type space_id,
  525. acpi_physical_address address,
  526. u32 length, struct acpi_namespace_node *region_node);
  527. void
  528. acpi_ut_remove_address_range(acpi_adr_space_type space_id,
  529. struct acpi_namespace_node *region_node);
  530. u32
  531. acpi_ut_check_address_range(acpi_adr_space_type space_id,
  532. acpi_physical_address address, u32 length, u8 warn);
  533. void acpi_ut_delete_address_lists(void);
  534. /*
  535. * utxferror - various error/warning output functions
  536. */
  537. void ACPI_INTERNAL_VAR_XFACE
  538. acpi_ut_predefined_warning(const char *module_name,
  539. u32 line_number,
  540. char *pathname,
  541. u8 node_flags, const char *format, ...);
  542. void ACPI_INTERNAL_VAR_XFACE
  543. acpi_ut_predefined_info(const char *module_name,
  544. u32 line_number,
  545. char *pathname, u8 node_flags, const char *format, ...);
  546. void ACPI_INTERNAL_VAR_XFACE
  547. acpi_ut_predefined_bios_error(const char *module_name,
  548. u32 line_number,
  549. char *pathname,
  550. u8 node_flags, const char *format, ...);
  551. void
  552. acpi_ut_prefixed_namespace_error(const char *module_name,
  553. u32 line_number,
  554. union acpi_generic_state *prefix_scope,
  555. const char *internal_name,
  556. acpi_status lookup_status);
  557. void
  558. acpi_ut_method_error(const char *module_name,
  559. u32 line_number,
  560. const char *message,
  561. struct acpi_namespace_node *node,
  562. const char *path, acpi_status lookup_status);
  563. /*
  564. * Utility functions for ACPI names and IDs
  565. */
  566. const struct ah_predefined_name *acpi_ah_match_predefined_name(char *nameseg);
  567. const struct ah_device_id *acpi_ah_match_hardware_id(char *hid);
  568. const char *acpi_ah_match_uuid(u8 *data);
  569. /*
  570. * utuuid -- UUID support functions
  571. */
  572. #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP)
  573. void acpi_ut_convert_string_to_uuid(char *in_string, u8 *uuid_buffer);
  574. #endif
  575. #endif /* _ACUTILS_H */