acpixf.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. /******************************************************************************
  2. *
  3. * Name: acpixf.h - External interfaces to the ACPI subsystem
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2011, 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 0x20120320
  46. #include "acconfig.h"
  47. #include "actypes.h"
  48. #include "actbl.h"
  49. extern u8 acpi_gbl_permanent_mmap;
  50. /*
  51. * Globals that are publicly available, allowing for
  52. * run time configuration
  53. */
  54. extern u32 acpi_dbg_level;
  55. extern u32 acpi_dbg_layer;
  56. extern u8 acpi_gbl_enable_interpreter_slack;
  57. extern u8 acpi_gbl_all_methods_serialized;
  58. extern u8 acpi_gbl_create_osi_method;
  59. extern u8 acpi_gbl_use_default_register_widths;
  60. extern acpi_name acpi_gbl_trace_method_name;
  61. extern u32 acpi_gbl_trace_flags;
  62. extern bool acpi_gbl_enable_aml_debug_object;
  63. extern u8 acpi_gbl_copy_dsdt_locally;
  64. extern u8 acpi_gbl_truncate_io_addresses;
  65. extern u8 acpi_gbl_disable_auto_repair;
  66. /*
  67. * Hardware-reduced prototypes. All interfaces that use these macros will
  68. * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
  69. * is set to TRUE.
  70. */
  71. #if (!ACPI_REDUCED_HARDWARE)
  72. #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
  73. prototype;
  74. #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
  75. prototype;
  76. #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
  77. prototype;
  78. #else
  79. #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
  80. static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
  81. #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
  82. static ACPI_INLINE prototype {return(AE_OK);}
  83. #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
  84. static ACPI_INLINE prototype {}
  85. #endif /* !ACPI_REDUCED_HARDWARE */
  86. extern u32 acpi_current_gpe_count;
  87. extern struct acpi_table_fadt acpi_gbl_FADT;
  88. extern u8 acpi_gbl_system_awake_and_running;
  89. extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */
  90. extern u32 acpi_rsdt_forced;
  91. /*
  92. * Global interfaces
  93. */
  94. acpi_status
  95. acpi_initialize_tables(struct acpi_table_desc *initial_storage,
  96. u32 initial_table_count, u8 allow_resize);
  97. acpi_status __init acpi_initialize_subsystem(void);
  98. acpi_status acpi_enable_subsystem(u32 flags);
  99. acpi_status acpi_initialize_objects(u32 flags);
  100. acpi_status acpi_terminate(void);
  101. #ifdef ACPI_FUTURE_USAGE
  102. acpi_status acpi_subsystem_status(void);
  103. #endif
  104. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
  105. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
  106. #ifdef ACPI_FUTURE_USAGE
  107. acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
  108. #endif
  109. const char *acpi_format_exception(acpi_status exception);
  110. acpi_status acpi_purge_cached_objects(void);
  111. acpi_status acpi_install_interface(acpi_string interface_name);
  112. acpi_status acpi_remove_interface(acpi_string interface_name);
  113. u32
  114. acpi_check_address_range(acpi_adr_space_type space_id,
  115. acpi_physical_address address,
  116. acpi_size length, u8 warn);
  117. /*
  118. * ACPI Memory management
  119. */
  120. void *acpi_allocate(u32 size);
  121. void *acpi_callocate(u32 size);
  122. void acpi_free(void *address);
  123. /*
  124. * ACPI table manipulation interfaces
  125. */
  126. acpi_status acpi_reallocate_root_table(void);
  127. acpi_status acpi_find_root_pointer(acpi_size *rsdp_address);
  128. acpi_status acpi_load_tables(void);
  129. acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
  130. acpi_status acpi_unload_table_id(acpi_owner_id id);
  131. acpi_status
  132. acpi_get_table_header(acpi_string signature,
  133. u32 instance,
  134. struct acpi_table_header *out_table_header);
  135. acpi_status
  136. acpi_get_table_with_size(acpi_string signature,
  137. u32 instance, struct acpi_table_header **out_table,
  138. acpi_size *tbl_size);
  139. acpi_status
  140. acpi_get_table(acpi_string signature,
  141. u32 instance, struct acpi_table_header **out_table);
  142. acpi_status
  143. acpi_get_table_by_index(u32 table_index,
  144. struct acpi_table_header **out_table);
  145. acpi_status
  146. acpi_install_table_handler(acpi_tbl_handler handler, void *context);
  147. acpi_status acpi_remove_table_handler(acpi_tbl_handler handler);
  148. /*
  149. * Namespace and name interfaces
  150. */
  151. acpi_status
  152. acpi_walk_namespace(acpi_object_type type,
  153. acpi_handle start_object,
  154. u32 max_depth,
  155. acpi_walk_callback pre_order_visit,
  156. acpi_walk_callback post_order_visit,
  157. void *context, void **return_value);
  158. acpi_status
  159. acpi_get_devices(const char *HID,
  160. acpi_walk_callback user_function,
  161. void *context, void **return_value);
  162. acpi_status
  163. acpi_get_name(acpi_handle object,
  164. u32 name_type, struct acpi_buffer *ret_path_ptr);
  165. acpi_status
  166. acpi_get_handle(acpi_handle parent,
  167. acpi_string pathname, acpi_handle * ret_handle);
  168. acpi_status
  169. acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data);
  170. acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler);
  171. acpi_status
  172. acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data);
  173. acpi_status
  174. acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags);
  175. /*
  176. * Object manipulation and enumeration
  177. */
  178. acpi_status
  179. acpi_evaluate_object(acpi_handle object,
  180. acpi_string pathname,
  181. struct acpi_object_list *parameter_objects,
  182. struct acpi_buffer *return_object_buffer);
  183. acpi_status
  184. acpi_evaluate_object_typed(acpi_handle object,
  185. acpi_string pathname,
  186. struct acpi_object_list *external_params,
  187. struct acpi_buffer *return_buffer,
  188. acpi_object_type return_type);
  189. acpi_status
  190. acpi_get_object_info(acpi_handle object,
  191. struct acpi_device_info **return_buffer);
  192. acpi_status acpi_install_method(u8 *buffer);
  193. acpi_status
  194. acpi_get_next_object(acpi_object_type type,
  195. acpi_handle parent,
  196. acpi_handle child, acpi_handle * out_handle);
  197. acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type);
  198. acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
  199. acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle);
  200. /*
  201. * Handler interfaces
  202. */
  203. acpi_status
  204. acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
  205. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  206. acpi_install_global_event_handler
  207. (ACPI_GBL_EVENT_HANDLER handler, void *context))
  208. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  209. acpi_install_fixed_event_handler(u32
  210. acpi_event,
  211. acpi_event_handler
  212. handler,
  213. void
  214. *context))
  215. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  216. acpi_remove_fixed_event_handler(u32 acpi_event,
  217. acpi_event_handler
  218. handler))
  219. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  220. acpi_install_gpe_handler(acpi_handle
  221. gpe_device,
  222. u32 gpe_number,
  223. u32 type,
  224. acpi_gpe_handler
  225. address,
  226. void *context))
  227. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  228. acpi_remove_gpe_handler(acpi_handle gpe_device,
  229. u32 gpe_number,
  230. acpi_gpe_handler
  231. address))
  232. acpi_status
  233. acpi_install_notify_handler(acpi_handle device,
  234. u32 handler_type,
  235. acpi_notify_handler handler, void *context);
  236. acpi_status
  237. acpi_remove_notify_handler(acpi_handle device,
  238. u32 handler_type, acpi_notify_handler handler);
  239. acpi_status
  240. acpi_install_address_space_handler(acpi_handle device,
  241. acpi_adr_space_type space_id,
  242. acpi_adr_space_handler handler,
  243. acpi_adr_space_setup setup, void *context);
  244. acpi_status
  245. acpi_remove_address_space_handler(acpi_handle device,
  246. acpi_adr_space_type space_id,
  247. acpi_adr_space_handler handler);
  248. #ifdef ACPI_FUTURE_USAGE
  249. acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
  250. #endif
  251. acpi_status acpi_install_interface_handler(acpi_interface_handler handler);
  252. /*
  253. * Global Lock interfaces
  254. */
  255. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  256. acpi_acquire_global_lock(u16 timeout,
  257. u32 *handle))
  258. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  259. acpi_release_global_lock(u32 handle))
  260. /*
  261. * Interfaces to AML mutex objects
  262. */
  263. acpi_status
  264. acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout);
  265. acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname);
  266. /*
  267. * Fixed Event interfaces
  268. */
  269. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  270. acpi_enable_event(u32 event, u32 flags))
  271. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  272. acpi_disable_event(u32 event, u32 flags))
  273. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_clear_event(u32 event))
  274. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  275. acpi_get_event_status(u32 event,
  276. acpi_event_status
  277. *event_status))
  278. /*
  279. * General Purpose Event (GPE) Interfaces
  280. */
  281. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_update_all_gpes(void))
  282. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  283. acpi_enable_gpe(acpi_handle gpe_device,
  284. u32 gpe_number))
  285. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  286. acpi_disable_gpe(acpi_handle gpe_device,
  287. u32 gpe_number))
  288. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  289. acpi_clear_gpe(acpi_handle gpe_device,
  290. u32 gpe_number))
  291. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  292. acpi_set_gpe(acpi_handle gpe_device,
  293. u32 gpe_number, u8 action))
  294. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  295. acpi_finish_gpe(acpi_handle gpe_device,
  296. u32 gpe_number))
  297. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  298. acpi_setup_gpe_for_wake(acpi_handle
  299. parent_device,
  300. acpi_handle gpe_device,
  301. u32 gpe_number))
  302. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  303. acpi_set_gpe_wake_mask(acpi_handle gpe_device,
  304. u32 gpe_number,
  305. u8 action))
  306. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  307. acpi_get_gpe_status(acpi_handle gpe_device,
  308. u32 gpe_number,
  309. acpi_event_status
  310. *event_status))
  311. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void))
  312. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void))
  313. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  314. acpi_get_gpe_device(u32 gpe_index,
  315. acpi_handle * gpe_device))
  316. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  317. acpi_install_gpe_block(acpi_handle gpe_device,
  318. struct
  319. acpi_generic_address
  320. *gpe_block_address,
  321. u32 register_count,
  322. u32 interrupt_number))
  323. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  324. acpi_remove_gpe_block(acpi_handle gpe_device))
  325. /*
  326. * Resource interfaces
  327. */
  328. typedef
  329. acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
  330. void *context);
  331. acpi_status
  332. acpi_get_vendor_resource(acpi_handle device,
  333. char *name,
  334. struct acpi_vendor_uuid *uuid,
  335. struct acpi_buffer *ret_buffer);
  336. acpi_status
  337. acpi_get_current_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
  338. #ifdef ACPI_FUTURE_USAGE
  339. acpi_status
  340. acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
  341. #endif
  342. acpi_status
  343. acpi_get_event_resources(acpi_handle device_handle,
  344. struct acpi_buffer *ret_buffer);
  345. acpi_status
  346. acpi_walk_resources(acpi_handle device,
  347. char *name,
  348. acpi_walk_resource_callback user_function, void *context);
  349. acpi_status
  350. acpi_set_current_resources(acpi_handle device, struct acpi_buffer *in_buffer);
  351. acpi_status
  352. acpi_get_irq_routing_table(acpi_handle device, struct acpi_buffer *ret_buffer);
  353. acpi_status
  354. acpi_resource_to_address64(struct acpi_resource *resource,
  355. struct acpi_resource_address64 *out);
  356. acpi_status
  357. acpi_buffer_to_resource(u8 *aml_buffer,
  358. u16 aml_buffer_length,
  359. struct acpi_resource **resource_ptr);
  360. /*
  361. * Hardware (ACPI device) interfaces
  362. */
  363. acpi_status acpi_reset(void);
  364. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  365. acpi_read_bit_register(u32 register_id,
  366. u32 *return_value))
  367. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  368. acpi_write_bit_register(u32 register_id,
  369. u32 value))
  370. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  371. acpi_set_firmware_waking_vector(u32
  372. physical_address))
  373. #if ACPI_MACHINE_WIDTH == 64
  374. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  375. acpi_set_firmware_waking_vector64(u64
  376. physical_address))
  377. #endif
  378. acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
  379. acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
  380. /*
  381. * Sleep/Wake interfaces
  382. */
  383. acpi_status
  384. acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
  385. acpi_status acpi_enter_sleep_state_prep(u8 sleep_state);
  386. acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state, u8 flags);
  387. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void))
  388. acpi_status acpi_leave_sleep_state_prep(u8 sleep_state, u8 flags);
  389. acpi_status acpi_leave_sleep_state(u8 sleep_state);
  390. /*
  391. * ACPI Timer interfaces
  392. */
  393. #ifdef ACPI_FUTURE_USAGE
  394. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  395. acpi_get_timer_resolution(u32 *resolution))
  396. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_get_timer(u32 *ticks))
  397. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  398. acpi_get_timer_duration(u32 start_ticks,
  399. u32 end_ticks,
  400. u32 *time_elapsed))
  401. #endif /* ACPI_FUTURE_USAGE */
  402. /*
  403. * Error/Warning output
  404. */
  405. void ACPI_INTERNAL_VAR_XFACE
  406. acpi_error(const char *module_name,
  407. u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
  408. void ACPI_INTERNAL_VAR_XFACE
  409. acpi_exception(const char *module_name,
  410. u32 line_number,
  411. acpi_status status, const char *format, ...) ACPI_PRINTF_LIKE(4);
  412. void ACPI_INTERNAL_VAR_XFACE
  413. acpi_warning(const char *module_name,
  414. u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
  415. void ACPI_INTERNAL_VAR_XFACE
  416. acpi_info(const char *module_name,
  417. u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
  418. /*
  419. * Debug output
  420. */
  421. #ifdef ACPI_DEBUG_OUTPUT
  422. void ACPI_INTERNAL_VAR_XFACE
  423. acpi_debug_print(u32 requested_debug_level,
  424. u32 line_number,
  425. const char *function_name,
  426. const char *module_name,
  427. u32 component_id, const char *format, ...) ACPI_PRINTF_LIKE(6);
  428. void ACPI_INTERNAL_VAR_XFACE
  429. acpi_debug_print_raw(u32 requested_debug_level,
  430. u32 line_number,
  431. const char *function_name,
  432. const char *module_name,
  433. u32 component_id,
  434. const char *format, ...) ACPI_PRINTF_LIKE(6);
  435. #endif
  436. #endif /* __ACXFACE_H__ */