MdePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
1436aea4d5
commit
2f88bd3a12
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -46,18 +46,18 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLib
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
IsDevicePathValid (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN UINTN MaxSize
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN UINTN MaxSize
|
||||
)
|
||||
{
|
||||
UINTN Count;
|
||||
UINTN Size;
|
||||
UINTN NodeLength;
|
||||
UINTN Count;
|
||||
UINTN Size;
|
||||
UINTN NodeLength;
|
||||
|
||||
//
|
||||
//Validate the input whether exists and its size big enough to touch the first node
|
||||
// Validate the input whether exists and its size big enough to touch the first node
|
||||
//
|
||||
if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) {
|
||||
if ((DevicePath == NULL) || ((MaxSize > 0) && (MaxSize < END_DEVICE_PATH_LENGTH))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ IsDevicePathValid (
|
||||
if (NodeLength > MAX_UINTN - Size) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Size += NodeLength;
|
||||
|
||||
//
|
||||
@@ -93,9 +94,10 @@ IsDevicePathValid (
|
||||
//
|
||||
// FilePath must be a NULL-terminated string.
|
||||
//
|
||||
if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH &&
|
||||
DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP &&
|
||||
*(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0) {
|
||||
if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&
|
||||
(DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP) &&
|
||||
(*(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -103,10 +105,9 @@ IsDevicePathValid (
|
||||
//
|
||||
// Only return TRUE when the End Device Path node is valid.
|
||||
//
|
||||
return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
|
||||
return (BOOLEAN)(DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns the Type field of a device path node.
|
||||
|
||||
@@ -197,7 +198,7 @@ NextDevicePathNode (
|
||||
)
|
||||
{
|
||||
ASSERT (Node != NULL);
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength (Node));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +228,7 @@ IsDevicePathEndType (
|
||||
)
|
||||
{
|
||||
ASSERT (Node != NULL);
|
||||
return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE);
|
||||
return (BOOLEAN)(DevicePathType (Node) == END_DEVICE_PATH_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,7 +255,7 @@ IsDevicePathEnd (
|
||||
)
|
||||
{
|
||||
ASSERT (Node != NULL);
|
||||
return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
|
||||
return (BOOLEAN)(IsDevicePathEndType (Node) && DevicePathSubType (Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,7 +282,7 @@ IsDevicePathEndInstance (
|
||||
)
|
||||
{
|
||||
ASSERT (Node != NULL);
|
||||
return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
|
||||
return (BOOLEAN)(IsDevicePathEndType (Node) && DevicePathSubType (Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,7 +381,7 @@ UefiDevicePathLibGetDevicePathSize (
|
||||
//
|
||||
// Compute the size and add back in the size of the end device path structure
|
||||
//
|
||||
return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);
|
||||
return ((UINTN)DevicePath - (UINTN)Start) + DevicePathNodeLength (DevicePath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -405,7 +406,7 @@ UefiDevicePathLibDuplicateDevicePath (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
UINTN Size;
|
||||
|
||||
//
|
||||
// Compute the size
|
||||
@@ -478,9 +479,9 @@ UefiDevicePathLibAppendDevicePath (
|
||||
// Allocate space for the combined device path. It only has one end node of
|
||||
// length EFI_DEVICE_PATH_PROTOCOL.
|
||||
//
|
||||
Size1 = GetDevicePathSize (FirstDevicePath);
|
||||
Size2 = GetDevicePathSize (SecondDevicePath);
|
||||
Size = Size1 + Size2 - END_DEVICE_PATH_LENGTH;
|
||||
Size1 = GetDevicePathSize (FirstDevicePath);
|
||||
Size2 = GetDevicePathSize (SecondDevicePath);
|
||||
Size = Size1 + Size2 - END_DEVICE_PATH_LENGTH;
|
||||
|
||||
NewDevicePath = AllocatePool (Size);
|
||||
|
||||
@@ -489,8 +490,8 @@ UefiDevicePathLibAppendDevicePath (
|
||||
//
|
||||
// Over write FirstDevicePath EndNode and do the copy
|
||||
//
|
||||
DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath +
|
||||
(Size1 - END_DEVICE_PATH_LENGTH));
|
||||
DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *)((CHAR8 *)NewDevicePath +
|
||||
(Size1 - END_DEVICE_PATH_LENGTH));
|
||||
CopyMem (DevicePath2, SecondDevicePath, Size2);
|
||||
}
|
||||
|
||||
@@ -540,6 +541,7 @@ UefiDevicePathLibAppendDevicePathNode (
|
||||
if (DevicePathNode == NULL) {
|
||||
return DuplicateDevicePath ((DevicePath != NULL) ? DevicePath : &mUefiDevicePathLibEndDevicePath);
|
||||
}
|
||||
|
||||
//
|
||||
// Build a Node that has a terminator on it
|
||||
//
|
||||
@@ -549,6 +551,7 @@ UefiDevicePathLibAppendDevicePathNode (
|
||||
if (TempDevicePath == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TempDevicePath = CopyMem (TempDevicePath, DevicePathNode, NodeLength);
|
||||
//
|
||||
// Add and end device path node to convert Node to device path
|
||||
@@ -612,20 +615,19 @@ UefiDevicePathLibAppendDevicePathInstance (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SrcSize = GetDevicePathSize (DevicePath);
|
||||
InstanceSize = GetDevicePathSize (DevicePathInstance);
|
||||
SrcSize = GetDevicePathSize (DevicePath);
|
||||
InstanceSize = GetDevicePathSize (DevicePathInstance);
|
||||
|
||||
NewDevicePath = AllocatePool (SrcSize + InstanceSize);
|
||||
if (NewDevicePath != NULL) {
|
||||
|
||||
TempDevicePath = CopyMem (NewDevicePath, DevicePath, SrcSize);;
|
||||
TempDevicePath = CopyMem (NewDevicePath, DevicePath, SrcSize);
|
||||
|
||||
while (!IsDevicePathEnd (TempDevicePath)) {
|
||||
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||
}
|
||||
|
||||
TempDevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
|
||||
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||
TempDevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
|
||||
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||
CopyMem (TempDevicePath, DevicePathInstance, InstanceSize);
|
||||
}
|
||||
|
||||
@@ -663,8 +665,8 @@ UefiDevicePathLibAppendDevicePathInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
UefiDevicePathLibGetNextDevicePathInstance (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||
@@ -673,7 +675,7 @@ UefiDevicePathLibGetNextDevicePathInstance (
|
||||
|
||||
ASSERT (Size != NULL);
|
||||
|
||||
if (DevicePath == NULL || *DevicePath == NULL) {
|
||||
if ((DevicePath == NULL) || (*DevicePath == NULL)) {
|
||||
*Size = 0;
|
||||
return NULL;
|
||||
}
|
||||
@@ -693,15 +695,15 @@ UefiDevicePathLibGetNextDevicePathInstance (
|
||||
//
|
||||
// Compute the size of the device path instance
|
||||
//
|
||||
*Size = ((UINTN) DevPath - (UINTN) (*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
*Size = ((UINTN)DevPath - (UINTN)(*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
|
||||
//
|
||||
// Make a copy and return the device path instance
|
||||
//
|
||||
Temp = DevPath->SubType;
|
||||
DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||
ReturnValue = DuplicateDevicePath (*DevicePath);
|
||||
DevPath->SubType = Temp;
|
||||
Temp = DevPath->SubType;
|
||||
DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||
ReturnValue = DuplicateDevicePath (*DevicePath);
|
||||
DevPath->SubType = Temp;
|
||||
|
||||
//
|
||||
// If DevPath is the end of an entire device path, then another instance
|
||||
@@ -738,12 +740,12 @@ UefiDevicePathLibGetNextDevicePathInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
UefiDevicePathLibCreateDeviceNode (
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
|
||||
//
|
||||
@@ -754,9 +756,9 @@ UefiDevicePathLibCreateDeviceNode (
|
||||
|
||||
DevicePath = AllocateZeroPool (NodeLength);
|
||||
if (DevicePath != NULL) {
|
||||
DevicePath->Type = NodeType;
|
||||
DevicePath->SubType = NodeSubType;
|
||||
SetDevicePathNodeLength (DevicePath, NodeLength);
|
||||
DevicePath->Type = NodeType;
|
||||
DevicePath->SubType = NodeSubType;
|
||||
SetDevicePathNodeLength (DevicePath, NodeLength);
|
||||
}
|
||||
|
||||
return DevicePath;
|
||||
@@ -783,7 +785,7 @@ UefiDevicePathLibIsDevicePathMultiInstance (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
CONST EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
CONST EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
|
||||
if (DevicePath == NULL) {
|
||||
return FALSE;
|
||||
@@ -805,7 +807,6 @@ UefiDevicePathLibIsDevicePathMultiInstance (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Allocates a device path for a file and appends it to an existing device path.
|
||||
|
||||
@@ -830,8 +831,8 @@ UefiDevicePathLibIsDevicePathMultiInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
FileDevicePath (
|
||||
IN EFI_HANDLE Device OPTIONAL,
|
||||
IN CONST CHAR16 *FileName
|
||||
IN EFI_HANDLE Device OPTIONAL,
|
||||
IN CONST CHAR16 *FileName
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
@@ -841,10 +842,10 @@ FileDevicePath (
|
||||
|
||||
DevicePath = NULL;
|
||||
|
||||
Size = StrSize (FileName);
|
||||
Size = StrSize (FileName);
|
||||
FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
|
||||
if (FileDevicePath != NULL) {
|
||||
FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
|
||||
FilePath = (FILEPATH_DEVICE_PATH *)FileDevicePath;
|
||||
FilePath->Header.Type = MEDIA_DEVICE_PATH;
|
||||
FilePath->Header.SubType = MEDIA_FILEPATH_DP;
|
||||
CopyMem (&FilePath->PathName, FileName, Size);
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
#include "UefiDevicePathLib.h"
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the device path protocol from a handle.
|
||||
|
||||
@@ -33,7 +32,7 @@
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
DevicePathFromHandle (
|
||||
IN EFI_HANDLE Handle
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
@@ -42,10 +41,11 @@ DevicePathFromHandle (
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID *) &DevicePath
|
||||
(VOID *)&DevicePath
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DevicePath = NULL;
|
||||
}
|
||||
|
||||
return DevicePath;
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
#include "UefiDevicePathLib.h"
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the device path protocol from a handle.
|
||||
|
||||
@@ -33,7 +32,7 @@
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
DevicePathFromHandle (
|
||||
IN EFI_HANDLE Handle
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
{
|
||||
return NULL;
|
||||
|
@@ -13,7 +13,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "UefiDevicePathLib.h"
|
||||
|
||||
/**
|
||||
@@ -199,8 +198,8 @@ AppendDevicePathInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
GetNextDevicePathInstance (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
)
|
||||
{
|
||||
return UefiDevicePathLibGetNextDevicePathInstance (DevicePath, Size);
|
||||
@@ -228,9 +227,9 @@ GetNextDevicePathInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
CreateDeviceNode (
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
)
|
||||
{
|
||||
return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength);
|
||||
@@ -304,9 +303,9 @@ ConvertDeviceNodeToText (
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
ConvertDevicePathToText (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortcuts
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortcuts
|
||||
)
|
||||
{
|
||||
return UefiDevicePathLibConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
|
||||
@@ -326,7 +325,7 @@ ConvertDevicePathToText (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
ConvertTextToDeviceNode (
|
||||
IN CONST CHAR16 *TextDeviceNode
|
||||
IN CONST CHAR16 *TextDeviceNode
|
||||
)
|
||||
{
|
||||
return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode);
|
||||
@@ -347,7 +346,7 @@ ConvertTextToDeviceNode (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
ConvertTextToDevicePath (
|
||||
IN CONST CHAR16 *TextDevicePath
|
||||
IN CONST CHAR16 *TextDevicePath
|
||||
)
|
||||
{
|
||||
return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath);
|
||||
|
@@ -24,28 +24,27 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/PcdLib.h>
|
||||
#include <IndustryStandard/Bluetooth.h>
|
||||
|
||||
#define IS_COMMA(a) ((a) == L',')
|
||||
#define IS_HYPHEN(a) ((a) == L'-')
|
||||
#define IS_DOT(a) ((a) == L'.')
|
||||
#define IS_LEFT_PARENTH(a) ((a) == L'(')
|
||||
#define IS_RIGHT_PARENTH(a) ((a) == L')')
|
||||
#define IS_SLASH(a) ((a) == L'/')
|
||||
#define IS_NULL(a) ((a) == L'\0')
|
||||
|
||||
#define IS_COMMA(a) ((a) == L',')
|
||||
#define IS_HYPHEN(a) ((a) == L'-')
|
||||
#define IS_DOT(a) ((a) == L'.')
|
||||
#define IS_LEFT_PARENTH(a) ((a) == L'(')
|
||||
#define IS_RIGHT_PARENTH(a) ((a) == L')')
|
||||
#define IS_SLASH(a) ((a) == L'/')
|
||||
#define IS_NULL(a) ((a) == L'\0')
|
||||
|
||||
//
|
||||
// Private Data structure
|
||||
//
|
||||
typedef struct {
|
||||
CHAR16 *Str;
|
||||
UINTN Count;
|
||||
UINTN Capacity;
|
||||
CHAR16 *Str;
|
||||
UINTN Count;
|
||||
UINTN Capacity;
|
||||
} POOL_PRINT;
|
||||
|
||||
typedef
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
(*DEVICE_PATH_FROM_TEXT) (
|
||||
IN CHAR16 *Str
|
||||
IN CHAR16 *Str
|
||||
);
|
||||
|
||||
typedef
|
||||
@@ -58,90 +57,90 @@ VOID
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
DEVICE_PATH_TO_TEXT Function;
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
DEVICE_PATH_TO_TEXT Function;
|
||||
} DEVICE_PATH_TO_TEXT_TABLE;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
CHAR16 *Text;
|
||||
UINT8 Type;
|
||||
CHAR16 *Text;
|
||||
} DEVICE_PATH_TO_TEXT_GENERIC_TABLE;
|
||||
|
||||
typedef struct {
|
||||
CHAR16 *DevicePathNodeText;
|
||||
DEVICE_PATH_FROM_TEXT Function;
|
||||
CHAR16 *DevicePathNodeText;
|
||||
DEVICE_PATH_FROM_TEXT Function;
|
||||
} DEVICE_PATH_FROM_TEXT_TABLE;
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN ClassExist;
|
||||
UINT8 Class;
|
||||
BOOLEAN SubClassExist;
|
||||
UINT8 SubClass;
|
||||
BOOLEAN ClassExist;
|
||||
UINT8 Class;
|
||||
BOOLEAN SubClassExist;
|
||||
UINT8 SubClass;
|
||||
} USB_CLASS_TEXT;
|
||||
|
||||
#define USB_CLASS_AUDIO 1
|
||||
#define USB_CLASS_CDCCONTROL 2
|
||||
#define USB_CLASS_HID 3
|
||||
#define USB_CLASS_IMAGE 6
|
||||
#define USB_CLASS_PRINTER 7
|
||||
#define USB_CLASS_MASS_STORAGE 8
|
||||
#define USB_CLASS_HUB 9
|
||||
#define USB_CLASS_CDCDATA 10
|
||||
#define USB_CLASS_SMART_CARD 11
|
||||
#define USB_CLASS_VIDEO 14
|
||||
#define USB_CLASS_DIAGNOSTIC 220
|
||||
#define USB_CLASS_WIRELESS 224
|
||||
#define USB_CLASS_AUDIO 1
|
||||
#define USB_CLASS_CDCCONTROL 2
|
||||
#define USB_CLASS_HID 3
|
||||
#define USB_CLASS_IMAGE 6
|
||||
#define USB_CLASS_PRINTER 7
|
||||
#define USB_CLASS_MASS_STORAGE 8
|
||||
#define USB_CLASS_HUB 9
|
||||
#define USB_CLASS_CDCDATA 10
|
||||
#define USB_CLASS_SMART_CARD 11
|
||||
#define USB_CLASS_VIDEO 14
|
||||
#define USB_CLASS_DIAGNOSTIC 220
|
||||
#define USB_CLASS_WIRELESS 224
|
||||
|
||||
#define USB_CLASS_RESERVE 254
|
||||
#define USB_SUBCLASS_FW_UPDATE 1
|
||||
#define USB_SUBCLASS_IRDA_BRIDGE 2
|
||||
#define USB_SUBCLASS_TEST 3
|
||||
#define USB_CLASS_RESERVE 254
|
||||
#define USB_SUBCLASS_FW_UPDATE 1
|
||||
#define USB_SUBCLASS_IRDA_BRIDGE 2
|
||||
#define USB_SUBCLASS_TEST 3
|
||||
|
||||
#define RFC_1700_UDP_PROTOCOL 17
|
||||
#define RFC_1700_TCP_PROTOCOL 6
|
||||
#define RFC_1700_UDP_PROTOCOL 17
|
||||
#define RFC_1700_TCP_PROTOCOL 6
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
} VENDOR_DEFINED_HARDWARE_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
} VENDOR_DEFINED_MESSAGING_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
} VENDOR_DEFINED_MEDIA_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
UINT32 Hid;
|
||||
UINT32 Uid;
|
||||
UINT32 Cid;
|
||||
CHAR8 HidUidCidStr[3];
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
UINT32 Hid;
|
||||
UINT32 Uid;
|
||||
UINT32 Cid;
|
||||
CHAR8 HidUidCidStr[3];
|
||||
} ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
UINT16 NetworkProtocol;
|
||||
UINT16 LoginOption;
|
||||
UINT64 Lun;
|
||||
UINT16 TargetPortalGroupTag;
|
||||
CHAR8 TargetName[1];
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
UINT16 NetworkProtocol;
|
||||
UINT16 LoginOption;
|
||||
UINT64 Lun;
|
||||
UINT16 TargetPortalGroupTag;
|
||||
CHAR8 TargetName[1];
|
||||
} ISCSI_DEVICE_PATH_WITH_NAME;
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
EFI_DEVICE_PATH_PROTOCOL Header;
|
||||
EFI_GUID Guid;
|
||||
UINT8 VendorDefinedData[1];
|
||||
} VENDOR_DEVICE_PATH_WITH_DATA;
|
||||
|
||||
#pragma pack()
|
||||
@@ -314,8 +313,8 @@ UefiDevicePathLibAppendDevicePathInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
UefiDevicePathLibGetNextDevicePathInstance (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -340,9 +339,9 @@ UefiDevicePathLibGetNextDevicePathInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
UefiDevicePathLibCreateDeviceNode (
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -366,7 +365,6 @@ UefiDevicePathLibIsDevicePathMultiInstance (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Converts a device path to its text representation.
|
||||
|
||||
@@ -385,9 +383,9 @@ UefiDevicePathLibIsDevicePathMultiInstance (
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
UefiDevicePathLibConvertDevicePathToText (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortcuts
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortcuts
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -427,7 +425,7 @@ UefiDevicePathLibConvertDeviceNodeToText (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
UefiDevicePathLibConvertTextToDeviceNode (
|
||||
IN CONST CHAR16 *TextDeviceNode
|
||||
IN CONST CHAR16 *TextDeviceNode
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -445,7 +443,7 @@ UefiDevicePathLibConvertTextToDeviceNode (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
UefiDevicePathLibConvertTextToDevicePath (
|
||||
IN CONST CHAR16 *TextDevicePath
|
||||
IN CONST CHAR16 *TextDevicePath
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -13,12 +13,11 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "UefiDevicePathLib.h"
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathLibDevicePathToText = NULL;
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText = NULL;
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathLibDevicePathToText = NULL;
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText = NULL;
|
||||
|
||||
/**
|
||||
The constructor function caches the pointer to DevicePathUtilites protocol,
|
||||
@@ -37,16 +36,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLib
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UefiDevicePathLibOptionalDevicePathProtocolConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDevicePathUtilitiesProtocolGuid,
|
||||
NULL,
|
||||
(VOID**) &mDevicePathLibDevicePathUtilities
|
||||
(VOID **)&mDevicePathLibDevicePathUtilities
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
ASSERT (mDevicePathLibDevicePathUtilities != NULL);
|
||||
@@ -256,8 +255,8 @@ AppendDevicePathInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
GetNextDevicePathInstance (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
OUT UINTN *Size
|
||||
)
|
||||
{
|
||||
if (mDevicePathLibDevicePathUtilities != NULL) {
|
||||
@@ -289,9 +288,9 @@ GetNextDevicePathInstance (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
CreateDeviceNode (
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
IN UINT8 NodeType,
|
||||
IN UINT8 NodeSubType,
|
||||
IN UINT16 NodeLength
|
||||
)
|
||||
{
|
||||
if (mDevicePathLibDevicePathUtilities != NULL) {
|
||||
@@ -338,15 +337,16 @@ IsDevicePathMultiInstance (
|
||||
**/
|
||||
VOID *
|
||||
UefiDevicePathLibLocateProtocol (
|
||||
EFI_GUID *ProtocolGuid
|
||||
EFI_GUID *ProtocolGuid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *Protocol;
|
||||
EFI_STATUS Status;
|
||||
VOID *Protocol;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
ProtocolGuid,
|
||||
NULL,
|
||||
(VOID**) &Protocol
|
||||
(VOID **)&Protocol
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
@@ -381,6 +381,7 @@ ConvertDeviceNodeToText (
|
||||
if (mDevicePathLibDevicePathToText == NULL) {
|
||||
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
|
||||
}
|
||||
|
||||
if (mDevicePathLibDevicePathToText != NULL) {
|
||||
return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);
|
||||
}
|
||||
@@ -406,14 +407,15 @@ ConvertDeviceNodeToText (
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
ConvertDevicePathToText (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortcuts
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortcuts
|
||||
)
|
||||
{
|
||||
if (mDevicePathLibDevicePathToText == NULL) {
|
||||
mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
|
||||
}
|
||||
|
||||
if (mDevicePathLibDevicePathToText != NULL) {
|
||||
return mDevicePathLibDevicePathToText->ConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
|
||||
}
|
||||
@@ -435,12 +437,13 @@ ConvertDevicePathToText (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
ConvertTextToDeviceNode (
|
||||
IN CONST CHAR16 *TextDeviceNode
|
||||
IN CONST CHAR16 *TextDeviceNode
|
||||
)
|
||||
{
|
||||
if (mDevicePathLibDevicePathFromText == NULL) {
|
||||
mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
|
||||
}
|
||||
|
||||
if (mDevicePathLibDevicePathFromText != NULL) {
|
||||
return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (TextDeviceNode);
|
||||
}
|
||||
@@ -463,12 +466,13 @@ ConvertTextToDeviceNode (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
ConvertTextToDevicePath (
|
||||
IN CONST CHAR16 *TextDevicePath
|
||||
IN CONST CHAR16 *TextDevicePath
|
||||
)
|
||||
{
|
||||
if (mDevicePathLibDevicePathFromText == NULL) {
|
||||
mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
|
||||
}
|
||||
|
||||
if (mDevicePathLibDevicePathFromText != NULL) {
|
||||
return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (TextDevicePath);
|
||||
}
|
||||
|
Reference in New Issue
Block a user