PatchworkOS
Loading...
Searching...
No Matches
Name Objects

Name Objects Encoding. More...

Data Structures

struct  aml_prefix_path_t
 A PrefixPath structure. More...
 
struct  aml_root_char_t
 A RootChar structure. More...
 
struct  aml_name_path_t
 Represents the NamePath, DualNamePath, MultiNamePath and NullPath structures. More...
 
struct  aml_name_string_t
 A NameString structure. More...
 
struct  aml_field_flags_t
 FieldFlags structure. More...
 
struct  aml_field_list_ctx_t
 Context passed to lower functions by aml_field_list_read(). More...
 
struct  aml_method_flags_t
 MethodFlags structure. More...
 
struct  aml_name_seg_t
 A NameSeg strcture. More...
 

Macros

#define AML_IS_LEAD_NAME_CHAR(token)    (((token)->num >= AML_NAME_CHAR_A && (token)->num <= AML_NAME_CHAR_Z) || (token)->num == AML_NAME_CHAR)
 Check if a token is a LeadNameChar structure.
 
#define AML_IS_DIGIT_CHAR(token)   (((token)->num >= AML_DIGIT_CHAR_0 && (token)->num <= AML_DIGIT_CHAR_9))
 Check if a token is a DigitChar structure.
 
#define AML_IS_NAME_CHAR(token)   (AML_IS_DIGIT_CHAR(token) || AML_IS_LEAD_NAME_CHAR(token))
 Check if a token is a NameChar structure.
 

Typedefs

typedef uint32_t aml_name_seg_t
 
typedef uint8_t aml_sync_level_t
 
typedef uint8_t aml_proc_id_t
 ProcID structure, deprecated in version 6.4 of the ACPI specification.
 
typedef uint32_t aml_pblk_addr_t
 PblkAddr structure, deprecated in version 6.4 of the ACPI specification.
 
typedef uint8_t aml_pblk_len_t
 PblkLen structure, deprecated in version 6.4 of the ACPI specification.
 
typedef uint8_t aml_system_level_t
 SystemLevel structure.
 
typedef uint16_t aml_resource_order_t
 ResourceOrder structure.
 

Enumerations

enum  aml_region_space_t {
  AML_REGION_SYSTEM_MEMORY = 0x00 ,
  AML_REGION_SYSTEM_IO = 0x01 ,
  AML_REGION_PCI_CONFIG = 0x02 ,
  AML_REGION_EMBEDDED_CONTROL = 0x03 ,
  AML_REGION_SM_BUS = 0x04 ,
  AML_REGION_SYSTEM_CMOS = 0x05 ,
  AML_REGION_PCI_BAR_TARGET = 0x06 ,
  AML_REGION_IPMI = 0x07 ,
  AML_REGION_GENERAL_PURPOSE_IO = 0x08 ,
  AML_REGION_GENERIC_SERIAL_BUS = 0x09 ,
  AML_REGION_PCC = 0x0A ,
  AML_REGION_OEM_MIN = 0x80 ,
  AML_REGION_OEM_MAX = 0xFF
}
 Region Space Encoding. More...
 
enum  aml_access_type_t {
  AML_ACCESS_TYPE_ANY = 0 ,
  AML_ACCESS_TYPE_BYTE = 1 ,
  AML_ACCESS_TYPE_WORD = 2 ,
  AML_ACCESS_TYPE_DWORD = 3 ,
  AML_ACCESS_TYPE_QWORD = 4 ,
  AML_ACCESS_TYPE_BUFFER = 5
}
 Enum for all field access types, bits 0-3 of FieldFlags. More...
 
enum  aml_lock_rule_t {
  AML_LOCK_RULE_NO_LOCK = 0 ,
  AML_LOCK_RULE_LOCK = 1
}
 Enum for all field lock rules, bit 4 of FieldFlags. More...
 
enum  aml_update_rule_t {
  AML_UPDATE_RULE_PRESERVE = 0 ,
  AML_UPDATE_RULE_WRITE_AS_ONES = 1 ,
  AML_UPDATE_RULE_WRITE_AS_ZEROS = 2
}
 Enum for all field update rules, bits 5-6 of FieldFlags. More...
 
enum  aml_field_list_type_t {
  AML_FIELD_LIST_TYPE_FIELD ,
  AML_FIELD_LIST_TYPE_INDEX_FIELD ,
  AML_FIELD_LIST_TYPE_BANK_FIELD
}
 Enum for all FieldList types. More...
 

Functions

uint64_t aml_seg_count_read (aml_term_list_ctx_t *ctx, uint8_t *out)
 Reads the next data as a SegCount structure from the AML bytecode stream.
 
uint64_t aml_name_seg_read (aml_term_list_ctx_t *ctx, aml_name_seg_t **out)
 Reads the next data as a NameSeg from the AML bytecode stream.
 
uint64_t aml_dual_name_path_read (aml_term_list_ctx_t *ctx, aml_name_seg_t **out)
 Reads the next data as a DualNamePath structure from the AML bytecode stream.
 
uint64_t aml_multi_name_path_read (aml_term_list_ctx_t *ctx, aml_name_seg_t **outSegments, uint64_t *outSegCount)
 Reads the next data as a MultiNamePath structure from the AML bytecode stream.
 
uint64_t aml_null_name_read (aml_term_list_ctx_t *ctx)
 
uint64_t aml_name_path_read (aml_term_list_ctx_t *ctx, aml_name_path_t *out)
 Reads the next data as a NamePath structure from the AML bytecode stream.
 
uint64_t aml_prefix_path_read (aml_term_list_ctx_t *ctx, aml_prefix_path_t *out)
 Reads the next data as a PrefixPath structure from the AML bytecode stream.
 
uint64_t aml_root_char_read (aml_term_list_ctx_t *ctx, aml_root_char_t *out)
 Reads the next data as a RootChar from the AML bytecode stream.
 
uint64_t aml_name_string_read (aml_term_list_ctx_t *ctx, aml_name_string_t *out)
 Reads the next data as a NameString structure from the AML bytecode stream.
 
aml_object_taml_name_string_read_and_resolve (aml_term_list_ctx_t *ctx)
 Reads the next data as a NameString structure from the AML bytecode stream and resolves it to a object.
 
aml_object_taml_simple_name_read_and_resolve (aml_term_list_ctx_t *ctx)
 Reads a SimpleName structure from the AML byte stream and resolves it to a object.
 
aml_object_taml_super_name_read_and_resolve (aml_term_list_ctx_t *ctx)
 Reads a SuperName structure from the AML byte stream and resolves it to a object.
 
uint64_t aml_target_read_and_resolve (aml_term_list_ctx_t *ctx, aml_object_t **out)
 Reads a Target structure from the AML byte stream and resolves it to a object.
 
uint64_t aml_bank_value_read (aml_term_list_ctx_t *ctx, aml_integer_t *out)
 Reads a BankValue structure from the AML byte stream.
 
uint64_t aml_region_space_read (aml_term_list_ctx_t *ctx, aml_region_space_t *out)
 Reads a RegionSpace structure from the AML byte stream.
 
uint64_t aml_region_offset_read (aml_term_list_ctx_t *ctx, aml_integer_t *out)
 Reads a RegionOffset structure from the AML byte stream.
 
