acpixf.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  1. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
  2. /******************************************************************************
  3. *
  4. * Name: acpixf.h - External interfaces to the ACPI subsystem
  5. *
  6. * Copyright (C) 2000 - 2018, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. #ifndef __ACXFACE_H__
  10. #define __ACXFACE_H__
  11. /* Current ACPICA subsystem version in YYYYMMDD format */
  12. #define ACPI_CA_VERSION 0x20181003
  13. #include <acpi/acconfig.h>
  14. #include <acpi/actypes.h>
  15. #include <acpi/actbl.h>
  16. #include <acpi/acbuffer.h>
  17. /*****************************************************************************
  18. *
  19. * Macros used for ACPICA globals and configuration
  20. *
  21. ****************************************************************************/
  22. /*
  23. * Ensure that global variables are defined and initialized only once.
  24. *
  25. * The use of these macros allows for a single list of globals (here)
  26. * in order to simplify maintenance of the code.
  27. */
  28. #ifdef DEFINE_ACPI_GLOBALS
  29. #define ACPI_GLOBAL(type,name) \
  30. extern type name; \
  31. type name
  32. #define ACPI_INIT_GLOBAL(type,name,value) \
  33. type name=value
  34. #else
  35. #ifndef ACPI_GLOBAL
  36. #define ACPI_GLOBAL(type,name) \
  37. extern type name
  38. #endif
  39. #ifndef ACPI_INIT_GLOBAL
  40. #define ACPI_INIT_GLOBAL(type,name,value) \
  41. extern type name
  42. #endif
  43. #endif
  44. /*
  45. * These macros configure the various ACPICA interfaces. They are
  46. * useful for generating stub inline functions for features that are
  47. * configured out of the current kernel or ACPICA application.
  48. */
  49. #ifndef ACPI_EXTERNAL_RETURN_STATUS
  50. #define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
  51. prototype;
  52. #endif
  53. #ifndef ACPI_EXTERNAL_RETURN_OK
  54. #define ACPI_EXTERNAL_RETURN_OK(prototype) \
  55. prototype;
  56. #endif
  57. #ifndef ACPI_EXTERNAL_RETURN_VOID
  58. #define ACPI_EXTERNAL_RETURN_VOID(prototype) \
  59. prototype;
  60. #endif
  61. #ifndef ACPI_EXTERNAL_RETURN_UINT32
  62. #define ACPI_EXTERNAL_RETURN_UINT32(prototype) \
  63. prototype;
  64. #endif
  65. #ifndef ACPI_EXTERNAL_RETURN_PTR
  66. #define ACPI_EXTERNAL_RETURN_PTR(prototype) \
  67. prototype;
  68. #endif
  69. /*****************************************************************************
  70. *
  71. * Public globals and runtime configuration options
  72. *
  73. ****************************************************************************/
  74. /*
  75. * Enable "slack mode" of the AML interpreter? Default is FALSE, and the
  76. * interpreter strictly follows the ACPI specification. Setting to TRUE
  77. * allows the interpreter to ignore certain errors and/or bad AML constructs.
  78. *
  79. * Currently, these features are enabled by this flag:
  80. *
  81. * 1) Allow "implicit return" of last value in a control method
  82. * 2) Allow access beyond the end of an operation region
  83. * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
  84. * 4) Allow ANY object type to be a source operand for the Store() operator
  85. * 5) Allow unresolved references (invalid target name) in package objects
  86. * 6) Enable warning messages for behavior that is not ACPI spec compliant
  87. */
  88. ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE);
  89. /*
  90. * Automatically serialize all methods that create named objects? Default
  91. * is TRUE, meaning that all non_serialized methods are scanned once at
  92. * table load time to determine those that create named objects. Methods
  93. * that create named objects are marked Serialized in order to prevent
  94. * possible run-time problems if they are entered by more than one thread.
  95. */
  96. ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE);
  97. /*
  98. * Create the predefined _OSI method in the namespace? Default is TRUE
  99. * because ACPICA is fully compatible with other ACPI implementations.
  100. * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior.
  101. */
  102. ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);
  103. /*
  104. * Optionally use default values for the ACPI register widths. Set this to
  105. * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
  106. */
  107. ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE);
  108. /*
  109. * Whether or not to validate (map) an entire table to verify
  110. * checksum/duplication in early stage before install. Set this to TRUE to
  111. * allow early table validation before install it to the table manager.
  112. * Note that enabling this option causes errors to happen in some OSPMs
  113. * during early initialization stages. Default behavior is to allow such
  114. * validation.
  115. */
  116. ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_table_validation, TRUE);
  117. /*
  118. * Optionally enable output from the AML Debug Object.
  119. */
  120. ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE);
  121. /*
  122. * Optionally copy the entire DSDT to local memory (instead of simply
  123. * mapping it.) There are some BIOSs that corrupt or replace the original
  124. * DSDT, creating the need for this option. Default is FALSE, do not copy
  125. * the DSDT.
  126. */
  127. ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE);
  128. /*
  129. * Optionally ignore an XSDT if present and use the RSDT instead.
  130. * Although the ACPI specification requires that an XSDT be used instead
  131. * of the RSDT, the XSDT has been found to be corrupt or ill-formed on
  132. * some machines. Default behavior is to use the XSDT if present.
  133. */
  134. ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
  135. /*
  136. * Optionally support module level code by parsing an entire table as
  137. * a method as it is loaded. Default is TRUE.
  138. * NOTE, this is essentially obsolete and will be removed soon
  139. * (01/2018).
  140. */
  141. ACPI_INIT_GLOBAL(u8, acpi_gbl_execute_tables_as_methods, TRUE);
  142. /*
  143. * Optionally use 32-bit FADT addresses if and when there is a conflict
  144. * (address mismatch) between the 32-bit and 64-bit versions of the
  145. * address. Although ACPICA adheres to the ACPI specification which
  146. * requires the use of the corresponding 64-bit address if it is non-zero,
  147. * some machines have been found to have a corrupted non-zero 64-bit
  148. * address. Default is FALSE, do not favor the 32-bit addresses.
  149. */
  150. ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE);
  151. /*
  152. * Optionally use 32-bit FACS table addresses.
  153. * It is reported that some platforms fail to resume from system suspending
  154. * if 64-bit FACS table address is selected:
  155. * https://bugzilla.kernel.org/show_bug.cgi?id=74021
  156. * Default is TRUE, favor the 32-bit addresses.
  157. */
  158. ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_facs_addresses, TRUE);
  159. /*
  160. * Optionally truncate I/O addresses to 16 bits. Provides compatibility
  161. * with other ACPI implementations. NOTE: During ACPICA initialization,
  162. * this value is set to TRUE if any Windows OSI strings have been
  163. * requested by the BIOS.
  164. */
  165. ACPI_INIT_GLOBAL(u8, acpi_gbl_truncate_io_addresses, FALSE);
  166. /*
  167. * Disable runtime checking and repair of values returned by control methods.
  168. * Use only if the repair is causing a problem on a particular machine.
  169. */
  170. ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE);
  171. /*
  172. * Optionally do not install any SSDTs from the RSDT/XSDT during initialization.
  173. * This can be useful for debugging ACPI problems on some machines.
  174. */
  175. ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE);
  176. /*
  177. * Optionally enable runtime namespace override.
  178. */
  179. ACPI_INIT_GLOBAL(u8, acpi_gbl_runtime_namespace_override, TRUE);
  180. /*
  181. * We keep track of the latest version of Windows that has been requested by
  182. * the BIOS. ACPI 5.0.
  183. */
  184. ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0);
  185. /*
  186. * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning
  187. * that the ACPI hardware is no longer required. A flag in the FADT indicates
  188. * a reduced HW machine, and that flag is duplicated here for convenience.
  189. */
  190. ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);
  191. /*
  192. * Maximum timeout for While() loop iterations before forced method abort.
  193. * This mechanism is intended to prevent infinite loops during interpreter
  194. * execution within a host kernel.
  195. */
  196. ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_TIMEOUT);
  197. /*
  198. * Optionally ignore AE_NOT_FOUND errors from named reference package elements
  199. * during DSDT/SSDT table loading. This reduces error "noise" in platforms
  200. * whose firmware is carrying around a bunch of unused package objects that
  201. * refer to non-existent named objects. However, If the AML actually tries to
  202. * use such a package, the unresolved element(s) will be replaced with NULL
  203. * elements.
  204. */
  205. ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_package_resolution_errors, FALSE);
  206. /*
  207. * This mechanism is used to trace a specified AML method. The method is
  208. * traced each time it is executed.
  209. */
  210. ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0);
  211. ACPI_INIT_GLOBAL(const char *, acpi_gbl_trace_method_name, NULL);
  212. ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_dbg_level, ACPI_TRACE_LEVEL_DEFAULT);
  213. ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_dbg_layer, ACPI_TRACE_LAYER_DEFAULT);
  214. /*
  215. * Runtime configuration of debug output control masks. We want the debug
  216. * switches statically initialized so they are already set when the debugger
  217. * is entered.
  218. */
  219. ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT);
  220. ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0);
  221. /* Optionally enable timer output with Debug Object output */
  222. ACPI_INIT_GLOBAL(u8, acpi_gbl_display_debug_timer, FALSE);
  223. /*
  224. * Debugger command handshake globals. Host OSes need to access these
  225. * variables to implement their own command handshake mechanism.
  226. */
  227. #ifdef ACPI_DEBUGGER
  228. ACPI_INIT_GLOBAL(u8, acpi_gbl_method_executing, FALSE);
  229. ACPI_GLOBAL(char, acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]);
  230. #endif
  231. /*
  232. * Other miscellaneous globals
  233. */
  234. ACPI_GLOBAL(struct acpi_table_fadt, acpi_gbl_FADT);
  235. ACPI_GLOBAL(u32, acpi_current_gpe_count);
  236. ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running);
  237. /*****************************************************************************
  238. *
  239. * ACPICA public interface configuration.
  240. *
  241. * Interfaces that are configured out of the ACPICA build are replaced
  242. * by inlined stubs by default.
  243. *
  244. ****************************************************************************/
  245. /*
  246. * Hardware-reduced prototypes (default: Not hardware reduced).
  247. *
  248. * All ACPICA hardware-related interfaces that use these macros will be
  249. * configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
  250. * is set to TRUE.
  251. *
  252. * Note: This static build option for reduced hardware is intended to
  253. * reduce ACPICA code size if desired or necessary. However, even if this
  254. * option is not specified, the runtime behavior of ACPICA is dependent
  255. * on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set,
  256. * the flag will enable similar behavior -- ACPICA will not attempt
  257. * to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.)
  258. */
  259. #if (!ACPI_REDUCED_HARDWARE)
  260. #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
  261. ACPI_EXTERNAL_RETURN_STATUS(prototype)
  262. #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
  263. ACPI_EXTERNAL_RETURN_OK(prototype)
  264. #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
  265. ACPI_EXTERNAL_RETURN_VOID(prototype)
  266. #else
  267. #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
  268. static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
  269. #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
  270. static ACPI_INLINE prototype {return(AE_OK);}
  271. #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
  272. static ACPI_INLINE prototype {return;}
  273. #endif /* !ACPI_REDUCED_HARDWARE */
  274. /*
  275. * Error message prototypes (default: error messages enabled).
  276. *
  277. * All interfaces related to error and warning messages
  278. * will be configured out of the ACPICA build if the
  279. * ACPI_NO_ERROR_MESSAGE flag is defined.
  280. */
  281. #ifndef ACPI_NO_ERROR_MESSAGES
  282. #define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \
  283. prototype;
  284. #else
  285. #define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \
  286. static ACPI_INLINE prototype {return;}
  287. #endif /* ACPI_NO_ERROR_MESSAGES */
  288. /*
  289. * Debugging output prototypes (default: no debug output).
  290. *
  291. * All interfaces related to debug output messages
  292. * will be configured out of the ACPICA build unless the
  293. * ACPI_DEBUG_OUTPUT flag is defined.
  294. */
  295. #ifdef ACPI_DEBUG_OUTPUT
  296. #define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \
  297. prototype;
  298. #else
  299. #define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \
  300. static ACPI_INLINE prototype {return;}
  301. #endif /* ACPI_DEBUG_OUTPUT */
  302. /*
  303. * Application prototypes
  304. *
  305. * All interfaces used by application will be configured
  306. * out of the ACPICA build unless the ACPI_APPLICATION
  307. * flag is defined.
  308. */
  309. #ifdef ACPI_APPLICATION
  310. #define ACPI_APP_DEPENDENT_RETURN_VOID(prototype) \
  311. prototype;
  312. #else
  313. #define ACPI_APP_DEPENDENT_RETURN_VOID(prototype) \
  314. static ACPI_INLINE prototype {return;}
  315. #endif /* ACPI_APPLICATION */
  316. /*
  317. * Debugger prototypes
  318. *
  319. * All interfaces used by debugger will be configured
  320. * out of the ACPICA build unless the ACPI_DEBUGGER
  321. * flag is defined.
  322. */
  323. #ifdef ACPI_DEBUGGER
  324. #define ACPI_DBR_DEPENDENT_RETURN_OK(prototype) \
  325. ACPI_EXTERNAL_RETURN_OK(prototype)
  326. #define ACPI_DBR_DEPENDENT_RETURN_VOID(prototype) \
  327. ACPI_EXTERNAL_RETURN_VOID(prototype)
  328. #else
  329. #define ACPI_DBR_DEPENDENT_RETURN_OK(prototype) \
  330. static ACPI_INLINE prototype {return(AE_OK);}
  331. #define ACPI_DBR_DEPENDENT_RETURN_VOID(prototype) \
  332. static ACPI_INLINE prototype {return;}
  333. #endif /* ACPI_DEBUGGER */
  334. /*****************************************************************************
  335. *
  336. * ACPICA public interface prototypes
  337. *
  338. ****************************************************************************/
  339. /*
  340. * Initialization
  341. */
  342. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  343. acpi_initialize_tables(struct acpi_table_desc
  344. *initial_storage,
  345. u32 initial_table_count,
  346. u8 allow_resize))
  347. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  348. acpi_initialize_subsystem(void))
  349. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  350. acpi_enable_subsystem(u32 flags))
  351. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  352. acpi_initialize_objects(u32 flags))
  353. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  354. acpi_terminate(void))
  355. /*
  356. * Miscellaneous global interfaces
  357. */
  358. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
  359. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
  360. ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void))
  361. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  362. acpi_get_system_info(struct acpi_buffer
  363. *ret_buffer))
  364. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  365. acpi_get_statistics(struct acpi_statistics *stats))
  366. ACPI_EXTERNAL_RETURN_PTR(const char
  367. *acpi_format_exception(acpi_status exception))
  368. ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void))
  369. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  370. acpi_install_interface(acpi_string interface_name))
  371. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  372. acpi_remove_interface(acpi_string interface_name))
  373. ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_update_interfaces(u8 action))
  374. ACPI_EXTERNAL_RETURN_UINT32(u32
  375. acpi_check_address_range(acpi_adr_space_type
  376. space_id,
  377. acpi_physical_address
  378. address, acpi_size length,
  379. u8 warn))
  380. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  381. acpi_decode_pld_buffer(u8 *in_buffer,
  382. acpi_size length,
  383. struct acpi_pld_info
  384. **return_buffer))
  385. /*
  386. * ACPI table load/unload interfaces
  387. */
  388. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  389. acpi_install_table(acpi_physical_address address,
  390. u8 physical))
  391. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  392. acpi_load_table(struct acpi_table_header *table))
  393. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  394. acpi_unload_parent_table(acpi_handle object))
  395. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  396. acpi_load_tables(void))
  397. /*
  398. * ACPI table manipulation interfaces
  399. */
  400. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  401. acpi_reallocate_root_table(void))
  402. ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
  403. acpi_find_root_pointer(acpi_physical_address
  404. *rsdp_address))
  405. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  406. acpi_get_table_header(acpi_string signature,
  407. u32 instance,
  408. struct acpi_table_header
  409. *out_table_header))
  410. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  411. acpi_get_table(acpi_string signature, u32 instance,
  412. struct acpi_table_header
  413. **out_table))
  414. ACPI_EXTERNAL_RETURN_VOID(void acpi_put_table(struct acpi_table_header *table))
  415. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  416. acpi_get_table_by_index(u32 table_index,
  417. struct acpi_table_header
  418. **out_table))
  419. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  420. acpi_install_table_handler(acpi_table_handler
  421. handler, void *context))
  422. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  423. acpi_remove_table_handler(acpi_table_handler
  424. handler))
  425. /*
  426. * Namespace and name interfaces
  427. */
  428. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  429. acpi_walk_namespace(acpi_object_type type,
  430. acpi_handle start_object,
  431. u32 max_depth,
  432. acpi_walk_callback
  433. descending_callback,
  434. acpi_walk_callback
  435. ascending_callback,
  436. void *context,
  437. void **return_value))
  438. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  439. acpi_get_devices(const char *HID,
  440. acpi_walk_callback user_function,
  441. void *context,
  442. void **return_value))
  443. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  444. acpi_get_name(acpi_handle object, u32 name_type,
  445. struct acpi_buffer *ret_path_ptr))
  446. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  447. acpi_get_handle(acpi_handle parent,
  448. acpi_string pathname,
  449. acpi_handle *ret_handle))
  450. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  451. acpi_attach_data(acpi_handle object,
  452. acpi_object_handler handler,
  453. void *data))
  454. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  455. acpi_detach_data(acpi_handle object,
  456. acpi_object_handler handler))
  457. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  458. acpi_get_data(acpi_handle object,
  459. acpi_object_handler handler,
  460. void **data))
  461. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  462. acpi_debug_trace(const char *name, u32 debug_level,
  463. u32 debug_layer, u32 flags))
  464. /*
  465. * Object manipulation and enumeration
  466. */
  467. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  468. acpi_evaluate_object(acpi_handle object,
  469. acpi_string pathname,
  470. struct acpi_object_list
  471. *parameter_objects,
  472. struct acpi_buffer
  473. *return_object_buffer))
  474. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  475. acpi_evaluate_object_typed(acpi_handle object,
  476. acpi_string pathname,
  477. struct acpi_object_list
  478. *external_params,
  479. struct acpi_buffer
  480. *return_buffer,
  481. acpi_object_type
  482. return_type))
  483. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  484. acpi_get_object_info(acpi_handle object,
  485. struct acpi_device_info
  486. **return_buffer))
  487. ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_install_method(u8 *buffer))
  488. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  489. acpi_get_next_object(acpi_object_type type,
  490. acpi_handle parent,
  491. acpi_handle child,
  492. acpi_handle *out_handle))
  493. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  494. acpi_get_type(acpi_handle object,
  495. acpi_object_type *out_type))
  496. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  497. acpi_get_parent(acpi_handle object,
  498. acpi_handle *out_handle))
  499. /*
  500. * Handler interfaces
  501. */
  502. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  503. acpi_install_initialization_handler
  504. (acpi_init_handler handler, u32 function))
  505. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  506. acpi_install_sci_handler(acpi_sci_handler
  507. address,
  508. void *context))
  509. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  510. acpi_remove_sci_handler(acpi_sci_handler
  511. address))
  512. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  513. acpi_install_global_event_handler
  514. (acpi_gbl_event_handler handler,
  515. void *context))
  516. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  517. acpi_install_fixed_event_handler(u32
  518. acpi_event,
  519. acpi_event_handler
  520. handler,
  521. void
  522. *context))
  523. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  524. acpi_remove_fixed_event_handler(u32 acpi_event,
  525. acpi_event_handler
  526. handler))
  527. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  528. acpi_install_gpe_handler(acpi_handle
  529. gpe_device,
  530. u32 gpe_number,
  531. u32 type,
  532. acpi_gpe_handler
  533. address,
  534. void *context))
  535. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  536. acpi_install_gpe_raw_handler(acpi_handle
  537. gpe_device,
  538. u32 gpe_number,
  539. u32 type,
  540. acpi_gpe_handler
  541. address,
  542. void *context))
  543. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  544. acpi_remove_gpe_handler(acpi_handle gpe_device,
  545. u32 gpe_number,
  546. acpi_gpe_handler
  547. address))
  548. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  549. acpi_install_notify_handler(acpi_handle device,
  550. u32 handler_type,
  551. acpi_notify_handler
  552. handler,
  553. void *context))
  554. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  555. acpi_remove_notify_handler(acpi_handle device,
  556. u32 handler_type,
  557. acpi_notify_handler
  558. handler))
  559. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  560. acpi_install_address_space_handler(acpi_handle
  561. device,
  562. acpi_adr_space_type
  563. space_id,
  564. acpi_adr_space_handler
  565. handler,
  566. acpi_adr_space_setup
  567. setup,
  568. void *context))
  569. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  570. acpi_remove_address_space_handler(acpi_handle
  571. device,
  572. acpi_adr_space_type
  573. space_id,
  574. acpi_adr_space_handler
  575. handler))
  576. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  577. acpi_install_exception_handler
  578. (acpi_exception_handler handler))
  579. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  580. acpi_install_interface_handler
  581. (acpi_interface_handler handler))
  582. /*
  583. * Global Lock interfaces
  584. */
  585. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  586. acpi_acquire_global_lock(u16 timeout,
  587. u32 *handle))
  588. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  589. acpi_release_global_lock(u32 handle))
  590. /*
  591. * Interfaces to AML mutex objects
  592. */
  593. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  594. acpi_acquire_mutex(acpi_handle handle,
  595. acpi_string pathname,
  596. u16 timeout))
  597. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  598. acpi_release_mutex(acpi_handle handle,
  599. acpi_string pathname))
  600. /*
  601. * Fixed Event interfaces
  602. */
  603. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  604. acpi_enable_event(u32 event, u32 flags))
  605. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  606. acpi_disable_event(u32 event, u32 flags))
  607. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_clear_event(u32 event))
  608. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  609. acpi_get_event_status(u32 event,
  610. acpi_event_status
  611. *event_status))
  612. /*
  613. * General Purpose Event (GPE) Interfaces
  614. */
  615. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_update_all_gpes(void))
  616. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  617. acpi_enable_gpe(acpi_handle gpe_device,
  618. u32 gpe_number))
  619. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  620. acpi_disable_gpe(acpi_handle gpe_device,
  621. u32 gpe_number))
  622. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  623. acpi_clear_gpe(acpi_handle gpe_device,
  624. u32 gpe_number))
  625. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  626. acpi_set_gpe(acpi_handle gpe_device,
  627. u32 gpe_number, u8 action))
  628. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  629. acpi_finish_gpe(acpi_handle gpe_device,
  630. u32 gpe_number))
  631. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  632. acpi_mask_gpe(acpi_handle gpe_device,
  633. u32 gpe_number, u8 is_masked))
  634. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  635. acpi_mark_gpe_for_wake(acpi_handle gpe_device,
  636. u32 gpe_number))
  637. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  638. acpi_setup_gpe_for_wake(acpi_handle
  639. parent_device,
  640. acpi_handle gpe_device,
  641. u32 gpe_number))
  642. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  643. acpi_set_gpe_wake_mask(acpi_handle gpe_device,
  644. u32 gpe_number,
  645. u8 action))
  646. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  647. acpi_get_gpe_status(acpi_handle gpe_device,
  648. u32 gpe_number,
  649. acpi_event_status
  650. *event_status))
  651. ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number))
  652. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void))
  653. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void))
  654. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void))
  655. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  656. acpi_get_gpe_device(u32 gpe_index,
  657. acpi_handle *gpe_device))
  658. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  659. acpi_install_gpe_block(acpi_handle gpe_device,
  660. struct
  661. acpi_generic_address
  662. *gpe_block_address,
  663. u32 register_count,
  664. u32 interrupt_number))
  665. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  666. acpi_remove_gpe_block(acpi_handle gpe_device))
  667. /*
  668. * Resource interfaces
  669. */
  670. typedef
  671. acpi_status (*acpi_walk_resource_callback) (struct acpi_resource * resource,
  672. void *context);
  673. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  674. acpi_get_vendor_resource(acpi_handle device,
  675. char *name,
  676. struct acpi_vendor_uuid
  677. *uuid,
  678. struct acpi_buffer
  679. *ret_buffer))
  680. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  681. acpi_get_current_resources(acpi_handle device,
  682. struct acpi_buffer
  683. *ret_buffer))
  684. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  685. acpi_get_possible_resources(acpi_handle device,
  686. struct acpi_buffer
  687. *ret_buffer))
  688. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  689. acpi_get_event_resources(acpi_handle device_handle,
  690. struct acpi_buffer
  691. *ret_buffer))
  692. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  693. acpi_walk_resource_buffer(struct acpi_buffer
  694. *buffer,
  695. acpi_walk_resource_callback
  696. user_function,
  697. void *context))
  698. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  699. acpi_walk_resources(acpi_handle device, char *name,
  700. acpi_walk_resource_callback
  701. user_function, void *context))
  702. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  703. acpi_set_current_resources(acpi_handle device,
  704. struct acpi_buffer
  705. *in_buffer))
  706. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  707. acpi_get_irq_routing_table(acpi_handle device,
  708. struct acpi_buffer
  709. *ret_buffer))
  710. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  711. acpi_resource_to_address64(struct acpi_resource
  712. *resource,
  713. struct
  714. acpi_resource_address64
  715. *out))
  716. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  717. acpi_buffer_to_resource(u8 *aml_buffer,
  718. u16 aml_buffer_length,
  719. struct acpi_resource
  720. **resource_ptr))
  721. /*
  722. * Hardware (ACPI device) interfaces
  723. */
  724. ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_reset(void))
  725. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  726. acpi_read(u64 *value,
  727. struct acpi_generic_address *reg))
  728. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  729. acpi_write(u64 value,
  730. struct acpi_generic_address *reg))
  731. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  732. acpi_read_bit_register(u32 register_id,
  733. u32 *return_value))
  734. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  735. acpi_write_bit_register(u32 register_id,
  736. u32 value))
  737. /*
  738. * Sleep/Wake interfaces
  739. */
  740. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  741. acpi_get_sleep_type_data(u8 sleep_state,
  742. u8 *slp_typ_a,
  743. u8 *slp_typ_b))
  744. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  745. acpi_enter_sleep_state_prep(u8 sleep_state))
  746. ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_enter_sleep_state(u8 sleep_state))
  747. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void))
  748. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  749. acpi_leave_sleep_state_prep(u8 sleep_state))
  750. ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state))
  751. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  752. acpi_set_firmware_waking_vector
  753. (acpi_physical_address physical_address,
  754. acpi_physical_address physical_address64))
  755. /*
  756. * ACPI Timer interfaces
  757. */
  758. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  759. acpi_get_timer_resolution(u32 *resolution))
  760. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_get_timer(u32 *ticks))
  761. ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  762. acpi_get_timer_duration(u32 start_ticks,
  763. u32 end_ticks,
  764. u32 *time_elapsed))
  765. /*
  766. * Error/Warning output
  767. */
  768. ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
  769. void ACPI_INTERNAL_VAR_XFACE
  770. acpi_error(const char *module_name,
  771. u32 line_number,
  772. const char *format, ...))
  773. ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4)
  774. void ACPI_INTERNAL_VAR_XFACE
  775. acpi_exception(const char *module_name,
  776. u32 line_number,
  777. acpi_status status,
  778. const char *format, ...))
  779. ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
  780. void ACPI_INTERNAL_VAR_XFACE
  781. acpi_warning(const char *module_name,
  782. u32 line_number,
  783. const char *format, ...))
  784. ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
  785. void ACPI_INTERNAL_VAR_XFACE
  786. acpi_info(const char *format, ...))
  787. ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
  788. void ACPI_INTERNAL_VAR_XFACE
  789. acpi_bios_error(const char *module_name,
  790. u32 line_number,
  791. const char *format, ...))
  792. ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
  793. void ACPI_INTERNAL_VAR_XFACE
  794. acpi_bios_warning(const char *module_name,
  795. u32 line_number,
  796. const char *format, ...))
  797. /*
  798. * Debug output
  799. */
  800. ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
  801. void ACPI_INTERNAL_VAR_XFACE
  802. acpi_debug_print(u32 requested_debug_level,
  803. u32 line_number,
  804. const char *function_name,
  805. const char *module_name,
  806. u32 component_id,
  807. const char *format, ...))
  808. ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
  809. void ACPI_INTERNAL_VAR_XFACE
  810. acpi_debug_print_raw(u32 requested_debug_level,
  811. u32 line_number,
  812. const char *function_name,
  813. const char *module_name,
  814. u32 component_id,
  815. const char *format, ...))
  816. ACPI_DBG_DEPENDENT_RETURN_VOID(void
  817. acpi_trace_point(acpi_trace_event_type type,
  818. u8 begin,
  819. u8 *aml, char *pathname))
  820. acpi_status acpi_initialize_debugger(void);
  821. void acpi_terminate_debugger(void);
  822. /*
  823. * Divergences
  824. */
  825. ACPI_EXTERNAL_RETURN_STATUS(acpi_status
  826. acpi_get_data_full(acpi_handle object,
  827. acpi_object_handler handler,
  828. void **data,
  829. void (*callback)(void *)))
  830. void acpi_run_debugger(char *batch_buffer);
  831. void acpi_set_debugger_thread_id(acpi_thread_id thread_id);
  832. #endif /* __ACXFACE_H__ */