OvmfPkg: Apply uncrustify changes

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

Apply uncrustify changes to .c/.h files in the OvmfPkg 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: Andrew Fish <afish@apple.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:09 -08:00
committed by mergify[bot]
parent d1050b9dff
commit ac0a286f4d
445 changed files with 30894 additions and 26369 deletions

View File

@@ -26,7 +26,7 @@
// Higher versions will be used before lower, 0x10-0xffffffef is the version
// range for IHV (Indie Hardware Vendors)
//
#define PVSCSI_BINDING_VERSION 0x10
#define PVSCSI_BINDING_VERSION 0x10
//
// Ext SCSI Pass Thru utilities
@@ -38,9 +38,9 @@
STATIC
EFI_STATUS
PvScsiMmioRead32 (
IN CONST PVSCSI_DEV *Dev,
IN UINT64 Offset,
OUT UINT32 *Value
IN CONST PVSCSI_DEV *Dev,
IN UINT64 Offset,
OUT UINT32 *Value
)
{
return Dev->PciIo->Mem.Read (
@@ -59,9 +59,9 @@ PvScsiMmioRead32 (
STATIC
EFI_STATUS
PvScsiMmioWrite32 (
IN CONST PVSCSI_DEV *Dev,
IN UINT64 Offset,
IN UINT32 Value
IN CONST PVSCSI_DEV *Dev,
IN UINT64 Offset,
IN UINT32 Value
)
{
return Dev->PciIo->Mem.Write (
@@ -80,10 +80,10 @@ PvScsiMmioWrite32 (
STATIC
EFI_STATUS
PvScsiMmioWrite32Multiple (
IN CONST PVSCSI_DEV *Dev,
IN UINT64 Offset,
IN UINTN Count,
IN UINT32 *Words
IN CONST PVSCSI_DEV *Dev,
IN UINT64 Offset,
IN UINTN Count,
IN UINT32 *Words
)
{
return Dev->PciIo->Mem.Write (
@@ -116,13 +116,13 @@ PvScsiMmioWrite32Multiple (
STATIC
EFI_STATUS
PvScsiWriteCmdDesc (
IN CONST PVSCSI_DEV *Dev,
IN UINT32 Cmd,
IN UINT32 *DescWords OPTIONAL,
IN UINTN DescWordsCount
IN CONST PVSCSI_DEV *Dev,
IN UINT32 Cmd,
IN UINT32 *DescWords OPTIONAL,
IN UINTN DescWordsCount
)
{
EFI_STATUS Status;
EFI_STATUS Status;
if (DescWordsCount > PVSCSI_MAX_CMD_DATA_WORDS) {
return EFI_INVALID_PARAMETER;
@@ -148,7 +148,7 @@ PvScsiWriteCmdDesc (
STATIC
EFI_STATUS
PvScsiResetAdapter (
IN CONST PVSCSI_DEV *Dev
IN CONST PVSCSI_DEV *Dev
)
{
return PvScsiWriteCmdDesc (Dev, PvScsiCmdAdapterReset, NULL, 0);
@@ -160,13 +160,13 @@ PvScsiResetAdapter (
STATIC
BOOLEAN
PvScsiIsReqRingFull (
IN CONST PVSCSI_DEV *Dev
IN CONST PVSCSI_DEV *Dev
)
{
PVSCSI_RINGS_STATE *RingsState;
UINT32 ReqNumEntries;
PVSCSI_RINGS_STATE *RingsState;
UINT32 ReqNumEntries;
RingsState = Dev->RingDesc.RingState;
RingsState = Dev->RingDesc.RingState;
ReqNumEntries = 1U << RingsState->ReqNumEntriesLog2;
return (RingsState->ReqProdIdx - RingsState->CmpConsIdx) >= ReqNumEntries;
}
@@ -177,13 +177,13 @@ PvScsiIsReqRingFull (
STATIC
PVSCSI_RING_REQ_DESC *
PvScsiGetCurrentRequest (
IN CONST PVSCSI_DEV *Dev
IN CONST PVSCSI_DEV *Dev
)
{
PVSCSI_RINGS_STATE *RingState;
UINT32 ReqNumEntries;
PVSCSI_RINGS_STATE *RingState;
UINT32 ReqNumEntries;
RingState = Dev->RingDesc.RingState;
RingState = Dev->RingDesc.RingState;
ReqNumEntries = 1U << RingState->ReqNumEntriesLog2;
return Dev->RingDesc.RingReqs +
(RingState->ReqProdIdx & (ReqNumEntries - 1));
@@ -195,13 +195,13 @@ PvScsiGetCurrentRequest (
STATIC
PVSCSI_RING_CMP_DESC *
PvScsiGetCurrentResponse (
IN CONST PVSCSI_DEV *Dev
IN CONST PVSCSI_DEV *Dev
)
{
PVSCSI_RINGS_STATE *RingState;
UINT32 CmpNumEntries;
PVSCSI_RINGS_STATE *RingState;
UINT32 CmpNumEntries;
RingState = Dev->RingDesc.RingState;
RingState = Dev->RingDesc.RingState;
CmpNumEntries = 1U << RingState->CmpNumEntriesLog2;
return Dev->RingDesc.RingCmps +
(RingState->CmpConsIdx & (CmpNumEntries - 1));
@@ -213,11 +213,11 @@ PvScsiGetCurrentResponse (
STATIC
EFI_STATUS
PvScsiWaitForRequestCompletion (
IN CONST PVSCSI_DEV *Dev
IN CONST PVSCSI_DEV *Dev
)
{
EFI_STATUS Status;
UINT32 IntrStatus;
EFI_STATUS Status;
UINT32 IntrStatus;
//
// Note: We don't yet support Timeout according to
@@ -226,7 +226,7 @@ PvScsiWaitForRequestCompletion (
// This is consistent with some other Scsi PassThru drivers
// such as VirtioScsi.
//
for (;;) {
for ( ; ;) {
Status = PvScsiMmioRead32 (Dev, PvScsiRegOffsetIntrStatus, &IntrStatus);
if (EFI_ERROR (Status)) {
return Status;
@@ -258,14 +258,14 @@ PvScsiWaitForRequestCompletion (
STATIC
EFI_STATUS
ReportHostAdapterError (
OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
)
{
Packet->InTransferLength = 0;
Packet->InTransferLength = 0;
Packet->OutTransferLength = 0;
Packet->SenseDataLength = 0;
Packet->SenseDataLength = 0;
Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER;
Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
return EFI_DEVICE_ERROR;
}
@@ -275,12 +275,12 @@ ReportHostAdapterError (
STATIC
EFI_STATUS
ReportHostAdapterOverrunError (
OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
)
{
Packet->SenseDataLength = 0;
Packet->SenseDataLength = 0;
Packet->HostAdapterStatus =
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
return EFI_BAD_BUFFER_SIZE;
}
@@ -292,14 +292,14 @@ ReportHostAdapterOverrunError (
STATIC
EFI_STATUS
PopulateRequest (
IN CONST PVSCSI_DEV *Dev,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
OUT PVSCSI_RING_REQ_DESC *Request
IN CONST PVSCSI_DEV *Dev,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
OUT PVSCSI_RING_REQ_DESC *Request
)
{
UINT8 TargetValue;
UINT8 TargetValue;
//
// We only use first byte of target identifer
@@ -313,15 +313,15 @@ PopulateRequest (
//
// Bidirectional transfer was requested
//
(Packet->InTransferLength > 0 && Packet->OutTransferLength > 0) ||
((Packet->InTransferLength > 0) && (Packet->OutTransferLength > 0)) ||
(Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL) ||
//
// Command Descriptor Block bigger than this constant should be considered
// out-of-band. We currently don't support these CDBs.
//
(Packet->CdbLength > PVSCSI_CDB_MAX_SIZE)
) {
)
{
//
// This error code doesn't require updates to the Packet output fields
//
@@ -348,8 +348,8 @@ PopulateRequest (
((Packet->InTransferLength > 0) &&
((Packet->InDataBuffer == NULL) ||
(Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_WRITE)
)
) ||
)
) ||
//
// Trying to send, but source pointer is NULL, or contradicting
// transfer direction
@@ -357,10 +357,10 @@ PopulateRequest (
((Packet->OutTransferLength > 0) &&
((Packet->OutDataBuffer == NULL) ||
(Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_READ)
)
)
) {
)
)
{
//
// This error code doesn't require updates to the Packet output fields
//
@@ -374,6 +374,7 @@ PopulateRequest (
Packet->InTransferLength = sizeof (Dev->DmaBuf->Data);
return ReportHostAdapterOverrunError (Packet);
}
if (Packet->OutTransferLength > sizeof (Dev->DmaBuf->Data)) {
Packet->OutTransferLength = sizeof (Dev->DmaBuf->Data);
return ReportHostAdapterOverrunError (Packet);
@@ -384,27 +385,27 @@ PopulateRequest (
//
ZeroMem (Request, sizeof (*Request));
Request->Bus = 0;
Request->Bus = 0;
Request->Target = TargetValue;
//
// This cast is safe as PVSCSI_DEV.MaxLun is defined as UINT8
//
Request->Lun[1] = (UINT8)Lun;
Request->Lun[1] = (UINT8)Lun;
Request->SenseLen = Packet->SenseDataLength;
//
// DMA communication buffer SenseData overflow is not possible
// due to Packet->SenseDataLength defined as UINT8
//
Request->SenseAddr = PVSCSI_DMA_BUF_DEV_ADDR (Dev, SenseData);
Request->CdbLen = Packet->CdbLength;
Request->CdbLen = Packet->CdbLength;
CopyMem (Request->Cdb, Packet->Cdb, Packet->CdbLength);
Request->VcpuHint = 0;
Request->Tag = PVSCSI_SIMPLE_QUEUE_TAG;
Request->Tag = PVSCSI_SIMPLE_QUEUE_TAG;
if (Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_READ) {
Request->Flags = PVSCSI_FLAG_CMD_DIR_TOHOST;
Request->Flags = PVSCSI_FLAG_CMD_DIR_TOHOST;
Request->DataLen = Packet->InTransferLength;
} else {
Request->Flags = PVSCSI_FLAG_CMD_DIR_TODEVICE;
Request->Flags = PVSCSI_FLAG_CMD_DIR_TODEVICE;
Request->DataLen = Packet->OutTransferLength;
CopyMem (
Dev->DmaBuf->Data,
@@ -412,6 +413,7 @@ PopulateRequest (
Packet->OutTransferLength
);
}
Request->DataAddr = PVSCSI_DMA_BUF_DEV_ADDR (Dev, Data);
return EFI_SUCCESS;
@@ -426,9 +428,9 @@ PopulateRequest (
STATIC
EFI_STATUS
HandleResponse (
IN PVSCSI_DEV *Dev,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN CONST PVSCSI_RING_CMP_DESC *Response
IN PVSCSI_DEV *Dev,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN CONST PVSCSI_RING_CMP_DESC *Response
)
{
//
@@ -437,6 +439,7 @@ HandleResponse (
if (Packet->SenseDataLength > Response->SenseLen) {
Packet->SenseDataLength = (UINT8)Response->SenseLen;
}
//
// Copy sense data from DMA communication buffer
//
@@ -482,18 +485,19 @@ HandleResponse (
} else {
Packet->OutTransferLength = (UINT32)Response->DataLen;
}
Packet->HostAdapterStatus =
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
return EFI_SUCCESS;
case PvScsiBtStatDatarun:
Packet->HostAdapterStatus =
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
return EFI_SUCCESS;
case PvScsiBtStatSelTimeout:
Packet->HostAdapterStatus =
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT;
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT;
return EFI_TIMEOUT;
case PvScsiBtStatBusFree:
@@ -506,13 +510,13 @@ HandleResponse (
case PvScsiBtStatSensFailed:
Packet->HostAdapterStatus =
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED;
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED;
break;
case PvScsiBtStatTagReject:
case PvScsiBtStatBadMsg:
Packet->HostAdapterStatus =
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT;
EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT;
break;
case PvScsiBtStatBusReset:
@@ -542,16 +546,17 @@ HandleResponse (
STATIC
BOOLEAN
IsTargetInitialized (
IN UINT8 *Target
IN UINT8 *Target
)
{
UINTN Idx;
UINTN Idx;
for (Idx = 0; Idx < TARGET_MAX_BYTES; ++Idx) {
if (Target[Idx] != 0xFF) {
return TRUE;
}
}
return FALSE;
}
@@ -563,17 +568,17 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiPassThru (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
)
{
PVSCSI_DEV *Dev;
EFI_STATUS Status;
PVSCSI_RING_REQ_DESC *Request;
PVSCSI_RING_CMP_DESC *Response;
PVSCSI_RING_REQ_DESC *Request;
PVSCSI_RING_CMP_DESC *Response;
Dev = PVSCSI_FROM_PASS_THRU (This);
@@ -616,7 +621,7 @@ PvScsiPassThru (
}
Response = PvScsiGetCurrentResponse (Dev);
Status = HandleResponse (Dev, Packet, Response);
Status = HandleResponse (Dev, Packet, Response);
//
// Reads from response must complete before releasing completion entry
@@ -632,14 +637,14 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiGetNextTargetLun (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN OUT UINT8 **Target,
IN OUT UINT64 *Lun
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN OUT UINT8 **Target,
IN OUT UINT64 *Lun
)
{
UINT8 *TargetPtr;
UINT8 LastTarget;
PVSCSI_DEV *Dev;
UINT8 *TargetPtr;
UINT8 LastTarget;
PVSCSI_DEV *Dev;
if (Target == NULL) {
return EFI_INVALID_PARAMETER;
@@ -668,7 +673,7 @@ PvScsiGetNextTargetLun (
// Increment (target, LUN) pair if valid on input
//
Dev = PVSCSI_FROM_PASS_THRU (This);
if (LastTarget > Dev->MaxTarget || *Lun > Dev->MaxLun) {
if ((LastTarget > Dev->MaxTarget) || (*Lun > Dev->MaxLun)) {
return EFI_INVALID_PARAMETER;
}
@@ -691,10 +696,10 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiBuildDevicePath (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
)
{
UINT8 TargetValue;
@@ -711,7 +716,7 @@ PvScsiBuildDevicePath (
TargetValue = *Target;
Dev = PVSCSI_FROM_PASS_THRU (This);
if (TargetValue > Dev->MaxTarget || Lun > Dev->MaxLun) {
if ((TargetValue > Dev->MaxTarget) || (Lun > Dev->MaxLun)) {
return EFI_NOT_FOUND;
}
@@ -735,28 +740,30 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiGetTargetLun (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINT8 **Target,
OUT UINT64 *Lun
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINT8 **Target,
OUT UINT64 *Lun
)
{
SCSI_DEVICE_PATH *ScsiDevicePath;
PVSCSI_DEV *Dev;
SCSI_DEVICE_PATH *ScsiDevicePath;
PVSCSI_DEV *Dev;
if (DevicePath == NULL || Target == NULL || *Target == NULL || Lun == NULL) {
if ((DevicePath == NULL) || (Target == NULL) || (*Target == NULL) || (Lun == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (DevicePath->Type != MESSAGING_DEVICE_PATH ||
DevicePath->SubType != MSG_SCSI_DP) {
if ((DevicePath->Type != MESSAGING_DEVICE_PATH) ||
(DevicePath->SubType != MSG_SCSI_DP))
{
return EFI_UNSUPPORTED;
}
ScsiDevicePath = (SCSI_DEVICE_PATH *)DevicePath;
Dev = PVSCSI_FROM_PASS_THRU (This);
if (ScsiDevicePath->Pun > Dev->MaxTarget ||
ScsiDevicePath->Lun > Dev->MaxLun) {
Dev = PVSCSI_FROM_PASS_THRU (This);
if ((ScsiDevicePath->Pun > Dev->MaxTarget) ||
(ScsiDevicePath->Lun > Dev->MaxLun))
{
return EFI_NOT_FOUND;
}
@@ -774,7 +781,7 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiResetChannel (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
)
{
return EFI_UNSUPPORTED;
@@ -784,9 +791,9 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiResetTargetLun (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun
)
{
return EFI_UNSUPPORTED;
@@ -796,13 +803,13 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiGetNextTarget (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN OUT UINT8 **Target
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN OUT UINT8 **Target
)
{
UINT8 *TargetPtr;
UINT8 LastTarget;
PVSCSI_DEV *Dev;
UINT8 *TargetPtr;
UINT8 LastTarget;
PVSCSI_DEV *Dev;
if (Target == NULL) {
return EFI_INVALID_PARAMETER;
@@ -846,10 +853,10 @@ PvScsiGetNextTarget (
STATIC
EFI_STATUS
PvScsiSetPciAttributes (
IN OUT PVSCSI_DEV *Dev
IN OUT PVSCSI_DEV *Dev
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Backup original PCI Attributes
@@ -907,7 +914,7 @@ PvScsiSetPciAttributes (
STATIC
VOID
PvScsiRestorePciAttributes (
IN PVSCSI_DEV *Dev
IN PVSCSI_DEV *Dev
)
{
Dev->PciIo->Attributes (
@@ -921,14 +928,14 @@ PvScsiRestorePciAttributes (
STATIC
EFI_STATUS
PvScsiAllocateSharedPages (
IN PVSCSI_DEV *Dev,
IN UINTN Pages,
OUT VOID **HostAddress,
OUT PVSCSI_DMA_DESC *DmaDesc
IN PVSCSI_DEV *Dev,
IN UINTN Pages,
OUT VOID **HostAddress,
OUT PVSCSI_DMA_DESC *DmaDesc
)
{
EFI_STATUS Status;
UINTN NumberOfBytes;
EFI_STATUS Status;
UINTN NumberOfBytes;
Status = Dev->PciIo->AllocateBuffer (
Dev->PciIo,
@@ -943,14 +950,14 @@ PvScsiAllocateSharedPages (
}
NumberOfBytes = EFI_PAGES_TO_SIZE (Pages);
Status = Dev->PciIo->Map (
Dev->PciIo,
EfiPciIoOperationBusMasterCommonBuffer,
*HostAddress,
&NumberOfBytes,
&DmaDesc->DeviceAddress,
&DmaDesc->Mapping
);
Status = Dev->PciIo->Map (
Dev->PciIo,
EfiPciIoOperationBusMasterCommonBuffer,
*HostAddress,
&NumberOfBytes,
&DmaDesc->DeviceAddress,
&DmaDesc->Mapping
);
if (EFI_ERROR (Status)) {
goto FreeBuffer;
}
@@ -974,10 +981,10 @@ FreeBuffer:
STATIC
VOID
PvScsiFreeSharedPages (
IN PVSCSI_DEV *Dev,
IN UINTN Pages,
IN VOID *HostAddress,
IN PVSCSI_DMA_DESC *DmaDesc
IN PVSCSI_DEV *Dev,
IN UINTN Pages,
IN VOID *HostAddress,
IN PVSCSI_DMA_DESC *DmaDesc
)
{
Dev->PciIo->Unmap (Dev->PciIo, DmaDesc->Mapping);
@@ -987,10 +994,10 @@ PvScsiFreeSharedPages (
STATIC
EFI_STATUS
PvScsiInitRings (
IN OUT PVSCSI_DEV *Dev
IN OUT PVSCSI_DEV *Dev
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = PvScsiAllocateSharedPages (
Dev,
@@ -1001,6 +1008,7 @@ PvScsiInitRings (
if (EFI_ERROR (Status)) {
return Status;
}
ZeroMem (Dev->RingDesc.RingState, EFI_PAGE_SIZE);
Status = PvScsiAllocateSharedPages (
@@ -1012,6 +1020,7 @@ PvScsiInitRings (
if (EFI_ERROR (Status)) {
goto FreeRingState;
}
ZeroMem (Dev->RingDesc.RingReqs, EFI_PAGE_SIZE);
Status = PvScsiAllocateSharedPages (
@@ -1023,6 +1032,7 @@ PvScsiInitRings (
if (EFI_ERROR (Status)) {
goto FreeRingReqs;
}
ZeroMem (Dev->RingDesc.RingCmps, EFI_PAGE_SIZE);
return EFI_SUCCESS;
@@ -1049,7 +1059,7 @@ FreeRingState:
STATIC
VOID
PvScsiFreeRings (
IN OUT PVSCSI_DEV *Dev
IN OUT PVSCSI_DEV *Dev
)
{
PvScsiFreeSharedPages (
@@ -1077,24 +1087,24 @@ PvScsiFreeRings (
STATIC
EFI_STATUS
PvScsiSetupRings (
IN OUT PVSCSI_DEV *Dev
IN OUT PVSCSI_DEV *Dev
)
{
union {
PVSCSI_CMD_DESC_SETUP_RINGS Cmd;
UINT32 Uint32;
PVSCSI_CMD_DESC_SETUP_RINGS Cmd;
UINT32 Uint32;
} AlignedCmd;
PVSCSI_CMD_DESC_SETUP_RINGS *Cmd;
PVSCSI_CMD_DESC_SETUP_RINGS *Cmd;
Cmd = &AlignedCmd.Cmd;
ZeroMem (Cmd, sizeof (*Cmd));
Cmd->ReqRingNumPages = 1;
Cmd->CmpRingNumPages = 1;
Cmd->RingsStatePPN = RShiftU64 (
Dev->RingDesc.RingStateDmaDesc.DeviceAddress,
EFI_PAGE_SHIFT
);
Cmd->RingsStatePPN = RShiftU64 (
Dev->RingDesc.RingStateDmaDesc.DeviceAddress,
EFI_PAGE_SHIFT
);
Cmd->ReqRingPPNs[0] = RShiftU64 (
Dev->RingDesc.RingReqsDmaDesc.DeviceAddress,
EFI_PAGE_SHIFT
@@ -1119,16 +1129,16 @@ PvScsiSetupRings (
STATIC
EFI_STATUS
PvScsiInit (
IN OUT PVSCSI_DEV *Dev
IN OUT PVSCSI_DEV *Dev
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Init configuration
//
Dev->MaxTarget = PcdGet8 (PcdPvScsiMaxTargetLimit);
Dev->MaxLun = PcdGet8 (PcdPvScsiMaxLunLimit);
Dev->MaxTarget = PcdGet8 (PcdPvScsiMaxTargetLimit);
Dev->MaxLun = PcdGet8 (PcdPvScsiMaxLunLimit);
Dev->WaitForCmpStallInUsecs = PcdGet32 (PcdPvScsiWaitForCmpStallInUsecs);
//
@@ -1227,7 +1237,7 @@ RestorePciAttributes:
STATIC
VOID
PvScsiUninit (
IN OUT PVSCSI_DEV *Dev
IN OUT PVSCSI_DEV *Dev
)
{
//
@@ -1262,11 +1272,11 @@ STATIC
VOID
EFIAPI
PvScsiExitBoot (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
PVSCSI_DEV *Dev;
PVSCSI_DEV *Dev;
Dev = Context;
DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
@@ -1288,14 +1298,14 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
PCI_TYPE00 Pci;
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
PCI_TYPE00 Pci;
Status = gBS->OpenProtocol (
ControllerHandle,
@@ -1321,7 +1331,8 @@ PvScsiDriverBindingSupported (
}
if ((Pci.Hdr.VendorId != PCI_VENDOR_ID_VMWARE) ||
(Pci.Hdr.DeviceId != PCI_DEVICE_ID_VMWARE_PVSCSI)) {
(Pci.Hdr.DeviceId != PCI_DEVICE_ID_VMWARE_PVSCSI))
{
Status = EFI_UNSUPPORTED;
goto Done;
}
@@ -1343,15 +1354,15 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
PVSCSI_DEV *Dev;
EFI_STATUS Status;
PVSCSI_DEV *Dev;
EFI_STATUS Status;
Dev = (PVSCSI_DEV *) AllocateZeroPool (sizeof (*Dev));
Dev = (PVSCSI_DEV *)AllocateZeroPool (sizeof (*Dev));
if (Dev == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -1388,12 +1399,12 @@ PvScsiDriverBindingStart (
// Setup complete, attempt to export the driver instance's PassThru interface
//
Dev->Signature = PVSCSI_SIG;
Status = gBS->InstallProtocolInterface (
&ControllerHandle,
&gEfiExtScsiPassThruProtocolGuid,
EFI_NATIVE_INTERFACE,
&Dev->PassThru
);
Status = gBS->InstallProtocolInterface (
&ControllerHandle,
&gEfiExtScsiPassThruProtocolGuid,
EFI_NATIVE_INTERFACE,
&Dev->PassThru
);
if (EFI_ERROR (Status)) {
goto CloseExitBoot;
}
@@ -1424,15 +1435,15 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
PVSCSI_DEV *Dev;
EFI_STATUS Status;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
PVSCSI_DEV *Dev;
Status = gBS->OpenProtocol (
ControllerHandle,
@@ -1473,7 +1484,7 @@ PvScsiDriverBindingStop (
return EFI_SUCCESS;
}
STATIC EFI_DRIVER_BINDING_PROTOCOL mPvScsiDriverBinding = {
STATIC EFI_DRIVER_BINDING_PROTOCOL mPvScsiDriverBinding = {
&PvScsiDriverBindingSupported,
&PvScsiDriverBindingStart,
&PvScsiDriverBindingStop,
@@ -1486,20 +1497,20 @@ STATIC EFI_DRIVER_BINDING_PROTOCOL mPvScsiDriverBinding = {
// Component Name
//
STATIC EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
STATIC EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
{ "eng;en", L"PVSCSI Host Driver" },
{ NULL, NULL }
};
STATIC EFI_COMPONENT_NAME_PROTOCOL mComponentName;
STATIC EFI_COMPONENT_NAME_PROTOCOL mComponentName;
STATIC
EFI_STATUS
EFIAPI
PvScsiGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
{
return LookupUnicodeString2 (
@@ -1515,25 +1526,25 @@ STATIC
EFI_STATUS
EFIAPI
PvScsiGetDeviceName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN EFI_HANDLE ChildHandle,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN EFI_HANDLE ChildHandle,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;
}
STATIC EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
STATIC EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
&PvScsiGetDriverName,
&PvScsiGetDeviceName,
"eng" // SupportedLanguages, ISO 639-2 language codes
};
STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &PvScsiGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &PvScsiGetDeviceName,
STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)&PvScsiGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)&PvScsiGetDeviceName,
"en" // SupportedLanguages, RFC 4646 language codes
};
@@ -1544,8 +1555,8 @@ STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
EFI_STATUS
EFIAPI
PvScsiEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallDriverBindingComponentName2 (