PatchworkOS
Loading...
Searching...
No Matches
Package Length

Package Length Encoding. More...

Data Structures

struct  aml_pkg_lead_byte_t
 PkgLeadByte structure. More...
 

Typedefs

typedef uint32_t aml_pkg_length_t
 PkgLength structure.
 

Functions

uint64_t aml_pkg_lead_byte_read (aml_term_list_ctx_t *ctx, aml_pkg_lead_byte_t *out)
 Reads a PkgLeadByte structure from the AML byte stream.
 
uint64_t aml_pkg_length_read (aml_term_list_ctx_t *ctx, aml_pkg_length_t *out)
 Reads a PkgLength structure from the AML byte stream.
 

Detailed Description

Package Length Encoding.

See also
Section 20.2.4 of the ACPI specification.

Typedef Documentation

◆ aml_pkg_length_t

PkgLength structure.

Definition at line 21 of file package_length.h.

Function Documentation

◆ aml_pkg_lead_byte_read()

uint64_t aml_pkg_lead_byte_read ( aml_term_list_ctx_t ctx,
aml_pkg_lead_byte_t out 
)

Reads a PkgLeadByte structure from the AML byte stream.

The PkgLeadByte structure is defined as:

  • bit 7-6: bytedata count that follows (0-3)
  • bit 5-4: only used if pkglength <= 63
  • bit 3-0: least significant package length nybble
Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the lead byte.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 10 of file package_length.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, aml_pkg_lead_byte_t::byteDataCount, EILSEQ, ERR, errno, aml_pkg_lead_byte_t::leastSignificantNybble, and aml_pkg_lead_byte_t::smallLengthBits.

Referenced by aml_pkg_length_read().

◆ aml_pkg_length_read()

uint64_t aml_pkg_length_read ( aml_term_list_ctx_t ctx,
aml_pkg_length_t out 
)

Reads a PkgLength structure from the AML byte stream.

The PkgLength structure is defined as PkgLength := PkgLeadByte | <pkgleadbyte bytedata> | <pkgleadbyte bytedata bytedata> | <pkgleadbyte bytedata bytedata bytedata>.

A PkgLength structure specifies the length from its own start to the end of the data for the operation/structure it is part of, as such the PkgLength includes the length of the PkgLength structure itself.

See also
Section 5.4.1 of the ACPI specification for more details.
Parameters
ctxThe context of the TermList that this structure is part of.
outThe output buffer to store the package length.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 34 of file package_length.c.

References aml_byte_data_read(), AML_DEBUG_ERROR, aml_pkg_lead_byte_read(), aml_pkg_lead_byte_t::byteDataCount, aml_term_list_ctx_t::current, ERANGE, ERR, errno, aml_pkg_lead_byte_t::leastSignificantNybble, aml_pkg_lead_byte_t::smallLengthBits, and start().

Referenced by aml_def_bank_field_read(), aml_def_buffer_read(), aml_def_device_read(), aml_def_else_read(), aml_def_field_read(), aml_def_if_else_read(), aml_def_index_field_read(), aml_def_method_read(), aml_def_package_read(), aml_def_power_res_read(), aml_def_processor_read(), aml_def_scope_read(), aml_def_thermal_zone_read(), aml_def_var_package_read(), aml_def_while_read(), aml_name_field_read(), and aml_reserved_field_read().