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 B57B32095E4E3 for ; Thu, 21 Sep 2017 22:47:20 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 21 Sep 2017 22:50:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,427,1500966000"; d="scan'208";a="154738635" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.7]) by fmsmga006.fm.intel.com with ESMTP; 21 Sep 2017 22:50:27 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Huajing Li , Jaben Carsey Date: Fri, 22 Sep 2017 13:50:12 +0800 Message-Id: <20170922055014.27288-13-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: [PATCH 12/14] ShellPkg/dh: Modify the dump of UsbIo 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: , X-List-Received-Date: Fri, 22 Sep 2017 05:47:20 -0000 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 | 61 +++++++++++++++++++++- .../UefiHandleParsingLib/UefiHandleParsingLib.uni | 5 +- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index e5b4bea8f6..164caa9b91 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -1245,6 +1245,65 @@ PciIoProtocolDumpInformation ( } /** + Function to dump information about UsbIoProtocol. + + This will allocate the return buffer from boot services pool. + + @param[in] TheHandle The handle that has PciRootBridgeIo installed. + @param[in] Verbose TRUE for additional information, FALSE otherwise. + + @retval A poitner to a string containing the information. +**/ +CHAR16* +EFIAPI +UsbIoProtocolDumpInformation ( + IN CONST EFI_HANDLE TheHandle, + IN CONST BOOLEAN Verbose + ) +{ + EFI_STATUS Status; + EFI_USB_IO_PROTOCOL *UsbIo; + EFI_USB_INTERFACE_DESCRIPTOR InterfaceDesc; + CHAR16 *GetString; + CHAR16 *RetVal; + + if (!Verbose) { + return (NULL); + } + RetVal = NULL; + GetString = NULL; + Status = gBS->OpenProtocol ( + TheHandle, + &gEfiUsbIoProtocolGuid, + (VOID**)&UsbIo, + gImageHandle, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + + if (EFI_ERROR(Status)) { + return NULL; + } + UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc); + HandleParsingHiiInit (); + GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_USBIO_DUMP_MAIN), NULL); + if (GetString == NULL) { + return NULL; + } + RetVal = CatSPrint ( + NULL, + GetString, + InterfaceDesc.InterfaceNumber, + InterfaceDesc.InterfaceClass, + InterfaceDesc.InterfaceSubClass, + InterfaceDesc.InterfaceProtocol + ); + + FreePool (GetString); + return RetVal; +} + +/** Function to dump information about EfiAdapterInformation Protocol. @param[in] TheHandle The handle that has the protocol installed. @@ -1964,7 +2023,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = { {STRING_TOKEN(STR_SCSI_IO), &gEfiScsiIoProtocolGuid, NULL}, {STRING_TOKEN(STR_SCSI_PT_EXT), &gEfiExtScsiPassThruProtocolGuid, NULL}, {STRING_TOKEN(STR_ISCSI), &gEfiIScsiInitiatorNameProtocolGuid, NULL}, - {STRING_TOKEN(STR_USB_IO), &gEfiUsbIoProtocolGuid, NULL}, + {STRING_TOKEN(STR_USB_IO), &gEfiUsbIoProtocolGuid, UsbIoProtocolDumpInformation}, {STRING_TOKEN(STR_USB_HC), &gEfiUsbHcProtocolGuid, NULL}, {STRING_TOKEN(STR_USB_HC2), &gEfiUsb2HcProtocolGuid, NULL}, {STRING_TOKEN(STR_DEBUG_SUPPORT), &gEfiDebugSupportProtocolGuid, DebugSupportProtocolDumpInformation}, diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni index 59409d9ca0..98299cd1d0 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni @@ -358,7 +358,10 @@ " Device ID.....: %04x\r\n" " Class Code....: %02x %02x %02x\r\n" " Configuration Header :" - +#string STR_USBIO_DUMP_MAIN #language en-US " Interface Number #.....: %02x\r\n" + " Interface Class #......: %02x\r\n" + " Interface Subclass #...: %02x\r\n" + " Interface Protocol #...: %02x" #string STR_LI_DUMP_NAME #language en-US " Name..........: %%H%s%%N\r\n" -- 2.12.2.windows.2