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