ReactOS 0.4.16-dev-1946-g52006dd
event.h
Go to the documentation of this file.
1#pragma once
2
3#include <uacpi/types.h>
4#include <uacpi/uacpi.h>
5#include <uacpi/acpi.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#ifndef UACPI_BAREBONES_MODE
12
13typedef enum uacpi_fixed_event {
20
24))
25
29))
30
31/*
32 * Enable/disable a fixed event. Note that the event is automatically enabled
33 * upon installing a handler to it.
34 */
37)
40)
41
44)
45
46typedef enum uacpi_event_info {
47 // Event is enabled in software
48 UACPI_EVENT_INFO_ENABLED = (1 << 0),
49
50 // Event is enabled in software (only for wake)
51 UACPI_EVENT_INFO_ENABLED_FOR_WAKE = (1 << 1),
52
53 // Event is masked
54 UACPI_EVENT_INFO_MASKED = (1 << 2),
55
56 // Event has a handler attached
57 UACPI_EVENT_INFO_HAS_HANDLER = (1 << 3),
58
59 // Hardware enable bit is set
60 UACPI_EVENT_INFO_HW_ENABLED = (1 << 4),
61
62 // Hardware status bit is set
63 UACPI_EVENT_INFO_HW_STATUS = (1 << 5),
65
69))
70
74 uacpi_event_info *out_info
75))
76
77// Set if the handler wishes to reenable the GPE it just handled
78#define UACPI_GPE_REENABLE (1 << 7)
79
82);
83
89
92);
93
94/*
95 * Installs a handler to the provided GPE at 'idx' controlled by device
96 * 'gpe_device'. The GPE is automatically disabled & cleared according to the
97 * configured triggering upon invoking the handler. The event is optionally
98 * re-enabled (by returning UACPI_GPE_REENABLE from the handler)
99 *
100 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
101 */
106))
107
108/*
109 * Installs a raw handler to the provided GPE at 'idx' controlled by device
110 * 'gpe_device'. The handler is dispatched immediately after the event is
111 * received, status & enable bits are untouched.
112 *
113 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
114 */
119))
120
124))
125
126/*
127 * Marks the GPE 'idx' managed by 'gpe_device' as wake-capable. 'wake_device' is
128 * optional and configures the GPE to generate an implicit notification whenever
129 * an event occurs.
130 *
131 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
132 */
136 uacpi_namespace_node *wake_device
137))
138
139/*
140 * Mark a GPE managed by 'gpe_device' as enabled/disabled for wake. The GPE must
141 * have previously been marked by calling uacpi_gpe_setup_for_wake. This
142 * function only affects the GPE enable register state following the call to
143 * uacpi_gpe_enable_all_for_wake.
144 *
145 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
146 */
150))
154))
155
156/*
157 * Finalize GPE initialization by enabling all GPEs not configured for wake and
158 * having a matching AML handler detected.
159 *
160 * This should be called after the kernel power managment subsystem has
161 * enumerated all of the devices, executing their _PRW methods etc., and
162 * marking those it wishes to use for wake by calling uacpi_setup_gpe_for_wake
163 * or uacpi_mark_gpe_for_wake.
164 */
167)
168
169/*
170 * Enable/disable a general purpose event managed by 'gpe_device'. Internally
171 * this uses reference counting to make sure a GPE is not disabled until all
172 * possible users of it do so. GPEs not marked for wake are enabled
173 * automatically so this API is only needed for wake events or those that don't
174 * have a corresponding AML handler.
175 *
176 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
177 */
181))
185))
186
187/*
188 * Clear the status bit of the event 'idx' managed by 'gpe_device'.
189 *
190 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
191 */
195))
196
197/*
198 * Suspend/resume a general purpose event managed by 'gpe_device'. This bypasses
199 * the reference counting mechanism and unconditionally clears/sets the
200 * corresponding bit in the enable registers. This is used for switching the GPE
201 * to poll mode.
202 *
203 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
204 */
208))
212))
213
214/*
215 * Finish handling the GPE managed by 'gpe_device' at 'idx'. This clears the
216 * status registers if it hasn't been cleared yet and re-enables the event if
217 * it was enabled before.
218 *
219 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
220 */
224))
225
226/*
227 * Hard mask/umask a general purpose event at 'idx' managed by 'gpe_device'.
228 * This is used to permanently silence an event so that further calls to
229 * enable/disable as well as suspend/resume get ignored. This might be necessary
230 * for GPEs that cause an event storm due to the kernel's inability to properly
231 * handle them. The only way to enable a masked event is by a call to unmask.
232 *
233 * NOTE: 'gpe_device' may be null for GPEs managed by \_GPE
234 */
238))
242))
243
244/*
245 * Disable all GPEs currently set up on the system.
246 */
249)
250
251/*
252 * Enable all GPEs not marked as wake. This is only needed after the system
253 * wakes from a shallow sleep state and is called automatically by wake code.
254 */
257)
258
259/*
260 * Enable all GPEs marked as wake. This is only needed before the system goes
261 * to sleep is called automatically by sleep code.
262 */
265)
266
267/*
268 * Install/uninstall a new GPE block, usually defined by a device in the
269 * namespace with a _HID of ACPI0006.
270 */
276))
279 uacpi_namespace_node *gpe_device
280))
281
282#endif // !UACPI_BAREBONES_MODE
283
284#ifdef __cplusplus
285}
286#endif
void user(int argc, const char *argv[])
Definition: cmds.c:1350
uacpi_interrupt_ret(* uacpi_gpe_handler)(uacpi_handle ctx, uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.h:80
const uacpi_char * uacpi_gpe_triggering_to_string(uacpi_gpe_triggering triggering)
Definition: event.c:1237
uacpi_u16 uacpi_gpe_triggering uacpi_gpe_handler uacpi_handle ctx uacpi_u16 uacpi_namespace_node *wake_device uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u64 uacpi_address_space uacpi_u16 num_registers
Definition: event.h:274
uacpi_gpe_triggering
Definition: event.h:84
@ UACPI_GPE_TRIGGERING_MAX
Definition: event.h:87
@ UACPI_GPE_TRIGGERING_EDGE
Definition: event.h:86
@ UACPI_GPE_TRIGGERING_LEVEL
Definition: event.h:85
uacpi_fixed_event
Definition: event.h:13
@ UACPI_FIXED_EVENT_TIMER_STATUS
Definition: event.h:14
@ UACPI_FIXED_EVENT_RTC
Definition: event.h:17
@ UACPI_FIXED_EVENT_SLEEP_BUTTON
Definition: event.h:16
@ UACPI_FIXED_EVENT_POWER_BUTTON
Definition: event.h:15
@ UACPI_FIXED_EVENT_MAX
Definition: event.h:18
uacpi_u16 idx
Definition: event.h:73
uacpi_event_info
Definition: event.h:64
uacpi_u16 uacpi_gpe_triggering uacpi_gpe_handler handler
Definition: event.h:118
uacpi_u16 uacpi_gpe_triggering triggering
Definition: event.h:118
uacpi_u16 uacpi_gpe_triggering uacpi_gpe_handler uacpi_handle ctx uacpi_u16 uacpi_namespace_node *wake_device uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u64 uacpi_address_space address_space
Definition: event.h:274
uint32_t uacpi_u32
Definition: types.h:21
uint64_t uacpi_u64
Definition: types.h:22
char uacpi_char
Definition: types.h:44
uint16_t uacpi_u16
Definition: types.h:20
uacpi_status
Definition: status.h:10
uacpi_interrupt_ret(* uacpi_interrupt_handler)(uacpi_handle)
Definition: types.h:538
uacpi_u32 uacpi_interrupt_ret
Definition: types.h:536
uacpi_address_space
Definition: types.h:36
uacpi_status uacpi_install_gpe_handler_raw(uacpi_namespace_node *gpe_device, uacpi_u16 idx, uacpi_gpe_triggering triggering, uacpi_gpe_handler handler, uacpi_handle ctx)
Definition: event.c:1488
uacpi_status uacpi_disable_gpe_for_wake(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1899
uacpi_status uacpi_suspend_gpe(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1660
uacpi_status uacpi_enable_fixed_event(uacpi_fixed_event event)
Definition: event.c:109
uacpi_status uacpi_resume_gpe(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1667
uacpi_status uacpi_enable_all_wake_gpes(void)
Definition: event.c:1956
uacpi_status uacpi_enable_gpe_for_wake(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1892
uacpi_status uacpi_disable_all_gpes(void)
Definition: event.c:1940
uacpi_status uacpi_install_gpe_block(uacpi_namespace_node *gpe_device, uacpi_u64 address, uacpi_address_space address_space, uacpi_u16 num_registers, uacpi_u32 irq)
Definition: event.c:2018
uacpi_status uacpi_uninstall_gpe_handler(uacpi_namespace_node *gpe_device, uacpi_u16 idx, uacpi_gpe_handler handler)
Definition: event.c:1500
uacpi_status uacpi_enable_all_runtime_gpes(void)
Definition: event.c:1948
uacpi_status uacpi_disable_fixed_event(uacpi_fixed_event event)
Definition: event.c:140
uacpi_status uacpi_mask_gpe(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1728
uacpi_status uacpi_gpe_info(uacpi_namespace_node *gpe_device, uacpi_u16 idx, uacpi_event_info *out_info)
Definition: event.c:2356
uacpi_status uacpi_uninstall_fixed_event_handler(uacpi_fixed_event event)
Definition: event.c:2279
uacpi_status uacpi_uninstall_gpe_block(uacpi_namespace_node *gpe_device)
Definition: event.c:2052
uacpi_status uacpi_finalize_gpe_initialization(void)
Definition: event.c:1361
uacpi_status uacpi_fixed_event_info(uacpi_fixed_event event, uacpi_event_info *out_info)
Definition: event.c:2313
uacpi_status uacpi_install_fixed_event_handler(uacpi_fixed_event event, uacpi_interrupt_handler handler, uacpi_handle user)
Definition: event.c:2239
uacpi_status uacpi_finish_handling_gpe(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1674
uacpi_status uacpi_setup_gpe_for_wake(uacpi_namespace_node *gpe_device, uacpi_u16 idx, uacpi_namespace_node *wake_device)
Definition: event.c:1742
uacpi_status uacpi_enable_gpe(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1556
uacpi_status uacpi_clear_fixed_event(uacpi_fixed_event event)
Definition: event.c:161
uacpi_status uacpi_disable_gpe(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1590
uacpi_status uacpi_clear_gpe(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1613
uacpi_status uacpi_install_gpe_handler(uacpi_namespace_node *gpe_device, uacpi_u16 idx, uacpi_gpe_triggering triggering, uacpi_gpe_handler handler, uacpi_handle ctx)
Definition: event.c:1476
uacpi_status uacpi_unmask_gpe(uacpi_namespace_node *gpe_device, uacpi_u16 idx)
Definition: event.c:1735
unsigned char irq
Definition: dsp.h:13
struct _cl_event * event
Definition: glext.h:7739
GLuint address
Definition: glext.h:9393
#define UACPI_ALWAYS_ERROR_FOR_REDUCED_HARDWARE(fn)
Definition: uacpi.h:27