]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Include/Library/VirtioLib.h
OvmfPkg/XenBusDxe: Add Event Channel into XenBus protocol.
[mirror_edk2.git] / OvmfPkg / Include / Library / VirtioLib.h
index 9a502f3e6776453b2864ba06c732ab119de8d711..36527a523f28814b4e0ce0c0b5f53f12ca7da3d9 100644 (file)
 #ifndef _VIRTIO_LIB_H_\r
 #define _VIRTIO_LIB_H_\r
 \r
-#include <Protocol/PciIo.h>\r
-#include <IndustryStandard/Virtio.h>\r
-\r
-/**\r
-\r
-  Write a word into Region 0 of the device specified by PciIo.\r
-\r
-  Region 0 must be an iomem region. This is an internal function for the\r
-  driver-specific VIRTIO_CFG_WRITE() macros.\r
-\r
-  @param[in] PciIo        Target PCI device.\r
-\r
-  @param[in] FieldOffset  Destination offset.\r
-\r
-  @param[in] FieldSize    Destination field size, must be in { 1, 2, 4, 8 }.\r
-\r
-  @param[in] Value        Little endian value to write, converted to UINT64.\r
-                          The least significant FieldSize bytes will be used.\r
+#include <Protocol/VirtioDevice.h>\r
 \r
-\r
-  @return  Status code returned by PciIo->Io.Write().\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VirtioWrite (\r
-  IN EFI_PCI_IO_PROTOCOL *PciIo,\r
-  IN UINTN               FieldOffset,\r
-  IN UINTN               FieldSize,\r
-  IN UINT64              Value\r
-  );\r
-\r
-\r
-/**\r
-\r
-  Read a word from Region 0 of the device specified by PciIo.\r
-\r
-  Region 0 must be an iomem region. This is an internal function for the\r
-  driver-specific VIRTIO_CFG_READ() macros.\r
-\r
-  @param[in] PciIo        Source PCI device.\r
-\r
-  @param[in] FieldOffset  Source offset.\r
-\r
-  @param[in] FieldSize    Source field size, must be in { 1, 2, 4, 8 }.\r
-\r
-  @param[in] BufferSize   Number of bytes available in the target buffer. Must\r
-                          equal FieldSize.\r
-\r
-  @param[out] Buffer      Target buffer.\r
-\r
-\r
-  @return  Status code returned by PciIo->Io.Read().\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VirtioRead (\r
-  IN  EFI_PCI_IO_PROTOCOL *PciIo,\r
-  IN  UINTN               FieldOffset,\r
-  IN  UINTN               FieldSize,\r
-  IN  UINTN               BufferSize,\r
-  OUT VOID                *Buffer\r
-  );\r
+#include <IndustryStandard/Virtio.h>\r
 \r
 \r
 /**\r
@@ -180,27 +119,26 @@ VirtioPrepare (
   The caller is responsible for initializing *Indices with VirtioPrepare()\r
   first.\r
 \r
-  @param[in out] Ring           The virtio ring to append the buffer to, as a\r
-                                descriptor.\r
+  @param[in,out] Ring        The virtio ring to append the buffer to, as a\r
+                             descriptor.\r
 \r
-  @param [in] BufferPhysAddr    (Guest pseudo-physical) start address of the\r
-                                transmit / receive buffer.\r
+  @param[in] BufferPhysAddr  (Guest pseudo-physical) start address of the\r
+                             transmit / receive buffer.\r
 \r
-  @param [in] BufferSize        Number of bytes to transmit or receive.\r
+  @param[in] BufferSize      Number of bytes to transmit or receive.\r
 \r
-  @param [in] Flags             A bitmask of VRING_DESC_F_* flags. The caller\r
-                                computes this mask dependent on further buffers\r
-                                to append and transfer direction.\r
-                                VRING_DESC_F_INDIRECT is unsupported. The\r
-                                VRING_DESC.Next field is always set, but the\r
-                                host only interprets it dependent on\r
-                                VRING_DESC_F_NEXT.\r
+  @param[in] Flags           A bitmask of VRING_DESC_F_* flags. The caller\r
+                             computes this mask dependent on further buffers to\r
+                             append and transfer direction.\r
+                             VRING_DESC_F_INDIRECT is unsupported. The\r
+                             VRING_DESC.Next field is always set, but the host\r
+                             only interprets it dependent on VRING_DESC_F_NEXT.\r
 \r
-  In *Indices:\r
-\r
-  @param [in out] NextDescIdx  On input, the index identifying the next\r
-                               descriptor to carry the buffer. On output,\r
-                               incremented by one, modulo 2^16.\r
+  @param[in,out] Indices     Indices->HeadDescIdx is not accessed.\r
+                             On input, Indices->NextDescIdx identifies the next\r
+                             descriptor to carry the buffer. On output,\r
+                             Indices->NextDescIdx is incremented by one, modulo\r
+                             2^16.\r
 \r
 **/\r
 VOID\r
@@ -219,19 +157,18 @@ VirtioAppendDesc (
   Notify the host about the descriptor chain just built, and wait until the\r
   host processes it.\r
 \r
-  @param[in] PciIo        The target virtio PCI device to notify.\r
+  @param[in] VirtIo       The target virtio device to notify.\r
 \r
   @param[in] VirtQueueId  Identifies the queue for the target device.\r
 \r
-  @param[in out] Ring     The virtio ring with descriptors to submit.\r
-\r
-  In *Indices:\r
+  @param[in,out] Ring     The virtio ring with descriptors to submit.\r
 \r
-  @param[in] HeadDescIdx  Identifies the head descriptor of the descriptor\r
-                          chain.\r
+  @param[in] Indices      Indices->NextDescIdx is not accessed.\r
+                          Indices->HeadDescIdx identifies the head descriptor\r
+                          of the descriptor chain.\r
 \r
 \r
-  @return              Error code from VirtioWrite() if it fails.\r
+  @return              Error code from VirtIo->SetQueueNotify() if it fails.\r
 \r
   @retval EFI_SUCCESS  Otherwise, the host processed all descriptors.\r
 \r
@@ -239,10 +176,10 @@ VirtioAppendDesc (
 EFI_STATUS\r
 EFIAPI\r
 VirtioFlush (\r
-  IN     EFI_PCI_IO_PROTOCOL *PciIo,\r
-  IN     UINT16              VirtQueueId,\r
-  IN OUT VRING               *Ring,\r
-  IN     DESC_INDICES        *Indices\r
+  IN     VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
+  IN     UINT16                 VirtQueueId,\r
+  IN OUT VRING                  *Ring,\r
+  IN     DESC_INDICES           *Indices\r
   );\r
 \r
 #endif // _VIRTIO_LIB_H_\r