From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9UpJ-0003zG-TJ for qemu-devel@nongnu.org; Mon, 29 Jun 2015 04:54:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9UpI-0002uX-RD for qemu-devel@nongnu.org; Mon, 29 Jun 2015 04:54:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9UpI-0002uM-MW for qemu-devel@nongnu.org; Mon, 29 Jun 2015 04:54:04 -0400 From: Gerd Hoffmann Date: Mon, 29 Jun 2015 10:53:33 +0200 Message-Id: <1435568020-8669-12-git-send-email-kraxel@redhat.com> In-Reply-To: <1435568020-8669-1-git-send-email-kraxel@redhat.com> References: <1435568020-8669-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 11/18] virtio: add version 1.0 support to vp_reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: seabios@seabios.org Cc: Gerd Hoffmann , qemu-devel@nongnu.org, "Michael S. Tsirkin" Signed-off-by: Gerd Hoffmann --- 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