From nobody Wed May 1 21:46:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528289441790500.6278929071341; Wed, 6 Jun 2018 05:50:41 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 27B65211E7448; Wed, 6 Jun 2018 05:50:40 -0700 (PDT) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 74E932118C504 for ; Wed, 6 Jun 2018 05:50:38 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2018 05:50:38 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga004.jf.intel.com with ESMTP; 06 Jun 2018 05:50:36 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,483,1520924400"; d="scan'208";a="205791675" From: Dandan Bi To: edk2-devel@lists.01.org Date: Wed, 6 Jun 2018 20:49:52 +0800 Message-Id: <20180606124952.77236-3-dandan.bi@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 In-Reply-To: <20180606124952.77236-1-dandan.bi@intel.com> References: <20180606124952.77236-1-dandan.bi@intel.com> Subject: [edk2] [patch V2 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexei.Fedorov@arm.com, Jaben Carsey , Ruiyu Ni MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 1. Separate variable definition and initialization. 2. Make the variable naming following Edk2 rule. V2: Remove the updates of guard macros in header files. Cc: Sami Mujawar Cc: Evan Lloyd Cc: Jaben Carsey Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- .../UefiShellAcpiViewCommandLib/AcpiParser.c | 44 ++++++++++------ .../UefiShellAcpiViewCommandLib/AcpiTableParser.c | 50 +++++++++---------- .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 58 ++++++++++++++----= ---- .../Library/UefiShellAcpiViewCommandLib/AcpiView.h | 10 ++-- .../Parsers/Dbg2/Dbg2Parser.c | 5 +- .../Parsers/Gtdt/GtdtParser.c | 5 +- .../Parsers/Iort/IortParser.c | 26 +++++----- .../Parsers/Madt/MadtParser.c | 4 +- .../Parsers/Rsdp/RsdpParser.c | 10 +++- .../Parsers/Slit/SlitParser.c | 44 ++++++++-------- .../Parsers/Spcr/SpcrParser.c | 10 +++- .../Parsers/Srat/SratParser.c | 21 +++++--- .../UefiShellAcpiViewCommandLib.c | 5 +- .../UefiShellAcpiViewCommandLib.inf | 3 ++ 14 files changed, 178 insertions(+), 117 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 088575d0144..6d3bc451acd 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -19,10 +19,19 @@ =20 STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount; STATIC UINT32 mTableWarningCount; =20 +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; + +/** + An ACPI_PARSER array describing the ACPI header. +**/ +STATIC CONST ACPI_PARSER AcpiHeaderParser[] =3D { + PARSE_ACPI_HEADER (&AcpiHdrInfo) +}; + /** This function resets the ACPI table error counter to Zero. **/ VOID ResetErrorCount ( @@ -112,14 +121,17 @@ VerifyChecksum ( IN BOOLEAN Log, IN UINT8* Ptr, IN UINT32 Length ) { - UINTN ByteCount =3D 0; - UINT8 Checksum =3D 0; + UINTN ByteCount; + UINT8 Checksum; UINTN OriginalAttribute; =20 + ByteCount =3D 0; + Checksum =3D 0; + while (ByteCount < Length) { Checksum +=3D *(Ptr++); ByteCount++; } =20 @@ -164,15 +176,18 @@ EFIAPI DumpRaw ( IN UINT8* Ptr, IN UINT32 Length ) { - UINTN ByteCount =3D 0; + UINTN ByteCount; UINTN PartLineChars; - UINTN AsciiBufferIndex =3D 0; + UINTN AsciiBufferIndex; CHAR8 AsciiBuffer[17]; =20 + ByteCount =3D 0; + AsciiBufferIndex =3D 0; + Print (L"Address : 0x%p\n", Ptr); Print (L"Length : %d\n", Length); =20 while (ByteCount < Length) { if ((ByteCount & 0x0F) =3D=3D 0) { @@ -275,11 +290,14 @@ DumpUint64 ( ) { // Some fields are not aligned and this causes alignment faults // on ARM platforms if the compiler generates LDRD instructions. // Perform word access so that LDRD instructions are not generated. - UINT64 Val =3D *(UINT32*)(Ptr + sizeof (UINT32)); + UINT64 Val; + + Val =3D *(UINT32*)(Ptr + sizeof (UINT32)); + Val <<=3D 32; Val |=3D *(UINT32*)Ptr; =20 Print (Format, Val); } @@ -454,17 +472,20 @@ ParseAcpi ( IN CONST ACPI_PARSER* Parser, IN UINT32 ParserItems ) { UINT32 Index; - UINT32 Offset =3D 0; + UINT32 Offset; + BOOLEAN HighLight; + + Offset =3D 0; =20 // Increment the Indent gIndent +=3D Indent; =20 if (Trace && (AsciiName !=3D NULL)){ - BOOLEAN HighLight =3D GetColourHighlighting (); + HighLight =3D GetColourHighlighting (); UINTN OriginalAttribute; =20 if (HighLight) { OriginalAttribute =3D gST->ConOut->Mode->Attribute; gST->ConOut->SetAttribute ( @@ -618,15 +639,10 @@ UINT32 EFIAPI DumpAcpiHeader ( IN UINT8* Ptr ) { - ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - ACPI_PARSER AcpiHeaderParser[] =3D { - PARSE_ACPI_HEADER (&AcpiHdrInfo) - }; - return ParseAcpi ( TRUE, 0, "ACPI Table Header", Ptr, @@ -656,14 +672,10 @@ ParseAcpiHeader ( OUT CONST UINT32** Length, OUT CONST UINT8** Revision ) { UINT32 BytesParsed; - ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - ACPI_PARSER AcpiHeaderParser[] =3D { - PARSE_ACPI_HEADER (&AcpiHdrInfo) - }; =20 BytesParsed =3D ParseAcpi ( FALSE, 0, NULL, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c= b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index 7b1a02cad3e..fff5757bf58 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -43,36 +43,36 @@ EFIAPI RegisterParser ( IN UINT32 Signature, IN PARSE_ACPI_TABLE_PROC ParserProc ) { - UINT32 index; + UINT32 Index; =20 if ((ParserProc =3D=3D NULL) || (Signature =3D=3D ACPI_PARSER_SIGNATURE_= NULL)) { return EFI_INVALID_PARAMETER; } =20 // Search if a parser is already installed - for (index =3D 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index =3D 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature =3D=3D mTableParserList[index].Signature) { - if (mTableParserList[index].Parser !=3D NULL) { + if (Signature =3D=3D mTableParserList[Index].Signature) { + if (mTableParserList[Index].Parser !=3D NULL) { return EFI_ALREADY_STARTED; } } } =20 // Find the first free slot and register the parser - for (index =3D 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index =3D 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (mTableParserList[index].Signature =3D=3D ACPI_PARSER_SIGNATURE_NUL= L) { - mTableParserList[index].Signature =3D Signature; - mTableParserList[index].Parser =3D ParserProc; + if (mTableParserList[Index].Signature =3D=3D ACPI_PARSER_SIGNATURE_NUL= L) { + mTableParserList[Index].Signature =3D Signature; + mTableParserList[Index].Parser =3D ParserProc; return EFI_SUCCESS; } } =20 // No free slot found @@ -94,23 +94,23 @@ EFI_STATUS EFIAPI DeregisterParser ( IN UINT32 Signature ) { - UINT32 index; + UINT32 Index; =20 if (Signature =3D=3D ACPI_PARSER_SIGNATURE_NULL) { return EFI_INVALID_PARAMETER; } =20 - for (index =3D 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index =3D 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature =3D=3D mTableParserList[index].Signature) { - mTableParserList[index].Signature =3D ACPI_PARSER_SIGNATURE_NULL; - mTableParserList[index].Parser =3D NULL; + if (Signature =3D=3D mTableParserList[Index].Signature) { + mTableParserList[Index].Signature =3D ACPI_PARSER_SIGNATURE_NULL; + mTableParserList[Index].Parser =3D NULL; return EFI_SUCCESS; } } =20 // No matching registered parser found. @@ -135,22 +135,22 @@ EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc ) { - UINT32 index; + UINT32 Index; =20 if ((ParserProc =3D=3D NULL) || (Signature =3D=3D ACPI_PARSER_SIGNATURE_= NULL)) { return EFI_INVALID_PARAMETER; } =20 - for (index =3D 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index =3D 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature =3D=3D mTableParserList[index].Signature) { - *ParserProc =3D mTableParserList[index].Parser; + if (Signature =3D=3D mTableParserList[Index].Signature) { + *ParserProc =3D mTableParserList[Index].Parser; return EFI_SUCCESS; } } =20 // No matching registered parser found. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index f5602e94291..47ce93f104b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -120,12 +120,15 @@ DumpAcpiTableToFile ( IN CONST UINTN Length ) { EFI_STATUS Status; CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SHELL_FILE_HANDLE DumpFileHandle =3D NULL; - UINTN TransferBytes =3D Length; + SHELL_FILE_HANDLE DumpFileHandle; + UINTN TransferBytes; + + DumpFileHandle =3D NULL; + TransferBytes =3D Length; =20 UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.bin", @@ -184,24 +187,29 @@ ProcessTableReportOptions ( IN CONST UINT8* TablePtr, IN CONST UINT32 Length ) { UINTN OriginalAttribute; - UINT8* SignaturePtr =3D (UINT8*)(UINTN)&Signature; - BOOLEAN Log =3D FALSE; - BOOLEAN HighLight =3D GetColourHighlighting (); + UINT8* SignaturePtr; + BOOLEAN Log; + BOOLEAN HighLight; + + SignaturePtr =3D (UINT8*)(UINTN)&Signature; + Log =3D FALSE; + HighLight =3D GetColourHighlighting (); + switch (GetReportOption ()) { - case EREPORT_ALL: + case ReportAll: Log =3D TRUE; break; - case EREPORT_SELECTED: + case ReportSelected: if (Signature =3D=3D GetSelectedAcpiTable ()) { Log =3D TRUE; mSelectedAcpiTableFound =3D TRUE; } break; - case EREPORT_TABLE_LIST: + case ReportTableList: if (mTableCount =3D=3D 0) { if (HighLight) { OriginalAttribute =3D gST->ConOut->Mode->Attribute; gST->ConOut->SetAttribute ( gST->ConOut, @@ -221,17 +229,17 @@ ProcessTableReportOptions ( SignaturePtr[1], SignaturePtr[2], SignaturePtr[3] ); break; - case EREPORT_DUMP_BIN_FILE: + case ReportDumpBinFile: if (Signature =3D=3D GetSelectedAcpiTable ()) { mSelectedAcpiTableFound =3D TRUE; DumpAcpiTableToFile (TablePtr, Length); } break; - case EREPORT_MAX: + case ReportMax: // We should never be here. // This case is only present to prevent compiler warning. break; } // switch =20 @@ -271,13 +279,15 @@ STATIC UINT32 ConvertStrToAcpiSignature ( IN CONST CHAR16* Str ) { - UINT8 Index =3D 0; + UINT8 Index; CHAR8 Ptr[4]; =20 + Index =3D 0; + // Convert to Upper case and convert to ASCII while ((Index < 4) && (Str[Index] !=3D 0)) { if (Str[Index] >=3D L'a' && Str[Index] <=3D L'z') { Ptr[Index] =3D (CHAR8)(Str[Index] - (L'a' - L'A')); } else { @@ -369,16 +379,16 @@ AcpiView ( ); return EFI_NOT_FOUND; } =20 ReportOption =3D GetReportOption (); - if (EREPORT_TABLE_LIST !=3D ReportOption) { - if (((EREPORT_SELECTED =3D=3D ReportOption) || - (EREPORT_DUMP_BIN_FILE =3D=3D ReportOption)) && + if (ReportTableList !=3D ReportOption) { + if (((ReportSelected =3D=3D ReportOption) || + (ReportDumpBinFile =3D=3D ReportOption)) && (!mSelectedAcpiTableFound)) { Print (L"\nRequested ACPI Table not found.\n"); - } else if (EREPORT_DUMP_BIN_FILE !=3D ReportOption) { + } else if (ReportDumpBinFile !=3D ReportOption) { OriginalAttribute =3D gST->ConOut->Mode->Attribute; =20 Print (L"\nTable Statistics:\n"); =20 if (GetColourHighlighting ()) { @@ -424,27 +434,31 @@ ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE* SystemTable ) { EFI_STATUS Status; - SHELL_STATUS ShellStatus =3D SHELL_SUCCESS; - LIST_ENTRY* Package =3D NULL; + SHELL_STATUS ShellStatus; + LIST_ENTRY* Package; CHAR16* ProblemParam; CONST CHAR16* Temp; CHAR8 ColourOption[8]; - SHELL_FILE_HANDLE TmpDumpFileHandle =3D NULL; + SHELL_FILE_HANDLE TmpDumpFileHandle; =20 // Set Defaults - mReportType =3D EREPORT_ALL; + mReportType =3D ReportAll; mTableCount =3D 0; mBinTableCount =3D 0; mSelectedAcpiTable =3D 0; mSelectedAcpiTableName =3D NULL; mSelectedAcpiTableFound =3D FALSE; mVerbose =3D TRUE; mConsistencyCheck =3D TRUE; =20 + ShellStatus =3D SHELL_SUCCESS; + Package =3D NULL; + TmpDumpFileHandle =3D NULL; + // Reset The error/warning counters ResetErrorCount (); ResetWarningCount (); =20 Status =3D ShellCommandLineParse (ParamList, &Package, &ProblemParam, TR= UE); @@ -545,23 +559,23 @@ ShellCommandRunAcpiView ( SetColourHighlighting (FALSE); } } =20 if (ShellCommandLineGetFlag (Package, L"-l")) { - mReportType =3D EREPORT_TABLE_LIST; + mReportType =3D ReportTableList; } else { mSelectedAcpiTableName =3D ShellCommandLineGetValue (Package, L"-s= "); if (mSelectedAcpiTableName !=3D NULL) { mSelectedAcpiTable =3D (UINT32)ConvertStrToAcpiSignature ( mSelectedAcpiTableName ); - mReportType =3D EREPORT_SELECTED; + mReportType =3D ReportSelected; =20 if (ShellCommandLineGetFlag (Package, L"-d")) { // Create a temporary file to check if the media is writable. CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - mReportType =3D EREPORT_DUMP_BIN_FILE; + mReportType =3D ReportDumpBinFile; =20 UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.tmp", diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index b035395a721..615686dde83 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -31,15 +31,15 @@ =20 /** The EREPORT_OPTION enum describes ACPI table Reporting options. **/ typedef enum ReportOption { - EREPORT_ALL, ///< Report All tables. - EREPORT_SELECTED, ///< Report Selected table. - EREPORT_TABLE_LIST, ///< Report List of tables. - EREPORT_DUMP_BIN_FILE, ///< Dump selected table to a file. - EREPORT_MAX + ReportAll, ///< Report All tables. + ReportSelected, ///< Report Selected table. + ReportTableList, ///< Report List of tables. + ReportDumpBinFile, ///< Dump selected table to a file. + ReportMax, } EREPORT_OPTION; =20 /** This function resets the ACPI table error counter to Zero. **/ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Pa= rser.c index 7f66bce074e..bc8b7b00e38 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -110,11 +110,14 @@ EFIAPI ValidateNameSpaceStrLen ( IN UINT8* Ptr, IN VOID* Context ) { - UINT16 NameSpaceStrLen =3D *(UINT16*)Ptr; + UINT16 NameSpaceStrLen; + + NameSpaceStrLen =3D *(UINT16*)Ptr; + if (NameSpaceStrLen < 2) { IncrementErrorCount (); Print ( L"\nERROR: NamespaceString Length =3D %d. If no Namespace device exi= sts,\n" " then NamespaceString[] must contain a period '.'", diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/Gtdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPa= rser.c index 30cf3e14f7e..3a3cee948ad 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -136,11 +136,14 @@ EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, IN VOID* Context ) { - UINT32 BlockTimerCount =3D *(UINT32*)Ptr; + UINT32 BlockTimerCount; + + BlockTimerCount =3D *(UINT32*)Ptr; + if (BlockTimerCount > 8) { IncrementErrorCount (); Print ( L"\nERROR: Timer Count =3D %d. Max Timer Count is 8.", BlockTimerCount diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/Iort= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPa= rser.c index 704dfc407cc..fb0abe3c43b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -25,17 +25,17 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; =20 /** The EIORT_NODE enum describes the IORT Node types. **/ typedef enum IortNode { - EIORT_NODE_ITS_GROUP, ///< ITS Group node - EIORT_NODE_NAMED_COMPONENT, ///< Named Component node - EIORT_NODE_ROOT_COMPLEX, ///< Root Complex node - EIORT_NODE_SMMUV1_V2, ///< SMMU v1/v2 node - EIORT_NODE_SMMUV3, ///< SMMU v3 node - EIORT_NODE_PMCG, ///< PMC group node - EIORT_NODE_MAX + Iort_Node_ITS_Group, ///< ITS Group node + Iort_Node_Named_Component, ///< Named Component node + Iort_Node_Root_Complex, ///< Root Complex node + Iort_Node_SMMUV1_V2, ///< SMMU v1/v2 node + Iort_Node_SMMUV3, ///< SMMU v3 node + Iort_Node_PMCG, ///< PMC group node + Iort_Node_Max } EIORT_NODE; =20 // Local Variables STATIC CONST UINT32* IortNodeCount; STATIC CONST UINT32* IortNodeOffset; @@ -663,49 +663,49 @@ ParseAcpiIort ( =20 PrintFieldName (2, L"* Node Offset *"); Print (L"0x%x\n", Offset); =20 switch (*IortNodeType) { - case EIORT_NODE_ITS_GROUP: + case Iort_Node_ITS_Group: DumpIortNodeIts ( NodePtr, *IortNodeLength ); break; - case EIORT_NODE_NAMED_COMPONENT: + case Iort_Node_Named_Component: DumpIortNodeNamedComponent ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_ROOT_COMPLEX: + case Iort_Node_Root_Complex: DumpIortNodeRootComplex ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_SMMUV1_V2: + case Iort_Node_SMMUV1_V2: DumpIortNodeSmmuV1V2 ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_SMMUV3: + case Iort_Node_SMMUV3: DumpIortNodeSmmuV3 ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_PMCG: + case Iort_Node_PMCG: DumpIortNodePmcg ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/Madt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPa= rser.c index 3ac27086a6b..a704b0c6314 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -195,11 +195,13 @@ ParseAcpiMadt ( IN UINT8 AcpiTableRevision ) { UINT32 Offset; UINT8* InterruptContollerPtr; - UINT32 GICDCount =3D 0; + UINT32 GICDCount; + + GICDCount =3D 0; =20 if (!Trace) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/Rsdp= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpPa= rser.c index c33bb1e9234..164cd462022 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -86,11 +86,14 @@ ValidateRsdtAddress ( // Reference: Server Base Boot Requirements System Software on ARM Platf= orms // Section: 4.2.1.1 RSDP // Root System Description Pointer (RSDP), ACPI ? 5.2.5. // - Within the RSDP, the RsdtAddress field must be null (zero) and the // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT32 RsdtAddr =3D *(UINT32*)Ptr; + UINT32 RsdtAddr; + + RsdtAddr =3D *(UINT32*)Ptr; + if (RsdtAddr !=3D 0) { IncrementErrorCount (); Print ( L"\nERROR: Rsdt Address =3D 0x%p. This must be NULL on ARM Platforms= .", RsdtAddr @@ -118,11 +121,14 @@ ValidateXsdtAddress ( // Reference: Server Base Boot Requirements System Software on ARM Platf= orms // Section: 4.2.1.1 RSDP // Root System Description Pointer (RSDP), ACPI ? 5.2.5. // - Within the RSDP, the RsdtAddress field must be null (zero) and the // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT64 XsdtAddr =3D *(UINT64*)Ptr; + UINT64 XsdtAddr; + + XsdtAddr =3D *(UINT64*)Ptr; + if (XsdtAddr =3D=3D 0) { IncrementErrorCount (); Print ( L"\nERROR: Xsdt Address =3D 0x%p. This must not be NULL on ARM Platf= orms.", XsdtAddr diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/Slit= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitPa= rser.c index a028ae541ca..c38666d2b7f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -61,12 +61,12 @@ ParseAcpiSlit ( IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { UINT32 Offset; - UINT64 i; - UINT64 j; + UINT64 Count; + UINT64 Index; UINT64 LocalityCount; UINT8* LocalityPtr; CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi =20 if (!Trace) { @@ -96,50 +96,50 @@ ParseAcpiSlit ( LocalityCount ); PrintFieldName (0, Buffer); Print (L"\n"); Print (L" "); - for (j =3D 0; j < LocalityCount; j++) { - Print (L" (%3d) ", j); + for (Index =3D 0; Index < LocalityCount; Index++) { + Print (L" (%3d) ", Index); } Print (L"\n"); - for (i =3D 0; i < LocalityCount; i++) { - Print (L" (%3d) ", i); - for (j =3D 0; j < LocalityCount; j++) { - Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, i, j)); + for (Count =3D 0; Count< LocalityCount; Count++) { + Print (L" (%3d) ", Count); + for (Index =3D 0; Index < LocalityCount; Index++) { + Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index)); } Print (L"\n"); } } =20 // Validate - for (i =3D 0; i < LocalityCount; i++) { - for (j =3D 0; j < LocalityCount; j++) { + for (Count =3D 0; Count < LocalityCount; Count++) { + for (Index =3D 0; Index < LocalityCount; Index++) { // Element[x][x] must be equal to 10 - if ((i =3D=3D j) && (SLIT_ELEMENT (LocalityPtr, i, j) !=3D 10)) { + if ((Count =3D=3D Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index)= !=3D 10)) { IncrementErrorCount (); Print ( L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)." " Normalized Value is not 10\n", - i, - j, - SLIT_ELEMENT (LocalityPtr, i, j) + Count, + Index, + SLIT_ELEMENT (LocalityPtr, Count, Index) ); } // Element[i][j] must be equal to Element[j][i] - if (SLIT_ELEMENT (LocalityPtr, i, j) !=3D - SLIT_ELEMENT (LocalityPtr, j, i)) { + if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=3D + SLIT_ELEMENT (LocalityPtr, Index, Count)) { IncrementErrorCount (); Print ( L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and = \n" "Element[0x%lx][0x%lx] (%3d) do not match.\n", - i, - j, - SLIT_ELEMENT (LocalityPtr, i, j), - j, - i, - SLIT_ELEMENT (LocalityPtr, j, i) + Count, + Index, + SLIT_ELEMENT (LocalityPtr, Count, Index), + Index, + Count, + SLIT_ELEMENT (LocalityPtr, Index, Count) ); } } } } diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/Spcr= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrPa= rser.c index 64340886fe5..815ba9a9db0 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -96,11 +96,14 @@ ValidateInterruptType ( IN UINT8* Ptr, IN VOID* Context ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 InterruptType =3D *Ptr; + UINT8 InterruptType; + + InterruptType =3D *Ptr; + if (InterruptType !=3D EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC)= { IncrementErrorCount (); Print ( L"\nERROR: InterruptType =3D %d. This must be 8 on ARM Platforms", @@ -124,11 +127,14 @@ ValidateIrq ( IN UINT8* Ptr, IN VOID* Context ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 Irq =3D *Ptr; + UINT8 Irq; + + Irq =3D *Ptr; + if (Irq !=3D 0) { IncrementErrorCount (); Print ( L"\nERROR: Irq =3D %d. This must be zero on ARM Platforms\n", Irq diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Srat= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPa= rser.c index fbe943d898a..043277aabf8 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -175,11 +175,14 @@ VOID DumpSratApicProximity ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { - UINT32 ProximityDomain =3D Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); + UINT32 ProximityDomain; + + ProximityDomain =3D Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); + Print (Format, ProximityDomain); } =20 /** This function parses the ACPI SRAT table. @@ -208,17 +211,23 @@ ParseAcpiSrat ( IN UINT8 AcpiTableRevision ) { UINT32 Offset; UINT8* ResourcePtr; - UINT32 GicCAffinityIndex =3D 0; - UINT32 GicITSAffinityIndex =3D 0; - UINT32 MemoryAffinityIndex =3D 0; - UINT32 ApicSapicAffinityIndex =3D 0; - UINT32 X2ApicAffinityIndex =3D 0; + UINT32 GicCAffinityIndex; + UINT32 GicITSAffinityIndex; + UINT32 MemoryAffinityIndex; + UINT32 ApicSapicAffinityIndex; + UINT32 X2ApicAffinityIndex; CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi =20 + GicCAffinityIndex =3D 0; + GicITSAffinityIndex =3D 0; + MemoryAffinityIndex =3D 0; + ApicSapicAffinityIndex =3D 0; + X2ApicAffinityIndex =3D 0; + if (!Trace) { return; } =20 Offset =3D ParseAcpi ( diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index 8479bfbc9be..c2f40009eeb 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -62,11 +62,14 @@ ACPI_TABLE_PARSER ParserList[] =3D { EFI_STATUS RegisterAllParsers ( ) { EFI_STATUS Status; - UINTN Count =3D sizeof (ParserList) / sizeof (ParserList[0]); + UINTN Count; + + Count =3D sizeof (ParserList) / sizeof (ParserList[0]); + while (Count-- !=3D 0) { Status =3D RegisterParser ( ParserList[Count].Signature, ParserList[Count].Parser ); diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf index dbdb7e301b4..6df8c08b855 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf @@ -25,10 +25,13 @@ =20 [Sources.common] UefiShellAcpiViewCommandLib.uni UefiShellAcpiViewCommandLib.c UefiShellAcpiViewCommandLib.h + AcpiParser.h + AcpiTableParser.h + AcpiView.h AcpiParser.c AcpiTableParser.c AcpiView.c Parsers/Bgrt/BgrtParser.c Parsers/Dbg2/Dbg2Parser.c --=20 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel