diff options
author | Stefan Fritsch <sf@cvs.openbsd.org> | 2019-01-19 16:23:47 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@cvs.openbsd.org> | 2019-01-19 16:23:47 +0000 |
commit | 080038e0159b9823f099144f81421a3a1fc75a82 (patch) | |
tree | d4f699d92f3afd5d86361e0b2e96275511871a56 | |
parent | 337aac4d274499bb74eed25291a9203fac2bf4e0 (diff) |
virtio: Introduce defines for config(8) flags
-rw-r--r-- | sys/dev/fdt/virtio_mmio.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/virtio_pci.c | 6 | ||||
-rw-r--r-- | sys/dev/pv/if_vio.c | 6 | ||||
-rw-r--r-- | sys/dev/pv/virtiovar.h | 6 |
4 files changed, 14 insertions, 10 deletions
diff --git a/sys/dev/fdt/virtio_mmio.c b/sys/dev/fdt/virtio_mmio.c index a48091d7fca..847519c3280 100644 --- a/sys/dev/fdt/virtio_mmio.c +++ b/sys/dev/fdt/virtio_mmio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio_mmio.c,v 1.4 2019/01/10 18:05:43 sf Exp $ */ +/* $OpenBSD: virtio_mmio.c,v 1.5 2019/01/19 16:23:46 sf Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -308,8 +308,8 @@ virtio_mmio_negotiate_features(struct virtio_softc *vsc, uint32_t guest_features * indirect descriptors can be switched off by setting bit 1 in the * driver flags, see config(8) */ - if (!(vsc->sc_dev.dv_cfdata->cf_flags & 1) && - !(vsc->sc_child->dv_cfdata->cf_flags & 1)) { + if (!(vsc->sc_dev.dv_cfdata->cf_flags & VIRTIO_CF_NO_INDIRECT) && + !(vsc->sc_child->dv_cfdata->cf_flags & VIRTIO_CF_NO_INDIRECT)) { guest_features |= VIRTIO_F_RING_INDIRECT_DESC; } else { printf("RingIndirectDesc disabled by UKC\n"); diff --git a/sys/dev/pci/virtio_pci.c b/sys/dev/pci/virtio_pci.c index d9c8d144e21..06d3a5ca23e 100644 --- a/sys/dev/pci/virtio_pci.c +++ b/sys/dev/pci/virtio_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio_pci.c,v 1.20 2019/01/10 18:11:42 sf Exp $ */ +/* $OpenBSD: virtio_pci.c,v 1.21 2019/01/19 16:23:46 sf Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -327,8 +327,8 @@ virtio_pci_negotiate_features(struct virtio_softc *vsc, uint32_t guest_features, * indirect descriptors can be switched off by setting bit 1 in the * driver flags, see config(8) */ - if (!(vsc->sc_dev.dv_cfdata->cf_flags & 1) && - !(vsc->sc_child->dv_cfdata->cf_flags & 1)) { + if (!(vsc->sc_dev.dv_cfdata->cf_flags & VIRTIO_CF_NO_INDIRECT) && + !(vsc->sc_child->dv_cfdata->cf_flags & VIRTIO_CF_NO_INDIRECT)) { guest_features |= VIRTIO_F_RING_INDIRECT_DESC; } else { printf("RingIndirectDesc disabled by UKC\n"); diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c index 28658380507..c3f472e1ce0 100644 --- a/sys/dev/pv/if_vio.c +++ b/sys/dev/pv/if_vio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vio.c,v 1.7 2019/01/08 16:23:01 sf Exp $ */ +/* $OpenBSD: if_vio.c,v 1.8 2019/01/19 16:23:46 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. @@ -531,8 +531,8 @@ vio_attach(struct device *parent, struct device *self, void *aux) * VIRTIO_F_RING_EVENT_IDX can be switched off by setting bit 2 in the * driver flags, see config(8) */ - if (!(sc->sc_dev.dv_cfdata->cf_flags & 2) && - !(vsc->sc_dev.dv_cfdata->cf_flags & 2)) + if (!(sc->sc_dev.dv_cfdata->cf_flags & VIRTIO_CF_NO_EVENT_IDX) && + !(vsc->sc_dev.dv_cfdata->cf_flags & VIRTIO_CF_NO_EVENT_IDX)) features |= VIRTIO_F_RING_EVENT_IDX; else printf(": RingEventIdx disabled by UKC"); diff --git a/sys/dev/pv/virtiovar.h b/sys/dev/pv/virtiovar.h index 0c353a8f177..87f7bcfa627 100644 --- a/sys/dev/pv/virtiovar.h +++ b/sys/dev/pv/virtiovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: virtiovar.h,v 1.9 2019/01/10 18:06:56 sf Exp $ */ +/* $OpenBSD: virtiovar.h,v 1.10 2019/01/19 16:23:46 sf Exp $ */ /* $NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */ /* @@ -79,6 +79,10 @@ #define VIRTIO_DEBUG 0 #endif +/* flags for config(8) */ +#define VIRTIO_CF_NO_INDIRECT 1 +#define VIRTIO_CF_NO_EVENT_IDX 2 + struct vq_entry { SLIST_ENTRY(vq_entry) qe_list; /* free list */ uint16_t qe_index; /* index in vq_desc array */ |