From f4f3c6bf0a1198c3742416cc1039a0884fcecbd4 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Tue, 10 Jan 2012 20:51:04 +0000 Subject: [PATCH] ShellPkg: Add dump information for PCI Root Bridge IO protocol. This indirectly updates the DH command since it will automatically call the new function. signed-off-by: jcarsey reviewed-by: leegrosenbaum git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12922 6f19259b-4bc3-4df7-8a09-765794883524 --- .../UefiHandleParsingLib.c | 122 +++++++++++++++++- .../UefiHandleParsingLib.uni | Bin 22510 -> 24050 bytes 2 files changed, 121 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index 44ad4c0b55..6e44bcec75 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -13,6 +13,7 @@ **/ #include "UefiHandleParsingLib.h" +#include "IndustryStandard/Acpi10.h" EFI_HANDLE mHandleParsingHiiHandle; HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0}; @@ -160,6 +161,125 @@ LoadedImageProtocolDumpInformation( } */ +/** + Function to dump information about PciRootBridgeIo. + + 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 +PciRootBridgeIoDumpInformation( + IN CONST EFI_HANDLE TheHandle, + IN CONST BOOLEAN Verbose + ) +{ + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Configuration; + UINT64 Supports; + UINT64 Attributes; + CHAR16 *Temp; + CHAR16 *Temp2; + CHAR16 *RetVal; + EFI_STATUS Status; + + RetVal = NULL; + + if (!Verbose) { + return (CatSPrint(NULL, L"PciRootBridgeIo")); + } + + Status = gBS->HandleProtocol( + TheHandle, + &gEfiPciRootBridgeIoProtocolGuid, + (VOID**)&PciRootBridgeIo); + + if (EFI_ERROR(Status)) { + return NULL; + } + + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_PH), NULL); + Temp2 = CatSPrint(L"\r\n", Temp, PciRootBridgeIo->ParentHandle); + FreePool(Temp); + RetVal = Temp2; + Temp2 = NULL; + + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SEG), NULL); + Temp2 = CatSPrint(RetVal, Temp, PciRootBridgeIo->SegmentNumber); + FreePool(Temp); + FreePool(RetVal); + RetVal = Temp2; + Temp2 = NULL; + + Supports = 0; + Attributes = 0; + Status = PciRootBridgeIo->GetAttributes (PciRootBridgeIo, &Supports, &Attributes); + if (!EFI_ERROR(Status)) { + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_ATT), NULL); + Temp2 = CatSPrint(RetVal, Temp, Attributes); + FreePool(Temp); + FreePool(RetVal); + RetVal = Temp2; + Temp2 = NULL; + + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SUPPORTS), NULL); + Temp2 = CatSPrint(RetVal, Temp, Supports); + FreePool(Temp); + FreePool(RetVal); + RetVal = Temp2; + Temp2 = NULL; + } + + Configuration = NULL; + Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Configuration); + if (!EFI_ERROR(Status) && Configuration != NULL) { + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_TITLE), NULL); + Temp2 = CatSPrint(RetVal, Temp, Supports); + FreePool(Temp); + FreePool(RetVal); + RetVal = Temp2; + Temp2 = NULL; + while (Configuration->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) { + Temp = NULL; + switch (Configuration->ResType) { + case ACPI_ADDRESS_SPACE_TYPE_MEM: + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_MEM), NULL); + break; + case ACPI_ADDRESS_SPACE_TYPE_IO: + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_IO), NULL); + break; + case ACPI_ADDRESS_SPACE_TYPE_BUS: + Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_BUS), NULL); + break; + } + if (Temp != NULL) { + Temp2 = CatSPrint(RetVal, L"%s", Temp); + FreePool(Temp); + FreePool(RetVal); + RetVal = Temp2; + Temp2 = NULL; + } + + Temp2 = CatSPrint(RetVal, + L"%H%02x %016lx %016lx %02x%N\r\n", + Configuration->SpecificFlag, + Configuration->AddrRangeMin, + Configuration->AddrRangeMax, + Configuration->AddrSpaceGranularity + ); + FreePool(RetVal); + RetVal = Temp2; + Temp2 = NULL; + Configuration++; + } + } + return (RetVal); +} + /** Function to dump information about SimpleTextOut. @@ -381,7 +501,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = { {STRING_TOKEN(STR_BLK_IO), &gEfiBlockIoProtocolGuid, NULL}, {STRING_TOKEN(STR_UC), &gEfiUnicodeCollationProtocolGuid, NULL}, {STRING_TOKEN(STR_UC2), &gEfiUnicodeCollation2ProtocolGuid, NULL}, - {STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, NULL}, + {STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, PciRootBridgeIoDumpInformation}, {STRING_TOKEN(STR_PCI_IO), &gEfiPciIoProtocolGuid, NULL}, {STRING_TOKEN(STR_SCSI_PT), &gEfiScsiPassThruProtocolGuid, NULL}, {STRING_TOKEN(STR_SCSI_IO), &gEfiScsiIoProtocolGuid, NULL}, diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni index 096e6c8f4e6b5472d5aee5c33c6d6563b65368d7..6a9074eafe6e10599e3e6d65780f3e280287f9fe 100644 GIT binary patch delta 810 zcmb7C%}N4c6g@%+MW!W^5|SBW5mXXwf)VPtgBu|x8X`!GnxIzEGu$VzWt(c< z$~WjqTJ!{+86BIM3X03+{>*pJJ>Qw{{VDSC8hL(b$>UO5a@pu~6BQhy3IhsMW~%g} zDM`fhn>l!Dg0<)u<|aFbzN4K=xsCqu{@QBKeq zV&|~vVmi2gM=nDbQwt-P$<-$7Qyk%%nT4wn_Ai|0zjHRIiHZX>p+l2WblInhM%)Y9 zIk(t8^#5?Lz>t#Ra-a3ob|U-G7|B#3*+MGJOhFBbm@^xJDYyGI6$?y>nanuq2PW#g zo3n4YCli?9YtT`rH~8=RlWQw}hB|I}cgvmL;cGDY9|z1$YGFw~ksWVP{SMt`HJ93@ zPR`qDGqxG?h+#q&szq6^rd@waOx@*O6mQcu2Ika1