MdeModulePkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdeModulePkg 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:
Michael Kubacki
2021-12-05 14:54:02 -08:00
committed by mergify[bot]
parent 7c7184e201
commit 1436aea4d5
994 changed files with 107608 additions and 101311 deletions

View File

@@ -12,24 +12,24 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// ProtocolRequest - Last LocateHandle request ID
//
UINTN mEfiLocateHandleRequest = 0;
UINTN mEfiLocateHandleRequest = 0;
//
// Internal prototypes
//
typedef struct {
EFI_GUID *Protocol;
VOID *SearchKey;
LIST_ENTRY *Position;
PROTOCOL_ENTRY *ProtEntry;
EFI_GUID *Protocol;
VOID *SearchKey;
LIST_ENTRY *Position;
PROTOCOL_ENTRY *ProtEntry;
} LOCATE_POSITION;
typedef
IHANDLE *
(* CORE_GET_NEXT) (
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
(*CORE_GET_NEXT) (
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
);
/**
@@ -45,8 +45,8 @@ IHANDLE *
**/
IHANDLE *
CoreGetNextLocateAllHandles (
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
);
/**
@@ -63,8 +63,8 @@ CoreGetNextLocateAllHandles (
**/
IHANDLE *
CoreGetNextLocateByRegisterNotify (
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
);
/**
@@ -80,11 +80,10 @@ CoreGetNextLocateByRegisterNotify (
**/
IHANDLE *
CoreGetNextLocateByProtocol (
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
);
/**
Internal function for locating the requested handle(s) and returns them in Buffer.
The caller should already have acquired the ProtocolLock.
@@ -106,21 +105,21 @@ CoreGetNextLocateByProtocol (
**/
EFI_STATUS
InternalCoreLocateHandle (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *BufferSize,
OUT EFI_HANDLE *Buffer
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *BufferSize,
OUT EFI_HANDLE *Buffer
)
{
EFI_STATUS Status;
LOCATE_POSITION Position;
PROTOCOL_NOTIFY *ProtNotify;
CORE_GET_NEXT GetNext;
UINTN ResultSize;
IHANDLE *Handle;
IHANDLE **ResultBuffer;
VOID *Interface;
EFI_STATUS Status;
LOCATE_POSITION Position;
PROTOCOL_NOTIFY *ProtNotify;
CORE_GET_NEXT GetNext;
UINTN ResultSize;
IHANDLE *Handle;
IHANDLE **ResultBuffer;
VOID *Interface;
if (BufferSize == NULL) {
return EFI_INVALID_PARAMETER;
@@ -139,52 +138,55 @@ InternalCoreLocateHandle (
Position.SearchKey = SearchKey;
Position.Position = &gHandleList;
ResultSize = 0;
ResultBuffer = (IHANDLE **) Buffer;
Status = EFI_SUCCESS;
ResultSize = 0;
ResultBuffer = (IHANDLE **)Buffer;
Status = EFI_SUCCESS;
//
// Get the search function based on type
//
switch (SearchType) {
case AllHandles:
GetNext = CoreGetNextLocateAllHandles;
break;
case AllHandles:
GetNext = CoreGetNextLocateAllHandles;
break;
case ByRegisterNotify:
//
// Must have SearchKey for locate ByRegisterNotify
//
if (SearchKey == NULL) {
case ByRegisterNotify:
//
// Must have SearchKey for locate ByRegisterNotify
//
if (SearchKey == NULL) {
Status = EFI_INVALID_PARAMETER;
break;
}
GetNext = CoreGetNextLocateByRegisterNotify;
break;
case ByProtocol:
GetNext = CoreGetNextLocateByProtocol;
if (Protocol == NULL) {
Status = EFI_INVALID_PARAMETER;
break;
}
//
// Look up the protocol entry and set the head pointer
//
Position.ProtEntry = CoreFindProtocolEntry (Protocol, FALSE);
if (Position.ProtEntry == NULL) {
Status = EFI_NOT_FOUND;
break;
}
Position.Position = &Position.ProtEntry->Protocols;
break;
default:
Status = EFI_INVALID_PARAMETER;
break;
}
GetNext = CoreGetNextLocateByRegisterNotify;
break;
case ByProtocol:
GetNext = CoreGetNextLocateByProtocol;
if (Protocol == NULL) {
Status = EFI_INVALID_PARAMETER;
break;
}
//
// Look up the protocol entry and set the head pointer
//
Position.ProtEntry = CoreFindProtocolEntry (Protocol, FALSE);
if (Position.ProtEntry == NULL) {
Status = EFI_NOT_FOUND;
break;
}
Position.Position = &Position.ProtEntry->Protocols;
break;
default:
Status = EFI_INVALID_PARAMETER;
break;
}
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return Status;
}
@@ -193,7 +195,7 @@ InternalCoreLocateHandle (
// Enumerate out the matching handles
//
mEfiLocateHandleRequest += 1;
for (; ;) {
for ( ; ;) {
//
// Get the next handle. If no more handles, stop
//
@@ -206,10 +208,10 @@ InternalCoreLocateHandle (
// Increase the resulting buffer size, and if this handle
// fits return it
//
ResultSize += sizeof(Handle);
ResultSize += sizeof (Handle);
if (ResultSize <= *BufferSize) {
*ResultBuffer = Handle;
ResultBuffer += 1;
*ResultBuffer = Handle;
ResultBuffer += 1;
}
}
@@ -230,13 +232,13 @@ InternalCoreLocateHandle (
*BufferSize = ResultSize;
if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) {
if ((SearchType == ByRegisterNotify) && !EFI_ERROR (Status)) {
//
// If this is a search by register notify and a handle was
// returned, update the register notification position
//
ASSERT (SearchKey != NULL);
ProtNotify = SearchKey;
ProtNotify = SearchKey;
ProtNotify->Position = ProtNotify->Position->ForwardLink;
}
}
@@ -265,25 +267,24 @@ InternalCoreLocateHandle (
EFI_STATUS
EFIAPI
CoreLocateHandle (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *BufferSize,
OUT EFI_HANDLE *Buffer
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *BufferSize,
OUT EFI_HANDLE *Buffer
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Lock the protocol database
//
CoreAcquireProtocolLock ();
Status = InternalCoreLocateHandle(SearchType, Protocol, SearchKey, BufferSize, Buffer);
Status = InternalCoreLocateHandle (SearchType, Protocol, SearchKey, BufferSize, Buffer);
CoreReleaseProtocolLock ();
return Status;
}
/**
Routine to get the next Handle, when you are searching for all handles.
@@ -297,11 +298,11 @@ CoreLocateHandle (
**/
IHANDLE *
CoreGetNextLocateAllHandles (
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
)
{
IHANDLE *Handle;
IHANDLE *Handle;
//
// Next handle
@@ -311,8 +312,8 @@ CoreGetNextLocateAllHandles (
//
// If not at the end of the list, get the handle
//
Handle = NULL;
*Interface = NULL;
Handle = NULL;
*Interface = NULL;
if (Position->Position != &gHandleList) {
Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
}
@@ -320,8 +321,6 @@ CoreGetNextLocateAllHandles (
return Handle;
}
/**
Routine to get the next Handle, when you are searching for register protocol
notifies.
@@ -336,8 +335,8 @@ CoreGetNextLocateAllHandles (
**/
IHANDLE *
CoreGetNextLocateByRegisterNotify (
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
)
{
IHANDLE *Handle;
@@ -345,15 +344,15 @@ CoreGetNextLocateByRegisterNotify (
PROTOCOL_INTERFACE *Prot;
LIST_ENTRY *Link;
Handle = NULL;
*Interface = NULL;
Handle = NULL;
*Interface = NULL;
ProtNotify = Position->SearchKey;
//
// If this is the first request, get the next handle
//
if (ProtNotify != NULL) {
ASSERT(ProtNotify->Signature == PROTOCOL_NOTIFY_SIGNATURE);
ASSERT (ProtNotify->Signature == PROTOCOL_NOTIFY_SIGNATURE);
Position->SearchKey = NULL;
//
@@ -361,8 +360,8 @@ CoreGetNextLocateByRegisterNotify (
//
Link = ProtNotify->Position->ForwardLink;
if (Link != &ProtNotify->Protocol->Protocols) {
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
Handle = Prot->Handle;
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
Handle = Prot->Handle;
*Interface = Prot->Interface;
}
}
@@ -370,7 +369,6 @@ CoreGetNextLocateByRegisterNotify (
return Handle;
}
/**
Routine to get the next Handle, when you are searching for a given protocol.
@@ -384,21 +382,21 @@ CoreGetNextLocateByRegisterNotify (
**/
IHANDLE *
CoreGetNextLocateByProtocol (
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
IN OUT LOCATE_POSITION *Position,
OUT VOID **Interface
)
{
IHANDLE *Handle;
LIST_ENTRY *Link;
PROTOCOL_INTERFACE *Prot;
Handle = NULL;
*Interface = NULL;
for (; ;) {
Handle = NULL;
*Interface = NULL;
for ( ; ;) {
//
// Next entry
//
Link = Position->Position->ForwardLink;
Link = Position->Position->ForwardLink;
Position->Position = Link;
//
@@ -412,8 +410,8 @@ CoreGetNextLocateByProtocol (
//
// Get the handle
//
Prot = CR(Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
Handle = Prot->Handle;
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
Handle = Prot->Handle;
*Interface = Prot->Interface;
//
@@ -429,7 +427,6 @@ CoreGetNextLocateByProtocol (
return Handle;
}
/**
Locates the handle to a device on the device path that supports the specified protocol.
@@ -449,22 +446,22 @@ CoreGetNextLocateByProtocol (
EFI_STATUS
EFIAPI
CoreLocateDevicePath (
IN EFI_GUID *Protocol,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
OUT EFI_HANDLE *Device
IN EFI_GUID *Protocol,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
OUT EFI_HANDLE *Device
)
{
INTN SourceSize;
INTN Size;
INTN BestMatch;
UINTN HandleCount;
UINTN Index;
EFI_STATUS Status;
EFI_HANDLE *Handles;
EFI_HANDLE Handle;
EFI_HANDLE BestDevice;
EFI_DEVICE_PATH_PROTOCOL *SourcePath;
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
INTN SourceSize;
INTN Size;
INTN BestMatch;
UINTN HandleCount;
UINTN Index;
EFI_STATUS Status;
EFI_HANDLE *Handles;
EFI_HANDLE Handle;
EFI_HANDLE BestDevice;
EFI_DEVICE_PATH_PROTOCOL *SourcePath;
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
if (Protocol == NULL) {
return EFI_INVALID_PARAMETER;
@@ -474,9 +471,9 @@ CoreLocateDevicePath (
return EFI_INVALID_PARAMETER;
}
Handles = NULL;
BestDevice = NULL;
SourcePath = *DevicePath;
Handles = NULL;
BestDevice = NULL;
SourcePath = *DevicePath;
TmpDevicePath = SourcePath;
while (!IsDevicePathEnd (TmpDevicePath)) {
if (IsDevicePathEndInstance (TmpDevicePath)) {
@@ -486,21 +483,22 @@ CoreLocateDevicePath (
//
break;
}
TmpDevicePath = NextDevicePathNode (TmpDevicePath);
}
SourceSize = (UINTN) TmpDevicePath - (UINTN) SourcePath;
SourceSize = (UINTN)TmpDevicePath - (UINTN)SourcePath;
//
// Get a list of all handles that support the requested protocol
//
Status = CoreLocateHandleBuffer (ByProtocol, Protocol, NULL, &HandleCount, &Handles);
if (EFI_ERROR (Status) || HandleCount == 0) {
if (EFI_ERROR (Status) || (HandleCount == 0)) {
return EFI_NOT_FOUND;
}
BestMatch = -1;
for(Index = 0; Index < HandleCount; Index += 1) {
for (Index = 0; Index < HandleCount; Index += 1) {
Handle = Handles[Index];
Status = CoreHandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&TmpDevicePath);
if (EFI_ERROR (Status)) {
@@ -513,9 +511,9 @@ CoreLocateDevicePath (
//
// Check if DevicePath is first part of SourcePath
//
Size = GetDevicePathSize (TmpDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);
Size = GetDevicePathSize (TmpDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL);
ASSERT (Size >= 0);
if ((Size <= SourceSize) && CompareMem (SourcePath, TmpDevicePath, (UINTN) Size) == 0) {
if ((Size <= SourceSize) && (CompareMem (SourcePath, TmpDevicePath, (UINTN)Size) == 0)) {
//
// If the size is equal to the best match, then we
// have a duplicate device path for 2 different device
@@ -527,7 +525,7 @@ CoreLocateDevicePath (
// We've got a match, see if it's the best match so far
//
if (Size > BestMatch) {
BestMatch = Size;
BestMatch = Size;
BestDevice = Handle;
}
}
@@ -544,18 +542,18 @@ CoreLocateDevicePath (
}
if (Device == NULL) {
return EFI_INVALID_PARAMETER;
return EFI_INVALID_PARAMETER;
}
*Device = BestDevice;
//
// Return the remaining part of the device path
//
*DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) SourcePath) + BestMatch);
*DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)(((UINT8 *)SourcePath) + BestMatch);
return EFI_SUCCESS;
}
/**
Return the first Protocol Interface that matches the Protocol GUID. If
Registration is passed in, return a Protocol Instance that was just add
@@ -580,17 +578,17 @@ CoreLocateProtocol (
OUT VOID **Interface
)
{
EFI_STATUS Status;
LOCATE_POSITION Position;
PROTOCOL_NOTIFY *ProtNotify;
IHANDLE *Handle;
EFI_STATUS Status;
LOCATE_POSITION Position;
PROTOCOL_NOTIFY *ProtNotify;
IHANDLE *Handle;
if ((Interface == NULL) || (Protocol == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Interface = NULL;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
//
// Set initial position
@@ -618,6 +616,7 @@ CoreLocateProtocol (
Status = EFI_NOT_FOUND;
goto Done;
}
Position.Position = &Position.ProtEntry->Protocols;
Handle = CoreGetNextLocateByProtocol (&Position, Interface);
@@ -632,7 +631,7 @@ CoreLocateProtocol (
// If this is a search by register notify and a handle was
// returned, update the register notification position
//
ProtNotify = Registration;
ProtNotify = Registration;
ProtNotify->Position = ProtNotify->Position->ForwardLink;
}
@@ -666,15 +665,15 @@ Done:
EFI_STATUS
EFIAPI
CoreLocateHandleBuffer (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *NumberHandles,
OUT EFI_HANDLE **Buffer
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *NumberHandles,
OUT EFI_HANDLE **Buffer
)
{
EFI_STATUS Status;
UINTN BufferSize;
EFI_STATUS Status;
UINTN BufferSize;
if (NumberHandles == NULL) {
return EFI_INVALID_PARAMETER;
@@ -684,14 +683,14 @@ CoreLocateHandleBuffer (
return EFI_INVALID_PARAMETER;
}
BufferSize = 0;
BufferSize = 0;
*NumberHandles = 0;
*Buffer = NULL;
*Buffer = NULL;
//
// Lock the protocol database
//
CoreAcquireProtocolLock();
CoreAcquireProtocolLock ();
Status = InternalCoreLocateHandle (
SearchType,
Protocol,
@@ -705,10 +704,11 @@ CoreLocateHandleBuffer (
//
// Add code to correctly handle expected errors from CoreLocateHandle().
//
if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
if (Status != EFI_INVALID_PARAMETER) {
Status = EFI_NOT_FOUND;
}
CoreReleaseProtocolLock ();
return Status;
}
@@ -727,14 +727,11 @@ CoreLocateHandleBuffer (
*Buffer
);
*NumberHandles = BufferSize / sizeof(EFI_HANDLE);
if (EFI_ERROR(Status)) {
*NumberHandles = BufferSize / sizeof (EFI_HANDLE);
if (EFI_ERROR (Status)) {
*NumberHandles = 0;
}
CoreReleaseProtocolLock ();
return Status;
}