-/* $OpenBSD: virtio_mmio.c,v 1.2 2016/04/24 00:57:23 patrick Exp $ */
+/* $OpenBSD: virtio_mmio.c,v 1.3 2016/07/14 12:42:00 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
if ((isr & VIRTIO_MMIO_INT_CONFIG) &&
(vsc->sc_config_change != NULL))
r = (vsc->sc_config_change)(vsc);
- if ((isr & VIRTIO_MMIO_INT_VRING) &&
- (vsc->sc_intrhand != NULL))
- r |= (vsc->sc_intrhand)(vsc);
+ if ((isr & VIRTIO_MMIO_INT_VRING))
+ r |= virtio_check_vqs(vsc);
return r;
}
-/* $OpenBSD: if_vio.c,v 1.41 2016/04/13 10:34:32 mpi Exp $ */
+/* $OpenBSD: if_vio.c,v 1.42 2016/07/14 12:42:00 sf Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
vsc->sc_ipl = IPL_NET;
vsc->sc_vqs = &sc->sc_vq[0];
vsc->sc_config_change = 0;
- vsc->sc_intrhand = virtio_vq_intr;
features = VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS |
VIRTIO_NET_F_CTRL_VQ | VIRTIO_NET_F_CTRL_RX |
-/* $OpenBSD: vioblk.c,v 1.9 2015/12/05 19:57:03 sf Exp $ */
+/* $OpenBSD: vioblk.c,v 1.10 2016/07/14 12:42:00 sf Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch.
panic("already attached to something else");
vsc->sc_child = self;
vsc->sc_ipl = IPL_BIO;
- vsc->sc_intrhand = virtio_vq_intr;
sc->sc_virtio = vsc;
features = virtio_negotiate_features(vsc,
-/* $OpenBSD: viomb.c,v 1.14 2015/06/11 04:38:23 jsg Exp $ */
+/* $OpenBSD: viomb.c,v 1.15 2016/07/14 12:42:00 sf Exp $ */
/* $NetBSD: viomb.c,v 1.1 2011/10/30 12:12:21 hannken Exp $ */
/*
vsc->sc_child = self;
vsc->sc_ipl = IPL_BIO;
vsc->sc_config_change = viomb_config_change;
- vsc->sc_intrhand = virtio_vq_intr;
/* negotiate features */
features = VIRTIO_F_RING_INDIRECT_DESC;
-/* $OpenBSD: viornd.c,v 1.2 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: viornd.c,v 1.3 2016/07/14 12:42:00 sf Exp $ */
/*
* Copyright (c) 2014 Stefan Fritsch <sf@sfritsch.de>
panic("already attached to something else");
vsc->sc_child = self;
vsc->sc_ipl = IPL_NET;
- vsc->sc_intrhand = virtio_vq_intr;
sc->sc_virtio = vsc;
virtio_negotiate_features(vsc, 0, NULL);
-/* $OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: vioscsi.c,v 1.4 2016/07/14 12:42:00 sf Exp $ */
/*
* Copyright (c) 2013 Google Inc.
*
}
vsc->sc_child = &sc->sc_dev;
vsc->sc_ipl = IPL_BIO;
- vsc->sc_intrhand = virtio_vq_intr;
// TODO(matthew): Negotiate hotplug.
-/* $OpenBSD: virtio.c,v 1.18 2015/12/05 19:40:34 sf Exp $ */
+/* $OpenBSD: virtio.c,v 1.19 2016/07/14 12:42:00 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
sizeof(struct vring_desc) * vq->vq_maxnsegs, ops);
}
-/*
- * Can be used as sc_intrhand.
- */
/*
* Scan vq, bus_dmamap_sync for the vqs (not for the payload),
* and calls (*vq_done)() if some entries are consumed.
+ * For use in transport specific irq handlers.
*/
int
-virtio_vq_intr(struct virtio_softc *sc)
+virtio_check_vqs(struct virtio_softc *sc)
{
struct virtqueue *vq;
int i, r = 0;
-/* $OpenBSD: virtio_pci.c,v 1.12 2015/11/15 16:00:15 deraadt Exp $ */
+/* $OpenBSD: virtio_pci.c,v 1.13 2016/07/14 12:42:00 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
return 0;
KERNEL_LOCK();
if ((isr & VIRTIO_CONFIG_ISR_CONFIG_CHANGE) &&
- (vsc->sc_config_change != NULL))
+ (vsc->sc_config_change != NULL)) {
r = (vsc->sc_config_change)(vsc);
- if (vsc->sc_intrhand != NULL)
- r |= (vsc->sc_intrhand)(vsc);
+ }
+ r |= virtio_check_vqs(vsc);
KERNEL_UNLOCK();
return r;
-/* $OpenBSD: virtiovar.h,v 1.6 2015/12/05 19:40:34 sf Exp $ */
+/* $OpenBSD: virtiovar.h,v 1.7 2016/07/14 12:42:00 sf Exp $ */
/* $NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */
/*
*/
int (*sc_config_change)(struct virtio_softc*);
/* set by child */
- int (*sc_intrhand)(struct virtio_softc*);
- /* set by child */
};
/* public interface */
int virtio_dequeue_commit(struct virtqueue*, int);
int virtio_intr(void *arg);
-int virtio_vq_intr(struct virtio_softc *);
+int virtio_check_vqs(struct virtio_softc *);
void virtio_stop_vq_intr(struct virtio_softc *, struct virtqueue *);
int virtio_start_vq_intr(struct virtio_softc *, struct virtqueue *);