summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/VirtioScsiDxe
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:09 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commitac0a286f4d747a4c6c603a7b225917293cbe1e9f (patch)
tree32654f2b35755afc961e2c97296b2dec5762da75 /OvmfPkg/VirtioScsiDxe
parentd1050b9dff1cace252aff86630bfdb59dff5f507 (diff)
downloadedk2-ac0a286f4d747a4c6c603a7b225917293cbe1e9f.tar.gz
edk2-ac0a286f4d747a4c6c603a7b225917293cbe1e9f.tar.bz2
edk2-ac0a286f4d747a4c6c603a7b225917293cbe1e9f.zip
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>
Diffstat (limited to 'OvmfPkg/VirtioScsiDxe')
-rw-r--r--OvmfPkg/VirtioScsiDxe/VirtioScsi.c525
-rw-r--r--OvmfPkg/VirtioScsiDxe/VirtioScsi.h120
2 files changed, 331 insertions, 314 deletions
diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
index 935d154395..d44f9ebca7 100644
--- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
+++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
@@ -76,7 +76,7 @@
(Value) \
))
-#define VIRTIO_CFG_READ(Dev, Field, Pointer) ((Dev)->VirtIo->ReadDevice ( \
+#define VIRTIO_CFG_READ(Dev, Field, Pointer) ((Dev)->VirtIo->ReadDevice ( \
(Dev)->VirtIo, \
OFFSET_OF_VSCSI (Field), \
SIZE_OF_VSCSI (Field), \
@@ -84,7 +84,6 @@
(Pointer) \
))
-
//
// UEFI Spec 2.3.1 + Errata C, 14.7 Extended SCSI Pass Thru Protocol specifies
// the PassThru() interface. Beside returning a status code, the function must
@@ -153,32 +152,32 @@ PopulateRequest (
OUT volatile VIRTIO_SCSI_REQ *Request
)
{
- UINTN Idx;
+ UINTN Idx;
if (
//
// bidirectional transfer was requested, but the host doesn't support it
//
- (Packet->InTransferLength > 0 && Packet->OutTransferLength > 0 &&
+ ((Packet->InTransferLength > 0) && (Packet->OutTransferLength > 0) &&
!Dev->InOutSupported) ||
//
// a target / LUN was addressed that's impossible to encode for the host
//
- Target > 0xFF || Lun >= 0x4000 ||
+ (Target > 0xFF) || (Lun >= 0x4000) ||
//
// Command Descriptor Block bigger than VIRTIO_SCSI_CDB_SIZE
//
- Packet->CdbLength > VIRTIO_SCSI_CDB_SIZE ||
+ (Packet->CdbLength > VIRTIO_SCSI_CDB_SIZE) ||
//
// From virtio-0.9.5, 2.3.2 Descriptor Table:
// "no descriptor chain may be more than 2^32 bytes long in total".
//
- (UINT64) Packet->InTransferLength + Packet->OutTransferLength > SIZE_1GB
- ) {
-
+ ((UINT64)Packet->InTransferLength + Packet->OutTransferLength > SIZE_1GB)
+ )
+ {
//
// this error code doesn't require updates to the Packet output fields
//
@@ -189,35 +188,35 @@ PopulateRequest (
//
// addressed invalid device
//
- Target > Dev->MaxTarget || Lun > Dev->MaxLun ||
+ (Target > Dev->MaxTarget) || (Lun > Dev->MaxLun) ||
//
// invalid direction (there doesn't seem to be a macro for the "no data
// transferred" "direction", eg. for TEST UNIT READY)
//
- Packet->DataDirection > EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL ||
+ (Packet->DataDirection > EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL) ||
//
// trying to receive, but destination pointer is NULL, or contradicting
// transfer direction
//
- (Packet->InTransferLength > 0 &&
- (Packet->InDataBuffer == NULL ||
- Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_WRITE
- )
- ) ||
+ ((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
//
- (Packet->OutTransferLength > 0 &&
- (Packet->OutDataBuffer == NULL ||
- Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_READ
- )
+ ((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
//
@@ -229,16 +228,17 @@ PopulateRequest (
// then the combined size of a bidirectional request will not exceed the
// virtio-scsi device's transfer limit either.
//
- if (ALIGN_VALUE (Packet->OutTransferLength, 512) / 512
- > Dev->MaxSectors / 2 ||
- ALIGN_VALUE (Packet->InTransferLength, 512) / 512
- > Dev->MaxSectors / 2) {
+ if ((ALIGN_VALUE (Packet->OutTransferLength, 512) / 512
+ > Dev->MaxSectors / 2) ||
+ (ALIGN_VALUE (Packet->InTransferLength, 512) / 512
+ > Dev->MaxSectors / 2))
+ {
Packet->InTransferLength = (Dev->MaxSectors / 2) * 512;
Packet->OutTransferLength = (Dev->MaxSectors / 2) * 512;
Packet->HostAdapterStatus =
- EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
- Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
- Packet->SenseDataLength = 0;
+ EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
+ Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
+ Packet->SenseDataLength = 0;
return EFI_BAD_BUFFER_SIZE;
}
@@ -247,22 +247,21 @@ PopulateRequest (
// Device Operation: request queues
//
Request->Lun[0] = 1;
- Request->Lun[1] = (UINT8) Target;
- Request->Lun[2] = (UINT8) (((UINT32)Lun >> 8) | 0x40);
- Request->Lun[3] = (UINT8) Lun;
+ Request->Lun[1] = (UINT8)Target;
+ Request->Lun[2] = (UINT8)(((UINT32)Lun >> 8) | 0x40);
+ Request->Lun[3] = (UINT8)Lun;
//
// CopyMem() would cast away the "volatile" qualifier before access, which is
// undefined behavior (ISO C99 6.7.3p5)
//
for (Idx = 0; Idx < Packet->CdbLength; ++Idx) {
- Request->Cdb[Idx] = ((UINT8 *) Packet->Cdb)[Idx];
+ Request->Cdb[Idx] = ((UINT8 *)Packet->Cdb)[Idx];
}
return EFI_SUCCESS;
}
-
/**
Parse the virtio-scsi device's response, translate it to an EFI status code,
@@ -288,22 +287,23 @@ STATIC
EFI_STATUS
EFIAPI
ParseResponse (
- IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
- IN CONST volatile VIRTIO_SCSI_RESP *Response
+ IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
+ IN CONST volatile VIRTIO_SCSI_RESP *Response
)
{
- UINTN ResponseSenseLen;
- UINTN Idx;
+ UINTN ResponseSenseLen;
+ UINTN Idx;
//
// return sense data (length and contents) in all cases, truncated if needed
//
ResponseSenseLen = MIN (Response->SenseLen, VIRTIO_SCSI_SENSE_SIZE);
if (Packet->SenseDataLength > ResponseSenseLen) {
- Packet->SenseDataLength = (UINT8) ResponseSenseLen;
+ Packet->SenseDataLength = (UINT8)ResponseSenseLen;
}
+
for (Idx = 0; Idx < Packet->SenseDataLength; ++Idx) {
- ((UINT8 *) Packet->SenseData)[Idx] = Response->Sense[Idx];
+ ((UINT8 *)Packet->SenseData)[Idx] = Response->Sense[Idx];
}
//
@@ -321,9 +321,8 @@ ParseResponse (
// V @ OutTransferLength + InTransferLength -+- @ 0
//
if (Response->Residual <= Packet->InTransferLength) {
- Packet->InTransferLength -= Response->Residual;
- }
- else {
+ Packet->InTransferLength -= Response->Residual;
+ } else {
Packet->OutTransferLength -= Response->Residual - Packet->InTransferLength;
Packet->InTransferLength = 0;
}
@@ -338,50 +337,49 @@ ParseResponse (
// response code
//
switch (Response->Response) {
- case VIRTIO_SCSI_S_OK:
- Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;
- return EFI_SUCCESS;
+ case VIRTIO_SCSI_S_OK:
+ Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;
+ return EFI_SUCCESS;
- case VIRTIO_SCSI_S_OVERRUN:
- Packet->HostAdapterStatus =
- EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
- break;
+ case VIRTIO_SCSI_S_OVERRUN:
+ Packet->HostAdapterStatus =
+ EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
+ break;
- case VIRTIO_SCSI_S_BAD_TARGET:
- //
- // This is non-intuitive but explicitly required by the
- // EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru() specification for
- // disconnected (but otherwise valid) target / LUN addresses.
- //
- Packet->HostAdapterStatus =
- EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND;
- return EFI_TIMEOUT;
+ case VIRTIO_SCSI_S_BAD_TARGET:
+ //
+ // This is non-intuitive but explicitly required by the
+ // EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru() specification for
+ // disconnected (but otherwise valid) target / LUN addresses.
+ //
+ Packet->HostAdapterStatus =
+ EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND;
+ return EFI_TIMEOUT;
- case VIRTIO_SCSI_S_RESET:
- Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET;
- break;
+ case VIRTIO_SCSI_S_RESET:
+ Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET;
+ break;
- case VIRTIO_SCSI_S_BUSY:
- Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;
- return EFI_NOT_READY;
+ case VIRTIO_SCSI_S_BUSY:
+ Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;
+ return EFI_NOT_READY;
- //
- // Lump together the rest. The mapping for VIRTIO_SCSI_S_ABORTED is
- // intentional as well, not an oversight.
- //
- case VIRTIO_SCSI_S_ABORTED:
- case VIRTIO_SCSI_S_TRANSPORT_FAILURE:
- case VIRTIO_SCSI_S_TARGET_FAILURE:
- case VIRTIO_SCSI_S_NEXUS_FAILURE:
- case VIRTIO_SCSI_S_FAILURE:
- default:
- Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER;
+ //
+ // Lump together the rest. The mapping for VIRTIO_SCSI_S_ABORTED is
+ // intentional as well, not an oversight.
+ //
+ case VIRTIO_SCSI_S_ABORTED:
+ case VIRTIO_SCSI_S_TRANSPORT_FAILURE:
+ case VIRTIO_SCSI_S_TARGET_FAILURE:
+ case VIRTIO_SCSI_S_NEXUS_FAILURE:
+ case VIRTIO_SCSI_S_FAILURE:
+ default:
+ Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER;
}
return EFI_DEVICE_ERROR;
}
-
/**
The function can be used to create a fake host adapter error.
@@ -412,7 +410,6 @@ ReportHostAdapterError (
return EFI_DEVICE_ERROR;
}
-
//
// The next seven functions implement EFI_EXT_SCSI_PASS_THRU_PROTOCOL
// for the virtio-scsi HBA. Refer to UEFI Spec 2.3.1 + Errata C, sections
@@ -423,31 +420,31 @@ ReportHostAdapterError (
EFI_STATUS
EFIAPI
VirtioScsiPassThru (
- 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
)
{
- VSCSI_DEV *Dev;
- UINT16 TargetValue;
- EFI_STATUS Status;
- volatile VIRTIO_SCSI_REQ Request;
- volatile VIRTIO_SCSI_RESP *Response;
- VOID *ResponseBuffer;
- DESC_INDICES Indices;
- VOID *RequestMapping;
- VOID *ResponseMapping;
- VOID *InDataMapping;
- VOID *OutDataMapping;
- EFI_PHYSICAL_ADDRESS RequestDeviceAddress;
- EFI_PHYSICAL_ADDRESS ResponseDeviceAddress;
- EFI_PHYSICAL_ADDRESS InDataDeviceAddress;
- EFI_PHYSICAL_ADDRESS OutDataDeviceAddress;
- VOID *InDataBuffer;
- UINTN InDataNumPages;
- BOOLEAN OutDataBufferIsMapped;
+ VSCSI_DEV *Dev;
+ UINT16 TargetValue;
+ EFI_STATUS Status;
+ volatile VIRTIO_SCSI_REQ Request;
+ volatile VIRTIO_SCSI_RESP *Response;
+ VOID *ResponseBuffer;
+ DESC_INDICES Indices;
+ VOID *RequestMapping;
+ VOID *ResponseMapping;
+ VOID *InDataMapping;
+ VOID *OutDataMapping;
+ EFI_PHYSICAL_ADDRESS RequestDeviceAddress;
+ EFI_PHYSICAL_ADDRESS ResponseDeviceAddress;
+ EFI_PHYSICAL_ADDRESS InDataDeviceAddress;
+ EFI_PHYSICAL_ADDRESS OutDataDeviceAddress;
+ VOID *InDataBuffer;
+ UINTN InDataNumPages;
+ BOOLEAN OutDataBufferIsMapped;
//
// Set InDataMapping,OutDataMapping,InDataDeviceAddress and OutDataDeviceAddress to
@@ -458,14 +455,14 @@ VirtioScsiPassThru (
InDataDeviceAddress = 0;
OutDataDeviceAddress = 0;
- ZeroMem ((VOID*) &Request, sizeof (Request));
+ ZeroMem ((VOID *)&Request, sizeof (Request));
Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
CopyMem (&TargetValue, Target, sizeof TargetValue);
- InDataBuffer = NULL;
+ InDataBuffer = NULL;
OutDataBufferIsMapped = FALSE;
- InDataNumPages = 0;
+ InDataNumPages = 0;
Status = PopulateRequest (Dev, TargetValue, Lun, Packet, &Request);
if (EFI_ERROR (Status)) {
@@ -478,10 +475,11 @@ VirtioScsiPassThru (
Status = VirtioMapAllBytesInSharedBuffer (
Dev->VirtIo,
VirtioOperationBusMasterRead,
- (VOID *) &Request,
+ (VOID *)&Request,
sizeof Request,
&RequestDeviceAddress,
- &RequestMapping);
+ &RequestMapping
+ );
if (EFI_ERROR (Status)) {
return ReportHostAdapterError (Packet);
}
@@ -506,11 +504,11 @@ VirtioScsiPassThru (
// buffer into Packet->InDataBuffer.
//
InDataNumPages = EFI_SIZE_TO_PAGES ((UINTN)Packet->InTransferLength);
- Status = Dev->VirtIo->AllocateSharedPages (
- Dev->VirtIo,
- InDataNumPages,
- &InDataBuffer
- );
+ Status = Dev->VirtIo->AllocateSharedPages (
+ Dev->VirtIo,
+ InDataNumPages,
+ &InDataBuffer
+ );
if (EFI_ERROR (Status)) {
Status = ReportHostAdapterError (Packet);
goto UnmapRequestBuffer;
@@ -653,8 +651,14 @@ VirtioScsiPassThru (
// EFI_NOT_READY would save us the effort, but it would also suggest that the
// caller retry.
//
- if (VirtioFlush (Dev->VirtIo, VIRTIO_SCSI_REQUEST_QUEUE, &Dev->Ring,
- &Indices, NULL) != EFI_SUCCESS) {
+ if (VirtioFlush (
+ Dev->VirtIo,
+ VIRTIO_SCSI_REQUEST_QUEUE,
+ &Dev->Ring,
+ &Indices,
+ NULL
+ ) != EFI_SUCCESS)
+ {
Status = ReportHostAdapterError (Packet);
goto UnmapResponseBuffer;
}
@@ -701,19 +705,18 @@ UnmapRequestBuffer:
return Status;
}
-
EFI_STATUS
EFIAPI
VirtioScsiGetNextTargetLun (
- IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
- IN OUT UINT8 **TargetPointer,
- IN OUT UINT64 *Lun
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
+ IN OUT UINT8 **TargetPointer,
+ IN OUT UINT64 *Lun
)
{
- UINT8 *Target;
- UINTN Idx;
- UINT16 LastTarget;
- VSCSI_DEV *Dev;
+ UINT8 *Target;
+ UINTN Idx;
+ UINT16 LastTarget;
+ VSCSI_DEV *Dev;
//
// the TargetPointer input parameter is unnecessarily a pointer-to-pointer
@@ -723,8 +726,9 @@ VirtioScsiGetNextTargetLun (
//
// Search for first non-0xFF byte. If not found, return first target & LUN.
//
- for (Idx = 0; Idx < TARGET_MAX_BYTES && Target[Idx] == 0xFF; ++Idx)
- ;
+ for (Idx = 0; Idx < TARGET_MAX_BYTES && Target[Idx] == 0xFF; ++Idx) {
+ }
+
if (Idx == TARGET_MAX_BYTES) {
SetMem (Target, TARGET_MAX_BYTES, 0x00);
*Lun = 0;
@@ -740,7 +744,7 @@ VirtioScsiGetNextTargetLun (
// increment (target, LUN) pair if valid on input
//
Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
- if (LastTarget > Dev->MaxTarget || *Lun > Dev->MaxLun) {
+ if ((LastTarget > Dev->MaxTarget) || (*Lun > Dev->MaxLun)) {
return EFI_INVALID_PARAMETER;
}
@@ -759,19 +763,18 @@ VirtioScsiGetNextTargetLun (
return EFI_NOT_FOUND;
}
-
EFI_STATUS
EFIAPI
VirtioScsiBuildDevicePath (
- 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
)
{
- UINT16 TargetValue;
- VSCSI_DEV *Dev;
- SCSI_DEVICE_PATH *ScsiDevicePath;
+ UINT16 TargetValue;
+ VSCSI_DEV *Dev;
+ SCSI_DEVICE_PATH *ScsiDevicePath;
if (DevicePath == NULL) {
return EFI_INVALID_PARAMETER;
@@ -779,7 +782,7 @@ VirtioScsiBuildDevicePath (
CopyMem (&TargetValue, Target, sizeof TargetValue);
Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
- if (TargetValue > Dev->MaxTarget || Lun > Dev->MaxLun || Lun > 0xFFFF) {
+ if ((TargetValue > Dev->MaxTarget) || (Lun > Dev->MaxLun) || (Lun > 0xFFFF)) {
return EFI_NOT_FOUND;
}
@@ -790,43 +793,45 @@ VirtioScsiBuildDevicePath (
ScsiDevicePath->Header.Type = MESSAGING_DEVICE_PATH;
ScsiDevicePath->Header.SubType = MSG_SCSI_DP;
- ScsiDevicePath->Header.Length[0] = (UINT8) sizeof *ScsiDevicePath;
- ScsiDevicePath->Header.Length[1] = (UINT8) (sizeof *ScsiDevicePath >> 8);
+ ScsiDevicePath->Header.Length[0] = (UINT8)sizeof *ScsiDevicePath;
+ ScsiDevicePath->Header.Length[1] = (UINT8)(sizeof *ScsiDevicePath >> 8);
ScsiDevicePath->Pun = TargetValue;
- ScsiDevicePath->Lun = (UINT16) Lun;
+ ScsiDevicePath->Lun = (UINT16)Lun;
*DevicePath = &ScsiDevicePath->Header;
return EFI_SUCCESS;
}
-
EFI_STATUS
EFIAPI
VirtioScsiGetTargetLun (
- IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT UINT8 **TargetPointer,
- OUT UINT64 *Lun
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ OUT UINT8 **TargetPointer,
+ OUT UINT64 *Lun
)
{
- SCSI_DEVICE_PATH *ScsiDevicePath;
- VSCSI_DEV *Dev;
- UINT8 *Target;
+ SCSI_DEVICE_PATH *ScsiDevicePath;
+ VSCSI_DEV *Dev;
+ UINT8 *Target;
- if (DevicePath == NULL || TargetPointer == NULL || *TargetPointer == NULL ||
- Lun == NULL) {
+ if ((DevicePath == NULL) || (TargetPointer == NULL) || (*TargetPointer == 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 = VIRTIO_SCSI_FROM_PASS_THRU (This);
- if (ScsiDevicePath->Pun > Dev->MaxTarget ||
- ScsiDevicePath->Lun > Dev->MaxLun) {
+ ScsiDevicePath = (SCSI_DEVICE_PATH *)DevicePath;
+ Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
+ if ((ScsiDevicePath->Pun > Dev->MaxTarget) ||
+ (ScsiDevicePath->Lun > Dev->MaxLun))
+ {
return EFI_NOT_FOUND;
}
@@ -843,40 +848,37 @@ VirtioScsiGetTargetLun (
return EFI_SUCCESS;
}
-
EFI_STATUS
EFIAPI
VirtioScsiResetChannel (
- IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
)
{
return EFI_UNSUPPORTED;
}
-
EFI_STATUS
EFIAPI
VirtioScsiResetTargetLun (
- 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;
}
-
EFI_STATUS
EFIAPI
VirtioScsiGetNextTarget (
- IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
- IN OUT UINT8 **TargetPointer
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
+ IN OUT UINT8 **TargetPointer
)
{
- UINT8 *Target;
- UINTN Idx;
- UINT16 LastTarget;
- VSCSI_DEV *Dev;
+ UINT8 *Target;
+ UINTN Idx;
+ UINT16 LastTarget;
+ VSCSI_DEV *Dev;
//
// the TargetPointer input parameter is unnecessarily a pointer-to-pointer
@@ -886,8 +888,9 @@ VirtioScsiGetNextTarget (
//
// Search for first non-0xFF byte. If not found, return first target.
//
- for (Idx = 0; Idx < TARGET_MAX_BYTES && Target[Idx] == 0xFF; ++Idx)
- ;
+ for (Idx = 0; Idx < TARGET_MAX_BYTES && Target[Idx] == 0xFF; ++Idx) {
+ }
+
if (Idx == TARGET_MAX_BYTES) {
SetMem (Target, TARGET_MAX_BYTES, 0x00);
return EFI_SUCCESS;
@@ -915,39 +918,38 @@ VirtioScsiGetNextTarget (
return EFI_NOT_FOUND;
}
-
STATIC
EFI_STATUS
EFIAPI
VirtioScsiInit (
- IN OUT VSCSI_DEV *Dev
+ IN OUT VSCSI_DEV *Dev
)
{
- UINT8 NextDevStat;
- EFI_STATUS Status;
- UINT64 RingBaseShift;
- UINT64 Features;
- UINT16 MaxChannel; // for validation only
- UINT32 NumQueues; // for validation only
- UINT16 QueueSize;
+ UINT8 NextDevStat;
+ EFI_STATUS Status;
+ UINT64 RingBaseShift;
+ UINT64 Features;
+ UINT16 MaxChannel; // for validation only
+ UINT32 NumQueues; // for validation only
+ UINT16 QueueSize;
//
// Execute virtio-0.9.5, 2.2.1 Device Initialization Sequence.
//
NextDevStat = 0; // step 1 -- reset device
- Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
+ Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
if (EFI_ERROR (Status)) {
goto Failed;
}
NextDevStat |= VSTAT_ACK; // step 2 -- acknowledge device presence
- Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
+ Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
if (EFI_ERROR (Status)) {
goto Failed;
}
NextDevStat |= VSTAT_DRIVER; // step 3 -- we know how to drive it
- Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
+ Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
if (EFI_ERROR (Status)) {
goto Failed;
}
@@ -967,12 +969,14 @@ VirtioScsiInit (
if (EFI_ERROR (Status)) {
goto Failed;
}
- Dev->InOutSupported = (BOOLEAN) ((Features & VIRTIO_SCSI_F_INOUT) != 0);
+
+ Dev->InOutSupported = (BOOLEAN)((Features & VIRTIO_SCSI_F_INOUT) != 0);
Status = VIRTIO_CFG_READ (Dev, MaxChannel, &MaxChannel);
if (EFI_ERROR (Status)) {
goto Failed;
}
+
if (MaxChannel != 0) {
//
// this driver is for a single-channel virtio-scsi HBA
@@ -985,6 +989,7 @@ VirtioScsiInit (
if (EFI_ERROR (Status)) {
goto Failed;
}
+
if (NumQueues < 1) {
Status = EFI_UNSUPPORTED;
goto Failed;
@@ -994,6 +999,7 @@ VirtioScsiInit (
if (EFI_ERROR (Status)) {
goto Failed;
}
+
if (Dev->MaxTarget > PcdGet16 (PcdVirtioScsiMaxTargetLimit)) {
Dev->MaxTarget = PcdGet16 (PcdVirtioScsiMaxTargetLimit);
}
@@ -1002,6 +1008,7 @@ VirtioScsiInit (
if (EFI_ERROR (Status)) {
goto Failed;
}
+
if (Dev->MaxLun > PcdGet32 (PcdVirtioScsiMaxLunLimit)) {
Dev->MaxLun = PcdGet32 (PcdVirtioScsiMaxLunLimit);
}
@@ -1010,6 +1017,7 @@ VirtioScsiInit (
if (EFI_ERROR (Status)) {
goto Failed;
}
+
if (Dev->MaxSectors < 2) {
//
// We must be able to halve it for bidirectional transfers
@@ -1040,10 +1048,12 @@ VirtioScsiInit (
if (EFI_ERROR (Status)) {
goto Failed;
}
+
Status = Dev->VirtIo->GetQueueNumMax (Dev->VirtIo, &QueueSize);
if (EFI_ERROR (Status)) {
goto Failed;
}
+
//
// VirtioScsiPassThru() uses at most four descriptors
//
@@ -1101,7 +1111,7 @@ VirtioScsiInit (
//
if (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {
Features &= ~(UINT64)(VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM);
- Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
+ Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
if (EFI_ERROR (Status)) {
goto UnmapQueue;
}
@@ -1115,6 +1125,7 @@ VirtioScsiInit (
if (EFI_ERROR (Status)) {
goto UnmapQueue;
}
+
Status = VIRTIO_CFG_WRITE (Dev, SenseSize, VIRTIO_SCSI_SENSE_SIZE);
if (EFI_ERROR (Status)) {
goto UnmapQueue;
@@ -1124,7 +1135,7 @@ VirtioScsiInit (
// step 6 -- initialization complete
//
NextDevStat |= VSTAT_DRIVER_OK;
- Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
+ Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
if (EFI_ERROR (Status)) {
goto UnmapQueue;
}
@@ -1184,12 +1195,11 @@ Failed:
return Status; // reached only via Failed above
}
-
STATIC
VOID
EFIAPI
VirtioScsiUninit (
- IN OUT VSCSI_DEV *Dev
+ IN OUT VSCSI_DEV *Dev
)
{
//
@@ -1207,11 +1217,10 @@ VirtioScsiUninit (
Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap);
VirtioRingUninit (Dev->VirtIo, &Dev->Ring);
- SetMem (&Dev->PassThru, sizeof Dev->PassThru, 0x00);
+ SetMem (&Dev->PassThru, sizeof Dev->PassThru, 0x00);
SetMem (&Dev->PassThruMode, sizeof Dev->PassThruMode, 0x00);
}
-
//
// Event notification function enqueued by ExitBootServices().
//
@@ -1220,11 +1229,11 @@ STATIC
VOID
EFIAPI
VirtioScsiExitBoot (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- VSCSI_DEV *Dev;
+ VSCSI_DEV *Dev;
DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
//
@@ -1238,7 +1247,6 @@ VirtioScsiExitBoot (
Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);
}
-
//
// Probe, start and stop functions of this driver, called by the DXE core for
// specific devices.
@@ -1257,13 +1265,13 @@ VirtioScsiExitBoot (
EFI_STATUS
EFIAPI
VirtioScsiDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE DeviceHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- VIRTIO_DEVICE_PROTOCOL *VirtIo;
+ EFI_STATUS Status;
+ VIRTIO_DEVICE_PROTOCOL *VirtIo;
//
// Attempt to open the device with the VirtIo set of interfaces. On success,
@@ -1292,31 +1300,39 @@ VirtioScsiDriverBindingSupported (
// We needed VirtIo access only transitorily, to see whether we support the
// device or not.
//
- gBS->CloseProtocol (DeviceHandle, &gVirtioDeviceProtocolGuid,
- This->DriverBindingHandle, DeviceHandle);
+ gBS->CloseProtocol (
+ DeviceHandle,
+ &gVirtioDeviceProtocolGuid,
+ This->DriverBindingHandle,
+ DeviceHandle
+ );
return Status;
}
-
EFI_STATUS
EFIAPI
VirtioScsiDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE DeviceHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- VSCSI_DEV *Dev;
- EFI_STATUS Status;
+ VSCSI_DEV *Dev;
+ EFI_STATUS Status;
- Dev = (VSCSI_DEV *) AllocateZeroPool (sizeof *Dev);
+ Dev = (VSCSI_DEV *)AllocateZeroPool (sizeof *Dev);
if (Dev == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Status = gBS->OpenProtocol (DeviceHandle, &gVirtioDeviceProtocolGuid,
- (VOID **)&Dev->VirtIo, This->DriverBindingHandle,
- DeviceHandle, EFI_OPEN_PROTOCOL_BY_DRIVER);
+ Status = gBS->OpenProtocol (
+ DeviceHandle,
+ &gVirtioDeviceProtocolGuid,
+ (VOID **)&Dev->VirtIo,
+ This->DriverBindingHandle,
+ DeviceHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
if (EFI_ERROR (Status)) {
goto FreeVirtioScsi;
}
@@ -1329,8 +1345,13 @@ VirtioScsiDriverBindingStart (
goto CloseVirtIo;
}
- Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_CALLBACK,
- &VirtioScsiExitBoot, Dev, &Dev->ExitBoot);
+ Status = gBS->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_CALLBACK,
+ &VirtioScsiExitBoot,
+ Dev,
+ &Dev->ExitBoot
+ );
if (EFI_ERROR (Status)) {
goto UninitDev;
}
@@ -1340,9 +1361,12 @@ VirtioScsiDriverBindingStart (
// interface.
//
Dev->Signature = VSCSI_SIG;
- Status = gBS->InstallProtocolInterface (&DeviceHandle,
- &gEfiExtScsiPassThruProtocolGuid, EFI_NATIVE_INTERFACE,
- &Dev->PassThru);
+ Status = gBS->InstallProtocolInterface (
+ &DeviceHandle,
+ &gEfiExtScsiPassThruProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &Dev->PassThru
+ );
if (EFI_ERROR (Status)) {
goto CloseExitBoot;
}
@@ -1356,8 +1380,12 @@ UninitDev:
VirtioScsiUninit (Dev);
CloseVirtIo:
- gBS->CloseProtocol (DeviceHandle, &gVirtioDeviceProtocolGuid,
- This->DriverBindingHandle, DeviceHandle);
+ gBS->CloseProtocol (
+ DeviceHandle,
+ &gVirtioDeviceProtocolGuid,
+ This->DriverBindingHandle,
+ DeviceHandle
+ );
FreeVirtioScsi:
FreePool (Dev);
@@ -1365,19 +1393,18 @@ FreeVirtioScsi:
return Status;
}
-
EFI_STATUS
EFIAPI
VirtioScsiDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE DeviceHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE DeviceHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
)
{
- EFI_STATUS Status;
- EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
- VSCSI_DEV *Dev;
+ EFI_STATUS Status;
+ EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
+ VSCSI_DEV *Dev;
Status = gBS->OpenProtocol (
DeviceHandle, // candidate device
@@ -1396,8 +1423,11 @@ VirtioScsiDriverBindingStop (
//
// Handle Stop() requests for in-use driver instances gracefully.
//
- Status = gBS->UninstallProtocolInterface (DeviceHandle,
- &gEfiExtScsiPassThruProtocolGuid, &Dev->PassThru);
+ Status = gBS->UninstallProtocolInterface (
+ DeviceHandle,
+ &gEfiExtScsiPassThruProtocolGuid,
+ &Dev->PassThru
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1406,21 +1436,24 @@ VirtioScsiDriverBindingStop (
VirtioScsiUninit (Dev);
- gBS->CloseProtocol (DeviceHandle, &gVirtioDeviceProtocolGuid,
- This->DriverBindingHandle, DeviceHandle);
+ gBS->CloseProtocol (
+ DeviceHandle,
+ &gVirtioDeviceProtocolGuid,
+ This->DriverBindingHandle,
+ DeviceHandle
+ );
FreePool (Dev);
return EFI_SUCCESS;
}
-
//
// The static object that groups the Supported() (ie. probe), Start() and
// Stop() functions of the driver together. Refer to UEFI Spec 2.3.1 + Errata
// C, 10.1 EFI Driver Binding Protocol.
//
-STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
+STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
&VirtioScsiDriverBindingSupported,
&VirtioScsiDriverBindingStart,
&VirtioScsiDriverBindingStop,
@@ -1430,7 +1463,6 @@ STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
NULL // DriverBindingHandle, ditto
};
-
//
// The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL and
// EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's name
@@ -1444,20 +1476,20 @@ STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
//
STATIC
-EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
+EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
{ "eng;en", L"Virtio SCSI Host Driver" },
- { NULL, NULL }
+ { NULL, NULL }
};
STATIC
-EFI_COMPONENT_NAME_PROTOCOL gComponentName;
+EFI_COMPONENT_NAME_PROTOCOL gComponentName;
EFI_STATUS
EFIAPI
VirtioScsiGetDriverName (
- 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 (
@@ -1472,39 +1504,38 @@ VirtioScsiGetDriverName (
EFI_STATUS
EFIAPI
VirtioScsiGetDeviceName (
- 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 gComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
&VirtioScsiGetDriverName,
&VirtioScsiGetDeviceName,
"eng" // SupportedLanguages, ISO 639-2 language codes
};
STATIC
-EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &VirtioScsiGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &VirtioScsiGetDeviceName,
+EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)&VirtioScsiGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)&VirtioScsiGetDeviceName,
"en" // SupportedLanguages, RFC 4646 language codes
};
-
//
// Entry point of this driver.
//
EFI_STATUS
EFIAPI
VirtioScsiEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallDriverBindingComponentName2 (
diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.h b/OvmfPkg/VirtioScsiDxe/VirtioScsi.h
index af1901891f..e7aa16dc2f 100644
--- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.h
+++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.h
@@ -18,7 +18,6 @@
#include <IndustryStandard/Virtio.h>
-
//
// This driver supports 2-byte target identifiers and 4-byte LUN identifiers.
//
@@ -30,11 +29,10 @@
// AdapterId and our target identifiers.
//
#if TARGET_MAX_BYTES < 4
-# error "virtio-scsi requires TARGET_MAX_BYTES >= 4"
+ #error "virtio-scsi requires TARGET_MAX_BYTES >= 4"
#endif
-
-#define VSCSI_SIG SIGNATURE_32 ('V', 'S', 'C', 'S')
+#define VSCSI_SIG SIGNATURE_32 ('V', 'S', 'C', 'S')
typedef struct {
//
@@ -44,23 +42,22 @@ typedef struct {
//
// field init function init depth
// ---------------- ------------------ ----------
- UINT32 Signature; // DriverBindingStart 0
- VIRTIO_DEVICE_PROTOCOL *VirtIo; // DriverBindingStart 0
- EFI_EVENT ExitBoot; // DriverBindingStart 0
- BOOLEAN InOutSupported; // VirtioScsiInit 1
- UINT16 MaxTarget; // VirtioScsiInit 1
- UINT32 MaxLun; // VirtioScsiInit 1
- UINT32 MaxSectors; // VirtioScsiInit 1
- VRING Ring; // VirtioRingInit 2
- EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru; // VirtioScsiInit 1
- EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode; // VirtioScsiInit 1
- VOID *RingMap; // VirtioRingMap 2
+ UINT32 Signature; // DriverBindingStart 0
+ VIRTIO_DEVICE_PROTOCOL *VirtIo; // DriverBindingStart 0
+ EFI_EVENT ExitBoot; // DriverBindingStart 0
+ BOOLEAN InOutSupported; // VirtioScsiInit 1
+ UINT16 MaxTarget; // VirtioScsiInit 1
+ UINT32 MaxLun; // VirtioScsiInit 1
+ UINT32 MaxSectors; // VirtioScsiInit 1
+ VRING Ring; // VirtioRingInit 2
+ EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru; // VirtioScsiInit 1
+ EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode; // VirtioScsiInit 1
+ VOID *RingMap; // VirtioRingMap 2
} VSCSI_DEV;
#define VIRTIO_SCSI_FROM_PASS_THRU(PassThruPointer) \
CR (PassThruPointer, VSCSI_DEV, PassThru, VSCSI_SIG)
-
//
// Probe, start and stop functions of this driver, called by the DXE core for
// specific devices.
@@ -73,31 +70,28 @@ typedef struct {
EFI_STATUS
EFIAPI
VirtioScsiDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE DeviceHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
-
EFI_STATUS
EFIAPI
VirtioScsiDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE DeviceHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
-
EFI_STATUS
EFIAPI
VirtioScsiDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE DeviceHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE DeviceHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
);
-
//
// The next seven functions implement EFI_EXT_SCSI_PASS_THRU_PROTOCOL
// for the virtio-scsi HBA. Refer to UEFI Spec 2.3.1 + Errata C, sections
@@ -108,67 +102,60 @@ VirtioScsiDriverBindingStop (
EFI_STATUS
EFIAPI
VirtioScsiPassThru (
- 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
);
-
EFI_STATUS
EFIAPI
VirtioScsiGetNextTargetLun (
- 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
);
-
EFI_STATUS
EFIAPI
VirtioScsiBuildDevicePath (
- 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
);
-
EFI_STATUS
EFIAPI
VirtioScsiGetTargetLun (
- 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
);
-
EFI_STATUS
EFIAPI
VirtioScsiResetChannel (
- IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
);
-
EFI_STATUS
EFIAPI
VirtioScsiResetTargetLun (
- 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
);
-
EFI_STATUS
EFIAPI
VirtioScsiGetNextTarget (
- IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
- IN OUT UINT8 **Target
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
+ IN OUT UINT8 **Target
);
-
//
// The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL and
// EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's name
@@ -184,20 +171,19 @@ VirtioScsiGetNextTarget (
EFI_STATUS
EFIAPI
VirtioScsiGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
);
-
EFI_STATUS
EFIAPI
VirtioScsiGetDeviceName (
- 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
);
#endif // _VIRTIO_SCSI_DXE_H_