uint64_t aml_region_len_read (aml_term_list_ctx_t *ctx, aml_integer_t *out)
 Reads a RegionLen structure from the AML byte stream.
 
uint64_t aml_def_opregion_read (aml_term_list_ctx_t *ctx)
 Reads a DefOpRegion structure from the AML byte stream.
 
uint64_t aml_field_flags_read (aml_term_list_ctx_t *ctx, aml_field_flags_t *out)
 Reads a FieldFlags structure from the AML byte stream.
 
uint64_t aml_name_field_read (aml_term_list_ctx_t *ctx, aml_field_list_ctx_t *fieldCtx)
 Reads a NamedField structure from the AML byte stream.
 
uint64_t aml_reserved_field_read (aml_term_list_ctx_t *ctx, aml_field_list_ctx_t *fieldCtx)
 Reads a ReservedField structure from the AML byte stream.
 
uint64_t aml_field_element_read (aml_term_list_ctx_t *ctx, aml_field_list_ctx_t *fieldCtx)
 Reads a FieldElement structure from the AML byte stream.
 
uint64_t aml_field_list_read (aml_term_list_ctx_t *ctx, aml_field_list_ctx_t *fieldCtx, const uint8_t *end)
 Reads a FieldList structure from the AML byte stream.
 
uint64_t aml_def_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefField structure from the AML byte stream.
 
uint64_t aml_def_index_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefIndexField structure from the AML byte stream.
 
uint64_t aml_def_bank_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefBankField structure from the AML byte stream.
 
uint64_t aml_method_flags_read (aml_term_list_ctx_t *ctx, aml_method_flags_t *out)
 Reads a MethodFlags structure from the AML byte stream.
 
uint64_t aml_def_method_read (aml_term_list_ctx_t *ctx)
 Reads a DefMethod structure from the AML byte stream.
 
uint64_t aml_def_device_read (aml_term_list_ctx_t *ctx)
 Reads a DefDevice structure from the AML byte stream.
 
uint64_t aml_sync_flags_read (aml_term_list_ctx_t *ctx, aml_sync_level_t *out)
 Reads a SyncFlags structure from the AML byte stream.
 
uint64_t aml_def_mutex_read (aml_term_list_ctx_t *ctx)
 Reads a DefMutex structure from the AML byte stream.
 
uint64_t aml_proc_id_read (aml_term_list_ctx_t *ctx, aml_proc_id_t *out)
 Reads a ProcID structure from the AML byte stream. Deprecated in ACPI 6.4 but still supported.
 
uint64_t aml_pblk_addr_read (aml_term_list_ctx_t *ctx, aml_pblk_addr_t *out)
 Reads a PblkAddr structure from the AML byte stream. Deprecated in ACPI 6.4 but still supported.
 
uint64_t aml_pblk_len_read (aml_term_list_ctx_t *ctx, aml_pblk_len_t *out)
 Reads a PblkLen structure from the AML byte stream. Deprecated in ACPI 6.4 but still supported.
 
uint64_t aml_def_processor_read (aml_term_list_ctx_t *ctx)
 Reads a DefProcessor structure from the AML byte stream. Deprecated in ACPI 6.4 but still supported.
 
aml_object_taml_source_buff_read (aml_term_list_ctx_t *ctx)
 Reads a SourceBuff structure from the AML byte stream.
 
uint64_t aml_bit_index_read (aml_term_list_ctx_t *ctx, aml_integer_t *out)
 Reads a BitIndex structure from the AML byte stream.
 
uint64_t aml_byte_index_read (aml_term_list_ctx_t *ctx, aml_integer_t *out)
 Reads a ByteIndex structure from the AML byte stream.
 
uint64_t aml_def_create_bit_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefCreateBitField structure from the AML byte stream.
 
uint64_t aml_def_create_byte_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefCreateByteField structure from the AML byte stream.
 
uint64_t aml_def_create_word_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefCreateWordField structure from the AML byte stream.
 
uint64_t aml_def_create_dword_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefCreateDWordField structure from the AML byte stream.
 
uint64_t aml_def_create_qword_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefCreateQWordField structure from the AML byte stream.
 
uint64_t aml_def_event_read (aml_term_list_ctx_t *ctx)
 Reads a DefEvent structure from the AML byte stream.
 
uint64_t aml_def_thermal_zone_read (aml_term_list_ctx_t *ctx)
 Reads a DefThermalZone structure from the AML byte stream.
 
uint64_t aml_system_level_read (aml_term_list_ctx_t *ctx, aml_system_level_t *out)
 Reads a SystemLevel structure from the AML byte stream.
 
uint64_t aml_resource_order_read (aml_term_list_ctx_t *ctx, aml_resource_order_t *out)
 Reads a ResourceOrder structure from the AML byte stream.
 
uint64_t aml_def_power_res_read (aml_term_list_ctx_t *ctx)
 Reads a DefPowerRes structure from the AML byte stream.
 
uint64_t aml_num_bits_read (aml_term_list_ctx_t *ctx, aml_integer_t *out)
 Reads a NumBits structure from the AML byte stream.
 
uint64_t aml_def_create_field_read (aml_term_list_ctx_t *ctx)
 Reads a DefCreateField structure from the AML byte stream.
 
uint64_t aml_def_data_region_read (aml_term_list_ctx_t *ctx)
 Reads a DefDataRegion structure from the AML byte stream.
 
uint64_t aml_named_obj_read (aml_term_list_ctx_t *ctx)
 Reads a NamedObj structure from the AML byte stream.
 

Detailed Description

Name Objects Encoding.

Named Objects Encoding.

Not to be confused with "ACPI AML Named Objects Encoding".

See also
Section 20.2.2 of the ACPI specification for more details.

Not to be confused with "ACPI AML Name Objects Encoding".

See also
Section 20.2.5.2 of the ACPI specification for more details.

Macro Definition Documentation

◆ AML_IS_DIGIT_CHAR

#define AML_IS_DIGIT_CHAR (   token)    (((token)->num >= AML_DIGIT_CHAR_0 && (token)->num <= AML_DIGIT_CHAR_9))

Check if a token is a DigitChar structure.

Parameters
tokenThe token to check.
Returns
true if the token is a DigitChar structure, false otherwise.

Definition at line 37 of file name.h.

◆ AML_IS_LEAD_NAME_CHAR

#define AML_IS_LEAD_NAME_CHAR (   token)     (((token)->num >= AML_NAME_CHAR_A && (token)->num <= AML_NAME_CHAR_Z) || (token)->num == AML_NAME_CHAR)

Check if a token is a LeadNameChar structure.

Parameters
tokenThe token to check.
Returns
true if the token is a LeadNameChar structure, false otherwise.

Definition at line 28 of file name.h.

◆ AML_IS_NAME_CHAR

#define AML_IS_NAME_CHAR (   token)    (AML_IS_DIGIT_CHAR(token) || AML_IS_LEAD_NAME_CHAR(token))

Check if a token is a NameChar structure.

Parameters
tokenThe token to check.
Returns
true if the token is a NameChar structure, false otherwise.

Definition at line 45 of file name.h.

Typedef Documentation

◆ aml_name_seg_t

Definition at line 70 of file name.h.

◆ aml_pblk_addr_t

