31 IN AML_OP_PARSE_INDEX TermIndex,
32 OUT EFI_ACPI_DATA_TYPE *DataType,
40 if (DataType !=
NULL) {
51 switch (AmlByteEncoding->Format[TermIndex - 1]) {
53 *DataSize =
sizeof (UINT8);
56 *DataSize =
sizeof (UINT16);
59 *DataSize =
sizeof (UINT32);
62 *DataSize =
sizeof (UINT64);
69 if (EFI_ERROR (Status)) {
70 return EFI_INVALID_PARAMETER;
76 if (ChildAmlByteEncoding ==
NULL) {
77 return EFI_INVALID_PARAMETER;
86 if (DataType !=
NULL) {
91 if (EFI_ERROR (Status)) {
92 return EFI_INVALID_PARAMETER;
102 ChildAmlByteEncoding,
106 if (*DataSize == 0) {
107 return EFI_INVALID_PARAMETER;
118 return EFI_INVALID_PARAMETER;
121 if (*DataSize > MaxBufferSize) {
122 return EFI_INVALID_PARAMETER;
149 IN AML_OP_PARSE_INDEX Index,
150 OUT EFI_ACPI_DATA_TYPE *DataType,
155 UINT8 *CurrentBuffer;
159 AML_OP_PARSE_INDEX TermIndex;
162 ASSERT ((Index <= AmlByteEncoding->MaxIndex) || (Index == AML_OP_PARSE_INDEX_GET_SIZE));
171 if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
172 return EFI_INVALID_PARAMETER;
179 if (EFI_ERROR (Status)) {
180 return EFI_INVALID_PARAMETER;
183 if (*DataSize > MaxBufferSize) {
184 return EFI_INVALID_PARAMETER;
193 CurrentBuffer = Buffer;
198 if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
199 *DataType = EFI_ACPI_DATA_TYPE_OPCODE;
200 *Data = (VOID *)CurrentBuffer;
203 if (*CurrentBuffer == AML_EXT_OP) {
209 *DataSize = OpLength;
210 if (Index == AML_OP_PARSE_INDEX_GET_OPCODE) {
214 if (OpLength > MaxBufferSize) {
215 return EFI_INVALID_PARAMETER;
218 CurrentBuffer += OpLength;
228 if (OpLength + PkgLength > MaxBufferSize) {
229 return EFI_INVALID_PARAMETER;
231 MaxBufferSize = OpLength + PkgLength;
238 CurrentBuffer += PkgOffset;
243 TermIndex = AML_OP_PARSE_INDEX_GET_TERM1;
244 while ((Index >= TermIndex) && (TermIndex <= AmlByteEncoding->MaxIndex) && ((
UINTN)CurrentBuffer < (
UINTN)Buffer + MaxBufferSize)) {
248 (
UINTN)Buffer + MaxBufferSize - (
UINTN)CurrentBuffer,
254 if (EFI_ERROR (Status)) {
255 return EFI_INVALID_PARAMETER;
258 if (Index == TermIndex) {
268 CurrentBuffer += *DataSize;
275 if ((
UINTN)CurrentBuffer > (
UINTN)Buffer + MaxBufferSize) {
276 return EFI_INVALID_PARAMETER;
279 if ((
UINTN)CurrentBuffer == (
UINTN)Buffer + MaxBufferSize) {
280 if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
281 return EFI_INVALID_PARAMETER;
288 ASSERT (Index == AML_OP_PARSE_INDEX_GET_SIZE);
290 *DataSize = OpLength + PkgLength;
292 *DataSize = (
UINTN)CurrentBuffer - (
UINTN)Buffer;
321 AML_OP_PARSE_INDEX_GET_SIZE,
326 if (EFI_ERROR (Status)) {
348 AML_OP_PARSE_INDEX TermIndex;
350 EFI_ACPI_DATA_TYPE DataType;
352 AmlByteEncoding = AmlHandle->AmlByteEncoding;
360 TermIndex = AmlByteEncoding->
MaxIndex;
361 for (TermIndex = AmlByteEncoding->
MaxIndex; TermIndex > 0; TermIndex--) {
362 if (AmlByteEncoding->
Format[TermIndex - 1] == AML_NAME) {
367 ASSERT (TermIndex != 0);
379 if (EFI_ERROR (Status)) {
383 ASSERT (DataType == EFI_ACPI_DATA_TYPE_NAME_STRING);
403 EFI_ACPI_DATA_TYPE DataType;
410 AmlHandle->AmlByteEncoding->MaxIndex,
415 if (EFI_ERROR (Status)) {
416 return EFI_INVALID_PARAMETER;
422 *Buffer = (UINT8 *)((
UINTN)Data + DataSize);
427 if (DataType == EFI_ACPI_DATA_TYPE_OPCODE) {
451 IN AML_OP_PARSE_INDEX Index,
452 OUT EFI_ACPI_DATA_TYPE *DataType,
458 AmlHandle->AmlByteEncoding,
AML_BYTE_ENCODING * AmlSearchByOpByte(IN UINT8 *OpByteBuffer)
EFI_ACPI_DATA_TYPE AmlTypeToAcpiType(IN AML_OP_PARSE_FORMAT AmlType)
#define AML_HAS_PKG_LENGTH
CHAR8 * AmlGetObjectName(IN EFI_AML_HANDLE *AmlHandle)
UINTN AmlGetObjectSize(IN AML_BYTE_ENCODING *AmlByteEncoding, IN UINT8 *Buffer, IN UINTN MaxBufferSize)
EFI_STATUS AmlParseOptionTerm(IN AML_BYTE_ENCODING *AmlByteEncoding, IN UINT8 *Buffer, IN UINTN MaxBufferSize, IN AML_OP_PARSE_INDEX TermIndex, OUT EFI_ACPI_DATA_TYPE *DataType, OUT VOID **Data, OUT UINTN *DataSize)
EFI_STATUS AmlParseOptionHandleCommon(IN EFI_AML_HANDLE *AmlHandle, IN AML_OP_PARSE_INDEX Index, OUT EFI_ACPI_DATA_TYPE *DataType, OUT VOID **Data, OUT UINTN *DataSize)
EFI_STATUS AmlGetOffsetAfterLastOption(IN EFI_AML_HANDLE *AmlHandle, OUT UINT8 **Buffer)
EFI_STATUS AmlParseOptionCommon(IN AML_BYTE_ENCODING *AmlByteEncoding, IN UINT8 *Buffer, IN UINTN MaxBufferSize, IN AML_OP_PARSE_INDEX Index, OUT EFI_ACPI_DATA_TYPE *DataType, OUT VOID **Data, OUT UINTN *DataSize)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
UINT32 EFIAPI AmlGetPkgLength(IN CONST UINT8 *Buffer, OUT UINT32 *PkgLength)
EFI_STATUS EFIAPI AmlGetNameStringSize(IN CONST CHAR8 *AmlPath, OUT UINT32 *AmlPathSizePtr)
AML_OP_ATTRIBUTE Attribute
Additional information on the AML object.
AML_PARSE_FORMAT Format[EAmlParseIndexMax]
Type of each fixed argument.
EAML_PARSE_INDEX MaxIndex