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,26 +12,26 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Global function
//
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gPeiUsbIoPpiGuid,
NotifyOnUsbIoPpi
};
EFI_PEI_RECOVERY_BLOCK_IO_PPI mRecoveryBlkIoPpi = {
EFI_PEI_RECOVERY_BLOCK_IO_PPI mRecoveryBlkIoPpi = {
BotGetNumberOfBlockDevices,
BotGetMediaInfo,
BotReadBlocks
};
EFI_PEI_RECOVERY_BLOCK_IO2_PPI mRecoveryBlkIo2Ppi = {
EFI_PEI_RECOVERY_BLOCK_IO2_PPI mRecoveryBlkIo2Ppi = {
EFI_PEI_RECOVERY_BLOCK_IO2_PPI_REVISION,
BotGetNumberOfBlockDevices2,
BotGetMediaInfo2,
BotReadBlocks2
};
EFI_PEI_PPI_DESCRIPTOR mPpiList[2] = {
EFI_PEI_PPI_DESCRIPTOR mPpiList[2] = {
{
EFI_PEI_PPI_DESCRIPTOR_PPI,
&gEfiPeiVirtualBlockIoPpiGuid,
@@ -57,8 +57,8 @@ EFI_PEI_PPI_DESCRIPTOR mPpiList[2] = {
**/
EFI_STATUS
PeiBotDetectMedia (
IN EFI_PEI_SERVICES **PeiServices,
IN PEI_BOT_DEVICE *PeiBotDev
IN EFI_PEI_SERVICES **PeiServices,
IN PEI_BOT_DEVICE *PeiBotDev
);
/**
@@ -74,14 +74,14 @@ PeiBotDetectMedia (
EFI_STATUS
EFIAPI
PeimInitializeUsbBot (
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
EFI_STATUS Status;
UINTN UsbIoPpiInstance;
EFI_PEI_PPI_DESCRIPTOR *TempPpiDescriptor;
PEI_USB_IO_PPI *UsbIoPpi;
EFI_STATUS Status;
UINTN UsbIoPpiInstance;
EFI_PEI_PPI_DESCRIPTOR *TempPpiDescriptor;
PEI_USB_IO_PPI *UsbIoPpi;
//
// Shadow this PEIM to run from memory
@@ -94,17 +94,17 @@ PeimInitializeUsbBot (
// locate all usb io PPIs
//
for (UsbIoPpiInstance = 0; UsbIoPpiInstance < PEI_FAT_MAX_USB_IO_PPI; UsbIoPpiInstance++) {
Status = PeiServicesLocatePpi (
&gPeiUsbIoPpiGuid,
UsbIoPpiInstance,
&TempPpiDescriptor,
(VOID **) &UsbIoPpi
);
&gPeiUsbIoPpiGuid,
UsbIoPpiInstance,
&TempPpiDescriptor,
(VOID **)&UsbIoPpi
);
if (EFI_ERROR (Status)) {
break;
}
}
//
// Register a notify function
//
@@ -127,14 +127,14 @@ PeimInitializeUsbBot (
EFI_STATUS
EFIAPI
NotifyOnUsbIoPpi (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
IN VOID *InvokePpi
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
IN VOID *InvokePpi
)
{
PEI_USB_IO_PPI *UsbIoPpi;
UsbIoPpi = (PEI_USB_IO_PPI *) InvokePpi;
UsbIoPpi = (PEI_USB_IO_PPI *)InvokePpi;
InitUsbBot (PeiServices, UsbIoPpi);
@@ -154,8 +154,8 @@ NotifyOnUsbIoPpi (
**/
EFI_STATUS
InitUsbBot (
IN EFI_PEI_SERVICES **PeiServices,
IN PEI_USB_IO_PPI *UsbIoPpi
IN EFI_PEI_SERVICES **PeiServices,
IN PEI_USB_IO_PPI *UsbIoPpi
)
{
PEI_BOT_DEVICE *PeiBotDevice;
@@ -170,45 +170,45 @@ InitUsbBot (
// Check its interface
//
Status = UsbIoPpi->UsbGetInterfaceDescriptor (
PeiServices,
UsbIoPpi,
&InterfaceDesc
);
PeiServices,
UsbIoPpi,
&InterfaceDesc
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Check if it is the BOT device we support
//
if ((InterfaceDesc->InterfaceClass != 0x08) || (InterfaceDesc->InterfaceProtocol != 0x50)) {
return EFI_NOT_FOUND;
}
MemPages = sizeof (PEI_BOT_DEVICE) / EFI_PAGE_SIZE + 1;
Status = PeiServicesAllocatePages (
EfiBootServicesCode,
MemPages,
&AllocateAddress
);
Status = PeiServicesAllocatePages (
EfiBootServicesCode,
MemPages,
&AllocateAddress
);
if (EFI_ERROR (Status)) {
return Status;
}
PeiBotDevice = (PEI_BOT_DEVICE *) ((UINTN) AllocateAddress);
PeiBotDevice = (PEI_BOT_DEVICE *)((UINTN)AllocateAddress);
PeiBotDevice->Signature = PEI_BOT_DEVICE_SIGNATURE;
PeiBotDevice->UsbIoPpi = UsbIoPpi;
PeiBotDevice->AllocateAddress = (UINTN) AllocateAddress;
PeiBotDevice->AllocateAddress = (UINTN)AllocateAddress;
PeiBotDevice->BotInterface = InterfaceDesc;
//
// Default value
//
PeiBotDevice->Media.DeviceType = UsbMassStorage;
PeiBotDevice->Media.BlockSize = 0x200;
PeiBotDevice->Media2.InterfaceType = MSG_USB_DP;
PeiBotDevice->Media2.BlockSize = 0x200;
PeiBotDevice->Media.DeviceType = UsbMassStorage;
PeiBotDevice->Media.BlockSize = 0x200;
PeiBotDevice->Media2.InterfaceType = MSG_USB_DP;
PeiBotDevice->Media2.BlockSize = 0x200;
PeiBotDevice->Media2.RemovableMedia = FALSE;
PeiBotDevice->Media2.ReadOnly = FALSE;
@@ -217,11 +217,11 @@ InitUsbBot (
//
for (Index = 0; Index < 2; Index++) {
Status = UsbIoPpi->UsbGetEndpointDescriptor (
PeiServices,
UsbIoPpi,
Index,
&EndpointDesc
);
PeiServices,
UsbIoPpi,
Index,
&EndpointDesc
);
if (EFI_ERROR (Status)) {
return Status;
@@ -257,7 +257,7 @@ InitUsbBot (
PeiBotDevice->BlkIoPpiList.Ppi = &PeiBotDevice->BlkIoPpi;
PeiBotDevice->BlkIo2PpiList.Ppi = &PeiBotDevice->BlkIo2Ppi;
Status = PeiUsbInquiry (PeiServices, PeiBotDevice);
Status = PeiUsbInquiry (PeiServices, PeiBotDevice);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -271,7 +271,7 @@ InitUsbBot (
return Status;
}
PeiBotDevice->SensePtr = (ATAPI_REQUEST_SENSE_DATA *) ((UINTN) AllocateAddress);
PeiBotDevice->SensePtr = (ATAPI_REQUEST_SENSE_DATA *)((UINTN)AllocateAddress);
Status = PeiServicesInstallPpi (&PeiBotDevice->BlkIoPpiList);
@@ -304,9 +304,9 @@ InitUsbBot (
EFI_STATUS
EFIAPI
BotGetNumberOfBlockDevices (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
OUT UINTN *NumberBlockDevices
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
OUT UINTN *NumberBlockDevices
)
{
//
@@ -346,10 +346,10 @@ BotGetNumberOfBlockDevices (
EFI_STATUS
EFIAPI
BotGetMediaInfo (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
)
{
PEI_BOT_DEVICE *PeiBotDev;
@@ -366,9 +366,9 @@ BotGetMediaInfo (
);
Status = PeiBotDetectMedia (
PeiServices,
PeiBotDev
);
PeiServices,
PeiBotDev
);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
@@ -420,12 +420,12 @@ BotGetMediaInfo (
EFI_STATUS
EFIAPI
BotReadBlocks (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLBA,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLBA,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
PEI_BOT_DEVICE *PeiBotDev;
@@ -464,19 +464,18 @@ BotReadBlocks (
NumberOfBlocks = BufferSize / (PeiBotDev->Media.BlockSize);
if (Status == EFI_SUCCESS) {
Status = PeiUsbTestUnitReady (
PeiServices,
PeiBotDev
);
PeiServices,
PeiBotDev
);
if (Status == EFI_SUCCESS) {
Status = PeiUsbRead10 (
PeiServices,
PeiBotDev,
Buffer,
StartLBA,
1
);
PeiServices,
PeiBotDev,
Buffer,
StartLBA,
1
);
}
} else {
//
@@ -494,9 +493,9 @@ BotReadBlocks (
// update the media info accordingly.
//
Status = PeiBotDetectMedia (
PeiServices,
PeiBotDev
);
PeiServices,
PeiBotDev
);
if (Status != EFI_SUCCESS) {
return EFI_DEVICE_ERROR;
}
@@ -520,45 +519,42 @@ BotReadBlocks (
}
Status = PeiUsbRead10 (
PeiServices,
PeiBotDev,
Buffer,
StartLBA,
NumberOfBlocks
);
PeiServices,
PeiBotDev,
Buffer,
StartLBA,
NumberOfBlocks
);
switch (Status) {
case EFI_SUCCESS:
return EFI_SUCCESS;
case EFI_SUCCESS:
return EFI_SUCCESS;
default:
return EFI_DEVICE_ERROR;
default:
return EFI_DEVICE_ERROR;
}
} else {
StartLBA += 1;
StartLBA += 1;
NumberOfBlocks -= 1;
Buffer = (UINT8 *) Buffer + PeiBotDev->Media.BlockSize;
Buffer = (UINT8 *)Buffer + PeiBotDev->Media.BlockSize;
if (NumberOfBlocks == 0) {
return EFI_SUCCESS;
}
Status = PeiUsbRead10 (
PeiServices,
PeiBotDev,
Buffer,
StartLBA,
NumberOfBlocks
);
PeiServices,
PeiBotDev,
Buffer,
StartLBA,
NumberOfBlocks
);
switch (Status) {
case EFI_SUCCESS:
return EFI_SUCCESS;
case EFI_SUCCESS:
return EFI_SUCCESS;
default:
return EFI_DEVICE_ERROR;
default:
return EFI_DEVICE_ERROR;
}
}
}
@@ -585,9 +581,9 @@ BotReadBlocks (
EFI_STATUS
EFIAPI
BotGetNumberOfBlockDevices2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
OUT UINTN *NumberBlockDevices
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
OUT UINTN *NumberBlockDevices
)
{
//
@@ -627,10 +623,10 @@ BotGetNumberOfBlockDevices2 (
EFI_STATUS
EFIAPI
BotGetMediaInfo2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
)
{
PEI_BOT_DEVICE *PeiBotDev;
@@ -695,12 +691,12 @@ BotGetMediaInfo2 (
EFI_STATUS
EFIAPI
BotReadBlocks2 (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLBA,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLBA,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
PEI_BOT_DEVICE *PeiBotDev;
@@ -738,25 +734,25 @@ BotReadBlocks2 (
**/
EFI_STATUS
PeiBotDetectMedia (
IN EFI_PEI_SERVICES **PeiServices,
IN PEI_BOT_DEVICE *PeiBotDev
IN EFI_PEI_SERVICES **PeiServices,
IN PEI_BOT_DEVICE *PeiBotDev
)
{
EFI_STATUS Status;
EFI_STATUS FloppyStatus;
UINTN SenseCounts;
BOOLEAN NeedReadCapacity;
EFI_PHYSICAL_ADDRESS AllocateAddress;
ATAPI_REQUEST_SENSE_DATA *SensePtr;
UINTN Retry;
EFI_STATUS Status;
EFI_STATUS FloppyStatus;
UINTN SenseCounts;
BOOLEAN NeedReadCapacity;
EFI_PHYSICAL_ADDRESS AllocateAddress;
ATAPI_REQUEST_SENSE_DATA *SensePtr;
UINTN Retry;
//
// if there is no media present,or media not changed,
// the request sense command will detect faster than read capacity command.
// read capacity command can be bypassed, thus improve performance.
//
SenseCounts = 0;
NeedReadCapacity = TRUE;
SenseCounts = 0;
NeedReadCapacity = TRUE;
Status = PeiServicesAllocatePages (
EfiBootServicesCode,
@@ -771,20 +767,20 @@ PeiBotDetectMedia (
ZeroMem (SensePtr, EFI_PAGE_SIZE);
Status = PeiUsbRequestSense (
PeiServices,
PeiBotDev,
&SenseCounts,
(UINT8 *) SensePtr
);
PeiServices,
PeiBotDev,
&SenseCounts,
(UINT8 *)SensePtr
);
if (Status == EFI_SUCCESS) {
//
// No Media
//
if (IsNoMedia (SensePtr, SenseCounts)) {
NeedReadCapacity = FALSE;
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
NeedReadCapacity = FALSE;
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
PeiBotDev->Media2.MediaPresent = FALSE;
PeiBotDev->Media2.LastBlock = 0;
} else {
@@ -795,6 +791,7 @@ PeiBotDetectMedia (
PeiBotDev->Media.MediaPresent = TRUE;
PeiBotDev->Media2.MediaPresent = TRUE;
}
//
// Media Error
//
@@ -802,14 +799,12 @@ PeiBotDetectMedia (
//
// if media error encountered, make it look like no media present.
//
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
PeiBotDev->Media2.MediaPresent = FALSE;
PeiBotDev->Media2.LastBlock = 0;
}
}
}
if (NeedReadCapacity) {
@@ -818,43 +813,46 @@ PeiBotDetectMedia (
//
for (Retry = 0; Retry < 4; Retry++) {
switch (PeiBotDev->DeviceType) {
case USBCDROM:
Status = PeiUsbReadCapacity (
PeiServices,
PeiBotDev
);
break;
case USBCDROM:
Status = PeiUsbReadCapacity (
PeiServices,
PeiBotDev
);
break;
case USBFLOPPY2:
Status = PeiUsbReadFormattedCapacity (
PeiServices,
PeiBotDev
);
if (EFI_ERROR(Status)||
!PeiBotDev->Media.MediaPresent) {
//
// retry the ReadCapacity command
//
PeiBotDev->DeviceType = USBFLOPPY;
Status = EFI_DEVICE_ERROR;
}
break;
case USBFLOPPY2:
Status = PeiUsbReadFormattedCapacity (
PeiServices,
PeiBotDev
);
if (EFI_ERROR (Status) ||
!PeiBotDev->Media.MediaPresent)
{
//
// retry the ReadCapacity command
//
PeiBotDev->DeviceType = USBFLOPPY;
Status = EFI_DEVICE_ERROR;
}
case USBFLOPPY:
Status = PeiUsbReadCapacity (
PeiServices,
PeiBotDev
);
if (EFI_ERROR (Status)) {
//
// retry the ReadFormatCapacity command
//
PeiBotDev->DeviceType = USBFLOPPY2;
}
break;
break;
default:
return EFI_INVALID_PARAMETER;
case USBFLOPPY:
Status = PeiUsbReadCapacity (
PeiServices,
PeiBotDev
);
if (EFI_ERROR (Status)) {
//
// retry the ReadFormatCapacity command
//
PeiBotDev->DeviceType = USBFLOPPY2;
}
break;
default:
return EFI_INVALID_PARAMETER;
}
SenseCounts = 0;
@@ -865,11 +863,11 @@ PeiBotDetectMedia (
}
FloppyStatus = PeiUsbRequestSense (
PeiServices,
PeiBotDev,
&SenseCounts,
(UINT8 *) SensePtr
);
PeiServices,
PeiBotDev,
&SenseCounts,
(UINT8 *)SensePtr
);
//
// If Request Sense data failed,retry.
@@ -877,12 +875,13 @@ PeiBotDetectMedia (
if (EFI_ERROR (FloppyStatus)) {
continue;
}
//
// No Media
//
if (IsNoMedia (SensePtr, SenseCounts)) {
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
PeiBotDev->Media2.MediaPresent = FALSE;
PeiBotDev->Media2.LastBlock = 0;
break;
@@ -892,13 +891,14 @@ PeiBotDetectMedia (
//
// if media error encountered, make it look like no media present.
//
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
PeiBotDev->Media2.MediaPresent = FALSE;
PeiBotDev->Media2.LastBlock = 0;
break;
}
}
//
// ENDFOR
//