PblkAddr structure, deprecated in version 6.4 of the ACPI specification.

Definition at line 156 of file named.h.

◆ aml_pblk_len_t

PblkLen structure, deprecated in version 6.4 of the ACPI specification.

Definition at line 161 of file named.h.

◆ aml_proc_id_t

ProcID structure, deprecated in version 6.4 of the ACPI specification.

Definition at line 151 of file named.h.

◆ aml_resource_order_t

ResourceOrder structure.

Definition at line 171 of file named.h.

◆ aml_sync_level_t

Definition at line 135 of file named.h.

◆ aml_system_level_t

SystemLevel structure.

Definition at line 166 of file named.h.

Enumeration Type Documentation

◆ aml_access_type_t

Enum for all field access types, bits 0-3 of FieldFlags.

Enumerator
AML_ACCESS_TYPE_ANY 
AML_ACCESS_TYPE_BYTE 
AML_ACCESS_TYPE_WORD 
AML_ACCESS_TYPE_DWORD 
AML_ACCESS_TYPE_QWORD 
AML_ACCESS_TYPE_BUFFER 

Definition at line 50 of file named.h.

◆ aml_field_list_type_t

Enum for all FieldList types.

Enumerator
AML_FIELD_LIST_TYPE_FIELD 

FieldList is part of a DefField.

AML_FIELD_LIST_TYPE_INDEX_FIELD 

FieldList is part of an IndexField.

AML_FIELD_LIST_TYPE_BANK_FIELD 

FieldList is part of a BankField.

Definition at line 96 of file named.h.

◆ aml_lock_rule_t

Enum for all field lock rules, bit 4 of FieldFlags.

Enumerator
AML_LOCK_RULE_NO_LOCK 
AML_LOCK_RULE_LOCK 

Definition at line 64 of file named.h.

◆ aml_region_space_t

Region Space Encoding.

Enumerator
AML_REGION_SYSTEM_MEMORY 
AML_REGION_SYSTEM_IO 
AML_REGION_PCI_CONFIG 
AML_REGION_EMBEDDED_CONTROL 
AML_REGION_SM_BUS 
AML_REGION_SYSTEM_CMOS 
AML_REGION_PCI_BAR_TARGET 
AML_REGION_IPMI 
AML_REGION_GENERAL_PURPOSE_IO 
AML_REGION_GENERIC_SERIAL_BUS 
AML_REGION_PCC 
AML_REGION_OEM_MIN 
AML_REGION_OEM_MAX 

Definition at line 29 of file named.h.

◆ aml_update_rule_t

Enum for all field update rules, bits 5-6 of FieldFlags.

Enumerator
AML_UPDATE_RULE_PRESERVE 
AML_UPDATE_RULE_WRITE_AS_ONES 
AML_UPDATE_RULE_WRITE_AS_ZEROS 

Definition at line 74 of file named.h.

Function Documentation

◆ aml_bank_value_read()

uint64_t aml_bank_value_read ( aml_term_list_ctx_t ctx,
aml_integer_t out 
)

Reads a BankValue structure from the AML byte stream.

A BankValue structure is defined as BankValue := TermArg => Integer.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the bank value.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 15 of file named.c.

References AML_DEBUG_ERROR, aml_term_arg_read_integer(), and ERR.

Referenced by aml_def_bank_field_read().

◆ aml_bit_index_read()

uint64_t aml_bit_index_read ( aml_term_list_ctx_t ctx,
aml_integer_t out 
)

Reads a BitIndex structure from the AML byte stream.

A BitIndex structure is defined as BitIndex := TermArg => Integer.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe destination buffer to store the BitIndex.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 815 of file named.c.

References AML_DEBUG_ERROR, aml_term_arg_read_integer(), and ERR.

Referenced by aml_def_create_bit_field_read(), and aml_def_create_field_read().

◆ aml_byte_index_read()

uint64_t aml_byte_index_read ( aml_term_list_ctx_t ctx,
aml_integer_t out 
)

Reads a ByteIndex structure from the AML byte stream.

A ByteIndex structure is defined as ByteIndex := TermArg => Integer.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe destination buffer to store the ByteIndex.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 826 of file named.c.

References AML_DEBUG_ERROR, aml_term_arg_read_integer(), and ERR.

Referenced by aml_def_create_field_read_helper().

◆ aml_def_bank_field_read()

uint64_t aml_def_bank_field_read ( aml_term_list_ctx_t ctx)

Reads a DefBankField structure from the AML byte stream.

The DefBankField structure is defined as DefBankField := BankFieldOp PkgLength NameString NameString BankValue FieldFlags FieldList.

BankFields can be even more confusing then IndexFields. A BankField allows for the same opregion to be accessed using different field configurations, by switching between different banks. Each BankField as an ID, the BankValue, and you have some object, pointed to by the second NameString, such that when you read from a BankField, the BankValue is first written to the object to select the bank structure associated with that BankField.

Basically you can change the structure of an opregion by selecting different banks.

See also
Section 19.6.7 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 451 of file named.c.

References AML_BANK_FIELD_OP, aml_bank_value_read(), AML_DEBUG_ERROR, aml_field_flags_read(), aml_field_list_read(), AML_FIELD_LIST_TYPE_BANK_FIELD, aml_name_string_read_and_resolve(), aml_pkg_length_read(), aml_token_expect(), aml_field_unit_obj_t::bank, aml_field_unit_obj_t::bankValue, aml_term_list_ctx_t::current, DEREF_DEFER, ERR, aml_object_t::fieldUnit, NULL, aml_object_t::opregion, start(), and aml_field_list_ctx_t::type.

Referenced by aml_named_obj_read().

◆ aml_def_create_bit_field_read()

uint64_t aml_def_create_bit_field_read ( aml_term_list_ctx_t ctx)

Reads a DefCreateBitField structure from the AML byte stream.

The DefCreateBitField structure is defined as DefCreateBitField := CreateBitFieldOp SourceBuff BitIndex NameString.

A CreateBitField operation creates a field, with the name stored in the NameString, that accesses the single bit with the index BitIndex within the SourceBuff.

So if BitIndex is 6 and SourceBuff is a buffer with the value 0b10101010, then reading the created bit field will return 1, and writing 0 to it will change SourceBuff to 0b10101000.

The other CreateXField operations work similarly, but for different sizes of fields and use byte indices instead of bit indices.

See also
Section 19.6.18 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 837 of file named.c.

References aml_bit_index_read(), AML_BUFFER, aml_buffer_field_set(), AML_CREATE_BIT_FIELD_OP, AML_DEBUG_ERROR, aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_source_buff_read(), aml_token_expect(), assert, DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_create_byte_field_read()

uint64_t aml_def_create_byte_field_read ( aml_term_list_ctx_t ctx)

Reads a DefCreateByteField structure from the AML byte stream.

The DefCreateByteField structure is defined as DefCreateByteField := CreateByteFieldOp SourceBuff ByteIndex NameString.

A CreateByteField operation creates a field, with the name stored in the NameString, that accesses the byte (8 bits) starting at the index ByteIndex within the SourceBuff.

See also
Section 19.6.19 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 936 of file named.c.

References AML_CREATE_BYTE_FIELD_OP, and aml_def_create_field_read_helper().

