From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 D807821A134AE for ; Thu, 4 May 2017 19:59:40 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP; 04 May 2017 19:59:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,290,1491289200"; d="scan'208";a="853100775" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 04 May 2017 19:59:40 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 4 May 2017 19:59:40 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 4 May 2017 19:59:39 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.178]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.224]) with mapi id 14.03.0319.002; Fri, 5 May 2017 10:59:36 +0800 From: "Ni, Ruiyu" To: Jeff Westfahl , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH 0/3] ShellPkg/HandleParsingLib: Show LoadedImageProtocol info Thread-Index: AQHSxSDVO+Iu4ReV60WB+ehv+6kQ6aHlBErA Date: Fri, 5 May 2017 02:59:36 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B93E24F@SHSMSX104.ccr.corp.intel.com> References: <1493934784-30012-1-git-send-email-jeff.westfahl@ni.com> In-Reply-To: <1493934784-30012-1-git-send-email-jeff.westfahl@ni.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 0/3] ShellPkg/HandleParsingLib: Show LoadedImageProtocol info X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 02:59:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jeff, Firstly great thanks for filling the gap between EDK shell and UEFI shell. There are many behavior differences between the two, and EDK Shell does ca= rry much more information that are very helpful for developer debugging. Before I check in your patch, could you please kindly review whether the ad= ditional change is ok to you. One change is to fix the ECC failure: "python BaseTools\Source\Python\Ecc\E= cc.py -t ShellPkg\Library\UefiHandleParsingLib -s" ShellPkg\Library\UefiHandleParsingLib\UefiHandleParsingLib.c(272): [3002]No= n-Boolean comparisons should use a compare operator (=3D=3D, !=3D, >, < >= =3D, <=3D) Predicate Expression: FileName ShellPkg\Library\UefiHandleParsingLib\UefiHandleParsingLib.c(272): [3003]A = comparison of any pointer to zero must be done via the NULL type Predicate = Expression: FileName =3D=3D=3D=3Dpatch content=3D=3D=3D .../UefiHandleParsingLib/UefiHandleParsingLib.c | 39 ++++++++-----------= --- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b= /ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index 74934f8617..d3ee068eba 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -16,14 +16,14 @@ =20 #include "UefiHandleParsingLib.h" #include "IndustryStandard/Acpi10.h" -#include "Pi/PiFirmwareFile.h" -#include "Pi/PiFirmwareVolume.h" -#include "Protocol/FirmwareVolume2.h" +#include +#include =20 EFI_HANDLE mHandleParsingHiiHandle =3D NULL; HANDLE_INDEX_LIST mHandleList =3D {{{NULL,NULL},0,0},0}; GUID_INFO_BLOCK *mGuidList; UINTN mGuidListCount; + /** Function to find the file name associated with a LoadedImageProtocol. =20 @@ -44,37 +44,26 @@ FindLoadedImageFileName ( UINTN BufferSize; UINT32 AuthenticationStatus; =20 - // - // Only subtype MEDIA_PIWG_FW_FILE_DP of type MEDIA_DEVICE_PATH is suppo= rted. - // - if ( (LoadedImage =3D=3D NULL) - || (LoadedImage->FilePath =3D=3D NULL) - || (LoadedImage->FilePath->Type !=3D MEDIA_DEVICE_PATH) - || (LoadedImage->FilePath->SubType !=3D MEDIA_PIWG_FW_FILE_DP) - ) { - return (NULL); + if ((LoadedImage =3D=3D NULL) || (LoadedImage->FilePath =3D=3D NULL)) { + return NULL; } =20 NameGuid =3D EfiGetNameGuidFromFwVolDevicePathNode((MEDIA_FW_VOL_FILEPAT= H_DEVICE_PATH *)LoadedImage->FilePath); =20 if (NameGuid =3D=3D NULL) { - return (NULL); + return NULL; } =20 // - // Get the FirmwareVolume2Protocol of the device handle that this image = was - // loaded from. + // Get the FirmwareVolume2Protocol of the device handle that this image = was loaded from. // - Status =3D gBS->HandleProtocol( - LoadedImage->DeviceHandle, - &gEfiFirmwareVolume2ProtocolGuid, - (VOID**)&Fv); + Status =3D gBS->HandleProtocol (LoadedImage->DeviceHandle, &gEfiFirmware= Volume2ProtocolGuid, (VOID**) &Fv); =20 // // FirmwareVolume2Protocol is PI, and is not required to be available. // - if (EFI_ERROR(Status)) { - return (NULL); + if (EFI_ERROR (Status)) { + return NULL; } =20 // @@ -83,15 +72,15 @@ FindLoadedImageFileName ( Buffer =3D NULL; Status =3D Fv->ReadSection(Fv, NameGuid, EFI_SECTION_USER_INTERFACE, 0, = &Buffer, &BufferSize, &AuthenticationStatus); =20 - if (EFI_ERROR(Status)) { - return (NULL); + if (EFI_ERROR (Status)) { + return NULL; } =20 // // ReadSection returns just the section data, without any section header= . For // a user interface section, the only data is the file name. // - return (Buffer); + return Buffer; } =20 /** @@ -269,7 +258,7 @@ LoadedImageProtocolDumpInformation( FileName =3D FindLoadedImageFileName(LoadedImage); =20 RetVal =3D NULL; - if (FileName) { + if (FileName !=3D NULL) { Temp =3D HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUM= P_NAME), NULL); =20 if (Temp !=3D NULL) { Thanks/Ray > -----Original Message----- > From: Jeff Westfahl [mailto:jeff.westfahl@ni.com] > Sent: Friday, May 5, 2017 5:53 AM > To: edk2-devel@lists.01.org > Cc: Jeff Westfahl ; Ni, Ruiyu ; > Carsey, Jaben > Subject: [PATCH 0/3] ShellPkg/HandleParsingLib: Show LoadedImageProtocol > info >=20 > In the old shell, 'dh -v' showed some useful information about the file p= ath > associated with a LoadedImageProtocol that is no longer shown in the mode= rn > shell. >=20 > For example, with the old shell: >=20 > Handle D3 (3A552218) > Image (3A54C918) File:MicrocodeUpdate > ParentHandle..: 3A666398 > SystemTable...: 3D2A8F18 > DeviceHandle..: 3B1C8098 > FilePath......: FvFile(F3331DE6-4A55-44E4-B767-7453F7A1A021) > ImageBase.....: 3D650000 - 3D655540 > ImageSize.....: 5540 > CodeType......: RT_code > DataType......: RT_data >=20 > compared to the new shell: >=20 > D3: 3A552218 > LoadedImage > Revision......: 0x00001000 > ParentHandle..: 3A666398 > SystemTable...: 3D2A8F18 > DeviceHandle..: 3B1C8098 > FilePath......: 3A552298 > OptionsSize...: 0 > LoadOptions...: 0 > ImageBase.....: 3D650000 > ImageSize.....: 5540 > CodeType......: EfiRuntimeServicesCode > DataType......: EfiRuntimeServicesData > Unload........: 0 >=20 > Here is the output for the same handle with this series applied: >=20 > D3: 3A552218 > LoadedImage > Name..........: MicrocodeUpdate > Revision......: 0x00001000 > ParentHandle..: 3A666398 > SystemTable...: 3D2A8F18 > DeviceHandle..: 3B1C8098 > FilePath......: FvFile(F3331DE6-4A55-44E4-B767-7453F7A1A021) > OptionsSize...: 0 > LoadOptions...: 0 > ImageBase.....: 3D650000 > ImageSize.....: 5540 > CodeType......: EfiRuntimeServicesCode > DataType......: EfiRuntimeServicesData > Unload........: 0 >=20 > Cc: Ruiyu Ni > Cc: Jaben Carsey >=20 > Jeff Westfahl (3): > ShellPkg/HandleParsingLib: Show LoadedImageProtocol file path as text > ShellPkg/HandleParsingLib: Open LoadedImageProtocol first > ShellPkg/HandleParsingLib: Show LoadedImageProtocol file name >=20 > .../UefiHandleParsingLib/UefiHandleParsingLib.c | 111 > +++++++++++++++++++-- > .../UefiHandleParsingLib/UefiHandleParsingLib.uni | 4 +- > 2 files changed, 104 insertions(+), 11 deletions(-) >=20 > -- > 2.7.4