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

@ -7,10 +7,8 @@
**/
#include <Uefi.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
@ -48,7 +46,8 @@ InternalAllocatePages (
if (EFI_ERROR (Status)) {
return NULL;
}
return (VOID *) (UINTN) Memory;
return (VOID *)(UINTN)Memory;
}
/**
@ -75,7 +74,7 @@ AllocatePages (
Buffer = InternalAllocatePages (EfiBootServicesData, Pages);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES,
EfiBootServicesData,
Buffer,
@ -83,6 +82,7 @@ AllocatePages (
NULL
);
}
return Buffer;
}
@ -110,7 +110,7 @@ AllocateRuntimePages (
Buffer = InternalAllocatePages (EfiRuntimeServicesData, Pages);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES,
EfiRuntimeServicesData,
Buffer,
@ -118,6 +118,7 @@ AllocateRuntimePages (
NULL
);
}
return Buffer;
}
@ -145,7 +146,7 @@ AllocateReservedPages (
Buffer = InternalAllocatePages (EfiReservedMemoryType, Pages);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES,
EfiReservedMemoryType,
Buffer,
@ -153,6 +154,7 @@ AllocateReservedPages (
NULL
);
}
return Buffer;
}
@ -180,10 +182,10 @@ FreePages (
IN UINTN Pages
)
{
EFI_STATUS Status;
EFI_STATUS Status;
ASSERT (Pages != 0);
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
}
@ -227,23 +229,25 @@ InternalAllocateAlignedPages (
if (Pages == 0) {
return NULL;
}
if (Alignment > EFI_PAGE_SIZE) {
//
// Calculate the total number of pages since alignment is larger than page size.
//
AlignmentMask = Alignment - 1;
RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
AlignmentMask = Alignment - 1;
RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
//
// Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
//
ASSERT (RealPages > Pages);
Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);
Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);
if (EFI_ERROR (Status)) {
return NULL;
}
AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory);
AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
if (UnalignedPages > 0) {
//
// Free first unaligned page(s).
@ -251,6 +255,7 @@ InternalAllocateAlignedPages (
Status = gBS->FreePages (Memory, UnalignedPages);
ASSERT_EFI_ERROR (Status);
}
Memory = AlignedMemory + EFI_PAGES_TO_SIZE (Pages);
UnalignedPages = RealPages - Pages - UnalignedPages;
if (UnalignedPages > 0) {
@ -268,9 +273,11 @@ InternalAllocateAlignedPages (
if (EFI_ERROR (Status)) {
return NULL;
}
AlignedMemory = (UINTN) Memory;
AlignedMemory = (UINTN)Memory;
}
return (VOID *) AlignedMemory;
return (VOID *)AlignedMemory;
}
/**
@ -303,7 +310,7 @@ AllocateAlignedPages (
Buffer = InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_PAGES,
EfiBootServicesData,
Buffer,
@ -311,6 +318,7 @@ AllocateAlignedPages (
NULL
);
}
return Buffer;
}
@ -344,7 +352,7 @@ AllocateAlignedRuntimePages (
Buffer = InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RUNTIME_PAGES,
EfiRuntimeServicesData,
Buffer,
@ -352,6 +360,7 @@ AllocateAlignedRuntimePages (
NULL
);
}
return Buffer;
}
@ -385,7 +394,7 @@ AllocateAlignedReservedPages (
Buffer = InternalAllocateAlignedPages (EfiReservedMemoryType, Pages, Alignment);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ALIGNED_RESERVED_PAGES,
EfiReservedMemoryType,
Buffer,
@ -393,6 +402,7 @@ AllocateAlignedReservedPages (
NULL
);
}
return Buffer;
}
@ -423,7 +433,7 @@ FreeAlignedPages (
EFI_STATUS Status;
ASSERT (Pages != 0);
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, Pages);
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
}
@ -453,6 +463,7 @@ InternalAllocatePool (
if (EFI_ERROR (Status)) {
Memory = NULL;
}
return Memory;
}
@ -479,7 +490,7 @@ AllocatePool (
Buffer = InternalAllocatePool (EfiBootServicesData, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL,
EfiBootServicesData,
Buffer,
@ -487,6 +498,7 @@ AllocatePool (
NULL
);
}
return Buffer;
}
@ -513,7 +525,7 @@ AllocateRuntimePool (
Buffer = InternalAllocatePool (EfiRuntimeServicesData, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_POOL,
EfiRuntimeServicesData,
Buffer,
@ -521,6 +533,7 @@ AllocateRuntimePool (
NULL
);
}
return Buffer;
}
@ -547,7 +560,7 @@ AllocateReservedPool (
Buffer = InternalAllocatePool (EfiReservedMemoryType, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL,
EfiReservedMemoryType,
Buffer,
@ -555,6 +568,7 @@ AllocateReservedPool (
NULL
);
}
return Buffer;
}
@ -584,6 +598,7 @@ InternalAllocateZeroPool (
if (Memory != NULL) {
Memory = ZeroMem (Memory, AllocationSize);
}
return Memory;
}
@ -611,7 +626,7 @@ AllocateZeroPool (
Buffer = InternalAllocateZeroPool (EfiBootServicesData, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL,
EfiBootServicesData,
Buffer,
@ -619,6 +634,7 @@ AllocateZeroPool (
NULL
);
}
return Buffer;
}
@ -646,7 +662,7 @@ AllocateRuntimeZeroPool (
Buffer = InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL,
EfiRuntimeServicesData,
Buffer,
@ -654,6 +670,7 @@ AllocateRuntimeZeroPool (
NULL
);
}
return Buffer;
}
@ -681,7 +698,7 @@ AllocateReservedZeroPool (
Buffer = InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_ZERO_POOL,
EfiReservedMemoryType,
Buffer,
@ -689,6 +706,7 @@ AllocateReservedZeroPool (
NULL
);
}
return Buffer;
}
@ -719,12 +737,13 @@ InternalAllocateCopyPool (
VOID *Memory;
ASSERT (Buffer != NULL);
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN)Buffer + 1));
Memory = InternalAllocatePool (PoolType, AllocationSize);
if (Memory != NULL) {
Memory = CopyMem (Memory, Buffer, AllocationSize);
Memory = CopyMem (Memory, Buffer, AllocationSize);
}
return Memory;
}
@ -757,7 +776,7 @@ AllocateCopyPool (
NewBuffer = InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);
if (NewBuffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL,
EfiBootServicesData,
NewBuffer,
@ -765,6 +784,7 @@ AllocateCopyPool (
NULL
);
}
return NewBuffer;
}
@ -797,7 +817,7 @@ AllocateRuntimeCopyPool (
NewBuffer = InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);
if (NewBuffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_COPY_POOL,
EfiRuntimeServicesData,
NewBuffer,
@ -805,6 +825,7 @@ AllocateRuntimeCopyPool (
NULL
);
}
return NewBuffer;
}
@ -837,7 +858,7 @@ AllocateReservedCopyPool (
NewBuffer = InternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer);
if (NewBuffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_COPY_POOL,
EfiRuntimeServicesData,
NewBuffer,
@ -845,6 +866,7 @@ AllocateReservedCopyPool (
NULL
);
}
return NewBuffer;
}
@ -881,10 +903,11 @@ InternalReallocatePool (
VOID *NewBuffer;
NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
if (NewBuffer != NULL && OldBuffer != NULL) {
if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
FreePool (OldBuffer);
}
return NewBuffer;
}
@ -922,7 +945,7 @@ ReallocatePool (
Buffer = InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL,
EfiBootServicesData,
Buffer,
@ -930,6 +953,7 @@ ReallocatePool (
NULL
);
}
return Buffer;
}
@ -967,7 +991,7 @@ ReallocateRuntimePool (
Buffer = InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RUNTIME_POOL,
EfiRuntimeServicesData,
Buffer,
@ -975,6 +999,7 @@ ReallocateRuntimePool (
NULL
);
}
return Buffer;
}
@ -1012,7 +1037,7 @@ ReallocateReservedPool (
Buffer = InternalReallocatePool (EfiReservedMemoryType, OldSize, NewSize, OldBuffer);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS(0),
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL,
EfiReservedMemoryType,
Buffer,
@ -1020,6 +1045,7 @@ ReallocateReservedPool (
NULL
);
}
return Buffer;
}
@ -1040,12 +1066,11 @@ ReallocateReservedPool (
VOID
EFIAPI
FreePool (
IN VOID *Buffer
IN VOID *Buffer
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = gBS->FreePool (Buffer);
ASSERT_EFI_ERROR (Status);
}