Referenced by aml_named_obj_read().

◆ aml_def_create_dword_field_read()

uint64_t aml_def_create_dword_field_read ( aml_term_list_ctx_t ctx)

Reads a DefCreateDWordField structure from the AML byte stream.

The DefCreateDWordField structure is defined as DefCreateDWordField := CreateDWordFieldOp SourceBuff ByteIndex NameString.

A CreateDWordField operation creates a field, with the name stored in the NameString, that accesses the double word (32 bits) starting at the index ByteIndex within the SourceBuff.

See also
Section 19.6.20 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 946 of file named.c.

References AML_CREATE_DWORD_FIELD_OP, and aml_def_create_field_read_helper().

Referenced by aml_named_obj_read().

◆ aml_def_create_field_read()

uint64_t aml_def_create_field_read ( aml_term_list_ctx_t ctx)

Reads a DefCreateField structure from the AML byte stream.

The DefCreateField structure is defined as DefDataRegion := CreateFieldOp SourceBuff BitIndex NumBits NameString.

See also
Section 19.6.21 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

The DefCreateField structure is defined as DefCreateField := CreateFieldOp SourceBuff BitIndex FieldFlags NameString.

A CreateField operation creates a field, with the name stored in the NameString, that accesses a field of arbitrary size and alignment within the SourceBuff, starting at the bit index BitIndex, and with the access properties defined by FieldFlags.

See also
Section 19.6.21 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 1133 of file named.c.

References aml_bit_index_read(), AML_BUFFER, aml_buffer_field_set(), AML_CREATE_FIELD_OP, AML_DEBUG_ERROR, aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_num_bits_read(), aml_object_new(), aml_source_buff_read(), aml_token_expect(), assert, DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_create_qword_field_read()

uint64_t aml_def_create_qword_field_read ( aml_term_list_ctx_t ctx)

Reads a DefCreateQWordField structure from the AML byte stream.

The DefCreateQWordField structure is defined as DefCreateQWordField := CreateQWordFieldOp SourceBuff ByteIndex NameString.

A CreateQWordField operation creates a field, with the name stored in the NameString, that accesses the quad word (64 bits) starting at the index ByteIndex within the SourceBuff.

See also
Section 19.6.22 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 951 of file named.c.

References AML_CREATE_QWORD_FIELD_OP, and aml_def_create_field_read_helper().

Referenced by aml_named_obj_read().

◆ aml_def_create_word_field_read()

uint64_t aml_def_create_word_field_read ( aml_term_list_ctx_t ctx)

Reads a DefCreateWordField structure from the AML byte stream.

The DefCreateWordField structure is defined as DefCreateWordField := CreateWordFieldOp SourceBuff ByteIndex NameString.

A CreateWordField operation creates a field, with the name stored in the NameString, that accesses the word (16 bits) starting at the index ByteIndex within the SourceBuff.

See also
Section 19.6.23 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 941 of file named.c.

References AML_CREATE_WORD_FIELD_OP, and aml_def_create_field_read_helper().

Referenced by aml_named_obj_read().

◆ aml_def_data_region_read()

uint64_t aml_def_data_region_read ( aml_term_list_ctx_t ctx)

Reads a DefDataRegion structure from the AML byte stream.

The DefDataRegion structure is defined as DefDataRegion := DataRegionOp NameString TermArg TermArg TermArg.

Despite the name the DefDataRegion structure is used to implement the DataTableRegion ASL operation.

All it does is that it allows a System Descriptor Table to be accessed as an opregion.

See also
Section 19.6.25 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 1189 of file named.c.

References acpi_tables_lookup(), AML_DATA_REGION_OP, AML_DEBUG_ERROR, aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_operation_region_set(), AML_REGION_SYSTEM_MEMORY, aml_term_arg_read_string(), aml_token_expect(), aml_string_obj_t::content, DEREF_DEFER, EILSEQ, ENOENT, ERR, errno, sdt_header_t::length, aml_string_obj_t::length, NULL, sdt_header_t::oemId, sdt_header_t::oemTableId, aml_state_t::overlay, aml_term_list_ctx_t::scope, SDT_OEM_ID_LENGTH, SDT_OEM_TABLE_ID_LENGTH, SDT_SIGNATURE_LENGTH, aml_term_list_ctx_t::state, and strncmp().

Referenced by aml_named_obj_read().

◆ aml_def_device_read()

uint64_t aml_def_device_read ( aml_term_list_ctx_t ctx)

Reads a DefDevice structure from the AML byte stream.

The DefDevice structure is defined as DefDevice := DeviceOp PkgLength NameString TermList.

See also
Section 19.6.31 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 593 of file named.c.

References AML_DEBUG_ERROR, AML_DEVICE_OP, aml_device_set(), aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_pkg_length_read(), aml_term_list_read(), aml_token_expect(), aml_term_list_ctx_t::current, DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, start(), and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_event_read()

uint64_t aml_def_event_read ( aml_term_list_ctx_t ctx)

Reads a DefEvent structure from the AML byte stream.

The DefEvent structure is defined as DefEvent := EventOp NameString.

See also
Section 19.6.42 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 956 of file named.c.

References AML_DEBUG_ERROR, AML_EVENT_OP, aml_event_set(), aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_token_expect(), DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_field_read()

uint64_t aml_def_field_read ( aml_term_list_ctx_t ctx)

Reads a DefField structure from the AML byte stream.

The DefField structure is defined as DefField := FieldOp PkgLength NameString FieldFlags FieldList.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 323 of file named.c.

References AML_DEBUG_ERROR, aml_field_flags_read(), aml_field_list_read(), AML_FIELD_LIST_TYPE_FIELD, AML_FIELD_OP, aml_name_string_read_and_resolve(), AML_OPERATION_REGION, aml_pkg_length_read(), aml_token_expect(), aml_term_list_ctx_t::current, DEREF_DEFER, EILSEQ, ERR, errno, NULL, aml_object_t::opregion, start(), and aml_field_list_ctx_t::type.

Referenced by aml_named_obj_read().

◆ aml_def_index_field_read()

uint64_t aml_def_index_field_read ( aml_term_list_ctx_t ctx)

Reads a DefIndexField structure from the AML byte stream.

The DefIndexField structure is defined as DefIndexField := IndexFieldOp PkgLength NameString NameString FieldFlags FieldList.

IndexFields can be a bit confusing, but the basic idea is that you have two fields, one for the index and one for the data. The index field in this case can be thought of as a "selector", and the data field is where we find the actual data we "selected". For example, to perform a read, we first write an index to the index field, and then read the data from the data field. The index is typically an offset into an array or table, and the data is the value at that offset.

See also
Section 19.6.64 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 380 of file named.c.

References AML_DEBUG_ERROR, aml_field_flags_read(), aml_field_list_read(), AML_FIELD_LIST_TYPE_INDEX_FIELD, AML_FIELD_UNIT, AML_INDEX_FIELD_OP, aml_name_string_read_and_resolve(), aml_pkg_length_read(), aml_token_expect(), aml_term_list_ctx_t::current, aml_field_unit_obj_t::data, data, DEREF_DEFER, EILSEQ, ERR, errno, aml_object_t::fieldUnit, aml_field_unit_obj_t::index, NULL, start(), and aml_field_list_ctx_t::type.

