32 if (AcpiTable ==
NULL) {
34 return EFI_INVALID_PARAMETER;
37 Ptr = (UINT8 *)AcpiTable;
38 Size = AcpiTable->Length;
42 AcpiTable->Checksum = 0;
45 while ((Size--) != 0) {
46 Sum = (UINT8)(Sum + (*Ptr++));
50 AcpiTable->Checksum = (UINT8)(0xFF - Sum + 1);
93 *Status = EFI_INVALID_PARAMETER;
108 if (Status !=
NULL) {
116 Size = *((UINT32 *)Context);
144 if (*((UINT32 *)Context) > Size) {
146 *Status = EFI_INVALID_PARAMETER;
150 *((UINT32 *)Context) = Size;
152 if (Status !=
NULL) {
180 return EFI_INVALID_PARAMETER;
218 return EFI_INVALID_PARAMETER;
230 return EFI_INVALID_PARAMETER;
242 return EFI_INVALID_PARAMETER;
245 switch (DataNode->
Size) {
248 *Value = *((UINT8 *)(DataNode->
Buffer));
253 *Value = *((UINT16 *)(DataNode->
Buffer));
258 *Value = *((UINT32 *)(DataNode->
Buffer));
263 *Value = *((UINT64 *)(DataNode->
Buffer));
269 return EFI_INVALID_PARAMETER;
300 return EFI_INVALID_PARAMETER;
311 return EFI_INVALID_PARAMETER;
320 if (EFI_ERROR (Status)) {
327 if (ByteEncoding ==
NULL) {
329 Status = EFI_INVALID_PARAMETER;
334 Node->AmlByteEncoding = ByteEncoding;
342 if (EFI_ERROR (Status)) {
377 OUT INT8 *ValueWidthDiff
388 (ValueWidthDiff ==
NULL))
391 return EFI_INVALID_PARAMETER;
408 if (EFI_ERROR (Status)) {
417 *ValueWidthDiff +=
sizeof (UINT8);
428 return EFI_INVALID_PARAMETER;
434 NewOpCode = (NewValue == 0) ? AML_ZERO_OP : AML_ONE_OP;
440 *ValueWidthDiff = -((INT8)DataNode->
Size);
446 if (EFI_ERROR (Status)) {
455 if (NewValue > MAX_UINT32) {
457 NewOpCode = AML_QWORD_PREFIX;
459 }
else if (NewValue > MAX_UINT16) {
461 NewOpCode = AML_DWORD_PREFIX;
463 }
else if (NewValue > MAX_UINT8) {
465 NewOpCode = AML_WORD_PREFIX;
469 NewOpCode = AML_BYTE_PREFIX;
473 *ValueWidthDiff += (INT8)(NumberOfBytes - DataNode->
Size);
477 if (Node->AmlByteEncoding ==
NULL) {
479 return EFI_INVALID_PARAMETER;
484 if (*ValueWidthDiff != 0) {
489 return EFI_OUT_OF_RESOURCES;
492 DataNode->
Size = NumberOfBytes;
524 IN BOOLEAN IsIncrement,
526 OUT INT8 *ValueWidthDiff
532 if (ValueWidthDiff ==
NULL) {
534 return EFI_INVALID_PARAMETER;
540 if (EFI_ERROR (Status)) {
546 if ((IsIncrement && (Value > (MAX_UINT64 - Diff))) ||
547 (!IsIncrement && (Value < Diff)))
550 return EFI_INVALID_PARAMETER;
591 IN BOOLEAN IsIncrement,
600 UINT32 InitialPkgLenWidth;
601 UINT32 NewPkgLenWidth;
602 UINT32 ReComputedPkgLenWidth;
603 INT8 FieldWidthChange;
609 return EFI_INVALID_PARAMETER;
635 if (EFI_ERROR (Status)) {
643 (FieldWidthChange < 0)) ||
645 (FieldWidthChange > 0)))
648 return EFI_INVALID_PARAMETER;
652 if (*Diff > (MAX_UINT32 - (UINT32)
ABS (FieldWidthChange))) {
654 return EFI_INVALID_PARAMETER;
658 *Diff = (UINT32)(*Diff +
ABS (FieldWidthChange));
664 Value = ObjectNode->
PkgLen;
669 Value -= InitialPkgLenWidth;
674 if ((IsIncrement && ((((BIT0 << 28) - 1) - Value) < *Diff)) ||
675 (!IsIncrement && (Value < *Diff)))
678 return EFI_INVALID_PARAMETER;
690 if (NewPkgLenWidth == 0) {
692 return EFI_INVALID_PARAMETER;
696 Value += NewPkgLenWidth;
703 if (ReComputedPkgLenWidth != NewPkgLenWidth) {
704 if ((ReComputedPkgLenWidth != 0) &&
705 (ReComputedPkgLenWidth < 4))
712 return EFI_INVALID_PARAMETER;
716 *Diff += (InitialPkgLenWidth > ReComputedPkgLenWidth) ?
717 (InitialPkgLenWidth - ReComputedPkgLenWidth) :
718 (ReComputedPkgLenWidth - InitialPkgLenWidth);
719 ObjectNode->
PkgLen = Value;
727 if (ParentNode !=
NULL) {
734 if (EFI_ERROR (Status)) {
744 if ((IsIncrement && (Value > (MAX_UINT32 - *Diff))) ||
745 (!IsIncrement && (Value < *Diff)))
748 return EFI_INVALID_PARAMETER;
787 IN BOOLEAN IsIncrement,
789 OUT INT8 *FieldWidthChange
799 (FieldWidthChange ==
NULL) ||
803 return EFI_INVALID_PARAMETER;
806 *FieldWidthChange = 0;
823 if ((IsIncrement && (CurrNodeCount == MAX_UINT8)) ||
824 (!IsIncrement && (CurrNodeCount == 0)))
827 return EFI_INVALID_PARAMETER;
831 CurrNodeCount = IsIncrement ? (CurrNodeCount + 1) : (CurrNodeCount - 1);
842 if (EFI_ERROR (Status)) {
872 IN BOOLEAN IsIncrement,
878 INT8 FieldWidthChange;
886 return EFI_INVALID_PARAMETER;
891 if ((NodeCount != 0) &&
900 if (EFI_ERROR (Status)) {
907 if ((
ABS (FieldWidthChange) > 8) ||
909 ((FieldWidthChange < 0) ||
910 ((Diff + (UINT8)FieldWidthChange) > MAX_UINT32))) ||
912 ((FieldWidthChange > 0) ||
913 (Diff < (UINT32)
ABS (FieldWidthChange)))))
916 return EFI_INVALID_PARAMETER;
919 Diff = (UINT32)(Diff + (UINT8)
ABS (FieldWidthChange));
925 if (EFI_ERROR (Status)) {
972 return EFI_INVALID_PARAMETER;
981 if ((LastRdNode ==
NULL) ||
986 return EFI_INVALID_PARAMETER;
990 if (EFI_ERROR (Status)) {
1004 return EFI_NOT_FOUND;
#define AML_HAS_PKG_LENGTH
#define AML_IS_PSEUDO_OPCODE
BOOLEAN EFIAPI IsIntegerNode(IN AML_OBJECT_NODE *Node)
BOOLEAN EFIAPI AmlNodeCompareOpCode(IN CONST AML_OBJECT_NODE *ObjectNode, IN UINT8 OpCode, IN UINT8 SubOpCode)
EFI_STATUS EFIAPI AmlDeleteNode(IN AML_NODE_HEADER *Node)
BOOLEAN EFIAPI AmlNodeHasAttribute(IN CONST AML_OBJECT_NODE *ObjectNode, IN AML_OP_ATTRIBUTE Attribute)
BOOLEAN EFIAPI IsSpecialIntegerNode(IN AML_OBJECT_NODE *Node)
EFI_STATUS EFIAPI AmlCreateDataNode(IN EAML_NODE_DATA_TYPE DataType, IN CONST UINT8 *Data, IN UINT32 DataSize, OUT AML_DATA_NODE **NewDataNodePtr)
#define IS_AML_ROOT_NODE(Node)
#define IS_AML_OBJECT_NODE(Node)
#define IS_AML_DATA_NODE(Node)
#define IS_AML_NODE_VALID(Node)
EFI_STATUS EFIAPI AmlRdSetEndTagChecksum(IN CONST AML_RD_HEADER *Header, IN UINT8 CheckSum)
EFI_STATUS EFIAPI AmlSetFixedArgument(IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index, IN AML_NODE_HEADER *NewNode)
BOOLEAN EFIAPI AmlIsNodeFixedArgument(IN CONST AML_NODE_HEADER *Node, OUT EAML_PARSE_INDEX *IndexPtr)
EFI_STATUS EFIAPI AmlSetRdListCheckSum(IN AML_OBJECT_NODE *BufferOpNode, IN UINT8 CheckSum)
EFI_STATUS EFIAPI AmlNodeGetIntegerValue(IN AML_OBJECT_NODE *Node, OUT UINT64 *Value)
EFI_STATUS EFIAPI AmlNodeSetIntegerValue(IN AML_OBJECT_NODE *Node, IN UINT64 NewValue, OUT INT8 *ValueWidthDiff)
EFI_STATUS EFIAPI AcpiPlatformChecksum(IN EFI_ACPI_DESCRIPTION_HEADER *AcpiTable)
STATIC EFI_STATUS EFIAPI AmlPropagateSize(IN AML_NODE_HEADER *Node, IN BOOLEAN IsIncrement, IN UINT32 *Diff)
EFI_STATUS EFIAPI AmlPropagateInformation(IN AML_NODE_HEADER *Node, IN BOOLEAN IsIncrement, IN UINT32 Diff, IN UINT8 NodeCount)
STATIC EFI_STATUS EFIAPI AmlPropagateNodeCount(IN AML_OBJECT_NODE *ObjectNode, IN BOOLEAN IsIncrement, IN UINT8 NodeCount, OUT INT8 *FieldWidthChange)
STATIC BOOLEAN EFIAPI AmlComputeSizeCallback(IN AML_NODE_HEADER *Node, IN OUT VOID *Context, IN OUT EFI_STATUS *Status OPTIONAL)
EFI_STATUS EFIAPI AmlComputeSize(IN CONST AML_NODE_HEADER *Node, IN OUT UINT32 *Size)
STATIC EFI_STATUS EFIAPI AmlNodeUpdateIntegerValue(IN AML_OBJECT_NODE *IntegerNode, IN BOOLEAN IsIncrement, IN UINT64 Diff, OUT INT8 *ValueWidthDiff)
STATIC EFI_STATUS EFIAPI AmlUnwindSpecialInteger(IN AML_OBJECT_NODE *Node)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
CONST AML_BYTE_ENCODING *EFIAPI AmlGetByteEncodingByOpCode(IN UINT8 OpCode, IN UINT8 SubOpCode)
UINT8 EFIAPI AmlComputePkgLengthWidth(IN UINT32 Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
AML_NODE_HANDLE EFIAPI AmlGetParent(IN AML_NODE_HANDLE Node)
AML_NODE_HANDLE EFIAPI AmlGetFixedArgument(IN AML_OBJECT_NODE_HANDLE ObjectNode, IN EAML_PARSE_INDEX Index)
AML_NODE_HANDLE EFIAPI AmlGetPreviousVariableArgument(IN AML_NODE_HANDLE Node, IN AML_NODE_HANDLE CurrVarArg)
BOOLEAN EFIAPI AmlEnumTree(IN AML_NODE_HANDLE Node, IN EDKII_AML_TREE_ENUM_CALLBACK CallBack, IN OUT VOID *Context OPTIONAL, OUT EFI_STATUS *Status OPTIONAL)
EFI_STATUS EFIAPI AmlGetResourceDataType(IN AML_DATA_NODE_HANDLE DataNode, OUT AML_RD_HEADER *ResourceDataType)
BOOLEAN EFIAPI AmlRdCompareDescId(IN CONST AML_RD_HEADER *Header, IN AML_RD_HEADER DescriptorId)
#define AML_RD_BUILD_SMALL_DESC_ID(Id)
#define AML_METHOD_INVOC_OP
enum EAmlParseIndex EAML_PARSE_INDEX
@ EAmlParseIndexTerm1
Second fixed argument index.
@ EAmlParseIndexTerm0
First fixed argument index.
@ EAmlNodeDataTypeResourceData
Resource data element.
EFI_STATUS EFIAPI AmlDeleteTree(IN AML_NODE_HANDLE Node)
AML_NODE_HEADER NodeHeader
Header information. Must be the first field of the struct.
EAML_NODE_DATA_TYPE DataType
UINT8 * Buffer
Buffer containing the data stored by this node.
UINT32 Size
Size of the Buffer.