sizeof *Ring->Avail.Idx +\r
sizeof *Ring->Avail.Ring * QueueSize +\r
sizeof *Ring->Avail.UsedEvent,\r
sizeof *Ring->Avail.Idx +\r
sizeof *Ring->Avail.Ring * QueueSize +\r
sizeof *Ring->Avail.UsedEvent,\r
\r
RingSize += ALIGN_VALUE (\r
sizeof *Ring->Used.Flags +\r
sizeof *Ring->Used.Idx +\r
sizeof *Ring->Used.UsedElem * QueueSize +\r
sizeof *Ring->Used.AvailEvent,\r
\r
RingSize += ALIGN_VALUE (\r
sizeof *Ring->Used.Flags +\r
sizeof *Ring->Used.Idx +\r
sizeof *Ring->Used.UsedElem * QueueSize +\r
sizeof *Ring->Used.AvailEvent,\r
SetMem (Ring->Base, RingSize, 0x00);\r
RingPagesPtr = Ring->Base;\r
\r
SetMem (Ring->Base, RingSize, 0x00);\r
RingPagesPtr = Ring->Base;\r
\r
- Ring->Avail.Flags = (volatile VOID *) RingPagesPtr;\r
- RingPagesPtr += sizeof *Ring->Avail.Flags;\r
+ Ring->Avail.Flags = (volatile VOID *)RingPagesPtr;\r
+ RingPagesPtr += sizeof *Ring->Avail.Flags;\r
- Ring->Avail.Ring = (volatile VOID *) RingPagesPtr;\r
- RingPagesPtr += sizeof *Ring->Avail.Ring * QueueSize;\r
+ Ring->Avail.Ring = (volatile VOID *)RingPagesPtr;\r
+ RingPagesPtr += sizeof *Ring->Avail.Ring * QueueSize;\r
- Ring->Avail.UsedEvent = (volatile VOID *) RingPagesPtr;\r
- RingPagesPtr += sizeof *Ring->Avail.UsedEvent;\r
+ Ring->Avail.UsedEvent = (volatile VOID *)RingPagesPtr;\r
+ RingPagesPtr += sizeof *Ring->Avail.UsedEvent;\r
- RingPagesPtr = (volatile UINT8 *) Ring->Base +\r
- ALIGN_VALUE (RingPagesPtr - (volatile UINT8 *) Ring->Base,\r
- EFI_PAGE_SIZE);\r
+ RingPagesPtr = (volatile UINT8 *)Ring->Base +\r
+ ALIGN_VALUE (\r
+ RingPagesPtr - (volatile UINT8 *)Ring->Base,\r
+ EFI_PAGE_SIZE\r
+ );\r
- Ring->Used.UsedElem = (volatile VOID *) RingPagesPtr;\r
- RingPagesPtr += sizeof *Ring->Used.UsedElem * QueueSize;\r
+ Ring->Used.UsedElem = (volatile VOID *)RingPagesPtr;\r
+ RingPagesPtr += sizeof *Ring->Used.UsedElem * QueueSize;\r
- Ring->Used.AvailEvent = (volatile VOID *) RingPagesPtr;\r
- RingPagesPtr += sizeof *Ring->Used.AvailEvent;\r
+ Ring->Used.AvailEvent = (volatile VOID *)RingPagesPtr;\r
+ RingPagesPtr += sizeof *Ring->Used.AvailEvent;\r
)\r
{\r
VirtIo->FreeSharedPages (VirtIo, Ring->NumPages, Ring->Base);\r
SetMem (Ring, sizeof *Ring, 0x00);\r
}\r
\r
)\r
{\r
VirtIo->FreeSharedPages (VirtIo, Ring->NumPages, Ring->Base);\r
SetMem (Ring, sizeof *Ring, 0x00);\r
}\r
\r
)\r
{\r
//\r
// Prepare for virtio-0.9.5, 2.4.2 Receiving Used Buffers From the Device.\r
// We're going to poll the answer, the host should not send an interrupt.\r
//\r
)\r
{\r
//\r
// Prepare for virtio-0.9.5, 2.4.2 Receiving Used Buffers From the Device.\r
// We're going to poll the answer, the host should not send an interrupt.\r
//\r
- IN OUT VRING *Ring,\r
- IN UINT64 BufferDeviceAddress,\r
- IN UINT32 BufferSize,\r
- IN UINT16 Flags,\r
- IN OUT DESC_INDICES *Indices\r
+ IN OUT VRING *Ring,\r
+ IN UINT64 BufferDeviceAddress,\r
+ IN UINT32 BufferSize,\r
+ IN UINT16 Flags,\r
+ IN OUT DESC_INDICES *Indices\r
- IN VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
- IN UINT16 VirtQueueId,\r
- IN OUT VRING *Ring,\r
- IN DESC_INDICES *Indices,\r
- OUT UINT32 *UsedLen OPTIONAL\r
+ IN VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
+ IN UINT16 VirtQueueId,\r
+ IN OUT VRING *Ring,\r
+ IN DESC_INDICES *Indices,\r
+ OUT UINT32 *UsedLen OPTIONAL\r
// (Due to our lock-step progress, this is where the host will produce the\r
// used element with the head descriptor's index in it.)\r
//\r
// (Due to our lock-step progress, this is where the host will produce the\r
// used element with the head descriptor's index in it.)\r
//\r
Ring->Avail.Ring[NextAvailIdx++ % Ring->QueueSize] =\r
Indices->HeadDescIdx % Ring->QueueSize;\r
\r
//\r
// virtio-0.9.5, 2.4.1.3 Updating the Index Field\r
//\r
Ring->Avail.Ring[NextAvailIdx++ % Ring->QueueSize] =\r
Indices->HeadDescIdx % Ring->QueueSize;\r
\r
//\r
// virtio-0.9.5, 2.4.1.3 Updating the Index Field\r
//\r
*Ring->Avail.Idx = NextAvailIdx;\r
\r
//\r
// virtio-0.9.5, 2.4.1.4 Notifying the Device -- gratuitous notifications are\r
// OK.\r
//\r
*Ring->Avail.Idx = NextAvailIdx;\r
\r
//\r
// virtio-0.9.5, 2.4.1.4 Notifying the Device -- gratuitous notifications are\r
// OK.\r
//\r
Status = VirtIo->SetQueueNotify (VirtIo, VirtQueueId);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
Status = VirtIo->SetQueueNotify (VirtIo, VirtQueueId);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
while (*Ring->Used.Idx != NextAvailIdx) {\r
gBS->Stall (PollPeriodUsecs); // calls AcpiTimerLib::MicroSecondDelay\r
\r
if (PollPeriodUsecs < 1024) {\r
PollPeriodUsecs *= 2;\r
}\r
while (*Ring->Used.Idx != NextAvailIdx) {\r
gBS->Stall (PollPeriodUsecs); // calls AcpiTimerLib::MicroSecondDelay\r
\r
if (PollPeriodUsecs < 1024) {\r
PollPeriodUsecs *= 2;\r
}\r
\r
UsedElem = &Ring->Used.UsedElem[LastUsedIdx % Ring->QueueSize];\r
ASSERT (UsedElem->Id == Indices->HeadDescIdx);\r
\r
UsedElem = &Ring->Used.UsedElem[LastUsedIdx % Ring->QueueSize];\r
ASSERT (UsedElem->Id == Indices->HeadDescIdx);\r
- IN VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
- IN UINT64 Features,\r
- IN OUT UINT8 *DeviceStatus\r
+ IN VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
+ IN UINT64 Features,\r
+ IN OUT UINT8 *DeviceStatus\r
\r
if (VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {\r
return EFI_UNSUPPORTED;\r
\r
if (VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {\r
return EFI_UNSUPPORTED;\r
- IN VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
- IN VRING *Ring,\r
- OUT UINT64 *RingBaseShift,\r
- OUT VOID **Mapping\r
+ IN VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
+ IN VRING *Ring,\r
+ OUT UINT64 *RingBaseShift,\r
+ OUT VOID **Mapping\r