32#define AML_SMALL_BUFFER_SIZE 32
37#define AML_SMALL_STRING_SIZE AML_SMALL_BUFFER_SIZE
42#define AML_SMALL_PACKAGE_SIZE 4
47#define AML_OBJECT_CACHE_SIZE 64
153#define AML_OBJECT_ID_NONE 0
194#define AML_OBJECT_COMMON_HEADER \
196 aml_object_id_t id; \
198 map_entry_t mapEntry; \
199 list_entry_t listEntry; \
200 aml_overlay_t* overlay; \
202 list_entry_t siblingsEntry; \
203 aml_object_t* parent; \
204 aml_object_flags_t flags; \
212typedef struct aml_buffer
224typedef struct aml_buffer_field
236typedef struct aml_device
258typedef struct aml_event
267typedef struct aml_field_unit
285typedef struct aml_integer
295typedef struct aml_integer_constant
305typedef struct aml_method
323typedef struct aml_mutex
334typedef struct aml_object_reference
344typedef struct aml_opregion
358typedef struct aml_package
366typedef struct aml_power_resource
377typedef struct aml_processor
389typedef struct aml_string
401typedef struct aml_alias
411typedef struct aml_unresolved
426typedef struct aml_arg
436typedef struct aml_local
446typedef struct aml_object
uint64_t aml_bit_size_t
Represents a size in bits within an opregion.
uint8_t aml_proc_id_t
ProcID structure, deprecated in version 6.4 of the ACPI specification.
uint32_t aml_pblk_addr_t
PblkAddr structure, deprecated in version 6.4 of the ACPI specification.
uint8_t aml_system_level_t
SystemLevel structure.
uint8_t aml_pblk_len_t
PblkLen structure, deprecated in version 6.4 of the ACPI specification.
aml_region_space_t
Region Space Encoding.
uint16_t aml_resource_order_t
ResourceOrder structure.
uint64_t aml_uint_t
AML Integer type.
uint64_t aml_mutex_id_t
Mutex id.
uint64_t aml_object_reference_set(aml_object_t *object, aml_object_t *target)
Set a object as an ObjectReference to the given target object.
uint64_t aml_buffer_resize(aml_buffer_t *buffer, uint64_t newLength)
Resize a buffer object to the new length.
uint64_t aml_field_unit_bank_field_set(aml_object_t *object, aml_opregion_t *opregion, aml_field_unit_t *bank, uint64_t bankValue, aml_field_flags_t flags, aml_bit_size_t bitOffset, aml_bit_size_t bitSize)
Set a object as a field unit of type BankField.
aml_method_t * aml_method_find(const uint8_t *addr)
Find the method which contains the provided address in its AML bytecode range.
aml_type_t
ACPI data types.
uint64_t aml_method_set(aml_object_t *object, aml_method_flags_t flags, const uint8_t *start, const uint8_t *end, aml_method_implementation_t implementation)
Set a object as a method with the given flags and address range.
uint64_t aml_local_set(aml_object_t *object)
Set a object as a empty local variable.
uint64_t aml_event_set(aml_object_t *object)
Set a object as an event.
uint64_t aml_device_set(aml_object_t *object)
Set a object as a device or bus.
uint64_t aml_mutex_set(aml_object_t *object, aml_sync_level_t syncLevel)
Set a object as a mutex with the given synchronization level.
aml_field_unit_type_t
Field Unit types.
uint64_t aml_power_resource_set(aml_object_t *object, aml_system_level_t systemLevel, aml_resource_order_t resourceOrder)
Set a object as a power resource with the given system level and resource order.
uint64_t aml_package_set(aml_object_t *object, uint64_t length)
Set a object as a package with the given number of elements.
#define AML_SMALL_STRING_SIZE
Size of string buffers used for small objects optimization, not including the null terminator.
uint64_t aml_field_unit_index_field_set(aml_object_t *object, aml_field_unit_t *index, aml_field_unit_t *data, aml_field_flags_t flags, aml_bit_size_t bitOffset, aml_bit_size_t bitSize)
Set a object as a field unit of type IndexField.
uint64_t aml_object_count_children(aml_object_t *parent)
Recursively count how many children an object has.
uint64_t aml_field_unit_field_set(aml_object_t *object, aml_opregion_t *opregion, aml_field_flags_t flags, aml_bit_size_t bitOffset, aml_bit_size_t bitSize)
Set a object as a field unit of type Field.
uint64_t aml_thermal_zone_set(aml_object_t *object)
Set a object as a thermal zone.
aml_object_t * aml_object_new(void)
Allocate a new ACPI object.
uint64_t aml_string_set(aml_object_t *object, const char *str)
Set a object as a string with the given value.
uint64_t aml_object_set_bits_at(aml_object_t *object, aml_bit_size_t bitOffset, aml_bit_size_t bitSize, uint8_t *in)
Store bits into a object at the specified bit offset and size.
uint64_t aml_alias_set(aml_object_t *object, aml_object_t *target)
Set a object as an alias to the given target object.
uint64_t aml_arg_set(aml_object_t *object, aml_object_t *value)
Set a object as an argument with the given target object.
aml_object_t * aml_alias_traverse(aml_alias_t *alias)
Traverse an alias object to get the target object.
uint64_t aml_predefined_scope_set(aml_object_t *object)
Set a object as a predefined scope with the given name.
uint64_t aml_buffer_set_empty(aml_object_t *object, uint64_t length)
Set a object as an empty buffer with the given length.
uint64_t aml_buffer_field_set(aml_object_t *object, aml_object_t *target, aml_bit_size_t bitOffset, aml_bit_size_t bitSize)
Set a object as a buffer field with the given buffer, bit offset and bit size.
uint64_t aml_string_set_empty(aml_object_t *object, uint64_t length)
Set a object as an empty string with the given length.
aml_object_t *(* aml_method_implementation_t)(aml_method_t *method, aml_object_t **args, uint64_t argCount)
Method Implementation function type.
uint64_t aml_debug_object_set(aml_object_t *object)
Set a object as a debug object.
aml_object_flags_t
Flags for ACPI objects.
void aml_object_clear(aml_object_t *object)
Clear the data of a object, setting its type to AML_UNINITIALIZED.
uint64_t aml_object_get_bits_at(aml_object_t *object, aml_bit_size_t bitOffset, aml_bit_size_t bitSize, uint8_t *out)
Retrieve bits from a object at the specified bit offset and size.
uint64_t aml_object_id_t
Object id type.
uint64_t aml_processor_set(aml_object_t *object, aml_proc_id_t procId, aml_pblk_addr_t pblkAddr, aml_pblk_len_t pblkLen)
Set a object as a processor with the given ProcID, PblkAddr, and PblkLen.
#define AML_SMALL_BUFFER_SIZE
Size of buffers used for small objects optimization.
uint64_t aml_object_get_total_count(void)
Get the total amount of allocated ACPI objects.
uint64_t aml_integer_set(aml_object_t *object, aml_uint_t value)
Set a object as an integer with the given value and bit width.
uint64_t aml_operation_region_set(aml_object_t *object, aml_region_space_t space, uintptr_t offset, uint32_t length)
Set a object as an operation region with the given space, offset, and length.
uint64_t aml_unresolved_set(aml_object_t *object, const aml_name_string_t *nameString, aml_object_t *from, aml_patch_up_resolve_callback_t callback)
Set a object as an unresolved reference with the given namestring and starting point.
uint64_t aml_buffer_set(aml_object_t *object, const uint8_t *buffer, uint64_t bytesToCopy, uint64_t length)
Set a object as a buffer with the given content.
uint64_t aml_string_resize(aml_string_t *string, uint64_t newLength)
Resize a string object to the new length.
#define AML_SMALL_PACKAGE_SIZE
Size of package element arrays used for small objects optimization.
@ AML_UNRESOLVED
Not in the spec, used internally to represent unresolved references.
@ AML_TYPE_AMOUNT
Not a type, just the amount of types.
@ AML_ALIAS
Not in the spec, used internally to represent Aliases.
@ AML_ARG
Not in the spec, used internally to represent method arguments.
@ AML_COMPUTATIONAL_DATA_OBJECTS
@ AML_LOCAL
Not in the spec, used internally to represent method local variables.
@ AML_PREDEFINED_SCOPE
Not in the spec, used internally to represent _SB, _GPE, etc.
@ AML_FIELD_UNIT_BANK_FIELD
@ AML_FIELD_UNIT_INDEX_FIELD
@ AML_OBJECT_EXPOSED_IN_SYSFS
@ AML_OBJECT_ROOT
Is the root object.
@ AML_OBJECT_EXCEPTION_ON_USE
@ AML_OBJECT_NAMED
Appears in the namespace tree. Will be set in aml_object_add().
@ AML_OBJECT_NONE
No flags.
uint64_t(* aml_patch_up_resolve_callback_t)(aml_state_t *state, aml_object_t *match, aml_object_t *unresolved)
Callback type for resolving a forward reference.
EFI_PHYSICAL_ADDRESS buffer
static const path_flag_t flags[]
__UINTPTR_TYPE__ uintptr_t
ACPI device configuration structure.
Data for an alias object.
Data for an argument object.
aml_object_t * value
The object that was passed as the argument.
Data for a buffer field object.
Data for a buffer object.
Data for a device object.
Data placeholder for an event object.
Data for a field unit object.
aml_opregion_t * opregion
Used for Field and BankField.
aml_object_t * bankValue
Used for BankField.
aml_bit_size_t bitSize
Used for Field, IndexField and BankField.
aml_field_unit_t * bank
Used for BankField.
aml_field_unit_type_t fieldType
The type of field unit.
aml_field_flags_t fieldFlags
Used for Field, IndexField and BankField.
aml_bit_size_t bitOffset
Used for Field, IndexField and BankField.
aml_field_unit_t * index
Used for IndexField.
aml_field_unit_t * data
Used for IndexField.
Data for an integer constant object.
Data for an integer object.
Data for a local variable object.
aml_object_t * value
The value of the local variable.
Data for a method object.
aml_method_flags_t methodFlags
aml_method_implementation_t implementation
aml_sync_level_t syncLevel
Data for an object reference object.
aml_field_unit_t fieldUnit
aml_unresolved_t unresolved
aml_processor_t processor
aml_power_resource_t powerResource
aml_object_reference_t objectReference
aml_integer_constant_t integerConstant
aml_buffer_field_t bufferField
Data for an operation region object.
Data for a package object.
aml_resource_order_t resourceOrder
aml_system_level_t systemLevel
Data for a processor object.
Data for a string object.
Data for an unresolved object.
aml_object_t * from
The object to start the search from when resolving the reference.
aml_patch_up_resolve_callback_t callback
The callback to call when a matching object is found.
aml_name_string_t nameString
The NameString representing the path to the target object.