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 <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
This commit is contained in:
Sami Mujawar 2020-09-21 18:19:55 +01:00 committed by mergify[bot]
parent 5e0b708f74
commit e18bc21d6a
8 changed files with 55 additions and 30 deletions

View File

@ -71,6 +71,7 @@
"ExtendWords": [ "ExtendWords": [
"ARMHB", # ARMHB000 "ARMHB", # ARMHB000
"ARMLTD", "ARMLTD",
"AMLDBG",
"EISAID", "EISAID",
"CCIDX", "CCIDX",
"CCSIDR", "CCSIDR",

View File

@ -163,11 +163,11 @@ AmlDbgPrintNameString (
} }
if (SegCount != 0) { if (SegCount != 0) {
AmlDbgPrintNameSeg (Buffer); AMLDBG_PRINT_NAMESEG (Buffer);
Buffer += AML_NAME_SEG_SIZE; Buffer += AML_NAME_SEG_SIZE;
for (Index = 0; Index < SegCount - 1; Index++) { for (Index = 0; Index < SegCount - 1; Index++) {
DEBUG ((DEBUG_INFO, ".")); DEBUG ((DEBUG_INFO, "."));
AmlDbgPrintNameSeg (Buffer); AMLDBG_PRINT_NAMESEG (Buffer);
Buffer += AML_NAME_SEG_SIZE; Buffer += AML_NAME_SEG_SIZE;
} }
} }
@ -232,7 +232,7 @@ AmlDbgPrintDataNode (
if ((DataNode->DataType == EAmlNodeDataTypeNameString) || if ((DataNode->DataType == EAmlNodeDataTypeNameString) ||
(DataNode->DataType == EAmlNodeDataTypeString)) { (DataNode->DataType == EAmlNodeDataTypeString)) {
AmlDbgPrintChars ( AMLDBG_PRINT_CHARS (
DEBUG_INFO, DEBUG_INFO,
(CONST CHAR8*)DataNode->Buffer, (CONST CHAR8*)DataNode->Buffer,
DataNode->Size DataNode->Size
@ -316,7 +316,7 @@ AmlDbgPrintObjectNode (
DEBUG ((DEBUG_INFO, "0x%08x | ", ObjectNode->AmlByteEncoding->Attribute)); DEBUG ((DEBUG_INFO, "0x%08x | ", ObjectNode->AmlByteEncoding->Attribute));
DEBUG ((DEBUG_INFO, "0x%04x | ", ObjectNode->PkgLen)); DEBUG ((DEBUG_INFO, "0x%04x | ", ObjectNode->PkgLen));
if (AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) { if (AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)) {
AmlDbgPrintNameString ( AMLDBG_PRINT_NAMESTR (
AmlNodeGetName ((CONST AML_OBJECT_NODE*)ObjectNode), AmlNodeGetName ((CONST AML_OBJECT_NODE*)ObjectNode),
FALSE FALSE
); );
@ -488,7 +488,7 @@ AmlDbgPrintTree (
**/ **/
VOID VOID
EFIAPI EFIAPI
DumpRaw ( AmlDbgDumpRaw (
IN CONST UINT8 * Ptr, IN CONST UINT8 * Ptr,
IN UINT32 Length IN UINT32 Length
) )

View File

@ -45,7 +45,7 @@
**/ **/
VOID VOID
EFIAPI EFIAPI
DumpRaw ( AmlDbgDumpRaw (
IN CONST UINT8 * Ptr, IN CONST UINT8 * Ptr,
IN UINT32 Length IN UINT32 Length
); );
@ -133,21 +133,45 @@ AmlDbgPrintNameSpace (
IN AML_ROOT_NODE_HANDLE RootNode 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 #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 #endif // MDEPKG_NDEBUG

View File

@ -1140,13 +1140,13 @@ AmlEnumeratePathCallback (
"Comparing search path with current node path.\n" "Comparing search path with current node path.\n"
)); ));
DEBUG ((DEBUG_VERBOSE, "Search path:")); DEBUG ((DEBUG_VERBOSE, "Search path:"));
AmlDbgPrintChars ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
(CHAR8*)AmlStreamGetCurrPos (SearchPathBStream), (CHAR8*)AmlStreamGetCurrPos (SearchPathBStream),
AmlStreamGetIndex (SearchPathBStream) AmlStreamGetIndex (SearchPathBStream)
); );
DEBUG ((DEBUG_VERBOSE, "\nPath of the current node: ")); DEBUG ((DEBUG_VERBOSE, "\nPath of the current node: "));
AmlDbgPrintChars ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
(CHAR8*)AmlStreamGetCurrPos (CurrNodePathBStream), (CHAR8*)AmlStreamGetCurrPos (CurrNodePathBStream),
AmlStreamGetIndex (CurrNodePathBStream) AmlStreamGetIndex (CurrNodePathBStream)

View File

@ -82,7 +82,7 @@ AmlParseFieldElement (
} }
// Skip the field opcode (1 byte) as it is already in the FieldByteEncoding. // 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); Status = AmlStreamProgress (FStream, 1);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);
@ -106,7 +106,7 @@ AmlParseFieldElement (
} }
// Move stream forward as the PkgLen has been read. // Move stream forward as the PkgLen has been read.
DumpRaw (CurrPos, PkgLenOffset); AMLDBG_DUMP_RAW (CurrPos, PkgLenOffset);
Status = AmlStreamProgress (FStream, PkgLenOffset); Status = AmlStreamProgress (FStream, PkgLenOffset);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ASSERT (0); ASSERT (0);

View File

@ -173,7 +173,7 @@ AmlDbgPrintNameSpaceRefList (
while (CurrLink != NameSpaceRefList) { while (CurrLink != NameSpaceRefList) {
CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE*)CurrLink; CurrNameSpaceNode = (AML_NAMESPACE_REF_NODE*)CurrLink;
AmlDbgPrintChars ( AMLDBG_PRINT_CHARS (
DEBUG_INFO, DEBUG_INFO,
CurrNameSpaceNode->RawAbsolutePath, CurrNameSpaceNode->RawAbsolutePath,
CurrNameSpaceNode->RawAbsolutePathSize CurrNameSpaceNode->RawAbsolutePathSize
@ -749,7 +749,7 @@ AmlFindMethodDefinition (
} }
DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Checking absolute name: ")); DEBUG ((DEBUG_VERBOSE, "AmlMethodParser: Checking absolute name: "));
AmlDbgPrintChars ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
(CONST CHAR8*)AmlStreamGetCurrPos (RawAbsolutePathFStream), (CONST CHAR8*)AmlStreamGetCurrPos (RawAbsolutePathFStream),
AmlStreamGetMaxBufferSize (RawAbsolutePathFStream) AmlStreamGetMaxBufferSize (RawAbsolutePathFStream)
@ -768,7 +768,7 @@ AmlFindMethodDefinition (
ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE*)NextLink; ProbedNameSpaceRefNode = (AML_NAMESPACE_REF_NODE*)NextLink;
// Print the raw absolute path of the probed node. // Print the raw absolute path of the probed node.
AmlDbgPrintChars ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
ProbedNameSpaceRefNode->RawAbsolutePath, ProbedNameSpaceRefNode->RawAbsolutePath,
ProbedNameSpaceRefNode->RawAbsolutePathSize ProbedNameSpaceRefNode->RawAbsolutePathSize
@ -1067,7 +1067,7 @@ AmlIsMethodInvocation (
DEBUG_VERBOSE, DEBUG_VERBOSE,
"AmlMethodParser: Corresponding method definition: " "AmlMethodParser: Corresponding method definition: "
)); ));
AmlDbgPrintChars ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
NameSpaceRefNode->RawAbsolutePath, NameSpaceRefNode->RawAbsolutePath,
NameSpaceRefNode->RawAbsolutePathSize NameSpaceRefNode->RawAbsolutePathSize
@ -1230,7 +1230,7 @@ AmlAddNameSpaceReference (
DEBUG_VERBOSE, DEBUG_VERBOSE,
"AmlMethodParser: Adding namespace reference with name:\n" "AmlMethodParser: Adding namespace reference with name:\n"
)); ));
AmlDbgPrintChars ( AMLDBG_PRINT_CHARS (
DEBUG_VERBOSE, DEBUG_VERBOSE,
(CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream), (CONST CHAR8*)AmlStreamGetCurrPos (&RawAbsolutePathBStream),
AmlStreamGetIndex (&RawAbsolutePathBStream) AmlStreamGetIndex (&RawAbsolutePathBStream)

View File

@ -182,7 +182,7 @@ AmlParseUIntX (
return Status; return Status;
} }
DumpRaw (AmlStreamGetCurrPos (FStream), UIntXSize); AMLDBG_DUMP_RAW (AmlStreamGetCurrPos (FStream), UIntXSize);
// Move stream forward by the size of UIntX. // Move stream forward by the size of UIntX.
Status = AmlStreamProgress (FStream, UIntXSize); Status = AmlStreamProgress (FStream, UIntXSize);
@ -266,7 +266,7 @@ AmlParseNameString (
return Status; return Status;
} }
DumpRaw (AmlStreamGetCurrPos (FStream), StrSize); AMLDBG_DUMP_RAW (AmlStreamGetCurrPos (FStream), StrSize);
// Move the stream forward by StrSize. // Move the stream forward by StrSize.
Status = AmlStreamProgress (FStream, StrSize); Status = AmlStreamProgress (FStream, StrSize);
@ -335,7 +335,7 @@ AmlParseString (
StrSize++; StrSize++;
} while (Byte != '\0'); } while (Byte != '\0');
DumpRaw (Buffer, StrSize); AMLDBG_DUMP_RAW (Buffer, StrSize);
Status = AmlCreateDataNode ( Status = AmlCreateDataNode (
AmlTypeToNodeDataType (ExpectedFormat), AmlTypeToNodeDataType (ExpectedFormat),
@ -441,7 +441,7 @@ AmlParseObject (
} }
// Print the opcode. // Print the opcode.
DumpRaw (Buffer, OpCodeSize); AMLDBG_DUMP_RAW (Buffer, OpCodeSize);
if (!IS_END_OF_STREAM (FStream)) { if (!IS_END_OF_STREAM (FStream)) {
// 3. Parse the PkgLength field, if present. // 3. Parse the PkgLength field, if present.
@ -454,7 +454,7 @@ AmlParseObject (
} }
// Print the package length. // Print the package length.
DumpRaw (Buffer, PkgOffset); AMLDBG_DUMP_RAW (Buffer, PkgOffset);
// Adjust the size of the stream if it is valid package length. // Adjust the size of the stream if it is valid package length.
FreeSpace = AmlStreamGetFreeSpace (FStream); FreeSpace = AmlStreamGetFreeSpace (FStream);
@ -559,7 +559,7 @@ AmlParseFieldPkgLen (
return Status; return Status;
} }
DumpRaw (Buffer, PkgOffset); AMLDBG_DUMP_RAW (Buffer, PkgOffset);
Status = AmlStreamProgress (FStream, PkgOffset); Status = AmlStreamProgress (FStream, PkgOffset);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -844,7 +844,7 @@ AmlParseByteList (
return Status; return Status;
} }
DumpRaw (Buffer, BufferSize); AMLDBG_DUMP_RAW (Buffer, BufferSize);
// Move the stream forward as we have consumed the Buffer. // Move the stream forward as we have consumed the Buffer.
Status = AmlStreamProgress (FStream, BufferSize); Status = AmlStreamProgress (FStream, BufferSize);

View File

@ -310,7 +310,7 @@ AmlParseResourceData (
return Status; return Status;
} }
DumpRaw (CurrRdElement, CurrRdElementSize); AMLDBG_DUMP_RAW (CurrRdElement, CurrRdElementSize);
// Exit the loop when finding the resource data end tag. // Exit the loop when finding the resource data end tag.
if (AmlRdCompareDescId ( if (AmlRdCompareDescId (