PatchworkOS
Loading...
Searching...
No Matches
object.h File Reference

Go to the source code of this file.

Data Structures

struct  aml_buffer_obj_t
 Data for a buffer object. More...
 
struct  aml_buffer_field_obj_t
 Data for a buffer field object. More...
 
struct  aml_event_obj_t
 Data placeholder for an event object. More...
 
struct  aml_field_unit_obj_t
 Data for a field unit object. More...
 
struct  aml_integer_obj_t
 Data for an integer object. More...
 
struct  aml_integer_constant_obj_t
 Data for an integer constant object. More...
 
struct  aml_method_obj_t
 Data for a method object. More...
 
struct  aml_mutex_obj_t
 Data for a mutex object. More...
 
struct  aml_object_reference_obj_t
 Data for an object reference object. More...
 
struct  aml_opregion_obj_t
 Data for an operation region object. More...
 
struct  aml_package_obj_t
 Data for a package object. More...
 
struct  aml_power_resource_obj_t
 
struct  aml_processor_obj_t
 Data for a processor object. More...
 
struct  aml_string_obj_t
 Data for a string object. More...
 
struct  aml_alias_obj_t
 Data for an alias object. More...
 
struct  aml_unresolved_obj_t
 Data for an unresolved object. More...
 
struct  aml_arg_obj_t
 Data for an argument object. More...
 
struct  aml_local_obj_t
 Data for a local variable object. More...
 
struct  aml_object_t
 ACPI object. More...
 

Macros

#define AML_SMALL_BUFFER_SIZE   32
 Size of buffers used for small objects optimization.
 
#define AML_SMALL_STRING_SIZE   AML_SMALL_BUFFER_SIZE
 Size of string buffers used for small objects optimization, not including the null terminator.
 
#define AML_SMALL_PACKAGE_SIZE   4
 Size of package element arrays used for small objects optimization.
 
#define AML_OBJECT_CACHE_SIZE   64
 Amount of objects to store in the cache before freeing them instead.
 
#define AML_OBJECT_ID_NONE   0
 Value for an invalid object id.
 
#define AML_OBJECT_COMMON_HEADER
 Common header for all AML objects.
 

Typedefs

typedef struct aml_state aml_state_t
 
typedef struct aml_object aml_object_t
 
typedef struct aml_opregion_obj aml_opregion_obj_t
 
typedef struct aml_string_obj aml_string_obj_t
 
typedef struct aml_method_obj aml_method_obj_t
 
typedef uint64_t aml_object_id_t
 Object id type.
 
typedef aml_object_t *(* aml_method_implementation_t) (aml_method_obj_t *method, aml_object_t **args, uint64_t argCount)
 Method Implementation function type.
 

Enumerations

enum  aml_type_t {
  AML_UNINITIALIZED = 0 ,
  AML_BUFFER = 1 << 0 ,
  AML_BUFFER_FIELD = 1 << 1 ,
  AML_DEBUG_OBJECT = 1 << 2 ,
  AML_DEVICE = 1 << 3 ,
  AML_EVENT = 1 << 4 ,
  AML_FIELD_UNIT = 1 << 5 ,
  AML_INTEGER = 1 << 6 ,
  AML_METHOD = 1 << 8 ,
  AML_MUTEX = 1 << 9 ,
  AML_OBJECT_REFERENCE = 1 << 10 ,
  AML_OPERATION_REGION = 1 << 11 ,
  AML_PACKAGE = 1 << 12 ,
  AML_POWER_RESOURCE = 1 << 13 ,
  AML_PROCESSOR = 1 << 14 ,
  AML_RAW_DATA_BUFFER = 1 << 15 ,
  AML_STRING = 1 << 16 ,
  AML_THERMAL_ZONE = 1 << 17 ,
  AML_ALIAS = 1 << 18 ,
  AML_UNRESOLVED = 1 << 19 ,
  AML_PREDEFINED_SCOPE = 1 << 20 ,
  AML_ARG = 1 << 21 ,
  AML_LOCAL = 1 << 22 ,
  AML_COMPUTATIONAL_DATA_OBJECTS = AML_INTEGER | AML_STRING | AML_BUFFER ,
  AML_DATA_OBJECTS = AML_COMPUTATIONAL_DATA_OBJECTS | AML_PACKAGE ,
  AML_DATA_REF_OBJECTS = AML_DATA_OBJECTS | AML_OBJECT_REFERENCE ,
  AML_NAMESPACES ,
  AML_ALL_TYPES ,
  AML_TYPE_AMOUNT = 20
}
 ACPI data types. More...
 
