From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.12183.1591929613784681731 for ; Thu, 11 Jun 2020 19:40:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=L5sA6ALN; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: zhichao.gao@intel.com) IronPort-SDR: KsHL5vX31Nk5Hk+QTJU2hW9DAV8nBIJTctEQvIt7YNZJahzLdbZzFYu3uuoKz8cmoFTiiDyBtv U1ERMDZWECAQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 19:40:12 -0700 IronPort-SDR: aNEXRltGVdXYSZyWNhfXzJPprX6c/SAoHy/LenPBeV/9AV8KDlgbua5ry+9lKPCsBk2ySJYFtZ lRpa1egm4uSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,501,1583222400"; d="scan'208";a="473912953" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 11 Jun 2020 19:40:11 -0700 Received: from fmsmsx163.amr.corp.intel.com (10.18.125.72) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jun 2020 19:40:11 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx163.amr.corp.intel.com (10.18.125.72) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jun 2020 19:40:11 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jun 2020 19:40:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KiCO1QZP9WUvq+pohhCq4R0jJrjPI7vmiBzdSiETU24JYvOSrOTLsUJg/AQAkxMYhB8oluy0kA7/Mtf+OxvU2GF4CjmEYunEyf47gAKGAK7gmMDyzO25g8TA6IJfsB/mIzYoBST1hnGv45N4GO6DTKh6ov3NSj7WQ7NEUqyzuK1+bt80rzTwu1KXRmfAJpFMch08lrBK5yFnIHDZMzmspfLLNqJsGuiJ9PIzO6rervfjkp6Jfyv8HbuHQ8s2wP5fhRlMqdOSzqIXmYA2L4DF+XZz0kVpkjczlXO0++o0W89jz3vz//BFJPjjAQzewPP2DYucOUy2Hss/DxtJVa2vFg== 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=qJIj/LoI9IjusZEbCfSUynGLZ3mpTzFqNY023w2ooJk=; b=eHXl6uIiVJydN1xjfe7njLOT8bIshw4Z+woieNUuPFf0h82RvDAfYHfYTgkQgQe8VHmW3b3mACljJj+p6yYslgFwRzJvwqTEvAN0UMVWG/JrSVrfNjDeeU4VYyzxLCn3CGcgOic+JuV1iTAe18YLV9sq1kE+sRLAXH3ENMQunVPcJ2obKCX2t1+1Rxkssdj5QZ/JgxgBte5/5TN1uCwHyZYke/uX80UNovI3aNcGTAN7XKEYT97LNxLXJXkk3npD1+KqS87ebscdQVjYp+2/6cbUN5qNEjPG2v8h/gkQxFiRpW/URySGB8/9XoM9dMKXSW9zkcVPhaBD/HfAbqAhMA== 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=qJIj/LoI9IjusZEbCfSUynGLZ3mpTzFqNY023w2ooJk=; b=L5sA6ALNagizPTvRwE6lq0ZBv5bOvyO2VG5j4raFyRyQInx5BOIXsp0SPlerei5DY9U1LjEfmifAf+v19heJKV1c78VJdYyNv8O0dlIgF1G65mwrHxmML7VZ9Jyf56k3OVW07gyRZZ9uHqljwQQdto7Fen+I68R2RivV81VDDFc= Received: from DM6PR11MB4425.namprd11.prod.outlook.com (2603:10b6:5:1d9::31) by DM6PR11MB4753.namprd11.prod.outlook.com (2603:10b6:5:2ac::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20; Fri, 12 Jun 2020 02:40:10 +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.3088.023; Fri, 12 Jun 2020 02:40:10 +0000 From: "Gao, Zhichao" To: Tomas Pilar , "devel@edk2.groups.io" CC: "nd@arm.com" , "Ni, Ray" Subject: Re: [PATCH v2 2/6] ShellPkg/AcpiView: Refactor configuration Thread-Topic: [PATCH v2 2/6] ShellPkg/AcpiView: Refactor configuration Thread-Index: AQHWL5/7b8mqXzihREWuab68oX/KcKjUSqHQ Date: Fri, 12 Jun 2020 02:40:10 +0000 Message-ID: References: <20200521184421.2222-1-Tomas.Pilar@arm.com> <20200521184421.2222-3-Tomas.Pilar@arm.com> In-Reply-To: <20200521184421.2222-3-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: e8ddae70-1d9d-4eb2-f7ec-08d80e79ece9 x-ms-traffictypediagnostic: DM6PR11MB4753: 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:2150; x-forefront-prvs: 0432A04947 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Pb1gld0OOlGvpqxCZvPYtZRPkW6AttN1IhvFOUYQP/PEubcxa2cKHE1Ngn6UobdpRw4B6vquhrD774NJUc+7/vhFRrIP5CQQ4iV/xwC8XWBu7yjxcMIiA9+SsZNyIhpMCSeG9vR6Sb9wLH+GFGNBR6+RdnJFrWOKRsM+bG1SG5oEtQVRVd2boXf6ZcxorzDDxARf44m9iwO0uaID3v3pQzuJX9zz62kpQtVRb9UTlvOwhtZ84YW0JvqhABgn4Ixdcya1IgpdIQ3owNPEdcHs0DnCWv5zYy05GI9d4EGSvrO99UprVMAr5V/Z9aRhr3EZo+NDB/ygWFAVyrWr4HGcVQ== 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:(346002)(136003)(366004)(39860400002)(376002)(396003)(52536014)(5660300002)(71200400001)(86362001)(66446008)(66946007)(64756008)(83380400001)(2906002)(76116006)(8676002)(8936002)(66556008)(66476007)(478600001)(30864003)(110136005)(107886003)(6506007)(55016002)(53546011)(9686003)(316002)(4326008)(186003)(33656002)(7696005)(19627235002)(54906003)(26005)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: Fe6cCA4ENEWtdkBZ/rd7TmmgVLCRmJeytFH/Uc33PCh3mW7jqEyj6YWRXX2+XVl7r66NhFcdymoyDKaDD62gEkEE+W14cS/rWhh6VUfYb0p1Rxof8YOrNELncJ8CNowS/6+ly1D/0NZWKu1GZfZFs1F3VtIGi5QEu7rMBw/G2bW3GAXahvgv6B1nJnZ68ELLPOpih616Mal350y3nWW1UNBhBpvH1lcBOGCSEVdPUSLSVrjpkZNiWqmzFtdyUG6MmKn3q+06lCUXQ6F+OwA51GzyZsQuWNyTDvTb75jFChUgr+pgpFQb7PTFlmq9GHsdS7+WMXIocjHItnTuKl/VbalFNptH4SRgf7N2vPrIJ5Dk+sv4zgwJrmdSzLQVURsLpBtYHBWRgRbns7aQOGvcYBOxezEbkKFXyXQs8w0EZ27oL7PdKYCv5mDpNgF8l1iPxvTfeGECdzOIep4ZUamNMgVRmXAAFf4GeNRxz9vePjh9Xu3FceleXkgfiKwlqzo9 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e8ddae70-1d9d-4eb2-f7ec-08d80e79ece9 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jun 2020 02:40:10.0803 (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: 8RXPbXRXgapZmkO5d9W0DNQmWf2vxDgyTCCVdb4HwYu9xMSLwGdBBIj7wfNpq7e5jypJURFO+1r2fQiLnxs1cw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4753 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 Reviewed-by: Zhichao Gao Thanks, Zhichao > -----Original Message----- > From: Tomas Pilar > Sent: Friday, May 22, 2020 2:44 AM > To: devel@edk2.groups.io > Cc: nd@arm.com; Ni, Ray ; Gao, Zhichao > > Subject: [PATCH v2 2/6] ShellPkg/AcpiView: Refactor configuration >=20 > A new file and header (AcpiViewConfig.[ch]) is created that houses the us= er > configuration. This declutters the core code and improves modularity of t= he > design. >=20 > The module level symbols for verbosity, table selection, and highlighting= are > refactored into the new file. >=20 > Cc: Ray Ni > Cc: Zhichao Gao > Signed-off-by: Tomas Pilar > --- > ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c = | 1 + > ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c = | 1 + > ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c = | 237 > +++++++++---------------------------------------------------------- > ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h = | 95 ------ > --------------------- > ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c = | 246 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++ > ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h = | 177 > ++++++++++++++++++++++++++++++++++++++++++++++++++ > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c = | > 1 + > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c = | > 1 + > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c > | 1 + > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c = | > 1 + > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c = | > 1 + >=20 > ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.= i > nf | 32 ++++----- > 12 files changed, 479 insertions(+), 315 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c > index 3f12a33050a4..02f6d771c7e1 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c > @@ -10,6 +10,7 @@ > #include > #include "AcpiParser.h" > #include "AcpiView.h" > +#include "AcpiViewConfig.h" >=20 > STATIC UINT32 gIndent; > STATIC UINT32 mTableErrorCount; > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser= .c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c > index d5b9eee52323..4b618f131eac 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c > @@ -17,6 +17,7 @@ > #include "AcpiParser.h" > #include "AcpiTableParser.h" > #include "AcpiView.h" > +#include "AcpiViewConfig.h" >=20 > #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) #include > "Arm/SbbrValidator.h" > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c > index f1a95b7b8f03..2f7395c23bce 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c > @@ -20,6 +20,7 @@ > #include "AcpiParser.h" > #include "AcpiTableParser.h" > #include "AcpiView.h" > +#include "AcpiViewConfig.h" > #include "UefiShellAcpiViewCommandLib.h" >=20 > #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -28,17 +29,8 > @@ >=20 > EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; >=20 > -// Report variables > -STATIC UINT32 mSelectedAcpiTable; > -STATIC CONST CHAR16* mSelectedAcpiTableName; > -STATIC BOOLEAN mSelectedAcpiTableFound; > -STATIC EREPORT_OPTION mReportType; > STATIC UINT32 mTableCount; > STATIC UINT32 mBinTableCount; > -STATIC BOOLEAN mConsistencyCheck; > -STATIC BOOLEAN mColourHighlighting; > -STATIC BOOLEAN mMandatoryTableValidate; > -STATIC UINTN mMandatoryTableSpec; >=20 > /** > An array of acpiview command line parameters. > @@ -53,142 +45,6 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { > {NULL, TypeMax} > }; >=20 > -/** > - This function returns the colour highlighting status. > - > - @retval TRUE if colour highlighting is enabled. > -**/ > -BOOLEAN > -GetColourHighlighting ( > - VOID > - ) > -{ > - return mColourHighlighting; > -} > - > -/** > - This function sets the colour highlighting status. > - > - @param Highlight The Highlight status. > - > -**/ > -VOID > -SetColourHighlighting ( > - BOOLEAN Highlight > - ) > -{ > - mColourHighlighting =3D Highlight; > -} > - > -/** > - This function returns the consistency checking status. > - > - @retval TRUE if consistency checking is enabled. > -**/ > -BOOLEAN > -GetConsistencyChecking ( > - VOID > - ) > -{ > - return mConsistencyCheck; > -} > - > -/** > - This function sets the consistency checking status. > - > - @param ConsistencyChecking The consistency checking status. > - > -**/ > -VOID > -SetConsistencyChecking ( > - BOOLEAN ConsistencyChecking > - ) > -{ > - mConsistencyCheck =3D ConsistencyChecking; -} > - > -/** > - This function returns the ACPI table requirements validation flag. > - > - @retval TRUE if check for mandatory table presence should be performed= . > -**/ > -BOOLEAN > -GetMandatoryTableValidate ( > - VOID > - ) > -{ > - return mMandatoryTableValidate; > -} > - > -/** > - This function sets the ACPI table requirements validation flag. > - > - @param Validate Enable/Disable ACPI table requirements validation. > -**/ > -VOID > -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 > -GetMandatoryTableSpec ( > - VOID > - ) > -{ > - return mMandatoryTableSpec; > -} > - > -/** > - This function sets the identifier of specification to validate ACPI ta= ble > - requirements against. > - > - @param Spec ID of specification listing mandatory tables. > -**/ > -VOID > -SetMandatoryTableSpec ( > - UINTN Spec > - ) > -{ > - mMandatoryTableSpec =3D Spec; > -} > - > -/** > - This function returns the report options. > - > - @retval Returns the report option. > -**/ > -STATIC > -EREPORT_OPTION > -GetReportOption ( > - VOID > - ) > -{ > - return mReportType; > -} > - > -/** > - This function returns the selected ACPI table. > - > - @retval Returns signature of the selected ACPI table. > -**/ > -STATIC > -UINT32 > -GetSelectedAcpiTable ( > - VOID > - ) > -{ > - return mSelectedAcpiTable; > -} > - > /** > This function dumps the ACPI table to a file. >=20 > @@ -205,19 +61,21 @@ DumpAcpiTableToFile ( > IN CONST UINTN Length > ) > { > - EFI_STATUS Status; > - CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; > - SHELL_FILE_HANDLE DumpFileHandle; > - UINTN TransferBytes; > + EFI_STATUS Status; > + CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; > + SHELL_FILE_HANDLE DumpFileHandle; > + UINTN TransferBytes; > + SELECTED_ACPI_TABLE SelectedTable; >=20 > DumpFileHandle =3D NULL; > TransferBytes =3D Length; > + GetSelectedAcpiTable (&SelectedTable); >=20 > UnicodeSPrint ( > FileNameBuffer, > sizeof (FileNameBuffer), > L".\\%s%04d.bin", > - mSelectedAcpiTableName, > + SelectedTable.Name, > mBinTableCount++ > ); >=20 > @@ -273,10 +131,11 @@ ProcessTableReportOptions ( > IN CONST UINT32 Length > ) > { > - UINTN OriginalAttribute; > - UINT8* SignaturePtr; > - BOOLEAN Log; > - BOOLEAN HighLight; > + UINTN OriginalAttribute; > + UINT8 *SignaturePtr; > + BOOLEAN Log; > + BOOLEAN HighLight; > + SELECTED_ACPI_TABLE SelectedTable; >=20 > // > // set local variables to suppress incorrect compiler/analyzer warning= s @@ - > 285,15 +144,16 @@ ProcessTableReportOptions ( > SignaturePtr =3D (UINT8*)(UINTN)&Signature; > Log =3D FALSE; > HighLight =3D GetColourHighlighting (); > + GetSelectedAcpiTable (&SelectedTable); >=20 > switch (GetReportOption ()) { > case ReportAll: > Log =3D TRUE; > break; > case ReportSelected: > - if (Signature =3D=3D GetSelectedAcpiTable ()) { > + if (Signature =3D=3D SelectedTable.Type) { > Log =3D TRUE; > - mSelectedAcpiTableFound =3D TRUE; > + SelectedTable.Found =3D TRUE; > } > break; > case ReportTableList: > @@ -321,8 +181,8 @@ ProcessTableReportOptions ( > ); > break; > case ReportDumpBinFile: > - if (Signature =3D=3D GetSelectedAcpiTable ()) { > - mSelectedAcpiTableFound =3D TRUE; > + if (Signature =3D=3D SelectedTable.Type) { > + SelectedTable.Found =3D TRUE; > DumpAcpiTableToFile (TablePtr, Length); > } > break; > @@ -356,37 +216,7 @@ ProcessTableReportOptions ( > return Log; > } >=20 > -/** > - This function converts a string to ACPI table signature. > - > - @param [in] Str Pointer to the string to be converted to the > - ACPI table signature. >=20 > - @retval The ACPI table signature. > -**/ > -STATIC > -UINT32 > -ConvertStrToAcpiSignature ( > - IN CONST CHAR16* Str > - ) > -{ > - UINT8 Index; > - CHAR8 Ptr[4]; > - > - ZeroMem (Ptr, sizeof (Ptr)); > - 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 { > - Ptr[Index] =3D (CHAR8)Str[Index]; > - } > - Index++; > - } > - return *(UINT32*)Ptr; > -} >=20 > /** > This function iterates the configuration table entries in the @@ -417,= 6 +247,7 > @@ AcpiView ( > UINT8 RsdpRevision; > PARSE_ACPI_TABLE_PROC RsdpParserProc; > BOOLEAN Trace; > + SELECTED_ACPI_TABLE SelectedTable; >=20 > // > // set local variables to suppress incorrect compiler/analyzer warning= s @@ - > 428,6 +259,9 @@ 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++) = { @@ - > 496,7 +330,7 @@ AcpiView ( > if (ReportTableList !=3D ReportOption) { > if (((ReportSelected =3D=3D ReportOption) || > (ReportDumpBinFile =3D=3D ReportOption)) && > - (!mSelectedAcpiTableFound)) { > + (!SelectedTable.Found)) { > Print (L"\nRequested ACPI Table not found.\n"); > } else if (GetConsistencyChecking () && > (ReportDumpBinFile !=3D ReportOption)) { @@ -554,17 +388,= 12 @@ > ShellCommandRunAcpiView ( > CHAR16* ProblemParam; > SHELL_FILE_HANDLE TmpDumpFileHandle; > CONST CHAR16* MandatoryTableSpecStr; > + CONST CHAR16 *SelectedTableName; >=20 > // Set Defaults > - mReportType =3D ReportAll; > mTableCount =3D 0; > mBinTableCount =3D 0; > - mSelectedAcpiTable =3D 0; > - mSelectedAcpiTableName =3D NULL; > - mSelectedAcpiTableFound =3D FALSE; > - mConsistencyCheck =3D TRUE; > - mMandatoryTableValidate =3D FALSE; > - mMandatoryTableSpec =3D 0; > + AcpiConfigSetDefaults (); >=20 > ShellStatus =3D SHELL_SUCCESS; > Package =3D NULL; > @@ -671,25 +500,23 @@ ShellCommandRunAcpiView ( > } >=20 > if (ShellCommandLineGetFlag (Package, L"-l")) { > - mReportType =3D ReportTableList; > + SetReportOption (ReportTableList); > } else { > - mSelectedAcpiTableName =3D ShellCommandLineGetValue (Package, L"= -s"); > - if (mSelectedAcpiTableName !=3D NULL) { > - mSelectedAcpiTable =3D (UINT32)ConvertStrToAcpiSignature ( > - mSelectedAcpiTableName > - ); > - mReportType =3D ReportSelected; > + SelectedTableName =3D ShellCommandLineGetValue (Package, L"-s"); > + if (SelectedTableName !=3D NULL) { > + SelectAcpiTable (SelectedTableName); > + SetReportOption (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 ReportDumpBinFile; > + SetReportOption (ReportDumpBinFile); >=20 > UnicodeSPrint ( > FileNameBuffer, > sizeof (FileNameBuffer), > L".\\%s%04d.tmp", > - mSelectedAcpiTableName, > + SelectedTableName, > mBinTableCount > ); >=20 > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h > index be65564c86a6..92d64a88814d 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h > @@ -23,17 +23,6 @@ > **/ > #define RSDP_LENGTH_OFFSET 20 >=20 > -/** > - The EREPORT_OPTION enum describes ACPI table Reporting options. > -**/ > -typedef enum ReportOption { > - 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. > **/ > @@ -70,90 +59,6 @@ GetWarningCount ( > VOID > ); >=20 > -/** > - This function returns the colour highlighting status. > - > - @retval TRUE if colour highlighting is enabled. > -**/ > -BOOLEAN > -GetColourHighlighting ( > - VOID > - ); > - > -/** > - This function sets the colour highlighting status. > - > - @param Highlight The Highlight status. > - > -**/ > -VOID > -SetColourHighlighting ( > - BOOLEAN Highlight > - ); > - > -/** > - This function returns the consistency checking status. > - > - @retval TRUE if consistency checking is enabled. > -**/ > -BOOLEAN > -GetConsistencyChecking ( > - VOID > - ); > - > -/** > - This function sets the consistency checking status. > - > - @param ConsistencyChecking The consistency checking status. > - > -**/ > -VOID > -SetConsistencyChecking ( > - BOOLEAN ConsistencyChecking > - ); > - > -/** > - This function returns the ACPI table requirements validation flag. > - > - @retval TRUE if check for mandatory table presence should be performed= . > -**/ > -BOOLEAN > -GetMandatoryTableValidate ( > - VOID > - ); > - > -/** > - This function sets the ACPI table requirements validation flag. > - > - @param Validate Enable/Disable ACPI table requirements validation. > -**/ > -VOID > -SetMandatoryTableValidate ( > - BOOLEAN Validate > - ); > - > -/** > - This function returns the identifier of specification to validate ACPI= table > - requirements against. > - > - @return ID of specification listing mandatory tables. > -**/ > -UINTN > -GetMandatoryTableSpec ( > - VOID > - ); > - > -/** > - This function sets the identifier of specification to validate ACPI ta= ble > - requirements against. > - > - @param Spec ID of specification listing mandatory tables. > -**/ > -VOID > -SetMandatoryTableSpec ( > - UINTN Spec > - ); > - > /** > This function processes the table reporting options for the ACPI table= . >=20 > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.= c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c > new file mode 100644 > index 000000000000..6f6d1a9d52c1 > --- /dev/null > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c > @@ -0,0 +1,246 @@ > +/** @file > + State and accessors for 'acpiview' configuration. > + > + Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#include > +#include > + > +#include "AcpiViewConfig.h" > + > +// Report variables > +STATIC BOOLEAN mConsistencyCheck; > +STATIC BOOLEAN mColourHighlighting; > +STATIC EREPORT_OPTION mReportType; > +STATIC BOOLEAN mMandatoryTableValidate; > +STATIC UINTN mMandatoryTableSpec; > + > +// User selection of which ACPI table should be checked > +SELECTED_ACPI_TABLE mSelectedAcpiTable; > + > +/** > + Reset the AcpiView user configuration to defaults **/ VOID EFIAPI > +AcpiConfigSetDefaults ( > + VOID > + ) > +{ > + mReportType =3D ReportAll; > + mSelectedAcpiTable.Type =3D 0; > + mSelectedAcpiTable.Name =3D NULL; > + mSelectedAcpiTable.Found =3D FALSE; > + mConsistencyCheck =3D TRUE; > + mMandatoryTableValidate =3D FALSE; > + mMandatoryTableSpec =3D 0; > +} > + > +/** > + This function converts a string to ACPI table signature. > + > + @param [in] Str Pointer to the string to be converted to the > + ACPI table signature. > + > + @retval The ACPI table signature. > +**/ > +STATIC > +UINT32 > +ConvertStrToAcpiSignature ( > + IN CONST CHAR16 *Str > + ) > +{ > + UINT8 Index; > + CHAR8 Ptr[4]; > + > + ZeroMem (Ptr, sizeof (Ptr)); > + 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 { > + Ptr[Index] =3D (CHAR8)Str[Index]; > + } > + Index++; > + } > + return *(UINT32 *) Ptr; > +} > + > +/** > + This function selects an ACPI table in current context. > + The string name of the table is converted into UINT32 > + table signature. > + > + @param [in] TableName The name of the ACPI table to select. > +**/ > +VOID > +EFIAPI > +SelectAcpiTable ( > + IN CONST CHAR16 *TableName > + ) > +{ > + ASSERT (TableName !=3D NULL); > + > + 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 > +table > + 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 > new file mode 100644 > index 000000000000..fc99624e41dc > --- /dev/null > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h > @@ -0,0 +1,177 @@ > +/** @file > + Header file for 'acpiview' configuration. > + > + Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#ifndef ACPI_VIEW_CONFIG_H_ > +#define ACPI_VIEW_CONFIG_H_ > + > +/** > + 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 > +table > + 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. > +**/ > +typedef enum { > + 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 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. > +**/ > +typedef struct { > + UINT32 Type; ///< 32bit signature of the selected ACPI= table. > + CONST CHAR16* Name; ///< User friendly name of the selected A= CPI > table. > + BOOLEAN Found; ///< The selected table has been found in= the system. > +} SELECTED_ACPI_TABLE; > + > +/** > + 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 > + ); > + > +/** > + This function selects an ACPI table in current context. > + The string name of the table is converted into UINT32 > + table signature. > + > + @param [in] TableName The name of the ACPI table to select. > +**/ > +VOID > +EFIAPI > +SelectAcpiTable ( > + CONST CHAR16* TableName > + ); > + > +/** > + Reset the AcpiView user configuration to defaults. > +**/ > +VOID > +EFIAPI > +AcpiConfigSetDefaults ( > + VOID > + ); > + > +#endif // ACPI_VIEW_CONFIG_H_ > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c > index bdd30ff45c61..d02fc4929d6f 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParse= r.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPars > +++ er.c > @@ -12,6 +12,7 @@ > #include > #include "AcpiParser.h" > #include "AcpiTableParser.h" > +#include "AcpiViewConfig.h" >=20 > // "The number of GT Block Timers must be less than or equal to 8" > #define GT_BLOCK_TIMER_COUNT_MAX 8 > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c > index 9a006a01448b..f7447947b230 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParse= r.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPars > +++ er.c > @@ -13,6 +13,7 @@ > #include > #include "AcpiParser.h" > #include "AcpiTableParser.h" > +#include "AcpiViewConfig.h" >=20 > // Local variables > STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c > index f85d2b36532c..15aa2392b60c 100644 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars > +++ er.c > @@ -15,6 +15,7 @@ > #include > #include "AcpiParser.h" > #include "AcpiTableParser.h" > +#include "AcpiViewConfig.h" > #include "MadtParser.h" >=20 > // Local Variables > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c > index 0db272c16af0..acd2b81bb325 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParse= r.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttPars > +++ er.c > @@ -13,6 +13,7 @@ > #include > #include "AcpiParser.h" > #include "AcpiView.h" > +#include "AcpiViewConfig.h" > #include "PpttParser.h" >=20 > // Local variables > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c > index 6f66be68cc0b..b9b67820b89f 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParse= r.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPars > +++ er.c > @@ -13,6 +13,7 @@ > #include > #include "AcpiParser.h" > #include "AcpiTableParser.h" > +#include "AcpiViewConfig.h" >=20 > // Local Variables > STATIC CONST UINT8* SratRAType; > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLi > b.inf > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLi > b.inf > index d21ecd40a8cf..92de2391b09f 100644 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLi > b.inf > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > +++ andLib.inf > @@ -19,15 +19,14 @@ [Defines] > DESTRUCTOR =3D UefiShellAcpiViewCommandLibDestruct= or >=20 > [Sources.common] > - UefiShellAcpiViewCommandLib.uni > - UefiShellAcpiViewCommandLib.c > - UefiShellAcpiViewCommandLib.h > - AcpiParser.h > - AcpiTableParser.h > - AcpiView.h > AcpiParser.c > + AcpiParser.h > AcpiTableParser.c > + AcpiTableParser.h > AcpiView.c > + AcpiView.h > + AcpiViewConfig.c > + AcpiViewConfig.h > Parsers/Bgrt/BgrtParser.c > Parsers/Dbg2/Dbg2Parser.c > Parsers/Dsdt/DsdtParser.c > @@ -36,40 +35,43 @@ [Sources.common] > Parsers/Gtdt/GtdtParser.c > Parsers/Iort/IortParser.c > Parsers/Madt/MadtParser.c > + Parsers/Madt/MadtParser.h > Parsers/Mcfg/McfgParser.c > Parsers/Pptt/PpttParser.c > + Parsers/Pptt/PpttParser.h > Parsers/Rsdp/RsdpParser.c > Parsers/Slit/SlitParser.c > Parsers/Spcr/SpcrParser.c > Parsers/Srat/SratParser.c > Parsers/Ssdt/SsdtParser.c > Parsers/Xsdt/XsdtParser.c > - Parsers/Madt/MadtParser.h > - Parsers/Pptt/PpttParser.h > + UefiShellAcpiViewCommandLib.c > + UefiShellAcpiViewCommandLib.h > + UefiShellAcpiViewCommandLib.uni >=20 > [Sources.ARM, Sources.AARCH64] > Arm/SbbrValidator.h > Arm/SbbrValidator.c >=20 > [Packages] > + MdeModulePkg/MdeModulePkg.dec > MdePkg/MdePkg.dec > ShellPkg/ShellPkg.dec > - MdeModulePkg/MdeModulePkg.dec >=20 > [LibraryClasses] > - MemoryAllocationLib > BaseLib > BaseMemoryLib > DebugLib > + FileHandleLib > + HiiLib > + MemoryAllocationLib > + PcdLib > + PrintLib > ShellCommandLib > ShellLib > + UefiBootServicesTableLib > UefiLib > UefiRuntimeServicesTableLib > - UefiBootServicesTableLib > - PcdLib > - HiiLib > - PrintLib > - FileHandleLib >=20 >=20 > [FixedPcd] > -- > 2.24.1.windows.2 >=20