[SeaBIOS] [PATCH 11/18] virtio: add version 1.0 support to vp_reset

Gerd Hoffmann kraxel at redhat.com
Mon Jun 29 10:53:33 CEST 2015


Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 src/hw/virtio-pci.c | 16 ++++++++++++++++
 src/hw/virtio-pci.h |  9 +--------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c
index 481b365..d2d06c5 100644
--- a/src/hw/virtio-pci.c
+++ b/src/hw/virtio-pci.c
@@ -102,6 +102,22 @@ u8 vp_get_isr(struct vp_device *vp)
     return isr;
 }
 
+void vp_reset(struct vp_device *vp)
+{
+    u8 isr;
+
+    if (vp->use_modern) {
+        vp_modern_write(vp->common, virtio_pci_common_cfg,
+                        device_status, 0);
+        vp_modern_read(vp->isr, virtio_pci_isr,
+                       isr, isr);
+    } else {
+        outb(0, vp->ioaddr + VIRTIO_PCI_STATUS);
+        isr = inb(vp->ioaddr + VIRTIO_PCI_ISR);
+    }
+    (void)isr;
+}
+
 int vp_find_vq(struct vp_device *vp, int queue_index,
                struct vring_virtqueue **p_vq)
 {
diff --git a/src/hw/virtio-pci.h b/src/hw/virtio-pci.h
index c9e5a21..608f492 100644
--- a/src/hw/virtio-pci.h
+++ b/src/hw/virtio-pci.h
@@ -205,14 +205,7 @@ static inline void vp_get(struct vp_device *vp, unsigned offset,
 u8 vp_get_status(struct vp_device *vp);
 void vp_set_status(struct vp_device *vp, u8 status);
 u8 vp_get_isr(struct vp_device *vp);
-
-static inline void vp_reset(struct vp_device *vp)
-{
-   int ioaddr = GET_LOWFLAT(vp->ioaddr);
-
-   outb(0, ioaddr + VIRTIO_PCI_STATUS);
-   (void)inb(ioaddr + VIRTIO_PCI_ISR);
-}
+void vp_reset(struct vp_device *vp);
 
 static inline void vp_notify(struct vp_device *vp, int queue_index)
 {
-- 
1.8.3.1




More information about the SeaBIOS mailing list