From e18bc21d6a85a1336fc6766332e56a4cdc26c52a Mon Sep 17 00:00:00 2001 From: Sami Mujawar Date: Mon, 21 Sep 2020 18:19:55 +0100 Subject: [PATCH] DynamicTablesPkg: AmlLib\AmlDbgPrint fix ECC error Fix ECC error 8001 reported errors in AmlDbgPrint. [8001] Only capital letters are allowed to be used for #define declarations. Signed-off-by: Sami Mujawar Reviewed-by: Alexei Fedorov --- DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 1 + .../Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c | 10 ++--- .../Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h | 40 +++++++++++++++---- .../Common/AmlLib/NameSpace/AmlNameSpace.c | 4 +- .../Common/AmlLib/Parser/AmlFieldListParser.c | 4 +- .../Common/AmlLib/Parser/AmlMethodParser.c | 10 ++--- .../Library/Common/AmlLib/Parser/AmlParser.c | 14 +++---- .../AmlLib/Parser/AmlResourceDataParser.c | 2 +- 8 files changed, 55 insertions(+), 30 deletions(-) diff --git a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml index c0d09e79fd..ecb05f06fb 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml +++ b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml @@ -71,6 +71,7 @@ "ExtendWords": [ "ARMHB", # ARMHB000 "ARMLTD", + "AMLDBG", "EISAID", "CCIDX", "CCSIDR", diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c index 7b11cc8e99..00a61a2fe6 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c @@ -163,11 +163,11 @@ AmlDbgPrintNameString ( } if (SegCount != 0) { - AmlDbgPrintNameSeg (Buffer); + AMLDBG_PRINT_NAMESEG (Buffer); Buffer += AML_NAME_SEG_SIZE; for (Index = 0; Index < SegCount - 1; Index++) { DEBUG ((DEBUG_INFO, ".")); - AmlDbgPrintNameSeg (Buffer); + AMLDBG_PRINT_NAMESEG (Buffer); Buffer += AML_NAME_SEG_SIZE; } } @@ -232,7 +232,7 @@ AmlDbgPrintDataNode ( if ((DataNode->DataType == EAmlNodeDataTypeNameString) || (DataNode->DataType == EAmlNodeDataTypeString)) { - AmlDbgPrintChars ( + AMLDBG_PRINT_CHARS ( DEBUG_INFO, (CONST CHAR8*)DataNode->Buffer, DataNode->Size @@ -316,7 +316,7 @@ AmlDbgPrintObjectNode ( DEBUG ((DEBUG_INFO, "0x%08x | ", ObjectNode->AmlByteEncoding->Attribute)); DEBUG ((DEBUG_INFO, "0x%04x | ", ObjectNode->PkgLen)); if (AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) { - AmlDbgPrintNameString ( + AMLDBG_PRINT_NAMESTR ( AmlNodeGetName ((CONST AML_OBJECT_NODE*)ObjectNode), FALSE ); @@ -488,7 +488,7 @@ AmlDbgPrintTree ( **/ VOID EFIAPI -DumpRaw ( +AmlDbgDumpRaw ( IN CONST UINT8 * Ptr, IN UINT32 Length ) diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h index 68f4c74169..e0d527262e 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h @@ -45,7 +45,7 @@ **/ VOID EFIAPI -DumpRaw ( +AmlDbgDumpRaw ( IN CONST UINT8 * Ptr, IN UINT32 Length ); @@ -133,21 +133,45 @@ AmlDbgPrintNameSpace ( IN AML_ROOT_NODE_HANDLE RootNode ); +/* Macros to encapsulate Aml Debug Print APIs. +*/ + +#define AMLDBG_DUMP_RAW(Ptr, Length) \ + AmlDbgDumpRaw (Ptr, Length) + +#define AMLDBG_PRINT_CHARS(ErrorLevel, Buffer, Size) \ + AmlDbgPrintChars (ErrorLevel, Buffer, Size) + +#define AMLDBG_PRINT_NAMESEG(Buffer) \ + AmlDbgPrintNameSeg (Buffer) + +#define AMLDBG_PRINT_NAMESTR(Buffer,NewLine) \ + AmlDbgPrintNameString (Buffer,NewLine) + +#define AMLDBG_PRINT_NODE(Node) \ + AmlDbgPrintNode (Node) + +#define AMLDBG_PRINT_TREE(Node) \ + AmlDbgPrintTree (Node) + +#define AMLDBG_PRINT_NAMESPACE(RootNode) \ + AmlDbgPrintNameSpace (RootNode) + #else -#define DumpRaw(Ptr, Length) +#define AMLDBG_DUMP_RAW(Ptr, Length) -#define AmlDbgPrintChars(ErrorLevel, Buffer, Size) +#define AMLDBG_PRINT_CHARS(ErrorLevel, Buffer, Size) -#define AmlDbgPrintNameSeg(Buffer) +#define AMLDBG_PRINT_NAMESEG(Buffer) -#define AmlDbgPrintNameString(Buffer,NewLine) +#define AMLDBG_PRINT_NAMESTR(Buffer,NewLine) -#define AmlDbgPrintNode(Node) +#define AMLDBG_PRINT_NODE(Node) -#define AmlDbgPrintTree(Node) +#define AMLDBG_PRINT_TREE(Node) -#define AmlDbgPrintNameSpace(RootNode) +#define AMLDBG_PRINT_NAMESPACE(RootNode) #endif // MDEPKG_NDEBUG diff --git a/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c b/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c index 30d31572d3..2d055e9fb9 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c @@ -1140,13 +1140,13 @@ AmlEnumeratePathCallback ( "Comparing search path with current node path.\n" )); DEBUG ((DEBUG_VERBOSE, "Search path:")); - AmlDbgPrintChars ( + AMLDBG_PRINT_CHARS ( DEBUG_VERBOSE, (CHAR8*)AmlStreamGetCurrPos (SearchPathBStream), AmlStreamGetIndex (SearchPathBStream) ); DEBUG ((DEBUG_VERBOSE, "\nPath of the current node: ")); - AmlDbgPrintChars ( + AMLDBG_PRINT_CHARS ( DEBUG_VERBOSE, (CHAR8*)AmlStreamGetCurrPos (CurrNodePathBStream), AmlStreamGetIndex (CurrNodePathBStream) diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c index b9403efe3c..24460f9c80 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c @@ -82,7 +82,7 @@ AmlParseFieldElement ( } // Skip the field opcode (1 byte) as it is already in the FieldByteEncoding. - DumpRaw (CurrPos, 1); + AMLDBG_DUMP_RAW (CurrPos, 1); Status = AmlStreamProgress (FStream, 1); if (EFI_ERROR (Status)) { ASSERT (0); @@ -106,7 +106,7 @@ AmlParseFieldElement ( } // Move stream forward as the PkgLen has been read. - DumpRaw (CurrPos, PkgLenOffset); + AMLDBG_DUMP_RAW (CurrPos, PkgLenOffset); Status = AmlStreamProgress (FStream, PkgLenOffset); if (EFI_ERROR (Status)) { ASSERT (0); diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c index 4797fa11ed..53e91dd627 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c @@ -173,7 +173,7 @@ AmlDbgPrintNameSpaceRefList ( while (CurrLink != NameSpaceRefList) { CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE*)CurrLink; - AmlDbgPrintChars ( + AMLDBG_PRINT_CHARS ( DEBUG_INFO, CurrNameSpaceNode->RawAbsolutePath, CurrNameSpaceNode->RawAbsolutePathSize @@ -749,7 +749,7 @@ AmlFindMethodDefinition ( } DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Checking absolute name: ")); - AmlDbgPrintChars ( + AMLDBG_PRINT_CHARS ( DEBUG_VERBOSE, (CONST CHAR8*)AmlStreamGetCurrPos (RawAbsolutePathFStream), AmlStreamGetMaxBufferSize (RawAbsolutePathFStream) @@ -768,7 +768,7 @@ AmlFindMethodDefinition ( ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE*)NextLink; // Print the raw absolute path of the probed node. - AmlDbgPrintChars ( + AMLDBG_PRINT_CHARS ( DEBUG_VERBOSE, ProbedNameSpaceRefNode->RawAbsolutePath, ProbedNameSpaceRefNode->RawAbsolutePathSize @@ -1067,7 +1067,7 @@ AmlIsMethodInvocation ( DEBUG_VERBOSE, "AmlMethodParser: Corresponding method definition: " )); - AmlDbgPrintChars ( + AMLDBG_PRINT_CHARS ( DEBUG_VERBOSE, NameSpaceRefNode->RawAbsolutePath, NameSpaceRefNode->RawAbsolutePathSize @@ -1230,7 +1230,7 @@ AmlAddNameSpaceReference ( DEBUG_VERBOSE, "AmlMethodParser: Adding namespace reference with name:\n" )); - AmlDbgPrintChars ( + AMLDBG_PRINT_CHARS ( DEBUG_VERBOSE, (CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream), AmlStreamGetIndex (&RawAbsolutePathBStream) diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c index 4f6623de02..e3b9f24905 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c @@ -182,7 +182,7 @@ AmlParseUIntX ( return Status; } - DumpRaw (AmlStreamGetCurrPos (FStream), UIntXSize); + AMLDBG_DUMP_RAW (AmlStreamGetCurrPos (FStream), UIntXSize); // Move stream forward by the size of UIntX. Status = AmlStreamProgress (FStream, UIntXSize); @@ -266,7 +266,7 @@ AmlParseNameString ( return Status; } - DumpRaw (AmlStreamGetCurrPos (FStream), StrSize); + AMLDBG_DUMP_RAW (AmlStreamGetCurrPos (FStream), StrSize); // Move the stream forward by StrSize. Status = AmlStreamProgress (FStream, StrSize); @@ -335,7 +335,7 @@ AmlParseString ( StrSize++; } while (Byte != '\0'); - DumpRaw (Buffer, StrSize); + AMLDBG_DUMP_RAW (Buffer, StrSize); Status = AmlCreateDataNode ( AmlTypeToNodeDataType (ExpectedFormat), @@ -441,7 +441,7 @@ AmlParseObject ( } // Print the opcode. - DumpRaw (Buffer, OpCodeSize); + AMLDBG_DUMP_RAW (Buffer, OpCodeSize); if (!IS_END_OF_STREAM (FStream)) { // 3. Parse the PkgLength field, if present. @@ -454,7 +454,7 @@ AmlParseObject ( } // Print the package length. - DumpRaw (Buffer, PkgOffset); + AMLDBG_DUMP_RAW (Buffer, PkgOffset); // Adjust the size of the stream if it is valid package length. FreeSpace = AmlStreamGetFreeSpace (FStream); @@ -559,7 +559,7 @@ AmlParseFieldPkgLen ( return Status; } - DumpRaw (Buffer, PkgOffset); + AMLDBG_DUMP_RAW (Buffer, PkgOffset); Status = AmlStreamProgress (FStream, PkgOffset); if (EFI_ERROR (Status)) { @@ -844,7 +844,7 @@ AmlParseByteList ( return Status; } - DumpRaw (Buffer, BufferSize); + AMLDBG_DUMP_RAW (Buffer, BufferSize); // Move the stream forward as we have consumed the Buffer. Status = AmlStreamProgress (FStream, BufferSize); diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c index 0f41c68b28..7f78ed51bf 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c @@ -310,7 +310,7 @@ AmlParseResourceData ( return Status; } - DumpRaw (CurrRdElement, CurrRdElementSize); + AMLDBG_DUMP_RAW (CurrRdElement, CurrRdElementSize); // Exit the loop when finding the resource data end tag. if (AmlRdCompareDescId (