From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web12.5118.1594361722099108713 for ; Thu, 09 Jul 2020 23:15:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=N2piFuKe; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: zhichao.gao@intel.com) IronPort-SDR: 1EAOocbO8KXmdnvuy+RyvCxHJxVk5aqCfFa4K/W+PpEy/e5nPuLJM4dOpLu2aMWLSX9eKObQss rXNQlxyJkfUA== X-IronPort-AV: E=McAfee;i="6000,8403,9677"; a="127748935" X-IronPort-AV: E=Sophos;i="5.75,334,1589266800"; d="scan'208";a="127748935" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2020 23:15:21 -0700 IronPort-SDR: JRMwaX0Ssbvec3L85ZgG1xxKejVbFBdhXNxBRzXX5W9R7ui/4BNSuyjpTQqKJuD4qCYxm1MBYE cm1dK41v/Tiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,334,1589266800"; d="scan'208";a="267632785" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga007.fm.intel.com with ESMTP; 09 Jul 2020 23:15:21 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 9 Jul 2020 23:15:21 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 9 Jul 2020 23:15:20 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.109) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 9 Jul 2020 23:15:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YDq5BeXgiYTBqZ0tPMXJiG9BA9LlgToLYvqCU+kwI8j1iVe+5t4n/U7//RWNgOUrmYUMz5k/86zwlAKK8Lz6P8oFASdHgb7DG4LvM0VQQGeewo1QWMWsyE49GkZOnMdG9e+BbJaLdUe6wORWhfmN7TNlm7t5mIbhnrRL2LSNEGEpPKTZJPaY5/cmpU/VlSob0bKA4erCg3FNjPlI0wpH+YuxkU3tVWN57Y0xsZMYqDgr1KYS60H77thxIwQVt26exdOgeBHgyqtZjquQvE+gQvb/0aCr8kAWmWo24w9jrymhmfijcH8ZsQ+m+4PqwE/8so4Nc2qcWZPQ1iGwi6X73w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gURvdhm9b5hWBjEX+OQrQR8XjbUY/mpC8YfjOUjzJHw=; b=fqf2W4wufFBXsQ02VaMQUhv2uT8U/ioFQiT4wGwUtSIzxMP1n0t0cd/qupqKw78Wqa34Du8OMERPgHJGzJ9eU2Ft7kEb9aC43Blw1DzFgLwkVQXH2F5PRV+X2VFTPoqJI3fsw2676lLR2Bx2R6KHwunU7cWVz7WbRBzT9yivhspWRyZzNpyMMWZv5U1IZJ3kaMD+HxOZY3tlHKRi0VUvwDRGVx3Y4JmeZt9UbCuO0jbVTGcokmcL/eYiFkGQr1hmWoskJzC5gR+1S7NGngqS88+qnLUTR7EUMbY9s6gZtGeIQXPkwIykY//noa5+KApYNNgg6B628yhUobhHaSGeEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gURvdhm9b5hWBjEX+OQrQR8XjbUY/mpC8YfjOUjzJHw=; b=N2piFuKefISYKJlH7/pJGZgu3cJPIwB2BvGkPAO4GSLWiZIAsMhMKI+jhbbRHQKelznWFrqcreQradsycMIt8L6LOGEeAaBC+TolGSEWKgpoNMhpKh6lMhDMhV+QTTf4qGNVTMVX8flyKWhcdSgThokUixWBay+l9jjpLCzBA3w= Received: from DM6PR11MB4425.namprd11.prod.outlook.com (2603:10b6:5:1d9::31) by DM6PR11MB3306.namprd11.prod.outlook.com (2603:10b6:5:5c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.20; Fri, 10 Jul 2020 06:15:19 +0000 Received: from DM6PR11MB4425.namprd11.prod.outlook.com ([fe80::ad34:e1fc:2e7b:d124]) by DM6PR11MB4425.namprd11.prod.outlook.com ([fe80::ad34:e1fc:2e7b:d124%3]) with mapi id 15.20.3174.023; Fri, 10 Jul 2020 06:15:19 +0000 From: "Gao, Zhichao" To: Tomas Pilar , "devel@edk2.groups.io" CC: "Sami.Mujawar@arm.com" , "nd@arm.com" , "Ni, Ray" Subject: Re: [PATCH 1/8] ShellPkg/AcpiView: Extract configuration struct Thread-Topic: [PATCH 1/8] ShellPkg/AcpiView: Extract configuration struct Thread-Index: AQHWTijnXoeF6mw4nka+ov9G9YGnm6j7XCBA Date: Fri, 10 Jul 2020 06:15:19 +0000 Message-ID: References: <20200629152008.685-1-Tomas.Pilar@arm.com> <20200629152008.685-2-Tomas.Pilar@arm.com> In-Reply-To: <20200629152008.685-2-Tomas.Pilar@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0c7d92aa-668e-4a47-f12c-08d824989eeb x-ms-traffictypediagnostic: DM6PR11MB3306: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KRjWWMkQ7pvy5UJdxGBqVFM1nD8Yxe5+qnMINm8miupV2TFh4P/ZsCYM5g+yNqvlB+SSPXUojNHp0fY5+LfjycDmIKPYWGlanGtBy1ldjzyFRztMSO/81PyWtwbeCOx6xg1tl5BPPfQV2DEy/C3C8mXAPaB5pYEgwrE69pcq+Bi2sDWSak0zHzmB6aoLSM1WaKHQ5N2gnfwF7iPd61OgljJAiwdBpPkJ+kBfyF3J2w29fo6A2WCkRLBqPMp4tCHRN5k+r/yWGYE5e9jzEHRn7sQe/fl8b3/GPh7QFLLGQGX9Zb51lxX6pk4+KKeYMuUK x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4425.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(366004)(39860400002)(376002)(346002)(136003)(54906003)(33656002)(2906002)(6506007)(53546011)(86362001)(4326008)(26005)(186003)(8936002)(8676002)(66476007)(66946007)(76116006)(7696005)(66556008)(66446008)(5660300002)(110136005)(64756008)(55016002)(9686003)(30864003)(83380400001)(316002)(71200400001)(107886003)(52536014)(478600001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: qbvDArKGBHj2nA9u7F8SrPVd7W8m4qQi3P+3VVForQWtv/kWj+v7Joco8IQ9LkUH875ohCt3rDCFCuABZ5j/Rr/T2B33jRJxoyS4OWx9wPLxBtFjJLMwuEM7r+PlKMrPUFxEgCvTUaRoyClCtfjRdayEOx4by5yfGETrbrsi4eMFkmfXuX0dx1u+ZtuaBJAMgLS0KHSkEO1F1VH8cqnBc4C59OqtA+GnKowKoOZudMcyVbAixpR+jMCBgarefy47knc1BjoGNahSQ4vMXAid8vAU5+DOxqT8zITXmde0AHGklZdCq0GA2xFej5ezjG7XIy+82XEvODyZw5CinI9/AjSC/vcQW7bgSasxjwlMPWFduPupctmubWE9gbtxlTyXHVEF2VEcBhD92bP1ix/IjrqHZ0CKj2zjsCXqVgBs9n46sTMBX/BWjBFgjdOIdabKU8qeU2TMD05nu/qcFdWmUL2g5KvqsrfF3OCgqwzPOy/kLUGLzvbqiZZ9ms7PoCjw MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4425.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c7d92aa-668e-4a47-f12c-08d824989eeb X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jul 2020 06:15:19.1867 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: kDXI5xyP3A1qjKh5yoqcAUihSluCRnMIq9MxvnkCE+BvNLwfx+ffbAlRT8UypETEoyyFva5c/L1UIrowG9myGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3306 Return-Path: zhichao.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Tomas Pilar > Sent: Monday, June 29, 2020 11:20 PM > To: devel@edk2.groups.io > Cc: Sami.Mujawar@arm.com; nd@arm.com; Ni, Ray ; Gao, > Zhichao > Subject: [PATCH 1/8] ShellPkg/AcpiView: Extract configuration struct >=20 > Remove accessor method bloat by creating a configuration struct that is l= inked > using an extern symbol in the config header file. Directly reference the = config > struct for all read and write accesses in the entire module. >=20 > Rationalise the remaining methods in the config header and source. >=20 > Cc: Ray Ni > Cc: Zhichao Gao > Signed-off-by: Tomas Pilar > --- > .../UefiShellAcpiViewCommandLib/AcpiParser.c | 18 +- > .../AcpiTableParser.c | 4 +- > .../UefiShellAcpiViewCommandLib/AcpiView.c | 67 +++---- > .../AcpiViewConfig.c | 180 ++---------------- > .../AcpiViewConfig.h | 138 ++------------ > .../UefiShellAcpiViewCommandLib.c | 18 +- > 6 files changed, 71 insertions(+), 354 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c > index 02f6d771c7e1..3a029b01cc20 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c > @@ -137,7 +137,7 @@ VerifyChecksum ( > if (Log) { > OriginalAttribute =3D gST->ConOut->Mode->Attribute; > if (Checksum =3D=3D 0) { > - if (GetColourHighlighting ()) { > + if (mConfig.ColourHighlighting) { > gST->ConOut->SetAttribute ( > gST->ConOut, > EFI_TEXT_ATTR (EFI_GREEN, @@ -147,7 +147,7 @@ > VerifyChecksum ( > Print (L"Table Checksum : OK\n\n"); > } else { > IncrementErrorCount (); > - if (GetColourHighlighting ()) { > + if (mConfig.ColourHighlighting) { > gST->ConOut->SetAttribute ( > gST->ConOut, > EFI_TEXT_ATTR (EFI_RED, @@ -156,7 +156,7 @@ Verif= yChecksum ( > } > Print (L"Table Checksum : FAILED (0x%X)\n\n", Checksum); > } > - if (GetColourHighlighting ()) { > + if (mConfig.ColourHighlighting) { > gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); > } > } > @@ -507,7 +507,6 @@ ParseAcpi ( > { > UINT32 Index; > UINT32 Offset; > - BOOLEAN HighLight; > UINTN OriginalAttribute; >=20 > // > @@ -520,9 +519,8 @@ ParseAcpi ( > gIndent +=3D Indent; >=20 > if (Trace && (AsciiName !=3D NULL)){ > - HighLight =3D GetColourHighlighting (); >=20 > - if (HighLight) { > + if (mConfig.ColourHighlighting) { > OriginalAttribute =3D gST->ConOut->Mode->Attribute; > gST->ConOut->SetAttribute ( > gST->ConOut, > @@ -537,7 +535,7 @@ ParseAcpi ( > (OUTPUT_FIELD_COLUMN_WIDTH - gIndent), > AsciiName > ); > - if (HighLight) { > + if (mConfig.ColourHighlighting) { > gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); > } > } > @@ -555,8 +553,7 @@ ParseAcpi ( > continue; > } >=20 > - if (GetConsistencyChecking () && > - (Offset !=3D Parser[Index].Offset)) { > + if (mConfig.ConsistencyCheck && (Offset !=3D Parser[Index].Offset)) = { > IncrementErrorCount (); > Print ( > L"\nERROR: %a: Offset Mismatch for %s\n" > @@ -599,8 +596,7 @@ ParseAcpi ( >=20 > // Validating only makes sense if we are tracing > // the parsed table entries, to report by table name. > - if (GetConsistencyChecking () && > - (Parser[Index].FieldValidator !=3D NULL)) { > + if (mConfig.ConsistencyCheck && (Parser[Index].FieldValidator > + !=3D NULL)) { > Parser[Index].FieldValidator (Ptr, Parser[Index].Context); > } > } > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser= .c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c > index 4b618f131eac..526cb8cb7cad 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c > @@ -222,13 +222,13 @@ ProcessAcpiTable ( > return; > } >=20 > - if (GetConsistencyChecking ()) { > + if (mConfig.ConsistencyCheck) { > VerifyChecksum (TRUE, Ptr, *AcpiTableLength); > } > } >=20 > #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) > - if (GetMandatoryTableValidate ()) { > + if (mConfig.MandatoryTableValidate) { > ArmSbbrIncrementTableCount (*AcpiTableSignature); > } > #endif > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c > index 9a5b013fb234..d2c14d5b8f5a 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c > @@ -48,15 +48,14 @@ DumpAcpiTableToFile ( { > CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; > UINTN TransferBytes; > - SELECTED_ACPI_TABLE *SelectedTable; >=20 > - GetSelectedAcpiTable (&SelectedTable); > + TransferBytes =3D Length; Why add the useless assignment back? Thanks, Zhichao >=20 > UnicodeSPrint ( > FileNameBuffer, > sizeof (FileNameBuffer), > L".\\%s%04d.bin", > - SelectedTable->Name, > + mSelectedAcpiTable.Name, > mBinTableCount++ > ); >=20 > @@ -82,11 +81,9 @@ ProcessTableReportOptions ( > IN CONST UINT32 Length > ) > { > - UINTN OriginalAttribute; > - UINT8 *SignaturePtr; > - BOOLEAN Log; > - BOOLEAN HighLight; > - SELECTED_ACPI_TABLE *SelectedTable; > + UINTN OriginalAttribute; > + UINT8 *SignaturePtr; > + BOOLEAN Log; >=20 > // > // set local variables to suppress incorrect compiler/analyzer warning= s @@ - > 94,22 +91,20 @@ ProcessTableReportOptions ( > OriginalAttribute =3D 0; > SignaturePtr =3D (UINT8*)(UINTN)&Signature; > Log =3D FALSE; > - HighLight =3D GetColourHighlighting (); > - GetSelectedAcpiTable (&SelectedTable); >=20 > - switch (GetReportOption ()) { > + switch (mConfig.ReportType) { > case ReportAll: > Log =3D TRUE; > break; > case ReportSelected: > - if (Signature =3D=3D SelectedTable->Type) { > + if (Signature =3D=3D mSelectedAcpiTable.Type) { > Log =3D TRUE; > - SelectedTable->Found =3D TRUE; > + mSelectedAcpiTable.Found =3D TRUE; > } > break; > case ReportTableList: > if (mTableCount =3D=3D 0) { > - if (HighLight) { > + if (mConfig.ColourHighlighting) { > OriginalAttribute =3D gST->ConOut->Mode->Attribute; > gST->ConOut->SetAttribute ( > gST->ConOut, > @@ -118,7 +113,7 @@ ProcessTableReportOptions ( > ); > } > Print (L"\nInstalled Table(s):\n"); > - if (HighLight) { > + if (mConfig.ColourHighlighting) { > gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); > } > } > @@ -132,8 +127,8 @@ ProcessTableReportOptions ( > ); > break; > case ReportDumpBinFile: > - if (Signature =3D=3D SelectedTable->Type) { > - SelectedTable->Found =3D TRUE; > + if (Signature =3D=3D mSelectedAcpiTable.Type) { > + mSelectedAcpiTable.Found =3D TRUE; > DumpAcpiTableToFile (TablePtr, Length); > } > break; > @@ -144,7 +139,7 @@ ProcessTableReportOptions ( > } // switch >=20 > if (Log) { > - if (HighLight) { > + if (mConfig.ColourHighlighting) { > OriginalAttribute =3D gST->ConOut->Mode->Attribute; > gST->ConOut->SetAttribute ( > gST->ConOut, > @@ -159,7 +154,7 @@ ProcessTableReportOptions ( > SignaturePtr[2], > SignaturePtr[3] > ); > - if (HighLight) { > + if (mConfig.ColourHighlighting) { > gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); > } > } > @@ -191,18 +186,12 @@ AcpiView ( > BOOLEAN FoundAcpiTable; > UINTN OriginalAttribute; > UINTN PrintAttribute; > - EREPORT_OPTION ReportOption; > UINT8* RsdpPtr; > UINT32 RsdpLength; > UINT8 RsdpRevision; > PARSE_ACPI_TABLE_PROC RsdpParserProc; > BOOLEAN Trace; > - SELECTED_ACPI_TABLE *SelectedTable; >=20 > - // > - // set local variables to suppress incorrect compiler/analyzer warning= s > - // > - EfiConfigurationTable =3D NULL; > OriginalAttribute =3D 0; >=20 > // Reset Table counts > @@ -213,9 +202,6 @@ AcpiView ( > ResetErrorCount (); > ResetWarningCount (); >=20 > - // Retrieve the user selection of ACPI table to process > - GetSelectedAcpiTable (&SelectedTable); > - > // Search the table for an entry that matches the ACPI Table Guid > FoundAcpiTable =3D FALSE; > for (Index =3D 0; Index < SystemTable->NumberOfTableEntries; Index++) = { @@ - > 241,7 +227,7 @@ AcpiView ( > } >=20 > #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) > - if (GetMandatoryTableValidate ()) { > + if (mConfig.MandatoryTableValidate) { > ArmSbbrResetTableCounts (); > } > #endif > @@ -275,24 +261,23 @@ AcpiView ( > } >=20 > #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) > - if (GetMandatoryTableValidate ()) { > - ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ()); > + if (mConfig.MandatoryTableValidate) { > + ArmSbbrReqsValidate ((ARM_SBBR_VERSION) > + mConfig.MandatoryTableSpec); > } > #endif >=20 > - ReportOption =3D GetReportOption (); > - if (ReportTableList !=3D ReportOption) { > - if (((ReportSelected =3D=3D ReportOption) || > - (ReportDumpBinFile =3D=3D ReportOption)) && > - (!SelectedTable->Found)) { > + if (ReportTableList !=3D mConfig.ReportType) { > + if (((ReportSelected =3D=3D mConfig.ReportType) || > + (ReportDumpBinFile =3D=3D mConfig.ReportType)) && > + (!mSelectedAcpiTable.Found)) { > Print (L"\nRequested ACPI Table not found.\n"); > - } else if (GetConsistencyChecking () && > - (ReportDumpBinFile !=3D ReportOption)) { > + } else if (mConfig.ConsistencyCheck && > + (ReportDumpBinFile !=3D mConfig.ReportType)) { > OriginalAttribute =3D gST->ConOut->Mode->Attribute; >=20 > Print (L"\nTable Statistics:\n"); >=20 > - if (GetColourHighlighting ()) { > + if (mConfig.ColourHighlighting) { > PrintAttribute =3D (GetErrorCount () > 0) ? > EFI_TEXT_ATTR ( > EFI_RED, > @@ -303,7 +288,7 @@ AcpiView ( > } > Print (L"\t%d Error(s)\n", GetErrorCount ()); >=20 > - if (GetColourHighlighting ()) { > + if (mConfig.ColourHighlighting) { > PrintAttribute =3D (GetWarningCount () > 0) ? > EFI_TEXT_ATTR ( > EFI_RED, > @@ -315,7 +300,7 @@ AcpiView ( > } > Print (L"\t%d Warning(s)\n", GetWarningCount ()); >=20 > - if (GetColourHighlighting ()) { > + if (mConfig.ColourHighlighting) { > gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); > } > } > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.= c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c > index 759a915928c7..a0a392085355 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c > @@ -10,12 +10,8 @@ >=20 > #include "AcpiViewConfig.h" >=20 > -// Report variables > -STATIC BOOLEAN mConsistencyCheck; > -STATIC BOOLEAN mColourHighlighting; > -STATIC EREPORT_OPTION mReportType; > -STATIC BOOLEAN mMandatoryTableValidate; > -STATIC UINTN mMandatoryTableSpec; > +// Main configuration structure > +ACPI_VIEW_CONFIG mConfig; >=20 > // User selection of which ACPI table should be checked SELECTED_ACPI_T= ABLE > mSelectedAcpiTable; @@ -25,17 +21,21 @@ SELECTED_ACPI_TABLE > mSelectedAcpiTable; **/ VOID EFIAPI -AcpiConfigSetDefaults ( > +AcpiViewConfigSetDefaults ( > VOID > ) > { > - mReportType =3D ReportAll; > + // Generic defaults > + mConfig.ReportType =3D ReportAll; > + mConfig.ConsistencyCheck =3D TRUE; > + mConfig.MandatoryTableValidate =3D FALSE; mConfig.MandatoryTableSpec = =3D > + 0; mConfig.ColourHighlighting =3D FALSE; > + > + // Unselect acpi table > mSelectedAcpiTable.Type =3D 0; > mSelectedAcpiTable.Name =3D NULL; > mSelectedAcpiTable.Found =3D FALSE; > - mConsistencyCheck =3D TRUE; > - mMandatoryTableValidate =3D FALSE; > - mMandatoryTableSpec =3D 0; > } >=20 > /** > @@ -79,7 +79,7 @@ ConvertStrToAcpiSignature ( **/ VOID EFIAPI - > SelectAcpiTable ( > +AcpiViewConfigSelectTable ( > IN CONST CHAR16 *TableName > ) > { > @@ -88,159 +88,3 @@ SelectAcpiTable ( > mSelectedAcpiTable.Name =3D TableName; > mSelectedAcpiTable.Type =3D ConvertStrToAcpiSignature > (mSelectedAcpiTable.Name); } > - > -/** > - This function returns the selected ACPI table. > - > - @param [out] SelectedAcpiTable Pointer that will contain the returned = struct. > -**/ > -VOID > -EFIAPI > -GetSelectedAcpiTable ( > - OUT SELECTED_ACPI_TABLE **SelectedAcpiTable > - ) > -{ > - *SelectedAcpiTable =3D &mSelectedAcpiTable; -} > - > -/** > - This function returns the colour highlighting status. > - > - @retval TRUE Colour highlighting is enabled. > -**/ > -BOOLEAN > -EFIAPI > -GetColourHighlighting ( > - VOID > - ) > -{ > - return mColourHighlighting; > -} > - > -/** > - This function sets the colour highlighting status. > - > - @param [in] Highlight The highlight status. > -**/ > -VOID > -EFIAPI > -SetColourHighlighting ( > - BOOLEAN Highlight > - ) > -{ > - mColourHighlighting =3D Highlight; > -} > - > -/** > - This function returns the consistency checking status. > - > - @retval TRUE Consistency checking is enabled. > -**/ > -BOOLEAN > -EFIAPI > -GetConsistencyChecking ( > - VOID > - ) > -{ > - return mConsistencyCheck; > -} > - > -/** > - This function sets the consistency checking status. > - > - @param [in] ConsistencyChecking The consistency checking status. > -**/ > -VOID > -EFIAPI > -SetConsistencyChecking ( > - BOOLEAN ConsistencyChecking > - ) > -{ > - mConsistencyCheck =3D ConsistencyChecking; -} > - > -/** > - This function returns the report options. > - > - @return The current report option. > -**/ > -EREPORT_OPTION > -EFIAPI > -GetReportOption ( > - VOID > - ) > -{ > - return mReportType; > -} > - > -/** > - This function sets the report options. > - > - @param [in] ReportType The report option to set. > -**/ > -VOID > -EFIAPI > -SetReportOption ( > - EREPORT_OPTION ReportType > - ) > -{ > - mReportType =3D ReportType; > -} > - > -/** > - This function returns the ACPI table requirements validation flag. > - > - @retval TRUE Check for mandatory table presence should be performed. > -**/ > -BOOLEAN > -EFIAPI > -GetMandatoryTableValidate ( > - VOID > - ) > -{ > - return mMandatoryTableValidate; > -} > - > -/** > - This function sets the ACPI table requirements validation flag. > - > - @param [in] Validate Enable/Disable ACPI table requirements validation= . > -**/ > -VOID > -EFIAPI > -SetMandatoryTableValidate ( > - BOOLEAN Validate > - ) > -{ > - mMandatoryTableValidate =3D Validate; > -} > - > -/** > - This function returns the identifier of specification to validate ACPI= table > - requirements against. > - > - @return ID of specification listing mandatory tables. > -**/ > -UINTN > -EFIAPI > -GetMandatoryTableSpec ( > - VOID > - ) > -{ > - return mMandatoryTableSpec; > -} > - > -/** > - This function sets the identifier of specification to validate ACPI ta= ble > - requirements against. > - > - @param [in] Spec ID of specification listing mandatory tables. > -**/ > -VOID > -EFIAPI > -SetMandatoryTableSpec ( > - UINTN Spec > - ) > -{ > - mMandatoryTableSpec =3D Spec; > -} > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.= h > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h > index 2db4a65415d8..1883145d04a4 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h > @@ -8,96 +8,6 @@ > #ifndef ACPI_VIEW_CONFIG_H_ > #define ACPI_VIEW_CONFIG_H_ >=20 > -/** > - This function returns the colour highlighting status. > - > - @retval TRUE Colour highlighting is enabled. > -**/ > -BOOLEAN > -EFIAPI > -GetColourHighlighting ( > - VOID > - ); > - > -/** > - This function sets the colour highlighting status. > - > - @param [in] Highlight The highlight status. > -**/ > -VOID > -EFIAPI > -SetColourHighlighting ( > - BOOLEAN Highlight > - ); > - > -/** > - This function returns the consistency checking status. > - > - @retval TRUE Consistency checking is enabled. > -**/ > -BOOLEAN > -EFIAPI > -GetConsistencyChecking ( > - VOID > - ); > - > -/** > - This function sets the consistency checking status. > - > - @param [in] ConsistencyChecking The consistency checking status. > -**/ > -VOID > -EFIAPI > -SetConsistencyChecking ( > - BOOLEAN ConsistencyChecking > - ); > - > -/** > - This function returns the ACPI table requirements validation flag. > - > - @retval TRUE Check for mandatory table presence should be performed. > -**/ > -BOOLEAN > -EFIAPI > -GetMandatoryTableValidate ( > - VOID > - ); > - > -/** > - This function sets the ACPI table requirements validation flag. > - > - @param [in] Validate Enable/Disable ACPI table requirements validation= . > -**/ > -VOID > -EFIAPI > -SetMandatoryTableValidate ( > - BOOLEAN Validate > - ); > - > -/** > - This function returns the identifier of specification to validate ACPI= table > - requirements against. > - > - @return ID of specification listing mandatory tables. > -**/ > -UINTN > -EFIAPI > -GetMandatoryTableSpec ( > - VOID > - ); > - > -/** > - This function sets the identifier of specification to validate ACPI ta= ble > - requirements against. > - > - @param [in] Spec ID of specification listing mandatory tables. > -**/ > -VOID > -EFIAPI > -SetMandatoryTableSpec ( > - UINTN Spec > - ); > - > /** > The EREPORT_OPTION enum describes ACPI table Reporting options. > **/ > @@ -109,28 +19,6 @@ typedef enum { > ReportMax, > } EREPORT_OPTION; >=20 > -/** > - This function returns the report options. > - > - @return The current report option. > -**/ > -EREPORT_OPTION > -EFIAPI > -GetReportOption ( > - VOID > - ); > - > -/** > - This function sets the report options. > - > - @param [in] ReportType The report option to set. > -**/ > -VOID > -EFIAPI > -SetReportOption ( > - EREPORT_OPTION ReportType > - ); > - > /** > A structure holding the user selection detailing which > ACPI table is to be examined by the AcpiView code. > @@ -142,15 +30,15 @@ typedef struct { > } SELECTED_ACPI_TABLE; >=20 > /** > - This function returns the selected ACPI table. > - > - @param [out] SelectedAcpiTable Pointer that will contain the returned = struct. > + Configuration struct for the acpiview command. > **/ > -VOID > -EFIAPI > -GetSelectedAcpiTable ( > - OUT SELECTED_ACPI_TABLE** SelectedAcpiTable > - ); > +typedef struct { > + BOOLEAN ConsistencyCheck; ///< Enable consistency ch= ecks when > processing tables > + BOOLEAN ColourHighlighting; ///< Enable UEFI shell col= our codes in > output > + EREPORT_OPTION ReportType; ///< Type of report to cre= ate > + BOOLEAN MandatoryTableValidate; ///< Validate presence of > mandatory tables > + UINTN MandatoryTableSpec; ///< Specification of whic= h tables are > mandatory > +} ACPI_VIEW_CONFIG; >=20 > /** > This function selects an ACPI table in current context. > @@ -161,8 +49,8 @@ GetSelectedAcpiTable ( **/ VOID EFIAPI - > SelectAcpiTable ( > - CONST CHAR16* TableName > +AcpiViewConfigSelectTable ( > + CONST CHAR16 *TableName > ); >=20 > /** > @@ -170,8 +58,12 @@ SelectAcpiTable ( > **/ > VOID > EFIAPI > -AcpiConfigSetDefaults ( > +AcpiViewConfigSetDefaults ( > VOID > ); >=20 > +extern ACPI_VIEW_CONFIG mConfig; > +extern SELECTED_ACPI_TABLE mSelectedAcpiTable; > + > #endif // ACPI_VIEW_CONFIG_H_ > + > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLi > b.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLi > b.c > index d2f26ff89f12..9613c16f5703 100644 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLi > b.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > +++ andLib.c > @@ -197,7 +197,7 @@ ShellCommandRunAcpiView ( > CONST CHAR16* SelectedTableName; >=20 > // Set configuration defaults > - AcpiConfigSetDefaults (); > + AcpiViewConfigSetDefaults (); >=20 > ShellStatus =3D SHELL_SUCCESS; > Package =3D NULL; > @@ -290,31 +290,31 @@ ShellCommandRunAcpiView ( > ShellStatus =3D SHELL_INVALID_PARAMETER; > } else { > // Turn on colour highlighting if requested > - SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h")); > + mConfig.ColourHighlighting =3D ShellCommandLineGetFlag (Package, > + L"-h"); >=20 > // Surpress consistency checking if requested > - SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q"))= ; > + mConfig.ConsistencyCheck =3D !ShellCommandLineGetFlag (Package, > + L"-q"); >=20 > // Evaluate the parameters for mandatory ACPI table presence check= s > - SetMandatoryTableValidate (ShellCommandLineGetFlag (Package, L"-r"= )); > + mConfig.MandatoryTableValidate =3D ShellCommandLineGetFlag > + (Package, L"-r"); > MandatoryTableSpecStr =3D ShellCommandLineGetValue (Package, L"-r"= ); >=20 > if (MandatoryTableSpecStr !=3D NULL) { > - SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr= )); > + mConfig.MandatoryTableSpec =3D ShellHexStrToUintn > + (MandatoryTableSpecStr); > } >=20 > if (ShellCommandLineGetFlag (Package, L"-l")) { > - SetReportOption (ReportTableList); > + mConfig.ReportType =3D ReportTableList; > } else { > SelectedTableName =3D ShellCommandLineGetValue (Package, L"-s"); > if (SelectedTableName !=3D NULL) { > - SelectAcpiTable (SelectedTableName); > - SetReportOption (ReportSelected); > + AcpiViewConfigSelectTable (SelectedTableName); > + mConfig.ReportType =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]; > - SetReportOption (ReportDumpBinFile); > + mConfig.ReportType =3D ReportDumpBinFile; >=20 > UnicodeSPrint ( > FileNameBuffer, > -- > 2.24.1.windows.2 >=20