From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 26581820A7 for ; Mon, 13 Feb 2017 08:20:34 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP; 13 Feb 2017 08:20:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,156,1484035200"; d="scan'208";a="820378113" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 13 Feb 2017 08:20:33 -0800 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.47]) by FMSMSX106.amr.corp.intel.com ([169.254.5.63]) with mapi id 14.03.0248.002; Mon, 13 Feb 2017 08:20:33 -0800 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH] ShellPkg/pci: Report error when invalid value is specified for "-ec" Thread-Index: AQHSg3cEhyufqIZziU+obD++4Q3cKKFieM4QgAFG7wCAA2OAEA== Date: Mon, 13 Feb 2017 16:20:32 +0000 Message-ID: References: <20170210082335.91020-1-ruiyu.ni@intel.com> <734D49CCEBEEF84792F5B80ED585239D5B89F552@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5B89F552@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTM4N2ZiNjItODYyOS00ZGUzLWE0NGUtZjAyMDkwZjg2YzU3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkF0WG1MaFhYNFhnTWFBU2l3UU5Ca3dyZWZqTkxQKzFrU3lkSDJGalRtTEU9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/pci: Report error when invalid value is specified for "-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: Mon, 13 Feb 2017 16:20:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ok. That makes sense. > -----Original Message----- > From: Ni, Ruiyu > Sent: Friday, February 10, 2017 8:36 PM > To: Carsey, Jaben ; edk2-devel@lists.01.org > Subject: RE: [PATCH] ShellPkg/pci: Report error when invalid value is > specified for "-ec" > Importance: High >=20 > Jaben, > "-ec" should be followed by a ID. >=20 > The patch fixes when "-ec" is followed by string other than ID, no error = is > reported. >=20 > Regards, > Ray >=20 > >-----Original Message----- > >From: Carsey, Jaben > >Sent: Saturday, February 11, 2017 1:06 AM > >To: Ni, Ruiyu ; edk2-devel@lists.01.org > >Cc: Carsey, Jaben > >Subject: RE: [PATCH] ShellPkg/pci: Report error when invalid value is > specified for "-ec" > > > >Reviewed-by: Jaben Carsey > > > >Ray, > > > >What is the intended behavior if the user does -ec with no data after it= ? > > > >-Jaben > > > > > >> -----Original Message----- > >> From: Ni, Ruiyu > >> Sent: Friday, February 10, 2017 12:24 AM > >> To: edk2-devel@lists.01.org > >> Cc: Carsey, Jaben > >> Subject: [PATCH] ShellPkg/pci: Report error when invalid value is spec= ified > >> for "-ec" > >> Importance: High > >> > >> Contributed-under: TianoCore Contribution Agreement 1.0 > >> Signed-off-by: Ruiyu Ni > >> Cc: Jaben Carsey > >> --- > >> ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 21 > >> +++++++++++++++------ > >> .../UefiShellDebug1CommandsLib.uni | 2 +- > >> 2 files changed, 16 insertions(+), 7 deletions(-) > >> > >> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > >> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > >> index fb7561f..37f15d6 100644 > >> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > >> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > >> @@ -2726,6 +2726,7 @@ ShellCommandRunPci ( > >> Bus =3D 0; > >> Device =3D 0; > >> Func =3D 0; > >> + EnhancedDump =3D 0xFFFF; > >> if (ShellCommandLineGetFlag(Package, L"-i")) { > >> ExplainData =3D TRUE; > >> } > >> @@ -2807,6 +2808,20 @@ ShellCommandRunPci ( > >> } > >> } > >> > >> + Temp =3D ShellCommandLineGetValue (Package, L"-ec"); > >> + if (Temp !=3D NULL) { > >> + // > >> + // Input converted to hexadecimal number. > >> + // > >> + if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE= , > >> TRUE))) { > >> + EnhancedDump =3D (UINT16) RetVal; > >> + } else { > >> + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > >> (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); > >> + ShellStatus =3D SHELL_INVALID_PARAMETER; > >> + goto Done; > >> + } > >> + } > >> + > >> // > >> // Find the protocol interface who's in charge of current segment= , and > its > >> // bus range covers the current bus > >> @@ -2883,12 +2898,6 @@ ShellCommandRunPci ( > >> // If "-i" appears in command line, interpret data in configurati= on space > >> // > >> if (ExplainData) { > >> - 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, > EnhancedDump); > >> } > >> } > >> diff --git > >> > a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman > >> dsLib.uni > >> > b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman > >> dsLib.uni > >> index 8ea4215..7c0ca98 100644 > >> --- > >> > a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman > >> dsLib.uni > >> +++ > >> > b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman > >> dsLib.uni > >> @@ -39,7 +39,7 @@ > >> #string STR_GEN_PCIRBIO_NF #language en-US "%H%s%N: Protocol - > >> PciRootBridgeIo not found.\r\n" > >> #string STR_GEN_PCIRBIO_ER #language en-US "%H%s%N: Problem > >> accessing the data using Protocol - PciRootBridgeIo\r\n" > >> #string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid > >> argument - '%H%s%N'\r\n" > >> -#string STR_GEN_PARAM_INV_HEX #language en-US "%H%s%N: > Invalid > >> parameter - '%H%s%N:'. Must be hexadecimal.\r\n" > >> +#string STR_GEN_PARAM_INV_HEX #language en-US "%H%s%N: > Invalid > >> parameter - '%H%s%N'. Must be hexadecimal.\r\n" > >> #string STR_GEN_PARAM_CONFLICT #language en-US "%H%s%N: Flags > >> conflict with - '%H%s%N' and '%H%s%N'\r\n" > >> #string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory > >> allocation was not successful.\r\n" > >> #string STR_GEN_MAP_PROTOCOL #language en-US "%H%s%N: > Mapped > >> device '%B%s%N' does not have protocol %B%s%N\r\n" > >> -- > >> 2.9.0.windows.1