From nobody Thu Dec 26 13:40:42 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 1506059447310626.8432577648693; Thu, 21 Sep 2017 22:50:47 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AA4202095E503; Thu, 21 Sep 2017 22:47:23 -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 CC2FE2095E4E2 for ; Thu, 21 Sep 2017 22:47:19 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 21 Sep 2017 22:50:27 -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:26 -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="154738632" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Fri, 22 Sep 2017 13:50:11 +0800 Message-Id: <20170922055014.27288-12-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 11/14] ShellPkg/dh: Modify the dump of PciIo 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 | 87 ++++++++++++++++++= +++- .../UefiHandleParsingLib/UefiHandleParsingLib.uni | 11 ++- 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b= /ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index 1c62415e86..e5b4bea8f6 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -16,6 +16,7 @@ =20 #include "UefiHandleParsingLib.h" #include "IndustryStandard/Acpi10.h" +#include "IndustryStandard/Pci.h" #include #include =20 @@ -1160,6 +1161,90 @@ DebugSupportProtocolDumpInformation ( } =20 /** + Function to dump information about PciIoProtocol. + + 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 otherwi= se. + + @retval A poitner to a string containing the information. +**/ +CHAR16* +EFIAPI +PciIoProtocolDumpInformation ( + IN CONST EFI_HANDLE TheHandle, + IN CONST BOOLEAN Verbose + ) +{ + EFI_STATUS Status; + EFI_PCI_IO_PROTOCOL *PciIo; + PCI_TYPE00 Pci; + UINTN Segment; + UINTN Bus; + UINTN Device; + UINTN Function; + UINTN Index; + CHAR16 *GetString; + CHAR16 *TempRetVal; + CHAR16 *RetVal; + + if (!Verbose) { + return (NULL); + } + RetVal =3D NULL; + GetString =3D NULL; + TempRetVal =3D NULL; + Status =3D gBS->OpenProtocol ( + TheHandle, + &gEfiPciIoProtocolGuid, + (VOID**)&PciIo, + gImageHandle, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + + if (EFI_ERROR(Status)) { + return NULL; + } + PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (Pci), &Pci); + PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function); + HandleParsingHiiInit (); + GetString =3D HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PC= IIO_DUMP_MAIN), NULL); + if (GetString =3D=3D NULL) { + return NULL; + } + RetVal =3D CatSPrint ( + NULL, + GetString, + Segment, + Bus, + Device, + Function, + PciIo->RomSize, + PciIo->RomImage, + Pci.Hdr.VendorId, + Pci.Hdr.DeviceId, + Pci.Hdr.ClassCode[0], + Pci.Hdr.ClassCode[1], + Pci.Hdr.ClassCode[2] + ); + for (Index =3D 0; Index < sizeof (Pci); Index ++) { + if ((Index % 0x10) =3D=3D 0) { + TempRetVal =3D CatSPrint (RetVal, L"\r\n %02x", *((UINT8 *) (&= Pci) + Index)); + } else { + TempRetVal =3D CatSPrint (RetVal, L"%02x", *((UINT8 *) (&Pci) + Inde= x)); + } + FreePool (RetVal); + RetVal =3D TempRetVal; + TempRetVal =3D NULL; + } + + FreePool(GetString); + return RetVal; +} + +/** Function to dump information about EfiAdapterInformation Protocol. =20 @param[in] TheHandle The handle that has the protocol installed. @@ -1874,7 +1959,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] =3D { {STRING_TOKEN(STR_UC), &gEfiUnicodeCollationProtocolG= uid, NULL}, {STRING_TOKEN(STR_UC2), &gEfiUnicodeCollation2Protocol= Guid, NULL}, {STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGu= id, PciRootBridgeIoDumpInformation}, - {STRING_TOKEN(STR_PCI_IO), &gEfiPciIoProtocolGuid, = NULL}, + {STRING_TOKEN(STR_PCI_IO), &gEfiPciIoProtocolGuid, = PciIoProtocolDumpInformation}, {STRING_TOKEN(STR_SCSI_PT), &gEfiScsiPassThruProtocolGuid,= NULL}, {STRING_TOKEN(STR_SCSI_IO), &gEfiScsiIoProtocolGuid, = NULL}, {STRING_TOKEN(STR_SCSI_PT_EXT), &gEfiExtScsiPassThruProtocolGu= id, NULL}, diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni= b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni index 4b0c67b42a..59409d9ca0 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni @@ -348,7 +348,16 @@ #string STR_PCIRB_DUMP_IO #language en-US " IO : " #string STR_PCIRB_DUMP_TITLE #language en-US " Type Flag Base = Limit Gran\r\n" " =3D=3D=3D=3D =3D= =3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D\r\n" - +#string STR_PCIIO_DUMP_MAIN #language en-US " Segment #.....: %0= 2x\r\n" + " Bus #.........: %0= 2x\r\n" + " Device #......: %0= 2x\r\n" + " Function #....: %0= 2x\r\n" + " ROM Size......: %l= x\r\n" + " ROM Location..: %0= 8x\r\n" + " Vendor ID.....: %0= 4x\r\n" + " Device ID.....: %0= 4x\r\n" + " Class Code....: %0= 2x %02x %02x\r\n" + " Configuration Head= er :" =20 =20 #string STR_LI_DUMP_NAME #language en-US " Name..........: %%= H%s%%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