30#define AML_SMALL_BUFFER_SIZE 32
35#define AML_SMALL_STRING_SIZE AML_SMALL_BUFFER_SIZE
40#define AML_SMALL_PACKAGE_SIZE 4
45#define AML_OBJECT_CACHE_SIZE 64
151#define AML_OBJECT_ID_NONE 0
192#define AML_OBJECT_COMMON_HEADER \
194 aml_object_id_t id; \
196 map_entry_t mapEntry; \
197 list_entry_t listEntry; \
198 aml_namespace_overlay_t* overlay; \
200 list_entry_t siblingsEntry; \
201 aml_object_t* parent; \
202 aml_object_flags_t flags; \
210typedef struct aml_buffer_obj
222typedef struct aml_buffer_field_obj
236typedef struct aml_event_obj
245typedef struct aml_field_unit_obj
263typedef struct aml_integer_obj
273typedef struct aml_integer_constant_obj
283typedef struct aml_method_obj
301typedef struct aml_mutex_obj
312typedef struct aml_object_referencev
322typedef struct aml_opregion_obj
336typedef struct aml_package_obj
344typedef struct aml_power_resource_obj
355typedef struct aml_processor_obj
367typedef struct aml_string_obj
379typedef struct aml_alias_obj
389typedef struct aml_unresolved_obj
404typedef struct aml_arg_obj
414typedef struct aml_local_obj
424typedef 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_integer_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.
void aml_object_exception_check(aml_object_t *object, aml_state_t *state)
Check if a object has the AML_OBJECT_EXCEPTION_ON_USE flag set and raise an exception if it is.
uint64_t aml_field_unit_field_set(aml_object_t *object, aml_opregion_obj_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_string_resize(aml_string_obj_t *string, uint64_t newLength)
Resize a string object to the new length.
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.
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.
uint64_t aml_integer_set(aml_object_t *object, aml_integer_t value)
Set a object as an integer with the given value and bit width.
aml_method_obj_t * aml_method_find(const uint8_t *addr)
Find the method which contains the provided address in its AML bytecode range.
#define AML_SMALL_STRING_SIZE
Size of string buffers used for small objects optimization, not including the null terminator.
uint64_t aml_object_count_children(aml_object_t *parent)
Recursively count how many children an object has.
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_field_unit_index_field_set(aml_object_t *object, aml_field_unit_obj_t *index, aml_field_unit_obj_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_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_obj_traverse(aml_alias_obj_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.
aml_object_t *(* aml_method_implementation_t)(aml_method_obj_t *method, aml_object_t **args, uint64_t argCount)
Method Implementation function type.
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.
aml_field_unit_obj_type_t
Field Unit types.
uint64_t aml_string_set_empty(aml_object_t *object, uint64_t length)
Set a object as an empty string with the given length.
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_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_field_unit_bank_field_set(aml_object_t *object, aml_opregion_obj_t *opregion, aml_field_unit_obj_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.
#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
__UINTPTR_TYPE__ uintptr_t
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 placeholder for an event object.
Data for a field unit object.
aml_bit_size_t bitOffset
Used for Field, IndexField and BankField.
aml_field_unit_obj_type_t fieldType
The type of field unit.
aml_field_unit_obj_t * bank
Used for BankField.
aml_field_flags_t fieldFlags
Used for Field, IndexField and BankField.
aml_field_unit_obj_t * index
Used for IndexField.
aml_field_unit_obj_t * data
Used for IndexField.
aml_bit_size_t bitSize
Used for Field, IndexField and BankField.
aml_opregion_obj_t * opregion
Used for Field and BankField.
aml_object_t * bankValue
Used for BankField.
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_implementation_t implementation
aml_method_flags_t methodFlags
aml_sync_level_t syncLevel
Data for an object reference object.
aml_buffer_field_obj_t bufferField
aml_power_resource_obj_t powerResource
aml_opregion_obj_t opregion
aml_object_reference_obj_t objectReference
aml_integer_obj_t integer
aml_processor_obj_t processor
aml_field_unit_obj_t fieldUnit
aml_package_obj_t package
aml_integer_constant_obj_t integerConstant
aml_unresolved_obj_t unresolved
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_name_string_t nameString
The NameString representing the path to the target 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.