2 DevicePathFromText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "DevicePath.h"
22 @param Src Source string.
24 @return The duplicated string.
32 return AllocateCopyPool (StrSize (Src
), Src
);
37 Get parameter in a pair of parentheses follow the given node name.
38 For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1".
40 @param Str Device Path Text.
41 @param NodeName Name of the node.
43 @return Parameter text for the node.
55 UINTN ParameterLength
;
58 // Check whether the node name matchs
60 NodeNameLength
= StrLen (NodeName
);
61 if (CompareMem (Str
, NodeName
, NodeNameLength
* sizeof (CHAR16
)) != 0) {
65 ParamStr
= Str
+ NodeNameLength
;
66 if (!IS_LEFT_PARENTH (*ParamStr
)) {
71 // Skip the found '(' and find first occurrence of ')'
75 StrPointer
= ParamStr
;
76 while (!IS_NULL (*StrPointer
)) {
77 if (IS_RIGHT_PARENTH (*StrPointer
)) {
83 if (IS_NULL (*StrPointer
)) {
90 ParamStr
= AllocateCopyPool ((ParameterLength
+ 1) * sizeof (CHAR16
), ParamStr
);
91 if (ParamStr
== NULL
) {
95 // Terminate the parameter string
97 ParamStr
[ParameterLength
] = L
'\0';
103 Gets current sub-string from a string list, before return
104 the list header is moved to next sub-string. The sub-string is separated
105 by the specified character. For example, the separator is ',', the string
106 list is "2,0,3", it returns "2", the remain list move to "0,3"
108 @param List A string list separated by the specified separator
109 @param Separator The separator character
111 @return A pointer to the current sub-string
116 IN OUT CHAR16
**List
,
126 if (IS_NULL (*Str
)) {
131 // Find first occurrence of the separator
133 while (!IS_NULL (*Str
)) {
134 if (*Str
== Separator
) {
140 if (*Str
== Separator
) {
142 // Find a sub-string, terminate it
149 // Move to next sub-string
157 Gets the next parameter string from the list.
159 @param List A string list separated by the specified separator
161 @return A pointer to the current sub-string
170 // The separator is comma
172 return SplitStr (List
, L
',');
176 Get one device node from entire device path text.
178 @param DevicePath On input, the current Device Path node; on output, the next device path node
179 @param IsInstanceEnd This node is the end of a device path instance
181 @return A device node text or NULL if no more device node available
185 GetNextDeviceNodeStr (
186 IN OUT CHAR16
**DevicePath
,
187 OUT BOOLEAN
*IsInstanceEnd
192 UINTN ParenthesesStack
;
195 if (IS_NULL (*Str
)) {
200 // Skip the leading '/', '(', ')' and ','
202 while (!IS_NULL (*Str
)) {
203 if (!IS_SLASH (*Str
) &&
205 !IS_LEFT_PARENTH (*Str
) &&
206 !IS_RIGHT_PARENTH (*Str
)) {
215 // Scan for the separator of this device node, '/' or ','
217 ParenthesesStack
= 0;
218 while (!IS_NULL (*Str
)) {
219 if ((IS_COMMA (*Str
) || IS_SLASH (*Str
)) && (ParenthesesStack
== 0)) {
223 if (IS_LEFT_PARENTH (*Str
)) {
225 } else if (IS_RIGHT_PARENTH (*Str
)) {
232 if (ParenthesesStack
!= 0) {
234 // The '(' doesn't pair with ')', invalid device path text
239 if (IS_COMMA (*Str
)) {
240 *IsInstanceEnd
= TRUE
;
244 *IsInstanceEnd
= FALSE
;
245 if (!IS_NULL (*Str
)) {
258 Skip the leading white space and '0x' or '0X' of a integer string
260 @param Str The integer string
261 @param IsHex TRUE: Hex string, FALSE: Decimal string
263 @return The trimmed Hex string.
275 // skip preceeding white space
277 while ((*Str
!= 0) && *Str
== ' ') {
281 // skip preceeding zeros
283 while ((*Str
!= 0) && *Str
== '0') {
287 // skip preceeding character 'x' or 'X'
289 if ((*Str
!= 0) && (*Str
== 'x' || *Str
== 'X')) {
299 Convert hex string to uint.
301 @param Str The hex string
303 @return A UINTN value represented by Str
314 ASSERT (Str
!= NULL
);
317 // convert hex digits
320 Length
= sizeof (UINTN
);
321 HexStringToBuf ((UINT8
*) &Rvalue
, &Length
, Str
, NULL
);
328 Convert hex string to 64 bit data.
330 @param Str The hex string
331 @param Data A pointer to the UINT64 value represented by Str
343 Length
= sizeof (UINT64
);
344 HexStringToBuf ((UINT8
*) Data
, &Length
, Str
, NULL
);
349 Convert decimal string to uint.
351 @param Str The decimal string
353 @return A UINTN value represented by Str
366 ASSERT (Str
!= NULL
);
368 High
= (UINTN
) -1 / 10;
369 Low
= (UINTN
) -1 % 10;
371 // skip preceeding white space
373 while ((*Str
!= 0) && *Str
== ' ') {
382 if (Char
>= '0' && Char
<= '9') {
383 if ((Rvalue
> High
|| Rvalue
== High
) && (Char
- '0' > (INTN
) Low
)) {
387 Rvalue
= (Rvalue
* 10) + Char
- '0';
400 Convert decimal string to uint.
402 @param Str The decimal string
403 @param Data A pointer to the UINT64 value represented by Str
417 ASSERT (Str
!= NULL
);
418 ASSERT (Data
!= NULL
);
421 // skip preceeding white space
423 while ((*Str
!= 0) && *Str
== ' ') {
432 if (Char
>= '0' && Char
<= '9') {
433 High
= LShiftU64 (Rvalue
, 3);
434 Low
= LShiftU64 (Rvalue
, 1);
435 Rvalue
= High
+ Low
+ Char
- '0';
448 Convert integer string to uint.
450 @param Str The integer string. If leading with "0x" or "0X", it's heximal.
452 @return A UINTN value represented by Str
462 Str
= TrimHexStr (Str
, &IsHex
);
473 Convert integer string to 64 bit data.
475 @param Str The integer string. If leading with "0x" or "0X", it's heximal.
476 @param Data A pointer to the UINT64 value represented by Str
487 Str
= TrimHexStr (Str
, &IsHex
);
497 Converts a list of string to a specified buffer.
499 @param Buf The output buffer that contains the string.
500 @param BufferLength The length of the buffer
501 @param Str The input string that contains the hex number
503 @retval EFI_SUCCESS The string was successfully converted to the buffer.
509 IN UINTN BufferLength
,
521 // Two hex char make up one byte
523 StrLength
= BufferLength
* sizeof (CHAR16
);
525 for(Index
= 0; Index
< StrLength
; Index
++, Str
++) {
527 IsHexDigit (&Digit
, *Str
);
530 // For odd charaters, write the upper nibble for each buffer byte,
531 // and for even characters, the lower nibble.
533 if ((Index
& 1) == 0) {
534 Byte
= (UINT8
) (Digit
<< 4);
536 Byte
= Buf
[Index
/ 2];
538 Byte
= (UINT8
) (Byte
| Digit
);
541 Buf
[Index
/ 2] = Byte
;
548 Converts a string to GUID value.
550 @param Str The registry format GUID string that contains the GUID value.
551 @param Guid A pointer to the converted GUID value.
553 @retval EFI_SUCCESS The GUID string was successfully converted to the GUID value.
554 @retval EFI_UNSUPPORTED The input string is not in registry format.
555 @return others Some error occurred when converting part of GUID value.
565 UINTN ConvertedStrLen
;
568 BufferLength
= sizeof (Guid
->Data1
);
569 Status
= HexStringToBuf ((UINT8
*) &Guid
->Data1
, &BufferLength
, Str
, &ConvertedStrLen
);
570 if (EFI_ERROR (Status
)) {
573 Str
+= ConvertedStrLen
;
574 if (IS_HYPHEN (*Str
)) {
577 return EFI_UNSUPPORTED
;
580 BufferLength
= sizeof (Guid
->Data2
);
581 Status
= HexStringToBuf ((UINT8
*) &Guid
->Data2
, &BufferLength
, Str
, &ConvertedStrLen
);
582 if (EFI_ERROR (Status
)) {
585 Str
+= ConvertedStrLen
;
586 if (IS_HYPHEN (*Str
)) {
589 return EFI_UNSUPPORTED
;
592 BufferLength
= sizeof (Guid
->Data3
);
593 Status
= HexStringToBuf ((UINT8
*) &Guid
->Data3
, &BufferLength
, Str
, &ConvertedStrLen
);
594 if (EFI_ERROR (Status
)) {
597 Str
+= ConvertedStrLen
;
598 if (IS_HYPHEN (*Str
)) {
601 return EFI_UNSUPPORTED
;
604 StrToBuf (&Guid
->Data4
[0], 2, Str
);
606 // Skip 2 byte hex chars
610 if (IS_HYPHEN (*Str
)) {
613 return EFI_UNSUPPORTED
;
615 StrToBuf (&Guid
->Data4
[2], 6, Str
);
621 Converts a string to IPv4 address
623 @param Str A string representation of IPv4 address.
624 @param IPv4Addr A pointer to the converted IPv4 address.
630 OUT EFI_IPv4_ADDRESS
*IPv4Addr
635 for (Index
= 0; Index
< 4; Index
++) {
636 IPv4Addr
->Addr
[Index
] = (UINT8
) Dtoi (SplitStr (Str
, L
'.'));
641 Converts a string to IPv4 address
643 @param Str A string representation of IPv6 address.
644 @param IPv6Addr A pointer to the converted IPv6 address.
650 OUT EFI_IPv6_ADDRESS
*IPv6Addr
656 for (Index
= 0; Index
< 8; Index
++) {
657 Data
= (UINT16
) Xtoi (SplitStr (Str
, L
':'));
658 IPv6Addr
->Addr
[Index
* 2] = (UINT8
) (Data
>> 8);
659 IPv6Addr
->Addr
[Index
* 2 + 1] = (UINT8
) (Data
& 0xff);
664 Converts a Unicode string to ASCII string.
666 @param Str The equiventant Unicode string
667 @param AsciiStr On input, it points to destination ASCII string buffer; on output, it points
668 to the next ASCII string next to it
674 IN OUT CHAR8
**AsciiStr
680 while (!IS_NULL (*Str
)) {
681 *(Dest
++) = (CHAR8
) *(Str
++);
686 // Return the string next to it
688 *AsciiStr
= Dest
+ 1;
692 Converts a text device path node to Hardware PCI device path structure.
694 @param TextDeviceNode The input Text device path node.
696 @return A pointer to Hardware PCI device path structure.
699 EFI_DEVICE_PATH_PROTOCOL
*
701 IN CHAR16
*TextDeviceNode
706 PCI_DEVICE_PATH
*Pci
;
708 DeviceStr
= GetNextParamStr (&TextDeviceNode
);
709 FunctionStr
= GetNextParamStr (&TextDeviceNode
);
710 Pci
= (PCI_DEVICE_PATH
*) CreateDeviceNode (
711 HARDWARE_DEVICE_PATH
,
713 sizeof (PCI_DEVICE_PATH
)
716 Pci
->Function
= (UINT8
) Strtoi (FunctionStr
);
717 Pci
->Device
= (UINT8
) Strtoi (DeviceStr
);
719 return (EFI_DEVICE_PATH_PROTOCOL
*) Pci
;
723 Converts a text device path node to Hardware PC card device path structure.
725 @param TextDeviceNode The input Text device path node.
727 @return A pointer to Hardware PC card device path structure.
730 EFI_DEVICE_PATH_PROTOCOL
*
731 DevPathFromTextPcCard (
732 IN CHAR16
*TextDeviceNode
735 CHAR16
*FunctionNumberStr
;
736 PCCARD_DEVICE_PATH
*Pccard
;
738 FunctionNumberStr
= GetNextParamStr (&TextDeviceNode
);
739 Pccard
= (PCCARD_DEVICE_PATH
*) CreateDeviceNode (
740 HARDWARE_DEVICE_PATH
,
742 sizeof (PCCARD_DEVICE_PATH
)
745 Pccard
->FunctionNumber
= (UINT8
) Strtoi (FunctionNumberStr
);
747 return (EFI_DEVICE_PATH_PROTOCOL
*) Pccard
;
751 Converts a text device path node to Hardware memory map device path structure.
753 @param TextDeviceNode The input Text device path node.
755 @return A pointer to Hardware memory map device path structure.
758 EFI_DEVICE_PATH_PROTOCOL
*
759 DevPathFromTextMemoryMapped (
760 IN CHAR16
*TextDeviceNode
763 CHAR16
*MemoryTypeStr
;
764 CHAR16
*StartingAddressStr
;
765 CHAR16
*EndingAddressStr
;
766 MEMMAP_DEVICE_PATH
*MemMap
;
768 MemoryTypeStr
= GetNextParamStr (&TextDeviceNode
);
769 StartingAddressStr
= GetNextParamStr (&TextDeviceNode
);
770 EndingAddressStr
= GetNextParamStr (&TextDeviceNode
);
771 MemMap
= (MEMMAP_DEVICE_PATH
*) CreateDeviceNode (
772 HARDWARE_DEVICE_PATH
,
774 sizeof (MEMMAP_DEVICE_PATH
)
777 MemMap
->MemoryType
= (UINT32
) Strtoi (MemoryTypeStr
);
778 Strtoi64 (StartingAddressStr
, &MemMap
->StartingAddress
);
779 Strtoi64 (EndingAddressStr
, &MemMap
->EndingAddress
);
781 return (EFI_DEVICE_PATH_PROTOCOL
*) MemMap
;
785 Converts a text device path node to Vendor device path structure based on the input Type
788 @param TextDeviceNode The input Text device path node.
789 @param Type The type of device path node.
790 @param SubType The subtype of device path node.
792 @return A pointer to the newly-created Vendor device path structure.
795 EFI_DEVICE_PATH_PROTOCOL
*
796 ConvertFromTextVendor (
797 IN CHAR16
*TextDeviceNode
,
805 VENDOR_DEVICE_PATH
*Vendor
;
807 GuidStr
= GetNextParamStr (&TextDeviceNode
);
809 DataStr
= GetNextParamStr (&TextDeviceNode
);
810 Length
= StrLen (DataStr
);
812 // Two hex characters make up 1 buffer byte
814 Length
= (Length
+ 1) / 2;
816 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
819 (UINT16
) (sizeof (VENDOR_DEVICE_PATH
) + Length
)
822 StrToGuid (GuidStr
, &Vendor
->Guid
);
823 StrToBuf (((UINT8
*) Vendor
) + sizeof (VENDOR_DEVICE_PATH
), Length
, DataStr
);
825 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
829 Converts a text device path node to Vendor Hardware device path structure.
831 @param TextDeviceNode The input Text device path node.
833 @return A pointer to the newly-created Vendor Hardware device path structure.
836 EFI_DEVICE_PATH_PROTOCOL
*
837 DevPathFromTextVenHw (
838 IN CHAR16
*TextDeviceNode
841 return ConvertFromTextVendor (
843 HARDWARE_DEVICE_PATH
,
849 Converts a text device path node to Hardware Controller device path structure.
851 @param TextDeviceNode The input Text device path node.
853 @return A pointer to the newly-created Hardware Controller device path structure.
856 EFI_DEVICE_PATH_PROTOCOL
*
857 DevPathFromTextCtrl (
858 IN CHAR16
*TextDeviceNode
861 CHAR16
*ControllerStr
;
862 CONTROLLER_DEVICE_PATH
*Controller
;
864 ControllerStr
= GetNextParamStr (&TextDeviceNode
);
865 Controller
= (CONTROLLER_DEVICE_PATH
*) CreateDeviceNode (
866 HARDWARE_DEVICE_PATH
,
868 sizeof (CONTROLLER_DEVICE_PATH
)
870 Controller
->ControllerNumber
= (UINT32
) Strtoi (ControllerStr
);
872 return (EFI_DEVICE_PATH_PROTOCOL
*) Controller
;
876 Converts a string to EisaId.
878 @param Text The input string.
879 @param EisaId A pointer to the output EisaId.
890 PnpId
= Xtoi (Text
+ 3);
891 *EisaId
= (((Text
[0] - '@') & 0x1f) << 10) +
892 (((Text
[1] - '@') & 0x1f) << 5) +
893 ((Text
[2] - '@') & 0x1f) +
894 (UINT32
) (PnpId
<< 16);
898 Converts a text device path node to ACPI HID device path structure.
900 @param TextDeviceNode The input Text device path node.
902 @return A pointer to the newly-created ACPI HID device path structure.
905 EFI_DEVICE_PATH_PROTOCOL
*
906 DevPathFromTextAcpi (
907 IN CHAR16
*TextDeviceNode
912 ACPI_HID_DEVICE_PATH
*Acpi
;
914 HIDStr
= GetNextParamStr (&TextDeviceNode
);
915 UIDStr
= GetNextParamStr (&TextDeviceNode
);
916 Acpi
= (ACPI_HID_DEVICE_PATH
*) CreateDeviceNode (
919 sizeof (ACPI_HID_DEVICE_PATH
)
922 EisaIdFromText (HIDStr
, &Acpi
->HID
);
923 Acpi
->UID
= (UINT32
) Strtoi (UIDStr
);
925 return (EFI_DEVICE_PATH_PROTOCOL
*) Acpi
;
929 Converts a text device path node to ACPI HID device path structure.
931 @param TextDeviceNode The input Text device path node.
932 @param PnPId The input plug and play identification.
934 @return A pointer to the newly-created ACPI HID device path structure.
937 EFI_DEVICE_PATH_PROTOCOL
*
938 ConvertFromTextAcpi (
939 IN CHAR16
*TextDeviceNode
,
944 ACPI_HID_DEVICE_PATH
*Acpi
;
946 UIDStr
= GetNextParamStr (&TextDeviceNode
);
947 Acpi
= (ACPI_HID_DEVICE_PATH
*) CreateDeviceNode (
950 sizeof (ACPI_HID_DEVICE_PATH
)
953 Acpi
->HID
= EFI_PNP_ID (PnPId
);
954 Acpi
->UID
= (UINT32
) Strtoi (UIDStr
);
956 return (EFI_DEVICE_PATH_PROTOCOL
*) Acpi
;
960 Converts a text device path node to PCI root device path structure.
962 @param TextDeviceNode The input Text device path node.
964 @return A pointer to the newly-created PCI root device path structure.
967 EFI_DEVICE_PATH_PROTOCOL
*
968 DevPathFromTextPciRoot (
969 IN CHAR16
*TextDeviceNode
972 return ConvertFromTextAcpi (TextDeviceNode
, 0x0a03);
976 Converts a text device path node to Floppy device path structure.
978 @param TextDeviceNode The input Text device path node.
980 @return A pointer to the newly-created Floppy device path structure.
983 EFI_DEVICE_PATH_PROTOCOL
*
984 DevPathFromTextFloppy (
985 IN CHAR16
*TextDeviceNode
988 return ConvertFromTextAcpi (TextDeviceNode
, 0x0604);
992 Converts a text device path node to Keyboard device path structure.
994 @param TextDeviceNode The input Text device path node.
996 @return A pointer to the newly-created Keyboard device path structure.
999 EFI_DEVICE_PATH_PROTOCOL
*
1000 DevPathFromTextKeyboard (
1001 IN CHAR16
*TextDeviceNode
1004 return ConvertFromTextAcpi (TextDeviceNode
, 0x0301);
1008 Converts a text device path node to Serial device path structure.
1010 @param TextDeviceNode The input Text device path node.
1012 @return A pointer to the newly-created Serial device path structure.
1015 EFI_DEVICE_PATH_PROTOCOL
*
1016 DevPathFromTextSerial (
1017 IN CHAR16
*TextDeviceNode
1020 return ConvertFromTextAcpi (TextDeviceNode
, 0x0501);
1024 Converts a text device path node to Parallel Port device path structure.
1026 @param TextDeviceNode The input Text device path node.
1028 @return A pointer to the newly-created Parallel Port device path structure.
1031 EFI_DEVICE_PATH_PROTOCOL
*
1032 DevPathFromTextParallelPort (
1033 IN CHAR16
*TextDeviceNode
1036 return ConvertFromTextAcpi (TextDeviceNode
, 0x0401);
1040 Converts a text device path node to ACPI extention device path structure.
1042 @param TextDeviceNode The input Text device path node.
1044 @return A pointer to the newly-created ACPI extention device path structure.
1047 EFI_DEVICE_PATH_PROTOCOL
*
1048 DevPathFromTextAcpiEx (
1049 IN CHAR16
*TextDeviceNode
1060 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
1062 HIDStr
= GetNextParamStr (&TextDeviceNode
);
1063 CIDStr
= GetNextParamStr (&TextDeviceNode
);
1064 UIDStr
= GetNextParamStr (&TextDeviceNode
);
1065 HIDSTRStr
= GetNextParamStr (&TextDeviceNode
);
1066 CIDSTRStr
= GetNextParamStr (&TextDeviceNode
);
1067 UIDSTRStr
= GetNextParamStr (&TextDeviceNode
);
1069 Length
= (UINT16
) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
) + StrLen (HIDSTRStr
) + 1);
1070 Length
= (UINT16
) (Length
+ StrLen (UIDSTRStr
) + 1);
1071 Length
= (UINT16
) (Length
+ StrLen (CIDSTRStr
) + 1);
1072 AcpiEx
= (ACPI_EXTENDED_HID_DEVICE_PATH
*) CreateDeviceNode (
1078 EisaIdFromText (HIDStr
, &AcpiEx
->HID
);
1079 EisaIdFromText (CIDStr
, &AcpiEx
->CID
);
1080 AcpiEx
->UID
= (UINT32
) Strtoi (UIDStr
);
1082 AsciiStr
= (CHAR8
*) ((UINT8
*)AcpiEx
+ sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
1083 StrToAscii (HIDSTRStr
, &AsciiStr
);
1084 StrToAscii (UIDSTRStr
, &AsciiStr
);
1085 StrToAscii (CIDSTRStr
, &AsciiStr
);
1087 return (EFI_DEVICE_PATH_PROTOCOL
*) AcpiEx
;
1091 Converts a text device path node to ACPI extention device path structure.
1093 @param TextDeviceNode The input Text device path node.
1095 @return A pointer to the newly-created ACPI extention device path structure.
1098 EFI_DEVICE_PATH_PROTOCOL
*
1099 DevPathFromTextAcpiExp (
1100 IN CHAR16
*TextDeviceNode
1108 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
1110 HIDStr
= GetNextParamStr (&TextDeviceNode
);
1111 CIDStr
= GetNextParamStr (&TextDeviceNode
);
1112 UIDSTRStr
= GetNextParamStr (&TextDeviceNode
);
1113 Length
= (UINT16
) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
) + StrLen (UIDSTRStr
) + 3);
1114 AcpiEx
= (ACPI_EXTENDED_HID_DEVICE_PATH
*) CreateDeviceNode (
1120 EisaIdFromText (HIDStr
, &AcpiEx
->HID
);
1121 EisaIdFromText (CIDStr
, &AcpiEx
->CID
);
1124 AsciiStr
= (CHAR8
*) ((UINT8
*)AcpiEx
+ sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
1126 // HID string is NULL
1130 // Convert UID string
1133 StrToAscii (UIDSTRStr
, &AsciiStr
);
1135 // CID string is NULL
1139 return (EFI_DEVICE_PATH_PROTOCOL
*) AcpiEx
;
1143 Converts a text device path node to Parallel Port device path structure.
1145 @param TextDeviceNode The input Text device path node.
1147 @return A pointer to the newly-created Parallel Port device path structure.
1150 EFI_DEVICE_PATH_PROTOCOL
*
1151 DevPathFromTextAta (
1152 IN CHAR16
*TextDeviceNode
1155 CHAR16
*PrimarySecondaryStr
;
1156 CHAR16
*SlaveMasterStr
;
1158 ATAPI_DEVICE_PATH
*Atapi
;
1160 Atapi
= (ATAPI_DEVICE_PATH
*) CreateDeviceNode (
1161 MESSAGING_DEVICE_PATH
,
1163 sizeof (ATAPI_DEVICE_PATH
)
1166 PrimarySecondaryStr
= GetNextParamStr (&TextDeviceNode
);
1167 SlaveMasterStr
= GetNextParamStr (&TextDeviceNode
);
1168 LunStr
= GetNextParamStr (&TextDeviceNode
);
1170 Atapi
->PrimarySecondary
= (UINT8
) ((StrCmp (PrimarySecondaryStr
, L
"Primary") == 0) ? 0 : 1);
1171 Atapi
->SlaveMaster
= (UINT8
) ((StrCmp (SlaveMasterStr
, L
"Master") == 0) ? 0 : 1);
1172 Atapi
->Lun
= (UINT16
) Strtoi (LunStr
);
1174 return (EFI_DEVICE_PATH_PROTOCOL
*) Atapi
;
1178 Converts a text device path node to SCSI device path structure.
1180 @param TextDeviceNode The input Text device path node.
1182 @return A pointer to the newly-created SCSI device path structure.
1185 EFI_DEVICE_PATH_PROTOCOL
*
1186 DevPathFromTextScsi (
1187 IN CHAR16
*TextDeviceNode
1192 SCSI_DEVICE_PATH
*Scsi
;
1194 PunStr
= GetNextParamStr (&TextDeviceNode
);
1195 LunStr
= GetNextParamStr (&TextDeviceNode
);
1196 Scsi
= (SCSI_DEVICE_PATH
*) CreateDeviceNode (
1197 MESSAGING_DEVICE_PATH
,
1199 sizeof (SCSI_DEVICE_PATH
)
1202 Scsi
->Pun
= (UINT16
) Strtoi (PunStr
);
1203 Scsi
->Lun
= (UINT16
) Strtoi (LunStr
);
1205 return (EFI_DEVICE_PATH_PROTOCOL
*) Scsi
;
1209 Converts a text device path node to Fibre device path structure.
1211 @param TextDeviceNode The input Text device path node.
1213 @return A pointer to the newly-created Fibre device path structure.
1216 EFI_DEVICE_PATH_PROTOCOL
*
1217 DevPathFromTextFibre (
1218 IN CHAR16
*TextDeviceNode
1223 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
1225 WWNStr
= GetNextParamStr (&TextDeviceNode
);
1226 LunStr
= GetNextParamStr (&TextDeviceNode
);
1227 Fibre
= (FIBRECHANNEL_DEVICE_PATH
*) CreateDeviceNode (
1228 MESSAGING_DEVICE_PATH
,
1229 MSG_FIBRECHANNEL_DP
,
1230 sizeof (FIBRECHANNEL_DEVICE_PATH
)
1233 Fibre
->Reserved
= 0;
1234 Strtoi64 (WWNStr
, &Fibre
->WWN
);
1235 Strtoi64 (LunStr
, &Fibre
->Lun
);
1237 return (EFI_DEVICE_PATH_PROTOCOL
*) Fibre
;
1241 Converts a text device path node to 1394 device path structure.
1243 @param TextDeviceNode The input Text device path node.
1245 @return A pointer to the newly-created 1394 device path structure.
1248 EFI_DEVICE_PATH_PROTOCOL
*
1249 DevPathFromText1394 (
1250 IN CHAR16
*TextDeviceNode
1254 F1394_DEVICE_PATH
*F1394DevPath
;
1256 GuidStr
= GetNextParamStr (&TextDeviceNode
);
1257 F1394DevPath
= (F1394_DEVICE_PATH
*) CreateDeviceNode (
1258 MESSAGING_DEVICE_PATH
,
1260 sizeof (F1394_DEVICE_PATH
)
1263 F1394DevPath
->Reserved
= 0;
1264 Xtoi64 (GuidStr
, &F1394DevPath
->Guid
);
1266 return (EFI_DEVICE_PATH_PROTOCOL
*) F1394DevPath
;
1270 Converts a text device path node to USB device path structure.
1272 @param TextDeviceNode The input Text device path node.
1274 @return A pointer to the newly-created USB device path structure.
1277 EFI_DEVICE_PATH_PROTOCOL
*
1278 DevPathFromTextUsb (
1279 IN CHAR16
*TextDeviceNode
1283 CHAR16
*InterfaceStr
;
1284 USB_DEVICE_PATH
*Usb
;
1286 PortStr
= GetNextParamStr (&TextDeviceNode
);
1287 InterfaceStr
= GetNextParamStr (&TextDeviceNode
);
1288 Usb
= (USB_DEVICE_PATH
*) CreateDeviceNode (
1289 MESSAGING_DEVICE_PATH
,
1291 sizeof (USB_DEVICE_PATH
)
1294 Usb
->ParentPortNumber
= (UINT8
) Strtoi (PortStr
);
1295 Usb
->InterfaceNumber
= (UINT8
) Strtoi (InterfaceStr
);
1297 return (EFI_DEVICE_PATH_PROTOCOL
*) Usb
;
1301 Converts a text device path node to I20 device path structure.
1303 @param TextDeviceNode The input Text device path node.
1305 @return A pointer to the newly-created I20 device path structure.
1308 EFI_DEVICE_PATH_PROTOCOL
*
1309 DevPathFromTextI2O (
1310 IN CHAR16
*TextDeviceNode
1314 I2O_DEVICE_PATH
*I2ODevPath
;
1316 TIDStr
= GetNextParamStr (&TextDeviceNode
);
1317 I2ODevPath
= (I2O_DEVICE_PATH
*) CreateDeviceNode (
1318 MESSAGING_DEVICE_PATH
,
1320 sizeof (I2O_DEVICE_PATH
)
1323 I2ODevPath
->Tid
= (UINT32
) Strtoi (TIDStr
);
1325 return (EFI_DEVICE_PATH_PROTOCOL
*) I2ODevPath
;
1329 Converts a text device path node to Infini Band device path structure.
1331 @param TextDeviceNode The input Text device path node.
1333 @return A pointer to the newly-created Infini Band device path structure.
1336 EFI_DEVICE_PATH_PROTOCOL
*
1337 DevPathFromTextInfiniband (
1338 IN CHAR16
*TextDeviceNode
1347 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1349 FlagsStr
= GetNextParamStr (&TextDeviceNode
);
1350 GuidStr
= GetNextParamStr (&TextDeviceNode
);
1351 SidStr
= GetNextParamStr (&TextDeviceNode
);
1352 TidStr
= GetNextParamStr (&TextDeviceNode
);
1353 DidStr
= GetNextParamStr (&TextDeviceNode
);
1354 InfiniBand
= (INFINIBAND_DEVICE_PATH
*) CreateDeviceNode (
1355 MESSAGING_DEVICE_PATH
,
1357 sizeof (INFINIBAND_DEVICE_PATH
)
1360 InfiniBand
->ResourceFlags
= (UINT32
) Strtoi (FlagsStr
);
1361 StrToGuid (GuidStr
, &PortGid
);
1362 CopyMem (InfiniBand
->PortGid
, &PortGid
, sizeof (EFI_GUID
));
1363 Strtoi64 (SidStr
, &InfiniBand
->ServiceId
);
1364 Strtoi64 (TidStr
, &InfiniBand
->TargetPortId
);
1365 Strtoi64 (DidStr
, &InfiniBand
->DeviceId
);
1367 return (EFI_DEVICE_PATH_PROTOCOL
*) InfiniBand
;
1371 Converts a text device path node to Vendor-Defined Messaging device path structure.
1373 @param TextDeviceNode The input Text device path node.
1375 @return A pointer to the newly-created Vendor-Defined Messaging device path structure.
1378 EFI_DEVICE_PATH_PROTOCOL
*
1379 DevPathFromTextVenMsg (
1380 IN CHAR16
*TextDeviceNode
1383 return ConvertFromTextVendor (
1385 MESSAGING_DEVICE_PATH
,
1391 Converts a text device path node to Vendor defined PC-ANSI device path structure.
1393 @param TextDeviceNode The input Text device path node.
1395 @return A pointer to the newly-created Vendor defined PC-ANSI device path structure.
1398 EFI_DEVICE_PATH_PROTOCOL
*
1399 DevPathFromTextVenPcAnsi (
1400 IN CHAR16
*TextDeviceNode
1403 VENDOR_DEVICE_PATH
*Vendor
;
1405 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
1406 MESSAGING_DEVICE_PATH
,
1408 sizeof (VENDOR_DEVICE_PATH
));
1409 CopyGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
);
1411 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
1415 Converts a text device path node to Vendor defined VT100 device path structure.
1417 @param TextDeviceNode The input Text device path node.
1419 @return A pointer to the newly-created Vendor defined VT100 device path structure.
1422 EFI_DEVICE_PATH_PROTOCOL
*
1423 DevPathFromTextVenVt100 (
1424 IN CHAR16
*TextDeviceNode
1427 VENDOR_DEVICE_PATH
*Vendor
;
1429 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
1430 MESSAGING_DEVICE_PATH
,
1432 sizeof (VENDOR_DEVICE_PATH
));
1433 CopyGuid (&Vendor
->Guid
, &gEfiVT100Guid
);
1435 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
1439 Converts a text device path node to Vendor defined VT100 Plus device path structure.
1441 @param TextDeviceNode The input Text device path node.
1443 @return A pointer to the newly-created Vendor defined VT100 Plus device path structure.
1446 EFI_DEVICE_PATH_PROTOCOL
*
1447 DevPathFromTextVenVt100Plus (
1448 IN CHAR16
*TextDeviceNode
1451 VENDOR_DEVICE_PATH
*Vendor
;
1453 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
1454 MESSAGING_DEVICE_PATH
,
1456 sizeof (VENDOR_DEVICE_PATH
));
1457 CopyGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
);
1459 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
1463 Converts a text device path node to Vendor defined UTF8 device path structure.
1465 @param TextDeviceNode The input Text device path node.
1467 @return A pointer to the newly-created Vendor defined UTF8 device path structure.
1470 EFI_DEVICE_PATH_PROTOCOL
*
1471 DevPathFromTextVenUtf8 (
1472 IN CHAR16
*TextDeviceNode
1475 VENDOR_DEVICE_PATH
*Vendor
;
1477 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
1478 MESSAGING_DEVICE_PATH
,
1480 sizeof (VENDOR_DEVICE_PATH
));
1481 CopyGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
);
1483 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
1487 Converts a text device path node to UART Flow Control device path structure.
1489 @param TextDeviceNode The input Text device path node.
1491 @return A pointer to the newly-created UART Flow Control device path structure.
1494 EFI_DEVICE_PATH_PROTOCOL
*
1495 DevPathFromTextUartFlowCtrl (
1496 IN CHAR16
*TextDeviceNode
1500 UART_FLOW_CONTROL_DEVICE_PATH
*UartFlowControl
;
1502 ValueStr
= GetNextParamStr (&TextDeviceNode
);
1503 UartFlowControl
= (UART_FLOW_CONTROL_DEVICE_PATH
*) CreateDeviceNode (
1504 MESSAGING_DEVICE_PATH
,
1506 sizeof (UART_FLOW_CONTROL_DEVICE_PATH
)
1509 CopyGuid (&UartFlowControl
->Guid
, &mEfiDevicePathMessagingUartFlowControlGuid
);
1510 if (StrCmp (ValueStr
, L
"XonXoff") == 0) {
1511 UartFlowControl
->FlowControlMap
= 2;
1512 } else if (StrCmp (ValueStr
, L
"Hardware") == 0) {
1513 UartFlowControl
->FlowControlMap
= 1;
1515 UartFlowControl
->FlowControlMap
= 0;
1518 return (EFI_DEVICE_PATH_PROTOCOL
*) UartFlowControl
;
1522 Converts a text device path node to Serial Attached SCSI device path structure.
1524 @param TextDeviceNode The input Text device path node.
1526 @return A pointer to the newly-created Serial Attached SCSI device path structure.
1529 EFI_DEVICE_PATH_PROTOCOL
*
1530 DevPathFromTextSAS (
1531 IN CHAR16
*TextDeviceNode
1538 CHAR16
*LocationStr
;
1540 CHAR16
*DriveBayStr
;
1541 CHAR16
*ReservedStr
;
1543 SAS_DEVICE_PATH
*Sas
;
1545 AddressStr
= GetNextParamStr (&TextDeviceNode
);
1546 LunStr
= GetNextParamStr (&TextDeviceNode
);
1547 RTPStr
= GetNextParamStr (&TextDeviceNode
);
1548 SASSATAStr
= GetNextParamStr (&TextDeviceNode
);
1549 LocationStr
= GetNextParamStr (&TextDeviceNode
);
1550 ConnectStr
= GetNextParamStr (&TextDeviceNode
);
1551 DriveBayStr
= GetNextParamStr (&TextDeviceNode
);
1552 ReservedStr
= GetNextParamStr (&TextDeviceNode
);
1554 Sas
= (SAS_DEVICE_PATH
*) CreateDeviceNode (
1555 MESSAGING_DEVICE_PATH
,
1557 sizeof (SAS_DEVICE_PATH
)
1560 CopyGuid (&Sas
->Guid
, &mEfiDevicePathMessagingSASGuid
);
1561 Strtoi64 (AddressStr
, &Sas
->SasAddress
);
1562 Strtoi64 (LunStr
, &Sas
->Lun
);
1563 Sas
->RelativeTargetPort
= (UINT16
) Strtoi (RTPStr
);
1564 if (StrCmp (SASSATAStr
, L
"NoTopology") != 0) {
1565 if (StrCmp (DriveBayStr
, L
"0") == 0) {
1569 Info
= (UINT16
) (Info
| (Strtoi (DriveBayStr
) << 8));
1572 if (StrCmp (SASSATAStr
, L
"SATA") == 0) {
1576 if (StrCmp (LocationStr
, L
"External") == 0) {
1580 if (StrCmp (ConnectStr
, L
"Expanded") == 0) {
1585 Sas
->DeviceTopology
= Info
;
1586 Sas
->Reserved
= (UINT32
) Strtoi (ReservedStr
);
1588 return (EFI_DEVICE_PATH_PROTOCOL
*) Sas
;
1592 Converts a text device path node to Debug Port device path structure.
1594 @param TextDeviceNode The input Text device path node.
1596 @return A pointer to the newly-created Debug Port device path structure.
1599 EFI_DEVICE_PATH_PROTOCOL
*
1600 DevPathFromTextDebugPort (
1601 IN CHAR16
*TextDeviceNode
1604 VENDOR_DEFINED_MESSAGING_DEVICE_PATH
*Vend
;
1606 Vend
= (VENDOR_DEFINED_MESSAGING_DEVICE_PATH
*) CreateDeviceNode (
1607 MESSAGING_DEVICE_PATH
,
1609 sizeof (VENDOR_DEFINED_MESSAGING_DEVICE_PATH
)
1612 CopyGuid (&Vend
->Guid
, &gEfiDebugPortProtocolGuid
);
1614 return (EFI_DEVICE_PATH_PROTOCOL
*) Vend
;
1618 Converts a text device path node to MAC device path structure.
1620 @param TextDeviceNode The input Text device path node.
1622 @return A pointer to the newly-created MAC device path structure.
1625 EFI_DEVICE_PATH_PROTOCOL
*
1626 DevPathFromTextMAC (
1627 IN CHAR16
*TextDeviceNode
1633 MAC_ADDR_DEVICE_PATH
*MACDevPath
;
1635 AddressStr
= GetNextParamStr (&TextDeviceNode
);
1636 IfTypeStr
= GetNextParamStr (&TextDeviceNode
);
1637 MACDevPath
= (MAC_ADDR_DEVICE_PATH
*) CreateDeviceNode (
1638 MESSAGING_DEVICE_PATH
,
1640 sizeof (MAC_ADDR_DEVICE_PATH
)
1643 MACDevPath
->IfType
= (UINT8
) Strtoi (IfTypeStr
);
1645 Length
= sizeof (EFI_MAC_ADDRESS
);
1646 StrToBuf (&MACDevPath
->MacAddress
.Addr
[0], Length
, AddressStr
);
1648 return (EFI_DEVICE_PATH_PROTOCOL
*) MACDevPath
;
1652 Converts a text device path node to IPV4 device path structure.
1654 @param TextDeviceNode The input Text device path node.
1656 @return A pointer to the newly-created IPV4 device path structure.
1659 EFI_DEVICE_PATH_PROTOCOL
*
1660 DevPathFromTextIPv4 (
1661 IN CHAR16
*TextDeviceNode
1664 CHAR16
*RemoteIPStr
;
1665 CHAR16
*ProtocolStr
;
1668 IPv4_DEVICE_PATH
*IPv4
;
1670 RemoteIPStr
= GetNextParamStr (&TextDeviceNode
);
1671 ProtocolStr
= GetNextParamStr (&TextDeviceNode
);
1672 TypeStr
= GetNextParamStr (&TextDeviceNode
);
1673 LocalIPStr
= GetNextParamStr (&TextDeviceNode
);
1674 IPv4
= (IPv4_DEVICE_PATH
*) CreateDeviceNode (
1675 MESSAGING_DEVICE_PATH
,
1677 sizeof (IPv4_DEVICE_PATH
)
1680 StrToIPv4Addr (&RemoteIPStr
, &IPv4
->RemoteIpAddress
);
1681 IPv4
->Protocol
= (UINT16
) ((StrCmp (ProtocolStr
, L
"UDP") == 0) ? 0 : 1);
1682 if (StrCmp (TypeStr
, L
"Static") == 0) {
1683 IPv4
->StaticIpAddress
= TRUE
;
1685 IPv4
->StaticIpAddress
= FALSE
;
1688 StrToIPv4Addr (&LocalIPStr
, &IPv4
->LocalIpAddress
);
1690 IPv4
->LocalPort
= 0;
1691 IPv4
->RemotePort
= 0;
1693 return (EFI_DEVICE_PATH_PROTOCOL
*) IPv4
;
1697 Converts a text device path node to IPV6 device path structure.
1699 @param TextDeviceNode The input Text device path node.
1701 @return A pointer to the newly-created IPV6 device path structure.
1704 EFI_DEVICE_PATH_PROTOCOL
*
1705 DevPathFromTextIPv6 (
1706 IN CHAR16
*TextDeviceNode
1709 CHAR16
*RemoteIPStr
;
1710 CHAR16
*ProtocolStr
;
1713 IPv6_DEVICE_PATH
*IPv6
;
1715 RemoteIPStr
= GetNextParamStr (&TextDeviceNode
);
1716 ProtocolStr
= GetNextParamStr (&TextDeviceNode
);
1717 TypeStr
= GetNextParamStr (&TextDeviceNode
);
1718 LocalIPStr
= GetNextParamStr (&TextDeviceNode
);
1719 IPv6
= (IPv6_DEVICE_PATH
*) CreateDeviceNode (
1720 MESSAGING_DEVICE_PATH
,
1722 sizeof (IPv6_DEVICE_PATH
)
1725 StrToIPv6Addr (&RemoteIPStr
, &IPv6
->RemoteIpAddress
);
1726 IPv6
->Protocol
= (UINT16
) ((StrCmp (ProtocolStr
, L
"UDP") == 0) ? 0 : 1);
1727 if (StrCmp (TypeStr
, L
"Static") == 0) {
1728 IPv6
->StaticIpAddress
= TRUE
;
1730 IPv6
->StaticIpAddress
= FALSE
;
1733 StrToIPv6Addr (&LocalIPStr
, &IPv6
->LocalIpAddress
);
1735 IPv6
->LocalPort
= 0;
1736 IPv6
->RemotePort
= 0;
1738 return (EFI_DEVICE_PATH_PROTOCOL
*) IPv6
;
1742 Converts a text device path node to UART device path structure.
1744 @param TextDeviceNode The input Text device path node.
1746 @return A pointer to the newly-created UART device path structure.
1749 EFI_DEVICE_PATH_PROTOCOL
*
1750 DevPathFromTextUart (
1751 IN CHAR16
*TextDeviceNode
1755 CHAR16
*DataBitsStr
;
1757 CHAR16
*StopBitsStr
;
1758 UART_DEVICE_PATH
*Uart
;
1760 BaudStr
= GetNextParamStr (&TextDeviceNode
);
1761 DataBitsStr
= GetNextParamStr (&TextDeviceNode
);
1762 ParityStr
= GetNextParamStr (&TextDeviceNode
);
1763 StopBitsStr
= GetNextParamStr (&TextDeviceNode
);
1764 Uart
= (UART_DEVICE_PATH
*) CreateDeviceNode (
1765 MESSAGING_DEVICE_PATH
,
1767 sizeof (UART_DEVICE_PATH
)
1770 Uart
->BaudRate
= (StrCmp (BaudStr
, L
"DEFAULT") == 0) ? 115200 : Dtoi (BaudStr
);
1771 Uart
->DataBits
= (UINT8
) ((StrCmp (DataBitsStr
, L
"DEFAULT") == 0) ? 8 : Dtoi (DataBitsStr
));
1772 switch (*ParityStr
) {
1797 Uart
->Parity
= 0xff;
1800 if (StrCmp (StopBitsStr
, L
"D") == 0) {
1801 Uart
->StopBits
= (UINT8
) 0;
1802 } else if (StrCmp (StopBitsStr
, L
"1") == 0) {
1803 Uart
->StopBits
= (UINT8
) 1;
1804 } else if (StrCmp (StopBitsStr
, L
"1.5") == 0) {
1805 Uart
->StopBits
= (UINT8
) 2;
1806 } else if (StrCmp (StopBitsStr
, L
"2") == 0) {
1807 Uart
->StopBits
= (UINT8
) 3;
1809 Uart
->StopBits
= 0xff;
1812 return (EFI_DEVICE_PATH_PROTOCOL
*) Uart
;
1816 Converts a text device path node to USB class device path structure.
1818 @param TextDeviceNode The input Text device path node.
1819 @param UsbClassText A pointer to USB_CLASS_TEXT structure to be integrated to USB Class Text.
1821 @return A pointer to the newly-created USB class device path structure.
1824 EFI_DEVICE_PATH_PROTOCOL
*
1825 ConvertFromTextUsbClass (
1826 IN CHAR16
*TextDeviceNode
,
1827 IN USB_CLASS_TEXT
*UsbClassText
1833 CHAR16
*SubClassStr
;
1834 CHAR16
*ProtocolStr
;
1835 USB_CLASS_DEVICE_PATH
*UsbClass
;
1837 UsbClass
= (USB_CLASS_DEVICE_PATH
*) CreateDeviceNode (
1838 MESSAGING_DEVICE_PATH
,
1840 sizeof (USB_CLASS_DEVICE_PATH
)
1843 VIDStr
= GetNextParamStr (&TextDeviceNode
);
1844 PIDStr
= GetNextParamStr (&TextDeviceNode
);
1845 if (UsbClassText
->ClassExist
) {
1846 ClassStr
= GetNextParamStr (&TextDeviceNode
);
1847 UsbClass
->DeviceClass
= (UINT8
) Strtoi (ClassStr
);
1849 UsbClass
->DeviceClass
= UsbClassText
->Class
;
1851 if (UsbClassText
->SubClassExist
) {
1852 SubClassStr
= GetNextParamStr (&TextDeviceNode
);
1853 UsbClass
->DeviceSubClass
= (UINT8
) Strtoi (SubClassStr
);
1855 UsbClass
->DeviceSubClass
= UsbClassText
->SubClass
;
1858 ProtocolStr
= GetNextParamStr (&TextDeviceNode
);
1860 UsbClass
->VendorId
= (UINT16
) Strtoi (VIDStr
);
1861 UsbClass
->ProductId
= (UINT16
) Strtoi (PIDStr
);
1862 UsbClass
->DeviceProtocol
= (UINT8
) Strtoi (ProtocolStr
);
1864 return (EFI_DEVICE_PATH_PROTOCOL
*) UsbClass
;
1869 Converts a text device path node to USB class device path structure.
1871 @param TextDeviceNode The input Text device path node.
1873 @return A pointer to the newly-created USB class device path structure.
1876 EFI_DEVICE_PATH_PROTOCOL
*
1877 DevPathFromTextUsbClass (
1878 IN CHAR16
*TextDeviceNode
1881 USB_CLASS_TEXT UsbClassText
;
1883 UsbClassText
.ClassExist
= TRUE
;
1884 UsbClassText
.SubClassExist
= TRUE
;
1886 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
1890 Converts a text device path node to USB audio device path structure.
1892 @param TextDeviceNode The input Text device path node.
1894 @return A pointer to the newly-created USB audio device path structure.
1897 EFI_DEVICE_PATH_PROTOCOL
*
1898 DevPathFromTextUsbAudio (
1899 IN CHAR16
*TextDeviceNode
1902 USB_CLASS_TEXT UsbClassText
;
1904 UsbClassText
.ClassExist
= FALSE
;
1905 UsbClassText
.Class
= USB_CLASS_AUDIO
;
1906 UsbClassText
.SubClassExist
= TRUE
;
1908 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
1912 Converts a text device path node to USB CDC Control device path structure.
1914 @param TextDeviceNode The input Text device path node.
1916 @return A pointer to the newly-created USB CDC Control device path structure.
1919 EFI_DEVICE_PATH_PROTOCOL
*
1920 DevPathFromTextUsbCDCControl (
1921 IN CHAR16
*TextDeviceNode
1924 USB_CLASS_TEXT UsbClassText
;
1926 UsbClassText
.ClassExist
= FALSE
;
1927 UsbClassText
.Class
= USB_CLASS_CDCCONTROL
;
1928 UsbClassText
.SubClassExist
= TRUE
;
1930 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
1934 Converts a text device path node to USB HID device path structure.
1936 @param TextDeviceNode The input Text device path node.
1938 @return A pointer to the newly-created USB HID device path structure.
1941 EFI_DEVICE_PATH_PROTOCOL
*
1942 DevPathFromTextUsbHID (
1943 IN CHAR16
*TextDeviceNode
1946 USB_CLASS_TEXT UsbClassText
;
1948 UsbClassText
.ClassExist
= FALSE
;
1949 UsbClassText
.Class
= USB_CLASS_HID
;
1950 UsbClassText
.SubClassExist
= TRUE
;
1952 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
1956 Converts a text device path node to USB Image device path structure.
1958 @param TextDeviceNode The input Text device path node.
1960 @return A pointer to the newly-created USB Image device path structure.
1963 EFI_DEVICE_PATH_PROTOCOL
*
1964 DevPathFromTextUsbImage (
1965 IN CHAR16
*TextDeviceNode
1968 USB_CLASS_TEXT UsbClassText
;
1970 UsbClassText
.ClassExist
= FALSE
;
1971 UsbClassText
.Class
= USB_CLASS_IMAGE
;
1972 UsbClassText
.SubClassExist
= TRUE
;
1974 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
1978 Converts a text device path node to USB Print device path structure.
1980 @param TextDeviceNode The input Text device path node.
1982 @return A pointer to the newly-created USB Print device path structure.
1985 EFI_DEVICE_PATH_PROTOCOL
*
1986 DevPathFromTextUsbPrinter (
1987 IN CHAR16
*TextDeviceNode
1990 USB_CLASS_TEXT UsbClassText
;
1992 UsbClassText
.ClassExist
= FALSE
;
1993 UsbClassText
.Class
= USB_CLASS_PRINTER
;
1994 UsbClassText
.SubClassExist
= TRUE
;
1996 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2000 Converts a text device path node to USB mass storage device path structure.
2002 @param TextDeviceNode The input Text device path node.
2004 @return A pointer to the newly-created USB mass storage device path structure.
2007 EFI_DEVICE_PATH_PROTOCOL
*
2008 DevPathFromTextUsbMassStorage (
2009 IN CHAR16
*TextDeviceNode
2012 USB_CLASS_TEXT UsbClassText
;
2014 UsbClassText
.ClassExist
= FALSE
;
2015 UsbClassText
.Class
= USB_CLASS_MASS_STORAGE
;
2016 UsbClassText
.SubClassExist
= TRUE
;
2018 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2022 Converts a text device path node to USB HUB device path structure.
2024 @param TextDeviceNode The input Text device path node.
2026 @return A pointer to the newly-created USB HUB device path structure.
2029 EFI_DEVICE_PATH_PROTOCOL
*
2030 DevPathFromTextUsbHub (
2031 IN CHAR16
*TextDeviceNode
2034 USB_CLASS_TEXT UsbClassText
;
2036 UsbClassText
.ClassExist
= FALSE
;
2037 UsbClassText
.Class
= USB_CLASS_HUB
;
2038 UsbClassText
.SubClassExist
= TRUE
;
2040 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2044 Converts a text device path node to USB CDC data device path structure.
2046 @param TextDeviceNode The input Text device path node.
2048 @return A pointer to the newly-created USB CDC data device path structure.
2051 EFI_DEVICE_PATH_PROTOCOL
*
2052 DevPathFromTextUsbCDCData (
2053 IN CHAR16
*TextDeviceNode
2056 USB_CLASS_TEXT UsbClassText
;
2058 UsbClassText
.ClassExist
= FALSE
;
2059 UsbClassText
.Class
= USB_CLASS_CDCDATA
;
2060 UsbClassText
.SubClassExist
= TRUE
;
2062 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2066 Converts a text device path node to USB smart card device path structure.
2068 @param TextDeviceNode The input Text device path node.
2070 @return A pointer to the newly-created USB smart card device path structure.
2073 EFI_DEVICE_PATH_PROTOCOL
*
2074 DevPathFromTextUsbSmartCard (
2075 IN CHAR16
*TextDeviceNode
2078 USB_CLASS_TEXT UsbClassText
;
2080 UsbClassText
.ClassExist
= FALSE
;
2081 UsbClassText
.Class
= USB_CLASS_SMART_CARD
;
2082 UsbClassText
.SubClassExist
= TRUE
;
2084 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2088 Converts a text device path node to USB video device path structure.
2090 @param TextDeviceNode The input Text device path node.
2092 @return A pointer to the newly-created USB video device path structure.
2095 EFI_DEVICE_PATH_PROTOCOL
*
2096 DevPathFromTextUsbVideo (
2097 IN CHAR16
*TextDeviceNode
2100 USB_CLASS_TEXT UsbClassText
;
2102 UsbClassText
.ClassExist
= FALSE
;
2103 UsbClassText
.Class
= USB_CLASS_VIDEO
;
2104 UsbClassText
.SubClassExist
= TRUE
;
2106 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2110 Converts a text device path node to USB diagnostic device path structure.
2112 @param TextDeviceNode The input Text device path node.
2114 @return A pointer to the newly-created USB diagnostic device path structure.
2117 EFI_DEVICE_PATH_PROTOCOL
*
2118 DevPathFromTextUsbDiagnostic (
2119 IN CHAR16
*TextDeviceNode
2122 USB_CLASS_TEXT UsbClassText
;
2124 UsbClassText
.ClassExist
= FALSE
;
2125 UsbClassText
.Class
= USB_CLASS_DIAGNOSTIC
;
2126 UsbClassText
.SubClassExist
= TRUE
;
2128 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2132 Converts a text device path node to USB wireless device path structure.
2134 @param TextDeviceNode The input Text device path node.
2136 @return A pointer to the newly-created USB wireless device path structure.
2139 EFI_DEVICE_PATH_PROTOCOL
*
2140 DevPathFromTextUsbWireless (
2141 IN CHAR16
*TextDeviceNode
2144 USB_CLASS_TEXT UsbClassText
;
2146 UsbClassText
.ClassExist
= FALSE
;
2147 UsbClassText
.Class
= USB_CLASS_WIRELESS
;
2148 UsbClassText
.SubClassExist
= TRUE
;
2150 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2154 Converts a text device path node to USB device firmware update device path structure.
2156 @param TextDeviceNode The input Text device path node.
2158 @return A pointer to the newly-created USB device firmware update device path structure.
2161 EFI_DEVICE_PATH_PROTOCOL
*
2162 DevPathFromTextUsbDeviceFirmwareUpdate (
2163 IN CHAR16
*TextDeviceNode
2166 USB_CLASS_TEXT UsbClassText
;
2168 UsbClassText
.ClassExist
= FALSE
;
2169 UsbClassText
.Class
= USB_CLASS_RESERVE
;
2170 UsbClassText
.SubClassExist
= FALSE
;
2171 UsbClassText
.SubClass
= USB_SUBCLASS_FW_UPDATE
;
2173 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2177 Converts a text device path node to USB IRDA bridge device path structure.
2179 @param TextDeviceNode The input Text device path node.
2181 @return A pointer to the newly-created USB IRDA bridge device path structure.
2184 EFI_DEVICE_PATH_PROTOCOL
*
2185 DevPathFromTextUsbIrdaBridge (
2186 IN CHAR16
*TextDeviceNode
2189 USB_CLASS_TEXT UsbClassText
;
2191 UsbClassText
.ClassExist
= FALSE
;
2192 UsbClassText
.Class
= USB_CLASS_RESERVE
;
2193 UsbClassText
.SubClassExist
= FALSE
;
2194 UsbClassText
.SubClass
= USB_SUBCLASS_IRDA_BRIDGE
;
2196 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2200 Converts a text device path node to USB text and measurement device path structure.
2202 @param TextDeviceNode The input Text device path node.
2204 @return A pointer to the newly-created USB text and measurement device path structure.
2207 EFI_DEVICE_PATH_PROTOCOL
*
2208 DevPathFromTextUsbTestAndMeasurement (
2209 IN CHAR16
*TextDeviceNode
2212 USB_CLASS_TEXT UsbClassText
;
2214 UsbClassText
.ClassExist
= FALSE
;
2215 UsbClassText
.Class
= USB_CLASS_RESERVE
;
2216 UsbClassText
.SubClassExist
= FALSE
;
2217 UsbClassText
.SubClass
= USB_SUBCLASS_TEST
;
2219 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2223 Converts a text device path node to USB WWID device path structure.
2225 @param TextDeviceNode The input Text device path node.
2227 @return A pointer to the newly-created USB WWID device path structure.
2230 EFI_DEVICE_PATH_PROTOCOL
*
2231 DevPathFromTextUsbWwid (
2232 IN CHAR16
*TextDeviceNode
2237 CHAR16
*InterfaceNumStr
;
2238 CHAR16
*SerialNumberStr
;
2239 USB_WWID_DEVICE_PATH
*UsbWwid
;
2241 VIDStr
= GetNextParamStr (&TextDeviceNode
);
2242 PIDStr
= GetNextParamStr (&TextDeviceNode
);
2243 InterfaceNumStr
= GetNextParamStr (&TextDeviceNode
);
2244 SerialNumberStr
= GetNextParamStr (&TextDeviceNode
);
2245 UsbWwid
= (USB_WWID_DEVICE_PATH
*) CreateDeviceNode (
2246 MESSAGING_DEVICE_PATH
,
2248 (UINT16
) (sizeof (USB_WWID_DEVICE_PATH
) + StrSize (SerialNumberStr
))
2251 UsbWwid
->VendorId
= (UINT16
) Strtoi (VIDStr
);
2252 UsbWwid
->ProductId
= (UINT16
) Strtoi (PIDStr
);
2253 UsbWwid
->InterfaceNumber
= (UINT16
) Strtoi (InterfaceNumStr
);
2254 StrCpy ((CHAR16
*) ((UINT8
*) UsbWwid
+ sizeof (USB_WWID_DEVICE_PATH
)), SerialNumberStr
);
2256 return (EFI_DEVICE_PATH_PROTOCOL
*) UsbWwid
;
2260 Converts a text device path node to Logic Unit device path structure.
2262 @param TextDeviceNode The input Text device path node.
2264 @return A pointer to the newly-created Logic Unit device path structure.
2267 EFI_DEVICE_PATH_PROTOCOL
*
2268 DevPathFromTextUnit (
2269 IN CHAR16
*TextDeviceNode
2273 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
2275 LunStr
= GetNextParamStr (&TextDeviceNode
);
2276 LogicalUnit
= (DEVICE_LOGICAL_UNIT_DEVICE_PATH
*) CreateDeviceNode (
2277 MESSAGING_DEVICE_PATH
,
2278 MSG_DEVICE_LOGICAL_UNIT_DP
,
2279 (UINT16
) sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH
)
2282 LogicalUnit
->Lun
= (UINT8
) Strtoi (LunStr
);
2284 return (EFI_DEVICE_PATH_PROTOCOL
*) LogicalUnit
;
2288 Converts a text device path node to iSCSI device path structure.
2290 @param TextDeviceNode The input Text device path node.
2292 @return A pointer to the newly-created iSCSI device path structure.
2295 EFI_DEVICE_PATH_PROTOCOL
*
2296 DevPathFromTextiSCSI (
2297 IN CHAR16
*TextDeviceNode
2302 CHAR16
*PortalGroupStr
;
2304 CHAR16
*HeaderDigestStr
;
2305 CHAR16
*DataDigestStr
;
2306 CHAR16
*AuthenticationStr
;
2307 CHAR16
*ProtocolStr
;
2309 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
2311 NameStr
= GetNextParamStr (&TextDeviceNode
);
2312 PortalGroupStr
= GetNextParamStr (&TextDeviceNode
);
2313 LunStr
= GetNextParamStr (&TextDeviceNode
);
2314 HeaderDigestStr
= GetNextParamStr (&TextDeviceNode
);
2315 DataDigestStr
= GetNextParamStr (&TextDeviceNode
);
2316 AuthenticationStr
= GetNextParamStr (&TextDeviceNode
);
2317 ProtocolStr
= GetNextParamStr (&TextDeviceNode
);
2318 ISCSIDevPath
= (ISCSI_DEVICE_PATH_WITH_NAME
*) CreateDeviceNode (
2319 MESSAGING_DEVICE_PATH
,
2321 (UINT16
) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME
) + StrLen (NameStr
))
2324 AsciiStr
= ISCSIDevPath
->iSCSITargetName
;
2325 StrToAscii (NameStr
, &AsciiStr
);
2327 ISCSIDevPath
->TargetPortalGroupTag
= (UINT16
) Strtoi (PortalGroupStr
);
2328 Strtoi64 (LunStr
, &ISCSIDevPath
->Lun
);
2331 if (StrCmp (HeaderDigestStr
, L
"CRC32C") == 0) {
2335 if (StrCmp (DataDigestStr
, L
"CRC32C") == 0) {
2339 if (StrCmp (AuthenticationStr
, L
"None") == 0) {
2343 if (StrCmp (AuthenticationStr
, L
"CHAP_UNI") == 0) {
2347 ISCSIDevPath
->LoginOption
= (UINT16
) Options
;
2349 ISCSIDevPath
->NetworkProtocol
= (UINT16
) StrCmp (ProtocolStr
, L
"TCP");
2351 return (EFI_DEVICE_PATH_PROTOCOL
*) ISCSIDevPath
;
2355 Converts a text device path node to HD device path structure.
2357 @param TextDeviceNode The input Text device path node.
2359 @return A pointer to the newly-created HD device path structure.
2362 EFI_DEVICE_PATH_PROTOCOL
*
2364 IN CHAR16
*TextDeviceNode
2367 CHAR16
*PartitionStr
;
2369 CHAR16
*SignatureStr
;
2373 EFI_GUID SignatureGuid
;
2374 HARDDRIVE_DEVICE_PATH
*Hd
;
2376 PartitionStr
= GetNextParamStr (&TextDeviceNode
);
2377 TypeStr
= GetNextParamStr (&TextDeviceNode
);
2378 SignatureStr
= GetNextParamStr (&TextDeviceNode
);
2379 StartStr
= GetNextParamStr (&TextDeviceNode
);
2380 SizeStr
= GetNextParamStr (&TextDeviceNode
);
2381 Hd
= (HARDDRIVE_DEVICE_PATH
*) CreateDeviceNode (
2384 sizeof (HARDDRIVE_DEVICE_PATH
)
2387 Hd
->PartitionNumber
= (UINT32
) Dtoi (PartitionStr
);
2389 ZeroMem (Hd
->Signature
, 16);
2390 Hd
->MBRType
= (UINT8
) 0;
2392 if (StrCmp (TypeStr
, L
"MBR") == 0) {
2393 Hd
->SignatureType
= SIGNATURE_TYPE_MBR
;
2396 Signature32
= (UINT32
) Strtoi (SignatureStr
);
2397 CopyMem (Hd
->Signature
, &Signature32
, sizeof (UINT32
));
2398 } else if (StrCmp (TypeStr
, L
"GPT") == 0) {
2399 Hd
->SignatureType
= SIGNATURE_TYPE_GUID
;
2402 StrToGuid (SignatureStr
, &SignatureGuid
);
2403 CopyMem (Hd
->Signature
, &SignatureGuid
, sizeof (EFI_GUID
));
2405 Hd
->SignatureType
= (UINT8
) Strtoi (TypeStr
);
2408 Strtoi64 (StartStr
, &Hd
->PartitionStart
);
2409 Strtoi64 (SizeStr
, &Hd
->PartitionSize
);
2411 return (EFI_DEVICE_PATH_PROTOCOL
*) Hd
;
2415 Converts a text device path node to CDROM device path structure.
2417 @param TextDeviceNode The input Text device path node.
2419 @return A pointer to the newly-created CDROM device path structure.
2422 EFI_DEVICE_PATH_PROTOCOL
*
2423 DevPathFromTextCDROM (
2424 IN CHAR16
*TextDeviceNode
2430 CDROM_DEVICE_PATH
*CDROMDevPath
;
2432 EntryStr
= GetNextParamStr (&TextDeviceNode
);
2433 StartStr
= GetNextParamStr (&TextDeviceNode
);
2434 SizeStr
= GetNextParamStr (&TextDeviceNode
);
2435 CDROMDevPath
= (CDROM_DEVICE_PATH
*) CreateDeviceNode (
2438 sizeof (CDROM_DEVICE_PATH
)
2441 CDROMDevPath
->BootEntry
= (UINT32
) Strtoi (EntryStr
);
2442 Strtoi64 (StartStr
, &CDROMDevPath
->PartitionStart
);
2443 Strtoi64 (SizeStr
, &CDROMDevPath
->PartitionSize
);
2445 return (EFI_DEVICE_PATH_PROTOCOL
*) CDROMDevPath
;
2449 Converts a text device path node to Vendor-defined media device path structure.
2451 @param TextDeviceNode The input Text device path node.
2453 @return A pointer to the newly-created Vendor-defined media device path structure.
2456 EFI_DEVICE_PATH_PROTOCOL
*
2457 DevPathFromTextVenMEDIA (
2458 IN CHAR16
*TextDeviceNode
2461 return ConvertFromTextVendor (
2469 Converts a text device path node to File device path structure.
2471 @param TextDeviceNode The input Text device path node.
2473 @return A pointer to the newly-created File device path structure.
2476 EFI_DEVICE_PATH_PROTOCOL
*
2477 DevPathFromTextFilePath (
2478 IN CHAR16
*TextDeviceNode
2481 FILEPATH_DEVICE_PATH
*File
;
2483 File
= (FILEPATH_DEVICE_PATH
*) CreateDeviceNode (
2486 (UINT16
) (sizeof (FILEPATH_DEVICE_PATH
) + StrLen (TextDeviceNode
) * 2)
2489 StrCpy (File
->PathName
, TextDeviceNode
);
2491 return (EFI_DEVICE_PATH_PROTOCOL
*) File
;
2495 Converts a text device path node to Media protocol device path structure.
2497 @param TextDeviceNode The input Text device path node.
2499 @return A pointer to the newly-created Media protocol device path structure.
2502 EFI_DEVICE_PATH_PROTOCOL
*
2503 DevPathFromTextMedia (
2504 IN CHAR16
*TextDeviceNode
2508 MEDIA_PROTOCOL_DEVICE_PATH
*Media
;
2510 GuidStr
= GetNextParamStr (&TextDeviceNode
);
2511 Media
= (MEDIA_PROTOCOL_DEVICE_PATH
*) CreateDeviceNode (
2514 sizeof (MEDIA_PROTOCOL_DEVICE_PATH
)
2517 StrToGuid (GuidStr
, &Media
->Protocol
);
2519 return (EFI_DEVICE_PATH_PROTOCOL
*) Media
;
2523 Converts a text device path node to firmware volume device path structure.
2525 @param TextDeviceNode The input Text device path node.
2527 @return A pointer to the newly-created firmware volume device path structure.
2530 EFI_DEVICE_PATH_PROTOCOL
*
2532 IN CHAR16
*TextDeviceNode
2536 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
2538 GuidStr
= GetNextParamStr (&TextDeviceNode
);
2539 Fv
= (MEDIA_FW_VOL_DEVICE_PATH
*) CreateDeviceNode (
2541 MEDIA_PIWG_FW_VOL_DP
,
2542 sizeof (MEDIA_FW_VOL_DEVICE_PATH
)
2545 StrToGuid (GuidStr
, &Fv
->FvName
);
2547 return (EFI_DEVICE_PATH_PROTOCOL
*) Fv
;
2551 Converts a text device path node to firmware file device path structure.
2553 @param TextDeviceNode The input Text device path node.
2555 @return A pointer to the newly-created firmware file device path structure.
2558 EFI_DEVICE_PATH_PROTOCOL
*
2559 DevPathFromTextFvFile (
2560 IN CHAR16
*TextDeviceNode
2564 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
2566 GuidStr
= GetNextParamStr (&TextDeviceNode
);
2567 FvFile
= (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*) CreateDeviceNode (
2569 MEDIA_PIWG_FW_FILE_DP
,
2570 sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
)
2573 StrToGuid (GuidStr
, &FvFile
->FvFileName
);
2575 return (EFI_DEVICE_PATH_PROTOCOL
*) FvFile
;
2579 Converts a text device path node to BIOS Boot Specification device path structure.
2581 @param TextDeviceNode The input Text device path node.
2583 @return A pointer to the newly-created BIOS Boot Specificationa device path structure.
2586 EFI_DEVICE_PATH_PROTOCOL
*
2587 DevPathFromTextBBS (
2588 IN CHAR16
*TextDeviceNode
2595 BBS_BBS_DEVICE_PATH
*Bbs
;
2597 TypeStr
= GetNextParamStr (&TextDeviceNode
);
2598 IdStr
= GetNextParamStr (&TextDeviceNode
);
2599 FlagsStr
= GetNextParamStr (&TextDeviceNode
);
2600 Bbs
= (BBS_BBS_DEVICE_PATH
*) CreateDeviceNode (
2603 (UINT16
) (sizeof (BBS_BBS_DEVICE_PATH
) + StrLen (IdStr
))
2606 if (StrCmp (TypeStr
, L
"Floppy") == 0) {
2607 Bbs
->DeviceType
= BBS_TYPE_FLOPPY
;
2608 } else if (StrCmp (TypeStr
, L
"HD") == 0) {
2609 Bbs
->DeviceType
= BBS_TYPE_HARDDRIVE
;
2610 } else if (StrCmp (TypeStr
, L
"CDROM") == 0) {
2611 Bbs
->DeviceType
= BBS_TYPE_CDROM
;
2612 } else if (StrCmp (TypeStr
, L
"PCMCIA") == 0) {
2613 Bbs
->DeviceType
= BBS_TYPE_PCMCIA
;
2614 } else if (StrCmp (TypeStr
, L
"USB") == 0) {
2615 Bbs
->DeviceType
= BBS_TYPE_USB
;
2616 } else if (StrCmp (TypeStr
, L
"Network") == 0) {
2617 Bbs
->DeviceType
= BBS_TYPE_EMBEDDED_NETWORK
;
2619 Bbs
->DeviceType
= (UINT16
) Strtoi (TypeStr
);
2622 AsciiStr
= Bbs
->String
;
2623 StrToAscii (IdStr
, &AsciiStr
);
2625 Bbs
->StatusFlag
= (UINT16
) Strtoi (FlagsStr
);
2627 return (EFI_DEVICE_PATH_PROTOCOL
*) Bbs
;
2631 Converts a text device path node to SATA device path structure.
2633 @param TextDeviceNode The input Text device path node.
2635 @return A pointer to the newly-created SATA device path structure.
2638 EFI_DEVICE_PATH_PROTOCOL
*
2639 DevPathFromTextSata (
2640 IN CHAR16
*TextDeviceNode
2643 SATA_DEVICE_PATH
*Sata
;
2649 // The PMPN is optional.
2651 Param1
= GetNextParamStr (&TextDeviceNode
);
2652 Param2
= GetNextParamStr (&TextDeviceNode
);
2654 if (!IS_NULL (TextDeviceNode
)) {
2655 Param3
= GetNextParamStr (&TextDeviceNode
);
2658 Sata
= (SATA_DEVICE_PATH
*) CreateDeviceNode (
2659 MESSAGING_DEVICE_PATH
,
2661 sizeof (SATA_DEVICE_PATH
)
2663 Sata
->HBAPortNumber
= (UINT16
) Xtoi (Param1
);
2664 if (Param3
!= NULL
) {
2665 Sata
->PortMultiplierPortNumber
= (UINT16
) Xtoi (Param2
);
2668 Sata
->PortMultiplierPortNumber
= 0;
2670 Sata
->Lun
= (UINT16
) Xtoi (Param2
);
2672 return (EFI_DEVICE_PATH_PROTOCOL
*) Sata
;
2675 GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable
[] = {
2676 {L
"Pci", DevPathFromTextPci
},
2677 {L
"PcCard", DevPathFromTextPcCard
},
2678 {L
"MemoryMapped", DevPathFromTextMemoryMapped
},
2679 {L
"VenHw", DevPathFromTextVenHw
},
2680 {L
"Ctrl", DevPathFromTextCtrl
},
2681 {L
"Acpi", DevPathFromTextAcpi
},
2682 {L
"PciRoot", DevPathFromTextPciRoot
},
2683 {L
"Floppy", DevPathFromTextFloppy
},
2684 {L
"Keyboard", DevPathFromTextKeyboard
},
2685 {L
"Serial", DevPathFromTextSerial
},
2686 {L
"ParallelPort", DevPathFromTextParallelPort
},
2687 {L
"AcpiEx", DevPathFromTextAcpiEx
},
2688 {L
"AcpiExp", DevPathFromTextAcpiExp
},
2689 {L
"Ata", DevPathFromTextAta
},
2690 {L
"Scsi", DevPathFromTextScsi
},
2691 {L
"Fibre", DevPathFromTextFibre
},
2692 {L
"I1394", DevPathFromText1394
},
2693 {L
"USB", DevPathFromTextUsb
},
2694 {L
"I2O", DevPathFromTextI2O
},
2695 {L
"Infiniband", DevPathFromTextInfiniband
},
2696 {L
"VenMsg", DevPathFromTextVenMsg
},
2697 {L
"VenPcAnsi", DevPathFromTextVenPcAnsi
},
2698 {L
"VenVt100", DevPathFromTextVenVt100
},
2699 {L
"VenVt100Plus", DevPathFromTextVenVt100Plus
},
2700 {L
"VenUtf8", DevPathFromTextVenUtf8
},
2701 {L
"UartFlowCtrl", DevPathFromTextUartFlowCtrl
},
2702 {L
"SAS", DevPathFromTextSAS
},
2703 {L
"DebugPort", DevPathFromTextDebugPort
},
2704 {L
"MAC", DevPathFromTextMAC
},
2705 {L
"IPv4", DevPathFromTextIPv4
},
2706 {L
"IPv6", DevPathFromTextIPv6
},
2707 {L
"Uart", DevPathFromTextUart
},
2708 {L
"UsbClass", DevPathFromTextUsbClass
},
2709 {L
"UsbAudio", DevPathFromTextUsbAudio
},
2710 {L
"UsbCDCControl", DevPathFromTextUsbCDCControl
},
2711 {L
"UsbHID", DevPathFromTextUsbHID
},
2712 {L
"UsbImage", DevPathFromTextUsbImage
},
2713 {L
"UsbPrinter", DevPathFromTextUsbPrinter
},
2714 {L
"UsbMassStorage", DevPathFromTextUsbMassStorage
},
2715 {L
"UsbHub", DevPathFromTextUsbHub
},
2716 {L
"UsbCDCData", DevPathFromTextUsbCDCData
},
2717 {L
"UsbSmartCard", DevPathFromTextUsbSmartCard
},
2718 {L
"UsbVideo", DevPathFromTextUsbVideo
},
2719 {L
"UsbDiagnostic", DevPathFromTextUsbDiagnostic
},
2720 {L
"UsbWireless", DevPathFromTextUsbWireless
},
2721 {L
"UsbDeviceFirmwareUpdate", DevPathFromTextUsbDeviceFirmwareUpdate
},
2722 {L
"UsbIrdaBridge", DevPathFromTextUsbIrdaBridge
},
2723 {L
"UsbTestAndMeasurement", DevPathFromTextUsbTestAndMeasurement
},
2724 {L
"UsbWwid", DevPathFromTextUsbWwid
},
2725 {L
"Unit", DevPathFromTextUnit
},
2726 {L
"iSCSI", DevPathFromTextiSCSI
},
2727 {L
"HD", DevPathFromTextHD
},
2728 {L
"CDROM", DevPathFromTextCDROM
},
2729 {L
"VenMEDIA", DevPathFromTextVenMEDIA
},
2730 {L
"Media", DevPathFromTextMedia
},
2731 {L
"Fv", DevPathFromTextFv
},
2732 {L
"FvFile", DevPathFromTextFvFile
},
2733 {L
"BBS", DevPathFromTextBBS
},
2734 {L
"Sata", DevPathFromTextSata
},
2739 Convert text to the binary representation of a device node.
2741 @param TextDeviceNode TextDeviceNode points to the text representation of a device
2742 node. Conversion starts with the first character and continues
2743 until the first non-device node character.
2745 @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
2746 insufficient memory or text unsupported.
2749 EFI_DEVICE_PATH_PROTOCOL
*
2751 ConvertTextToDeviceNode (
2752 IN CONST CHAR16
*TextDeviceNode
2757 EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
;
2758 CHAR16
*DeviceNodeStr
;
2761 if ((TextDeviceNode
== NULL
) || (IS_NULL (*TextDeviceNode
))) {
2767 DeviceNodeStr
= StrDuplicate (TextDeviceNode
);
2769 for (Index
= 0; DevPathFromTextTable
[Index
].Function
; Index
++) {
2770 ParamStr
= GetParamByNodeName (DeviceNodeStr
, DevPathFromTextTable
[Index
].DevicePathNodeText
);
2771 if (ParamStr
!= NULL
) {
2772 DumpNode
= DevPathFromTextTable
[Index
].Function
;
2777 if (DumpNode
== NULL
) {
2781 DumpNode
= DevPathFromTextFilePath
;
2782 DeviceNode
= DumpNode (DeviceNodeStr
);
2784 DeviceNode
= DumpNode (ParamStr
);
2785 FreePool (ParamStr
);
2788 FreePool (DeviceNodeStr
);
2794 Convert text to the binary representation of a device path.
2797 @param TextDevicePath TextDevicePath points to the text representation of a device
2798 path. Conversion starts with the first character and continues
2799 until the first non-device node character.
2801 @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
2802 there was insufficient memory.
2805 EFI_DEVICE_PATH_PROTOCOL
*
2807 ConvertTextToDevicePath (
2808 IN CONST CHAR16
*TextDevicePath
2813 EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
;
2815 EFI_DEVICE_PATH_PROTOCOL
*NewDevicePath
;
2816 CHAR16
*DevicePathStr
;
2818 CHAR16
*DeviceNodeStr
;
2819 UINT8 IsInstanceEnd
;
2820 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
2822 if ((TextDevicePath
== NULL
) || (IS_NULL (*TextDevicePath
))) {
2826 DevicePath
= (EFI_DEVICE_PATH_PROTOCOL
*) AllocatePool (END_DEVICE_PATH_LENGTH
);
2827 SetDevicePathEndNode (DevicePath
);
2830 DeviceNodeStr
= NULL
;
2831 DevicePathStr
= StrDuplicate (TextDevicePath
);
2833 Str
= DevicePathStr
;
2834 while ((DeviceNodeStr
= GetNextDeviceNodeStr (&Str
, &IsInstanceEnd
)) != NULL
) {
2836 for (Index
= 0; DevPathFromTextTable
[Index
].Function
; Index
++) {
2837 ParamStr
= GetParamByNodeName (DeviceNodeStr
, DevPathFromTextTable
[Index
].DevicePathNodeText
);
2838 if (ParamStr
!= NULL
) {
2839 DumpNode
= DevPathFromTextTable
[Index
].Function
;
2844 if (DumpNode
== NULL
) {
2848 DumpNode
= DevPathFromTextFilePath
;
2849 DeviceNode
= DumpNode (DeviceNodeStr
);
2851 DeviceNode
= DumpNode (ParamStr
);
2852 FreePool (ParamStr
);
2855 NewDevicePath
= AppendDeviceNodeProtocolInterface (DevicePath
, DeviceNode
);
2856 FreePool (DevicePath
);
2857 FreePool (DeviceNode
);
2858 DevicePath
= NewDevicePath
;
2860 if (IsInstanceEnd
!= 0) {
2861 DeviceNode
= (EFI_DEVICE_PATH_PROTOCOL
*) AllocatePool (END_DEVICE_PATH_LENGTH
);
2862 SET_DEVICE_PATH_INSTANCE_END_NODE (DeviceNode
);
2864 NewDevicePath
= AppendDeviceNodeProtocolInterface (DevicePath
, DeviceNode
);
2865 FreePool (DevicePath
);
2866 FreePool (DeviceNode
);
2867 DevicePath
= NewDevicePath
;
2871 FreePool (DevicePathStr
);