PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
package_length.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4
5typedef struct aml_object aml_object_t;
6typedef struct aml_term_list_ctx aml_term_list_ctx_t;
7
8/**
9 * @brief Package Length Encoding
10 * @defgroup modules_acpi_aml_encoding_package_length Package Length
11 * @ingroup modules_acpi_aml
12 *
13 * @see Section 20.2.4 of the ACPI specification.
14 *
15 * @{
16 */
17
18/**
19 * @brief PkgLength structure.
20 */
22
23/**
24 * @brief PkgLeadByte structure.
25 * @struct aml_pkg_lead_byte_t
26 */
27typedef struct
28{
29 uint8_t byteDataCount; ///< Amount of ByteData structures that come after the lead byte.
30 uint8_t smallLengthBits; ///< Stores the total package length if the pkglength <= 63 which is equivalent to
31 ///< byteDataCount == 0 else it must be 0.
32 uint8_t leastSignificantNybble; ///< Least significant nybble of the package length.
34
35/**
36 * @brief Reads a PkgLeadByte structure from the AML byte stream.
37 *
38 * The PkgLeadByte structure is defined as:
39 * - bit 7-6: bytedata count that follows (0-3)
40 * - bit 5-4: only used if pkglength <= 63
41 * - bit 3-0: least significant package length nybble
42 *
43 * @param ctx The context of the TermList that this structure is part of.
44 * @param out The output buffer to store the lead byte.
45 * @return On success, `0`. On failure, `ERR` and `errno` is set.
46 */
48
49/**
50 * @brief Reads a PkgLength structure from the AML byte stream.
51 *
52 * The PkgLength structure is defined as `PkgLength := PkgLeadByte | <pkgleadbyte bytedata> | <pkgleadbyte bytedata
53 * bytedata> | <pkgleadbyte bytedata bytedata bytedata>`.
54 *
55 * A PkgLength structure specifies the length from its own start to the end of the data for the operation/structure it
56 * is part of, as such the PkgLength includes the length of the PkgLength structure itself.
57 *
58 * @see Section 5.4.1 of the ACPI specification for more details.
59 *
60 * @param ctx The context of the TermList that this structure is part of.
61 * @param out The output buffer to store the package length.
62 * @return On success, `0`. On failure, `ERR` and `errno` is set.
63 */
65
66/** @} */
uint32_t aml_pkg_length_t
PkgLength structure.
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.
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.
__UINT32_TYPE__ uint32_t
Definition stdint.h:15
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
__UINT8_TYPE__ uint8_t
Definition stdint.h:11
ACPI object.
Definition object.h:447
PkgLeadByte structure.
uint8_t byteDataCount
Amount of ByteData structures that come after the lead byte.
uint8_t leastSignificantNybble
Least significant nybble of the package length.
Context for reading a TermList.
Definition term.h:37