Update DevicePath driver to reflect several device path update in UEFI spec: SATA, memory, iScsi, Firmware volume, Firmware volume File, etc

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3915 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2007-09-24 06:55:50 +00:00
parent 98a14db6f2
commit cf40f28a5b
3 changed files with 675 additions and 415 deletions

View File

@ -109,6 +109,8 @@ typedef struct {
#define USB_SUBCLASS_IRDA_BRIDGE 2
#define USB_SUBCLASS_TEST 3
#pragma pack(1)
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
@ -139,10 +141,9 @@ typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 NetworkProtocol;
UINT16 LoginOption;
UINT16 Reserved;
UINT16 TargetPortalGroupTag;
UINT64 Lun;
CHAR16 iSCSITargetName[1];
UINT16 TargetPortalGroupTag;
CHAR8 iSCSITargetName[1];
} ISCSI_DEVICE_PATH_WITH_NAME;
typedef struct {
@ -151,6 +152,8 @@ typedef struct {
UINT8 VendorDefinedData[1];
} VENDOR_DEVICE_PATH_WITH_DATA;
#pragma pack()
CHAR16 *
ConvertDeviceNodeToText (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,

View File

@ -132,7 +132,7 @@ SplitStr (
Get current sub-string from a string list, before return
the list header is moved to next sub-string. The sub-string is separated
by the specified character. For example, the separator is ',', the string
list is "2,0,3", it returns "2", the remain list move to "2,3"
list is "2,0,3", it returns "2", the remain list move to "0,3"
Arguments:
List - A string list separated by the specified separator
@ -408,20 +408,24 @@ HexStringToBuf (
STATIC
CHAR16 *
TrimHexStr (
IN CHAR16 *Str
IN CHAR16 *Str,
OUT BOOLEAN *IsHex
)
/*++
Routine Description:
Skip the leading white space and '0x' or '0X' of a hex string
Skip the leading white space and '0x' or '0X' of a integer string
Arguments:
Str - The hex string
Str - The integer string
IsHex - 1: Hex string, 0: Decimal string
Returns:
--*/
{
*IsHex = FALSE;
//
// skip preceeding white space
//
@ -439,6 +443,7 @@ TrimHexStr (
//
if (*Str && (*Str == 'x' || *Str == 'X')) {
Str += 1;
*IsHex = TRUE;
}
return Str;
@ -473,7 +478,7 @@ Returns:
//
Rvalue = 0;
Length = sizeof (UINTN);
HexStringToBuf ((UINT8 *) &Rvalue, &Length, TrimHexStr (Str), NULL);
HexStringToBuf ((UINT8 *) &Rvalue, &Length, Str, NULL);
return Rvalue;
}
@ -502,12 +507,12 @@ Returns:
*Data = 0;
Length = sizeof (UINT64);
HexStringToBuf ((UINT8 *) Data, &Length, TrimHexStr (Str), NULL);
HexStringToBuf ((UINT8 *) Data, &Length, Str, NULL);
}
STATIC
UINTN
Atoi (
Dtoi (
IN CHAR16 *str
)
/*++
@ -561,6 +566,121 @@ Returns:
return Rvalue;
}
STATIC
VOID
Dtoi64 (
IN CHAR16 *str,
OUT UINT64 *Data
)
/*++
Routine Description:
Convert decimal string to uint
Arguments:
Str - The string
Returns:
--*/
{
UINT64 Rvalue;
CHAR16 Char;
UINT64 High;
UINT64 Low;
ASSERT (str != NULL);
ASSERT (Data != NULL);
//
// skip preceeding white space
//
while (*str && *str == ' ') {
str += 1;
}
//
// convert digits
//
Rvalue = 0;
Char = *(str++);
while (Char) {
if (Char >= '0' && Char <= '9') {
High = LShiftU64 (Rvalue, 3);
Low = LShiftU64 (Rvalue, 1);
Rvalue = High + Low + Char - '0';
} else {
break;
}
Char = *(str++);
}
*Data = Rvalue;
}
STATIC
UINTN
Strtoi (
IN CHAR16 *Str
)
/*++
Routine Description:
Convert integer string to uint.
Arguments:
Str - The integer string. If leading with "0x" or "0X", it's heximal.
Returns:
--*/
{
BOOLEAN IsHex;
Str = TrimHexStr (Str, &IsHex);
if (IsHex) {
return Xtoi (Str);
} else {
return Dtoi (Str);
}
}
STATIC
VOID
Strtoi64 (
IN CHAR16 *Str,
IN UINT64 *Data
)
/*++
Routine Description:
Convert integer string to 64 bit data.
Arguments:
Str - The integer string. If leading with "0x" or "0X", it's heximal.
Returns:
--*/
{
BOOLEAN IsHex;
Str = TrimHexStr (Str, &IsHex);
if (IsHex) {
Xtoi64 (Str, Data);
} else {
Dtoi64 (Str, Data);
}
}
STATIC
EFI_STATUS
StrToBuf (
@ -674,7 +794,7 @@ StrToIPv4Addr (
UINTN Index;
for (Index = 0; Index < 4; Index++) {
IPv4Addr->Addr[Index] = (UINT8) Atoi (SplitStr (Str, L'.'));
IPv4Addr->Addr[Index] = (UINT8) Dtoi (SplitStr (Str, L'.'));
}
}
@ -726,16 +846,16 @@ DevPathFromTextPci (
CHAR16 *DeviceStr;
PCI_DEVICE_PATH *Pci;
FunctionStr = GetNextParamStr (&TextDeviceNode);
DeviceStr = GetNextParamStr (&TextDeviceNode);
FunctionStr = GetNextParamStr (&TextDeviceNode);
Pci = (PCI_DEVICE_PATH *) CreateDeviceNode (
HARDWARE_DEVICE_PATH,
HW_PCI_DP,
sizeof (PCI_DEVICE_PATH)
);
Pci->Function = (UINT8) Xtoi (FunctionStr);
Pci->Device = (UINT8) Xtoi (DeviceStr);
Pci->Function = (UINT8) Strtoi (FunctionStr);
Pci->Device = (UINT8) Strtoi (DeviceStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Pci;
}
@ -756,7 +876,7 @@ DevPathFromTextPcCard (
sizeof (PCCARD_DEVICE_PATH)
);
Pccard->FunctionNumber = (UINT8) Xtoi (FunctionNumberStr);
Pccard->FunctionNumber = (UINT8) Strtoi (FunctionNumberStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Pccard;
}
@ -767,10 +887,12 @@ DevPathFromTextMemoryMapped (
IN CHAR16 *TextDeviceNode
)
{
CHAR16 *MemoryTypeStr;
CHAR16 *StartingAddressStr;
CHAR16 *EndingAddressStr;
MEMMAP_DEVICE_PATH *MemMap;
MemoryTypeStr = GetNextParamStr (&TextDeviceNode);
StartingAddressStr = GetNextParamStr (&TextDeviceNode);
EndingAddressStr = GetNextParamStr (&TextDeviceNode);
MemMap = (MEMMAP_DEVICE_PATH *) CreateDeviceNode (
@ -779,10 +901,9 @@ DevPathFromTextMemoryMapped (
sizeof (MEMMAP_DEVICE_PATH)
);
MemMap->MemoryType = 0;
Xtoi64 (StartingAddressStr, &MemMap->StartingAddress);
Xtoi64 (EndingAddressStr, &MemMap->EndingAddress);
MemMap->MemoryType = (UINT32) Strtoi (MemoryTypeStr);
Strtoi64 (StartingAddressStr, &MemMap->StartingAddress);
Strtoi64 (EndingAddressStr, &MemMap->EndingAddress);
return (EFI_DEVICE_PATH_PROTOCOL *) MemMap;
}
@ -849,12 +970,27 @@ DevPathFromTextCtrl (
HW_CONTROLLER_DP,
sizeof (CONTROLLER_DEVICE_PATH)
);
Controller->ControllerNumber = (UINT32) Xtoi (ControllerStr);
Controller->ControllerNumber = (UINT32) Strtoi (ControllerStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Controller;
}
STATIC
VOID
EisaIdFromText (
IN CHAR16 *Text,
OUT UINT32 *EisaId
)
{
UINTN PnpId;
PnpId = Xtoi (Text + 3);
*EisaId = (((Text[0] - '@') & 0x1f) << 10) +
(((Text[1] - '@') & 0x1f) << 5) +
((Text[2] - '@') & 0x1f) +
(UINT32) (PnpId << 16);
}
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextAcpi (
IN CHAR16 *TextDeviceNode
@ -872,12 +1008,8 @@ DevPathFromTextAcpi (
sizeof (ACPI_HID_DEVICE_PATH)
);
if ((HIDStr[0] == L'P') && (HIDStr[1] == L'N') && (HIDStr[2] == L'P')) {
HIDStr += 3;
}
Acpi->HID = EISA_PNP_ID (Xtoi (HIDStr));
Acpi->UID = (UINT32) Xtoi (UIDStr);
EisaIdFromText (HIDStr, &Acpi->HID);
Acpi->UID = (UINT32) Strtoi (UIDStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;
}
@ -886,7 +1018,7 @@ STATIC
EFI_DEVICE_PATH_PROTOCOL *
ConvertFromTextAcpi (
IN CHAR16 *TextDeviceNode,
IN UINT32 Hid
IN UINT32 PnPId
)
{
CHAR16 *UIDStr;
@ -899,8 +1031,8 @@ ConvertFromTextAcpi (
sizeof (ACPI_HID_DEVICE_PATH)
);
Acpi->HID = Hid;
Acpi->UID = (UINT32) Xtoi (UIDStr);
Acpi->HID = EFI_PNP_ID (PnPId);
Acpi->UID = (UINT32) Strtoi (UIDStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;
}
@ -911,7 +1043,7 @@ DevPathFromTextPciRoot (
IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0a0341d0);
return ConvertFromTextAcpi (TextDeviceNode, 0x0a03);
}
STATIC
@ -920,7 +1052,7 @@ DevPathFromTextFloppy (
IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x060441d0);
return ConvertFromTextAcpi (TextDeviceNode, 0x0604);
}
STATIC
@ -929,7 +1061,7 @@ DevPathFromTextKeyboard (
IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x030141d0);
return ConvertFromTextAcpi (TextDeviceNode, 0x0301);
}
STATIC
@ -938,7 +1070,7 @@ DevPathFromTextSerial (
IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x050141d0);
return ConvertFromTextAcpi (TextDeviceNode, 0x0501);
}
STATIC
@ -947,7 +1079,7 @@ DevPathFromTextParallelPort (
IN CHAR16 *TextDeviceNode
)
{
return ConvertFromTextAcpi (TextDeviceNode, 0x040141d0);
return ConvertFromTextAcpi (TextDeviceNode, 0x0401);
}
STATIC
@ -964,7 +1096,7 @@ DevPathFromTextAcpiEx (
CHAR16 *UIDSTRStr;
CHAR8 *AsciiStr;
UINT16 Length;
ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *AcpiExt;
ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;
HIDStr = GetNextParamStr (&TextDeviceNode);
CIDStr = GetNextParamStr (&TextDeviceNode);
@ -976,28 +1108,22 @@ DevPathFromTextAcpiEx (
Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (HIDSTRStr) + 1);
Length = (UINT16) (Length + StrLen (UIDSTRStr) + 1);
Length = (UINT16) (Length + StrLen (CIDSTRStr) + 1);
AcpiExt = (ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *) CreateDeviceNode (
AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *) CreateDeviceNode (
ACPI_DEVICE_PATH,
ACPI_EXTENDED_DP,
Length
);
if ((HIDStr[0] == L'P') && (HIDStr[1] == L'N') && (HIDStr[2] == L'P')) {
HIDStr += 3;
AcpiExt->HID = EISA_PNP_ID (Xtoi (HIDStr));
} else {
AcpiExt->HID = (UINT32) Xtoi (HIDStr);
}
EisaIdFromText (HIDStr, &AcpiEx->HID);
EisaIdFromText (CIDStr, &AcpiEx->CID);
AcpiEx->UID = (UINT32) Strtoi (UIDStr);
AcpiExt->UID = (UINT32) Xtoi (UIDStr);
AcpiExt->CID = (UINT32) Xtoi (CIDStr);
AsciiStr = AcpiExt->HidUidCidStr;
AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
StrToAscii (HIDSTRStr, &AsciiStr);
StrToAscii (UIDSTRStr, &AsciiStr);
StrToAscii (CIDSTRStr, &AsciiStr);
return (EFI_DEVICE_PATH_PROTOCOL *) AcpiExt;
return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;
}
STATIC
@ -1011,33 +1137,27 @@ DevPathFromTextAcpiExp (
CHAR16 *UIDSTRStr;
CHAR8 *AsciiStr;
UINT16 Length;
ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *AcpiExt;
ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;
HIDStr = GetNextParamStr (&TextDeviceNode);
CIDStr = GetNextParamStr (&TextDeviceNode);
UIDSTRStr = GetNextParamStr (&TextDeviceNode);
Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (UIDSTRStr) + 3);
AcpiExt = (ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *) CreateDeviceNode (
AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *) CreateDeviceNode (
ACPI_DEVICE_PATH,
ACPI_EXTENDED_DP,
Length
);
if ((HIDStr[0] == L'P') && (HIDStr[1] == L'N') && (HIDStr[2] == L'P')) {
HIDStr += 3;
AcpiExt->HID = EISA_PNP_ID (Xtoi (HIDStr));
} else {
AcpiExt->HID = (UINT32) Xtoi (HIDStr);
}
EisaIdFromText (HIDStr, &AcpiEx->HID);
EisaIdFromText (CIDStr, &AcpiEx->CID);
AcpiEx->UID = 0;
AcpiExt->UID = 0;
AcpiExt->CID = (UINT32) Xtoi (CIDStr);
AsciiStr = AcpiExt->HidUidCidStr;
AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
//
// HID string is NULL
//
*AsciiStr = 0;
*AsciiStr = '\0';
//
// Convert UID string
//
@ -1046,9 +1166,9 @@ DevPathFromTextAcpiExp (
//
// CID string is NULL
//
*AsciiStr = 0;
*AsciiStr = '\0';
return (EFI_DEVICE_PATH_PROTOCOL *) AcpiExt;
return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;
}
STATIC
@ -1074,7 +1194,7 @@ DevPathFromTextAta (
Atapi->PrimarySecondary = (UINT8) ((StrCmp (PrimarySecondaryStr, L"Primary") == 0) ? 0 : 1);
Atapi->SlaveMaster = (UINT8) ((StrCmp (SlaveMasterStr, L"Master") == 0) ? 0 : 1);
Atapi->Lun = (UINT16) Xtoi (LunStr);
Atapi->Lun = (UINT16) Strtoi (LunStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Atapi;
}
@ -1097,8 +1217,8 @@ DevPathFromTextScsi (
sizeof (SCSI_DEVICE_PATH)
);
Scsi->Pun = (UINT16) Xtoi (PunStr);
Scsi->Lun = (UINT16) Xtoi (LunStr);
Scsi->Pun = (UINT16) Strtoi (PunStr);
Scsi->Lun = (UINT16) Strtoi (LunStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Scsi;
}
@ -1122,8 +1242,8 @@ DevPathFromTextFibre (
);
Fibre->Reserved = 0;
Xtoi64 (WWNStr, &Fibre->WWN);
Xtoi64 (LunStr, &Fibre->Lun);
Strtoi64 (WWNStr, &Fibre->WWN);
Strtoi64 (LunStr, &Fibre->Lun);
return (EFI_DEVICE_PATH_PROTOCOL *) Fibre;
}
@ -1168,8 +1288,8 @@ DevPathFromTextUsb (
sizeof (USB_DEVICE_PATH)
);
Usb->ParentPortNumber = (UINT8) Xtoi (PortStr);
Usb->InterfaceNumber = (UINT8) Xtoi (InterfaceStr);
Usb->ParentPortNumber = (UINT8) Strtoi (PortStr);
Usb->InterfaceNumber = (UINT8) Strtoi (InterfaceStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Usb;
}
@ -1190,7 +1310,7 @@ DevPathFromTextI2O (
sizeof (I2O_DEVICE_PATH)
);
I2O->Tid = (UINT32) Xtoi (TIDStr);
I2O->Tid = (UINT32) Strtoi (TIDStr);
return (EFI_DEVICE_PATH_PROTOCOL *) I2O;
}
@ -1220,12 +1340,12 @@ DevPathFromTextInfiniband (
sizeof (INFINIBAND_DEVICE_PATH)
);
InfiniBand->ResourceFlags = (UINT32) Xtoi (FlagsStr);
InfiniBand->ResourceFlags = (UINT32) Strtoi (FlagsStr);
StrToGuid (GuidStr, &PortGid);
CopyMem (InfiniBand->PortGid, &PortGid, sizeof (EFI_GUID));
Xtoi64 (SidStr, &InfiniBand->ServiceId);
Xtoi64 (TidStr, &InfiniBand->TargetPortId);
Xtoi64 (DidStr, &InfiniBand->DeviceId);
Strtoi64 (SidStr, &InfiniBand->ServiceId);
Strtoi64 (TidStr, &InfiniBand->TargetPortId);
Strtoi64 (DidStr, &InfiniBand->DeviceId);
return (EFI_DEVICE_PATH_PROTOCOL *) InfiniBand;
}
@ -1372,17 +1492,15 @@ DevPathFromTextSAS (
);
CopyGuid (&Sas->Guid, &mEfiDevicePathMessagingSASGuid);
Xtoi64 (AddressStr, &Sas->SasAddress);
Xtoi64 (LunStr, &Sas->Lun);
Sas->RelativeTargetPort = (UINT16) Xtoi (RTPStr);
if (StrCmp (SASSATAStr, L"NoTopology") == 0)
;
else {
Strtoi64 (AddressStr, &Sas->SasAddress);
Strtoi64 (LunStr, &Sas->Lun);
Sas->RelativeTargetPort = (UINT16) Strtoi (RTPStr);
if (StrCmp (SASSATAStr, L"NoTopology") != 0) {
if (StrCmp (DriveBayStr, L"0") == 0) {
Info |= 0x0001;
} else {
Info |= 0x0002;
Info = (UINT16) (Info | (Xtoi (DriveBayStr) << 8));
Info = (UINT16) (Info | (Strtoi (DriveBayStr) << 8));
}
if (StrCmp (SASSATAStr, L"SATA") == 0) {
@ -1399,7 +1517,7 @@ DevPathFromTextSAS (
}
Sas->DeviceTopology = Info;
Sas->Reserved = (UINT32) Xtoi (ReservedStr);
Sas->Reserved = (UINT32) Strtoi (ReservedStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Sas;
}
@ -1442,7 +1560,7 @@ DevPathFromTextMAC (
sizeof (MAC_ADDR_DEVICE_PATH)
);
MAC->IfType = (UINT8) Xtoi (IfTypeStr);
MAC->IfType = (UINT8) Strtoi (IfTypeStr);
Length = sizeof (EFI_MAC_ADDRESS);
StrToBuf (&MAC->MacAddress.Addr[0], Length, AddressStr);
@ -1548,8 +1666,8 @@ DevPathFromTextUart (
sizeof (UART_DEVICE_PATH)
);
Uart->BaudRate = (StrCmp (BaudStr, L"DEFAULT") == 0) ? 115200 : Atoi (BaudStr);
Uart->DataBits = (UINT8) ((StrCmp (DataBitsStr, L"DEFAULT") == 0) ? 8 : Atoi (DataBitsStr));
Uart->BaudRate = (StrCmp (BaudStr, L"DEFAULT") == 0) ? 115200 : Dtoi (BaudStr);
Uart->DataBits = (UINT8) ((StrCmp (DataBitsStr, L"DEFAULT") == 0) ? 8 : Dtoi (DataBitsStr));
switch (*ParityStr) {
case L'D':
Uart->Parity = 0;
@ -1617,22 +1735,22 @@ ConvertFromTextUsbClass (
PIDStr = GetNextParamStr (&TextDeviceNode);
if (UsbClassText->ClassExist) {
ClassStr = GetNextParamStr (&TextDeviceNode);
UsbClass->DeviceClass = (UINT8) Xtoi (ClassStr);
UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
} else {
UsbClass->DeviceClass = UsbClassText->Class;
}
if (UsbClassText->SubClassExist) {
SubClassStr = GetNextParamStr (&TextDeviceNode);
UsbClass->DeviceSubClass = (UINT8) Xtoi (SubClassStr);
UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
} else {
UsbClass->DeviceSubClass = UsbClassText->SubClass;
}
ProtocolStr = GetNextParamStr (&TextDeviceNode);
UsbClass->VendorId = (UINT16) Xtoi (VIDStr);
UsbClass->ProductId = (UINT16) Xtoi (PIDStr);
UsbClass->DeviceProtocol = (UINT8) Xtoi (ProtocolStr);
UsbClass->VendorId = (UINT16) Strtoi (VIDStr);
UsbClass->ProductId = (UINT16) Strtoi (PIDStr);
UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr);
return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass;
}
@ -1889,20 +2007,23 @@ DevPathFromTextUsbWwid (
CHAR16 *VIDStr;
CHAR16 *PIDStr;
CHAR16 *InterfaceNumStr;
CHAR16 *SerialNumberStr;
USB_WWID_DEVICE_PATH *UsbWwid;
VIDStr = GetNextParamStr (&TextDeviceNode);
PIDStr = GetNextParamStr (&TextDeviceNode);
InterfaceNumStr = GetNextParamStr (&TextDeviceNode);
SerialNumberStr = GetNextParamStr (&TextDeviceNode);
UsbWwid = (USB_WWID_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_USB_WWID_DP,
sizeof (USB_WWID_DEVICE_PATH)
(UINT16) (sizeof (USB_WWID_DEVICE_PATH) + StrSize (SerialNumberStr))
);
UsbWwid->VendorId = (UINT16) Xtoi (VIDStr);
UsbWwid->ProductId = (UINT16) Xtoi (PIDStr);
UsbWwid->InterfaceNumber = (UINT16) Xtoi (InterfaceNumStr);
UsbWwid->VendorId = (UINT16) Strtoi (VIDStr);
UsbWwid->ProductId = (UINT16) Strtoi (PIDStr);
UsbWwid->InterfaceNumber = (UINT16) Strtoi (InterfaceNumStr);
StrCpy ((CHAR16 *) ((UINT8 *) UsbWwid + sizeof (USB_WWID_DEVICE_PATH)), SerialNumberStr);
return (EFI_DEVICE_PATH_PROTOCOL *) UsbWwid;
}
@ -1920,10 +2041,10 @@ DevPathFromTextUnit (
LogicalUnit = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_DEVICE_LOGICAL_UNIT_DP,
sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH)
(UINT16) sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH)
);
LogicalUnit->Lun = (UINT8) Xtoi (LunStr);
LogicalUnit->Lun = (UINT8) Strtoi (LunStr);
return (EFI_DEVICE_PATH_PROTOCOL *) LogicalUnit;
}
@ -1942,6 +2063,7 @@ DevPathFromTextiSCSI (
CHAR16 *DataDigestStr;
CHAR16 *AuthenticationStr;
CHAR16 *ProtocolStr;
CHAR8 *AsciiStr;
ISCSI_DEVICE_PATH_WITH_NAME *iSCSI;
NameStr = GetNextParamStr (&TextDeviceNode);
@ -1957,9 +2079,11 @@ DevPathFromTextiSCSI (
(UINT16) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + StrLen (NameStr) * 2)
);
StrCpy (iSCSI->iSCSITargetName, NameStr);
iSCSI->TargetPortalGroupTag = (UINT16) Xtoi (PortalGroupStr);
Xtoi64 (LunStr, &iSCSI->Lun);
AsciiStr = iSCSI->iSCSITargetName;
StrToAscii (NameStr, &AsciiStr);
iSCSI->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);
Strtoi64 (LunStr, &iSCSI->Lun);
Options = 0x0000;
if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) {
@ -1981,7 +2105,6 @@ DevPathFromTextiSCSI (
iSCSI->LoginOption = (UINT16) Options;
iSCSI->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP");
iSCSI->Reserved = (UINT16) 0;
return (EFI_DEVICE_PATH_PROTOCOL *) iSCSI;
}
@ -2012,32 +2135,29 @@ DevPathFromTextHD (
sizeof (HARDDRIVE_DEVICE_PATH)
);
Hd->PartitionNumber = (UINT32) Atoi (PartitionStr);
Hd->PartitionNumber = (UINT32) Dtoi (PartitionStr);
ZeroMem (Hd->Signature, 16);
Hd->MBRType = (UINT8) 0;
if (StrCmp (TypeStr, L"None") == 0) {
Hd->SignatureType = (UINT8) 0;
} else if (StrCmp (TypeStr, L"MBR") == 0) {
if (StrCmp (TypeStr, L"MBR") == 0) {
Hd->SignatureType = SIGNATURE_TYPE_MBR;
Hd->MBRType = 0x01;
Signature32 = (UINT32) Xtoi (SignatureStr);
Signature32 = (UINT32) Strtoi (SignatureStr);
CopyMem (Hd->Signature, &Signature32, sizeof (UINT32));
} else if (StrCmp (TypeStr, L"GUID") == 0) {
} else if (StrCmp (TypeStr, L"GPT") == 0) {
Hd->SignatureType = SIGNATURE_TYPE_GUID;
Hd->MBRType = 0x02;
StrToGuid (SignatureStr, &SignatureGuid);
CopyMem (Hd->Signature, &SignatureGuid, sizeof (EFI_GUID));
} else {
Hd->SignatureType = 0xff;
Hd->SignatureType = (UINT8) Strtoi (TypeStr);
}
Xtoi64 (StartStr, &Hd->PartitionStart);
Xtoi64 (SizeStr, &Hd->PartitionSize);
Strtoi64 (StartStr, &Hd->PartitionStart);
Strtoi64 (SizeStr, &Hd->PartitionSize);
return (EFI_DEVICE_PATH_PROTOCOL *) Hd;
}
@ -2062,9 +2182,9 @@ DevPathFromTextCDROM (
sizeof (CDROM_DEVICE_PATH)
);
CDROM->BootEntry = (UINT32) Xtoi (EntryStr);
Xtoi64 (StartStr, &CDROM->PartitionStart);
Xtoi64 (SizeStr, &CDROM->PartitionSize);
CDROM->BootEntry = (UINT32) Strtoi (EntryStr);
Strtoi64 (StartStr, &CDROM->PartitionStart);
Strtoi64 (SizeStr, &CDROM->PartitionSize);
return (EFI_DEVICE_PATH_PROTOCOL *) CDROM;
}
@ -2122,6 +2242,48 @@ DevPathFromTextMedia (
return (EFI_DEVICE_PATH_PROTOCOL *) Media;
}
STATIC
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextFv (
IN CHAR16 *TextDeviceNode
)
{
CHAR16 *GuidStr;
MEDIA_FW_VOL_DEVICE_PATH *Fv;
GuidStr = GetNextParamStr (&TextDeviceNode);
Fv = (MEDIA_FW_VOL_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_PIWG_FW_VOL_DP,
sizeof (MEDIA_FW_VOL_DEVICE_PATH)
);
StrToGuid (GuidStr, &Fv->FvName);
return (EFI_DEVICE_PATH_PROTOCOL *) Fv;
}
STATIC
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextFvFile (
IN CHAR16 *TextDeviceNode
)
{
CHAR16 *GuidStr;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile;
GuidStr = GetNextParamStr (&TextDeviceNode);
FvFile = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_PIWG_FW_FILE_DP,
sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH)
);
StrToGuid (GuidStr, &FvFile->FvFileName);
return (EFI_DEVICE_PATH_PROTOCOL *) FvFile;
}
STATIC
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextBBS (
@ -2131,7 +2293,7 @@ DevPathFromTextBBS (
CHAR16 *TypeStr;
CHAR16 *IdStr;
CHAR16 *FlagsStr;
UINT8 *AsciiStr;
CHAR8 *AsciiStr;
BBS_BBS_DEVICE_PATH *Bbs;
TypeStr = GetNextParamStr (&TextDeviceNode);
@ -2156,17 +2318,55 @@ DevPathFromTextBBS (
} else if (StrCmp (TypeStr, L"Network") == 0) {
Bbs->DeviceType = BBS_TYPE_EMBEDDED_NETWORK;
} else {
Bbs->DeviceType = BBS_TYPE_UNKNOWN;
Bbs->DeviceType = (UINT16) Strtoi (TypeStr);
}
AsciiStr = (UINT8 *) Bbs->String;
StrToAscii (IdStr, (CHAR8 **) &AsciiStr);
AsciiStr = Bbs->String;
StrToAscii (IdStr, &AsciiStr);
Bbs->StatusFlag = (UINT16) Xtoi (FlagsStr);
Bbs->StatusFlag = (UINT16) Strtoi (FlagsStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Bbs;
}
STATIC
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextSata (
IN CHAR16 *TextDeviceNode
)
{
SATA_DEVICE_PATH *Sata;
CHAR16 *Param1;
CHAR16 *Param2;
CHAR16 *Param3;
//
// The PMPN is optional.
//
Param1 = GetNextParamStr (&TextDeviceNode);
Param2 = GetNextParamStr (&TextDeviceNode);
Param3 = NULL;
if (!IS_NULL (TextDeviceNode)) {
Param3 = GetNextParamStr (&TextDeviceNode);
}
Sata = (SATA_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_SATA_DP,
sizeof (SATA_DEVICE_PATH)
);
Sata->HbaPortNumber = (UINT16) Xtoi (Param1);
if (Param3 != NULL) {
Sata->PortMultiplierPort = (UINT16) Xtoi (Param2);
Param2 = Param3;
} else {
Sata->PortMultiplierPort = 0;
}
Sata->LogicalUnitNumber = (UINT16) Xtoi (Param2);
return (EFI_DEVICE_PATH_PROTOCOL *) Sata;
}
GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[] = {
{L"Pci", DevPathFromTextPci},
{L"PcCard", DevPathFromTextPcCard},
@ -2223,7 +2423,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[]
{L"CDROM", DevPathFromTextCDROM},
{L"VenMEDIA", DevPathFromTextVenMEDIA},
{L"Media", DevPathFromTextMedia},
{L"Fv", DevPathFromTextFv},
{L"FvFile", DevPathFromTextFvFile},
{L"BBS", DevPathFromTextBBS},
{L"Sata", DevPathFromTextSata},
{NULL, NULL}
};

View File

@ -212,7 +212,7 @@ DevPathToTextPci (
PCI_DEVICE_PATH *Pci;
Pci = DevPath;
CatPrint (Str, L"Pci(%x,%x)", Pci->Function, Pci->Device);
CatPrint (Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function);
}
STATIC
@ -227,7 +227,7 @@ DevPathToTextPccard (
PCCARD_DEVICE_PATH *Pccard;
Pccard = DevPath;
CatPrint (Str, L"PcCard(%x)", Pccard->FunctionNumber);
CatPrint (Str, L"PcCard(0x%x)", Pccard->FunctionNumber);
}
STATIC
@ -244,7 +244,8 @@ DevPathToTextMemMap (
MemMap = DevPath;
CatPrint (
Str,
L"MemoryMapped(%lx,%lx)",
L"MemoryMapped(0x%x,0x%lx,0x%lx)",
MemMap->MemoryType,
MemMap->StartingAddress,
MemMap->EndingAddress
);
@ -262,6 +263,7 @@ DevPathToTextVendor (
VENDOR_DEVICE_PATH *Vendor;
CHAR16 *Type;
UINTN Index;
UINTN DataLength;
UINT32 FlowControlMap;
UINT16 Info;
@ -309,7 +311,7 @@ DevPathToTextVendor (
} else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingSASGuid)) {
CatPrint (
Str,
L"SAS(%lx,%lx,%x,",
L"SAS(0x%lx,0x%lx,0x%x,",
((SAS_DEVICE_PATH *) Vendor)->SasAddress,
((SAS_DEVICE_PATH *) Vendor)->Lun,
((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort
@ -328,22 +330,17 @@ DevPathToTextVendor (
if ((Info & 0x0f) == 1) {
CatPrint (Str, L"0,");
} else {
CatPrint (Str, L"%x,", (Info >> 8) & 0xff);
CatPrint (Str, L"0x%x,", (Info >> 8) & 0xff);
}
} else {
CatPrint (Str, L"0,0,0,0,");
}
CatPrint (Str, L"%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);
CatPrint (Str, L"0x%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);
return ;
} else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {
CatPrint (Str, L"DebugPort()");
return ;
} else {
return ;
//
// reserved
//
}
}
break;
@ -357,10 +354,14 @@ DevPathToTextVendor (
break;
}
CatPrint (Str, L"Ven%s(%g,", Type, &Vendor->Guid);
for (Index = 0; Index < DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH); Index++) {
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++) {
CatPrint (Str, L"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);
}
}
CatPrint (Str, L")");
}
@ -379,7 +380,7 @@ DevPathToTextController (
Controller = DevPath;
CatPrint (
Str,
L"Ctrl(%x)",
L"Ctrl(0x%x)",
Controller->ControllerNumber
);
}
@ -397,110 +398,157 @@ DevPathToTextAcpi (
Acpi = DevPath;
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
if (AllowShortcuts) {
switch (EISA_ID_TO_NUM (Acpi->HID)) {
case 0x0a03:
CatPrint (Str, L"PciRoot(%x)", Acpi->UID);
CatPrint (Str, L"PciRoot(0x%x)", Acpi->UID);
break;
case 0x0604:
CatPrint (Str, L"Floppy(%x)", Acpi->UID);
CatPrint (Str, L"Floppy(0x%x)", Acpi->UID);
break;
case 0x0301:
CatPrint (Str, L"Keyboard(%x)", Acpi->UID);
CatPrint (Str, L"Keyboard(0x%x)", Acpi->UID);
break;
case 0x0501:
CatPrint (Str, L"Serial(%x)", Acpi->UID);
CatPrint (Str, L"Serial(0x%x)", Acpi->UID);
break;
case 0x0401:
CatPrint (Str, L"ParallelPort(%x)", Acpi->UID);
CatPrint (Str, L"ParallelPort(0x%x)", Acpi->UID);
break;
default:
CatPrint (Str, L"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
break;
}
return ;
}
CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
} else {
CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
CatPrint (Str, L"Acpi(0x%08x,0x%x)", Acpi->HID, Acpi->UID);
}
}
#define NextStrA(a) ((UINT8 *) (((UINT8 *) (a)) + AsciiStrLen ((CHAR8 *) (a)) + 1))
STATIC
VOID
DevPathToTextExtAcpi (
EisaIdToText (
IN UINT32 EisaId,
IN OUT CHAR16 *Text
)
{
CHAR16 PnpIdStr[17];
//
//UnicodeSPrint ("%X", 0x0a03) => "0000000000000A03"
//
UnicodeSPrint (PnpIdStr, 17 * 2, L"%X", EisaId >> 16);
UnicodeSPrint (
Text,
0,
L"%c%c%c%s",
'@' + ((EisaId >> 10) & 0x1f),
'@' + ((EisaId >> 5) & 0x1f),
'@' + ((EisaId >> 0) & 0x1f),
PnpIdStr + (16 - 4)
);
}
STATIC
VOID
DevPathToTextAcpiEx (
IN OUT POOL_PRINT *Str,
IN VOID *DevPath,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
)
{
ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *AcpiExt;
UINT8 *NextString;
ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;
CHAR8 *HIDStr;
CHAR8 *UIDStr;
CHAR8 *CIDStr;
CHAR16 HIDText[11];
CHAR16 CIDText[11];
AcpiExt = DevPath;
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) {
NextString = NextStrA (AcpiExt->HidUidCidStr);
if ((*(AcpiExt->HidUidCidStr) == '\0') &&
(*(NextStrA (NextString)) == '\0') &&
(AcpiExt->UID == 0)
) {
if ((AcpiExt->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
CatPrint (
Str,
L"AcpiExp(PNP%04x,%x,%a)",
EISA_ID_TO_NUM (AcpiExt->HID),
AcpiExt->CID,
NextStrA (AcpiExt->HidUidCidStr)
);
//
// display only
//
if (AcpiEx->HID == 0) {
CatPrint (Str, L"AcpiEx(%a,", HIDStr);
} else {
CatPrint (
Str,
L"AcpiExp(%08x,%x,%a)",
AcpiExt->HID,
AcpiExt->CID,
NextStrA (AcpiExt->HidUidCidStr)
);
}
}
return ;
CatPrint (Str, L"AcpiEx(%s,", HIDText);
}
NextString = NextStrA (AcpiExt->HidUidCidStr);
NextString = NextStrA (NextString);
if ((AcpiExt->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
CatPrint (
Str,
L"AcpiEx(PNP%04x,%x,%x,%a,%a,%a)",
EISA_ID_TO_NUM (AcpiExt->HID),
AcpiExt->CID,
AcpiExt->UID,
AcpiExt->HidUidCidStr,
NextString,
NextStrA (AcpiExt->HidUidCidStr)
);
if (AcpiEx->UID == 0) {
CatPrint (Str, L"%a,", UIDStr);
} else {
CatPrint (Str, L"0x%x,", AcpiEx->UID);
}
if (AcpiEx->CID == 0) {
CatPrint (Str, L"%a)", CIDStr);
} else {
CatPrint (Str, L"%s)", CIDText);
}
} else {
CatPrint (
Str,
L"AcpiEx(%08x,%x,%x,%a,%a,%a)",
AcpiExt->HID,
AcpiExt->CID,
AcpiExt->UID,
AcpiExt->HidUidCidStr,
NextString,
NextStrA (AcpiExt->HidUidCidStr)
L"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
HIDText,
CIDText,
AcpiEx->UID,
HIDStr,
CIDStr,
UIDStr
);
}
}
}
STATIC
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);
CatPrint (Str, L"AcpiAdr(0x%x", AcpiAdr->ADR);
for (Index = 0; Index < AdditionalAdrCount; Index++) {
CatPrint (Str, L",0x%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));
}
CatPrint (Str, L")");
}
STATIC
VOID
@ -516,11 +564,11 @@ DevPathToTextAtapi (
Atapi = DevPath;
if (DisplayOnly) {
CatPrint (Str, L"Ata(%x)", Atapi->Lun);
CatPrint (Str, L"Ata(0x%x)", Atapi->Lun);
} else {
CatPrint (
Str,
L"Ata(%s,%s,%x)",
L"Ata(%s,%s,0x%x)",
Atapi->PrimarySecondary ? L"Secondary" : L"Primary",
Atapi->SlaveMaster ? L"Slave" : L"Master",
Atapi->Lun
@ -540,7 +588,7 @@ DevPathToTextScsi (
SCSI_DEVICE_PATH *Scsi;
Scsi = DevPath;
CatPrint (Str, L"Scsi(%x,%x)", Scsi->Pun, Scsi->Lun);
CatPrint (Str, L"Scsi(0x%x,0x%x)", Scsi->Pun, Scsi->Lun);
}
STATIC
@ -555,7 +603,7 @@ DevPathToTextFibre (
FIBRECHANNEL_DEVICE_PATH *Fibre;
Fibre = DevPath;
CatPrint (Str, L"Fibre(%lx,%lx)", Fibre->WWN, Fibre->Lun);
CatPrint (Str, L"Fibre(0x%lx,0x%lx)", Fibre->WWN, Fibre->Lun);
}
STATIC
@ -570,7 +618,10 @@ DevPathToText1394 (
F1394_DEVICE_PATH *F1394;
F1394 = DevPath;
CatPrint (Str, L"I1394(%lx)", F1394->Guid);
//
// Guid has format of IEEE-EUI64
//
CatPrint (Str, L"I1394(%016lx)", F1394->Guid);
}
STATIC
@ -585,7 +636,7 @@ DevPathToTextUsb (
USB_DEVICE_PATH *Usb;
Usb = DevPath;
CatPrint (Str, L"USB(%x,%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
CatPrint (Str, L"USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
}
STATIC
@ -598,14 +649,30 @@ DevPathToTextUsbWWID (
)
{
USB_WWID_DEVICE_PATH *UsbWWId;
CHAR16 *SerialNumberStr;
CHAR16 *NewStr;
UINT16 Length;
UsbWWId = DevPath;
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);
NewStr [Length] = 0;
SerialNumberStr = NewStr;
}
CatPrint (
Str,
L"UsbWwid(%x,%x,%x,\"WWID\")",
L"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
UsbWWId->VendorId,
UsbWWId->ProductId,
UsbWWId->InterfaceNumber
UsbWWId->InterfaceNumber,
SerialNumberStr
);
}
@ -621,7 +688,7 @@ DevPathToTextLogicalUnit (
DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
LogicalUnit = DevPath;
CatPrint (Str, L"Unit(%x)", LogicalUnit->Lun);
CatPrint (Str, L"Unit(0x%x)", LogicalUnit->Lun);
}
STATIC
@ -634,181 +701,112 @@ DevPathToTextUsbClass (
)
{
USB_CLASS_DEVICE_PATH *UsbClass;
BOOLEAN IsKnownSubClass;
UsbClass = DevPath;
if (AllowShortcuts == TRUE) {
IsKnownSubClass = TRUE;
switch (UsbClass->DeviceClass) {
case 1:
CatPrint (
Str,
L"UsbAudio(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_AUDIO:
CatPrint (Str, L"UsbAudio");
break;
case 2:
CatPrint (
Str,
L"UsbCDCControl(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_CDCCONTROL:
CatPrint (Str, L"UsbCDCControl");
break;
case 3:
CatPrint (
Str,
L"UsbHID(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_HID:
CatPrint (Str, L"UsbHID");
break;
case 6:
CatPrint (
Str,
L"UsbImage(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_IMAGE:
CatPrint (Str, L"UsbImage");
break;
case 7:
CatPrint (
Str,
L"UsbPrinter(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_PRINTER:
CatPrint (Str, L"UsbPrinter");
break;
case 8:
CatPrint (
Str,
L"UsbMassStorage(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_MASS_STORAGE:
CatPrint (Str, L"UsbMassStorage");
break;
case 9:
CatPrint (
Str,
L"UsbHub(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_HUB:
CatPrint (Str, L"UsbHub");
break;
case 10:
CatPrint (
Str,
L"UsbCDCData(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_CDCDATA:
CatPrint (Str, L"UsbCDCData");
break;
case 11:
CatPrint (
Str,
L"UsbSmartCard(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_SMART_CARD:
CatPrint (Str, L"UsbSmartCard");
break;
case 14:
CatPrint (
Str,
L"UsbVideo(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_VIDEO:
CatPrint (Str, L"UsbVideo");
break;
case 220:
CatPrint (
Str,
L"UsbDiagnostic(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
case USB_CLASS_DIAGNOSTIC:
CatPrint (Str, L"UsbDiagnostic");
break;
case 224:
CatPrint (
Str,
L"UsbWireless(%x,%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
break;
case 254:
if (UsbClass->DeviceSubClass == 1) {
CatPrint (
Str,
L"UsbDeviceFirmwareUpdate(%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceProtocol
);
} else if (UsbClass->DeviceSubClass == 2) {
CatPrint (
Str,
L"UsbIrdaBridge(%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceProtocol
);
} else if (UsbClass->DeviceSubClass == 3) {
CatPrint (
Str,
L"UsbTestAndMeasurement(%x,%x,%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceProtocol
);
}
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)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceSubClass,
UsbClass->DeviceProtocol
);
return;
}
if (UsbClass->DeviceClass == USB_CLASS_RESERVE) {
if (UsbClass->DeviceSubClass == USB_SUBCLASS_FW_UPDATE) {
CatPrint (
Str,
L"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceProtocol
);
return;
} else if (UsbClass->DeviceSubClass == USB_SUBCLASS_IRDA_BRIDGE) {
CatPrint (
Str,
L"UsbIrdaBridge(0x%x,0x%x,0x%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceProtocol
);
return;
} else if (UsbClass->DeviceSubClass == USB_SUBCLASS_TEST) {
CatPrint (
Str,
L"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceProtocol
);
return;
}
}
CatPrint (
Str,
L"UsbClass(%x,%x,%x,%x,%x)",
L"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
UsbClass->VendorId,
UsbClass->ProductId,
UsbClass->DeviceClass,
@ -817,6 +815,27 @@ DevPathToTextUsbClass (
);
}
STATIC
VOID
DevPathToTextSata (
IN OUT POOL_PRINT *Str,
IN VOID *DevPath,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
)
{
SATA_DEVICE_PATH *Sata;
Sata = DevPath;
CatPrint (
Str,
L"Sata(0x%x,0x%x,0x%x)",
(UINTN) Sata->HbaPortNumber,
(UINTN) Sata->PortMultiplierPort,
(UINTN) Sata->LogicalUnitNumber
);
}
STATIC
VOID
DevPathToTextI2O (
@ -829,7 +848,7 @@ DevPathToTextI2O (
I2O_DEVICE_PATH *I2O;
I2O = DevPath;
CatPrint (Str, L"I2O(%x)", I2O->Tid);
CatPrint (Str, L"I2O(0x%x)", I2O->Tid);
}
STATIC
@ -858,7 +877,7 @@ DevPathToTextMacAddr (
CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);
}
CatPrint (Str, L",%x)", MAC->IfType);
CatPrint (Str, L",0x%x)", MAC->IfType);
}
STATIC
@ -991,7 +1010,7 @@ DevPathToTextInfiniBand (
InfiniBand = DevPath;
CatPrint (
Str,
L"Infiniband(%x,%g,%lx,%lx,%lx)",
L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
InfiniBand->ResourceFlags,
InfiniBand->PortGid,
InfiniBand->ServiceId,
@ -1095,7 +1114,7 @@ DevPathToTextiSCSI (
iSCSI = DevPath;
CatPrint (
Str,
L"iSCSI(%s,%x,%lx,",
L"iSCSI(%a,0x%x,0x%lx,",
iSCSI->iSCSITargetName,
iSCSI->TargetPortalGroupTag,
iSCSI->Lun
@ -1129,19 +1148,10 @@ DevPathToTextHardDrive (
Hd = DevPath;
switch (Hd->SignatureType) {
case 0:
CatPrint (
Str,
L"HD(%d,%s,0,",
Hd->PartitionNumber,
L"None"
);
break;
case SIGNATURE_TYPE_MBR:
CatPrint (
Str,
L"HD(%d,%s,%08x,",
L"HD(%d,%s,0x%08x,",
Hd->PartitionNumber,
L"MBR",
*((UINT32 *) (&(Hd->Signature[0])))
@ -1153,16 +1163,22 @@ DevPathToTextHardDrive (
Str,
L"HD(%d,%s,%g,",
Hd->PartitionNumber,
L"GUID",
L"GPT",
(EFI_GUID *) &(Hd->Signature[0])
);
break;
default:
CatPrint (
Str,
L"HD(%d,%d,0,",
Hd->PartitionNumber,
Hd->SignatureType
);
break;
}
CatPrint (Str, L"%lx,%lx)", Hd->PartitionStart, Hd->PartitionSize);
CatPrint (Str, L"0x%lx,0x%lx)", Hd->PartitionStart, Hd->PartitionSize);
}
STATIC
@ -1178,11 +1194,11 @@ DevPathToTextCDROM (
Cd = DevPath;
if (DisplayOnly == TRUE) {
CatPrint (Str, L"CDROM(%x)", Cd->BootEntry);
CatPrint (Str, L"CDROM(0x%x)", Cd->BootEntry);
return ;
}
CatPrint (Str, L"CDROM(%x,%lx,%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);
CatPrint (Str, L"CDROM(0x%x,0x%lx,0x%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);
}
STATIC
@ -1215,6 +1231,36 @@ DevPathToTextMediaProtocol (
CatPrint (Str, L"Media(%g)", &MediaProt->Protocol);
}
STATIC
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);
}
STATIC
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);
}
STATIC
VOID
DevPathToTextBBS (
@ -1254,18 +1300,22 @@ DevPathToTextBBS (
break;
default:
Type = L"?";
Type = NULL;
break;
}
if (Type != NULL) {
CatPrint (Str, L"BBS(%s,%a", Type, Bbs->String);
} else {
CatPrint (Str, L"BBS(0x%x,%a", Bbs->DeviceType, Bbs->String);
}
if (DisplayOnly == TRUE) {
CatPrint (Str, L")");
return ;
}
CatPrint (Str, L",%x)", Bbs->StatusFlag);
CatPrint (Str, L",0x%x)", Bbs->StatusFlag);
}
STATIC
@ -1299,7 +1349,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
{HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor},
{HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController},
{ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi},
{ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextExtAcpi},
{ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx},
{ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr},
{MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi},
{MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi},
{MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre},
@ -1308,6 +1359,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
{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},
{MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata},
{MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O},
{MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr},
{MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4},
@ -1322,6 +1374,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable
{MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},
{MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol},
{MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},
{MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv},
{MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile},
{BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS},
{END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance},
{0, 0, NULL}