| 1 | #pragma once |
| 2 | |
| 3 | #include <uacpi/types.h> |
| 4 | #include <uacpi/status.h> |
| 5 | |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
| 10 | #ifndef UACPI_BAREBONES_MODE |
| 11 | |
| 12 | typedef enum uacpi_vendor_interface { |
| 13 | UACPI_VENDOR_INTERFACE_NONE = 0, |
| 14 | UACPI_VENDOR_INTERFACE_WINDOWS_2000, |
| 15 | UACPI_VENDOR_INTERFACE_WINDOWS_XP, |
| 16 | UACPI_VENDOR_INTERFACE_WINDOWS_XP_SP1, |
| 17 | UACPI_VENDOR_INTERFACE_WINDOWS_SERVER_2003, |
| 18 | UACPI_VENDOR_INTERFACE_WINDOWS_XP_SP2, |
| 19 | UACPI_VENDOR_INTERFACE_WINDOWS_SERVER_2003_SP1, |
| 20 | UACPI_VENDOR_INTERFACE_WINDOWS_VISTA, |
| 21 | UACPI_VENDOR_INTERFACE_WINDOWS_SERVER_2008, |
| 22 | UACPI_VENDOR_INTERFACE_WINDOWS_VISTA_SP1, |
| 23 | UACPI_VENDOR_INTERFACE_WINDOWS_VISTA_SP2, |
| 24 | UACPI_VENDOR_INTERFACE_WINDOWS_7, |
| 25 | UACPI_VENDOR_INTERFACE_WINDOWS_8, |
| 26 | UACPI_VENDOR_INTERFACE_WINDOWS_8_1, |
| 27 | UACPI_VENDOR_INTERFACE_WINDOWS_10, |
| 28 | UACPI_VENDOR_INTERFACE_WINDOWS_10_RS1, |
| 29 | UACPI_VENDOR_INTERFACE_WINDOWS_10_RS2, |
| 30 | UACPI_VENDOR_INTERFACE_WINDOWS_10_RS3, |
| 31 | UACPI_VENDOR_INTERFACE_WINDOWS_10_RS4, |
| 32 | UACPI_VENDOR_INTERFACE_WINDOWS_10_RS5, |
| 33 | UACPI_VENDOR_INTERFACE_WINDOWS_10_19H1, |
| 34 | UACPI_VENDOR_INTERFACE_WINDOWS_10_20H1, |
| 35 | UACPI_VENDOR_INTERFACE_WINDOWS_11, |
| 36 | UACPI_VENDOR_INTERFACE_WINDOWS_11_22H2, |
| 37 | } uacpi_vendor_interface; |
| 38 | |
| 39 | /** |
| 40 | * Returns the "latest" AML-queried _OSI vendor interface. |
| 41 | * |
| 42 | * E.g. for the following AML code: |
| 43 | * _OSI("Windows 2021") |
| 44 | * _OSI("Windows 2000") |
| 45 | * |
| 46 | * This function will return UACPI_VENDOR_INTERFACE_WINDOWS_11, since this is |
| 47 | * the latest version of the interface the code queried, even though the |
| 48 | * "Windows 2000" query came after "Windows 2021". |
| 49 | */ |
| 50 | uacpi_vendor_interface uacpi_latest_queried_vendor_interface(void); |
| 51 | |
| 52 | typedef enum uacpi_interface_kind { |
| 53 | UACPI_INTERFACE_KIND_VENDOR = (1 << 0), |
| 54 | UACPI_INTERFACE_KIND_FEATURE = (1 << 1), |
| 55 | UACPI_INTERFACE_KIND_ALL = UACPI_INTERFACE_KIND_VENDOR | |
| 56 | UACPI_INTERFACE_KIND_FEATURE, |
| 57 | } uacpi_interface_kind; |
| 58 | |
| 59 | /** |
| 60 | * Install or uninstall an interface. |
| 61 | * |
| 62 | * The interface kind is used for matching during interface enumeration in |
| 63 | * uacpi_bulk_configure_interfaces(). |
| 64 | * |
| 65 | * After installing an interface, all _OSI queries report it as supported. |
| 66 | */ |
| 67 | uacpi_status uacpi_install_interface( |
| 68 | const uacpi_char *name, uacpi_interface_kind |
| 69 | ); |
| 70 | uacpi_status uacpi_uninstall_interface(const uacpi_char *name); |
| 71 | |
| 72 | typedef enum uacpi_host_interface { |
| 73 | UACPI_HOST_INTERFACE_MODULE_DEVICE = 1, |
| 74 | UACPI_HOST_INTERFACE_PROCESSOR_DEVICE, |
| 75 | UACPI_HOST_INTERFACE_3_0_THERMAL_MODEL, |
| 76 | UACPI_HOST_INTERFACE_3_0_SCP_EXTENSIONS, |
| 77 | UACPI_HOST_INTERFACE_PROCESSOR_AGGREGATOR_DEVICE, |
| 78 | } uacpi_host_interface; |
| 79 | |
| 80 | /** |
| 81 | * Same as install/uninstall interface, but comes with an enum of known |
| 82 | * interfaces defined by the ACPI specification. These are disabled by default |
| 83 | * as they depend on the host kernel support. |
| 84 | */ |
| 85 | uacpi_status uacpi_enable_host_interface(uacpi_host_interface); |
| 86 | uacpi_status uacpi_disable_host_interface(uacpi_host_interface); |
| 87 | |
| 88 | typedef uacpi_bool (*uacpi_interface_handler) |
| 89 | (const uacpi_char *name, uacpi_bool supported); |
| 90 | |
| 91 | /** |
| 92 | * Set a custom interface query (_OSI) handler. |
| 93 | * |
| 94 | * This callback will be invoked for each _OSI query with the value |
| 95 | * passed in the _OSI, as well as whether the interface was detected as |
| 96 | * supported. The callback is able to override the return value dynamically |
| 97 | * or leave it untouched if desired (e.g. if it simply wants to log something or |
| 98 | * do internal bookkeeping of some kind). |
| 99 | */ |
| 100 | uacpi_status uacpi_set_interface_query_handler(uacpi_interface_handler); |
| 101 | |
| 102 | typedef enum uacpi_interface_action { |
| 103 | UACPI_INTERFACE_ACTION_DISABLE = 0, |
| 104 | UACPI_INTERFACE_ACTION_ENABLE, |
| 105 | } uacpi_interface_action; |
| 106 | |
| 107 | /** |
| 108 | * Bulk interface configuration, used to disable or enable all interfaces that |
| 109 | * match 'kind'. |
| 110 | * |
| 111 | * This is generally only needed to work around buggy hardware, for example if |
| 112 | * requested from the kernel command line. |
| 113 | * |
| 114 | * By default, all vendor strings (like "Windows 2000") are enabled, and all |
| 115 | * host features (like "3.0 Thermal Model") are disabled. |
| 116 | */ |
| 117 | uacpi_status uacpi_bulk_configure_interfaces( |
| 118 | uacpi_interface_action action, uacpi_interface_kind kind |
| 119 | ); |
| 120 | |
| 121 | #endif // !UACPI_BAREBONES_MODE |
| 122 | |
| 123 | #ifdef __cplusplus |
| 124 | } |
| 125 | #endif |
| 126 | |