73#define VIRTIO_CFG_WRITE(Dev, Field, Value) ((Dev)->VirtIo->WriteDevice ( \
75 OFFSET_OF_VSCSI (Field), \
76 SIZE_OF_VSCSI (Field), \
80#define VIRTIO_CFG_READ(Dev, Field, Pointer) ((Dev)->VirtIo->ReadDevice ( \
82 OFFSET_OF_VSCSI (Field), \
83 SIZE_OF_VSCSI (Field), \
162 ((Packet->InTransferLength > 0) && (Packet->OutTransferLength > 0) &&
163 !Dev->InOutSupported) ||
168 (Target > 0xFF) || (Lun >= 0x4000) ||
173 (Packet->CdbLength > VIRTIO_SCSI_CDB_SIZE) ||
179 ((UINT64)Packet->InTransferLength + Packet->OutTransferLength > SIZE_1GB)
185 return EFI_UNSUPPORTED;
192 (Target > Dev->MaxTarget) || (Lun > Dev->MaxLun) ||
198 (Packet->DataDirection > EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL) ||
204 ((Packet->InTransferLength > 0) &&
205 ((Packet->InDataBuffer ==
NULL) ||
206 (Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_WRITE)
214 ((Packet->OutTransferLength > 0) &&
215 ((Packet->OutDataBuffer ==
NULL) ||
216 (Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_READ)
224 return EFI_INVALID_PARAMETER;
232 if ((
ALIGN_VALUE (Packet->OutTransferLength, 512) / 512
233 > Dev->MaxSectors / 2) ||
235 > Dev->MaxSectors / 2))
237 Packet->InTransferLength = (Dev->MaxSectors / 2) * 512;
238 Packet->OutTransferLength = (Dev->MaxSectors / 2) * 512;
239 Packet->HostAdapterStatus =
240 EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
241 Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
242 Packet->SenseDataLength = 0;
243 return EFI_BAD_BUFFER_SIZE;
251 Request->Lun[1] = (UINT8)Target;
252 Request->Lun[2] = (UINT8)(((UINT32)Lun >> 8) | 0x40);
253 Request->Lun[3] = (UINT8)Lun;
259 for (Idx = 0; Idx < Packet->CdbLength; ++Idx) {
260 Request->Cdb[Idx] = ((UINT8 *)Packet->Cdb)[Idx];
295 UINTN ResponseSenseLen;
301 ResponseSenseLen =
MIN (Response->SenseLen, VIRTIO_SCSI_SENSE_SIZE);
302 if (Packet->SenseDataLength > ResponseSenseLen) {
303 Packet->SenseDataLength = (UINT8)ResponseSenseLen;
306 for (Idx = 0; Idx < Packet->SenseDataLength; ++Idx) {
307 ((UINT8 *)Packet->SenseData)[Idx] = Response->Sense[Idx];
324 if (Response->Residual <= Packet->InTransferLength) {
325 Packet->InTransferLength -= Response->Residual;
327 Packet->OutTransferLength -= Response->Residual - Packet->InTransferLength;
328 Packet->InTransferLength = 0;
334 Packet->TargetStatus = Response->Status;
340 switch (Response->Response) {
341 case VIRTIO_SCSI_S_OK:
342 Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;
345 case VIRTIO_SCSI_S_OVERRUN:
346 Packet->HostAdapterStatus =
347 EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN;
350 case VIRTIO_SCSI_S_BAD_TARGET:
356 Packet->HostAdapterStatus =
357 EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND;
360 case VIRTIO_SCSI_S_RESET:
361 Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET;
364 case VIRTIO_SCSI_S_BUSY:
365 Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;
366 return EFI_NOT_READY;
372 case VIRTIO_SCSI_S_ABORTED:
373 case VIRTIO_SCSI_S_TRANSPORT_FAILURE:
374 case VIRTIO_SCSI_S_TARGET_FAILURE:
375 case VIRTIO_SCSI_S_NEXUS_FAILURE:
376 case VIRTIO_SCSI_S_FAILURE:
378 Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER;
381 return EFI_DEVICE_ERROR;
406 Packet->InTransferLength = 0;
407 Packet->OutTransferLength = 0;
408 Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER;
409 Packet->TargetStatus = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
410 Packet->SenseDataLength = 0;
411 return EFI_DEVICE_ERROR;
436 VOID *ResponseBuffer;
438 VOID *RequestMapping;
439 VOID *ResponseMapping;
441 VOID *OutDataMapping;
447 UINTN InDataNumPages;
448 BOOLEAN OutDataBufferIsMapped;
454 InDataMapping =
NULL;
455 OutDataMapping =
NULL;
456 InDataDeviceAddress = 0;
457 OutDataDeviceAddress = 0;
460 if (Request ==
NULL) {
461 return EFI_OUT_OF_RESOURCES;
464 Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
465 CopyMem (&TargetValue, Target,
sizeof TargetValue);
468 OutDataBufferIsMapped =
FALSE;
472 if (EFI_ERROR (Status)) {
473 goto FreeScsiRequest;
481 VirtioOperationBusMasterRead,
484 &RequestDeviceAddress,
487 if (EFI_ERROR (Status)) {
489 goto FreeScsiRequest;
495 if (Packet->InTransferLength > 0) {
512 Status = Dev->VirtIo->AllocateSharedPages (
517 if (EFI_ERROR (Status)) {
519 goto UnmapRequestBuffer;
522 ZeroMem (InDataBuffer, Packet->InTransferLength);
526 VirtioOperationBusMasterCommonBuffer,
528 Packet->InTransferLength,
529 &InDataDeviceAddress,
532 if (EFI_ERROR (Status)) {
534 goto FreeInDataBuffer;
541 if (Packet->OutTransferLength > 0) {
544 VirtioOperationBusMasterRead,
545 Packet->OutDataBuffer,
546 Packet->OutTransferLength,
547 &OutDataDeviceAddress,
550 if (EFI_ERROR (Status)) {
552 goto UnmapInDataBuffer;
555 OutDataBufferIsMapped =
TRUE;
563 Status = Dev->VirtIo->AllocateSharedPages (
568 if (EFI_ERROR (Status)) {
570 goto UnmapOutDataBuffer;
573 Response = ResponseBuffer;
575 ZeroMem ((VOID *)Response,
sizeof (*Response));
580 Response->Response = VIRTIO_SCSI_S_FAILURE;
588 VirtioOperationBusMasterCommonBuffer,
591 &ResponseDeviceAddress,
594 if (EFI_ERROR (Status)) {
596 goto FreeResponseBuffer;
605 ASSERT (Dev->Ring.QueueSize >= 4);
612 RequestDeviceAddress,
621 if (Packet->OutTransferLength > 0) {
624 OutDataDeviceAddress,
625 Packet->OutTransferLength,
636 ResponseDeviceAddress,
638 VRING_DESC_F_WRITE | (Packet->InTransferLength > 0 ? VRING_DESC_F_NEXT : 0),
645 if (Packet->InTransferLength > 0) {
649 Packet->InTransferLength,
661 VIRTIO_SCSI_REQUEST_QUEUE,
668 goto UnmapResponseBuffer;
678 if (InDataBuffer !=
NULL) {
679 CopyMem (Packet->InDataBuffer, InDataBuffer, Packet->InTransferLength);
683 Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, ResponseMapping);
686 Dev->VirtIo->FreeSharedPages (
693 if (OutDataBufferIsMapped) {
694 Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, OutDataMapping);
698 if (InDataBuffer !=
NULL) {
699 Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, InDataMapping);
703 if (InDataBuffer !=
NULL) {
704 Dev->VirtIo->FreeSharedPages (Dev->VirtIo, InDataNumPages, InDataBuffer);
708 Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, RequestMapping);
718VirtioScsiGetNextTargetLun (
720 IN OUT UINT8 **TargetPointer,
732 Target = *TargetPointer;
737 for (Idx = 0; Idx < TARGET_MAX_BYTES && Target[Idx] == 0xFF; ++Idx) {
740 if (Idx == TARGET_MAX_BYTES) {
741 SetMem (Target, TARGET_MAX_BYTES, 0x00);
749 CopyMem (&LastTarget, Target,
sizeof LastTarget);
754 Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
755 if ((LastTarget > Dev->MaxTarget) || (*Lun > Dev->MaxLun)) {
756 return EFI_INVALID_PARAMETER;
759 if (*Lun < Dev->MaxLun) {
764 if (LastTarget < Dev->MaxTarget) {
767 CopyMem (Target, &LastTarget,
sizeof LastTarget);
771 return EFI_NOT_FOUND;
776VirtioScsiBuildDevicePath (
787 if (DevicePath ==
NULL) {
788 return EFI_INVALID_PARAMETER;
791 CopyMem (&TargetValue, Target,
sizeof TargetValue);
792 Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
793 if ((TargetValue > Dev->MaxTarget) || (Lun > Dev->MaxLun) || (Lun > 0xFFFF)) {
794 return EFI_NOT_FOUND;
798 if (ScsiDevicePath ==
NULL) {
799 return EFI_OUT_OF_RESOURCES;
804 ScsiDevicePath->Header.
Length[0] = (UINT8)
sizeof *ScsiDevicePath;
805 ScsiDevicePath->Header.
Length[1] = (UINT8)(
sizeof *ScsiDevicePath >> 8);
806 ScsiDevicePath->
Pun = TargetValue;
807 ScsiDevicePath->
Lun = (UINT16)Lun;
809 *DevicePath = &ScsiDevicePath->Header;
815VirtioScsiGetTargetLun (
818 OUT UINT8 **TargetPointer,
826 if ((DevicePath ==
NULL) || (TargetPointer ==
NULL) || (*TargetPointer ==
NULL) ||
829 return EFI_INVALID_PARAMETER;
835 return EFI_UNSUPPORTED;
839 Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
840 if ((ScsiDevicePath->
Pun > Dev->MaxTarget) ||
841 (ScsiDevicePath->
Lun > Dev->MaxLun))
843 return EFI_NOT_FOUND;
851 Target = *TargetPointer;
853 SetMem (Target + 2, TARGET_MAX_BYTES - 2, 0x00);
855 *Lun = ScsiDevicePath->
Lun;
861VirtioScsiResetChannel (
865 return EFI_UNSUPPORTED;
870VirtioScsiResetTargetLun (
876 return EFI_UNSUPPORTED;
881VirtioScsiGetNextTarget (
883 IN OUT UINT8 **TargetPointer
894 Target = *TargetPointer;
899 for (Idx = 0; Idx < TARGET_MAX_BYTES && Target[Idx] == 0xFF; ++Idx) {
902 if (Idx == TARGET_MAX_BYTES) {
903 SetMem (Target, TARGET_MAX_BYTES, 0x00);
910 CopyMem (&LastTarget, Target,
sizeof LastTarget);
915 Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
916 if (LastTarget > Dev->MaxTarget) {
917 return EFI_INVALID_PARAMETER;
920 if (LastTarget < Dev->MaxTarget) {
922 CopyMem (Target, &LastTarget,
sizeof LastTarget);
926 return EFI_NOT_FOUND;
938 UINT64 RingBaseShift;
948 Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
949 if (EFI_ERROR (Status)) {
953 NextDevStat |= VSTAT_ACK;
954 Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
955 if (EFI_ERROR (Status)) {
959 NextDevStat |= VSTAT_DRIVER;
960 Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
961 if (EFI_ERROR (Status)) {
968 Status = Dev->VirtIo->SetPageSize (Dev->VirtIo, EFI_PAGE_SIZE);
969 if (EFI_ERROR (Status)) {
976 Status = Dev->VirtIo->GetDeviceFeatures (Dev->VirtIo, &Features);
977 if (EFI_ERROR (Status)) {
981 Dev->InOutSupported = (BOOLEAN)((Features & VIRTIO_SCSI_F_INOUT) != 0);
983 Status = VIRTIO_CFG_READ (Dev, MaxChannel, &MaxChannel);
984 if (EFI_ERROR (Status)) {
988 if (MaxChannel != 0) {
992 Status = EFI_UNSUPPORTED;
996 Status = VIRTIO_CFG_READ (Dev, NumQueues, &NumQueues);
997 if (EFI_ERROR (Status)) {
1001 if (NumQueues < 1) {
1002 Status = EFI_UNSUPPORTED;
1006 Status = VIRTIO_CFG_READ (Dev, MaxTarget, &Dev->MaxTarget);
1007 if (EFI_ERROR (Status)) {
1011 if (Dev->MaxTarget >
PcdGet16 (PcdVirtioScsiMaxTargetLimit)) {
1012 Dev->MaxTarget =
PcdGet16 (PcdVirtioScsiMaxTargetLimit);
1015 Status = VIRTIO_CFG_READ (Dev, MaxLun, &Dev->MaxLun);
1016 if (EFI_ERROR (Status)) {
1020 if (Dev->MaxLun >
PcdGet32 (PcdVirtioScsiMaxLunLimit)) {
1021 Dev->MaxLun =
PcdGet32 (PcdVirtioScsiMaxLunLimit);
1024 Status = VIRTIO_CFG_READ (Dev, MaxSectors, &Dev->MaxSectors);
1025 if (EFI_ERROR (Status)) {
1029 if (Dev->MaxSectors < 2) {
1034 Status = EFI_UNSUPPORTED;
1038 Features &= VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1 |
1039 VIRTIO_F_IOMMU_PLATFORM;
1045 if (Dev->VirtIo->Revision >= VIRTIO_SPEC_REVISION (1, 0, 0)) {
1047 if (EFI_ERROR (Status)) {
1055 Status = Dev->VirtIo->SetQueueSel (Dev->VirtIo, VIRTIO_SCSI_REQUEST_QUEUE);
1056 if (EFI_ERROR (Status)) {
1060 Status = Dev->VirtIo->GetQueueNumMax (Dev->VirtIo, &QueueSize);
1061 if (EFI_ERROR (Status)) {
1068 if (QueueSize < 4) {
1069 Status = EFI_UNSUPPORTED;
1074 if (EFI_ERROR (Status)) {
1087 if (EFI_ERROR (Status)) {
1095 Status = Dev->VirtIo->SetQueueNum (Dev->VirtIo, QueueSize);
1096 if (EFI_ERROR (Status)) {
1100 Status = Dev->VirtIo->SetQueueAlign (Dev->VirtIo, EFI_PAGE_SIZE);
1101 if (EFI_ERROR (Status)) {
1108 Status = Dev->VirtIo->SetQueueAddress (
1113 if (EFI_ERROR (Status)) {
1120 if (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {
1121 Features &= ~(UINT64)(VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM);
1122 Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);
1123 if (EFI_ERROR (Status)) {
1133 if (EFI_ERROR (Status)) {
1138 if (EFI_ERROR (Status)) {
1145 NextDevStat |= VSTAT_DRIVER_OK;
1146 Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
1147 if (EFI_ERROR (Status)) {
1154 Dev->PassThru.Mode = &Dev->PassThruMode;
1155 Dev->PassThru.PassThru = &VirtioScsiPassThru;
1156 Dev->PassThru.GetNextTargetLun = &VirtioScsiGetNextTargetLun;
1157 Dev->PassThru.BuildDevicePath = &VirtioScsiBuildDevicePath;
1158 Dev->PassThru.GetTargetLun = &VirtioScsiGetTargetLun;
1159 Dev->PassThru.ResetChannel = &VirtioScsiResetChannel;
1160 Dev->PassThru.ResetTargetLun = &VirtioScsiResetTargetLun;
1161 Dev->PassThru.GetNextTarget = &VirtioScsiGetNextTarget;
1167 Dev->PassThruMode.AdapterId = 0xFFFFFFFF;
1174 Dev->PassThruMode.Attributes = EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL |
1175 EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL;
1180 Dev->PassThruMode.IoAlign = 0;
1185 Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap);
1195 NextDevStat |= VSTAT_FAILED;
1196 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat);
1198 Dev->InOutSupported =
FALSE;
1201 Dev->MaxSectors = 0;
1218 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);
1220 Dev->InOutSupported =
FALSE;
1223 Dev->MaxSectors = 0;
1225 Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap);
1228 SetMem (&Dev->PassThru,
sizeof Dev->PassThru, 0x00);
1229 SetMem (&Dev->PassThruMode,
sizeof Dev->PassThruMode, 0x00);
1246 DEBUG ((DEBUG_VERBOSE,
"%a: Context=0x%p\n", __func__, Context));
1255 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);
1275VirtioScsiDriverBindingSupported (
1289 Status =
gBS->OpenProtocol (
1291 &gVirtioDeviceProtocolGuid,
1293 This->DriverBindingHandle,
1296 EFI_OPEN_PROTOCOL_BY_DRIVER
1299 if (EFI_ERROR (Status)) {
1303 if (VirtIo->SubSystemDeviceId != VIRTIO_SUBSYSTEM_SCSI_HOST) {
1304 Status = EFI_UNSUPPORTED;
1311 gBS->CloseProtocol (
1313 &gVirtioDeviceProtocolGuid,
1314 This->DriverBindingHandle,
1322VirtioScsiDriverBindingStart (
1333 return EFI_OUT_OF_RESOURCES;
1336 Status =
gBS->OpenProtocol (
1338 &gVirtioDeviceProtocolGuid,
1339 (VOID **)&Dev->VirtIo,
1340 This->DriverBindingHandle,
1342 EFI_OPEN_PROTOCOL_BY_DRIVER
1344 if (EFI_ERROR (Status)) {
1345 goto FreeVirtioScsi;
1351 Status = VirtioScsiInit (Dev);
1352 if (EFI_ERROR (Status)) {
1356 Status =
gBS->CreateEvent (
1357 EVT_SIGNAL_EXIT_BOOT_SERVICES,
1359 &VirtioScsiExitBoot,
1363 if (EFI_ERROR (Status)) {
1371 Dev->Signature = VSCSI_SIG;
1372 Status =
gBS->InstallProtocolInterface (
1374 &gEfiExtScsiPassThruProtocolGuid,
1378 if (EFI_ERROR (Status)) {
1385 gBS->CloseEvent (Dev->ExitBoot);
1388 VirtioScsiUninit (Dev);
1391 gBS->CloseProtocol (
1393 &gVirtioDeviceProtocolGuid,
1394 This->DriverBindingHandle,
1406VirtioScsiDriverBindingStop (
1417 Status =
gBS->OpenProtocol (
1419 &gEfiExtScsiPassThruProtocolGuid,
1421 This->DriverBindingHandle,
1423 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1425 if (EFI_ERROR (Status)) {
1429 Dev = VIRTIO_SCSI_FROM_PASS_THRU (PassThru);
1434 Status =
gBS->UninstallProtocolInterface (
1436 &gEfiExtScsiPassThruProtocolGuid,
1439 if (EFI_ERROR (Status)) {
1443 gBS->CloseEvent (Dev->ExitBoot);
1445 VirtioScsiUninit (Dev);
1447 gBS->CloseProtocol (
1449 &gVirtioDeviceProtocolGuid,
1450 This->DriverBindingHandle,
1465 &VirtioScsiDriverBindingSupported,
1466 &VirtioScsiDriverBindingStart,
1467 &VirtioScsiDriverBindingStop,
1488 {
"eng;en", L
"Virtio SCSI Host Driver" },
1497VirtioScsiGetDriverName (
1500 OUT CHAR16 **DriverName
1505 This->SupportedLanguages,
1508 (BOOLEAN)(This == &gComponentName)
1514VirtioScsiGetDeviceName (
1519 OUT CHAR16 **ControllerName
1522 return EFI_UNSUPPORTED;
1527 &VirtioScsiGetDriverName,
1528 &VirtioScsiGetDeviceName,
1544VirtioScsiEntryPoint (
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS(EFIAPI * EFI_COMPONENT_NAME2_GET_DRIVER_NAME)(IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
EFI_STATUS(EFIAPI * EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)(IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
#define MESSAGING_DEVICE_PATH
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ALIGN_VALUE(Value, Alignment)
#define DEBUG(Expression)
#define PcdGet16(TokenName)
#define PcdGet32(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_SIZE_TO_PAGES(Size)
EFI_STATUS EFIAPI LookupUnicodeString2(IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, OUT CHAR16 **UnicodeString, IN BOOLEAN Iso639Language)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_STATUS EFIAPI VirtioMapAllBytesInSharedBuffer(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN VIRTIO_MAP_OPERATION Operation, IN VOID *HostAddress, IN UINTN NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
VOID EFIAPI VirtioAppendDesc(IN OUT VRING *Ring, IN UINT64 BufferDeviceAddress, IN UINT32 BufferSize, IN UINT16 Flags, IN OUT DESC_INDICES *Indices)
EFI_STATUS EFIAPI VirtioFlush(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN UINT16 VirtQueueId, IN OUT VRING *Ring, IN DESC_INDICES *Indices, OUT UINT32 *UsedLen OPTIONAL)
EFI_STATUS EFIAPI VirtioRingMap(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN VRING *Ring, OUT UINT64 *RingBaseShift, OUT VOID **Mapping)
EFI_STATUS EFIAPI Virtio10WriteFeatures(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN UINT64 Features, IN OUT UINT8 *DeviceStatus)
VOID EFIAPI VirtioPrepare(IN OUT VRING *Ring, OUT DESC_INDICES *Indices)
EFI_STATUS EFIAPI VirtioRingInit(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN UINT16 QueueSize, OUT VRING *Ring)
VOID EFIAPI VirtioRingUninit(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN OUT VRING *Ring)
STATIC EFI_STATUS EFIAPI ParseResponse(IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet, IN CONST volatile VIRTIO_SCSI_RESP *Response)
STATIC EFI_STATUS ReportHostAdapterError(OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet)
STATIC EFI_STATUS EFIAPI PopulateRequest(IN CONST VSCSI_DEV *Dev, IN UINT16 Target, IN UINT64 Lun, IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet, OUT volatile VIRTIO_SCSI_REQ *Request)
#define VIRTIO_CFG_WRITE(Dev, Field, Value)