From nobody Thu Dec 26 13:35:48 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1506059438654448.83216523274575; Thu, 21 Sep 2017 22:50:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EEA712095E4F9; Thu, 21 Sep 2017 22:47:17 -0700 (PDT) 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 F412321ECCB2A for ; Thu, 21 Sep 2017 22:47:16 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 21 Sep 2017 22:50:24 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.7]) by fmsmga006.fm.intel.com with ESMTP; 21 Sep 2017 22:50:23 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,427,1500966000"; d="scan'208";a="154738617" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Fri, 22 Sep 2017 13:50:08 +0800 Message-Id: <20170922055014.27288-9-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.12.2.windows.2 In-Reply-To: <20170922055014.27288-1-ruiyu.ni@intel.com> References: <20170922055014.27288-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH 08/14] ShellPkg/dh: Modify the dump of BlockIo protocol 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: , Cc: Jaben Carsey , Huajing Li MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Huajing Li Reviewed-by: Ruiyu Ni Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Huajing Li --- .../UefiHandleParsingLib/UefiHandleParsingLib.c | 80 ++++++++++++++++++= +++- .../UefiHandleParsingLib/UefiHandleParsingLib.uni | 1 + 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b= /ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index ce2b49b5a2..fb67197171 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -1017,6 +1017,84 @@ BusSpecificDriverOverrideProtocolDumpInformation ( } =20 /** + Function to dump information about BlockIo protocol. + + This will allocate the return buffer from boot services pool. + + @param[in] TheHandle The handle that has the protocol installed. + @param[in] Verbose TRUE for additional information, FALSE otherwi= se. + + @retval A pointer to a string containing the information. +**/ +CHAR16* +EFIAPI +BlockIoProtocolDumpInformation ( + IN CONST EFI_HANDLE TheHandle, + IN CONST BOOLEAN Verbose + ) +{ + EFI_STATUS Status; + EFI_BLOCK_IO_PROTOCOL *BlockIo; + EFI_BLOCK_IO_MEDIA *BlockMedia; + CHAR16 *GetString; + CHAR16 *RetVal; + + if (!Verbose) { + return NULL; + } + GetString =3D NULL; + RetVal =3D NULL; + + Status =3D gBS->OpenProtocol ( + TheHandle, + &gEfiBlockIoProtocolGuid, + (VOID**)&BlockIo, + gImageHandle, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + if (EFI_ERROR (Status)) { + return NULL; + } + BlockMedia =3D BlockIo->Media; + // + // Per spec: + // The function (ReadBlocks) must return EFI_NO_MEDIA or + // EFI_MEDIA_CHANGED even if LBA, BufferSize, or Buffer are invalid so= the caller can probe + // for changes in media state. + // + BlockIo->ReadBlocks ( + BlockIo, + BlockIo->Media->MediaId, + 0, + 0, + NULL + ); + + HandleParsingHiiInit (); + GetString =3D HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_BL= OCKIO_INFO), NULL); + if (GetString =3D=3D NULL) { + return NULL; + } + RetVal =3D CatSPrint ( + RetVal, + GetString, + BlockMedia->RemovableMedia ? L"Removable " : L"Fixed ", + BlockMedia->MediaPresent ? L"" : L"not-present ", + BlockMedia->MediaId, + BlockMedia->BlockSize, + BlockMedia->LastBlock, + MultU64x32 (BlockMedia->LastBlock + 1, BlockMedia->BlockSize), + BlockMedia->LogicalPartition ? L"partition" : L"raw", + BlockMedia->ReadOnly ? L"ro" : L"rw", + BlockMedia->WriteCaching ? L"cached" : L"!cached" + ); + + SHELL_FREE_NON_NULL (GetString); + return RetVal; +} + +/** Function to dump information about EfiAdapterInformation Protocol. =20 @param[in] TheHandle The handle that has the protocol installed. @@ -1727,7 +1805,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] =3D { {STRING_TOKEN(STR_SIMPLE_FILE_SYS), &gEfiSimpleFileSystemProtocolG= uid, NULL}, {STRING_TOKEN(STR_TAPE_IO), &gEfiTapeIoProtocolGuid, = NULL}, {STRING_TOKEN(STR_DISK_IO), &gEfiDiskIoProtocolGuid, = NULL}, - {STRING_TOKEN(STR_BLK_IO), &gEfiBlockIoProtocolGuid, = NULL}, + {STRING_TOKEN(STR_BLK_IO), &gEfiBlockIoProtocolGuid, = BlockIoProtocolDumpInformation}, {STRING_TOKEN(STR_UC), &gEfiUnicodeCollationProtocolG= uid, NULL}, {STRING_TOKEN(STR_UC2), &gEfiUnicodeCollation2Protocol= Guid, NULL}, {STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGu= id, PciRootBridgeIoDumpInformation}, diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni= b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni index 3f9fc9cbac..eeb6aded6f 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni @@ -335,6 +335,7 @@ =20 #string STR_IDE_CONT_INIT #language en-US "IdeControllerInit" #string STR_DISK_INFO #language en-US "DiskInfo" +#string STR_BLOCKIO_INFO #language en-US " %s%sMId:%%H%x%%N bsiz= e %%H%x%%N, lblock %lx (%,ld), %s %s %s" =20 #string STR_PCIRB_DUMP_PH #language en-US " ParentHandle..: %H= %x%N\r\n" #string STR_PCIRB_DUMP_SEG #language en-US " Segment #.....: %H= %x%N\r\n" --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel