@@ -65,6 +65,31 @@ void vp_set_features(struct vp_device *vp, u64 features)
}
}
+u8 vp_get_status(struct vp_device *vp)
+{
+ u8 status;
+
+ if (vp->use_modern) {
+ vp_modern_read(vp->common, virtio_pci_common_cfg,
+ device_status, status);
+ } else {
+ status = inb(vp->ioaddr + VIRTIO_PCI_STATUS);
+ }
+ return status;
+}
+
+void vp_set_status(struct vp_device *vp, u8 status)
+{
+ if (status == 0) /* reset */
+ return;
+ if (vp->use_modern) {
+ vp_modern_write(vp->common, virtio_pci_common_cfg,
+ device_status, status);
+ } else {
+ outb(status, vp->ioaddr + VIRTIO_PCI_STATUS);
+ }
+}
+
int vp_find_vq(struct vp_device *vp, int queue_index,
struct vring_virtqueue **p_vq)
{
@@ -202,17 +202,8 @@ static inline void vp_get(struct vp_device *vp, unsigned offset,
ptr[i] = inb(ioaddr + VIRTIO_PCI_CONFIG + offset + i);
}
-static inline u8 vp_get_status(struct vp_device *vp)
-{
- return inb(GET_LOWFLAT(vp->ioaddr) + VIRTIO_PCI_STATUS);
-}
-
-static inline void vp_set_status(struct vp_device *vp, u8 status)
-{
- if (status == 0) /* reset */
- return;
- outb(status, GET_LOWFLAT(vp->ioaddr) + VIRTIO_PCI_STATUS);
-}
+u8 vp_get_status(struct vp_device *vp);
+void vp_set_status(struct vp_device *vp, u8 status);
static inline u8 vp_get_isr(struct vp_device *vp)
{
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- src/hw/virtio-pci.c | 25 +++++++++++++++++++++++++ src/hw/virtio-pci.h | 13 ++----------- 2 files changed, 27 insertions(+), 11 deletions(-)