acpixf.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. /******************************************************************************
  2. *
  3. * Name: acpixf.h - External interfaces to the ACPI subsystem
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2010, 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 __ACXFACE_H__
  43. #define __ACXFACE_H__
  44. /* Current ACPICA subsystem version in YYYYMMDD format */
  45. #define ACPI_CA_VERSION 0x20100702
  46. #include "actypes.h"
  47. #include "actbl.h"
  48. extern u8 acpi_gbl_permanent_mmap;
  49. /*
  50. * Globals that are publically available, allowing for
  51. * run time configuration
  52. */
  53. extern u32 acpi_dbg_level;
  54. extern u32 acpi_dbg_layer;
  55. extern u8 acpi_gbl_enable_interpreter_slack;
  56. extern u8 acpi_gbl_all_methods_serialized;
  57. extern u8 acpi_gbl_create_osi_method;
  58. extern u8 acpi_gbl_use_default_register_widths;
  59. extern acpi_name acpi_gbl_trace_method_name;
  60. extern u32 acpi_gbl_trace_flags;
  61. extern u32 acpi_gbl_enable_aml_debug_object;
  62. extern u8 acpi_gbl_copy_dsdt_locally;
  63. extern u8 acpi_gbl_truncate_io_addresses;
  64. extern u32 acpi_current_gpe_count;
  65. extern struct acpi_table_fadt acpi_gbl_FADT;
  66. extern u32 acpi_rsdt_forced;
  67. /*
  68. * Global interfaces
  69. */
  70. acpi_status
  71. acpi_initialize_tables(struct acpi_table_desc *initial_storage,
  72. u32 initial_table_count, u8 allow_resize);
  73. acpi_status __init acpi_initialize_subsystem(void);
  74. acpi_status acpi_enable_subsystem(u32 flags);
  75. acpi_status acpi_initialize_objects(u32 flags);
  76. acpi_status acpi_terminate(void);
  77. #ifdef ACPI_FUTURE_USAGE
  78. acpi_status acpi_subsystem_status(void);
  79. #endif
  80. acpi_status acpi_enable(void);
  81. acpi_status acpi_disable(void);
  82. #ifdef ACPI_FUTURE_USAGE
  83. acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
  84. #endif
  85. const char *acpi_format_exception(acpi_status exception);
  86. acpi_status acpi_purge_cached_objects(void);
  87. /*
  88. * ACPI Memory management
  89. */
  90. void *acpi_allocate(u32 size);
  91. void *acpi_callocate(u32 size);
  92. void acpi_free(void *address);
  93. /*
  94. * ACPI table manipulation interfaces
  95. */
  96. acpi_status acpi_reallocate_root_table(void);
  97. acpi_status acpi_find_root_pointer(acpi_size *rsdp_address);
  98. acpi_status acpi_load_tables(void);
  99. acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
  100. acpi_status acpi_unload_table_id(acpi_owner_id id);
  101. acpi_status
  102. acpi_get_table_header(acpi_string signature,
  103. u32 instance,
  104. struct acpi_table_header *out_table_header);
  105. acpi_status
  106. acpi_get_table_with_size(acpi_string signature,
  107. u32 instance, struct acpi_table_header **out_table,
  108. acpi_size *tbl_size);
  109. acpi_status
  110. acpi_get_table(acpi_string signature,
  111. u32 instance, struct acpi_table_header **out_table);
  112. acpi_status
  113. acpi_get_table_by_index(u32 table_index,
  114. struct acpi_table_header **out_table);
  115. acpi_status
  116. acpi_install_table_handler(acpi_tbl_handler handler, void *context);
  117. acpi_status acpi_remove_table_handler(acpi_tbl_handler handler);
  118. /*
  119. * Namespace and name interfaces
  120. */
  121. acpi_status
  122. acpi_walk_namespace(acpi_object_type type,
  123. acpi_handle start_object,
  124. u32 max_depth,
  125. acpi_walk_callback pre_order_visit,
  126. acpi_walk_callback post_order_visit,
  127. void *context, void **return_value);
  128. acpi_status
  129. acpi_get_devices(const char *HID,
  130. acpi_walk_callback user_function,
  131. void *context, void **return_value);
  132. acpi_status
  133. acpi_get_name(acpi_handle object,
  134. u32 name_type, struct acpi_buffer *ret_path_ptr);
  135. acpi_status
  136. acpi_get_handle(acpi_handle parent,
  137. acpi_string pathname, acpi_handle * ret_handle);
  138. acpi_status
  139. acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data);
  140. acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler);
  141. acpi_status
  142. acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data);
  143. acpi_status
  144. acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags);
  145. /*
  146. * Object manipulation and enumeration
  147. */
  148. acpi_status
  149. acpi_evaluate_object(acpi_handle object,
  150. acpi_string pathname,
  151. struct acpi_object_list *parameter_objects,
  152. struct acpi_buffer *return_object_buffer);
  153. acpi_status
  154. acpi_evaluate_object_typed(acpi_handle object,
  155. acpi_string pathname,
  156. struct acpi_object_list *external_params,
  157. struct acpi_buffer *return_buffer,
  158. acpi_object_type return_type);
  159. acpi_status
  160. acpi_get_object_info(acpi_handle object,
  161. struct acpi_device_info **return_buffer);
  162. acpi_status acpi_install_method(u8 *buffer);
  163. acpi_status
  164. acpi_get_next_object(acpi_object_type type,
  165. acpi_handle parent,
  166. acpi_handle child, acpi_handle * out_handle);
  167. acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type);
  168. acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
  169. acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle);
  170. /*
  171. * Handler interfaces
  172. */
  173. acpi_status
  174. acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
  175. acpi_status
  176. acpi_install_fixed_event_handler(u32 acpi_event,
  177. acpi_event_handler handler, void *context);
  178. acpi_status
  179. acpi_remove_fixed_event_handler(u32 acpi_event, acpi_event_handler handler);
  180. acpi_status
  181. acpi_install_notify_handler(acpi_handle device,
  182. u32 handler_type,
  183. acpi_notify_handler handler, void *context);
  184. acpi_status
  185. acpi_remove_notify_handler(acpi_handle device,
  186. u32 handler_type, acpi_notify_handler handler);
  187. acpi_status
  188. acpi_install_address_space_handler(acpi_handle device,
  189. acpi_adr_space_type space_id,
  190. acpi_adr_space_handler handler,
  191. acpi_adr_space_setup setup, void *context);
  192. acpi_status
  193. acpi_remove_address_space_handler(acpi_handle device,
  194. acpi_adr_space_type space_id,
  195. acpi_adr_space_handler handler);
  196. acpi_status
  197. acpi_install_gpe_handler(acpi_handle gpe_device,
  198. u32 gpe_number,
  199. u32 type, acpi_event_handler address, void *context);
  200. acpi_status
  201. acpi_remove_gpe_handler(acpi_handle gpe_device,
  202. u32 gpe_number, acpi_event_handler address);
  203. #ifdef ACPI_FUTURE_USAGE
  204. acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
  205. #endif
  206. /*
  207. * Event interfaces
  208. */
  209. acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle);
  210. acpi_status acpi_release_global_lock(u32 handle);
  211. acpi_status acpi_enable_event(u32 event, u32 flags);
  212. acpi_status acpi_disable_event(u32 event, u32 flags);
  213. acpi_status acpi_clear_event(u32 event);
  214. acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
  215. /*
  216. * GPE Interfaces
  217. */
  218. acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number);
  219. acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number);
  220. acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number);
  221. acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number);
  222. acpi_status acpi_gpe_wakeup(acpi_handle gpe_device, u32 gpe_number, u8 action);
  223. acpi_status
  224. acpi_get_gpe_status(acpi_handle gpe_device,
  225. u32 gpe_number, acpi_event_status *event_status);
  226. acpi_status acpi_disable_all_gpes(void);
  227. acpi_status acpi_enable_all_runtime_gpes(void);
  228. acpi_status acpi_get_gpe_device(u32 gpe_index, acpi_handle *gpe_device);
  229. acpi_status
  230. acpi_install_gpe_block(acpi_handle gpe_device,
  231. struct acpi_generic_address *gpe_block_address,
  232. u32 register_count, u32 interrupt_number);
  233. acpi_status acpi_remove_gpe_block(acpi_handle gpe_device);
  234. /*
  235. * Resource interfaces
  236. */
  237. typedef
  238. acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
  239. void *context);
  240. acpi_status
  241. acpi_get_vendor_resource(acpi_handle device,
  242. char *name,
  243. struct acpi_vendor_uuid *uuid,
  244. struct acpi_buffer *ret_buffer);
  245. acpi_status
  246. acpi_get_current_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
  247. #ifdef ACPI_FUTURE_USAGE
  248. acpi_status
  249. acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
  250. #endif
  251. acpi_status
  252. acpi_walk_resources(acpi_handle device,
  253. char *name,
  254. acpi_walk_resource_callback user_function, void *context);
  255. acpi_status
  256. acpi_set_current_resources(acpi_handle device, struct acpi_buffer *in_buffer);
  257. acpi_status
  258. acpi_get_irq_routing_table(acpi_handle device, struct acpi_buffer *ret_buffer);
  259. acpi_status
  260. acpi_resource_to_address64(struct acpi_resource *resource,
  261. struct acpi_resource_address64 *out);
  262. /*
  263. * Hardware (ACPI device) interfaces
  264. */
  265. acpi_status acpi_reset(void);
  266. acpi_status acpi_read_bit_register(u32 register_id, u32 *return_value);
  267. acpi_status acpi_write_bit_register(u32 register_id, u32 value);
  268. acpi_status acpi_set_firmware_waking_vector(u32 physical_address);
  269. #if ACPI_MACHINE_WIDTH == 64
  270. acpi_status acpi_set_firmware_waking_vector64(u64 physical_address);
  271. #endif
  272. acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
  273. acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
  274. acpi_status
  275. acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
  276. acpi_status acpi_enter_sleep_state_prep(u8 sleep_state);
  277. acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state);
  278. acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void);
  279. acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
  280. acpi_status acpi_leave_sleep_state(u8 sleep_state);
  281. /*
  282. * Error/Warning output
  283. */
  284. void ACPI_INTERNAL_VAR_XFACE
  285. acpi_error(const char *module_name,
  286. u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
  287. void ACPI_INTERNAL_VAR_XFACE
  288. acpi_exception(const char *module_name,
  289. u32 line_number,
  290. acpi_status status, const char *format, ...) ACPI_PRINTF_LIKE(4);
  291. void ACPI_INTERNAL_VAR_XFACE
  292. acpi_warning(const char *module_name,
  293. u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
  294. void ACPI_INTERNAL_VAR_XFACE
  295. acpi_info(const char *module_name,
  296. u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
  297. /*
  298. * Debug output
  299. */
  300. #ifdef ACPI_DEBUG_OUTPUT
  301. void ACPI_INTERNAL_VAR_XFACE
  302. acpi_debug_print(u32 requested_debug_level,
  303. u32 line_number,
  304. const char *function_name,
  305. const char *module_name,
  306. u32 component_id, const char *format, ...) ACPI_PRINTF_LIKE(6);
  307. void ACPI_INTERNAL_VAR_XFACE
  308. acpi_debug_print_raw(u32 requested_debug_level,
  309. u32 line_number,
  310. const char *function_name,
  311. const char *module_name,
  312. u32 component_id,
  313. const char *format, ...) ACPI_PRINTF_LIKE(6);
  314. #endif
  315. #endif /* __ACXFACE_H__ */