enum  aml_object_flags_t {
  AML_OBJECT_NONE = 0 ,
  AML_OBJECT_ROOT = 1 << 0 ,
  AML_OBJECT_NAMED = 1 << 1 ,
  AML_OBJECT_EXCEPTION_ON_USE = 1 << 2 ,
  AML_OBJECT_EXPOSED_IN_SYSFS = 1 << 3
}
 Flags for ACPI objects. More...
 
enum  aml_field_unit_obj_type_t {
  AML_FIELD_UNIT_NONE ,
  AML_FIELD_UNIT_FIELD ,
  AML_FIELD_UNIT_INDEX_FIELD ,
  AML_FIELD_UNIT_BANK_FIELD
}
 Field Unit types. More...
 

Functions

uint64_t aml_object_get_total_count (void)
 Get the total amount of allocated ACPI objects.
 
aml_object_taml_object_new (void)
 Allocate a new ACPI object.
 
void aml_object_clear (aml_object_t *object)
 Clear the data of a object, setting its type to AML_UNINITIALIZED.
 
uint64_t aml_object_count_children (aml_object_t *parent)
 Recursively count how many children an object has.
 
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_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.
 
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_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_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_debug_object_set (aml_object_t *object)
 Set a object as a debug object.
 
uint64_t aml_device_set (aml_object_t *object)
 Set a object as a device or bus.
 
uint64_t aml_event_set (aml_object_t *object)
 Set a object as an event.
 
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_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_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.
 
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.
 
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.
 
aml_method_obj_taml_method_find (const uint8_t *addr)
 Find the method which contains the provided address in its AML bytecode range.
 
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_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_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_package_set (aml_object_t *object, uint64_t length)
 Set a object as a package with the given number of elements.
 
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_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.
 
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_string_set (aml_object_t *object, const char *str)
 Set a object as a string with the given value.
 
uint64_t aml_string_resize (aml_string_obj_t *string, uint64_t newLength)
 Resize a string object to the new length.
 
uint64_t aml_thermal_zone_set (aml_object_t *object)
 Set a object as a thermal zone.
 
uint64_t aml_alias_set (aml_object_t *object, aml_object_t *target)
 Set a object as an alias to the given target object.
 
aml_object_taml_alias_obj_traverse (aml_alias_obj_t *alias)
 Traverse an alias object to get the target object.
 
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_predefined_scope_set (aml_object_t *object)
 Set a object as a predefined scope with the given name.
 
uint64_t aml_arg_set (aml_object_t *object, aml_object_t *value)
 Set a object as an argument with the given target object.
 
uint64_t aml_local_set (aml_object_t *object)
 Set a object as a empty local variable.
 

Typedef Documentation

◆ aml_method_obj_t

typedef struct aml_method_obj aml_method_obj_t

Definition at line 17 of file object.h.

◆ aml_object_t

typedef struct aml_object aml_object_t

Definition at line 14 of file object.h.

◆ aml_opregion_obj_t

typedef struct aml_opregion_obj aml_opregion_obj_t

Definition at line 15 of file object.h.

◆ aml_state_t

typedef struct aml_state aml_state_t

Definition at line 13 of file object.h.

◆ aml_string_obj_t

typedef struct aml_string_obj aml_string_obj_t

Definition at line 16 of file object.h.