Referenced by aml_named_obj_read().

◆ aml_def_method_read()

uint64_t aml_def_method_read ( aml_term_list_ctx_t ctx)

Reads a DefMethod structure from the AML byte stream.

The DefField structure is defined as DefMethod := MethodOp PkgLength NameString MethodFlags TermList.

See also
Section 19.6.85 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 540 of file named.c.

References AML_DEBUG_ERROR, aml_method_flags_read(), AML_METHOD_OP, aml_method_set(), aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_pkg_length_read(), aml_token_expect(), aml_term_list_ctx_t::current, DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, start(), and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_mutex_read()

uint64_t aml_def_mutex_read ( aml_term_list_ctx_t ctx)

Reads a DefMutex structure from the AML byte stream.

The DefMutex structure is defined as DefMutex := MutexOp NameString SyncFlags.

See also
Section 19.6.89 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 663 of file named.c.

References AML_DEBUG_ERROR, AML_MUTEX_OP, aml_mutex_set(), aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_sync_flags_read(), aml_token_expect(), DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_opregion_read()

uint64_t aml_def_opregion_read ( aml_term_list_ctx_t ctx)

Reads a DefOpRegion structure from the AML byte stream.

A DefOpRegion structure is defined as DefOpRegion := OpRegionOp NameString RegionSpace RegionOffset RegionLen.

See also
Section 19.6.100 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 68 of file named.c.

References AML_DEBUG_ERROR, aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_operation_region_set(), AML_OPREGION_OP, aml_region_len_read(), aml_region_offset_read(), aml_region_space_read(), aml_token_expect(), DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_power_res_read()

uint64_t aml_def_power_res_read ( aml_term_list_ctx_t ctx)

Reads a DefPowerRes structure from the AML byte stream.

The DefPowerRes structure is defined as DefPowerRes := PowerResOp PkgLength NameString SystemLevel ResourceOrder TermList.

See also
Section 19.6.108 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 1058 of file named.c.

References AML_DEBUG_ERROR, aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_pkg_length_read(), AML_POWER_RES_OP, aml_power_resource_set(), aml_resource_order_read(), aml_system_level_read(), aml_term_list_read(), aml_token_expect(), aml_term_list_ctx_t::current, DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, start(), and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_processor_read()

uint64_t aml_def_processor_read ( aml_term_list_ctx_t ctx)

Reads a DefProcessor structure from the AML byte stream. Deprecated in ACPI 6.4 but still supported.

The DefProcessor structure is defined as DefProcessor := ProcessorOp PkgLength NameString ProcID PblkAddr PblkLen TermList.

See also
Section 20.2.7 of version 6.3 Errata A of the ACPI specification for more details on the grammar and section 19.6.108 of the same for more details about its behavior.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 732 of file named.c.

References AML_DEBUG_ERROR, AML_DEPRECATED_PROCESSOR_OP, aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_pblk_addr_read(), aml_pblk_len_read(), aml_pkg_length_read(), aml_proc_id_read(), aml_processor_set(), aml_term_list_read(), aml_token_expect(), aml_term_list_ctx_t::current, DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, start(), and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_def_thermal_zone_read()

uint64_t aml_def_thermal_zone_read ( aml_term_list_ctx_t ctx)

Reads a DefThermalZone structure from the AML byte stream.

The DefThermalZone structure is defined as DefThermalZone := ThermalZoneOp PkgLength NameString TermList.

See also
Section 19.6.135 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 988 of file named.c.

References AML_DEBUG_ERROR, aml_name_string_read(), aml_name_string_to_string(), aml_namespace_add_by_name_string(), aml_object_new(), aml_pkg_length_read(), aml_term_list_read(), AML_THERMAL_ZONE_OP, aml_thermal_zone_set(), aml_token_expect(), aml_term_list_ctx_t::current, DEREF_DEFER, ERR, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, start(), and aml_term_list_ctx_t::state.

Referenced by aml_named_obj_read().

◆ aml_dual_name_path_read()

uint64_t aml_dual_name_path_read ( aml_term_list_ctx_t ctx,
aml_name_seg_t **  out 
)

Reads the next data as a DualNamePath structure from the AML bytecode stream.

A DualNamePath structure is defined as DualNamePath := DualNamePrefix NameSeg NameSeg.

Parameters
ctxThe context of the TermList that this structure is part of.
outPointer to destination where the pointer to the array of two NameSeg will be stored. Will be located within the AML bytecode stream.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 58 of file name.c.

References AML_DEBUG_ERROR, AML_DUAL_NAME_PREFIX, aml_name_seg_read(), aml_token_expect(), aml_term_list_ctx_t::current, ERR, and start().

Referenced by aml_name_path_read().

◆ aml_field_element_read()

uint64_t aml_field_element_read ( aml_term_list_ctx_t ctx,
aml_field_list_ctx_t fieldCtx 
)

Reads a FieldElement structure from the AML byte stream.

The FieldElement structure is defined as FieldElement := NamedField | ReservedField | AccessField | ExtendedAccessField | ConnectField.

See also
Section 19.6.48 of the ACPI specification for more details about the Field Operation.
Parameters
ctxThe context of the TermList that this structure is part of.
fieldCtxThe AML field list context.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 277 of file named.c.

References AML_DEBUG_ERROR, AML_IS_LEAD_NAME_CHAR, aml_name_field_read(), aml_reserved_field_read(), aml_token_peek(), ENOSYS, ERR, errno, and aml_token_t::num.

Referenced by aml_field_list_read().

◆ aml_field_flags_read()

uint64_t aml_field_flags_read ( aml_term_list_ctx_t ctx,
aml_field_flags_t out 
)

Reads a FieldFlags structure from the AML byte stream.

Clean up definition.

A FieldFlags structure is defined as FieldFlags := ByteData, where

  • bit 0-3: AccessType
    • 0 AnyAcc
    • 1 ByteAcc
    • 2 WordAcc
    • 3 DWordAcc
    • 4 QWordAcc
    • 5 BufferAcc
    • 6 Reserved
  • bits 7-15 Reserved
  • bit 4: LockRule
    • 0 NoLock
    • 1 Lock
  • bit 5-6: UpdateRule
    • 0 Preserve
    • 1 WriteAsOnes
    • 2 WriteAsZeros
  • bit 7: Reserved (must be 0)
Parameters
ctxThe context of the TermList that this structure is part of.
outThe buffer to store the FieldFlags structure.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 122 of file named.c.

References aml_field_flags_t::accessType, AML_ACCESS_TYPE_BUFFER, aml_byte_data_read(), AML_DEBUG_ERROR, EILSEQ, ERR, and errno.

Referenced by aml_def_bank_field_read(), aml_def_field_read(), and aml_def_index_field_read().

◆ aml_field_list_read()

uint64_t aml_field_list_read ( aml_term_list_ctx_t ctx,
aml_field_list_ctx_t fieldCtx,
const uint8_t end 
)

Reads a FieldList structure from the AML byte stream.

The FieldList structure is defined as FieldList := Nothing | <fieldelement fieldlist>.

See also
Section 19.6.48 of the ACPI specification for more details about the Field Operation.
Parameters
ctxThe context of the TermList that this structure is part of.
fieldCtxThe AML field list context.
endThe index at which the FieldList ends.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 308 of file named.c.

