|
TianoCore EDK2 master
|
#include <AmlEncoding/Aml.h>Go to the source code of this file.
Functions | |
| CONST AML_BYTE_ENCODING *EFIAPI | AmlGetByteEncoding (IN CONST UINT8 *Buffer) |
| CONST AML_BYTE_ENCODING *EFIAPI | AmlGetByteEncodingByOpCode (IN UINT8 OpCode, IN UINT8 SubOpCode) |
| CONST AML_BYTE_ENCODING *EFIAPI | AmlGetFieldEncoding (IN CONST UINT8 *Buffer) |
| CONST AML_BYTE_ENCODING *EFIAPI | AmlGetFieldEncodingByOpCode (IN UINT8 OpCode, IN UINT8 SubOpCode) |
| CONST CHAR8 * | AmlGetOpCodeStr (IN UINT8 OpCode, IN UINT8 SubOpCode) |
| CONST CHAR8 * | AmlGetFieldOpCodeStr (IN UINT8 OpCode, IN UINT8 SubOpCode) |
| BOOLEAN EFIAPI | AmlIsOpCodeValid (IN UINT8 OpCode, IN UINT8 SubOpCode) |
| EAML_NODE_DATA_TYPE EFIAPI | AmlTypeToNodeDataType (IN AML_PARSE_FORMAT AmlType) |
| UINT32 EFIAPI | AmlGetPkgLength (IN CONST UINT8 *Buffer, OUT UINT32 *PkgLength) |
| UINT8 EFIAPI | AmlSetPkgLength (IN UINT32 Length, OUT UINT8 *Buffer) |
| UINT8 EFIAPI | AmlComputePkgLengthWidth (IN UINT32 Length) |
| EFI_STATUS EFIAPI | AmlComputePkgLength (IN UINT32 Length, OUT UINT32 *PkgLen) |
AML grammar definitions.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Aml.c.
| EFI_STATUS EFIAPI AmlComputePkgLength | ( | IN UINT32 | Length, |
| OUT UINT32 * | PkgLen | ||
| ) |
Given a length, compute the value of a PkgLen.
In AML, some object have a PkgLen, telling the size of the AML object. It can be encoded in 1 to 4 bytes. The bytes used to encode the PkgLen is itself counted in the PkgLen value. This means that if an AML object sees its size increment/decrement, the number of bytes used to encode the PkgLen value can itself increment/decrement.
For instance, the AML encoding of a DeviceOp is: DefDevice := DeviceOp PkgLength NameString TermList If:
The input arguments Length and PkgLen represent, for the DefDevice: DefDevice := DeviceOp PkgLength NameString TermList |---—Length--—| |-----—*PgkLength------—|
| [in] | Length | The length to encode as a PkgLen. Length cannot exceed 2^28 - 4 (4 bytes for the PkgLen encoding). The size of the PkgLen encoding bytes should not be counted in this length value. |
| [out] | PkgLen | If success, contains the value of the PkgLen, ready to encode in the PkgLen format. This value takes into account the size of PkgLen encoding. |
| EFI_SUCCESS | The function completed successfully. |
| EFI_INVALID_PARAMETER | Invalid parameter. |
| UINT8 EFIAPI AmlComputePkgLengthWidth | ( | IN UINT32 | Length | ) |
| CONST AML_BYTE_ENCODING *EFIAPI AmlGetByteEncoding | ( | IN CONST UINT8 * | Buffer | ) |
Get the AML_BYTE_ENCODING entry in the AML encoding table.
Note: For Pseudo OpCodes this function returns NULL.
| [in] | Buffer | Pointer to an OpCode/SubOpCode couple. If *Buffer = 0x5b (extended OpCode), Buffer must be at least two bytes long. |
| CONST AML_BYTE_ENCODING *EFIAPI AmlGetByteEncodingByOpCode | ( | IN UINT8 | OpCode, |
| IN UINT8 | SubOpCode | ||
| ) |
| CONST AML_BYTE_ENCODING *EFIAPI AmlGetFieldEncoding | ( | IN CONST UINT8 * | Buffer | ) |
Get the AML_BYTE_ENCODING entry in the field encoding table.
Note: For Pseudo OpCodes this function returns NULL.
| [in] | Buffer | Pointer to a field OpCode. No SubOpCode is expected. |
| CONST AML_BYTE_ENCODING *EFIAPI AmlGetFieldEncodingByOpCode | ( | IN UINT8 | OpCode, |
| IN UINT8 | SubOpCode | ||
| ) |
| EAML_NODE_DATA_TYPE EFIAPI AmlTypeToNodeDataType | ( | IN AML_PARSE_FORMAT | AmlType | ) |
| GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST AML_BYTE_ENCODING mAmlByteEncoding[] |
AML grammar encoding table.
The ASL language is a description language, used to define abstract objects, like devices, thermal zones, etc. and their place in a hierarchical tree. The following table stores the AML grammar definition. It can be used to parse an AML bytestream. Each line corresponds to the definition of an opcode and what is expected to be found with this opcode. See table 20-440 in the ACPI 6.3 specification s20.3, and the AML grammar definitions in s20.2.
-Attributes: The attribute field gives additional information on each object. This can be the presence of a variable list of arguments, the presence of a PkgLen, etc.
In summary, an AML object is described as: OpCode [SubOpcode] [PkgLen] [FixedArgs] [VarArgs]
OpCode {1 byte} [SubOpCode] {1 byte. Only relevant if the OpCode value is 0x5B (extended OpCode prefix). Otherwise 0. Most objects don't have one.} [PkgLen] {Size of the object. It has a special encoding, cf. ACPI 6.3 specification, s20.2.4 "Package Length Encoding". Most objects don't have one.} [FixedArgs[0..X]] {Fixed list of arguments. (where X <= 5) Can be other objects or data (a byte, a string, etc.). They belong to the current AML object. The number of fixed arguments varies according to the object, but it is fixed for each kind of object.} [VarArgs] {Variable list of arguments. They also belong to the current object and can be objects or data. Most objects don't have one.} [ByteList] {This is a sub-type of a variable list of arguments. It can only be found in buffer objects. A ByteList is either a list of bytes or a list of resource data elements. Resource data elements have specific opcodes.} [FieldList] {This is a sub-type of a variable list of arguments. It can only be found in Fields, IndexFields and BankFields. A FieldList is made of FieldElements. FieldElements have specific opcodes.}
| GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST AML_BYTE_ENCODING mAmlFieldEncoding[] |
AML grammar encoding for field elements.
Some AML objects are expecting a FieldList. They are referred in this library as field nodes. These objects have the following opcodes:
A field list is made of field elements. According to the ACPI 6.3 specification, s20.2.5.2 "Named Objects Encoding", field elements can be:
A small set of opcodes describes field elements. They are referred in this library as field opcodes. The NamedField field element doesn't have a field opcode. A pseudo OpCode/SubOpCode couple has been created for it.
Field elements:
| GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST EAML_NODE_DATA_TYPE mAmlTypeToNodeDataType[] |
AML_PARSE_FORMAT to EAML_NODE_DATA_TYPE translation table.
AML_PARSE_FORMAT describes an internal set of values identifying the types that can be found while parsing an AML bytestream. EAML_NODE_DATA_TYPE describes an external set of values allowing to identify what type of data can be found in data nodes.