ReactOS 0.4.16-dev-2192-g7de9099
types.h
Go to the documentation of this file.
1#pragma once
2
3#include <uacpi/status.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#if UACPI_POINTER_SIZE == 4 && defined(UACPI_PHYS_ADDR_IS_32BITS)
16#else
19#endif
20
21typedef void *uacpi_handle;
22
23typedef union uacpi_object_name {
27
31
32 // Only applicable for uacpi_namespace_for_each_child
35
36typedef enum uacpi_address_space {
50
51 // Internal type
55
56#ifndef UACPI_BAREBONES_MODE
57
58typedef enum uacpi_init_level {
59 // Reboot state, nothing is available
61
62 /*
63 * State after a successfull call to uacpi_initialize. Table API and
64 * other helpers that don't depend on the ACPI namespace may be used.
65 */
67
68 /*
69 * State after a successfull call to uacpi_namespace_load. Most API may be
70 * used, namespace can be iterated, etc.
71 */
73
74 /*
75 * The final initialization stage, this is entered after the call to
76 * uacpi_namespace_initialize. All API is available to use.
77 */
80
81typedef struct uacpi_pci_address {
87
88typedef struct uacpi_data_view {
89 union {
92
95
96 void *data;
97 const void *const_data;
98 };
101
103
104typedef enum uacpi_object_type {
121
126
127// Type bits for API requiring a bit mask, e.g. uacpi_eval_typed
148
150
153
156
157/*
158 * Returns UACPI_TRUE if the provided object's type matches this type.
159 */
161
162/*
163 * Returns UACPI_TRUE if the provided object's type is one of the values
164 * specified in the 'type_mask' of UACPI_OBJECT_*_BIT.
165 */
168);
169
171
172/*
173 * Create an uninitialized object. The object can be further overwritten via
174 * uacpi_object_assign_* to anything.
175 */
177
178/*
179 * Create an integer object with the value provided.
180 */
182
188
189/*
190 * Same as uacpi_object_create_integer, but introduces additional ways to
191 * control what happens if the provided integer is larger than 32-bits, and the
192 * AML code expects 32-bit integers.
193 *
194 * - UACPI_OVERFLOW_ALLOW -> do nothing, same as the vanilla helper
195 * - UACPI_OVERFLOW_TRUNCATE -> truncate the integer to 32-bits if it happens to
196 * be larger than allowed by the DSDT
197 * - UACPI_OVERFLOW_DISALLOW -> fail object creation with
198 * UACPI_STATUS_INVALID_ARGUMENT if the provided
199 * value happens to be too large
200 */
203);
204
207
208/*
209 * Create a string/buffer object. Takes in a constant view of the data.
210 *
211 * NOTE: The data is copied to a separately allocated buffer and is not taken
212 * ownership of.
213 */
217
218/*
219 * Returns a writable view of the data stored in the string or buffer type
220 * object.
221 */
224);
227
228/*
229 * Returns UACPI_TRUE if the provided string object is actually an AML namepath.
230 *
231 * This can only be the case for package elements. If a package element is
232 * specified as a path to an object in AML, it's not resolved by the interpreter
233 * right away as it might not have been defined at that point yet, and is
234 * instead stored as a special string object to be resolved by client code
235 * when needed.
236 *
237 * Example usage:
238 * uacpi_namespace_node *target_node = UACPI_NULL;
239 *
240 * uacpi_object *obj = UACPI_NULL;
241 * uacpi_eval(scope, path, UACPI_NULL, &obj);
242 *
243 * uacpi_object_array arr;
244 * uacpi_object_get_package(obj, &arr);
245 *
246 * if (uacpi_object_is_aml_namepath(arr.objects[0])) {
247 * uacpi_object_resolve_as_aml_namepath(
248 * arr.objects[0], scope, &target_node
249 * );
250 * }
251 */
253
254/*
255 * Resolve an AML namepath contained in a string object.
256 *
257 * This is only applicable to objects that are package elements. See an
258 * explanation of how this works in the comment above the declaration of
259 * uacpi_object_is_aml_namepath.
260 *
261 * This is a shorthand for:
262 * uacpi_data_view view;
263 * uacpi_object_get_string(object, &view);
264 *
265 * target_node = uacpi_namespace_node_resolve_from_aml_namepath(
266 * scope, view.text
267 * );
268 */
271);
272
273/*
274 * Make the provided object a string/buffer.
275 * Takes in a constant view of the data to be stored in the object.
276 *
277 * NOTE: The data is copied to a separately allocated buffer and is not taken
278 * ownership of.
279 */
282
283typedef struct uacpi_object_array {
287
288/*
289 * Create a package object and store all of the objects in the array inside.
290 * The array is allowed to be empty.
291 *
292 * NOTE: the reference count of each object is incremented before being stored
293 * in the object. Client code must remove all of the locally created
294 * references at its own discretion.
295 */
297
298/*
299 * Returns the list of objects stored in a package object.
300 *
301 * NOTE: the reference count of the objects stored inside is not incremented,
302 * which means destorying/overwriting the object also potentially destroys
303 * all of the objects stored inside unless the reference count is
304 * incremented by the client via uacpi_object_ref.
305 */
307
308/*
309 * Make the provided object a package and store all of the objects in the array
310 * inside. The array is allowed to be empty.
311 *
312 * NOTE: the reference count of each object is incremented before being stored
313 * in the object. Client code must remove all of the locally created
314 * references at its own discretion.
315 */
317
318/*
319 * Create a reference object and make it point to 'child'.
320 *
321 * NOTE: child's reference count is incremented by one. Client code must remove
322 * all of the locally created references at its own discretion.
323 */
325
326/*
327 * Make the provided object a reference and make it point to 'child'.
328 *
329 * NOTE: child's reference count is incremented by one. Client code must remove
330 * all of the locally created references at its own discretion.
331 */
333
334/*
335 * Retrieve the object pointed to by a reference object.
336 *
337 * NOTE: the reference count of the returned object is incremented by one and
338 * must be uacpi_object_unref'ed by the client when no longer needed.
339 */
341
342typedef struct uacpi_processor_info {
347
348/*
349 * Returns the information about the provided processor object.
350 */
353);
354
359
360/*
361 * Returns the information about the provided power resource object.
362 */
365);
366
367typedef enum uacpi_region_op {
368 // data => uacpi_region_attach_data
370 // data => uacpi_region_detach_data
372
373 // data => uacpi_region_rw_data
376
377 // data => uacpi_region_pcc_send_data
379
380 // data => uacpi_region_gpio_rw_data
383
384 // data => uacpi_region_ipmi_rw_data
386
387 // data => uacpi_region_ffixedhw_rw_data
389
390 // data => uacpi_region_prm_rw_data
392
393 // data => uacpi_region_serial_rw_data
397
402
403typedef struct uacpi_pcc_region_info {
407
409{
412
416 union {
420 };
423
424typedef struct uacpi_region_rw_data {
427 union {
430 };
434
440
442{
450
452{
458
460
462{
467
480
488
489 /*
490 * Applicable if access_attribute is one of:
491 * - UACPI_ACCESS_ATTRIBUTE_BYTES
492 * - UACPI_ACCESS_ATTRIBUTE_RAW_BYTES
493 * - UACPI_ACCESS_ATTRIBUTE_RAW_PROCESS_BYTES
494 */
497
503
506
509
514
517
518 union {
519 // UACPI_FIRMWARE_REQUEST_BREAKPOINT
520 struct {
521 // The context of the method currently being executed
524
525 // UACPI_FIRMWARE_REQUEST_FATAL
526 struct {
531 };
533
534#define UACPI_INTERRUPT_NOT_HANDLED 0
535#define UACPI_INTERRUPT_HANDLED 1
537
539
540#endif // !UACPI_BAREBONES_MODE
541
542#ifdef __cplusplus
543}
544#endif
UINT op
Definition: effect.c:236
size_t uacpi_size
Definition: types.h:37
uint32_t uacpi_u32
Definition: types.h:21
bool uacpi_bool
Definition: types.h:31
uint64_t uacpi_u64
Definition: types.h:22
char uacpi_char
Definition: types.h:44
uint16_t uacpi_u16
Definition: types.h:20
uint8_t uacpi_u8
Definition: types.h:19
uacpi_status
Definition: status.h:10
uacpi_status uacpi_object_assign_reference(uacpi_object *, uacpi_object *child)
Definition: types.c:1254
void uacpi_object_ref(uacpi_object *obj)
Definition: types.c:727
const uacpi_char * uacpi_address_space_to_string(uacpi_address_space space)
Definition: types.c:11
uacpi_status uacpi_object_assign_package(uacpi_object *, uacpi_object_array in)
Definition: types.c:1313
uacpi_status(* uacpi_notify_handler)(uacpi_handle context, uacpi_namespace_node *node, uacpi_u64 value)
Definition: types.h:508
uacpi_status uacpi_object_get_string(uacpi_object *, uacpi_data_view *out)
Definition: types.c:1059
uacpi_u64 uacpi_io_addr
Definition: types.h:18
uacpi_status uacpi_object_assign_buffer(uacpi_object *, uacpi_data_view in)
Definition: types.c:1133
uacpi_bool uacpi_object_is_aml_namepath(uacpi_object *)
Definition: types.c:1073
uacpi_status uacpi_object_get_integer(uacpi_object *, uacpi_u64 *out)
Definition: types.c:1016
void * uacpi_handle
Definition: types.h:21
uacpi_bool uacpi_object_is_one_of(uacpi_object *, uacpi_object_type_bits type_mask)
Definition: types.c:990
uacpi_iteration_decision
Definition: types.h:28
@ UACPI_ITERATION_DECISION_BREAK
Definition: types.h:30
@ UACPI_ITERATION_DECISION_NEXT_PEER
Definition: types.h:33
@ UACPI_ITERATION_DECISION_CONTINUE
Definition: types.h:29
uacpi_object * uacpi_object_create_package(uacpi_object_array in)
Definition: types.c:1342
uacpi_object_type_bits
Definition: types.h:128
@ UACPI_OBJECT_STRING_BIT
Definition: types.h:130
@ UACPI_OBJECT_MUTEX_BIT
Definition: types.h:137
@ UACPI_OBJECT_REFERENCE_BIT
Definition: types.h:144
@ UACPI_OBJECT_METHOD_BIT
Definition: types.h:136
@ UACPI_OBJECT_BUFFER_INDEX_BIT
Definition: types.h:145
@ UACPI_OBJECT_FIELD_UNIT_BIT
Definition: types.h:133
@ UACPI_OBJECT_PROCESSOR_BIT
Definition: types.h:140
@ UACPI_OBJECT_BUFFER_BIT
Definition: types.h:131
@ UACPI_OBJECT_POWER_RESOURCE_BIT
Definition: types.h:139
@ UACPI_OBJECT_BUFFER_FIELD_BIT
Definition: types.h:142
@ UACPI_OBJECT_INTEGER_BIT
Definition: types.h:129
@ UACPI_OBJECT_OPERATION_REGION_BIT
Definition: types.h:138
@ UACPI_OBJECT_PACKAGE_BIT
Definition: types.h:132
@ UACPI_OBJECT_EVENT_BIT
Definition: types.h:135
@ UACPI_OBJECT_THERMAL_ZONE_BIT
Definition: types.h:141
@ UACPI_OBJECT_ANY_BIT
Definition: types.h:146
@ UACPI_OBJECT_DEBUG_BIT
Definition: types.h:143
@ UACPI_OBJECT_DEVICE_BIT
Definition: types.h:134
uacpi_status uacpi_object_get_power_resource_info(uacpi_object *, uacpi_power_resource_info *out)
Definition: types.c:1302
uacpi_status uacpi_object_assign_string(uacpi_object *, uacpi_data_view in)
Definition: types.c:1128
uacpi_u64 uacpi_phys_addr
Definition: types.h:17
uacpi_access_attribute
Definition: types.h:468
@ UACPI_ACCESS_ATTRIBUTE_WORD
Definition: types.h:472
@ UACPI_ACCESS_ATTRIBUTE_PROCESS_CALL
Definition: types.h:475
@ UACPI_ACCESS_ATTRIBUTE_BLOCK_PROCESS_CALL
Definition: types.h:476
@ UACPI_ACCESS_ATTRIBUTE_BYTE
Definition: types.h:471
@ UACPI_ACCESS_ATTRIBUTE_QUICK
Definition: types.h:469
@ UACPI_ACCESS_ATTRIBUTE_SEND_RECEIVE
Definition: types.h:470
@ UACPI_ACCESS_ATTRIBUTE_RAW_BYTES
Definition: types.h:477
@ UACPI_ACCESS_ATTRIBUTE_BLOCK
Definition: types.h:473
@ UACPI_ACCESS_ATTRIBUTE_RAW_PROCESS_BYTES
Definition: types.h:478
@ UACPI_ACCESS_ATTRIBUTE_BYTES
Definition: types.h:474
uacpi_object * uacpi_object_create_cstring(const uacpi_char *)
Definition: types.c:1219
uacpi_region_ipmi_rw_data uacpi_region_ffixedhw_rw_data
Definition: types.h:459
const uacpi_char * uacpi_object_type_to_string(uacpi_object_type)
Definition: types.c:51
uacpi_status uacpi_object_get_package(uacpi_object *, uacpi_object_array *out)
Definition: types.c:1227
uacpi_object * uacpi_object_create_reference(uacpi_object *child)
Definition: types.c:1238
uacpi_status uacpi_object_assign_integer(uacpi_object *, uacpi_u64 value)
Definition: types.c:1024
uacpi_overflow_behavior
Definition: types.h:183
@ UACPI_OVERFLOW_TRUNCATE
Definition: types.h:185
@ UACPI_OVERFLOW_ALLOW
Definition: types.h:184
@ UACPI_OVERFLOW_DISALLOW
Definition: types.h:186
uacpi_init_level
Definition: types.h:58
@ UACPI_INIT_LEVEL_EARLY
Definition: types.h:60
@ UACPI_INIT_LEVEL_SUBSYSTEM_INITIALIZED
Definition: types.h:66
@ UACPI_INIT_LEVEL_NAMESPACE_INITIALIZED
Definition: types.h:78
@ UACPI_INIT_LEVEL_NAMESPACE_LOADED
Definition: types.h:72
uacpi_object_type uacpi_object_get_type(uacpi_object *)
Definition: types.c:975
uacpi_status uacpi_object_get_processor_info(uacpi_object *, uacpi_processor_info *out)
Definition: types.c:1290
uacpi_status uacpi_object_get_buffer(uacpi_object *, uacpi_data_view *out)
Definition: types.c:1066
uacpi_object_type_bits uacpi_object_get_type_bit(uacpi_object *)
Definition: types.c:980
uacpi_object * uacpi_object_create_integer(uacpi_u64)
Definition: types.c:1177
uacpi_status uacpi_object_get_dereferenced(uacpi_object *, uacpi_object **out)
Definition: types.c:1278
uacpi_status(* uacpi_region_handler)(uacpi_region_op op, uacpi_handle op_data)
Definition: types.h:505
uacpi_interrupt_ret(* uacpi_interrupt_handler)(uacpi_handle)
Definition: types.h:538
uacpi_object_type
Definition: types.h:104
@ UACPI_OBJECT_MAX_TYPE_VALUE
Definition: types.h:124
@ UACPI_OBJECT_EVENT
Definition: types.h:112
@ UACPI_OBJECT_METHOD
Definition: types.h:113
@ UACPI_OBJECT_BUFFER
Definition: types.h:108
@ UACPI_OBJECT_STRING
Definition: types.h:107
@ UACPI_OBJECT_PROCESSOR
Definition: types.h:117
@ UACPI_OBJECT_DEVICE
Definition: types.h:111
@ UACPI_OBJECT_PACKAGE
Definition: types.h:109
@ UACPI_OBJECT_POWER_RESOURCE
Definition: types.h:116
@ UACPI_OBJECT_UNINITIALIZED
Definition: types.h:105
@ UACPI_OBJECT_REFERENCE
Definition: types.h:122
@ UACPI_OBJECT_MUTEX
Definition: types.h:114
@ UACPI_OBJECT_DEBUG
Definition: types.h:120
@ UACPI_OBJECT_INTEGER
Definition: types.h:106
@ UACPI_OBJECT_BUFFER_FIELD
Definition: types.h:119
@ UACPI_OBJECT_OPERATION_REGION
Definition: types.h:115
@ UACPI_OBJECT_FIELD_UNIT
Definition: types.h:110
@ UACPI_OBJECT_THERMAL_ZONE
Definition: types.h:118
@ UACPI_OBJECT_BUFFER_INDEX
Definition: types.h:123
uacpi_region_op
Definition: types.h:367
@ UACPI_REGION_OP_FFIXEDHW_COMMAND
Definition: types.h:388
@ UACPI_REGION_OP_PCC_SEND
Definition: types.h:378
@ UACPI_REGION_OP_GPIO_READ
Definition: types.h:381
@ UACPI_REGION_OP_SERIAL_WRITE
Definition: types.h:395
@ UACPI_REGION_OP_PRM_COMMAND
Definition: types.h:391
@ UACPI_REGION_OP_DETACH
Definition: types.h:371
@ UACPI_REGION_OP_GPIO_WRITE
Definition: types.h:382
@ UACPI_REGION_OP_SERIAL_READ
Definition: types.h:394
@ UACPI_REGION_OP_WRITE
Definition: types.h:375
@ UACPI_REGION_OP_READ
Definition: types.h:374
@ UACPI_REGION_OP_IPMI_COMMAND
Definition: types.h:385
@ UACPI_REGION_OP_ATTACH
Definition: types.h:369
uacpi_u32 uacpi_interrupt_ret
Definition: types.h:536
uacpi_object * uacpi_object_create_uninitialized(void)
Definition: types.c:1138
uacpi_firmware_request_type
Definition: types.h:510
@ UACPI_FIRMWARE_REQUEST_TYPE_FATAL
Definition: types.h:512
@ UACPI_FIRMWARE_REQUEST_TYPE_BREAKPOINT
Definition: types.h:511
uacpi_status uacpi_object_create_integer_safe(uacpi_u64, uacpi_overflow_behavior, uacpi_object **out_obj)
Definition: types.c:1143
uacpi_bool uacpi_object_is(uacpi_object *, uacpi_object_type)
Definition: types.c:985
uacpi_address_space
Definition: types.h:36
@ UACPI_ADDRESS_SPACE_IPMI
Definition: types.h:44
@ UACPI_ADDRESS_SPACE_PRM
Definition: types.h:48
@ UACPI_ADDRESS_SPACE_SYSTEM_MEMORY
Definition: types.h:37
@ UACPI_ADDRESS_SPACE_GENERAL_PURPOSE_IO
Definition: types.h:45
@ UACPI_ADDRESS_SPACE_FFIXEDHW
Definition: types.h:49
@ UACPI_ADDRESS_SPACE_PCI_CONFIG
Definition: types.h:39
@ UACPI_ADDRESS_SPACE_TABLE_DATA
Definition: types.h:52
@ UACPI_ADDRESS_SPACE_EMBEDDED_CONTROLLER
Definition: types.h:40
@ UACPI_ADDRESS_SPACE_SYSTEM_CMOS
Definition: types.h:42
@ UACPI_ADDRESS_SPACE_GENERIC_SERIAL_BUS
Definition: types.h:46
@ UACPI_ADDRESS_SPACE_SYSTEM_IO
Definition: types.h:38
@ UACPI_ADDRESS_SPACE_SMBUS
Definition: types.h:41
@ UACPI_ADDRESS_SPACE_PCC
Definition: types.h:47
@ UACPI_ADDRESS_SPACE_PCI_BAR_TARGET
Definition: types.h:43
uacpi_status uacpi_object_resolve_as_aml_namepath(uacpi_object *, uacpi_namespace_node *scope, uacpi_namespace_node **out_node)
Definition: types.c:1079
uacpi_object * uacpi_object_create_buffer(uacpi_data_view)
Definition: types.c:1214
uacpi_status uacpi_object_get_string_or_buffer(uacpi_object *, uacpi_data_view *out)
Definition: types.c:1050
uacpi_object * uacpi_object_create_string(uacpi_data_view)
Definition: types.c:1209
void uacpi_object_unref(uacpi_object *obj)
Definition: types.c:755
GLuint in
Definition: glext.h:9616
static HWND child
Definition: cursoricon.c:298
Definition: http.c:7252
uacpi_char * text
Definition: types.h:93
uacpi_size length
Definition: types.h:99
const void * const_data
Definition: types.h:97
const uacpi_u8 * const_bytes
Definition: types.h:91
const uacpi_char * const_text
Definition: types.h:94
void * data
Definition: types.h:96
uacpi_u8 * bytes
Definition: types.h:90
struct uacpi_firmware_request::@740::@743 fatal
struct uacpi_firmware_request::@740::@742 breakpoint
uacpi_handle ctx
Definition: types.h:522
uacpi_u32 code
Definition: types.h:528
uacpi_u64 num_pins
Definition: types.h:410
uacpi_object ** objects
Definition: types.h:284
uacpi_size count
Definition: types.h:285
uacpi_data_view buffer
Definition: types.h:404
uacpi_u8 subspace_id
Definition: types.h:405
uacpi_u8 device
Definition: types.h:84
uacpi_u8 bus
Definition: types.h:83
uacpi_u8 function
Definition: types.h:85
uacpi_u16 segment
Definition: types.h:82
uacpi_u16 resource_order
Definition: types.h:357
uacpi_u32 block_address
Definition: types.h:344
uacpi_u8 block_length
Definition: types.h:345
void * out_region_context
Definition: types.h:421
uacpi_gpio_region_info gpio_info
Definition: types.h:419
uacpi_pcc_region_info pcc_info
Definition: types.h:418
uacpi_namespace_node * region_node
Definition: types.h:415
uacpi_generic_region_info generic_info
Definition: types.h:417
uacpi_namespace_node * region_node
Definition: types.h:501
uacpi_data_view connection
Definition: types.h:445
uacpi_u32 pin_offset
Definition: types.h:446
uacpi_data_view in_out_message
Definition: types.h:455
uacpi_data_view buffer
Definition: types.h:438
uacpi_data_view in_out_message
Definition: types.h:465
void * region_context
Definition: types.h:426
uacpi_phys_addr address
Definition: types.h:428
uacpi_u64 offset
Definition: types.h:429
void * handler_context
Definition: types.h:425
uacpi_u64 value
Definition: types.h:431
uacpi_u8 byte_width
Definition: types.h:432
uacpi_access_attribute access_attribute
Definition: types.h:487
uacpi_data_view connection
Definition: types.h:485
uacpi_data_view in_out_buffer
Definition: types.h:486
Definition: dlist.c:348
uacpi_u32 id
Definition: types.h:25
uacpi_char text[4]
Definition: types.h:24
Definition: pdh_main.c:96
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383