EmulatorPkg: Apply uncrustify changes

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

Apply uncrustify changes to .c/.h files in the EmulatorPkg 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: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:53:57 -08:00
committed by mergify[bot]
parent e7108d0e96
commit a550d468a6
111 changed files with 6170 additions and 6345 deletions

View File

@@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <PiPei.h>
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
(ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
@@ -18,6 +17,7 @@ GetFileState (
IN UINT8 ErasePolarity,
IN EFI_FFS_FILE_HEADER *FfsHeader
)
/*++
Routine Description:
@@ -39,7 +39,7 @@ Returns:
FileState = FfsHeader->State;
if (ErasePolarity != 0) {
FileState = (EFI_FFS_FILE_STATE)~FileState;
FileState = (EFI_FFS_FILE_STATE) ~FileState;
}
HighestBit = 0x80;
@@ -54,6 +54,7 @@ UINT8
CalculateHeaderChecksum (
IN EFI_FFS_FILE_HEADER *FileHeader
)
/*++
Routine Description:
@@ -67,41 +68,43 @@ Returns:
**/
{
UINT8 *ptr;
UINTN Index;
UINT8 Sum;
UINT8 *ptr;
UINTN Index;
UINT8 Sum;
Sum = 0;
ptr = (UINT8 *) FileHeader;
ptr = (UINT8 *)FileHeader;
for (Index = 0; Index < sizeof (EFI_FFS_FILE_HEADER) - 3; Index += 4) {
Sum = (UINT8) (Sum + ptr[Index]);
Sum = (UINT8) (Sum + ptr[Index + 1]);
Sum = (UINT8) (Sum + ptr[Index + 2]);
Sum = (UINT8) (Sum + ptr[Index + 3]);
Sum = (UINT8)(Sum + ptr[Index]);
Sum = (UINT8)(Sum + ptr[Index + 1]);
Sum = (UINT8)(Sum + ptr[Index + 2]);
Sum = (UINT8)(Sum + ptr[Index + 3]);
}
for (; Index < sizeof (EFI_FFS_FILE_HEADER); Index++) {
Sum = (UINT8) (Sum + ptr[Index]);
for ( ; Index < sizeof (EFI_FFS_FILE_HEADER); Index++) {
Sum = (UINT8)(Sum + ptr[Index]);
}
//
// State field (since this indicates the different state of file).
//
Sum = (UINT8) (Sum - FileHeader->State);
Sum = (UINT8)(Sum - FileHeader->State);
//
// Checksum field of the file is not part of the header checksum.
//
Sum = (UINT8) (Sum - FileHeader->IntegrityCheck.Checksum.File);
Sum = (UINT8)(Sum - FileHeader->IntegrityCheck.Checksum.File);
return Sum;
}
EFI_STATUS
SecFfsFindNextFile (
IN EFI_FV_FILETYPE SearchType,
IN EFI_PEI_FV_HANDLE FvHandle,
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
IN EFI_FV_FILETYPE SearchType,
IN EFI_PEI_FV_HANDLE FvHandle,
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
)
/*++
Routine Description:
@@ -124,20 +127,20 @@ Returns:
**/
{
EFI_FFS_FILE_HEADER *FfsFileHeader;
UINT32 FileLength;
UINT32 FileOccupiedSize;
UINT32 FileOffset;
UINT64 FvLength;
UINT8 ErasePolarity;
UINT8 FileState;
EFI_FFS_FILE_HEADER *FfsFileHeader;
UINT32 FileLength;
UINT32 FileOccupiedSize;
UINT32 FileOffset;
UINT64 FvLength;
UINT8 ErasePolarity;
UINT8 FileState;
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
EFI_FFS_FILE_HEADER **FileHeader;
//
// Convert the handle of FV to FV header for memory-mapped firmware volume
//
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) FvHandle;
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)FvHandle;
FileHeader = (EFI_FFS_FILE_HEADER **)FileHandle;
FvLength = FwVolHeader->FvLength;
@@ -146,23 +149,24 @@ Returns:
} else {
ErasePolarity = 0;
}
//
// If FileHeader is not specified (NULL) start with the first file in the
// firmware volume. Otherwise, start from the FileHeader.
//
if (*FileHeader == NULL) {
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FwVolHeader + FwVolHeader->HeaderLength);
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FwVolHeader + FwVolHeader->HeaderLength);
} else {
//
// Length is 24 bits wide so mask upper 8 bits
// FileLength is adjusted to FileOccupiedSize as it is 8 byte aligned.
//
FileLength = *(UINT32 *) (*FileHeader)->Size & 0x00FFFFFF;
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) *FileHeader + FileOccupiedSize);
FileLength = *(UINT32 *)(*FileHeader)->Size & 0x00FFFFFF;
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)*FileHeader + FileOccupiedSize);
}
FileOffset = (UINT32) ((UINT8 *) FfsFileHeader - (UINT8 *) FwVolHeader);
FileOffset = (UINT32)((UINT8 *)FfsFileHeader - (UINT8 *)FwVolHeader);
while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {
//
@@ -171,42 +175,40 @@ Returns:
FileState = GetFileState (ErasePolarity, FfsFileHeader);
switch (FileState) {
case EFI_FILE_HEADER_INVALID:
FileOffset += sizeof (EFI_FFS_FILE_HEADER);
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));
break;
case EFI_FILE_HEADER_INVALID:
FileOffset += sizeof (EFI_FFS_FILE_HEADER);
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));
break;
case EFI_FILE_DATA_VALID:
case EFI_FILE_MARKED_FOR_UPDATE:
if (CalculateHeaderChecksum (FfsFileHeader) == 0) {
FileLength = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
case EFI_FILE_DATA_VALID:
case EFI_FILE_MARKED_FOR_UPDATE:
if (CalculateHeaderChecksum (FfsFileHeader) == 0) {
FileLength = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
if ((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) {
*FileHeader = FfsFileHeader;
if ((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) {
return EFI_SUCCESS;
}
*FileHeader = FfsFileHeader;
return EFI_SUCCESS;
FileOffset += FileOccupiedSize;
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + FileOccupiedSize);
} else {
return EFI_NOT_FOUND;
}
FileOffset += FileOccupiedSize;
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);
} else {
break;
case EFI_FILE_DELETED:
FileLength = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
FileOffset += FileOccupiedSize;
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + FileOccupiedSize);
break;
default:
return EFI_NOT_FOUND;
}
break;
case EFI_FILE_DELETED:
FileLength = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
FileOffset += FileOccupiedSize;
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);
break;
default:
return EFI_NOT_FOUND;
}
}
@@ -215,10 +217,11 @@ Returns:
EFI_STATUS
SecFfsFindSectionData (
IN EFI_SECTION_TYPE SectionType,
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
IN OUT VOID **SectionData
IN EFI_SECTION_TYPE SectionType,
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
IN OUT VOID **SectionData
)
/*++
Routine Description:
@@ -237,39 +240,39 @@ Returns:
**/
{
UINT32 FileSize;
EFI_COMMON_SECTION_HEADER *Section;
UINT32 SectionLength;
UINT32 ParsedLength;
UINT32 FileSize;
EFI_COMMON_SECTION_HEADER *Section;
UINT32 SectionLength;
UINT32 ParsedLength;
//
// Size is 24 bits wide so mask upper 8 bits.
// Does not include FfsFileHeader header size
// FileSize is adjusted to FileOccupiedSize as it is 8 byte aligned.
//
Section = (EFI_COMMON_SECTION_HEADER *) (FfsFileHeader + 1);
FileSize = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;
Section = (EFI_COMMON_SECTION_HEADER *)(FfsFileHeader + 1);
FileSize = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
FileSize -= sizeof (EFI_FFS_FILE_HEADER);
*SectionData = NULL;
ParsedLength = 0;
*SectionData = NULL;
ParsedLength = 0;
while (ParsedLength < FileSize) {
if (Section->Type == SectionType) {
*SectionData = (VOID *) (Section + 1);
*SectionData = (VOID *)(Section + 1);
return EFI_SUCCESS;
}
//
// Size is 24 bits wide so mask upper 8 bits.
// SectionLength is adjusted it is 4 byte aligned.
// Go to the next section
//
SectionLength = *(UINT32 *) Section->Size & 0x00FFFFFF;
SectionLength = *(UINT32 *)Section->Size & 0x00FFFFFF;
SectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);
ParsedLength += SectionLength;
Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + SectionLength);
Section = (EFI_COMMON_SECTION_HEADER *)((UINT8 *)Section + SectionLength);
}
return EFI_NOT_FOUND;
}