References AML_DEBUG_ERROR, aml_field_element_read(), aml_term_list_ctx_t::current, and ERR.

Referenced by aml_def_bank_field_read(), aml_def_field_read(), and aml_def_index_field_read().

◆ aml_method_flags_read()

uint64_t aml_method_flags_read ( aml_term_list_ctx_t ctx,
aml_method_flags_t out 
)

Reads a MethodFlags structure from the AML byte stream.

A MethodFlags structure is defined as MethodFlags := ByteData, where

  • bit 0-2: ArgCount (0-7)
  • bit 3:
    • 0: NotSerialized
    • 1: Serialized
  • bit 4-7: SyncLevel (0x00-0x0F)
Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the MethodFlags structure.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 518 of file named.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, aml_method_flags_t::argCount, and ERR.

Referenced by aml_def_method_read().

◆ aml_multi_name_path_read()

uint64_t aml_multi_name_path_read ( aml_term_list_ctx_t ctx,
aml_name_seg_t **  outSegments,
uint64_t outSegCount 
)

Reads the next data as a MultiNamePath structure from the AML bytecode stream.

A MultiNamePath structure is defined as MultiNamePath := MultiNamePrefix SegCount NameSeg(SegCount).

Parameters
ctxThe context of the TermList that this structure is part of.
outSegmentsPointer to destination where the pointer to the array of NameSeg will be stored. Will be located within the AML bytecode stream.
outSegCountPointer to destination where the number of segments will be stored.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 80 of file name.c.

References AML_DEBUG_ERROR, AML_MULTI_NAME_PREFIX, aml_name_seg_read(), aml_seg_count_read(), aml_token_expect(), aml_term_list_ctx_t::current, ERR, and start().

Referenced by aml_name_path_read().

◆ aml_name_field_read()

uint64_t aml_name_field_read ( aml_term_list_ctx_t ctx,
aml_field_list_ctx_t fieldCtx 
)

Reads a NamedField structure from the AML byte stream.

A NamedField structure is defined as NamedField := NameSeg PkgLength

See also
Section 19.6.48 of the ACPI specification for more details about the Field Operation.
Parameters
ctxThe context of the TermList that this structure is part of.
fieldCtxThe AML field list context.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 155 of file named.c.

References AML_DEBUG_ERROR, AML_FIELD_LIST_TYPE_BANK_FIELD, AML_FIELD_LIST_TYPE_FIELD, AML_FIELD_LIST_TYPE_INDEX_FIELD, aml_field_unit_bank_field_set(), aml_field_unit_field_set(), aml_field_unit_index_field_set(), aml_name_seg_read(), AML_NAME_TO_STRING, aml_namespace_add_child(), aml_object_new(), aml_pkg_length_read(), aml_field_list_ctx_t::bank, aml_field_unit_obj_t::bank, aml_field_unit_obj_t::bankValue, aml_field_list_ctx_t::currentOffset, aml_field_unit_obj_t::data, DEREF_DEFER, EILSEQ, ERR, errno, aml_field_list_ctx_t::field, aml_field_list_ctx_t::flags, aml_field_list_ctx_t::index, aml_field_unit_obj_t::index, NULL, aml_field_list_ctx_t::opregion, aml_field_unit_obj_t::opregion, aml_state_t::overlay, aml_term_list_ctx_t::scope, aml_term_list_ctx_t::state, and aml_field_list_ctx_t::type.

Referenced by aml_field_element_read().

◆ aml_name_path_read()

uint64_t aml_name_path_read ( aml_term_list_ctx_t ctx,
aml_name_path_t out 
)

Reads the next data as a NamePath structure from the AML bytecode stream.

A NamePath structure is defined as NamePath := NameSeg | DualNamePath | MultiNamePath | NullName.

Parameters
ctxThe context of the TermList that this structure is part of.
outPointer to destination where the NamePath will be stored.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 124 of file name.c.

References AML_DEBUG_ERROR, aml_dual_name_path_read(), AML_DUAL_NAME_PREFIX, AML_IS_LEAD_NAME_CHAR, aml_multi_name_path_read(), AML_MULTI_NAME_PREFIX, aml_name_seg_read(), AML_NULL_NAME, aml_null_name_read(), aml_token_peek(), EILSEQ, ERR, errno, NULL, aml_token_t::num, aml_name_path_t::segmentCount, and aml_name_path_t::segments.

Referenced by aml_name_string_read().

◆ aml_name_seg_read()

uint64_t aml_name_seg_read ( aml_term_list_ctx_t ctx,
aml_name_seg_t **  out 
)

Reads the next data as a NameSeg from the AML bytecode stream.

A NameSeg structure is defined as NameSeg := <leadnamechar namechar namechar namechar>.

Parameters
ctxThe context of the TermList that this structure is part of.
outPointer to the destination where the pointer to the NameSeg will be stored. Will be located within the AML bytecode stream.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 27 of file name.c.

References AML_DEBUG_ERROR, AML_IS_LEAD_NAME_CHAR, AML_IS_NAME_CHAR, aml_token_read(), aml_term_list_ctx_t::current, EILSEQ, ERR, errno, aml_token_t::num, and start().

Referenced by aml_dual_name_path_read(), aml_multi_name_path_read(), aml_name_field_read(), and aml_name_path_read().

◆ aml_name_string_read()

uint64_t aml_name_string_read ( aml_term_list_ctx_t ctx,
aml_name_string_t out 
)

Reads the next data as a NameString structure from the AML bytecode stream.

A NameString structure is defined as NameString := <rootchar namepath> | <prefixpath namepath>.

Parameters
ctxThe context of the TermList that this structure is part of.
outPointer to destination where the NameString will be stored.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 189 of file name.c.

References AML_DEBUG_ERROR, aml_name_path_read(), AML_PARENT_PREFIX_CHAR, aml_prefix_path_read(), AML_ROOT_CHAR, aml_root_char_read(), aml_token_peek(), ERR, aml_name_string_t::namePath, aml_token_t::num, aml_name_string_t::prefixPath, and aml_name_string_t::rootChar.

Referenced by aml_def_alias_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_device_read(), aml_def_event_read(), aml_def_method_read(), aml_def_mutex_read(), aml_def_name_read(), aml_def_opregion_read(), aml_def_power_res_read(), aml_def_processor_read(), aml_def_thermal_zone_read(), aml_name_string_read_and_resolve(), and aml_package_element_read().

◆ aml_name_string_read_and_resolve()

aml_object_t * aml_name_string_read_and_resolve ( aml_term_list_ctx_t ctx)

Reads the next data as a NameString structure from the AML bytecode stream and resolves it to a object.

Note that errno will only be set to ENOENT if the NameString is read correctly but fails to resolve, other values for errno might be set in other cases.

See also
Section 5.3 of the ACPI specification for more details.
aml_name_string_find_by_name_string() for details on how the resolution is performed.
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, a pointer to the resolved object. On failure, NULL and errno is set.

Definition at line 227 of file name.c.

References AML_DEBUG_ERROR, aml_name_string_read(), aml_namespace_find_by_name_string(), AML_UNINITIALIZED, DEREF, ENOENT, ERR, errno, NULL, aml_state_t::overlay, aml_term_list_ctx_t::scope, and aml_term_list_ctx_t::state.

