Lines Matching refs:Dev
64 #define VIRTIO_CFG_WRITE(Dev, Field, Value) ((Dev)->VirtIo->WriteDevice ( \ argument
65 (Dev)->VirtIo, \
71 #define VIRTIO_CFG_READ(Dev, Field, Pointer) ((Dev)->VirtIo->ReadDevice ( \ argument
72 (Dev)->VirtIo, \
242 IN VBLK_DEV *Dev, in SynchronousRequest() argument
254 BlockSize = Dev->BlockIoMedia.BlockSize; in SynchronousRequest()
277 VirtioPrepare (&Dev->Ring, &Indices); in SynchronousRequest()
288 ASSERT (Dev->Ring.QueueSize >= 3); in SynchronousRequest()
293 VirtioAppendDesc (&Dev->Ring, (UINTN) &Request, sizeof Request, in SynchronousRequest()
313 VirtioAppendDesc (&Dev->Ring, (UINTN) Buffer, (UINT32) BufferSize, in SynchronousRequest()
321 VirtioAppendDesc (&Dev->Ring, (UINTN) &HostStatus, sizeof HostStatus, in SynchronousRequest()
327 if (VirtioFlush (Dev->VirtIo, 0, &Dev->Ring, &Indices, in SynchronousRequest()
365 VBLK_DEV *Dev; in VirtioBlkReadBlocks() local
372 Dev = VIRTIO_BLK_FROM_BLOCK_IO (This); in VirtioBlkReadBlocks()
374 &Dev->BlockIoMedia, in VirtioBlkReadBlocks()
384 Dev, in VirtioBlkReadBlocks()
420 VBLK_DEV *Dev; in VirtioBlkWriteBlocks() local
427 Dev = VIRTIO_BLK_FROM_BLOCK_IO (This); in VirtioBlkWriteBlocks()
429 &Dev->BlockIoMedia, in VirtioBlkWriteBlocks()
439 Dev, in VirtioBlkWriteBlocks()
471 VBLK_DEV *Dev; in VirtioBlkFlushBlocks() local
473 Dev = VIRTIO_BLK_FROM_BLOCK_IO (This); in VirtioBlkFlushBlocks()
474 return Dev->BlockIoMedia.WriteCaching ? in VirtioBlkFlushBlocks()
476 Dev, in VirtioBlkFlushBlocks()
590 IN OUT VBLK_DEV *Dev in VirtioBlkInit() argument
612 Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat); in VirtioBlkInit()
618 Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat); in VirtioBlkInit()
624 Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat); in VirtioBlkInit()
632 Status = Dev->VirtIo->SetPageSize (Dev->VirtIo, EFI_PAGE_SIZE); in VirtioBlkInit()
640 Status = Dev->VirtIo->GetDeviceFeatures (Dev->VirtIo, &Features); in VirtioBlkInit()
645 Status = VIRTIO_CFG_READ (Dev, Capacity, &NumSectors); in VirtioBlkInit()
655 Status = VIRTIO_CFG_READ (Dev, BlkSize, &BlockSize); in VirtioBlkInit()
674 Status = VIRTIO_CFG_READ (Dev, Topology.PhysicalBlockExp, in VirtioBlkInit()
684 Status = VIRTIO_CFG_READ (Dev, Topology.AlignmentOffset, &AlignmentOffset); in VirtioBlkInit()
689 Status = VIRTIO_CFG_READ (Dev, Topology.OptIoSize, &OptIoSize); in VirtioBlkInit()
702 if (Dev->VirtIo->Revision >= VIRTIO_SPEC_REVISION (1, 0, 0)) { in VirtioBlkInit()
703 Status = Virtio10WriteFeatures (Dev->VirtIo, Features, &NextDevStat); in VirtioBlkInit()
712 Status = Dev->VirtIo->SetQueueSel (Dev->VirtIo, 0); in VirtioBlkInit()
716 Status = Dev->VirtIo->GetQueueNumMax (Dev->VirtIo, &QueueSize); in VirtioBlkInit()
725 Status = VirtioRingInit (QueueSize, &Dev->Ring); in VirtioBlkInit()
734 Status = Dev->VirtIo->SetQueueNum (Dev->VirtIo, QueueSize); in VirtioBlkInit()
739 Status = Dev->VirtIo->SetQueueAlign (Dev->VirtIo, EFI_PAGE_SIZE); in VirtioBlkInit()
747 Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring); in VirtioBlkInit()
756 if (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) { in VirtioBlkInit()
758 Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features); in VirtioBlkInit()
768 Status = Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat); in VirtioBlkInit()
777 Dev->BlockIo.Revision = 0; in VirtioBlkInit()
778 Dev->BlockIo.Media = &Dev->BlockIoMedia; in VirtioBlkInit()
779 Dev->BlockIo.Reset = &VirtioBlkReset; in VirtioBlkInit()
780 Dev->BlockIo.ReadBlocks = &VirtioBlkReadBlocks; in VirtioBlkInit()
781 Dev->BlockIo.WriteBlocks = &VirtioBlkWriteBlocks; in VirtioBlkInit()
782 Dev->BlockIo.FlushBlocks = &VirtioBlkFlushBlocks; in VirtioBlkInit()
783 Dev->BlockIoMedia.MediaId = 0; in VirtioBlkInit()
784 Dev->BlockIoMedia.RemovableMedia = FALSE; in VirtioBlkInit()
785 Dev->BlockIoMedia.MediaPresent = TRUE; in VirtioBlkInit()
786 Dev->BlockIoMedia.LogicalPartition = FALSE; in VirtioBlkInit()
787 Dev->BlockIoMedia.ReadOnly = (BOOLEAN) ((Features & VIRTIO_BLK_F_RO) != 0); in VirtioBlkInit()
788 Dev->BlockIoMedia.WriteCaching = (BOOLEAN) ((Features & VIRTIO_BLK_F_FLUSH) != 0); in VirtioBlkInit()
789 Dev->BlockIoMedia.BlockSize = BlockSize; in VirtioBlkInit()
790 Dev->BlockIoMedia.IoAlign = 0; in VirtioBlkInit()
791 Dev->BlockIoMedia.LastBlock = DivU64x32 (NumSectors, in VirtioBlkInit()
795 __FUNCTION__, Dev->BlockIoMedia.BlockSize, in VirtioBlkInit()
796 Dev->BlockIoMedia.LastBlock + 1)); in VirtioBlkInit()
799 Dev->BlockIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION3; in VirtioBlkInit()
801 Dev->BlockIoMedia.LowestAlignedLba = AlignmentOffset; in VirtioBlkInit()
802 Dev->BlockIoMedia.LogicalBlocksPerPhysicalBlock = 1u << PhysicalBlockExp; in VirtioBlkInit()
803 Dev->BlockIoMedia.OptimalTransferLengthGranularity = OptIoSize; in VirtioBlkInit()
806 __FUNCTION__, Dev->BlockIoMedia.LowestAlignedLba, in VirtioBlkInit()
807 Dev->BlockIoMedia.LogicalBlocksPerPhysicalBlock)); in VirtioBlkInit()
809 __FUNCTION__, Dev->BlockIoMedia.OptimalTransferLengthGranularity)); in VirtioBlkInit()
814 VirtioRingUninit (&Dev->Ring); in VirtioBlkInit()
822 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat); in VirtioBlkInit()
841 IN OUT VBLK_DEV *Dev in VirtioBlkUninit() argument
849 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); in VirtioBlkUninit()
851 VirtioRingUninit (&Dev->Ring); in VirtioBlkUninit()
853 SetMem (&Dev->BlockIo, sizeof Dev->BlockIo, 0x00); in VirtioBlkUninit()
854 SetMem (&Dev->BlockIoMedia, sizeof Dev->BlockIoMedia, 0x00); in VirtioBlkUninit()
876 VBLK_DEV *Dev; in VirtioBlkExitBoot() local
885 Dev = Context; in VirtioBlkExitBoot()
886 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); in VirtioBlkExitBoot()
926 VBLK_DEV *Dev; in VirtioBlkDriverBindingStart() local
929 Dev = (VBLK_DEV *) AllocateZeroPool (sizeof *Dev); in VirtioBlkDriverBindingStart()
930 if (Dev == NULL) { in VirtioBlkDriverBindingStart()
935 (VOID **)&Dev->VirtIo, This->DriverBindingHandle, in VirtioBlkDriverBindingStart()
944 Status = VirtioBlkInit (Dev); in VirtioBlkDriverBindingStart()
950 &VirtioBlkExitBoot, Dev, &Dev->ExitBoot); in VirtioBlkDriverBindingStart()
958 Dev->Signature = VBLK_SIG; in VirtioBlkDriverBindingStart()
961 &Dev->BlockIo); in VirtioBlkDriverBindingStart()
969 gBS->CloseEvent (Dev->ExitBoot); in VirtioBlkDriverBindingStart()
972 VirtioBlkUninit (Dev); in VirtioBlkDriverBindingStart()
979 FreePool (Dev); in VirtioBlkDriverBindingStart()
1019 VBLK_DEV *Dev; in VirtioBlkDriverBindingStop() local
1033 Dev = VIRTIO_BLK_FROM_BLOCK_IO (BlockIo); in VirtioBlkDriverBindingStop()
1039 &gEfiBlockIoProtocolGuid, &Dev->BlockIo); in VirtioBlkDriverBindingStop()
1044 gBS->CloseEvent (Dev->ExitBoot); in VirtioBlkDriverBindingStop()
1046 VirtioBlkUninit (Dev); in VirtioBlkDriverBindingStop()
1051 FreePool (Dev); in VirtioBlkDriverBindingStop()