From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 D51DB81E52 for ; Tue, 24 Jan 2017 09:38:45 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 24 Jan 2017 09:38:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,278,1477983600"; d="scan'208";a="1098329965" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 24 Jan 2017 09:38:44 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 24 Jan 2017 09:38:44 -0800 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.47]) by fmsmsx156.amr.corp.intel.com ([169.254.13.248]) with mapi id 14.03.0248.002; Tue, 24 Jan 2017 09:38:44 -0800 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH] ShellPkg/pci: Support interpreting specific PCIE ext cap thru "-ec" Thread-Index: AQHSdg0mTUt6DIQbXkyRPuZA469T5aFH5UoQ Date: Tue, 24 Jan 2017 17:38:43 +0000 Message-ID: References: <20170124064312.309760-1-ruiyu.ni@intel.com> In-Reply-To: <20170124064312.309760-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTQ1YjQ0ZmUtZjI2OC00ZmJjLThkYjAtYjQyMzVhMzM0YzBlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InJuTjlMT25MYnNMWDZuZmx2dXQ5MnZYbTlDb2o1cTAyTzUrR1d5WEJZTkk9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/pci: Support interpreting specific PCIE ext cap thru "-ec" X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 17:38:46 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: Ni, Ruiyu > Sent: Monday, January 23, 2017 10:43 PM > To: edk2-devel@lists.01.org > Cc: Carsey, Jaben > Subject: [PATCH] ShellPkg/pci: Support interpreting specific PCIE ext cap= thru > "-ec" > Importance: High >=20 > The implementation was already there but through a private flag > "-_e". The patch removes "-_e" support and add "-ec" support. > Removing old "-_e" support makes the pci command more clean. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni > Cc: Jaben Carsey > --- > ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 61 +++++++++------- > ------ > .../UefiShellDebug1CommandsLib.uni | 15 +++--- > 2 files changed, 34 insertions(+), 42 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > index 9cc4f5c..99e6caf 100644 > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > @@ -2370,7 +2370,7 @@ PCI_CONFIG_SPACE *mConfigSpace =3D NULL; > STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { > {L"-s", TypeValue}, > {L"-i", TypeFlag}, > - {L"-_e", TypeValue}, > + {L"-ec", TypeValue}, > {NULL, TypeMax} > }; >=20 > @@ -2516,6 +2516,11 @@ ShellCommandRunPci ( > ShellStatus =3D SHELL_INVALID_PARAMETER; > goto Done; > } > + if (ShellCommandLineGetFlag(Package, L"-ec") && > ShellCommandLineGetValue(Package, L"-ec") =3D=3D NULL) { > + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), > gShellDebug1HiiHandle, L"pci", L"-ec"); > + ShellStatus =3D SHELL_INVALID_PARAMETER; > + goto Done; > + } > if (ShellCommandLineGetFlag(Package, L"-s") && > ShellCommandLineGetValue(Package, L"-s") =3D=3D NULL) { > ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), > gShellDebug1HiiHandle, L"pci", L"-s"); > ShellStatus =3D SHELL_INVALID_PARAMETER; > @@ -2878,13 +2883,11 @@ ShellCommandRunPci ( > // If "-i" appears in command line, interpret data in configuration = space > // > if (ExplainData) { > - EnhancedDump =3D 0; > - if (ShellCommandLineGetFlag(Package, L"-_e")) { > - EnhancedDump =3D 0xFFFF; > - Temp =3D ShellCommandLineGetValue(Package, L"-_e"); > - if (Temp !=3D NULL) { > - EnhancedDump =3D (UINT16) ShellHexStrToUintn (Temp); > - } > + EnhancedDump =3D 0xFFFF; > + if (ShellCommandLineGetFlag(Package, L"-ec")) { > + Temp =3D ShellCommandLineGetValue(Package, L"-ec"); > + ASSERT (Temp !=3D NULL); > + EnhancedDump =3D (UINT16) ShellHexStrToUintn (Temp); > } > Status =3D PciExplainData (&ConfigSpace, Address, IoDev, EnhancedD= ump); > } > @@ -5829,39 +5832,25 @@ PciExplainPciExpress ( > return EFI_UNSUPPORTED; > } >=20 > - if (EnhancedDump =3D=3D 0) { > + ExtHdr =3D (PCI_EXP_EXT_HDR*)ExRegBuffer; > + while (ExtHdr->CapabilityId !=3D 0 && ExtHdr->CapabilityVersion !=3D 0= ) { > // > - // Print the PciEx extend space in raw bytes ( 0xFF-0xFFF) > + // Process this item > // > - ShellPrintEx (-1, -1, L"\r\n%HStart dumping PCIex extended configura= tion > space (0x100 - 0xFFF).%N\r\n\r\n"); > - > - DumpHex ( > - 2, > - EFI_PCIE_CAPABILITY_BASE_OFFSET, > - ExtendRegSize, > - (VOID *) (ExRegBuffer) > - ); > - } else { > - ExtHdr =3D (PCI_EXP_EXT_HDR*)ExRegBuffer; > - while (ExtHdr->CapabilityId !=3D 0 && ExtHdr->CapabilityVersion !=3D= 0) { > + if (EnhancedDump =3D=3D 0xFFFF || EnhancedDump =3D=3D ExtHdr->Capabi= lityId) > { > // > - // Process this item > + // Print this item > // > - if (EnhancedDump =3D=3D 0xFFFF || EnhancedDump =3D=3D ExtHdr->Capa= bilityId) > { > - // > - // Print this item > - // > - PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR*)ExRegBuffer, > ExtHdr, &PciExpressCap); > - } > + PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR*)ExRegBuffer, > ExtHdr, &PciExpressCap); > + } >=20 > - // > - // Advance to the next item if it exists > - // > - if (ExtHdr->NextCapabilityOffset !=3D 0) { > - ExtHdr =3D (PCI_EXP_EXT_HDR*)((UINT8*)ExRegBuffer + ExtHdr- > >NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET); > - } else { > - break; > - } > + // > + // Advance to the next item if it exists > + // > + if (ExtHdr->NextCapabilityOffset !=3D 0) { > + ExtHdr =3D (PCI_EXP_EXT_HDR*)((UINT8*)ExRegBuffer + ExtHdr- > >NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET); > + } else { > + break; > } > } > SHELL_FREE_NON_NULL(ExRegBuffer); > diff --git > a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman > dsLib.uni > b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman > dsLib.uni > index 06865a4..324e233f 100644 > --- > a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman > dsLib.uni > +++ > b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman > dsLib.uni > @@ -895,17 +895,20 @@ > #string STR_GET_HELP_PCI #language en-US "" > ".TH pci 0 "Displays PCI device information."\r\n" > ".SH NAME\r\n" > -"Displays a PCI device list or PCI function configuration space of a > device.\r\n" > +"Displays PCI device list or PCI function configuration space and PCIe > extended\r\n" > +"configuration space.\r\n" > ".SH SYNOPSIS\r\n" > " \r\n" > -"PCI [Bus Dev [Func] [-s Seg] [-i]]\r\n" > +"PCI [Bus Dev [Func] [-s Seg] [-i [-ec ID]]]\r\n" > ".SH OPTIONS\r\n" > " \r\n" > -" -s - Specifies optional segment number.\r\n" > +" -s - Specifies optional segment number (hexadecimal number).\r\n" > " -i - Displays interpreted information.\r\n" > -" Bus - Specifies a bus number.\r\n" > -" Dev - Specifies a device number.\r\n" > -" Func - Specifies a function number.\r\n" > +" -ec - Displays detailed interpretation of specified PCIe extended > capability\r\n" > +" ID (hexadecimal number).\r\n" > +" Bus - Specifies a bus number (hexadecimal number).\r\n" > +" Dev - Specifies a device number (hexadecimal number).\r\n" > +" Func - Specifies a function number (hexadecimal number).\r\n" > ".SH DESCRIPTION\r\n" > " \r\n" > "NOTES:\r\n" > -- > 2.9.0.windows.1