Referenced by aml_def_alias_read(), aml_def_bank_field_read(), aml_def_field_read(), aml_def_index_field_read(), aml_def_scope_read(), aml_method_invocation_read(), and aml_simple_name_read_and_resolve().

◆ aml_named_obj_read()

uint64_t aml_named_obj_read ( aml_term_list_ctx_t ctx)

Reads a NamedObj structure from the AML byte stream.

Version 6.6 of the ACPI specification has a few mistakes in the definition of the NamedObj structure, its supposed to contain several stuctures that it does not. If you check version 4.0 of the specification section 19.2.5.2 you can confirm that that these structures are supposed to be there but have, somehow, been forgotten.

The forgotten structures are:

  • DefField
  • DefMethod
  • DefMutex
  • DefIndexField
  • DefDevice
  • DefEvent
  • Maybe even more?

We add all missing structures to our definition of NamedObj. I have no idea how there are this many mistakes in the latest version of the ACPI specification.

The DefProcessor structure was deprecated in version 6.4 of the ACPI specification, but we still support it.

The NamedObj structure is defined as NamedObj := DefBankField | DefCreateBitField | DefCreateByteField | DefCreateDWordField | DefCreateField | DefCreateQWordField | DefCreateWordField | DefDataRegion | DefExternal | DefOpRegion | DefPowerRes | DefThermalZone | DefField | DefMethod | DefDevice | DefMutex | DefProcessor | DefIndexField | DefEvent.

Currently unimplemented Opcodes are:

  • DefExternal
Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 1296 of file named.c.

References AML_BANK_FIELD_OP, AML_CREATE_BIT_FIELD_OP, AML_CREATE_BYTE_FIELD_OP, AML_CREATE_DWORD_FIELD_OP, AML_CREATE_FIELD_OP, AML_CREATE_QWORD_FIELD_OP, AML_CREATE_WORD_FIELD_OP, AML_DATA_REGION_OP, AML_DEBUG_ERROR, aml_def_bank_field_read(), aml_def_create_bit_field_read(), aml_def_create_byte_field_read(), aml_def_create_dword_field_read(), aml_def_create_field_read(), aml_def_create_qword_field_read(), aml_def_create_word_field_read(), aml_def_data_region_read(), aml_def_device_read(), aml_def_event_read(), aml_def_field_read(), aml_def_index_field_read(), aml_def_method_read(), aml_def_mutex_read(), aml_def_opregion_read(), aml_def_power_res_read(), aml_def_processor_read(), aml_def_thermal_zone_read(), AML_DEPRECATED_PROCESSOR_OP, AML_DEVICE_OP, AML_EVENT_OP, AML_FIELD_OP, AML_INDEX_FIELD_OP, AML_METHOD_OP, AML_MUTEX_OP, AML_OPREGION_OP, AML_POWER_RES_OP, AML_THERMAL_ZONE_OP, aml_token_peek(), ENOSYS, ERR, errno, aml_token_props_t::name, aml_token_t::num, and aml_token_t::props.

Referenced by aml_object_read().

◆ aml_null_name_read()

uint64_t aml_null_name_read ( aml_term_list_ctx_t ctx)

Reads the next data as a NullName structure from the AML bytecode stream.

A NullName structure is defined as NullName := 0x00.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 113 of file name.c.

References AML_DEBUG_ERROR, AML_NULL_NAME, aml_token_expect(), and ERR.

Referenced by aml_name_path_read(), and aml_target_read_and_resolve().

◆ aml_num_bits_read()

uint64_t aml_num_bits_read ( aml_term_list_ctx_t ctx,
aml_integer_t out 
)

Reads a NumBits structure from the AML byte stream.

A NumBits structure is defined as NumBits := TermArg => Integer.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the number of bits.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 1122 of file named.c.

References AML_DEBUG_ERROR, aml_term_arg_read_integer(), and ERR.

Referenced by aml_def_create_field_read().

◆ aml_pblk_addr_read()

uint64_t aml_pblk_addr_read ( aml_term_list_ctx_t ctx,
aml_pblk_addr_t out 
)

Reads a PblkAddr structure from the AML byte stream. Deprecated in ACPI 6.4 but still supported.

A PblkAddr structure is defined as PblkAddr := DWordData.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the Pblk address.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 712 of file named.c.

References AML_DEBUG_ERROR, aml_dword_data_read(), and ERR.

Referenced by aml_def_processor_read().

◆ aml_pblk_len_read()

uint64_t aml_pblk_len_read ( aml_term_list_ctx_t ctx,
aml_pblk_len_t out 
)

Reads a PblkLen structure from the AML byte stream. Deprecated in ACPI 6.4 but still supported.

A PblkLen structure is defined as PblkLen := ByteData.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the Pblk length.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 722 of file named.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, and ERR.

Referenced by aml_def_processor_read().

◆ aml_prefix_path_read()

uint64_t aml_prefix_path_read ( aml_term_list_ctx_t ctx,
aml_prefix_path_t out 
)

Reads the next data as a PrefixPath structure from the AML bytecode stream.

A PrefixPath structure is defined as ‘PrefixPath := Nothing | <’^' prefixpath>`.

Note that ^ is just a AML_PARENT_PREFIX_CHAR.

Parameters
ctxThe context of the TermList that this structure is part of.
outPointer to destination where the PrefixPath will be stored.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 159 of file name.c.

References AML_PARENT_PREFIX_CHAR, aml_token_peek(), aml_term_list_ctx_t::current, aml_prefix_path_t::depth, aml_token_t::length, and aml_token_t::num.

Referenced by aml_name_string_read().

◆ aml_proc_id_read()

uint64_t aml_proc_id_read ( aml_term_list_ctx_t ctx,
aml_proc_id_t out 
)

Reads a ProcID structure from the AML byte stream. Deprecated in ACPI 6.4 but still supported.

A ProcID structure is defined as ProcID := ByteData.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the processor ID.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 702 of file named.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, and ERR.

Referenced by aml_def_processor_read().

◆ aml_region_len_read()

uint64_t aml_region_len_read ( aml_term_list_ctx_t ctx,
aml_integer_t out 
)

Reads a RegionLen structure from the AML byte stream.

A RegionLen structure is defined as RegionLen := TermArg => Integer.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the region length.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 57 of file named.c.

References AML_DEBUG_ERROR, aml_term_arg_read_integer(), and ERR.

Referenced by aml_def_opregion_read().

◆ aml_region_offset_read()

uint64_t aml_region_offset_read ( aml_term_list_ctx_t ctx,
aml_integer_t out 
)

Reads a RegionOffset structure from the AML byte stream.

A RegionOffset structure is defined as RegionOffset := TermArg => Integer.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the RegionOffset.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 46 of file named.c.

References AML_DEBUG_ERROR, aml_term_arg_read_integer(), and ERR.

Referenced by aml_def_opregion_read().

◆ aml_region_space_read()

uint64_t aml_region_space_read ( aml_term_list_ctx_t ctx,
aml_region_space_t out 
)

Reads a RegionSpace structure from the AML byte stream.

