-/*++\r
+/** @file\r
+ DevicePathFromText protocol as defined in the UEFI 2.0 specification.\r
\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
\r
-Module Name:\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
- DevicePathFromText.c\r
+**/\r
\r
-Abstract:\r
+#include "DevicePath.h"\r
\r
- DevicePathFromText protocol as defined in the UEFI 2.0 specification.\r
\r
---*/\r
+/**\r
\r
-#include "DevicePath.h"\r
+ Duplicates a string.\r
\r
-STATIC\r
+ @param Src Source string.\r
+\r
+ @return The duplicated string.\r
+\r
+**/\r
CHAR16 *\r
StrDuplicate (\r
IN CONST CHAR16 *Src\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Duplicate a string\r
-\r
- Arguments:\r
- Src - Source string\r
-\r
- Returns:\r
- Duplicated string\r
-\r
---*/\r
{\r
- UINTN Length;\r
- CHAR16 *ReturnStr;\r
+ return AllocateCopyPool (StrSize (Src), Src);\r
+}\r
\r
- Length = StrLen ((CHAR16 *) Src);\r
+/**\r
\r
- ReturnStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), (VOID *) Src);\r
+ Get parameter in a pair of parentheses follow the given node name.\r
+ For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1".\r
\r
- return ReturnStr;\r
-}\r
+ @param Str Device Path Text.\r
+ @param NodeName Name of the node.\r
+\r
+ @return Parameter text for the node.\r
\r
-STATIC\r
+**/\r
CHAR16 *\r
GetParamByNodeName (\r
IN CHAR16 *Str,\r
IN CHAR16 *NodeName\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Get parameter in a pair of parentheses follow the given node name.\r
- For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1".\r
-\r
- Arguments:\r
- Str - Device Path Text\r
- NodeName - Name of the node\r
-\r
- Returns:\r
- Parameter text for the node\r
-\r
---*/\r
{\r
CHAR16 *ParamStr;\r
CHAR16 *StrPointer;\r
return ParamStr;\r
}\r
\r
-STATIC\r
+/**\r
+ Gets current sub-string from a string list, before return\r
+ the list header is moved to next sub-string. The sub-string is separated\r
+ by the specified character. For example, the separator is ',', the string\r
+ list is "2,0,3", it returns "2", the remain list move to "0,3"\r
+\r
+ @param List A string list separated by the specified separator\r
+ @param Separator The separator character\r
+\r
+ @return A pointer to the current sub-string\r
+\r
+**/\r
CHAR16 *\r
SplitStr (\r
IN OUT CHAR16 **List,\r
IN CHAR16 Separator\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Get current sub-string from a string list, before return\r
- the list header is moved to next sub-string. The sub-string is separated\r
- by the specified character. For example, the separator is ',', the string\r
- list is "2,0,3", it returns "2", the remain list move to "0,3"\r
-\r
- Arguments:\r
- List - A string list separated by the specified separator\r
- Separator - The separator character\r
-\r
- Returns:\r
- pointer - The current sub-string\r
-\r
---*/\r
{\r
CHAR16 *Str;\r
CHAR16 *ReturnStr;\r
return ReturnStr;\r
}\r
\r
-STATIC\r
+/**\r
+ Gets the next parameter string from the list.\r
+\r
+ @param List A string list separated by the specified separator\r
+\r
+ @return A pointer to the current sub-string\r
+\r
+**/\r
CHAR16 *\r
GetNextParamStr (\r
IN OUT CHAR16 **List\r
return SplitStr (List, L',');\r
}\r
\r
-STATIC\r
+/**\r
+ Get one device node from entire device path text.\r
+\r
+ @param DevicePath On input, the current Device Path node; on output, the next device path node\r
+ @param IsInstanceEnd This node is the end of a device path instance\r
+\r
+ @return A device node text or NULL if no more device node available\r
+\r
+**/\r
CHAR16 *\r
GetNextDeviceNodeStr (\r
IN OUT CHAR16 **DevicePath,\r
OUT BOOLEAN *IsInstanceEnd\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Get one device node from entire device path text.\r
-\r
- Arguments:\r
- Str - The entire device path text string\r
- IsInstanceEnd - This node is the end of a device path instance\r
-\r
- Returns:\r
- a pointer - A device node text\r
- NULL - No more device node available\r
-\r
---*/\r
{\r
CHAR16 *Str;\r
CHAR16 *ReturnStr;\r
return ReturnStr;\r
}\r
\r
-STATIC\r
-BOOLEAN\r
-IsHexDigit (\r
- OUT UINT8 *Digit,\r
- IN CHAR16 Char\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Determines if a Unicode character is a hexadecimal digit.\r
- The test is case insensitive.\r
\r
- Arguments:\r
- Digit - Pointer to byte that receives the value of the hex character.\r
- Char - Unicode character to test.\r
+/**\r
+ Skip the leading white space and '0x' or '0X' of a integer string\r
\r
- Returns:\r
- TRUE - If the character is a hexadecimal digit.\r
- FALSE - Otherwise.\r
+ @param Str The integer string\r
+ @param IsHex TRUE: Hex string, FALSE: Decimal string\r
\r
---*/\r
-{\r
- if ((Char >= L'0') && (Char <= L'9')) {\r
- *Digit = (UINT8) (Char - L'0');\r
- return TRUE;\r
- }\r
-\r
- if ((Char >= L'A') && (Char <= L'F')) {\r
- *Digit = (UINT8) (Char - L'A' + 0x0A);\r
- return TRUE;\r
- }\r
-\r
- if ((Char >= L'a') && (Char <= L'f')) {\r
- *Digit = (UINT8) (Char - L'a' + 0x0A);\r
- return TRUE;\r
- }\r
-\r
- return FALSE;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-HexStringToBuf (\r
- IN OUT UINT8 *Buf, \r
- IN OUT UINTN *Len,\r
- IN CHAR16 *Str,\r
- OUT UINTN *ConvertedStrLen OPTIONAL\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Converts Unicode string to binary buffer.\r
- The conversion may be partial.\r
- The first character in the string that is not hex digit stops the conversion.\r
- At a minimum, any blob of data could be represented as a hex string.\r
-\r
- Arguments:\r
- Buf - Pointer to buffer that receives the data.\r
- Len - Length in bytes of the buffer to hold converted data.\r
- If routine return with EFI_SUCCESS, containing length of converted data.\r
- If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.\r
- Str - String to be converted from.\r
- ConvertedStrLen - Length of the Hex String consumed.\r
-\r
- Returns:\r
- EFI_SUCCESS: Routine Success.\r
- EFI_BUFFER_TOO_SMALL: The buffer is too small to hold converted data.\r
- EFI_\r
-\r
---*/\r
-{\r
- UINTN HexCnt;\r
- UINTN Idx;\r
- UINTN BufferLength;\r
- UINT8 Digit;\r
- UINT8 Byte;\r
+ @return The trimmed Hex string.\r
\r
- Digit = 0;\r
-\r
- //\r
- // Find out how many hex characters the string has.\r
- //\r
- for (Idx = 0, HexCnt = 0; IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);\r
-\r
- if (HexCnt == 0) {\r
- *Len = 0;\r
- return EFI_SUCCESS;\r
- }\r
- //\r
- // Two Unicode characters make up 1 buffer byte. Round up.\r
- //\r
- BufferLength = (HexCnt + 1) / 2; \r
-\r
- //\r
- // Test if buffer is passed enough.\r
- //\r
- if (BufferLength > (*Len)) {\r
- *Len = BufferLength;\r
- return EFI_BUFFER_TOO_SMALL;\r
- }\r
-\r
- *Len = BufferLength;\r
-\r
- for (Idx = 0; Idx < HexCnt; Idx++) {\r
-\r
- IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]);\r
-\r
- //\r
- // For odd charaters, write the lower nibble for each buffer byte,\r
- // and for even characters, the upper nibble.\r
- //\r
- if ((Idx & 1) == 0) {\r
- Byte = Digit;\r
- } else {\r
- Byte = Buf[Idx / 2];\r
- Byte &= 0x0F;\r
- Byte = (UINT8) (Byte | Digit << 4);\r
- }\r
-\r
- Buf[Idx / 2] = Byte;\r
- }\r
-\r
- if (ConvertedStrLen != NULL) {\r
- *ConvertedStrLen = HexCnt;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-STATIC\r
+**/\r
CHAR16 *\r
TrimHexStr (\r
IN CHAR16 *Str,\r
OUT BOOLEAN *IsHex\r
)\r
-/*++\r
-\r
- Routine Description:\r
- Skip the leading white space and '0x' or '0X' of a integer string\r
-\r
- Arguments:\r
- Str - The integer string\r
- IsHex - 1: Hex string, 0: Decimal string\r
-\r
- Returns:\r
-\r
---*/\r
{\r
*IsHex = FALSE;\r
\r
//\r
// skip preceeding white space\r
//\r
- while (*Str && *Str == ' ') {\r
+ while ((*Str != 0) && *Str == ' ') {\r
Str += 1;\r
}\r
//\r
// skip preceeding zeros\r
//\r
- while (*Str && *Str == '0') {\r
+ while ((*Str != 0) && *Str == '0') {\r
Str += 1;\r
}\r
//\r
// skip preceeding character 'x' or 'X'\r
//\r
- if (*Str && (*Str == 'x' || *Str == 'X')) {\r
+ if ((*Str != 0) && (*Str == 'x' || *Str == 'X')) {\r
Str += 1;\r
*IsHex = TRUE;\r
}\r
return Str;\r
}\r
\r
-STATIC\r
-UINTN\r
-Xtoi (\r
- IN CHAR16 *Str\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
- Convert hex string to uint\r
+ Convert hex string to uint.\r
\r
-Arguments:\r
+ @param Str The hex string\r
\r
- Str - The string\r
- \r
-Returns:\r
+ @return A UINTN value represented by Str\r
\r
---*/\r
+**/\r
+UINTN\r
+Xtoi (\r
+ IN CHAR16 *Str\r
+ )\r
{\r
- UINTN Rvalue;\r
- UINTN Length;\r
+ return StrHexToUintn (Str);\r
+}\r
\r
- ASSERT (Str != NULL);\r
+/**\r
\r
- //\r
- // convert hex digits\r
- //\r
- Rvalue = 0;\r
- Length = sizeof (UINTN);\r
- HexStringToBuf ((UINT8 *) &Rvalue, &Length, Str, NULL);\r
+ Convert hex string to 64 bit data.\r
\r
- return Rvalue;\r
-}\r
+ @param Str The hex string\r
+ @param Data A pointer to the UINT64 value represented by Str\r
\r
-STATIC\r
+**/\r
VOID\r
Xtoi64 (\r
- IN CHAR16 *Str,\r
- IN UINT64 *Data\r
+ IN CHAR16 *Str,\r
+ OUT UINT64 *Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Convert hex string to 64 bit data.\r
+{\r
+ *Data = StrHexToUint64 (Str);\r
+}\r
\r
-Arguments:\r
+/**\r
\r
- Str - The string\r
- \r
-Returns:\r
+ Convert decimal string to uint.\r
\r
---*/\r
-{\r
- UINTN Length;\r
+ @param Str The decimal string\r
\r
- *Data = 0;\r
- Length = sizeof (UINT64);\r
- HexStringToBuf ((UINT8 *) Data, &Length, Str, NULL);\r
-}\r
+ @return A UINTN value represented by Str\r
\r
-STATIC\r
+**/\r
UINTN\r
Dtoi (\r
- IN CHAR16 *str\r
+ IN CHAR16 *Str\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Convert decimal string to uint\r
-\r
-Arguments:\r
-\r
- Str - The string\r
- \r
-Returns:\r
-\r
---*/\r
{\r
UINTN Rvalue;\r
CHAR16 Char;\r
UINTN High;\r
UINTN Low;\r
\r
- ASSERT (str != NULL);\r
+ ASSERT (Str != NULL);\r
\r
High = (UINTN) -1 / 10;\r
Low = (UINTN) -1 % 10;\r
//\r
// skip preceeding white space\r
//\r
- while (*str && *str == ' ') {\r
- str += 1;\r
+ while ((*Str != 0) && *Str == ' ') {\r
+ Str += 1;\r
}\r
//\r
// convert digits\r
//\r
Rvalue = 0;\r
- Char = *(str++);\r
- while (Char) {\r
+ Char = *(Str++);\r
+ while (Char != 0) {\r
if (Char >= '0' && Char <= '9') {\r
if ((Rvalue > High || Rvalue == High) && (Char - '0' > (INTN) Low)) {\r
return (UINTN) -1;\r
break;\r
}\r
\r
- Char = *(str++);\r
+ Char = *(Str++);\r
}\r
\r
return Rvalue;\r
}\r
\r
-STATIC\r
+/**\r
+\r
+ Convert decimal string to uint.\r
+\r
+ @param Str The decimal string\r
+ @param Data A pointer to the UINT64 value represented by Str\r
+\r
+**/\r
VOID\r
Dtoi64 (\r
- IN CHAR16 *str,\r
+ IN CHAR16 *Str,\r
OUT UINT64 *Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Convert decimal string to uint\r
-\r
-Arguments:\r
-\r
- Str - The string\r
-\r
-Returns:\r
-\r
---*/\r
{\r
UINT64 Rvalue;\r
CHAR16 Char;\r
UINT64 High;\r
UINT64 Low;\r
\r
- ASSERT (str != NULL);\r
+ ASSERT (Str != NULL);\r
ASSERT (Data != NULL);\r
\r
//\r
// skip preceeding white space\r
//\r
- while (*str && *str == ' ') {\r
- str += 1;\r
+ while ((*Str != 0) && *Str == ' ') {\r
+ Str += 1;\r
}\r
//\r
// convert digits\r
//\r
Rvalue = 0;\r
- Char = *(str++);\r
- while (Char) {\r
+ Char = *(Str++);\r
+ while (Char != 0) {\r
if (Char >= '0' && Char <= '9') {\r
High = LShiftU64 (Rvalue, 3);\r
Low = LShiftU64 (Rvalue, 1);\r
break;\r
}\r
\r
- Char = *(str++);\r
+ Char = *(Str++);\r
}\r
\r
*Data = Rvalue;\r
}\r
\r
-STATIC\r
-UINTN\r
-Strtoi (\r
- IN CHAR16 *Str\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Convert integer string to uint.\r
\r
-Arguments:\r
-\r
- Str - The integer string. If leading with "0x" or "0X", it's heximal.\r
+ @param Str The integer string. If leading with "0x" or "0X", it's heximal.\r
\r
-Returns:\r
+ @return A UINTN value represented by Str\r
\r
---*/\r
+**/\r
+UINTN\r
+Strtoi (\r
+ IN CHAR16 *Str\r
+ )\r
{\r
BOOLEAN IsHex;\r
\r
}\r
}\r
\r
-STATIC\r
-VOID\r
-Strtoi64 (\r
- IN CHAR16 *Str,\r
- IN UINT64 *Data\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Convert integer string to 64 bit data.\r
\r
-Arguments:\r
+ @param Str The integer string. If leading with "0x" or "0X", it's heximal.\r
+ @param Data A pointer to the UINT64 value represented by Str\r
\r
- Str - The integer string. If leading with "0x" or "0X", it's heximal.\r
-\r
-Returns:\r
-\r
---*/\r
+**/\r
+VOID\r
+Strtoi64 (\r
+ IN CHAR16 *Str,\r
+ OUT UINT64 *Data\r
+ )\r
{\r
BOOLEAN IsHex;\r
\r
}\r
}\r
\r
-STATIC\r
-EFI_STATUS \r
+/**\r
+ Converts a list of string to a specified buffer.\r
+\r
+ @param Buf The output buffer that contains the string.\r
+ @param BufferLength The length of the buffer\r
+ @param Str The input string that contains the hex number\r
+\r
+ @retval EFI_SUCCESS The string was successfully converted to the buffer.\r
+\r
+**/\r
+EFI_STATUS\r
StrToBuf (\r
OUT UINT8 *Buf,\r
IN UINTN BufferLength,\r
\r
for(Index = 0; Index < StrLength; Index++, Str++) {\r
\r
- IsHexDigit (&Digit, *Str);\r
+ if ((*Str >= L'a') && (*Str <= L'f')) {\r
+ Digit = (UINT8) (*Str - L'a' + 0x0A);\r
+ } else if ((*Str >= L'A') && (*Str <= L'F')) {\r
+ Digit = (UINT8) (*Str - L'A' + 0x0A);\r
+ } else if ((*Str >= L'0') && (*Str <= L'9')) {\r
+ Digit = (UINT8) (*Str - L'0');\r
+ } else {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
\r
//\r
// For odd charaters, write the upper nibble for each buffer byte,\r
return EFI_SUCCESS;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a string to GUID value.\r
+ Guid Format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\r
+\r
+ @param Str The registry format GUID string that contains the GUID value.\r
+ @param Guid A pointer to the converted GUID value.\r
+\r
+ @retval EFI_SUCCESS The GUID string was successfully converted to the GUID value.\r
+ @retval EFI_UNSUPPORTED The input string is not in registry format.\r
+ @return others Some error occurred when converting part of GUID value.\r
+\r
+**/\r
EFI_STATUS\r
StrToGuid (\r
IN CHAR16 *Str,\r
OUT EFI_GUID *Guid\r
)\r
{\r
- UINTN BufferLength;\r
- UINTN ConvertedStrLen;\r
- EFI_STATUS Status;\r
-\r
- BufferLength = sizeof (Guid->Data1);\r
- Status = HexStringToBuf ((UINT8 *) &Guid->Data1, &BufferLength, Str, &ConvertedStrLen);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
+ //\r
+ // Get the first UINT32 data\r
+ //\r
+ Guid->Data1 = (UINT32) StrHexToUint64 (Str);\r
+ while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
+ Str ++;\r
}\r
- Str += ConvertedStrLen;\r
+ \r
if (IS_HYPHEN (*Str)) {\r
- Str++; \r
+ Str++;\r
} else {\r
return EFI_UNSUPPORTED;\r
}\r
-\r
- BufferLength = sizeof (Guid->Data2);\r
- Status = HexStringToBuf ((UINT8 *) &Guid->Data2, &BufferLength, Str, &ConvertedStrLen);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
+ \r
+ //\r
+ // Get the second UINT16 data\r
+ //\r
+ Guid->Data2 = (UINT16) StrHexToUint64 (Str);\r
+ while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
+ Str ++;\r
}\r
- Str += ConvertedStrLen;\r
+\r
if (IS_HYPHEN (*Str)) {\r
Str++;\r
} else {\r
return EFI_UNSUPPORTED;\r
}\r
-\r
- BufferLength = sizeof (Guid->Data3);\r
- Status = HexStringToBuf ((UINT8 *) &Guid->Data3, &BufferLength, Str, &ConvertedStrLen);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
+ \r
+ //\r
+ // Get the third UINT16 data\r
+ //\r
+ Guid->Data3 = (UINT16) StrHexToUint64 (Str);\r
+ while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
+ Str ++;\r
}\r
- Str += ConvertedStrLen;\r
+\r
if (IS_HYPHEN (*Str)) {\r
Str++;\r
} else {\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ //\r
+ // Get the followin 8 bytes data\r
+ // \r
StrToBuf (&Guid->Data4[0], 2, Str);\r
//\r
// Skip 2 byte hex chars\r
return EFI_SUCCESS;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a string to IPv4 address\r
+\r
+ @param Str A string representation of IPv4 address.\r
+ @param IPv4Addr A pointer to the converted IPv4 address.\r
+\r
+**/\r
VOID\r
StrToIPv4Addr (\r
IN OUT CHAR16 **Str,\r
}\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a string to IPv4 address\r
+\r
+ @param Str A string representation of IPv6 address.\r
+ @param IPv6Addr A pointer to the converted IPv6 address.\r
+\r
+**/\r
VOID\r
StrToIPv6Addr (\r
IN OUT CHAR16 **Str,\r
}\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a Unicode string to ASCII string.\r
+\r
+ @param Str The equiventant Unicode string\r
+ @param AsciiStr On input, it points to destination ASCII string buffer; on output, it points\r
+ to the next ASCII string next to it\r
+\r
+**/\r
VOID\r
StrToAscii (\r
IN CHAR16 *Str,\r
*AsciiStr = Dest + 1;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Hardware PCI device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to Hardware PCI device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextPci (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Pci;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Hardware PC card device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to Hardware PC card device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextPcCard (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Pccard;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Hardware memory map device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to Hardware memory map device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextMemoryMapped (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) MemMap;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Vendor device path structure based on the input Type\r
+ and SubType.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+ @param Type The type of device path node.\r
+ @param SubType The subtype of device path node.\r
+\r
+ @return A pointer to the newly-created Vendor device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
ConvertFromTextVendor (\r
IN CHAR16 *TextDeviceNode,\r
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Vendor Hardware device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Vendor Hardware device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextVenHw (\r
IN CHAR16 *TextDeviceNode\r
);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Hardware Controller device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Hardware Controller device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextCtrl (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Controller;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a string to EisaId.\r
+\r
+ @param Text The input string.\r
+ @param EisaId A pointer to the output EisaId.\r
+\r
+**/\r
VOID\r
EisaIdFromText (\r
IN CHAR16 *Text,\r
UINTN PnpId;\r
\r
PnpId = Xtoi (Text + 3);\r
- *EisaId = (((Text[0] - '@') & 0x1f) << 10) + \r
- (((Text[1] - '@') & 0x1f) << 5) + \r
+ *EisaId = (((Text[0] - '@') & 0x1f) << 10) +\r
+ (((Text[1] - '@') & 0x1f) << 5) +\r
((Text[2] - '@') & 0x1f) +\r
(UINT32) (PnpId << 16);\r
}\r
\r
+/**\r
+ Converts a text device path node to ACPI HID device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created ACPI HID device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextAcpi (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to ACPI HID device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+ @param PnPId The input plug and play identification.\r
+\r
+ @return A pointer to the newly-created ACPI HID device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
ConvertFromTextAcpi (\r
IN CHAR16 *TextDeviceNode,\r
return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to PCI root device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created PCI root device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextPciRoot (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextAcpi (TextDeviceNode, 0x0a03);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Floppy device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Floppy device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextFloppy (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextAcpi (TextDeviceNode, 0x0604);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Keyboard device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Keyboard device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextKeyboard (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextAcpi (TextDeviceNode, 0x0301);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Serial device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Serial device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextSerial (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextAcpi (TextDeviceNode, 0x0501);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Parallel Port device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Parallel Port device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextParallelPort (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextAcpi (TextDeviceNode, 0x0401);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to ACPI extention device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created ACPI extention device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextAcpiEx (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to ACPI extention device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created ACPI extention device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextAcpiExp (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Parallel Port device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Parallel Port device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextAta (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Atapi;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to SCSI device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created SCSI device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextScsi (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Scsi;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Fibre device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Fibre device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextFibre (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Fibre;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to 1394 device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created 1394 device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromText1394 (\r
IN CHAR16 *TextDeviceNode\r
)\r
{\r
CHAR16 *GuidStr;\r
- F1394_DEVICE_PATH *F1394;\r
+ F1394_DEVICE_PATH *F1394DevPath;\r
\r
GuidStr = GetNextParamStr (&TextDeviceNode);\r
- F1394 = (F1394_DEVICE_PATH *) CreateDeviceNode (\r
- MESSAGING_DEVICE_PATH,\r
- MSG_1394_DP,\r
- sizeof (F1394_DEVICE_PATH)\r
- );\r
+ F1394DevPath = (F1394_DEVICE_PATH *) CreateDeviceNode (\r
+ MESSAGING_DEVICE_PATH,\r
+ MSG_1394_DP,\r
+ sizeof (F1394_DEVICE_PATH)\r
+ );\r
\r
- F1394->Reserved = 0;\r
- Xtoi64 (GuidStr, &F1394->Guid);\r
+ F1394DevPath->Reserved = 0;\r
+ Xtoi64 (GuidStr, &F1394DevPath->Guid);\r
\r
- return (EFI_DEVICE_PATH_PROTOCOL *) F1394;\r
+ return (EFI_DEVICE_PATH_PROTOCOL *) F1394DevPath;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsb (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Usb;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to I20 device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created I20 device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextI2O (\r
IN CHAR16 *TextDeviceNode\r
)\r
{\r
CHAR16 *TIDStr;\r
- I2O_DEVICE_PATH *I2O;\r
+ I2O_DEVICE_PATH *I2ODevPath;\r
\r
- TIDStr = GetNextParamStr (&TextDeviceNode);\r
- I2O = (I2O_DEVICE_PATH *) CreateDeviceNode (\r
+ TIDStr = GetNextParamStr (&TextDeviceNode);\r
+ I2ODevPath = (I2O_DEVICE_PATH *) CreateDeviceNode (\r
MESSAGING_DEVICE_PATH,\r
MSG_I2O_DP,\r
sizeof (I2O_DEVICE_PATH)\r
);\r
\r
- I2O->Tid = (UINT32) Strtoi (TIDStr);\r
+ I2ODevPath->Tid = (UINT32) Strtoi (TIDStr);\r
\r
- return (EFI_DEVICE_PATH_PROTOCOL *) I2O;\r
+ return (EFI_DEVICE_PATH_PROTOCOL *) I2ODevPath;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Infini Band device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Infini Band device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextInfiniband (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) InfiniBand;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Vendor-Defined Messaging device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Vendor-Defined Messaging device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextVenMsg (\r
IN CHAR16 *TextDeviceNode\r
);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Vendor defined PC-ANSI device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Vendor defined PC-ANSI device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextVenPcAnsi (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Vendor defined VT100 device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Vendor defined VT100 device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextVenVt100 (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Vendor defined VT100 Plus device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Vendor defined VT100 Plus device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextVenVt100Plus (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Vendor defined UTF8 device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Vendor defined UTF8 device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextVenUtf8 (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to UART Flow Control device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created UART Flow Control device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUartFlowCtrl (\r
IN CHAR16 *TextDeviceNode\r
sizeof (UART_FLOW_CONTROL_DEVICE_PATH)\r
);\r
\r
- CopyGuid (&UartFlowControl->Guid, &mEfiDevicePathMessagingUartFlowControlGuid);\r
+ CopyGuid (&UartFlowControl->Guid, &gEfiUartDevicePathGuid);\r
if (StrCmp (ValueStr, L"XonXoff") == 0) {\r
UartFlowControl->FlowControlMap = 2;\r
} else if (StrCmp (ValueStr, L"Hardware") == 0) {\r
return (EFI_DEVICE_PATH_PROTOCOL *) UartFlowControl;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Serial Attached SCSI device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Serial Attached SCSI device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextSAS (\r
IN CHAR16 *TextDeviceNode\r
sizeof (SAS_DEVICE_PATH)\r
);\r
\r
- CopyGuid (&Sas->Guid, &mEfiDevicePathMessagingSASGuid);\r
+ CopyGuid (&Sas->Guid, &gEfiSasDevicePathGuid);\r
Strtoi64 (AddressStr, &Sas->SasAddress);\r
Strtoi64 (LunStr, &Sas->Lun);\r
Sas->RelativeTargetPort = (UINT16) Strtoi (RTPStr);\r
return (EFI_DEVICE_PATH_PROTOCOL *) Sas;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Debug Port device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Debug Port device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextDebugPort (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Vend;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to MAC device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created MAC device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextMAC (\r
IN CHAR16 *TextDeviceNode\r
CHAR16 *AddressStr;\r
CHAR16 *IfTypeStr;\r
UINTN Length;\r
- MAC_ADDR_DEVICE_PATH *MAC;\r
+ MAC_ADDR_DEVICE_PATH *MACDevPath;\r
\r
AddressStr = GetNextParamStr (&TextDeviceNode);\r
IfTypeStr = GetNextParamStr (&TextDeviceNode);\r
- MAC = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode (\r
+ MACDevPath = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode (\r
MESSAGING_DEVICE_PATH,\r
MSG_MAC_ADDR_DP,\r
sizeof (MAC_ADDR_DEVICE_PATH)\r
);\r
\r
- MAC->IfType = (UINT8) Strtoi (IfTypeStr);\r
+ MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr);\r
\r
Length = sizeof (EFI_MAC_ADDRESS);\r
- StrToBuf (&MAC->MacAddress.Addr[0], Length, AddressStr);\r
+ StrToBuf (&MACDevPath->MacAddress.Addr[0], Length, AddressStr);\r
\r
- return (EFI_DEVICE_PATH_PROTOCOL *) MAC;\r
+ return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to IPV4 device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created IPV4 device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextIPv4 (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) IPv4;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to IPV6 device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created IPV6 device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextIPv6 (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) IPv6;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to UART device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created UART device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUart (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Uart;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB class device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+ @param UsbClassText A pointer to USB_CLASS_TEXT structure to be integrated to USB Class Text.\r
+\r
+ @return A pointer to the newly-created USB class device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
ConvertFromTextUsbClass (\r
IN CHAR16 *TextDeviceNode,\r
UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);\r
} else {\r
UsbClass->DeviceSubClass = UsbClassText->SubClass;\r
- } \r
+ }\r
\r
ProtocolStr = GetNextParamStr (&TextDeviceNode);\r
\r
}\r
\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB class device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB class device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbClass (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB audio device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB audio device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbAudio (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB CDC Control device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB CDC Control device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbCDCControl (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB HID device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB HID device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbHID (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB Image device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB Image device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbImage (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB Print device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB Print device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbPrinter (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB mass storage device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB mass storage device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbMassStorage (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB HUB device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB HUB device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbHub (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB CDC data device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB CDC data device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbCDCData (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB smart card device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB smart card device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbSmartCard (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB video device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB video device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbVideo (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB diagnostic device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB diagnostic device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbDiagnostic (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB wireless device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB wireless device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbWireless (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB device firmware update device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB device firmware update device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbDeviceFirmwareUpdate (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB IRDA bridge device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB IRDA bridge device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbIrdaBridge (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB text and measurement device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB text and measurement device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbTestAndMeasurement (\r
IN CHAR16 *TextDeviceNode\r
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to USB WWID device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created USB WWID device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUsbWwid (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) UsbWwid;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Logic Unit device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Logic Unit device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextUnit (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) LogicalUnit;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to iSCSI device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created iSCSI device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextiSCSI (\r
IN CHAR16 *TextDeviceNode\r
CHAR16 *AuthenticationStr;\r
CHAR16 *ProtocolStr;\r
CHAR8 *AsciiStr;\r
- ISCSI_DEVICE_PATH_WITH_NAME *iSCSI;\r
+ ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;\r
\r
NameStr = GetNextParamStr (&TextDeviceNode);\r
PortalGroupStr = GetNextParamStr (&TextDeviceNode);\r
DataDigestStr = GetNextParamStr (&TextDeviceNode);\r
AuthenticationStr = GetNextParamStr (&TextDeviceNode);\r
ProtocolStr = GetNextParamStr (&TextDeviceNode);\r
- iSCSI = (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode (\r
+ ISCSIDevPath = (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode (\r
MESSAGING_DEVICE_PATH,\r
MSG_ISCSI_DP,\r
- (UINT16) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + StrLen (NameStr) * 2)\r
+ (UINT16) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + StrLen (NameStr))\r
);\r
\r
- AsciiStr = iSCSI->iSCSITargetName;\r
+ AsciiStr = ISCSIDevPath->iSCSITargetName;\r
StrToAscii (NameStr, &AsciiStr);\r
\r
- iSCSI->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);\r
- Strtoi64 (LunStr, &iSCSI->Lun);\r
+ ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);\r
+ Strtoi64 (LunStr, &ISCSIDevPath->Lun);\r
\r
Options = 0x0000;\r
if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) {\r
Options |= 0x1000;\r
}\r
\r
- iSCSI->LoginOption = (UINT16) Options;\r
+ ISCSIDevPath->LoginOption = (UINT16) Options;\r
\r
- iSCSI->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP");\r
+ ISCSIDevPath->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP");\r
\r
- return (EFI_DEVICE_PATH_PROTOCOL *) iSCSI;\r
+ return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to HD device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created HD device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextHD (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Hd;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to CDROM device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created CDROM device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextCDROM (\r
IN CHAR16 *TextDeviceNode\r
CHAR16 *EntryStr;\r
CHAR16 *StartStr;\r
CHAR16 *SizeStr;\r
- CDROM_DEVICE_PATH *CDROM;\r
+ CDROM_DEVICE_PATH *CDROMDevPath;\r
\r
EntryStr = GetNextParamStr (&TextDeviceNode);\r
StartStr = GetNextParamStr (&TextDeviceNode);\r
SizeStr = GetNextParamStr (&TextDeviceNode);\r
- CDROM = (CDROM_DEVICE_PATH *) CreateDeviceNode (\r
+ CDROMDevPath = (CDROM_DEVICE_PATH *) CreateDeviceNode (\r
MEDIA_DEVICE_PATH,\r
MEDIA_CDROM_DP,\r
sizeof (CDROM_DEVICE_PATH)\r
);\r
\r
- CDROM->BootEntry = (UINT32) Strtoi (EntryStr);\r
- Strtoi64 (StartStr, &CDROM->PartitionStart);\r
- Strtoi64 (SizeStr, &CDROM->PartitionSize);\r
+ CDROMDevPath->BootEntry = (UINT32) Strtoi (EntryStr);\r
+ Strtoi64 (StartStr, &CDROMDevPath->PartitionStart);\r
+ Strtoi64 (SizeStr, &CDROMDevPath->PartitionSize);\r
\r
- return (EFI_DEVICE_PATH_PROTOCOL *) CDROM;\r
+ return (EFI_DEVICE_PATH_PROTOCOL *) CDROMDevPath;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Vendor-defined media device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Vendor-defined media device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextVenMEDIA (\r
IN CHAR16 *TextDeviceNode\r
);\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to File device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created File device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextFilePath (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) File;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to Media protocol device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Media protocol device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextMedia (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Media;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to firmware volume device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created firmware volume device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextFv (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Fv;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to firmware file device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created firmware file device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextFvFile (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) FvFile;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to BIOS Boot Specification device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created BIOS Boot Specificationa device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextBBS (\r
IN CHAR16 *TextDeviceNode\r
return (EFI_DEVICE_PATH_PROTOCOL *) Bbs;\r
}\r
\r
-STATIC\r
+/**\r
+ Converts a text device path node to SATA device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created SATA device path structure.\r
+\r
+**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
DevPathFromTextSata (\r
IN CHAR16 *TextDeviceNode\r
MSG_SATA_DP,\r
sizeof (SATA_DEVICE_PATH)\r
);\r
- Sata->HbaPortNumber = (UINT16) Xtoi (Param1);\r
+ Sata->HBAPortNumber = (UINT16) Xtoi (Param1);\r
if (Param3 != NULL) {\r
- Sata->PortMultiplierPort = (UINT16) Xtoi (Param2);\r
+ Sata->PortMultiplierPortNumber = (UINT16) Xtoi (Param2);\r
Param2 = Param3;\r
} else {\r
- Sata->PortMultiplierPort = 0;\r
+ Sata->PortMultiplierPortNumber = 0;\r
}\r
- Sata->LogicalUnitNumber = (UINT16) Xtoi (Param2);\r
+ Sata->Lun = (UINT16) Xtoi (Param2);\r
\r
return (EFI_DEVICE_PATH_PROTOCOL *) Sata;\r
}\r
{NULL, NULL}\r
};\r
\r
-EFI_DEVICE_PATH_PROTOCOL *\r
-ConvertTextToDeviceNode (\r
- IN CONST CHAR16 *TextDeviceNode\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Convert text to the binary representation of a device node.\r
+/**\r
+ Convert text to the binary representation of a device node.\r
\r
- Arguments:\r
- TextDeviceNode - TextDeviceNode points to the text representation of a device\r
+ @param TextDeviceNode TextDeviceNode points to the text representation of a device\r
node. Conversion starts with the first character and continues\r
until the first non-device node character.\r
\r
- Returns:\r
- A pointer - Pointer to the EFI device node.\r
- NULL - If TextDeviceNode is NULL or there was insufficient memory or text unsupported.\r
+ @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was\r
+ insufficient memory or text unsupported.\r
\r
---*/\r
+**/\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+EFIAPI\r
+ConvertTextToDeviceNode (\r
+ IN CONST CHAR16 *TextDeviceNode\r
+ )\r
{\r
- EFI_DEVICE_PATH_PROTOCOL * (*DumpNode) (CHAR16 *);\r
+ DUMP_NODE DumpNode;\r
CHAR16 *ParamStr;\r
EFI_DEVICE_PATH_PROTOCOL *DeviceNode;\r
CHAR16 *DeviceNodeStr;\r
ParamStr = NULL;\r
DumpNode = NULL;\r
DeviceNodeStr = StrDuplicate (TextDeviceNode);\r
+ ASSERT (DeviceNodeStr != NULL);\r
\r
for (Index = 0; DevPathFromTextTable[Index].Function; Index++) {\r
ParamStr = GetParamByNodeName (DeviceNodeStr, DevPathFromTextTable[Index].DevicePathNodeText);\r
return DeviceNode;\r
}\r
\r
-EFI_DEVICE_PATH_PROTOCOL *\r
-ConvertTextToDevicePath (\r
- IN CONST CHAR16 *TextDevicePath\r
- )\r
-/*++\r
+/**\r
+ Convert text to the binary representation of a device path.\r
\r
- Routine Description:\r
- Convert text to the binary representation of a device path.\r
\r
- Arguments:\r
- TextDevicePath - TextDevicePath points to the text representation of a device\r
+ @param TextDevicePath TextDevicePath points to the text representation of a device\r
path. Conversion starts with the first character and continues\r
until the first non-device node character.\r
\r
- Returns:\r
- A pointer - Pointer to the allocated device path.\r
- NULL - If TextDeviceNode is NULL or there was insufficient memory.\r
+ @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or\r
+ there was insufficient memory.\r
\r
---*/\r
+**/\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+EFIAPI\r
+ConvertTextToDevicePath (\r
+ IN CONST CHAR16 *TextDevicePath\r
+ )\r
{\r
- EFI_DEVICE_PATH_PROTOCOL * (*DumpNode) (CHAR16 *);\r
+ DUMP_NODE DumpNode;\r
CHAR16 *ParamStr;\r
EFI_DEVICE_PATH_PROTOCOL *DeviceNode;\r
UINTN Index;\r
}\r
\r
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);\r
+ ASSERT (DevicePath != NULL);\r
SetDevicePathEndNode (DevicePath);\r
\r
ParamStr = NULL;\r
FreePool (DeviceNode);\r
DevicePath = NewDevicePath;\r
\r
- if (IsInstanceEnd) {\r
+ if (IsInstanceEnd != 0) {\r
DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);\r
- SetDevicePathInstanceEndNode (DeviceNode);\r
+ ASSERT (DeviceNode != NULL);\r
+ SET_DEVICE_PATH_INSTANCE_END_NODE (DeviceNode);\r
\r
NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode);\r
FreePool (DevicePath);\r