PatchworkOS
Loading...
Searching...
No Matches
object.c File Reference
#include <kernel/acpi/aml/object.h>
#include <kernel/acpi/acpi.h>
#include <kernel/acpi/aml/aml.h>
#include <kernel/acpi/aml/exception.h>
#include <kernel/acpi/aml/to_string.h>
#include <kernel/acpi/aml/token.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/math.h>

Go to the source code of this file.

Functions

uint64_t aml_object_get_total_count (void)
 Get the total amount of allocated ACPI objects.
 
static void aml_object_free (aml_object_t *object)
 
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.
 
static void aml_copy_bits (uint8_t *dst, uint64_t dstOffset, const uint8_t *src, uint64_t srcOffset, uint64_t bitCount)
 
uint64_t aml_object_set_bits_at (aml_object_t *object, aml_bit_size_t bitOffset, aml_bit_size_t bitSize, uint8_t *data)
 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.
 
static uint64_t aml_object_check_clear (aml_object_t *object)
 
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_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_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.
 
static aml_method_obj_taml_method_find_recursive (aml_object_t *current, const uint8_t *addr)
 
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.
 

Variables

static uint64_t totalObjects = 0
 
static list_t objectsCache = LIST_CREATE(objectsCache)
 
static aml_object_id_t newObjectId = AML_OBJECT_ID_NONE + 1
 

Function Documentation

◆ aml_copy_bits()

static void aml_copy_bits ( uint8_t dst,
uint64_t  dstOffset,
const uint8_t src,
uint64_t  srcOffset,
uint64_t  bitCount 
)
inlinestatic

Definition at line 311 of file object.c.

Referenced by aml_object_get_bits_at(), and aml_object_set_bits_at().

◆ aml_method_find_recursive()

static aml_method_obj_t * aml_method_find_recursive ( aml_object_t current,
const uint8_t addr 
)
inlinestatic

◆ aml_object_check_clear()

◆ aml_object_free()

static void aml_object_free ( aml_object_t object)
static

Variable Documentation

◆ newObjectId

aml_object_id_t newObjectId = AML_OBJECT_ID_NONE + 1
static

Definition at line 22 of file object.c.

Referenced by aml_object_new().

◆ objectsCache

list_t objectsCache = LIST_CREATE(objectsCache)
static

Definition at line 20 of file object.c.

Referenced by aml_object_free(), and aml_object_new().

◆ totalObjects

uint64_t totalObjects = 0
static

Definition at line 17 of file object.c.

Referenced by aml_object_free(), aml_object_get_total_count(), and aml_object_new().