A RegionSpace structure is defined as RegionSpace := ByteData.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the region space.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 26 of file named.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, AML_REGION_OEM_MIN, AML_REGION_PCC, EILSEQ, ERR, and errno.

Referenced by aml_def_opregion_read().

◆ aml_reserved_field_read()

uint64_t aml_reserved_field_read ( aml_term_list_ctx_t ctx,
aml_field_list_ctx_t fieldCtx 
)

Reads a ReservedField structure from the AML byte stream.

A ReservedField structure is defined as ReservedField := 0x00 PkgLength.

See also
Section 19.6.48 of the ACPI specification for more details about the Field Operation.
Parameters
ctxThe context of the TermList that this structure is part of.
fieldCtxThe AML field list context.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 258 of file named.c.

References AML_DEBUG_ERROR, aml_pkg_length_read(), aml_token_expect(), aml_field_list_ctx_t::currentOffset, and ERR.

Referenced by aml_field_element_read().

◆ aml_resource_order_read()

uint64_t aml_resource_order_read ( aml_term_list_ctx_t ctx,
aml_resource_order_t out 
)

Reads a ResourceOrder structure from the AML byte stream.

A ResourceOrder structure is defined as ResourceOrder := WordData.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the resource order.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 1048 of file named.c.

References AML_DEBUG_ERROR, aml_word_data_read(), and ERR.

Referenced by aml_def_power_res_read().

◆ aml_root_char_read()

uint64_t aml_root_char_read ( aml_term_list_ctx_t ctx,
aml_root_char_t out 
)

Reads the next data as a RootChar from the AML bytecode stream.

A RootChar is defined as RootChar := 0x5C.

Parameters
ctxThe context of the TermList that this structure is part of.
outPointer to destination where the RootChar will be stored.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 177 of file name.c.

References AML_DEBUG_ERROR, AML_ROOT_CHAR, aml_token_expect(), ERR, and aml_root_char_t::present.

Referenced by aml_name_string_read().

◆ aml_seg_count_read()

uint64_t aml_seg_count_read ( aml_term_list_ctx_t ctx,
uint8_t out 
)

Reads the next data as a SegCount structure from the AML bytecode stream.

A SegCount structure is defined as SegCount := ByteData.

Parameters
ctxThe context of the TermList that this structure is part of.
outPointer to destination where the SegCount will be stored.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 17 of file name.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, and ERR.

Referenced by aml_multi_name_path_read().

◆ aml_simple_name_read_and_resolve()

aml_object_t * aml_simple_name_read_and_resolve ( aml_term_list_ctx_t ctx)

Reads a SimpleName structure from the AML byte stream and resolves it to a object.

A SimpleName structure is defined as SimpleName := NameString | ArgObj | LocalObj.

Note that errno will only be set to ENOENT if it is a NameString that fails to resolve, other values for errno might be set in other cases.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, a pointer to the resolved object. On failure, NULL and errno is set.

Definition at line 253 of file name.c.

References aml_arg_obj_read(), AML_DEBUG_ERROR, aml_local_obj_read(), aml_name_string_read_and_resolve(), aml_token_peek(), AML_TOKEN_TYPE_ARG, AML_TOKEN_TYPE_LOCAL, AML_TOKEN_TYPE_NAME, aml_token_type_to_string(), EILSEQ, errno, aml_token_props_t::name, NULL, aml_token_t::props, and aml_token_props_t::type.

Referenced by aml_def_object_type_read(), aml_op_termarg_simplename_read(), and aml_super_name_read_and_resolve().

◆ aml_source_buff_read()

aml_object_t * aml_source_buff_read ( aml_term_list_ctx_t ctx)

Reads a SourceBuff structure from the AML byte stream.

A SourceBuff structure is defined as SourceBuff := TermArg => Buffer.

SourceBuff must evaluate to a ObjectReference that refers to a Buffer object.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, the buffer object. On failure, NULL and errno is set.

Definition at line 803 of file named.c.

References AML_BUFFER, AML_DEBUG_ERROR, aml_term_arg_read(), and NULL.

Referenced by aml_def_create_bit_field_read(), aml_def_create_field_read(), and aml_def_create_field_read_helper().

◆ aml_super_name_read_and_resolve()

aml_object_t * aml_super_name_read_and_resolve ( aml_term_list_ctx_t ctx)

Reads a SuperName structure from the AML byte stream and resolves it to a object.

A SuperName structure is defined as SuperName := SimpleName | DebugObj | ReferenceTypeOpcode.

Parameters
ctxThe context of the TermList that this structure is part of.
Returns
On success, a pointer to the resolved object. On failure, NULL and errno is set.

Definition at line 285 of file name.c.

References AML_DEBUG_ERROR, aml_debug_obj_read(), aml_reference_type_opcode_read(), aml_simple_name_read_and_resolve(), aml_token_peek(), AML_TOKEN_TYPE_ARG, AML_TOKEN_TYPE_DEBUG, AML_TOKEN_TYPE_EXPRESSION, AML_TOKEN_TYPE_LOCAL, AML_TOKEN_TYPE_NAME, aml_token_type_to_string(), EILSEQ, errno, aml_token_props_t::name, NULL, aml_token_t::props, and aml_token_props_t::type.

Referenced by aml_def_cond_ref_of_read(), aml_mutex_object_read(), aml_op_supername_read(), aml_op_termarg_supername_read(), and aml_target_read_and_resolve().

◆ aml_sync_flags_read()

uint64_t aml_sync_flags_read ( aml_term_list_ctx_t ctx,
aml_sync_level_t out 
)

Reads a SyncFlags structure from the AML byte stream.

A SyncFlags structure is defined as SyncFlags := ByteData, where

  • bit 0-3: SyncLevel (0x00-0x0F)
  • bit 4-7: Reserved (must be 0)
Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the SyncFlags structure.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 643 of file named.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, EILSEQ, ERR, and errno.

Referenced by aml_def_mutex_read().

◆ aml_system_level_read()

uint64_t aml_system_level_read ( aml_term_list_ctx_t ctx,
aml_system_level_t out 
)

Reads a SystemLevel structure from the AML byte stream.

A SystemLevel structure is defined as SystemLevel := ByteData.

Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the system level.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 1038 of file named.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, and ERR.

Referenced by aml_def_power_res_read().

◆ aml_target_read_and_resolve()

uint64_t aml_target_read_and_resolve ( aml_term_list_ctx_t ctx,
aml_object_t **  out 
)

Reads a Target structure from the AML byte stream and resolves it to a object.

A Target structure is defined as Target := SuperName | NullName.

If the Target is a NullName, then out will be set to point to NULL but its not considered an error.

Parameters
ctxThe context of the TermList that this structure is part of.
outPointer to where the pointer to the resolved object will be stored, might be set to point to NULL.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 319 of file name.c.

References AML_DEBUG_ERROR, AML_NULL_NAME, aml_null_name_read(), aml_super_name_read_and_resolve(), aml_token_peek(), ERR, NULL, and aml_token_t::num.

Referenced by aml_def_cond_ref_of_read(), aml_def_index_read(), aml_def_mod_read(), aml_def_to_string_read(), aml_op_data_data_target_read(), aml_op_operand_operand_target_read(), aml_op_operand_shiftcount_target_read(), aml_op_operand_target_read(), aml_quotient_read(), and aml_remainder_read().