diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:53:55 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | 731c67e1d77b7741a91762d17659fc9fbcb9e305 (patch) | |
tree | 74c09d31d65dbaf66cc98dfe99b0837a71e6db31 /DynamicTablesPkg/Library/Common/AmlLib | |
parent | 7c342378317039e632d9a1a5d4cf7c21aec8cb7a (diff) | |
download | edk2-731c67e1d77b7741a91762d17659fc9fbcb9e305.zip edk2-731c67e1d77b7741a91762d17659fc9fbcb9e305.tar.gz edk2-731c67e1d77b7741a91762d17659fc9fbcb9e305.tar.bz2 |
DynamicTablesPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in the DynamicTablesPkg package
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Diffstat (limited to 'DynamicTablesPkg/Library/Common/AmlLib')
44 files changed, 2885 insertions, 2483 deletions
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlCoreInterface.h b/DynamicTablesPkg/Library/Common/AmlLib/AmlCoreInterface.h index 3a758fc..9626ee3 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlCoreInterface.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlCoreInterface.h @@ -67,9 +67,9 @@ EFI_STATUS
EFIAPI
AmlSerializeTree (
- IN AML_ROOT_NODE_HANDLE RootNode,
- IN UINT8 * Buffer OPTIONAL,
- IN OUT UINT32 * BufferSize
+ IN AML_ROOT_NODE_HANDLE RootNode,
+ IN UINT8 *Buffer OPTIONAL,
+ IN OUT UINT32 *BufferSize
);
/** Clone a node.
@@ -89,8 +89,8 @@ AmlSerializeTree ( EFI_STATUS
EFIAPI
AmlCloneNode (
- IN AML_NODE_HANDLE Node,
- OUT AML_NODE_HANDLE * ClonedNode
+ IN AML_NODE_HANDLE Node,
+ OUT AML_NODE_HANDLE *ClonedNode
);
/**
@@ -127,7 +127,7 @@ AmlCloneNode ( EFI_STATUS
EFIAPI
AmlRemoveNodeFromVarArgList (
- IN AML_NODE_HANDLE Node
+ IN AML_NODE_HANDLE Node
);
/** Add the NewNode to the head of the variable list of arguments
@@ -145,8 +145,8 @@ AmlRemoveNodeFromVarArgList ( EFI_STATUS
EFIAPI
AmlVarListAddHead (
- IN AML_NODE_HANDLE ParentNode,
- IN AML_NODE_HANDLE NewNode
+ IN AML_NODE_HANDLE ParentNode,
+ IN AML_NODE_HANDLE NewNode
);
/** Add the NewNode to the tail of the variable list of arguments
@@ -164,8 +164,8 @@ AmlVarListAddHead ( EFI_STATUS
EFIAPI
AmlVarListAddTail (
- IN AML_NODE_HANDLE ParentNode,
- IN AML_NODE_HANDLE NewNode
+ IN AML_NODE_HANDLE ParentNode,
+ IN AML_NODE_HANDLE NewNode
);
/** Add the NewNode before the Node in the list of variable
@@ -183,8 +183,8 @@ AmlVarListAddTail ( EFI_STATUS
EFIAPI
AmlVarListAddBefore (
- IN AML_NODE_HANDLE Node,
- IN AML_NODE_HANDLE NewNode
+ IN AML_NODE_HANDLE Node,
+ IN AML_NODE_HANDLE NewNode
);
/** Add the NewNode after the Node in the variable list of arguments
@@ -202,8 +202,8 @@ AmlVarListAddBefore ( EFI_STATUS
EFIAPI
AmlVarListAddAfter (
- IN AML_NODE_HANDLE Node,
- IN AML_NODE_HANDLE NewNode
+ IN AML_NODE_HANDLE Node,
+ IN AML_NODE_HANDLE NewNode
);
/** Append a Resource Data node to the BufferOpNode.
@@ -221,8 +221,8 @@ AmlVarListAddAfter ( EFI_STATUS
EFIAPI
AmlAppendRdNode (
- IN AML_OBJECT_NODE_HANDLE BufferOpNode,
- IN AML_DATA_NODE_HANDLE NewRdNode
+ IN AML_OBJECT_NODE_HANDLE BufferOpNode,
+ IN AML_DATA_NODE_HANDLE NewRdNode
);
/** Replace the OldNode, which is in a variable list of arguments,
@@ -244,8 +244,8 @@ AmlAppendRdNode ( EFI_STATUS
EFIAPI
AmlReplaceVariableArgument (
- IN AML_NODE_HANDLE OldNode,
- IN AML_NODE_HANDLE NewNode
+ IN AML_NODE_HANDLE OldNode,
+ IN AML_NODE_HANDLE NewNode
);
/**
@@ -285,7 +285,7 @@ AmlReplaceVariableArgument ( EAML_NODE_TYPE
EFIAPI
AmlGetNodeType (
- IN AML_NODE_HANDLE Node
+ IN AML_NODE_HANDLE Node
);
/** Get the RootNode information.
@@ -302,8 +302,8 @@ AmlGetNodeType ( EFI_STATUS
EFIAPI
AmlGetRootNodeInfo (
- IN AML_ROOT_NODE_HANDLE RootNode,
- OUT EFI_ACPI_DESCRIPTION_HEADER * SdtHeaderBuffer
+ IN AML_ROOT_NODE_HANDLE RootNode,
+ OUT EFI_ACPI_DESCRIPTION_HEADER *SdtHeaderBuffer
);
/** Get the ObjectNode information.
@@ -333,11 +333,11 @@ AmlGetRootNodeInfo ( EFI_STATUS
EFIAPI
AmlGetObjectNodeInfo (
- IN AML_OBJECT_NODE_HANDLE ObjectNode,
- OUT UINT8 * OpCode OPTIONAL,
- OUT UINT8 * SubOpCode OPTIONAL,
- OUT UINT32 * PkgLen OPTIONAL,
- OUT BOOLEAN * IsNameSpaceNode OPTIONAL
+ IN AML_OBJECT_NODE_HANDLE ObjectNode,
+ OUT UINT8 *OpCode OPTIONAL,
+ OUT UINT8 *SubOpCode OPTIONAL,
+ OUT UINT32 *PkgLen OPTIONAL,
+ OUT BOOLEAN *IsNameSpaceNode OPTIONAL
);
/** Returns the count of the fixed arguments for the input Node.
@@ -368,8 +368,8 @@ AmlGetFixedArgumentCount ( EFI_STATUS
EFIAPI
AmlGetNodeDataType (
- IN AML_DATA_NODE_HANDLE DataNode,
- OUT EAML_NODE_DATA_TYPE * DataType
+ IN AML_DATA_NODE_HANDLE DataNode,
+ OUT EAML_NODE_DATA_TYPE *DataType
);
/** Get the descriptor Id of the resource data element
@@ -392,8 +392,8 @@ AmlGetNodeDataType ( EFI_STATUS
EFIAPI
AmlGetResourceDataType (
- IN AML_DATA_NODE_HANDLE DataNode,
- OUT AML_RD_HEADER * ResourceDataType
+ IN AML_DATA_NODE_HANDLE DataNode,
+ OUT AML_RD_HEADER *ResourceDataType
);
/** Get the data buffer and size of the DataNode.
@@ -422,9 +422,9 @@ AmlGetResourceDataType ( EFI_STATUS
EFIAPI
AmlGetDataNodeBuffer (
- IN AML_DATA_NODE_HANDLE DataNode,
- OUT UINT8 * Buffer OPTIONAL,
- IN OUT UINT32 * BufferSize
+ IN AML_DATA_NODE_HANDLE DataNode,
+ OUT UINT8 *Buffer OPTIONAL,
+ IN OUT UINT32 *BufferSize
);
/** Update the ACPI DSDT/SSDT table header.
@@ -444,8 +444,8 @@ AmlGetDataNodeBuffer ( EFI_STATUS
EFIAPI
AmlUpdateRootNode (
- IN AML_ROOT_NODE_HANDLE RootNode,
- IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader
+ IN AML_ROOT_NODE_HANDLE RootNode,
+ IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader
);
/** Update an object node representing an integer with a new value.
@@ -472,8 +472,8 @@ AmlUpdateRootNode ( EFI_STATUS
EFIAPI
AmlUpdateInteger (
- IN AML_OBJECT_NODE_HANDLE IntegerOpNode,
- IN UINT64 NewInteger
+ IN AML_OBJECT_NODE_HANDLE IntegerOpNode,
+ IN UINT64 NewInteger
);
/** Update the buffer of a data node.
@@ -496,10 +496,10 @@ AmlUpdateInteger ( EFI_STATUS
EFIAPI
AmlUpdateDataNode (
- IN AML_DATA_NODE_HANDLE DataNode,
- IN EAML_NODE_DATA_TYPE DataType,
- IN UINT8 * Buffer,
- IN UINT32 Size
+ IN AML_DATA_NODE_HANDLE DataNode,
+ IN EAML_NODE_DATA_TYPE DataType,
+ IN UINT8 *Buffer,
+ IN UINT32 Size
);
/**
@@ -541,7 +541,7 @@ AmlUpdateDataNode ( AML_NODE_HANDLE
EFIAPI
AmlGetParent (
- IN AML_NODE_HANDLE Node
+ IN AML_NODE_HANDLE Node
);
/** Get the node at the input Index in the fixed argument list of the input
@@ -590,7 +590,7 @@ AmlGetFixedArgument ( AML_NODE_HANDLE
EFIAPI
AmlGetSiblingVariableArgument (
- IN AML_NODE_HANDLE VarArgNode
+ IN AML_NODE_HANDLE VarArgNode
);
/** Get the next variable argument.
@@ -619,8 +619,8 @@ AmlGetSiblingVariableArgument ( AML_NODE_HANDLE
EFIAPI
AmlGetNextVariableArgument (
- IN AML_NODE_HANDLE Node,
- IN AML_NODE_HANDLE CurrVarArg
+ IN AML_NODE_HANDLE Node,
+ IN AML_NODE_HANDLE CurrVarArg
);
/** Get the previous variable argument.
@@ -650,8 +650,8 @@ AmlGetNextVariableArgument ( AML_NODE_HANDLE
EFIAPI
AmlGetPreviousVariableArgument (
- IN AML_NODE_HANDLE Node,
- IN AML_NODE_HANDLE CurrVarArg
+ IN AML_NODE_HANDLE Node,
+ IN AML_NODE_HANDLE CurrVarArg
);
/**
@@ -682,10 +682,10 @@ AmlGetPreviousVariableArgument ( **/
typedef
BOOLEAN
-(EFIAPI * EDKII_AML_TREE_ENUM_CALLBACK) (
+(EFIAPI *EDKII_AML_TREE_ENUM_CALLBACK)(
IN AML_NODE_HANDLE Node,
- IN OUT VOID * Context OPTIONAL,
- IN OUT EFI_STATUS * Status OPTIONAL
+ IN OUT VOID *Context OPTIONAL,
+ IN OUT EFI_STATUS *Status OPTIONAL
);
/** Enumerate all nodes of the subtree under the input Node in the AML
@@ -712,10 +712,10 @@ BOOLEAN 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
+ IN AML_NODE_HANDLE Node,
+ IN EDKII_AML_TREE_ENUM_CALLBACK CallBack,
+ IN OUT VOID *Context OPTIONAL,
+ OUT EFI_STATUS *Status OPTIONAL
);
/**
@@ -759,9 +759,9 @@ AmlEnumTree ( EFI_STATUS
EFIAPI
AmlGetAslPathName (
- IN AML_NODE_HANDLE Node,
- OUT CHAR8 * Buffer,
- IN OUT UINT32 * BufferSize
+ IN AML_NODE_HANDLE Node,
+ OUT CHAR8 *Buffer,
+ IN OUT UINT32 *BufferSize
);
#endif // AML_CORE_INTERFACE_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c index 7f4cd34..e8c542d 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c @@ -19,7 +19,7 @@ /** String table representing AML Data types as defined by EAML_NODE_DATA_TYPE.
*/
-CONST CHAR8 * NodeDataTypeStrTbl[] = {
+CONST CHAR8 *NodeDataTypeStrTbl[] = {
"EAmlNodeDataTypeNone",
"EAmlNodeDataTypeReserved1",
"EAmlNodeDataTypeReserved2",
@@ -37,7 +37,7 @@ CONST CHAR8 * NodeDataTypeStrTbl[] = { /** String table representing AML Node types as defined by EAML_NODE_TYPE.
*/
-CONST CHAR8 * NodeTypeStrTbl[] = {
+CONST CHAR8 *NodeTypeStrTbl[] = {
"EAmlNodeUnknown",
"EAmlNodeRoot",
"EAmlNodeObject",
@@ -54,9 +54,9 @@ CONST CHAR8 * NodeTypeStrTbl[] = { VOID
EFIAPI
AmlDbgPrintChars (
- IN UINT32 ErrorLevel,
- IN CONST CHAR8 * Buffer,
- IN UINT32 Size
+ IN UINT32 ErrorLevel,
+ IN CONST CHAR8 *Buffer,
+ IN UINT32 Size
)
{
UINT32 i;
@@ -79,7 +79,7 @@ AmlDbgPrintChars ( VOID
EFIAPI
AmlDbgPrintNameSeg (
- IN CONST CHAR8 * Buffer
+ IN CONST CHAR8 *Buffer
)
{
if (Buffer == NULL) {
@@ -90,18 +90,23 @@ AmlDbgPrintNameSeg ( DEBUG ((DEBUG_INFO, "%c", Buffer[0]));
if ((Buffer[1] == AML_NAME_CHAR__) &&
(Buffer[2] == AML_NAME_CHAR__) &&
- (Buffer[3] == AML_NAME_CHAR__)) {
+ (Buffer[3] == AML_NAME_CHAR__))
+ {
return;
}
+
DEBUG ((DEBUG_INFO, "%c", Buffer[1]));
if ((Buffer[2] == AML_NAME_CHAR__) &&
- (Buffer[3] == AML_NAME_CHAR__)) {
+ (Buffer[3] == AML_NAME_CHAR__))
+ {
return;
}
+
DEBUG ((DEBUG_INFO, "%c", Buffer[2]));
if (Buffer[3] == AML_NAME_CHAR__) {
return;
}
+
DEBUG ((DEBUG_INFO, "%c", Buffer[3]));
return;
}
@@ -114,12 +119,12 @@ AmlDbgPrintNameSeg ( VOID
EFIAPI
AmlDbgPrintNameString (
- IN CONST CHAR8 * Buffer,
- IN BOOLEAN NewLine
+ IN CONST CHAR8 *Buffer,
+ IN BOOLEAN NewLine
)
{
- UINT8 SegCount;
- UINT8 Index;
+ UINT8 SegCount;
+ UINT8 Index;
if (Buffer == NULL) {
ASSERT (0);
@@ -153,6 +158,7 @@ AmlDbgPrintNameString ( ASSERT (0);
return;
}
+
SegCount = 1;
} else if (*Buffer == AML_ZERO_OP) {
SegCount = 0;
@@ -188,8 +194,8 @@ STATIC VOID
EFIAPI
AmlDbgPrintNodeHeader (
- IN AML_NODE_HEADER * Node,
- IN UINT8 Level
+ IN AML_NODE_HEADER *Node,
+ IN UINT8 Level
)
{
if (!IS_AML_NODE_VALID (Node)) {
@@ -214,8 +220,8 @@ STATIC VOID
EFIAPI
AmlDbgPrintDataNode (
- IN AML_DATA_NODE * DataNode,
- IN UINT8 Level
+ IN AML_DATA_NODE *DataNode,
+ IN UINT8 Level
)
{
UINT32 Idx;
@@ -225,38 +231,39 @@ AmlDbgPrintDataNode ( return;
}
- AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)DataNode, Level);
+ AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)DataNode, Level);
DEBUG ((DEBUG_INFO, "%-36a | ", NodeDataTypeStrTbl[DataNode->DataType]));
DEBUG ((DEBUG_INFO, "0x%04x | ", DataNode->Size));
if ((DataNode->DataType == EAmlNodeDataTypeNameString) ||
- (DataNode->DataType == EAmlNodeDataTypeString)) {
+ (DataNode->DataType == EAmlNodeDataTypeString))
+ {
AMLDBG_PRINT_CHARS (
DEBUG_INFO,
- (CONST CHAR8*)DataNode->Buffer,
+ (CONST CHAR8 *)DataNode->Buffer,
DataNode->Size
);
} else if (DataNode->DataType == EAmlNodeDataTypeUInt) {
switch (DataNode->Size) {
case 1:
{
- DEBUG ((DEBUG_INFO, "0x%0x", *((UINT8*)DataNode->Buffer)));
+ DEBUG ((DEBUG_INFO, "0x%0x", *((UINT8 *)DataNode->Buffer)));
break;
}
case 2:
{
- DEBUG ((DEBUG_INFO, "0x%0x", *((UINT16*)DataNode->Buffer)));
+ DEBUG ((DEBUG_INFO, "0x%0x", *((UINT16 *)DataNode->Buffer)));
break;
}
case 4:
{
- DEBUG ((DEBUG_INFO, "0x%0lx", *((UINT32*)DataNode->Buffer)));
+ DEBUG ((DEBUG_INFO, "0x%0lx", *((UINT32 *)DataNode->Buffer)));
break;
}
case 8:
{
- DEBUG ((DEBUG_INFO, "0x%0llx", *((UINT64*)DataNode->Buffer)));
+ DEBUG ((DEBUG_INFO, "0x%0llx", *((UINT64 *)DataNode->Buffer)));
break;
}
default:
@@ -284,8 +291,8 @@ STATIC VOID
EFIAPI
AmlDbgPrintObjectNode (
- IN AML_OBJECT_NODE * ObjectNode,
- IN UINT8 Level
+ IN AML_OBJECT_NODE *ObjectNode,
+ IN UINT8 Level
)
{
if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@@ -293,23 +300,31 @@ AmlDbgPrintObjectNode ( return;
}
- AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)ObjectNode, Level);
+ AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)ObjectNode, Level);
DEBUG ((DEBUG_INFO, "0x%02x | ", ObjectNode->AmlByteEncoding->OpCode));
DEBUG ((DEBUG_INFO, "0x%02x | ", ObjectNode->AmlByteEncoding->SubOpCode));
// Print a string corresponding to the field object OpCode/SubOpCode.
if (AmlNodeHasAttribute (ObjectNode, AML_IS_FIELD_ELEMENT)) {
- DEBUG ((DEBUG_INFO, "%-15a ", AmlGetFieldOpCodeStr (
- ObjectNode->AmlByteEncoding->OpCode,
- 0
- )));
+ DEBUG ((
+ DEBUG_INFO,
+ "%-15a ",
+ AmlGetFieldOpCodeStr (
+ ObjectNode->AmlByteEncoding->OpCode,
+ 0
+ )
+ ));
} else {
// Print a string corresponding to the object OpCode/SubOpCode.
- DEBUG ((DEBUG_INFO, "%-15a | ", AmlGetOpCodeStr (
- ObjectNode->AmlByteEncoding->OpCode,
- ObjectNode->AmlByteEncoding->SubOpCode)
- ));
+ DEBUG ((
+ DEBUG_INFO,
+ "%-15a | ",
+ AmlGetOpCodeStr (
+ ObjectNode->AmlByteEncoding->OpCode,
+ ObjectNode->AmlByteEncoding->SubOpCode
+ )
+ ));
}
DEBUG ((DEBUG_INFO, "%3d | ", ObjectNode->AmlByteEncoding->MaxIndex));
@@ -317,7 +332,7 @@ AmlDbgPrintObjectNode ( DEBUG ((DEBUG_INFO, "0x%04x | ", ObjectNode->PkgLen));
if (AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) {
AMLDBG_PRINT_NAMESTR (
- AmlNodeGetName ((CONST AML_OBJECT_NODE*)ObjectNode),
+ AmlNodeGetName ((CONST AML_OBJECT_NODE *)ObjectNode),
FALSE
);
}
@@ -334,8 +349,8 @@ STATIC VOID
EFIAPI
AmlDbgPrintRootNode (
- IN AML_ROOT_NODE * RootNode,
- IN UINT8 Level
+ IN AML_ROOT_NODE *RootNode,
+ IN UINT8 Level
)
{
if (!IS_AML_ROOT_NODE (RootNode)) {
@@ -343,7 +358,7 @@ AmlDbgPrintRootNode ( return;
}
- AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)RootNode, Level);
+ AmlDbgPrintNodeHeader ((AML_NODE_HEADER *)RootNode, Level);
DEBUG ((DEBUG_INFO, "%8x | ", RootNode->SdtHeader->Signature));
DEBUG ((DEBUG_INFO, "0x%08x | ", RootNode->SdtHeader->Length));
@@ -379,25 +394,25 @@ AmlDbgPrintTableHeader ( DEBUG ((
DEBUG_INFO,
" | %-15a | Signature| Length | Rev | CSum | OemId | "
- "OemTableId | OemRev | CreatorId| CreatorRev\n",
+ "OemTableId | OemRev | CreatorId| CreatorRev\n",
NodeTypeStrTbl[EAmlNodeRoot]
));
DEBUG ((
DEBUG_INFO,
" | %-15a | Op | SubOp| OpName | MaxI| Attribute | "
- "PkgLen | NodeName (opt)\n",
+ "PkgLen | NodeName (opt)\n",
NodeTypeStrTbl[EAmlNodeObject]
));
DEBUG ((
DEBUG_INFO,
" | %-15a | Data Type | Size | "
- "Buffer\n",
+ "Buffer\n",
NodeTypeStrTbl[EAmlNodeData]
));
DEBUG ((
DEBUG_INFO,
"---------------------------------------"
- "---------------------------------------\n"
+ "---------------------------------------\n"
));
}
@@ -413,12 +428,12 @@ STATIC VOID
EFIAPI
AmlDbgPrintTreeInternal (
- IN AML_NODE_HEADER * Node,
- IN BOOLEAN Recurse,
- IN UINT8 Level
+ IN AML_NODE_HEADER *Node,
+ IN BOOLEAN Recurse,
+ IN UINT8 Level
)
{
- AML_NODE_HEADER * ChildNode;
+ AML_NODE_HEADER *ChildNode;
if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0);
@@ -426,12 +441,12 @@ AmlDbgPrintTreeInternal ( }
if (IS_AML_DATA_NODE (Node)) {
- AmlDbgPrintDataNode ((AML_DATA_NODE*)Node, Level);
+ AmlDbgPrintDataNode ((AML_DATA_NODE *)Node, Level);
return;
} else if (IS_AML_OBJECT_NODE (Node)) {
- AmlDbgPrintObjectNode ((AML_OBJECT_NODE*)Node, Level);
+ AmlDbgPrintObjectNode ((AML_OBJECT_NODE *)Node, Level);
} else if (IS_AML_ROOT_NODE (Node)) {
- AmlDbgPrintRootNode ((AML_ROOT_NODE*)Node, Level);
+ AmlDbgPrintRootNode ((AML_ROOT_NODE *)Node, Level);
} else {
// Should not be possible.
ASSERT (0);
@@ -459,7 +474,7 @@ AmlDbgPrintTreeInternal ( VOID
EFIAPI
AmlDbgPrintNode (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
)
{
AmlDbgPrintTableHeader ();
@@ -474,7 +489,7 @@ AmlDbgPrintNode ( VOID
EFIAPI
AmlDbgPrintTree (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
)
{
AmlDbgPrintTableHeader ();
@@ -489,8 +504,8 @@ AmlDbgPrintTree ( VOID
EFIAPI
AmlDbgDumpRaw (
- IN CONST UINT8 * Ptr,
- IN UINT32 Length
+ IN CONST UINT8 *Ptr,
+ IN UINT32 Length
)
{
UINT32 ByteCount;
@@ -498,7 +513,7 @@ AmlDbgDumpRaw ( UINT32 AsciiBufferIndex;
CHAR8 AsciiBuffer[17];
- ByteCount = 0;
+ ByteCount = 0;
AsciiBufferIndex = 0;
DEBUG ((DEBUG_VERBOSE, "Address : 0x%p\n", Ptr));
@@ -532,6 +547,7 @@ AmlDbgDumpRaw ( if ((Length & 0x0F) <= 8) {
PartLineChars += 2;
}
+
while (PartLineChars > 0) {
DEBUG ((DEBUG_VERBOSE, " "));
PartLineChars--;
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h index e0d5272..e6ed9bc 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h @@ -24,7 +24,7 @@ #if !defined (MDEPKG_NDEBUG)
-#include <AmlInclude.h>
+ #include <AmlInclude.h>
/**
@defgroup DbgPrintApis Print APIs for debugging.
@@ -46,8 +46,8 @@ VOID
EFIAPI
AmlDbgDumpRaw (
- IN CONST UINT8 * Ptr,
- IN UINT32 Length
+ IN CONST UINT8 *Ptr,
+ IN UINT32 Length
);
/** Print Size chars at Buffer address.
@@ -61,9 +61,9 @@ AmlDbgDumpRaw ( VOID
EFIAPI
AmlDbgPrintChars (
- IN UINT32 ErrorLevel,
- IN CONST CHAR8 * Buffer,
- IN UINT32 Size
+ IN UINT32 ErrorLevel,
+ IN CONST CHAR8 *Buffer,
+ IN UINT32 Size
);
/** Print an AML NameSeg.
@@ -74,7 +74,7 @@ AmlDbgPrintChars ( VOID
EFIAPI
AmlDbgPrintNameSeg (
- IN CONST CHAR8 * Buffer
+ IN CONST CHAR8 *Buffer
);
/** Print an AML NameString.
@@ -85,8 +85,8 @@ AmlDbgPrintNameSeg ( VOID
EFIAPI
AmlDbgPrintNameString (
- IN CONST CHAR8 * Buffer,
- IN BOOLEAN NewLine
+ IN CONST CHAR8 *Buffer,
+ IN BOOLEAN NewLine
);
/** Print Node information.
@@ -99,7 +99,7 @@ AmlDbgPrintNameString ( VOID
EFIAPI
AmlDbgPrintNode (
- IN AML_NODE_HANDLE Node
+ IN AML_NODE_HANDLE Node
);
/** Recursively print the subtree under the Node.
@@ -112,7 +112,7 @@ AmlDbgPrintNode ( VOID
EFIAPI
AmlDbgPrintTree (
- IN AML_NODE_HANDLE Node
+ IN AML_NODE_HANDLE Node
);
/** Print the absolute pathnames in the AML namespace of
@@ -145,7 +145,7 @@ AmlDbgPrintNameSpace ( #define AMLDBG_PRINT_NAMESEG(Buffer) \
AmlDbgPrintNameSeg (Buffer)
-#define AMLDBG_PRINT_NAMESTR(Buffer,NewLine) \
+#define AMLDBG_PRINT_NAMESTR(Buffer, NewLine) \
AmlDbgPrintNameString (Buffer,NewLine)
#define AMLDBG_PRINT_NODE(Node) \
@@ -165,7 +165,7 @@ AmlDbgPrintNameSpace ( #define AMLDBG_PRINT_NAMESEG(Buffer)
-#define AMLDBG_PRINT_NAMESTR(Buffer,NewLine)
+#define AMLDBG_PRINT_NAMESTR(Buffer, NewLine)
#define AMLDBG_PRINT_NODE(Node)
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h b/DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h index fff99e6..a5e05e6 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h @@ -62,7 +62,7 @@ typedef enum EAmlNodeDataType { @ingroup TreeStructures
*/
typedef enum EAmlParseIndex {
- EAmlParseIndexTerm0 = 0, ///< First fixed argument index.
+ EAmlParseIndexTerm0 = 0, ///< First fixed argument index.
EAmlParseIndexTerm1, ///< Second fixed argument index.
EAmlParseIndexTerm2, ///< Third fixed argument index.
EAmlParseIndexTerm3, ///< Fourth fixed argument index.
@@ -84,7 +84,7 @@ typedef enum EAmlParseIndex { @ingroup TreeStructures
*/
-#define MAX_AML_NAMESTRING_SIZE 1277U
+#define MAX_AML_NAMESTRING_SIZE 1277U
/** Maximum size of an ASL NameString.
@@ -98,7 +98,7 @@ typedef enum EAmlParseIndex { @ingroup TreeStructures
*/
-#define MAX_ASL_NAMESTRING_SIZE 1529U
+#define MAX_ASL_NAMESTRING_SIZE 1529U
/** Pseudo OpCode for method invocations.
@@ -117,7 +117,7 @@ typedef enum EAmlParseIndex { @ingroup TreeStructures
*/
-#define AML_METHOD_INVOC_OP 0xD0
+#define AML_METHOD_INVOC_OP 0xD0
/** Pseudo OpCode for NamedField field elements.
@@ -136,7 +136,7 @@ typedef enum EAmlParseIndex { @ingroup TreeStructures
*/
-#define AML_FIELD_NAMED_OP 0x04
+#define AML_FIELD_NAMED_OP 0x04
/** AML object types.
@@ -146,7 +146,7 @@ typedef enum EAmlParseIndex { @ingroup TreeStructures
*/
typedef enum EAmlObjType {
- EAmlObjTypeUnknown = 0x0,
+ EAmlObjTypeUnknown = 0x0,
EAmlObjTypeInt,
EAmlObjTypeStrObj,
EAmlObjTypeBuffObj,
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c b/DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c index d829b18..e46dc6c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c @@ -81,153 +81,153 @@ GLOBAL_REMOVE_IF_UNREFERENCED
STATIC
CONST
-AML_BYTE_ENCODING mAmlByteEncoding[] = {
+AML_BYTE_ENCODING mAmlByteEncoding[] = {
// Comment Str OpCode SubOpCode MaxIndex NameIndex 0 1 2 3 4 5 Attribute
- /* 0x00 */ {AML_OPCODE_DEF ("ZeroOp", AML_ZERO_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x01 */ {AML_OPCODE_DEF ("OneOp", AML_ONE_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x06 */ {AML_OPCODE_DEF ("AliasOp", AML_ALIAS_OP), 0, 2, 1, {EAmlName, EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x08 */ {AML_OPCODE_DEF ("NameOp", AML_NAME_OP), 0, 2, 0, {EAmlName, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x0A */ {AML_OPCODE_DEF ("BytePrefix", AML_BYTE_PREFIX), 0, 1, 0, {EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x0B */ {AML_OPCODE_DEF ("WordPrefix", AML_WORD_PREFIX), 0, 1, 0, {EAmlUInt16, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x0C */ {AML_OPCODE_DEF ("DWordPrefix", AML_DWORD_PREFIX), 0, 1, 0, {EAmlUInt32, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x0D */ {AML_OPCODE_DEF ("StringPrefix", AML_STRING_PREFIX), 0, 1, 0, {EAmlString, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x0E */ {AML_OPCODE_DEF ("QWordPrefix", AML_QWORD_PREFIX), 0, 1, 0, {EAmlUInt64, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x10 */ {AML_OPCODE_DEF ("ScopeOp", AML_SCOPE_OP), 0, 1, 0, {EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
- /* 0x11 */ {AML_OPCODE_DEF ("BufferOp", AML_BUFFER_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_BYTE_LIST},
- /* 0x12 */ {AML_OPCODE_DEF ("PackageOp", AML_PACKAGE_OP), 0, 1, 0, {EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
- /* 0x13 */ {AML_OPCODE_DEF ("VarPackageOp", AML_VAR_PACKAGE_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
- /* 0x14 */ {AML_OPCODE_DEF ("MethodOp", AML_METHOD_OP), 0, 2, 0, {EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
- /* 0x15 */ {AML_OPCODE_DEF ("ExternalOp", AML_EXTERNAL_OP), 0, 3, 0, {EAmlName, EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x2E */ {AML_OPCODE_DEF ("DualNamePrefix", AML_DUAL_NAME_PREFIX), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x2F */ {AML_OPCODE_DEF ("MultiNamePrefix", AML_MULTI_NAME_PREFIX), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x41 */ {AML_OPCODE_DEF ("NameChar_A", 'A'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x42 */ {AML_OPCODE_DEF ("NameChar_B", 'B'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x43 */ {AML_OPCODE_DEF ("NameChar_C", 'C'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x44 */ {AML_OPCODE_DEF ("NameChar_D", 'D'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x45 */ {AML_OPCODE_DEF ("NameChar_E", 'E'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x46 */ {AML_OPCODE_DEF ("NameChar_F", 'F'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x47 */ {AML_OPCODE_DEF ("NameChar_G", 'G'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x48 */ {AML_OPCODE_DEF ("NameChar_H", 'H'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x49 */ {AML_OPCODE_DEF ("NameChar_I", 'I'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x4A */ {AML_OPCODE_DEF ("NameChar_J", 'J'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x4B */ {AML_OPCODE_DEF ("NameChar_K", 'K'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x4C */ {AML_OPCODE_DEF ("NameChar_L", 'L'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x4D */ {AML_OPCODE_DEF ("NameChar_M", 'M'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x4E */ {AML_OPCODE_DEF ("NameChar_N", 'N'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x4F */ {AML_OPCODE_DEF ("NameChar_O", 'O'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x50 */ {AML_OPCODE_DEF ("NameChar_P", 'P'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x51 */ {AML_OPCODE_DEF ("NameChar_Q", 'Q'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x52 */ {AML_OPCODE_DEF ("NameChar_R", 'R'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x53 */ {AML_OPCODE_DEF ("NameChar_S", 'S'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x54 */ {AML_OPCODE_DEF ("NameChar_T", 'T'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x55 */ {AML_OPCODE_DEF ("NameChar_U", 'U'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x56 */ {AML_OPCODE_DEF ("NameChar_V", 'V'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x57 */ {AML_OPCODE_DEF ("NameChar_W", 'W'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x58 */ {AML_OPCODE_DEF ("NameChar_X", 'X'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x59 */ {AML_OPCODE_DEF ("NameChar_Y", 'Y'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x5A */ {AML_OPCODE_DEF ("NameChar_Z", 'Z'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x5B 0x01 */ {AML_OPCODE_DEF ("MutexOp", AML_EXT_OP), AML_EXT_MUTEX_OP, 2, 0, {EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x5B 0x02 */ {AML_OPCODE_DEF ("EventOp", AML_EXT_OP), AML_EXT_EVENT_OP, 1, 0, {EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x5B 0x12 */ {AML_OPCODE_DEF ("CondRefOfOp", AML_EXT_OP), AML_EXT_COND_REF_OF_OP, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x13 */ {AML_OPCODE_DEF ("CreateFieldOp", AML_EXT_OP), AML_EXT_CREATE_FIELD_OP,4, 3, {EAmlObject, EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x5B 0x1F */ {AML_OPCODE_DEF ("LoadTableOp", AML_EXT_OP), AML_EXT_LOAD_TABLE_OP, 6, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject}, 0},
- /* 0x5B 0x20 */ {AML_OPCODE_DEF ("LoadOp", AML_EXT_OP), AML_EXT_LOAD_OP, 2, 0, {EAmlName, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x21 */ {AML_OPCODE_DEF ("StallOp", AML_EXT_OP), AML_EXT_STALL_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x22 */ {AML_OPCODE_DEF ("SleepOp", AML_EXT_OP), AML_EXT_SLEEP_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x23 */ {AML_OPCODE_DEF ("AcquireOp", AML_EXT_OP), AML_EXT_ACQUIRE_OP, 2, 0, {EAmlObject, EAmlUInt16, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x24 */ {AML_OPCODE_DEF ("SignalOp", AML_EXT_OP), AML_EXT_SIGNAL_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x25 */ {AML_OPCODE_DEF ("WaitOp", AML_EXT_OP), AML_EXT_WAIT_OP, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x26 */ {AML_OPCODE_DEF ("ResetOp", AML_EXT_OP), AML_EXT_RESET_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x27 */ {AML_OPCODE_DEF ("ReleaseOp", AML_EXT_OP), AML_EXT_RELEASE_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x28 */ {AML_OPCODE_DEF ("FromBCDOp", AML_EXT_OP), AML_EXT_FROM_BCD_OP, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x29 */ {AML_OPCODE_DEF ("ToBCDOp", AML_EXT_OP), AML_EXT_TO_BCD_OP, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x2A */ {AML_OPCODE_DEF ("UnloadOp", AML_EXT_OP), AML_EXT_UNLOAD_OP, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x30 */ {AML_OPCODE_DEF ("RevisionOp", AML_EXT_OP), AML_EXT_REVISION_OP, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x31 */ {AML_OPCODE_DEF ("DebugOp", AML_EXT_OP), AML_EXT_DEBUG_OP, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x32 */ {AML_OPCODE_DEF ("FatalOp", AML_EXT_OP), AML_EXT_FATAL_OP, 3, 0, {EAmlUInt8, EAmlUInt32, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x33 */ {AML_OPCODE_DEF ("TimerOp", AML_EXT_OP), AML_EXT_TIMER_OP, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x5B 0x80 */ {AML_OPCODE_DEF ("OpRegionOp", AML_EXT_OP), AML_EXT_REGION_OP, 4, 0, {EAmlName, EAmlUInt8, EAmlObject, EAmlObject, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x5B 0x81 */ {AML_OPCODE_DEF ("FieldOp", AML_EXT_OP), AML_EXT_FIELD_OP, 2, 0, {EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST},
- /* 0x5B 0x82 */ {AML_OPCODE_DEF ("DeviceOp", AML_EXT_OP), AML_EXT_DEVICE_OP, 1, 0, {EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
- /* 0x5B 0x83 */ {AML_OPCODE_DEF ("ProcessorOp", AML_EXT_OP), AML_EXT_PROCESSOR_OP, 4, 0, {EAmlName, EAmlUInt8, EAmlUInt32, EAmlUInt8, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
- /* 0x5B 0x84 */ {AML_OPCODE_DEF ("PowerResOp", AML_EXT_OP), AML_EXT_POWER_RES_OP, 3, 0, {EAmlName, EAmlUInt8, EAmlUInt16, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
- /* 0x5B 0x85 */ {AML_OPCODE_DEF ("ThermalZoneOp", AML_EXT_OP), AML_EXT_THERMAL_ZONE_OP,1, 0, {EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
- /* 0x5B 0x86 */ {AML_OPCODE_DEF ("IndexFieldOp", AML_EXT_OP), AML_EXT_INDEX_FIELD_OP, 3, 0, {EAmlName, EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST},
- /* 0x5B 0x87 */ {AML_OPCODE_DEF ("BankFieldOp", AML_EXT_OP), AML_EXT_BANK_FIELD_OP, 4, 0, {EAmlName, EAmlName, EAmlObject, EAmlUInt8, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST},
- /* 0x5B 0x88 */ {AML_OPCODE_DEF ("DataRegionOp", AML_EXT_OP), AML_EXT_DATA_REGION_OP, 4, 0, {EAmlName, EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x5C */ {AML_OPCODE_DEF ("RootChar", AML_ROOT_CHAR), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x5E */ {AML_OPCODE_DEF ("ParentPrefixChar", AML_PARENT_PREFIX_CHAR), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x5F */ {AML_OPCODE_DEF ("NameChar", '_'), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_NAME_CHAR},
- /* 0x60 */ {AML_OPCODE_DEF ("Local0Op", AML_LOCAL0), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x61 */ {AML_OPCODE_DEF ("Local1Op", AML_LOCAL1), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x62 */ {AML_OPCODE_DEF ("Local2Op", AML_LOCAL2), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x63 */ {AML_OPCODE_DEF ("Local3Op", AML_LOCAL3), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x64 */ {AML_OPCODE_DEF ("Local4Op", AML_LOCAL4), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x65 */ {AML_OPCODE_DEF ("Local5Op", AML_LOCAL5), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x66 */ {AML_OPCODE_DEF ("Local6Op", AML_LOCAL6), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x67 */ {AML_OPCODE_DEF ("Local7Op", AML_LOCAL7), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x68 */ {AML_OPCODE_DEF ("Arg0Op", AML_ARG0), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x69 */ {AML_OPCODE_DEF ("Arg1Op", AML_ARG1), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x6A */ {AML_OPCODE_DEF ("Arg2Op", AML_ARG2), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x6B */ {AML_OPCODE_DEF ("Arg3Op", AML_ARG3), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x6C */ {AML_OPCODE_DEF ("Arg4Op", AML_ARG4), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x6D */ {AML_OPCODE_DEF ("Arg5Op", AML_ARG5), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x6E */ {AML_OPCODE_DEF ("Arg6Op", AML_ARG6), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x70 */ {AML_OPCODE_DEF ("StoreOp", AML_STORE_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x71 */ {AML_OPCODE_DEF ("RefOfOp", AML_REF_OF_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x72 */ {AML_OPCODE_DEF ("AddOp", AML_ADD_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x73 */ {AML_OPCODE_DEF ("ConcatOp", AML_CONCAT_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x74 */ {AML_OPCODE_DEF ("SubtractOp", AML_SUBTRACT_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x75 */ {AML_OPCODE_DEF ("IncrementOp", AML_INCREMENT_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x76 */ {AML_OPCODE_DEF ("DecrementOp", AML_DECREMENT_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x77 */ {AML_OPCODE_DEF ("MultiplyOp", AML_MULTIPLY_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x78 */ {AML_OPCODE_DEF ("DivideOp", AML_DIVIDE_OP), 0, 4, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone}, 0},
- /* 0x79 */ {AML_OPCODE_DEF ("ShiftLeftOp", AML_SHIFT_LEFT_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x7A */ {AML_OPCODE_DEF ("ShiftRightOp", AML_SHIFT_RIGHT_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x7B */ {AML_OPCODE_DEF ("AndOp", AML_AND_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x7C */ {AML_OPCODE_DEF ("NAndOp", AML_NAND_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x7D */ {AML_OPCODE_DEF ("OrOp", AML_OR_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x7E */ {AML_OPCODE_DEF ("NorOp", AML_NOR_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x7F */ {AML_OPCODE_DEF ("XOrOp", AML_XOR_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x80 */ {AML_OPCODE_DEF ("NotOp", AML_NOT_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x81 */ {AML_OPCODE_DEF ("FindSetLeftBitOp", AML_FIND_SET_LEFT_BIT_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x82 */ {AML_OPCODE_DEF ("FindSetRightBitOp", AML_FIND_SET_RIGHT_BIT_OP),0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x83 */ {AML_OPCODE_DEF ("DerefOfOp", AML_DEREF_OF_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x84 */ {AML_OPCODE_DEF ("ConcatResOp", AML_CONCAT_RES_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x85 */ {AML_OPCODE_DEF ("ModOp", AML_MOD_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x86 */ {AML_OPCODE_DEF ("NotifyOp", AML_NOTIFY_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x87 */ {AML_OPCODE_DEF ("SizeOfOp", AML_SIZE_OF_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x88 */ {AML_OPCODE_DEF ("IndexOp", AML_INDEX_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x89 */ {AML_OPCODE_DEF ("MatchOp", AML_MATCH_OP), 0, 6, 0, {EAmlObject, EAmlUInt8, EAmlObject, EAmlUInt8, EAmlObject, EAmlObject}, 0},
- /* 0x8A */ {AML_OPCODE_DEF ("CreateDWordFieldOp", AML_CREATE_DWORD_FIELD_OP),0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x8B */ {AML_OPCODE_DEF ("CreateWordFieldOp", AML_CREATE_WORD_FIELD_OP), 0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x8C */ {AML_OPCODE_DEF ("CreateByteFieldOp", AML_CREATE_BYTE_FIELD_OP), 0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x8D */ {AML_OPCODE_DEF ("CreateBitFieldOp", AML_CREATE_BIT_FIELD_OP), 0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x8E */ {AML_OPCODE_DEF ("ObjectTypeOp", AML_OBJECT_TYPE_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x8F */ {AML_OPCODE_DEF ("CreateQWordFieldOp", AML_CREATE_QWORD_FIELD_OP),0, 3, 2, {EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone}, AML_IN_NAMESPACE},
- /* 0x90 */ {AML_OPCODE_DEF ("LAndOp", AML_LAND_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x91 */ {AML_OPCODE_DEF ("LOrOp", AML_LOR_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x92 */ {AML_OPCODE_DEF ("LNotOp", AML_LNOT_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x93 */ {AML_OPCODE_DEF ("LEqualOp", AML_LEQUAL_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x94 */ {AML_OPCODE_DEF ("LGreaterOp", AML_LGREATER_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x95 */ {AML_OPCODE_DEF ("LLessOp", AML_LLESS_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x96 */ {AML_OPCODE_DEF ("ToBufferOp", AML_TO_BUFFER_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x97 */ {AML_OPCODE_DEF ("ToDecimalStringOp", AML_TO_DEC_STRING_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x98 */ {AML_OPCODE_DEF ("ToHexStringOp", AML_TO_HEX_STRING_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x99 */ {AML_OPCODE_DEF ("ToIntegerOp", AML_TO_INTEGER_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x9C */ {AML_OPCODE_DEF ("ToStringOp", AML_TO_STRING_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x9D */ {AML_OPCODE_DEF ("CopyObjectOp", AML_COPY_OBJECT_OP), 0, 2, 0, {EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x9E */ {AML_OPCODE_DEF ("MidOp", AML_MID_OP), 0, 3, 0, {EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0x9F */ {AML_OPCODE_DEF ("ContinueOp", AML_CONTINUE_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0xA0 */ {AML_OPCODE_DEF ("IfOp", AML_IF_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
- /* 0xA1 */ {AML_OPCODE_DEF ("ElseOp", AML_ELSE_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
- /* 0xA2 */ {AML_OPCODE_DEF ("WhileOp", AML_WHILE_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
- /* 0xA3 */ {AML_OPCODE_DEF ("NoopOp", AML_NOOP_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0xA4 */ {AML_OPCODE_DEF ("ReturnOp", AML_RETURN_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0xA5 */ {AML_OPCODE_DEF ("BreakOp", AML_BREAK_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0xCC */ {AML_OPCODE_DEF ("BreakPointOp", AML_BREAK_POINT_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
- /* 0xD0 */ {AML_OPCODE_DEF ("MethodInvocOp", AML_METHOD_INVOC_OP), 0, 2, 0, {EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_PSEUDO_OPCODE | AML_HAS_CHILD_OBJ},
- /* 0xFF */ {AML_OPCODE_DEF ("OnesOp", AML_ONES_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, 0},
+ /* 0x00 */ { AML_OPCODE_DEF ("ZeroOp", AML_ZERO_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x01 */ { AML_OPCODE_DEF ("OneOp", AML_ONE_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x06 */ { AML_OPCODE_DEF ("AliasOp", AML_ALIAS_OP), 0, 2, 1, { EAmlName, EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x08 */ { AML_OPCODE_DEF ("NameOp", AML_NAME_OP), 0, 2, 0, { EAmlName, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x0A */ { AML_OPCODE_DEF ("BytePrefix", AML_BYTE_PREFIX), 0, 1, 0, { EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x0B */ { AML_OPCODE_DEF ("WordPrefix", AML_WORD_PREFIX), 0, 1, 0, { EAmlUInt16, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x0C */ { AML_OPCODE_DEF ("DWordPrefix", AML_DWORD_PREFIX), 0, 1, 0, { EAmlUInt32, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x0D */ { AML_OPCODE_DEF ("StringPrefix", AML_STRING_PREFIX), 0, 1, 0, { EAmlString, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x0E */ { AML_OPCODE_DEF ("QWordPrefix", AML_QWORD_PREFIX), 0, 1, 0, { EAmlUInt64, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x10 */ { AML_OPCODE_DEF ("ScopeOp", AML_SCOPE_OP), 0, 1, 0, { EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+ /* 0x11 */ { AML_OPCODE_DEF ("BufferOp", AML_BUFFER_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_BYTE_LIST },
+ /* 0x12 */ { AML_OPCODE_DEF ("PackageOp", AML_PACKAGE_OP), 0, 1, 0, { EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
+ /* 0x13 */ { AML_OPCODE_DEF ("VarPackageOp", AML_VAR_PACKAGE_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
+ /* 0x14 */ { AML_OPCODE_DEF ("MethodOp", AML_METHOD_OP), 0, 2, 0, { EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+ /* 0x15 */ { AML_OPCODE_DEF ("ExternalOp", AML_EXTERNAL_OP), 0, 3, 0, { EAmlName, EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x2E */ { AML_OPCODE_DEF ("DualNamePrefix", AML_DUAL_NAME_PREFIX), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x2F */ { AML_OPCODE_DEF ("MultiNamePrefix", AML_MULTI_NAME_PREFIX), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x41 */ { AML_OPCODE_DEF ("NameChar_A", 'A'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x42 */ { AML_OPCODE_DEF ("NameChar_B", 'B'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x43 */ { AML_OPCODE_DEF ("NameChar_C", 'C'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x44 */ { AML_OPCODE_DEF ("NameChar_D", 'D'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x45 */ { AML_OPCODE_DEF ("NameChar_E", 'E'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x46 */ { AML_OPCODE_DEF ("NameChar_F", 'F'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x47 */ { AML_OPCODE_DEF ("NameChar_G", 'G'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x48 */ { AML_OPCODE_DEF ("NameChar_H", 'H'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x49 */ { AML_OPCODE_DEF ("NameChar_I", 'I'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x4A */ { AML_OPCODE_DEF ("NameChar_J", 'J'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x4B */ { AML_OPCODE_DEF ("NameChar_K", 'K'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x4C */ { AML_OPCODE_DEF ("NameChar_L", 'L'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x4D */ { AML_OPCODE_DEF ("NameChar_M", 'M'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x4E */ { AML_OPCODE_DEF ("NameChar_N", 'N'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x4F */ { AML_OPCODE_DEF ("NameChar_O", 'O'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x50 */ { AML_OPCODE_DEF ("NameChar_P", 'P'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x51 */ { AML_OPCODE_DEF ("NameChar_Q", 'Q'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x52 */ { AML_OPCODE_DEF ("NameChar_R", 'R'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x53 */ { AML_OPCODE_DEF ("NameChar_S", 'S'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x54 */ { AML_OPCODE_DEF ("NameChar_T", 'T'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x55 */ { AML_OPCODE_DEF ("NameChar_U", 'U'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x56 */ { AML_OPCODE_DEF ("NameChar_V", 'V'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x57 */ { AML_OPCODE_DEF ("NameChar_W", 'W'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x58 */ { AML_OPCODE_DEF ("NameChar_X", 'X'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x59 */ { AML_OPCODE_DEF ("NameChar_Y", 'Y'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x5A */ { AML_OPCODE_DEF ("NameChar_Z", 'Z'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x5B 0x01 */ { AML_OPCODE_DEF ("MutexOp", AML_EXT_OP), AML_EXT_MUTEX_OP, 2, 0, { EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x5B 0x02 */ { AML_OPCODE_DEF ("EventOp", AML_EXT_OP), AML_EXT_EVENT_OP, 1, 0, { EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x5B 0x12 */ { AML_OPCODE_DEF ("CondRefOfOp", AML_EXT_OP), AML_EXT_COND_REF_OF_OP, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x13 */ { AML_OPCODE_DEF ("CreateFieldOp", AML_EXT_OP), AML_EXT_CREATE_FIELD_OP, 4, 3, { EAmlObject, EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x5B 0x1F */ { AML_OPCODE_DEF ("LoadTableOp", AML_EXT_OP), AML_EXT_LOAD_TABLE_OP, 6, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlObject }, 0 },
+ /* 0x5B 0x20 */ { AML_OPCODE_DEF ("LoadOp", AML_EXT_OP), AML_EXT_LOAD_OP, 2, 0, { EAmlName, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x21 */ { AML_OPCODE_DEF ("StallOp", AML_EXT_OP), AML_EXT_STALL_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x22 */ { AML_OPCODE_DEF ("SleepOp", AML_EXT_OP), AML_EXT_SLEEP_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x23 */ { AML_OPCODE_DEF ("AcquireOp", AML_EXT_OP), AML_EXT_ACQUIRE_OP, 2, 0, { EAmlObject, EAmlUInt16, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x24 */ { AML_OPCODE_DEF ("SignalOp", AML_EXT_OP), AML_EXT_SIGNAL_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x25 */ { AML_OPCODE_DEF ("WaitOp", AML_EXT_OP), AML_EXT_WAIT_OP, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x26 */ { AML_OPCODE_DEF ("ResetOp", AML_EXT_OP), AML_EXT_RESET_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x27 */ { AML_OPCODE_DEF ("ReleaseOp", AML_EXT_OP), AML_EXT_RELEASE_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x28 */ { AML_OPCODE_DEF ("FromBCDOp", AML_EXT_OP), AML_EXT_FROM_BCD_OP, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x29 */ { AML_OPCODE_DEF ("ToBCDOp", AML_EXT_OP), AML_EXT_TO_BCD_OP, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x2A */ { AML_OPCODE_DEF ("UnloadOp", AML_EXT_OP), AML_EXT_UNLOAD_OP, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x30 */ { AML_OPCODE_DEF ("RevisionOp", AML_EXT_OP), AML_EXT_REVISION_OP, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x31 */ { AML_OPCODE_DEF ("DebugOp", AML_EXT_OP), AML_EXT_DEBUG_OP, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x32 */ { AML_OPCODE_DEF ("FatalOp", AML_EXT_OP), AML_EXT_FATAL_OP, 3, 0, { EAmlUInt8, EAmlUInt32, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x33 */ { AML_OPCODE_DEF ("TimerOp", AML_EXT_OP), AML_EXT_TIMER_OP, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x5B 0x80 */ { AML_OPCODE_DEF ("OpRegionOp", AML_EXT_OP), AML_EXT_REGION_OP, 4, 0, { EAmlName, EAmlUInt8, EAmlObject, EAmlObject, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x5B 0x81 */ { AML_OPCODE_DEF ("FieldOp", AML_EXT_OP), AML_EXT_FIELD_OP, 2, 0, { EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST },
+ /* 0x5B 0x82 */ { AML_OPCODE_DEF ("DeviceOp", AML_EXT_OP), AML_EXT_DEVICE_OP, 1, 0, { EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+ /* 0x5B 0x83 */ { AML_OPCODE_DEF ("ProcessorOp", AML_EXT_OP), AML_EXT_PROCESSOR_OP, 4, 0, { EAmlName, EAmlUInt8, EAmlUInt32, EAmlUInt8, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+ /* 0x5B 0x84 */ { AML_OPCODE_DEF ("PowerResOp", AML_EXT_OP), AML_EXT_POWER_RES_OP, 3, 0, { EAmlName, EAmlUInt8, EAmlUInt16, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+ /* 0x5B 0x85 */ { AML_OPCODE_DEF ("ThermalZoneOp", AML_EXT_OP), AML_EXT_THERMAL_ZONE_OP, 1, 0, { EAmlName, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
+ /* 0x5B 0x86 */ { AML_OPCODE_DEF ("IndexFieldOp", AML_EXT_OP), AML_EXT_INDEX_FIELD_OP, 3, 0, { EAmlName, EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST },
+ /* 0x5B 0x87 */ { AML_OPCODE_DEF ("BankFieldOp", AML_EXT_OP), AML_EXT_BANK_FIELD_OP, 4, 0, { EAmlName, EAmlName, EAmlObject, EAmlUInt8, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_FIELD_LIST },
+ /* 0x5B 0x88 */ { AML_OPCODE_DEF ("DataRegionOp", AML_EXT_OP), AML_EXT_DATA_REGION_OP, 4, 0, { EAmlName, EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x5C */ { AML_OPCODE_DEF ("RootChar", AML_ROOT_CHAR), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x5E */ { AML_OPCODE_DEF ("ParentPrefixChar", AML_PARENT_PREFIX_CHAR), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x5F */ { AML_OPCODE_DEF ("NameChar", '_'), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_NAME_CHAR },
+ /* 0x60 */ { AML_OPCODE_DEF ("Local0Op", AML_LOCAL0), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x61 */ { AML_OPCODE_DEF ("Local1Op", AML_LOCAL1), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x62 */ { AML_OPCODE_DEF ("Local2Op", AML_LOCAL2), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x63 */ { AML_OPCODE_DEF ("Local3Op", AML_LOCAL3), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x64 */ { AML_OPCODE_DEF ("Local4Op", AML_LOCAL4), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x65 */ { AML_OPCODE_DEF ("Local5Op", AML_LOCAL5), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x66 */ { AML_OPCODE_DEF ("Local6Op", AML_LOCAL6), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x67 */ { AML_OPCODE_DEF ("Local7Op", AML_LOCAL7), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x68 */ { AML_OPCODE_DEF ("Arg0Op", AML_ARG0), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x69 */ { AML_OPCODE_DEF ("Arg1Op", AML_ARG1), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x6A */ { AML_OPCODE_DEF ("Arg2Op", AML_ARG2), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x6B */ { AML_OPCODE_DEF ("Arg3Op", AML_ARG3), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x6C */ { AML_OPCODE_DEF ("Arg4Op", AML_ARG4), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x6D */ { AML_OPCODE_DEF ("Arg5Op", AML_ARG5), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x6E */ { AML_OPCODE_DEF ("Arg6Op", AML_ARG6), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x70 */ { AML_OPCODE_DEF ("StoreOp", AML_STORE_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x71 */ { AML_OPCODE_DEF ("RefOfOp", AML_REF_OF_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x72 */ { AML_OPCODE_DEF ("AddOp", AML_ADD_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x73 */ { AML_OPCODE_DEF ("ConcatOp", AML_CONCAT_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x74 */ { AML_OPCODE_DEF ("SubtractOp", AML_SUBTRACT_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x75 */ { AML_OPCODE_DEF ("IncrementOp", AML_INCREMENT_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x76 */ { AML_OPCODE_DEF ("DecrementOp", AML_DECREMENT_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x77 */ { AML_OPCODE_DEF ("MultiplyOp", AML_MULTIPLY_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x78 */ { AML_OPCODE_DEF ("DivideOp", AML_DIVIDE_OP), 0, 4, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone }, 0 },
+ /* 0x79 */ { AML_OPCODE_DEF ("ShiftLeftOp", AML_SHIFT_LEFT_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x7A */ { AML_OPCODE_DEF ("ShiftRightOp", AML_SHIFT_RIGHT_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x7B */ { AML_OPCODE_DEF ("AndOp", AML_AND_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x7C */ { AML_OPCODE_DEF ("NAndOp", AML_NAND_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x7D */ { AML_OPCODE_DEF ("OrOp", AML_OR_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x7E */ { AML_OPCODE_DEF ("NorOp", AML_NOR_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x7F */ { AML_OPCODE_DEF ("XOrOp", AML_XOR_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x80 */ { AML_OPCODE_DEF ("NotOp", AML_NOT_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x81 */ { AML_OPCODE_DEF ("FindSetLeftBitOp", AML_FIND_SET_LEFT_BIT_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x82 */ { AML_OPCODE_DEF ("FindSetRightBitOp", AML_FIND_SET_RIGHT_BIT_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x83 */ { AML_OPCODE_DEF ("DerefOfOp", AML_DEREF_OF_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x84 */ { AML_OPCODE_DEF ("ConcatResOp", AML_CONCAT_RES_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x85 */ { AML_OPCODE_DEF ("ModOp", AML_MOD_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x86 */ { AML_OPCODE_DEF ("NotifyOp", AML_NOTIFY_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x87 */ { AML_OPCODE_DEF ("SizeOfOp", AML_SIZE_OF_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x88 */ { AML_OPCODE_DEF ("IndexOp", AML_INDEX_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x89 */ { AML_OPCODE_DEF ("MatchOp", AML_MATCH_OP), 0, 6, 0, { EAmlObject, EAmlUInt8, EAmlObject, EAmlUInt8, EAmlObject, EAmlObject }, 0 },
+ /* 0x8A */ { AML_OPCODE_DEF ("CreateDWordFieldOp", AML_CREATE_DWORD_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x8B */ { AML_OPCODE_DEF ("CreateWordFieldOp", AML_CREATE_WORD_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x8C */ { AML_OPCODE_DEF ("CreateByteFieldOp", AML_CREATE_BYTE_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x8D */ { AML_OPCODE_DEF ("CreateBitFieldOp", AML_CREATE_BIT_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x8E */ { AML_OPCODE_DEF ("ObjectTypeOp", AML_OBJECT_TYPE_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x8F */ { AML_OPCODE_DEF ("CreateQWordFieldOp", AML_CREATE_QWORD_FIELD_OP), 0, 3, 2, { EAmlObject, EAmlObject, EAmlName, EAmlNone, EAmlNone, EAmlNone }, AML_IN_NAMESPACE },
+ /* 0x90 */ { AML_OPCODE_DEF ("LAndOp", AML_LAND_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x91 */ { AML_OPCODE_DEF ("LOrOp", AML_LOR_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x92 */ { AML_OPCODE_DEF ("LNotOp", AML_LNOT_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x93 */ { AML_OPCODE_DEF ("LEqualOp", AML_LEQUAL_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x94 */ { AML_OPCODE_DEF ("LGreaterOp", AML_LGREATER_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x95 */ { AML_OPCODE_DEF ("LLessOp", AML_LLESS_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x96 */ { AML_OPCODE_DEF ("ToBufferOp", AML_TO_BUFFER_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x97 */ { AML_OPCODE_DEF ("ToDecimalStringOp", AML_TO_DEC_STRING_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x98 */ { AML_OPCODE_DEF ("ToHexStringOp", AML_TO_HEX_STRING_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x99 */ { AML_OPCODE_DEF ("ToIntegerOp", AML_TO_INTEGER_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x9C */ { AML_OPCODE_DEF ("ToStringOp", AML_TO_STRING_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x9D */ { AML_OPCODE_DEF ("CopyObjectOp", AML_COPY_OBJECT_OP), 0, 2, 0, { EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x9E */ { AML_OPCODE_DEF ("MidOp", AML_MID_OP), 0, 3, 0, { EAmlObject, EAmlObject, EAmlObject, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0x9F */ { AML_OPCODE_DEF ("ContinueOp", AML_CONTINUE_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0xA0 */ { AML_OPCODE_DEF ("IfOp", AML_IF_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
+ /* 0xA1 */ { AML_OPCODE_DEF ("ElseOp", AML_ELSE_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
+ /* 0xA2 */ { AML_OPCODE_DEF ("WhileOp", AML_WHILE_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
+ /* 0xA3 */ { AML_OPCODE_DEF ("NoopOp", AML_NOOP_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0xA4 */ { AML_OPCODE_DEF ("ReturnOp", AML_RETURN_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0xA5 */ { AML_OPCODE_DEF ("BreakOp", AML_BREAK_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0xCC */ { AML_OPCODE_DEF ("BreakPointOp", AML_BREAK_POINT_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
+ /* 0xD0 */ { AML_OPCODE_DEF ("MethodInvocOp", AML_METHOD_INVOC_OP), 0, 2, 0, { EAmlName, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_PSEUDO_OPCODE | AML_HAS_CHILD_OBJ },
+ /* 0xFF */ { AML_OPCODE_DEF ("OnesOp", AML_ONES_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, 0 },
};
/** AML grammar encoding for field elements.
@@ -264,13 +264,13 @@ AML_BYTE_ENCODING mAmlByteEncoding[] = { GLOBAL_REMOVE_IF_UNREFERENCED
STATIC
CONST
-AML_BYTE_ENCODING mAmlFieldEncoding[] = {
+AML_BYTE_ENCODING mAmlFieldEncoding[] = {
// Comment Str OpCode SubOpCode MaxIndex NameIndex 0 1 2 3 4 5 Attribute
- /* 0x00 */ {AML_OPCODE_DEF ("FieldReservedOp", AML_FIELD_RESERVED_OP), 0, 0, 0, {EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT | AML_HAS_PKG_LENGTH},
- /* 0x01 */ {AML_OPCODE_DEF ("FieldAccessOp", AML_FIELD_ACCESS_OP), 0, 2, 0, {EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT},
- /* 0x02 */ {AML_OPCODE_DEF ("FieldConnectionOp", AML_FIELD_CONNECTION_OP), 0, 1, 0, {EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT},
- /* 0x03 */ {AML_OPCODE_DEF ("FieldExtAccessOp", AML_FIELD_EXT_ACCESS_OP), 0, 3, 0, {EAmlUInt8, EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT},
- /* 0x04 */ {AML_OPCODE_DEF ("FieldNamed", AML_FIELD_NAMED_OP), 0, 2, 0, {EAmlName, EAmlFieldPkgLen, EAmlNone, EAmlNone, EAmlNone, EAmlNone}, AML_IS_FIELD_ELEMENT | AML_IS_PSEUDO_OPCODE | AML_IN_NAMESPACE}
+ /* 0x00 */ { AML_OPCODE_DEF ("FieldReservedOp", AML_FIELD_RESERVED_OP), 0, 0, 0, { EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT | AML_HAS_PKG_LENGTH },
+ /* 0x01 */ { AML_OPCODE_DEF ("FieldAccessOp", AML_FIELD_ACCESS_OP), 0, 2, 0, { EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT },
+ /* 0x02 */ { AML_OPCODE_DEF ("FieldConnectionOp", AML_FIELD_CONNECTION_OP), 0, 1, 0, { EAmlObject, EAmlNone, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT },
+ /* 0x03 */ { AML_OPCODE_DEF ("FieldExtAccessOp", AML_FIELD_EXT_ACCESS_OP), 0, 3, 0, { EAmlUInt8, EAmlUInt8, EAmlUInt8, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT },
+ /* 0x04 */ { AML_OPCODE_DEF ("FieldNamed", AML_FIELD_NAMED_OP), 0, 2, 0, { EAmlName, EAmlFieldPkgLen, EAmlNone, EAmlNone, EAmlNone, EAmlNone }, AML_IS_FIELD_ELEMENT | AML_IS_PSEUDO_OPCODE | AML_IN_NAMESPACE }
};
/** Get the AML_BYTE_ENCODING entry in the AML encoding table.
@@ -288,12 +288,12 @@ CONST AML_BYTE_ENCODING *
EFIAPI
AmlGetByteEncoding (
- IN CONST UINT8 * Buffer
+ IN CONST UINT8 *Buffer
)
{
- UINT8 OpCode;
- UINT8 SubOpCode;
- UINT32 Index;
+ UINT8 OpCode;
+ UINT8 SubOpCode;
+ UINT32 Index;
if (Buffer == NULL) {
ASSERT (0);
@@ -311,16 +311,20 @@ AmlGetByteEncoding ( // Search the table.
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
- Index++) {
+ Index++)
+ {
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
- (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
- if ((mAmlByteEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) ==
- AML_IS_PSEUDO_OPCODE) {
+ (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
+ {
+ if ((mAmlByteEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) ==
+ AML_IS_PSEUDO_OPCODE)
+ {
// A pseudo OpCode cannot be parsed as it is internal to this library.
// The MethodInvocation encoding can be detected by NameSpace lookup.
ASSERT (0);
return NULL;
}
+
return &mAmlByteEncoding[Index];
}
}
@@ -341,21 +345,24 @@ CONST AML_BYTE_ENCODING *
EFIAPI
AmlGetByteEncodingByOpCode (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
)
{
- UINT32 Index;
+ UINT32 Index;
// Search the table.
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
- Index++) {
+ Index++)
+ {
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
- (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
+ (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
+ {
return &mAmlByteEncoding[Index];
}
}
+
return NULL;
}
@@ -374,11 +381,11 @@ CONST AML_BYTE_ENCODING *
EFIAPI
AmlGetFieldEncoding (
- IN CONST UINT8 * Buffer
+ IN CONST UINT8 *Buffer
)
{
- UINT8 OpCode;
- UINT32 Index;
+ UINT8 OpCode;
+ UINT32 Index;
if (Buffer == NULL) {
ASSERT (0);
@@ -391,16 +398,19 @@ AmlGetFieldEncoding ( // Search in the table.
for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
- Index++) {
+ Index++)
+ {
if (mAmlFieldEncoding[Index].OpCode == OpCode) {
if ((mAmlFieldEncoding[Index].Attribute & AML_IS_PSEUDO_OPCODE) ==
- AML_IS_PSEUDO_OPCODE) {
+ AML_IS_PSEUDO_OPCODE)
+ {
// A pseudo OpCode cannot be parsed as it is internal to this library.
// The NamedField encoding can be detected because it begins with a
// char.
ASSERT (0);
return NULL;
}
+
return &mAmlFieldEncoding[Index];
}
}
@@ -422,26 +432,30 @@ CONST AML_BYTE_ENCODING *
EFIAPI
AmlGetFieldEncodingByOpCode (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
)
{
- UINT32 Index;
+ UINT32 Index;
// Search the table.
for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
- Index++) {
+ Index++)
+ {
if ((mAmlFieldEncoding[Index].OpCode == OpCode) &&
- (mAmlFieldEncoding[Index].SubOpCode == SubOpCode)) {
+ (mAmlFieldEncoding[Index].SubOpCode == SubOpCode))
+ {
return &mAmlFieldEncoding[Index];
}
}
+
return NULL;
}
// Enable this function for debug.
#if !defined (MDEPKG_NDEBUG)
+
/** Look for an OpCode/SubOpCode couple in the AML grammar,
and return a corresponding string.
@@ -454,8 +468,8 @@ AmlGetFieldEncodingByOpCode ( CONST
CHAR8 *
AmlGetOpCodeStr (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
)
{
EAML_PARSE_INDEX Index;
@@ -463,9 +477,11 @@ AmlGetOpCodeStr ( // Search the table.
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
- Index++) {
+ Index++)
+ {
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
- (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
+ (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
+ {
return mAmlByteEncoding[Index].Str;
}
}
@@ -486,8 +502,8 @@ AmlGetOpCodeStr ( CONST
CHAR8 *
AmlGetFieldOpCodeStr (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
)
{
EAML_PARSE_INDEX Index;
@@ -500,7 +516,8 @@ AmlGetFieldOpCodeStr ( // Search the table.
for (Index = 0;
Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0]));
- Index++) {
+ Index++)
+ {
if ((mAmlFieldEncoding[Index].OpCode == OpCode)) {
return mAmlFieldEncoding[Index].Str;
}
@@ -509,6 +526,7 @@ AmlGetFieldOpCodeStr ( ASSERT (0);
return NULL;
}
+
#endif // MDEPKG_NDEBUG
/** Check whether the OpCode/SubOpcode couple is a valid entry
@@ -523,8 +541,8 @@ AmlGetFieldOpCodeStr ( BOOLEAN
EFIAPI
AmlIsOpCodeValid (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
)
{
EAML_PARSE_INDEX Index;
@@ -532,12 +550,15 @@ AmlIsOpCodeValid ( // Search the table.
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
- Index++) {
+ Index++)
+ {
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
- (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
+ (mAmlByteEncoding[Index].SubOpCode == SubOpCode))
+ {
return TRUE;
}
}
+
return FALSE;
}
@@ -551,7 +572,7 @@ AmlIsOpCodeValid ( GLOBAL_REMOVE_IF_UNREFERENCED
STATIC
CONST
-EAML_NODE_DATA_TYPE mAmlTypeToNodeDataType[] = {
+EAML_NODE_DATA_TYPE mAmlTypeToNodeDataType[] = {
EAmlNodeDataTypeNone, // EAmlNone
EAmlNodeDataTypeUInt, // EAmlUInt8
EAmlNodeDataTypeUInt, // EAmlUInt16
@@ -577,7 +598,8 @@ AmlTypeToNodeDataType ( )
{
if (AmlType >=
- (sizeof (mAmlTypeToNodeDataType) / sizeof (mAmlTypeToNodeDataType[0]))) {
+ (sizeof (mAmlTypeToNodeDataType) / sizeof (mAmlTypeToNodeDataType[0])))
+ {
ASSERT (0);
return EAmlNodeDataTypeNone;
}
@@ -597,17 +619,18 @@ AmlTypeToNodeDataType ( UINT32
EFIAPI
AmlGetPkgLength (
- IN CONST UINT8 * Buffer,
- OUT UINT32 * PkgLength
+ IN CONST UINT8 *Buffer,
+ OUT UINT32 *PkgLength
)
{
- UINT8 LeadByte;
- UINT8 ByteCount;
- UINT32 RealLength;
- UINT32 Offset;
+ UINT8 LeadByte;
+ UINT8 ByteCount;
+ UINT32 RealLength;
+ UINT32 Offset;
if ((Buffer == NULL) ||
- (PkgLength == NULL)) {
+ (PkgLength == NULL))
+ {
ASSERT (0);
return 0;
}
@@ -641,9 +664,9 @@ AmlGetPkgLength ( package length is 2**28.
*/
- LeadByte = *Buffer;
- ByteCount = (LeadByte >> 6) & 0x03U;
- Offset = ByteCount + 1U;
+ LeadByte = *Buffer;
+ ByteCount = (LeadByte >> 6) & 0x03U;
+ Offset = ByteCount + 1U;
RealLength = 0;
// Switch on the number of bytes used to store the PkgLen.
@@ -661,17 +684,17 @@ AmlGetPkgLength ( }
case 2:
{
- RealLength = *(Buffer + 1);
+ RealLength = *(Buffer + 1);
RealLength |= ((UINT32)(*(Buffer + 2))) << 8;
- RealLength = (RealLength << 4) | (LeadByte & 0xF);
+ RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
}
case 3:
{
- RealLength = *(Buffer + 1);
+ RealLength = *(Buffer + 1);
RealLength |= ((UINT32)(*(Buffer + 2))) << 8;
RealLength |= ((UINT32)(*(Buffer + 3))) << 16;
- RealLength = (RealLength << 4) | (LeadByte & 0xF);
+ RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
}
default:
@@ -699,8 +722,8 @@ AmlGetPkgLength ( UINT8
EFIAPI
AmlSetPkgLength (
- IN UINT32 Length,
- OUT UINT8 * Buffer
+ IN UINT32 Length,
+ OUT UINT8 *Buffer
)
{
UINT8 LeadByte;
@@ -715,12 +738,11 @@ AmlSetPkgLength ( }
LeadByte = 0;
- Offset = 0;
+ Offset = 0;
if ((Length < (1 << 6))) {
// Length < 2^6, only need one byte to encode it.
LeadByte = (UINT8)Length;
-
} else {
// Need more than one byte to encode it.
// Test Length to find how many bytes are needed.
@@ -729,19 +751,15 @@ AmlSetPkgLength ( // Length >= 2^28, should not be possible.
ASSERT (0);
return 0;
-
} else if (Length >= (1 << 20)) {
// Length >= 2^20
Offset = 3;
-
} else if (Length >= (1 << 12)) {
// Length >= 2^12
Offset = 2;
-
} else if (Length >= (1 << 6)) {
// Length >= 2^6
Offset = 1;
-
} else {
// Should not be possible.
ASSERT (0);
@@ -754,13 +772,13 @@ AmlSetPkgLength ( }
// Write to the Buffer.
- *Buffer = LeadByte;
+ *Buffer = LeadByte;
CurrentOffset = 1;
while (CurrentOffset < (Offset + 1)) {
- CurrentShift = (UINT8)((CurrentOffset - 1) * 8);
- ComputedLength = Length & (UINT32)(0x00000FF0 << CurrentShift);
- ComputedLength = (ComputedLength) >> (4 + CurrentShift);
- LeadByte = (UINT8)(ComputedLength & 0xFF);
+ CurrentShift = (UINT8)((CurrentOffset - 1) * 8);
+ ComputedLength = Length & (UINT32)(0x00000FF0 << CurrentShift);
+ ComputedLength = (ComputedLength) >> (4 + CurrentShift);
+ LeadByte = (UINT8)(ComputedLength & 0xFF);
*(Buffer + CurrentOffset) = LeadByte;
CurrentOffset++;
}
@@ -786,15 +804,12 @@ AmlComputePkgLengthWidth ( if (Length >= (1 << 28)) {
ASSERT (0);
return 0;
-
} else if (Length >= (1 << 20)) {
// Length >= 2^20
return 4;
-
} else if (Length >= (1 << 12)) {
// Length >= 2^12
return 3;
-
} else if (Length >= (1 << 6)) {
// Length >= 2^6
return 2;
@@ -845,8 +860,8 @@ AmlComputePkgLengthWidth ( EFI_STATUS
EFIAPI
AmlComputePkgLength (
- IN UINT32 Length,
- OUT UINT32 * PkgLen
+ IN UINT32 Length,
+ OUT UINT32 *PkgLen
)
{
UINT32 PkgLenWidth;
@@ -874,7 +889,8 @@ AmlComputePkgLength ( ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Length);
if (ReComputedPkgLenWidth != PkgLenWidth) {
if ((ReComputedPkgLenWidth != 0) &&
- (ReComputedPkgLenWidth < 4)) {
+ (ReComputedPkgLenWidth < 4))
+ {
// No need to recompute the PkgLen since a new threshold cannot
// be reached by incrementing the value by one.
Length += 1;
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.h b/DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.h index 0641500..0c931dc 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.h @@ -15,9 +15,9 @@ #include <IndustryStandard/AcpiAml.h>
#if !defined (MDEPKG_NDEBUG)
-#define AML_OPCODE_DEF(str, OpCode) str, OpCode
+#define AML_OPCODE_DEF(str, OpCode) str, OpCode
#else
-#define AML_OPCODE_DEF(str, OpCode) OpCode
+#define AML_OPCODE_DEF(str, OpCode) OpCode
#endif // MDEPKG_NDEBUG
/** AML types.
@@ -31,7 +31,7 @@ These are internal types.
*/
typedef enum EAmlParseFormat {
- EAmlNone = 0, ///< No data expected.
+ EAmlNone = 0, ///< No data expected.
EAmlUInt8, ///< One byte value evaluated as a UINT8.
EAmlUInt16, ///< Two byte value evaluated as a UINT16.
EAmlUInt32, ///< Four byte value evaluated as a UINT32.
@@ -61,46 +61,46 @@ typedef UINT32 AML_OP_ATTRIBUTE; /** A PkgLength is expected between the OpCode/SubOpCode couple and the first
fixed argument of the object.
*/
-#define AML_HAS_PKG_LENGTH 0x00001U
+#define AML_HAS_PKG_LENGTH 0x00001U
/** The object's OpCode is actually a character. Encodings with this attribute
don't describe objects. The dual/multi name prefix have this attribute,
indicating the start of a longer NameString.
*/
-#define AML_IS_NAME_CHAR 0x00002U
+#define AML_IS_NAME_CHAR 0x00002U
/** A variable list of arguments is following the last fixed argument. Each
argument is evaluated as an EAmlObject.
*/
-#define AML_HAS_CHILD_OBJ 0x00004U
+#define AML_HAS_CHILD_OBJ 0x00004U
/** 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.
*/
-#define AML_HAS_BYTE_LIST 0x00008U
+#define AML_HAS_BYTE_LIST 0x00008U
/** 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.
*/
-#define AML_HAS_FIELD_LIST 0x00010U
+#define AML_HAS_FIELD_LIST 0x00010U
/** This object node is a field element. Its opcode is to be fetched from
the field encoding table.
*/
-#define AML_IS_FIELD_ELEMENT 0x00020U
+#define AML_IS_FIELD_ELEMENT 0x00020U
/** The object has a name and which is part of the AML namespace. The name
can be found in the fixed argument list at the NameIndex.
*/
-#define AML_IN_NAMESPACE 0x10000U
+#define AML_IN_NAMESPACE 0x10000U
/** Some OpCodes have been created in this library. They are called
pseudo opcodes and must stay internal to this library.
*/
-#define AML_IS_PSEUDO_OPCODE 0x20000U
+#define AML_IS_PSEUDO_OPCODE 0x20000U
/** Encoding of an AML object.
@@ -112,37 +112,37 @@ typedef UINT32 AML_OP_ATTRIBUTE; Cf. ACPI 6.3 specification, s20.2.
*/
typedef struct _AML_BYTE_ENCODING {
-// Enable this field for debug.
-#if !defined (MDEPKG_NDEBUG)
+ // Enable this field for debug.
+ #if !defined (MDEPKG_NDEBUG)
/// String field allowing to print the AML object.
- CONST CHAR8 * Str;
-#endif // MDEPKG_NDEBUG
+ CONST CHAR8 *Str;
+ #endif // MDEPKG_NDEBUG
/// OpCode of the AML object.
- UINT8 OpCode;
+ UINT8 OpCode;
/// SubOpCode of the AML object.
/// The SubOpcode field has a valid value when the OpCode is 0x5B,
/// otherwise this field must be zero.
/// For field objects, the SubOpCode is not used.
- UINT8 SubOpCode;
+ UINT8 SubOpCode;
/// Number of fixed arguments for the AML statement represented
/// by the OpCode & SubOpcode.
/// Maximum is 6 for AML objects.
/// Maximum is 3 for field objects.
- EAML_PARSE_INDEX MaxIndex;
+ EAML_PARSE_INDEX MaxIndex;
/// If the encoding has the AML_IN_NAMESPACE attribute (cf Attribute
/// field below), indicate where to find the name in the fixed list
/// of arguments.
- EAML_PARSE_INDEX NameIndex;
+ EAML_PARSE_INDEX NameIndex;
/// Type of each fixed argument.
- AML_PARSE_FORMAT Format[EAmlParseIndexMax];
+ AML_PARSE_FORMAT Format[EAmlParseIndexMax];
/// Additional information on the AML object.
- AML_OP_ATTRIBUTE Attribute;
+ AML_OP_ATTRIBUTE Attribute;
} AML_BYTE_ENCODING;
/** Get the AML_BYTE_ENCODING entry in the AML encoding table.
@@ -160,7 +160,7 @@ CONST AML_BYTE_ENCODING *
EFIAPI
AmlGetByteEncoding (
- IN CONST UINT8 * Buffer
+ IN CONST UINT8 *Buffer
);
/** Get the AML_BYTE_ENCODING entry in the AML encoding table
@@ -176,8 +176,8 @@ CONST AML_BYTE_ENCODING *
EFIAPI
AmlGetByteEncodingByOpCode (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
);
/** Get the AML_BYTE_ENCODING entry in the field encoding table.
@@ -195,7 +195,7 @@ CONST AML_BYTE_ENCODING *
EFIAPI
AmlGetFieldEncoding (
- IN CONST UINT8 * Buffer
+ IN CONST UINT8 *Buffer
);
/** Get the AML_BYTE_ENCODING entry in the field encoding table
@@ -212,12 +212,13 @@ CONST AML_BYTE_ENCODING *
EFIAPI
AmlGetFieldEncodingByOpCode (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
);
// Enable this function for debug.
#if !defined (MDEPKG_NDEBUG)
+
/** Look for an OpCode/SubOpCode couple in the AML grammar,
and return a corresponding string.
@@ -230,8 +231,8 @@ AmlGetFieldEncodingByOpCode ( CONST
CHAR8 *
AmlGetOpCodeStr (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
);
/** Look for an OpCode/SubOpCode couple in the AML field element grammar,
@@ -246,9 +247,10 @@ AmlGetOpCodeStr ( CONST
CHAR8 *
AmlGetFieldOpCodeStr (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
);
+
#endif // MDEPKG_NDEBUG
/** Check whether the OpCode/SubOpcode couple is a valid entry
@@ -263,8 +265,8 @@ AmlGetFieldOpCodeStr ( BOOLEAN
EFIAPI
AmlIsOpCodeValid (
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
);
/** Convert an AML_PARSE_FORMAT to its corresponding EAML_NODE_DATA_TYPE.
@@ -292,8 +294,8 @@ AmlTypeToNodeDataType ( UINT32
EFIAPI
AmlGetPkgLength (
- IN CONST UINT8 * Buffer,
- OUT UINT32 * PkgLength
+ IN CONST UINT8 *Buffer,
+ OUT UINT32 *PkgLength
);
/** Convert the Length to the AML PkgLen encoding,
@@ -308,8 +310,8 @@ AmlGetPkgLength ( UINT8
EFIAPI
AmlSetPkgLength (
- IN UINT32 Length,
- OUT UINT8 * Buffer
+ IN UINT32 Length,
+ OUT UINT8 *Buffer
);
/** Compute the number of bytes required to write a package length.
@@ -367,9 +369,8 @@ AmlComputePkgLengthWidth ( EFI_STATUS
EFIAPI
AmlComputePkgLength (
- IN UINT32 Length,
- OUT UINT32 * PkgLen
+ IN UINT32 Length,
+ OUT UINT32 *PkgLen
);
#endif // AML_H_
-
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlNodeDefines.h b/DynamicTablesPkg/Library/Common/AmlLib/AmlNodeDefines.h index fffba6d..8ceb20f 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlNodeDefines.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlNodeDefines.h @@ -22,7 +22,7 @@ typedef struct AmlNodeHeader { LIST_ENTRY Link;
/// Parent of this node. NULL for the root node.
- struct AmlNodeHeader * Parent;
+ struct AmlNodeHeader *Parent;
/// Node type allowing to identify a root/object/data node.
EAML_NODE_TYPE NodeType;
@@ -30,7 +30,7 @@ typedef struct AmlNodeHeader { /** Node handle.
*/
-typedef AML_NODE_HEADER* AML_NODE_HANDLE;
+typedef AML_NODE_HEADER *AML_NODE_HANDLE;
/** AML root node.
@@ -47,12 +47,12 @@ typedef struct AmlRootNode { LIST_ENTRY VariableArgs;
/// ACPI DSDT/SSDT header.
- EFI_ACPI_DESCRIPTION_HEADER * SdtHeader;
+ EFI_ACPI_DESCRIPTION_HEADER *SdtHeader;
} AML_ROOT_NODE;
/** Root Node handle.
*/
-typedef AML_ROOT_NODE* AML_ROOT_NODE_HANDLE;
+typedef AML_ROOT_NODE *AML_ROOT_NODE_HANDLE;
/** AML object node.
@@ -71,11 +71,11 @@ typedef struct AmlObjectNode { /// Fixed arguments of this object node.
/// These are children and can be object/data nodes.
/// Cf ACPI specification, s20.3.
- AML_NODE_HEADER * FixedArgs[EAmlParseIndexMax];
+ AML_NODE_HEADER *FixedArgs[EAmlParseIndexMax];
/// AML byte encoding. Stores the encoding information:
/// (OpCode/SubOpCode/number of fixed arguments/ attributes).
- CONST AML_BYTE_ENCODING * AmlByteEncoding;
+ CONST AML_BYTE_ENCODING *AmlByteEncoding;
/// Some nodes have a PkgLen following their OpCode/SubOpCode in the
/// AML bytestream. This field stores the decoded value of the PkgLen.
@@ -84,7 +84,7 @@ typedef struct AmlObjectNode { /** Object Node handle.
*/
-typedef AML_OBJECT_NODE* AML_OBJECT_NODE_HANDLE;
+typedef AML_OBJECT_NODE *AML_OBJECT_NODE_HANDLE;
/** AML data node.
@@ -94,22 +94,22 @@ typedef AML_OBJECT_NODE* AML_OBJECT_NODE_HANDLE; */
typedef struct AmlDataNode {
/// Header information. Must be the first field of the struct.
- AML_NODE_HEADER NodeHeader;
+ AML_NODE_HEADER NodeHeader;
/// Tag identifying what data is stored in this node.
/// E.g. UINT, NULL terminated string, resource data element, etc.
- EAML_NODE_DATA_TYPE DataType;
+ EAML_NODE_DATA_TYPE DataType;
/// Buffer containing the data stored by this node.
- UINT8 * Buffer;
+ UINT8 *Buffer;
/// Size of the Buffer.
- UINT32 Size;
+ UINT32 Size;
} AML_DATA_NODE;
/** Data Node handle.
*/
-typedef AML_DATA_NODE* AML_DATA_NODE_HANDLE;
+typedef AML_DATA_NODE *AML_DATA_NODE_HANDLE;
/** Check whether a Node has a valid NodeType.
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c index 6f9e3f6..e6802d2 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c @@ -39,21 +39,22 @@ EFI_STATUS
EFIAPI
AmlDeviceOpUpdateName (
- IN AML_OBJECT_NODE_HANDLE DeviceOpNode,
- IN CHAR8 * NewNameString
+ IN AML_OBJECT_NODE_HANDLE DeviceOpNode,
+ IN CHAR8 *NewNameString
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_DATA_NODE_HANDLE DeviceNameDataNode;
- CHAR8 * NewAmlNameString;
- UINT32 NewAmlNameStringSize;
+ AML_DATA_NODE_HANDLE DeviceNameDataNode;
+ CHAR8 *NewAmlNameString;
+ UINT32 NewAmlNameStringSize;
// Check the input node is an object node.
if ((DeviceOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)DeviceOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (DeviceOpNode, AML_EXT_OP, AML_EXT_DEVICE_OP)) ||
- (NewNameString == NULL)) {
+ (NewNameString == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -66,7 +67,8 @@ AmlDeviceOpUpdateName ( );
if ((DeviceNameDataNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)DeviceNameDataNode) != EAmlNodeData) ||
- (!AmlNodeHasDataType (DeviceNameDataNode, EAmlNodeDataTypeNameString))) {
+ (!AmlNodeHasDataType (DeviceNameDataNode, EAmlNodeDataTypeNameString)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -87,7 +89,7 @@ AmlDeviceOpUpdateName ( Status = AmlUpdateDataNode (
DeviceNameDataNode,
EAmlNodeDataTypeNameString,
- (UINT8*)NewAmlNameString,
+ (UINT8 *)NewAmlNameString,
NewAmlNameStringSize
);
ASSERT_EFI_ERROR (Status);
@@ -124,7 +126,8 @@ AmlNameOpUpdateInteger ( if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
- (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
+ (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -138,7 +141,8 @@ AmlNameOpUpdateInteger ( EAmlParseIndexTerm1
);
if ((IntegerOpNode == NULL) ||
- (AmlGetNodeType ((AML_NODE_HANDLE)IntegerOpNode) != EAmlNodeObject)) {
+ (AmlGetNodeType ((AML_NODE_HANDLE)IntegerOpNode) != EAmlNodeObject))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -170,8 +174,8 @@ AmlNameOpUpdateInteger ( EFI_STATUS
EFIAPI
AmlNameOpUpdateString (
- IN AML_OBJECT_NODE_HANDLE NameOpNode,
- IN CONST CHAR8 * NewName
+ IN AML_OBJECT_NODE_HANDLE NameOpNode,
+ IN CONST CHAR8 *NewName
)
{
EFI_STATUS Status;
@@ -180,7 +184,8 @@ AmlNameOpUpdateString ( if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
- (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
+ (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -193,7 +198,8 @@ AmlNameOpUpdateString ( EAmlParseIndexTerm1
);
if ((StringOpNode == NULL) ||
- (AmlGetNodeType ((AML_NODE_HANDLE)StringOpNode) != EAmlNodeObject)) {
+ (AmlGetNodeType ((AML_NODE_HANDLE)StringOpNode) != EAmlNodeObject))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -205,7 +211,8 @@ AmlNameOpUpdateString ( EAmlParseIndexTerm0
);
if ((StringDataNode == NULL) ||
- (AmlGetNodeType ((AML_NODE_HANDLE)StringDataNode) != EAmlNodeData)) {
+ (AmlGetNodeType ((AML_NODE_HANDLE)StringDataNode) != EAmlNodeData))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -214,7 +221,7 @@ AmlNameOpUpdateString ( Status = AmlUpdateDataNode (
StringDataNode,
EAmlNodeDataTypeString,
- (UINT8*)NewName,
+ (UINT8 *)NewName,
(UINT32)AsciiStrLen (NewName) + 1
);
ASSERT_EFI_ERROR (Status);
@@ -250,8 +257,8 @@ AmlNameOpUpdateString ( EFI_STATUS
EFIAPI
AmlNameOpGetFirstRdNode (
- IN AML_OBJECT_NODE_HANDLE NameOpNode,
- OUT AML_DATA_NODE_HANDLE * OutRdNode
+ IN AML_OBJECT_NODE_HANDLE NameOpNode,
+ OUT AML_DATA_NODE_HANDLE *OutRdNode
)
{
AML_OBJECT_NODE_HANDLE BufferOpNode;
@@ -260,7 +267,8 @@ AmlNameOpGetFirstRdNode ( if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
- (OutRdNode == NULL)) {
+ (OutRdNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -275,7 +283,8 @@ AmlNameOpGetFirstRdNode ( );
if ((BufferOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
- (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
+ (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -288,7 +297,8 @@ AmlNameOpGetFirstRdNode ( );
if ((FirstRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)FirstRdNode) != EAmlNodeData) ||
- (!AmlNodeHasDataType (FirstRdNode, EAmlNodeDataTypeResourceData))) {
+ (!AmlNodeHasDataType (FirstRdNode, EAmlNodeDataTypeResourceData)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -327,17 +337,18 @@ AmlNameOpGetFirstRdNode ( EFI_STATUS
EFIAPI
AmlNameOpGetNextRdNode (
- IN AML_DATA_NODE_HANDLE CurrRdNode,
- OUT AML_DATA_NODE_HANDLE * OutRdNode
+ IN AML_DATA_NODE_HANDLE CurrRdNode,
+ OUT AML_DATA_NODE_HANDLE *OutRdNode
)
{
- AML_OBJECT_NODE_HANDLE NameOpNode;
- AML_OBJECT_NODE_HANDLE BufferOpNode;
+ AML_OBJECT_NODE_HANDLE NameOpNode;
+ AML_OBJECT_NODE_HANDLE BufferOpNode;
if ((CurrRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)CurrRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (CurrRdNode, EAmlNodeDataTypeResourceData)) ||
- (OutRdNode == NULL)) {
+ (OutRdNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -349,7 +360,8 @@ AmlNameOpGetNextRdNode ( (AML_NODE_HANDLE)CurrRdNode
);
if ((BufferOpNode == NULL) ||
- (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
+ (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -359,7 +371,8 @@ AmlNameOpGetNextRdNode ( (AML_NODE_HANDLE)BufferOpNode
);
if ((NameOpNode == NULL) ||
- (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
+ (!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -372,7 +385,9 @@ AmlNameOpGetNextRdNode ( // If the Resource Data is an End Tag, return NULL.
if (AmlNodeHasRdDataType (
*OutRdNode,
- AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+ AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+ ))
+ {
*OutRdNode = NULL;
}
@@ -415,8 +430,8 @@ AmlNameOpGetNextRdNode ( EFI_STATUS
EFIAPI
AmlNameOpCrsGetFirstRdNode (
- IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
- OUT AML_DATA_NODE_HANDLE * OutRdNode
+ IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
+ OUT AML_DATA_NODE_HANDLE *OutRdNode
)
{
return AmlNameOpGetFirstRdNode (NameOpCrsNode, OutRdNode);
@@ -455,8 +470,8 @@ AmlNameOpCrsGetFirstRdNode ( EFI_STATUS
EFIAPI
AmlNameOpCrsGetNextRdNode (
- IN AML_DATA_NODE_HANDLE CurrRdNode,
- OUT AML_DATA_NODE_HANDLE * OutRdNode
+ IN AML_DATA_NODE_HANDLE CurrRdNode,
+ OUT AML_DATA_NODE_HANDLE *OutRdNode
)
{
return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode);
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.c b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.c index 9693f28..391c72b 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.c @@ -44,22 +44,23 @@ BOOLEAN
EFIAPI
AmlNameOpCompareName (
- IN AML_OBJECT_NODE_HANDLE NameOpNode,
- IN CHAR8 * AslName
+ IN AML_OBJECT_NODE_HANDLE NameOpNode,
+ IN CHAR8 *AslName
)
{
- EFI_STATUS Status;
- AML_DATA_NODE_HANDLE NameDataNode;
+ EFI_STATUS Status;
+ AML_DATA_NODE_HANDLE NameDataNode;
- CHAR8 * AmlName;
- UINT32 AmlNameSize;
+ CHAR8 *AmlName;
+ UINT32 AmlNameSize;
- BOOLEAN RetVal;
+ BOOLEAN RetVal;
if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)) ||
- (AslName == NULL)) {
+ (AslName == NULL))
+ {
ASSERT (0);
return FALSE;
}
@@ -72,7 +73,8 @@ AmlNameOpCompareName ( );
if ((NameDataNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameDataNode) != EAmlNodeData) ||
- (!AmlNodeHasDataType (NameDataNode, EAmlNodeDataTypeNameString))) {
+ (!AmlNodeHasDataType (NameDataNode, EAmlNodeDataTypeNameString)))
+ {
ASSERT (0);
return FALSE;
}
@@ -92,7 +94,7 @@ AmlNameOpCompareName ( }
// Fetch the name.
- Status = AmlGetDataNodeBuffer (NameDataNode, (UINT8*)AmlName, &AmlNameSize);
+ Status = AmlGetDataNodeBuffer (NameDataNode, (UINT8 *)AmlName, &AmlNameSize);
if (EFI_ERROR (Status)) {
FreePool (AmlName);
ASSERT (0);
@@ -120,14 +122,14 @@ AmlNameOpCompareName ( BOOLEAN
EFIAPI
AmlNodeHasOpCode (
- IN AML_OBJECT_NODE_HANDLE ObjectNode,
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN AML_OBJECT_NODE_HANDLE ObjectNode,
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
)
{
- EFI_STATUS Status;
- UINT8 NodeOpCode;
- UINT8 NodeSubOpCode;
+ EFI_STATUS Status;
+ UINT8 NodeOpCode;
+ UINT8 NodeSubOpCode;
// Get the Node information.
Status = AmlGetObjectNodeInfo (
@@ -144,7 +146,8 @@ AmlNodeHasOpCode ( // Check the OpCode and SubOpCode.
if ((OpCode != NodeOpCode) ||
- (SubOpCode != NodeSubOpCode)) {
+ (SubOpCode != NodeSubOpCode))
+ {
return FALSE;
}
@@ -163,12 +166,12 @@ AmlNodeHasOpCode ( BOOLEAN
EFIAPI
AmlNodeHasDataType (
- IN AML_DATA_NODE_HANDLE DataNode,
- IN EAML_NODE_DATA_TYPE DataType
+ IN AML_DATA_NODE_HANDLE DataNode,
+ IN EAML_NODE_DATA_TYPE DataType
)
{
- EFI_STATUS Status;
- EAML_NODE_DATA_TYPE NodeDataType;
+ EFI_STATUS Status;
+ EAML_NODE_DATA_TYPE NodeDataType;
// Get the data type.
Status = AmlGetNodeDataType (DataNode, &NodeDataType);
@@ -197,12 +200,12 @@ AmlNodeHasDataType ( BOOLEAN
EFIAPI
AmlNodeHasRdDataType (
- IN AML_DATA_NODE_HANDLE RdNode,
- IN AML_RD_HEADER RdDataType
+ IN AML_DATA_NODE_HANDLE RdNode,
+ IN AML_RD_HEADER RdDataType
)
{
- EFI_STATUS Status;
- AML_RD_HEADER NodeRdDataType;
+ EFI_STATUS Status;
+ AML_RD_HEADER NodeRdDataType;
// Get the resource data type.
Status = AmlGetResourceDataType (
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.h b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.h index 9872add..8bbf62b 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.h @@ -36,8 +36,8 @@ BOOLEAN
EFIAPI
AmlNameOpCompareName (
- IN AML_OBJECT_NODE_HANDLE NameOpNode,
- IN CHAR8 * AslName
+ IN AML_OBJECT_NODE_HANDLE NameOpNode,
+ IN CHAR8 *AslName
);
/** Check whether ObjectNode has the input OpCode/SubOpcode couple.
@@ -53,9 +53,9 @@ AmlNameOpCompareName ( BOOLEAN
EFIAPI
AmlNodeHasOpCode (
- IN AML_OBJECT_NODE_HANDLE ObjectNode,
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN AML_OBJECT_NODE_HANDLE ObjectNode,
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
);
/** Check whether DataNode has the input DataType.
@@ -70,8 +70,8 @@ AmlNodeHasOpCode ( BOOLEAN
EFIAPI
AmlNodeHasDataType (
- IN AML_DATA_NODE_HANDLE DataNode,
- IN EAML_NODE_DATA_TYPE DataType
+ IN AML_DATA_NODE_HANDLE DataNode,
+ IN EAML_NODE_DATA_TYPE DataType
);
/** Check whether RdNode has the input RdDataType.
@@ -86,8 +86,8 @@ AmlNodeHasDataType ( BOOLEAN
EFIAPI
AmlNodeHasRdDataType (
- IN AML_DATA_NODE_HANDLE RdNode,
- IN AML_RD_HEADER RdDataType
+ IN AML_DATA_NODE_HANDLE RdNode,
+ IN AML_RD_HEADER RdDataType
);
#endif // AML_HELPER_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlResourceDataApi.c b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlResourceDataApi.c index 913c8dc..d261adb 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlResourceDataApi.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlResourceDataApi.c @@ -41,24 +41,28 @@ EFI_STATUS
EFIAPI
AmlUpdateRdInterrupt (
- IN AML_DATA_NODE_HANDLE InterruptRdNode,
- IN UINT32 Irq
+ IN AML_DATA_NODE_HANDLE InterruptRdNode,
+ IN UINT32 Irq
)
{
- EFI_STATUS Status;
- UINT32 * FirstInterrupt;
- UINT8 * QueryBuffer;
- UINT32 QueryBufferSize;
+ EFI_STATUS Status;
+ UINT32 *FirstInterrupt;
+ UINT8 *QueryBuffer;
+ UINT32 QueryBufferSize;
if ((InterruptRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (
InterruptRdNode,
- EAmlNodeDataTypeResourceData)) ||
+ EAmlNodeDataTypeResourceData
+ )) ||
(!AmlNodeHasRdDataType (
InterruptRdNode,
AML_RD_BUILD_LARGE_DESC_ID (
- ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME)))) {
+ ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME
+ )
+ )))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -102,7 +106,7 @@ AmlUpdateRdInterrupt ( // Get the address of the first interrupt field.
FirstInterrupt =
- ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)QueryBuffer)->InterruptNumber;
+ ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)QueryBuffer)->InterruptNumber;
*FirstInterrupt = Irq;
@@ -121,6 +125,7 @@ error_handler: if (QueryBuffer != NULL) {
FreePool (QueryBuffer);
}
+
return Status;
}
@@ -151,40 +156,44 @@ error_handler: EFI_STATUS
EFIAPI
AmlUpdateRdInterruptEx (
- IN AML_DATA_NODE_HANDLE InterruptRdNode,
- IN BOOLEAN ResourceConsumer,
- IN BOOLEAN EdgeTriggered,
- IN BOOLEAN ActiveLow,
- IN BOOLEAN Shared,
- IN UINT32 * IrqList,
- IN UINT8 IrqCount
+ IN AML_DATA_NODE_HANDLE InterruptRdNode,
+ IN BOOLEAN ResourceConsumer,
+ IN BOOLEAN EdgeTriggered,
+ IN BOOLEAN ActiveLow,
+ IN BOOLEAN Shared,
+ IN UINT32 *IrqList,
+ IN UINT8 IrqCount
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR * RdInterrupt;
- UINT32 * FirstInterrupt;
- UINT8 * UpdateBuffer;
- UINT16 UpdateBufferSize;
+ EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *RdInterrupt;
+ UINT32 *FirstInterrupt;
+ UINT8 *UpdateBuffer;
+ UINT16 UpdateBufferSize;
if ((InterruptRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)InterruptRdNode) != EAmlNodeData) ||
(!AmlNodeHasDataType (
InterruptRdNode,
- EAmlNodeDataTypeResourceData)) ||
+ EAmlNodeDataTypeResourceData
+ )) ||
(!AmlNodeHasRdDataType (
InterruptRdNode,
AML_RD_BUILD_LARGE_DESC_ID (
- ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME))) ||
+ ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME
+ )
+ )) ||
(IrqList == NULL) ||
- (IrqCount == 0)) {
+ (IrqCount == 0))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- UpdateBuffer = NULL;
+ UpdateBuffer = NULL;
UpdateBufferSize = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) +
- ((IrqCount - 1) * sizeof (UINT32));
+ ((IrqCount - 1) * sizeof (UINT32));
// Allocate a buffer to update the data.
UpdateBuffer = AllocatePool (UpdateBufferSize);
@@ -194,9 +203,9 @@ AmlUpdateRdInterruptEx ( }
// Update the Resource Data information (structure size, interrupt count).
- RdInterrupt = (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)UpdateBuffer;
+ RdInterrupt = (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)UpdateBuffer;
RdInterrupt->Header.Header.Byte =
- AML_RD_BUILD_LARGE_DESC_ID (ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME);
+ AML_RD_BUILD_LARGE_DESC_ID (ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME);
RdInterrupt->Header.Length =
UpdateBufferSize - sizeof (ACPI_LARGE_RESOURCE_HEADER);
RdInterrupt->InterruptTableLength = IrqCount;
@@ -207,7 +216,7 @@ AmlUpdateRdInterruptEx ( // Get the address of the first interrupt field.
FirstInterrupt =
- ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR*)UpdateBuffer)->InterruptNumber;
+ ((EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR *)UpdateBuffer)->InterruptNumber;
// Copy the input list of interrupts.
CopyMem (FirstInterrupt, IrqList, (sizeof (UINT32) * IrqCount));
@@ -248,11 +257,11 @@ AmlUpdateRdQWord ( IN UINT64 BaseAddressLength
)
{
- EFI_STATUS Status;
- EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR * RdQWord;
+ EFI_STATUS Status;
+ EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR *RdQWord;
- UINT8 * QueryBuffer;
- UINT32 QueryBufferSize;
+ UINT8 *QueryBuffer;
+ UINT32 QueryBufferSize;
if ((QWordRdNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)QWordRdNode) != EAmlNodeData) ||
@@ -260,7 +269,10 @@ AmlUpdateRdQWord ( (!AmlNodeHasRdDataType (
QWordRdNode,
AML_RD_BUILD_LARGE_DESC_ID (
- ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME)))) {
+ ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME
+ )
+ )))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -294,12 +306,12 @@ AmlUpdateRdQWord ( goto error_handler;
}
- RdQWord = (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR*)QueryBuffer;
+ RdQWord = (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR *)QueryBuffer;
// Update the Base Address and Length.
RdQWord->AddrRangeMin = BaseAddress;
RdQWord->AddrRangeMax = BaseAddress + BaseAddressLength - 1;
- RdQWord->AddrLen = BaseAddressLength;
+ RdQWord->AddrLen = BaseAddressLength;
// Update Base Address Resource Data node.
Status = AmlUpdateDataNode (
@@ -316,5 +328,6 @@ error_handler: if (QueryBuffer != NULL) {
FreePool (QueryBuffer);
}
+
return Status;
}
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index bb739e6..15cab83 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -35,12 +35,12 @@ STATIC EFI_STATUS
EFIAPI
LinkNode (
- IN AML_OBJECT_NODE * Node,
- IN AML_NODE_HEADER * ParentNode,
- OUT AML_OBJECT_NODE ** NewObjectNode
+ IN AML_OBJECT_NODE *Node,
+ IN AML_NODE_HEADER *ParentNode,
+ OUT AML_OBJECT_NODE **NewObjectNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (NewObjectNode != NULL) {
*NewObjectNode = NULL;
@@ -48,7 +48,7 @@ LinkNode ( // Add RdNode as the last element.
if (ParentNode != NULL) {
- Status = AmlVarListAddTail (ParentNode, (AML_NODE_HEADER*)Node);
+ Status = AmlVarListAddTail (ParentNode, (AML_NODE_HEADER *)Node);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -89,31 +89,32 @@ LinkNode ( EFI_STATUS
EFIAPI
AmlCodeGenDefinitionBlock (
- IN CONST CHAR8 * TableSignature,
- IN CONST CHAR8 * OemId,
- IN CONST CHAR8 * OemTableId,
- IN UINT32 OemRevision,
- OUT AML_ROOT_NODE ** NewRootNode
+ IN CONST CHAR8 *TableSignature,
+ IN CONST CHAR8 *OemId,
+ IN CONST CHAR8 *OemTableId,
+ IN UINT32 OemRevision,
+ OUT AML_ROOT_NODE **NewRootNode
)
{
- EFI_STATUS Status;
- EFI_ACPI_DESCRIPTION_HEADER AcpiHeader;
+ EFI_STATUS Status;
+ EFI_ACPI_DESCRIPTION_HEADER AcpiHeader;
if ((TableSignature == NULL) ||
(OemId == NULL) ||
(OemTableId == NULL) ||
- (NewRootNode == NULL)) {
+ (NewRootNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
CopyMem (&AcpiHeader.Signature, TableSignature, 4);
- AcpiHeader.Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+ AcpiHeader.Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
AcpiHeader.Revision = 2;
CopyMem (&AcpiHeader.OemId, OemId, 6);
CopyMem (&AcpiHeader.OemTableId, OemTableId, 8);
- AcpiHeader.OemRevision = OemRevision;
- AcpiHeader.CreatorId = TABLE_GENERATOR_CREATOR_ID_ARM;
+ AcpiHeader.OemRevision = OemRevision;
+ AcpiHeader.CreatorId = TABLE_GENERATOR_CREATOR_ID_ARM;
AcpiHeader.CreatorRevision = CREATE_REVISION (1, 0);
Status = AmlCreateRootNode (&AcpiHeader, NewRootNode);
@@ -136,16 +137,17 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenString (
- IN CHAR8 * String,
- OUT AML_OBJECT_NODE ** NewObjectNode
+ IN CHAR8 *String,
+ OUT AML_OBJECT_NODE **NewObjectNode
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
- AML_DATA_NODE * DataNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
+ AML_DATA_NODE *DataNode;
if ((String == NULL) ||
- (NewObjectNode == NULL)) {
+ (NewObjectNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -164,7 +166,7 @@ AmlCodeGenString ( Status = AmlCreateDataNode (
EAmlNodeDataTypeString,
- (UINT8*)String,
+ (UINT8 *)String,
(UINT32)AsciiStrLen (String) + 1,
&DataNode
);
@@ -176,11 +178,11 @@ AmlCodeGenString ( Status = AmlSetFixedArgument (
ObjectNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)DataNode
+ (AML_NODE_HEADER *)DataNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)DataNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
goto error_handler;
}
@@ -188,7 +190,7 @@ AmlCodeGenString ( return Status;
error_handler:
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
return Status;
}
@@ -206,20 +208,20 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenInteger (
- IN UINT64 Integer,
- OUT AML_OBJECT_NODE ** NewObjectNode
+ IN UINT64 Integer,
+ OUT AML_OBJECT_NODE **NewObjectNode
)
{
- EFI_STATUS Status;
- INT8 ValueWidthDiff;
+ EFI_STATUS Status;
+ INT8 ValueWidthDiff;
if (NewObjectNode == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- // Create an object node containing Zero.
- Status = AmlCreateObjectNode (
+ // Create an object node containing Zero.
+ Status = AmlCreateObjectNode (
AmlGetByteEncodingByOpCode (AML_ZERO_OP, 0),
0,
NewObjectNode
@@ -233,7 +235,7 @@ AmlCodeGenInteger ( Status = AmlNodeSetIntegerValue (*NewObjectNode, Integer, &ValueWidthDiff);
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)*NewObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)*NewObjectNode);
}
return Status;
@@ -255,12 +257,12 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenPackage (
- OUT AML_OBJECT_NODE ** NewObjectNode
+ OUT AML_OBJECT_NODE **NewObjectNode
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * DataNode;
- UINT8 NodeCount;
+ EFI_STATUS Status;
+ AML_DATA_NODE *DataNode;
+ UINT8 NodeCount;
if (NewObjectNode == NULL) {
ASSERT (0);
@@ -301,7 +303,7 @@ AmlCodeGenPackage ( Status = AmlSetFixedArgument (
*NewObjectNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)DataNode
+ (AML_NODE_HEADER *)DataNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -311,10 +313,11 @@ AmlCodeGenPackage ( return Status;
error_handler:
- AmlDeleteTree ((AML_NODE_HEADER*)*NewObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)*NewObjectNode);
if (DataNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)DataNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
}
+
return Status;
}
@@ -341,27 +344,28 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenBuffer (
- IN CONST UINT8 * Buffer OPTIONAL,
- IN UINT32 BufferSize OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode
+ IN CONST UINT8 *Buffer OPTIONAL,
+ IN UINT32 BufferSize OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * BufferNode;
- AML_OBJECT_NODE * BufferSizeNode;
- UINT32 BufferSizeNodeSize;
- AML_DATA_NODE * DataNode;
- UINT32 PkgLen;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *BufferNode;
+ AML_OBJECT_NODE *BufferSizeNode;
+ UINT32 BufferSizeNodeSize;
+ AML_DATA_NODE *DataNode;
+ UINT32 PkgLen;
// Buffer and BufferSize must be either both set, or both clear.
if ((NewObjectNode == NULL) ||
- ((Buffer == NULL) != (BufferSize == 0))) {
+ ((Buffer == NULL) != (BufferSize == 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
BufferNode = NULL;
- DataNode = NULL;
+ DataNode = NULL;
// Cf ACPI 6.3 specification, s20.2.5.4 "Type 2 Opcodes Encoding"
// DefBuffer := BufferOp PkgLength BufferSize ByteList
@@ -376,7 +380,7 @@ AmlCodeGenBuffer ( // Get the number of bytes required to encode the BufferSizeNode.
Status = AmlComputeSize (
- (AML_NODE_HEADER*)BufferSizeNode,
+ (AML_NODE_HEADER *)BufferSizeNode,
&BufferSizeNodeSize
);
if (EFI_ERROR (Status)) {
@@ -406,7 +410,7 @@ AmlCodeGenBuffer ( Status = AmlSetFixedArgument (
BufferNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)BufferSizeNode
+ (AML_NODE_HEADER *)BufferSizeNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -430,8 +434,8 @@ AmlCodeGenBuffer ( }
Status = AmlVarListAddTail (
- (AML_NODE_HEADER*)BufferNode,
- (AML_NODE_HEADER*)DataNode
+ (AML_NODE_HEADER *)BufferNode,
+ (AML_NODE_HEADER *)DataNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -444,14 +448,17 @@ AmlCodeGenBuffer ( error_handler:
if (BufferSizeNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)BufferSizeNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)BufferSizeNode);
}
+
if (BufferNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)BufferNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)BufferNode);
}
+
if (DataNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)DataNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
}
+
return Status;
}
@@ -477,11 +484,11 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenResourceTemplate (
- OUT AML_OBJECT_NODE ** NewObjectNode
+ OUT AML_OBJECT_NODE **NewObjectNode
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * BufferNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *BufferNode;
if (NewObjectNode == NULL) {
ASSERT (0);
@@ -499,7 +506,7 @@ AmlCodeGenResourceTemplate ( Status = AmlCodeGenEndTag (0, BufferNode, NULL);
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)BufferNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)BufferNode);
return Status;
}
@@ -526,27 +533,28 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenName (
- IN CONST CHAR8 * NameString,
- IN AML_OBJECT_NODE * Object,
- IN AML_NODE_HEADER * ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
+ IN CONST CHAR8 *NameString,
+ IN AML_OBJECT_NODE *Object,
+ IN AML_NODE_HEADER *ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
- AML_DATA_NODE * DataNode;
- CHAR8 * AmlNameString;
- UINT32 AmlNameStringSize;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
+ AML_DATA_NODE *DataNode;
+ CHAR8 *AmlNameString;
+ UINT32 AmlNameStringSize;
if ((NameString == NULL) ||
(Object == NULL) ||
- ((ParentNode == NULL) && (NewObjectNode == NULL))) {
+ ((ParentNode == NULL) && (NewObjectNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- ObjectNode = NULL;
- DataNode = NULL;
+ ObjectNode = NULL;
+ DataNode = NULL;
AmlNameString = NULL;
Status = ConvertAslNameToAmlName (NameString, &AmlNameString);
@@ -573,7 +581,7 @@ AmlCodeGenName ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString,
- (UINT8*)AmlNameString,
+ (UINT8 *)AmlNameString,
AmlNameStringSize,
&DataNode
);
@@ -585,18 +593,18 @@ AmlCodeGenName ( Status = AmlSetFixedArgument (
ObjectNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)DataNode
+ (AML_NODE_HEADER *)DataNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)DataNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
goto error_handler2;
}
Status = AmlSetFixedArgument (
ObjectNode,
EAmlParseIndexTerm1,
- (AML_NODE_HEADER*)Object
+ (AML_NODE_HEADER *)Object
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -619,7 +627,7 @@ AmlCodeGenName ( error_handler2:
if (ObjectNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
error_handler1:
@@ -653,18 +661,19 @@ error_handler1: EFI_STATUS
EFIAPI
AmlCodeGenNameString (
- IN CONST CHAR8 * NameString,
- IN CHAR8 * String,
- IN AML_NODE_HEADER * ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
+ IN CONST CHAR8 *NameString,
+ IN CHAR8 *String,
+ IN AML_NODE_HEADER *ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
if ((NameString == NULL) ||
(String == NULL) ||
- ((ParentNode == NULL) && (NewObjectNode == NULL))) {
+ ((ParentNode == NULL) && (NewObjectNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -683,7 +692,7 @@ AmlCodeGenNameString ( );
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
return Status;
@@ -711,17 +720,18 @@ AmlCodeGenNameString ( EFI_STATUS
EFIAPI
AmlCodeGenNameInteger (
- IN CONST CHAR8 * NameString,
- IN UINT64 Integer,
- IN AML_NODE_HEADER * ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
+ IN CONST CHAR8 *NameString,
+ IN UINT64 Integer,
+ IN AML_NODE_HEADER *ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
if ((NameString == NULL) ||
- ((ParentNode == NULL) && (NewObjectNode == NULL))) {
+ ((ParentNode == NULL) && (NewObjectNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -740,7 +750,7 @@ AmlCodeGenNameInteger ( );
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
return Status;
@@ -767,25 +777,26 @@ AmlCodeGenNameInteger ( EFI_STATUS
EFIAPI
AmlCodeGenDevice (
- IN CONST CHAR8 * NameString,
- IN AML_NODE_HEADER * ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
+ IN CONST CHAR8 *NameString,
+ IN AML_NODE_HEADER *ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
- AML_DATA_NODE * DataNode;
- CHAR8 * AmlNameString;
- UINT32 AmlNameStringSize;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
+ AML_DATA_NODE *DataNode;
+ CHAR8 *AmlNameString;
+ UINT32 AmlNameStringSize;
if ((NameString == NULL) ||
- ((ParentNode == NULL) && (NewObjectNode == NULL))) {
+ ((ParentNode == NULL) && (NewObjectNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- ObjectNode = NULL;
- DataNode = NULL;
+ ObjectNode = NULL;
+ DataNode = NULL;
AmlNameString = NULL;
Status = ConvertAslNameToAmlName (NameString, &AmlNameString);
@@ -812,7 +823,7 @@ AmlCodeGenDevice ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString,
- (UINT8*)AmlNameString,
+ (UINT8 *)AmlNameString,
AmlNameStringSize,
&DataNode
);
@@ -824,11 +835,11 @@ AmlCodeGenDevice ( Status = AmlSetFixedArgument (
ObjectNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)DataNode
+ (AML_NODE_HEADER *)DataNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)DataNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
goto error_handler2;
}
@@ -848,7 +859,7 @@ AmlCodeGenDevice ( error_handler2:
if (ObjectNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
error_handler1:
@@ -880,25 +891,26 @@ error_handler1: EFI_STATUS
EFIAPI
AmlCodeGenScope (
- IN CONST CHAR8 * NameString,
- IN AML_NODE_HEADER * ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
+ IN CONST CHAR8 *NameString,
+ IN AML_NODE_HEADER *ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
- AML_DATA_NODE * DataNode;
- CHAR8 * AmlNameString;
- UINT32 AmlNameStringSize;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
+ AML_DATA_NODE *DataNode;
+ CHAR8 *AmlNameString;
+ UINT32 AmlNameStringSize;
if ((NameString == NULL) ||
- ((ParentNode == NULL) && (NewObjectNode == NULL))) {
+ ((ParentNode == NULL) && (NewObjectNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- ObjectNode = NULL;
- DataNode = NULL;
+ ObjectNode = NULL;
+ DataNode = NULL;
AmlNameString = NULL;
Status = ConvertAslNameToAmlName (NameString, &AmlNameString);
@@ -925,7 +937,7 @@ AmlCodeGenScope ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString,
- (UINT8*)AmlNameString,
+ (UINT8 *)AmlNameString,
AmlNameStringSize,
&DataNode
);
@@ -937,11 +949,11 @@ AmlCodeGenScope ( Status = AmlSetFixedArgument (
ObjectNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)DataNode
+ (AML_NODE_HEADER *)DataNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)DataNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
goto error_handler2;
}
@@ -961,7 +973,7 @@ AmlCodeGenScope ( error_handler2:
if (ObjectNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
error_handler1:
@@ -1009,32 +1021,33 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenMethod (
- IN CONST CHAR8 * NameString,
- IN UINT8 NumArgs,
- IN BOOLEAN IsSerialized,
- IN UINT8 SyncLevel,
- IN AML_NODE_HEADER * ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
+ IN CONST CHAR8 *NameString,
+ IN UINT8 NumArgs,
+ IN BOOLEAN IsSerialized,
+ IN UINT8 SyncLevel,
+ IN AML_NODE_HEADER *ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- UINT32 PkgLen;
- UINT8 Flags;
- AML_OBJECT_NODE * ObjectNode;
- AML_DATA_NODE * DataNode;
- CHAR8 * AmlNameString;
- UINT32 AmlNameStringSize;
+ EFI_STATUS Status;
+ UINT32 PkgLen;
+ UINT8 Flags;
+ AML_OBJECT_NODE *ObjectNode;
+ AML_DATA_NODE *DataNode;
+ CHAR8 *AmlNameString;
+ UINT32 AmlNameStringSize;
if ((NameString == NULL) ||
(NumArgs > 6) ||
(SyncLevel > 15) ||
- ((ParentNode == NULL) && (NewObjectNode == NULL))) {
+ ((ParentNode == NULL) && (NewObjectNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ObjectNode = NULL;
- DataNode = NULL;
+ DataNode = NULL;
// ACPI 6.4, s20.2.5.2 "Named Objects Encoding":
// DefMethod := MethodOp PkgLength NameString MethodFlags TermList
@@ -1080,7 +1093,7 @@ AmlCodeGenMethod ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString,
- (UINT8*)AmlNameString,
+ (UINT8 *)AmlNameString,
AmlNameStringSize,
&DataNode
);
@@ -1093,7 +1106,7 @@ AmlCodeGenMethod ( Status = AmlSetFixedArgument (
ObjectNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)DataNode
+ (AML_NODE_HEADER *)DataNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1116,7 +1129,7 @@ AmlCodeGenMethod ( Status = AmlSetFixedArgument (
ObjectNode,
EAmlParseIndexTerm1,
- (AML_NODE_HEADER*)DataNode
+ (AML_NODE_HEADER *)DataNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1143,16 +1156,18 @@ AmlCodeGenMethod ( error_handler2:
if (ObjectNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
+
if (DataNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)DataNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)DataNode);
}
error_handler1:
if (AmlNameString != NULL) {
FreePool (AmlNameString);
}
+
return Status;
}
@@ -1189,19 +1204,23 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenReturn (
- IN AML_NODE_HEADER * ReturnNode,
- IN AML_NODE_HEADER * ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
+ IN AML_NODE_HEADER *ReturnNode,
+ IN AML_NODE_HEADER *ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
if ((ReturnNode == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL)) ||
((ParentNode != NULL) &&
- !AmlNodeCompareOpCode (
- (AML_OBJECT_NODE*)ParentNode, AML_METHOD_OP, 0))) {
+ !AmlNodeCompareOpCode (
+ (AML_OBJECT_NODE *)ParentNode,
+ AML_METHOD_OP,
+ 0
+ )))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -1219,7 +1238,7 @@ AmlCodeGenReturn ( Status = AmlSetFixedArgument (
ObjectNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)ReturnNode
+ (AML_NODE_HEADER *)ReturnNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1244,9 +1263,11 @@ error_handler: if (ReturnNode != NULL) {
AmlDeleteTree (ReturnNode);
}
+
if (ObjectNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
+
return Status;
}
@@ -1287,15 +1308,15 @@ STATIC EFI_STATUS
EFIAPI
AmlCodeGenReturnNameString (
- IN CONST CHAR8 * NameString,
- IN AML_NODE_HEADER * ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE ** NewObjectNode OPTIONAL
+ IN CONST CHAR8 *NameString,
+ IN AML_NODE_HEADER *ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * DataNode;
- CHAR8 * AmlNameString;
- UINT32 AmlNameStringSize;
+ EFI_STATUS Status;
+ AML_DATA_NODE *DataNode;
+ CHAR8 *AmlNameString;
+ UINT32 AmlNameStringSize;
DataNode = NULL;
@@ -1313,7 +1334,7 @@ AmlCodeGenReturnNameString ( Status = AmlCreateDataNode (
EAmlNodeDataTypeNameString,
- (UINT8*)AmlNameString,
+ (UINT8 *)AmlNameString,
AmlNameStringSize,
&DataNode
);
@@ -1324,7 +1345,7 @@ AmlCodeGenReturnNameString ( // AmlCodeGenReturn() deletes DataNode if error.
Status = AmlCodeGenReturn (
- (AML_NODE_HEADER*)DataNode,
+ (AML_NODE_HEADER *)DataNode,
ParentNode,
NewObjectNode
);
@@ -1334,6 +1355,7 @@ exit_handler: if (AmlNameString != NULL) {
FreePool (AmlNameString);
}
+
return Status;
}
@@ -1379,20 +1401,21 @@ exit_handler: EFI_STATUS
EFIAPI
AmlCodeGenMethodRetNameString (
- IN CONST CHAR8 * MethodNameString,
- IN CONST CHAR8 * ReturnedNameString OPTIONAL,
- IN UINT8 NumArgs,
- IN BOOLEAN IsSerialized,
- IN UINT8 SyncLevel,
- IN AML_NODE_HANDLE ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE_HANDLE * NewObjectNode OPTIONAL
+ IN CONST CHAR8 *MethodNameString,
+ IN CONST CHAR8 *ReturnedNameString OPTIONAL,
+ IN UINT8 NumArgs,
+ IN BOOLEAN IsSerialized,
+ IN UINT8 SyncLevel,
+ IN AML_NODE_HANDLE ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE_HANDLE MethodNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE_HANDLE MethodNode;
if ((MethodNameString == NULL) ||
- ((ParentNode == NULL) && (NewObjectNode == NULL))) {
+ ((ParentNode == NULL) && (NewObjectNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -1440,6 +1463,7 @@ error_handler: if (MethodNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)MethodNode);
}
+
return Status;
}
@@ -1478,19 +1502,20 @@ error_handler: EFI_STATUS
EFIAPI
AmlCreateLpiNode (
- IN CONST CHAR8 * LpiNameString,
- IN UINT16 Revision,
- IN UINT64 LevelId,
- IN AML_NODE_HANDLE ParentNode OPTIONAL,
- OUT AML_OBJECT_NODE_HANDLE * NewLpiNode OPTIONAL
+ IN CONST CHAR8 *LpiNameString,
+ IN UINT16 Revision,
+ IN UINT64 LevelId,
+ IN AML_NODE_HANDLE ParentNode OPTIONAL,
+ OUT AML_OBJECT_NODE_HANDLE *NewLpiNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE_HANDLE PackageNode;
- AML_OBJECT_NODE_HANDLE IntegerNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE_HANDLE PackageNode;
+ AML_OBJECT_NODE_HANDLE IntegerNode;
if ((LpiNameString == NULL) ||
- ((ParentNode == NULL) && (NewLpiNode == NULL))) {
+ ((ParentNode == NULL) && (NewLpiNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -1573,6 +1598,7 @@ error_handler: if (IntegerNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode);
}
+
return Status;
}
@@ -1631,42 +1657,43 @@ error_handler: EFI_STATUS
EFIAPI
AmlAddLpiState (
- IN UINT32 MinResidency,
- IN UINT32 WorstCaseWakeLatency,
- IN UINT32 Flags,
- IN UINT32 ArchFlags,
- IN UINT32 ResCntFreq,
- IN UINT32 EnableParentState,
- IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * GenericRegisterDescriptor OPTIONAL,
- IN UINT64 Integer OPTIONAL,
- IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * ResidencyCounterRegister OPTIONAL,
- IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE * UsageCounterRegister OPTIONAL,
- IN CHAR8 * StateName OPTIONAL,
- IN AML_OBJECT_NODE_HANDLE LpiNode
+ IN UINT32 MinResidency,
+ IN UINT32 WorstCaseWakeLatency,
+ IN UINT32 Flags,
+ IN UINT32 ArchFlags,
+ IN UINT32 ResCntFreq,
+ IN UINT32 EnableParentState,
+ IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *GenericRegisterDescriptor OPTIONAL,
+ IN UINT64 Integer OPTIONAL,
+ IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ResidencyCounterRegister OPTIONAL,
+ IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *UsageCounterRegister OPTIONAL,
+ IN CHAR8 *StateName OPTIONAL,
+ IN AML_OBJECT_NODE_HANDLE LpiNode
)
{
- EFI_STATUS Status;
- AML_DATA_NODE_HANDLE RdNode;
- AML_OBJECT_NODE_HANDLE PackageNode;
- AML_OBJECT_NODE_HANDLE IntegerNode;
- AML_OBJECT_NODE_HANDLE StringNode;
- AML_OBJECT_NODE_HANDLE NewLpiPackageNode;
- AML_OBJECT_NODE_HANDLE ResourceTemplateNode;
-
- UINT32 Index;
- AML_OBJECT_NODE_HANDLE CountNode;
- UINT64 Count;
+ EFI_STATUS Status;
+ AML_DATA_NODE_HANDLE RdNode;
+ AML_OBJECT_NODE_HANDLE PackageNode;
+ AML_OBJECT_NODE_HANDLE IntegerNode;
+ AML_OBJECT_NODE_HANDLE StringNode;
+ AML_OBJECT_NODE_HANDLE NewLpiPackageNode;
+ AML_OBJECT_NODE_HANDLE ResourceTemplateNode;
+
+ UINT32 Index;
+ AML_OBJECT_NODE_HANDLE CountNode;
+ UINT64 Count;
if ((LpiNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)LpiNode) != EAmlNodeObject) ||
- (!AmlNodeHasOpCode (LpiNode, AML_NAME_OP, 0))) {
+ (!AmlNodeHasOpCode (LpiNode, AML_NAME_OP, 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- RdNode = 0;
- StringNode = NULL;
- IntegerNode = NULL;
+ RdNode = 0;
+ StringNode = NULL;
+ IntegerNode = NULL;
ResourceTemplateNode = NULL;
// AmlCreateLpiNode () created a LPI container such as:
@@ -1683,7 +1710,8 @@ AmlAddLpiState ( );
if ((PackageNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) ||
- (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) {
+ (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -1706,6 +1734,7 @@ AmlAddLpiState ( ASSERT (0);
return Status;
}
+
Status = AmlUpdateInteger (CountNode, Count + 1);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1725,6 +1754,7 @@ AmlAddLpiState ( IntegerNode = NULL;
goto error_handler;
}
+
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@@ -1733,6 +1763,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
IntegerNode = NULL;
// WorstCaseWakeLatency
@@ -1742,6 +1773,7 @@ AmlAddLpiState ( IntegerNode = NULL;
goto error_handler;
}
+
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@@ -1750,6 +1782,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
IntegerNode = NULL;
// Flags
@@ -1759,6 +1792,7 @@ AmlAddLpiState ( IntegerNode = NULL;
goto error_handler;
}
+
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@@ -1767,6 +1801,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
IntegerNode = NULL;
// ArchFlags
@@ -1776,6 +1811,7 @@ AmlAddLpiState ( IntegerNode = NULL;
goto error_handler;
}
+
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@@ -1784,6 +1820,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
IntegerNode = NULL;
// ResCntFreq
@@ -1793,6 +1830,7 @@ AmlAddLpiState ( IntegerNode = NULL;
goto error_handler;
}
+
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@@ -1801,6 +1839,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
IntegerNode = NULL;
// EnableParentState
@@ -1810,6 +1849,7 @@ AmlAddLpiState ( IntegerNode = NULL;
goto error_handler;
}
+
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@@ -1818,6 +1858,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
IntegerNode = NULL;
// Entry Method
@@ -1829,6 +1870,7 @@ AmlAddLpiState ( ResourceTemplateNode = NULL;
goto error_handler;
}
+
Status = AmlCodeGenRdRegister (
GenericRegisterDescriptor->AddressSpaceId,
GenericRegisterDescriptor->RegisterBitWidth,
@@ -1849,6 +1891,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
RdNode = NULL;
Status = AmlVarListAddTail (
@@ -1859,6 +1902,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
ResourceTemplateNode = NULL;
} else {
// Entry Method: As an integer
@@ -1868,6 +1912,7 @@ AmlAddLpiState ( IntegerNode = NULL;
goto error_handler;
}
+
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)IntegerNode
@@ -1876,6 +1921,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
IntegerNode = NULL;
}
@@ -1886,6 +1932,7 @@ AmlAddLpiState ( ResourceTemplateNode = NULL;
goto error_handler;
}
+
if (ResidencyCounterRegister != NULL) {
Status = AmlCodeGenRdRegister (
ResidencyCounterRegister->AddressSpaceId,
@@ -1907,6 +1954,7 @@ AmlAddLpiState ( &RdNode
);
}
+
if (EFI_ERROR (Status)) {
ASSERT (0);
RdNode = NULL;
@@ -1918,6 +1966,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
RdNode = NULL;
Status = AmlVarListAddTail (
@@ -1928,6 +1977,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
ResourceTemplateNode = NULL;
// Usage Counter Register.
@@ -1937,6 +1987,7 @@ AmlAddLpiState ( ResourceTemplateNode = NULL;
goto error_handler;
}
+
if (UsageCounterRegister != NULL) {
Status = AmlCodeGenRdRegister (
UsageCounterRegister->AddressSpaceId,
@@ -1958,6 +2009,7 @@ AmlAddLpiState ( &RdNode
);
}
+
if (EFI_ERROR (Status)) {
ASSERT (0);
RdNode = NULL;
@@ -1969,6 +2021,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
RdNode = NULL;
Status = AmlVarListAddTail (
@@ -1979,6 +2032,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
ResourceTemplateNode = NULL;
// State name.
@@ -1987,11 +2041,13 @@ AmlAddLpiState ( } else {
Status = AmlCodeGenString ("", &StringNode);
}
+
if (EFI_ERROR (Status)) {
ASSERT (0);
StringNode = NULL;
goto error_handler;
}
+
Status = AmlVarListAddTail (
(AML_NODE_HANDLE)NewLpiPackageNode,
(AML_NODE_HANDLE)StringNode
@@ -2000,6 +2056,7 @@ AmlAddLpiState ( ASSERT (0);
goto error_handler;
}
+
StringNode = NULL;
// Add the new LPI state to the LpiNode.
@@ -2018,15 +2075,19 @@ error_handler: if (RdNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)RdNode);
}
+
if (NewLpiPackageNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)NewLpiPackageNode);
}
+
if (StringNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)StringNode);
}
+
if (IntegerNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode);
}
+
if (ResourceTemplateNode != NULL) {
AmlDeleteTree ((AML_NODE_HANDLE)ResourceTemplateNode);
}
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c index a7e3685..2985463 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c @@ -44,14 +44,14 @@ STATIC EFI_STATUS
EFIAPI
LinkRdNode (
- IN AML_DATA_NODE * RdNode,
- IN AML_OBJECT_NODE * ParentNode,
- OUT AML_DATA_NODE ** NewRdNode
+ IN AML_DATA_NODE *RdNode,
+ IN AML_OBJECT_NODE *ParentNode,
+ OUT AML_DATA_NODE **NewRdNode
)
{
- EFI_STATUS Status;
- EFI_STATUS Status1;
- AML_OBJECT_NODE *BufferOpNode;
+ EFI_STATUS Status;
+ EFI_STATUS Status1;
+ AML_OBJECT_NODE *BufferOpNode;
if (NewRdNode != NULL) {
*NewRdNode = NULL;
@@ -73,7 +73,8 @@ LinkRdNode ( );
if ((BufferOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
- (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
+ (!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0)))
+ {
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
@@ -94,7 +95,7 @@ LinkRdNode ( return EFI_SUCCESS;
error_handler:
- Status1 = AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
+ Status1 = AmlDeleteTree ((AML_NODE_HEADER *)RdNode);
ASSERT_EFI_ERROR (Status1);
// Return original error.
return Status;
@@ -146,15 +147,16 @@ AmlCodeGenRdInterrupt ( OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_DATA_NODE * RdNode;
- EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR RdInterrupt;
- UINT32 * FirstInterrupt;
+ AML_DATA_NODE *RdNode;
+ EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR RdInterrupt;
+ UINT32 *FirstInterrupt;
if ((IrqList == NULL) ||
(IrqCount == 0) ||
- ((NameOpNode == NULL) && (NewRdNode == NULL))) {
+ ((NameOpNode == NULL) && (NewRdNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -163,8 +165,8 @@ AmlCodeGenRdInterrupt ( RdInterrupt.Header.Header.Bits.Name =
ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME;
RdInterrupt.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
- RdInterrupt.Header.Length = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) -
- sizeof (ACPI_LARGE_RESOURCE_HEADER);
+ RdInterrupt.Header.Length = sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR) -
+ sizeof (ACPI_LARGE_RESOURCE_HEADER);
// Body
RdInterrupt.InterruptVectorFlags = (ResourceConsumer ? BIT0 : 0) |
@@ -181,7 +183,7 @@ AmlCodeGenRdInterrupt ( Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData,
- (UINT8*)&RdInterrupt,
+ (UINT8 *)&RdInterrupt,
sizeof (EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR),
&RdNode
);
@@ -242,12 +244,13 @@ AmlCodeGenRdRegister ( OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * RdNode;
- EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR RdRegister;
+ EFI_STATUS Status;
+ AML_DATA_NODE *RdNode;
+ EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR RdRegister;
if ((AccessSize > EFI_ACPI_6_4_QWORD) ||
- ((NameOpNode == NULL) && (NewRdNode == NULL))) {
+ ((NameOpNode == NULL) && (NewRdNode == NULL)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -256,19 +259,19 @@ AmlCodeGenRdRegister ( RdRegister.Header.Header.Bits.Name =
ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME;
RdRegister.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG;
- RdRegister.Header.Length = sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) -
- sizeof (ACPI_LARGE_RESOURCE_HEADER);
+ RdRegister.Header.Length = sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) -
+ sizeof (ACPI_LARGE_RESOURCE_HEADER);
// Body
- RdRegister.AddressSpaceId = AddressSpace;
- RdRegister.RegisterBitWidth = BitWidth;
+ RdRegister.AddressSpaceId = AddressSpace;
+ RdRegister.RegisterBitWidth = BitWidth;
RdRegister.RegisterBitOffset = BitOffset;
- RdRegister.AddressSize = AccessSize;
- RdRegister.RegisterAddress = Address;
+ RdRegister.AddressSize = AccessSize;
+ RdRegister.RegisterAddress = Address;
Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData,
- (UINT8*)&RdRegister,
+ (UINT8 *)&RdRegister,
sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR),
&RdNode
);
@@ -318,15 +321,15 @@ AmlCodeGenRdRegister ( EFI_STATUS
EFIAPI
AmlCodeGenEndTag (
- IN UINT8 CheckSum OPTIONAL,
- IN AML_OBJECT_NODE * ParentNode OPTIONAL,
- OUT AML_DATA_NODE ** NewRdNode OPTIONAL
+ IN UINT8 CheckSum OPTIONAL,
+ IN AML_OBJECT_NODE *ParentNode OPTIONAL,
+ OUT AML_DATA_NODE **NewRdNode OPTIONAL
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * RdNode;
- EFI_ACPI_END_TAG_DESCRIPTOR EndTag;
- ACPI_SMALL_RESOURCE_HEADER SmallResHdr;
+ EFI_STATUS Status;
+ AML_DATA_NODE *RdNode;
+ EFI_ACPI_END_TAG_DESCRIPTOR EndTag;
+ ACPI_SMALL_RESOURCE_HEADER SmallResHdr;
if ((ParentNode == NULL) && (NewRdNode == NULL)) {
ASSERT (0);
@@ -337,17 +340,17 @@ AmlCodeGenEndTag ( // Header
SmallResHdr.Bits.Length = sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) -
- sizeof (ACPI_SMALL_RESOURCE_HEADER);
+ sizeof (ACPI_SMALL_RESOURCE_HEADER);
SmallResHdr.Bits.Name = ACPI_SMALL_END_TAG_DESCRIPTOR_NAME;
SmallResHdr.Bits.Type = ACPI_SMALL_ITEM_FLAG;
// Body
- EndTag.Desc = SmallResHdr.Byte;
+ EndTag.Desc = SmallResHdr.Byte;
EndTag.Checksum = CheckSum;
Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData,
- (UINT8*)&EndTag,
+ (UINT8 *)&EndTag,
sizeof (EFI_ACPI_END_TAG_DESCRIPTOR),
&RdNode
);
@@ -365,8 +368,9 @@ AmlCodeGenEndTag ( // This is a hard check: do not allow to add an EndTag if the BufferNode
// already has resource data elements attached. Indeed, the EndTag should
// have already been added.
- if (AmlGetNextVariableArgument ((AML_NODE_HEADER*)ParentNode, NULL) !=
- NULL) {
+ if (AmlGetNextVariableArgument ((AML_NODE_HEADER *)ParentNode, NULL) !=
+ NULL)
+ {
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
@@ -375,8 +379,8 @@ AmlCodeGenEndTag ( // Add the EndTag RdNode. Indeed, the AmlAppendRdNode function
// is looking for an EndTag, which we are adding here.
Status = AmlVarListAddTail (
- (AML_NODE_HEADER*)ParentNode,
- (AML_NODE_HEADER*)RdNode
+ (AML_NODE_HEADER *)ParentNode,
+ (AML_NODE_HEADER *)RdNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -388,8 +392,9 @@ AmlCodeGenEndTag ( error_handler:
if (RdNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)RdNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)RdNode);
}
+
return Status;
}
@@ -451,7 +456,7 @@ AmlCodeGenCrsAddRdInterrupt ( IN BOOLEAN EdgeTriggered,
IN BOOLEAN ActiveLow,
IN BOOLEAN Shared,
- IN UINT32 * IrqList,
+ IN UINT32 *IrqList,
IN UINT8 IrqCount
)
{
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.h b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.h index eb26192..f241da9 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.h @@ -142,9 +142,9 @@ AmlCodeGenRdRegister ( EFI_STATUS
EFIAPI
AmlCodeGenEndTag (
- IN UINT8 CheckSum OPTIONAL,
- IN AML_OBJECT_NODE * ParentNode OPTIONAL,
- OUT AML_DATA_NODE ** NewRdNode OPTIONAL
+ IN UINT8 CheckSum OPTIONAL,
+ IN AML_OBJECT_NODE *ParentNode OPTIONAL,
+ OUT AML_DATA_NODE **NewRdNode OPTIONAL
);
#endif // AML_RESOURCE_DATA_CODE_GEN_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c b/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c index 8da4740..9104b78 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c @@ -110,18 +110,18 @@ */
typedef struct AmlPathSearchContext {
/// Backward stream holding the raw AML absolute searched path.
- AML_STREAM * SearchPathBStream;
+ AML_STREAM *SearchPathBStream;
/// An empty backward stream holding a pre-allocated buffer. This prevents
/// from having to do multiple allocations during the search.
/// This stream is used to query the raw AML absolute path of the node
/// currently being probed.
- AML_STREAM * CurrNodePathBStream;
+ AML_STREAM *CurrNodePathBStream;
/// If the node being visited is the node being searched,
/// i.e. its path and the searched path match,
/// save its reference in this pointer.
- AML_NODE_HEADER * OutNode;
+ AML_NODE_HEADER *OutNode;
} AML_PATH_SEARCH_CONTEXT;
/** Return the first AML namespace node up in the parent hierarchy.
@@ -140,12 +140,13 @@ typedef struct AmlPathSearchContext { EFI_STATUS
EFIAPI
AmlGetFirstAncestorNameSpaceNode (
- IN CONST AML_NODE_HEADER * Node,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *Node,
+ OUT AML_NODE_HEADER **OutNode
)
{
if (!IS_AML_NODE_VALID (Node) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -156,7 +157,7 @@ AmlGetFirstAncestorNameSpaceNode ( return EFI_SUCCESS;
} else {
// Else, get the parent node.
- Node = AmlGetParent ((AML_NODE_HEADER*)Node);
+ Node = AmlGetParent ((AML_NODE_HEADER *)Node);
if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -168,12 +169,13 @@ AmlGetFirstAncestorNameSpaceNode ( if (IS_AML_ROOT_NODE (Node)) {
break;
} else if (AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
+ (CONST AML_OBJECT_NODE *)Node,
AML_IN_NAMESPACE
- )) {
+ ))
+ {
break;
} else {
- Node = AmlGetParent ((AML_NODE_HEADER*)Node);
+ Node = AmlGetParent ((AML_NODE_HEADER *)Node);
if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -181,7 +183,7 @@ AmlGetFirstAncestorNameSpaceNode ( }
} // while
- *OutNode = (AML_NODE_HEADER*)Node;
+ *OutNode = (AML_NODE_HEADER *)Node;
return EFI_SUCCESS;
}
@@ -234,46 +236,47 @@ STATIC EFI_STATUS
EFIAPI
AmlGetAncestorNameSpaceNode (
- IN CONST AML_OBJECT_NODE * Node,
- IN OUT UINT32 * Levels,
- OUT UINT32 * HasRoot,
- OUT CONST AML_NODE_HEADER ** OutNode
+ IN CONST AML_OBJECT_NODE *Node,
+ IN OUT UINT32 *Levels,
+ OUT UINT32 *HasRoot,
+ OUT CONST AML_NODE_HEADER **OutNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- CONST AML_NODE_HEADER * NameSpaceNode;
- CHAR8 * NodeName;
- UINT32 ParentCnt;
+ CONST AML_NODE_HEADER *NameSpaceNode;
+ CHAR8 *NodeName;
+ UINT32 ParentCnt;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
if (!IS_AML_OBJECT_NODE (Node) ||
(Levels == NULL) ||
(HasRoot == NULL) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentCnt = *Levels;
- *HasRoot = 0;
+ *HasRoot = 0;
// ParentCnt namespace levels need to be climbed.
do {
// Get the next namespace node in the hierarchy.
Status = AmlGetFirstAncestorNameSpaceNode (
- (CONST AML_NODE_HEADER*)Node,
- (AML_NODE_HEADER**)&NameSpaceNode
+ (CONST AML_NODE_HEADER *)Node,
+ (AML_NODE_HEADER **)&NameSpaceNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
- Node = (CONST AML_OBJECT_NODE*)NameSpaceNode;
+ Node = (CONST AML_OBJECT_NODE *)NameSpaceNode;
if (IS_AML_ROOT_NODE (Node)) {
// Node is the root node. It is not possible to go beyond.
@@ -281,11 +284,12 @@ AmlGetAncestorNameSpaceNode ( ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
*HasRoot = 1;
break;
}
- NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node);
+ NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node);
if (NodeName == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -293,11 +297,11 @@ AmlGetAncestorNameSpaceNode ( // Analyze the node name.
Status = AmlParseNameStringInfo (
- NodeName,
- &Root,
- &ParentPrefix,
- &SegCount
- );
+ NodeName,
+ &Root,
+ &ParentPrefix,
+ &SegCount
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -316,9 +320,9 @@ AmlGetAncestorNameSpaceNode ( if (SegCount == ParentCnt) {
// There are exactly enough AML namespace levels to consume.
// This means the root node was the searched node.
- Node = (CONST AML_OBJECT_NODE*)AmlGetRootNode (
- (CONST AML_NODE_HEADER*)Node
- );
+ Node = (CONST AML_OBJECT_NODE *)AmlGetRootNode (
+ (CONST AML_NODE_HEADER *)Node
+ );
if (!IS_AML_ROOT_NODE (Node)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -350,14 +354,15 @@ AmlGetAncestorNameSpaceNode ( // The node name doesn't have any carets. Get the next namespace
// node and return.
Status = AmlGetFirstAncestorNameSpaceNode (
- (CONST AML_NODE_HEADER*)Node,
- (AML_NODE_HEADER**)&NameSpaceNode
+ (CONST AML_NODE_HEADER *)Node,
+ (AML_NODE_HEADER **)&NameSpaceNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
- Node = (CONST AML_OBJECT_NODE*)NameSpaceNode;
+
+ Node = (CONST AML_OBJECT_NODE *)NameSpaceNode;
ParentCnt = 0;
break;
} else {
@@ -375,8 +380,8 @@ AmlGetAncestorNameSpaceNode ( }
} while (ParentCnt != 0);
- *OutNode = (CONST AML_NODE_HEADER*)Node;
- *Levels = ParentCnt;
+ *OutNode = (CONST AML_NODE_HEADER *)Node;
+ *Levels = ParentCnt;
return EFI_SUCCESS;
}
@@ -415,29 +420,31 @@ AmlGetAncestorNameSpaceNode ( EFI_STATUS
EFIAPI
AmlGetRawNameSpacePath (
- IN CONST AML_NODE_HEADER * Node,
- IN UINT32 InputParent,
- OUT AML_STREAM * RawAbsPathBStream
+ IN CONST AML_NODE_HEADER *Node,
+ IN UINT32 InputParent,
+ OUT AML_STREAM *RawAbsPathBStream
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_NODE_HEADER * ParentNode;
- CHAR8 * NodeName;
+ AML_NODE_HEADER *ParentNode;
+ CHAR8 *NodeName;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
- CONST CHAR8 * NameSeg;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
+ CONST CHAR8 *NameSeg;
if ((!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
- AML_IN_NAMESPACE)) ||
+ (CONST AML_OBJECT_NODE *)Node,
+ AML_IN_NAMESPACE
+ )) ||
!IS_STREAM (RawAbsPathBStream) ||
IS_END_OF_STREAM (RawAbsPathBStream) ||
!IS_STREAM_BACKWARD (RawAbsPathBStream) ||
- (InputParent > MAX_UINT8)) {
+ (InputParent > MAX_UINT8))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -447,7 +454,7 @@ AmlGetRawNameSpacePath ( break;
}
- NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node);
+ NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node);
if (NodeName == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -468,15 +475,16 @@ AmlGetRawNameSpacePath ( // 1.1. If the Node's name has enough levels to consume all the
// InputParent carets, write the levels that are left.
NameSeg = AmlGetFirstNameSeg (NodeName, Root, ParentPrefix);
- Status = AmlStreamWrite (
+ Status = AmlStreamWrite (
RawAbsPathBStream,
- (CONST UINT8*)NameSeg,
+ (CONST UINT8 *)NameSeg,
(SegCount - InputParent) * AML_NAME_SEG_SIZE
);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
+
InputParent = 0;
} else {
// (SegCount <= InputParent)
@@ -488,23 +496,25 @@ AmlGetRawNameSpacePath ( InputParent += ParentPrefix;
if (Root != 0) {
- // 2. The Node's name is an absolute path.
- // Exit, the root has been reached.
+ // 2. The Node's name is an absolute path.
+ // Exit, the root has been reached.
if (InputParent != 0) {
ASSERT (0);
return EFI_NOT_FOUND;
}
+
break;
}
Status = AmlGetAncestorNameSpaceNode (
- (CONST AML_OBJECT_NODE*)Node,
+ (CONST AML_OBJECT_NODE *)Node,
&InputParent,
&Root,
- (CONST AML_NODE_HEADER**)&ParentNode
+ (CONST AML_NODE_HEADER **)&ParentNode
);
if (EFI_ERROR (Status) ||
- (!IS_AML_NODE_VALID (ParentNode))) {
+ (!IS_AML_NODE_VALID (ParentNode)))
+ {
ASSERT (0);
return Status;
}
@@ -524,7 +534,7 @@ AmlGetRawNameSpacePath ( // Then exit.
if (InputParent != 0) {
// Get the absolute pathname.
- NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node);
+ NodeName = AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node);
if (NodeName == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -532,11 +542,11 @@ AmlGetRawNameSpacePath ( // Analyze the absolute pathname.
Status = AmlParseNameStringInfo (
- NodeName,
- &Root,
- &ParentPrefix,
- &SegCount
- );
+ NodeName,
+ &Root,
+ &ParentPrefix,
+ &SegCount
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -545,9 +555,9 @@ AmlGetRawNameSpacePath ( // Writing the n first NameSegs.
// n = SegCount - InputParent
NameSeg = AmlGetFirstNameSeg (NodeName, Root, ParentPrefix);
- Status = AmlStreamWrite (
+ Status = AmlStreamWrite (
RawAbsPathBStream,
- (CONST UINT8*)NameSeg,
+ (CONST UINT8 *)NameSeg,
(SegCount - InputParent) * AML_NAME_SEG_SIZE
);
if (EFI_ERROR (Status)) {
@@ -557,7 +567,6 @@ AmlGetRawNameSpacePath ( break;
} // (InputParent != 0)
-
}
} // while
@@ -584,21 +593,22 @@ STATIC EFI_STATUS
EFIAPI
AmlAddPrefix (
- IN OUT AML_STREAM * AmlPathBStream
+ IN OUT AML_STREAM *AmlPathBStream
)
{
- EFI_STATUS Status;
- UINT32 NameSegCount;
- UINT32 NameSegSize;
+ EFI_STATUS Status;
+ UINT32 NameSegCount;
+ UINT32 NameSegSize;
// At most 3 bytes are needed for: RootChar + MultiNamePrefix + SegCount.
- CHAR8 Prefix[3];
- UINT32 PrefixSize;
+ CHAR8 Prefix[3];
+ UINT32 PrefixSize;
// The Stream contains concatenated NameSegs.
if (!IS_STREAM (AmlPathBStream) ||
IS_END_OF_STREAM (AmlPathBStream) ||
- !IS_STREAM_BACKWARD (AmlPathBStream)) {
+ !IS_STREAM_BACKWARD (AmlPathBStream))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -625,7 +635,7 @@ AmlAddPrefix ( case 0:
{
// Root and parents only NameString (no NameSeg(s)) end with '\0'.
- Prefix[1] = AML_ZERO_OP;
+ Prefix[1] = AML_ZERO_OP;
PrefixSize = 2;
break;
}
@@ -636,21 +646,21 @@ AmlAddPrefix ( }
case 2:
{
- Prefix[1] = AML_DUAL_NAME_PREFIX;
+ Prefix[1] = AML_DUAL_NAME_PREFIX;
PrefixSize = 2;
break;
}
default:
{
- Prefix[1] = AML_MULTI_NAME_PREFIX;
- Prefix[2] = (UINT8)NameSegCount;
+ Prefix[1] = AML_MULTI_NAME_PREFIX;
+ Prefix[2] = (UINT8)NameSegCount;
PrefixSize = 3;
break;
}
}
// Add the RootChar + prefix (if needed) at the beginning of the pathname.
- Status = AmlStreamWrite (AmlPathBStream, (CONST UINT8*)Prefix, PrefixSize);
+ Status = AmlStreamWrite (AmlPathBStream, (CONST UINT8 *)Prefix, PrefixSize);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -679,27 +689,28 @@ STATIC EFI_STATUS
EFIAPI
AmlRemovePrefix (
- IN OUT AML_STREAM * AmlPathBStream
+ IN OUT AML_STREAM *AmlPathBStream
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT32 TotalSize;
- UINT32 RewindSize;
+ UINT32 TotalSize;
+ UINT32 RewindSize;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
if (!IS_STREAM (AmlPathBStream) ||
IS_END_OF_STREAM (AmlPathBStream) ||
- !IS_STREAM_BACKWARD (AmlPathBStream)) {
+ !IS_STREAM_BACKWARD (AmlPathBStream))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Status = AmlParseNameStringInfo (
- (CHAR8*)AmlStreamGetCurrPos (AmlPathBStream),
+ (CHAR8 *)AmlStreamGetCurrPos (AmlPathBStream),
&Root,
&ParentPrefix,
&SegCount
@@ -755,31 +766,33 @@ AmlRemovePrefix ( EFI_STATUS
EFIAPI
AmlGetAslPathName (
- IN AML_NODE_HEADER * Node,
- OUT CHAR8 * Buffer,
- IN OUT UINT32 * BufferSize
+ IN AML_NODE_HEADER *Node,
+ OUT CHAR8 *Buffer,
+ IN OUT UINT32 *BufferSize
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
// Backward stream used to build the raw AML absolute path to the node.
- AML_STREAM RawAmlAbsPathBStream;
- CHAR8 * RawAmlAbsPathBuffer;
- UINT32 RawAmlAbsPathBufferSize;
+ AML_STREAM RawAmlAbsPathBStream;
+ CHAR8 *RawAmlAbsPathBuffer;
+ UINT32 RawAmlAbsPathBufferSize;
- CHAR8 * AmlPathName;
- CHAR8 * AslPathName;
- UINT32 AslPathNameSize;
+ CHAR8 *AmlPathName;
+ CHAR8 *AslPathName;
+ UINT32 AslPathNameSize;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
if ((!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
- AML_IN_NAMESPACE)) ||
- (BufferSize == NULL)) {
+ (CONST AML_OBJECT_NODE *)Node,
+ AML_IN_NAMESPACE
+ )) ||
+ (BufferSize == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -788,7 +801,7 @@ AmlGetAslPathName ( // Allocate a Stream to get the raw AML absolute pathname.
RawAmlAbsPathBufferSize = MAX_AML_NAMESTRING_SIZE;
- RawAmlAbsPathBuffer = AllocateZeroPool (RawAmlAbsPathBufferSize);
+ RawAmlAbsPathBuffer = AllocateZeroPool (RawAmlAbsPathBufferSize);
if (RawAmlAbsPathBuffer == NULL) {
ASSERT (0);
return EFI_OUT_OF_RESOURCES;
@@ -796,7 +809,7 @@ AmlGetAslPathName ( Status = AmlStreamInit (
&RawAmlAbsPathBStream,
- (UINT8*)RawAmlAbsPathBuffer,
+ (UINT8 *)RawAmlAbsPathBuffer,
RawAmlAbsPathBufferSize,
EAmlStreamDirectionBackward
);
@@ -821,11 +834,11 @@ AmlGetAslPathName ( goto exit_handler;
}
- AmlPathName = (CHAR8*)AmlStreamGetCurrPos (&RawAmlAbsPathBStream);
+ AmlPathName = (CHAR8 *)AmlStreamGetCurrPos (&RawAmlAbsPathBStream);
// Analyze the NameString.
Status = AmlParseNameStringInfo (
- (CONST CHAR8*)AmlPathName,
+ (CONST CHAR8 *)AmlPathName,
&Root,
&ParentPrefix,
&SegCount
@@ -890,33 +903,36 @@ STATIC BOOLEAN
EFIAPI
AmlDbgPrintNameSpaceCallback (
- IN AML_NODE_HEADER * Node,
- IN VOID * Context,
- IN OUT EFI_STATUS * Status OPTIONAL
+ IN AML_NODE_HEADER *Node,
+ IN VOID *Context,
+ IN OUT EFI_STATUS *Status OPTIONAL
)
{
- BOOLEAN ContinueEnum;
- EFI_STATUS Status1;
+ BOOLEAN ContinueEnum;
+ EFI_STATUS Status1;
- AML_STREAM * CurrNodePathFStream;
- CHAR8 * CurrNodePathBuffer;
- UINT32 CurrNodePathBufferSize;
+ AML_STREAM *CurrNodePathFStream;
+ CHAR8 *CurrNodePathBuffer;
+ UINT32 CurrNodePathBufferSize;
ContinueEnum = TRUE;
- Status1 = EFI_SUCCESS;
+ Status1 = EFI_SUCCESS;
if (!IS_AML_NODE_VALID (Node) ||
- (Context == NULL)) {
+ (Context == NULL))
+ {
ASSERT (0);
- Status1 = EFI_INVALID_PARAMETER;
+ Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
goto exit_handler;
}
if (!IS_AML_ROOT_NODE (Node) &&
!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
- AML_IN_NAMESPACE)) {
+ (CONST AML_OBJECT_NODE *)Node,
+ AML_IN_NAMESPACE
+ ))
+ {
// Skip this node and continue enumeration.
goto exit_handler;
}
@@ -924,40 +940,41 @@ AmlDbgPrintNameSpaceCallback ( if (IS_AML_ROOT_NODE (Node)) {
DEBUG ((DEBUG_INFO, "\\\n"));
} else if (AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
- AML_IN_NAMESPACE)) {
-
- CurrNodePathFStream = (AML_STREAM*)Context;
-
- // Check the Context's content.
- if (!IS_STREAM (CurrNodePathFStream) ||
- IS_END_OF_STREAM (CurrNodePathFStream) ||
- !IS_STREAM_FORWARD (CurrNodePathFStream)) {
- ASSERT (0);
- Status1 = EFI_INVALID_PARAMETER;
- ContinueEnum = FALSE;
- goto exit_handler;
- }
-
- CurrNodePathBuffer = (CHAR8*)AmlStreamGetBuffer (CurrNodePathFStream);
- CurrNodePathBufferSize = AmlStreamGetMaxBufferSize (CurrNodePathFStream);
+ (CONST AML_OBJECT_NODE *)Node,
+ AML_IN_NAMESPACE
+ ))
+ {
+ CurrNodePathFStream = (AML_STREAM *)Context;
+
+ // Check the Context's content.
+ if (!IS_STREAM (CurrNodePathFStream) ||
+ IS_END_OF_STREAM (CurrNodePathFStream) ||
+ !IS_STREAM_FORWARD (CurrNodePathFStream))
+ {
+ ASSERT (0);
+ Status1 = EFI_INVALID_PARAMETER;
+ ContinueEnum = FALSE;
+ goto exit_handler;
+ }
- Status1 = AmlGetAslPathName (
- (AML_NODE_HEADER*)Node,
- CurrNodePathBuffer,
- &CurrNodePathBufferSize
- );
- if (EFI_ERROR (Status1)) {
- ASSERT (0);
- ContinueEnum = FALSE;
- goto exit_handler;
- }
+ CurrNodePathBuffer = (CHAR8 *)AmlStreamGetBuffer (CurrNodePathFStream);
+ CurrNodePathBufferSize = AmlStreamGetMaxBufferSize (CurrNodePathFStream);
- DEBUG ((DEBUG_INFO, "%a\n", CurrNodePathBuffer));
+ Status1 = AmlGetAslPathName (
+ (AML_NODE_HEADER *)Node,
+ CurrNodePathBuffer,
+ &CurrNodePathBufferSize
+ );
+ if (EFI_ERROR (Status1)) {
+ ASSERT (0);
+ ContinueEnum = FALSE;
+ goto exit_handler;
+ }
+ DEBUG ((DEBUG_INFO, "%a\n", CurrNodePathBuffer));
} else {
ASSERT (0);
- Status1 = EFI_INVALID_PARAMETER;
+ Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
}
@@ -982,14 +999,14 @@ exit_handler: EFI_STATUS
EFIAPI
AmlDbgPrintNameSpace (
- IN AML_ROOT_NODE * RootNode
+ IN AML_ROOT_NODE *RootNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_STREAM CurrNodePathFStream;
- CHAR8 * CurrNodePathBuffer;
- UINT32 CurrNodePathBufferSize;
+ AML_STREAM CurrNodePathFStream;
+ CHAR8 *CurrNodePathBuffer;
+ UINT32 CurrNodePathBufferSize;
if (!IS_AML_ROOT_NODE (RootNode)) {
ASSERT (0);
@@ -1000,7 +1017,7 @@ AmlDbgPrintNameSpace ( // Allocate memory to build the absolute ASL path to each node.
CurrNodePathBufferSize = MAX_AML_NAMESTRING_SIZE;
- CurrNodePathBuffer = AllocateZeroPool (CurrNodePathBufferSize);
+ CurrNodePathBuffer = AllocateZeroPool (CurrNodePathBufferSize);
if (CurrNodePathBuffer == NULL) {
ASSERT (0);
return EFI_OUT_OF_RESOURCES;
@@ -1010,7 +1027,7 @@ AmlDbgPrintNameSpace ( // to avoid multiple allocations during the enumeration.
Status = AmlStreamInit (
&CurrNodePathFStream,
- (UINT8*)CurrNodePathBuffer,
+ (UINT8 *)CurrNodePathBuffer,
CurrNodePathBufferSize,
EAmlStreamDirectionForward
);
@@ -1020,9 +1037,9 @@ AmlDbgPrintNameSpace ( }
AmlEnumTree (
- (AML_NODE_HEADER*)RootNode,
+ (AML_NODE_HEADER *)RootNode,
AmlDbgPrintNameSpaceCallback,
- (VOID*)&CurrNodePathFStream,
+ (VOID *)&CurrNodePathFStream,
&Status
);
ASSERT_EFI_ERROR (Status);
@@ -1064,40 +1081,43 @@ STATIC BOOLEAN
EFIAPI
AmlEnumeratePathCallback (
- IN AML_NODE_HEADER * Node,
- IN OUT VOID * Context,
- IN OUT EFI_STATUS * Status OPTIONAL
-)
+ IN AML_NODE_HEADER *Node,
+ IN OUT VOID *Context,
+ IN OUT EFI_STATUS *Status OPTIONAL
+ )
{
- BOOLEAN ContinueEnum;
- EFI_STATUS Status1;
+ BOOLEAN ContinueEnum;
+ EFI_STATUS Status1;
- AML_PATH_SEARCH_CONTEXT * PathSearchContext;
+ AML_PATH_SEARCH_CONTEXT *PathSearchContext;
- AML_STREAM * SearchPathBStream;
+ AML_STREAM *SearchPathBStream;
- AML_STREAM * CurrNodePathBStream;
- UINT32 CurrNodePathSize;
+ AML_STREAM *CurrNodePathBStream;
+ UINT32 CurrNodePathSize;
ContinueEnum = TRUE;
- Status1 = EFI_SUCCESS;
+ Status1 = EFI_SUCCESS;
if (!IS_AML_NODE_VALID (Node) ||
- (Context == NULL)) {
+ (Context == NULL))
+ {
ASSERT (0);
- Status1 = EFI_INVALID_PARAMETER;
+ Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
goto exit_handler;
}
if (!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
- AML_IN_NAMESPACE)) {
+ (CONST AML_OBJECT_NODE *)Node,
+ AML_IN_NAMESPACE
+ ))
+ {
goto exit_handler;
}
- PathSearchContext = (AML_PATH_SEARCH_CONTEXT*)Context;
- SearchPathBStream = PathSearchContext->SearchPathBStream;
+ PathSearchContext = (AML_PATH_SEARCH_CONTEXT *)Context;
+ SearchPathBStream = PathSearchContext->SearchPathBStream;
CurrNodePathBStream = PathSearchContext->CurrNodePathBStream;
// Check the Context's content.
@@ -1106,9 +1126,10 @@ AmlEnumeratePathCallback ( !IS_STREAM_BACKWARD (SearchPathBStream) ||
!IS_STREAM (CurrNodePathBStream) ||
IS_END_OF_STREAM (CurrNodePathBStream) ||
- !IS_STREAM_BACKWARD (CurrNodePathBStream)) {
+ !IS_STREAM_BACKWARD (CurrNodePathBStream))
+ {
ASSERT (0);
- Status1 = EFI_INVALID_PARAMETER;
+ Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
goto exit_handler;
}
@@ -1116,7 +1137,7 @@ AmlEnumeratePathCallback ( CurrNodePathSize = AmlStreamGetMaxBufferSize (CurrNodePathBStream);
if (CurrNodePathSize == 0) {
ASSERT (0);
- Status1 = EFI_INVALID_PARAMETER;
+ Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
goto exit_handler;
}
@@ -1137,26 +1158,28 @@ AmlEnumeratePathCallback ( DEBUG ((DEBUG_VERBOSE, "Search path:"));
AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE,
- (CHAR8*)AmlStreamGetCurrPos (SearchPathBStream),
+ (CHAR8 *)AmlStreamGetCurrPos (SearchPathBStream),
AmlStreamGetIndex (SearchPathBStream)
);
DEBUG ((DEBUG_VERBOSE, "\nPath of the current node: "));
AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE,
- (CHAR8*)AmlStreamGetCurrPos (CurrNodePathBStream),
+ (CHAR8 *)AmlStreamGetCurrPos (CurrNodePathBStream),
AmlStreamGetIndex (CurrNodePathBStream)
);
DEBUG ((DEBUG_VERBOSE, "\n"));
// Compare the searched path and Node's path.
if ((AmlStreamGetIndex (CurrNodePathBStream) ==
- AmlStreamGetIndex (SearchPathBStream)) &&
+ AmlStreamGetIndex (SearchPathBStream)) &&
(CompareMem (
AmlStreamGetCurrPos (CurrNodePathBStream),
AmlStreamGetCurrPos (SearchPathBStream),
- AmlStreamGetIndex (SearchPathBStream)) == 0)) {
- Status1 = EFI_SUCCESS;
- ContinueEnum = FALSE;
+ AmlStreamGetIndex (SearchPathBStream)
+ ) == 0))
+ {
+ Status1 = EFI_SUCCESS;
+ ContinueEnum = FALSE;
PathSearchContext->OutNode = Node;
} else {
// If the paths don't match, reset the CurrNodePathStream's content.
@@ -1210,27 +1233,29 @@ STATIC EFI_STATUS
EFIAPI
AmlBuildAbsoluteAmlPath (
- IN AML_NODE_HEADER * ReferenceNode,
- IN CHAR8 * AslPath,
- IN OUT AML_STREAM * RawAmlAbsSearchPathBStream
+ IN AML_NODE_HEADER *ReferenceNode,
+ IN CHAR8 *AslPath,
+ IN OUT AML_STREAM *RawAmlAbsSearchPathBStream
)
{
- EFI_STATUS Status;
- CHAR8 * AmlPath;
+ EFI_STATUS Status;
+ CHAR8 *AmlPath;
- UINT32 AmlNameStringSize;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
+ UINT32 AmlNameStringSize;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
if ((!IS_AML_ROOT_NODE (ReferenceNode) &&
!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)ReferenceNode,
- AML_IN_NAMESPACE)) ||
+ (CONST AML_OBJECT_NODE *)ReferenceNode,
+ AML_IN_NAMESPACE
+ )) ||
(AslPath == NULL) ||
!IS_STREAM (RawAmlAbsSearchPathBStream) ||
IS_END_OF_STREAM (RawAmlAbsSearchPathBStream) ||
- !IS_STREAM_BACKWARD (RawAmlAbsSearchPathBStream)) {
+ !IS_STREAM_BACKWARD (RawAmlAbsSearchPathBStream))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -1264,10 +1289,10 @@ AmlBuildAbsoluteAmlPath ( // 2.1. Write the AML path to the stream.
Status = AmlStreamWrite (
- RawAmlAbsSearchPathBStream,
- (CONST UINT8*)AmlPath,
- AmlNameStringSize
- );
+ RawAmlAbsSearchPathBStream,
+ (CONST UINT8 *)AmlPath,
+ AmlNameStringSize
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
goto exit_handler;
@@ -1347,47 +1372,49 @@ exit_handler: EFI_STATUS
EFIAPI
AmlFindNode (
- IN AML_NODE_HEADER * ReferenceNode,
- IN CHAR8 * AslPath,
- OUT AML_NODE_HEADER ** OutNode
+ IN AML_NODE_HEADER *ReferenceNode,
+ IN CHAR8 *AslPath,
+ OUT AML_NODE_HEADER **OutNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_PATH_SEARCH_CONTEXT PathSearchContext;
- AML_ROOT_NODE * RootNode;
+ AML_PATH_SEARCH_CONTEXT PathSearchContext;
+ AML_ROOT_NODE *RootNode;
// Backward stream used to build the raw AML absolute path to the searched
// node.
- AML_STREAM RawAmlAbsSearchPathBStream;
- CHAR8 * RawAmlAbsSearchPathBuffer;
- UINT32 RawAmlAbsSearchPathBufferSize;
+ AML_STREAM RawAmlAbsSearchPathBStream;
+ CHAR8 *RawAmlAbsSearchPathBuffer;
+ UINT32 RawAmlAbsSearchPathBufferSize;
// Backward stream used to store the raw AML absolute path of the node
// currently enumerated in the tree. This path can then be compared to the
// RawAmlAbsSearchPath.
- AML_STREAM RawAmlAbsCurrNodePathBStream;
- CHAR8 * RawAmlAbsCurrNodePathBuffer;
- UINT32 RawAmlAbsCurrNodePathBufferSize;
+ AML_STREAM RawAmlAbsCurrNodePathBStream;
+ CHAR8 *RawAmlAbsCurrNodePathBuffer;
+ UINT32 RawAmlAbsCurrNodePathBufferSize;
if ((!IS_AML_ROOT_NODE (ReferenceNode) &&
!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)ReferenceNode,
- AML_IN_NAMESPACE)) ||
+ (CONST AML_OBJECT_NODE *)ReferenceNode,
+ AML_IN_NAMESPACE
+ )) ||
(AslPath == NULL) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- *OutNode = NULL;
+ *OutNode = NULL;
RawAmlAbsCurrNodePathBuffer = NULL;
// 1. Build a raw absolute AML path from the reference node and the ASL
// path. For this:
// 1.1. First initialize a backward stream.
RawAmlAbsSearchPathBufferSize = MAX_AML_NAMESTRING_SIZE;
- RawAmlAbsSearchPathBuffer = AllocateZeroPool (RawAmlAbsSearchPathBufferSize);
+ RawAmlAbsSearchPathBuffer = AllocateZeroPool (RawAmlAbsSearchPathBufferSize);
if (RawAmlAbsSearchPathBuffer == NULL) {
ASSERT (0);
return EFI_OUT_OF_RESOURCES;
@@ -1395,7 +1422,7 @@ AmlFindNode ( Status = AmlStreamInit (
&RawAmlAbsSearchPathBStream,
- (UINT8*)RawAmlAbsSearchPathBuffer,
+ (UINT8 *)RawAmlAbsSearchPathBuffer,
RawAmlAbsSearchPathBufferSize,
EAmlStreamDirectionBackward
);
@@ -1427,8 +1454,8 @@ AmlFindNode ( // For the Root Node there is no NameSegs so the length of
// the stream will be zero.
if (AmlStreamGetIndex (&RawAmlAbsSearchPathBStream) == 0) {
- *OutNode = (AML_NODE_HEADER*)RootNode;
- Status = EFI_SUCCESS;
+ *OutNode = (AML_NODE_HEADER *)RootNode;
+ Status = EFI_SUCCESS;
goto exit_handler;
}
@@ -1436,9 +1463,9 @@ AmlFindNode ( // during enumeration. This prevents from doing multiple allocation/free
// operations.
RawAmlAbsCurrNodePathBufferSize = MAX_ASL_NAMESTRING_SIZE;
- RawAmlAbsCurrNodePathBuffer = AllocateZeroPool (
- RawAmlAbsCurrNodePathBufferSize
- );
+ RawAmlAbsCurrNodePathBuffer = AllocateZeroPool (
+ RawAmlAbsCurrNodePathBufferSize
+ );
if (RawAmlAbsCurrNodePathBuffer == NULL) {
ASSERT (0);
Status = EFI_OUT_OF_RESOURCES;
@@ -1447,7 +1474,7 @@ AmlFindNode ( Status = AmlStreamInit (
&RawAmlAbsCurrNodePathBStream,
- (UINT8*)RawAmlAbsCurrNodePathBuffer,
+ (UINT8 *)RawAmlAbsCurrNodePathBuffer,
RawAmlAbsCurrNodePathBufferSize,
EAmlStreamDirectionBackward
);
@@ -1462,17 +1489,17 @@ AmlFindNode ( // - CurrNodePathStream: backward stream containing the raw absolute AML
// of the node currently being enumerated;
// - OutNode: node pointer to the store the potentially found node.
- PathSearchContext.SearchPathBStream = &RawAmlAbsSearchPathBStream;
+ PathSearchContext.SearchPathBStream = &RawAmlAbsSearchPathBStream;
PathSearchContext.CurrNodePathBStream = &RawAmlAbsCurrNodePathBStream;
- PathSearchContext.OutNode = NULL;
+ PathSearchContext.OutNode = NULL;
// 6. Iterate through the namespace nodes of the tree.
// For each namespace node, build its raw AML absolute path. Then compare
// it with the search path.
AmlEnumTree (
- (AML_NODE_HEADER*)RootNode,
+ (AML_NODE_HEADER *)RootNode,
AmlEnumeratePathCallback,
- (VOID*)&PathSearchContext,
+ (VOID *)&PathSearchContext,
&Status
);
if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.h b/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.h index 3d8ebc8..c5079e8 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.h @@ -28,8 +28,8 @@ EFI_STATUS
EFIAPI
AmlGetFirstAncestorNameSpaceNode (
- IN CONST AML_NODE_HEADER * Node,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *Node,
+ OUT AML_NODE_HEADER **OutNode
);
/** Build the raw absolute AML pathname to Node and write it to a stream.
@@ -66,9 +66,9 @@ AmlGetFirstAncestorNameSpaceNode ( EFI_STATUS
EFIAPI
AmlGetRawNameSpacePath (
- IN CONST AML_NODE_HEADER * Node,
- IN UINT32 InputParent,
- OUT AML_STREAM * RawAbsPathBStream
+ IN CONST AML_NODE_HEADER *Node,
+ IN UINT32 InputParent,
+ OUT AML_STREAM *RawAbsPathBStream
);
#endif // AML_NAMESPACE_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c index 24460f9..5ae833c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c @@ -46,31 +46,32 @@ STATIC EFI_STATUS
EFIAPI
AmlParseFieldElement (
- IN CONST AML_BYTE_ENCODING * FieldByteEncoding,
- IN OUT AML_OBJECT_NODE * FieldNode,
- IN OUT AML_STREAM * FStream,
- IN OUT LIST_ENTRY * NameSpaceRefList
+ IN CONST AML_BYTE_ENCODING *FieldByteEncoding,
+ IN OUT AML_OBJECT_NODE *FieldNode,
+ IN OUT AML_STREAM *FStream,
+ IN OUT LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT8 * CurrPos;
- AML_OBJECT_NODE * NewNode;
+ UINT8 *CurrPos;
+ AML_OBJECT_NODE *NewNode;
- UINT32 PkgLenOffset;
- UINT32 PkgLenSize;
+ UINT32 PkgLenOffset;
+ UINT32 PkgLenSize;
// Check whether the node is an Object Node and has a field list.
// The byte encoding must be a field element.
if ((FieldByteEncoding == NULL) ||
((FieldByteEncoding->Attribute & AML_IS_FIELD_ELEMENT) == 0) ||
((FieldByteEncoding->Attribute & AML_IS_PSEUDO_OPCODE) ==
- AML_IS_PSEUDO_OPCODE) ||
+ AML_IS_PSEUDO_OPCODE) ||
!AmlNodeHasAttribute (FieldNode, AML_HAS_FIELD_LIST) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (NameSpaceRefList == NULL)) {
+ (NameSpaceRefList == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -98,7 +99,8 @@ AmlParseFieldElement ( // Parse the PkgLen if available.
PkgLenSize = 0;
if ((FieldByteEncoding->Attribute & AML_HAS_PKG_LENGTH) ==
- AML_HAS_PKG_LENGTH) {
+ AML_HAS_PKG_LENGTH)
+ {
PkgLenOffset = AmlGetPkgLength (CurrPos, &PkgLenSize);
if (PkgLenOffset == 0) {
ASSERT (0);
@@ -129,14 +131,14 @@ AmlParseFieldElement ( // Add the FieldElement to the Variable Argument List.
Status = AmlVarListAddTailInternal (
- (AML_NODE_HEADER*)FieldNode,
- (AML_NODE_HEADER*)NewNode
+ (AML_NODE_HEADER *)FieldNode,
+ (AML_NODE_HEADER *)NewNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
// Delete the sub-tree if the insertion failed.
// Otherwise its reference will be lost.
- AmlDeleteTree ((AML_NODE_HEADER*)NewNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
return Status;
}
@@ -144,10 +146,10 @@ AmlParseFieldElement ( if (!IS_END_OF_STREAM (FStream)) {
// Parse the fixed arguments of the field element.
Status = AmlParseFixedArguments (
- NewNode,
- FStream,
- NameSpaceRefList
- );
+ NewNode,
+ FStream,
+ NameSpaceRefList
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
}
@@ -182,14 +184,14 @@ STATIC EFI_STATUS
EFIAPI
AmlParseNamedFieldElement (
- IN CONST AML_BYTE_ENCODING * NamedFieldByteEncoding,
- IN OUT AML_OBJECT_NODE * FieldNode,
- IN OUT AML_STREAM * FStream,
- IN OUT LIST_ENTRY * NameSpaceRefList
-)
+ IN CONST AML_BYTE_ENCODING *NamedFieldByteEncoding,
+ IN OUT AML_OBJECT_NODE *FieldNode,
+ IN OUT AML_STREAM *FStream,
+ IN OUT LIST_ENTRY *NameSpaceRefList
+ )
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * NewNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *NewNode;
// Check whether the node is an Object Node and has a field list.
// The byte encoding must be a char.
@@ -199,7 +201,8 @@ AmlParseNamedFieldElement ( !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (NameSpaceRefList == NULL)) {
+ (NameSpaceRefList == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -217,14 +220,14 @@ AmlParseNamedFieldElement ( // Add the NamedField node to the variable argument list.
Status = AmlVarListAddTailInternal (
- (AML_NODE_HEADER*)FieldNode,
- (AML_NODE_HEADER*)NewNode
+ (AML_NODE_HEADER *)FieldNode,
+ (AML_NODE_HEADER *)NewNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
// Delete the sub-tree if the insertion failed.
// Otherwise its reference will be lost.
- AmlDeleteTree ((AML_NODE_HEADER*)NewNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
return Status;
}
@@ -306,23 +309,24 @@ AmlParseNamedFieldElement ( EFI_STATUS
EFIAPI
AmlParseFieldList (
- IN AML_OBJECT_NODE * FieldNode,
- IN AML_STREAM * FStream,
- IN LIST_ENTRY * NameSpaceRefList
+ IN AML_OBJECT_NODE *FieldNode,
+ IN AML_STREAM *FStream,
+ IN LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT8 * CurrPos;
- CONST AML_BYTE_ENCODING * FieldByteEncoding;
- CONST AML_BYTE_ENCODING * NamedFieldByteEncoding;
+ UINT8 *CurrPos;
+ CONST AML_BYTE_ENCODING *FieldByteEncoding;
+ CONST AML_BYTE_ENCODING *NamedFieldByteEncoding;
// Check whether the node is an Object Node and has a field list.
if (!AmlNodeHasAttribute (FieldNode, AML_HAS_FIELD_LIST) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (NameSpaceRefList == NULL)) {
+ (NameSpaceRefList == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -351,7 +355,8 @@ AmlParseFieldList ( // call AmlGetByteEncoding() to check that the encoding is NameChar.
NamedFieldByteEncoding = AmlGetByteEncoding (CurrPos);
if ((NamedFieldByteEncoding != NULL) &&
- (NamedFieldByteEncoding->Attribute & AML_IS_NAME_CHAR)) {
+ (NamedFieldByteEncoding->Attribute & AML_IS_NAME_CHAR))
+ {
// This is a NamedField field element since it is starting with a char.
Status = AmlParseNamedFieldElement (
NamedFieldByteEncoding,
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.h b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.h index 576f6c4..c0d3f1b 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.h @@ -69,9 +69,9 @@ EFI_STATUS
EFIAPI
AmlParseFieldList (
- IN AML_OBJECT_NODE * FieldNode,
- IN AML_STREAM * FStream,
- IN LIST_ENTRY * NameSpaceRefList
+ IN AML_OBJECT_NODE *FieldNode,
+ IN AML_STREAM *FStream,
+ IN LIST_ENTRY *NameSpaceRefList
);
#endif // AML_FIELD_LIST_PARSER_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c index 53e91dd..8c77716 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c @@ -30,7 +30,7 @@ STATIC EFI_STATUS
EFIAPI
AmlDeleteNameSpaceRefNode (
- IN AML_NAMESPACE_REF_NODE * NameSpaceRefNode
+ IN AML_NAMESPACE_REF_NODE *NameSpaceRefNode
)
{
if (NameSpaceRefNode == NULL) {
@@ -39,7 +39,7 @@ AmlDeleteNameSpaceRefNode ( }
if (NameSpaceRefNode->RawAbsolutePath != NULL) {
- FreePool ((CHAR8*)NameSpaceRefNode->RawAbsolutePath);
+ FreePool ((CHAR8 *)NameSpaceRefNode->RawAbsolutePath);
} else {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -59,11 +59,11 @@ AmlDeleteNameSpaceRefNode ( EFI_STATUS
EFIAPI
AmlDeleteNameSpaceRefList (
- IN LIST_ENTRY * NameSpaceRefList
+ IN LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
- LIST_ENTRY * CurrentLink;
+ EFI_STATUS Status;
+ LIST_ENTRY *CurrentLink;
if (NameSpaceRefList == NULL) {
ASSERT (0);
@@ -74,7 +74,7 @@ AmlDeleteNameSpaceRefList ( CurrentLink = NameSpaceRefList->ForwardLink;
RemoveEntryList (CurrentLink);
Status = AmlDeleteNameSpaceRefNode (
- (AML_NAMESPACE_REF_NODE*)CurrentLink
+ (AML_NAMESPACE_REF_NODE *)CurrentLink
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -106,18 +106,19 @@ STATIC EFI_STATUS
EFIAPI
AmlCreateMethodRefNode (
- IN CONST AML_OBJECT_NODE * ObjectNode,
- IN CONST CHAR8 * RawAbsolutePath,
- IN UINT32 RawAbsolutePathSize,
- OUT AML_NAMESPACE_REF_NODE ** NameSpaceRefNodePtr
+ IN CONST AML_OBJECT_NODE *ObjectNode,
+ IN CONST CHAR8 *RawAbsolutePath,
+ IN UINT32 RawAbsolutePathSize,
+ OUT AML_NAMESPACE_REF_NODE **NameSpaceRefNodePtr
)
{
- AML_NAMESPACE_REF_NODE * NameSpaceRefNode;
+ AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) ||
(RawAbsolutePath == NULL) ||
(RawAbsolutePathSize == 0) ||
- (NameSpaceRefNodePtr == NULL)) {
+ (NameSpaceRefNodePtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -129,10 +130,10 @@ AmlCreateMethodRefNode ( }
NameSpaceRefNode->RawAbsolutePathSize = RawAbsolutePathSize;
- NameSpaceRefNode->RawAbsolutePath = AllocateCopyPool (
- RawAbsolutePathSize,
- RawAbsolutePath
- );
+ NameSpaceRefNode->RawAbsolutePath = AllocateCopyPool (
+ RawAbsolutePathSize,
+ RawAbsolutePath
+ );
if (NameSpaceRefNode->RawAbsolutePath == NULL) {
FreePool (NameSpaceRefNode);
ASSERT (0);
@@ -142,7 +143,7 @@ AmlCreateMethodRefNode ( InitializeListHead (&NameSpaceRefNode->Link);
NameSpaceRefNode->NodeRef = ObjectNode;
- *NameSpaceRefNodePtr = NameSpaceRefNode;
+ *NameSpaceRefNodePtr = NameSpaceRefNode;
return EFI_SUCCESS;
}
@@ -156,11 +157,11 @@ AmlCreateMethodRefNode ( VOID
EFIAPI
AmlDbgPrintNameSpaceRefList (
- IN CONST LIST_ENTRY * NameSpaceRefList
+ IN CONST LIST_ENTRY *NameSpaceRefList
)
{
- LIST_ENTRY * CurrLink;
- AML_NAMESPACE_REF_NODE * CurrNameSpaceNode;
+ LIST_ENTRY *CurrLink;
+ AML_NAMESPACE_REF_NODE *CurrNameSpaceNode;
if (NameSpaceRefList == NULL) {
ASSERT (0);
@@ -171,7 +172,7 @@ AmlDbgPrintNameSpaceRefList ( CurrLink = NameSpaceRefList->ForwardLink;
while (CurrLink != NameSpaceRefList) {
- CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE*)CurrLink;
+ CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE *)CurrLink;
AMLDBG_PRINT_CHARS (
DEBUG_INFO,
@@ -215,28 +216,29 @@ STATIC EFI_STATUS
EFIAPI
AmlInitRawPathBStream (
- IN CONST AML_STREAM * FStream,
- OUT AML_STREAM * RawPathNameBStream
+ IN CONST AML_STREAM *FStream,
+ OUT AML_STREAM *RawPathNameBStream
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT8 * RawPathBuffer;
- CONST CHAR8 * Buffer;
+ UINT8 *RawPathBuffer;
+ CONST CHAR8 *Buffer;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
- !IS_STREAM_FORWARD (FStream) ||
- (RawPathNameBStream == NULL)) {
+ !IS_STREAM_FORWARD (FStream) ||
+ (RawPathNameBStream == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- Buffer = (CONST CHAR8*)AmlStreamGetCurrPos (FStream);
+ Buffer = (CONST CHAR8 *)AmlStreamGetCurrPos (FStream);
if (Buffer == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -255,11 +257,11 @@ AmlInitRawPathBStream ( }
// Get the beginning of the raw NameString.
- RawPathBuffer = (UINT8*)AmlGetFirstNameSeg (
- Buffer,
- Root,
- ParentPrefix
- );
+ RawPathBuffer = (UINT8 *)AmlGetFirstNameSeg (
+ Buffer,
+ Root,
+ ParentPrefix
+ );
if (RawPathBuffer == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -313,16 +315,17 @@ STATIC EFI_STATUS
EFIAPI
AmlGetFirstNamedAncestorNode (
- IN CONST AML_NODE_HEADER * Node,
- OUT AML_NODE_HEADER ** OutNamedNode
+ IN CONST AML_NODE_HEADER *Node,
+ OUT AML_NODE_HEADER **OutNamedNode
)
{
- EFI_STATUS Status;
- CONST AML_NODE_HEADER * NameSpaceNode;
+ EFI_STATUS Status;
+ CONST AML_NODE_HEADER *NameSpaceNode;
if ((!IS_AML_OBJECT_NODE (Node) &&
!IS_AML_ROOT_NODE (Node)) ||
- (OutNamedNode == NULL)) {
+ (OutNamedNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -331,23 +334,26 @@ AmlGetFirstNamedAncestorNode ( // get the ancestor NameSpace node.
while (!IS_AML_ROOT_NODE (Node) &&
!(AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
- AML_IN_NAMESPACE) &&
- AmlNodeGetName ((CONST AML_OBJECT_NODE*)Node) != NULL)) {
+ (CONST AML_OBJECT_NODE *)Node,
+ AML_IN_NAMESPACE
+ ) &&
+ AmlNodeGetName ((CONST AML_OBJECT_NODE *)Node) != NULL))
+ {
Status = AmlGetFirstAncestorNameSpaceNode (
- Node,
- (AML_NODE_HEADER**)&NameSpaceNode
- );
+ Node,
+ (AML_NODE_HEADER **)&NameSpaceNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
+
// The NameSpaceNode may not have its name defined as yet. In this
// case get the next ancestor node.
Node = NameSpaceNode;
}
- *OutNamedNode = (AML_NODE_HEADER*)Node;
+ *OutNamedNode = (AML_NODE_HEADER *)Node;
return EFI_SUCCESS;
}
@@ -380,20 +386,20 @@ STATIC EFI_STATUS
EFIAPI
AmlBuildRawMethodAbsolutePath (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN CONST AML_STREAM * PathnameFStream,
- IN OUT AML_STREAM * AbsolutePathBStream
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN CONST AML_STREAM *PathnameFStream,
+ IN OUT AML_STREAM *AbsolutePathBStream
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_NODE_HEADER * NamedParentNode;
- UINT8 * RawPathBuffer;
- CONST CHAR8 * CurrPos;
+ AML_NODE_HEADER *NamedParentNode;
+ UINT8 *RawPathBuffer;
+ CONST CHAR8 *CurrPos;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
if ((!IS_AML_OBJECT_NODE (ParentNode) &&
!IS_AML_ROOT_NODE (ParentNode)) ||
@@ -402,12 +408,13 @@ AmlBuildRawMethodAbsolutePath ( !IS_STREAM_FORWARD (PathnameFStream) ||
!IS_STREAM (AbsolutePathBStream) ||
IS_END_OF_STREAM (AbsolutePathBStream) ||
- !IS_STREAM_BACKWARD (AbsolutePathBStream)) {
+ !IS_STREAM_BACKWARD (AbsolutePathBStream))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- CurrPos = (CONST CHAR8*)AmlStreamGetCurrPos (PathnameFStream);
+ CurrPos = (CONST CHAR8 *)AmlStreamGetCurrPos (PathnameFStream);
if (CurrPos == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -428,11 +435,11 @@ AmlBuildRawMethodAbsolutePath ( // Copy the method invocation raw relative path at the end of the Stream.
if (SegCount != 0) {
// Get the beginning of the raw NameString.
- RawPathBuffer = (UINT8*)AmlGetFirstNameSeg (
- CurrPos,
- Root,
- ParentPrefix
- );
+ RawPathBuffer = (UINT8 *)AmlGetFirstNameSeg (
+ CurrPos,
+ Root,
+ ParentPrefix
+ );
Status = AmlStreamWrite (
AbsolutePathBStream,
@@ -487,19 +494,19 @@ STATIC EFI_STATUS
EFIAPI
AmlCompareRawNameString (
- IN CONST AML_STREAM * RawFStream1,
- IN CONST AML_STREAM * RawFStream2,
- OUT UINT32 * CompareCount
+ IN CONST AML_STREAM *RawFStream1,
+ IN CONST AML_STREAM *RawFStream2,
+ OUT UINT32 *CompareCount
)
{
- EFI_STATUS Status;
- UINT32 Index;
+ EFI_STATUS Status;
+ UINT32 Index;
- AML_STREAM RawFStream1Clone;
- AML_STREAM RawFStream2Clone;
- UINT32 Stream1Size;
- UINT32 Stream2Size;
- UINT32 CompareLen;
+ AML_STREAM RawFStream1Clone;
+ AML_STREAM RawFStream2Clone;
+ UINT32 Stream1Size;
+ UINT32 Stream2Size;
+ UINT32 CompareLen;
// Raw NameStrings have a size that is a multiple of the size of NameSegs.
if (!IS_STREAM (RawFStream1) ||
@@ -507,7 +514,8 @@ AmlCompareRawNameString ( !IS_STREAM_FORWARD (RawFStream1) ||
!IS_STREAM (RawFStream2) ||
IS_END_OF_STREAM (RawFStream2) ||
- (CompareCount == NULL)) {
+ (CompareCount == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -537,14 +545,16 @@ AmlCompareRawNameString ( }
CompareLen = MIN (Stream1Size, Stream2Size);
- Index = 0;
+ Index = 0;
// Check there is enough space for a NameSeg in both Stream1 and Stream2.
while (Index < CompareLen) {
if (!AmlStreamCmp (
&RawFStream1Clone,
&RawFStream2Clone,
- AML_NAME_SEG_SIZE)
- ) {
+ AML_NAME_SEG_SIZE
+ )
+ )
+ {
// NameSegs are different. Break.
break;
}
@@ -554,6 +564,7 @@ AmlCompareRawNameString ( ASSERT (0);
return Status;
}
+
Status = AmlStreamProgress (&RawFStream2Clone, AML_NAME_SEG_SIZE);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -599,28 +610,29 @@ STATIC EFI_STATUS
EFIAPI
AmlResolveAliasMethod (
- IN CONST AML_OBJECT_NODE * AliasNode,
- IN CONST LIST_ENTRY * NameSpaceRefList,
- OUT AML_NAMESPACE_REF_NODE ** OutNameSpaceRefNode
+ IN CONST AML_OBJECT_NODE *AliasNode,
+ IN CONST LIST_ENTRY *NameSpaceRefList,
+ OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode
)
{
- EFI_STATUS Status;
- AML_STREAM SourceAliasFStream;
- CONST AML_DATA_NODE * DataNode;
+ EFI_STATUS Status;
+ AML_STREAM SourceAliasFStream;
+ CONST AML_DATA_NODE *DataNode;
if (!AmlNodeCompareOpCode (AliasNode, AML_ALIAS_OP, 0) ||
(NameSpaceRefList == NULL) ||
- (OutNameSpaceRefNode == NULL)) {
+ (OutNameSpaceRefNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// The aliased NameString (the source name) is the first fixed argument,
// cf. ACPI6.3 spec, s19.6.4: Alias (SourceObject, AliasObject)
- DataNode = (CONST AML_DATA_NODE*)AmlGetFixedArgument (
- (AML_OBJECT_NODE*)AliasNode,
- EAmlParseIndexTerm0
- );
+ DataNode = (CONST AML_DATA_NODE *)AmlGetFixedArgument (
+ (AML_OBJECT_NODE *)AliasNode,
+ EAmlParseIndexTerm0
+ );
if (DataNode == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -641,7 +653,7 @@ AmlResolveAliasMethod ( // Recursively check whether the source alias NameString
// is a method invocation.
Status = AmlIsMethodInvocation (
- AmlGetParent ((AML_NODE_HEADER*)AliasNode),
+ AmlGetParent ((AML_NODE_HEADER *)AliasNode),
&SourceAliasFStream,
NameSpaceRefList,
OutNameSpaceRefNode
@@ -710,27 +722,27 @@ STATIC EFI_STATUS
EFIAPI
AmlFindMethodDefinition (
- IN CONST AML_STREAM * RawAbsolutePathFStream,
- IN CONST AML_STREAM * RawPathNameBStream,
- IN CONST LIST_ENTRY * NameSpaceRefList,
- OUT AML_NAMESPACE_REF_NODE ** OutNameSpaceRefNode
+ IN CONST AML_STREAM *RawAbsolutePathFStream,
+ IN CONST AML_STREAM *RawPathNameBStream,
+ IN CONST LIST_ENTRY *NameSpaceRefList,
+ OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- LIST_ENTRY * NextLink;
+ LIST_ENTRY *NextLink;
// To resolve a pathname, scope levels need to be compared.
- UINT32 NameSegScopeCount;
- UINT32 PathNameSegScopeCount;
- UINT32 ProbedScopeCount;
- UINT32 BestScopeCount;
+ UINT32 NameSegScopeCount;
+ UINT32 PathNameSegScopeCount;
+ UINT32 ProbedScopeCount;
+ UINT32 BestScopeCount;
- AML_STREAM ProbedRawAbsoluteFStream;
- AML_STREAM ProbedRawAbsoluteBStream;
+ AML_STREAM ProbedRawAbsoluteFStream;
+ AML_STREAM ProbedRawAbsoluteBStream;
- AML_NAMESPACE_REF_NODE * ProbedNameSpaceRefNode;
- AML_NAMESPACE_REF_NODE * BestNameSpaceRefNode;
+ AML_NAMESPACE_REF_NODE *ProbedNameSpaceRefNode;
+ AML_NAMESPACE_REF_NODE *BestNameSpaceRefNode;
if (!IS_STREAM (RawAbsolutePathFStream) ||
IS_END_OF_STREAM (RawAbsolutePathFStream) ||
@@ -743,7 +755,8 @@ AmlFindMethodDefinition ( ((AmlStreamGetIndex (RawPathNameBStream) &
(AML_NAME_SEG_SIZE - 1)) != 0) ||
(NameSpaceRefList == NULL) ||
- (OutNameSpaceRefNode == NULL)) {
+ (OutNameSpaceRefNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -751,21 +764,21 @@ AmlFindMethodDefinition ( DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Checking absolute name: "));
AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE,
- (CONST CHAR8*)AmlStreamGetCurrPos (RawAbsolutePathFStream),
+ (CONST CHAR8 *)AmlStreamGetCurrPos (RawAbsolutePathFStream),
AmlStreamGetMaxBufferSize (RawAbsolutePathFStream)
);
DEBUG ((DEBUG_VERBOSE, ".\n"));
- BestNameSpaceRefNode = NULL;
- BestScopeCount = 0;
- NameSegScopeCount = AmlStreamGetMaxBufferSize (RawAbsolutePathFStream);
+ BestNameSpaceRefNode = NULL;
+ BestScopeCount = 0;
+ NameSegScopeCount = AmlStreamGetMaxBufferSize (RawAbsolutePathFStream);
PathNameSegScopeCount = AmlStreamGetMaxBufferSize (RawPathNameBStream);
// Iterate through the raw AML absolute path to find the best match.
DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Comparing with: "));
NextLink = NameSpaceRefList->ForwardLink;
while (NextLink != NameSpaceRefList) {
- ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE*)NextLink;
+ ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE *)NextLink;
// Print the raw absolute path of the probed node.
AMLDBG_PRINT_CHARS (
@@ -790,7 +803,7 @@ AmlFindMethodDefinition ( // "MET0" should be skipped.
Status = AmlStreamInit (
&ProbedRawAbsoluteBStream,
- (UINT8*)ProbedNameSpaceRefNode->RawAbsolutePath,
+ (UINT8 *)ProbedNameSpaceRefNode->RawAbsolutePath,
ProbedNameSpaceRefNode->RawAbsolutePathSize,
EAmlStreamDirectionBackward
);
@@ -803,7 +816,9 @@ AmlFindMethodDefinition ( if (!AmlStreamCmp (
RawPathNameBStream,
&ProbedRawAbsoluteBStream,
- AmlStreamGetMaxBufferSize (RawPathNameBStream))) {
+ AmlStreamGetMaxBufferSize (RawPathNameBStream)
+ ))
+ {
NextLink = NextLink->ForwardLink;
continue;
}
@@ -820,7 +835,7 @@ AmlFindMethodDefinition ( // Thus, the best match is \AAAA.MET0.
Status = AmlStreamInit (
&ProbedRawAbsoluteFStream,
- (UINT8*)ProbedNameSpaceRefNode->RawAbsolutePath,
+ (UINT8 *)ProbedNameSpaceRefNode->RawAbsolutePath,
ProbedNameSpaceRefNode->RawAbsolutePathSize,
EAmlStreamDirectionForward
);
@@ -847,7 +862,7 @@ AmlFindMethodDefinition ( } else if (ProbedScopeCount > BestScopeCount) {
// The probed node has more scope levels in common than the
// last best match. Update the best match.
- BestScopeCount = ProbedScopeCount;
+ BestScopeCount = ProbedScopeCount;
BestNameSpaceRefNode = ProbedNameSpaceRefNode;
} else if (ProbedScopeCount == BestScopeCount) {
// The probed node has the same number of scope levels in
@@ -871,11 +886,13 @@ AmlFindMethodDefinition ( // didn't because it is out of scope.
// Thus, the best match is \AAAA.MET0.
if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) <
- BestNameSpaceRefNode->RawAbsolutePathSize) {
- BestScopeCount = ProbedScopeCount;
+ BestNameSpaceRefNode->RawAbsolutePathSize)
+ {
+ BestScopeCount = ProbedScopeCount;
BestNameSpaceRefNode = ProbedNameSpaceRefNode;
} else if (AmlStreamGetIndex (&ProbedRawAbsoluteFStream) ==
- BestNameSpaceRefNode->RawAbsolutePathSize) {
+ BestNameSpaceRefNode->RawAbsolutePathSize)
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -893,7 +910,10 @@ AmlFindMethodDefinition ( *OutNameSpaceRefNode = BestNameSpaceRefNode;
} else if (AmlNodeCompareOpCode (
BestNameSpaceRefNode->NodeRef,
- AML_ALIAS_OP, 0)) {
+ AML_ALIAS_OP,
+ 0
+ ))
+ {
// The path matches an alias. Resolve the alias and check whether
// this is a method defintion.
Status = AmlResolveAliasMethod (
@@ -943,22 +963,22 @@ AmlFindMethodDefinition ( EFI_STATUS
EFIAPI
AmlIsMethodInvocation (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN CONST AML_STREAM * FStream,
- IN CONST LIST_ENTRY * NameSpaceRefList,
- OUT AML_NAMESPACE_REF_NODE ** OutNameSpaceRefNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN CONST AML_STREAM *FStream,
+ IN CONST LIST_ENTRY *NameSpaceRefList,
+ OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_STREAM RawPathNameBStream;
- AML_STREAM RawAbsolutePathFStream;
+ AML_STREAM RawPathNameBStream;
+ AML_STREAM RawAbsolutePathFStream;
- AML_STREAM RawAbsolutePathBStream;
- UINT8 * RawAbsolutePathBuffer;
- UINT32 RawAbsolutePathBufferSize;
+ AML_STREAM RawAbsolutePathBStream;
+ UINT8 *RawAbsolutePathBuffer;
+ UINT32 RawAbsolutePathBufferSize;
- AML_NAMESPACE_REF_NODE * NameSpaceRefNode;
+ AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
if ((!IS_AML_OBJECT_NODE (ParentNode) &&
!IS_AML_ROOT_NODE (ParentNode)) ||
@@ -966,22 +986,25 @@ AmlIsMethodInvocation ( IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL) ||
- (OutNameSpaceRefNode == NULL)) {
+ (OutNameSpaceRefNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// There cannot be a method invocation in a field list. Return.
if (AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)ParentNode,
- AML_HAS_FIELD_LIST)) {
+ (CONST AML_OBJECT_NODE *)ParentNode,
+ AML_HAS_FIELD_LIST
+ ))
+ {
*OutNameSpaceRefNode = NULL;
return EFI_SUCCESS;
}
// Allocate memory for the raw absolute path.
RawAbsolutePathBufferSize = MAX_AML_NAMESTRING_SIZE;
- RawAbsolutePathBuffer = AllocateZeroPool (RawAbsolutePathBufferSize);
+ RawAbsolutePathBuffer = AllocateZeroPool (RawAbsolutePathBufferSize);
if (RawAbsolutePathBuffer == NULL) {
ASSERT (0);
return EFI_OUT_OF_RESOURCES;
@@ -1018,7 +1041,7 @@ AmlIsMethodInvocation ( "Root node cannot be a method invocation\n"
));
*OutNameSpaceRefNode = NULL;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
goto exit_handler;
}
@@ -1049,18 +1072,18 @@ AmlIsMethodInvocation ( // Go through the NameSpaceRefList elements to check for
// a corresponding method definition.
NameSpaceRefNode = NULL;
- Status = AmlFindMethodDefinition (
- &RawAbsolutePathFStream,
- &RawPathNameBStream,
- NameSpaceRefList,
- &NameSpaceRefNode
- );
+ Status = AmlFindMethodDefinition (
+ &RawAbsolutePathFStream,
+ &RawPathNameBStream,
+ NameSpaceRefList,
+ &NameSpaceRefNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
goto exit_handler;
}
-#if !defined(MDEPKG_NDEBUG)
+ #if !defined (MDEPKG_NDEBUG)
// Print whether a method definition has been found.
if (NameSpaceRefNode != NULL) {
DEBUG ((
@@ -1073,11 +1096,11 @@ AmlIsMethodInvocation ( NameSpaceRefNode->RawAbsolutePathSize
);
DEBUG ((DEBUG_VERBOSE, ".\n"));
-
} else {
DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: No method definition found.\n"));
}
-#endif // MDEPKG_NDEBUG
+
+ #endif // MDEPKG_NDEBUG
*OutNameSpaceRefNode = NameSpaceRefNode;
@@ -1105,27 +1128,28 @@ exit_handler: EFI_STATUS
EFIAPI
AmlAddNameSpaceReference (
- IN CONST AML_OBJECT_NODE * Node,
- IN OUT LIST_ENTRY * NameSpaceRefList
+ IN CONST AML_OBJECT_NODE *Node,
+ IN OUT LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
- AML_NAMESPACE_REF_NODE * NameSpaceRefNode;
+ EFI_STATUS Status;
+ AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
- AML_STREAM NodeNameFStream;
- EAML_PARSE_INDEX NameIndex;
- CONST AML_DATA_NODE * NameNode;
+ AML_STREAM NodeNameFStream;
+ EAML_PARSE_INDEX NameIndex;
+ CONST AML_DATA_NODE *NameNode;
- AML_STREAM RawAbsolutePathBStream;
- UINT32 RawAbsolutePathBStreamSize;
+ AML_STREAM RawAbsolutePathBStream;
+ UINT32 RawAbsolutePathBStreamSize;
- CHAR8 * AbsolutePathBuffer;
- UINT32 AbsolutePathBufferSize;
+ CHAR8 *AbsolutePathBuffer;
+ UINT32 AbsolutePathBufferSize;
- CONST AML_NODE_HEADER * ParentNode;
+ CONST AML_NODE_HEADER *ParentNode;
if (!AmlNodeHasAttribute (Node, AML_IN_NAMESPACE) ||
- (NameSpaceRefList == NULL)) {
+ (NameSpaceRefList == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -1133,7 +1157,7 @@ AmlAddNameSpaceReference ( // Allocate a buffer to get the raw AML absolute pathname of the
// namespace node.
AbsolutePathBufferSize = MAX_AML_NAMESTRING_SIZE;
- AbsolutePathBuffer = AllocateZeroPool (AbsolutePathBufferSize);
+ AbsolutePathBuffer = AllocateZeroPool (AbsolutePathBufferSize);
if (AbsolutePathBuffer == NULL) {
ASSERT (0);
return EFI_OUT_OF_RESOURCES;
@@ -1141,7 +1165,7 @@ AmlAddNameSpaceReference ( Status = AmlStreamInit (
&RawAbsolutePathBStream,
- (UINT8*)AbsolutePathBuffer,
+ (UINT8 *)AbsolutePathBuffer,
AbsolutePathBufferSize,
EAmlStreamDirectionBackward
);
@@ -1161,12 +1185,13 @@ AmlAddNameSpaceReference ( }
// Get the Node name.
- NameNode = (CONST AML_DATA_NODE*)AmlGetFixedArgument (
- (AML_OBJECT_NODE*)Node,
- NameIndex
- );
+ NameNode = (CONST AML_DATA_NODE *)AmlGetFixedArgument (
+ (AML_OBJECT_NODE *)Node,
+ NameIndex
+ );
if (!IS_AML_DATA_NODE (NameNode) ||
- (NameNode->DataType != EAmlNodeDataTypeNameString)) {
+ (NameNode->DataType != EAmlNodeDataTypeNameString))
+ {
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
goto exit_handler;
@@ -1186,7 +1211,7 @@ AmlAddNameSpaceReference ( goto exit_handler;
}
- ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+ ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
if (ParentNode == NULL) {
ASSERT (0);
Status = EFI_INVALID_PARAMETER;
@@ -1214,7 +1239,7 @@ AmlAddNameSpaceReference ( // Create a NameSpace reference node.
Status = AmlCreateMethodRefNode (
Node,
- (CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
+ (CONST CHAR8 *)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
RawAbsolutePathBStreamSize,
&NameSpaceRefNode
);
@@ -1232,7 +1257,7 @@ AmlAddNameSpaceReference ( ));
AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE,
- (CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
+ (CONST CHAR8 *)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
AmlStreamGetIndex (&RawAbsolutePathBStream)
);
DEBUG ((DEBUG_VERBOSE, "\n"));
@@ -1275,31 +1300,32 @@ exit_handler: EFI_STATUS
EFIAPI
AmlCreateMethodInvocationNode (
- IN CONST AML_NAMESPACE_REF_NODE * NameSpaceRefNode,
- IN AML_DATA_NODE * MethodInvocationName,
- OUT AML_OBJECT_NODE ** MethodInvocationNodePtr
+ IN CONST AML_NAMESPACE_REF_NODE *NameSpaceRefNode,
+ IN AML_DATA_NODE *MethodInvocationName,
+ OUT AML_OBJECT_NODE **MethodInvocationNodePtr
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT8 ArgCount;
- AML_DATA_NODE * ArgCountNode;
- AML_NODE_HEADER ** FixedArgs;
- AML_OBJECT_NODE * MethodDefinitionNode;
- AML_OBJECT_NODE * MethodInvocationNode;
+ UINT8 ArgCount;
+ AML_DATA_NODE *ArgCountNode;
+ AML_NODE_HEADER **FixedArgs;
+ AML_OBJECT_NODE *MethodDefinitionNode;
+ AML_OBJECT_NODE *MethodInvocationNode;
if ((NameSpaceRefNode == NULL) ||
!AmlIsMethodDefinitionNode (NameSpaceRefNode->NodeRef) ||
!IS_AML_DATA_NODE (MethodInvocationName) ||
(MethodInvocationName->DataType != EAmlNodeDataTypeNameString) ||
- (MethodInvocationNodePtr == NULL)) {
+ (MethodInvocationNodePtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Get the number of arguments of the method.
- MethodDefinitionNode = (AML_OBJECT_NODE*)NameSpaceRefNode->NodeRef;
- FixedArgs = MethodDefinitionNode->FixedArgs;
+ MethodDefinitionNode = (AML_OBJECT_NODE *)NameSpaceRefNode->NodeRef;
+ FixedArgs = MethodDefinitionNode->FixedArgs;
// The method definition is an actual method definition.
if (AmlNodeCompareOpCode (MethodDefinitionNode, AML_METHOD_OP, 0)) {
// Cf ACPI 6.3 specification:
@@ -1312,8 +1338,8 @@ AmlCreateMethodInvocationNode ( // bit 4-7: SyncLevel (0x00-0x0f)
// Read the MethodFlags to decode the ArgCount.
- ArgCountNode = (AML_DATA_NODE*)FixedArgs[EAmlParseIndexTerm1];
- ArgCount = *((UINT8*)ArgCountNode->Buffer) & 0x7;
+ ArgCountNode = (AML_DATA_NODE *)FixedArgs[EAmlParseIndexTerm1];
+ ArgCount = *((UINT8 *)ArgCountNode->Buffer) & 0x7;
} else if (AmlNodeCompareOpCode (MethodDefinitionNode, AML_EXTERNAL_OP, 0)) {
// The method definition is an external statement.
// Cf ACPI 6.3 specification:
@@ -1323,8 +1349,8 @@ AmlCreateMethodInvocationNode ( // ArgumentCount := ByteData (0 - 7)
// Read the ArgumentCount.
- ArgCountNode = (AML_DATA_NODE*)FixedArgs[EAmlParseIndexTerm2];
- ArgCount = *((UINT8*)ArgCountNode->Buffer);
+ ArgCountNode = (AML_DATA_NODE *)FixedArgs[EAmlParseIndexTerm2];
+ ArgCount = *((UINT8 *)ArgCountNode->Buffer);
} else {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -1349,7 +1375,7 @@ AmlCreateMethodInvocationNode ( Status = AmlSetFixedArgument (
MethodInvocationNode,
EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)MethodInvocationName
+ (AML_NODE_HEADER *)MethodInvocationName
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1359,12 +1385,12 @@ AmlCreateMethodInvocationNode ( // Create a data node holding the number of arguments
// of the method invocation.
ArgCountNode = NULL;
- Status = AmlCreateDataNode (
- EAmlNodeDataTypeUInt,
- &ArgCount,
- sizeof (UINT8),
- &ArgCountNode
- );
+ Status = AmlCreateDataNode (
+ EAmlNodeDataTypeUInt,
+ &ArgCount,
+ sizeof (UINT8),
+ &ArgCountNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
goto error_handler;
@@ -1372,10 +1398,10 @@ AmlCreateMethodInvocationNode ( // The second fixed argument is the number of arguments.
Status = AmlSetFixedArgument (
- MethodInvocationNode,
- EAmlParseIndexTerm1,
- (AML_NODE_HEADER*)ArgCountNode
- );
+ MethodInvocationNode,
+ EAmlParseIndexTerm1,
+ (AML_NODE_HEADER *)ArgCountNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
goto error_handler;
@@ -1386,9 +1412,9 @@ AmlCreateMethodInvocationNode ( error_handler:
// Delete the sub-tree: the method invocation name is already attached.
- AmlDeleteTree ((AML_NODE_HEADER*)MethodInvocationNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)MethodInvocationNode);
if (ArgCountNode != NULL) {
- AmlDeleteNode ((AML_NODE_HEADER*)ArgCountNode);
+ AmlDeleteNode ((AML_NODE_HEADER *)ArgCountNode);
}
return Status;
@@ -1415,16 +1441,17 @@ error_handler: EFI_STATUS
EFIAPI
AmlGetMethodInvocationArgCount (
- IN CONST AML_OBJECT_NODE * MethodInvocationNode,
- OUT BOOLEAN * IsMethodInvocation,
- OUT UINT8 * ArgCount
+ IN CONST AML_OBJECT_NODE *MethodInvocationNode,
+ OUT BOOLEAN *IsMethodInvocation,
+ OUT UINT8 *ArgCount
)
{
- AML_DATA_NODE * NumArgsNode;
+ AML_DATA_NODE *NumArgsNode;
if (!IS_AML_NODE_VALID (MethodInvocationNode) ||
(IsMethodInvocation == NULL) ||
- (ArgCount == NULL)) {
+ (ArgCount == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -1432,7 +1459,7 @@ AmlGetMethodInvocationArgCount ( // Check whether MethodInvocationNode is a method invocation.
if (!AmlNodeCompareOpCode (MethodInvocationNode, AML_METHOD_INVOC_OP, 0)) {
*IsMethodInvocation = FALSE;
- *ArgCount = 0;
+ *ArgCount = 0;
return EFI_SUCCESS;
}
@@ -1440,17 +1467,19 @@ AmlGetMethodInvocationArgCount ( // MethodInvocationOp := Pseudo Opcode for Method Invocation
// NameString := Method Name
// ArgumentCount := ByteData (0 - 7)
- NumArgsNode = (AML_DATA_NODE*)AmlGetFixedArgument (
- (AML_OBJECT_NODE*)MethodInvocationNode,
- EAmlParseIndexTerm1
- );
+ NumArgsNode = (AML_DATA_NODE *)AmlGetFixedArgument (
+ (AML_OBJECT_NODE *)MethodInvocationNode,
+ EAmlParseIndexTerm1
+ );
if (!IS_AML_NODE_VALID (NumArgsNode) ||
(NumArgsNode->Buffer == NULL) ||
(NumArgsNode->DataType != EAmlNodeDataTypeUInt) ||
- (NumArgsNode->Size != 1)) {
+ (NumArgsNode->Size != 1))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
*ArgCount = *NumArgsNode->Buffer;
*IsMethodInvocation = TRUE;
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.h b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.h index b082f2d..ac3284d 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.h @@ -23,20 +23,20 @@ typedef struct AmlNameSpaceRefNode {
/// Double linked list.
/// This must be the first field in this structure.
- LIST_ENTRY Link;
+ LIST_ENTRY Link;
/// Node part of the AML namespace. It must have the AML_IN_NAMESPACE
/// attribute.
- CONST AML_OBJECT_NODE * NodeRef;
+ CONST AML_OBJECT_NODE *NodeRef;
/// Raw AML absolute pathname of the NodeRef.
/// This is a raw AML NameString (cf AmlNameSpace.c: A concatenated list
/// of 4 chars long names. The dual/multi NameString prefix have been
/// stripped.).
- CONST CHAR8 * RawAbsolutePath;
+ CONST CHAR8 *RawAbsolutePath;
/// Size of the raw AML absolute pathname buffer.
- UINT32 RawAbsolutePathSize;
+ UINT32 RawAbsolutePathSize;
} AML_NAMESPACE_REF_NODE;
/** Delete a list of namespace reference nodes.
@@ -49,11 +49,11 @@ typedef struct AmlNameSpaceRefNode { EFI_STATUS
EFIAPI
AmlDeleteNameSpaceRefList (
- IN LIST_ENTRY * NameSpaceRefList
+ IN LIST_ENTRY *NameSpaceRefList
);
-
#if !defined (MDEPKG_NDEBUG)
+
/** Print the list of raw absolute paths of the NameSpace reference list.
@param [in] NameSpaceRefList List of NameSpace reference nodes.
@@ -61,7 +61,7 @@ AmlDeleteNameSpaceRefList ( VOID
EFIAPI
AmlDbgPrintNameSpaceRefList (
- IN CONST LIST_ENTRY * NameSpaceRefList
+ IN CONST LIST_ENTRY *NameSpaceRefList
);
#endif // MDEPKG_NDEBUG
@@ -95,10 +95,10 @@ AmlDbgPrintNameSpaceRefList ( EFI_STATUS
EFIAPI
AmlIsMethodInvocation (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN CONST AML_STREAM * FStream,
- IN CONST LIST_ENTRY * NameSpaceRefList,
- OUT AML_NAMESPACE_REF_NODE ** OutNameSpaceRefNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN CONST AML_STREAM *FStream,
+ IN CONST LIST_ENTRY *NameSpaceRefList,
+ OUT AML_NAMESPACE_REF_NODE **OutNameSpaceRefNode
);
/** Create a namespace reference node and add it to the NameSpaceRefList.
@@ -119,8 +119,8 @@ AmlIsMethodInvocation ( EFI_STATUS
EFIAPI
AmlAddNameSpaceReference (
- IN CONST AML_OBJECT_NODE * Node,
- IN OUT LIST_ENTRY * NameSpaceRefList
+ IN CONST AML_OBJECT_NODE *Node,
+ IN OUT LIST_ENTRY *NameSpaceRefList
);
/** Create a method invocation node.
@@ -154,9 +154,9 @@ AmlAddNameSpaceReference ( EFI_STATUS
EFIAPI
AmlCreateMethodInvocationNode (
- IN CONST AML_NAMESPACE_REF_NODE * NameSpaceRefNode,
- IN AML_DATA_NODE * MethodInvocationName,
- OUT AML_OBJECT_NODE ** MethodInvocationNodePtr
+ IN CONST AML_NAMESPACE_REF_NODE *NameSpaceRefNode,
+ IN AML_DATA_NODE *MethodInvocationName,
+ OUT AML_OBJECT_NODE **MethodInvocationNodePtr
);
/** Get the number of arguments of a method invocation node.
@@ -180,9 +180,9 @@ AmlCreateMethodInvocationNode ( EFI_STATUS
EFIAPI
AmlGetMethodInvocationArgCount (
- IN CONST AML_OBJECT_NODE * MethodInvocationNode,
- OUT BOOLEAN * IsMethodInvocation,
- OUT UINT8 * ArgCount
+ IN CONST AML_OBJECT_NODE *MethodInvocationNode,
+ OUT BOOLEAN *IsMethodInvocation,
+ OUT UINT8 *ArgCount
);
#endif // AML_METHOD_PARSER_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c index e3b9f24..8e584d4 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c @@ -69,9 +69,9 @@ STATIC EFI_STATUS
EFIAPI
AmlParseStream (
- IN AML_NODE_HEADER * Node,
- IN OUT AML_STREAM * FStream,
- IN OUT LIST_ENTRY * NameSpaceRefList
+ IN AML_NODE_HEADER *Node,
+ IN OUT AML_STREAM *FStream,
+ IN OUT LIST_ENTRY *NameSpaceRefList
);
/** Function pointer to parse an AML construct.
@@ -102,10 +102,10 @@ typedef EFI_STATUS
EFIAPI
(*AML_PARSE_FUNCTION) (
- IN CONST AML_NODE_HEADER * Node,
- IN AML_PARSE_FORMAT ExpectedFormat,
- IN OUT AML_STREAM * FStream,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *Node,
+ IN AML_PARSE_FORMAT ExpectedFormat,
+ IN OUT AML_STREAM *FStream,
+ OUT AML_NODE_HEADER **OutNode
);
/** Parse a UInt<X> (where X=8, 16, 32 or 64).
@@ -130,14 +130,14 @@ STATIC EFI_STATUS
EFIAPI
AmlParseUIntX (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN AML_PARSE_FORMAT ExpectedFormat,
- IN OUT AML_STREAM * FStream,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN AML_PARSE_FORMAT ExpectedFormat,
+ IN OUT AML_STREAM *FStream,
+ OUT AML_NODE_HEADER **OutNode
)
{
- EFI_STATUS Status;
- UINT32 UIntXSize;
+ EFI_STATUS Status;
+ UINT32 UIntXSize;
if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) ||
@@ -148,34 +148,35 @@ AmlParseUIntX ( !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
switch (ExpectedFormat) {
- case EAmlUInt8:
- UIntXSize = 1;
- break;
- case EAmlUInt16:
- UIntXSize = 2;
- break;
- case EAmlUInt32:
- UIntXSize = 4;
- break;
- case EAmlUInt64:
- UIntXSize = 8;
- break;
- default:
- ASSERT (0);
- return EFI_INVALID_PARAMETER;
+ case EAmlUInt8:
+ UIntXSize = 1;
+ break;
+ case EAmlUInt16:
+ UIntXSize = 2;
+ break;
+ case EAmlUInt32:
+ UIntXSize = 4;
+ break;
+ case EAmlUInt64:
+ UIntXSize = 8;
+ break;
+ default:
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
}
Status = AmlCreateDataNode (
AmlTypeToNodeDataType (ExpectedFormat),
AmlStreamGetCurrPos (FStream),
UIntXSize,
- (AML_DATA_NODE**)OutNode
+ (AML_DATA_NODE **)OutNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -216,17 +217,17 @@ STATIC EFI_STATUS
EFIAPI
AmlParseNameString (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN AML_PARSE_FORMAT ExpectedFormat,
- IN OUT AML_STREAM * FStream,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN AML_PARSE_FORMAT ExpectedFormat,
+ IN OUT AML_STREAM *FStream,
+ OUT AML_NODE_HEADER **OutNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- CONST UINT8 * Buffer;
- CONST AML_BYTE_ENCODING * ByteEncoding;
- UINT32 StrSize;
+ CONST UINT8 *Buffer;
+ CONST AML_BYTE_ENCODING *ByteEncoding;
+ UINT32 StrSize;
if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) ||
@@ -234,23 +235,26 @@ AmlParseNameString ( !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+ Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
ByteEncoding = AmlGetByteEncoding (Buffer);
if ((ByteEncoding == NULL) ||
- ((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0)) {
+ ((ByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Parse the NameString.
- Status = AmlGetNameStringSize ((CONST CHAR8*)Buffer, &StrSize);
+ Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &StrSize);
if ((EFI_ERROR (Status)) ||
- (StrSize > AmlStreamGetFreeSpace (FStream))) {
+ (StrSize > AmlStreamGetFreeSpace (FStream)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -259,7 +263,7 @@ AmlParseNameString ( EAmlNodeDataTypeNameString,
Buffer,
StrSize,
- (AML_DATA_NODE**)OutNode
+ (AML_DATA_NODE **)OutNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -300,16 +304,16 @@ STATIC EFI_STATUS
EFIAPI
AmlParseString (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN AML_PARSE_FORMAT ExpectedFormat,
- IN OUT AML_STREAM * FStream,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN AML_PARSE_FORMAT ExpectedFormat,
+ IN OUT AML_STREAM *FStream,
+ OUT AML_NODE_HEADER **OutNode
)
{
- EFI_STATUS Status;
- UINT32 StrSize;
- UINT8 Byte;
- CONST UINT8 * Buffer;
+ EFI_STATUS Status;
+ UINT32 StrSize;
+ UINT8 Byte;
+ CONST UINT8 *Buffer;
if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) ||
@@ -317,12 +321,13 @@ AmlParseString ( !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+ Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
StrSize = 0;
// AML String is NULL terminated.
do {
@@ -332,6 +337,7 @@ AmlParseString ( ASSERT (0);
return Status;
}
+
StrSize++;
} while (Byte != '\0');
@@ -341,7 +347,7 @@ AmlParseString ( AmlTypeToNodeDataType (ExpectedFormat),
Buffer,
StrSize,
- (AML_DATA_NODE**)OutNode
+ (AML_DATA_NODE **)OutNode
);
ASSERT_EFI_ERROR (Status);
@@ -372,21 +378,21 @@ STATIC EFI_STATUS
EFIAPI
AmlParseObject (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN AML_PARSE_FORMAT ExpectedFormat,
- IN OUT AML_STREAM * FStream,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN AML_PARSE_FORMAT ExpectedFormat,
+ IN OUT AML_STREAM *FStream,
+ OUT AML_NODE_HEADER **OutNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT8 OpCodeSize;
- UINT32 PkgLength;
- UINT32 PkgOffset;
- UINT32 FreeSpace;
+ UINT8 OpCodeSize;
+ UINT32 PkgLength;
+ UINT32 PkgOffset;
+ UINT32 FreeSpace;
- CONST AML_BYTE_ENCODING * AmlByteEncoding;
- CONST UINT8 * Buffer;
+ CONST AML_BYTE_ENCODING *AmlByteEncoding;
+ CONST UINT8 *Buffer;
if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) ||
@@ -394,7 +400,8 @@ AmlParseObject ( !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -424,16 +431,18 @@ AmlParseObject ( if (EFI_ERROR (Status)) {
ASSERT (0);
}
+
return Status;
}
// 2. Determine the OpCode size to move the stream forward.
- Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+ Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
if (*Buffer == AML_EXT_OP) {
OpCodeSize = 2;
} else {
OpCodeSize = 1;
}
+
Status = AmlStreamProgress (FStream, OpCodeSize);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -446,7 +455,7 @@ AmlParseObject ( if (!IS_END_OF_STREAM (FStream)) {
// 3. Parse the PkgLength field, if present.
if ((AmlByteEncoding->Attribute & AML_HAS_PKG_LENGTH) != 0) {
- Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+ Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
PkgOffset = AmlGetPkgLength (Buffer, &PkgLength);
if (PkgOffset == 0) {
ASSERT (0);
@@ -482,7 +491,7 @@ AmlParseObject ( Status = AmlCreateObjectNode (
AmlByteEncoding,
PkgLength,
- (AML_OBJECT_NODE**)OutNode
+ (AML_OBJECT_NODE **)OutNode
);
ASSERT_EFI_ERROR (Status);
@@ -513,32 +522,33 @@ STATIC EFI_STATUS
EFIAPI
AmlParseFieldPkgLen (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN AML_PARSE_FORMAT ExpectedFormat,
- IN OUT AML_STREAM * FStream,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN AML_PARSE_FORMAT ExpectedFormat,
+ IN OUT AML_STREAM *FStream,
+ OUT AML_NODE_HEADER **OutNode
)
{
- EFI_STATUS Status;
- EFI_STATUS Status1;
- CONST UINT8 * Buffer;
- UINT32 PkgOffset;
- UINT32 PkgLength;
+ EFI_STATUS Status;
+ EFI_STATUS Status1;
+ CONST UINT8 *Buffer;
+ UINT32 PkgOffset;
+ UINT32 PkgLength;
if (!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)ParentNode,
+ (CONST AML_OBJECT_NODE *)ParentNode,
AML_IS_FIELD_ELEMENT
) ||
(ExpectedFormat != EAmlFieldPkgLen) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+ Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
PkgOffset = AmlGetPkgLength (Buffer, &PkgLength);
if (PkgOffset == 0) {
@@ -552,7 +562,7 @@ AmlParseFieldPkgLen ( AmlTypeToNodeDataType (ExpectedFormat),
Buffer,
PkgOffset,
- (AML_DATA_NODE**)OutNode
+ (AML_DATA_NODE **)OutNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -577,7 +587,7 @@ AmlParseFieldPkgLen ( statements. The AML_PARSE_FORMAT enum definition lists these constructs
and the corresponding parsing functions.
*/
-AML_PARSE_FUNCTION mParseType[EAmlParseFormatMax] = {
+AML_PARSE_FUNCTION mParseType[EAmlParseFormatMax] = {
NULL, // EAmlNone
AmlParseUIntX, // EAmlUInt8
AmlParseUIntX, // EAmlUInt16
@@ -611,23 +621,24 @@ STATIC EFI_STATUS
EFIAPI
AmlCheckAndParseMethodInvoc (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN AML_DATA_NODE * DataNode,
- IN OUT LIST_ENTRY * NameSpaceRefList,
- OUT AML_OBJECT_NODE ** OutNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN AML_DATA_NODE *DataNode,
+ IN OUT LIST_ENTRY *NameSpaceRefList,
+ OUT AML_OBJECT_NODE **OutNode
)
{
- EFI_STATUS Status;
- AML_NAMESPACE_REF_NODE * NameSpaceRefNode;
- AML_OBJECT_NODE * MethodInvocationNode;
- AML_STREAM FStream;
+ EFI_STATUS Status;
+ AML_NAMESPACE_REF_NODE *NameSpaceRefNode;
+ AML_OBJECT_NODE *MethodInvocationNode;
+ AML_STREAM FStream;
if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) ||
!IS_AML_DATA_NODE (DataNode) ||
(DataNode->DataType != EAmlNodeDataTypeNameString) ||
(NameSpaceRefList == NULL) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -646,12 +657,12 @@ AmlCheckAndParseMethodInvoc ( // Check whether the NameString is a method invocation.
NameSpaceRefNode = NULL;
- Status = AmlIsMethodInvocation (
- ParentNode,
- &FStream,
- NameSpaceRefList,
- &NameSpaceRefNode
- );
+ Status = AmlIsMethodInvocation (
+ ParentNode,
+ &FStream,
+ NameSpaceRefList,
+ &NameSpaceRefNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -663,7 +674,7 @@ AmlCheckAndParseMethodInvoc ( // Create a method invocation node.
Status = AmlCreateMethodInvocationNode (
NameSpaceRefNode,
- (AML_DATA_NODE*)DataNode,
+ (AML_DATA_NODE *)DataNode,
&MethodInvocationNode
);
if (EFI_ERROR (Status)) {
@@ -701,17 +712,17 @@ STATIC EFI_STATUS
EFIAPI
AmlParseArgument (
- IN CONST AML_NODE_HEADER * ParentNode,
- IN AML_PARSE_FORMAT ExpectedFormat,
- IN OUT AML_STREAM * FStream,
- IN OUT LIST_ENTRY * NameSpaceRefList,
- OUT AML_NODE_HEADER ** OutNode
+ IN CONST AML_NODE_HEADER *ParentNode,
+ IN AML_PARSE_FORMAT ExpectedFormat,
+ IN OUT AML_STREAM *FStream,
+ IN OUT LIST_ENTRY *NameSpaceRefList,
+ OUT AML_NODE_HEADER **OutNode
)
{
- EFI_STATUS Status;
- AML_PARSE_FUNCTION ParsingFunction;
- AML_DATA_NODE * DataNode;
- AML_OBJECT_NODE * MethodInvocationNode;
+ EFI_STATUS Status;
+ AML_PARSE_FUNCTION ParsingFunction;
+ AML_DATA_NODE *DataNode;
+ AML_OBJECT_NODE *MethodInvocationNode;
if ((!IS_AML_ROOT_NODE (ParentNode) &&
!IS_AML_OBJECT_NODE (ParentNode)) ||
@@ -720,7 +731,8 @@ AmlParseArgument ( IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL) ||
- (OutNode == NULL)) {
+ (OutNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -746,15 +758,17 @@ AmlParseArgument ( // Check whether the parsed argument is a NameString when an object
// is expected. In such case, it could be a method invocation.
- DataNode = (AML_DATA_NODE*)*OutNode;
+ DataNode = (AML_DATA_NODE *)*OutNode;
if (IS_AML_DATA_NODE (DataNode) &&
(DataNode->DataType == EAmlNodeDataTypeNameString) &&
- (ExpectedFormat == EAmlObject)) {
+ (ExpectedFormat == EAmlObject))
+ {
Status = AmlCheckAndParseMethodInvoc (
ParentNode,
- (AML_DATA_NODE*)*OutNode,
+ (AML_DATA_NODE *)*OutNode,
NameSpaceRefList,
- &MethodInvocationNode);
+ &MethodInvocationNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -764,7 +778,7 @@ AmlParseArgument ( // the NameString has been attached to the MethodInvocationNode.
// Replace the OutNode with the MethodInvocationNode.
if (MethodInvocationNode != NULL) {
- *OutNode = (AML_NODE_HEADER*)MethodInvocationNode;
+ *OutNode = (AML_NODE_HEADER *)MethodInvocationNode;
}
}
@@ -789,20 +803,21 @@ STATIC EFI_STATUS
EFIAPI
AmlParseByteList (
- IN AML_OBJECT_NODE * BufferNode,
- IN OUT AML_STREAM * FStream
+ IN AML_OBJECT_NODE *BufferNode,
+ IN OUT AML_STREAM *FStream
)
{
- EFI_STATUS Status;
- AML_NODE_HEADER * NewNode;
- CONST UINT8 * Buffer;
- UINT32 BufferSize;
+ EFI_STATUS Status;
+ AML_NODE_HEADER *NewNode;
+ CONST UINT8 *Buffer;
+ UINT32 BufferSize;
// Check whether the node is an Object Node and has byte list.
if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
- !IS_STREAM_FORWARD (FStream)) {
+ !IS_STREAM_FORWARD (FStream))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -820,14 +835,14 @@ AmlParseByteList ( // Create a single node holding the whole buffer data.
// CreateDataNode checks the Buffer and BufferSize values.
- Buffer = (CONST UINT8*)AmlStreamGetCurrPos (FStream);
+ Buffer = (CONST UINT8 *)AmlStreamGetCurrPos (FStream);
BufferSize = AmlStreamGetFreeSpace (FStream);
Status = AmlCreateDataNode (
EAmlNodeDataTypeRaw,
Buffer,
BufferSize,
- (AML_DATA_NODE**)&NewNode
+ (AML_DATA_NODE **)&NewNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -835,9 +850,9 @@ AmlParseByteList ( }
Status = AmlVarListAddTailInternal (
- (AML_NODE_HEADER*)BufferNode,
- NewNode
- );
+ (AML_NODE_HEADER *)BufferNode,
+ NewNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
AmlDeleteTree (NewNode);
@@ -877,19 +892,19 @@ AmlParseByteList ( EFI_STATUS
EFIAPI
AmlParseFixedArguments (
- IN AML_OBJECT_NODE * ObjectNode,
- IN AML_STREAM * FStream,
- IN LIST_ENTRY * NameSpaceRefList
+ IN AML_OBJECT_NODE *ObjectNode,
+ IN AML_STREAM *FStream,
+ IN LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_NODE_HEADER * FixedArgNode;
- AML_STREAM FixedArgFStream;
+ AML_NODE_HEADER *FixedArgNode;
+ AML_STREAM FixedArgFStream;
- EAML_PARSE_INDEX TermIndex;
- EAML_PARSE_INDEX MaxIndex;
- CONST AML_PARSE_FORMAT * Format;
+ EAML_PARSE_INDEX TermIndex;
+ EAML_PARSE_INDEX MaxIndex;
+ CONST AML_PARSE_FORMAT *Format;
// Fixed arguments of method invocations node are handled differently.
if (!IS_AML_OBJECT_NODE (ObjectNode) ||
@@ -897,17 +912,19 @@ AmlParseFixedArguments ( !IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (NameSpaceRefList == NULL)) {
+ (NameSpaceRefList == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
TermIndex = EAmlParseIndexTerm0;
- MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
- (AML_OBJECT_NODE*)ObjectNode
- );
+ MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
+ (AML_OBJECT_NODE *)ObjectNode
+ );
if ((ObjectNode->AmlByteEncoding != NULL) &&
- (ObjectNode->AmlByteEncoding->Format != NULL)) {
+ (ObjectNode->AmlByteEncoding->Format != NULL))
+ {
Format = ObjectNode->AmlByteEncoding->Format;
} else {
ASSERT (0);
@@ -917,7 +934,8 @@ AmlParseFixedArguments ( // Parse all the FixedArgs.
while ((TermIndex < MaxIndex) &&
!IS_END_OF_STREAM (FStream) &&
- (Format[TermIndex] != EAmlNone)) {
+ (Format[TermIndex] != EAmlNone))
+ {
// Initialize a FixedArgStream to parse the current fixed argument.
Status = AmlStreamInitSubStream (FStream, &FixedArgFStream);
if (EFI_ERROR (Status)) {
@@ -927,7 +945,7 @@ AmlParseFixedArguments ( // Parse the current fixed argument.
Status = AmlParseArgument (
- (CONST AML_NODE_HEADER*)ObjectNode,
+ (CONST AML_NODE_HEADER *)ObjectNode,
Format[TermIndex],
&FixedArgFStream,
NameSpaceRefList,
@@ -941,7 +959,7 @@ AmlParseFixedArguments ( // Add the fixed argument to the parent node's fixed argument list.
// FixedArgNode can be an object or data node.
Status = AmlSetFixedArgument (
- (AML_OBJECT_NODE*)ObjectNode,
+ (AML_OBJECT_NODE *)ObjectNode,
TermIndex,
FixedArgNode
);
@@ -957,7 +975,8 @@ AmlParseFixedArguments ( // Parse the AML bytecode of the FixedArgNode if this is an object node.
if (IS_AML_OBJECT_NODE (FixedArgNode) &&
- !IS_END_OF_STREAM (&FixedArgFStream)) {
+ !IS_END_OF_STREAM (&FixedArgFStream))
+ {
Status = AmlParseStream (
FixedArgNode,
&FixedArgFStream,
@@ -1011,34 +1030,35 @@ AmlParseFixedArguments ( EFI_STATUS
EFIAPI
AmlParseVariableArguments (
- IN AML_NODE_HEADER * Node,
- IN AML_STREAM * FStream,
- IN LIST_ENTRY * NameSpaceRefList
+ IN AML_NODE_HEADER *Node,
+ IN AML_STREAM *FStream,
+ IN LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- BOOLEAN IsMethodInvocation;
- UINT8 MethodInvocationArgCount;
+ BOOLEAN IsMethodInvocation;
+ UINT8 MethodInvocationArgCount;
- AML_NODE_HEADER * VarArgNode;
- AML_STREAM VarArgFStream;
+ AML_NODE_HEADER *VarArgNode;
+ AML_STREAM VarArgFStream;
if ((!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
+ (CONST AML_OBJECT_NODE *)Node,
AML_HAS_CHILD_OBJ
) &&
!IS_AML_ROOT_NODE (Node)) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (NameSpaceRefList == NULL)) {
+ (NameSpaceRefList == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Status = AmlGetMethodInvocationArgCount (
- (CONST AML_OBJECT_NODE*)Node,
+ (CONST AML_OBJECT_NODE *)Node,
&IsMethodInvocation,
&MethodInvocationArgCount
);
@@ -1077,7 +1097,7 @@ AmlParseVariableArguments ( // Add the variable argument to its parent variable list of arguments.
// VarArgNode can be an object or data node.
Status = AmlVarListAddTailInternal (
- (AML_NODE_HEADER*)Node,
+ (AML_NODE_HEADER *)Node,
VarArgNode
);
if (EFI_ERROR (Status)) {
@@ -1092,7 +1112,8 @@ AmlParseVariableArguments ( // Parse the AML bytecode of the VarArgNode if this is an object node.
if (IS_AML_OBJECT_NODE (VarArgNode) &&
- (!IS_END_OF_STREAM (&VarArgFStream))) {
+ (!IS_END_OF_STREAM (&VarArgFStream)))
+ {
Status = AmlParseStream (VarArgNode, &VarArgFStream, NameSpaceRefList);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1139,25 +1160,26 @@ STATIC EFI_STATUS
EFIAPI
AmlPopulateRootNode (
- IN AML_ROOT_NODE * RootNode,
- IN OUT AML_STREAM * FStream,
- IN OUT LIST_ENTRY * NameSpaceRefList
+ IN AML_ROOT_NODE *RootNode,
+ IN OUT AML_STREAM *FStream,
+ IN OUT LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (!IS_AML_ROOT_NODE (RootNode) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (NameSpaceRefList == NULL)) {
+ (NameSpaceRefList == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// A Root Node only has variable arguments.
Status = AmlParseVariableArguments (
- (AML_NODE_HEADER*)RootNode,
+ (AML_NODE_HEADER *)RootNode,
FStream,
NameSpaceRefList
);
@@ -1184,18 +1206,19 @@ STATIC EFI_STATUS
EFIAPI
AmlPopulateObjectNode (
- IN AML_OBJECT_NODE * ObjectNode,
- IN OUT AML_STREAM * FStream,
- IN OUT LIST_ENTRY * NameSpaceRefList
+ IN AML_OBJECT_NODE *ObjectNode,
+ IN OUT AML_STREAM *FStream,
+ IN OUT LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (!IS_AML_OBJECT_NODE (ObjectNode) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
- (NameSpaceRefList == NULL)) {
+ (NameSpaceRefList == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -1230,10 +1253,12 @@ AmlPopulateObjectNode ( // This allows to identify method invocations from other namespace
// paths. Method invocation need to be parsed differently.
if (AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)ObjectNode,
- AML_IN_NAMESPACE)) {
+ (CONST AML_OBJECT_NODE *)ObjectNode,
+ AML_IN_NAMESPACE
+ ))
+ {
Status = AmlAddNameSpaceReference (
- (CONST AML_OBJECT_NODE*)ObjectNode,
+ (CONST AML_OBJECT_NODE *)ObjectNode,
NameSpaceRefList
);
if (EFI_ERROR (Status)) {
@@ -1246,23 +1271,23 @@ AmlPopulateObjectNode ( // Parse the variable list of arguments if present.
if (AmlNodeHasAttribute (ObjectNode, AML_HAS_CHILD_OBJ)) {
Status = AmlParseVariableArguments (
- (AML_NODE_HEADER*)ObjectNode,
- FStream,
- NameSpaceRefList
- );
+ (AML_NODE_HEADER *)ObjectNode,
+ FStream,
+ NameSpaceRefList
+ );
} else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_BYTE_LIST)) {
// Parse the byte list if present.
Status = AmlParseByteList (
- ObjectNode,
- FStream
- );
+ ObjectNode,
+ FStream
+ );
} else if (AmlNodeHasAttribute (ObjectNode, AML_HAS_FIELD_LIST)) {
// Parse the field list if present.
Status = AmlParseFieldList (
- ObjectNode,
- FStream,
- NameSpaceRefList
- );
+ ObjectNode,
+ FStream,
+ NameSpaceRefList
+ );
}
// Check status and assert
@@ -1292,33 +1317,31 @@ STATIC EFI_STATUS
EFIAPI
AmlParseStream (
- IN AML_NODE_HEADER * Node,
- IN AML_STREAM * FStream,
- IN LIST_ENTRY * NameSpaceRefList
+ IN AML_NODE_HEADER *Node,
+ IN AML_STREAM *FStream,
+ IN LIST_ENTRY *NameSpaceRefList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (IS_AML_ROOT_NODE (Node)) {
Status = AmlPopulateRootNode (
- (AML_ROOT_NODE*)Node,
+ (AML_ROOT_NODE *)Node,
FStream,
NameSpaceRefList
);
if (EFI_ERROR (Status)) {
ASSERT (0);
}
-
} else if (IS_AML_OBJECT_NODE (Node)) {
Status = AmlPopulateObjectNode (
- (AML_OBJECT_NODE*)Node,
+ (AML_OBJECT_NODE *)Node,
FStream,
NameSpaceRefList
);
if (EFI_ERROR (Status)) {
ASSERT (0);
}
-
} else {
// Data node or other.
ASSERT (0);
@@ -1346,37 +1369,39 @@ AmlParseStream ( EFI_STATUS
EFIAPI
AmlParseDefinitionBlock (
- IN CONST EFI_ACPI_DESCRIPTION_HEADER * DefinitionBlock,
- OUT AML_ROOT_NODE ** RootPtr
+ IN CONST EFI_ACPI_DESCRIPTION_HEADER *DefinitionBlock,
+ OUT AML_ROOT_NODE **RootPtr
)
{
- EFI_STATUS Status;
- EFI_STATUS Status1;
- AML_STREAM Stream;
- AML_ROOT_NODE * Root;
+ EFI_STATUS Status;
+ EFI_STATUS Status1;
+ AML_STREAM Stream;
+ AML_ROOT_NODE *Root;
- LIST_ENTRY NameSpaceRefList;
+ LIST_ENTRY NameSpaceRefList;
- UINT8 * Buffer;
- UINT32 MaxBufferSize;
+ UINT8 *Buffer;
+ UINT32 MaxBufferSize;
if ((DefinitionBlock == NULL) ||
- (RootPtr == NULL)) {
+ (RootPtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- Buffer = (UINT8*)DefinitionBlock + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+ Buffer = (UINT8 *)DefinitionBlock + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
if (DefinitionBlock->Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
MaxBufferSize = DefinitionBlock->Length -
- (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+ (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
// Create a root node.
Status = AmlCreateRootNode (
- (EFI_ACPI_DESCRIPTION_HEADER*)DefinitionBlock,
+ (EFI_ACPI_DESCRIPTION_HEADER *)DefinitionBlock,
&Root
);
if (EFI_ERROR (Status)) {
@@ -1408,7 +1433,7 @@ AmlParseDefinitionBlock ( // Parse the whole AML blob.
Status = AmlParseStream (
- (AML_NODE_HEADER*)Root,
+ (AML_NODE_HEADER *)Root,
&Stream,
&NameSpaceRefList
);
@@ -1432,7 +1457,7 @@ AmlParseDefinitionBlock ( error_handler:
if (Root != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)Root);
+ AmlDeleteTree ((AML_NODE_HEADER *)Root);
}
exit_handler:
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.h b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.h index 096a959..2900e1c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.h @@ -33,9 +33,9 @@ EFI_STATUS
EFIAPI
AmlParseFixedArguments (
- IN AML_OBJECT_NODE * ObjectNode,
- IN AML_STREAM * FStream,
- IN LIST_ENTRY * NameSpaceRefList
+ IN AML_OBJECT_NODE *ObjectNode,
+ IN AML_STREAM *FStream,
+ IN LIST_ENTRY *NameSpaceRefList
);
/** Parse the variable list of arguments of the input ObjectNode.
@@ -64,9 +64,9 @@ AmlParseFixedArguments ( EFI_STATUS
EFIAPI
AmlParseVariableArguments (
- IN AML_NODE_HEADER * Node,
- IN AML_STREAM * FStream,
- IN LIST_ENTRY * NameSpaceRefList
+ IN AML_NODE_HEADER *Node,
+ IN AML_STREAM *FStream,
+ IN LIST_ENTRY *NameSpaceRefList
);
#endif // AML_PARSER_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c index 7f78ed5..88eb850 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c @@ -36,19 +36,20 @@ UINT32
EFIAPI
AmlRdStreamGetRdSize (
- IN CONST AML_STREAM * FStream
+ IN CONST AML_STREAM *FStream
)
{
- CONST AML_RD_HEADER * CurrRdElement;
+ CONST AML_RD_HEADER *CurrRdElement;
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
- !IS_STREAM_FORWARD (FStream)) {
+ !IS_STREAM_FORWARD (FStream))
+ {
ASSERT (0);
return 0;
}
- CurrRdElement = (CONST AML_RD_HEADER*)AmlStreamGetCurrPos (FStream);
+ CurrRdElement = (CONST AML_RD_HEADER *)AmlStreamGetCurrPos (FStream);
if (CurrRdElement == NULL) {
ASSERT (0);
return 0;
@@ -57,7 +58,8 @@ AmlRdStreamGetRdSize ( // If the resource data element is of the large type, check for overflow.
if (AML_RD_IS_LARGE (CurrRdElement) &&
(AmlStreamGetFreeSpace (FStream) <
- sizeof (ACPI_LARGE_RESOURCE_HEADER))) {
+ sizeof (ACPI_LARGE_RESOURCE_HEADER)))
+ {
return 0;
}
@@ -86,15 +88,16 @@ STATIC BOOLEAN
EFIAPI
AmlRdCheckFunctionDescNesting (
- IN CONST AML_STREAM * FStream,
- IN OUT BOOLEAN * InFunctionDesc
+ IN CONST AML_STREAM *FStream,
+ IN OUT BOOLEAN *InFunctionDesc
)
{
- CONST AML_RD_HEADER * CurrRdElement;
+ CONST AML_RD_HEADER *CurrRdElement;
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
- (InFunctionDesc == NULL)) {
+ (InFunctionDesc == NULL))
+ {
ASSERT (0);
return FALSE;
}
@@ -110,7 +113,10 @@ AmlRdCheckFunctionDescNesting ( if (AmlRdCompareDescId (
CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID (
- ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME))) {
+ ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME
+ )
+ ))
+ {
*InFunctionDesc = TRUE;
return TRUE;
}
@@ -119,7 +125,10 @@ AmlRdCheckFunctionDescNesting ( if (AmlRdCompareDescId (
CurrRdElement,
AML_RD_BUILD_SMALL_DESC_ID (
- ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME))) {
+ ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME
+ )
+ ))
+ {
if (*InFunctionDesc) {
*InFunctionDesc = FALSE;
return TRUE;
@@ -155,19 +164,20 @@ AmlRdCheckFunctionDescNesting ( BOOLEAN
EFIAPI
AmlRdIsResourceDataBuffer (
- IN CONST AML_STREAM * FStream
+ IN CONST AML_STREAM *FStream
)
{
- EFI_STATUS Status;
- UINT32 FreeSpace;
- AML_STREAM SubStream;
- CONST AML_RD_HEADER * CurrRdElement;
- UINT32 CurrRdElementSize;
- BOOLEAN InFunctionDesc;
+ EFI_STATUS Status;
+ UINT32 FreeSpace;
+ AML_STREAM SubStream;
+ CONST AML_RD_HEADER *CurrRdElement;
+ UINT32 CurrRdElementSize;
+ BOOLEAN InFunctionDesc;
if (!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
- !IS_STREAM_FORWARD (FStream)) {
+ !IS_STREAM_FORWARD (FStream))
+ {
ASSERT (0);
return FALSE;
}
@@ -187,19 +197,22 @@ AmlRdIsResourceDataBuffer ( // The first element cannot be an end tag.
if (AmlRdCompareDescId (
- CurrRdElement,
- AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+ CurrRdElement,
+ AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+ ))
+ {
return FALSE;
}
InFunctionDesc = FALSE;
while (TRUE) {
- FreeSpace = AmlStreamGetFreeSpace (&SubStream);
- CurrRdElement = AmlStreamGetCurrPos (&SubStream);
+ FreeSpace = AmlStreamGetFreeSpace (&SubStream);
+ CurrRdElement = AmlStreamGetCurrPos (&SubStream);
CurrRdElementSize = AmlRdStreamGetRdSize (&SubStream);
if ((FreeSpace == 0) ||
(CurrRdElement == NULL) ||
- (CurrRdElementSize == 0)) {
+ (CurrRdElementSize == 0))
+ {
return FALSE;
}
@@ -218,7 +231,9 @@ AmlRdIsResourceDataBuffer ( // Thus the function should have already returned.
if (AmlRdCompareDescId (
CurrRdElement,
- AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+ AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+ ))
+ {
return FALSE;
}
@@ -252,21 +267,22 @@ AmlRdIsResourceDataBuffer ( EFI_STATUS
EFIAPI
AmlParseResourceData (
- IN AML_OBJECT_NODE * BufferNode,
- IN AML_STREAM * FStream
+ IN AML_OBJECT_NODE *BufferNode,
+ IN AML_STREAM *FStream
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * NewNode;
- UINT32 FreeSpace;
- CONST AML_RD_HEADER * CurrRdElement;
- UINT32 CurrRdElementSize;
+ EFI_STATUS Status;
+ AML_DATA_NODE *NewNode;
+ UINT32 FreeSpace;
+ CONST AML_RD_HEADER *CurrRdElement;
+ UINT32 CurrRdElementSize;
// Check that BufferNode is an ObjectNode and has a ByteList.
if (!AmlNodeHasAttribute (BufferNode, AML_HAS_BYTE_LIST) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
- !IS_STREAM_FORWARD (FStream)) {
+ !IS_STREAM_FORWARD (FStream))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -280,12 +296,12 @@ AmlParseResourceData ( break;
}
- CurrRdElement = (CONST AML_RD_HEADER*)AmlStreamGetCurrPos (FStream);
+ CurrRdElement = (CONST AML_RD_HEADER *)AmlStreamGetCurrPos (FStream);
CurrRdElementSize = AmlRdStreamGetRdSize (FStream);
Status = AmlCreateDataNode (
EAmlNodeDataTypeResourceData,
- (CONST UINT8*)CurrRdElement,
+ (CONST UINT8 *)CurrRdElement,
CurrRdElementSize,
&NewNode
);
@@ -295,12 +311,12 @@ AmlParseResourceData ( }
Status = AmlVarListAddTailInternal (
- (AML_NODE_HEADER*)BufferNode,
- (AML_NODE_HEADER*)NewNode
+ (AML_NODE_HEADER *)BufferNode,
+ (AML_NODE_HEADER *)NewNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
- AmlDeleteTree ((AML_NODE_HEADER*)NewNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)NewNode);
return Status;
}
@@ -315,11 +331,14 @@ AmlParseResourceData ( // Exit the loop when finding the resource data end tag.
if (AmlRdCompareDescId (
CurrRdElement,
- AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+ AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+ ))
+ {
if (FreeSpace != CurrRdElementSize) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
break;
}
} // while
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h index 13dfb35..434ad03 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h @@ -40,7 +40,7 @@ BOOLEAN
EFIAPI
AmlRdIsResourceDataBuffer (
- IN CONST AML_STREAM * FStream
+ IN CONST AML_STREAM *FStream
);
/** Parse a ResourceDataBuffer.
@@ -63,9 +63,8 @@ AmlRdIsResourceDataBuffer ( EFI_STATUS
EFIAPI
AmlParseResourceData (
- IN AML_OBJECT_NODE * BufferNode,
- IN AML_STREAM * FStream
+ IN AML_OBJECT_NODE *BufferNode,
+ IN AML_STREAM *FStream
);
#endif // AML_RESOURCE_DATA_PARSER_H_
-
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.c b/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.c index 41cf0bc..c19491e 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.c @@ -28,8 +28,8 @@ BOOLEAN
EFIAPI
AmlRdCompareDescId (
- IN CONST AML_RD_HEADER * Header,
- IN AML_RD_HEADER DescriptorId
+ IN CONST AML_RD_HEADER *Header,
+ IN AML_RD_HEADER DescriptorId
)
{
if (Header == NULL) {
@@ -56,7 +56,7 @@ AmlRdCompareDescId ( AML_RD_HEADER
EFIAPI
AmlRdGetDescId (
- IN CONST AML_RD_HEADER * Header
+ IN CONST AML_RD_HEADER *Header
)
{
if (Header == NULL) {
@@ -84,7 +84,7 @@ AmlRdGetDescId ( UINT32
EFIAPI
AmlRdGetSize (
- IN CONST AML_RD_HEADER * Header
+ IN CONST AML_RD_HEADER *Header
)
{
if (Header == NULL) {
@@ -93,13 +93,13 @@ AmlRdGetSize ( }
if (AML_RD_IS_LARGE (Header)) {
- return ((ACPI_LARGE_RESOURCE_HEADER*)Header)->Length +
- sizeof (ACPI_LARGE_RESOURCE_HEADER);
+ return ((ACPI_LARGE_RESOURCE_HEADER *)Header)->Length +
+ sizeof (ACPI_LARGE_RESOURCE_HEADER);
}
// Header is a small resource data element.
- return ((ACPI_SMALL_RESOURCE_HEADER*)Header)->Bits.Length +
- sizeof (ACPI_SMALL_RESOURCE_HEADER);
+ return ((ACPI_SMALL_RESOURCE_HEADER *)Header)->Bits.Length +
+ sizeof (ACPI_SMALL_RESOURCE_HEADER);
}
/** Set the Checksum of an EndTag resource data.
@@ -119,18 +119,20 @@ AmlRdGetSize ( EFI_STATUS
EFIAPI
AmlRdSetEndTagChecksum (
- IN CONST AML_RD_HEADER * Header,
- IN UINT8 CheckSum
+ IN CONST AML_RD_HEADER *Header,
+ IN UINT8 CheckSum
)
{
if ((Header == NULL) ||
!AmlRdCompareDescId (
- Header,
- AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+ Header,
+ AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+ ))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- ((EFI_ACPI_END_TAG_DESCRIPTOR*)Header)->Checksum = CheckSum;
+ ((EFI_ACPI_END_TAG_DESCRIPTOR *)Header)->Checksum = CheckSum;
return EFI_SUCCESS;
}
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.h b/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.h index e478107..3ef1447 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.h @@ -58,19 +58,19 @@ typedef UINT8 AML_RD_HEADER; @ingroup ResourceDataStructures
*/
-#define AML_RD_SMALL_SIZE_MASK (0x7U)
+#define AML_RD_SMALL_SIZE_MASK (0x7U)
/** Mask for the small resource data ID.
@ingroup ResourceDataStructures
*/
-#define AML_RD_SMALL_ID_MASK (0xFU << 3)
+#define AML_RD_SMALL_ID_MASK (0xFU << 3)
/** Mask for the large resource data ID.
@ingroup ResourceDataStructures
*/
-#define AML_RD_LARGE_ID_MASK (0x7FU)
+#define AML_RD_LARGE_ID_MASK (0x7FU)
/**
@defgroup ResourceDataApis Resource data APIs
@@ -133,8 +133,8 @@ typedef UINT8 AML_RD_HEADER; BOOLEAN
EFIAPI
AmlRdCompareDescId (
- IN CONST AML_RD_HEADER * Header,
- IN AML_RD_HEADER DescriptorId
+ IN CONST AML_RD_HEADER *Header,
+ IN AML_RD_HEADER DescriptorId
);
/** Get the descriptor Id of the resource data.
@@ -151,7 +151,7 @@ AmlRdCompareDescId ( AML_RD_HEADER
EFIAPI
AmlRdGetDescId (
- IN CONST AML_RD_HEADER * Header
+ IN CONST AML_RD_HEADER *Header
);
/** Get the size of a resource data element.
@@ -168,7 +168,7 @@ AmlRdGetDescId ( UINT32
EFIAPI
AmlRdGetSize (
- IN CONST AML_RD_HEADER * Header
+ IN CONST AML_RD_HEADER *Header
);
/** Set the Checksum of an EndTag resource data.
@@ -188,8 +188,8 @@ AmlRdGetSize ( EFI_STATUS
EFIAPI
AmlRdSetEndTagChecksum (
- IN CONST AML_RD_HEADER * Header,
- IN UINT8 CheckSum
+ IN CONST AML_RD_HEADER *Header,
+ IN UINT8 CheckSum
);
#endif // AML_RESOURCE_DATA_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Serialize/AmlSerialize.c b/DynamicTablesPkg/Library/Common/AmlLib/Serialize/AmlSerialize.c index da81ec2..0cb6bfc 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Serialize/AmlSerialize.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Serialize/AmlSerialize.c @@ -38,29 +38,30 @@ STATIC BOOLEAN
EFIAPI
AmlSerializeNodeCallback (
- IN AML_NODE_HEADER * Node,
- IN OUT VOID * Context OPTIONAL,
- IN OUT EFI_STATUS * Status OPTIONAL
+ IN AML_NODE_HEADER *Node,
+ IN OUT VOID *Context OPTIONAL,
+ IN OUT EFI_STATUS *Status OPTIONAL
)
{
- EFI_STATUS Status1;
+ EFI_STATUS Status1;
- CONST AML_DATA_NODE * DataNode;
- CONST AML_OBJECT_NODE * ObjectNode;
- AML_STREAM * FStream;
+ CONST AML_DATA_NODE *DataNode;
+ CONST AML_OBJECT_NODE *ObjectNode;
+ AML_STREAM *FStream;
// Bytes needed to store OpCode[1] + SubOpcode[1] + MaxPkgLen[4] = 6 bytes.
- UINT8 ObjectNodeInfoArray[6];
- UINT32 Index;
- BOOLEAN ContinueEnum;
+ UINT8 ObjectNodeInfoArray[6];
+ UINT32 Index;
+ BOOLEAN ContinueEnum;
- CONST AML_OBJECT_NODE * ParentNode;
- EAML_PARSE_INDEX IndexPtr;
+ CONST AML_OBJECT_NODE *ParentNode;
+ EAML_PARSE_INDEX IndexPtr;
if (!IS_AML_NODE_VALID (Node) ||
- (Context == NULL)) {
+ (Context == NULL))
+ {
ASSERT (0);
- Status1 = EFI_INVALID_PARAMETER;
+ Status1 = EFI_INVALID_PARAMETER;
ContinueEnum = FALSE;
goto error_handler;
}
@@ -68,44 +69,47 @@ AmlSerializeNodeCallback ( // Ignore the second fixed argument of method invocation nodes
// as the information stored there (the argument count) is not in the
// ACPI specification.
- ParentNode = (CONST AML_OBJECT_NODE*)AmlGetParent ((AML_NODE_HEADER*)Node);
+ ParentNode = (CONST AML_OBJECT_NODE *)AmlGetParent ((AML_NODE_HEADER *)Node);
if (IS_AML_OBJECT_NODE (ParentNode) &&
AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0) &&
- AmlIsNodeFixedArgument (Node, &IndexPtr)) {
+ AmlIsNodeFixedArgument (Node, &IndexPtr))
+ {
if (IndexPtr == EAmlParseIndexTerm1) {
if (Status != NULL) {
*Status = EFI_SUCCESS;
}
+
return TRUE;
}
}
- Status1 = EFI_SUCCESS;
+ Status1 = EFI_SUCCESS;
ContinueEnum = TRUE;
- FStream = (AML_STREAM*)Context;
+ FStream = (AML_STREAM *)Context;
if (IS_AML_DATA_NODE (Node)) {
// Copy the content of the Buffer for a DataNode.
- DataNode = (AML_DATA_NODE*)Node;
- Status1 = AmlStreamWrite (
- FStream,
- DataNode->Buffer,
- DataNode->Size
- );
+ DataNode = (AML_DATA_NODE *)Node;
+ Status1 = AmlStreamWrite (
+ FStream,
+ DataNode->Buffer,
+ DataNode->Size
+ );
if (EFI_ERROR (Status1)) {
ASSERT (0);
ContinueEnum = FALSE;
goto error_handler;
}
-
} else if (IS_AML_OBJECT_NODE (Node) &&
!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
- AML_IS_PSEUDO_OPCODE)) {
+ (CONST AML_OBJECT_NODE *)Node,
+ AML_IS_PSEUDO_OPCODE
+ ))
+ {
// Ignore pseudo-opcodes as they are not part of the
// ACPI specification.
- ObjectNode = (AML_OBJECT_NODE*)Node;
+ ObjectNode = (AML_OBJECT_NODE *)Node;
Index = 0;
// Copy the opcode(s).
@@ -138,6 +142,7 @@ error_handler: if (Status != NULL) {
*Status = Status1;
}
+
return ContinueEnum;
}
@@ -169,26 +174,27 @@ error_handler: EFI_STATUS
EFIAPI
AmlSerializeTree (
- IN AML_ROOT_NODE * RootNode,
- IN UINT8 * Buffer OPTIONAL,
- IN OUT UINT32 * BufferSize
+ IN AML_ROOT_NODE *RootNode,
+ IN UINT8 *Buffer OPTIONAL,
+ IN OUT UINT32 *BufferSize
)
{
- EFI_STATUS Status;
- AML_STREAM FStream;
- UINT32 TableSize;
+ EFI_STATUS Status;
+ AML_STREAM FStream;
+ UINT32 TableSize;
if (!IS_AML_ROOT_NODE (RootNode) ||
- (BufferSize == NULL)) {
+ (BufferSize == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Compute the total size of the AML blob.
Status = AmlComputeSize (
- (CONST AML_NODE_HEADER*)RootNode,
- &TableSize
- );
+ (CONST AML_NODE_HEADER *)RootNode,
+ &TableSize
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -226,7 +232,7 @@ AmlSerializeTree ( // Serialize the header.
Status = AmlStreamWrite (
&FStream,
- (UINT8*)RootNode->SdtHeader,
+ (UINT8 *)RootNode->SdtHeader,
sizeof (EFI_ACPI_DESCRIPTION_HEADER)
);
if (EFI_ERROR (Status)) {
@@ -236,9 +242,9 @@ AmlSerializeTree ( Status = EFI_SUCCESS;
AmlEnumTree (
- (AML_NODE_HEADER*)RootNode,
+ (AML_NODE_HEADER *)RootNode,
AmlSerializeNodeCallback,
- (VOID*)&FStream,
+ (VOID *)&FStream,
&Status
);
if (EFI_ERROR (Status)) {
@@ -247,7 +253,7 @@ AmlSerializeTree ( }
// Update the checksum.
- return AcpiPlatformChecksum ((EFI_ACPI_DESCRIPTION_HEADER*)Buffer);
+ return AcpiPlatformChecksum ((EFI_ACPI_DESCRIPTION_HEADER *)Buffer);
}
/** Serialize an AML definition block.
@@ -267,23 +273,24 @@ AmlSerializeTree ( EFI_STATUS
EFIAPI
AmlSerializeDefinitionBlock (
- IN AML_ROOT_NODE * RootNode,
- OUT EFI_ACPI_DESCRIPTION_HEADER ** Table
+ IN AML_ROOT_NODE *RootNode,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **Table
)
{
- EFI_STATUS Status;
- UINT8 * TableBuffer;
- UINT32 TableSize;
+ EFI_STATUS Status;
+ UINT8 *TableBuffer;
+ UINT32 TableSize;
if (!IS_AML_ROOT_NODE (RootNode) ||
- (Table == NULL)) {
+ (Table == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- *Table = NULL;
+ *Table = NULL;
TableBuffer = NULL;
- TableSize = 0;
+ TableSize = 0;
// Get the size of the SSDT table.
Status = AmlSerializeTree (
@@ -296,7 +303,7 @@ AmlSerializeDefinitionBlock ( return Status;
}
- TableBuffer = (UINT8*)AllocateZeroPool (TableSize);
+ TableBuffer = (UINT8 *)AllocateZeroPool (TableSize);
if (TableBuffer == NULL) {
DEBUG ((
DEBUG_ERROR,
@@ -317,7 +324,7 @@ AmlSerializeDefinitionBlock ( ASSERT (0);
} else {
// Save the allocated Table buffer in the table list
- *Table = (EFI_ACPI_DESCRIPTION_HEADER*)TableBuffer;
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER *)TableBuffer;
}
return Status;
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.c b/DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.c index 08ee959..6cd1c21 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.c @@ -23,25 +23,26 @@ EFI_STATUS
EFIAPI
AmlStreamInit (
- IN OUT AML_STREAM * Stream,
- IN UINT8 * Buffer,
- IN UINT32 MaxBufferSize,
- IN EAML_STREAM_DIRECTION Direction
+ IN OUT AML_STREAM *Stream,
+ IN UINT8 *Buffer,
+ IN UINT32 MaxBufferSize,
+ IN EAML_STREAM_DIRECTION Direction
)
{
if ((Stream == NULL) ||
(Buffer == NULL) ||
(MaxBufferSize == 0) ||
((Direction != EAmlStreamDirectionForward) &&
- (Direction != EAmlStreamDirectionBackward))) {
+ (Direction != EAmlStreamDirectionBackward)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- Stream->Buffer = Buffer;
+ Stream->Buffer = Buffer;
Stream->MaxBufferSize = MaxBufferSize;
- Stream->Index = 0;
- Stream->Direction = Direction;
+ Stream->Index = 0;
+ Stream->Direction = Direction;
return EFI_SUCCESS;
}
@@ -60,20 +61,21 @@ AmlStreamInit ( EFI_STATUS
EFIAPI
AmlStreamClone (
- IN CONST AML_STREAM * Stream,
- OUT AML_STREAM * ClonedStream
+ IN CONST AML_STREAM *Stream,
+ OUT AML_STREAM *ClonedStream
)
{
if (!IS_STREAM (Stream) ||
- (ClonedStream == NULL)) {
+ (ClonedStream == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- ClonedStream->Buffer = Stream->Buffer;
+ ClonedStream->Buffer = Stream->Buffer;
ClonedStream->MaxBufferSize = Stream->MaxBufferSize;
- ClonedStream->Index = Stream->Index;
- ClonedStream->Direction = Stream->Direction;
+ ClonedStream->Index = Stream->Index;
+ ClonedStream->Direction = Stream->Direction;
return EFI_SUCCESS;
}
@@ -105,12 +107,13 @@ AmlStreamClone ( EFI_STATUS
EFIAPI
AmlStreamInitSubStream (
- IN CONST AML_STREAM * Stream,
- OUT AML_STREAM * SubStream
+ IN CONST AML_STREAM *Stream,
+ OUT AML_STREAM *SubStream
)
{
if (!IS_STREAM (Stream) ||
- (SubStream == NULL)) {
+ (SubStream == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -125,8 +128,8 @@ AmlStreamInitSubStream ( }
SubStream->MaxBufferSize = AmlStreamGetFreeSpace (Stream);
- SubStream->Index = 0;
- SubStream->Direction = Stream->Direction;
+ SubStream->Index = 0;
+ SubStream->Direction = Stream->Direction;
return EFI_SUCCESS;
}
@@ -141,13 +144,14 @@ AmlStreamInitSubStream ( UINT8 *
EFIAPI
AmlStreamGetBuffer (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
)
{
if (!IS_STREAM (Stream)) {
ASSERT (0);
return NULL;
}
+
return Stream->Buffer;
}
@@ -161,13 +165,14 @@ AmlStreamGetBuffer ( UINT32
EFIAPI
AmlStreamGetMaxBufferSize (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
)
{
if (!IS_STREAM (Stream)) {
ASSERT (0);
return 0;
}
+
return Stream->MaxBufferSize;
}
@@ -183,13 +188,14 @@ AmlStreamGetMaxBufferSize ( EFI_STATUS
EFIAPI
AmlStreamReduceMaxBufferSize (
- IN AML_STREAM * Stream,
- IN UINT32 Diff
+ IN AML_STREAM *Stream,
+ IN UINT32 Diff
)
{
if (!IS_STREAM (Stream) ||
(Diff == 0) ||
- ((Stream->MaxBufferSize - Diff) <= Stream->Index)) {
+ ((Stream->MaxBufferSize - Diff) <= Stream->Index))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -214,13 +220,14 @@ AmlStreamReduceMaxBufferSize ( UINT32
EFIAPI
AmlStreamGetIndex (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
)
{
if (!IS_STREAM (Stream)) {
ASSERT (0);
return 0;
}
+
return Stream->Index;
}
@@ -234,13 +241,14 @@ AmlStreamGetIndex ( EAML_STREAM_DIRECTION
EFIAPI
AmlStreamGetDirection (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
)
{
if (!IS_STREAM (Stream)) {
ASSERT (0);
return EAmlStreamDirectionInvalid;
}
+
return Stream->Direction;
}
@@ -254,7 +262,7 @@ AmlStreamGetDirection ( UINT8 *
EFIAPI
AmlStreamGetCurrPos (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
)
{
if (!IS_STREAM (Stream)) {
@@ -282,7 +290,7 @@ AmlStreamGetCurrPos ( UINT32
EFIAPI
AmlStreamGetFreeSpace (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
)
{
if (!IS_STREAM (Stream)) {
@@ -314,13 +322,14 @@ AmlStreamGetFreeSpace ( EFI_STATUS
EFIAPI
AmlStreamProgress (
- IN AML_STREAM * Stream,
- IN UINT32 Offset
+ IN AML_STREAM *Stream,
+ IN UINT32 Offset
)
{
if (!IS_STREAM (Stream) ||
- IS_END_OF_STREAM (Stream) ||
- (Offset == 0)) {
+ IS_END_OF_STREAM (Stream) ||
+ (Offset == 0))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -350,12 +359,13 @@ AmlStreamProgress ( EFI_STATUS
EFIAPI
AmlStreamRewind (
- IN AML_STREAM * Stream,
- IN UINT32 Offset
+ IN AML_STREAM *Stream,
+ IN UINT32 Offset
)
{
if (!IS_STREAM (Stream) ||
- (Offset == 0)) {
+ (Offset == 0))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -380,7 +390,7 @@ AmlStreamRewind ( EFI_STATUS
EFIAPI
AmlStreamReset (
- IN AML_STREAM * Stream
+ IN AML_STREAM *Stream
)
{
if (!IS_STREAM (Stream)) {
@@ -409,15 +419,16 @@ AmlStreamReset ( EFI_STATUS
EFIAPI
AmlStreamPeekByte (
- IN AML_STREAM * Stream,
- OUT UINT8 * OutByte
+ IN AML_STREAM *Stream,
+ OUT UINT8 *OutByte
)
{
- UINT8 * CurPos;
+ UINT8 *CurPos;
if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) ||
- (OutByte == NULL)) {
+ (OutByte == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -448,15 +459,16 @@ AmlStreamPeekByte ( EFI_STATUS
EFIAPI
AmlStreamReadByte (
- IN AML_STREAM * Stream,
- OUT UINT8 * OutByte
+ IN AML_STREAM *Stream,
+ OUT UINT8 *OutByte
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) ||
- (OutByte == NULL)) {
+ (OutByte == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -498,17 +510,18 @@ AmlStreamReadByte ( EFI_STATUS
EFIAPI
AmlStreamWrite (
- IN AML_STREAM * Stream,
- IN CONST UINT8 * Buffer,
- IN UINT32 Size
+ IN AML_STREAM *Stream,
+ IN CONST UINT8 *Buffer,
+ IN UINT32 Size
)
{
- UINT8 * CurrPos;
+ UINT8 *CurrPos;
if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) ||
(Buffer == NULL) ||
- (Size == 0)) {
+ (Size == 0))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -554,21 +567,22 @@ AmlStreamWrite ( BOOLEAN
EFIAPI
AmlStreamCmp (
- IN CONST AML_STREAM * Stream1,
- IN CONST AML_STREAM * Stream2,
- IN UINT32 Size
+ IN CONST AML_STREAM *Stream1,
+ IN CONST AML_STREAM *Stream2,
+ IN UINT32 Size
)
{
- UINT32 MinSize;
- UINT8 * CurrPosStream1;
- UINT8 * CurrPosStream2;
+ UINT32 MinSize;
+ UINT8 *CurrPosStream1;
+ UINT8 *CurrPosStream2;
if (!IS_STREAM (Stream1) ||
IS_END_OF_STREAM (Stream1) ||
!IS_STREAM (Stream2) ||
IS_END_OF_STREAM (Stream2) ||
(Stream1->Direction != Stream2->Direction) ||
- (Size == 0)) {
+ (Size == 0))
+ {
ASSERT (0);
return FALSE;
}
@@ -589,6 +603,7 @@ AmlStreamCmp ( ASSERT (0);
return FALSE;
}
+
CurrPosStream2 = AmlStreamGetCurrPos (Stream2);
if (CurrPosStream2 == NULL) {
ASSERT (0);
@@ -606,10 +621,10 @@ AmlStreamCmp ( // ^
// CurrPos
return (0 == CompareMem (
- CurrPosStream1 - (MinSize - 1),
- CurrPosStream2 - (MinSize - 1),
- MinSize
- ));
+ CurrPosStream1 - (MinSize - 1),
+ CurrPosStream2 - (MinSize - 1),
+ MinSize
+ ));
}
/** Copy Size bytes of the stream's data to DstBuffer.
@@ -633,19 +648,20 @@ AmlStreamCmp ( EFI_STATUS
EFIAPI
AmlStreamCpyS (
- OUT CHAR8 * DstBuffer,
- IN UINT32 MaxDstBufferSize,
- IN AML_STREAM * Stream,
- IN UINT32 Size
+ OUT CHAR8 *DstBuffer,
+ IN UINT32 MaxDstBufferSize,
+ IN AML_STREAM *Stream,
+ IN UINT32 Size
)
{
- CHAR8 * StreamBufferStart;
+ CHAR8 *StreamBufferStart;
// Stream is checked in the function call.
if ((DstBuffer == NULL) ||
(MaxDstBufferSize == 0) ||
(Size > MaxDstBufferSize) ||
- (Size > AmlStreamGetMaxBufferSize (Stream))) {
+ (Size > AmlStreamGetMaxBufferSize (Stream)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -655,9 +671,9 @@ AmlStreamCpyS ( }
// Find the address at which the data is starting.
- StreamBufferStart = (CHAR8*)(IS_STREAM_FORWARD (Stream) ?
- Stream->Buffer :
- AmlStreamGetCurrPos (Stream));
+ StreamBufferStart = (CHAR8 *)(IS_STREAM_FORWARD (Stream) ?
+ Stream->Buffer :
+ AmlStreamGetCurrPos (Stream));
CopyMem (DstBuffer, StreamBufferStart, Size);
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.h b/DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.h index cd2da89..35d7c87 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.h @@ -31,17 +31,17 @@ typedef enum EAmlStreamDirection { */
typedef struct AmlStream {
/// Pointer to a buffer.
- UINT8 * Buffer;
+ UINT8 *Buffer;
/// Size of Buffer.
- UINT32 MaxBufferSize;
+ UINT32 MaxBufferSize;
/// Index in the Buffer.
/// The Index field allows to keep track of how many bytes have been
/// read/written in the Buffer, and to retrieve the current stream position.
/// 0 <= Index <= MaxBufferSize.
/// If Index == MaxBufferSize, no more action is allowed on the stream.
- UINT32 Index;
+ UINT32 Index;
/// The direction the stream is progressing.
/// If the stream goes backward (toward lower addresses), the bytes written
@@ -56,7 +56,7 @@ typedef struct AmlStream { /// +---------------+-----+-----+-----+-----+-----+-----+---- +------+
/// ^
/// Current position.
- EAML_STREAM_DIRECTION Direction;
+ EAML_STREAM_DIRECTION Direction;
} AML_STREAM;
/** Check whether a StreamPtr is a valid Stream.
@@ -88,7 +88,7 @@ typedef struct AmlStream { @retval TRUE Stream goes forward.
@retval FALSE Otherwise.
*/
-#define IS_STREAM_FORWARD(Stream) ( \
+#define IS_STREAM_FORWARD(Stream) ( \
((AML_STREAM*)Stream)->Direction == EAmlStreamDirectionForward)
/** Check Stream goes backward.
@@ -98,7 +98,7 @@ typedef struct AmlStream { @retval TRUE Stream goes backward.
@retval FALSE Otherwise.
*/
-#define IS_STREAM_BACKWARD(Stream) ( \
+#define IS_STREAM_BACKWARD(Stream) ( \
((AML_STREAM*)Stream)->Direction == EAmlStreamDirectionBackward)
/** Initialize a stream.
@@ -116,10 +116,10 @@ typedef struct AmlStream { EFI_STATUS
EFIAPI
AmlStreamInit (
- IN OUT AML_STREAM * Stream,
- IN UINT8 * Buffer,
- IN UINT32 MaxBufferSize,
- IN EAML_STREAM_DIRECTION Direction
+ IN OUT AML_STREAM *Stream,
+ IN UINT8 *Buffer,
+ IN UINT32 MaxBufferSize,
+ IN EAML_STREAM_DIRECTION Direction
);
/** Clone a stream.
@@ -136,8 +136,8 @@ AmlStreamInit ( EFI_STATUS
EFIAPI
AmlStreamClone (
- IN CONST AML_STREAM * Stream,
- OUT AML_STREAM * ClonedStream
+ IN CONST AML_STREAM *Stream,
+ OUT AML_STREAM *ClonedStream
);
/** Initialize a sub-stream from a stream.
@@ -167,8 +167,8 @@ AmlStreamClone ( EFI_STATUS
EFIAPI
AmlStreamInitSubStream (
- IN CONST AML_STREAM * Stream,
- OUT AML_STREAM * SubStream
+ IN CONST AML_STREAM *Stream,
+ OUT AML_STREAM *SubStream
);
/** Get the buffer of a stream.
@@ -181,7 +181,7 @@ AmlStreamInitSubStream ( UINT8 *
EFIAPI
AmlStreamGetBuffer (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
);
/** Get the size of Stream's Buffer.
@@ -194,7 +194,7 @@ AmlStreamGetBuffer ( UINT32
EFIAPI
AmlStreamGetMaxBufferSize (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
);
/** Reduce the maximal size of Stream's Buffer (MaxBufferSize field).
@@ -209,8 +209,8 @@ AmlStreamGetMaxBufferSize ( EFI_STATUS
EFIAPI
AmlStreamReduceMaxBufferSize (
- IN AML_STREAM * Stream,
- IN UINT32 Diff
+ IN AML_STREAM *Stream,
+ IN UINT32 Diff
);
/** Get Stream's Index.
@@ -229,7 +229,7 @@ AmlStreamReduceMaxBufferSize ( UINT32
EFIAPI
AmlStreamGetIndex (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
);
/** Get Stream's Direction.
@@ -242,7 +242,7 @@ AmlStreamGetIndex ( EAML_STREAM_DIRECTION
EFIAPI
AmlStreamGetDirection (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
);
/** Return a pointer to the current position in the stream.
@@ -255,7 +255,7 @@ AmlStreamGetDirection ( UINT8 *
EFIAPI
AmlStreamGetCurrPos (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
);
/** Get the space available in the stream.
@@ -268,7 +268,7 @@ AmlStreamGetCurrPos ( UINT32
EFIAPI
AmlStreamGetFreeSpace (
- IN CONST AML_STREAM * Stream
+ IN CONST AML_STREAM *Stream
);
/** Move Stream by Offset bytes.
@@ -287,8 +287,8 @@ AmlStreamGetFreeSpace ( EFI_STATUS
EFIAPI
AmlStreamProgress (
- IN AML_STREAM * Stream,
- IN UINT32 Offset
+ IN AML_STREAM *Stream,
+ IN UINT32 Offset
);
/** Rewind Stream of Offset bytes.
@@ -306,8 +306,8 @@ AmlStreamProgress ( EFI_STATUS
EFIAPI
AmlStreamRewind (
- IN AML_STREAM * Stream,
- IN UINT32 Offset
+ IN AML_STREAM *Stream,
+ IN UINT32 Offset
);
/** Reset the Stream (move the current position to the initial position).
@@ -320,7 +320,7 @@ AmlStreamRewind ( EFI_STATUS
EFIAPI
AmlStreamReset (
- IN AML_STREAM * Stream
+ IN AML_STREAM *Stream
);
/** Peek one byte at Stream's current position.
@@ -339,8 +339,8 @@ AmlStreamReset ( EFI_STATUS
EFIAPI
AmlStreamPeekByte (
- IN AML_STREAM * Stream,
- OUT UINT8 * OutByte
+ IN AML_STREAM *Stream,
+ OUT UINT8 *OutByte
);
/** Read one byte at Stream's current position.
@@ -359,8 +359,8 @@ AmlStreamPeekByte ( EFI_STATUS
EFIAPI
AmlStreamReadByte (
- IN AML_STREAM * Stream,
- OUT UINT8 * OutByte
+ IN AML_STREAM *Stream,
+ OUT UINT8 *OutByte
);
/** Write Size bytes in the stream.
@@ -388,9 +388,9 @@ AmlStreamReadByte ( EFI_STATUS
EFIAPI
AmlStreamWrite (
- IN AML_STREAM * Stream,
- IN CONST UINT8 * Buffer,
- IN UINT32 Size
+ IN AML_STREAM *Stream,
+ IN CONST UINT8 *Buffer,
+ IN UINT32 Size
);
/** Compare Size bytes between Stream1 and Stream2 from their
@@ -416,9 +416,9 @@ AmlStreamWrite ( BOOLEAN
EFIAPI
AmlStreamCmp (
- IN CONST AML_STREAM * Stream1,
- IN CONST AML_STREAM * Stream2,
- IN UINT32 Size
+ IN CONST AML_STREAM *Stream1,
+ IN CONST AML_STREAM *Stream2,
+ IN UINT32 Size
);
/** Copy Size bytes of the stream's data to DstBuffer.
@@ -442,10 +442,10 @@ AmlStreamCmp ( EFI_STATUS
EFIAPI
AmlStreamCpyS (
- OUT CHAR8 * DstBuffer,
- IN UINT32 MaxDstBufferSize,
- IN AML_STREAM * Stream,
- IN UINT32 Size
+ OUT CHAR8 *DstBuffer,
+ IN UINT32 MaxDstBufferSize,
+ IN AML_STREAM *Stream,
+ IN UINT32 Size
);
#endif // AML_STREAM_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.c b/DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.c index e9d36f4..3f5889d 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.c @@ -30,18 +30,20 @@ BOOLEAN
EFIAPI
AmlIsNameString (
- IN UINT32 Root,
- IN UINT32 ParentPrefix,
- IN UINT32 SegCount
+ IN UINT32 Root,
+ IN UINT32 ParentPrefix,
+ IN UINT32 SegCount
)
{
if (((Root == 0) || (Root == 1)) &&
(ParentPrefix <= MAX_UINT8) &&
(!((ParentPrefix != 0) && (Root != 0))) &&
(SegCount <= MAX_UINT8) &&
- ((SegCount + Root + ParentPrefix) != 0)) {
+ ((SegCount + Root + ParentPrefix) != 0))
+ {
return TRUE;
}
+
return FALSE;
}
@@ -61,16 +63,17 @@ AmlIsNameString ( EFI_STATUS
EFIAPI
AmlUpperCaseMemCpyS (
- OUT CHAR8 * DstBuffer,
- IN UINT32 MaxDstBufferSize,
- IN CONST CHAR8 * SrcBuffer,
- IN UINT32 Count
+ OUT CHAR8 *DstBuffer,
+ IN UINT32 MaxDstBufferSize,
+ IN CONST CHAR8 *SrcBuffer,
+ IN UINT32 Count
)
{
- UINT32 Index;
+ UINT32 Index;
if ((DstBuffer == NULL) ||
- (SrcBuffer == NULL)) {
+ (SrcBuffer == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -107,7 +110,7 @@ AmlUpperCaseMemCpyS ( BOOLEAN
EFIAPI
AmlIsRootPath (
- IN CONST CHAR8 * Buffer
+ IN CONST CHAR8 *Buffer
)
{
if (Buffer == NULL) {
@@ -139,10 +142,10 @@ AmlIsRootPath ( BOOLEAN
EFIAPI
AmlIsLeadNameChar (
- IN CHAR8 Ch
+ IN CHAR8 Ch
)
{
- if ((Ch == '_') || (Ch >= 'A' && Ch <= 'Z') || (Ch >= 'a' && Ch <= 'z')) {
+ if ((Ch == '_') || ((Ch >= 'A') && (Ch <= 'Z')) || ((Ch >= 'a') && (Ch <= 'z'))) {
return TRUE;
} else {
return FALSE;
@@ -174,7 +177,7 @@ AmlIsNameChar ( IN CHAR8 Ch
)
{
- if (AmlIsLeadNameChar (Ch) || (Ch >= '0' && Ch <= '9')) {
+ if (AmlIsLeadNameChar (Ch) || ((Ch >= '0') && (Ch <= '9'))) {
return TRUE;
} else {
return FALSE;
@@ -195,14 +198,15 @@ AmlIsNameChar ( BOOLEAN
EFIAPI
AslIsNameSeg (
- IN CONST CHAR8 * AslBuffer,
- OUT UINT32 * Size
+ IN CONST CHAR8 *AslBuffer,
+ OUT UINT32 *Size
)
{
- UINT32 Index;
+ UINT32 Index;
if ((AslBuffer == NULL) ||
- (Size == NULL)) {
+ (Size == NULL))
+ {
return FALSE;
}
@@ -212,7 +216,8 @@ AslIsNameSeg ( for (Index = 1; Index < AML_NAME_SEG_SIZE; Index++) {
if ((AslBuffer[Index] == '.') ||
- (AslBuffer[Index] == '\0')) {
+ (AslBuffer[Index] == '\0'))
+ {
*Size = Index;
return TRUE;
} else if (!AmlIsNameChar (AslBuffer[Index])) {
@@ -237,10 +242,10 @@ AslIsNameSeg ( BOOLEAN
EFIAPI
AmlIsNameSeg (
- IN CONST CHAR8 * AmlBuffer
+ IN CONST CHAR8 *AmlBuffer
)
{
- UINT32 Index;
+ UINT32 Index;
if (AmlBuffer == NULL) {
return FALSE;
@@ -279,25 +284,26 @@ AmlIsNameSeg ( EFI_STATUS
EFIAPI
AslParseNameStringInfo (
- IN CONST CHAR8 * Buffer,
- OUT UINT32 * Root,
- OUT UINT32 * ParentPrefix,
- OUT UINT32 * SegCount
+ IN CONST CHAR8 *Buffer,
+ OUT UINT32 *Root,
+ OUT UINT32 *ParentPrefix,
+ OUT UINT32 *SegCount
)
{
- UINT32 NameSegSize;
+ UINT32 NameSegSize;
if ((Buffer == NULL) ||
(Root == NULL) ||
(ParentPrefix == NULL) ||
- (SegCount == NULL)) {
+ (SegCount == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- *Root = 0;
+ *Root = 0;
*ParentPrefix = 0;
- *SegCount = 0;
+ *SegCount = 0;
// Handle Root and ParentPrefix(s).
if (*Buffer == AML_ROOT_CHAR) {
@@ -363,23 +369,24 @@ AslParseNameStringInfo ( EFI_STATUS
EFIAPI
AmlParseNameStringInfo (
- IN CONST CHAR8 * Buffer,
- OUT UINT32 * Root,
- OUT UINT32 * ParentPrefix,
- OUT UINT32 * SegCount
+ IN CONST CHAR8 *Buffer,
+ OUT UINT32 *Root,
+ OUT UINT32 *ParentPrefix,
+ OUT UINT32 *SegCount
)
{
if ((Buffer == NULL) ||
(Root == NULL) ||
(ParentPrefix == NULL) ||
- (SegCount == NULL)) {
+ (SegCount == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- *Root = 0;
+ *Root = 0;
*ParentPrefix = 0;
- *SegCount = 0;
+ *SegCount = 0;
// Handle Root and ParentPrefix(s).
if (*Buffer == AML_ROOT_CHAR) {
@@ -396,7 +403,7 @@ AmlParseNameStringInfo ( if (*Buffer == AML_DUAL_NAME_PREFIX) {
*SegCount = 2;
} else if (*Buffer == AML_MULTI_NAME_PREFIX) {
- *SegCount = *((UINT8*)(Buffer + 1));
+ *SegCount = *((UINT8 *)(Buffer + 1));
} else if (AmlIsNameSeg (Buffer)) {
*SegCount = 1;
} else if (*Buffer == AML_ZERO_OP) {
@@ -430,12 +437,12 @@ AmlParseNameStringInfo ( UINT32
EFIAPI
AslComputeNameStringSize (
- IN UINT32 Root,
- IN UINT32 ParentPrefix,
- IN UINT32 SegCount
+ IN UINT32 Root,
+ IN UINT32 ParentPrefix,
+ IN UINT32 SegCount
)
{
- UINT32 TotalSize;
+ UINT32 TotalSize;
if (!AmlIsNameString (Root, ParentPrefix, SegCount)) {
ASSERT (0);
@@ -472,12 +479,12 @@ AslComputeNameStringSize ( UINT32
EFIAPI
AmlComputeNameStringSize (
- IN UINT32 Root,
- IN UINT32 ParentPrefix,
- IN UINT32 SegCount
+ IN UINT32 Root,
+ IN UINT32 ParentPrefix,
+ IN UINT32 SegCount
)
{
- UINT32 TotalSize;
+ UINT32 TotalSize;
if (!AmlIsNameString (Root, ParentPrefix, SegCount)) {
ASSERT (0);
@@ -507,12 +514,13 @@ AmlComputeNameStringSize ( EFI_STATUS
EFIAPI
AslGetNameStringSize (
- IN CONST CHAR8 * AslPath,
- OUT UINT32 * AslPathSizePtr
+ IN CONST CHAR8 *AslPath,
+ OUT UINT32 *AslPathSizePtr
)
{
if ((AslPath == NULL) ||
- (AslPathSizePtr == NULL)) {
+ (AslPathSizePtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -537,18 +545,19 @@ AslGetNameStringSize ( EFI_STATUS
EFIAPI
AmlGetNameStringSize (
- IN CONST CHAR8 * AmlPath,
- OUT UINT32 * AmlPathSizePtr
+ IN CONST CHAR8 *AmlPath,
+ OUT UINT32 *AmlPathSizePtr
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
if ((AmlPath == NULL) ||
- (AmlPathSizePtr == NULL)) {
+ (AmlPathSizePtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -587,24 +596,25 @@ AmlGetNameStringSize ( EFI_STATUS
EFIAPI
ConvertAslNameToAmlName (
- IN CONST CHAR8 * AslPath,
- OUT CHAR8 ** OutAmlPath
+ IN CONST CHAR8 *AslPath,
+ OUT CHAR8 **OutAmlPath
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
- UINT32 TotalSize;
- UINT32 NameSegSize;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
+ UINT32 TotalSize;
+ UINT32 NameSegSize;
- CONST CHAR8 * AslBuffer;
- CHAR8 * AmlBuffer;
- CHAR8 * AmlPath;
+ CONST CHAR8 *AslBuffer;
+ CHAR8 *AmlBuffer;
+ CHAR8 *AmlPath;
if ((AslPath == NULL) ||
- (OutAmlPath == NULL)) {
+ (OutAmlPath == NULL))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -709,7 +719,6 @@ ConvertAslNameToAmlName ( }
}
} // while
-
} else {
// (SegCount == 0)
// '\0' needs to end the AML NameString/path.
@@ -721,10 +730,11 @@ ConvertAslNameToAmlName ( // Check that AmlPath has been filled with TotalSize bytes.
if ((SegCount != 0) ||
(*AslBuffer != AML_ZERO_OP) ||
- (((UINT32)(AmlBuffer - AmlPath)) != TotalSize)) {
- ASSERT (0);
- Status = EFI_INVALID_PARAMETER;
- goto error_handler;
+ (((UINT32)(AmlBuffer - AmlPath)) != TotalSize))
+ {
+ ASSERT (0);
+ Status = EFI_INVALID_PARAMETER;
+ goto error_handler;
}
*OutAmlPath = AmlPath;
@@ -749,23 +759,24 @@ error_handler: EFI_STATUS
EFIAPI
ConvertAmlNameToAslName (
- IN CONST CHAR8 * AmlPath,
- OUT CHAR8 ** OutAslPath
+ IN CONST CHAR8 *AmlPath,
+ OUT CHAR8 **OutAslPath
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT32 Root;
- UINT32 ParentPrefix;
- UINT32 SegCount;
- UINT32 TotalSize;
+ UINT32 Root;
+ UINT32 ParentPrefix;
+ UINT32 SegCount;
+ UINT32 TotalSize;
- CONST CHAR8 * AmlBuffer;
- CHAR8 * AslBuffer;
- CHAR8 * AslPath;
+ CONST CHAR8 *AmlBuffer;
+ CHAR8 *AslBuffer;
+ CHAR8 *AslPath;
if ((AmlPath == NULL) ||
- (OutAslPath == NULL)) {
+ (OutAslPath == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -860,16 +871,17 @@ error_handler: BOOLEAN
EFIAPI
AslCompareNameString (
- IN CONST CHAR8 * AslName1,
- IN CONST CHAR8 * AslName2
+ IN CONST CHAR8 *AslName1,
+ IN CONST CHAR8 *AslName2
)
{
- EFI_STATUS Status;
- UINT32 AslName1Len;
- UINT32 AslName2Len;
+ EFI_STATUS Status;
+ UINT32 AslName1Len;
+ UINT32 AslName2Len;
if ((AslName1 == NULL) ||
- (AslName2 == NULL)) {
+ (AslName2 == NULL))
+ {
ASSERT (0);
return FALSE;
}
@@ -905,16 +917,17 @@ AslCompareNameString ( BOOLEAN
EFIAPI
AmlCompareNameString (
- IN CONST CHAR8 * AmlName1,
- IN CONST CHAR8 * AmlName2
+ IN CONST CHAR8 *AmlName1,
+ IN CONST CHAR8 *AmlName2
)
{
- EFI_STATUS Status;
- UINT32 AmlName1Len;
- UINT32 AmlName2Len;
+ EFI_STATUS Status;
+ UINT32 AmlName1Len;
+ UINT32 AmlName2Len;
if ((AmlName1 == NULL) ||
- (AmlName2 == NULL)) {
+ (AmlName2 == NULL))
+ {
ASSERT (0);
return FALSE;
}
@@ -956,17 +969,18 @@ AmlCompareNameString ( BOOLEAN
EFIAPI
CompareAmlWithAslNameString (
- IN CONST CHAR8 * AmlName1,
- IN CONST CHAR8 * AslName2
+ IN CONST CHAR8 *AmlName1,
+ IN CONST CHAR8 *AslName2
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- CHAR8 * AmlName2;
- BOOLEAN RetVal;
+ CHAR8 *AmlName2;
+ BOOLEAN RetVal;
if ((AmlName1 == NULL) ||
- (AslName2 == NULL)) {
+ (AslName2 == NULL))
+ {
ASSERT (0);
return FALSE;
}
@@ -986,6 +1000,7 @@ CompareAmlWithAslNameString ( return RetVal;
}
+
/** Given an AmlPath, return the address of the first NameSeg.
It is possible to determine the size of an AML NameString/path just
@@ -1004,9 +1019,9 @@ CONST CHAR8 *
EFIAPI
AmlGetFirstNameSeg (
- IN CONST CHAR8 * AmlPath,
- IN UINT32 Root,
- IN UINT32 ParentPrefix
+ IN CONST CHAR8 *AmlPath,
+ IN UINT32 Root,
+ IN UINT32 ParentPrefix
)
{
if (AmlPath == NULL) {
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.h b/DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.h index 86d9df5..598d6ba 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.h @@ -42,9 +42,9 @@ BOOLEAN
EFIAPI
AmlIsNameString (
- IN UINT32 Root,
- IN UINT32 ParentPrefix,
- IN UINT32 SegCount
+ IN UINT32 Root,
+ IN UINT32 ParentPrefix,
+ IN UINT32 SegCount
);
/** Copy bytes from SrcBuffer to DstBuffer and convert to upper case.
@@ -63,10 +63,10 @@ AmlIsNameString ( EFI_STATUS
EFIAPI
AmlUpperCaseMemCpyS (
- OUT CHAR8 * DstBuffer,
- IN UINT32 MaxDstBufferSize,
- IN CONST CHAR8 * SrcBuffer,
- IN UINT32 Count
+ OUT CHAR8 *DstBuffer,
+ IN UINT32 MaxDstBufferSize,
+ IN CONST CHAR8 *SrcBuffer,
+ IN UINT32 Count
);
/** Check whether Buffer is a root path ('\').
@@ -82,7 +82,7 @@ AmlUpperCaseMemCpyS ( BOOLEAN
EFIAPI
AmlIsRootPath (
- IN CONST CHAR8 * Buffer
+ IN CONST CHAR8 *Buffer
);
/** Check whether Ch is an ASL/AML LeadName.
@@ -103,7 +103,7 @@ AmlIsRootPath ( BOOLEAN
EFIAPI
AmlIsLeadNameChar (
- IN CHAR8 Ch
+ IN CHAR8 Ch
);
/** Check whether Ch is an ASL/AML NameChar.
@@ -145,8 +145,8 @@ AmlIsNameChar ( BOOLEAN
EFIAPI
AslIsNameSeg (
- IN CONST CHAR8 * AslBuffer,
- OUT UINT32 * Size
+ IN CONST CHAR8 *AslBuffer,
+ OUT UINT32 *Size
);
/** Check whether AmlBuffer is an AML NameSeg.
@@ -162,7 +162,7 @@ AslIsNameSeg ( BOOLEAN
EFIAPI
AmlIsNameSeg (
- IN CONST CHAR8 * AmlBuffer
+ IN CONST CHAR8 *AmlBuffer
);
/** Parse an ASL NameString/path.
@@ -185,10 +185,10 @@ AmlIsNameSeg ( EFI_STATUS
EFIAPI
AslParseNameStringInfo (
- IN CONST CHAR8 * Buffer,
- OUT UINT32 * Root,
- OUT UINT32 * ParentPrefix,
- OUT UINT32 * SegCount
+ IN CONST CHAR8 *Buffer,
+ OUT UINT32 *Root,
+ OUT UINT32 *ParentPrefix,
+ OUT UINT32 *SegCount
);
/** Parse an AML NameString/path.
@@ -212,10 +212,10 @@ AslParseNameStringInfo ( EFI_STATUS
EFIAPI
AmlParseNameStringInfo (
- IN CONST CHAR8 * Buffer,
- OUT UINT32 * Root,
- OUT UINT32 * ParentPrefix,
- OUT UINT32 * SegCount
+ IN CONST CHAR8 *Buffer,
+ OUT UINT32 *Root,
+ OUT UINT32 *ParentPrefix,
+ OUT UINT32 *SegCount
);
/** Compute the ASL NameString/path size from NameString
@@ -233,9 +233,9 @@ AmlParseNameStringInfo ( UINT32
EFIAPI
AslComputeNameStringSize (
- IN UINT32 Root,
- IN UINT32 ParentPrefix,
- IN UINT32 SegCount
+ IN UINT32 Root,
+ IN UINT32 ParentPrefix,
+ IN UINT32 SegCount
);
/** Compute the AML NameString/path size from NameString
@@ -253,9 +253,9 @@ AslComputeNameStringSize ( UINT32
EFIAPI
AmlComputeNameStringSize (
- IN UINT32 Root,
- IN UINT32 ParentPrefix,
- IN UINT32 SegCount
+ IN UINT32 Root,
+ IN UINT32 ParentPrefix,
+ IN UINT32 SegCount
);
/** Get the ASL NameString/path size.
@@ -269,8 +269,8 @@ AmlComputeNameStringSize ( EFI_STATUS
EFIAPI
AslGetNameStringSize (
- IN CONST CHAR8 * AslPath,
- OUT UINT32 * AslPathSizePtr
+ IN CONST CHAR8 *AslPath,
+ OUT UINT32 *AslPathSizePtr
);
/** Get the AML NameString/path size.
@@ -284,8 +284,8 @@ AslGetNameStringSize ( EFI_STATUS
EFIAPI
AmlGetNameStringSize (
- IN CONST CHAR8 * AmlPath,
- OUT UINT32 * AmlPathSizePtr
+ IN CONST CHAR8 *AmlPath,
+ OUT UINT32 *AmlPathSizePtr
);
/** Convert an ASL NameString/path to an AML NameString/path.
@@ -302,8 +302,8 @@ AmlGetNameStringSize ( EFI_STATUS
EFIAPI
ConvertAslNameToAmlName (
- IN CONST CHAR8 * AslPath,
- OUT CHAR8 ** OutAmlPath
+ IN CONST CHAR8 *AslPath,
+ OUT CHAR8 **OutAmlPath
);
/** Convert an AML NameString/path to an ASL NameString/path.
@@ -320,8 +320,8 @@ ConvertAslNameToAmlName ( EFI_STATUS
EFIAPI
ConvertAmlNameToAslName (
- IN CONST CHAR8 * AmlPath,
- OUT CHAR8 ** OutAslPath
+ IN CONST CHAR8 *AmlPath,
+ OUT CHAR8 **OutAslPath
);
/** Compare two ASL NameStrings.
@@ -335,8 +335,8 @@ ConvertAmlNameToAslName ( BOOLEAN
EFIAPI
AslCompareNameString (
- IN CONST CHAR8 * AslName1,
- IN CONST CHAR8 * AslName2
+ IN CONST CHAR8 *AslName1,
+ IN CONST CHAR8 *AslName2
);
/** Compare two AML NameStrings.
@@ -350,8 +350,8 @@ AslCompareNameString ( BOOLEAN
EFIAPI
AmlCompareNameString (
- IN CONST CHAR8 * AmlName1,
- IN CONST CHAR8 * AmlName2
+ IN CONST CHAR8 *AmlName1,
+ IN CONST CHAR8 *AmlName2
);
/** Compare an AML NameString and an ASL NameString.
@@ -371,8 +371,8 @@ AmlCompareNameString ( BOOLEAN
EFIAPI
CompareAmlWithAslNameString (
- IN CONST CHAR8 * AmlName1,
- IN CONST CHAR8 * AslName2
+ IN CONST CHAR8 *AmlName1,
+ IN CONST CHAR8 *AslName2
);
/** Given an AmlPath, return the address of the first NameSeg.
@@ -393,9 +393,9 @@ CONST CHAR8 *
EFIAPI
AmlGetFirstNameSeg (
- IN CONST CHAR8 * AmlPath,
- IN UINT32 Root,
- IN UINT32 ParentPrefix
+ IN CONST CHAR8 *AmlPath,
+ IN UINT32 Root,
+ IN UINT32 ParentPrefix
);
#endif // AML_STRING_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c index 7aafa95..484c4e8 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c @@ -27,50 +27,51 @@ EFI_STATUS
EFIAPI
AmlCloneNode (
- IN AML_NODE_HEADER * Node,
- OUT AML_NODE_HEADER ** ClonedNode
+ IN AML_NODE_HEADER *Node,
+ OUT AML_NODE_HEADER **ClonedNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
- AML_DATA_NODE * DataNode;
- AML_ROOT_NODE * RootNode;
+ AML_OBJECT_NODE *ObjectNode;
+ AML_DATA_NODE *DataNode;
+ AML_ROOT_NODE *RootNode;
if (!IS_AML_NODE_VALID (Node) ||
- (ClonedNode == NULL)) {
+ (ClonedNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
if (IS_AML_DATA_NODE (Node)) {
- DataNode = (AML_DATA_NODE*)Node;
- Status = AmlCreateDataNode (
- DataNode->DataType,
- DataNode->Buffer,
- DataNode->Size,
- (AML_DATA_NODE**)ClonedNode
- );
+ DataNode = (AML_DATA_NODE *)Node;
+ Status = AmlCreateDataNode (
+ DataNode->DataType,
+ DataNode->Buffer,
+ DataNode->Size,
+ (AML_DATA_NODE **)ClonedNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
}
} else if (IS_AML_OBJECT_NODE (Node)) {
- ObjectNode = (AML_OBJECT_NODE*)Node;
+ ObjectNode = (AML_OBJECT_NODE *)Node;
Status = AmlCreateObjectNode (
- ObjectNode->AmlByteEncoding,
- ObjectNode->PkgLen,
- (AML_OBJECT_NODE**)ClonedNode
- );
+ ObjectNode->AmlByteEncoding,
+ ObjectNode->PkgLen,
+ (AML_OBJECT_NODE **)ClonedNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
}
} else if (IS_AML_ROOT_NODE (Node)) {
- RootNode = (AML_ROOT_NODE*)Node;
+ RootNode = (AML_ROOT_NODE *)Node;
Status = AmlCreateRootNode (
RootNode->SdtHeader,
- (AML_ROOT_NODE**)ClonedNode
+ (AML_ROOT_NODE **)ClonedNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -99,24 +100,25 @@ AmlCloneNode ( EFI_STATUS
EFIAPI
AmlCloneTree (
- IN AML_NODE_HEADER * Node,
- OUT AML_NODE_HEADER ** ClonedNode
+ IN AML_NODE_HEADER *Node,
+ OUT AML_NODE_HEADER **ClonedNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_NODE_HEADER * HeadNode;
- AML_NODE_HEADER * ClonedChildNode;
- AML_NODE_HEADER * FixedArgNode;
+ AML_NODE_HEADER *HeadNode;
+ AML_NODE_HEADER *ClonedChildNode;
+ AML_NODE_HEADER *FixedArgNode;
- EAML_PARSE_INDEX Index;
- EAML_PARSE_INDEX MaxIndex;
+ EAML_PARSE_INDEX Index;
+ EAML_PARSE_INDEX MaxIndex;
- LIST_ENTRY * StartLink;
- LIST_ENTRY * CurrentLink;
+ LIST_ENTRY *StartLink;
+ LIST_ENTRY *CurrentLink;
if (!IS_AML_NODE_VALID (Node) ||
- (ClonedNode == NULL)) {
+ (ClonedNode == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -129,10 +131,10 @@ AmlCloneTree ( // Clone the fixed arguments and bind them to their parent.
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
- (AML_OBJECT_NODE*)Node
+ (AML_OBJECT_NODE *)Node
);
for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
- FixedArgNode = AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index);
+ FixedArgNode = AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
if (FixedArgNode == NULL) {
Status = EFI_INVALID_PARAMETER;
ASSERT (0);
@@ -151,7 +153,7 @@ AmlCloneTree ( // Bind child.
Status = AmlSetFixedArgument (
- (AML_OBJECT_NODE*)HeadNode,
+ (AML_OBJECT_NODE *)HeadNode,
Index,
ClonedChildNode
);
@@ -168,7 +170,7 @@ AmlCloneTree ( CurrentLink = StartLink->ForwardLink;
while (CurrentLink != StartLink) {
// Clone child.
- Status = AmlCloneTree ((AML_NODE_HEADER*)CurrentLink, &ClonedChildNode);
+ Status = AmlCloneTree ((AML_NODE_HEADER *)CurrentLink, &ClonedChildNode);
if (EFI_ERROR (Status)) {
ASSERT (0);
goto error_handler;
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c index 300b07a..1404a21 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c @@ -24,8 +24,8 @@ STATIC EFI_STATUS
EFIAPI
AmlInitializeNodeHeader (
- IN AML_NODE_HEADER * Node,
- IN EAML_NODE_TYPE NodeType
+ IN AML_NODE_HEADER *Node,
+ IN EAML_NODE_TYPE NodeType
)
{
if (Node == NULL) {
@@ -35,7 +35,7 @@ AmlInitializeNodeHeader ( InitializeListHead (&Node->Link);
- Node->Parent = NULL;
+ Node->Parent = NULL;
Node->NodeType = NodeType;
return EFI_SUCCESS;
@@ -55,7 +55,7 @@ STATIC EFI_STATUS
EFIAPI
AmlDeleteRootNode (
- IN AML_ROOT_NODE * RootNode
+ IN AML_ROOT_NODE *RootNode
)
{
if (!IS_AML_ROOT_NODE (RootNode)) {
@@ -90,15 +90,16 @@ AmlDeleteRootNode ( EFI_STATUS
EFIAPI
AmlCreateRootNode (
- IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader,
- OUT AML_ROOT_NODE ** NewRootNodePtr
+ IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader,
+ OUT AML_ROOT_NODE **NewRootNodePtr
)
{
- EFI_STATUS Status;
- AML_ROOT_NODE * RootNode;
+ EFI_STATUS Status;
+ AML_ROOT_NODE *RootNode;
if ((SdtHeader == NULL) ||
- (NewRootNodePtr == NULL)) {
+ (NewRootNodePtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -149,7 +150,7 @@ STATIC EFI_STATUS
EFIAPI
AmlDeleteObjectNode (
- IN AML_OBJECT_NODE * ObjectNode
+ IN AML_OBJECT_NODE *ObjectNode
)
{
if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@@ -178,16 +179,17 @@ AmlDeleteObjectNode ( EFI_STATUS
EFIAPI
AmlCreateObjectNode (
- IN CONST AML_BYTE_ENCODING * AmlByteEncoding,
- IN UINT32 PkgLength,
- OUT AML_OBJECT_NODE ** NewObjectNodePtr
+ IN CONST AML_BYTE_ENCODING *AmlByteEncoding,
+ IN UINT32 PkgLength,
+ OUT AML_OBJECT_NODE **NewObjectNodePtr
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
if ((AmlByteEncoding == NULL) ||
- (NewObjectNodePtr == NULL)) {
+ (NewObjectNodePtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -212,7 +214,7 @@ AmlCreateObjectNode ( // ObjectNode->FixedArgs[...] is already initialised to NULL as the
// ObjectNode is Zero allocated.
ObjectNode->AmlByteEncoding = AmlByteEncoding;
- ObjectNode->PkgLen = PkgLength;
+ ObjectNode->PkgLen = PkgLength;
*NewObjectNodePtr = ObjectNode;
@@ -234,7 +236,7 @@ STATIC EFI_STATUS
EFIAPI
AmlDeleteDataNode (
- IN AML_DATA_NODE * DataNode
+ IN AML_DATA_NODE *DataNode
)
{
if (!IS_AML_DATA_NODE (DataNode)) {
@@ -271,14 +273,14 @@ AmlDeleteDataNode ( EFI_STATUS
EFIAPI
AmlCreateDataNode (
- IN EAML_NODE_DATA_TYPE DataType,
- IN CONST UINT8 * Data,
- IN UINT32 DataSize,
- OUT AML_DATA_NODE ** NewDataNodePtr
+ IN EAML_NODE_DATA_TYPE DataType,
+ IN CONST UINT8 *Data,
+ IN UINT32 DataSize,
+ OUT AML_DATA_NODE **NewDataNodePtr
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * DataNode;
+ EFI_STATUS Status;
+ AML_DATA_NODE *DataNode;
// A data node must not be created for certain data types.
if ((DataType == EAmlNodeDataTypeNone) ||
@@ -289,7 +291,8 @@ AmlCreateDataNode ( (DataType == EAmlNodeDataTypeReserved5) ||
(Data == NULL) ||
(DataSize == 0) ||
- (NewDataNodePtr == NULL)) {
+ (NewDataNodePtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -317,7 +320,7 @@ AmlCreateDataNode ( }
DataNode->DataType = DataType;
- DataNode->Size = DataSize;
+ DataNode->Size = DataSize;
*NewDataNodePtr = DataNode;
@@ -334,17 +337,18 @@ AmlCreateDataNode ( EFI_STATUS
EFIAPI
AmlDeleteNode (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
)
{
- EFI_STATUS Status;
- EAML_PARSE_INDEX Index;
+ EFI_STATUS Status;
+ EAML_PARSE_INDEX Index;
// Check that the node being deleted is unlinked.
// When removing the node, its parent and list are reset
// with InitializeListHead. Thus it must be empty.
if (!IS_AML_NODE_VALID (Node) ||
- !AML_NODE_IS_DETACHED (Node)) {
+ !AML_NODE_IS_DETACHED (Node))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -358,10 +362,11 @@ AmlDeleteNode ( return EFI_INVALID_PARAMETER;
}
- Status = AmlDeleteRootNode ((AML_ROOT_NODE*)Node);
+ Status = AmlDeleteRootNode ((AML_ROOT_NODE *)Node);
if (EFI_ERROR (Status)) {
ASSERT (0);
}
+
break;
}
@@ -375,25 +380,27 @@ AmlDeleteNode ( // Check the fixed argument list has been cleaned.
for (Index = EAmlParseIndexTerm0; Index < EAmlParseIndexMax; Index++) {
- if (((AML_OBJECT_NODE*)Node)->FixedArgs[Index] != NULL) {
+ if (((AML_OBJECT_NODE *)Node)->FixedArgs[Index] != NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
}
- Status = AmlDeleteObjectNode ((AML_OBJECT_NODE*)Node);
+ Status = AmlDeleteObjectNode ((AML_OBJECT_NODE *)Node);
if (EFI_ERROR (Status)) {
ASSERT (0);
}
+
break;
}
case EAmlNodeData:
{
- Status = AmlDeleteDataNode ((AML_DATA_NODE*)Node);
+ Status = AmlDeleteDataNode ((AML_DATA_NODE *)Node);
if (EFI_ERROR (Status)) {
ASSERT (0);
}
+
break;
}
@@ -421,12 +428,13 @@ AmlDeleteNode ( BOOLEAN
EFIAPI
AmlNodeHasAttribute (
- IN CONST AML_OBJECT_NODE * ObjectNode,
- IN AML_OP_ATTRIBUTE Attribute
+ IN CONST AML_OBJECT_NODE *ObjectNode,
+ IN AML_OP_ATTRIBUTE Attribute
)
{
if (!IS_AML_OBJECT_NODE (ObjectNode) ||
- (ObjectNode->AmlByteEncoding == NULL)) {
+ (ObjectNode->AmlByteEncoding == NULL))
+ {
return FALSE;
}
@@ -447,21 +455,22 @@ AmlNodeHasAttribute ( BOOLEAN
EFIAPI
AmlNodeCompareOpCode (
- IN CONST AML_OBJECT_NODE * ObjectNode,
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN CONST AML_OBJECT_NODE *ObjectNode,
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
)
{
if (!IS_AML_OBJECT_NODE (ObjectNode) ||
- (ObjectNode->AmlByteEncoding == NULL)) {
+ (ObjectNode->AmlByteEncoding == NULL))
+ {
return FALSE;
}
ASSERT (AmlIsOpCodeValid (OpCode, SubOpCode));
return ((ObjectNode->AmlByteEncoding->OpCode == OpCode) &&
- (ObjectNode->AmlByteEncoding->SubOpCode == SubOpCode)) ?
- TRUE : FALSE;
+ (ObjectNode->AmlByteEncoding->SubOpCode == SubOpCode)) ?
+ TRUE : FALSE;
}
/** Check whether a Node is an integer node.
@@ -480,13 +489,14 @@ AmlNodeCompareOpCode ( BOOLEAN
EFIAPI
IsIntegerNode (
- IN AML_OBJECT_NODE * Node
+ IN AML_OBJECT_NODE *Node
)
{
- UINT8 OpCode;
+ UINT8 OpCode;
if (!IS_AML_OBJECT_NODE (Node) ||
- (Node->AmlByteEncoding == NULL)) {
+ (Node->AmlByteEncoding == NULL))
+ {
return FALSE;
}
@@ -495,7 +505,8 @@ IsIntegerNode ( if ((OpCode != AML_BYTE_PREFIX) &&
(OpCode != AML_WORD_PREFIX) &&
(OpCode != AML_DWORD_PREFIX) &&
- (OpCode != AML_QWORD_PREFIX)) {
+ (OpCode != AML_QWORD_PREFIX))
+ {
return FALSE;
}
@@ -515,13 +526,14 @@ IsIntegerNode ( BOOLEAN
EFIAPI
IsSpecialIntegerNode (
- IN AML_OBJECT_NODE * Node
+ IN AML_OBJECT_NODE *Node
)
{
- UINT8 OpCode;
+ UINT8 OpCode;
if (!IS_AML_OBJECT_NODE (Node) ||
- (Node->AmlByteEncoding == NULL)) {
+ (Node->AmlByteEncoding == NULL))
+ {
return FALSE;
}
@@ -529,7 +541,8 @@ IsSpecialIntegerNode ( if ((OpCode != AML_ZERO_OP) &&
(OpCode != AML_ONE_OP) &&
- (OpCode != AML_ONES_OP)) {
+ (OpCode != AML_ONES_OP))
+ {
return FALSE;
}
@@ -555,10 +568,10 @@ IsSpecialIntegerNode ( BOOLEAN
EFIAPI
AmlIsMethodDefinitionNode (
- IN CONST AML_OBJECT_NODE * Node
+ IN CONST AML_OBJECT_NODE *Node
)
{
- AML_DATA_NODE * ObjectType;
+ AML_DATA_NODE *ObjectType;
// Node is checked to be an object node aswell.
if (AmlNodeCompareOpCode (Node, AML_METHOD_OP, 0)) {
@@ -569,14 +582,15 @@ AmlIsMethodDefinitionNode ( // ExternalOp := 0x15
// ObjectType := ByteData
// ArgumentCount := ByteData (0 - 7)
- ObjectType = (AML_DATA_NODE*)AmlGetFixedArgument (
- (AML_OBJECT_NODE*)Node,
- EAmlParseIndexTerm1
- );
+ ObjectType = (AML_DATA_NODE *)AmlGetFixedArgument (
+ (AML_OBJECT_NODE *)Node,
+ EAmlParseIndexTerm1
+ );
if (IS_AML_DATA_NODE (ObjectType) &&
(ObjectType->DataType == EAmlNodeDataTypeUInt) &&
- ((ObjectType->Size == 1))) {
- if (*((UINT8*)ObjectType->Buffer) == (UINT8)EAmlObjTypeMethodObj) {
+ ((ObjectType->Size == 1)))
+ {
+ if (*((UINT8 *)ObjectType->Buffer) == (UINT8)EAmlObjTypeMethodObj) {
// The external definition is a method.
return TRUE;
} else {
@@ -605,15 +619,16 @@ AmlIsMethodDefinitionNode ( **/
EFI_STATUS
AmlNodeGetNameIndex (
- IN CONST AML_OBJECT_NODE * ObjectNode,
- OUT EAML_PARSE_INDEX * Index
+ IN CONST AML_OBJECT_NODE *ObjectNode,
+ OUT EAML_PARSE_INDEX *Index
)
{
- EAML_PARSE_INDEX NameIndex;
+ EAML_PARSE_INDEX NameIndex;
if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) ||
(ObjectNode->AmlByteEncoding == NULL) ||
- (Index == NULL)) {
+ (Index == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -621,7 +636,8 @@ AmlNodeGetNameIndex ( NameIndex = ObjectNode->AmlByteEncoding->NameIndex;
if ((NameIndex > ObjectNode->AmlByteEncoding->MaxIndex) ||
- (ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName)) {
+ (ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -645,12 +661,12 @@ AmlNodeGetNameIndex ( CHAR8 *
EFIAPI
AmlNodeGetName (
- IN CONST AML_OBJECT_NODE * ObjectNode
+ IN CONST AML_OBJECT_NODE *ObjectNode
)
{
- EFI_STATUS Status;
- EAML_PARSE_INDEX NameIndex;
- AML_DATA_NODE * DataNode;
+ EFI_STATUS Status;
+ EAML_PARSE_INDEX NameIndex;
+ AML_DATA_NODE *DataNode;
if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) {
ASSERT (0);
@@ -665,10 +681,11 @@ AmlNodeGetName ( }
// The name is stored in a Data node.
- DataNode = (AML_DATA_NODE*)ObjectNode->FixedArgs[NameIndex];
+ DataNode = (AML_DATA_NODE *)ObjectNode->FixedArgs[NameIndex];
if (IS_AML_DATA_NODE (DataNode) &&
- (DataNode->DataType == EAmlNodeDataTypeNameString)) {
- return (CHAR8*)DataNode->Buffer;
+ (DataNode->DataType == EAmlNodeDataTypeNameString))
+ {
+ return (CHAR8 *)DataNode->Buffer;
}
/* Return NULL if no name is found.
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.h b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.h index 465a0e2..aa063b3 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.h @@ -28,8 +28,8 @@ EFI_STATUS
EFIAPI
AmlCreateRootNode (
- IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader,
- OUT AML_ROOT_NODE ** NewRootNodePtr
+ IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader,
+ OUT AML_ROOT_NODE **NewRootNodePtr
);
/** Create an AML_OBJECT_NODE.
@@ -49,9 +49,9 @@ AmlCreateRootNode ( EFI_STATUS
EFIAPI
AmlCreateObjectNode (
- IN CONST AML_BYTE_ENCODING * AmlByteEncoding,
- IN UINT32 PkgLength,
- OUT AML_OBJECT_NODE ** NewObjectNodePtr
+ IN CONST AML_BYTE_ENCODING *AmlByteEncoding,
+ IN UINT32 PkgLength,
+ OUT AML_OBJECT_NODE **NewObjectNodePtr
);
/** Create an AML_DATA_NODE.
@@ -72,10 +72,10 @@ AmlCreateObjectNode ( EFI_STATUS
EFIAPI
AmlCreateDataNode (
- IN EAML_NODE_DATA_TYPE DataType,
- IN CONST UINT8 * Data,
- IN UINT32 DataSize,
- OUT AML_DATA_NODE ** NewDataNodePtr
+ IN EAML_NODE_DATA_TYPE DataType,
+ IN CONST UINT8 *Data,
+ IN UINT32 DataSize,
+ OUT AML_DATA_NODE **NewDataNodePtr
);
/** Delete a Node.
@@ -88,7 +88,7 @@ AmlCreateDataNode ( EFI_STATUS
EFIAPI
AmlDeleteNode (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
);
/** Check whether ObjectNode has the input attribute.
@@ -104,8 +104,8 @@ AmlDeleteNode ( BOOLEAN
EFIAPI
AmlNodeHasAttribute (
- IN CONST AML_OBJECT_NODE * ObjectNode,
- IN AML_OP_ATTRIBUTE Attribute
+ IN CONST AML_OBJECT_NODE *ObjectNode,
+ IN AML_OP_ATTRIBUTE Attribute
);
/** Check whether ObjectNode has the input OpCode/SubOpcode couple.
@@ -121,9 +121,9 @@ AmlNodeHasAttribute ( BOOLEAN
EFIAPI
AmlNodeCompareOpCode (
- IN CONST AML_OBJECT_NODE * ObjectNode,
- IN UINT8 OpCode,
- IN UINT8 SubOpCode
+ IN CONST AML_OBJECT_NODE *ObjectNode,
+ IN UINT8 OpCode,
+ IN UINT8 SubOpCode
);
/** Check whether a Node is an integer node.
@@ -142,7 +142,7 @@ AmlNodeCompareOpCode ( BOOLEAN
EFIAPI
IsIntegerNode (
- IN AML_OBJECT_NODE * Node
+ IN AML_OBJECT_NODE *Node
);
/** Check whether a Node is a ZeroOp, a OneOp or a OnesOp.
@@ -158,7 +158,7 @@ IsIntegerNode ( BOOLEAN
EFIAPI
IsSpecialIntegerNode (
- IN AML_OBJECT_NODE * Node
+ IN AML_OBJECT_NODE *Node
);
/** Check whether Node corresponds to a method definition.
@@ -180,7 +180,7 @@ IsSpecialIntegerNode ( BOOLEAN
EFIAPI
AmlIsMethodDefinitionNode (
- IN CONST AML_OBJECT_NODE * Node
+ IN CONST AML_OBJECT_NODE *Node
);
/** Get the index at which the name of the node is stored.
@@ -194,8 +194,8 @@ AmlIsMethodDefinitionNode ( **/
EFI_STATUS
AmlNodeGetNameIndex (
- IN CONST AML_OBJECT_NODE * ObjectNode,
- OUT EAML_PARSE_INDEX * Index
+ IN CONST AML_OBJECT_NODE *ObjectNode,
+ OUT EAML_PARSE_INDEX *Index
);
/** Get the name of the Node.
@@ -212,7 +212,7 @@ AmlNodeGetNameIndex ( CHAR8 *
EFIAPI
AmlNodeGetName (
- IN CONST AML_OBJECT_NODE * ObjectNode
+ IN CONST AML_OBJECT_NODE *ObjectNode
);
#endif // AML_NODE_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNodeInterface.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNodeInterface.c index 80145c6..916d6f3 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNodeInterface.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNodeInterface.c @@ -25,7 +25,7 @@ EAML_NODE_TYPE
EFIAPI
AmlGetNodeType (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
)
{
if (!IS_AML_NODE_VALID (Node)) {
@@ -48,12 +48,13 @@ AmlGetNodeType ( EFI_STATUS
EFIAPI
AmlGetRootNodeInfo (
- IN AML_ROOT_NODE * RootNode,
- OUT EFI_ACPI_DESCRIPTION_HEADER * SdtHeaderBuffer
+ IN AML_ROOT_NODE *RootNode,
+ OUT EFI_ACPI_DESCRIPTION_HEADER *SdtHeaderBuffer
)
{
if (!IS_AML_ROOT_NODE (RootNode) ||
- (SdtHeaderBuffer == NULL)) {
+ (SdtHeaderBuffer == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -94,11 +95,11 @@ AmlGetRootNodeInfo ( EFI_STATUS
EFIAPI
AmlGetObjectNodeInfo (
- IN AML_OBJECT_NODE * ObjectNode,
- OUT UINT8 * OpCode OPTIONAL,
- OUT UINT8 * SubOpCode OPTIONAL,
- OUT UINT32 * PkgLen OPTIONAL,
- OUT BOOLEAN * IsNameSpaceNode OPTIONAL
+ IN AML_OBJECT_NODE *ObjectNode,
+ OUT UINT8 *OpCode OPTIONAL,
+ OUT UINT8 *SubOpCode OPTIONAL,
+ OUT UINT32 *PkgLen OPTIONAL,
+ OUT BOOLEAN *IsNameSpaceNode OPTIONAL
)
{
if (!IS_AML_OBJECT_NODE (ObjectNode)) {
@@ -109,12 +110,15 @@ AmlGetObjectNodeInfo ( if (OpCode != NULL) {
*OpCode = ObjectNode->AmlByteEncoding->OpCode;
}
+
if (SubOpCode != NULL) {
*SubOpCode = ObjectNode->AmlByteEncoding->SubOpCode;
}
+
if (PkgLen != NULL) {
*PkgLen = ObjectNode->PkgLen;
}
+
if (IsNameSpaceNode != NULL) {
*IsNameSpaceNode = AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE);
}
@@ -131,11 +135,12 @@ AmlGetObjectNodeInfo ( **/
UINT8
AmlGetFixedArgumentCount (
- IN AML_OBJECT_NODE * Node
+ IN AML_OBJECT_NODE *Node
)
{
if (IS_AML_OBJECT_NODE (Node) &&
- (Node->AmlByteEncoding != NULL)) {
+ (Node->AmlByteEncoding != NULL))
+ {
return (UINT8)Node->AmlByteEncoding->MaxIndex;
}
@@ -154,12 +159,13 @@ AmlGetFixedArgumentCount ( EFI_STATUS
EFIAPI
AmlGetNodeDataType (
- IN AML_DATA_NODE * DataNode,
- OUT EAML_NODE_DATA_TYPE * DataType
+ IN AML_DATA_NODE *DataNode,
+ OUT EAML_NODE_DATA_TYPE *DataType
)
{
if (!IS_AML_DATA_NODE (DataNode) ||
- (DataType == NULL)) {
+ (DataType == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -187,13 +193,14 @@ AmlGetNodeDataType ( EFI_STATUS
EFIAPI
AmlGetResourceDataType (
- IN AML_DATA_NODE * DataNode,
- OUT AML_RD_HEADER * ResourceDataType
+ IN AML_DATA_NODE *DataNode,
+ OUT AML_RD_HEADER *ResourceDataType
)
{
if (!IS_AML_DATA_NODE (DataNode) ||
(ResourceDataType == NULL) ||
- (DataNode->DataType != EAmlNodeDataTypeResourceData)) {
+ (DataNode->DataType != EAmlNodeDataTypeResourceData))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -227,19 +234,21 @@ AmlGetResourceDataType ( EFI_STATUS
EFIAPI
AmlGetDataNodeBuffer (
- IN AML_DATA_NODE * DataNode,
- OUT UINT8 * Buffer OPTIONAL,
- IN OUT UINT32 * BufferSize
+ IN AML_DATA_NODE *DataNode,
+ OUT UINT8 *Buffer OPTIONAL,
+ IN OUT UINT32 *BufferSize
)
{
if (!IS_AML_DATA_NODE (DataNode) ||
- (BufferSize == NULL)) {
+ (BufferSize == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
if ((*BufferSize >= DataNode->Size) &&
- (Buffer != NULL)) {
+ (Buffer != NULL))
+ {
CopyMem (Buffer, DataNode->Buffer, DataNode->Size);
}
@@ -263,8 +272,8 @@ AmlGetDataNodeBuffer ( EFI_STATUS
EFIAPI
AmlUpdateRootNode (
- IN AML_ROOT_NODE * RootNode,
- IN CONST EFI_ACPI_DESCRIPTION_HEADER * SdtHeader
+ IN AML_ROOT_NODE *RootNode,
+ IN CONST EFI_ACPI_DESCRIPTION_HEADER *SdtHeader
)
{
EFI_STATUS Status;
@@ -275,7 +284,8 @@ AmlUpdateRootNode ( ((SdtHeader->Signature !=
EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) &&
(SdtHeader->Signature !=
- EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE))) {
+ EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -287,14 +297,14 @@ AmlUpdateRootNode ( );
// Update the Length field.
- Status = AmlComputeSize ((AML_NODE_HEADER*)RootNode, &Length);
+ Status = AmlComputeSize ((AML_NODE_HEADER *)RootNode, &Length);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
RootNode->SdtHeader->Length = Length +
- (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+ (UINT32)sizeof (EFI_ACPI_DESCRIPTION_HEADER);
return Status;
}
@@ -323,18 +333,19 @@ AmlUpdateRootNode ( EFI_STATUS
EFIAPI
AmlUpdateInteger (
- IN AML_OBJECT_NODE * IntegerOpNode,
- IN UINT64 NewInteger
+ IN AML_OBJECT_NODE *IntegerOpNode,
+ IN UINT64 NewInteger
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- INT8 ValueWidthDiff;
+ INT8 ValueWidthDiff;
if (!IS_AML_OBJECT_NODE (IntegerOpNode) ||
(!IsIntegerNode (IntegerOpNode) &&
!IsSpecialIntegerNode (IntegerOpNode)) ||
- AmlNodeCompareOpCode (IntegerOpNode, AML_ONES_OP, 0)) {
+ AmlNodeCompareOpCode (IntegerOpNode, AML_ONES_OP, 0))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -349,7 +360,7 @@ AmlUpdateInteger ( if (ValueWidthDiff != 0) {
// Propagate the information.
Status = AmlPropagateInformation (
- (AML_NODE_HEADER*)IntegerOpNode,
+ (AML_NODE_HEADER *)IntegerOpNode,
(ValueWidthDiff > 0) ? TRUE : FALSE,
ABS (ValueWidthDiff),
0
@@ -380,28 +391,29 @@ AmlUpdateInteger ( EFI_STATUS
EFIAPI
AmlUpdateDataNode (
- IN AML_DATA_NODE * DataNode,
- IN EAML_NODE_DATA_TYPE DataType,
- IN UINT8 * Buffer,
- IN UINT32 Size
+ IN AML_DATA_NODE *DataNode,
+ IN EAML_NODE_DATA_TYPE DataType,
+ IN UINT8 *Buffer,
+ IN UINT32 Size
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- UINT32 ExpectedSize;
- AML_OBJECT_NODE * ParentNode;
- EAML_NODE_DATA_TYPE ExpectedArgType;
- EAML_PARSE_INDEX Index;
+ UINT32 ExpectedSize;
+ AML_OBJECT_NODE *ParentNode;
+ EAML_NODE_DATA_TYPE ExpectedArgType;
+ EAML_PARSE_INDEX Index;
if (!IS_AML_DATA_NODE (DataNode) ||
(DataType > EAmlNodeDataTypeMax) ||
(Buffer == NULL) ||
- (Size == 0)) {
+ (Size == 0))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- ParentNode = (AML_OBJECT_NODE*)AmlGetParent ((AML_NODE_HEADER*)DataNode);
+ ParentNode = (AML_OBJECT_NODE *)AmlGetParent ((AML_NODE_HEADER *)DataNode);
if (!IS_AML_OBJECT_NODE (ParentNode)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -419,7 +431,8 @@ AmlUpdateDataNode ( (((ExpectedArgType != EAmlNodeDataTypeRaw) &&
(ExpectedArgType != EAmlNodeDataTypeResourceData)) ||
((DataType != EAmlNodeDataTypeRaw) &&
- (DataType != EAmlNodeDataTypeResourceData)))) {
+ (DataType != EAmlNodeDataTypeResourceData))))
+ {
ASSERT (0);
return EFI_UNSUPPORTED;
}
@@ -430,12 +443,14 @@ AmlUpdateDataNode ( {
// Check the name contained in the Buffer is an AML name
// with the right size.
- Status = AmlGetNameStringSize ((CONST CHAR8*)Buffer, &ExpectedSize);
+ Status = AmlGetNameStringSize ((CONST CHAR8 *)Buffer, &ExpectedSize);
if (EFI_ERROR (Status) ||
- (Size != ExpectedSize)) {
+ (Size != ExpectedSize))
+ {
ASSERT (0);
return Status;
}
+
break;
}
case EAmlNodeDataTypeString:
@@ -450,6 +465,7 @@ AmlUpdateDataNode ( ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
ExpectedSize++;
}
@@ -457,13 +473,15 @@ AmlUpdateDataNode ( ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
break;
}
case EAmlNodeDataTypeUInt:
{
- if (AmlIsNodeFixedArgument ((CONST AML_NODE_HEADER*)DataNode, &Index)) {
+ if (AmlIsNodeFixedArgument ((CONST AML_NODE_HEADER *)DataNode, &Index)) {
if ((ParentNode->AmlByteEncoding == NULL) ||
- (ParentNode->AmlByteEncoding->Format == NULL)) {
+ (ParentNode->AmlByteEncoding->Format == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -472,11 +490,13 @@ AmlUpdateDataNode ( // E.g. for PackageOp the first fixed argument is of type EAmlUInt8
// and represents the count of elements. This type cannot be changed.
if ((ParentNode->AmlByteEncoding->Format[Index] != EAmlObject) &&
- (DataNode->Size != Size)) {
+ (DataNode->Size != Size))
+ {
ASSERT (0);
return EFI_UNSUPPORTED;
}
}
+
break;
}
case EAmlNodeDataTypeRaw:
@@ -486,6 +506,7 @@ AmlUpdateDataNode ( ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
break;
}
case EAmlNodeDataTypeResourceData:
@@ -495,7 +516,8 @@ AmlUpdateDataNode ( // Large resource data must be at least as long as the header
// of a large resource data.
if (AML_RD_IS_LARGE (Buffer) &&
- (Size < sizeof (ACPI_LARGE_RESOURCE_HEADER))) {
+ (Size < sizeof (ACPI_LARGE_RESOURCE_HEADER)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -529,6 +551,7 @@ AmlUpdateDataNode ( ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
break;
}
// None and reserved types.
@@ -547,8 +570,8 @@ AmlUpdateDataNode ( DataNode->NodeHeader.Parent,
(Size > DataNode->Size) ? TRUE : FALSE,
(Size > DataNode->Size) ?
- (Size - DataNode->Size) :
- (DataNode->Size - Size),
+ (Size - DataNode->Size) :
+ (DataNode->Size - Size),
0
);
if (EFI_ERROR (Status)) {
@@ -564,6 +587,7 @@ AmlUpdateDataNode ( ASSERT (0);
return EFI_OUT_OF_RESOURCES;
}
+
DataNode->Size = Size;
}
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.c index 2772e91..975174f 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.c @@ -23,11 +23,12 @@ AML_NODE_HEADER *
EFIAPI
AmlGetParent (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
)
{
if (IS_AML_DATA_NODE (Node) ||
- IS_AML_OBJECT_NODE (Node)) {
+ IS_AML_OBJECT_NODE (Node))
+ {
return Node->Parent;
}
@@ -45,7 +46,7 @@ AmlGetParent ( AML_ROOT_NODE *
EFIAPI
AmlGetRootNode (
- IN CONST AML_NODE_HEADER * Node
+ IN CONST AML_NODE_HEADER *Node
)
{
if (!IS_AML_NODE_VALID (Node)) {
@@ -60,7 +61,8 @@ AmlGetRootNode ( return NULL;
}
}
- return (AML_ROOT_NODE*)Node;
+
+ return (AML_ROOT_NODE *)Node;
}
/** Get the node at the input Index in the fixed argument list of the input
@@ -77,8 +79,8 @@ AmlGetRootNode ( AML_NODE_HEADER *
EFIAPI
AmlGetFixedArgument (
- IN AML_OBJECT_NODE * ObjectNode,
- IN EAML_PARSE_INDEX Index
+ IN AML_OBJECT_NODE *ObjectNode,
+ IN EAML_PARSE_INDEX Index
)
{
if (IS_AML_OBJECT_NODE (ObjectNode)) {
@@ -106,23 +108,24 @@ AmlGetFixedArgument ( BOOLEAN
EFIAPI
AmlIsNodeFixedArgument (
- IN CONST AML_NODE_HEADER * Node,
- OUT EAML_PARSE_INDEX * IndexPtr
+ IN CONST AML_NODE_HEADER *Node,
+ OUT EAML_PARSE_INDEX *IndexPtr
)
{
- AML_NODE_HEADER * ParentNode;
+ AML_NODE_HEADER *ParentNode;
- EAML_PARSE_INDEX Index;
- EAML_PARSE_INDEX MaxIndex;
+ EAML_PARSE_INDEX Index;
+ EAML_PARSE_INDEX MaxIndex;
if ((IndexPtr == NULL) ||
(!IS_AML_DATA_NODE (Node) &&
- !IS_AML_OBJECT_NODE (Node))) {
+ !IS_AML_OBJECT_NODE (Node)))
+ {
ASSERT (0);
return FALSE;
}
- ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+ ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
if (IS_AML_ROOT_NODE (ParentNode)) {
return FALSE;
} else if (IS_AML_DATA_NODE (ParentNode)) {
@@ -133,10 +136,10 @@ AmlIsNodeFixedArgument ( // Check whether the Node is in the fixed argument list.
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
- (AML_OBJECT_NODE*)ParentNode
+ (AML_OBJECT_NODE *)ParentNode
);
for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
- if (AmlGetFixedArgument ((AML_OBJECT_NODE*)ParentNode, Index) == Node) {
+ if (AmlGetFixedArgument ((AML_OBJECT_NODE *)ParentNode, Index) == Node) {
*IndexPtr = Index;
return TRUE;
}
@@ -163,21 +166,22 @@ AmlIsNodeFixedArgument ( EFI_STATUS
EFIAPI
AmlSetFixedArgument (
- IN AML_OBJECT_NODE * ObjectNode,
- IN EAML_PARSE_INDEX Index,
- IN AML_NODE_HEADER * NewNode
+ IN AML_OBJECT_NODE *ObjectNode,
+ IN EAML_PARSE_INDEX Index,
+ IN AML_NODE_HEADER *NewNode
)
{
if (IS_AML_OBJECT_NODE (ObjectNode) &&
(Index <= (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (ObjectNode)) &&
((NewNode == NULL) ||
IS_AML_OBJECT_NODE (NewNode) ||
- IS_AML_DATA_NODE (NewNode))) {
+ IS_AML_DATA_NODE (NewNode)))
+ {
ObjectNode->FixedArgs[Index] = NewNode;
// If NewNode is a data node or an object node, set its parent.
if (NewNode != NULL) {
- NewNode->Parent = (AML_NODE_HEADER*)ObjectNode;
+ NewNode->Parent = (AML_NODE_HEADER *)ObjectNode;
}
return EFI_SUCCESS;
@@ -199,14 +203,15 @@ AmlSetFixedArgument ( LIST_ENTRY *
EFIAPI
AmlNodeGetVariableArgList (
- IN CONST AML_NODE_HEADER * Node
+ IN CONST AML_NODE_HEADER *Node
)
{
if (IS_AML_ROOT_NODE (Node)) {
- return &(((AML_ROOT_NODE*)Node)->VariableArgs);
+ return &(((AML_ROOT_NODE *)Node)->VariableArgs);
} else if (IS_AML_OBJECT_NODE (Node)) {
- return &(((AML_OBJECT_NODE*)Node)->VariableArgs);
+ return &(((AML_OBJECT_NODE *)Node)->VariableArgs);
}
+
return NULL;
}
@@ -226,22 +231,24 @@ AmlNodeGetVariableArgList ( EFI_STATUS
EFIAPI
AmlRemoveNodeFromVarArgList (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
)
{
- EFI_STATUS Status;
- AML_NODE_HEADER * ParentNode;
- UINT32 Size;
+ EFI_STATUS Status;
+ AML_NODE_HEADER *ParentNode;
+ UINT32 Size;
if ((!IS_AML_DATA_NODE (Node) &&
- !IS_AML_OBJECT_NODE (Node))) {
+ !IS_AML_OBJECT_NODE (Node)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) &&
- !IS_AML_OBJECT_NODE (ParentNode)) {
+ !IS_AML_OBJECT_NODE (ParentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -249,7 +256,9 @@ AmlRemoveNodeFromVarArgList ( // Check the node is in its parent variable list of arguments.
if (!IsNodeInList (
AmlNodeGetVariableArgList (ParentNode),
- &Node->Link)) {
+ &Node->Link
+ ))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -289,7 +298,7 @@ AmlRemoveNodeFromVarArgList ( EFI_STATUS
EFIAPI
AmlDetachNode (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
)
{
return AmlRemoveNodeFromVarArgList (Node);
@@ -308,13 +317,13 @@ AmlDetachNode ( EFI_STATUS
EFIAPI
AmlVarListAddHead (
- IN AML_NODE_HEADER * ParentNode,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *ParentNode,
+ IN AML_NODE_HEADER *NewNode
)
{
- EFI_STATUS Status;
- UINT32 NewSize;
- LIST_ENTRY * ChildrenList;
+ EFI_STATUS Status;
+ UINT32 NewSize;
+ LIST_ENTRY *ChildrenList;
// Check arguments and that NewNode is not already attached to a tree.
// ParentNode != Data Node AND NewNode != Root Node AND NewNode != attached.
@@ -322,7 +331,8 @@ AmlVarListAddHead ( !IS_AML_OBJECT_NODE (ParentNode)) ||
(!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
- !AML_NODE_IS_DETACHED (NewNode)) {
+ !AML_NODE_IS_DETACHED (NewNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -367,11 +377,11 @@ AmlVarListAddHead ( EFI_STATUS
EFIAPI
AmlVarListAddTailInternal (
- IN AML_NODE_HEADER * ParentNode,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *ParentNode,
+ IN AML_NODE_HEADER *NewNode
)
{
- LIST_ENTRY * ChildrenList;
+ LIST_ENTRY *ChildrenList;
// Check arguments and that NewNode is not already attached to a tree.
// ParentNode != Data Node AND NewNode != Root Node AND NewNode != attached.
@@ -379,7 +389,8 @@ AmlVarListAddTailInternal ( !IS_AML_OBJECT_NODE (ParentNode)) ||
(!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
- !AML_NODE_IS_DETACHED (NewNode)) {
+ !AML_NODE_IS_DETACHED (NewNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -410,8 +421,8 @@ AmlVarListAddTailInternal ( EFI_STATUS
EFIAPI
AmlVarListAddTail (
- IN AML_NODE_HEADER * ParentNode,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *ParentNode,
+ IN AML_NODE_HEADER *NewNode
)
{
EFI_STATUS Status;
@@ -451,25 +462,27 @@ AmlVarListAddTail ( EFI_STATUS
EFIAPI
AmlVarListAddBefore (
- IN AML_NODE_HEADER * Node,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *Node,
+ IN AML_NODE_HEADER *NewNode
)
{
- EFI_STATUS Status;
- AML_NODE_HEADER * ParentNode;
- UINT32 NewSize;
+ EFI_STATUS Status;
+ AML_NODE_HEADER *ParentNode;
+ UINT32 NewSize;
// Check arguments and that NewNode is not already attached to a tree.
if ((!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
- !AML_NODE_IS_DETACHED (NewNode)) {
+ !AML_NODE_IS_DETACHED (NewNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) &&
- !IS_AML_OBJECT_NODE (ParentNode)) {
+ !IS_AML_OBJECT_NODE (ParentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -505,25 +518,27 @@ AmlVarListAddBefore ( EFI_STATUS
EFIAPI
AmlVarListAddAfter (
- IN AML_NODE_HEADER * Node,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *Node,
+ IN AML_NODE_HEADER *NewNode
)
{
- EFI_STATUS Status;
- AML_NODE_HEADER * ParentNode;
- UINT32 NewSize;
+ EFI_STATUS Status;
+ AML_NODE_HEADER *ParentNode;
+ UINT32 NewSize;
// Check arguments and that NewNode is not already attached to a tree.
if ((!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
- !AML_NODE_IS_DETACHED (NewNode)) {
+ !AML_NODE_IS_DETACHED (NewNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentNode = AmlGetParent (Node);
if (!IS_AML_ROOT_NODE (ParentNode) &&
- !IS_AML_OBJECT_NODE (ParentNode)) {
+ !IS_AML_OBJECT_NODE (ParentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -561,16 +576,17 @@ AmlVarListAddAfter ( EFI_STATUS
EFIAPI
AmlAppendRdNode (
- IN AML_OBJECT_NODE * BufferOpNode,
- IN AML_DATA_NODE * NewRdNode
+ IN AML_OBJECT_NODE *BufferOpNode,
+ IN AML_DATA_NODE *NewRdNode
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * LastRdNode;
+ EFI_STATUS Status;
+ AML_DATA_NODE *LastRdNode;
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0) ||
!IS_AML_DATA_NODE (NewRdNode) ||
- (NewRdNode->DataType != EAmlNodeDataTypeResourceData)) {
+ (NewRdNode->DataType != EAmlNodeDataTypeResourceData))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -590,22 +606,24 @@ AmlAppendRdNode ( // Get the last Resource data node in the variable list of argument of the
// BufferOp node. This must be an EndTag, otherwise setting the checksum
// would have failed.
- LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument (
- (AML_NODE_HEADER*)BufferOpNode,
- NULL
- );
+ LastRdNode = (AML_DATA_NODE *)AmlGetPreviousVariableArgument (
+ (AML_NODE_HEADER *)BufferOpNode,
+ NULL
+ );
if ((LastRdNode == NULL) ||
!IS_AML_DATA_NODE (LastRdNode) ||
- (LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
+ (LastRdNode->DataType != EAmlNodeDataTypeResourceData))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Add NewRdNode before the EndTag.
Status = AmlVarListAddBefore (
- (AML_NODE_HEADER*)LastRdNode,
- (AML_NODE_HEADER*)NewRdNode)
- ;
+ (AML_NODE_HEADER *)LastRdNode,
+ (AML_NODE_HEADER *)NewRdNode
+ )
+ ;
ASSERT_EFI_ERROR (Status);
return Status;
}
@@ -628,23 +646,24 @@ STATIC EFI_STATUS
EFIAPI
AmlReplaceFixedArgument (
- IN AML_OBJECT_NODE * ParentNode,
- IN EAML_PARSE_INDEX Index,
- IN AML_NODE_HEADER * NewNode
+ IN AML_OBJECT_NODE *ParentNode,
+ IN EAML_PARSE_INDEX Index,
+ IN AML_NODE_HEADER *NewNode
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_NODE_HEADER * OldNode;
- UINT32 NewSize;
- UINT32 OldSize;
- AML_PARSE_FORMAT FixedArgType;
+ AML_NODE_HEADER *OldNode;
+ UINT32 NewSize;
+ UINT32 OldSize;
+ AML_PARSE_FORMAT FixedArgType;
// Check arguments and that NewNode is not already attached to a tree.
if (!IS_AML_OBJECT_NODE (ParentNode) ||
(!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
- !AML_NODE_IS_DETACHED (NewNode)) {
+ !AML_NODE_IS_DETACHED (NewNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -657,11 +676,14 @@ AmlReplaceFixedArgument ( // A FieldPkgLen can only have a parent node with the
// AML_IS_FIELD_ELEMENT flag.
if (!AmlNodeHasAttribute (
- (AML_OBJECT_NODE*)ParentNode,
- AML_HAS_FIELD_LIST)) {
+ (AML_OBJECT_NODE *)ParentNode,
+ AML_HAS_FIELD_LIST
+ ))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
// Fall through.
}
@@ -676,11 +698,13 @@ AmlReplaceFixedArgument ( // data node of the same type.
// Note: This condition might be too strict, but safer.
if (!IS_AML_DATA_NODE (NewNode) ||
- (((AML_DATA_NODE*)NewNode)->DataType !=
- AmlTypeToNodeDataType (FixedArgType))) {
+ (((AML_DATA_NODE *)NewNode)->DataType !=
+ AmlTypeToNodeDataType (FixedArgType)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
break;
}
@@ -733,11 +757,11 @@ AmlReplaceFixedArgument ( // Propagate the new information.
Status = AmlPropagateInformation (
- (AML_NODE_HEADER*)ParentNode,
- (NewSize > OldSize) ? TRUE : FALSE,
- (NewSize > OldSize) ? (NewSize - OldSize) : (OldSize - NewSize),
- 0
- );
+ (AML_NODE_HEADER *)ParentNode,
+ (NewSize > OldSize) ? TRUE : FALSE,
+ (NewSize > OldSize) ? (NewSize - OldSize) : (OldSize - NewSize),
+ 0
+ );
ASSERT_EFI_ERROR (Status);
return Status;
@@ -760,18 +784,18 @@ AmlReplaceFixedArgument ( EFI_STATUS
EFIAPI
AmlReplaceVariableArgument (
- IN AML_NODE_HEADER * OldNode,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *OldNode,
+ IN AML_NODE_HEADER *NewNode
)
{
- EFI_STATUS Status;
- UINT32 NewSize;
- UINT32 OldSize;
- EAML_PARSE_INDEX Index;
+ EFI_STATUS Status;
+ UINT32 NewSize;
+ UINT32 OldSize;
+ EAML_PARSE_INDEX Index;
- AML_DATA_NODE * NewDataNode;
- AML_NODE_HEADER * ParentNode;
- LIST_ENTRY * NextLink;
+ AML_DATA_NODE *NewDataNode;
+ AML_NODE_HEADER *ParentNode;
+ LIST_ENTRY *NextLink;
// Check arguments, that NewNode is not already attached to a tree,
// and that OldNode is attached and not in a fixed list of arguments.
@@ -781,19 +805,21 @@ AmlReplaceVariableArgument ( !IS_AML_OBJECT_NODE (NewNode)) ||
!AML_NODE_IS_DETACHED (NewNode) ||
AML_NODE_IS_DETACHED (OldNode) ||
- AmlIsNodeFixedArgument (OldNode, &Index)) {
+ AmlIsNodeFixedArgument (OldNode, &Index))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
ParentNode = AmlGetParent (OldNode);
- if (!IS_AML_ROOT_NODE (ParentNode) &&
- !IS_AML_OBJECT_NODE (ParentNode)) {
+ if (!IS_AML_ROOT_NODE (ParentNode) &&
+ !IS_AML_OBJECT_NODE (ParentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- NewDataNode = (AML_DATA_NODE*)NewNode;
+ NewDataNode = (AML_DATA_NODE *)NewNode;
// Check attributes if the parent node is an object node.
if (IS_AML_OBJECT_NODE (ParentNode)) {
@@ -801,21 +827,26 @@ AmlReplaceVariableArgument ( // data node or an object node. This has already been checked. So,
// check for other cases.
- if (AmlNodeHasAttribute ((AML_OBJECT_NODE*)ParentNode, AML_HAS_BYTE_LIST)) {
+ if (AmlNodeHasAttribute ((AML_OBJECT_NODE *)ParentNode, AML_HAS_BYTE_LIST)) {
if (!IS_AML_DATA_NODE (NewNode) ||
((NewDataNode->DataType != EAmlNodeDataTypeRaw) &&
- (NewDataNode->DataType != EAmlNodeDataTypeResourceData))) {
+ (NewDataNode->DataType != EAmlNodeDataTypeResourceData)))
+ {
// A child node of a node with the BYTE_LIST flag must be a data node,
// containing raw data or a resource data.
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
} else if (AmlNodeHasAttribute (
- (AML_OBJECT_NODE*)ParentNode,
- AML_HAS_FIELD_LIST)) {
+ (AML_OBJECT_NODE *)ParentNode,
+ AML_HAS_FIELD_LIST
+ ))
+ {
if (!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)NewNode,
- AML_IS_FIELD_ELEMENT)) {
+ (CONST AML_OBJECT_NODE *)NewNode,
+ AML_IS_FIELD_ELEMENT
+ ))
+ {
// A child node of a node with the FIELD_LIST flag must be an object
// node with AML_IS_FIELD_ELEMENT flag.
ASSERT (0);
@@ -882,20 +913,21 @@ AmlReplaceVariableArgument ( EFI_STATUS
EFIAPI
AmlReplaceArgument (
- IN AML_NODE_HEADER * OldNode,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *OldNode,
+ IN AML_NODE_HEADER *NewNode
)
{
- EFI_STATUS Status;
- AML_NODE_HEADER * ParentNode;
- EAML_PARSE_INDEX Index;
+ EFI_STATUS Status;
+ AML_NODE_HEADER *ParentNode;
+ EAML_PARSE_INDEX Index;
// Check arguments and that NewNode is not already attached to a tree.
if ((!IS_AML_DATA_NODE (OldNode) &&
!IS_AML_OBJECT_NODE (OldNode)) ||
(!IS_AML_DATA_NODE (NewNode) &&
!IS_AML_OBJECT_NODE (NewNode)) ||
- !AML_NODE_IS_DETACHED (NewNode)) {
+ !AML_NODE_IS_DETACHED (NewNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -903,7 +935,8 @@ AmlReplaceArgument ( // ParentNode can be a root node or an object node.
ParentNode = AmlGetParent (OldNode);
if (!IS_AML_ROOT_NODE (ParentNode) &&
- !IS_AML_OBJECT_NODE (ParentNode)) {
+ !IS_AML_OBJECT_NODE (ParentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -911,7 +944,7 @@ AmlReplaceArgument ( if (AmlIsNodeFixedArgument (OldNode, &Index)) {
// OldNode is in its parent's fixed argument list at the Index.
Status = AmlReplaceFixedArgument (
- (AML_OBJECT_NODE*)ParentNode,
+ (AML_OBJECT_NODE *)ParentNode,
Index,
NewNode
);
@@ -942,18 +975,18 @@ AmlReplaceArgument ( EFI_STATUS
EFIAPI
AmlDeleteTree (
- IN AML_NODE_HEADER * Node
+ IN AML_NODE_HEADER *Node
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- EAML_PARSE_INDEX Index;
- EAML_PARSE_INDEX MaxIndex;
+ EAML_PARSE_INDEX Index;
+ EAML_PARSE_INDEX MaxIndex;
- AML_NODE_HEADER * Arg;
- LIST_ENTRY * StartLink;
- LIST_ENTRY * CurrentLink;
- LIST_ENTRY * NextLink;
+ AML_NODE_HEADER *Arg;
+ LIST_ENTRY *StartLink;
+ LIST_ENTRY *CurrentLink;
+ LIST_ENTRY *NextLink;
// Check that the node being deleted is unlinked.
// When removing the node, its parent pointer and
@@ -961,7 +994,8 @@ AmlDeleteTree ( // InitializeListHead. Thus it must be detached
// from the tree to avoid memory leaks.
if (!IS_AML_NODE_VALID (Node) ||
- !AML_NODE_IS_DETACHED (Node)) {
+ !AML_NODE_IS_DETACHED (Node))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -970,10 +1004,10 @@ AmlDeleteTree ( // Iterate through the fixed list of arguments.
if (IS_AML_OBJECT_NODE (Node)) {
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
- (AML_OBJECT_NODE*)Node
+ (AML_OBJECT_NODE *)Node
);
for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
- Arg = AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index);
+ Arg = AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
if (Arg == NULL) {
// A fixed argument is missing. The tree is inconsistent.
// Note: During CodeGeneration, the fixed arguments should be set
@@ -986,7 +1020,7 @@ AmlDeleteTree ( // Remove the node from the fixed argument list.
Arg->Parent = NULL;
- Status = AmlSetFixedArgument ((AML_OBJECT_NODE*)Node, Index, NULL);
+ Status = AmlSetFixedArgument ((AML_OBJECT_NODE *)Node, Index, NULL);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -1011,9 +1045,9 @@ AmlDeleteTree ( // Unlink the node from the tree.
NextLink = RemoveEntryList (CurrentLink);
InitializeListHead (CurrentLink);
- ((AML_NODE_HEADER*)CurrentLink)->Parent = NULL;
+ ((AML_NODE_HEADER *)CurrentLink)->Parent = NULL;
- Status = AmlDeleteTree ((AML_NODE_HEADER*)CurrentLink);
+ Status = AmlDeleteTree ((AML_NODE_HEADER *)CurrentLink);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.h b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.h index 0b3803c..cddd32e 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.h @@ -22,7 +22,7 @@ AML_ROOT_NODE *
EFIAPI
AmlGetRootNode (
- IN CONST AML_NODE_HEADER * Node
+ IN CONST AML_NODE_HEADER *Node
);
/** Check whether the input Node is in the fixed argument list of its parent
@@ -41,8 +41,8 @@ AmlGetRootNode ( BOOLEAN
EFIAPI
AmlIsNodeFixedArgument (
- IN CONST AML_NODE_HEADER * Node,
- OUT EAML_PARSE_INDEX * IndexPtr
+ IN CONST AML_NODE_HEADER *Node,
+ OUT EAML_PARSE_INDEX *IndexPtr
);
/** Set the fixed argument of the ObjectNode at the Index to the NewNode.
@@ -63,9 +63,9 @@ AmlIsNodeFixedArgument ( EFI_STATUS
EFIAPI
AmlSetFixedArgument (
- IN AML_OBJECT_NODE * ObjectNode,
- IN EAML_PARSE_INDEX Index,
- IN AML_NODE_HEADER * NewNode
+ IN AML_OBJECT_NODE *ObjectNode,
+ IN EAML_PARSE_INDEX Index,
+ IN AML_NODE_HEADER *NewNode
);
/** If the given AML_NODE_HEADER has a variable list of arguments,
@@ -80,7 +80,7 @@ AmlSetFixedArgument ( LIST_ENTRY *
EFIAPI
AmlNodeGetVariableArgList (
- IN CONST AML_NODE_HEADER * Node
+ IN CONST AML_NODE_HEADER *Node
);
/** Add the NewNode to the tail of the variable list of arguments
@@ -99,8 +99,8 @@ AmlNodeGetVariableArgList ( EFI_STATUS
EFIAPI
AmlVarListAddTailInternal (
- IN AML_NODE_HEADER * ParentNode,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *ParentNode,
+ IN AML_NODE_HEADER *NewNode
);
/** Replace the OldNode by the NewNode.
@@ -119,9 +119,8 @@ AmlVarListAddTailInternal ( EFI_STATUS
EFIAPI
AmlReplaceArgument (
- IN AML_NODE_HEADER * OldNode,
- IN AML_NODE_HEADER * NewNode
+ IN AML_NODE_HEADER *OldNode,
+ IN AML_NODE_HEADER *NewNode
);
#endif // AML_TREE_H_
-
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeEnumerator.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeEnumerator.c index 9502e4f..eedc8d0 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeEnumerator.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeEnumerator.c @@ -33,25 +33,26 @@ BOOLEAN
EFIAPI
AmlEnumTree (
- IN AML_NODE_HEADER * Node,
- IN EDKII_AML_TREE_ENUM_CALLBACK CallBack,
- IN OUT VOID * Context OPTIONAL,
- OUT EFI_STATUS * Status OPTIONAL
+ IN AML_NODE_HEADER *Node,
+ IN EDKII_AML_TREE_ENUM_CALLBACK CallBack,
+ IN OUT VOID *Context OPTIONAL,
+ OUT EFI_STATUS *Status OPTIONAL
)
{
- BOOLEAN ContinueEnum;
+ BOOLEAN ContinueEnum;
- EAML_PARSE_INDEX Index;
- EAML_PARSE_INDEX MaxIndex;
+ EAML_PARSE_INDEX Index;
+ EAML_PARSE_INDEX MaxIndex;
- LIST_ENTRY * StartLink;
- LIST_ENTRY * CurrentLink;
+ LIST_ENTRY *StartLink;
+ LIST_ENTRY *CurrentLink;
if (!IS_AML_NODE_VALID (Node) || (CallBack == NULL)) {
ASSERT (0);
if (Status != NULL) {
*Status = EFI_INVALID_PARAMETER;
}
+
return FALSE;
}
@@ -62,11 +63,11 @@ AmlEnumTree ( // Iterate through the fixed list of arguments.
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
- (AML_OBJECT_NODE*)Node
+ (AML_OBJECT_NODE *)Node
);
for (Index = EAmlParseIndexTerm0; Index < MaxIndex; Index++) {
ContinueEnum = AmlEnumTree (
- AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index),
+ AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index),
CallBack,
Context,
Status
@@ -82,7 +83,7 @@ AmlEnumTree ( CurrentLink = StartLink->ForwardLink;
while (CurrentLink != StartLink) {
ContinueEnum = AmlEnumTree (
- (AML_NODE_HEADER*)CurrentLink,
+ (AML_NODE_HEADER *)CurrentLink,
CallBack,
Context,
Status
@@ -90,6 +91,7 @@ AmlEnumTree ( if (ContinueEnum == FALSE) {
return ContinueEnum;
}
+
CurrentLink = CurrentLink->ForwardLink;
} // while
}
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.c index e99c234..d8cb2b6 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.c @@ -25,10 +25,10 @@ typedef struct AmlTreeInternalIterator { // of the Tree iterator APIs.
/// Pointer to the node on which the iterator has been initialized.
- CONST AML_NODE_HEADER * InitialNode;
+ CONST AML_NODE_HEADER *InitialNode;
/// Pointer to the current node.
- CONST AML_NODE_HEADER * CurrentNode;
+ CONST AML_NODE_HEADER *CurrentNode;
/// Iteration mode.
/// Allow to choose how to traverse the tree/choose which node is next.
@@ -47,13 +47,13 @@ STATIC EFI_STATUS
EFIAPI
AmlIteratorGetNode (
- IN AML_TREE_ITERATOR * Iterator,
- OUT AML_NODE_HEADER ** OutNode
+ IN AML_TREE_ITERATOR *Iterator,
+ OUT AML_NODE_HEADER **OutNode
)
{
- AML_TREE_ITERATOR_INTERNAL * InternalIterator;
+ AML_TREE_ITERATOR_INTERNAL *InternalIterator;
- InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+ InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot.
if ((OutNode == NULL) ||
@@ -62,12 +62,13 @@ AmlIteratorGetNode ( (InternalIterator->Mode >= EAmlIteratorModeMax) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
((InternalIterator->CurrentNode != NULL) &&
- !IS_AML_NODE_VALID (InternalIterator->CurrentNode))) {
+ !IS_AML_NODE_VALID (InternalIterator->CurrentNode)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- *OutNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode;
+ *OutNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
return EFI_SUCCESS;
}
@@ -87,19 +88,20 @@ STATIC EFI_STATUS
EFIAPI
AmlIteratorGetNextLinear (
- IN AML_TREE_ITERATOR * Iterator,
- OUT AML_NODE_HEADER ** NextNode
+ IN AML_TREE_ITERATOR *Iterator,
+ OUT AML_NODE_HEADER **NextNode
)
{
- AML_TREE_ITERATOR_INTERNAL * InternalIterator;
+ AML_TREE_ITERATOR_INTERNAL *InternalIterator;
- InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+ InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot.
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorLinear) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
- !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
+ !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -110,8 +112,9 @@ AmlIteratorGetNextLinear ( );
if (NextNode != NULL) {
- *NextNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode;
+ *NextNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
}
+
return EFI_SUCCESS;
}
@@ -130,19 +133,20 @@ STATIC EFI_STATUS
EFIAPI
AmlIteratorGetPreviousLinear (
- IN AML_TREE_ITERATOR * Iterator,
- OUT AML_NODE_HEADER ** PrevNode
+ IN AML_TREE_ITERATOR *Iterator,
+ OUT AML_NODE_HEADER **PrevNode
)
{
- AML_TREE_ITERATOR_INTERNAL * InternalIterator;
+ AML_TREE_ITERATOR_INTERNAL *InternalIterator;
- InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+ InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot.
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorLinear) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
- !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
+ !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -152,8 +156,9 @@ AmlIteratorGetPreviousLinear ( InternalIterator->CurrentNode
);
if (PrevNode != NULL) {
- *PrevNode = (AML_NODE_HEADER*)InternalIterator->CurrentNode;
+ *PrevNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
}
+
return EFI_SUCCESS;
}
@@ -172,20 +177,21 @@ STATIC EFI_STATUS
EFIAPI
AmlIteratorGetNextBranch (
- IN AML_TREE_ITERATOR * Iterator,
- OUT AML_NODE_HEADER ** NextNode
+ IN AML_TREE_ITERATOR *Iterator,
+ OUT AML_NODE_HEADER **NextNode
)
{
- AML_TREE_ITERATOR_INTERNAL * InternalIterator;
- AML_NODE_HEADER * Node;
+ AML_TREE_ITERATOR_INTERNAL *InternalIterator;
+ AML_NODE_HEADER *Node;
- InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+ InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot.
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorBranch) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
- !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
+ !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -193,7 +199,8 @@ AmlIteratorGetNextBranch ( Node = AmlGetNextNode (InternalIterator->CurrentNode);
// Check whether NextNode is a sibling of InitialNode.
if (AmlGetParent (Node) ==
- AmlGetParent ((AML_NODE_HEADER*)InternalIterator->InitialNode)) {
+ AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode))
+ {
Node = NULL;
}
@@ -202,6 +209,7 @@ AmlIteratorGetNextBranch ( if (NextNode != NULL) {
*NextNode = Node;
}
+
return EFI_SUCCESS;
}
@@ -220,20 +228,21 @@ STATIC EFI_STATUS
EFIAPI
AmlIteratorGetPreviousBranch (
- IN AML_TREE_ITERATOR * Iterator,
- OUT AML_NODE_HEADER ** PrevNode
+ IN AML_TREE_ITERATOR *Iterator,
+ OUT AML_NODE_HEADER **PrevNode
)
{
- AML_TREE_ITERATOR_INTERNAL * InternalIterator;
- AML_NODE_HEADER * Node;
+ AML_TREE_ITERATOR_INTERNAL *InternalIterator;
+ AML_NODE_HEADER *Node;
- InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)Iterator;
+ InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
// CurrentNode can be NULL, but InitialNode cannot.
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorBranch) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
- !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) {
+ !IS_AML_NODE_VALID (InternalIterator->CurrentNode))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -241,7 +250,8 @@ AmlIteratorGetPreviousBranch ( Node = AmlGetPreviousNode (InternalIterator->CurrentNode);
// Check whether PreviousNode is a sibling of InitialNode.
if (AmlGetParent (Node) ==
- AmlGetParent ((AML_NODE_HEADER*)InternalIterator->InitialNode)) {
+ AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode))
+ {
Node = NULL;
}
@@ -250,6 +260,7 @@ AmlIteratorGetPreviousBranch ( if (PrevNode != NULL) {
*PrevNode = Node;
}
+
return EFI_SUCCESS;
}
@@ -269,47 +280,48 @@ AmlIteratorGetPreviousBranch ( EFI_STATUS
EFIAPI
AmlInitializeIterator (
- IN AML_NODE_HEADER * Node,
- IN EAML_ITERATOR_MODE IteratorMode,
- OUT AML_TREE_ITERATOR ** IteratorPtr
+ IN AML_NODE_HEADER *Node,
+ IN EAML_ITERATOR_MODE IteratorMode,
+ OUT AML_TREE_ITERATOR **IteratorPtr
)
{
- AML_TREE_ITERATOR_INTERNAL * InternalIterator;
+ AML_TREE_ITERATOR_INTERNAL *InternalIterator;
if (!IS_AML_NODE_VALID (Node) ||
(IteratorMode <= EAmlIteratorUnknown) ||
(IteratorMode >= EAmlIteratorModeMax) ||
- (IteratorPtr == NULL)) {
+ (IteratorPtr == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- *IteratorPtr = NULL;
- InternalIterator = (AML_TREE_ITERATOR_INTERNAL*)AllocateZeroPool (
- sizeof (
- AML_TREE_ITERATOR_INTERNAL
- )
- );
+ *IteratorPtr = NULL;
+ InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)AllocateZeroPool (
+ sizeof (
+ AML_TREE_ITERATOR_INTERNAL
+ )
+ );
if (InternalIterator == NULL) {
ASSERT (0);
return EFI_OUT_OF_RESOURCES;
}
- InternalIterator->InitialNode = Node;
- InternalIterator->CurrentNode = Node;
- InternalIterator->Mode = IteratorMode;
+ InternalIterator->InitialNode = Node;
+ InternalIterator->CurrentNode = Node;
+ InternalIterator->Mode = IteratorMode;
InternalIterator->Iterator.GetNode = AmlIteratorGetNode;
switch (InternalIterator->Mode) {
case EAmlIteratorLinear:
{
- InternalIterator->Iterator.GetNext = AmlIteratorGetNextLinear;
+ InternalIterator->Iterator.GetNext = AmlIteratorGetNextLinear;
InternalIterator->Iterator.GetPrevious = AmlIteratorGetPreviousLinear;
break;
}
case EAmlIteratorBranch:
{
- InternalIterator->Iterator.GetNext = AmlIteratorGetNextBranch;
+ InternalIterator->Iterator.GetNext = AmlIteratorGetNextBranch;
InternalIterator->Iterator.GetPrevious = AmlIteratorGetPreviousBranch;
break;
}
@@ -339,7 +351,7 @@ AmlInitializeIterator ( EFI_STATUS
EFIAPI
AmlDeleteIterator (
- IN AML_TREE_ITERATOR * Iterator
+ IN AML_TREE_ITERATOR *Iterator
)
{
if (Iterator == NULL) {
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.h b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.h index d96eeca..f1f776f 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.h @@ -115,9 +115,9 @@ typedef struct AmlTreeIterator AML_TREE_ITERATOR; */
typedef
EFI_STATUS
-(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_NODE) (
- IN AML_TREE_ITERATOR * Iterator,
- OUT AML_NODE_HANDLE * OutNode
+(EFIAPI *EDKII_AML_TREE_ITERATOR_GET_NODE)(
+ IN AML_TREE_ITERATOR *Iterator,
+ OUT AML_NODE_HANDLE *OutNode
);
/** Function pointer to move the current node of the iterator to the
@@ -135,9 +135,9 @@ EFI_STATUS */
typedef
EFI_STATUS
-(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_NEXT) (
- IN AML_TREE_ITERATOR * Iterator,
- OUT AML_NODE_HANDLE * NextNode
+(EFIAPI *EDKII_AML_TREE_ITERATOR_GET_NEXT)(
+ IN AML_TREE_ITERATOR *Iterator,
+ OUT AML_NODE_HANDLE *NextNode
);
/** Function pointer to move the current node of the iterator to the
@@ -155,9 +155,9 @@ EFI_STATUS */
typedef
EFI_STATUS
-(EFIAPI * EDKII_AML_TREE_ITERATOR_GET_PREVIOUS) (
- IN AML_TREE_ITERATOR * Iterator,
- OUT AML_NODE_HANDLE * PrevNode
+(EFIAPI *EDKII_AML_TREE_ITERATOR_GET_PREVIOUS)(
+ IN AML_TREE_ITERATOR *Iterator,
+ OUT AML_NODE_HANDLE *PrevNode
);
/** Iterator structure to traverse the tree.
@@ -166,16 +166,15 @@ EFI_STATUS */
typedef struct AmlTreeIterator {
/// Get the current node of the iterator.
- EDKII_AML_TREE_ITERATOR_GET_NODE GetNode;
+ EDKII_AML_TREE_ITERATOR_GET_NODE GetNode;
/// Update the current node of the iterator with the next node.
- EDKII_AML_TREE_ITERATOR_GET_NEXT GetNext;
+ EDKII_AML_TREE_ITERATOR_GET_NEXT GetNext;
/// Update the current node of the iterator with the previous node.
- EDKII_AML_TREE_ITERATOR_GET_PREVIOUS GetPrevious;
+ EDKII_AML_TREE_ITERATOR_GET_PREVIOUS GetPrevious;
} AML_TREE_ITERATOR;
-
/** Initialize an iterator.
Note: The caller must call AmlDeleteIterator () to free the memory
@@ -194,9 +193,9 @@ typedef struct AmlTreeIterator { EFI_STATUS
EFIAPI
AmlInitializeIterator (
- IN AML_NODE_HANDLE Node,
- IN EAML_ITERATOR_MODE IteratorMode,
- OUT AML_TREE_ITERATOR ** IteratorPtr
+ IN AML_NODE_HANDLE Node,
+ IN EAML_ITERATOR_MODE IteratorMode,
+ OUT AML_TREE_ITERATOR **IteratorPtr
);
/** Delete an iterator.
@@ -214,7 +213,7 @@ AmlInitializeIterator ( EFI_STATUS
EFIAPI
AmlDeleteIterator (
- IN AML_TREE_ITERATOR * Iterator
+ IN AML_TREE_ITERATOR *Iterator
);
#endif // AML_ITERATOR_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.c index 9d0c794..b7c2cbe 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.c @@ -37,17 +37,18 @@ AML_NODE_HEADER *
EFIAPI
AmlGetSiblingVariableArgument (
- IN AML_NODE_HEADER * VarArgNode
+ IN AML_NODE_HEADER *VarArgNode
)
{
- EAML_PARSE_INDEX Index;
- AML_NODE_HEADER * ParentNode;
+ EAML_PARSE_INDEX Index;
+ AML_NODE_HEADER *ParentNode;
// VarArgNode must be an object node or a data node,
// and be in a variable list of arguments.
if ((!IS_AML_OBJECT_NODE (VarArgNode) &&
!IS_AML_DATA_NODE (VarArgNode)) ||
- AmlIsNodeFixedArgument (VarArgNode, &Index)) {
+ AmlIsNodeFixedArgument (VarArgNode, &Index))
+ {
ASSERT (0);
return NULL;
}
@@ -85,12 +86,12 @@ AmlGetSiblingVariableArgument ( AML_NODE_HEADER *
EFIAPI
AmlGetNextVariableArgument (
- IN AML_NODE_HEADER * Node,
- IN AML_NODE_HEADER * CurrVarArg
+ IN AML_NODE_HEADER *Node,
+ IN AML_NODE_HEADER *CurrVarArg
)
{
- CONST LIST_ENTRY * StartLink;
- CONST LIST_ENTRY * NextLink;
+ CONST LIST_ENTRY *StartLink;
+ CONST LIST_ENTRY *NextLink;
// Node must be a RootNode or an Object Node
// and the CurrVarArg must not be a Root Node.
@@ -98,7 +99,8 @@ AmlGetNextVariableArgument ( !IS_AML_OBJECT_NODE (Node)) ||
((CurrVarArg != NULL) &&
(!IS_AML_OBJECT_NODE (CurrVarArg) &&
- !IS_AML_DATA_NODE (CurrVarArg)))) {
+ !IS_AML_DATA_NODE (CurrVarArg))))
+ {
ASSERT (0);
return NULL;
}
@@ -112,8 +114,9 @@ AmlGetNextVariableArgument ( if (CurrVarArg == NULL) {
NextLink = StartLink->ForwardLink;
if (NextLink != StartLink) {
- return (AML_NODE_HEADER*)NextLink;
+ return (AML_NODE_HEADER *)NextLink;
}
+
// List is empty.
return NULL;
}
@@ -127,7 +130,7 @@ AmlGetNextVariableArgument ( // Get the node following the CurrVarArg.
NextLink = CurrVarArg->Link.ForwardLink;
if (NextLink != StartLink) {
- return (AML_NODE_HEADER*)NextLink;
+ return (AML_NODE_HEADER *)NextLink;
}
// End of the list has been reached.
@@ -159,12 +162,12 @@ AmlGetNextVariableArgument ( AML_NODE_HEADER *
EFIAPI
AmlGetPreviousVariableArgument (
- IN AML_NODE_HEADER * Node,
- IN AML_NODE_HEADER * CurrVarArg
+ IN AML_NODE_HEADER *Node,
+ IN AML_NODE_HEADER *CurrVarArg
)
{
- CONST LIST_ENTRY * StartLink;
- CONST LIST_ENTRY * PreviousLink;
+ CONST LIST_ENTRY *StartLink;
+ CONST LIST_ENTRY *PreviousLink;
// Node must be a RootNode or an Object Node
// and the CurrVarArg must not be a Root Node.
@@ -172,7 +175,8 @@ AmlGetPreviousVariableArgument ( !IS_AML_OBJECT_NODE (Node)) ||
((CurrVarArg != NULL) &&
(!IS_AML_OBJECT_NODE (CurrVarArg) &&
- !IS_AML_DATA_NODE (CurrVarArg)))) {
+ !IS_AML_DATA_NODE (CurrVarArg))))
+ {
ASSERT (0);
return NULL;
}
@@ -186,8 +190,9 @@ AmlGetPreviousVariableArgument ( if (CurrVarArg == NULL) {
PreviousLink = StartLink->BackLink;
if (PreviousLink != StartLink) {
- return (AML_NODE_HEADER*)PreviousLink;
+ return (AML_NODE_HEADER *)PreviousLink;
}
+
// List is empty.
return NULL;
}
@@ -201,7 +206,7 @@ AmlGetPreviousVariableArgument ( // Get the node before the CurrVarArg.
PreviousLink = CurrVarArg->Link.BackLink;
if (PreviousLink != StartLink) {
- return (AML_NODE_HEADER*)PreviousLink;
+ return (AML_NODE_HEADER *)PreviousLink;
}
// We have reached the beginning of the list.
@@ -240,12 +245,12 @@ AmlGetPreviousVariableArgument ( AML_NODE_HEADER *
EFIAPI
AmlGetNextSibling (
- IN CONST AML_NODE_HEADER * Node,
- IN CONST AML_NODE_HEADER * ChildNode
+ IN CONST AML_NODE_HEADER *Node,
+ IN CONST AML_NODE_HEADER *ChildNode
)
{
- EAML_PARSE_INDEX Index;
- AML_NODE_HEADER * CandidateNode;
+ EAML_PARSE_INDEX Index;
+ AML_NODE_HEADER *CandidateNode;
// Node must be a RootNode or an Object Node
// and the CurrVarArg must not be a Root Node.
@@ -253,7 +258,8 @@ AmlGetNextSibling ( !IS_AML_OBJECT_NODE (Node)) ||
((ChildNode != NULL) &&
(!IS_AML_OBJECT_NODE (ChildNode) &&
- !IS_AML_DATA_NODE (ChildNode)))) {
+ !IS_AML_DATA_NODE (ChildNode))))
+ {
ASSERT (0);
return NULL;
}
@@ -262,7 +268,7 @@ AmlGetNextSibling ( if (ChildNode == NULL) {
// Get the fixed argument at index 0 of the ChildNode.
CandidateNode = AmlGetFixedArgument (
- (AML_OBJECT_NODE*)Node,
+ (AML_OBJECT_NODE *)Node,
EAmlParseIndexTerm0
);
if (CandidateNode != NULL) {
@@ -275,14 +281,16 @@ AmlGetNextSibling ( Index++;
// The node is part of the list of fixed arguments.
if (Index == (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
- (AML_OBJECT_NODE*)Node)
- ) {
- // It is at the last argument of the fixed argument list.
- // Get the first argument of the variable list of arguments.
+ (AML_OBJECT_NODE *)Node
+ )
+ )
+ {
+ // It is at the last argument of the fixed argument list.
+ // Get the first argument of the variable list of arguments.
ChildNode = NULL;
} else {
// Else return the next node in the list of fixed arguments.
- return AmlGetFixedArgument ((AML_OBJECT_NODE*)Node, Index);
+ return AmlGetFixedArgument ((AML_OBJECT_NODE *)Node, Index);
}
}
}
@@ -290,8 +298,8 @@ AmlGetNextSibling ( // Else, get the next node in the variable list of arguments.
return AmlGetNextVariableArgument (
- (AML_NODE_HEADER*)Node,
- (AML_NODE_HEADER*)ChildNode
+ (AML_NODE_HEADER *)Node,
+ (AML_NODE_HEADER *)ChildNode
);
}
@@ -325,14 +333,14 @@ AmlGetNextSibling ( AML_NODE_HEADER *
EFIAPI
AmlGetPreviousSibling (
- IN CONST AML_NODE_HEADER * Node,
- IN CONST AML_NODE_HEADER * ChildNode
+ IN CONST AML_NODE_HEADER *Node,
+ IN CONST AML_NODE_HEADER *ChildNode
)
{
- EAML_PARSE_INDEX Index;
- EAML_PARSE_INDEX MaxIndex;
+ EAML_PARSE_INDEX Index;
+ EAML_PARSE_INDEX MaxIndex;
- AML_NODE_HEADER * CandidateNode;
+ AML_NODE_HEADER *CandidateNode;
// Node must be a Root Node or an Object Node
// and the ChildNode must not be a Root Node.
@@ -340,20 +348,22 @@ AmlGetPreviousSibling ( !IS_AML_OBJECT_NODE (Node)) ||
((ChildNode != NULL) &&
(!IS_AML_OBJECT_NODE (ChildNode) &&
- !IS_AML_DATA_NODE (ChildNode)))) {
+ !IS_AML_DATA_NODE (ChildNode))))
+ {
ASSERT (0);
return NULL;
}
MaxIndex = (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (
- (AML_OBJECT_NODE*)Node
+ (AML_OBJECT_NODE *)Node
);
// Get the last variable argument if no ChildNode.
// Otherwise the fixed argument list is checked first.
if ((ChildNode != NULL) &&
IS_AML_OBJECT_NODE (Node) &&
- (MaxIndex != EAmlParseIndexTerm0)) {
+ (MaxIndex != EAmlParseIndexTerm0))
+ {
if (AmlIsNodeFixedArgument (ChildNode, &Index)) {
// The node is part of the list of fixed arguments.
if (Index == EAmlParseIndexTerm0) {
@@ -362,7 +372,7 @@ AmlGetPreviousSibling ( } else {
// Return the previous node in the fixed argument list.
return AmlGetFixedArgument (
- (AML_OBJECT_NODE*)Node,
+ (AML_OBJECT_NODE *)Node,
(EAML_PARSE_INDEX)(Index - 1)
);
}
@@ -371,20 +381,21 @@ AmlGetPreviousSibling ( // ChildNode is in the variable list of arguments.
CandidateNode = AmlGetPreviousVariableArgument (
- (AML_NODE_HEADER*)Node,
- (AML_NODE_HEADER*)ChildNode
+ (AML_NODE_HEADER *)Node,
+ (AML_NODE_HEADER *)ChildNode
);
if (CandidateNode != NULL) {
if (!IS_AML_NODE_VALID (CandidateNode)) {
ASSERT (0);
return NULL;
}
+
// A Node has been found
return CandidateNode;
} else if (MaxIndex != EAmlParseIndexTerm0) {
// ChildNode was the first node of the variable list of arguments.
return AmlGetFixedArgument (
- (AML_OBJECT_NODE*)Node,
+ (AML_OBJECT_NODE *)Node,
(EAML_PARSE_INDEX)(MaxIndex - 1)
);
} else {
@@ -416,11 +427,11 @@ AmlGetPreviousSibling ( AML_NODE_HEADER *
EFIAPI
AmlGetNextNode (
- IN CONST AML_NODE_HEADER * Node
+ IN CONST AML_NODE_HEADER *Node
)
{
- AML_NODE_HEADER * ParentNode;
- AML_NODE_HEADER * CandidateNode;
+ AML_NODE_HEADER *ParentNode;
+ AML_NODE_HEADER *CandidateNode;
if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0);
@@ -435,6 +446,7 @@ AmlGetNextNode ( ASSERT (0);
return NULL;
}
+
// A Node has been found
return CandidateNode;
} else if (IS_AML_ROOT_NODE (Node)) {
@@ -452,7 +464,7 @@ AmlGetNextNode ( return NULL;
}
- ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+ ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
if (!IS_AML_NODE_VALID (ParentNode)) {
ASSERT (0);
return NULL;
@@ -464,6 +476,7 @@ AmlGetNextNode ( ASSERT (0);
return NULL;
}
+
// A Node has been found
return CandidateNode;
}
@@ -498,12 +511,12 @@ AmlGetNextNode ( AML_NODE_HEADER *
EFIAPI
AmlGetPreviousNode (
- IN CONST AML_NODE_HEADER * Node
+ IN CONST AML_NODE_HEADER *Node
)
{
- AML_NODE_HEADER * ParentNode;
- AML_NODE_HEADER * CandidateNode;
- AML_NODE_HEADER * PreviousNode;
+ AML_NODE_HEADER *ParentNode;
+ AML_NODE_HEADER *CandidateNode;
+ AML_NODE_HEADER *PreviousNode;
if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0);
@@ -511,13 +524,12 @@ AmlGetPreviousNode ( }
while (1) {
-
if (IS_AML_ROOT_NODE (Node)) {
// This is the root node.
return NULL;
}
- ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+ ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
CandidateNode = AmlGetPreviousSibling (ParentNode, Node);
if (CandidateNode == NULL) {
@@ -531,7 +543,7 @@ AmlGetPreviousNode ( // then get the last child of this node.
// If this node has children, get its last child, etc.
while (1) {
- PreviousNode = CandidateNode;
+ PreviousNode = CandidateNode;
CandidateNode = AmlGetPreviousSibling (PreviousNode, NULL);
if (CandidateNode == NULL) {
return PreviousNode;
@@ -539,7 +551,6 @@ AmlGetPreviousNode ( return CandidateNode;
}
} // while
-
} else {
ASSERT (0);
return NULL;
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.h b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.h index a4980b7..df2993c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.h @@ -43,8 +43,8 @@ AML_NODE_HEADER *
EFIAPI
AmlGetNextSibling (
- IN CONST AML_NODE_HEADER * Node,
- IN CONST AML_NODE_HEADER * ChildNode
+ IN CONST AML_NODE_HEADER *Node,
+ IN CONST AML_NODE_HEADER *ChildNode
);
/** Get the previous sibling node among the children of the input Node.
@@ -77,8 +77,8 @@ AmlGetNextSibling ( AML_NODE_HEADER *
EFIAPI
AmlGetPreviousSibling (
- IN CONST AML_NODE_HEADER * Node,
- IN CONST AML_NODE_HEADER * ChildNode
+ IN CONST AML_NODE_HEADER *Node,
+ IN CONST AML_NODE_HEADER *ChildNode
);
/** Iterate through the nodes in the same order as the AML bytestream.
@@ -104,7 +104,7 @@ AmlGetPreviousSibling ( AML_NODE_HEADER *
EFIAPI
AmlGetNextNode (
- IN CONST AML_NODE_HEADER * Node
+ IN CONST AML_NODE_HEADER *Node
);
/** Iterate through the nodes in the reverse order of the AML bytestream.
@@ -131,8 +131,7 @@ AmlGetNextNode ( AML_NODE_HEADER *
EFIAPI
AmlGetPreviousNode (
- IN CONST AML_NODE_HEADER * Node
+ IN CONST AML_NODE_HEADER *Node
);
#endif // AML_TREE_TRAVERSAL_H_
-
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.c b/DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.c index 8b5153f..811b7d2 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.c @@ -22,21 +22,21 @@ EFI_STATUS
EFIAPI
AcpiPlatformChecksum (
- IN EFI_ACPI_DESCRIPTION_HEADER * AcpiTable
+ IN EFI_ACPI_DESCRIPTION_HEADER *AcpiTable
)
{
- UINT8 * Ptr;
- UINT8 Sum;
- UINT32 Size;
+ UINT8 *Ptr;
+ UINT8 Sum;
+ UINT32 Size;
if (AcpiTable == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- Ptr = (UINT8*)AcpiTable;
+ Ptr = (UINT8 *)AcpiTable;
Size = AcpiTable->Length;
- Sum = 0;
+ Sum = 0;
// Set the checksum field to 0 first.
AcpiTable->Checksum = 0;
@@ -76,70 +76,78 @@ STATIC BOOLEAN
EFIAPI
AmlComputeSizeCallback (
- IN AML_NODE_HEADER * Node,
- IN OUT VOID * Context,
- IN OUT EFI_STATUS * Status OPTIONAL
+ IN AML_NODE_HEADER *Node,
+ IN OUT VOID *Context,
+ IN OUT EFI_STATUS *Status OPTIONAL
)
{
- UINT32 Size;
- EAML_PARSE_INDEX IndexPtr;
- CONST AML_OBJECT_NODE * ParentNode;
+ UINT32 Size;
+ EAML_PARSE_INDEX IndexPtr;
+ CONST AML_OBJECT_NODE *ParentNode;
if (!IS_AML_NODE_VALID (Node) ||
- (Context == NULL)) {
+ (Context == NULL))
+ {
ASSERT (0);
if (Status != NULL) {
*Status = EFI_INVALID_PARAMETER;
}
+
return FALSE;
}
// Ignore the second fixed argument of method invocation nodes
// as the information stored there (the argument count) is not in the
// ACPI specification.
- ParentNode = (CONST AML_OBJECT_NODE*)AmlGetParent (Node);
+ ParentNode = (CONST AML_OBJECT_NODE *)AmlGetParent (Node);
if (IS_AML_OBJECT_NODE (ParentNode) &&
AmlNodeCompareOpCode (ParentNode, AML_METHOD_INVOC_OP, 0) &&
- AmlIsNodeFixedArgument (Node, &IndexPtr)) {
+ AmlIsNodeFixedArgument (Node, &IndexPtr))
+ {
if (IndexPtr == EAmlParseIndexTerm1) {
if (Status != NULL) {
*Status = EFI_SUCCESS;
}
+
return TRUE;
}
}
- Size = *((UINT32*)Context);
+ Size = *((UINT32 *)Context);
if (IS_AML_DATA_NODE (Node)) {
- Size += ((AML_DATA_NODE*)Node)->Size;
+ Size += ((AML_DATA_NODE *)Node)->Size;
} else if (IS_AML_OBJECT_NODE (Node) &&
!AmlNodeHasAttribute (
- (CONST AML_OBJECT_NODE*)Node,
- AML_IS_PSEUDO_OPCODE)) {
+ (CONST AML_OBJECT_NODE *)Node,
+ AML_IS_PSEUDO_OPCODE
+ ))
+ {
// Ignore pseudo-opcodes as they are not part of the
// ACPI specification.
- Size += (((AML_OBJECT_NODE*)Node)->AmlByteEncoding->OpCode ==
- AML_EXT_OP) ? 2 : 1;
+ Size += (((AML_OBJECT_NODE *)Node)->AmlByteEncoding->OpCode ==
+ AML_EXT_OP) ? 2 : 1;
// Add the size of the PkgLen.
if (AmlNodeHasAttribute (
- (AML_OBJECT_NODE*)Node,
- AML_HAS_PKG_LENGTH)) {
- Size += AmlComputePkgLengthWidth (((AML_OBJECT_NODE*)Node)->PkgLen);
+ (AML_OBJECT_NODE *)Node,
+ AML_HAS_PKG_LENGTH
+ ))
+ {
+ Size += AmlComputePkgLengthWidth (((AML_OBJECT_NODE *)Node)->PkgLen);
}
}
// Check for overflow.
// The root node has a null size, thus the strict comparison.
- if (*((UINT32*)Context) > Size) {
+ if (*((UINT32 *)Context) > Size) {
ASSERT (0);
*Status = EFI_INVALID_PARAMETER;
return FALSE;
}
- *((UINT32*)Context) = Size;
+ *((UINT32 *)Context) = Size;
if (Status != NULL) {
*Status = EFI_SUCCESS;
@@ -159,14 +167,15 @@ AmlComputeSizeCallback ( EFI_STATUS
EFIAPI
AmlComputeSize (
- IN CONST AML_NODE_HEADER * Node,
- IN OUT UINT32 * Size
+ IN CONST AML_NODE_HEADER *Node,
+ IN OUT UINT32 *Size
)
{
EFI_STATUS Status;
if (!IS_AML_NODE_VALID (Node) ||
- (Size == NULL)) {
+ (Size == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -174,9 +183,9 @@ AmlComputeSize ( *Size = 0;
AmlEnumTree (
- (AML_NODE_HEADER*)Node,
+ (AML_NODE_HEADER *)Node,
AmlComputeSizeCallback,
- (VOID*)Size,
+ (VOID *)Size,
&Status
);
@@ -195,15 +204,16 @@ AmlComputeSize ( EFI_STATUS
EFIAPI
AmlNodeGetIntegerValue (
- IN AML_OBJECT_NODE * Node,
- OUT UINT64 * Value
+ IN AML_OBJECT_NODE *Node,
+ OUT UINT64 *Value
)
{
- AML_DATA_NODE * DataNode;
+ AML_DATA_NODE *DataNode;
if ((!IsIntegerNode (Node) &&
!IsSpecialIntegerNode (Node)) ||
- (Value == NULL)) {
+ (Value == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -219,13 +229,15 @@ AmlNodeGetIntegerValue ( ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
return EFI_SUCCESS;
}
// For integer nodes, the value is in the first fixed argument.
- DataNode = (AML_DATA_NODE*)Node->FixedArgs[EAmlParseIndexTerm0];
+ DataNode = (AML_DATA_NODE *)Node->FixedArgs[EAmlParseIndexTerm0];
if (!IS_AML_DATA_NODE (DataNode) ||
- (DataNode->DataType != EAmlNodeDataTypeUInt)) {
+ (DataNode->DataType != EAmlNodeDataTypeUInt))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -233,22 +245,22 @@ AmlNodeGetIntegerValue ( switch (DataNode->Size) {
case 1:
{
- *Value = *((UINT8*)(DataNode->Buffer));
+ *Value = *((UINT8 *)(DataNode->Buffer));
break;
}
case 2:
{
- *Value = *((UINT16*)(DataNode->Buffer));
+ *Value = *((UINT16 *)(DataNode->Buffer));
break;
}
case 4:
{
- *Value = *((UINT32*)(DataNode->Buffer));
+ *Value = *((UINT32 *)(DataNode->Buffer));
break;
}
case 8:
{
- *Value = *((UINT64*)(DataNode->Buffer));
+ *Value = *((UINT64 *)(DataNode->Buffer));
break;
}
default:
@@ -274,14 +286,14 @@ STATIC EFI_STATUS
EFIAPI
AmlUnwindSpecialInteger (
- IN AML_OBJECT_NODE * Node
+ IN AML_OBJECT_NODE *Node
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_DATA_NODE * NewDataNode;
- UINT8 Value;
- CONST AML_BYTE_ENCODING * ByteEncoding;
+ AML_DATA_NODE *NewDataNode;
+ UINT8 Value;
+ CONST AML_BYTE_ENCODING *ByteEncoding;
if (!IsSpecialIntegerNode (Node)) {
ASSERT (0);
@@ -300,11 +312,11 @@ AmlUnwindSpecialInteger ( }
Status = AmlCreateDataNode (
- EAmlNodeDataTypeUInt,
- &Value,
- sizeof (UINT8),
- (AML_DATA_NODE**)&NewDataNode
- );
+ EAmlNodeDataTypeUInt,
+ &Value,
+ sizeof (UINT8),
+ (AML_DATA_NODE **)&NewDataNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -323,10 +335,10 @@ AmlUnwindSpecialInteger ( // Add the data node as the first fixed argument of the ByteOp object.
Status = AmlSetFixedArgument (
- (AML_OBJECT_NODE*)Node,
- EAmlParseIndexTerm0,
- (AML_NODE_HEADER*)NewDataNode
- );
+ (AML_OBJECT_NODE *)Node,
+ EAmlParseIndexTerm0,
+ (AML_NODE_HEADER *)NewDataNode
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
goto error_handler;
@@ -335,7 +347,7 @@ AmlUnwindSpecialInteger ( return Status;
error_handler:
- AmlDeleteTree ((AML_NODE_HEADER*)NewDataNode);
+ AmlDeleteTree ((AML_NODE_HEADER *)NewDataNode);
return Status;
}
@@ -360,20 +372,21 @@ error_handler: EFI_STATUS
EFIAPI
AmlNodeSetIntegerValue (
- IN AML_OBJECT_NODE * Node,
- IN UINT64 NewValue,
- OUT INT8 * ValueWidthDiff
+ IN AML_OBJECT_NODE *Node,
+ IN UINT64 NewValue,
+ OUT INT8 *ValueWidthDiff
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * DataNode;
+ EFI_STATUS Status;
+ AML_DATA_NODE *DataNode;
- UINT8 NewOpCode;
- UINT8 NumberOfBytes;
+ UINT8 NewOpCode;
+ UINT8 NumberOfBytes;
if ((!IsIntegerNode (Node) &&
!IsSpecialIntegerNode (Node)) ||
- (ValueWidthDiff == NULL)) {
+ (ValueWidthDiff == NULL))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -396,6 +409,7 @@ AmlNodeSetIntegerValue ( ASSERT (0);
return Status;
}
+
// The AmlUnwindSpecialInteger functions converts a special integer
// node to a UInt8/Byte data node. Thus, the size increments by one:
// special integer are encoded as one byte (the opcode only) while byte
@@ -406,9 +420,10 @@ AmlNodeSetIntegerValue ( } // IsSpecialIntegerNode (Node)
// For integer nodes, the value is in the first fixed argument.
- DataNode = (AML_DATA_NODE*)Node->FixedArgs[EAmlParseIndexTerm0];
+ DataNode = (AML_DATA_NODE *)Node->FixedArgs[EAmlParseIndexTerm0];
if (!IS_AML_DATA_NODE (DataNode) ||
- (DataNode->DataType != EAmlNodeDataTypeUInt)) {
+ (DataNode->DataType != EAmlNodeDataTypeUInt))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -416,7 +431,7 @@ AmlNodeSetIntegerValue ( // The value can be encoded with a special 0 or 1 OpCode.
// The AML_ONES_OP is not handled.
if (NewValue <= 1) {
- NewOpCode = (NewValue == 0) ? AML_ZERO_OP : AML_ONE_OP;
+ NewOpCode = (NewValue == 0) ? AML_ZERO_OP : AML_ONE_OP;
Node->AmlByteEncoding = AmlGetByteEncodingByOpCode (NewOpCode, 0);
// The value is encoded with a AML_ZERO_OP or AML_ONE_OP.
@@ -425,9 +440,9 @@ AmlNodeSetIntegerValue ( *ValueWidthDiff = -((INT8)DataNode->Size);
// Detach and free the DataNode containing the integer value.
- DataNode->NodeHeader.Parent = NULL;
+ DataNode->NodeHeader.Parent = NULL;
Node->FixedArgs[EAmlParseIndexTerm0] = NULL;
- Status = AmlDeleteNode ((AML_NODE_HEADER*)DataNode);
+ Status = AmlDeleteNode ((AML_NODE_HEADER *)DataNode);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -439,19 +454,19 @@ AmlNodeSetIntegerValue ( // Check the number of bits needed to represent the value.
if (NewValue > MAX_UINT32) {
// Value is 64 bits.
- NewOpCode = AML_QWORD_PREFIX;
+ NewOpCode = AML_QWORD_PREFIX;
NumberOfBytes = 8;
} else if (NewValue > MAX_UINT16) {
// Value is 32 bits.
- NewOpCode = AML_DWORD_PREFIX;
+ NewOpCode = AML_DWORD_PREFIX;
NumberOfBytes = 4;
} else if (NewValue > MAX_UINT8) {
// Value is 16 bits.
- NewOpCode = AML_WORD_PREFIX;
+ NewOpCode = AML_WORD_PREFIX;
NumberOfBytes = 2;
} else {
// Value is 8 bits.
- NewOpCode = AML_BYTE_PREFIX;
+ NewOpCode = AML_BYTE_PREFIX;
NumberOfBytes = 1;
}
@@ -473,6 +488,7 @@ AmlNodeSetIntegerValue ( ASSERT (0);
return EFI_OUT_OF_RESOURCES;
}
+
DataNode->Size = NumberOfBytes;
}
@@ -504,14 +520,14 @@ STATIC EFI_STATUS
EFIAPI
AmlNodeUpdateIntegerValue (
- IN AML_OBJECT_NODE * IntegerNode,
- IN BOOLEAN IsIncrement,
- IN UINT64 Diff,
- OUT INT8 * ValueWidthDiff
+ IN AML_OBJECT_NODE *IntegerNode,
+ IN BOOLEAN IsIncrement,
+ IN UINT64 Diff,
+ OUT INT8 *ValueWidthDiff
)
{
- EFI_STATUS Status;
- UINT64 Value;
+ EFI_STATUS Status;
+ UINT64 Value;
if (ValueWidthDiff == NULL) {
ASSERT (0);
@@ -528,7 +544,8 @@ AmlNodeUpdateIntegerValue ( // Check for UINT64 over/underflow.
if ((IsIncrement && (Value > (MAX_UINT64 - Diff))) ||
- (!IsIncrement && (Value < Diff))) {
+ (!IsIncrement && (Value < Diff)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -570,29 +587,30 @@ STATIC EFI_STATUS
EFIAPI
AmlPropagateSize (
- IN AML_NODE_HEADER * Node,
- IN BOOLEAN IsIncrement,
- IN UINT32 * Diff
+ IN AML_NODE_HEADER *Node,
+ IN BOOLEAN IsIncrement,
+ IN UINT32 *Diff
)
{
- EFI_STATUS Status;
- AML_OBJECT_NODE * ObjectNode;
- AML_NODE_HEADER * ParentNode;
+ EFI_STATUS Status;
+ AML_OBJECT_NODE *ObjectNode;
+ AML_NODE_HEADER *ParentNode;
- UINT32 Value;
- UINT32 InitialPkgLenWidth;
- UINT32 NewPkgLenWidth;
- UINT32 ReComputedPkgLenWidth;
- INT8 FieldWidthChange;
+ UINT32 Value;
+ UINT32 InitialPkgLenWidth;
+ UINT32 NewPkgLenWidth;
+ UINT32 ReComputedPkgLenWidth;
+ INT8 FieldWidthChange;
if (!IS_AML_OBJECT_NODE (Node) &&
- !IS_AML_ROOT_NODE (Node)) {
+ !IS_AML_ROOT_NODE (Node))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
if (IS_AML_OBJECT_NODE (Node)) {
- ObjectNode = (AML_OBJECT_NODE*)Node;
+ ObjectNode = (AML_OBJECT_NODE *)Node;
// For BufferOp, the buffer size is stored in BufferSize. Therefore,
// BufferOp needs special handling to update the BufferSize.
@@ -606,10 +624,10 @@ AmlPropagateSize ( // (can be a BYTE, WORD, DWORD or QWORD).
// BufferSize is an object node.
Status = AmlNodeUpdateIntegerValue (
- (AML_OBJECT_NODE*)AmlGetFixedArgument (
- ObjectNode,
- EAmlParseIndexTerm0
- ),
+ (AML_OBJECT_NODE *)AmlGetFixedArgument (
+ ObjectNode,
+ EAmlParseIndexTerm0
+ ),
IsIncrement,
(UINT64)(*Diff),
&FieldWidthChange
@@ -624,7 +642,8 @@ AmlPropagateSize ( if ((IsIncrement &&
(FieldWidthChange < 0)) ||
(!IsIncrement &&
- (FieldWidthChange > 0))) {
+ (FieldWidthChange > 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -647,13 +666,14 @@ AmlPropagateSize ( // Subtract the size of the PkgLen encoding. The size of the PkgLen
// encoding must be computed after having updated Value.
InitialPkgLenWidth = AmlComputePkgLengthWidth (Value);
- Value -= InitialPkgLenWidth;
+ Value -= InitialPkgLenWidth;
// Check for an over/underflows.
// PkgLen is a 28 bit value, cf 20.2.4 Package Length Encoding
// i.e. the maximum value is (2^28 - 1) = ((BIT0 << 28) - 1).
if ((IsIncrement && ((((BIT0 << 28) - 1) - Value) < *Diff)) ||
- (!IsIncrement && (Value < *Diff))) {
+ (!IsIncrement && (Value < *Diff)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -682,7 +702,8 @@ AmlPropagateSize ( ReComputedPkgLenWidth = AmlComputePkgLengthWidth (Value);
if (ReComputedPkgLenWidth != NewPkgLenWidth) {
if ((ReComputedPkgLenWidth != 0) &&
- (ReComputedPkgLenWidth < 4)) {
+ (ReComputedPkgLenWidth < 4))
+ {
// No need to recompute the PkgLen since a new threshold cannot
// be reached by incrementing the value by one.
Value += 1;
@@ -693,8 +714,8 @@ AmlPropagateSize ( }
*Diff += (InitialPkgLenWidth > ReComputedPkgLenWidth) ?
- (InitialPkgLenWidth - ReComputedPkgLenWidth) :
- (ReComputedPkgLenWidth - InitialPkgLenWidth);
+ (InitialPkgLenWidth - ReComputedPkgLenWidth) :
+ (ReComputedPkgLenWidth - InitialPkgLenWidth);
ObjectNode->PkgLen = Value;
} // PkgLen update.
@@ -702,7 +723,7 @@ AmlPropagateSize ( // there is no root node at the top of the tree. Stop
// propagating the new size when finding a root node
// OR when a NULL parent is found.
- ParentNode = AmlGetParent ((AML_NODE_HEADER*)Node);
+ ParentNode = AmlGetParent ((AML_NODE_HEADER *)Node);
if (ParentNode != NULL) {
// Propagate the size up the tree.
Status = AmlPropagateSize (
@@ -715,14 +736,14 @@ AmlPropagateSize ( return Status;
}
}
-
} else if (IS_AML_ROOT_NODE (Node)) {
// Update the length field in the SDT header.
- Value = ((AML_ROOT_NODE*)Node)->SdtHeader->Length;
+ Value = ((AML_ROOT_NODE *)Node)->SdtHeader->Length;
// Check for an over/underflows.
if ((IsIncrement && (Value > (MAX_UINT32 - *Diff))) ||
- (!IsIncrement && (Value < *Diff))) {
+ (!IsIncrement && (Value < *Diff)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -734,7 +755,7 @@ AmlPropagateSize ( Value -= *Diff;
}
- ((AML_ROOT_NODE*)Node)->SdtHeader->Length = Value;
+ ((AML_ROOT_NODE *)Node)->SdtHeader->Length = Value;
}
return EFI_SUCCESS;
@@ -762,21 +783,22 @@ STATIC EFI_STATUS
EFIAPI
AmlPropagateNodeCount (
- IN AML_OBJECT_NODE * ObjectNode,
- IN BOOLEAN IsIncrement,
- IN UINT8 NodeCount,
- OUT INT8 * FieldWidthChange
+ IN AML_OBJECT_NODE *ObjectNode,
+ IN BOOLEAN IsIncrement,
+ IN UINT8 NodeCount,
+ OUT INT8 *FieldWidthChange
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- AML_NODE_HEADER * NodeCountArg;
- UINT8 CurrNodeCount;
+ AML_NODE_HEADER *NodeCountArg;
+ UINT8 CurrNodeCount;
// Currently there is no use case where (NodeCount > 1).
if (!IS_AML_OBJECT_NODE (ObjectNode) ||
(FieldWidthChange == NULL) ||
- (NodeCount > 1)) {
+ (NodeCount > 1))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -797,25 +819,26 @@ AmlPropagateNodeCount ( // in the package. It is an UINT8.
// Check for over/underflow.
- CurrNodeCount = *(((AML_DATA_NODE*)NodeCountArg)->Buffer);
+ CurrNodeCount = *(((AML_DATA_NODE *)NodeCountArg)->Buffer);
if ((IsIncrement && (CurrNodeCount == MAX_UINT8)) ||
- (!IsIncrement && (CurrNodeCount == 0))) {
+ (!IsIncrement && (CurrNodeCount == 0)))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
// Update the node count in the DataNode.
- CurrNodeCount = IsIncrement ? (CurrNodeCount + 1) : (CurrNodeCount - 1);
- *(((AML_DATA_NODE*)NodeCountArg)->Buffer) = CurrNodeCount;
+ CurrNodeCount = IsIncrement ? (CurrNodeCount + 1) : (CurrNodeCount - 1);
+ *(((AML_DATA_NODE *)NodeCountArg)->Buffer) = CurrNodeCount;
} else if (AmlNodeCompareOpCode (ObjectNode, AML_VAR_PACKAGE_OP, 0)) {
// First fixed argument of PackageOp stores the number of elements
// in the package. It is an integer (can be a BYTE, WORD, DWORD, QWORD).
Status = AmlNodeUpdateIntegerValue (
- (AML_OBJECT_NODE*)NodeCountArg,
- IsIncrement,
- NodeCount,
- FieldWidthChange
- );
+ (AML_OBJECT_NODE *)NodeCountArg,
+ IsIncrement,
+ NodeCount,
+ FieldWidthChange
+ );
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -845,10 +868,10 @@ AmlPropagateNodeCount ( EFI_STATUS
EFIAPI
AmlPropagateInformation (
- IN AML_NODE_HEADER * Node,
- IN BOOLEAN IsIncrement,
- IN UINT32 Diff,
- IN UINT8 NodeCount
+ IN AML_NODE_HEADER *Node,
+ IN BOOLEAN IsIncrement,
+ IN UINT32 Diff,
+ IN UINT8 NodeCount
)
{
EFI_STATUS Status;
@@ -857,7 +880,8 @@ AmlPropagateInformation ( // Currently there is no use case where (NodeCount > 1).
if ((!IS_AML_ROOT_NODE (Node) &&
!IS_AML_OBJECT_NODE (Node)) ||
- (NodeCount > 1)) {
+ (NodeCount > 1))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -865,9 +889,10 @@ AmlPropagateInformation ( // Propagate the node count first as it may change the number of bytes
// needed to store the node count, and then impact FieldWidthChange.
if ((NodeCount != 0) &&
- IS_AML_OBJECT_NODE (Node)) {
+ IS_AML_OBJECT_NODE (Node))
+ {
Status = AmlPropagateNodeCount (
- (AML_OBJECT_NODE*)Node,
+ (AML_OBJECT_NODE *)Node,
IsIncrement,
NodeCount,
&FieldWidthChange
@@ -881,14 +906,16 @@ AmlPropagateInformation ( // Maximum change is between UINT8/UINT64: 8 bytes.
if ((ABS (FieldWidthChange) > 8) ||
(IsIncrement &&
- ((FieldWidthChange < 0) ||
- ((Diff + (UINT8)FieldWidthChange) > MAX_UINT32))) ||
+ ((FieldWidthChange < 0) ||
+ ((Diff + (UINT8)FieldWidthChange) > MAX_UINT32))) ||
(!IsIncrement &&
- ((FieldWidthChange > 0) ||
- (Diff < (UINT32)ABS (FieldWidthChange))))) {
+ ((FieldWidthChange > 0) ||
+ (Diff < (UINT32)ABS (FieldWidthChange)))))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+
Diff = (UINT32)(Diff + (UINT8)ABS (FieldWidthChange));
}
@@ -932,13 +959,13 @@ AmlPropagateInformation ( EFI_STATUS
EFIAPI
AmlSetRdListCheckSum (
- IN AML_OBJECT_NODE * BufferOpNode,
- IN UINT8 CheckSum
+ IN AML_OBJECT_NODE *BufferOpNode,
+ IN UINT8 CheckSum
)
{
- EFI_STATUS Status;
- AML_DATA_NODE * LastRdNode;
- AML_RD_HEADER RdDataType;
+ EFI_STATUS Status;
+ AML_DATA_NODE *LastRdNode;
+ AML_RD_HEADER RdDataType;
if (!AmlNodeCompareOpCode (BufferOpNode, AML_BUFFER_OP, 0)) {
ASSERT (0);
@@ -947,13 +974,14 @@ AmlSetRdListCheckSum ( // Get the last Resource data node in the variable list of
// argument of the BufferOp node.
- LastRdNode = (AML_DATA_NODE*)AmlGetPreviousVariableArgument (
- (AML_NODE_HEADER*)BufferOpNode,
- NULL
- );
+ LastRdNode = (AML_DATA_NODE *)AmlGetPreviousVariableArgument (
+ (AML_NODE_HEADER *)BufferOpNode,
+ NULL
+ );
if ((LastRdNode == NULL) ||
!IS_AML_DATA_NODE (LastRdNode) ||
- (LastRdNode->DataType != EAmlNodeDataTypeResourceData)) {
+ (LastRdNode->DataType != EAmlNodeDataTypeResourceData))
+ {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -968,8 +996,10 @@ AmlSetRdListCheckSum ( // It is possible to have only one Resource Data in a BufferOp with
// no EndTag. Return EFI_NOT_FOUND is such case.
if (!AmlRdCompareDescId (
- &RdDataType,
- AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
+ &RdDataType,
+ AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME)
+ ))
+ {
ASSERT (0);
return EFI_NOT_FOUND;
}
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h b/DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h index 0c42d23..8c49769 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h @@ -21,7 +21,7 @@ EFI_STATUS
EFIAPI
AcpiPlatformChecksum (
- IN EFI_ACPI_DESCRIPTION_HEADER * AcpiTable
+ IN EFI_ACPI_DESCRIPTION_HEADER *AcpiTable
);
/** Compute the size of a tree/sub-tree.
@@ -35,8 +35,8 @@ AcpiPlatformChecksum ( EFI_STATUS
EFIAPI
AmlComputeSize (
- IN CONST AML_NODE_HEADER * Node,
- IN OUT UINT32 * Size
+ IN CONST AML_NODE_HEADER *Node,
+ IN OUT UINT32 *Size
);
/** Get the value contained in an integer node.
@@ -51,8 +51,8 @@ AmlComputeSize ( EFI_STATUS
EFIAPI
AmlNodeGetIntegerValue (
- IN AML_OBJECT_NODE * Node,
- OUT UINT64 * Value
+ IN AML_OBJECT_NODE *Node,
+ OUT UINT64 *Value
);
/** Set the value contained in an integer node.
@@ -76,9 +76,9 @@ AmlNodeGetIntegerValue ( EFI_STATUS
EFIAPI
AmlNodeSetIntegerValue (
- IN AML_OBJECT_NODE * Node,
- IN UINT64 NewValue,
- OUT INT8 * ValueWidthDiff
+ IN AML_OBJECT_NODE *Node,
+ IN UINT64 NewValue,
+ OUT INT8 *ValueWidthDiff
);
/** Propagate information up the tree.
@@ -101,10 +101,10 @@ AmlNodeSetIntegerValue ( EFI_STATUS
EFIAPI
AmlPropagateInformation (
- IN AML_NODE_HEADER * Node,
- IN BOOLEAN IsIncrement,
- IN UINT32 Diff,
- IN UINT8 NodeCount
+ IN AML_NODE_HEADER *Node,
+ IN BOOLEAN IsIncrement,
+ IN UINT32 Diff,
+ IN UINT8 NodeCount
);
/** Find and set the EndTag's Checksum of a list of Resource Data elements.
@@ -135,9 +135,8 @@ AmlPropagateInformation ( EFI_STATUS
EFIAPI
AmlSetRdListCheckSum (
- IN AML_OBJECT_NODE * BufferOpNode,
- IN UINT8 CheckSum
+ IN AML_OBJECT_NODE *BufferOpNode,
+ IN UINT8 CheckSum
);
#endif // AML_UTILITY_H_
-
|