Removing IsaSerailDxe driver instead of removing the TerminalDxe driver when source...
[mirror_edk2.git] / MdeModulePkg / Universal / DevicePathDxe / DevicePathFromText.c
CommitLineData
13d40edd 1/** @file\r
2 DevicePathFromText protocol as defined in the UEFI 2.0 specification.\r
95276127 3\r
5b84091f 4Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 5This program and the accompanying materials\r
13d40edd 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
95276127 9\r
13d40edd 10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
95276127 12\r
13d40edd 13**/\r
95276127 14\r
95276127 15#include "DevicePath.h"\r
16\r
95276127 17\r
572f5d8a 18/**\r
95276127 19\r
572f5d8a 20 Duplicates a string.\r
95276127 21\r
572f5d8a 22 @param Src Source string.\r
95276127 23\r
572f5d8a 24 @return The duplicated string.\r
25\r
26**/\r
27CHAR16 *\r
28StrDuplicate (\r
29 IN CONST CHAR16 *Src\r
30 )\r
95276127 31{\r
572f5d8a 32 return AllocateCopyPool (StrSize (Src), Src);\r
33}\r
95276127 34\r
572f5d8a 35/**\r
95276127 36\r
572f5d8a 37 Get parameter in a pair of parentheses follow the given node name.\r
38 For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1".\r
95276127 39\r
572f5d8a 40 @param Str Device Path Text.\r
41 @param NodeName Name of the node.\r
95276127 42\r
572f5d8a 43 @return Parameter text for the node.\r
44\r
45**/\r
95276127 46CHAR16 *\r
47GetParamByNodeName (\r
48 IN CHAR16 *Str,\r
49 IN CHAR16 *NodeName\r
50 )\r
95276127 51{\r
52 CHAR16 *ParamStr;\r
53 CHAR16 *StrPointer;\r
54 UINTN NodeNameLength;\r
55 UINTN ParameterLength;\r
56\r
57 //\r
58 // Check whether the node name matchs\r
59 //\r
60 NodeNameLength = StrLen (NodeName);\r
61 if (CompareMem (Str, NodeName, NodeNameLength * sizeof (CHAR16)) != 0) {\r
62 return NULL;\r
63 }\r
64\r
65 ParamStr = Str + NodeNameLength;\r
66 if (!IS_LEFT_PARENTH (*ParamStr)) {\r
67 return NULL;\r
68 }\r
69\r
70 //\r
71 // Skip the found '(' and find first occurrence of ')'\r
72 //\r
73 ParamStr++;\r
74 ParameterLength = 0;\r
75 StrPointer = ParamStr;\r
76 while (!IS_NULL (*StrPointer)) {\r
77 if (IS_RIGHT_PARENTH (*StrPointer)) {\r
78 break;\r
79 }\r
80 StrPointer++;\r
81 ParameterLength++;\r
82 }\r
83 if (IS_NULL (*StrPointer)) {\r
84 //\r
85 // ')' not found\r
86 //\r
87 return NULL;\r
88 }\r
89\r
90 ParamStr = AllocateCopyPool ((ParameterLength + 1) * sizeof (CHAR16), ParamStr);\r
91 if (ParamStr == NULL) {\r
92 return NULL;\r
93 }\r
94 //\r
95 // Terminate the parameter string\r
96 //\r
97 ParamStr[ParameterLength] = L'\0';\r
98\r
99 return ParamStr;\r
100}\r
101\r
572f5d8a 102/**\r
103 Gets current sub-string from a string list, before return\r
104 the list header is moved to next sub-string. The sub-string is separated\r
105 by the specified character. For example, the separator is ',', the string\r
106 list is "2,0,3", it returns "2", the remain list move to "0,3"\r
107\r
108 @param List A string list separated by the specified separator\r
109 @param Separator The separator character\r
110\r
111 @return A pointer to the current sub-string\r
112\r
113**/\r
95276127 114CHAR16 *\r
115SplitStr (\r
116 IN OUT CHAR16 **List,\r
117 IN CHAR16 Separator\r
118 )\r
95276127 119{\r
120 CHAR16 *Str;\r
121 CHAR16 *ReturnStr;\r
122\r
123 Str = *List;\r
124 ReturnStr = Str;\r
125\r
126 if (IS_NULL (*Str)) {\r
127 return ReturnStr;\r
128 }\r
129\r
130 //\r
131 // Find first occurrence of the separator\r
132 //\r
133 while (!IS_NULL (*Str)) {\r
134 if (*Str == Separator) {\r
135 break;\r
136 }\r
137 Str++;\r
138 }\r
139\r
140 if (*Str == Separator) {\r
141 //\r
142 // Find a sub-string, terminate it\r
143 //\r
144 *Str = L'\0';\r
145 Str++;\r
146 }\r
147\r
148 //\r
149 // Move to next sub-string\r
150 //\r
151 *List = Str;\r
152\r
153 return ReturnStr;\r
154}\r
155\r
572f5d8a 156/**\r
157 Gets the next parameter string from the list.\r
158\r
159 @param List A string list separated by the specified separator\r
160\r
161 @return A pointer to the current sub-string\r
162\r
163**/\r
95276127 164CHAR16 *\r
165GetNextParamStr (\r
166 IN OUT CHAR16 **List\r
167 )\r
168{\r
169 //\r
170 // The separator is comma\r
171 //\r
172 return SplitStr (List, L',');\r
173}\r
174\r
572f5d8a 175/**\r
176 Get one device node from entire device path text.\r
177\r
178 @param DevicePath On input, the current Device Path node; on output, the next device path node\r
179 @param IsInstanceEnd This node is the end of a device path instance\r
180\r
181 @return A device node text or NULL if no more device node available\r
182\r
183**/\r
95276127 184CHAR16 *\r
185GetNextDeviceNodeStr (\r
186 IN OUT CHAR16 **DevicePath,\r
187 OUT BOOLEAN *IsInstanceEnd\r
188 )\r
95276127 189{\r
190 CHAR16 *Str;\r
191 CHAR16 *ReturnStr;\r
192 UINTN ParenthesesStack;\r
193\r
194 Str = *DevicePath;\r
195 if (IS_NULL (*Str)) {\r
196 return NULL;\r
197 }\r
198\r
199 //\r
200 // Skip the leading '/', '(', ')' and ','\r
201 //\r
202 while (!IS_NULL (*Str)) {\r
203 if (!IS_SLASH (*Str) &&\r
204 !IS_COMMA (*Str) &&\r
205 !IS_LEFT_PARENTH (*Str) &&\r
206 !IS_RIGHT_PARENTH (*Str)) {\r
207 break;\r
208 }\r
209 Str++;\r
210 }\r
211\r
212 ReturnStr = Str;\r
213\r
214 //\r
215 // Scan for the separator of this device node, '/' or ','\r
216 //\r
217 ParenthesesStack = 0;\r
218 while (!IS_NULL (*Str)) {\r
219 if ((IS_COMMA (*Str) || IS_SLASH (*Str)) && (ParenthesesStack == 0)) {\r
220 break;\r
221 }\r
222\r
223 if (IS_LEFT_PARENTH (*Str)) {\r
224 ParenthesesStack++;\r
225 } else if (IS_RIGHT_PARENTH (*Str)) {\r
226 ParenthesesStack--;\r
227 }\r
228\r
229 Str++;\r
230 }\r
231\r
232 if (ParenthesesStack != 0) {\r
233 //\r
234 // The '(' doesn't pair with ')', invalid device path text\r
235 //\r
236 return NULL;\r
237 }\r
238\r
239 if (IS_COMMA (*Str)) {\r
240 *IsInstanceEnd = TRUE;\r
241 *Str = L'\0';\r
242 Str++;\r
243 } else {\r
244 *IsInstanceEnd = FALSE;\r
245 if (!IS_NULL (*Str)) {\r
246 *Str = L'\0';\r
247 Str++;\r
248 }\r
249 }\r
250\r
251 *DevicePath = Str;\r
252\r
253 return ReturnStr;\r
254}\r
255\r
95276127 256\r
572f5d8a 257/**\r
258 Skip the leading white space and '0x' or '0X' of a integer string\r
259\r
260 @param Str The integer string\r
261 @param IsHex TRUE: Hex string, FALSE: Decimal string\r
262\r
263 @return The trimmed Hex string.\r
264\r
265**/\r
95276127 266CHAR16 *\r
267TrimHexStr (\r
cf40f28a 268 IN CHAR16 *Str,\r
269 OUT BOOLEAN *IsHex\r
95276127 270 )\r
95276127 271{\r
cf40f28a 272 *IsHex = FALSE;\r
273\r
95276127 274 //\r
275 // skip preceeding white space\r
276 //\r
572f5d8a 277 while ((*Str != 0) && *Str == ' ') {\r
95276127 278 Str += 1;\r
279 }\r
280 //\r
281 // skip preceeding zeros\r
282 //\r
572f5d8a 283 while ((*Str != 0) && *Str == '0') {\r
95276127 284 Str += 1;\r
285 }\r
286 //\r
287 // skip preceeding character 'x' or 'X'\r
288 //\r
572f5d8a 289 if ((*Str != 0) && (*Str == 'x' || *Str == 'X')) {\r
95276127 290 Str += 1;\r
cf40f28a 291 *IsHex = TRUE;\r
95276127 292 }\r
293\r
294 return Str;\r
295}\r
296\r
572f5d8a 297/**\r
95276127 298\r
572f5d8a 299 Convert hex string to uint.\r
95276127 300\r
572f5d8a 301 @param Str The hex string\r
95276127 302\r
572f5d8a 303 @return A UINTN value represented by Str\r
95276127 304\r
572f5d8a 305**/\r
306UINTN\r
307Xtoi (\r
308 IN CHAR16 *Str\r
309 )\r
95276127 310{\r
ac7e320c 311 return StrHexToUintn (Str);\r
95276127 312}\r
313\r
572f5d8a 314/**\r
95276127 315\r
316 Convert hex string to 64 bit data.\r
317\r
572f5d8a 318 @param Str The hex string\r
319 @param Data A pointer to the UINT64 value represented by Str\r
95276127 320\r
572f5d8a 321**/\r
322VOID\r
323Xtoi64 (\r
324 IN CHAR16 *Str,\r
325 OUT UINT64 *Data\r
326 )\r
95276127 327{\r
ac7e320c 328 *Data = StrHexToUint64 (Str);\r
95276127 329}\r
330\r
572f5d8a 331/**\r
95276127 332\r
572f5d8a 333 Convert decimal string to uint.\r
95276127 334\r
572f5d8a 335 @param Str The decimal string\r
95276127 336\r
572f5d8a 337 @return A UINTN value represented by Str\r
95276127 338\r
572f5d8a 339**/\r
340UINTN\r
341Dtoi (\r
342 IN CHAR16 *Str\r
343 )\r
95276127 344{\r
345 UINTN Rvalue;\r
346 CHAR16 Char;\r
347 UINTN High;\r
348 UINTN Low;\r
349\r
572f5d8a 350 ASSERT (Str != NULL);\r
95276127 351\r
352 High = (UINTN) -1 / 10;\r
353 Low = (UINTN) -1 % 10;\r
354 //\r
355 // skip preceeding white space\r
356 //\r
572f5d8a 357 while ((*Str != 0) && *Str == ' ') {\r
358 Str += 1;\r
95276127 359 }\r
360 //\r
361 // convert digits\r
362 //\r
363 Rvalue = 0;\r
572f5d8a 364 Char = *(Str++);\r
365 while (Char != 0) {\r
95276127 366 if (Char >= '0' && Char <= '9') {\r
367 if ((Rvalue > High || Rvalue == High) && (Char - '0' > (INTN) Low)) {\r
368 return (UINTN) -1;\r
369 }\r
370\r
371 Rvalue = (Rvalue * 10) + Char - '0';\r
372 } else {\r
373 break;\r
374 }\r
375\r
572f5d8a 376 Char = *(Str++);\r
95276127 377 }\r
378\r
379 return Rvalue;\r
380}\r
381\r
572f5d8a 382/**\r
383\r
384 Convert decimal string to uint.\r
385\r
386 @param Str The decimal string\r
387 @param Data A pointer to the UINT64 value represented by Str\r
388\r
389**/\r
cf40f28a 390VOID\r
391Dtoi64 (\r
572f5d8a 392 IN CHAR16 *Str,\r
cf40f28a 393 OUT UINT64 *Data\r
394 )\r
cf40f28a 395{\r
396 UINT64 Rvalue;\r
397 CHAR16 Char;\r
398 UINT64 High;\r
399 UINT64 Low;\r
400\r
572f5d8a 401 ASSERT (Str != NULL);\r
cf40f28a 402 ASSERT (Data != NULL);\r
403\r
404 //\r
405 // skip preceeding white space\r
406 //\r
572f5d8a 407 while ((*Str != 0) && *Str == ' ') {\r
408 Str += 1;\r
cf40f28a 409 }\r
410 //\r
411 // convert digits\r
412 //\r
413 Rvalue = 0;\r
572f5d8a 414 Char = *(Str++);\r
415 while (Char != 0) {\r
cf40f28a 416 if (Char >= '0' && Char <= '9') {\r
417 High = LShiftU64 (Rvalue, 3);\r
418 Low = LShiftU64 (Rvalue, 1);\r
419 Rvalue = High + Low + Char - '0';\r
420 } else {\r
421 break;\r
422 }\r
423\r
572f5d8a 424 Char = *(Str++);\r
cf40f28a 425 }\r
426\r
427 *Data = Rvalue;\r
428}\r
429\r
572f5d8a 430/**\r
cf40f28a 431\r
432 Convert integer string to uint.\r
433\r
5755841f 434 @param Str The integer string. If leading with "0x" or "0X", it's hexadecimal.\r
cf40f28a 435\r
572f5d8a 436 @return A UINTN value represented by Str\r
cf40f28a 437\r
572f5d8a 438**/\r
439UINTN\r
440Strtoi (\r
441 IN CHAR16 *Str\r
442 )\r
cf40f28a 443{\r
444 BOOLEAN IsHex;\r
445\r
446 Str = TrimHexStr (Str, &IsHex);\r
447\r
448 if (IsHex) {\r
449 return Xtoi (Str);\r
450 } else {\r
451 return Dtoi (Str);\r
452 }\r
453}\r
454\r
572f5d8a 455/**\r
cf40f28a 456\r
457 Convert integer string to 64 bit data.\r
458\r
5755841f 459 @param Str The integer string. If leading with "0x" or "0X", it's hexadecimal.\r
572f5d8a 460 @param Data A pointer to the UINT64 value represented by Str\r
cf40f28a 461\r
572f5d8a 462**/\r
463VOID\r
464Strtoi64 (\r
465 IN CHAR16 *Str,\r
466 OUT UINT64 *Data\r
467 )\r
cf40f28a 468{\r
469 BOOLEAN IsHex;\r
470\r
471 Str = TrimHexStr (Str, &IsHex);\r
472\r
473 if (IsHex) {\r
474 Xtoi64 (Str, Data);\r
475 } else {\r
476 Dtoi64 (Str, Data);\r
477 }\r
478}\r
479\r
572f5d8a 480/**\r
481 Converts a list of string to a specified buffer.\r
482\r
483 @param Buf The output buffer that contains the string.\r
484 @param BufferLength The length of the buffer\r
485 @param Str The input string that contains the hex number\r
486\r
487 @retval EFI_SUCCESS The string was successfully converted to the buffer.\r
488\r
489**/\r
490EFI_STATUS\r
95276127 491StrToBuf (\r
492 OUT UINT8 *Buf,\r
493 IN UINTN BufferLength,\r
494 IN CHAR16 *Str\r
495 )\r
496{\r
497 UINTN Index;\r
498 UINTN StrLength;\r
499 UINT8 Digit;\r
500 UINT8 Byte;\r
501\r
6ee5bbdd 502 Digit = 0;\r
503\r
95276127 504 //\r
505 // Two hex char make up one byte\r
506 //\r
507 StrLength = BufferLength * sizeof (CHAR16);\r
508\r
509 for(Index = 0; Index < StrLength; Index++, Str++) {\r
510\r
ac7e320c
LG
511 if ((*Str >= L'a') && (*Str <= L'f')) {\r
512 Digit = (UINT8) (*Str - L'a' + 0x0A);\r
513 } else if ((*Str >= L'A') && (*Str <= L'F')) {\r
514 Digit = (UINT8) (*Str - L'A' + 0x0A);\r
515 } else if ((*Str >= L'0') && (*Str <= L'9')) {\r
516 Digit = (UINT8) (*Str - L'0');\r
517 } else {\r
518 return EFI_INVALID_PARAMETER;\r
519 }\r
95276127 520\r
521 //\r
5755841f 522 // For odd characters, write the upper nibble for each buffer byte,\r
95276127 523 // and for even characters, the lower nibble.\r
524 //\r
525 if ((Index & 1) == 0) {\r
526 Byte = (UINT8) (Digit << 4);\r
527 } else {\r
528 Byte = Buf[Index / 2];\r
529 Byte &= 0xF0;\r
530 Byte = (UINT8) (Byte | Digit);\r
531 }\r
532\r
533 Buf[Index / 2] = Byte;\r
534 }\r
535\r
536 return EFI_SUCCESS;\r
537}\r
538\r
572f5d8a 539/**\r
540 Converts a string to GUID value.\r
ac7e320c 541 Guid Format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\r
572f5d8a 542\r
543 @param Str The registry format GUID string that contains the GUID value.\r
544 @param Guid A pointer to the converted GUID value.\r
545\r
546 @retval EFI_SUCCESS The GUID string was successfully converted to the GUID value.\r
547 @retval EFI_UNSUPPORTED The input string is not in registry format.\r
548 @return others Some error occurred when converting part of GUID value.\r
549\r
550**/\r
95276127 551EFI_STATUS\r
552StrToGuid (\r
553 IN CHAR16 *Str,\r
554 OUT EFI_GUID *Guid\r
555 )\r
556{\r
ac7e320c
LG
557 //\r
558 // Get the first UINT32 data\r
559 //\r
560 Guid->Data1 = (UINT32) StrHexToUint64 (Str);\r
561 while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
562 Str ++;\r
95276127 563 }\r
ac7e320c 564 \r
95276127 565 if (IS_HYPHEN (*Str)) {\r
572f5d8a 566 Str++;\r
95276127 567 } else {\r
568 return EFI_UNSUPPORTED;\r
569 }\r
ac7e320c
LG
570 \r
571 //\r
572 // Get the second UINT16 data\r
573 //\r
574 Guid->Data2 = (UINT16) StrHexToUint64 (Str);\r
575 while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
576 Str ++;\r
95276127 577 }\r
ac7e320c 578\r
95276127 579 if (IS_HYPHEN (*Str)) {\r
580 Str++;\r
581 } else {\r
582 return EFI_UNSUPPORTED;\r
583 }\r
ac7e320c
LG
584 \r
585 //\r
586 // Get the third UINT16 data\r
587 //\r
588 Guid->Data3 = (UINT16) StrHexToUint64 (Str);\r
589 while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
590 Str ++;\r
95276127 591 }\r
ac7e320c 592\r
95276127 593 if (IS_HYPHEN (*Str)) {\r
594 Str++;\r
595 } else {\r
596 return EFI_UNSUPPORTED;\r
597 }\r
598\r
ac7e320c 599 //\r
5755841f 600 // Get the following 8 bytes data\r
ac7e320c 601 // \r
95276127 602 StrToBuf (&Guid->Data4[0], 2, Str);\r
603 //\r
604 // Skip 2 byte hex chars\r
605 //\r
606 Str += 2 * 2;\r
607\r
608 if (IS_HYPHEN (*Str)) {\r
609 Str++;\r
610 } else {\r
611 return EFI_UNSUPPORTED;\r
612 }\r
613 StrToBuf (&Guid->Data4[2], 6, Str);\r
614\r
615 return EFI_SUCCESS;\r
616}\r
617\r
572f5d8a 618/**\r
619 Converts a string to IPv4 address\r
620\r
621 @param Str A string representation of IPv4 address.\r
622 @param IPv4Addr A pointer to the converted IPv4 address.\r
623\r
624**/\r
95276127 625VOID\r
626StrToIPv4Addr (\r
627 IN OUT CHAR16 **Str,\r
628 OUT EFI_IPv4_ADDRESS *IPv4Addr\r
629 )\r
630{\r
631 UINTN Index;\r
632\r
633 for (Index = 0; Index < 4; Index++) {\r
cf40f28a 634 IPv4Addr->Addr[Index] = (UINT8) Dtoi (SplitStr (Str, L'.'));\r
95276127 635 }\r
636}\r
637\r
572f5d8a 638/**\r
639 Converts a string to IPv4 address\r
640\r
641 @param Str A string representation of IPv6 address.\r
642 @param IPv6Addr A pointer to the converted IPv6 address.\r
643\r
644**/\r
95276127 645VOID\r
646StrToIPv6Addr (\r
647 IN OUT CHAR16 **Str,\r
648 OUT EFI_IPv6_ADDRESS *IPv6Addr\r
649 )\r
650{\r
651 UINTN Index;\r
652 UINT16 Data;\r
653\r
654 for (Index = 0; Index < 8; Index++) {\r
655 Data = (UINT16) Xtoi (SplitStr (Str, L':'));\r
656 IPv6Addr->Addr[Index * 2] = (UINT8) (Data >> 8);\r
657 IPv6Addr->Addr[Index * 2 + 1] = (UINT8) (Data & 0xff);\r
658 }\r
659}\r
660\r
572f5d8a 661/**\r
662 Converts a Unicode string to ASCII string.\r
663\r
5755841f 664 @param Str The equivalent Unicode string\r
572f5d8a 665 @param AsciiStr On input, it points to destination ASCII string buffer; on output, it points\r
666 to the next ASCII string next to it\r
667\r
668**/\r
95276127 669VOID\r
670StrToAscii (\r
671 IN CHAR16 *Str,\r
672 IN OUT CHAR8 **AsciiStr\r
673 )\r
674{\r
675 CHAR8 *Dest;\r
676\r
677 Dest = *AsciiStr;\r
678 while (!IS_NULL (*Str)) {\r
679 *(Dest++) = (CHAR8) *(Str++);\r
680 }\r
681 *Dest = 0;\r
682\r
683 //\r
684 // Return the string next to it\r
685 //\r
686 *AsciiStr = Dest + 1;\r
687}\r
688\r
572f5d8a 689/**\r
690 Converts a text device path node to Hardware PCI device path structure.\r
691\r
692 @param TextDeviceNode The input Text device path node.\r
693\r
694 @return A pointer to Hardware PCI device path structure.\r
695\r
696**/\r
95276127 697EFI_DEVICE_PATH_PROTOCOL *\r
698DevPathFromTextPci (\r
699 IN CHAR16 *TextDeviceNode\r
700 )\r
701{\r
702 CHAR16 *FunctionStr;\r
703 CHAR16 *DeviceStr;\r
704 PCI_DEVICE_PATH *Pci;\r
705\r
95276127 706 DeviceStr = GetNextParamStr (&TextDeviceNode);\r
cf40f28a 707 FunctionStr = GetNextParamStr (&TextDeviceNode);\r
95276127 708 Pci = (PCI_DEVICE_PATH *) CreateDeviceNode (\r
709 HARDWARE_DEVICE_PATH,\r
710 HW_PCI_DP,\r
c9325700 711 (UINT16) sizeof (PCI_DEVICE_PATH)\r
95276127 712 );\r
713\r
cf40f28a 714 Pci->Function = (UINT8) Strtoi (FunctionStr);\r
715 Pci->Device = (UINT8) Strtoi (DeviceStr);\r
95276127 716\r
717 return (EFI_DEVICE_PATH_PROTOCOL *) Pci;\r
718}\r
719\r
572f5d8a 720/**\r
721 Converts a text device path node to Hardware PC card device path structure.\r
722\r
723 @param TextDeviceNode The input Text device path node.\r
724\r
725 @return A pointer to Hardware PC card device path structure.\r
726\r
727**/\r
95276127 728EFI_DEVICE_PATH_PROTOCOL *\r
729DevPathFromTextPcCard (\r
730 IN CHAR16 *TextDeviceNode\r
731 )\r
732{\r
733 CHAR16 *FunctionNumberStr;\r
734 PCCARD_DEVICE_PATH *Pccard;\r
735\r
736 FunctionNumberStr = GetNextParamStr (&TextDeviceNode);\r
737 Pccard = (PCCARD_DEVICE_PATH *) CreateDeviceNode (\r
738 HARDWARE_DEVICE_PATH,\r
739 HW_PCCARD_DP,\r
c9325700 740 (UINT16) sizeof (PCCARD_DEVICE_PATH)\r
95276127 741 );\r
742\r
cf40f28a 743 Pccard->FunctionNumber = (UINT8) Strtoi (FunctionNumberStr);\r
95276127 744\r
745 return (EFI_DEVICE_PATH_PROTOCOL *) Pccard;\r
746}\r
747\r
572f5d8a 748/**\r
749 Converts a text device path node to Hardware memory map device path structure.\r
750\r
751 @param TextDeviceNode The input Text device path node.\r
752\r
753 @return A pointer to Hardware memory map device path structure.\r
754\r
755**/\r
95276127 756EFI_DEVICE_PATH_PROTOCOL *\r
757DevPathFromTextMemoryMapped (\r
758 IN CHAR16 *TextDeviceNode\r
759 )\r
760{\r
cf40f28a 761 CHAR16 *MemoryTypeStr;\r
95276127 762 CHAR16 *StartingAddressStr;\r
763 CHAR16 *EndingAddressStr;\r
764 MEMMAP_DEVICE_PATH *MemMap;\r
765\r
cf40f28a 766 MemoryTypeStr = GetNextParamStr (&TextDeviceNode);\r
95276127 767 StartingAddressStr = GetNextParamStr (&TextDeviceNode);\r
768 EndingAddressStr = GetNextParamStr (&TextDeviceNode);\r
769 MemMap = (MEMMAP_DEVICE_PATH *) CreateDeviceNode (\r
770 HARDWARE_DEVICE_PATH,\r
771 HW_MEMMAP_DP,\r
c9325700 772 (UINT16) sizeof (MEMMAP_DEVICE_PATH)\r
95276127 773 );\r
774\r
cf40f28a 775 MemMap->MemoryType = (UINT32) Strtoi (MemoryTypeStr);\r
776 Strtoi64 (StartingAddressStr, &MemMap->StartingAddress);\r
777 Strtoi64 (EndingAddressStr, &MemMap->EndingAddress);\r
95276127 778\r
779 return (EFI_DEVICE_PATH_PROTOCOL *) MemMap;\r
780}\r
781\r
572f5d8a 782/**\r
783 Converts a text device path node to Vendor device path structure based on the input Type\r
784 and SubType.\r
785\r
786 @param TextDeviceNode The input Text device path node.\r
787 @param Type The type of device path node.\r
788 @param SubType The subtype of device path node.\r
789\r
790 @return A pointer to the newly-created Vendor device path structure.\r
791\r
792**/\r
95276127 793EFI_DEVICE_PATH_PROTOCOL *\r
794ConvertFromTextVendor (\r
795 IN CHAR16 *TextDeviceNode,\r
796 IN UINT8 Type,\r
797 IN UINT8 SubType\r
798 )\r
799{\r
800 CHAR16 *GuidStr;\r
801 CHAR16 *DataStr;\r
802 UINTN Length;\r
803 VENDOR_DEVICE_PATH *Vendor;\r
804\r
805 GuidStr = GetNextParamStr (&TextDeviceNode);\r
806\r
807 DataStr = GetNextParamStr (&TextDeviceNode);\r
808 Length = StrLen (DataStr);\r
809 //\r
810 // Two hex characters make up 1 buffer byte\r
811 //\r
812 Length = (Length + 1) / 2;\r
813\r
814 Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (\r
815 Type,\r
816 SubType,\r
d074a8e1 817 (UINT16) (sizeof (VENDOR_DEVICE_PATH) + Length)\r
95276127 818 );\r
819\r
820 StrToGuid (GuidStr, &Vendor->Guid);\r
821 StrToBuf (((UINT8 *) Vendor) + sizeof (VENDOR_DEVICE_PATH), Length, DataStr);\r
822\r
823 return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
824}\r
825\r
572f5d8a 826/**\r
827 Converts a text device path node to Vendor Hardware device path structure.\r
828\r
829 @param TextDeviceNode The input Text device path node.\r
830\r
831 @return A pointer to the newly-created Vendor Hardware device path structure.\r
832\r
833**/\r
95276127 834EFI_DEVICE_PATH_PROTOCOL *\r
835DevPathFromTextVenHw (\r
836 IN CHAR16 *TextDeviceNode\r
837 )\r
838{\r
839 return ConvertFromTextVendor (\r
840 TextDeviceNode,\r
841 HARDWARE_DEVICE_PATH,\r
842 HW_VENDOR_DP\r
843 );\r
844}\r
845\r
572f5d8a 846/**\r
847 Converts a text device path node to Hardware Controller device path structure.\r
848\r
849 @param TextDeviceNode The input Text device path node.\r
850\r
851 @return A pointer to the newly-created Hardware Controller device path structure.\r
852\r
853**/\r
95276127 854EFI_DEVICE_PATH_PROTOCOL *\r
855DevPathFromTextCtrl (\r
856 IN CHAR16 *TextDeviceNode\r
857 )\r
858{\r
859 CHAR16 *ControllerStr;\r
860 CONTROLLER_DEVICE_PATH *Controller;\r
861\r
862 ControllerStr = GetNextParamStr (&TextDeviceNode);\r
863 Controller = (CONTROLLER_DEVICE_PATH *) CreateDeviceNode (\r
864 HARDWARE_DEVICE_PATH,\r
865 HW_CONTROLLER_DP,\r
c9325700 866 (UINT16) sizeof (CONTROLLER_DEVICE_PATH)\r
95276127 867 );\r
cf40f28a 868 Controller->ControllerNumber = (UINT32) Strtoi (ControllerStr);\r
95276127 869\r
870 return (EFI_DEVICE_PATH_PROTOCOL *) Controller;\r
871}\r
872\r
572f5d8a 873/**\r
874 Converts a string to EisaId.\r
875\r
876 @param Text The input string.\r
877 @param EisaId A pointer to the output EisaId.\r
878\r
879**/\r
cf40f28a 880VOID\r
881EisaIdFromText (\r
882 IN CHAR16 *Text,\r
883 OUT UINT32 *EisaId\r
884 )\r
885{\r
886 UINTN PnpId;\r
887\r
888 PnpId = Xtoi (Text + 3);\r
572f5d8a 889 *EisaId = (((Text[0] - '@') & 0x1f) << 10) +\r
890 (((Text[1] - '@') & 0x1f) << 5) +\r
cf40f28a 891 ((Text[2] - '@') & 0x1f) +\r
892 (UINT32) (PnpId << 16);\r
893}\r
894\r
572f5d8a 895/**\r
896 Converts a text device path node to ACPI HID device path structure.\r
897\r
898 @param TextDeviceNode The input Text device path node.\r
899\r
900 @return A pointer to the newly-created ACPI HID device path structure.\r
901\r
902**/\r
95276127 903EFI_DEVICE_PATH_PROTOCOL *\r
904DevPathFromTextAcpi (\r
905 IN CHAR16 *TextDeviceNode\r
906 )\r
907{\r
908 CHAR16 *HIDStr;\r
909 CHAR16 *UIDStr;\r
910 ACPI_HID_DEVICE_PATH *Acpi;\r
911\r
912 HIDStr = GetNextParamStr (&TextDeviceNode);\r
913 UIDStr = GetNextParamStr (&TextDeviceNode);\r
914 Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (\r
915 ACPI_DEVICE_PATH,\r
916 ACPI_DP,\r
c9325700 917 (UINT16) sizeof (ACPI_HID_DEVICE_PATH)\r
95276127 918 );\r
919\r
cf40f28a 920 EisaIdFromText (HIDStr, &Acpi->HID);\r
921 Acpi->UID = (UINT32) Strtoi (UIDStr);\r
95276127 922\r
923 return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;\r
924}\r
925\r
572f5d8a 926/**\r
927 Converts a text device path node to ACPI HID device path structure.\r
928\r
929 @param TextDeviceNode The input Text device path node.\r
930 @param PnPId The input plug and play identification.\r
931\r
932 @return A pointer to the newly-created ACPI HID device path structure.\r
933\r
934**/\r
95276127 935EFI_DEVICE_PATH_PROTOCOL *\r
936ConvertFromTextAcpi (\r
937 IN CHAR16 *TextDeviceNode,\r
cf40f28a 938 IN UINT32 PnPId\r
95276127 939 )\r
940{\r
941 CHAR16 *UIDStr;\r
942 ACPI_HID_DEVICE_PATH *Acpi;\r
943\r
944 UIDStr = GetNextParamStr (&TextDeviceNode);\r
945 Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (\r
946 ACPI_DEVICE_PATH,\r
947 ACPI_DP,\r
c9325700 948 (UINT16) sizeof (ACPI_HID_DEVICE_PATH)\r
95276127 949 );\r
950\r
cf40f28a 951 Acpi->HID = EFI_PNP_ID (PnPId);\r
952 Acpi->UID = (UINT32) Strtoi (UIDStr);\r
95276127 953\r
954 return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;\r
955}\r
956\r
572f5d8a 957/**\r
958 Converts a text device path node to PCI root device path structure.\r
959\r
960 @param TextDeviceNode The input Text device path node.\r
961\r
962 @return A pointer to the newly-created PCI root device path structure.\r
963\r
964**/\r
95276127 965EFI_DEVICE_PATH_PROTOCOL *\r
966DevPathFromTextPciRoot (\r
967 IN CHAR16 *TextDeviceNode\r
968 )\r
969{\r
cf40f28a 970 return ConvertFromTextAcpi (TextDeviceNode, 0x0a03);\r
95276127 971}\r
972\r
e9b3cd55
RN
973/**\r
974 Converts a text device path node to PCIE root device path structure.\r
975\r
976 @param TextDeviceNode The input Text device path node.\r
977\r
978 @return A pointer to the newly-created PCIE root device path structure.\r
979\r
980**/\r
981EFI_DEVICE_PATH_PROTOCOL *\r
982DevPathFromTextPcieRoot (\r
983 IN CHAR16 *TextDeviceNode\r
984 )\r
985{\r
986 return ConvertFromTextAcpi (TextDeviceNode, 0x0a08);\r
987}\r
988\r
572f5d8a 989/**\r
990 Converts a text device path node to Floppy device path structure.\r
991\r
992 @param TextDeviceNode The input Text device path node.\r
993\r
994 @return A pointer to the newly-created Floppy device path structure.\r
995\r
996**/\r
95276127 997EFI_DEVICE_PATH_PROTOCOL *\r
998DevPathFromTextFloppy (\r
999 IN CHAR16 *TextDeviceNode\r
1000 )\r
1001{\r
cf40f28a 1002 return ConvertFromTextAcpi (TextDeviceNode, 0x0604);\r
95276127 1003}\r
1004\r
572f5d8a 1005/**\r
1006 Converts a text device path node to Keyboard device path structure.\r
1007\r
1008 @param TextDeviceNode The input Text device path node.\r
1009\r
1010 @return A pointer to the newly-created Keyboard device path structure.\r
1011\r
1012**/\r
95276127 1013EFI_DEVICE_PATH_PROTOCOL *\r
1014DevPathFromTextKeyboard (\r
1015 IN CHAR16 *TextDeviceNode\r
1016 )\r
1017{\r
cf40f28a 1018 return ConvertFromTextAcpi (TextDeviceNode, 0x0301);\r
95276127 1019}\r
1020\r
572f5d8a 1021/**\r
1022 Converts a text device path node to Serial device path structure.\r
1023\r
1024 @param TextDeviceNode The input Text device path node.\r
1025\r
1026 @return A pointer to the newly-created Serial device path structure.\r
1027\r
1028**/\r
95276127 1029EFI_DEVICE_PATH_PROTOCOL *\r
1030DevPathFromTextSerial (\r
1031 IN CHAR16 *TextDeviceNode\r
1032 )\r
1033{\r
cf40f28a 1034 return ConvertFromTextAcpi (TextDeviceNode, 0x0501);\r
95276127 1035}\r
1036\r
572f5d8a 1037/**\r
1038 Converts a text device path node to Parallel Port device path structure.\r
1039\r
1040 @param TextDeviceNode The input Text device path node.\r
1041\r
1042 @return A pointer to the newly-created Parallel Port device path structure.\r
1043\r
1044**/\r
95276127 1045EFI_DEVICE_PATH_PROTOCOL *\r
1046DevPathFromTextParallelPort (\r
1047 IN CHAR16 *TextDeviceNode\r
1048 )\r
1049{\r
cf40f28a 1050 return ConvertFromTextAcpi (TextDeviceNode, 0x0401);\r
95276127 1051}\r
1052\r
572f5d8a 1053/**\r
5755841f 1054 Converts a text device path node to ACPI extension device path structure.\r
572f5d8a 1055\r
1056 @param TextDeviceNode The input Text device path node.\r
1057\r
5755841f 1058 @return A pointer to the newly-created ACPI extension device path structure.\r
572f5d8a 1059\r
1060**/\r
95276127 1061EFI_DEVICE_PATH_PROTOCOL *\r
1062DevPathFromTextAcpiEx (\r
1063 IN CHAR16 *TextDeviceNode\r
1064 )\r
1065{\r
cf40f28a 1066 CHAR16 *HIDStr;\r
1067 CHAR16 *CIDStr;\r
1068 CHAR16 *UIDStr;\r
1069 CHAR16 *HIDSTRStr;\r
1070 CHAR16 *CIDSTRStr;\r
1071 CHAR16 *UIDSTRStr;\r
1072 CHAR8 *AsciiStr;\r
1073 UINT16 Length;\r
1074 ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;\r
95276127 1075\r
1076 HIDStr = GetNextParamStr (&TextDeviceNode);\r
1077 CIDStr = GetNextParamStr (&TextDeviceNode);\r
1078 UIDStr = GetNextParamStr (&TextDeviceNode);\r
1079 HIDSTRStr = GetNextParamStr (&TextDeviceNode);\r
1080 CIDSTRStr = GetNextParamStr (&TextDeviceNode);\r
1081 UIDSTRStr = GetNextParamStr (&TextDeviceNode);\r
1082\r
1083 Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (HIDSTRStr) + 1);\r
1084 Length = (UINT16) (Length + StrLen (UIDSTRStr) + 1);\r
1085 Length = (UINT16) (Length + StrLen (CIDSTRStr) + 1);\r
cf40f28a 1086 AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *) CreateDeviceNode (\r
1087 ACPI_DEVICE_PATH,\r
1088 ACPI_EXTENDED_DP,\r
1089 Length\r
1090 );\r
95276127 1091\r
cf40f28a 1092 EisaIdFromText (HIDStr, &AcpiEx->HID);\r
1093 EisaIdFromText (CIDStr, &AcpiEx->CID);\r
1094 AcpiEx->UID = (UINT32) Strtoi (UIDStr);\r
95276127 1095\r
cf40f28a 1096 AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));\r
95276127 1097 StrToAscii (HIDSTRStr, &AsciiStr);\r
1098 StrToAscii (UIDSTRStr, &AsciiStr);\r
1099 StrToAscii (CIDSTRStr, &AsciiStr);\r
cf40f28a 1100\r
1101 return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;\r
95276127 1102}\r
1103\r
572f5d8a 1104/**\r
5755841f 1105 Converts a text device path node to ACPI extension device path structure.\r
572f5d8a 1106\r
1107 @param TextDeviceNode The input Text device path node.\r
1108\r
5755841f 1109 @return A pointer to the newly-created ACPI extension device path structure.\r
572f5d8a 1110\r
1111**/\r
95276127 1112EFI_DEVICE_PATH_PROTOCOL *\r
1113DevPathFromTextAcpiExp (\r
1114 IN CHAR16 *TextDeviceNode\r
1115 )\r
1116{\r
cf40f28a 1117 CHAR16 *HIDStr;\r
1118 CHAR16 *CIDStr;\r
1119 CHAR16 *UIDSTRStr;\r
1120 CHAR8 *AsciiStr;\r
1121 UINT16 Length;\r
1122 ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;\r
95276127 1123\r
1124 HIDStr = GetNextParamStr (&TextDeviceNode);\r
1125 CIDStr = GetNextParamStr (&TextDeviceNode);\r
1126 UIDSTRStr = GetNextParamStr (&TextDeviceNode);\r
d074a8e1 1127 Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (UIDSTRStr) + 3);\r
cf40f28a 1128 AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *) CreateDeviceNode (\r
1129 ACPI_DEVICE_PATH,\r
1130 ACPI_EXTENDED_DP,\r
1131 Length\r
1132 );\r
95276127 1133\r
cf40f28a 1134 EisaIdFromText (HIDStr, &AcpiEx->HID);\r
1135 EisaIdFromText (CIDStr, &AcpiEx->CID);\r
1136 AcpiEx->UID = 0;\r
95276127 1137\r
cf40f28a 1138 AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));\r
95276127 1139 //\r
1140 // HID string is NULL\r
1141 //\r
cf40f28a 1142 *AsciiStr = '\0';\r
95276127 1143 //\r
1144 // Convert UID string\r
1145 //\r
1146 AsciiStr++;\r
1147 StrToAscii (UIDSTRStr, &AsciiStr);\r
1148 //\r
1149 // CID string is NULL\r
1150 //\r
cf40f28a 1151 *AsciiStr = '\0';\r
95276127 1152\r
cf40f28a 1153 return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;\r
95276127 1154}\r
1155\r
5b84091f
RN
1156/**\r
1157 Converts a text device path node to ACPI _ADR device path structure.\r
1158\r
1159 @param TextDeviceNode The input Text device path node.\r
1160\r
1161 @return A pointer to the newly-created ACPI _ADR device path structure.\r
1162\r
1163**/\r
1164EFI_DEVICE_PATH_PROTOCOL *\r
1165DevPathFromTextAcpiAdr (\r
1166 IN CHAR16 *TextDeviceNode\r
1167 )\r
1168{\r
1169 CHAR16 *DisplayDeviceStr;\r
1170 ACPI_ADR_DEVICE_PATH *AcpiAdr;\r
1171 UINTN Index;\r
b36653bc 1172 UINTN Length;\r
5b84091f
RN
1173\r
1174 AcpiAdr = (ACPI_ADR_DEVICE_PATH *) CreateDeviceNode (\r
1175 ACPI_DEVICE_PATH,\r
1176 ACPI_ADR_DP,\r
e7cc9dcc 1177 (UINT16) sizeof (ACPI_ADR_DEVICE_PATH)\r
5b84091f
RN
1178 );\r
1179 ASSERT (AcpiAdr != NULL);\r
1180\r
1181 for (Index = 0; ; Index++) {\r
1182 DisplayDeviceStr = GetNextParamStr (&TextDeviceNode);\r
1183 if (IS_NULL (*DisplayDeviceStr)) {\r
1184 break;\r
1185 }\r
1186 if (Index > 0) {\r
b36653bc 1187 Length = DevicePathNodeLength (AcpiAdr);\r
5b84091f 1188 AcpiAdr = ReallocatePool (\r
b36653bc
RN
1189 Length,\r
1190 Length + sizeof (UINT32),\r
5b84091f
RN
1191 AcpiAdr\r
1192 );\r
1193 ASSERT (AcpiAdr != NULL);\r
b36653bc 1194 SetDevicePathNodeLength (AcpiAdr, Length + sizeof (UINT32));\r
5b84091f
RN
1195 }\r
1196 \r
1197 (&AcpiAdr->ADR)[Index] = (UINT32) Strtoi (DisplayDeviceStr);\r
1198 }\r
1199\r
1200 return (EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr;\r
1201}\r
1202\r
572f5d8a 1203/**\r
1204 Converts a text device path node to Parallel Port device path structure.\r
1205\r
1206 @param TextDeviceNode The input Text device path node.\r
1207\r
1208 @return A pointer to the newly-created Parallel Port device path structure.\r
1209\r
1210**/\r
95276127 1211EFI_DEVICE_PATH_PROTOCOL *\r
1212DevPathFromTextAta (\r
1213 IN CHAR16 *TextDeviceNode\r
1214 )\r
1215{\r
1216 CHAR16 *PrimarySecondaryStr;\r
1217 CHAR16 *SlaveMasterStr;\r
1218 CHAR16 *LunStr;\r
1219 ATAPI_DEVICE_PATH *Atapi;\r
1220\r
1221 Atapi = (ATAPI_DEVICE_PATH *) CreateDeviceNode (\r
1222 MESSAGING_DEVICE_PATH,\r
1223 MSG_ATAPI_DP,\r
c9325700 1224 (UINT16) sizeof (ATAPI_DEVICE_PATH)\r
95276127 1225 );\r
1226\r
1227 PrimarySecondaryStr = GetNextParamStr (&TextDeviceNode);\r
1228 SlaveMasterStr = GetNextParamStr (&TextDeviceNode);\r
1229 LunStr = GetNextParamStr (&TextDeviceNode);\r
1230\r
1231 Atapi->PrimarySecondary = (UINT8) ((StrCmp (PrimarySecondaryStr, L"Primary") == 0) ? 0 : 1);\r
1232 Atapi->SlaveMaster = (UINT8) ((StrCmp (SlaveMasterStr, L"Master") == 0) ? 0 : 1);\r
cf40f28a 1233 Atapi->Lun = (UINT16) Strtoi (LunStr);\r
95276127 1234\r
1235 return (EFI_DEVICE_PATH_PROTOCOL *) Atapi;\r
1236}\r
1237\r
572f5d8a 1238/**\r
1239 Converts a text device path node to SCSI device path structure.\r
1240\r
1241 @param TextDeviceNode The input Text device path node.\r
1242\r
1243 @return A pointer to the newly-created SCSI device path structure.\r
1244\r
1245**/\r
95276127 1246EFI_DEVICE_PATH_PROTOCOL *\r
1247DevPathFromTextScsi (\r
1248 IN CHAR16 *TextDeviceNode\r
1249 )\r
1250{\r
1251 CHAR16 *PunStr;\r
1252 CHAR16 *LunStr;\r
1253 SCSI_DEVICE_PATH *Scsi;\r
1254\r
1255 PunStr = GetNextParamStr (&TextDeviceNode);\r
1256 LunStr = GetNextParamStr (&TextDeviceNode);\r
1257 Scsi = (SCSI_DEVICE_PATH *) CreateDeviceNode (\r
1258 MESSAGING_DEVICE_PATH,\r
1259 MSG_SCSI_DP,\r
c9325700 1260 (UINT16) sizeof (SCSI_DEVICE_PATH)\r
95276127 1261 );\r
1262\r
cf40f28a 1263 Scsi->Pun = (UINT16) Strtoi (PunStr);\r
1264 Scsi->Lun = (UINT16) Strtoi (LunStr);\r
95276127 1265\r
1266 return (EFI_DEVICE_PATH_PROTOCOL *) Scsi;\r
1267}\r
1268\r
572f5d8a 1269/**\r
1270 Converts a text device path node to Fibre device path structure.\r
1271\r
1272 @param TextDeviceNode The input Text device path node.\r
1273\r
1274 @return A pointer to the newly-created Fibre device path structure.\r
1275\r
1276**/\r
95276127 1277EFI_DEVICE_PATH_PROTOCOL *\r
1278DevPathFromTextFibre (\r
1279 IN CHAR16 *TextDeviceNode\r
1280 )\r
1281{\r
1282 CHAR16 *WWNStr;\r
1283 CHAR16 *LunStr;\r
1284 FIBRECHANNEL_DEVICE_PATH *Fibre;\r
1285\r
1286 WWNStr = GetNextParamStr (&TextDeviceNode);\r
1287 LunStr = GetNextParamStr (&TextDeviceNode);\r
1288 Fibre = (FIBRECHANNEL_DEVICE_PATH *) CreateDeviceNode (\r
1289 MESSAGING_DEVICE_PATH,\r
1290 MSG_FIBRECHANNEL_DP,\r
c9325700 1291 (UINT16) sizeof (FIBRECHANNEL_DEVICE_PATH)\r
95276127 1292 );\r
1293\r
1294 Fibre->Reserved = 0;\r
cf40f28a 1295 Strtoi64 (WWNStr, &Fibre->WWN);\r
1296 Strtoi64 (LunStr, &Fibre->Lun);\r
95276127 1297\r
1298 return (EFI_DEVICE_PATH_PROTOCOL *) Fibre;\r
1299}\r
1300\r
e9b3cd55
RN
1301/**\r
1302 Converts a text device path node to FibreEx device path structure.\r
1303\r
1304 @param TextDeviceNode The input Text device path node.\r
1305\r
1306 @return A pointer to the newly-created FibreEx device path structure.\r
1307\r
1308**/\r
1309EFI_DEVICE_PATH_PROTOCOL *\r
1310DevPathFromTextFibreEx (\r
1311 IN CHAR16 *TextDeviceNode\r
1312 )\r
1313{\r
1314 CHAR16 *WWNStr;\r
1315 CHAR16 *LunStr;\r
1316 FIBRECHANNELEX_DEVICE_PATH *FibreEx;\r
1317\r
1318 WWNStr = GetNextParamStr (&TextDeviceNode);\r
1319 LunStr = GetNextParamStr (&TextDeviceNode);\r
1320 FibreEx = (FIBRECHANNELEX_DEVICE_PATH *) CreateDeviceNode (\r
1321 MESSAGING_DEVICE_PATH,\r
1322 MSG_FIBRECHANNELEX_DP,\r
1323 (UINT16) sizeof (FIBRECHANNELEX_DEVICE_PATH)\r
1324 );\r
1325\r
1326 FibreEx->Reserved = 0;\r
1327 Strtoi64 (WWNStr, (UINT64 *) (&FibreEx->WWN));\r
1328 Strtoi64 (LunStr, (UINT64 *) (&FibreEx->Lun));\r
1329\r
1330 *(UINT64 *) (&FibreEx->WWN) = SwapBytes64 (*(UINT64 *) (&FibreEx->WWN));\r
1331 *(UINT64 *) (&FibreEx->Lun) = SwapBytes64 (*(UINT64 *) (&FibreEx->Lun));\r
1332\r
1333 return (EFI_DEVICE_PATH_PROTOCOL *) FibreEx;\r
1334}\r
1335\r
572f5d8a 1336/**\r
1337 Converts a text device path node to 1394 device path structure.\r
1338\r
1339 @param TextDeviceNode The input Text device path node.\r
1340\r
1341 @return A pointer to the newly-created 1394 device path structure.\r
1342\r
1343**/\r
95276127 1344EFI_DEVICE_PATH_PROTOCOL *\r
1345DevPathFromText1394 (\r
1346 IN CHAR16 *TextDeviceNode\r
1347 )\r
1348{\r
1349 CHAR16 *GuidStr;\r
572f5d8a 1350 F1394_DEVICE_PATH *F1394DevPath;\r
95276127 1351\r
1352 GuidStr = GetNextParamStr (&TextDeviceNode);\r
572f5d8a 1353 F1394DevPath = (F1394_DEVICE_PATH *) CreateDeviceNode (\r
1354 MESSAGING_DEVICE_PATH,\r
1355 MSG_1394_DP,\r
c9325700 1356 (UINT16) sizeof (F1394_DEVICE_PATH)\r
572f5d8a 1357 );\r
95276127 1358\r
572f5d8a 1359 F1394DevPath->Reserved = 0;\r
1360 Xtoi64 (GuidStr, &F1394DevPath->Guid);\r
95276127 1361\r
572f5d8a 1362 return (EFI_DEVICE_PATH_PROTOCOL *) F1394DevPath;\r
95276127 1363}\r
1364\r
572f5d8a 1365/**\r
1366 Converts a text device path node to USB device path structure.\r
1367\r
1368 @param TextDeviceNode The input Text device path node.\r
1369\r
1370 @return A pointer to the newly-created USB device path structure.\r
1371\r
1372**/\r
95276127 1373EFI_DEVICE_PATH_PROTOCOL *\r
1374DevPathFromTextUsb (\r
1375 IN CHAR16 *TextDeviceNode\r
1376 )\r
1377{\r
1378 CHAR16 *PortStr;\r
1379 CHAR16 *InterfaceStr;\r
1380 USB_DEVICE_PATH *Usb;\r
1381\r
1382 PortStr = GetNextParamStr (&TextDeviceNode);\r
1383 InterfaceStr = GetNextParamStr (&TextDeviceNode);\r
1384 Usb = (USB_DEVICE_PATH *) CreateDeviceNode (\r
1385 MESSAGING_DEVICE_PATH,\r
1386 MSG_USB_DP,\r
c9325700 1387 (UINT16) sizeof (USB_DEVICE_PATH)\r
95276127 1388 );\r
1389\r
cf40f28a 1390 Usb->ParentPortNumber = (UINT8) Strtoi (PortStr);\r
1391 Usb->InterfaceNumber = (UINT8) Strtoi (InterfaceStr);\r
95276127 1392\r
1393 return (EFI_DEVICE_PATH_PROTOCOL *) Usb;\r
1394}\r
1395\r
572f5d8a 1396/**\r
1397 Converts a text device path node to I20 device path structure.\r
1398\r
1399 @param TextDeviceNode The input Text device path node.\r
1400\r
1401 @return A pointer to the newly-created I20 device path structure.\r
1402\r
1403**/\r
95276127 1404EFI_DEVICE_PATH_PROTOCOL *\r
1405DevPathFromTextI2O (\r
1406 IN CHAR16 *TextDeviceNode\r
1407 )\r
1408{\r
1409 CHAR16 *TIDStr;\r
572f5d8a 1410 I2O_DEVICE_PATH *I2ODevPath;\r
95276127 1411\r
572f5d8a 1412 TIDStr = GetNextParamStr (&TextDeviceNode);\r
1413 I2ODevPath = (I2O_DEVICE_PATH *) CreateDeviceNode (\r
95276127 1414 MESSAGING_DEVICE_PATH,\r
1415 MSG_I2O_DP,\r
c9325700 1416 (UINT16) sizeof (I2O_DEVICE_PATH)\r
95276127 1417 );\r
1418\r
572f5d8a 1419 I2ODevPath->Tid = (UINT32) Strtoi (TIDStr);\r
95276127 1420\r
572f5d8a 1421 return (EFI_DEVICE_PATH_PROTOCOL *) I2ODevPath;\r
95276127 1422}\r
1423\r
572f5d8a 1424/**\r
1425 Converts a text device path node to Infini Band device path structure.\r
1426\r
1427 @param TextDeviceNode The input Text device path node.\r
1428\r
1429 @return A pointer to the newly-created Infini Band device path structure.\r
1430\r
1431**/\r
95276127 1432EFI_DEVICE_PATH_PROTOCOL *\r
1433DevPathFromTextInfiniband (\r
1434 IN CHAR16 *TextDeviceNode\r
1435 )\r
1436{\r
1437 CHAR16 *FlagsStr;\r
1438 CHAR16 *GuidStr;\r
1439 CHAR16 *SidStr;\r
1440 CHAR16 *TidStr;\r
1441 CHAR16 *DidStr;\r
1442 EFI_GUID PortGid;\r
1443 INFINIBAND_DEVICE_PATH *InfiniBand;\r
1444\r
1445 FlagsStr = GetNextParamStr (&TextDeviceNode);\r
1446 GuidStr = GetNextParamStr (&TextDeviceNode);\r
1447 SidStr = GetNextParamStr (&TextDeviceNode);\r
1448 TidStr = GetNextParamStr (&TextDeviceNode);\r
1449 DidStr = GetNextParamStr (&TextDeviceNode);\r
1450 InfiniBand = (INFINIBAND_DEVICE_PATH *) CreateDeviceNode (\r
1451 MESSAGING_DEVICE_PATH,\r
1452 MSG_INFINIBAND_DP,\r
c9325700 1453 (UINT16) sizeof (INFINIBAND_DEVICE_PATH)\r
95276127 1454 );\r
1455\r
cf40f28a 1456 InfiniBand->ResourceFlags = (UINT32) Strtoi (FlagsStr);\r
95276127 1457 StrToGuid (GuidStr, &PortGid);\r
1458 CopyMem (InfiniBand->PortGid, &PortGid, sizeof (EFI_GUID));\r
cf40f28a 1459 Strtoi64 (SidStr, &InfiniBand->ServiceId);\r
1460 Strtoi64 (TidStr, &InfiniBand->TargetPortId);\r
1461 Strtoi64 (DidStr, &InfiniBand->DeviceId);\r
95276127 1462\r
1463 return (EFI_DEVICE_PATH_PROTOCOL *) InfiniBand;\r
1464}\r
1465\r
572f5d8a 1466/**\r
1467 Converts a text device path node to Vendor-Defined Messaging device path structure.\r
1468\r
1469 @param TextDeviceNode The input Text device path node.\r
1470\r
1471 @return A pointer to the newly-created Vendor-Defined Messaging device path structure.\r
1472\r
1473**/\r
95276127 1474EFI_DEVICE_PATH_PROTOCOL *\r
1475DevPathFromTextVenMsg (\r
1476 IN CHAR16 *TextDeviceNode\r
1477 )\r
1478{\r
1479 return ConvertFromTextVendor (\r
1480 TextDeviceNode,\r
1481 MESSAGING_DEVICE_PATH,\r
1482 MSG_VENDOR_DP\r
1483 );\r
1484}\r
1485\r
572f5d8a 1486/**\r
1487 Converts a text device path node to Vendor defined PC-ANSI device path structure.\r
1488\r
1489 @param TextDeviceNode The input Text device path node.\r
1490\r
1491 @return A pointer to the newly-created Vendor defined PC-ANSI device path structure.\r
1492\r
1493**/\r
95276127 1494EFI_DEVICE_PATH_PROTOCOL *\r
1495DevPathFromTextVenPcAnsi (\r
1496 IN CHAR16 *TextDeviceNode\r
1497 )\r
1498{\r
1499 VENDOR_DEVICE_PATH *Vendor;\r
1500\r
1501 Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (\r
1502 MESSAGING_DEVICE_PATH,\r
1503 MSG_VENDOR_DP,\r
c9325700 1504 (UINT16) sizeof (VENDOR_DEVICE_PATH));\r
95276127 1505 CopyGuid (&Vendor->Guid, &gEfiPcAnsiGuid);\r
1506\r
1507 return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
1508}\r
1509\r
572f5d8a 1510/**\r
1511 Converts a text device path node to Vendor defined VT100 device path structure.\r
1512\r
1513 @param TextDeviceNode The input Text device path node.\r
1514\r
1515 @return A pointer to the newly-created Vendor defined VT100 device path structure.\r
1516\r
1517**/\r
95276127 1518EFI_DEVICE_PATH_PROTOCOL *\r
1519DevPathFromTextVenVt100 (\r
1520 IN CHAR16 *TextDeviceNode\r
1521 )\r
1522{\r
1523 VENDOR_DEVICE_PATH *Vendor;\r
1524\r
1525 Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (\r
1526 MESSAGING_DEVICE_PATH,\r
1527 MSG_VENDOR_DP,\r
c9325700 1528 (UINT16) sizeof (VENDOR_DEVICE_PATH));\r
95276127 1529 CopyGuid (&Vendor->Guid, &gEfiVT100Guid);\r
1530\r
1531 return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
1532}\r
1533\r
572f5d8a 1534/**\r
1535 Converts a text device path node to Vendor defined VT100 Plus device path structure.\r
1536\r
1537 @param TextDeviceNode The input Text device path node.\r
1538\r
1539 @return A pointer to the newly-created Vendor defined VT100 Plus device path structure.\r
1540\r
1541**/\r
95276127 1542EFI_DEVICE_PATH_PROTOCOL *\r
1543DevPathFromTextVenVt100Plus (\r
1544 IN CHAR16 *TextDeviceNode\r
1545 )\r
1546{\r
1547 VENDOR_DEVICE_PATH *Vendor;\r
1548\r
1549 Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (\r
1550 MESSAGING_DEVICE_PATH,\r
1551 MSG_VENDOR_DP,\r
c9325700 1552 (UINT16) sizeof (VENDOR_DEVICE_PATH));\r
95276127 1553 CopyGuid (&Vendor->Guid, &gEfiVT100PlusGuid);\r
1554\r
1555 return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
1556}\r
1557\r
572f5d8a 1558/**\r
1559 Converts a text device path node to Vendor defined UTF8 device path structure.\r
1560\r
1561 @param TextDeviceNode The input Text device path node.\r
1562\r
1563 @return A pointer to the newly-created Vendor defined UTF8 device path structure.\r
1564\r
1565**/\r
95276127 1566EFI_DEVICE_PATH_PROTOCOL *\r
1567DevPathFromTextVenUtf8 (\r
1568 IN CHAR16 *TextDeviceNode\r
1569 )\r
1570{\r
1571 VENDOR_DEVICE_PATH *Vendor;\r
1572\r
1573 Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (\r
1574 MESSAGING_DEVICE_PATH,\r
1575 MSG_VENDOR_DP,\r
c9325700 1576 (UINT16) sizeof (VENDOR_DEVICE_PATH));\r
95276127 1577 CopyGuid (&Vendor->Guid, &gEfiVTUTF8Guid);\r
1578\r
1579 return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
1580}\r
1581\r
572f5d8a 1582/**\r
1583 Converts a text device path node to UART Flow Control device path structure.\r
1584\r
1585 @param TextDeviceNode The input Text device path node.\r
1586\r
1587 @return A pointer to the newly-created UART Flow Control device path structure.\r
1588\r
1589**/\r
95276127 1590EFI_DEVICE_PATH_PROTOCOL *\r
1591DevPathFromTextUartFlowCtrl (\r
1592 IN CHAR16 *TextDeviceNode\r
1593 )\r
1594{\r
1595 CHAR16 *ValueStr;\r
1596 UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl;\r
1597\r
1598 ValueStr = GetNextParamStr (&TextDeviceNode);\r
1599 UartFlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) CreateDeviceNode (\r
1600 MESSAGING_DEVICE_PATH,\r
1601 MSG_VENDOR_DP,\r
c9325700 1602 (UINT16) sizeof (UART_FLOW_CONTROL_DEVICE_PATH)\r
95276127 1603 );\r
1604\r
48557c65 1605 CopyGuid (&UartFlowControl->Guid, &gEfiUartDevicePathGuid);\r
95276127 1606 if (StrCmp (ValueStr, L"XonXoff") == 0) {\r
1607 UartFlowControl->FlowControlMap = 2;\r
1608 } else if (StrCmp (ValueStr, L"Hardware") == 0) {\r
1609 UartFlowControl->FlowControlMap = 1;\r
1610 } else {\r
1611 UartFlowControl->FlowControlMap = 0;\r
1612 }\r
1613\r
1614 return (EFI_DEVICE_PATH_PROTOCOL *) UartFlowControl;\r
1615}\r
1616\r
572f5d8a 1617/**\r
1618 Converts a text device path node to Serial Attached SCSI device path structure.\r
1619\r
1620 @param TextDeviceNode The input Text device path node.\r
1621\r
1622 @return A pointer to the newly-created Serial Attached SCSI device path structure.\r
1623\r
1624**/\r
95276127 1625EFI_DEVICE_PATH_PROTOCOL *\r
1626DevPathFromTextSAS (\r
1627 IN CHAR16 *TextDeviceNode\r
1628 )\r
1629{\r
1630 CHAR16 *AddressStr;\r
1631 CHAR16 *LunStr;\r
1632 CHAR16 *RTPStr;\r
1633 CHAR16 *SASSATAStr;\r
1634 CHAR16 *LocationStr;\r
1635 CHAR16 *ConnectStr;\r
1636 CHAR16 *DriveBayStr;\r
1637 CHAR16 *ReservedStr;\r
1638 UINT16 Info;\r
1639 SAS_DEVICE_PATH *Sas;\r
1640\r
1641 AddressStr = GetNextParamStr (&TextDeviceNode);\r
1642 LunStr = GetNextParamStr (&TextDeviceNode);\r
1643 RTPStr = GetNextParamStr (&TextDeviceNode);\r
1644 SASSATAStr = GetNextParamStr (&TextDeviceNode);\r
1645 LocationStr = GetNextParamStr (&TextDeviceNode);\r
1646 ConnectStr = GetNextParamStr (&TextDeviceNode);\r
1647 DriveBayStr = GetNextParamStr (&TextDeviceNode);\r
1648 ReservedStr = GetNextParamStr (&TextDeviceNode);\r
1649 Info = 0x0000;\r
1650 Sas = (SAS_DEVICE_PATH *) CreateDeviceNode (\r
1651 MESSAGING_DEVICE_PATH,\r
1652 MSG_VENDOR_DP,\r
c9325700 1653 (UINT16) sizeof (SAS_DEVICE_PATH)\r
95276127 1654 );\r
1655\r
48557c65 1656 CopyGuid (&Sas->Guid, &gEfiSasDevicePathGuid);\r
cf40f28a 1657 Strtoi64 (AddressStr, &Sas->SasAddress);\r
1658 Strtoi64 (LunStr, &Sas->Lun);\r
1659 Sas->RelativeTargetPort = (UINT16) Strtoi (RTPStr);\r
1660 if (StrCmp (SASSATAStr, L"NoTopology") != 0) {\r
95276127 1661 if (StrCmp (DriveBayStr, L"0") == 0) {\r
1662 Info |= 0x0001;\r
1663 } else {\r
1664 Info |= 0x0002;\r
cf40f28a 1665 Info = (UINT16) (Info | (Strtoi (DriveBayStr) << 8));\r
95276127 1666 }\r
1667\r
1668 if (StrCmp (SASSATAStr, L"SATA") == 0) {\r
1669 Info |= 0x0010;\r
1670 }\r
1671\r
1672 if (StrCmp (LocationStr, L"External") == 0) {\r
1673 Info |= 0x0020;\r
1674 }\r
1675\r
1676 if (StrCmp (ConnectStr, L"Expanded") == 0) {\r
1677 Info |= 0x0040;\r
1678 }\r
1679 }\r
1680\r
1681 Sas->DeviceTopology = Info;\r
cf40f28a 1682 Sas->Reserved = (UINT32) Strtoi (ReservedStr);\r
95276127 1683\r
1684 return (EFI_DEVICE_PATH_PROTOCOL *) Sas;\r
1685}\r
1686\r
572f5d8a 1687/**\r
1688 Converts a text device path node to Debug Port device path structure.\r
1689\r
1690 @param TextDeviceNode The input Text device path node.\r
1691\r
1692 @return A pointer to the newly-created Debug Port device path structure.\r
1693\r
1694**/\r
95276127 1695EFI_DEVICE_PATH_PROTOCOL *\r
1696DevPathFromTextDebugPort (\r
1697 IN CHAR16 *TextDeviceNode\r
1698 )\r
1699{\r
1700 VENDOR_DEFINED_MESSAGING_DEVICE_PATH *Vend;\r
1701\r
1702 Vend = (VENDOR_DEFINED_MESSAGING_DEVICE_PATH *) CreateDeviceNode (\r
1703 MESSAGING_DEVICE_PATH,\r
1704 MSG_VENDOR_DP,\r
c9325700 1705 (UINT16) sizeof (VENDOR_DEFINED_MESSAGING_DEVICE_PATH)\r
95276127 1706 );\r
1707\r
1708 CopyGuid (&Vend->Guid, &gEfiDebugPortProtocolGuid);\r
1709\r
1710 return (EFI_DEVICE_PATH_PROTOCOL *) Vend;\r
1711}\r
1712\r
572f5d8a 1713/**\r
1714 Converts a text device path node to MAC device path structure.\r
1715\r
1716 @param TextDeviceNode The input Text device path node.\r
1717\r
1718 @return A pointer to the newly-created MAC device path structure.\r
1719\r
1720**/\r
95276127 1721EFI_DEVICE_PATH_PROTOCOL *\r
1722DevPathFromTextMAC (\r
1723 IN CHAR16 *TextDeviceNode\r
1724 )\r
1725{\r
1726 CHAR16 *AddressStr;\r
1727 CHAR16 *IfTypeStr;\r
1728 UINTN Length;\r
572f5d8a 1729 MAC_ADDR_DEVICE_PATH *MACDevPath;\r
95276127 1730\r
1731 AddressStr = GetNextParamStr (&TextDeviceNode);\r
1732 IfTypeStr = GetNextParamStr (&TextDeviceNode);\r
572f5d8a 1733 MACDevPath = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode (\r
95276127 1734 MESSAGING_DEVICE_PATH,\r
1735 MSG_MAC_ADDR_DP,\r
c9325700 1736 (UINT16) sizeof (MAC_ADDR_DEVICE_PATH)\r
95276127 1737 );\r
1738\r
572f5d8a 1739 MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr);\r
95276127 1740\r
1741 Length = sizeof (EFI_MAC_ADDRESS);\r
572f5d8a 1742 StrToBuf (&MACDevPath->MacAddress.Addr[0], Length, AddressStr);\r
95276127 1743\r
572f5d8a 1744 return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath;\r
95276127 1745}\r
1746\r
052019e1 1747\r
1748/**\r
1749 Converts a text format to the network protocol ID.\r
1750\r
1751 @param Text String of protocol field.\r
1752\r
1753 @return Network protocol ID .\r
1754\r
1755**/\r
1756UINTN\r
1757NetworkProtocolFromText (\r
1758 IN CHAR16 *Text\r
1759 )\r
1760{\r
1761 if (StrCmp (Text, L"UDP") == 0) {\r
1762 return RFC_1700_UDP_PROTOCOL;\r
1763 }\r
1764\r
1765 if (StrCmp (Text, L"TCP") == 0) {\r
1766 return RFC_1700_TCP_PROTOCOL;\r
1767 }\r
1768\r
1769 return Strtoi (Text);\r
1770}\r
1771\r
1772\r
572f5d8a 1773/**\r
1774 Converts a text device path node to IPV4 device path structure.\r
1775\r
1776 @param TextDeviceNode The input Text device path node.\r
1777\r
1778 @return A pointer to the newly-created IPV4 device path structure.\r
1779\r
1780**/\r
95276127 1781EFI_DEVICE_PATH_PROTOCOL *\r
1782DevPathFromTextIPv4 (\r
1783 IN CHAR16 *TextDeviceNode\r
1784 )\r
1785{\r
1786 CHAR16 *RemoteIPStr;\r
1787 CHAR16 *ProtocolStr;\r
1788 CHAR16 *TypeStr;\r
1789 CHAR16 *LocalIPStr;\r
e9b3cd55
RN
1790 CHAR16 *GatewayIPStr;\r
1791 CHAR16 *SubnetMaskStr;\r
95276127 1792 IPv4_DEVICE_PATH *IPv4;\r
1793\r
1794 RemoteIPStr = GetNextParamStr (&TextDeviceNode);\r
1795 ProtocolStr = GetNextParamStr (&TextDeviceNode);\r
1796 TypeStr = GetNextParamStr (&TextDeviceNode);\r
1797 LocalIPStr = GetNextParamStr (&TextDeviceNode);\r
e9b3cd55
RN
1798 GatewayIPStr = GetNextParamStr (&TextDeviceNode);\r
1799 SubnetMaskStr = GetNextParamStr (&TextDeviceNode);\r
95276127 1800 IPv4 = (IPv4_DEVICE_PATH *) CreateDeviceNode (\r
1801 MESSAGING_DEVICE_PATH,\r
1802 MSG_IPv4_DP,\r
c9325700 1803 (UINT16) sizeof (IPv4_DEVICE_PATH)\r
95276127 1804 );\r
1805\r
1806 StrToIPv4Addr (&RemoteIPStr, &IPv4->RemoteIpAddress);\r
052019e1 1807 IPv4->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);\r
95276127 1808 if (StrCmp (TypeStr, L"Static") == 0) {\r
1809 IPv4->StaticIpAddress = TRUE;\r
1810 } else {\r
1811 IPv4->StaticIpAddress = FALSE;\r
1812 }\r
1813\r
1814 StrToIPv4Addr (&LocalIPStr, &IPv4->LocalIpAddress);\r
e9b3cd55
RN
1815 if (!IS_NULL (*GatewayIPStr) && !IS_NULL (*SubnetMaskStr)) {\r
1816 StrToIPv4Addr (&GatewayIPStr, &IPv4->GatewayIpAddress);\r
1817 StrToIPv4Addr (&SubnetMaskStr, &IPv4->SubnetMask);\r
1818 } else {\r
1819 ZeroMem (&IPv4->GatewayIpAddress, sizeof (IPv4->GatewayIpAddress));\r
1820 ZeroMem (&IPv4->SubnetMask, sizeof (IPv4->SubnetMask));\r
1821 }\r
95276127 1822\r
cf40f28a 1823 IPv4->LocalPort = 0;\r
1824 IPv4->RemotePort = 0;\r
95276127 1825\r
1826 return (EFI_DEVICE_PATH_PROTOCOL *) IPv4;\r
1827}\r
1828\r
572f5d8a 1829/**\r
1830 Converts a text device path node to IPV6 device path structure.\r
1831\r
1832 @param TextDeviceNode The input Text device path node.\r
1833\r
1834 @return A pointer to the newly-created IPV6 device path structure.\r
1835\r
1836**/\r
95276127 1837EFI_DEVICE_PATH_PROTOCOL *\r
1838DevPathFromTextIPv6 (\r
1839 IN CHAR16 *TextDeviceNode\r
1840 )\r
1841{\r
1842 CHAR16 *RemoteIPStr;\r
1843 CHAR16 *ProtocolStr;\r
1844 CHAR16 *TypeStr;\r
1845 CHAR16 *LocalIPStr;\r
1846 IPv6_DEVICE_PATH *IPv6;\r
1847\r
1848 RemoteIPStr = GetNextParamStr (&TextDeviceNode);\r
1849 ProtocolStr = GetNextParamStr (&TextDeviceNode);\r
1850 TypeStr = GetNextParamStr (&TextDeviceNode);\r
1851 LocalIPStr = GetNextParamStr (&TextDeviceNode);\r
1852 IPv6 = (IPv6_DEVICE_PATH *) CreateDeviceNode (\r
1853 MESSAGING_DEVICE_PATH,\r
1854 MSG_IPv6_DP,\r
c9325700 1855 (UINT16) sizeof (IPv6_DEVICE_PATH)\r
95276127 1856 );\r
1857\r
1858 StrToIPv6Addr (&RemoteIPStr, &IPv6->RemoteIpAddress);\r
052019e1 1859 IPv6->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);\r
95276127 1860 if (StrCmp (TypeStr, L"Static") == 0) {\r
1861 IPv6->StaticIpAddress = TRUE;\r
1862 } else {\r
1863 IPv6->StaticIpAddress = FALSE;\r
1864 }\r
1865\r
1866 StrToIPv6Addr (&LocalIPStr, &IPv6->LocalIpAddress);\r
1867\r
1868 IPv6->LocalPort = 0;\r
1869 IPv6->RemotePort = 0;\r
1870\r
1871 return (EFI_DEVICE_PATH_PROTOCOL *) IPv6;\r
1872}\r
1873\r
572f5d8a 1874/**\r
1875 Converts a text device path node to UART device path structure.\r
1876\r
1877 @param TextDeviceNode The input Text device path node.\r
1878\r
1879 @return A pointer to the newly-created UART device path structure.\r
1880\r
1881**/\r
95276127 1882EFI_DEVICE_PATH_PROTOCOL *\r
1883DevPathFromTextUart (\r
1884 IN CHAR16 *TextDeviceNode\r
1885 )\r
1886{\r
1887 CHAR16 *BaudStr;\r
1888 CHAR16 *DataBitsStr;\r
1889 CHAR16 *ParityStr;\r
1890 CHAR16 *StopBitsStr;\r
1891 UART_DEVICE_PATH *Uart;\r
1892\r
1893 BaudStr = GetNextParamStr (&TextDeviceNode);\r
1894 DataBitsStr = GetNextParamStr (&TextDeviceNode);\r
1895 ParityStr = GetNextParamStr (&TextDeviceNode);\r
1896 StopBitsStr = GetNextParamStr (&TextDeviceNode);\r
1897 Uart = (UART_DEVICE_PATH *) CreateDeviceNode (\r
1898 MESSAGING_DEVICE_PATH,\r
1899 MSG_UART_DP,\r
c9325700 1900 (UINT16) sizeof (UART_DEVICE_PATH)\r
95276127 1901 );\r
1902\r
cf40f28a 1903 Uart->BaudRate = (StrCmp (BaudStr, L"DEFAULT") == 0) ? 115200 : Dtoi (BaudStr);\r
1904 Uart->DataBits = (UINT8) ((StrCmp (DataBitsStr, L"DEFAULT") == 0) ? 8 : Dtoi (DataBitsStr));\r
95276127 1905 switch (*ParityStr) {\r
1906 case L'D':\r
1907 Uart->Parity = 0;\r
1908 break;\r
1909\r
1910 case L'N':\r
1911 Uart->Parity = 1;\r
1912 break;\r
1913\r
1914 case L'E':\r
1915 Uart->Parity = 2;\r
1916 break;\r
1917\r
1918 case L'O':\r
1919 Uart->Parity = 3;\r
1920 break;\r
1921\r
1922 case L'M':\r
1923 Uart->Parity = 4;\r
1924 break;\r
1925\r
1926 case L'S':\r
1927 Uart->Parity = 5;\r
1928\r
1929 default:\r
1930 Uart->Parity = 0xff;\r
1931 }\r
1932\r
1933 if (StrCmp (StopBitsStr, L"D") == 0) {\r
1934 Uart->StopBits = (UINT8) 0;\r
1935 } else if (StrCmp (StopBitsStr, L"1") == 0) {\r
1936 Uart->StopBits = (UINT8) 1;\r
1937 } else if (StrCmp (StopBitsStr, L"1.5") == 0) {\r
1938 Uart->StopBits = (UINT8) 2;\r
1939 } else if (StrCmp (StopBitsStr, L"2") == 0) {\r
1940 Uart->StopBits = (UINT8) 3;\r
1941 } else {\r
1942 Uart->StopBits = 0xff;\r
1943 }\r
1944\r
1945 return (EFI_DEVICE_PATH_PROTOCOL *) Uart;\r
1946}\r
1947\r
572f5d8a 1948/**\r
1949 Converts a text device path node to USB class device path structure.\r
1950\r
1951 @param TextDeviceNode The input Text device path node.\r
1952 @param UsbClassText A pointer to USB_CLASS_TEXT structure to be integrated to USB Class Text.\r
1953\r
1954 @return A pointer to the newly-created USB class device path structure.\r
1955\r
1956**/\r
95276127 1957EFI_DEVICE_PATH_PROTOCOL *\r
1958ConvertFromTextUsbClass (\r
1959 IN CHAR16 *TextDeviceNode,\r
1960 IN USB_CLASS_TEXT *UsbClassText\r
1961 )\r
1962{\r
1963 CHAR16 *VIDStr;\r
1964 CHAR16 *PIDStr;\r
1965 CHAR16 *ClassStr;\r
1966 CHAR16 *SubClassStr;\r
1967 CHAR16 *ProtocolStr;\r
1968 USB_CLASS_DEVICE_PATH *UsbClass;\r
1969\r
1970 UsbClass = (USB_CLASS_DEVICE_PATH *) CreateDeviceNode (\r
1971 MESSAGING_DEVICE_PATH,\r
1972 MSG_USB_CLASS_DP,\r
c9325700 1973 (UINT16) sizeof (USB_CLASS_DEVICE_PATH)\r
95276127 1974 );\r
1975\r
1976 VIDStr = GetNextParamStr (&TextDeviceNode);\r
1977 PIDStr = GetNextParamStr (&TextDeviceNode);\r
1978 if (UsbClassText->ClassExist) {\r
1979 ClassStr = GetNextParamStr (&TextDeviceNode);\r
cf40f28a 1980 UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);\r
95276127 1981 } else {\r
1982 UsbClass->DeviceClass = UsbClassText->Class;\r
1983 }\r
1984 if (UsbClassText->SubClassExist) {\r
1985 SubClassStr = GetNextParamStr (&TextDeviceNode);\r
cf40f28a 1986 UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);\r
95276127 1987 } else {\r
1988 UsbClass->DeviceSubClass = UsbClassText->SubClass;\r
572f5d8a 1989 }\r
95276127 1990\r
1991 ProtocolStr = GetNextParamStr (&TextDeviceNode);\r
1992\r
cf40f28a 1993 UsbClass->VendorId = (UINT16) Strtoi (VIDStr);\r
1994 UsbClass->ProductId = (UINT16) Strtoi (PIDStr);\r
1995 UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr);\r
95276127 1996\r
1997 return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass;\r
1998}\r
1999\r
2000\r
572f5d8a 2001/**\r
2002 Converts a text device path node to USB class device path structure.\r
2003\r
2004 @param TextDeviceNode The input Text device path node.\r
2005\r
2006 @return A pointer to the newly-created USB class device path structure.\r
2007\r
2008**/\r
95276127 2009EFI_DEVICE_PATH_PROTOCOL *\r
2010DevPathFromTextUsbClass (\r
2011 IN CHAR16 *TextDeviceNode\r
2012 )\r
2013{\r
2014 USB_CLASS_TEXT UsbClassText;\r
2015\r
2016 UsbClassText.ClassExist = TRUE;\r
2017 UsbClassText.SubClassExist = TRUE;\r
2018\r
2019 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2020}\r
2021\r
572f5d8a 2022/**\r
2023 Converts a text device path node to USB audio device path structure.\r
2024\r
2025 @param TextDeviceNode The input Text device path node.\r
2026\r
2027 @return A pointer to the newly-created USB audio device path structure.\r
2028\r
2029**/\r
95276127 2030EFI_DEVICE_PATH_PROTOCOL *\r
2031DevPathFromTextUsbAudio (\r
2032 IN CHAR16 *TextDeviceNode\r
2033 )\r
2034{\r
2035 USB_CLASS_TEXT UsbClassText;\r
2036\r
2037 UsbClassText.ClassExist = FALSE;\r
2038 UsbClassText.Class = USB_CLASS_AUDIO;\r
2039 UsbClassText.SubClassExist = TRUE;\r
2040\r
2041 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2042}\r
2043\r
572f5d8a 2044/**\r
2045 Converts a text device path node to USB CDC Control device path structure.\r
2046\r
2047 @param TextDeviceNode The input Text device path node.\r
2048\r
2049 @return A pointer to the newly-created USB CDC Control device path structure.\r
2050\r
2051**/\r
95276127 2052EFI_DEVICE_PATH_PROTOCOL *\r
2053DevPathFromTextUsbCDCControl (\r
2054 IN CHAR16 *TextDeviceNode\r
2055 )\r
2056{\r
2057 USB_CLASS_TEXT UsbClassText;\r
2058\r
2059 UsbClassText.ClassExist = FALSE;\r
2060 UsbClassText.Class = USB_CLASS_CDCCONTROL;\r
2061 UsbClassText.SubClassExist = TRUE;\r
2062\r
2063 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2064}\r
2065\r
572f5d8a 2066/**\r
2067 Converts a text device path node to USB HID device path structure.\r
2068\r
2069 @param TextDeviceNode The input Text device path node.\r
2070\r
2071 @return A pointer to the newly-created USB HID device path structure.\r
2072\r
2073**/\r
95276127 2074EFI_DEVICE_PATH_PROTOCOL *\r
2075DevPathFromTextUsbHID (\r
2076 IN CHAR16 *TextDeviceNode\r
2077 )\r
2078{\r
2079 USB_CLASS_TEXT UsbClassText;\r
2080\r
2081 UsbClassText.ClassExist = FALSE;\r
2082 UsbClassText.Class = USB_CLASS_HID;\r
2083 UsbClassText.SubClassExist = TRUE;\r
2084\r
2085 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2086}\r
2087\r
572f5d8a 2088/**\r
2089 Converts a text device path node to USB Image device path structure.\r
2090\r
2091 @param TextDeviceNode The input Text device path node.\r
2092\r
2093 @return A pointer to the newly-created USB Image device path structure.\r
2094\r
2095**/\r
95276127 2096EFI_DEVICE_PATH_PROTOCOL *\r
2097DevPathFromTextUsbImage (\r
2098 IN CHAR16 *TextDeviceNode\r
2099 )\r
2100{\r
2101 USB_CLASS_TEXT UsbClassText;\r
2102\r
2103 UsbClassText.ClassExist = FALSE;\r
2104 UsbClassText.Class = USB_CLASS_IMAGE;\r
2105 UsbClassText.SubClassExist = TRUE;\r
2106\r
2107 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2108}\r
2109\r
572f5d8a 2110/**\r
2111 Converts a text device path node to USB Print device path structure.\r
2112\r
2113 @param TextDeviceNode The input Text device path node.\r
2114\r
2115 @return A pointer to the newly-created USB Print device path structure.\r
2116\r
2117**/\r
95276127 2118EFI_DEVICE_PATH_PROTOCOL *\r
2119DevPathFromTextUsbPrinter (\r
2120 IN CHAR16 *TextDeviceNode\r
2121 )\r
2122{\r
2123 USB_CLASS_TEXT UsbClassText;\r
2124\r
2125 UsbClassText.ClassExist = FALSE;\r
2126 UsbClassText.Class = USB_CLASS_PRINTER;\r
2127 UsbClassText.SubClassExist = TRUE;\r
2128\r
2129 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2130}\r
2131\r
572f5d8a 2132/**\r
2133 Converts a text device path node to USB mass storage device path structure.\r
2134\r
2135 @param TextDeviceNode The input Text device path node.\r
2136\r
2137 @return A pointer to the newly-created USB mass storage device path structure.\r
2138\r
2139**/\r
95276127 2140EFI_DEVICE_PATH_PROTOCOL *\r
2141DevPathFromTextUsbMassStorage (\r
2142 IN CHAR16 *TextDeviceNode\r
2143 )\r
2144{\r
2145 USB_CLASS_TEXT UsbClassText;\r
2146\r
2147 UsbClassText.ClassExist = FALSE;\r
2148 UsbClassText.Class = USB_CLASS_MASS_STORAGE;\r
2149 UsbClassText.SubClassExist = TRUE;\r
2150\r
2151 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2152}\r
2153\r
572f5d8a 2154/**\r
2155 Converts a text device path node to USB HUB device path structure.\r
2156\r
2157 @param TextDeviceNode The input Text device path node.\r
2158\r
2159 @return A pointer to the newly-created USB HUB device path structure.\r
2160\r
2161**/\r
95276127 2162EFI_DEVICE_PATH_PROTOCOL *\r
2163DevPathFromTextUsbHub (\r
2164 IN CHAR16 *TextDeviceNode\r
2165 )\r
2166{\r
2167 USB_CLASS_TEXT UsbClassText;\r
2168\r
2169 UsbClassText.ClassExist = FALSE;\r
2170 UsbClassText.Class = USB_CLASS_HUB;\r
2171 UsbClassText.SubClassExist = TRUE;\r
2172\r
2173 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2174}\r
2175\r
572f5d8a 2176/**\r
2177 Converts a text device path node to USB CDC data device path structure.\r
2178\r
2179 @param TextDeviceNode The input Text device path node.\r
2180\r
2181 @return A pointer to the newly-created USB CDC data device path structure.\r
2182\r
2183**/\r
95276127 2184EFI_DEVICE_PATH_PROTOCOL *\r
2185DevPathFromTextUsbCDCData (\r
2186 IN CHAR16 *TextDeviceNode\r
2187 )\r
2188{\r
2189 USB_CLASS_TEXT UsbClassText;\r
2190\r
2191 UsbClassText.ClassExist = FALSE;\r
2192 UsbClassText.Class = USB_CLASS_CDCDATA;\r
2193 UsbClassText.SubClassExist = TRUE;\r
2194\r
2195 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2196}\r
2197\r
572f5d8a 2198/**\r
2199 Converts a text device path node to USB smart card device path structure.\r
2200\r
2201 @param TextDeviceNode The input Text device path node.\r
2202\r
2203 @return A pointer to the newly-created USB smart card device path structure.\r
2204\r
2205**/\r
95276127 2206EFI_DEVICE_PATH_PROTOCOL *\r
2207DevPathFromTextUsbSmartCard (\r
2208 IN CHAR16 *TextDeviceNode\r
2209 )\r
2210{\r
2211 USB_CLASS_TEXT UsbClassText;\r
2212\r
2213 UsbClassText.ClassExist = FALSE;\r
2214 UsbClassText.Class = USB_CLASS_SMART_CARD;\r
2215 UsbClassText.SubClassExist = TRUE;\r
2216\r
2217 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2218}\r
2219\r
572f5d8a 2220/**\r
2221 Converts a text device path node to USB video device path structure.\r
2222\r
2223 @param TextDeviceNode The input Text device path node.\r
2224\r
2225 @return A pointer to the newly-created USB video device path structure.\r
2226\r
2227**/\r
95276127 2228EFI_DEVICE_PATH_PROTOCOL *\r
2229DevPathFromTextUsbVideo (\r
2230 IN CHAR16 *TextDeviceNode\r
2231 )\r
2232{\r
2233 USB_CLASS_TEXT UsbClassText;\r
2234\r
2235 UsbClassText.ClassExist = FALSE;\r
2236 UsbClassText.Class = USB_CLASS_VIDEO;\r
2237 UsbClassText.SubClassExist = TRUE;\r
2238\r
2239 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2240}\r
2241\r
572f5d8a 2242/**\r
2243 Converts a text device path node to USB diagnostic device path structure.\r
2244\r
2245 @param TextDeviceNode The input Text device path node.\r
2246\r
2247 @return A pointer to the newly-created USB diagnostic device path structure.\r
2248\r
2249**/\r
95276127 2250EFI_DEVICE_PATH_PROTOCOL *\r
2251DevPathFromTextUsbDiagnostic (\r
2252 IN CHAR16 *TextDeviceNode\r
2253 )\r
2254{\r
2255 USB_CLASS_TEXT UsbClassText;\r
2256\r
2257 UsbClassText.ClassExist = FALSE;\r
2258 UsbClassText.Class = USB_CLASS_DIAGNOSTIC;\r
2259 UsbClassText.SubClassExist = TRUE;\r
2260\r
2261 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2262}\r
2263\r
572f5d8a 2264/**\r
2265 Converts a text device path node to USB wireless device path structure.\r
2266\r
2267 @param TextDeviceNode The input Text device path node.\r
2268\r
2269 @return A pointer to the newly-created USB wireless device path structure.\r
2270\r
2271**/\r
95276127 2272EFI_DEVICE_PATH_PROTOCOL *\r
2273DevPathFromTextUsbWireless (\r
2274 IN CHAR16 *TextDeviceNode\r
2275 )\r
2276{\r
2277 USB_CLASS_TEXT UsbClassText;\r
2278\r
2279 UsbClassText.ClassExist = FALSE;\r
2280 UsbClassText.Class = USB_CLASS_WIRELESS;\r
2281 UsbClassText.SubClassExist = TRUE;\r
2282\r
2283 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2284}\r
2285\r
572f5d8a 2286/**\r
2287 Converts a text device path node to USB device firmware update device path structure.\r
2288\r
2289 @param TextDeviceNode The input Text device path node.\r
2290\r
2291 @return A pointer to the newly-created USB device firmware update device path structure.\r
2292\r
2293**/\r
95276127 2294EFI_DEVICE_PATH_PROTOCOL *\r
2295DevPathFromTextUsbDeviceFirmwareUpdate (\r
2296 IN CHAR16 *TextDeviceNode\r
2297 )\r
2298{\r
2299 USB_CLASS_TEXT UsbClassText;\r
2300\r
2301 UsbClassText.ClassExist = FALSE;\r
2302 UsbClassText.Class = USB_CLASS_RESERVE;\r
2303 UsbClassText.SubClassExist = FALSE;\r
2304 UsbClassText.SubClass = USB_SUBCLASS_FW_UPDATE;\r
2305\r
2306 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2307}\r
2308\r
572f5d8a 2309/**\r
2310 Converts a text device path node to USB IRDA bridge device path structure.\r
2311\r
2312 @param TextDeviceNode The input Text device path node.\r
2313\r
2314 @return A pointer to the newly-created USB IRDA bridge device path structure.\r
2315\r
2316**/\r
95276127 2317EFI_DEVICE_PATH_PROTOCOL *\r
2318DevPathFromTextUsbIrdaBridge (\r
2319 IN CHAR16 *TextDeviceNode\r
2320 )\r
2321{\r
2322 USB_CLASS_TEXT UsbClassText;\r
2323\r
2324 UsbClassText.ClassExist = FALSE;\r
2325 UsbClassText.Class = USB_CLASS_RESERVE;\r
2326 UsbClassText.SubClassExist = FALSE;\r
2327 UsbClassText.SubClass = USB_SUBCLASS_IRDA_BRIDGE;\r
2328\r
2329 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2330}\r
2331\r
572f5d8a 2332/**\r
2333 Converts a text device path node to USB text and measurement device path structure.\r
2334\r
2335 @param TextDeviceNode The input Text device path node.\r
2336\r
2337 @return A pointer to the newly-created USB text and measurement device path structure.\r
2338\r
2339**/\r
95276127 2340EFI_DEVICE_PATH_PROTOCOL *\r
2341DevPathFromTextUsbTestAndMeasurement (\r
2342 IN CHAR16 *TextDeviceNode\r
2343 )\r
2344{\r
2345 USB_CLASS_TEXT UsbClassText;\r
2346\r
2347 UsbClassText.ClassExist = FALSE;\r
2348 UsbClassText.Class = USB_CLASS_RESERVE;\r
2349 UsbClassText.SubClassExist = FALSE;\r
2350 UsbClassText.SubClass = USB_SUBCLASS_TEST;\r
2351\r
2352 return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
2353}\r
2354\r
572f5d8a 2355/**\r
2356 Converts a text device path node to USB WWID device path structure.\r
2357\r
2358 @param TextDeviceNode The input Text device path node.\r
2359\r
2360 @return A pointer to the newly-created USB WWID device path structure.\r
2361\r
2362**/\r
95276127 2363EFI_DEVICE_PATH_PROTOCOL *\r
2364DevPathFromTextUsbWwid (\r
2365 IN CHAR16 *TextDeviceNode\r
2366 )\r
2367{\r
2368 CHAR16 *VIDStr;\r
2369 CHAR16 *PIDStr;\r
2370 CHAR16 *InterfaceNumStr;\r
cf40f28a 2371 CHAR16 *SerialNumberStr;\r
95276127 2372 USB_WWID_DEVICE_PATH *UsbWwid;\r
2373\r
2374 VIDStr = GetNextParamStr (&TextDeviceNode);\r
2375 PIDStr = GetNextParamStr (&TextDeviceNode);\r
2376 InterfaceNumStr = GetNextParamStr (&TextDeviceNode);\r
cf40f28a 2377 SerialNumberStr = GetNextParamStr (&TextDeviceNode);\r
95276127 2378 UsbWwid = (USB_WWID_DEVICE_PATH *) CreateDeviceNode (\r
2379 MESSAGING_DEVICE_PATH,\r
2380 MSG_USB_WWID_DP,\r
cf40f28a 2381 (UINT16) (sizeof (USB_WWID_DEVICE_PATH) + StrSize (SerialNumberStr))\r
95276127 2382 );\r
2383\r
cf40f28a 2384 UsbWwid->VendorId = (UINT16) Strtoi (VIDStr);\r
2385 UsbWwid->ProductId = (UINT16) Strtoi (PIDStr);\r
2386 UsbWwid->InterfaceNumber = (UINT16) Strtoi (InterfaceNumStr);\r
2387 StrCpy ((CHAR16 *) ((UINT8 *) UsbWwid + sizeof (USB_WWID_DEVICE_PATH)), SerialNumberStr);\r
95276127 2388\r
2389 return (EFI_DEVICE_PATH_PROTOCOL *) UsbWwid;\r
2390}\r
2391\r
572f5d8a 2392/**\r
2393 Converts a text device path node to Logic Unit device path structure.\r
2394\r
2395 @param TextDeviceNode The input Text device path node.\r
2396\r
2397 @return A pointer to the newly-created Logic Unit device path structure.\r
2398\r
2399**/\r
95276127 2400EFI_DEVICE_PATH_PROTOCOL *\r
2401DevPathFromTextUnit (\r
2402 IN CHAR16 *TextDeviceNode\r
2403 )\r
2404{\r
2405 CHAR16 *LunStr;\r
2406 DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;\r
2407\r
2408 LunStr = GetNextParamStr (&TextDeviceNode);\r
2409 LogicalUnit = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *) CreateDeviceNode (\r
2410 MESSAGING_DEVICE_PATH,\r
2411 MSG_DEVICE_LOGICAL_UNIT_DP,\r
cf40f28a 2412 (UINT16) sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH)\r
95276127 2413 );\r
2414\r
cf40f28a 2415 LogicalUnit->Lun = (UINT8) Strtoi (LunStr);\r
95276127 2416\r
2417 return (EFI_DEVICE_PATH_PROTOCOL *) LogicalUnit;\r
2418}\r
2419\r
572f5d8a 2420/**\r
2421 Converts a text device path node to iSCSI device path structure.\r
2422\r
2423 @param TextDeviceNode The input Text device path node.\r
2424\r
2425 @return A pointer to the newly-created iSCSI device path structure.\r
2426\r
2427**/\r
95276127 2428EFI_DEVICE_PATH_PROTOCOL *\r
2429DevPathFromTextiSCSI (\r
2430 IN CHAR16 *TextDeviceNode\r
2431 )\r
2432{\r
2433 UINT16 Options;\r
2434 CHAR16 *NameStr;\r
2435 CHAR16 *PortalGroupStr;\r
2436 CHAR16 *LunStr;\r
2437 CHAR16 *HeaderDigestStr;\r
2438 CHAR16 *DataDigestStr;\r
2439 CHAR16 *AuthenticationStr;\r
2440 CHAR16 *ProtocolStr;\r
cf40f28a 2441 CHAR8 *AsciiStr;\r
572f5d8a 2442 ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;\r
95276127 2443\r
2444 NameStr = GetNextParamStr (&TextDeviceNode);\r
2445 PortalGroupStr = GetNextParamStr (&TextDeviceNode);\r
2446 LunStr = GetNextParamStr (&TextDeviceNode);\r
2447 HeaderDigestStr = GetNextParamStr (&TextDeviceNode);\r
2448 DataDigestStr = GetNextParamStr (&TextDeviceNode);\r
2449 AuthenticationStr = GetNextParamStr (&TextDeviceNode);\r
2450 ProtocolStr = GetNextParamStr (&TextDeviceNode);\r
572f5d8a 2451 ISCSIDevPath = (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode (\r
95276127 2452 MESSAGING_DEVICE_PATH,\r
2453 MSG_ISCSI_DP,\r
047c6449 2454 (UINT16) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + StrLen (NameStr))\r
95276127 2455 );\r
2456\r
184f7d83 2457 AsciiStr = ISCSIDevPath->TargetName;\r
cf40f28a 2458 StrToAscii (NameStr, &AsciiStr);\r
2459\r
572f5d8a 2460 ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);\r
2461 Strtoi64 (LunStr, &ISCSIDevPath->Lun);\r
95276127 2462\r
2463 Options = 0x0000;\r
2464 if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) {\r
2465 Options |= 0x0002;\r
2466 }\r
2467\r
2468 if (StrCmp (DataDigestStr, L"CRC32C") == 0) {\r
2469 Options |= 0x0008;\r
2470 }\r
2471\r
2472 if (StrCmp (AuthenticationStr, L"None") == 0) {\r
2473 Options |= 0x0800;\r
2474 }\r
2475\r
2476 if (StrCmp (AuthenticationStr, L"CHAP_UNI") == 0) {\r
2477 Options |= 0x1000;\r
2478 }\r
2479\r
572f5d8a 2480 ISCSIDevPath->LoginOption = (UINT16) Options;\r
95276127 2481\r
572f5d8a 2482 ISCSIDevPath->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP");\r
95276127 2483\r
572f5d8a 2484 return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;\r
95276127 2485}\r
2486\r
8f97f911 2487/**\r
2488 Converts a text device path node to VLAN device path structure.\r
2489\r
2490 @param TextDeviceNode The input Text device path node.\r
2491\r
2492 @return A pointer to the newly-created VLAN device path structure.\r
2493\r
2494**/\r
2495EFI_DEVICE_PATH_PROTOCOL *\r
2496DevPathFromTextVlan (\r
2497 IN CHAR16 *TextDeviceNode\r
2498 )\r
2499{\r
2500 CHAR16 *VlanStr;\r
2501 VLAN_DEVICE_PATH *Vlan;\r
2502\r
2503 VlanStr = GetNextParamStr (&TextDeviceNode);\r
2504 Vlan = (VLAN_DEVICE_PATH *) CreateDeviceNode (\r
2505 MESSAGING_DEVICE_PATH,\r
2506 MSG_VLAN_DP,\r
c9325700 2507 (UINT16) sizeof (VLAN_DEVICE_PATH)\r
8f97f911 2508 );\r
2509\r
2510 Vlan->VlanId = (UINT16) Strtoi (VlanStr);\r
2511\r
2512 return (EFI_DEVICE_PATH_PROTOCOL *) Vlan;\r
2513}\r
2514\r
572f5d8a 2515/**\r
2516 Converts a text device path node to HD device path structure.\r
2517\r
2518 @param TextDeviceNode The input Text device path node.\r
2519\r
2520 @return A pointer to the newly-created HD device path structure.\r
2521\r
2522**/\r
95276127 2523EFI_DEVICE_PATH_PROTOCOL *\r
2524DevPathFromTextHD (\r
2525 IN CHAR16 *TextDeviceNode\r
2526 )\r
2527{\r
2528 CHAR16 *PartitionStr;\r
2529 CHAR16 *TypeStr;\r
2530 CHAR16 *SignatureStr;\r
2531 CHAR16 *StartStr;\r
2532 CHAR16 *SizeStr;\r
2533 UINT32 Signature32;\r
2534 EFI_GUID SignatureGuid;\r
2535 HARDDRIVE_DEVICE_PATH *Hd;\r
2536\r
2537 PartitionStr = GetNextParamStr (&TextDeviceNode);\r
2538 TypeStr = GetNextParamStr (&TextDeviceNode);\r
2539 SignatureStr = GetNextParamStr (&TextDeviceNode);\r
2540 StartStr = GetNextParamStr (&TextDeviceNode);\r
2541 SizeStr = GetNextParamStr (&TextDeviceNode);\r
2542 Hd = (HARDDRIVE_DEVICE_PATH *) CreateDeviceNode (\r
2543 MEDIA_DEVICE_PATH,\r
2544 MEDIA_HARDDRIVE_DP,\r
c9325700 2545 (UINT16) sizeof (HARDDRIVE_DEVICE_PATH)\r
95276127 2546 );\r
2547\r
cf40f28a 2548 Hd->PartitionNumber = (UINT32) Dtoi (PartitionStr);\r
95276127 2549\r
2550 ZeroMem (Hd->Signature, 16);\r
2551 Hd->MBRType = (UINT8) 0;\r
2552\r
cf40f28a 2553 if (StrCmp (TypeStr, L"MBR") == 0) {\r
95276127 2554 Hd->SignatureType = SIGNATURE_TYPE_MBR;\r
2555 Hd->MBRType = 0x01;\r
2556\r
cf40f28a 2557 Signature32 = (UINT32) Strtoi (SignatureStr);\r
95276127 2558 CopyMem (Hd->Signature, &Signature32, sizeof (UINT32));\r
cf40f28a 2559 } else if (StrCmp (TypeStr, L"GPT") == 0) {\r
95276127 2560 Hd->SignatureType = SIGNATURE_TYPE_GUID;\r
2561 Hd->MBRType = 0x02;\r
2562\r
2563 StrToGuid (SignatureStr, &SignatureGuid);\r
2564 CopyMem (Hd->Signature, &SignatureGuid, sizeof (EFI_GUID));\r
2565 } else {\r
cf40f28a 2566 Hd->SignatureType = (UINT8) Strtoi (TypeStr);\r
95276127 2567 }\r
2568\r
cf40f28a 2569 Strtoi64 (StartStr, &Hd->PartitionStart);\r
2570 Strtoi64 (SizeStr, &Hd->PartitionSize);\r
95276127 2571\r
2572 return (EFI_DEVICE_PATH_PROTOCOL *) Hd;\r
2573}\r
2574\r
572f5d8a 2575/**\r
2576 Converts a text device path node to CDROM device path structure.\r
2577\r
2578 @param TextDeviceNode The input Text device path node.\r
2579\r
2580 @return A pointer to the newly-created CDROM device path structure.\r
2581\r
2582**/\r
95276127 2583EFI_DEVICE_PATH_PROTOCOL *\r
2584DevPathFromTextCDROM (\r
2585 IN CHAR16 *TextDeviceNode\r
2586 )\r
2587{\r
2588 CHAR16 *EntryStr;\r
2589 CHAR16 *StartStr;\r
2590 CHAR16 *SizeStr;\r
572f5d8a 2591 CDROM_DEVICE_PATH *CDROMDevPath;\r
95276127 2592\r
2593 EntryStr = GetNextParamStr (&TextDeviceNode);\r
2594 StartStr = GetNextParamStr (&TextDeviceNode);\r
2595 SizeStr = GetNextParamStr (&TextDeviceNode);\r
572f5d8a 2596 CDROMDevPath = (CDROM_DEVICE_PATH *) CreateDeviceNode (\r
95276127 2597 MEDIA_DEVICE_PATH,\r
2598 MEDIA_CDROM_DP,\r
c9325700 2599 (UINT16) sizeof (CDROM_DEVICE_PATH)\r
95276127 2600 );\r
2601\r
572f5d8a 2602 CDROMDevPath->BootEntry = (UINT32) Strtoi (EntryStr);\r
2603 Strtoi64 (StartStr, &CDROMDevPath->PartitionStart);\r
2604 Strtoi64 (SizeStr, &CDROMDevPath->PartitionSize);\r
95276127 2605\r
572f5d8a 2606 return (EFI_DEVICE_PATH_PROTOCOL *) CDROMDevPath;\r
95276127 2607}\r
2608\r
572f5d8a 2609/**\r
2610 Converts a text device path node to Vendor-defined media device path structure.\r
2611\r
2612 @param TextDeviceNode The input Text device path node.\r
2613\r
2614 @return A pointer to the newly-created Vendor-defined media device path structure.\r
2615\r
2616**/\r
95276127 2617EFI_DEVICE_PATH_PROTOCOL *\r
2618DevPathFromTextVenMEDIA (\r
2619 IN CHAR16 *TextDeviceNode\r
2620 )\r
2621{\r
2622 return ConvertFromTextVendor (\r
2623 TextDeviceNode,\r
2624 MEDIA_DEVICE_PATH,\r
2625 MEDIA_VENDOR_DP\r
2626 );\r
2627}\r
2628\r
572f5d8a 2629/**\r
2630 Converts a text device path node to File device path structure.\r
2631\r
2632 @param TextDeviceNode The input Text device path node.\r
2633\r
2634 @return A pointer to the newly-created File device path structure.\r
2635\r
2636**/\r
95276127 2637EFI_DEVICE_PATH_PROTOCOL *\r
2638DevPathFromTextFilePath (\r
2639 IN CHAR16 *TextDeviceNode\r
2640 )\r
2641{\r
2642 FILEPATH_DEVICE_PATH *File;\r
2643\r
2644 File = (FILEPATH_DEVICE_PATH *) CreateDeviceNode (\r
2645 MEDIA_DEVICE_PATH,\r
2646 MEDIA_FILEPATH_DP,\r
d074a8e1 2647 (UINT16) (sizeof (FILEPATH_DEVICE_PATH) + StrLen (TextDeviceNode) * 2)\r
95276127 2648 );\r
2649\r
2650 StrCpy (File->PathName, TextDeviceNode);\r
2651\r
2652 return (EFI_DEVICE_PATH_PROTOCOL *) File;\r
2653}\r
2654\r
572f5d8a 2655/**\r
2656 Converts a text device path node to Media protocol device path structure.\r
2657\r
2658 @param TextDeviceNode The input Text device path node.\r
2659\r
2660 @return A pointer to the newly-created Media protocol device path structure.\r
2661\r
2662**/\r
95276127 2663EFI_DEVICE_PATH_PROTOCOL *\r
2664DevPathFromTextMedia (\r
2665 IN CHAR16 *TextDeviceNode\r
2666 )\r
2667{\r
2668 CHAR16 *GuidStr;\r
2669 MEDIA_PROTOCOL_DEVICE_PATH *Media;\r
2670\r
2671 GuidStr = GetNextParamStr (&TextDeviceNode);\r
2672 Media = (MEDIA_PROTOCOL_DEVICE_PATH *) CreateDeviceNode (\r
2673 MEDIA_DEVICE_PATH,\r
2674 MEDIA_PROTOCOL_DP,\r
c9325700 2675 (UINT16) sizeof (MEDIA_PROTOCOL_DEVICE_PATH)\r
95276127 2676 );\r
2677\r
2678 StrToGuid (GuidStr, &Media->Protocol);\r
2679\r
2680 return (EFI_DEVICE_PATH_PROTOCOL *) Media;\r
2681}\r
2682\r
572f5d8a 2683/**\r
2684 Converts a text device path node to firmware volume device path structure.\r
2685\r
2686 @param TextDeviceNode The input Text device path node.\r
2687\r
2688 @return A pointer to the newly-created firmware volume device path structure.\r
2689\r
2690**/\r
cf40f28a 2691EFI_DEVICE_PATH_PROTOCOL *\r
2692DevPathFromTextFv (\r
2693 IN CHAR16 *TextDeviceNode\r
2694 )\r
2695{\r
2696 CHAR16 *GuidStr;\r
2697 MEDIA_FW_VOL_DEVICE_PATH *Fv;\r
2698\r
2699 GuidStr = GetNextParamStr (&TextDeviceNode);\r
2700 Fv = (MEDIA_FW_VOL_DEVICE_PATH *) CreateDeviceNode (\r
2701 MEDIA_DEVICE_PATH,\r
2702 MEDIA_PIWG_FW_VOL_DP,\r
c9325700 2703 (UINT16) sizeof (MEDIA_FW_VOL_DEVICE_PATH)\r
cf40f28a 2704 );\r
2705\r
2706 StrToGuid (GuidStr, &Fv->FvName);\r
2707\r
2708 return (EFI_DEVICE_PATH_PROTOCOL *) Fv;\r
2709}\r
2710\r
572f5d8a 2711/**\r
2712 Converts a text device path node to firmware file device path structure.\r
2713\r
2714 @param TextDeviceNode The input Text device path node.\r
2715\r
2716 @return A pointer to the newly-created firmware file device path structure.\r
2717\r
2718**/\r
cf40f28a 2719EFI_DEVICE_PATH_PROTOCOL *\r
2720DevPathFromTextFvFile (\r
2721 IN CHAR16 *TextDeviceNode\r
2722 )\r
2723{\r
2724 CHAR16 *GuidStr;\r
2725 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile;\r
2726\r
2727 GuidStr = GetNextParamStr (&TextDeviceNode);\r
2728 FvFile = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) CreateDeviceNode (\r
2729 MEDIA_DEVICE_PATH,\r
2730 MEDIA_PIWG_FW_FILE_DP,\r
c9325700 2731 (UINT16) sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH)\r
cf40f28a 2732 );\r
2733\r
2734 StrToGuid (GuidStr, &FvFile->FvFileName);\r
2735\r
2736 return (EFI_DEVICE_PATH_PROTOCOL *) FvFile;\r
2737}\r
2738\r
192b057b 2739/**\r
2740 Converts a text device path node to text relative offset device path structure.\r
2741\r
2742 @param TextDeviceNode The input Text device path node.\r
2743\r
2744 @return A pointer to the newly-created Text device path structure.\r
2745\r
2746**/\r
2747EFI_DEVICE_PATH_PROTOCOL *\r
2748DevPathFromTextRelativeOffsetRange (\r
2749 IN CHAR16 *TextDeviceNode\r
2750 )\r
2751{\r
395ed063 2752 CHAR16 *StartingOffsetStr;\r
2753 CHAR16 *EndingOffsetStr;\r
2754 MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;\r
192b057b 2755\r
2756 StartingOffsetStr = GetNextParamStr (&TextDeviceNode);\r
2757 EndingOffsetStr = GetNextParamStr (&TextDeviceNode);\r
395ed063 2758 Offset = (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *) CreateDeviceNode (\r
2759 MEDIA_DEVICE_PATH,\r
2760 MEDIA_RELATIVE_OFFSET_RANGE_DP,\r
c9325700 2761 (UINT16) sizeof (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH)\r
395ed063 2762 );\r
2763\r
792a1534 2764 Strtoi64 (StartingOffsetStr, &Offset->StartingOffset);\r
2765 Strtoi64 (EndingOffsetStr, &Offset->EndingOffset);\r
192b057b 2766\r
2767 return (EFI_DEVICE_PATH_PROTOCOL *) Offset;\r
2768}\r
2769\r
572f5d8a 2770/**\r
2771 Converts a text device path node to BIOS Boot Specification device path structure.\r
2772\r
2773 @param TextDeviceNode The input Text device path node.\r
2774\r
5755841f 2775 @return A pointer to the newly-created BIOS Boot Specification device path structure.\r
572f5d8a 2776\r
2777**/\r
95276127 2778EFI_DEVICE_PATH_PROTOCOL *\r
2779DevPathFromTextBBS (\r
2780 IN CHAR16 *TextDeviceNode\r
2781 )\r
2782{\r
2783 CHAR16 *TypeStr;\r
2784 CHAR16 *IdStr;\r
2785 CHAR16 *FlagsStr;\r
cf40f28a 2786 CHAR8 *AsciiStr;\r
95276127 2787 BBS_BBS_DEVICE_PATH *Bbs;\r
2788\r
2789 TypeStr = GetNextParamStr (&TextDeviceNode);\r
2790 IdStr = GetNextParamStr (&TextDeviceNode);\r
2791 FlagsStr = GetNextParamStr (&TextDeviceNode);\r
2792 Bbs = (BBS_BBS_DEVICE_PATH *) CreateDeviceNode (\r
2793 BBS_DEVICE_PATH,\r
2794 BBS_BBS_DP,\r
d074a8e1 2795 (UINT16) (sizeof (BBS_BBS_DEVICE_PATH) + StrLen (IdStr))\r
95276127 2796 );\r
2797\r
2798 if (StrCmp (TypeStr, L"Floppy") == 0) {\r
2799 Bbs->DeviceType = BBS_TYPE_FLOPPY;\r
2800 } else if (StrCmp (TypeStr, L"HD") == 0) {\r
2801 Bbs->DeviceType = BBS_TYPE_HARDDRIVE;\r
2802 } else if (StrCmp (TypeStr, L"CDROM") == 0) {\r
2803 Bbs->DeviceType = BBS_TYPE_CDROM;\r
2804 } else if (StrCmp (TypeStr, L"PCMCIA") == 0) {\r
2805 Bbs->DeviceType = BBS_TYPE_PCMCIA;\r
2806 } else if (StrCmp (TypeStr, L"USB") == 0) {\r
2807 Bbs->DeviceType = BBS_TYPE_USB;\r
2808 } else if (StrCmp (TypeStr, L"Network") == 0) {\r
2809 Bbs->DeviceType = BBS_TYPE_EMBEDDED_NETWORK;\r
2810 } else {\r
cf40f28a 2811 Bbs->DeviceType = (UINT16) Strtoi (TypeStr);\r
95276127 2812 }\r
2813\r
cf40f28a 2814 AsciiStr = Bbs->String;\r
2815 StrToAscii (IdStr, &AsciiStr);\r
95276127 2816\r
cf40f28a 2817 Bbs->StatusFlag = (UINT16) Strtoi (FlagsStr);\r
95276127 2818\r
2819 return (EFI_DEVICE_PATH_PROTOCOL *) Bbs;\r
2820}\r
2821\r
572f5d8a 2822/**\r
2823 Converts a text device path node to SATA device path structure.\r
2824\r
2825 @param TextDeviceNode The input Text device path node.\r
2826\r
2827 @return A pointer to the newly-created SATA device path structure.\r
2828\r
2829**/\r
cf40f28a 2830EFI_DEVICE_PATH_PROTOCOL *\r
2831DevPathFromTextSata (\r
2832 IN CHAR16 *TextDeviceNode\r
2833 )\r
2834{\r
2835 SATA_DEVICE_PATH *Sata;\r
2836 CHAR16 *Param1;\r
2837 CHAR16 *Param2;\r
2838 CHAR16 *Param3;\r
2839\r
2840 //\r
2841 // The PMPN is optional.\r
2842 //\r
2843 Param1 = GetNextParamStr (&TextDeviceNode);\r
2844 Param2 = GetNextParamStr (&TextDeviceNode);\r
2845 Param3 = NULL;\r
2846 if (!IS_NULL (TextDeviceNode)) {\r
2847 Param3 = GetNextParamStr (&TextDeviceNode);\r
2848 }\r
2849\r
2850 Sata = (SATA_DEVICE_PATH *) CreateDeviceNode (\r
2851 MESSAGING_DEVICE_PATH,\r
2852 MSG_SATA_DP,\r
c9325700 2853 (UINT16) sizeof (SATA_DEVICE_PATH)\r
cf40f28a 2854 );\r
93e3992d 2855 Sata->HBAPortNumber = (UINT16) Xtoi (Param1);\r
cf40f28a 2856 if (Param3 != NULL) {\r
93e3992d 2857 Sata->PortMultiplierPortNumber = (UINT16) Xtoi (Param2);\r
cf40f28a 2858 Param2 = Param3;\r
2859 } else {\r
186ca8b0 2860 Sata->PortMultiplierPortNumber = SATA_HBA_DIRECT_CONNECT_FLAG;\r
cf40f28a 2861 }\r
93e3992d 2862 Sata->Lun = (UINT16) Xtoi (Param2);\r
cf40f28a 2863\r
2864 return (EFI_DEVICE_PATH_PROTOCOL *) Sata;\r
2865}\r
2866\r
95276127 2867GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[] = {\r
2868 {L"Pci", DevPathFromTextPci},\r
2869 {L"PcCard", DevPathFromTextPcCard},\r
2870 {L"MemoryMapped", DevPathFromTextMemoryMapped},\r
2871 {L"VenHw", DevPathFromTextVenHw},\r
2872 {L"Ctrl", DevPathFromTextCtrl},\r
2873 {L"Acpi", DevPathFromTextAcpi},\r
2874 {L"PciRoot", DevPathFromTextPciRoot},\r
e9b3cd55 2875 {L"PcieRoot", DevPathFromTextPcieRoot},\r
95276127 2876 {L"Floppy", DevPathFromTextFloppy},\r
2877 {L"Keyboard", DevPathFromTextKeyboard},\r
2878 {L"Serial", DevPathFromTextSerial},\r
2879 {L"ParallelPort", DevPathFromTextParallelPort},\r
2880 {L"AcpiEx", DevPathFromTextAcpiEx},\r
2881 {L"AcpiExp", DevPathFromTextAcpiExp},\r
5b84091f 2882 {L"AcpiAdr", DevPathFromTextAcpiAdr},\r
95276127 2883 {L"Ata", DevPathFromTextAta},\r
2884 {L"Scsi", DevPathFromTextScsi},\r
2885 {L"Fibre", DevPathFromTextFibre},\r
e9b3cd55 2886 {L"FibreEx", DevPathFromTextFibreEx},\r
95276127 2887 {L"I1394", DevPathFromText1394},\r
2888 {L"USB", DevPathFromTextUsb},\r
2889 {L"I2O", DevPathFromTextI2O},\r
2890 {L"Infiniband", DevPathFromTextInfiniband},\r
2891 {L"VenMsg", DevPathFromTextVenMsg},\r
2892 {L"VenPcAnsi", DevPathFromTextVenPcAnsi},\r
2893 {L"VenVt100", DevPathFromTextVenVt100},\r
2894 {L"VenVt100Plus", DevPathFromTextVenVt100Plus},\r
2895 {L"VenUtf8", DevPathFromTextVenUtf8},\r
2896 {L"UartFlowCtrl", DevPathFromTextUartFlowCtrl},