2 DevicePathFromText protocol as defined in the UEFI 2.0 specification.
4 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
5 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 "UefiDevicePathLib.h"
21 @param Src Source string.
23 @return The duplicated string.
27 UefiDevicePathLibStrDuplicate (
31 return AllocateCopyPool (StrSize (Src
), Src
);
36 Get parameter in a pair of parentheses follow the given node name.
37 For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1".
39 @param Str Device Path Text.
40 @param NodeName Name of the node.
42 @return Parameter text for the node.
54 UINTN ParameterLength
;
57 // Check whether the node name matchs
59 NodeNameLength
= StrLen (NodeName
);
60 if (StrnCmp (Str
, NodeName
, NodeNameLength
) != 0) {
64 ParamStr
= Str
+ NodeNameLength
;
65 if (!IS_LEFT_PARENTH (*ParamStr
)) {
70 // Skip the found '(' and find first occurrence of ')'
74 StrPointer
= ParamStr
;
75 while (!IS_NULL (*StrPointer
)) {
76 if (IS_RIGHT_PARENTH (*StrPointer
)) {
82 if (IS_NULL (*StrPointer
)) {
89 ParamStr
= AllocateCopyPool ((ParameterLength
+ 1) * sizeof (CHAR16
), ParamStr
);
90 if (ParamStr
== NULL
) {
94 // Terminate the parameter string
96 ParamStr
[ParameterLength
] = L
'\0';
102 Gets current sub-string from a string list, before return
103 the list header is moved to next sub-string. The sub-string is separated
104 by the specified character. For example, the separator is ',', the string
105 list is "2,0,3", it returns "2", the remain list move to "0,3"
107 @param List A string list separated by the specified separator
108 @param Separator The separator character
110 @return A pointer to the current sub-string
115 IN OUT CHAR16
**List
,
125 if (IS_NULL (*Str
)) {
130 // Find first occurrence of the separator
132 while (!IS_NULL (*Str
)) {
133 if (*Str
== Separator
) {
139 if (*Str
== Separator
) {
141 // Find a sub-string, terminate it
148 // Move to next sub-string
156 Gets the next parameter string from the list.
158 @param List A string list separated by the specified separator
160 @return A pointer to the current sub-string
169 // The separator is comma
171 return SplitStr (List
, L
',');
175 Get one device node from entire device path text.
177 @param DevicePath On input, the current Device Path node; on output, the next device path node
178 @param IsInstanceEnd This node is the end of a device path instance
180 @return A device node text or NULL if no more device node available
184 GetNextDeviceNodeStr (
185 IN OUT CHAR16
**DevicePath
,
186 OUT BOOLEAN
*IsInstanceEnd
191 UINTN ParenthesesStack
;
194 if (IS_NULL (*Str
)) {
199 // Skip the leading '/', '(', ')' and ','
201 while (!IS_NULL (*Str
)) {
202 if (!IS_SLASH (*Str
) &&
204 !IS_LEFT_PARENTH (*Str
) &&
205 !IS_RIGHT_PARENTH (*Str
)) {
214 // Scan for the separator of this device node, '/' or ','
216 ParenthesesStack
= 0;
217 while (!IS_NULL (*Str
)) {
218 if ((IS_COMMA (*Str
) || IS_SLASH (*Str
)) && (ParenthesesStack
== 0)) {
222 if (IS_LEFT_PARENTH (*Str
)) {
224 } else if (IS_RIGHT_PARENTH (*Str
)) {
231 if (ParenthesesStack
!= 0) {
233 // The '(' doesn't pair with ')', invalid device path text
238 if (IS_COMMA (*Str
)) {
239 *IsInstanceEnd
= TRUE
;
243 *IsInstanceEnd
= FALSE
;
244 if (!IS_NULL (*Str
)) {
257 Return whether the integer string is a hex string.
259 @param Str The integer string
261 @retval TRUE Hex string
262 @retval FALSE Decimal string
271 // skip preceeding white space
273 while ((*Str
!= 0) && *Str
== L
' ') {
277 // skip preceeding zeros
279 while ((*Str
!= 0) && *Str
== L
'0') {
283 return (BOOLEAN
) (*Str
== L
'x' || *Str
== L
'X');
288 Convert integer string to uint.
290 @param Str The integer string. If leading with "0x" or "0X", it's hexadecimal.
292 @return A UINTN value represented by Str
300 if (IsHexStr (Str
)) {
301 return StrHexToUintn (Str
);
303 return StrDecimalToUintn (Str
);
309 Convert integer string to 64 bit data.
311 @param Str The integer string. If leading with "0x" or "0X", it's hexadecimal.
312 @param Data A pointer to the UINT64 value represented by Str
321 if (IsHexStr (Str
)) {
322 *Data
= StrHexToUint64 (Str
);
324 *Data
= StrDecimalToUint64 (Str
);
329 Converts a list of string to a specified buffer.
331 @param Buf The output buffer that contains the string.
332 @param BufferLength The length of the buffer
333 @param Str The input string that contains the hex number
335 @retval EFI_SUCCESS The string was successfully converted to the buffer.
341 IN UINTN BufferLength
,
353 // Two hex char make up one byte
355 StrLength
= BufferLength
* sizeof (CHAR16
);
357 for(Index
= 0; Index
< StrLength
; Index
++, Str
++) {
359 if ((*Str
>= L
'a') && (*Str
<= L
'f')) {
360 Digit
= (UINT8
) (*Str
- L
'a' + 0x0A);
361 } else if ((*Str
>= L
'A') && (*Str
<= L
'F')) {
362 Digit
= (UINT8
) (*Str
- L
'A' + 0x0A);
363 } else if ((*Str
>= L
'0') && (*Str
<= L
'9')) {
364 Digit
= (UINT8
) (*Str
- L
'0');
366 return EFI_INVALID_PARAMETER
;
370 // For odd characters, write the upper nibble for each buffer byte,
371 // and for even characters, the lower nibble.
373 if ((Index
& 1) == 0) {
374 Byte
= (UINT8
) (Digit
<< 4);
376 Byte
= Buf
[Index
/ 2];
378 Byte
= (UINT8
) (Byte
| Digit
);
381 Buf
[Index
/ 2] = Byte
;
388 Converts a string to GUID value.
389 Guid Format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
391 @param Str The registry format GUID string that contains the GUID value.
392 @param Guid A pointer to the converted GUID value.
394 @retval EFI_SUCCESS The GUID string was successfully converted to the GUID value.
395 @retval EFI_UNSUPPORTED The input string is not in registry format.
396 @return others Some error occurred when converting part of GUID value.
406 // Get the first UINT32 data
408 Guid
->Data1
= (UINT32
) StrHexToUint64 (Str
);
409 while (!IS_HYPHEN (*Str
) && !IS_NULL (*Str
)) {
413 if (IS_HYPHEN (*Str
)) {
416 return EFI_UNSUPPORTED
;
420 // Get the second UINT16 data
422 Guid
->Data2
= (UINT16
) StrHexToUint64 (Str
);
423 while (!IS_HYPHEN (*Str
) && !IS_NULL (*Str
)) {
427 if (IS_HYPHEN (*Str
)) {
430 return EFI_UNSUPPORTED
;
434 // Get the third UINT16 data
436 Guid
->Data3
= (UINT16
) StrHexToUint64 (Str
);
437 while (!IS_HYPHEN (*Str
) && !IS_NULL (*Str
)) {
441 if (IS_HYPHEN (*Str
)) {
444 return EFI_UNSUPPORTED
;
448 // Get the following 8 bytes data
450 StrToBuf (&Guid
->Data4
[0], 2, Str
);
452 // Skip 2 byte hex chars
456 if (IS_HYPHEN (*Str
)) {
459 return EFI_UNSUPPORTED
;
461 StrToBuf (&Guid
->Data4
[2], 6, Str
);
467 Converts a string to IPv4 address
469 @param Str A string representation of IPv4 address.
470 @param IPv4Addr A pointer to the converted IPv4 address.
476 OUT EFI_IPv4_ADDRESS
*IPv4Addr
481 for (Index
= 0; Index
< 4; Index
++) {
482 IPv4Addr
->Addr
[Index
] = (UINT8
) Strtoi (SplitStr (Str
, L
'.'));
487 Converts a string to IPv4 address
489 @param Str A string representation of IPv6 address.
490 @param IPv6Addr A pointer to the converted IPv6 address.
496 OUT EFI_IPv6_ADDRESS
*IPv6Addr
502 for (Index
= 0; Index
< 8; Index
++) {
503 Data
= (UINT16
) StrHexToUintn (SplitStr (Str
, L
':'));
504 IPv6Addr
->Addr
[Index
* 2] = (UINT8
) (Data
>> 8);
505 IPv6Addr
->Addr
[Index
* 2 + 1] = (UINT8
) (Data
& 0xff);
510 Converts a Unicode string to ASCII string.
512 @param Str The equivalent Unicode string
513 @param AsciiStr On input, it points to destination ASCII string buffer; on output, it points
514 to the next ASCII string next to it
520 IN OUT CHAR8
**AsciiStr
526 while (!IS_NULL (*Str
)) {
527 *(Dest
++) = (CHAR8
) *(Str
++);
532 // Return the string next to it
534 *AsciiStr
= Dest
+ 1;
538 Converts a generic text device path node to device path structure.
540 @param Type The type of the device path node.
541 @param TextDeviceNode The input text device path node.
543 @return A pointer to device path structure.
545 EFI_DEVICE_PATH_PROTOCOL
*
546 DevPathFromTextGenericPath (
548 IN CHAR16
*TextDeviceNode
551 EFI_DEVICE_PATH_PROTOCOL
*Node
;
556 SubtypeStr
= GetNextParamStr (&TextDeviceNode
);
557 DataStr
= GetNextParamStr (&TextDeviceNode
);
559 if (DataStr
== NULL
) {
562 DataLength
= StrLen (DataStr
) / 2;
564 Node
= CreateDeviceNode (
566 (UINT8
) Strtoi (SubtypeStr
),
567 (UINT16
) (sizeof (EFI_DEVICE_PATH_PROTOCOL
) + DataLength
)
570 if (DataLength
!= 0) {
571 StrToBuf ((UINT8
*) (Node
+ 1), DataLength
, DataStr
);
577 Converts a generic text device path node to device path structure.
579 @param TextDeviceNode The input Text device path node.
581 @return A pointer to device path structure.
584 EFI_DEVICE_PATH_PROTOCOL
*
585 DevPathFromTextPath (
586 IN CHAR16
*TextDeviceNode
591 TypeStr
= GetNextParamStr (&TextDeviceNode
);
593 return DevPathFromTextGenericPath ((UINT8
) Strtoi (TypeStr
), TextDeviceNode
);
597 Converts a generic hardware text device path node to Hardware device path structure.
599 @param TextDeviceNode The input Text device path node.
601 @return A pointer to Hardware device path structure.
604 EFI_DEVICE_PATH_PROTOCOL
*
605 DevPathFromTextHardwarePath (
606 IN CHAR16
*TextDeviceNode
609 return DevPathFromTextGenericPath (HARDWARE_DEVICE_PATH
, TextDeviceNode
);
613 Converts a text device path node to Hardware PCI device path structure.
615 @param TextDeviceNode The input Text device path node.
617 @return A pointer to Hardware PCI device path structure.
620 EFI_DEVICE_PATH_PROTOCOL
*
622 IN CHAR16
*TextDeviceNode
627 PCI_DEVICE_PATH
*Pci
;
629 DeviceStr
= GetNextParamStr (&TextDeviceNode
);
630 FunctionStr
= GetNextParamStr (&TextDeviceNode
);
631 Pci
= (PCI_DEVICE_PATH
*) CreateDeviceNode (
632 HARDWARE_DEVICE_PATH
,
634 (UINT16
) sizeof (PCI_DEVICE_PATH
)
637 Pci
->Function
= (UINT8
) Strtoi (FunctionStr
);
638 Pci
->Device
= (UINT8
) Strtoi (DeviceStr
);
640 return (EFI_DEVICE_PATH_PROTOCOL
*) Pci
;
644 Converts a text device path node to Hardware PC card device path structure.
646 @param TextDeviceNode The input Text device path node.
648 @return A pointer to Hardware PC card device path structure.
651 EFI_DEVICE_PATH_PROTOCOL
*
652 DevPathFromTextPcCard (
653 IN CHAR16
*TextDeviceNode
656 CHAR16
*FunctionNumberStr
;
657 PCCARD_DEVICE_PATH
*Pccard
;
659 FunctionNumberStr
= GetNextParamStr (&TextDeviceNode
);
660 Pccard
= (PCCARD_DEVICE_PATH
*) CreateDeviceNode (
661 HARDWARE_DEVICE_PATH
,
663 (UINT16
) sizeof (PCCARD_DEVICE_PATH
)
666 Pccard
->FunctionNumber
= (UINT8
) Strtoi (FunctionNumberStr
);
668 return (EFI_DEVICE_PATH_PROTOCOL
*) Pccard
;
672 Converts a text device path node to Hardware memory map device path structure.
674 @param TextDeviceNode The input Text device path node.
676 @return A pointer to Hardware memory map device path structure.
679 EFI_DEVICE_PATH_PROTOCOL
*
680 DevPathFromTextMemoryMapped (
681 IN CHAR16
*TextDeviceNode
684 CHAR16
*MemoryTypeStr
;
685 CHAR16
*StartingAddressStr
;
686 CHAR16
*EndingAddressStr
;
687 MEMMAP_DEVICE_PATH
*MemMap
;
689 MemoryTypeStr
= GetNextParamStr (&TextDeviceNode
);
690 StartingAddressStr
= GetNextParamStr (&TextDeviceNode
);
691 EndingAddressStr
= GetNextParamStr (&TextDeviceNode
);
692 MemMap
= (MEMMAP_DEVICE_PATH
*) CreateDeviceNode (
693 HARDWARE_DEVICE_PATH
,
695 (UINT16
) sizeof (MEMMAP_DEVICE_PATH
)
698 MemMap
->MemoryType
= (UINT32
) Strtoi (MemoryTypeStr
);
699 Strtoi64 (StartingAddressStr
, &MemMap
->StartingAddress
);
700 Strtoi64 (EndingAddressStr
, &MemMap
->EndingAddress
);
702 return (EFI_DEVICE_PATH_PROTOCOL
*) MemMap
;
706 Converts a text device path node to Vendor device path structure based on the input Type
709 @param TextDeviceNode The input Text device path node.
710 @param Type The type of device path node.
711 @param SubType The subtype of device path node.
713 @return A pointer to the newly-created Vendor device path structure.
716 EFI_DEVICE_PATH_PROTOCOL
*
717 ConvertFromTextVendor (
718 IN CHAR16
*TextDeviceNode
,
726 VENDOR_DEVICE_PATH
*Vendor
;
728 GuidStr
= GetNextParamStr (&TextDeviceNode
);
730 DataStr
= GetNextParamStr (&TextDeviceNode
);
731 Length
= StrLen (DataStr
);
733 // Two hex characters make up 1 buffer byte
735 Length
= (Length
+ 1) / 2;
737 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
740 (UINT16
) (sizeof (VENDOR_DEVICE_PATH
) + Length
)
743 StrToGuid (GuidStr
, &Vendor
->Guid
);
744 StrToBuf (((UINT8
*) Vendor
) + sizeof (VENDOR_DEVICE_PATH
), Length
, DataStr
);
746 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
750 Converts a text device path node to Vendor Hardware device path structure.
752 @param TextDeviceNode The input Text device path node.
754 @return A pointer to the newly-created Vendor Hardware device path structure.
757 EFI_DEVICE_PATH_PROTOCOL
*
758 DevPathFromTextVenHw (
759 IN CHAR16
*TextDeviceNode
762 return ConvertFromTextVendor (
764 HARDWARE_DEVICE_PATH
,
770 Converts a text device path node to Hardware Controller device path structure.
772 @param TextDeviceNode The input Text device path node.
774 @return A pointer to the newly-created Hardware Controller device path structure.
777 EFI_DEVICE_PATH_PROTOCOL
*
778 DevPathFromTextCtrl (
779 IN CHAR16
*TextDeviceNode
782 CHAR16
*ControllerStr
;
783 CONTROLLER_DEVICE_PATH
*Controller
;
785 ControllerStr
= GetNextParamStr (&TextDeviceNode
);
786 Controller
= (CONTROLLER_DEVICE_PATH
*) CreateDeviceNode (
787 HARDWARE_DEVICE_PATH
,
789 (UINT16
) sizeof (CONTROLLER_DEVICE_PATH
)
791 Controller
->ControllerNumber
= (UINT32
) Strtoi (ControllerStr
);
793 return (EFI_DEVICE_PATH_PROTOCOL
*) Controller
;
797 Converts a generic ACPI text device path node to ACPI device path structure.
799 @param TextDeviceNode The input Text device path node.
801 @return A pointer to ACPI device path structure.
804 EFI_DEVICE_PATH_PROTOCOL
*
805 DevPathFromTextAcpiPath (
806 IN CHAR16
*TextDeviceNode
809 return DevPathFromTextGenericPath (ACPI_DEVICE_PATH
, TextDeviceNode
);
813 Converts a string to EisaId.
815 @param Text The input string.
817 @return UINT32 EISA ID.
824 return (((Text
[0] - 'A' + 1) & 0x1f) << 10)
825 + (((Text
[1] - 'A' + 1) & 0x1f) << 5)
826 + (((Text
[2] - 'A' + 1) & 0x1f) << 0)
827 + (UINT32
) (StrHexToUintn (&Text
[3]) << 16)
832 Converts a text device path node to ACPI HID device path structure.
834 @param TextDeviceNode The input Text device path node.
836 @return A pointer to the newly-created ACPI HID device path structure.
839 EFI_DEVICE_PATH_PROTOCOL
*
840 DevPathFromTextAcpi (
841 IN CHAR16
*TextDeviceNode
846 ACPI_HID_DEVICE_PATH
*Acpi
;
848 HIDStr
= GetNextParamStr (&TextDeviceNode
);
849 UIDStr
= GetNextParamStr (&TextDeviceNode
);
850 Acpi
= (ACPI_HID_DEVICE_PATH
*) CreateDeviceNode (
853 (UINT16
) sizeof (ACPI_HID_DEVICE_PATH
)
856 Acpi
->HID
= EisaIdFromText (HIDStr
);
857 Acpi
->UID
= (UINT32
) Strtoi (UIDStr
);
859 return (EFI_DEVICE_PATH_PROTOCOL
*) Acpi
;
863 Converts a text device path node to ACPI HID device path structure.
865 @param TextDeviceNode The input Text device path node.
866 @param PnPId The input plug and play identification.
868 @return A pointer to the newly-created ACPI HID device path structure.
871 EFI_DEVICE_PATH_PROTOCOL
*
872 ConvertFromTextAcpi (
873 IN CHAR16
*TextDeviceNode
,
878 ACPI_HID_DEVICE_PATH
*Acpi
;
880 UIDStr
= GetNextParamStr (&TextDeviceNode
);
881 Acpi
= (ACPI_HID_DEVICE_PATH
*) CreateDeviceNode (
884 (UINT16
) sizeof (ACPI_HID_DEVICE_PATH
)
887 Acpi
->HID
= EFI_PNP_ID (PnPId
);
888 Acpi
->UID
= (UINT32
) Strtoi (UIDStr
);
890 return (EFI_DEVICE_PATH_PROTOCOL
*) Acpi
;
894 Converts a text device path node to PCI root device path structure.
896 @param TextDeviceNode The input Text device path node.
898 @return A pointer to the newly-created PCI root device path structure.
901 EFI_DEVICE_PATH_PROTOCOL
*
902 DevPathFromTextPciRoot (
903 IN CHAR16
*TextDeviceNode
906 return ConvertFromTextAcpi (TextDeviceNode
, 0x0a03);
910 Converts a text device path node to PCIE root device path structure.
912 @param TextDeviceNode The input Text device path node.
914 @return A pointer to the newly-created PCIE root device path structure.
917 EFI_DEVICE_PATH_PROTOCOL
*
918 DevPathFromTextPcieRoot (
919 IN CHAR16
*TextDeviceNode
922 return ConvertFromTextAcpi (TextDeviceNode
, 0x0a08);
926 Converts a text device path node to Floppy device path structure.
928 @param TextDeviceNode The input Text device path node.
930 @return A pointer to the newly-created Floppy device path structure.
933 EFI_DEVICE_PATH_PROTOCOL
*
934 DevPathFromTextFloppy (
935 IN CHAR16
*TextDeviceNode
938 return ConvertFromTextAcpi (TextDeviceNode
, 0x0604);
942 Converts a text device path node to Keyboard device path structure.
944 @param TextDeviceNode The input Text device path node.
946 @return A pointer to the newly-created Keyboard device path structure.
949 EFI_DEVICE_PATH_PROTOCOL
*
950 DevPathFromTextKeyboard (
951 IN CHAR16
*TextDeviceNode
954 return ConvertFromTextAcpi (TextDeviceNode
, 0x0301);
958 Converts a text device path node to Serial device path structure.
960 @param TextDeviceNode The input Text device path node.
962 @return A pointer to the newly-created Serial device path structure.
965 EFI_DEVICE_PATH_PROTOCOL
*
966 DevPathFromTextSerial (
967 IN CHAR16
*TextDeviceNode
970 return ConvertFromTextAcpi (TextDeviceNode
, 0x0501);
974 Converts a text device path node to Parallel Port device path structure.
976 @param TextDeviceNode The input Text device path node.
978 @return A pointer to the newly-created Parallel Port device path structure.
981 EFI_DEVICE_PATH_PROTOCOL
*
982 DevPathFromTextParallelPort (
983 IN CHAR16
*TextDeviceNode
986 return ConvertFromTextAcpi (TextDeviceNode
, 0x0401);
990 Converts a text device path node to ACPI extension device path structure.
992 @param TextDeviceNode The input Text device path node.
994 @return A pointer to the newly-created ACPI extension device path structure.
997 EFI_DEVICE_PATH_PROTOCOL
*
998 DevPathFromTextAcpiEx (
999 IN CHAR16
*TextDeviceNode
1010 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
1012 HIDStr
= GetNextParamStr (&TextDeviceNode
);
1013 CIDStr
= GetNextParamStr (&TextDeviceNode
);
1014 UIDStr
= GetNextParamStr (&TextDeviceNode
);
1015 HIDSTRStr
= GetNextParamStr (&TextDeviceNode
);
1016 CIDSTRStr
= GetNextParamStr (&TextDeviceNode
);
1017 UIDSTRStr
= GetNextParamStr (&TextDeviceNode
);
1019 Length
= (UINT16
) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
) + StrLen (HIDSTRStr
) + 1);
1020 Length
= (UINT16
) (Length
+ StrLen (UIDSTRStr
) + 1);
1021 Length
= (UINT16
) (Length
+ StrLen (CIDSTRStr
) + 1);
1022 AcpiEx
= (ACPI_EXTENDED_HID_DEVICE_PATH
*) CreateDeviceNode (
1028 AcpiEx
->HID
= EisaIdFromText (HIDStr
);
1029 AcpiEx
->CID
= EisaIdFromText (CIDStr
);
1030 AcpiEx
->UID
= (UINT32
) Strtoi (UIDStr
);
1032 AsciiStr
= (CHAR8
*) ((UINT8
*)AcpiEx
+ sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
1033 StrToAscii (HIDSTRStr
, &AsciiStr
);
1034 StrToAscii (UIDSTRStr
, &AsciiStr
);
1035 StrToAscii (CIDSTRStr
, &AsciiStr
);
1037 return (EFI_DEVICE_PATH_PROTOCOL
*) AcpiEx
;
1041 Converts a text device path node to ACPI extension device path structure.
1043 @param TextDeviceNode The input Text device path node.
1045 @return A pointer to the newly-created ACPI extension device path structure.
1048 EFI_DEVICE_PATH_PROTOCOL
*
1049 DevPathFromTextAcpiExp (
1050 IN CHAR16
*TextDeviceNode
1058 ACPI_EXTENDED_HID_DEVICE_PATH
*AcpiEx
;
1060 HIDStr
= GetNextParamStr (&TextDeviceNode
);
1061 CIDStr
= GetNextParamStr (&TextDeviceNode
);
1062 UIDSTRStr
= GetNextParamStr (&TextDeviceNode
);
1063 Length
= (UINT16
) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
) + StrLen (UIDSTRStr
) + 3);
1064 AcpiEx
= (ACPI_EXTENDED_HID_DEVICE_PATH
*) CreateDeviceNode (
1070 AcpiEx
->HID
= EisaIdFromText (HIDStr
);
1071 AcpiEx
->CID
= EisaIdFromText (CIDStr
);
1074 AsciiStr
= (CHAR8
*) ((UINT8
*)AcpiEx
+ sizeof (ACPI_EXTENDED_HID_DEVICE_PATH
));
1076 // HID string is NULL
1080 // Convert UID string
1083 StrToAscii (UIDSTRStr
, &AsciiStr
);
1085 // CID string is NULL
1089 return (EFI_DEVICE_PATH_PROTOCOL
*) AcpiEx
;
1093 Converts a text device path node to ACPI _ADR device path structure.
1095 @param TextDeviceNode The input Text device path node.
1097 @return A pointer to the newly-created ACPI _ADR device path structure.
1100 EFI_DEVICE_PATH_PROTOCOL
*
1101 DevPathFromTextAcpiAdr (
1102 IN CHAR16
*TextDeviceNode
1105 CHAR16
*DisplayDeviceStr
;
1106 ACPI_ADR_DEVICE_PATH
*AcpiAdr
;
1110 AcpiAdr
= (ACPI_ADR_DEVICE_PATH
*) CreateDeviceNode (
1113 (UINT16
) sizeof (ACPI_ADR_DEVICE_PATH
)
1115 ASSERT (AcpiAdr
!= NULL
);
1117 for (Index
= 0; ; Index
++) {
1118 DisplayDeviceStr
= GetNextParamStr (&TextDeviceNode
);
1119 if (IS_NULL (*DisplayDeviceStr
)) {
1123 Length
= DevicePathNodeLength (AcpiAdr
);
1124 AcpiAdr
= ReallocatePool (
1126 Length
+ sizeof (UINT32
),
1129 ASSERT (AcpiAdr
!= NULL
);
1130 SetDevicePathNodeLength (AcpiAdr
, Length
+ sizeof (UINT32
));
1133 (&AcpiAdr
->ADR
)[Index
] = (UINT32
) Strtoi (DisplayDeviceStr
);
1136 return (EFI_DEVICE_PATH_PROTOCOL
*) AcpiAdr
;
1140 Converts a generic messaging text device path node to messaging device path structure.
1142 @param TextDeviceNode The input Text device path node.
1144 @return A pointer to messaging device path structure.
1147 EFI_DEVICE_PATH_PROTOCOL
*
1148 DevPathFromTextMsg (
1149 IN CHAR16
*TextDeviceNode
1152 return DevPathFromTextGenericPath (MESSAGING_DEVICE_PATH
, TextDeviceNode
);
1156 Converts a text device path node to Parallel Port device path structure.
1158 @param TextDeviceNode The input Text device path node.
1160 @return A pointer to the newly-created Parallel Port device path structure.
1163 EFI_DEVICE_PATH_PROTOCOL
*
1164 DevPathFromTextAta (
1165 IN CHAR16
*TextDeviceNode
1168 CHAR16
*PrimarySecondaryStr
;
1169 CHAR16
*SlaveMasterStr
;
1171 ATAPI_DEVICE_PATH
*Atapi
;
1173 Atapi
= (ATAPI_DEVICE_PATH
*) CreateDeviceNode (
1174 MESSAGING_DEVICE_PATH
,
1176 (UINT16
) sizeof (ATAPI_DEVICE_PATH
)
1179 PrimarySecondaryStr
= GetNextParamStr (&TextDeviceNode
);
1180 SlaveMasterStr
= GetNextParamStr (&TextDeviceNode
);
1181 LunStr
= GetNextParamStr (&TextDeviceNode
);
1183 if (StrCmp (PrimarySecondaryStr
, L
"Primary") == 0) {
1184 Atapi
->PrimarySecondary
= 0;
1185 } else if (StrCmp (PrimarySecondaryStr
, L
"Secondary") == 0) {
1186 Atapi
->PrimarySecondary
= 1;
1188 Atapi
->PrimarySecondary
= (UINT8
) Strtoi (PrimarySecondaryStr
);
1190 if (StrCmp (SlaveMasterStr
, L
"Master") == 0) {
1191 Atapi
->SlaveMaster
= 0;
1192 } else if (StrCmp (SlaveMasterStr
, L
"Slave") == 0) {
1193 Atapi
->SlaveMaster
= 1;
1195 Atapi
->SlaveMaster
= (UINT8
) Strtoi (SlaveMasterStr
);
1198 Atapi
->Lun
= (UINT16
) Strtoi (LunStr
);
1200 return (EFI_DEVICE_PATH_PROTOCOL
*) Atapi
;
1204 Converts a text device path node to SCSI device path structure.
1206 @param TextDeviceNode The input Text device path node.
1208 @return A pointer to the newly-created SCSI device path structure.
1211 EFI_DEVICE_PATH_PROTOCOL
*
1212 DevPathFromTextScsi (
1213 IN CHAR16
*TextDeviceNode
1218 SCSI_DEVICE_PATH
*Scsi
;
1220 PunStr
= GetNextParamStr (&TextDeviceNode
);
1221 LunStr
= GetNextParamStr (&TextDeviceNode
);
1222 Scsi
= (SCSI_DEVICE_PATH
*) CreateDeviceNode (
1223 MESSAGING_DEVICE_PATH
,
1225 (UINT16
) sizeof (SCSI_DEVICE_PATH
)
1228 Scsi
->Pun
= (UINT16
) Strtoi (PunStr
);
1229 Scsi
->Lun
= (UINT16
) Strtoi (LunStr
);
1231 return (EFI_DEVICE_PATH_PROTOCOL
*) Scsi
;
1235 Converts a text device path node to Fibre device path structure.
1237 @param TextDeviceNode The input Text device path node.
1239 @return A pointer to the newly-created Fibre device path structure.
1242 EFI_DEVICE_PATH_PROTOCOL
*
1243 DevPathFromTextFibre (
1244 IN CHAR16
*TextDeviceNode
1249 FIBRECHANNEL_DEVICE_PATH
*Fibre
;
1251 WWNStr
= GetNextParamStr (&TextDeviceNode
);
1252 LunStr
= GetNextParamStr (&TextDeviceNode
);
1253 Fibre
= (FIBRECHANNEL_DEVICE_PATH
*) CreateDeviceNode (
1254 MESSAGING_DEVICE_PATH
,
1255 MSG_FIBRECHANNEL_DP
,
1256 (UINT16
) sizeof (FIBRECHANNEL_DEVICE_PATH
)
1259 Fibre
->Reserved
= 0;
1260 Strtoi64 (WWNStr
, &Fibre
->WWN
);
1261 Strtoi64 (LunStr
, &Fibre
->Lun
);
1263 return (EFI_DEVICE_PATH_PROTOCOL
*) Fibre
;
1267 Converts a text device path node to FibreEx device path structure.
1269 @param TextDeviceNode The input Text device path node.
1271 @return A pointer to the newly-created FibreEx device path structure.
1274 EFI_DEVICE_PATH_PROTOCOL
*
1275 DevPathFromTextFibreEx (
1276 IN CHAR16
*TextDeviceNode
1281 FIBRECHANNELEX_DEVICE_PATH
*FibreEx
;
1283 WWNStr
= GetNextParamStr (&TextDeviceNode
);
1284 LunStr
= GetNextParamStr (&TextDeviceNode
);
1285 FibreEx
= (FIBRECHANNELEX_DEVICE_PATH
*) CreateDeviceNode (
1286 MESSAGING_DEVICE_PATH
,
1287 MSG_FIBRECHANNELEX_DP
,
1288 (UINT16
) sizeof (FIBRECHANNELEX_DEVICE_PATH
)
1291 FibreEx
->Reserved
= 0;
1292 Strtoi64 (WWNStr
, (UINT64
*) (&FibreEx
->WWN
));
1293 Strtoi64 (LunStr
, (UINT64
*) (&FibreEx
->Lun
));
1295 *(UINT64
*) (&FibreEx
->WWN
) = SwapBytes64 (*(UINT64
*) (&FibreEx
->WWN
));
1296 *(UINT64
*) (&FibreEx
->Lun
) = SwapBytes64 (*(UINT64
*) (&FibreEx
->Lun
));
1298 return (EFI_DEVICE_PATH_PROTOCOL
*) FibreEx
;
1302 Converts a text device path node to 1394 device path structure.
1304 @param TextDeviceNode The input Text device path node.
1306 @return A pointer to the newly-created 1394 device path structure.
1309 EFI_DEVICE_PATH_PROTOCOL
*
1310 DevPathFromText1394 (
1311 IN CHAR16
*TextDeviceNode
1315 F1394_DEVICE_PATH
*F1394DevPath
;
1317 GuidStr
= GetNextParamStr (&TextDeviceNode
);
1318 F1394DevPath
= (F1394_DEVICE_PATH
*) CreateDeviceNode (
1319 MESSAGING_DEVICE_PATH
,
1321 (UINT16
) sizeof (F1394_DEVICE_PATH
)
1324 F1394DevPath
->Reserved
= 0;
1325 F1394DevPath
->Guid
= StrHexToUint64 (GuidStr
);
1327 return (EFI_DEVICE_PATH_PROTOCOL
*) F1394DevPath
;
1331 Converts a text device path node to USB device path structure.
1333 @param TextDeviceNode The input Text device path node.
1335 @return A pointer to the newly-created USB device path structure.
1338 EFI_DEVICE_PATH_PROTOCOL
*
1339 DevPathFromTextUsb (
1340 IN CHAR16
*TextDeviceNode
1344 CHAR16
*InterfaceStr
;
1345 USB_DEVICE_PATH
*Usb
;
1347 PortStr
= GetNextParamStr (&TextDeviceNode
);
1348 InterfaceStr
= GetNextParamStr (&TextDeviceNode
);
1349 Usb
= (USB_DEVICE_PATH
*) CreateDeviceNode (
1350 MESSAGING_DEVICE_PATH
,
1352 (UINT16
) sizeof (USB_DEVICE_PATH
)
1355 Usb
->ParentPortNumber
= (UINT8
) Strtoi (PortStr
);
1356 Usb
->InterfaceNumber
= (UINT8
) Strtoi (InterfaceStr
);
1358 return (EFI_DEVICE_PATH_PROTOCOL
*) Usb
;
1362 Converts a text device path node to I20 device path structure.
1364 @param TextDeviceNode The input Text device path node.
1366 @return A pointer to the newly-created I20 device path structure.
1369 EFI_DEVICE_PATH_PROTOCOL
*
1370 DevPathFromTextI2O (
1371 IN CHAR16
*TextDeviceNode
1375 I2O_DEVICE_PATH
*I2ODevPath
;
1377 TIDStr
= GetNextParamStr (&TextDeviceNode
);
1378 I2ODevPath
= (I2O_DEVICE_PATH
*) CreateDeviceNode (
1379 MESSAGING_DEVICE_PATH
,
1381 (UINT16
) sizeof (I2O_DEVICE_PATH
)
1384 I2ODevPath
->Tid
= (UINT32
) Strtoi (TIDStr
);
1386 return (EFI_DEVICE_PATH_PROTOCOL
*) I2ODevPath
;
1390 Converts a text device path node to Infini Band device path structure.
1392 @param TextDeviceNode The input Text device path node.
1394 @return A pointer to the newly-created Infini Band device path structure.
1397 EFI_DEVICE_PATH_PROTOCOL
*
1398 DevPathFromTextInfiniband (
1399 IN CHAR16
*TextDeviceNode
1408 INFINIBAND_DEVICE_PATH
*InfiniBand
;
1410 FlagsStr
= GetNextParamStr (&TextDeviceNode
);
1411 GuidStr
= GetNextParamStr (&TextDeviceNode
);
1412 SidStr
= GetNextParamStr (&TextDeviceNode
);
1413 TidStr
= GetNextParamStr (&TextDeviceNode
);
1414 DidStr
= GetNextParamStr (&TextDeviceNode
);
1415 InfiniBand
= (INFINIBAND_DEVICE_PATH
*) CreateDeviceNode (
1416 MESSAGING_DEVICE_PATH
,
1418 (UINT16
) sizeof (INFINIBAND_DEVICE_PATH
)
1421 InfiniBand
->ResourceFlags
= (UINT32
) Strtoi (FlagsStr
);
1422 StrToGuid (GuidStr
, &PortGid
);
1423 CopyMem (InfiniBand
->PortGid
, &PortGid
, sizeof (EFI_GUID
));
1424 Strtoi64 (SidStr
, &InfiniBand
->ServiceId
);
1425 Strtoi64 (TidStr
, &InfiniBand
->TargetPortId
);
1426 Strtoi64 (DidStr
, &InfiniBand
->DeviceId
);
1428 return (EFI_DEVICE_PATH_PROTOCOL
*) InfiniBand
;
1432 Converts a text device path node to Vendor-Defined Messaging device path structure.
1434 @param TextDeviceNode The input Text device path node.
1436 @return A pointer to the newly-created Vendor-Defined Messaging device path structure.
1439 EFI_DEVICE_PATH_PROTOCOL
*
1440 DevPathFromTextVenMsg (
1441 IN CHAR16
*TextDeviceNode
1444 return ConvertFromTextVendor (
1446 MESSAGING_DEVICE_PATH
,
1452 Converts a text device path node to Vendor defined PC-ANSI device path structure.
1454 @param TextDeviceNode The input Text device path node.
1456 @return A pointer to the newly-created Vendor defined PC-ANSI device path structure.
1459 EFI_DEVICE_PATH_PROTOCOL
*
1460 DevPathFromTextVenPcAnsi (
1461 IN CHAR16
*TextDeviceNode
1464 VENDOR_DEVICE_PATH
*Vendor
;
1466 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
1467 MESSAGING_DEVICE_PATH
,
1469 (UINT16
) sizeof (VENDOR_DEVICE_PATH
));
1470 CopyGuid (&Vendor
->Guid
, &gEfiPcAnsiGuid
);
1472 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
1476 Converts a text device path node to Vendor defined VT100 device path structure.
1478 @param TextDeviceNode The input Text device path node.
1480 @return A pointer to the newly-created Vendor defined VT100 device path structure.
1483 EFI_DEVICE_PATH_PROTOCOL
*
1484 DevPathFromTextVenVt100 (
1485 IN CHAR16
*TextDeviceNode
1488 VENDOR_DEVICE_PATH
*Vendor
;
1490 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
1491 MESSAGING_DEVICE_PATH
,
1493 (UINT16
) sizeof (VENDOR_DEVICE_PATH
));
1494 CopyGuid (&Vendor
->Guid
, &gEfiVT100Guid
);
1496 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
1500 Converts a text device path node to Vendor defined VT100 Plus device path structure.
1502 @param TextDeviceNode The input Text device path node.
1504 @return A pointer to the newly-created Vendor defined VT100 Plus device path structure.
1507 EFI_DEVICE_PATH_PROTOCOL
*
1508 DevPathFromTextVenVt100Plus (
1509 IN CHAR16
*TextDeviceNode
1512 VENDOR_DEVICE_PATH
*Vendor
;
1514 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
1515 MESSAGING_DEVICE_PATH
,
1517 (UINT16
) sizeof (VENDOR_DEVICE_PATH
));
1518 CopyGuid (&Vendor
->Guid
, &gEfiVT100PlusGuid
);
1520 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
1524 Converts a text device path node to Vendor defined UTF8 device path structure.
1526 @param TextDeviceNode The input Text device path node.
1528 @return A pointer to the newly-created Vendor defined UTF8 device path structure.
1531 EFI_DEVICE_PATH_PROTOCOL
*
1532 DevPathFromTextVenUtf8 (
1533 IN CHAR16
*TextDeviceNode
1536 VENDOR_DEVICE_PATH
*Vendor
;
1538 Vendor
= (VENDOR_DEVICE_PATH
*) CreateDeviceNode (
1539 MESSAGING_DEVICE_PATH
,
1541 (UINT16
) sizeof (VENDOR_DEVICE_PATH
));
1542 CopyGuid (&Vendor
->Guid
, &gEfiVTUTF8Guid
);
1544 return (EFI_DEVICE_PATH_PROTOCOL
*) Vendor
;
1548 Converts a text device path node to UART Flow Control device path structure.
1550 @param TextDeviceNode The input Text device path node.
1552 @return A pointer to the newly-created UART Flow Control device path structure.
1555 EFI_DEVICE_PATH_PROTOCOL
*
1556 DevPathFromTextUartFlowCtrl (
1557 IN CHAR16
*TextDeviceNode
1561 UART_FLOW_CONTROL_DEVICE_PATH
*UartFlowControl
;
1563 ValueStr
= GetNextParamStr (&TextDeviceNode
);
1564 UartFlowControl
= (UART_FLOW_CONTROL_DEVICE_PATH
*) CreateDeviceNode (
1565 MESSAGING_DEVICE_PATH
,
1567 (UINT16
) sizeof (UART_FLOW_CONTROL_DEVICE_PATH
)
1570 CopyGuid (&UartFlowControl
->Guid
, &gEfiUartDevicePathGuid
);
1571 if (StrCmp (ValueStr
, L
"XonXoff") == 0) {
1572 UartFlowControl
->FlowControlMap
= 2;
1573 } else if (StrCmp (ValueStr
, L
"Hardware") == 0) {
1574 UartFlowControl
->FlowControlMap
= 1;
1576 UartFlowControl
->FlowControlMap
= 0;
1579 return (EFI_DEVICE_PATH_PROTOCOL
*) UartFlowControl
;
1583 Converts a text device path node to Serial Attached SCSI device path structure.
1585 @param TextDeviceNode The input Text device path node.
1587 @return A pointer to the newly-created Serial Attached SCSI device path structure.
1590 EFI_DEVICE_PATH_PROTOCOL
*
1591 DevPathFromTextSAS (
1592 IN CHAR16
*TextDeviceNode
1599 CHAR16
*LocationStr
;
1601 CHAR16
*DriveBayStr
;
1602 CHAR16
*ReservedStr
;
1605 SAS_DEVICE_PATH
*Sas
;
1607 AddressStr
= GetNextParamStr (&TextDeviceNode
);
1608 LunStr
= GetNextParamStr (&TextDeviceNode
);
1609 RTPStr
= GetNextParamStr (&TextDeviceNode
);
1610 SASSATAStr
= GetNextParamStr (&TextDeviceNode
);
1611 LocationStr
= GetNextParamStr (&TextDeviceNode
);
1612 ConnectStr
= GetNextParamStr (&TextDeviceNode
);
1613 DriveBayStr
= GetNextParamStr (&TextDeviceNode
);
1614 ReservedStr
= GetNextParamStr (&TextDeviceNode
);
1615 Sas
= (SAS_DEVICE_PATH
*) CreateDeviceNode (
1616 MESSAGING_DEVICE_PATH
,
1618 (UINT16
) sizeof (SAS_DEVICE_PATH
)
1621 CopyGuid (&Sas
->Guid
, &gEfiSasDevicePathGuid
);
1622 Strtoi64 (AddressStr
, &Sas
->SasAddress
);
1623 Strtoi64 (LunStr
, &Sas
->Lun
);
1624 Sas
->RelativeTargetPort
= (UINT16
) Strtoi (RTPStr
);
1626 if (StrCmp (SASSATAStr
, L
"NoTopology") == 0) {
1629 } else if ((StrCmp (SASSATAStr
, L
"SATA") == 0) || (StrCmp (SASSATAStr
, L
"SAS") == 0)) {
1631 Uint16
= (UINT16
) Strtoi (DriveBayStr
);
1635 Info
= (UINT16
) (0x2 | ((Uint16
- 1) << 8));
1638 if (StrCmp (SASSATAStr
, L
"SATA") == 0) {
1643 // Location is an integer between 0 and 1 or else
1644 // the keyword Internal (0) or External (1).
1646 if (StrCmp (LocationStr
, L
"External") == 0) {
1648 } else if (StrCmp (LocationStr
, L
"Internal") == 0) {
1651 Uint16
= ((UINT16
) Strtoi (LocationStr
) & BIT0
);
1653 Info
|= (Uint16
<< 5);
1656 // Connect is an integer between 0 and 3 or else
1657 // the keyword Direct (0) or Expanded (1).
1659 if (StrCmp (ConnectStr
, L
"Expanded") == 0) {
1661 } else if (StrCmp (ConnectStr
, L
"Direct") == 0) {
1664 Uint16
= ((UINT16
) Strtoi (ConnectStr
) & (BIT0
| BIT1
));
1666 Info
|= (Uint16
<< 6);
1669 Info
= (UINT16
) Strtoi (SASSATAStr
);
1672 Sas
->DeviceTopology
= Info
;
1673 Sas
->Reserved
= (UINT32
) Strtoi (ReservedStr
);
1675 return (EFI_DEVICE_PATH_PROTOCOL
*) Sas
;
1679 Converts a text device path node to Serial Attached SCSI Ex device path structure.
1681 @param TextDeviceNode The input Text device path node.
1683 @return A pointer to the newly-created Serial Attached SCSI Ex device path structure.
1686 EFI_DEVICE_PATH_PROTOCOL
*
1687 DevPathFromTextSasEx (
1688 IN CHAR16
*TextDeviceNode
1695 CHAR16
*LocationStr
;
1697 CHAR16
*DriveBayStr
;
1702 SASEX_DEVICE_PATH
*SasEx
;
1704 AddressStr
= GetNextParamStr (&TextDeviceNode
);
1705 LunStr
= GetNextParamStr (&TextDeviceNode
);
1706 RTPStr
= GetNextParamStr (&TextDeviceNode
);
1707 SASSATAStr
= GetNextParamStr (&TextDeviceNode
);
1708 LocationStr
= GetNextParamStr (&TextDeviceNode
);
1709 ConnectStr
= GetNextParamStr (&TextDeviceNode
);
1710 DriveBayStr
= GetNextParamStr (&TextDeviceNode
);
1711 SasEx
= (SASEX_DEVICE_PATH
*) CreateDeviceNode (
1712 MESSAGING_DEVICE_PATH
,
1714 (UINT16
) sizeof (SASEX_DEVICE_PATH
)
1717 Strtoi64 (AddressStr
, &SasAddress
);
1718 Strtoi64 (LunStr
, &Lun
);
1719 WriteUnaligned64 ((UINT64
*) &SasEx
->SasAddress
, SwapBytes64 (SasAddress
));
1720 WriteUnaligned64 ((UINT64
*) &SasEx
->Lun
, SwapBytes64 (Lun
));
1721 SasEx
->RelativeTargetPort
= (UINT16
) Strtoi (RTPStr
);
1723 if (StrCmp (SASSATAStr
, L
"NoTopology") == 0) {
1726 } else if ((StrCmp (SASSATAStr
, L
"SATA") == 0) || (StrCmp (SASSATAStr
, L
"SAS") == 0)) {
1728 Uint16
= (UINT16
) Strtoi (DriveBayStr
);
1732 Info
= (UINT16
) (0x2 | ((Uint16
- 1) << 8));
1735 if (StrCmp (SASSATAStr
, L
"SATA") == 0) {
1740 // Location is an integer between 0 and 1 or else
1741 // the keyword Internal (0) or External (1).
1743 if (StrCmp (LocationStr
, L
"External") == 0) {
1745 } else if (StrCmp (LocationStr
, L
"Internal") == 0) {
1748 Uint16
= ((UINT16
) Strtoi (LocationStr
) & BIT0
);
1750 Info
|= (Uint16
<< 5);
1753 // Connect is an integer between 0 and 3 or else
1754 // the keyword Direct (0) or Expanded (1).
1756 if (StrCmp (ConnectStr
, L
"Expanded") == 0) {
1758 } else if (StrCmp (ConnectStr
, L
"Direct") == 0) {
1761 Uint16
= ((UINT16
) Strtoi (ConnectStr
) & (BIT0
| BIT1
));
1763 Info
|= (Uint16
<< 6);
1766 Info
= (UINT16
) Strtoi (SASSATAStr
);
1769 SasEx
->DeviceTopology
= Info
;
1771 return (EFI_DEVICE_PATH_PROTOCOL
*) SasEx
;
1775 Converts a text device path node to NVM Express Namespace device path structure.
1777 @param TextDeviceNode The input Text device path node.
1779 @return A pointer to the newly-created NVM Express Namespace device path structure.
1782 EFI_DEVICE_PATH_PROTOCOL
*
1783 DevPathFromTextNVMe (
1784 IN CHAR16
*TextDeviceNode
1787 CHAR16
*NamespaceIdStr
;
1788 CHAR16
*NamespaceUuidStr
;
1789 NVME_NAMESPACE_DEVICE_PATH
*Nvme
;
1793 NamespaceIdStr
= GetNextParamStr (&TextDeviceNode
);
1794 NamespaceUuidStr
= GetNextParamStr (&TextDeviceNode
);
1795 Nvme
= (NVME_NAMESPACE_DEVICE_PATH
*) CreateDeviceNode (
1796 MESSAGING_DEVICE_PATH
,
1797 MSG_NVME_NAMESPACE_DP
,
1798 (UINT16
) sizeof (NVME_NAMESPACE_DEVICE_PATH
)
1801 Nvme
->NamespaceId
= (UINT32
) Strtoi (NamespaceIdStr
);
1802 Uuid
= (UINT8
*) &Nvme
->NamespaceUuid
;
1804 Index
= sizeof (Nvme
->NamespaceUuid
) / sizeof (UINT8
);
1805 while (Index
-- != 0) {
1806 Uuid
[Index
] = (UINT8
) StrHexToUintn (SplitStr (&NamespaceUuidStr
, L
'-'));
1809 return (EFI_DEVICE_PATH_PROTOCOL
*) Nvme
;
1813 Converts a text device path node to UFS device path structure.
1815 @param TextDeviceNode The input Text device path node.
1817 @return A pointer to the newly-created UFS device path structure.
1820 EFI_DEVICE_PATH_PROTOCOL
*
1821 DevPathFromTextUfs (
1822 IN CHAR16
*TextDeviceNode
1827 UFS_DEVICE_PATH
*Ufs
;
1829 PunStr
= GetNextParamStr (&TextDeviceNode
);
1830 LunStr
= GetNextParamStr (&TextDeviceNode
);
1831 Ufs
= (UFS_DEVICE_PATH
*) CreateDeviceNode (
1832 MESSAGING_DEVICE_PATH
,
1834 (UINT16
) sizeof (UFS_DEVICE_PATH
)
1837 Ufs
->Pun
= (UINT8
) Strtoi (PunStr
);
1838 Ufs
->Lun
= (UINT8
) Strtoi (LunStr
);
1840 return (EFI_DEVICE_PATH_PROTOCOL
*) Ufs
;
1844 Converts a text device path node to Debug Port device path structure.
1846 @param TextDeviceNode The input Text device path node.
1848 @return A pointer to the newly-created Debug Port device path structure.
1851 EFI_DEVICE_PATH_PROTOCOL
*
1852 DevPathFromTextDebugPort (
1853 IN CHAR16
*TextDeviceNode
1856 VENDOR_DEFINED_MESSAGING_DEVICE_PATH
*Vend
;
1858 Vend
= (VENDOR_DEFINED_MESSAGING_DEVICE_PATH
*) CreateDeviceNode (
1859 MESSAGING_DEVICE_PATH
,
1861 (UINT16
) sizeof (VENDOR_DEFINED_MESSAGING_DEVICE_PATH
)
1864 CopyGuid (&Vend
->Guid
, &gEfiDebugPortProtocolGuid
);
1866 return (EFI_DEVICE_PATH_PROTOCOL
*) Vend
;
1870 Converts a text device path node to MAC device path structure.
1872 @param TextDeviceNode The input Text device path node.
1874 @return A pointer to the newly-created MAC device path structure.
1877 EFI_DEVICE_PATH_PROTOCOL
*
1878 DevPathFromTextMAC (
1879 IN CHAR16
*TextDeviceNode
1885 MAC_ADDR_DEVICE_PATH
*MACDevPath
;
1887 AddressStr
= GetNextParamStr (&TextDeviceNode
);
1888 IfTypeStr
= GetNextParamStr (&TextDeviceNode
);
1889 MACDevPath
= (MAC_ADDR_DEVICE_PATH
*) CreateDeviceNode (
1890 MESSAGING_DEVICE_PATH
,
1892 (UINT16
) sizeof (MAC_ADDR_DEVICE_PATH
)
1895 MACDevPath
->IfType
= (UINT8
) Strtoi (IfTypeStr
);
1897 Length
= sizeof (EFI_MAC_ADDRESS
);
1898 StrToBuf (&MACDevPath
->MacAddress
.Addr
[0], Length
, AddressStr
);
1900 return (EFI_DEVICE_PATH_PROTOCOL
*) MACDevPath
;
1905 Converts a text format to the network protocol ID.
1907 @param Text String of protocol field.
1909 @return Network protocol ID .
1913 NetworkProtocolFromText (
1917 if (StrCmp (Text
, L
"UDP") == 0) {
1918 return RFC_1700_UDP_PROTOCOL
;
1921 if (StrCmp (Text
, L
"TCP") == 0) {
1922 return RFC_1700_TCP_PROTOCOL
;
1925 return Strtoi (Text
);
1930 Converts a text device path node to IPV4 device path structure.
1932 @param TextDeviceNode The input Text device path node.
1934 @return A pointer to the newly-created IPV4 device path structure.
1937 EFI_DEVICE_PATH_PROTOCOL
*
1938 DevPathFromTextIPv4 (
1939 IN CHAR16
*TextDeviceNode
1942 CHAR16
*RemoteIPStr
;
1943 CHAR16
*ProtocolStr
;
1946 CHAR16
*GatewayIPStr
;
1947 CHAR16
*SubnetMaskStr
;
1948 IPv4_DEVICE_PATH
*IPv4
;
1950 RemoteIPStr
= GetNextParamStr (&TextDeviceNode
);
1951 ProtocolStr
= GetNextParamStr (&TextDeviceNode
);
1952 TypeStr
= GetNextParamStr (&TextDeviceNode
);
1953 LocalIPStr
= GetNextParamStr (&TextDeviceNode
);
1954 GatewayIPStr
= GetNextParamStr (&TextDeviceNode
);
1955 SubnetMaskStr
= GetNextParamStr (&TextDeviceNode
);
1956 IPv4
= (IPv4_DEVICE_PATH
*) CreateDeviceNode (
1957 MESSAGING_DEVICE_PATH
,
1959 (UINT16
) sizeof (IPv4_DEVICE_PATH
)
1962 StrToIPv4Addr (&RemoteIPStr
, &IPv4
->RemoteIpAddress
);
1963 IPv4
->Protocol
= (UINT16
) NetworkProtocolFromText (ProtocolStr
);
1964 if (StrCmp (TypeStr
, L
"Static") == 0) {
1965 IPv4
->StaticIpAddress
= TRUE
;
1967 IPv4
->StaticIpAddress
= FALSE
;
1970 StrToIPv4Addr (&LocalIPStr
, &IPv4
->LocalIpAddress
);
1971 if (!IS_NULL (*GatewayIPStr
) && !IS_NULL (*SubnetMaskStr
)) {
1972 StrToIPv4Addr (&GatewayIPStr
, &IPv4
->GatewayIpAddress
);
1973 StrToIPv4Addr (&SubnetMaskStr
, &IPv4
->SubnetMask
);
1975 ZeroMem (&IPv4
->GatewayIpAddress
, sizeof (IPv4
->GatewayIpAddress
));
1976 ZeroMem (&IPv4
->SubnetMask
, sizeof (IPv4
->SubnetMask
));
1979 IPv4
->LocalPort
= 0;
1980 IPv4
->RemotePort
= 0;
1982 return (EFI_DEVICE_PATH_PROTOCOL
*) IPv4
;
1986 Converts a text device path node to IPV6 device path structure.
1988 @param TextDeviceNode The input Text device path node.
1990 @return A pointer to the newly-created IPV6 device path structure.
1993 EFI_DEVICE_PATH_PROTOCOL
*
1994 DevPathFromTextIPv6 (
1995 IN CHAR16
*TextDeviceNode
1998 CHAR16
*RemoteIPStr
;
1999 CHAR16
*ProtocolStr
;
2002 CHAR16
*GatewayIPStr
;
2003 CHAR16
*PrefixLengthStr
;
2004 IPv6_DEVICE_PATH
*IPv6
;
2006 RemoteIPStr
= GetNextParamStr (&TextDeviceNode
);
2007 ProtocolStr
= GetNextParamStr (&TextDeviceNode
);
2008 TypeStr
= GetNextParamStr (&TextDeviceNode
);
2009 LocalIPStr
= GetNextParamStr (&TextDeviceNode
);
2010 PrefixLengthStr
= GetNextParamStr (&TextDeviceNode
);
2011 GatewayIPStr
= GetNextParamStr (&TextDeviceNode
);
2012 IPv6
= (IPv6_DEVICE_PATH
*) CreateDeviceNode (
2013 MESSAGING_DEVICE_PATH
,
2015 (UINT16
) sizeof (IPv6_DEVICE_PATH
)
2018 StrToIPv6Addr (&RemoteIPStr
, &IPv6
->RemoteIpAddress
);
2019 IPv6
->Protocol
= (UINT16
) NetworkProtocolFromText (ProtocolStr
);
2020 if (StrCmp (TypeStr
, L
"Static") == 0) {
2021 IPv6
->IpAddressOrigin
= 0;
2022 } else if (StrCmp (TypeStr
, L
"StatelessAutoConfigure") == 0) {
2023 IPv6
->IpAddressOrigin
= 1;
2025 IPv6
->IpAddressOrigin
= 2;
2028 StrToIPv6Addr (&LocalIPStr
, &IPv6
->LocalIpAddress
);
2029 if (!IS_NULL (*GatewayIPStr
) && !IS_NULL (*PrefixLengthStr
)) {
2030 StrToIPv6Addr (&GatewayIPStr
, &IPv6
->GatewayIpAddress
);
2031 IPv6
->PrefixLength
= (UINT8
) Strtoi (PrefixLengthStr
);
2033 ZeroMem (&IPv6
->GatewayIpAddress
, sizeof (IPv6
->GatewayIpAddress
));
2034 IPv6
->PrefixLength
= 0;
2037 IPv6
->LocalPort
= 0;
2038 IPv6
->RemotePort
= 0;
2040 return (EFI_DEVICE_PATH_PROTOCOL
*) IPv6
;
2044 Converts a text device path node to UART device path structure.
2046 @param TextDeviceNode The input Text device path node.
2048 @return A pointer to the newly-created UART device path structure.
2051 EFI_DEVICE_PATH_PROTOCOL
*
2052 DevPathFromTextUart (
2053 IN CHAR16
*TextDeviceNode
2057 CHAR16
*DataBitsStr
;
2059 CHAR16
*StopBitsStr
;
2060 UART_DEVICE_PATH
*Uart
;
2062 BaudStr
= GetNextParamStr (&TextDeviceNode
);
2063 DataBitsStr
= GetNextParamStr (&TextDeviceNode
);
2064 ParityStr
= GetNextParamStr (&TextDeviceNode
);
2065 StopBitsStr
= GetNextParamStr (&TextDeviceNode
);
2066 Uart
= (UART_DEVICE_PATH
*) CreateDeviceNode (
2067 MESSAGING_DEVICE_PATH
,
2069 (UINT16
) sizeof (UART_DEVICE_PATH
)
2072 if (StrCmp (BaudStr
, L
"DEFAULT") == 0) {
2073 Uart
->BaudRate
= 115200;
2075 Strtoi64 (BaudStr
, &Uart
->BaudRate
);
2077 Uart
->DataBits
= (UINT8
) ((StrCmp (DataBitsStr
, L
"DEFAULT") == 0) ? 8 : Strtoi (DataBitsStr
));
2078 switch (*ParityStr
) {
2104 Uart
->Parity
= (UINT8
) Strtoi (ParityStr
);
2108 if (StrCmp (StopBitsStr
, L
"D") == 0) {
2109 Uart
->StopBits
= (UINT8
) 0;
2110 } else if (StrCmp (StopBitsStr
, L
"1") == 0) {
2111 Uart
->StopBits
= (UINT8
) 1;
2112 } else if (StrCmp (StopBitsStr
, L
"1.5") == 0) {
2113 Uart
->StopBits
= (UINT8
) 2;
2114 } else if (StrCmp (StopBitsStr
, L
"2") == 0) {
2115 Uart
->StopBits
= (UINT8
) 3;
2117 Uart
->StopBits
= (UINT8
) Strtoi (StopBitsStr
);
2120 return (EFI_DEVICE_PATH_PROTOCOL
*) Uart
;
2124 Converts a text device path node to USB class device path structure.
2126 @param TextDeviceNode The input Text device path node.
2127 @param UsbClassText A pointer to USB_CLASS_TEXT structure to be integrated to USB Class Text.
2129 @return A pointer to the newly-created USB class device path structure.
2132 EFI_DEVICE_PATH_PROTOCOL
*
2133 ConvertFromTextUsbClass (
2134 IN CHAR16
*TextDeviceNode
,
2135 IN USB_CLASS_TEXT
*UsbClassText
2141 CHAR16
*SubClassStr
;
2142 CHAR16
*ProtocolStr
;
2143 USB_CLASS_DEVICE_PATH
*UsbClass
;
2145 UsbClass
= (USB_CLASS_DEVICE_PATH
*) CreateDeviceNode (
2146 MESSAGING_DEVICE_PATH
,
2148 (UINT16
) sizeof (USB_CLASS_DEVICE_PATH
)
2151 VIDStr
= GetNextParamStr (&TextDeviceNode
);
2152 PIDStr
= GetNextParamStr (&TextDeviceNode
);
2153 if (UsbClassText
->ClassExist
) {
2154 ClassStr
= GetNextParamStr (&TextDeviceNode
);
2155 UsbClass
->DeviceClass
= (UINT8
) Strtoi (ClassStr
);
2157 UsbClass
->DeviceClass
= UsbClassText
->Class
;
2159 if (UsbClassText
->SubClassExist
) {
2160 SubClassStr
= GetNextParamStr (&TextDeviceNode
);
2161 UsbClass
->DeviceSubClass
= (UINT8
) Strtoi (SubClassStr
);
2163 UsbClass
->DeviceSubClass
= UsbClassText
->SubClass
;
2166 ProtocolStr
= GetNextParamStr (&TextDeviceNode
);
2168 UsbClass
->VendorId
= (UINT16
) Strtoi (VIDStr
);
2169 UsbClass
->ProductId
= (UINT16
) Strtoi (PIDStr
);
2170 UsbClass
->DeviceProtocol
= (UINT8
) Strtoi (ProtocolStr
);
2172 return (EFI_DEVICE_PATH_PROTOCOL
*) UsbClass
;
2177 Converts a text device path node to USB class device path structure.
2179 @param TextDeviceNode The input Text device path node.
2181 @return A pointer to the newly-created USB class device path structure.
2184 EFI_DEVICE_PATH_PROTOCOL
*
2185 DevPathFromTextUsbClass (
2186 IN CHAR16
*TextDeviceNode
2189 USB_CLASS_TEXT UsbClassText
;
2191 UsbClassText
.ClassExist
= TRUE
;
2192 UsbClassText
.SubClassExist
= TRUE
;
2194 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2198 Converts a text device path node to USB audio device path structure.
2200 @param TextDeviceNode The input Text device path node.
2202 @return A pointer to the newly-created USB audio device path structure.
2205 EFI_DEVICE_PATH_PROTOCOL
*
2206 DevPathFromTextUsbAudio (
2207 IN CHAR16
*TextDeviceNode
2210 USB_CLASS_TEXT UsbClassText
;
2212 UsbClassText
.ClassExist
= FALSE
;
2213 UsbClassText
.Class
= USB_CLASS_AUDIO
;
2214 UsbClassText
.SubClassExist
= TRUE
;
2216 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2220 Converts a text device path node to USB CDC Control device path structure.
2222 @param TextDeviceNode The input Text device path node.
2224 @return A pointer to the newly-created USB CDC Control device path structure.
2227 EFI_DEVICE_PATH_PROTOCOL
*
2228 DevPathFromTextUsbCDCControl (
2229 IN CHAR16
*TextDeviceNode
2232 USB_CLASS_TEXT UsbClassText
;
2234 UsbClassText
.ClassExist
= FALSE
;
2235 UsbClassText
.Class
= USB_CLASS_CDCCONTROL
;
2236 UsbClassText
.SubClassExist
= TRUE
;
2238 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2242 Converts a text device path node to USB HID device path structure.
2244 @param TextDeviceNode The input Text device path node.
2246 @return A pointer to the newly-created USB HID device path structure.
2249 EFI_DEVICE_PATH_PROTOCOL
*
2250 DevPathFromTextUsbHID (
2251 IN CHAR16
*TextDeviceNode
2254 USB_CLASS_TEXT UsbClassText
;
2256 UsbClassText
.ClassExist
= FALSE
;
2257 UsbClassText
.Class
= USB_CLASS_HID
;
2258 UsbClassText
.SubClassExist
= TRUE
;
2260 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2264 Converts a text device path node to USB Image device path structure.
2266 @param TextDeviceNode The input Text device path node.
2268 @return A pointer to the newly-created USB Image device path structure.
2271 EFI_DEVICE_PATH_PROTOCOL
*
2272 DevPathFromTextUsbImage (
2273 IN CHAR16
*TextDeviceNode
2276 USB_CLASS_TEXT UsbClassText
;
2278 UsbClassText
.ClassExist
= FALSE
;
2279 UsbClassText
.Class
= USB_CLASS_IMAGE
;
2280 UsbClassText
.SubClassExist
= TRUE
;
2282 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2286 Converts a text device path node to USB Print device path structure.
2288 @param TextDeviceNode The input Text device path node.
2290 @return A pointer to the newly-created USB Print device path structure.
2293 EFI_DEVICE_PATH_PROTOCOL
*
2294 DevPathFromTextUsbPrinter (
2295 IN CHAR16
*TextDeviceNode
2298 USB_CLASS_TEXT UsbClassText
;
2300 UsbClassText
.ClassExist
= FALSE
;
2301 UsbClassText
.Class
= USB_CLASS_PRINTER
;
2302 UsbClassText
.SubClassExist
= TRUE
;
2304 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2308 Converts a text device path node to USB mass storage device path structure.
2310 @param TextDeviceNode The input Text device path node.
2312 @return A pointer to the newly-created USB mass storage device path structure.
2315 EFI_DEVICE_PATH_PROTOCOL
*
2316 DevPathFromTextUsbMassStorage (
2317 IN CHAR16
*TextDeviceNode
2320 USB_CLASS_TEXT UsbClassText
;
2322 UsbClassText
.ClassExist
= FALSE
;
2323 UsbClassText
.Class
= USB_CLASS_MASS_STORAGE
;
2324 UsbClassText
.SubClassExist
= TRUE
;
2326 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2330 Converts a text device path node to USB HUB device path structure.
2332 @param TextDeviceNode The input Text device path node.
2334 @return A pointer to the newly-created USB HUB device path structure.
2337 EFI_DEVICE_PATH_PROTOCOL
*
2338 DevPathFromTextUsbHub (
2339 IN CHAR16
*TextDeviceNode
2342 USB_CLASS_TEXT UsbClassText
;
2344 UsbClassText
.ClassExist
= FALSE
;
2345 UsbClassText
.Class
= USB_CLASS_HUB
;
2346 UsbClassText
.SubClassExist
= TRUE
;
2348 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2352 Converts a text device path node to USB CDC data device path structure.
2354 @param TextDeviceNode The input Text device path node.
2356 @return A pointer to the newly-created USB CDC data device path structure.
2359 EFI_DEVICE_PATH_PROTOCOL
*
2360 DevPathFromTextUsbCDCData (
2361 IN CHAR16
*TextDeviceNode
2364 USB_CLASS_TEXT UsbClassText
;
2366 UsbClassText
.ClassExist
= FALSE
;
2367 UsbClassText
.Class
= USB_CLASS_CDCDATA
;
2368 UsbClassText
.SubClassExist
= TRUE
;
2370 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2374 Converts a text device path node to USB smart card device path structure.
2376 @param TextDeviceNode The input Text device path node.
2378 @return A pointer to the newly-created USB smart card device path structure.
2381 EFI_DEVICE_PATH_PROTOCOL
*
2382 DevPathFromTextUsbSmartCard (
2383 IN CHAR16
*TextDeviceNode
2386 USB_CLASS_TEXT UsbClassText
;
2388 UsbClassText
.ClassExist
= FALSE
;
2389 UsbClassText
.Class
= USB_CLASS_SMART_CARD
;
2390 UsbClassText
.SubClassExist
= TRUE
;
2392 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2396 Converts a text device path node to USB video device path structure.
2398 @param TextDeviceNode The input Text device path node.
2400 @return A pointer to the newly-created USB video device path structure.
2403 EFI_DEVICE_PATH_PROTOCOL
*
2404 DevPathFromTextUsbVideo (
2405 IN CHAR16
*TextDeviceNode
2408 USB_CLASS_TEXT UsbClassText
;
2410 UsbClassText
.ClassExist
= FALSE
;
2411 UsbClassText
.Class
= USB_CLASS_VIDEO
;
2412 UsbClassText
.SubClassExist
= TRUE
;
2414 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2418 Converts a text device path node to USB diagnostic device path structure.
2420 @param TextDeviceNode The input Text device path node.
2422 @return A pointer to the newly-created USB diagnostic device path structure.
2425 EFI_DEVICE_PATH_PROTOCOL
*
2426 DevPathFromTextUsbDiagnostic (
2427 IN CHAR16
*TextDeviceNode
2430 USB_CLASS_TEXT UsbClassText
;
2432 UsbClassText
.ClassExist
= FALSE
;
2433 UsbClassText
.Class
= USB_CLASS_DIAGNOSTIC
;
2434 UsbClassText
.SubClassExist
= TRUE
;
2436 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2440 Converts a text device path node to USB wireless device path structure.
2442 @param TextDeviceNode The input Text device path node.
2444 @return A pointer to the newly-created USB wireless device path structure.
2447 EFI_DEVICE_PATH_PROTOCOL
*
2448 DevPathFromTextUsbWireless (
2449 IN CHAR16
*TextDeviceNode
2452 USB_CLASS_TEXT UsbClassText
;
2454 UsbClassText
.ClassExist
= FALSE
;
2455 UsbClassText
.Class
= USB_CLASS_WIRELESS
;
2456 UsbClassText
.SubClassExist
= TRUE
;
2458 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2462 Converts a text device path node to USB device firmware update device path structure.
2464 @param TextDeviceNode The input Text device path node.
2466 @return A pointer to the newly-created USB device firmware update device path structure.
2469 EFI_DEVICE_PATH_PROTOCOL
*
2470 DevPathFromTextUsbDeviceFirmwareUpdate (
2471 IN CHAR16
*TextDeviceNode
2474 USB_CLASS_TEXT UsbClassText
;
2476 UsbClassText
.ClassExist
= FALSE
;
2477 UsbClassText
.Class
= USB_CLASS_RESERVE
;
2478 UsbClassText
.SubClassExist
= FALSE
;
2479 UsbClassText
.SubClass
= USB_SUBCLASS_FW_UPDATE
;
2481 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2485 Converts a text device path node to USB IRDA bridge device path structure.
2487 @param TextDeviceNode The input Text device path node.
2489 @return A pointer to the newly-created USB IRDA bridge device path structure.
2492 EFI_DEVICE_PATH_PROTOCOL
*
2493 DevPathFromTextUsbIrdaBridge (
2494 IN CHAR16
*TextDeviceNode
2497 USB_CLASS_TEXT UsbClassText
;
2499 UsbClassText
.ClassExist
= FALSE
;
2500 UsbClassText
.Class
= USB_CLASS_RESERVE
;
2501 UsbClassText
.SubClassExist
= FALSE
;
2502 UsbClassText
.SubClass
= USB_SUBCLASS_IRDA_BRIDGE
;
2504 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2508 Converts a text device path node to USB text and measurement device path structure.
2510 @param TextDeviceNode The input Text device path node.
2512 @return A pointer to the newly-created USB text and measurement device path structure.
2515 EFI_DEVICE_PATH_PROTOCOL
*
2516 DevPathFromTextUsbTestAndMeasurement (
2517 IN CHAR16
*TextDeviceNode
2520 USB_CLASS_TEXT UsbClassText
;
2522 UsbClassText
.ClassExist
= FALSE
;
2523 UsbClassText
.Class
= USB_CLASS_RESERVE
;
2524 UsbClassText
.SubClassExist
= FALSE
;
2525 UsbClassText
.SubClass
= USB_SUBCLASS_TEST
;
2527 return ConvertFromTextUsbClass (TextDeviceNode
, &UsbClassText
);
2531 Converts a text device path node to USB WWID device path structure.
2533 @param TextDeviceNode The input Text device path node.
2535 @return A pointer to the newly-created USB WWID device path structure.
2538 EFI_DEVICE_PATH_PROTOCOL
*
2539 DevPathFromTextUsbWwid (
2540 IN CHAR16
*TextDeviceNode
2545 CHAR16
*InterfaceNumStr
;
2546 CHAR16
*SerialNumberStr
;
2547 USB_WWID_DEVICE_PATH
*UsbWwid
;
2548 UINTN SerialNumberStrLen
;
2550 VIDStr
= GetNextParamStr (&TextDeviceNode
);
2551 PIDStr
= GetNextParamStr (&TextDeviceNode
);
2552 InterfaceNumStr
= GetNextParamStr (&TextDeviceNode
);
2553 SerialNumberStr
= GetNextParamStr (&TextDeviceNode
);
2554 SerialNumberStrLen
= StrLen (SerialNumberStr
);
2555 if (SerialNumberStrLen
>= 2 &&
2556 SerialNumberStr
[0] == L
'\"' &&
2557 SerialNumberStr
[SerialNumberStrLen
- 1] == L
'\"'
2559 SerialNumberStr
[SerialNumberStrLen
- 1] = L
'\0';
2561 SerialNumberStrLen
-= 2;
2563 UsbWwid
= (USB_WWID_DEVICE_PATH
*) CreateDeviceNode (
2564 MESSAGING_DEVICE_PATH
,
2566 (UINT16
) (sizeof (USB_WWID_DEVICE_PATH
) + SerialNumberStrLen
* sizeof (CHAR16
))
2568 UsbWwid
->VendorId
= (UINT16
) Strtoi (VIDStr
);
2569 UsbWwid
->ProductId
= (UINT16
) Strtoi (PIDStr
);
2570 UsbWwid
->InterfaceNumber
= (UINT16
) Strtoi (InterfaceNumStr
);
2571 StrnCpy ((CHAR16
*) ((UINT8
*) UsbWwid
+ sizeof (USB_WWID_DEVICE_PATH
)), SerialNumberStr
, SerialNumberStrLen
);
2573 return (EFI_DEVICE_PATH_PROTOCOL
*) UsbWwid
;
2577 Converts a text device path node to Logic Unit device path structure.
2579 @param TextDeviceNode The input Text device path node.
2581 @return A pointer to the newly-created Logic Unit device path structure.
2584 EFI_DEVICE_PATH_PROTOCOL
*
2585 DevPathFromTextUnit (
2586 IN CHAR16
*TextDeviceNode
2590 DEVICE_LOGICAL_UNIT_DEVICE_PATH
*LogicalUnit
;
2592 LunStr
= GetNextParamStr (&TextDeviceNode
);
2593 LogicalUnit
= (DEVICE_LOGICAL_UNIT_DEVICE_PATH
*) CreateDeviceNode (
2594 MESSAGING_DEVICE_PATH
,
2595 MSG_DEVICE_LOGICAL_UNIT_DP
,
2596 (UINT16
) sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH
)
2599 LogicalUnit
->Lun
= (UINT8
) Strtoi (LunStr
);
2601 return (EFI_DEVICE_PATH_PROTOCOL
*) LogicalUnit
;
2605 Converts a text device path node to iSCSI device path structure.
2607 @param TextDeviceNode The input Text device path node.
2609 @return A pointer to the newly-created iSCSI device path structure.
2612 EFI_DEVICE_PATH_PROTOCOL
*
2613 DevPathFromTextiSCSI (
2614 IN CHAR16
*TextDeviceNode
2619 CHAR16
*PortalGroupStr
;
2621 CHAR16
*HeaderDigestStr
;
2622 CHAR16
*DataDigestStr
;
2623 CHAR16
*AuthenticationStr
;
2624 CHAR16
*ProtocolStr
;
2626 ISCSI_DEVICE_PATH_WITH_NAME
*ISCSIDevPath
;
2628 NameStr
= GetNextParamStr (&TextDeviceNode
);
2629 PortalGroupStr
= GetNextParamStr (&TextDeviceNode
);
2630 LunStr
= GetNextParamStr (&TextDeviceNode
);
2631 HeaderDigestStr
= GetNextParamStr (&TextDeviceNode
);
2632 DataDigestStr
= GetNextParamStr (&TextDeviceNode
);
2633 AuthenticationStr
= GetNextParamStr (&TextDeviceNode
);
2634 ProtocolStr
= GetNextParamStr (&TextDeviceNode
);
2635 ISCSIDevPath
= (ISCSI_DEVICE_PATH_WITH_NAME
*) CreateDeviceNode (
2636 MESSAGING_DEVICE_PATH
,
2638 (UINT16
) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME
) + StrLen (NameStr
))
2641 AsciiStr
= ISCSIDevPath
->TargetName
;
2642 StrToAscii (NameStr
, &AsciiStr
);
2644 ISCSIDevPath
->TargetPortalGroupTag
= (UINT16
) Strtoi (PortalGroupStr
);
2645 Strtoi64 (LunStr
, &ISCSIDevPath
->Lun
);
2648 if (StrCmp (HeaderDigestStr
, L
"CRC32C") == 0) {
2652 if (StrCmp (DataDigestStr
, L
"CRC32C") == 0) {
2656 if (StrCmp (AuthenticationStr
, L
"None") == 0) {
2660 if (StrCmp (AuthenticationStr
, L
"CHAP_UNI") == 0) {
2664 ISCSIDevPath
->LoginOption
= (UINT16
) Options
;
2666 ISCSIDevPath
->NetworkProtocol
= (UINT16
) StrCmp (ProtocolStr
, L
"TCP");
2668 return (EFI_DEVICE_PATH_PROTOCOL
*) ISCSIDevPath
;
2672 Converts a text device path node to VLAN device path structure.
2674 @param TextDeviceNode The input Text device path node.
2676 @return A pointer to the newly-created VLAN device path structure.
2679 EFI_DEVICE_PATH_PROTOCOL
*
2680 DevPathFromTextVlan (
2681 IN CHAR16
*TextDeviceNode
2685 VLAN_DEVICE_PATH
*Vlan
;
2687 VlanStr
= GetNextParamStr (&TextDeviceNode
);
2688 Vlan
= (VLAN_DEVICE_PATH
*) CreateDeviceNode (
2689 MESSAGING_DEVICE_PATH
,
2691 (UINT16
) sizeof (VLAN_DEVICE_PATH
)
2694 Vlan
->VlanId
= (UINT16
) Strtoi (VlanStr
);
2696 return (EFI_DEVICE_PATH_PROTOCOL
*) Vlan
;
2700 Converts a media text device path node to media device path structure.
2702 @param TextDeviceNode The input Text device path node.
2704 @return A pointer to media device path structure.
2707 EFI_DEVICE_PATH_PROTOCOL
*
2708 DevPathFromTextMediaPath (
2709 IN CHAR16
*TextDeviceNode
2712 return DevPathFromTextGenericPath (MEDIA_DEVICE_PATH
, TextDeviceNode
);
2716 Converts a text device path node to HD device path structure.
2718 @param TextDeviceNode The input Text device path node.
2720 @return A pointer to the newly-created HD device path structure.
2723 EFI_DEVICE_PATH_PROTOCOL
*
2725 IN CHAR16
*TextDeviceNode
2728 CHAR16
*PartitionStr
;
2730 CHAR16
*SignatureStr
;
2734 EFI_GUID SignatureGuid
;
2735 HARDDRIVE_DEVICE_PATH
*Hd
;
2737 PartitionStr
= GetNextParamStr (&TextDeviceNode
);
2738 TypeStr
= GetNextParamStr (&TextDeviceNode
);
2739 SignatureStr
= GetNextParamStr (&TextDeviceNode
);
2740 StartStr
= GetNextParamStr (&TextDeviceNode
);
2741 SizeStr
= GetNextParamStr (&TextDeviceNode
);
2742 Hd
= (HARDDRIVE_DEVICE_PATH
*) CreateDeviceNode (
2745 (UINT16
) sizeof (HARDDRIVE_DEVICE_PATH
)
2748 Hd
->PartitionNumber
= (UINT32
) Strtoi (PartitionStr
);
2750 ZeroMem (Hd
->Signature
, 16);
2751 Hd
->MBRType
= (UINT8
) 0;
2753 if (StrCmp (TypeStr
, L
"MBR") == 0) {
2754 Hd
->SignatureType
= SIGNATURE_TYPE_MBR
;
2757 Signature32
= (UINT32
) Strtoi (SignatureStr
);
2758 CopyMem (Hd
->Signature
, &Signature32
, sizeof (UINT32
));
2759 } else if (StrCmp (TypeStr
, L
"GPT") == 0) {
2760 Hd
->SignatureType
= SIGNATURE_TYPE_GUID
;
2763 StrToGuid (SignatureStr
, &SignatureGuid
);
2764 CopyMem (Hd
->Signature
, &SignatureGuid
, sizeof (EFI_GUID
));
2766 Hd
->SignatureType
= (UINT8
) Strtoi (TypeStr
);
2769 Strtoi64 (StartStr
, &Hd
->PartitionStart
);
2770 Strtoi64 (SizeStr
, &Hd
->PartitionSize
);
2772 return (EFI_DEVICE_PATH_PROTOCOL
*) Hd
;
2776 Converts a text device path node to CDROM device path structure.
2778 @param TextDeviceNode The input Text device path node.
2780 @return A pointer to the newly-created CDROM device path structure.
2783 EFI_DEVICE_PATH_PROTOCOL
*
2784 DevPathFromTextCDROM (
2785 IN CHAR16
*TextDeviceNode
2791 CDROM_DEVICE_PATH
*CDROMDevPath
;
2793 EntryStr
= GetNextParamStr (&TextDeviceNode
);
2794 StartStr
= GetNextParamStr (&TextDeviceNode
);
2795 SizeStr
= GetNextParamStr (&TextDeviceNode
);
2796 CDROMDevPath
= (CDROM_DEVICE_PATH
*) CreateDeviceNode (
2799 (UINT16
) sizeof (CDROM_DEVICE_PATH
)
2802 CDROMDevPath
->BootEntry
= (UINT32
) Strtoi (EntryStr
);
2803 Strtoi64 (StartStr
, &CDROMDevPath
->PartitionStart
);
2804 Strtoi64 (SizeStr
, &CDROMDevPath
->PartitionSize
);
2806 return (EFI_DEVICE_PATH_PROTOCOL
*) CDROMDevPath
;
2810 Converts a text device path node to Vendor-defined media device path structure.
2812 @param TextDeviceNode The input Text device path node.
2814 @return A pointer to the newly-created Vendor-defined media device path structure.
2817 EFI_DEVICE_PATH_PROTOCOL
*
2818 DevPathFromTextVenMedia (
2819 IN CHAR16
*TextDeviceNode
2822 return ConvertFromTextVendor (
2830 Converts a text device path node to File device path structure.
2832 @param TextDeviceNode The input Text device path node.
2834 @return A pointer to the newly-created File device path structure.
2837 EFI_DEVICE_PATH_PROTOCOL
*
2838 DevPathFromTextFilePath (
2839 IN CHAR16
*TextDeviceNode
2842 FILEPATH_DEVICE_PATH
*File
;
2844 File
= (FILEPATH_DEVICE_PATH
*) CreateDeviceNode (
2847 (UINT16
) (sizeof (FILEPATH_DEVICE_PATH
) + StrLen (TextDeviceNode
) * 2)
2850 StrCpy (File
->PathName
, TextDeviceNode
);
2852 return (EFI_DEVICE_PATH_PROTOCOL
*) File
;
2856 Converts a text device path node to Media protocol device path structure.
2858 @param TextDeviceNode The input Text device path node.
2860 @return A pointer to the newly-created Media protocol device path structure.
2863 EFI_DEVICE_PATH_PROTOCOL
*
2864 DevPathFromTextMedia (
2865 IN CHAR16
*TextDeviceNode
2869 MEDIA_PROTOCOL_DEVICE_PATH
*Media
;
2871 GuidStr
= GetNextParamStr (&TextDeviceNode
);
2872 Media
= (MEDIA_PROTOCOL_DEVICE_PATH
*) CreateDeviceNode (
2875 (UINT16
) sizeof (MEDIA_PROTOCOL_DEVICE_PATH
)
2878 StrToGuid (GuidStr
, &Media
->Protocol
);
2880 return (EFI_DEVICE_PATH_PROTOCOL
*) Media
;
2884 Converts a text device path node to firmware volume device path structure.
2886 @param TextDeviceNode The input Text device path node.
2888 @return A pointer to the newly-created firmware volume device path structure.
2891 EFI_DEVICE_PATH_PROTOCOL
*
2893 IN CHAR16
*TextDeviceNode
2897 MEDIA_FW_VOL_DEVICE_PATH
*Fv
;
2899 GuidStr
= GetNextParamStr (&TextDeviceNode
);
2900 Fv
= (MEDIA_FW_VOL_DEVICE_PATH
*) CreateDeviceNode (
2902 MEDIA_PIWG_FW_VOL_DP
,
2903 (UINT16
) sizeof (MEDIA_FW_VOL_DEVICE_PATH
)
2906 StrToGuid (GuidStr
, &Fv
->FvName
);
2908 return (EFI_DEVICE_PATH_PROTOCOL
*) Fv
;
2912 Converts a text device path node to firmware file device path structure.
2914 @param TextDeviceNode The input Text device path node.
2916 @return A pointer to the newly-created firmware file device path structure.
2919 EFI_DEVICE_PATH_PROTOCOL
*
2920 DevPathFromTextFvFile (
2921 IN CHAR16
*TextDeviceNode
2925 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*FvFile
;
2927 GuidStr
= GetNextParamStr (&TextDeviceNode
);
2928 FvFile
= (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
*) CreateDeviceNode (
2930 MEDIA_PIWG_FW_FILE_DP
,
2931 (UINT16
) sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH
)
2934 StrToGuid (GuidStr
, &FvFile
->FvFileName
);
2936 return (EFI_DEVICE_PATH_PROTOCOL
*) FvFile
;
2940 Converts a text device path node to text relative offset device path structure.
2942 @param TextDeviceNode The input Text device path node.
2944 @return A pointer to the newly-created Text device path structure.
2947 EFI_DEVICE_PATH_PROTOCOL
*
2948 DevPathFromTextRelativeOffsetRange (
2949 IN CHAR16
*TextDeviceNode
2952 CHAR16
*StartingOffsetStr
;
2953 CHAR16
*EndingOffsetStr
;
2954 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*Offset
;
2956 StartingOffsetStr
= GetNextParamStr (&TextDeviceNode
);
2957 EndingOffsetStr
= GetNextParamStr (&TextDeviceNode
);
2958 Offset
= (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
*) CreateDeviceNode (
2960 MEDIA_RELATIVE_OFFSET_RANGE_DP
,
2961 (UINT16
) sizeof (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH
)
2964 Strtoi64 (StartingOffsetStr
, &Offset
->StartingOffset
);
2965 Strtoi64 (EndingOffsetStr
, &Offset
->EndingOffset
);
2967 return (EFI_DEVICE_PATH_PROTOCOL
*) Offset
;
2972 Converts a BBS text device path node to BBS device path structure.
2974 @param TextDeviceNode The input Text device path node.
2976 @return A pointer to BBS device path structure.
2979 EFI_DEVICE_PATH_PROTOCOL
*
2980 DevPathFromTextBbsPath (
2981 IN CHAR16
*TextDeviceNode
2984 return DevPathFromTextGenericPath (BBS_DEVICE_PATH
, TextDeviceNode
);
2988 Converts a text device path node to BIOS Boot Specification device path structure.
2990 @param TextDeviceNode The input Text device path node.
2992 @return A pointer to the newly-created BIOS Boot Specification device path structure.
2995 EFI_DEVICE_PATH_PROTOCOL
*
2996 DevPathFromTextBBS (
2997 IN CHAR16
*TextDeviceNode
3004 BBS_BBS_DEVICE_PATH
*Bbs
;
3006 TypeStr
= GetNextParamStr (&TextDeviceNode
);
3007 IdStr
= GetNextParamStr (&TextDeviceNode
);
3008 FlagsStr
= GetNextParamStr (&TextDeviceNode
);
3009 Bbs
= (BBS_BBS_DEVICE_PATH
*) CreateDeviceNode (
3012 (UINT16
) (sizeof (BBS_BBS_DEVICE_PATH
) + StrLen (IdStr
))
3015 if (StrCmp (TypeStr
, L
"Floppy") == 0) {
3016 Bbs
->DeviceType
= BBS_TYPE_FLOPPY
;
3017 } else if (StrCmp (TypeStr
, L
"HD") == 0) {
3018 Bbs
->DeviceType
= BBS_TYPE_HARDDRIVE
;
3019 } else if (StrCmp (TypeStr
, L
"CDROM") == 0) {
3020 Bbs
->DeviceType
= BBS_TYPE_CDROM
;
3021 } else if (StrCmp (TypeStr
, L
"PCMCIA") == 0) {
3022 Bbs
->DeviceType
= BBS_TYPE_PCMCIA
;
3023 } else if (StrCmp (TypeStr
, L
"USB") == 0) {
3024 Bbs
->DeviceType
= BBS_TYPE_USB
;
3025 } else if (StrCmp (TypeStr
, L
"Network") == 0) {
3026 Bbs
->DeviceType
= BBS_TYPE_EMBEDDED_NETWORK
;
3028 Bbs
->DeviceType
= (UINT16
) Strtoi (TypeStr
);
3031 AsciiStr
= Bbs
->String
;
3032 StrToAscii (IdStr
, &AsciiStr
);
3034 Bbs
->StatusFlag
= (UINT16
) Strtoi (FlagsStr
);
3036 return (EFI_DEVICE_PATH_PROTOCOL
*) Bbs
;
3040 Converts a text device path node to SATA device path structure.
3042 @param TextDeviceNode The input Text device path node.
3044 @return A pointer to the newly-created SATA device path structure.
3047 EFI_DEVICE_PATH_PROTOCOL
*
3048 DevPathFromTextSata (
3049 IN CHAR16
*TextDeviceNode
3052 SATA_DEVICE_PATH
*Sata
;
3057 Param1
= GetNextParamStr (&TextDeviceNode
);
3058 Param2
= GetNextParamStr (&TextDeviceNode
);
3059 Param3
= GetNextParamStr (&TextDeviceNode
);
3061 Sata
= (SATA_DEVICE_PATH
*) CreateDeviceNode (
3062 MESSAGING_DEVICE_PATH
,
3064 (UINT16
) sizeof (SATA_DEVICE_PATH
)
3066 Sata
->HBAPortNumber
= (UINT16
) Strtoi (Param1
);
3067 Sata
->PortMultiplierPortNumber
= (UINT16
) Strtoi (Param2
);
3068 Sata
->Lun
= (UINT16
) Strtoi (Param3
);
3070 return (EFI_DEVICE_PATH_PROTOCOL
*) Sata
;
3073 GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevPathFromTextTable
[] = {
3074 {L
"Path", DevPathFromTextPath
},
3076 {L
"HardwarePath", DevPathFromTextHardwarePath
},
3077 {L
"Pci", DevPathFromTextPci
},
3078 {L
"PcCard", DevPathFromTextPcCard
},
3079 {L
"MemoryMapped", DevPathFromTextMemoryMapped
},
3080 {L
"VenHw", DevPathFromTextVenHw
},
3081 {L
"Ctrl", DevPathFromTextCtrl
},
3083 {L
"AcpiPath", DevPathFromTextAcpiPath
},
3084 {L
"Acpi", DevPathFromTextAcpi
},
3085 {L
"PciRoot", DevPathFromTextPciRoot
},
3086 {L
"PcieRoot", DevPathFromTextPcieRoot
},
3087 {L
"Floppy", DevPathFromTextFloppy
},
3088 {L
"Keyboard", DevPathFromTextKeyboard
},
3089 {L
"Serial", DevPathFromTextSerial
},
3090 {L
"ParallelPort", DevPathFromTextParallelPort
},
3091 {L
"AcpiEx", DevPathFromTextAcpiEx
},
3092 {L
"AcpiExp", DevPathFromTextAcpiExp
},
3093 {L
"AcpiAdr", DevPathFromTextAcpiAdr
},
3095 {L
"Msg", DevPathFromTextMsg
},
3096 {L
"Ata", DevPathFromTextAta
},
3097 {L
"Scsi", DevPathFromTextScsi
},
3098 {L
"Fibre", DevPathFromTextFibre
},
3099 {L
"FibreEx", DevPathFromTextFibreEx
},
3100 {L
"I1394", DevPathFromText1394
},
3101 {L
"USB", DevPathFromTextUsb
},
3102 {L
"I2O", DevPathFromTextI2O
},
3103 {L
"Infiniband", DevPathFromTextInfiniband
},
3104 {L
"VenMsg", DevPathFromTextVenMsg
},
3105 {L
"VenPcAnsi", DevPathFromTextVenPcAnsi
},
3106 {L
"VenVt100", DevPathFromTextVenVt100
},
3107 {L
"VenVt100Plus", DevPathFromTextVenVt100Plus
},
3108 {L
"VenUtf8", DevPathFromTextVenUtf8
},
3109 {L
"UartFlowCtrl", DevPathFromTextUartFlowCtrl
},
3110 {L
"SAS", DevPathFromTextSAS
},
3111 {L
"SasEx", DevPathFromTextSasEx
},
3112 {L
"NVMe", DevPathFromTextNVMe
},
3113 {L
"UFS", DevPathFromTextUfs
},
3114 {L
"DebugPort", DevPathFromTextDebugPort
},
3115 {L
"MAC", DevPathFromTextMAC
},
3116 {L
"IPv4", DevPathFromTextIPv4
},
3117 {L
"IPv6", DevPathFromTextIPv6
},
3118 {L
"Uart", DevPathFromTextUart
},
3119 {L
"UsbClass", DevPathFromTextUsbClass
},
3120 {L
"UsbAudio", DevPathFromTextUsbAudio
},
3121 {L
"UsbCDCControl", DevPathFromTextUsbCDCControl
},
3122 {L
"UsbHID", DevPathFromTextUsbHID
},
3123 {L
"UsbImage", DevPathFromTextUsbImage
},
3124 {L
"UsbPrinter", DevPathFromTextUsbPrinter
},
3125 {L
"UsbMassStorage", DevPathFromTextUsbMassStorage
},
3126 {L
"UsbHub", DevPathFromTextUsbHub
},
3127 {L
"UsbCDCData", DevPathFromTextUsbCDCData
},
3128 {L
"UsbSmartCard", DevPathFromTextUsbSmartCard
},
3129 {L
"UsbVideo", DevPathFromTextUsbVideo
},
3130 {L
"UsbDiagnostic", DevPathFromTextUsbDiagnostic
},
3131 {L
"UsbWireless", DevPathFromTextUsbWireless
},
3132 {L
"UsbDeviceFirmwareUpdate", DevPathFromTextUsbDeviceFirmwareUpdate
},
3133 {L
"UsbIrdaBridge", DevPathFromTextUsbIrdaBridge
},
3134 {L
"UsbTestAndMeasurement", DevPathFromTextUsbTestAndMeasurement
},
3135 {L
"UsbWwid", DevPathFromTextUsbWwid
},
3136 {L
"Unit", DevPathFromTextUnit
},
3137 {L
"iSCSI", DevPathFromTextiSCSI
},
3138 {L
"Vlan", DevPathFromTextVlan
},
3140 {L
"MediaPath", DevPathFromTextMediaPath
},
3141 {L
"HD", DevPathFromTextHD
},
3142 {L
"CDROM", DevPathFromTextCDROM
},
3143 {L
"VenMedia", DevPathFromTextVenMedia
},
3144 {L
"Media", DevPathFromTextMedia
},
3145 {L
"Fv", DevPathFromTextFv
},
3146 {L
"FvFile", DevPathFromTextFvFile
},
3147 {L
"Offset", DevPathFromTextRelativeOffsetRange
},
3149 {L
"BbsPath", DevPathFromTextBbsPath
},
3150 {L
"BBS", DevPathFromTextBBS
},
3151 {L
"Sata", DevPathFromTextSata
},
3156 Convert text to the binary representation of a device node.
3158 @param TextDeviceNode TextDeviceNode points to the text representation of a device
3159 node. Conversion starts with the first character and continues
3160 until the first non-device node character.
3162 @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
3163 insufficient memory or text unsupported.
3166 EFI_DEVICE_PATH_PROTOCOL
*
3168 UefiDevicePathLibConvertTextToDeviceNode (
3169 IN CONST CHAR16
*TextDeviceNode
3172 DEVICE_PATH_FROM_TEXT FromText
;
3174 EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
;
3175 CHAR16
*DeviceNodeStr
;
3178 if ((TextDeviceNode
== NULL
) || (IS_NULL (*TextDeviceNode
))) {
3184 DeviceNodeStr
= UefiDevicePathLibStrDuplicate (TextDeviceNode
);
3185 ASSERT (DeviceNodeStr
!= NULL
);
3187 for (Index
= 0; mUefiDevicePathLibDevPathFromTextTable
[Index
].Function
!= NULL
; Index
++) {
3188 ParamStr
= GetParamByNodeName (DeviceNodeStr
, mUefiDevicePathLibDevPathFromTextTable
[Index
].DevicePathNodeText
);
3189 if (ParamStr
!= NULL
) {
3190 FromText
= mUefiDevicePathLibDevPathFromTextTable
[Index
].Function
;
3195 if (FromText
== NULL
) {
3199 FromText
= DevPathFromTextFilePath
;
3200 DeviceNode
= FromText (DeviceNodeStr
);
3202 DeviceNode
= FromText (ParamStr
);
3203 FreePool (ParamStr
);
3206 FreePool (DeviceNodeStr
);
3212 Convert text to the binary representation of a device path.
3215 @param TextDevicePath TextDevicePath points to the text representation of a device
3216 path. Conversion starts with the first character and continues
3217 until the first non-device node character.
3219 @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
3220 there was insufficient memory.
3223 EFI_DEVICE_PATH_PROTOCOL
*
3225 UefiDevicePathLibConvertTextToDevicePath (
3226 IN CONST CHAR16
*TextDevicePath
3229 EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
;
3230 EFI_DEVICE_PATH_PROTOCOL
*NewDevicePath
;
3231 CHAR16
*DevicePathStr
;
3233 CHAR16
*DeviceNodeStr
;
3234 BOOLEAN IsInstanceEnd
;
3235 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
3237 if ((TextDevicePath
== NULL
) || (IS_NULL (*TextDevicePath
))) {
3241 DevicePath
= (EFI_DEVICE_PATH_PROTOCOL
*) AllocatePool (END_DEVICE_PATH_LENGTH
);
3242 ASSERT (DevicePath
!= NULL
);
3243 SetDevicePathEndNode (DevicePath
);
3245 DevicePathStr
= UefiDevicePathLibStrDuplicate (TextDevicePath
);
3247 Str
= DevicePathStr
;
3248 while ((DeviceNodeStr
= GetNextDeviceNodeStr (&Str
, &IsInstanceEnd
)) != NULL
) {
3249 DeviceNode
= UefiDevicePathLibConvertTextToDeviceNode (DeviceNodeStr
);
3251 NewDevicePath
= AppendDevicePathNode (DevicePath
, DeviceNode
);
3252 FreePool (DevicePath
);
3253 FreePool (DeviceNode
);
3254 DevicePath
= NewDevicePath
;
3256 if (IsInstanceEnd
) {
3257 DeviceNode
= (EFI_DEVICE_PATH_PROTOCOL
*) AllocatePool (END_DEVICE_PATH_LENGTH
);
3258 ASSERT (DeviceNode
!= NULL
);
3259 SetDevicePathEndNode (DeviceNode
);
3261 NewDevicePath
= AppendDevicePathNode (DevicePath
, DeviceNode
);
3262 FreePool (DevicePath
);
3263 FreePool (DeviceNode
);
3264 DevicePath
= NewDevicePath
;
3268 FreePool (DevicePathStr
);