From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 E6F082112DF68 for ; Tue, 5 Jun 2018 19:42:12 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2018 19:42:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,481,1520924400"; d="scan'208";a="55082710" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by FMSMGA003.fm.intel.com with ESMTP; 05 Jun 2018 19:42:11 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 5 Jun 2018 19:42:11 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 5 Jun 2018 19:42:11 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.223]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.87]) with mapi id 14.03.0319.002; Wed, 6 Jun 2018 10:42:08 +0800 From: "Bi, Dandan" To: 'Alexei Fedorov' , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" , "Ni, Ruiyu" Thread-Topic: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues Thread-Index: AQHT/KguB5uk7Sl7ak6e6y3I1GlagqRQ22QAgADaHSA= Date: Wed, 6 Jun 2018 02:42:07 +0000 Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB3BB28535@shsmsx102.ccr.corp.intel.com> References: <20180605083348.81864-1-dandan.bi@intel.com>, <20180605083348.81864-3-dandan.bi@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTBiYTQxMjQtMTU4ZS00OWYyLWJkNzgtNzE1NzVmMThiYjNkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNFpLaFNMcnBYbUszeVwvODJka1lwS1RIVG1nSEw4N2hUR3hMV2QrXC91cjgzd2pXZWNNeE1HSnVERjlRejRDcldKIn0= x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch 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: , X-List-Received-Date: Wed, 06 Jun 2018 02:42:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Alexei, Current in the Edk2 implementation, the guard macros in the include header = files start with underscore and end with underscore. And the number of und= erscore usually used here is one or two. And the check tool (ECC) also follow above rule to do the check. So it will= report error for the ACPIPARSER_H_=20 So do you agree to keep the changes in the patch or update it to_ ACPIPARSE= R_H_ for alignment consideration firstly? Then there is another topic, we need to make the Check Tool align with CSS,= we may enhance the check tool or update the Spec. Thanks, Dandan -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Alex= ei Fedorov Sent: Tuesday, June 05, 2018 5:13 PM To: Bi, Dandan ; edk2-devel@lists.01.org Cc: Carsey, Jaben ; Ni, Ruiyu Subject: Re: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix E= CC issues Hi Dandan Bi, Your patch contains a number of modifications like the one below: -#ifndef ACPIPARSER_H_ -#define ACPIPARSER_H_ +#ifndef __ACPIPARSER_H__ +#define __ACPIPARSER_H__ which violate CCS "3.3.2 Include Files" "4.3.5.4 The names of guard macros shall end with an underscore character." and the given examples. Alexei ________________________________ From: edk2-devel on behalf of Dandan Bi <= dandan.bi@intel.com> Sent: 05 June 2018 09:33 To: edk2-devel@lists.01.org Cc: Jaben Carsey; Ruiyu Ni Subject: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC i= ssues 1. Separate variable definition and initialization. 2. Make the variable naming following Edk2 rule. Naming convention of local variable: a.First character should be upper case. b.Must contain lower case characters. c.No white space characters. Cc: Sami Mujawar Cc: Evan Lloyd 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/AcpiParser.h | 6 +-- .../UefiShellAcpiViewCommandLib/AcpiTableParser.c | 50 +++++++++---------= - .../UefiShellAcpiViewCommandLib/AcpiTableParser.h | 6 +-- .../Library= /UefiShellAcpiViewCommandLib/AcpiView.c | 58 ++++++++++++++-------- .../Li= brary/UefiShellAcpiViewCommandLib/AcpiView.h | 16 +++--- .../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.h | 6 +-- .../UefiShellAcpiViewCommandLib.inf | 3 ++ 17 files changed, 190 insertions(+), 129 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 @@ STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount; STATIC UINT32 mTableWarningCount; +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; + ByteCount =3D 0; + Checksum =3D 0; + while (ByteCount < Length) { Checksum +=3D *(Ptr++); ByteCount++; } @@ -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]; + ByteCount =3D 0; + AsciiBufferIndex =3D 0; + Print (L"Address : 0x%p\n", Ptr); Print (L"Length : %d\n", Length); 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; 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; // Increment the Indent gIndent +=3D Indent; if (Trace && (AsciiName !=3D NULL)){ - BOOLEAN HighLight =3D GetColourHighlighting (); + HighLight =3D GetColourHighlighting (); UINTN OriginalAttribute; 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) - }; BytesParsed =3D ParseAcpi ( FALSE, 0, NULL, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index ecf7dae9038..cea8857bc08 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -9,12 +9,12 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. **/ -#ifndef ACPIPARSER_H_ -#define ACPIPARSER_H_ +#ifndef __ACPIPARSER_H__ +#define __ACPIPARSER_H__ #define OUTPUT_FIELD_COLUMN_WIDTH 36 /// The RSDP table signature is "RSD PTR " (8 bytes) /// However The sign= ature for ACPI tables is 4 bytes. @@ -789,6 +789,6 @@ ParseAcpiXsdt ( IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -#endif // ACPIPARSER_H_ +#endif // __ACPIPARSER_H__ 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; if ((ParserProc =3D=3D NULL) || (Signature =3D=3D ACPI_PARSER_SIGNATURE_= NULL)) { return EFI_INVALID_PARAMETER; } // 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; } } } // 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; } } // No free slot found @@ -94,23 +94,23 @@ EFI_STATUS EFIAPI DeregisterParser ( IN UINT32 Signature ) { - UINT32 index; + UINT32 Index; if (Signature =3D=3D ACPI_PARSER_SIGNATURE_NULL) { return EFI_INVALID_PARAMETER; } - 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; } } // No matching registered parser found. @@ -135,22 +135,22 @@ EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc ) { - UINT32 index; + UINT32 Index; if ((ParserProc =3D=3D NULL) || (Signature =3D=3D ACPI_PARSER_SIGNATURE_= NULL)) { return EFI_INVALID_PARAMETER; } - 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; } } // No matching registered parser found. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h= b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h index ca33b935760..5a6c4df12f3 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h @@ -9,12 +9,12 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. **/ -#ifndef ACPITABLEPARSER_H_ -#define ACPITABLEPARSER_H_ +#ifndef __ACPITABLEPARSER_H__ +#define __ACPITABLEPARSER_H__ /** The maximum number of ACPI table parsers. */ #define MAX_ACPI_TABLE_PARSERS 16 @@ -128,6 +128,6 @@ EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc ); -#endif // ACPITABLEPARSER_H_ +#endif // __ACPITABLEPARSER_H__ 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; 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=20 + 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 @@ -271,13 +279,15 @@ STATIC UINT32 ConvertStrToAcpiSignature ( IN CONST CHAR16* Str ) { - UINT8 Index =3D 0; + UINT8 Index; CHAR8 Ptr[4]; + 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; } 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; Print (L"\nTable Statistics:\n"); 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; // 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; + ShellStatus =3D SHELL_SUCCESS; + Package =3D NULL; + TmpDumpFileHandle =3D NULL; + // Reset The error/warning counters ResetErrorCount (); ResetWarningCount (); Status =3D ShellCommandLineParse (ParamList, &Package, &ProblemParam, TR= UE); @@ -545,23 +559,23 @@ ShellCommandRunAcpiView ( SetColourHighlighting (FALSE); } } 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; 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; 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..4e7ac93ca03 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -9,12 +9,12 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. **/ -#ifndef ACPIVIEW_H_ -#define ACPIVIEW_H_ +#ifndef __ACPIVIEW_H__ +#define __ACPIVIEW_H__ /** A macro to define the max file name length **/ #define MAX_FILE_NAME_LEN 128 @@ -31,15 +31,15 @@ /** 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; /** This function resets the ACPI table error counter to Zero. **/ @@ -111,6 +111,6 @@ ProcessTableReportOptions ( IN CONST UINT32 Signature, IN CONST UINT8* TablePtr, IN CONST UINT32 Length ); -#endif // ACPIVIEW_H_ +#endif // __ACPIVIEW_H__ 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/Dbg2Pars +++ er.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/GtdtPars +++ er.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/IortPars +++ er.c @@ -25,17 +25,17 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; /** 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; // Local Variables STATIC CONST UINT32* IortNodeCount; STATIC CONST UINT32* IortNodeOffset; @@ -663,49 +663,49 @@ ParseAcpiIort ( PrintFieldName (2, L"* Node Offset *"); Print (L"0x%x\n", Offset); 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/MadtPars +++ er.c @@ -195,11 +195,13 @@ ParseAcpiMadt ( IN UINT8 AcpiTableRevision ) { UINT32 Offset; UINT8* InterruptContollerPtr; - UINT32 GICDCount =3D 0; + UINT32 GICDCount; + + GICDCount =3D 0; if (!Trace) { return; } 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/RsdpPars +++ er.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 th= e // 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 th= e // 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/SlitPars +++ er.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 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"); } } // 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)= =20 + !=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/SpcrPars +++ er.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/SratPars +++ er.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); } /** 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 + GicCAffinityIndex =3D 0; + GicITSAffinityIndex =3D 0; + MemoryAffinityIndex =3D 0; + ApicSapicAffinityIndex =3D 0; + X2ApicAffinityIndex =3D 0; + if (!Trace) { return; } 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/UefiShellAcpiViewComm +++ andLib.c @@ -62,11 +62,14 @@ ACPI_TABLE_PARSER ParserList[] =3D { EFI_STATUS Regis= terAllParsers ( ) { 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.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.h index f547569cf37..4ea958b80e7 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm +++ andLib.h @@ -9,12 +9,12 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. **/ -#ifndef UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ -#define UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ +#ifndef __UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H__ +#define __UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H__ extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; /** Function for 'acpiview' command. @@ -27,6 +27,6 @@ EFIAPI ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); -#endif // UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ +#endif // __UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H__ 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/UefiShellAcpiViewComm +++ andLib.inf @@ -25,10 +25,13 @@ [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 -- 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel