X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FDevicePathDxe%2FDevicePathFromText.c;h=f7e7cdfcfb612cb3daa22a0fd0345940f17e7abe;hb=3069bc194422eea310b17effd6700f6e0b5b58e8;hp=88994c2d911c9081790fdbe090ffc1ae7b7156eb;hpb=047c644982db181bae23a28a735bfed97dc4a677;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c index 88994c2d91..f7e7cdfcfb 100644 --- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c +++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c @@ -1,74 +1,53 @@ -/*++ +/** @file + DevicePathFromText protocol as defined in the UEFI 2.0 specification. -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2008, Intel Corporation.
+All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php -Module Name: +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - DevicePathFromText.c +**/ -Abstract: +#include "DevicePath.h" - DevicePathFromText protocol as defined in the UEFI 2.0 specification. ---*/ +/** -#include "DevicePath.h" + Duplicates a string. -STATIC + @param Src Source string. + + @return The duplicated string. + +**/ CHAR16 * StrDuplicate ( IN CONST CHAR16 *Src ) -/*++ - - Routine Description: - Duplicate a string - - Arguments: - Src - Source string - - Returns: - Duplicated string - ---*/ { - UINTN Length; - CHAR16 *ReturnStr; + return AllocateCopyPool (StrSize (Src), Src); +} - Length = StrLen ((CHAR16 *) Src); +/** - ReturnStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), (VOID *) Src); + Get parameter in a pair of parentheses follow the given node name. + For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1". - return ReturnStr; -} + @param Str Device Path Text. + @param NodeName Name of the node. + + @return Parameter text for the node. -STATIC +**/ CHAR16 * GetParamByNodeName ( IN CHAR16 *Str, IN CHAR16 *NodeName ) -/*++ - - Routine Description: - Get parameter in a pair of parentheses follow the given node name. - For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1". - - Arguments: - Str - Device Path Text - NodeName - Name of the node - - Returns: - Parameter text for the node - ---*/ { CHAR16 *ParamStr; CHAR16 *StrPointer; @@ -120,28 +99,23 @@ GetParamByNodeName ( return ParamStr; } -STATIC +/** + Gets current sub-string from a string list, before return + the list header is moved to next sub-string. The sub-string is separated + by the specified character. For example, the separator is ',', the string + list is "2,0,3", it returns "2", the remain list move to "0,3" + + @param List A string list separated by the specified separator + @param Separator The separator character + + @return A pointer to the current sub-string + +**/ CHAR16 * SplitStr ( IN OUT CHAR16 **List, IN CHAR16 Separator ) -/*++ - - Routine Description: - Get current sub-string from a string list, before return - the list header is moved to next sub-string. The sub-string is separated - by the specified character. For example, the separator is ',', the string - list is "2,0,3", it returns "2", the remain list move to "0,3" - - Arguments: - List - A string list separated by the specified separator - Separator - The separator character - - Returns: - pointer - The current sub-string - ---*/ { CHAR16 *Str; CHAR16 *ReturnStr; @@ -179,7 +153,14 @@ SplitStr ( return ReturnStr; } -STATIC +/** + Gets the next parameter string from the list. + + @param List A string list separated by the specified separator + + @return A pointer to the current sub-string + +**/ CHAR16 * GetNextParamStr ( IN OUT CHAR16 **List @@ -191,26 +172,20 @@ GetNextParamStr ( return SplitStr (List, L','); } -STATIC +/** + Get one device node from entire device path text. + + @param DevicePath On input, the current Device Path node; on output, the next device path node + @param IsInstanceEnd This node is the end of a device path instance + + @return A device node text or NULL if no more device node available + +**/ CHAR16 * GetNextDeviceNodeStr ( IN OUT CHAR16 **DevicePath, OUT BOOLEAN *IsInstanceEnd ) -/*++ - - Routine Description: - Get one device node from entire device path text. - - Arguments: - Str - The entire device path text string - IsInstanceEnd - This node is the end of a device path instance - - Returns: - a pointer - A device node text - NULL - No more device node available - ---*/ { CHAR16 *Str; CHAR16 *ReturnStr; @@ -278,172 +253,40 @@ GetNextDeviceNodeStr ( return ReturnStr; } -STATIC -BOOLEAN -IsHexDigit ( - OUT UINT8 *Digit, - IN CHAR16 Char - ) -/*++ - - Routine Description: - Determines if a Unicode character is a hexadecimal digit. - The test is case insensitive. - Arguments: - Digit - Pointer to byte that receives the value of the hex character. - Char - Unicode character to test. +/** + Skip the leading white space and '0x' or '0X' of a integer string - Returns: - TRUE - If the character is a hexadecimal digit. - FALSE - Otherwise. + @param Str The integer string + @param IsHex TRUE: Hex string, FALSE: Decimal string ---*/ -{ - if ((Char >= L'0') && (Char <= L'9')) { - *Digit = (UINT8) (Char - L'0'); - return TRUE; - } - - if ((Char >= L'A') && (Char <= L'F')) { - *Digit = (UINT8) (Char - L'A' + 0x0A); - return TRUE; - } - - if ((Char >= L'a') && (Char <= L'f')) { - *Digit = (UINT8) (Char - L'a' + 0x0A); - return TRUE; - } - - return FALSE; -} - -STATIC -EFI_STATUS -HexStringToBuf ( - IN OUT UINT8 *Buf, - IN OUT UINTN *Len, - IN CHAR16 *Str, - OUT UINTN *ConvertedStrLen OPTIONAL - ) -/*++ - - Routine Description: - Converts Unicode string to binary buffer. - The conversion may be partial. - The first character in the string that is not hex digit stops the conversion. - At a minimum, any blob of data could be represented as a hex string. - - Arguments: - Buf - Pointer to buffer that receives the data. - Len - Length in bytes of the buffer to hold converted data. - If routine return with EFI_SUCCESS, containing length of converted data. - If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired. - Str - String to be converted from. - ConvertedStrLen - Length of the Hex String consumed. - - Returns: - EFI_SUCCESS: Routine Success. - EFI_BUFFER_TOO_SMALL: The buffer is too small to hold converted data. - EFI_ - ---*/ -{ - UINTN HexCnt; - UINTN Idx; - UINTN BufferLength; - UINT8 Digit; - UINT8 Byte; + @return The trimmed Hex string. - Digit = 0; - - // - // Find out how many hex characters the string has. - // - for (Idx = 0, HexCnt = 0; IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++); - - if (HexCnt == 0) { - *Len = 0; - return EFI_SUCCESS; - } - // - // Two Unicode characters make up 1 buffer byte. Round up. - // - BufferLength = (HexCnt + 1) / 2; - - // - // Test if buffer is passed enough. - // - if (BufferLength > (*Len)) { - *Len = BufferLength; - return EFI_BUFFER_TOO_SMALL; - } - - *Len = BufferLength; - - for (Idx = 0; Idx < HexCnt; Idx++) { - - IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]); - - // - // For odd charaters, write the lower nibble for each buffer byte, - // and for even characters, the upper nibble. - // - if ((Idx & 1) == 0) { - Byte = Digit; - } else { - Byte = Buf[Idx / 2]; - Byte &= 0x0F; - Byte = (UINT8) (Byte | Digit << 4); - } - - Buf[Idx / 2] = Byte; - } - - if (ConvertedStrLen != NULL) { - *ConvertedStrLen = HexCnt; - } - - return EFI_SUCCESS; -} - -STATIC +**/ CHAR16 * TrimHexStr ( IN CHAR16 *Str, OUT BOOLEAN *IsHex ) -/*++ - - Routine Description: - Skip the leading white space and '0x' or '0X' of a integer string - - Arguments: - Str - The integer string - IsHex - 1: Hex string, 0: Decimal string - - Returns: - ---*/ { *IsHex = FALSE; // // skip preceeding white space // - while (*Str && *Str == ' ') { + while ((*Str != 0) && *Str == ' ') { Str += 1; } // // skip preceeding zeros // - while (*Str && *Str == '0') { + while ((*Str != 0) && *Str == '0') { Str += 1; } // // skip preceeding character 'x' or 'X' // - if (*Str && (*Str == 'x' || *Str == 'X')) { + if ((*Str != 0) && (*Str == 'x' || *Str == 'X')) { Str += 1; *IsHex = TRUE; } @@ -451,107 +294,75 @@ TrimHexStr ( return Str; } -STATIC -UINTN -Xtoi ( - IN CHAR16 *Str - ) -/*++ - -Routine Description: +/** - Convert hex string to uint + Convert hex string to uint. -Arguments: + @param Str The hex string - Str - The string - -Returns: + @return A UINTN value represented by Str ---*/ +**/ +UINTN +Xtoi ( + IN CHAR16 *Str + ) { - UINTN Rvalue; - UINTN Length; + return StrHexToUintn (Str); +} - ASSERT (Str != NULL); +/** - // - // convert hex digits - // - Rvalue = 0; - Length = sizeof (UINTN); - HexStringToBuf ((UINT8 *) &Rvalue, &Length, Str, NULL); + Convert hex string to 64 bit data. - return Rvalue; -} + @param Str The hex string + @param Data A pointer to the UINT64 value represented by Str -STATIC +**/ VOID Xtoi64 ( - IN CHAR16 *Str, - IN UINT64 *Data + IN CHAR16 *Str, + OUT UINT64 *Data ) -/*++ - -Routine Description: - - Convert hex string to 64 bit data. +{ + *Data = StrHexToUint64 (Str); +} -Arguments: +/** - Str - The string - -Returns: + Convert decimal string to uint. ---*/ -{ - UINTN Length; + @param Str The decimal string - *Data = 0; - Length = sizeof (UINT64); - HexStringToBuf ((UINT8 *) Data, &Length, Str, NULL); -} + @return A UINTN value represented by Str -STATIC +**/ UINTN Dtoi ( - IN CHAR16 *str + IN CHAR16 *Str ) -/*++ - -Routine Description: - - Convert decimal string to uint - -Arguments: - - Str - The string - -Returns: - ---*/ { UINTN Rvalue; CHAR16 Char; UINTN High; UINTN Low; - ASSERT (str != NULL); + ASSERT (Str != NULL); High = (UINTN) -1 / 10; Low = (UINTN) -1 % 10; // // skip preceeding white space // - while (*str && *str == ' ') { - str += 1; + while ((*Str != 0) && *Str == ' ') { + Str += 1; } // // convert digits // Rvalue = 0; - Char = *(str++); - while (Char) { + Char = *(Str++); + while (Char != 0) { if (Char >= '0' && Char <= '9') { if ((Rvalue > High || Rvalue == High) && (Char - '0' > (INTN) Low)) { return (UINTN) -1; @@ -562,52 +373,46 @@ Returns: break; } - Char = *(str++); + Char = *(Str++); } return Rvalue; } -STATIC +/** + + Convert decimal string to uint. + + @param Str The decimal string + @param Data A pointer to the UINT64 value represented by Str + +**/ VOID Dtoi64 ( - IN CHAR16 *str, + IN CHAR16 *Str, OUT UINT64 *Data ) -/*++ - -Routine Description: - - Convert decimal string to uint - -Arguments: - - Str - The string - -Returns: - ---*/ { UINT64 Rvalue; CHAR16 Char; UINT64 High; UINT64 Low; - ASSERT (str != NULL); + ASSERT (Str != NULL); ASSERT (Data != NULL); // // skip preceeding white space // - while (*str && *str == ' ') { - str += 1; + while ((*Str != 0) && *Str == ' ') { + Str += 1; } // // convert digits // Rvalue = 0; - Char = *(str++); - while (Char) { + Char = *(Str++); + while (Char != 0) { if (Char >= '0' && Char <= '9') { High = LShiftU64 (Rvalue, 3); Low = LShiftU64 (Rvalue, 1); @@ -616,30 +421,25 @@ Returns: break; } - Char = *(str++); + Char = *(Str++); } *Data = Rvalue; } -STATIC -UINTN -Strtoi ( - IN CHAR16 *Str - ) -/*++ - -Routine Description: +/** Convert integer string to uint. -Arguments: - - Str - The integer string. If leading with "0x" or "0X", it's heximal. + @param Str The integer string. If leading with "0x" or "0X", it's heximal. -Returns: + @return A UINTN value represented by Str ---*/ +**/ +UINTN +Strtoi ( + IN CHAR16 *Str + ) { BOOLEAN IsHex; @@ -652,25 +452,19 @@ Returns: } } -STATIC -VOID -Strtoi64 ( - IN CHAR16 *Str, - IN UINT64 *Data - ) -/*++ - -Routine Description: +/** Convert integer string to 64 bit data. -Arguments: + @param Str The integer string. If leading with "0x" or "0X", it's heximal. + @param Data A pointer to the UINT64 value represented by Str - Str - The integer string. If leading with "0x" or "0X", it's heximal. - -Returns: - ---*/ +**/ +VOID +Strtoi64 ( + IN CHAR16 *Str, + OUT UINT64 *Data + ) { BOOLEAN IsHex; @@ -683,8 +477,17 @@ Returns: } } -STATIC -EFI_STATUS +/** + Converts a list of string to a specified buffer. + + @param Buf The output buffer that contains the string. + @param BufferLength The length of the buffer + @param Str The input string that contains the hex number + + @retval EFI_SUCCESS The string was successfully converted to the buffer. + +**/ +EFI_STATUS StrToBuf ( OUT UINT8 *Buf, IN UINTN BufferLength, @@ -705,7 +508,15 @@ StrToBuf ( for(Index = 0; Index < StrLength; Index++, Str++) { - IsHexDigit (&Digit, *Str); + if ((*Str >= L'a') && (*Str <= L'f')) { + Digit = (UINT8) (*Str - L'a' + 0x0A); + } else if ((*Str >= L'A') && (*Str <= L'F')) { + Digit = (UINT8) (*Str - L'A' + 0x0A); + } else if ((*Str >= L'0') && (*Str <= L'9')) { + Digit = (UINT8) (*Str - L'0'); + } else { + return EFI_INVALID_PARAMETER; + } // // For odd charaters, write the upper nibble for each buffer byte, @@ -725,53 +536,69 @@ StrToBuf ( return EFI_SUCCESS; } -STATIC +/** + Converts a string to GUID value. + Guid Format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + + @param Str The registry format GUID string that contains the GUID value. + @param Guid A pointer to the converted GUID value. + + @retval EFI_SUCCESS The GUID string was successfully converted to the GUID value. + @retval EFI_UNSUPPORTED The input string is not in registry format. + @return others Some error occurred when converting part of GUID value. + +**/ EFI_STATUS StrToGuid ( IN CHAR16 *Str, OUT EFI_GUID *Guid ) { - UINTN BufferLength; - UINTN ConvertedStrLen; - EFI_STATUS Status; - - BufferLength = sizeof (Guid->Data1); - Status = HexStringToBuf ((UINT8 *) &Guid->Data1, &BufferLength, Str, &ConvertedStrLen); - if (EFI_ERROR (Status)) { - return Status; + // + // Get the first UINT32 data + // + Guid->Data1 = (UINT32) StrHexToUint64 (Str); + while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) { + Str ++; } - Str += ConvertedStrLen; + if (IS_HYPHEN (*Str)) { - Str++; + Str++; } else { return EFI_UNSUPPORTED; } - - BufferLength = sizeof (Guid->Data2); - Status = HexStringToBuf ((UINT8 *) &Guid->Data2, &BufferLength, Str, &ConvertedStrLen); - if (EFI_ERROR (Status)) { - return Status; + + // + // Get the second UINT16 data + // + Guid->Data2 = (UINT16) StrHexToUint64 (Str); + while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) { + Str ++; } - Str += ConvertedStrLen; + if (IS_HYPHEN (*Str)) { Str++; } else { return EFI_UNSUPPORTED; } - - BufferLength = sizeof (Guid->Data3); - Status = HexStringToBuf ((UINT8 *) &Guid->Data3, &BufferLength, Str, &ConvertedStrLen); - if (EFI_ERROR (Status)) { - return Status; + + // + // Get the third UINT16 data + // + Guid->Data3 = (UINT16) StrHexToUint64 (Str); + while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) { + Str ++; } - Str += ConvertedStrLen; + if (IS_HYPHEN (*Str)) { Str++; } else { return EFI_UNSUPPORTED; } + // + // Get the followin 8 bytes data + // StrToBuf (&Guid->Data4[0], 2, Str); // // Skip 2 byte hex chars @@ -788,7 +615,13 @@ StrToGuid ( return EFI_SUCCESS; } -STATIC +/** + Converts a string to IPv4 address + + @param Str A string representation of IPv4 address. + @param IPv4Addr A pointer to the converted IPv4 address. + +**/ VOID StrToIPv4Addr ( IN OUT CHAR16 **Str, @@ -802,7 +635,13 @@ StrToIPv4Addr ( } } -STATIC +/** + Converts a string to IPv4 address + + @param Str A string representation of IPv6 address. + @param IPv6Addr A pointer to the converted IPv6 address. + +**/ VOID StrToIPv6Addr ( IN OUT CHAR16 **Str, @@ -819,7 +658,14 @@ StrToIPv6Addr ( } } -STATIC +/** + Converts a Unicode string to ASCII string. + + @param Str The equiventant Unicode string + @param AsciiStr On input, it points to destination ASCII string buffer; on output, it points + to the next ASCII string next to it + +**/ VOID StrToAscii ( IN CHAR16 *Str, @@ -840,7 +686,14 @@ StrToAscii ( *AsciiStr = Dest + 1; } -STATIC +/** + Converts a text device path node to Hardware PCI device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to Hardware PCI device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextPci ( IN CHAR16 *TextDeviceNode @@ -864,7 +717,14 @@ DevPathFromTextPci ( return (EFI_DEVICE_PATH_PROTOCOL *) Pci; } -STATIC +/** + Converts a text device path node to Hardware PC card device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to Hardware PC card device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextPcCard ( IN CHAR16 *TextDeviceNode @@ -885,7 +745,14 @@ DevPathFromTextPcCard ( return (EFI_DEVICE_PATH_PROTOCOL *) Pccard; } -STATIC +/** + Converts a text device path node to Hardware memory map device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to Hardware memory map device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextMemoryMapped ( IN CHAR16 *TextDeviceNode @@ -912,7 +779,17 @@ DevPathFromTextMemoryMapped ( return (EFI_DEVICE_PATH_PROTOCOL *) MemMap; } -STATIC +/** + Converts a text device path node to Vendor device path structure based on the input Type + and SubType. + + @param TextDeviceNode The input Text device path node. + @param Type The type of device path node. + @param SubType The subtype of device path node. + + @return A pointer to the newly-created Vendor device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * ConvertFromTextVendor ( IN CHAR16 *TextDeviceNode, @@ -946,7 +823,14 @@ ConvertFromTextVendor ( return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } -STATIC +/** + Converts a text device path node to Vendor Hardware device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Vendor Hardware device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextVenHw ( IN CHAR16 *TextDeviceNode @@ -959,7 +843,14 @@ DevPathFromTextVenHw ( ); } -STATIC +/** + Converts a text device path node to Hardware Controller device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Hardware Controller device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextCtrl ( IN CHAR16 *TextDeviceNode @@ -979,7 +870,13 @@ DevPathFromTextCtrl ( return (EFI_DEVICE_PATH_PROTOCOL *) Controller; } -STATIC +/** + Converts a string to EisaId. + + @param Text The input string. + @param EisaId A pointer to the output EisaId. + +**/ VOID EisaIdFromText ( IN CHAR16 *Text, @@ -989,12 +886,20 @@ EisaIdFromText ( UINTN PnpId; PnpId = Xtoi (Text + 3); - *EisaId = (((Text[0] - '@') & 0x1f) << 10) + - (((Text[1] - '@') & 0x1f) << 5) + + *EisaId = (((Text[0] - '@') & 0x1f) << 10) + + (((Text[1] - '@') & 0x1f) << 5) + ((Text[2] - '@') & 0x1f) + (UINT32) (PnpId << 16); } +/** + Converts a text device path node to ACPI HID device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created ACPI HID device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextAcpi ( IN CHAR16 *TextDeviceNode @@ -1018,7 +923,15 @@ DevPathFromTextAcpi ( return (EFI_DEVICE_PATH_PROTOCOL *) Acpi; } -STATIC +/** + Converts a text device path node to ACPI HID device path structure. + + @param TextDeviceNode The input Text device path node. + @param PnPId The input plug and play identification. + + @return A pointer to the newly-created ACPI HID device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * ConvertFromTextAcpi ( IN CHAR16 *TextDeviceNode, @@ -1041,7 +954,14 @@ ConvertFromTextAcpi ( return (EFI_DEVICE_PATH_PROTOCOL *) Acpi; } -STATIC +/** + Converts a text device path node to PCI root device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created PCI root device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextPciRoot ( IN CHAR16 *TextDeviceNode @@ -1050,7 +970,14 @@ DevPathFromTextPciRoot ( return ConvertFromTextAcpi (TextDeviceNode, 0x0a03); } -STATIC +/** + Converts a text device path node to Floppy device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Floppy device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextFloppy ( IN CHAR16 *TextDeviceNode @@ -1059,7 +986,14 @@ DevPathFromTextFloppy ( return ConvertFromTextAcpi (TextDeviceNode, 0x0604); } -STATIC +/** + Converts a text device path node to Keyboard device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Keyboard device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextKeyboard ( IN CHAR16 *TextDeviceNode @@ -1068,7 +1002,14 @@ DevPathFromTextKeyboard ( return ConvertFromTextAcpi (TextDeviceNode, 0x0301); } -STATIC +/** + Converts a text device path node to Serial device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Serial device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextSerial ( IN CHAR16 *TextDeviceNode @@ -1077,7 +1018,14 @@ DevPathFromTextSerial ( return ConvertFromTextAcpi (TextDeviceNode, 0x0501); } -STATIC +/** + Converts a text device path node to Parallel Port device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Parallel Port device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextParallelPort ( IN CHAR16 *TextDeviceNode @@ -1086,7 +1034,14 @@ DevPathFromTextParallelPort ( return ConvertFromTextAcpi (TextDeviceNode, 0x0401); } -STATIC +/** + Converts a text device path node to ACPI extention device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created ACPI extention device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextAcpiEx ( IN CHAR16 *TextDeviceNode @@ -1130,7 +1085,14 @@ DevPathFromTextAcpiEx ( return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx; } -STATIC +/** + Converts a text device path node to ACPI extention device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created ACPI extention device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextAcpiExp ( IN CHAR16 *TextDeviceNode @@ -1175,7 +1137,14 @@ DevPathFromTextAcpiExp ( return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx; } -STATIC +/** + Converts a text device path node to Parallel Port device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Parallel Port device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextAta ( IN CHAR16 *TextDeviceNode @@ -1203,7 +1172,14 @@ DevPathFromTextAta ( return (EFI_DEVICE_PATH_PROTOCOL *) Atapi; } -STATIC +/** + Converts a text device path node to SCSI device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created SCSI device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextScsi ( IN CHAR16 *TextDeviceNode @@ -1227,7 +1203,14 @@ DevPathFromTextScsi ( return (EFI_DEVICE_PATH_PROTOCOL *) Scsi; } -STATIC +/** + Converts a text device path node to Fibre device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Fibre device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextFibre ( IN CHAR16 *TextDeviceNode @@ -1252,29 +1235,43 @@ DevPathFromTextFibre ( return (EFI_DEVICE_PATH_PROTOCOL *) Fibre; } -STATIC +/** + Converts a text device path node to 1394 device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created 1394 device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromText1394 ( IN CHAR16 *TextDeviceNode ) { CHAR16 *GuidStr; - F1394_DEVICE_PATH *F1394; + F1394_DEVICE_PATH *F1394DevPath; GuidStr = GetNextParamStr (&TextDeviceNode); - F1394 = (F1394_DEVICE_PATH *) CreateDeviceNode ( - MESSAGING_DEVICE_PATH, - MSG_1394_DP, - sizeof (F1394_DEVICE_PATH) - ); + F1394DevPath = (F1394_DEVICE_PATH *) CreateDeviceNode ( + MESSAGING_DEVICE_PATH, + MSG_1394_DP, + sizeof (F1394_DEVICE_PATH) + ); - F1394->Reserved = 0; - Xtoi64 (GuidStr, &F1394->Guid); + F1394DevPath->Reserved = 0; + Xtoi64 (GuidStr, &F1394DevPath->Guid); - return (EFI_DEVICE_PATH_PROTOCOL *) F1394; + return (EFI_DEVICE_PATH_PROTOCOL *) F1394DevPath; } -STATIC +/** + Converts a text device path node to USB device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsb ( IN CHAR16 *TextDeviceNode @@ -1298,28 +1295,42 @@ DevPathFromTextUsb ( return (EFI_DEVICE_PATH_PROTOCOL *) Usb; } -STATIC +/** + Converts a text device path node to I20 device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created I20 device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextI2O ( IN CHAR16 *TextDeviceNode ) { CHAR16 *TIDStr; - I2O_DEVICE_PATH *I2O; + I2O_DEVICE_PATH *I2ODevPath; - TIDStr = GetNextParamStr (&TextDeviceNode); - I2O = (I2O_DEVICE_PATH *) CreateDeviceNode ( + TIDStr = GetNextParamStr (&TextDeviceNode); + I2ODevPath = (I2O_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_I2O_DP, sizeof (I2O_DEVICE_PATH) ); - I2O->Tid = (UINT32) Strtoi (TIDStr); + I2ODevPath->Tid = (UINT32) Strtoi (TIDStr); - return (EFI_DEVICE_PATH_PROTOCOL *) I2O; + return (EFI_DEVICE_PATH_PROTOCOL *) I2ODevPath; } -STATIC +/** + Converts a text device path node to Infini Band device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Infini Band device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextInfiniband ( IN CHAR16 *TextDeviceNode @@ -1354,7 +1365,14 @@ DevPathFromTextInfiniband ( return (EFI_DEVICE_PATH_PROTOCOL *) InfiniBand; } -STATIC +/** + Converts a text device path node to Vendor-Defined Messaging device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Vendor-Defined Messaging device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextVenMsg ( IN CHAR16 *TextDeviceNode @@ -1367,7 +1385,14 @@ DevPathFromTextVenMsg ( ); } -STATIC +/** + Converts a text device path node to Vendor defined PC-ANSI device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Vendor defined PC-ANSI device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextVenPcAnsi ( IN CHAR16 *TextDeviceNode @@ -1384,7 +1409,14 @@ DevPathFromTextVenPcAnsi ( return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } -STATIC +/** + Converts a text device path node to Vendor defined VT100 device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Vendor defined VT100 device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextVenVt100 ( IN CHAR16 *TextDeviceNode @@ -1401,7 +1433,14 @@ DevPathFromTextVenVt100 ( return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } -STATIC +/** + Converts a text device path node to Vendor defined VT100 Plus device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Vendor defined VT100 Plus device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextVenVt100Plus ( IN CHAR16 *TextDeviceNode @@ -1418,7 +1457,14 @@ DevPathFromTextVenVt100Plus ( return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } -STATIC +/** + Converts a text device path node to Vendor defined UTF8 device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Vendor defined UTF8 device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextVenUtf8 ( IN CHAR16 *TextDeviceNode @@ -1435,7 +1481,14 @@ DevPathFromTextVenUtf8 ( return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } -STATIC +/** + Converts a text device path node to UART Flow Control device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created UART Flow Control device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUartFlowCtrl ( IN CHAR16 *TextDeviceNode @@ -1451,7 +1504,7 @@ DevPathFromTextUartFlowCtrl ( sizeof (UART_FLOW_CONTROL_DEVICE_PATH) ); - CopyGuid (&UartFlowControl->Guid, &mEfiDevicePathMessagingUartFlowControlGuid); + CopyGuid (&UartFlowControl->Guid, &gEfiUartDevicePathGuid); if (StrCmp (ValueStr, L"XonXoff") == 0) { UartFlowControl->FlowControlMap = 2; } else if (StrCmp (ValueStr, L"Hardware") == 0) { @@ -1463,7 +1516,14 @@ DevPathFromTextUartFlowCtrl ( return (EFI_DEVICE_PATH_PROTOCOL *) UartFlowControl; } -STATIC +/** + Converts a text device path node to Serial Attached SCSI device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Serial Attached SCSI device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextSAS ( IN CHAR16 *TextDeviceNode @@ -1495,7 +1555,7 @@ DevPathFromTextSAS ( sizeof (SAS_DEVICE_PATH) ); - CopyGuid (&Sas->Guid, &mEfiDevicePathMessagingSASGuid); + CopyGuid (&Sas->Guid, &gEfiSasDevicePathGuid); Strtoi64 (AddressStr, &Sas->SasAddress); Strtoi64 (LunStr, &Sas->Lun); Sas->RelativeTargetPort = (UINT16) Strtoi (RTPStr); @@ -1526,7 +1586,14 @@ DevPathFromTextSAS ( return (EFI_DEVICE_PATH_PROTOCOL *) Sas; } -STATIC +/** + Converts a text device path node to Debug Port device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Debug Port device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextDebugPort ( IN CHAR16 *TextDeviceNode @@ -1545,7 +1612,14 @@ DevPathFromTextDebugPort ( return (EFI_DEVICE_PATH_PROTOCOL *) Vend; } -STATIC +/** + Converts a text device path node to MAC device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created MAC device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextMAC ( IN CHAR16 *TextDeviceNode @@ -1554,25 +1628,32 @@ DevPathFromTextMAC ( CHAR16 *AddressStr; CHAR16 *IfTypeStr; UINTN Length; - MAC_ADDR_DEVICE_PATH *MAC; + MAC_ADDR_DEVICE_PATH *MACDevPath; AddressStr = GetNextParamStr (&TextDeviceNode); IfTypeStr = GetNextParamStr (&TextDeviceNode); - MAC = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode ( + MACDevPath = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, sizeof (MAC_ADDR_DEVICE_PATH) ); - MAC->IfType = (UINT8) Strtoi (IfTypeStr); + MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr); Length = sizeof (EFI_MAC_ADDRESS); - StrToBuf (&MAC->MacAddress.Addr[0], Length, AddressStr); + StrToBuf (&MACDevPath->MacAddress.Addr[0], Length, AddressStr); - return (EFI_DEVICE_PATH_PROTOCOL *) MAC; + return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath; } -STATIC +/** + Converts a text device path node to IPV4 device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created IPV4 device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextIPv4 ( IN CHAR16 *TextDeviceNode @@ -1610,7 +1691,14 @@ DevPathFromTextIPv4 ( return (EFI_DEVICE_PATH_PROTOCOL *) IPv4; } -STATIC +/** + Converts a text device path node to IPV6 device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created IPV6 device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextIPv6 ( IN CHAR16 *TextDeviceNode @@ -1648,7 +1736,14 @@ DevPathFromTextIPv6 ( return (EFI_DEVICE_PATH_PROTOCOL *) IPv6; } -STATIC +/** + Converts a text device path node to UART device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created UART device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUart ( IN CHAR16 *TextDeviceNode @@ -1715,7 +1810,15 @@ DevPathFromTextUart ( return (EFI_DEVICE_PATH_PROTOCOL *) Uart; } -STATIC +/** + Converts a text device path node to USB class device path structure. + + @param TextDeviceNode The input Text device path node. + @param UsbClassText A pointer to USB_CLASS_TEXT structure to be integrated to USB Class Text. + + @return A pointer to the newly-created USB class device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * ConvertFromTextUsbClass ( IN CHAR16 *TextDeviceNode, @@ -1748,7 +1851,7 @@ ConvertFromTextUsbClass ( UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr); } else { UsbClass->DeviceSubClass = UsbClassText->SubClass; - } + } ProtocolStr = GetNextParamStr (&TextDeviceNode); @@ -1760,7 +1863,14 @@ ConvertFromTextUsbClass ( } -STATIC +/** + Converts a text device path node to USB class device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB class device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbClass ( IN CHAR16 *TextDeviceNode @@ -1774,7 +1884,14 @@ DevPathFromTextUsbClass ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB audio device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB audio device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbAudio ( IN CHAR16 *TextDeviceNode @@ -1789,7 +1906,14 @@ DevPathFromTextUsbAudio ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB CDC Control device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB CDC Control device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbCDCControl ( IN CHAR16 *TextDeviceNode @@ -1804,7 +1928,14 @@ DevPathFromTextUsbCDCControl ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB HID device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB HID device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbHID ( IN CHAR16 *TextDeviceNode @@ -1819,7 +1950,14 @@ DevPathFromTextUsbHID ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB Image device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB Image device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbImage ( IN CHAR16 *TextDeviceNode @@ -1834,7 +1972,14 @@ DevPathFromTextUsbImage ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB Print device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB Print device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbPrinter ( IN CHAR16 *TextDeviceNode @@ -1849,7 +1994,14 @@ DevPathFromTextUsbPrinter ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB mass storage device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB mass storage device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbMassStorage ( IN CHAR16 *TextDeviceNode @@ -1864,7 +2016,14 @@ DevPathFromTextUsbMassStorage ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB HUB device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB HUB device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbHub ( IN CHAR16 *TextDeviceNode @@ -1879,7 +2038,14 @@ DevPathFromTextUsbHub ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB CDC data device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB CDC data device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbCDCData ( IN CHAR16 *TextDeviceNode @@ -1894,7 +2060,14 @@ DevPathFromTextUsbCDCData ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB smart card device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB smart card device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbSmartCard ( IN CHAR16 *TextDeviceNode @@ -1909,7 +2082,14 @@ DevPathFromTextUsbSmartCard ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB video device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB video device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbVideo ( IN CHAR16 *TextDeviceNode @@ -1924,7 +2104,14 @@ DevPathFromTextUsbVideo ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB diagnostic device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB diagnostic device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbDiagnostic ( IN CHAR16 *TextDeviceNode @@ -1939,7 +2126,14 @@ DevPathFromTextUsbDiagnostic ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB wireless device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB wireless device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbWireless ( IN CHAR16 *TextDeviceNode @@ -1954,7 +2148,14 @@ DevPathFromTextUsbWireless ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB device firmware update device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB device firmware update device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbDeviceFirmwareUpdate ( IN CHAR16 *TextDeviceNode @@ -1970,7 +2171,14 @@ DevPathFromTextUsbDeviceFirmwareUpdate ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB IRDA bridge device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB IRDA bridge device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbIrdaBridge ( IN CHAR16 *TextDeviceNode @@ -1986,7 +2194,14 @@ DevPathFromTextUsbIrdaBridge ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB text and measurement device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB text and measurement device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbTestAndMeasurement ( IN CHAR16 *TextDeviceNode @@ -2002,7 +2217,14 @@ DevPathFromTextUsbTestAndMeasurement ( return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); } -STATIC +/** + Converts a text device path node to USB WWID device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created USB WWID device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUsbWwid ( IN CHAR16 *TextDeviceNode @@ -2032,7 +2254,14 @@ DevPathFromTextUsbWwid ( return (EFI_DEVICE_PATH_PROTOCOL *) UsbWwid; } -STATIC +/** + Converts a text device path node to Logic Unit device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Logic Unit device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextUnit ( IN CHAR16 *TextDeviceNode @@ -2053,7 +2282,14 @@ DevPathFromTextUnit ( return (EFI_DEVICE_PATH_PROTOCOL *) LogicalUnit; } -STATIC +/** + Converts a text device path node to iSCSI device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created iSCSI device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextiSCSI ( IN CHAR16 *TextDeviceNode @@ -2068,7 +2304,7 @@ DevPathFromTextiSCSI ( CHAR16 *AuthenticationStr; CHAR16 *ProtocolStr; CHAR8 *AsciiStr; - ISCSI_DEVICE_PATH_WITH_NAME *iSCSI; + ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath; NameStr = GetNextParamStr (&TextDeviceNode); PortalGroupStr = GetNextParamStr (&TextDeviceNode); @@ -2077,17 +2313,17 @@ DevPathFromTextiSCSI ( DataDigestStr = GetNextParamStr (&TextDeviceNode); AuthenticationStr = GetNextParamStr (&TextDeviceNode); ProtocolStr = GetNextParamStr (&TextDeviceNode); - iSCSI = (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode ( + ISCSIDevPath = (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, (UINT16) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + StrLen (NameStr)) ); - AsciiStr = iSCSI->iSCSITargetName; + AsciiStr = ISCSIDevPath->iSCSITargetName; StrToAscii (NameStr, &AsciiStr); - iSCSI->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr); - Strtoi64 (LunStr, &iSCSI->Lun); + ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr); + Strtoi64 (LunStr, &ISCSIDevPath->Lun); Options = 0x0000; if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) { @@ -2106,14 +2342,21 @@ DevPathFromTextiSCSI ( Options |= 0x1000; } - iSCSI->LoginOption = (UINT16) Options; + ISCSIDevPath->LoginOption = (UINT16) Options; - iSCSI->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP"); + ISCSIDevPath->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP"); - return (EFI_DEVICE_PATH_PROTOCOL *) iSCSI; + return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath; } -STATIC +/** + Converts a text device path node to HD device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created HD device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextHD ( IN CHAR16 *TextDeviceNode @@ -2166,7 +2409,14 @@ DevPathFromTextHD ( return (EFI_DEVICE_PATH_PROTOCOL *) Hd; } -STATIC +/** + Converts a text device path node to CDROM device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created CDROM device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextCDROM ( IN CHAR16 *TextDeviceNode @@ -2175,25 +2425,32 @@ DevPathFromTextCDROM ( CHAR16 *EntryStr; CHAR16 *StartStr; CHAR16 *SizeStr; - CDROM_DEVICE_PATH *CDROM; + CDROM_DEVICE_PATH *CDROMDevPath; EntryStr = GetNextParamStr (&TextDeviceNode); StartStr = GetNextParamStr (&TextDeviceNode); SizeStr = GetNextParamStr (&TextDeviceNode); - CDROM = (CDROM_DEVICE_PATH *) CreateDeviceNode ( + CDROMDevPath = (CDROM_DEVICE_PATH *) CreateDeviceNode ( MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, sizeof (CDROM_DEVICE_PATH) ); - CDROM->BootEntry = (UINT32) Strtoi (EntryStr); - Strtoi64 (StartStr, &CDROM->PartitionStart); - Strtoi64 (SizeStr, &CDROM->PartitionSize); + CDROMDevPath->BootEntry = (UINT32) Strtoi (EntryStr); + Strtoi64 (StartStr, &CDROMDevPath->PartitionStart); + Strtoi64 (SizeStr, &CDROMDevPath->PartitionSize); - return (EFI_DEVICE_PATH_PROTOCOL *) CDROM; + return (EFI_DEVICE_PATH_PROTOCOL *) CDROMDevPath; } -STATIC +/** + Converts a text device path node to Vendor-defined media device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Vendor-defined media device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextVenMEDIA ( IN CHAR16 *TextDeviceNode @@ -2206,7 +2463,14 @@ DevPathFromTextVenMEDIA ( ); } -STATIC +/** + Converts a text device path node to File device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created File device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextFilePath ( IN CHAR16 *TextDeviceNode @@ -2225,7 +2489,14 @@ DevPathFromTextFilePath ( return (EFI_DEVICE_PATH_PROTOCOL *) File; } -STATIC +/** + Converts a text device path node to Media protocol device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Media protocol device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextMedia ( IN CHAR16 *TextDeviceNode @@ -2246,7 +2517,14 @@ DevPathFromTextMedia ( return (EFI_DEVICE_PATH_PROTOCOL *) Media; } -STATIC +/** + Converts a text device path node to firmware volume device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created firmware volume device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextFv ( IN CHAR16 *TextDeviceNode @@ -2267,7 +2545,14 @@ DevPathFromTextFv ( return (EFI_DEVICE_PATH_PROTOCOL *) Fv; } -STATIC +/** + Converts a text device path node to firmware file device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created firmware file device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextFvFile ( IN CHAR16 *TextDeviceNode @@ -2288,7 +2573,14 @@ DevPathFromTextFvFile ( return (EFI_DEVICE_PATH_PROTOCOL *) FvFile; } -STATIC +/** + Converts a text device path node to BIOS Boot Specification device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created BIOS Boot Specificationa device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextBBS ( IN CHAR16 *TextDeviceNode @@ -2333,7 +2625,14 @@ DevPathFromTextBBS ( return (EFI_DEVICE_PATH_PROTOCOL *) Bbs; } -STATIC +/** + Converts a text device path node to SATA device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created SATA device path structure. + +**/ EFI_DEVICE_PATH_PROTOCOL * DevPathFromTextSata ( IN CHAR16 *TextDeviceNode @@ -2434,27 +2733,24 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[] {NULL, NULL} }; -EFI_DEVICE_PATH_PROTOCOL * -ConvertTextToDeviceNode ( - IN CONST CHAR16 *TextDeviceNode - ) -/*++ - - Routine Description: - Convert text to the binary representation of a device node. +/** + Convert text to the binary representation of a device node. - Arguments: - TextDeviceNode - TextDeviceNode points to the text representation of a device + @param TextDeviceNode TextDeviceNode points to the text representation of a device node. Conversion starts with the first character and continues until the first non-device node character. - Returns: - A pointer - Pointer to the EFI device node. - NULL - If TextDeviceNode is NULL or there was insufficient memory or text unsupported. + @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was + insufficient memory or text unsupported. ---*/ +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +ConvertTextToDeviceNode ( + IN CONST CHAR16 *TextDeviceNode + ) { - EFI_DEVICE_PATH_PROTOCOL * (*DumpNode) (CHAR16 *); + DUMP_NODE DumpNode; CHAR16 *ParamStr; EFI_DEVICE_PATH_PROTOCOL *DeviceNode; CHAR16 *DeviceNodeStr; @@ -2467,6 +2763,7 @@ ConvertTextToDeviceNode ( ParamStr = NULL; DumpNode = NULL; DeviceNodeStr = StrDuplicate (TextDeviceNode); + ASSERT (DeviceNodeStr != NULL); for (Index = 0; DevPathFromTextTable[Index].Function; Index++) { ParamStr = GetParamByNodeName (DeviceNodeStr, DevPathFromTextTable[Index].DevicePathNodeText); @@ -2492,27 +2789,25 @@ ConvertTextToDeviceNode ( return DeviceNode; } -EFI_DEVICE_PATH_PROTOCOL * -ConvertTextToDevicePath ( - IN CONST CHAR16 *TextDevicePath - ) -/*++ +/** + Convert text to the binary representation of a device path. - Routine Description: - Convert text to the binary representation of a device path. - Arguments: - TextDevicePath - TextDevicePath points to the text representation of a device + @param TextDevicePath TextDevicePath points to the text representation of a device path. Conversion starts with the first character and continues until the first non-device node character. - Returns: - A pointer - Pointer to the allocated device path. - NULL - If TextDeviceNode is NULL or there was insufficient memory. + @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or + there was insufficient memory. ---*/ +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +ConvertTextToDevicePath ( + IN CONST CHAR16 *TextDevicePath + ) { - EFI_DEVICE_PATH_PROTOCOL * (*DumpNode) (CHAR16 *); + DUMP_NODE DumpNode; CHAR16 *ParamStr; EFI_DEVICE_PATH_PROTOCOL *DeviceNode; UINTN Index; @@ -2528,6 +2823,7 @@ ConvertTextToDevicePath ( } DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH); + ASSERT (DevicePath != NULL); SetDevicePathEndNode (DevicePath); ParamStr = NULL; @@ -2561,9 +2857,10 @@ ConvertTextToDevicePath ( FreePool (DeviceNode); DevicePath = NewDevicePath; - if (IsInstanceEnd) { + if (IsInstanceEnd != 0) { DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH); - SetDevicePathInstanceEndNode (DeviceNode); + ASSERT (DeviceNode != NULL); + SET_DEVICE_PATH_INSTANCE_END_NODE (DeviceNode); NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode); FreePool (DevicePath);