From ea49e59ed0fc50085716e55d66395b6afef8a554 Mon Sep 17 00:00:00 2001 From: Konstantin Aladyshev Date: Mon, 12 Jul 2021 15:28:51 +0300 Subject: Update UefiLessonsPkg Signed-off-by: Konstantin Aladyshev --- UefiLessonsPkg/ListPCI/ListPCI.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'UefiLessonsPkg/ListPCI') diff --git a/UefiLessonsPkg/ListPCI/ListPCI.c b/UefiLessonsPkg/ListPCI/ListPCI.c index 6eb2eef..055906c 100644 --- a/UefiLessonsPkg/ListPCI/ListPCI.c +++ b/UefiLessonsPkg/ListPCI/ListPCI.c @@ -20,12 +20,15 @@ VOID ToLowerASCII(CHAR8* Str, UINTN Size) } } -EFI_STATUS FindPCIDevDescription(UINT16 VendorId, - UINT16 DeviceId, - CHAR16* VendorDesc, - CHAR16* DeviceDesc, - UINTN DescBufferSize) +EFI_STATUS FindPCIDevDescription(IN UINT16 VendorId, + IN UINT16 DeviceId, + OUT CHAR16* VendorDesc, + OUT CHAR16* DeviceDesc, + IN UINTN DescBufferSize) { + BOOLEAN Vendor_found = FALSE; + BOOLEAN Device_found = FALSE; + EFI_STATUS Status = ShellFileExists(L"pci.ids"); if (EFI_ERROR(Status)) { @@ -70,8 +73,6 @@ EFI_STATUS FindPCIDevDescription(UINT16 VendorId, CHAR8 Buffer[BLOCK_READ_SIZE]; UINTN Size; UINT64 FilePos = 0; - BOOLEAN Vendor_found = FALSE; - BOOLEAN Device_found = FALSE; while (TRUE) { Size = BLOCK_READ_SIZE; @@ -88,7 +89,7 @@ EFI_STATUS FindPCIDevDescription(UINT16 VendorId, StrEnd=i; if (!Vendor_found){ // 0123456 7 - //\nXXXX ||\n + //\nVVVV ||\n if ((StrEnd - StrStart) > 7) { if ((Buffer[StrStart+1]==VendorStr[0]) && (Buffer[StrStart+2]==VendorStr[1]) && @@ -101,7 +102,7 @@ EFI_STATUS FindPCIDevDescription(UINT16 VendorId, } } else { // 0 1234567 8 - //\n\tXXXX ||\n + //\n\tDDDD ||\n if ((StrEnd - StrStart) > 8) { if ((Buffer[StrStart+1]=='\t') && (Buffer[StrStart+2]==DeviceStr[0]) && @@ -111,7 +112,7 @@ EFI_STATUS FindPCIDevDescription(UINT16 VendorId, Buffer[StrEnd] = 0; UnicodeSPrintAsciiFormat(DeviceDesc, DescBufferSize, "%a", &Buffer[StrStart+1+1+4+2]); Device_found = TRUE; - break; + goto end; } } } @@ -186,7 +187,7 @@ EFI_STATUS PrintRootBridge(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL* PciRootBridgeIo) ); if (!EFI_ERROR(Status)) { if (PCIConfHdr.VendorId != 0xffff) { - Print(L"\t%02x:%02x.%02x - Vendor:%04x, Device:%04x", + Print(L" %02x:%02x.%02x - Vendor:%04x, Device:%04x", Bus, Device, Func, @@ -207,7 +208,7 @@ EFI_STATUS PrintRootBridge(EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL* PciRootBridgeIo) } } } else { - Print(L"\tError in PCI read: %r\n", Status); + Print(L" Error in PCI read: %r\n", Status); } } } -- cgit v1.2.3-18-g5258