View File

@@ -6,30 +6,26 @@
**/
#include <PiPei.h>
#include <Library/EmuMagicPageLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
EFI_STATUS
SecFfsFindNextFile (
IN EFI_FV_FILETYPE SearchType,
IN EFI_PEI_FV_HANDLE VolumeHandle,
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
IN EFI_FV_FILETYPE SearchType,
IN EFI_PEI_FV_HANDLE VolumeHandle,
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
);
EFI_STATUS
SecFfsFindSectionData (
IN EFI_SECTION_TYPE SectionType,
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT VOID **SectionData
IN EFI_SECTION_TYPE SectionType,
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT VOID **SectionData
);
/**
This service enables a given PEIM to register an interface into the PEI Foundation.
@@ -45,7 +41,7 @@ SecFfsFindSectionData (
EFI_STATUS
EFIAPI
PeiServicesInstallPpi (
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
)
{
ASSERT (FALSE);
@@ -70,8 +66,8 @@ PeiServicesInstallPpi (
EFI_STATUS
EFIAPI
PeiServicesReInstallPpi (
IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,
IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,
IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
)
{
ASSERT (FALSE);
@@ -97,26 +93,28 @@ PeiServicesReInstallPpi (
EFI_STATUS
EFIAPI
PeiServicesLocatePpi (
IN CONST EFI_GUID *Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
IN OUT VOID **Ppi
IN CONST EFI_GUID *Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
IN OUT VOID **Ppi
)
{
EFI_PEI_PPI_DESCRIPTOR *PpiList;
EFI_PEI_PPI_DESCRIPTOR *PpiList;
if (Instance != 0) {
return EFI_NOT_FOUND;
}
for (PpiList = EMU_MAGIC_PAGE()->PpiList; ; PpiList++) {
for (PpiList = EMU_MAGIC_PAGE ()->PpiList; ; PpiList++) {
if (CompareGuid (PpiList->Guid, Guid)) {
if (PpiDescriptor != NULL) {
*PpiDescriptor = PpiList;
}
if (Ppi != NULL) {
*Ppi = PpiList->Ppi;
}
return EFI_SUCCESS;
}
@@ -125,7 +123,6 @@ PeiServicesLocatePpi (
}
}
return EFI_NOT_FOUND;
}
@@ -166,7 +163,7 @@ PeiServicesNotifyPpi (
EFI_STATUS
EFIAPI
PeiServicesGetBootMode (
OUT EFI_BOOT_MODE *BootMode
OUT EFI_BOOT_MODE *BootMode
)
{
ASSERT (FALSE);
@@ -184,7 +181,7 @@ PeiServicesGetBootMode (
EFI_STATUS
EFIAPI
PeiServicesSetBootMode (
IN EFI_BOOT_MODE BootMode
IN EFI_BOOT_MODE BootMode
)
{
ASSERT (FALSE);
@@ -204,7 +201,7 @@ PeiServicesSetBootMode (
EFI_STATUS
EFIAPI
PeiServicesGetHobList (
OUT VOID **HobList
OUT VOID **HobList
)
{
ASSERT (FALSE);
@@ -226,9 +223,9 @@ PeiServicesGetHobList (
EFI_STATUS
EFIAPI
PeiServicesCreateHob (
IN UINT16 Type,
IN UINT16 Length,
OUT VOID **Hob
IN UINT16 Type,
IN UINT16 Length,
OUT VOID **Hob
)
{
ASSERT (FALSE);
@@ -251,8 +248,8 @@ PeiServicesCreateHob (
EFI_STATUS
EFIAPI
PeiServicesFfsFindNextVolume (
IN UINTN Instance,
IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
IN UINTN Instance,
IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
)
{
ASSERT (FALSE);
@@ -276,9 +273,9 @@ PeiServicesFfsFindNextVolume (
EFI_STATUS
EFIAPI
PeiServicesFfsFindNextFile (
IN EFI_FV_FILETYPE SearchType,
IN EFI_PEI_FV_HANDLE VolumeHandle,
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
IN EFI_FV_FILETYPE SearchType,
IN EFI_PEI_FV_HANDLE VolumeHandle,
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
)
{
return SecFfsFindNextFile (SearchType, VolumeHandle, FileHandle);
@@ -299,9 +296,9 @@ PeiServicesFfsFindNextFile (
EFI_STATUS
EFIAPI
PeiServicesFfsFindSectionData (
IN EFI_SECTION_TYPE SectionType,
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT VOID **SectionData
IN EFI_SECTION_TYPE SectionType,
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT VOID **SectionData
)
{
return SecFfsFindSectionData (SectionType, FileHandle, SectionData);
@@ -322,8 +319,8 @@ PeiServicesFfsFindSectionData (
EFI_STATUS
EFIAPI
PeiServicesInstallPeiMemory (
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
IN UINT64 MemoryLength
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
IN UINT64 MemoryLength
)
{
ASSERT (FALSE);
@@ -347,9 +344,9 @@ PeiServicesInstallPeiMemory (
EFI_STATUS
EFIAPI
PeiServicesAllocatePages (
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
OUT EFI_PHYSICAL_ADDRESS *Memory
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
OUT EFI_PHYSICAL_ADDRESS *Memory
)
{
ASSERT (FALSE);
@@ -370,8 +367,8 @@ PeiServicesAllocatePages (
EFI_STATUS
EFIAPI
PeiServicesAllocatePool (
IN UINTN Size,
OUT VOID **Buffer
IN UINTN Size,
OUT VOID **Buffer
)
{
ASSERT (FALSE);
@@ -415,7 +412,7 @@ PeiServicesResetSystem (
EFI_STATUS
EFIAPI
PeiServicesRegisterForShadow (
IN EFI_PEI_FILE_HANDLE FileHandle
IN EFI_PEI_FILE_HANDLE FileHandle
)
{
ASSERT (FALSE);
@@ -443,15 +440,14 @@ PeiServicesRegisterForShadow (
EFI_STATUS
EFIAPI
PeiServicesFfsGetFileInfo (
IN CONST EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO *FileInfo
IN CONST EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO *FileInfo
)
{
ASSERT (FALSE);
return EFI_OUT_OF_RESOURCES;
}
/**
This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services
Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
@@ -476,16 +472,15 @@ PeiServicesFfsGetFileInfo (
EFI_STATUS
EFIAPI
PeiServicesFfsFindFileByName (
IN CONST EFI_GUID *FileName,
IN CONST EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
IN CONST EFI_GUID *FileName,
IN CONST EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
)
{
ASSERT (FALSE);
return EFI_OUT_OF_RESOURCES;
}
/**
This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services
Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
@@ -507,8 +502,8 @@ PeiServicesFfsFindFileByName (
EFI_STATUS
EFIAPI
PeiServicesFfsGetVolumeInfo (
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_FV_INFO *VolumeInfo
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_FV_INFO *VolumeInfo
)
{
ASSERT (FALSE);
@@ -548,11 +543,11 @@ PeiServicesFfsGetVolumeInfo (
VOID
EFIAPI
PeiServicesInstallFvInfoPpi (
IN CONST EFI_GUID *FvFormat OPTIONAL,
IN CONST VOID *FvInfo,
IN UINT32 FvInfoSize,
IN CONST EFI_GUID *ParentFvName OPTIONAL,
IN CONST EFI_GUID *ParentFileName OPTIONAL
IN CONST EFI_GUID *FvFormat OPTIONAL,
IN CONST VOID *FvInfo,
IN UINT32 FvInfoSize,
IN CONST EFI_GUID *ParentFvName OPTIONAL,
IN CONST EFI_GUID *ParentFileName OPTIONAL
)
{
ASSERT (FALSE);