X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FUefiDevicePathLib%2FDevicePathToText.c;h=5922deeea840b2a75eb24565e61890e043e9a93c;hp=a4a665b31622b87e8363e041af3d4d6316663721;hb=c3c9892c3b4dafd1d0ccdc8e5e017d80e8c4361e;hpb=ab8686b892137598948469db3c6bd1793dca0d0b diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c index a4a665b316..5922deeea8 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c @@ -1,6 +1,7 @@ /** @file DevicePathToText protocol as defined in the UEFI 2.0 specification. + (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -41,6 +42,7 @@ UefiDevicePathLibCatPrint ( VA_START (Args, Fmt); Count = SPrintLength (Fmt, Args); + VA_END(Args); if ((Str->Count + (Count + 1)) * sizeof (CHAR16) > Str->Capacity) { Str->Capacity = (Str->Count + (Count + 1) * 2) * sizeof (CHAR16); @@ -51,6 +53,7 @@ UefiDevicePathLibCatPrint ( ); ASSERT (Str->Str != NULL); } + VA_START (Args, Fmt); UnicodeVSPrint (&Str->Str[Str->Count], Str->Capacity - Str->Count * sizeof (CHAR16), Fmt, Args); Str->Count += Count; @@ -306,6 +309,38 @@ DevPathToTextController ( ); } +/** + Converts a BMC device path structure to its string representative. + + @param Str The string representative of input device. + @param DevPath The input device path structure. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text + representation for a device node can be used, where applicable. + +**/ +VOID +DevPathToTextBmc ( + IN OUT POOL_PRINT *Str, + IN VOID *DevPath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +{ + BMC_DEVICE_PATH *Bmc; + + Bmc = DevPath; + UefiDevicePathLibCatPrint ( + Str, + L"BMC(0x%x,0x%lx)", + Bmc->InterfaceType, + ReadUnaligned64 ((UINT64 *) (&Bmc->BaseAddress)) + ); +} + /** Converts a ACPI device path structure to its string representative. @@ -789,6 +824,37 @@ DevPathToTextSd ( ); } +/** + Converts a EMMC (Embedded MMC) device path structure to its string representative. + + @param Str The string representative of input device. + @param DevPath The input device path structure. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text + representation for a device node can be used, where applicable. + +**/ +VOID +DevPathToTextEmmc ( + IN OUT POOL_PRINT *Str, + IN VOID *DevPath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +{ + EMMC_DEVICE_PATH *Emmc; + + Emmc = DevPath; + UefiDevicePathLibCatPrint ( + Str, + L"Emmc(0x%x)", + Emmc->SlotNumber + ); +} + /** Converts a 1394 device path structure to its string representative. @@ -1551,7 +1617,7 @@ DevPathToTextBluetooth ( Bluetooth = DevPath; UefiDevicePathLibCatPrint ( Str, - L"Bluetooth(%02x:%02x:%02x:%02x:%02x:%02x)", + L"Bluetooth(%02x%02x%02x%02x%02x%02x)", Bluetooth->BD_ADDR.Address[5], Bluetooth->BD_ADDR.Address[4], Bluetooth->BD_ADDR.Address[3], @@ -1561,6 +1627,38 @@ DevPathToTextBluetooth ( ); } +/** + Converts a Wi-Fi device path structure to its string representative. + + @param Str The string representative of input device. + @param DevPath The input device path structure. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text + representation for a device node can be used, where applicable. + +**/ +VOID +DevPathToTextWiFi ( + IN OUT POOL_PRINT *Str, + IN VOID *DevPath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +{ + WIFI_DEVICE_PATH *WiFi; + UINT8 SSId[33]; + + WiFi = DevPath; + + SSId[32] = '\0'; + CopyMem (SSId, WiFi->SSId, 32); + + UefiDevicePathLibCatPrint (Str, L"Wi-Fi(%a)", SSId); +} + /** Converts a URI device path structure to its string representative. @@ -1830,6 +1928,75 @@ DevPathRelativeOffsetRange ( ); } +/** + Converts a Ram Disk device path structure to its string representative. + + @param Str The string representative of input device. + @param DevPath The input device path structure. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text + representation for a device node can be used, where applicable. + +**/ +VOID +DevPathToTextRamDisk ( + IN OUT POOL_PRINT *Str, + IN VOID *DevPath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +{ + MEDIA_RAM_DISK_DEVICE_PATH *RamDisk; + + RamDisk = DevPath; + + if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualDiskGuid)) { + UefiDevicePathLibCatPrint ( + Str, + L"VirtualDisk(0x%lx,0x%lx,%d)", + LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], + LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], + RamDisk->Instance + ); + } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid)) { + UefiDevicePathLibCatPrint ( + Str, + L"VirtualCD(0x%lx,0x%lx,%d)", + LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], + LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], + RamDisk->Instance + ); + } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid)) { + UefiDevicePathLibCatPrint ( + Str, + L"PersistentVirtualDisk(0x%lx,0x%lx,%d)", + LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], + LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], + RamDisk->Instance + ); + } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid)) { + UefiDevicePathLibCatPrint ( + Str, + L"PersistentVirtualCD(0x%lx,0x%lx,%d)", + LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], + LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], + RamDisk->Instance + ); + } else { + UefiDevicePathLibCatPrint ( + Str, + L"RamDisk(0x%lx,0x%lx,%d,%g)", + LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], + LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], + RamDisk->Instance, + &RamDisk->TypeGuid + ); + } +} + /** Converts a BIOS Boot Specification device path structure to its string representative. @@ -1993,6 +2160,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib {HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap }, {HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor }, {HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController }, + {HARDWARE_DEVICE_PATH, HW_BMC_DP, DevPathToTextBmc }, {ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi }, {ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx }, {ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr }, @@ -2004,6 +2172,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib {MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe }, {MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs }, {MESSAGING_DEVICE_PATH, MSG_SD_DP, DevPathToTextSd }, + {MESSAGING_DEVICE_PATH, MSG_EMMC_DP, DevPathToTextEmmc }, {MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 }, {MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb }, {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID }, @@ -2021,6 +2190,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib {MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan }, {MESSAGING_DEVICE_PATH, MSG_URI_DP, DevPathToTextUri }, {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth }, + {MESSAGING_DEVICE_PATH, MSG_WIFI_DP, DevPathToTextWiFi }, {MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive }, {MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM }, {MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor }, @@ -2029,6 +2199,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib {MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv }, {MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile }, {MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange }, + {MEDIA_DEVICE_PATH, MEDIA_RAM_DISK_DP, DevPathToTextRamDisk }, {BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS }, {END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance }, {0, 0, NULL}