\r
#include "UefiHandleParsingLib.h"\r
#include "IndustryStandard/Acpi10.h"\r
+#include "IndustryStandard/Pci.h"\r
#include <PiDxe.h>\r
#include <Protocol/FirmwareVolume2.h>\r
\r
return RetVal;\r
}\r
\r
+/**\r
+ Function to dump information about PciIoProtocol.\r
+\r
+ This will allocate the return buffer from boot services pool.\r
+\r
+ @param[in] TheHandle The handle that has PciRootBridgeIo installed.\r
+ @param[in] Verbose TRUE for additional information, FALSE otherwise.\r
+\r
+ @retval A poitner to a string containing the information.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+PciIoProtocolDumpInformation (\r
+ IN CONST EFI_HANDLE TheHandle,\r
+ IN CONST BOOLEAN Verbose\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
+ PCI_TYPE00 Pci;\r
+ UINTN Segment;\r
+ UINTN Bus;\r
+ UINTN Device;\r
+ UINTN Function;\r
+ UINTN Index;\r
+ CHAR16 *GetString;\r
+ CHAR16 *TempRetVal;\r
+ CHAR16 *RetVal;\r
+\r
+ if (!Verbose) {\r
+ return (NULL);\r
+ }\r
+ RetVal = NULL;\r
+ GetString = NULL;\r
+ TempRetVal = NULL;\r
+ Status = gBS->OpenProtocol (\r
+ TheHandle,\r
+ &gEfiPciIoProtocolGuid,\r
+ (VOID**)&PciIo,\r
+ gImageHandle,\r
+ NULL,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
+\r
+ if (EFI_ERROR(Status)) {\r
+ return NULL;\r
+ }\r
+ PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (Pci), &Pci);\r
+ PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);\r
+ HandleParsingHiiInit ();\r
+ GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIIO_DUMP_MAIN), NULL);\r
+ if (GetString == NULL) {\r
+ return NULL;\r
+ }\r
+ RetVal = CatSPrint (\r
+ NULL,\r
+ GetString,\r
+ Segment,\r
+ Bus,\r
+ Device,\r
+ Function,\r
+ PciIo->RomSize,\r
+ PciIo->RomImage,\r
+ Pci.Hdr.VendorId,\r
+ Pci.Hdr.DeviceId,\r
+ Pci.Hdr.ClassCode[0],\r
+ Pci.Hdr.ClassCode[1],\r
+ Pci.Hdr.ClassCode[2]\r
+ );\r
+ for (Index = 0; Index < sizeof (Pci); Index ++) {\r
+ if ((Index % 0x10) == 0) {\r
+ TempRetVal = CatSPrint (RetVal, L"\r\n %02x", *((UINT8 *) (&Pci) + Index));\r
+ } else {\r
+ TempRetVal = CatSPrint (RetVal, L"%02x", *((UINT8 *) (&Pci) + Index));\r
+ }\r
+ FreePool (RetVal);\r
+ RetVal = TempRetVal;\r
+ TempRetVal = NULL;\r
+ }\r
+\r
+ FreePool(GetString);\r
+ return RetVal;\r
+}\r
+\r
/**\r
Function to dump information about EfiAdapterInformation Protocol.\r
\r
{STRING_TOKEN(STR_UC), &gEfiUnicodeCollationProtocolGuid, NULL},\r
{STRING_TOKEN(STR_UC2), &gEfiUnicodeCollation2ProtocolGuid, NULL},\r
{STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, PciRootBridgeIoDumpInformation},\r
- {STRING_TOKEN(STR_PCI_IO), &gEfiPciIoProtocolGuid, NULL},\r
+ {STRING_TOKEN(STR_PCI_IO), &gEfiPciIoProtocolGuid, PciIoProtocolDumpInformation},\r
{STRING_TOKEN(STR_SCSI_PT), &gEfiScsiPassThruProtocolGuid, NULL},\r
{STRING_TOKEN(STR_SCSI_IO), &gEfiScsiIoProtocolGuid, NULL},\r
{STRING_TOKEN(STR_SCSI_PT_EXT), &gEfiExtScsiPassThruProtocolGuid, NULL},\r
#string STR_PCIRB_DUMP_IO #language en-US " IO : "\r
#string STR_PCIRB_DUMP_TITLE #language en-US " Type Flag Base Limit Gran\r\n"\r
" ==== ==== ================ ================ ====\r\n"\r
-\r
+#string STR_PCIIO_DUMP_MAIN #language en-US " Segment #.....: %02x\r\n"\r
+ " Bus #.........: %02x\r\n"\r
+ " Device #......: %02x\r\n"\r
+ " Function #....: %02x\r\n"\r
+ " ROM Size......: %lx\r\n"\r
+ " ROM Location..: %08x\r\n"\r
+ " Vendor ID.....: %04x\r\n"\r
+ " Device ID.....: %04x\r\n"\r
+ " Class Code....: %02x %02x %02x\r\n"\r
+ " Configuration Header :"\r
\r
\r
#string STR_LI_DUMP_NAME #language en-US " Name..........: %%H%s%%N\r\n"\r