2008-04-09 07:50:10 +02:00
|
|
|
/** @file
|
|
|
|
DevicePathToText protocol as defined in the UEFI 2.0 specification.
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2010-01-25 04:40:18 +01:00
|
|
|
Copyright (c) 2006 - 2010, Intel Corporation. <BR>
|
2008-04-09 07:50:10 +02:00
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-04-09 07:50:10 +02:00
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-04-09 07:50:10 +02:00
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
|
|
|
|
#include "DevicePath.h"
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
|
|
|
Concatenates a formatted unicode string to allocated pool. The caller must
|
|
|
|
free the resulting buffer.
|
|
|
|
|
|
|
|
@param Str Tracks the allocated pool, size in use, and
|
|
|
|
amount of pool allocated.
|
|
|
|
@param Fmt The format string
|
|
|
|
@param ... Variable arguments based on the format string.
|
|
|
|
|
|
|
|
@return Allocated buffer with the formatted string printed in it.
|
|
|
|
The caller must free the allocated buffer. The buffer
|
|
|
|
allocation is not packed.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
CHAR16 *
|
|
|
|
CatPrint (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN CHAR16 *Fmt,
|
|
|
|
...
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINT16 *AppendStr;
|
|
|
|
VA_LIST Args;
|
|
|
|
UINTN Size;
|
|
|
|
|
|
|
|
AppendStr = AllocateZeroPool (0x1000);
|
|
|
|
if (AppendStr == NULL) {
|
|
|
|
return Str->Str;
|
|
|
|
}
|
|
|
|
|
|
|
|
VA_START (Args, Fmt);
|
|
|
|
UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);
|
|
|
|
VA_END (Args);
|
|
|
|
if (NULL == Str->Str) {
|
|
|
|
Size = StrSize (AppendStr);
|
|
|
|
Str->Str = AllocateZeroPool (Size);
|
|
|
|
ASSERT (Str->Str != NULL);
|
|
|
|
} else {
|
2008-07-16 03:10:45 +02:00
|
|
|
Size = StrSize (AppendStr) - sizeof (UINT16);
|
2007-07-05 09:05:28 +02:00
|
|
|
Size = Size + StrSize (Str->Str);
|
|
|
|
Str->Str = ReallocatePool (
|
2008-12-23 17:20:43 +01:00
|
|
|
StrSize (Str->Str),
|
|
|
|
Size,
|
|
|
|
Str->Str
|
|
|
|
);
|
2007-07-05 09:05:28 +02:00
|
|
|
ASSERT (Str->Str != NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
Str->MaxLen = MAX_CHAR * sizeof (UINT16);
|
|
|
|
if (Size < Str->MaxLen) {
|
|
|
|
StrCat (Str->Str, AppendStr);
|
|
|
|
Str->Len = Size - sizeof (UINT16);
|
|
|
|
}
|
|
|
|
|
|
|
|
FreePool (AppendStr);
|
|
|
|
return Str->Str;
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a PCI device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextPci (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
PCI_DEVICE_PATH *Pci;
|
|
|
|
|
|
|
|
Pci = DevPath;
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Pci(0x%x,0x%x)", (UINTN) Pci->Device, (UINTN) Pci->Function);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a PC Card device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextPccard (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
PCCARD_DEVICE_PATH *Pccard;
|
|
|
|
|
|
|
|
Pccard = DevPath;
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"PcCard(0x%x)", (UINTN) Pccard->FunctionNumber);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Memory Map device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextMemMap (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
MEMMAP_DEVICE_PATH *MemMap;
|
|
|
|
|
|
|
|
MemMap = DevPath;
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"MemoryMapped(0x%x,0x%lx,0x%lx)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) MemMap->MemoryType,
|
2007-07-05 09:05:28 +02:00
|
|
|
MemMap->StartingAddress,
|
|
|
|
MemMap->EndingAddress
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Vendor device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextVendor (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
VENDOR_DEVICE_PATH *Vendor;
|
|
|
|
CHAR16 *Type;
|
|
|
|
UINTN Index;
|
2007-09-24 08:55:50 +02:00
|
|
|
UINTN DataLength;
|
2007-07-05 09:05:28 +02:00
|
|
|
UINT32 FlowControlMap;
|
|
|
|
UINT16 Info;
|
|
|
|
|
|
|
|
Vendor = (VENDOR_DEVICE_PATH *) DevPath;
|
|
|
|
switch (DevicePathType (&Vendor->Header)) {
|
|
|
|
case HARDWARE_DEVICE_PATH:
|
|
|
|
Type = L"Hw";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MESSAGING_DEVICE_PATH:
|
|
|
|
Type = L"Msg";
|
|
|
|
if (AllowShortcuts) {
|
|
|
|
if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {
|
|
|
|
CatPrint (Str, L"VenPcAnsi()");
|
|
|
|
return ;
|
|
|
|
} else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {
|
|
|
|
CatPrint (Str, L"VenVt100()");
|
|
|
|
return ;
|
|
|
|
} else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {
|
|
|
|
CatPrint (Str, L"VenVt100Plus()");
|
|
|
|
return ;
|
|
|
|
} else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
|
|
|
|
CatPrint (Str, L"VenUft8()");
|
|
|
|
return ;
|
2008-12-23 17:20:43 +01:00
|
|
|
} else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {
|
2007-07-05 09:05:28 +02:00
|
|
|
FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);
|
|
|
|
switch (FlowControlMap & 0x00000003) {
|
|
|
|
case 0:
|
|
|
|
CatPrint (Str, L"UartFlowCtrl(%s)", L"None");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
CatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
CatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ;
|
2008-12-23 17:20:43 +01:00
|
|
|
} else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"SAS(0x%lx,0x%lx,0x%x,",
|
2007-07-05 09:05:28 +02:00
|
|
|
((SAS_DEVICE_PATH *) Vendor)->SasAddress,
|
|
|
|
((SAS_DEVICE_PATH *) Vendor)->Lun,
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) ((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology);
|
|
|
|
if ((Info & 0x0f) == 0) {
|
|
|
|
CatPrint (Str, L"NoTopology,0,0,0,");
|
|
|
|
} else if (((Info & 0x0f) == 1) || ((Info & 0x0f) == 2)) {
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"%s,%s,%s,",
|
2008-07-16 03:10:45 +02:00
|
|
|
((Info & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",
|
|
|
|
((Info & (0x1 << 5)) != 0) ? L"External" : L"Internal",
|
|
|
|
((Info & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
if ((Info & 0x0f) == 1) {
|
|
|
|
CatPrint (Str, L"0,");
|
|
|
|
} else {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"0x%x,",(UINTN) (Info >> 8) & 0xff);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
CatPrint (Str, L"0,0,0,0,");
|
|
|
|
}
|
|
|
|
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"0x%x)", (UINTN) ((SAS_DEVICE_PATH *) Vendor)->Reserved);
|
2007-07-05 09:05:28 +02:00
|
|
|
return ;
|
|
|
|
} else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {
|
|
|
|
CatPrint (Str, L"DebugPort()");
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MEDIA_DEVICE_PATH:
|
|
|
|
Type = L"Media";
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
Type = L"?";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH);
|
|
|
|
CatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid);
|
|
|
|
if (DataLength != 0) {
|
|
|
|
CatPrint (Str, L",");
|
|
|
|
for (Index = 0; Index < DataLength; Index++) {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"%02x", (UINTN) ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);
|
2007-09-24 08:55:50 +02:00
|
|
|
}
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CatPrint (Str, L")");
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Controller device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextController (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CONTROLLER_DEVICE_PATH *Controller;
|
|
|
|
|
|
|
|
Controller = DevPath;
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"Ctrl(0x%x)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) Controller->ControllerNumber
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a ACPI device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextAcpi (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
ACPI_HID_DEVICE_PATH *Acpi;
|
|
|
|
|
|
|
|
Acpi = DevPath;
|
|
|
|
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
|
2007-09-24 08:55:50 +02:00
|
|
|
switch (EISA_ID_TO_NUM (Acpi->HID)) {
|
|
|
|
case 0x0a03:
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"PciRoot(0x%x)", (UINTN) Acpi->UID);
|
2007-09-24 08:55:50 +02:00
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case 0x0604:
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Floppy(0x%x)", (UINTN) Acpi->UID);
|
2007-09-24 08:55:50 +02:00
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case 0x0301:
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Keyboard(0x%x)", (UINTN) Acpi->UID);
|
2007-09-24 08:55:50 +02:00
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case 0x0501:
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Serial(0x%x)", (UINTN) Acpi->UID);
|
2007-09-24 08:55:50 +02:00
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case 0x0401:
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"ParallelPort(0x%x)", (UINTN) Acpi->UID);
|
2007-09-24 08:55:50 +02:00
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
default:
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Acpi(PNP%04x,0x%x)", (UINTN) EISA_ID_TO_NUM (Acpi->HID), (UINTN) Acpi->UID);
|
2007-09-24 08:55:50 +02:00
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
} else {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Acpi(0x%08x,0x%x)", (UINTN) Acpi->HID, (UINTN) Acpi->UID);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
|
|
|
Converts EISA identification to string.
|
|
|
|
|
|
|
|
@param EisaId The input EISA identification.
|
|
|
|
@param Text A pointer to the output string.
|
|
|
|
|
|
|
|
**/
|
2007-09-24 08:55:50 +02:00
|
|
|
VOID
|
|
|
|
EisaIdToText (
|
|
|
|
IN UINT32 EisaId,
|
2008-07-16 03:10:45 +02:00
|
|
|
IN OUT CHAR16 *Text
|
2007-09-24 08:55:50 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
CHAR16 PnpIdStr[17];
|
|
|
|
|
|
|
|
//
|
|
|
|
//UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"
|
|
|
|
//
|
2008-01-25 04:14:35 +01:00
|
|
|
UnicodeSPrint (PnpIdStr, 17 * 2, L"%16X", EisaId >> 16);
|
2007-09-24 08:55:50 +02:00
|
|
|
|
|
|
|
UnicodeSPrint (
|
|
|
|
Text,
|
2008-01-25 04:14:35 +01:00
|
|
|
sizeof (CHAR16) + sizeof (CHAR16) + sizeof (CHAR16) + sizeof (PnpIdStr),
|
2007-09-24 08:55:50 +02:00
|
|
|
L"%c%c%c%s",
|
|
|
|
'@' + ((EisaId >> 10) & 0x1f),
|
|
|
|
'@' + ((EisaId >> 5) & 0x1f),
|
|
|
|
'@' + ((EisaId >> 0) & 0x1f),
|
|
|
|
PnpIdStr + (16 - 4)
|
|
|
|
);
|
|
|
|
}
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a ACPI extended HID device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
2007-09-24 08:55:50 +02:00
|
|
|
DevPathToTextAcpiEx (
|
2007-07-05 09:05:28 +02:00
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
2007-09-24 08:55:50 +02:00
|
|
|
ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;
|
|
|
|
CHAR8 *HIDStr;
|
|
|
|
CHAR8 *UIDStr;
|
|
|
|
CHAR8 *CIDStr;
|
|
|
|
CHAR16 HIDText[11];
|
|
|
|
CHAR16 CIDText[11];
|
|
|
|
|
|
|
|
AcpiEx = DevPath;
|
|
|
|
HIDStr = (CHAR8 *) (((UINT8 *) AcpiEx) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
|
|
|
|
UIDStr = HIDStr + AsciiStrLen (HIDStr) + 1;
|
|
|
|
CIDStr = UIDStr + AsciiStrLen (UIDStr) + 1;
|
|
|
|
|
|
|
|
EisaIdToText (AcpiEx->HID, HIDText);
|
|
|
|
EisaIdToText (AcpiEx->CID, CIDText);
|
|
|
|
|
|
|
|
if ((*HIDStr == '\0') && (*CIDStr == '\0') && (AcpiEx->UID == 0)) {
|
|
|
|
//
|
|
|
|
// use AcpiExp()
|
|
|
|
//
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"AcpiExp(%s,%s,%a)",
|
|
|
|
HIDText,
|
|
|
|
CIDText,
|
|
|
|
UIDStr
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
if (AllowShortcuts) {
|
|
|
|
//
|
|
|
|
// display only
|
|
|
|
//
|
|
|
|
if (AcpiEx->HID == 0) {
|
|
|
|
CatPrint (Str, L"AcpiEx(%a,", HIDStr);
|
|
|
|
} else {
|
|
|
|
CatPrint (Str, L"AcpiEx(%s,", HIDText);
|
|
|
|
}
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
if (AcpiEx->UID == 0) {
|
|
|
|
CatPrint (Str, L"%a,", UIDStr);
|
|
|
|
} else {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"0x%x,", (UINTN) AcpiEx->UID);
|
2007-09-24 08:55:50 +02:00
|
|
|
}
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
if (AcpiEx->CID == 0) {
|
|
|
|
CatPrint (Str, L"%a)", CIDStr);
|
2007-07-05 09:05:28 +02:00
|
|
|
} else {
|
2007-09-24 08:55:50 +02:00
|
|
|
CatPrint (Str, L"%s)", CIDText);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
2007-09-24 08:55:50 +02:00
|
|
|
} else {
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
|
|
|
|
HIDText,
|
|
|
|
CIDText,
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) AcpiEx->UID,
|
2007-09-24 08:55:50 +02:00
|
|
|
HIDStr,
|
|
|
|
CIDStr,
|
|
|
|
UIDStr
|
|
|
|
);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
}
|
2007-09-24 08:55:50 +02:00
|
|
|
}
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a ACPI address device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-09-24 08:55:50 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextAcpiAdr (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
ACPI_ADR_DEVICE_PATH *AcpiAdr;
|
|
|
|
UINT16 Index;
|
|
|
|
UINT16 Length;
|
|
|
|
UINT16 AdditionalAdrCount;
|
|
|
|
|
|
|
|
AcpiAdr = DevPath;
|
|
|
|
Length = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);
|
|
|
|
AdditionalAdrCount = (UINT16) ((Length - 8) / 4);
|
|
|
|
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"AcpiAdr(0x%x", (UINTN) AcpiAdr->ADR);
|
2007-09-24 08:55:50 +02:00
|
|
|
for (Index = 0; Index < AdditionalAdrCount; Index++) {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L",0x%x", (UINTN) *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
2007-09-24 08:55:50 +02:00
|
|
|
CatPrint (Str, L")");
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a ATAPI device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextAtapi (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
ATAPI_DEVICE_PATH *Atapi;
|
|
|
|
|
|
|
|
Atapi = DevPath;
|
|
|
|
|
|
|
|
if (DisplayOnly) {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Ata(0x%x)", (UINTN) Atapi->Lun);
|
2007-07-05 09:05:28 +02:00
|
|
|
} else {
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"Ata(%s,%s,0x%x)",
|
2009-02-06 06:48:16 +01:00
|
|
|
(Atapi->PrimarySecondary == 1) ? L"Secondary" : L"Primary",
|
|
|
|
(Atapi->SlaveMaster == 1) ? L"Slave" : L"Master",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) Atapi->Lun
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a SCSI device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextScsi (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
SCSI_DEVICE_PATH *Scsi;
|
|
|
|
|
|
|
|
Scsi = DevPath;
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Scsi(0x%x,0x%x)", (UINTN) Scsi->Pun, (UINTN) Scsi->Lun);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Fibre device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextFibre (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
FIBRECHANNEL_DEVICE_PATH *Fibre;
|
|
|
|
|
|
|
|
Fibre = DevPath;
|
2007-09-24 08:55:50 +02:00
|
|
|
CatPrint (Str, L"Fibre(0x%lx,0x%lx)", Fibre->WWN, Fibre->Lun);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a 1394 device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToText1394 (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
2008-07-16 03:10:45 +02:00
|
|
|
F1394_DEVICE_PATH *F1394DevPath;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
F1394DevPath = DevPath;
|
2007-09-24 08:55:50 +02:00
|
|
|
//
|
|
|
|
// Guid has format of IEEE-EUI64
|
|
|
|
//
|
2008-07-16 03:10:45 +02:00
|
|
|
CatPrint (Str, L"I1394(%016lx)", F1394DevPath->Guid);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a USB device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextUsb (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
USB_DEVICE_PATH *Usb;
|
|
|
|
|
|
|
|
Usb = DevPath;
|
2007-09-24 08:55:50 +02:00
|
|
|
CatPrint (Str, L"USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a USB WWID device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextUsbWWID (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
USB_WWID_DEVICE_PATH *UsbWWId;
|
2007-09-24 08:55:50 +02:00
|
|
|
CHAR16 *SerialNumberStr;
|
|
|
|
CHAR16 *NewStr;
|
|
|
|
UINT16 Length;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
|
|
|
UsbWWId = DevPath;
|
2007-09-24 08:55:50 +02:00
|
|
|
|
|
|
|
SerialNumberStr = (CHAR16 *) ((UINT8 *) UsbWWId + sizeof (USB_WWID_DEVICE_PATH));
|
|
|
|
Length = (UINT16) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));
|
|
|
|
if (SerialNumberStr [Length - 1] != 0) {
|
|
|
|
//
|
|
|
|
// In case no NULL terminator in SerialNumber, create a new one with NULL terminator
|
|
|
|
//
|
|
|
|
NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr);
|
2009-01-19 02:55:14 +01:00
|
|
|
ASSERT (NewStr != NULL);
|
2007-09-24 08:55:50 +02:00
|
|
|
NewStr [Length] = 0;
|
|
|
|
SerialNumberStr = NewStr;
|
|
|
|
}
|
|
|
|
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) UsbWWId->VendorId,
|
|
|
|
(UINTN) UsbWWId->ProductId,
|
|
|
|
(UINTN) UsbWWId->InterfaceNumber,
|
2007-09-24 08:55:50 +02:00
|
|
|
SerialNumberStr
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Logic Unit device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextLogicalUnit (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
|
|
|
|
|
|
|
|
LogicalUnit = DevPath;
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"Unit(0x%x)", (UINTN) LogicalUnit->Lun);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a USB class device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextUsbClass (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
USB_CLASS_DEVICE_PATH *UsbClass;
|
2007-09-24 08:55:50 +02:00
|
|
|
BOOLEAN IsKnownSubClass;
|
|
|
|
|
2007-07-05 09:05:28 +02:00
|
|
|
|
|
|
|
UsbClass = DevPath;
|
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
IsKnownSubClass = TRUE;
|
|
|
|
switch (UsbClass->DeviceClass) {
|
|
|
|
case USB_CLASS_AUDIO:
|
|
|
|
CatPrint (Str, L"UsbAudio");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_CDCCONTROL:
|
|
|
|
CatPrint (Str, L"UsbCDCControl");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_HID:
|
|
|
|
CatPrint (Str, L"UsbHID");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_IMAGE:
|
|
|
|
CatPrint (Str, L"UsbImage");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_PRINTER:
|
|
|
|
CatPrint (Str, L"UsbPrinter");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_MASS_STORAGE:
|
|
|
|
CatPrint (Str, L"UsbMassStorage");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_HUB:
|
|
|
|
CatPrint (Str, L"UsbHub");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_CDCDATA:
|
|
|
|
CatPrint (Str, L"UsbCDCData");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_SMART_CARD:
|
|
|
|
CatPrint (Str, L"UsbSmartCard");
|
|
|
|
break;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
case USB_CLASS_VIDEO:
|
|
|
|
CatPrint (Str, L"UsbVideo");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case USB_CLASS_DIAGNOSTIC:
|
|
|
|
CatPrint (Str, L"UsbDiagnostic");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case USB_CLASS_WIRELESS:
|
|
|
|
CatPrint (Str, L"UsbWireless");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
IsKnownSubClass = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsKnownSubClass) {
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"(0x%x,0x%x,0x%x,0x%x)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) UsbClass->VendorId,
|
|
|
|
(UINTN) UsbClass->ProductId,
|
|
|
|
(UINTN) UsbClass->DeviceSubClass,
|
|
|
|
(UINTN) UsbClass->DeviceProtocol
|
2007-09-24 08:55:50 +02:00
|
|
|
);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (UsbClass->DeviceClass == USB_CLASS_RESERVE) {
|
|
|
|
if (UsbClass->DeviceSubClass == USB_SUBCLASS_FW_UPDATE) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) UsbClass->VendorId,
|
|
|
|
(UINTN) UsbClass->ProductId,
|
|
|
|
(UINTN) UsbClass->DeviceProtocol
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
2007-09-24 08:55:50 +02:00
|
|
|
return;
|
|
|
|
} else if (UsbClass->DeviceSubClass == USB_SUBCLASS_IRDA_BRIDGE) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"UsbIrdaBridge(0x%x,0x%x,0x%x)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) UsbClass->VendorId,
|
|
|
|
(UINTN) UsbClass->ProductId,
|
|
|
|
(UINTN) UsbClass->DeviceProtocol
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
2007-09-24 08:55:50 +02:00
|
|
|
return;
|
|
|
|
} else if (UsbClass->DeviceSubClass == USB_SUBCLASS_TEST) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) UsbClass->VendorId,
|
|
|
|
(UINTN) UsbClass->ProductId,
|
|
|
|
(UINTN) UsbClass->DeviceProtocol
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
2007-09-24 08:55:50 +02:00
|
|
|
return;
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) UsbClass->VendorId,
|
|
|
|
(UINTN) UsbClass->ProductId,
|
|
|
|
(UINTN) UsbClass->DeviceClass,
|
|
|
|
(UINTN) UsbClass->DeviceSubClass,
|
|
|
|
(UINTN) UsbClass->DeviceProtocol
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a SATA device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-09-24 08:55:50 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextSata (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
SATA_DEVICE_PATH *Sata;
|
|
|
|
|
|
|
|
Sata = DevPath;
|
2010-02-11 03:33:16 +01:00
|
|
|
if ((Sata->PortMultiplierPortNumber & SATA_HBA_DIRECT_CONNECT_FLAG) != 0) {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"Sata(0x%x,0x%x)",
|
|
|
|
(UINTN) Sata->HBAPortNumber,
|
|
|
|
(UINTN) Sata->Lun
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"Sata(0x%x,0x%x,0x%x)",
|
|
|
|
(UINTN) Sata->HBAPortNumber,
|
|
|
|
(UINTN) Sata->PortMultiplierPortNumber,
|
|
|
|
(UINTN) Sata->Lun
|
|
|
|
);
|
|
|
|
}
|
2007-09-24 08:55:50 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a I20 device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextI2O (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
2008-07-16 03:10:45 +02:00
|
|
|
I2O_DEVICE_PATH *I2ODevPath;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
I2ODevPath = DevPath;
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"I2O(0x%x)", (UINTN) I2ODevPath->Tid);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a MAC address device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextMacAddr (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
2008-07-16 03:10:45 +02:00
|
|
|
MAC_ADDR_DEVICE_PATH *MacDevPath;
|
2007-07-05 09:05:28 +02:00
|
|
|
UINTN HwAddressSize;
|
|
|
|
UINTN Index;
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
MacDevPath = DevPath;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
|
|
|
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
|
2008-07-16 03:10:45 +02:00
|
|
|
if (MacDevPath->IfType == 0x01 || MacDevPath->IfType == 0x00) {
|
2007-07-05 09:05:28 +02:00
|
|
|
HwAddressSize = 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
CatPrint (Str, L"MAC(");
|
|
|
|
|
|
|
|
for (Index = 0; Index < HwAddressSize; Index++) {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"%02x", (UINTN) MacDevPath->MacAddress.Addr[Index]);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L",0x%x)", (UINTN) MacDevPath->IfType);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2010-01-25 04:40:18 +01:00
|
|
|
/**
|
|
|
|
Converts network protocol string to its text representation.
|
|
|
|
|
|
|
|
@param Str The string representative of input device.
|
|
|
|
@param Protocol The network protocol ID.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
CatNetworkProtocol (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN UINT16 Protocol
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (Protocol == RFC_1700_TCP_PROTOCOL) {
|
|
|
|
CatPrint (Str, L"TCP");
|
|
|
|
} else if (Protocol == RFC_1700_UDP_PROTOCOL) {
|
|
|
|
CatPrint (Str, L"UDP");
|
|
|
|
} else {
|
|
|
|
CatPrint (Str, L"0x%x", Protocol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a IPv4 device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextIPv4 (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
2008-07-16 03:10:45 +02:00
|
|
|
IPv4_DEVICE_PATH *IPDevPath;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
IPDevPath = DevPath;
|
|
|
|
if (DisplayOnly) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"IPv4(%d.%d.%d.%d)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[0],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[1],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[2],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[3]
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2010-01-25 04:40:18 +01:00
|
|
|
L"IPv4(%d.%d.%d.%d,",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[0],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[1],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[2],
|
2010-01-25 04:40:18 +01:00
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[3]
|
|
|
|
);
|
|
|
|
|
|
|
|
CatNetworkProtocol (
|
|
|
|
Str,
|
|
|
|
IPDevPath->Protocol
|
|
|
|
);
|
|
|
|
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L",%s,%d.%d.%d.%d)",
|
2009-02-06 06:48:16 +01:00
|
|
|
IPDevPath->StaticIpAddress ? L"Static" : L"DHCP",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[0],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[1],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[2],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[3]
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a IPv6 device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextIPv6 (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
2008-07-16 03:10:45 +02:00
|
|
|
IPv6_DEVICE_PATH *IPDevPath;
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
IPDevPath = DevPath;
|
|
|
|
if (DisplayOnly) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[0],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[1],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[2],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[3],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[4],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[5],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[6],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[7],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[8],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[9],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[10],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[11],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[12],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[13],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[14],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[15]
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2010-01-25 04:40:18 +01:00
|
|
|
L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[0],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[1],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[2],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[3],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[4],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[5],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[6],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[7],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[8],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[9],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[10],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[11],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[12],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[13],
|
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[14],
|
2010-01-25 04:40:18 +01:00
|
|
|
(UINTN) IPDevPath->RemoteIpAddress.Addr[15]
|
|
|
|
);
|
|
|
|
|
|
|
|
CatNetworkProtocol (
|
|
|
|
Str,
|
|
|
|
IPDevPath->Protocol
|
|
|
|
);
|
|
|
|
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
|
2009-02-06 06:48:16 +01:00
|
|
|
IPDevPath->StaticIpAddress ? L"Static" : L"DHCP",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[0],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[1],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[2],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[3],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[4],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[5],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[6],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[7],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[8],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[9],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[10],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[11],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[12],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[13],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[14],
|
|
|
|
(UINTN) IPDevPath->LocalIpAddress.Addr[15]
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts an Infini Band device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextInfiniBand (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
INFINIBAND_DEVICE_PATH *InfiniBand;
|
|
|
|
|
|
|
|
InfiniBand = DevPath;
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) InfiniBand->ResourceFlags,
|
2007-07-05 09:05:28 +02:00
|
|
|
InfiniBand->PortGid,
|
|
|
|
InfiniBand->ServiceId,
|
|
|
|
InfiniBand->TargetPortId,
|
|
|
|
InfiniBand->DeviceId
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a UART device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextUart (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UART_DEVICE_PATH *Uart;
|
|
|
|
CHAR8 Parity;
|
|
|
|
|
|
|
|
Uart = DevPath;
|
|
|
|
switch (Uart->Parity) {
|
|
|
|
case 0:
|
|
|
|
Parity = 'D';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
Parity = 'N';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
Parity = 'E';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
Parity = 'O';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
Parity = 'M';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
Parity = 'S';
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
Parity = 'x';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Uart->BaudRate == 0) {
|
|
|
|
CatPrint (Str, L"Uart(DEFAULT,");
|
|
|
|
} else {
|
|
|
|
CatPrint (Str, L"Uart(%ld,", Uart->BaudRate);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Uart->DataBits == 0) {
|
|
|
|
CatPrint (Str, L"DEFAULT,");
|
|
|
|
} else {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"%d,", (UINTN) Uart->DataBits);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CatPrint (Str, L"%c,", Parity);
|
|
|
|
|
|
|
|
switch (Uart->StopBits) {
|
|
|
|
case 0:
|
|
|
|
CatPrint (Str, L"D)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
CatPrint (Str, L"1)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
CatPrint (Str, L"1.5)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
CatPrint (Str, L"2)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
CatPrint (Str, L"x)");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts an iSCSI device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextiSCSI (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
2008-07-16 03:10:45 +02:00
|
|
|
ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
|
2007-07-05 09:05:28 +02:00
|
|
|
UINT16 Options;
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
ISCSIDevPath = DevPath;
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"iSCSI(%a,0x%x,0x%lx,",
|
2009-06-30 03:55:22 +02:00
|
|
|
ISCSIDevPath->TargetName,
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) ISCSIDevPath->TargetPortalGroupTag,
|
2008-07-16 03:10:45 +02:00
|
|
|
ISCSIDevPath->Lun
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
Options = ISCSIDevPath->LoginOption;
|
|
|
|
CatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");
|
|
|
|
CatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");
|
|
|
|
if (((Options >> 11) & 0x0001) != 0) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (Str, L"%s,", L"None");
|
2008-07-16 03:10:45 +02:00
|
|
|
} else if (((Options >> 12) & 0x0001) != 0) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (Str, L"%s,", L"CHAP_UNI");
|
|
|
|
} else {
|
|
|
|
CatPrint (Str, L"%s,", L"CHAP_BI");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
CatPrint (Str, L"%s)", (ISCSIDevPath->NetworkProtocol == 0) ? L"TCP" : L"reserved");
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2009-11-12 11:40:58 +01:00
|
|
|
/**
|
|
|
|
Converts a VLAN 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
|
|
|
|
DevPathToTextVlan (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
VLAN_DEVICE_PATH *Vlan;
|
|
|
|
|
|
|
|
Vlan = DevPath;
|
|
|
|
CatPrint (Str, L"Vlan(%d)", (UINTN) Vlan->VlanId);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Hard drive device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextHardDrive (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
HARDDRIVE_DEVICE_PATH *Hd;
|
|
|
|
|
|
|
|
Hd = DevPath;
|
|
|
|
switch (Hd->SignatureType) {
|
|
|
|
case SIGNATURE_TYPE_MBR:
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"HD(%d,%s,0x%08x,",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) Hd->PartitionNumber,
|
2007-07-05 09:05:28 +02:00
|
|
|
L"MBR",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) *((UINT32 *) (&(Hd->Signature[0])))
|
2007-07-05 09:05:28 +02:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SIGNATURE_TYPE_GUID:
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"HD(%d,%s,%g,",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) Hd->PartitionNumber,
|
2007-09-24 08:55:50 +02:00
|
|
|
L"GPT",
|
2007-07-05 09:05:28 +02:00
|
|
|
(EFI_GUID *) &(Hd->Signature[0])
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-09-24 08:55:50 +02:00
|
|
|
CatPrint (
|
|
|
|
Str,
|
|
|
|
L"HD(%d,%d,0,",
|
2009-04-02 10:34:03 +02:00
|
|
|
(UINTN) Hd->PartitionNumber,
|
|
|
|
(UINTN) Hd->SignatureType
|
2007-09-24 08:55:50 +02:00
|
|
|
);
|
2007-07-05 09:05:28 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
CatPrint (Str, L"0x%lx,0x%lx)", Hd->PartitionStart, Hd->PartitionSize);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a CDROM device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextCDROM (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CDROM_DEVICE_PATH *Cd;
|
|
|
|
|
|
|
|
Cd = DevPath;
|
2008-07-16 03:10:45 +02:00
|
|
|
if (DisplayOnly) {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"CDROM(0x%x)", (UINTN) Cd->BootEntry);
|
2007-07-05 09:05:28 +02:00
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"CDROM(0x%x,0x%lx,0x%lx)", (UINTN) Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a File device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextFilePath (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
FILEPATH_DEVICE_PATH *Fp;
|
|
|
|
|
|
|
|
Fp = DevPath;
|
|
|
|
CatPrint (Str, L"%s", Fp->PathName);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Media protocol device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextMediaProtocol (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;
|
|
|
|
|
|
|
|
MediaProt = DevPath;
|
|
|
|
CatPrint (Str, L"Media(%g)", &MediaProt->Protocol);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Firmware Volume device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-09-24 08:55:50 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextFv (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
MEDIA_FW_VOL_DEVICE_PATH *Fv;
|
|
|
|
|
|
|
|
Fv = DevPath;
|
|
|
|
CatPrint (Str, L"Fv(%g)", &Fv->FvName);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a Firmware Volume File device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-09-24 08:55:50 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextFvFile (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile;
|
|
|
|
|
|
|
|
FvFile = DevPath;
|
|
|
|
CatPrint (Str, L"FvFile(%g)", &FvFile->FvFileName);
|
|
|
|
}
|
|
|
|
|
2009-08-19 15:43:13 +02:00
|
|
|
/**
|
|
|
|
Converts a Relative Offset 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
|
|
|
|
DevPathRelativeOffsetRange (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
|
|
|
|
|
|
|
|
Offset = DevPath;
|
|
|
|
CatPrint (
|
|
|
|
Str,
|
2009-12-15 10:12:45 +01:00
|
|
|
L"Offset(0x%lx,0x%lx)",
|
2009-08-19 15:43:13 +02:00
|
|
|
Offset->StartingOffset,
|
|
|
|
Offset->EndingOffset
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts a BIOS Boot Specification device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextBBS (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
BBS_BBS_DEVICE_PATH *Bbs;
|
|
|
|
CHAR16 *Type;
|
|
|
|
|
|
|
|
Bbs = DevPath;
|
|
|
|
switch (Bbs->DeviceType) {
|
|
|
|
case BBS_TYPE_FLOPPY:
|
|
|
|
Type = L"Floppy";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BBS_TYPE_HARDDRIVE:
|
|
|
|
Type = L"HD";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BBS_TYPE_CDROM:
|
|
|
|
Type = L"CDROM";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BBS_TYPE_PCMCIA:
|
|
|
|
Type = L"PCMCIA";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BBS_TYPE_USB:
|
|
|
|
Type = L"USB";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BBS_TYPE_EMBEDDED_NETWORK:
|
|
|
|
Type = L"Network";
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-09-24 08:55:50 +02:00
|
|
|
Type = NULL;
|
2007-07-05 09:05:28 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-09-24 08:55:50 +02:00
|
|
|
if (Type != NULL) {
|
|
|
|
CatPrint (Str, L"BBS(%s,%a", Type, Bbs->String);
|
|
|
|
} else {
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L"BBS(0x%x,%a", (UINTN) Bbs->DeviceType, Bbs->String);
|
2007-09-24 08:55:50 +02:00
|
|
|
}
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
if (DisplayOnly) {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (Str, L")");
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2009-04-02 10:34:03 +02:00
|
|
|
CatPrint (Str, L",0x%x)", (UINTN) Bbs->StatusFlag);
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts an End-of-Device-Path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextEndInstance (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CatPrint (Str, L",");
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
2008-12-23 17:20:43 +01:00
|
|
|
Converts an unknown device path structure to its string representative.
|
2008-07-16 03:10:45 +02:00
|
|
|
|
2008-12-23 17:20:43 +01:00
|
|
|
@param Str The string representative of input device.
|
2008-07-16 03:10:45 +02:00
|
|
|
@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.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
VOID
|
|
|
|
DevPathToTextNodeUnknown (
|
|
|
|
IN OUT POOL_PRINT *Str,
|
|
|
|
IN VOID *DevPath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CatPrint (Str, L"?");
|
|
|
|
}
|
|
|
|
|
|
|
|
GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable[] = {
|
|
|
|
{HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci},
|
|
|
|
{HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard},
|
|
|
|
{HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap},
|
|
|
|
{HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor},
|
|
|
|
{HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController},
|
|
|
|
{ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi},
|
2007-09-24 08:55:50 +02:00
|
|
|
{ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx},
|
|
|
|
{ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr},
|
2007-07-05 09:05:28 +02:00
|
|
|
{MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass},
|
2007-09-24 08:55:50 +02:00
|
|
|
{MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata},
|
2007-07-05 09:05:28 +02:00
|
|
|
{MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor},
|
|
|
|
{MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI},
|
2009-11-12 11:40:58 +01:00
|
|
|
{MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan},
|
2007-07-05 09:05:28 +02:00
|
|
|
{MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive},
|
|
|
|
{MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM},
|
|
|
|
{MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor},
|
|
|
|
{MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol},
|
|
|
|
{MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},
|
2007-09-24 08:55:50 +02:00
|
|
|
{MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv},
|
|
|
|
{MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile},
|
2009-08-19 15:43:13 +02:00
|
|
|
{MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange},
|
2007-07-05 09:05:28 +02:00
|
|
|
{BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS},
|
|
|
|
{END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance},
|
|
|
|
{0, 0, NULL}
|
|
|
|
};
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
|
|
|
Converts a device node to its string representation.
|
|
|
|
|
|
|
|
@param DeviceNode A Pointer to the device node to be converted.
|
|
|
|
@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.
|
|
|
|
|
|
|
|
@return A pointer to the allocated text representation of the device node or NULL if DeviceNode
|
|
|
|
is NULL or there was insufficient memory.
|
|
|
|
|
|
|
|
**/
|
2007-07-05 09:05:28 +02:00
|
|
|
CHAR16 *
|
2008-07-16 03:10:45 +02:00
|
|
|
EFIAPI
|
2007-07-05 09:05:28 +02:00
|
|
|
ConvertDeviceNodeToText (
|
|
|
|
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
|
|
|
{
|
|
|
|
POOL_PRINT Str;
|
|
|
|
UINTN Index;
|
|
|
|
UINTN NewSize;
|
|
|
|
VOID (*DumpNode)(POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);
|
|
|
|
|
|
|
|
if (DeviceNode == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZeroMem (&Str, sizeof (Str));
|
|
|
|
|
|
|
|
//
|
|
|
|
// Process the device path node
|
|
|
|
//
|
|
|
|
DumpNode = NULL;
|
|
|
|
for (Index = 0; DevPathToTextTable[Index].Function != NULL; Index++) {
|
|
|
|
if (DevicePathType (DeviceNode) == DevPathToTextTable[Index].Type &&
|
|
|
|
DevicePathSubType (DeviceNode) == DevPathToTextTable[Index].SubType
|
|
|
|
) {
|
|
|
|
DumpNode = DevPathToTextTable[Index].Function;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// If not found, use a generic function
|
|
|
|
//
|
|
|
|
if (DumpNode == NULL) {
|
|
|
|
DumpNode = DevPathToTextNodeUnknown;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Print this node
|
|
|
|
//
|
|
|
|
DumpNode (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Shrink pool used for string allocation
|
|
|
|
//
|
|
|
|
NewSize = (Str.Len + 1) * sizeof (CHAR16);
|
2008-11-22 01:52:53 +01:00
|
|
|
Str.Str = ReallocatePool (NewSize, NewSize, Str.Str);
|
2007-07-05 09:05:28 +02:00
|
|
|
ASSERT (Str.Str != NULL);
|
|
|
|
Str.Str[Str.Len] = 0;
|
|
|
|
return Str.Str;
|
|
|
|
}
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
/**
|
|
|
|
Converts a device path to its text representation.
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
@param DevicePath A Pointer to the device to be converted.
|
|
|
|
@param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
2007-07-05 09:05:28 +02:00
|
|
|
of the display node is used, where applicable. If DisplayOnly
|
|
|
|
is FALSE, then the longer text representation of the display node
|
|
|
|
is used.
|
2008-07-16 03:10:45 +02:00
|
|
|
@param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
2007-07-05 09:05:28 +02:00
|
|
|
representation for a device node can be used, where applicable.
|
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
@return A pointer to the allocated text representation of the device path or
|
|
|
|
NULL if DeviceNode is NULL or there was insufficient memory.
|
2007-07-05 09:05:28 +02:00
|
|
|
|
2008-07-16 03:10:45 +02:00
|
|
|
**/
|
|
|
|
CHAR16 *
|
|
|
|
EFIAPI
|
|
|
|
ConvertDevicePathToText (
|
|
|
|
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
|
|
|
IN BOOLEAN DisplayOnly,
|
|
|
|
IN BOOLEAN AllowShortcuts
|
|
|
|
)
|
2007-07-05 09:05:28 +02:00
|
|
|
{
|
|
|
|
POOL_PRINT Str;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
|
2008-11-11 16:42:40 +01:00
|
|
|
EFI_DEVICE_PATH_PROTOCOL *AlignedDevPathNode;
|
2007-07-05 09:05:28 +02:00
|
|
|
UINTN Index;
|
|
|
|
UINTN NewSize;
|
|
|
|
VOID (*DumpNode) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);
|
|
|
|
|
|
|
|
if (DevicePath == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZeroMem (&Str, sizeof (Str));
|
|
|
|
|
|
|
|
//
|
|
|
|
// Process each device path node
|
|
|
|
//
|
2008-11-11 16:42:40 +01:00
|
|
|
DevPathNode = (EFI_DEVICE_PATH_PROTOCOL *) DevicePath;
|
2007-07-05 09:05:28 +02:00
|
|
|
while (!IsDevicePathEnd (DevPathNode)) {
|
|
|
|
//
|
|
|
|
// Find the handler to dump this device path node
|
|
|
|
//
|
|
|
|
DumpNode = NULL;
|
2009-02-06 06:48:16 +01:00
|
|
|
for (Index = 0; DevPathToTextTable[Index].Function != NULL; Index += 1) {
|
2007-07-05 09:05:28 +02:00
|
|
|
|
|
|
|
if (DevicePathType (DevPathNode) == DevPathToTextTable[Index].Type &&
|
|
|
|
DevicePathSubType (DevPathNode) == DevPathToTextTable[Index].SubType
|
|
|
|
) {
|
|
|
|
DumpNode = DevPathToTextTable[Index].Function;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// If not found, use a generic function
|
|
|
|
//
|
|
|
|
if (!DumpNode) {
|
|
|
|
DumpNode = DevPathToTextNodeUnknown;
|
|
|
|
}
|
|
|
|
//
|
2009-04-02 03:58:19 +02:00
|
|
|
// Put a path separator in if needed
|
2007-07-05 09:05:28 +02:00
|
|
|
//
|
2008-07-16 03:10:45 +02:00
|
|
|
if ((Str.Len != 0) && DumpNode != DevPathToTextEndInstance) {
|
2007-09-24 08:55:50 +02:00
|
|
|
if (*(Str.Str + Str.Len / sizeof (CHAR16) - 1) != L',') {
|
2007-07-05 09:05:28 +02:00
|
|
|
CatPrint (&Str, L"/");
|
2007-09-24 08:55:50 +02:00
|
|
|
}
|
2007-07-05 09:05:28 +02:00
|
|
|
}
|
2008-11-11 16:42:40 +01:00
|
|
|
|
|
|
|
AlignedDevPathNode = AllocateCopyPool (DevicePathNodeLength (DevPathNode), DevPathNode);
|
2007-07-05 09:05:28 +02:00
|
|
|
//
|
|
|
|
// Print this node of the device path
|
|
|
|
//
|
2008-11-11 16:42:40 +01:00
|
|
|
DumpNode (&Str, AlignedDevPathNode, DisplayOnly, AllowShortcuts);
|
|
|
|
FreePool (AlignedDevPathNode);
|
|
|
|
|
2007-07-05 09:05:28 +02:00
|
|
|
//
|
|
|
|
// Next device path node
|
|
|
|
//
|
|
|
|
DevPathNode = NextDevicePathNode (DevPathNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
NewSize = (Str.Len + 1) * sizeof (CHAR16);
|
2008-11-22 01:52:53 +01:00
|
|
|
Str.Str = ReallocatePool (NewSize, NewSize, Str.Str);
|
2007-07-05 09:05:28 +02:00
|
|
|
ASSERT (Str.Str != NULL);
|
|
|
|
Str.Str[Str.Len] = 0;
|
|
|
|
return Str.Str;
|
|
|
|
}
|