]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Include/Library/VirtioLib.h
OvmfPkg: Make the VirtIo devices use the new VIRTIO_DEVICE_PROTOCOL
[mirror_edk2.git] / OvmfPkg / Include / Library / VirtioLib.h
index 51303491d0ae81eddd16c504d084dc388e1a4fb4..8c043369c3642b62091aa133254297183daf22b9 100644 (file)
 #ifndef _VIRTIO_LIB_H_\r
 #define _VIRTIO_LIB_H_\r
 \r
-#include <Protocol/PciIo.h>\r
+#include <Protocol/VirtioDevice.h>\r
+\r
 #include <IndustryStandard/Virtio.h>\r
 \r
 /**\r
 \r
-  Write a word into Region 0 of the device specified by PciIo.\r
+  Write a word into VirtIo Device Specific Region\r
 \r
-  Region 0 must be an iomem region. This is an internal function for the\r
-  driver-specific VIRTIO_CFG_WRITE() macros.\r
+  The VirtIo Device Specific Region must be an iomem region.\r
+  This is an internal function for the driver-specific VIRTIO_CFG_WRITE()\r
+  macros.\r
 \r
-  @param[in] PciIo        Target PCI device.\r
+  @param[in] VirtIo       Target Virtio device.\r
 \r
   @param[in] FieldOffset  Destination offset.\r
 \r
                           The least significant FieldSize bytes will be used.\r
 \r
 \r
-  @return  Status code returned by PciIo->Io.Write().\r
+  @return  Status code returned by VirtIo->WriteDevice().\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
+VirtioWriteDevice (\r
+  IN VIRTIO_DEVICE_PROTOCOL *VirtIo,\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
+  Read a word from VirtIo Device Specific Region\r
 \r
-  Region 0 must be an iomem region. This is an internal function for the\r
-  driver-specific VIRTIO_CFG_READ() macros.\r
+  The VirtIo Device Specific Region must be an iomem region.\r
+  This is an internal function for the driver-specific VIRTIO_CFG_READ()\r
+  macros.\r
 \r
-  @param[in] PciIo        Source PCI device.\r
+  @param[in] VirtIo       Source Virtio device.\r
 \r
   @param[in] FieldOffset  Source offset.\r
 \r
@@ -69,17 +72,17 @@ VirtioWrite (
   @param[out] Buffer      Target buffer.\r
 \r
 \r
-  @return  Status code returned by PciIo->Io.Read().\r
+  @return  Status code returned by VirtIo->ReadDevice().\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
+VirtioReadDevice (\r
+  IN  VIRTIO_DEVICE_PROTOCOL *VirtIo,\r
+  IN  UINTN                  FieldOffset,\r
+  IN  UINTN                  FieldSize,\r
+  IN  UINTN                  BufferSize,\r
+  OUT VOID                   *Buffer\r
   );\r
 \r
 \r
@@ -218,7 +221,7 @@ 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
@@ -229,7 +232,7 @@ VirtioAppendDesc (
                           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
@@ -237,10 +240,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