|
PatchworkOS
|
Object. More...
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 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. | |
Functions | |
| uint64_t | aml_object_get_total_count (void) |
| Get the total amount of allocated ACPI objects. | |
| aml_object_t * | aml_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_t * | aml_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_t * | aml_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. | |
Object.
| #define AML_OBJECT_CACHE_SIZE 64 |
| #define AML_OBJECT_COMMON_HEADER |
Common header for all AML objects.
Members:
ref Reference count for the object.id The unique id of the object.name The name of the object.mapEntry Entry for the namespace map member.listEntry Entry for the namespace objects member or the object cache list.overlay The overlay this object is part of, NULL if part of the global namespace or unanamed.children List of children, children hold references to the parent, parent does not hold references to children.siblingsEntry Entry for the parent's children member.parent Pointer to the parent object, NULL if root or unnamed.flags Flags for the object, see aml_object_flags_t for more details.type The type of the object, see aml_type_t for more details.dir Sysfs directory for the object, only valid if flags has AML_OBJECT_EXPOSED_IN_SYSFS set. | #define AML_OBJECT_ID_NONE 0 |
| #define AML_SMALL_BUFFER_SIZE 32 |
| #define AML_SMALL_PACKAGE_SIZE 4 |
| #define AML_SMALL_STRING_SIZE AML_SMALL_BUFFER_SIZE |
| aml_method_implementation_t |
Field Unit types.
Since the ACPI spec does not differentiate between "objects" of type Field, IndexField and BankField, instead just calling them all FieldUnits, we use this enum to differentiate between different FieldUnit types, even if it might be cleaner to use aml_type_t for this.
| Enumerator | |
|---|---|
| AML_FIELD_UNIT_NONE | |
| AML_FIELD_UNIT_FIELD | |
| AML_FIELD_UNIT_INDEX_FIELD | |
| AML_FIELD_UNIT_BANK_FIELD | |
| enum aml_object_flags_t |
Flags for ACPI objects.
| Enumerator | |
|---|---|
| AML_OBJECT_NONE | No flags. |
| AML_OBJECT_ROOT | Is the root object. |
| AML_OBJECT_NAMED | Appears in the namespace tree. Will be set in |
| AML_OBJECT_EXCEPTION_ON_USE | The first time this object is used an exception will be raised. This is used such that when a method fails to implicitly or explicitly return a value the "synthetic" return value will raise an exception when used. Any copy of an object with this flag will also have this flag set. |
| AML_OBJECT_EXPOSED_IN_SYSFS | The object is exposed in sysfs. Will be set in |
| enum aml_type_t |
ACPI data types.
Note that objects can obviously only have one type but we use bitflags here to make it easier to define groups of types.
| aml_object_t * aml_alias_obj_traverse | ( | aml_alias_obj_t * | alias | ) |
Traverse an alias object to get the target object.
If the target is also an alias, it will be traversed recursively until a non-alias object is found.
| alias | Pointer to the alias object to traverse. |
NULL and errno is set. Definition at line 1114 of file object.c.
References aml_object_t::alias, AML_ALIAS, CONTAINER_OF, DEREF, next, NULL, REF, and aml_alias_obj_t::target.
Referenced by aml_namespace_find_child().
| uint64_t aml_alias_set | ( | aml_object_t * | object, |
| aml_object_t * | target | ||
| ) |
Set a object as an alias to the given target object.
This is used to implement the DefAlias structure.
| object | Pointer to the object to initialize. |
| target | Pointer to the target object the alias will point to. |
0. On failure, ERR and errno is set. Definition at line 1096 of file object.c.
References AML_ALIAS, aml_object_check_clear(), EINVAL, ERR, errno, NULL, and REF.
Referenced by aml_def_alias_read().
| uint64_t aml_arg_set | ( | aml_object_t * | object, |
| aml_object_t * | value | ||
| ) |
Set a object as an argument with the given target object.
| object | Pointer to the object to initialize. |
| value | Pointer to the object the argument will point to, can be NULL. |
0. On failure, ERR and errno is set. Definition at line 1179 of file object.c.
References AML_ARG, aml_object_check_clear(), EINVAL, ERR, errno, NULL, and REF.
Referenced by aml_state_init().
| 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.
| object | Pointer to the object to initialize. |
| target | Pointer to the object to create the buffer field from, must be AML_BUFFER or AML_STRING. |
| bitOffset | Bit offset within the buffer. |
| bitSize | Size of the field in bits. |
0. On failure, ERR and errno is set. Definition at line 537 of file object.c.
References AML_BUFFER, AML_BUFFER_FIELD, aml_object_check_clear(), AML_STRING, EINVAL, ERR, errno, NULL, and REF.
Referenced by aml_def_create_bit_field_read(), aml_def_create_field_read(), aml_def_create_field_read_helper(), and aml_def_index_read().
| 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.
| object | Pointer to the object to initialize. |
| buffer | Pointer to the buffer. |
| bytesToCopy | Number of bytes to copy from buffer to the object, the rest will be zeroed. |
| length | The total length of the buffer. |
0. On failure, ERR and errno is set. Definition at line 520 of file object.c.
References aml_buffer_set_empty(), aml_object_t::buffer, buffer, aml_buffer_obj_t::content, EINVAL, ERR, errno, memcpy(), and NULL.
Referenced by aml_copy_data_and_type(), aml_def_buffer_read(), and aml_integer_to_buffer().
| uint64_t aml_buffer_set_empty | ( | aml_object_t * | object, |
| uint64_t | length | ||
| ) |
Set a object as an empty buffer with the given length.
| object | Pointer to the object to initialize. |
| length | Length of the buffer will also be the capacity. |
0. On failure, ERR and errno is set. Definition at line 487 of file object.c.
References AML_BUFFER, aml_object_check_clear(), AML_SMALL_BUFFER_SIZE, aml_object_t::buffer, aml_buffer_obj_t::content, EINVAL, ERR, errno, malloc(), memset(), and NULL.
Referenced by aml_buffer_field_load(), aml_buffer_set(), aml_concat_buffer(), aml_concat_integer(), aml_field_unit_load(), and aml_string_to_buffer().
| uint64_t aml_debug_object_set | ( | aml_object_t * | object | ) |
Set a object as a debug object.
| object | Pointer to the object to initialize. |
0. On failure, ERR and errno is set. Definition at line 564 of file object.c.
References AML_DEBUG_OBJECT, aml_object_check_clear(), EINVAL, ERR, errno, and NULL.
Referenced by aml_debug_obj_read().
| uint64_t aml_device_set | ( | aml_object_t * | object | ) |
Set a object as a device or bus.
| object | Pointer to the object to initialize. |
0. On failure, ERR and errno is set. Definition at line 581 of file object.c.
References AML_DEVICE, aml_object_check_clear(), EINVAL, ERR, errno, and NULL.
Referenced by aml_def_device_read().
| uint64_t aml_event_set | ( | aml_object_t * | object | ) |
Set a object as an event.
| object | Pointer to the object to initialize. |
0. On failure, ERR and errno is set. Definition at line 598 of file object.c.
References AML_EVENT, aml_object_check_clear(), EINVAL, ERR, errno, and NULL.
Referenced by aml_def_event_read().
| 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.
| object | Pointer to the object to initialize. |
| opregion | Pointer to the operation region. |
| bank | Pointer to the bank field. |
| bankValue | Value to write to the bank object to select the bank structure. |
| flags | Flags for the field unit. |
| bitOffset | Bit offset within the operation region. |
| bitSize | Size of the field in bits. |
0. On failure, ERR and errno is set. Definition at line 669 of file object.c.
References AML_FIELD_UNIT, AML_FIELD_UNIT_BANK_FIELD, aml_integer_set(), aml_object_check_clear(), aml_object_new(), aml_field_unit_obj_t::bank, DEREF, EINVAL, ERR, errno, aml_object_t::fieldUnit, NULL, and REF.
Referenced by aml_name_field_read().
| 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.
| object | Pointer to the object to initialize. |
| opregion | Pointer to the operation region. |
| flags | Flags for the field unit. |
| bitOffset | Bit offset within the operation region. |
| bitSize | Size of the field in bits. |
0. On failure, ERR and errno is set. Definition at line 615 of file object.c.
References AML_FIELD_UNIT, AML_FIELD_UNIT_FIELD, aml_object_check_clear(), EINVAL, ERR, errno, NULL, and REF.
Referenced by aml_name_field_read().
| 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.
| object | Pointer to the object to initialize. |
| index | Pointer to the index field. |
| data | Pointer to the data field. |
| flags | Flags for the field unit. |
| bitOffset | Bit offset within the operation region. |
| bitSize | Size of the field in bits. |
0. On failure, ERR and errno is set. Definition at line 642 of file object.c.
References AML_FIELD_UNIT, AML_FIELD_UNIT_INDEX_FIELD, aml_object_check_clear(), data, EINVAL, ERR, errno, NULL, and REF.
Referenced by aml_name_field_read().
| 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.
| object | Pointer to the object to initialize. |
| value | The integer value to set. |
0. On failure, ERR and errno is set. Definition at line 708 of file object.c.
References AML_INTEGER, aml_integer_ones(), aml_object_check_clear(), EINVAL, ERR, errno, and NULL.
Referenced by aml_buffer_field_load(), aml_buffer_to_integer(), aml_computational_data_read(), aml_const_obj_read(), aml_convert_to_integer(), aml_copy_data_and_type(), aml_def_acquire_read(), aml_def_add_read(), aml_def_and_read(), aml_def_cond_ref_of_read(), aml_def_decrement_read(), aml_def_divide_read(), aml_def_find_set_left_bit_read(), aml_def_find_set_right_bit_read(), aml_def_increment_read(), aml_def_land_read(), aml_def_lequal_read(), aml_def_lgreater_equal_read(), aml_def_lgreater_read(), aml_def_lless_equal_read(), aml_def_lless_read(), aml_def_lnot_equal_read(), aml_def_lnot_read(), aml_def_lor_read(), aml_def_match_read(), aml_def_mod_read(), aml_def_multiply_read(), aml_def_nand_read(), aml_def_nor_read(), aml_def_not_read(), aml_def_object_type_read(), aml_def_or_read(), aml_def_shift_left_read(), aml_def_shift_right_read(), aml_def_size_of_read(), aml_def_subtract_read(), aml_def_timer_read(), aml_def_to_bcd_read(), aml_def_xor_read(), aml_field_unit_bank_field_set(), aml_field_unit_load(), aml_generic_field_read_at(), aml_generic_field_write_at(), aml_osi_implementation(), aml_rev_implementation(), aml_revision_op_read(), aml_state_result_get(), and aml_string_to_integer().
| uint64_t aml_local_set | ( | aml_object_t * | object | ) |
Set a object as a empty local variable.
| object | Pointer to the object to initialize. |
0. On failure, ERR and errno is set. Definition at line 1204 of file object.c.
References AML_LOCAL, aml_object_check_clear(), aml_object_new(), EINVAL, ERR, errno, aml_object_t::local, NULL, and aml_local_obj_t::value.
Referenced by aml_local_obj_read().
| aml_method_obj_t * aml_method_find | ( | const uint8_t * | addr | ) |
Find the method which contains the provided address in its AML bytecode range.
| addr | The address to search for. |
NULL and errno is set. Definition at line 794 of file object.c.
References aml_method_find_recursive(), aml_namespace_get_root(), DEREF_DEFER, EINVAL, errno, and NULL.
Referenced by aml_debug_error().
| 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.
| object | Pointer to the object to initialize. |
| flags | Flags for the method. |
| start | Pointer to the start of the method's AML bytecode. |
| end | Pointer to the end of the method's AML bytecode. |
| implementation | Pointer to a C function that will execute the method, or NULL if the method is a normal AML method. |
0. On failure, ERR and errno is set. Definition at line 732 of file object.c.
References AML_METHOD, aml_mutex_id_init(), aml_object_check_clear(), EINVAL, ERR, errno, aml_object_t::method, aml_method_obj_t::mutex, NULL, and start().
Referenced by aml_def_method_read(), and aml_predefined_init().
| 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.
| object | Pointer to the object to initialize. |
| syncLevel | The synchronization level of the mutex (0-15). |
0. On failure, ERR and errno is set. Definition at line 812 of file object.c.
References AML_MUTEX, aml_mutex_id_init(), aml_object_check_clear(), EINVAL, ERR, errno, aml_mutex_obj_t::mutex, aml_object_t::mutex, and NULL.
Referenced by aml_def_mutex_read(), and aml_predefined_init().
| void aml_object_clear | ( | aml_object_t * | object | ) |
Clear the data of a object, setting its type to AML_UNINITIALIZED.
| object | Pointer to the object to clear. |
Definition at line 87 of file object.c.
References aml_object_t::alias, AML_ALIAS, AML_ARG, AML_BUFFER, AML_BUFFER_FIELD, AML_DEBUG_OBJECT, AML_DEVICE, AML_EVENT, AML_FIELD_UNIT, AML_FIELD_UNIT_BANK_FIELD, AML_FIELD_UNIT_FIELD, AML_FIELD_UNIT_INDEX_FIELD, AML_INTEGER, AML_LOCAL, AML_METHOD, AML_MUTEX, aml_mutex_id_deinit(), aml_namespace_remove(), AML_NAMESPACES, AML_OBJECT_REFERENCE, AML_OPERATION_REGION, AML_PACKAGE, aml_patch_up_remove_unresolved(), AML_POWER_RESOURCE, AML_PREDEFINED_SCOPE, AML_PROCESSOR, AML_SMALL_BUFFER_SIZE, AML_SMALL_PACKAGE_SIZE, AML_SMALL_STRING_SIZE, AML_STRING, AML_THERMAL_ZONE, AML_UNINITIALIZED, AML_UNRESOLVED, aml_object_t::arg, aml_field_unit_obj_t::bank, aml_field_unit_obj_t::bankValue, aml_object_t::buffer, aml_object_t::bufferField, aml_buffer_obj_t::content, aml_string_obj_t::content, aml_field_unit_obj_t::data, DEREF, aml_package_obj_t::elements, aml_field_unit_obj_t::fieldType, aml_object_t::fieldUnit, free(), aml_unresolved_obj_t::from, aml_field_unit_obj_t::index, aml_buffer_obj_t::length, aml_package_obj_t::length, aml_string_obj_t::length, LIST_FOR_EACH_SAFE, aml_object_t::local, aml_object_t::method, aml_method_obj_t::mutex, aml_mutex_obj_t::mutex, aml_object_t::mutex, NULL, aml_object_t::objectReference, aml_field_unit_obj_t::opregion, aml_object_t::package, panic(), aml_object_t::string, aml_buffer_field_obj_t::target, aml_object_reference_obj_t::target, aml_alias_obj_t::target, aml_object_t::unresolved, aml_arg_obj_t::value, and aml_local_obj_t::value.
Referenced by aml_buffer_field_load(), aml_copy_data_and_type(), aml_def_package_read(), aml_def_var_package_read(), aml_generic_field_read_at(), aml_generic_field_write_at(), aml_object_check_clear(), aml_object_free(), and aml_package_element_list_read().
| uint64_t aml_object_count_children | ( | aml_object_t * | parent | ) |
Recursively count how many children an object has.
This will also count package elements, any cached byteFields, etc. All objects that are owned by the parent object will be counted.
| parent | Pointer to the parent object. |
Definition at line 264 of file object.c.
References AML_FIELD_UNIT, AML_NAMESPACES, aml_object_count_children(), AML_PACKAGE, aml_field_unit_obj_t::bankValue, count, aml_package_obj_t::elements, aml_object_t::fieldUnit, aml_package_obj_t::length, LIST_FOR_EACH, NULL, and aml_object_t::package.
Referenced by aml_object_count_children().
| 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.
This will also clear the flag so the exception is only raised once.
| object | Pointer to the object to check. |
| state | The current AML state, used to raise the exception. |
Definition at line 461 of file object.c.
References AML_EXCEPTION_RAISE, AML_OBJECT_EXCEPTION_ON_USE, and AML_PARSE.
Referenced by aml_term_arg_read().
| 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.
Only supports Integers, Strings and Buffers.
If a out of bounds access is attempted, the bits that are out of bounds will be read as zero.
All objects, Intergers, Strings and Buffers are read from as if they were little-endian Integers.
| object | Pointer to the object to extract bits from. |
| bitOffset | The bit offset within the object's data to start extracting from. |
| bitSize | The number of bits to store, out must be large enough to hold this many bits. |
| out | Pointer to a buffer where the extracted bits will be stored. |
0. On failure, ERR and errno is set. Definition at line 399 of file object.c.
References AML_BUFFER, aml_copy_bits(), AML_INTEGER, aml_integer_bit_size(), aml_integer_ones(), AML_STRING, aml_string_obj_t::content, EINVAL, ERR, errno, memset(), NULL, and aml_object_t::string.
Referenced by aml_buffer_field_load(), aml_buffer_field_store(), and aml_field_unit_access().
| uint64_t aml_object_get_total_count | ( | void | ) |
Get the total amount of allocated ACPI objects.
Definition at line 24 of file object.c.
References totalObjects.
| aml_object_t * aml_object_new | ( | void | ) |
Allocate a new ACPI object.
There is no aml_object_free() instead always use DEREF() to free an object, since objects are reference counted.
You could also use DEREF_DEFER() to dereference the object when the current scope ends.
NULL and errno is set. Definition at line 54 of file object.c.
References AML_NAME_UNDEFINED, aml_object_free(), AML_OBJECT_NONE, AML_UNINITIALIZED, calloc(), CONTAINER_OF_SAFE, list_entry_init(), list_init(), list_is_empty(), list_pop(), map_entry_init(), newObjectId, NULL, objectsCache, ref_init(), and totalObjects.
Referenced by aml_convert(), aml_convert_source(), aml_convert_to_buffer(), aml_convert_to_decimal_string(), aml_convert_to_hex_string(), aml_convert_to_integer(), aml_copy_object(), aml_create_predefined_scope(), aml_debug_obj_read(), aml_def_acquire_read(), aml_def_add_read(), aml_def_alias_read(), aml_def_and_read(), aml_def_concat_read(), aml_def_cond_ref_of_read(), aml_def_create_bit_field_read(), aml_def_create_field_read(), aml_def_create_field_read_helper(), aml_def_data_region_read(), aml_def_decrement_read(), aml_def_device_read(), aml_def_divide_read(), aml_def_event_read(), aml_def_find_set_left_bit_read(), aml_def_find_set_right_bit_read(), aml_def_increment_read(), aml_def_index_read(), aml_def_land_read(), aml_def_lequal_read(), aml_def_lgreater_equal_read(), aml_def_lgreater_read(), aml_def_lless_equal_read(), aml_def_lless_read(), aml_def_lnot_equal_read(), aml_def_lnot_read(), aml_def_lor_read(), aml_def_match_read(), aml_def_method_read(), aml_def_mod_read(), aml_def_multiply_read(), aml_def_mutex_read(), aml_def_name_read(), aml_def_nand_read(), aml_def_nor_read(), aml_def_not_read(), aml_def_object_type_read(), aml_def_opregion_read(), aml_def_or_read(), aml_def_power_res_read(), aml_def_processor_read(), aml_def_ref_of_read(), aml_def_shift_left_read(), aml_def_shift_right_read(), aml_def_size_of_read(), aml_def_subtract_read(), aml_def_thermal_zone_read(), aml_def_timer_read(), aml_def_to_bcd_read(), aml_def_to_string_read(), aml_def_xor_read(), aml_expression_opcode_read(), aml_field_unit_bank_field_set(), aml_generic_field_read_at(), aml_generic_field_write_at(), aml_init(), aml_local_obj_read(), aml_local_set(), aml_name_field_read(), aml_os_implementation(), aml_osi_implementation(), aml_package_set(), aml_predefined_init(), aml_rev_implementation(), aml_state_init(), aml_state_result_get(), aml_store(), and aml_term_arg_read().
| 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.
| object | Pointer to the object to initialize. |
| target | Pointer to the target object the ObjectReference will point to. |
0. On failure, ERR and errno is set. Definition at line 831 of file object.c.
References aml_object_check_clear(), AML_OBJECT_REFERENCE, EINVAL, ERR, errno, NULL, and REF.
Referenced by aml_copy_data_and_type(), aml_def_cond_ref_of_read(), aml_def_index_read(), aml_def_ref_of_read(), and aml_package_element_handle_name().
| 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.
Only supports Integers, Strings and Buffers.
If a out of bounds access is attempted, the bits that are out of bounds will be ignored.
All objects, Intergers, Strings and Buffers are writen to as if they were little-endian Integers.
| object | Pointer to the object to store bits into. |
| bitOffset | The bit offset within the object's data to start storing to. |
| bitSize | The number of bits to store, in must be large enough to hold this many bits. |
| in | Pointer to a buffer containing the bits to store. |
0. On failure, ERR and errno is set. Definition at line 338 of file object.c.
References AML_BUFFER, aml_copy_bits(), AML_INTEGER, aml_integer_bit_size(), aml_integer_ones(), AML_STRING, aml_string_obj_t::content, data, EINVAL, ERR, errno, NULL, and aml_object_t::string.
Referenced by aml_buffer_field_load(), aml_buffer_field_store(), and aml_field_unit_access().
| 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.
| object | Pointer to the object to initialize. |
| space | The address space of the operation region. |
| offset | The offset within the address space. |
| length | The length of the operation region. |
0. On failure, ERR and errno is set. Definition at line 849 of file object.c.
References aml_object_check_clear(), AML_OPERATION_REGION, EINVAL, ERR, errno, and NULL.
Referenced by aml_def_data_region_read(), and aml_def_opregion_read().
| uint64_t aml_package_set | ( | aml_object_t * | object, |
| uint64_t | length | ||
| ) |
Set a object as a package with the given number of elements.
| object | Pointer to the object to initialize. |
| length | Number of elements the package will be able to hold. |
0. On failure, ERR and errno is set. Definition at line 869 of file object.c.
References aml_object_check_clear(), aml_object_new(), AML_PACKAGE, AML_SMALL_PACKAGE_SIZE, DEREF, EINVAL, aml_package_obj_t::elements, ERR, errno, free(), malloc(), memset(), NULL, and aml_object_t::package.
Referenced by aml_copy_data_and_type(), aml_def_package_read(), and aml_def_var_package_read().
| 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.
| object | Pointer to the object to initialize. |
| systemLevel | The system level of the power resource. |
| resourceOrder | The resource order of the power resource. |
0. On failure, ERR and errno is set. Definition at line 915 of file object.c.
References aml_object_check_clear(), AML_POWER_RESOURCE, EINVAL, ERR, errno, and NULL.
Referenced by aml_def_power_res_read().
| uint64_t aml_predefined_scope_set | ( | aml_object_t * | object | ) |
Set a object as a predefined scope with the given name.
This is used to implement predefined scopes like _SB, _GPE, etc.
| object | Pointer to the object to initialize. |
0. On failure, ERR and errno is set. Definition at line 1162 of file object.c.
References aml_object_check_clear(), AML_PREDEFINED_SCOPE, EINVAL, ERR, errno, and NULL.
Referenced by aml_create_predefined_scope(), and aml_init().
| 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.
| object | Pointer to the object to initialize. |
| procId | The processor ID. |
| pblkAddr | The pblk address. |
| pblkLen | The length of the pblk. |
0. On failure, ERR and errno is set. Definition at line 935 of file object.c.
References aml_object_check_clear(), AML_PROCESSOR, EINVAL, ERR, errno, and NULL.
Referenced by aml_def_processor_read().
| uint64_t aml_string_resize | ( | aml_string_obj_t * | string, |
| uint64_t | newLength | ||
| ) |
Resize a string object to the new length.
If the new length is greater than the current length, the new bytes will be initialized to zero.
| string | Pointer to the string object to resize. |
| newLength | The new length of the string, not including the null terminator. |
ERR and errno is set. Definition at line 1005 of file object.c.
References AML_SMALL_STRING_SIZE, aml_string_obj_t::content, EINVAL, ERR, errno, free(), aml_string_obj_t::length, malloc(), memcpy(), memset(), NULL, and aml_string_obj_t::smallString.
Referenced by aml_string_prepare().
| uint64_t aml_string_set | ( | aml_object_t * | object, |
| const char * | str | ||
| ) |
Set a object as a string with the given value.
| object | Pointer to the object to initialize. |
| str | Pointer to the string. |
0. On failure, ERR and errno is set. Definition at line 988 of file object.c.
References aml_string_set_empty(), aml_string_obj_t::content, EINVAL, ERR, errno, memcpy(), NULL, aml_object_t::string, and strlen().
Referenced by aml_copy_data_and_type(), aml_os_implementation(), and aml_string_read().
| uint64_t aml_string_set_empty | ( | aml_object_t * | object, |
| uint64_t | length | ||
| ) |
Set a object as an empty string with the given length.
The string will be initalized with zero chars and be null terminated.
| object | Pointer to the object to initialize. |
| length | Length of the string, not including the null terminator. |
0. On failure, ERR and errno is set. Definition at line 955 of file object.c.
References aml_object_check_clear(), AML_SMALL_STRING_SIZE, AML_STRING, aml_string_obj_t::content, EINVAL, ERR, errno, malloc(), memset(), NULL, and aml_object_t::string.
Referenced by aml_concat_other_types(), aml_concat_string(), aml_convert_to_decimal_string(), aml_convert_to_hex_string(), aml_def_to_string_read(), aml_string_prepare(), and aml_string_set().
| uint64_t aml_thermal_zone_set | ( | aml_object_t * | object | ) |
Set a object as a thermal zone.
| object | Pointer to the object to initialize. |
0. On failure, ERR and errno is set. Definition at line 1079 of file object.c.
References aml_object_check_clear(), AML_THERMAL_ZONE, EINVAL, ERR, errno, and NULL.
Referenced by aml_def_thermal_zone_read().
| 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.
The object will be resolved later by calling aml_patch_up_resolve_all().
| object | Pointer to the object to initialize. |
| nameString | Pointer to the namestring representing the path to the target object. |
| from | Pointer to the object to start the search from, can be NULL to start from the root. |
| callback | Pointer to a callback function that will be called when a matching object is found |
0. On failure, ERR and errno is set. Definition at line 1135 of file object.c.
References aml_object_check_clear(), aml_patch_up_add_unresolved(), AML_UNINITIALIZED, AML_UNRESOLVED, EINVAL, ERR, errno, aml_unresolved_obj_t::nameString, NULL, REF, and aml_object_t::unresolved.
Referenced by aml_package_element_read().