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