summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2015-10-27 16:04:19 +0000
committerchristos <christos@NetBSD.org>2015-10-27 16:04:19 +0000
commitdb46a773104e32a690b22fcd0b2e7845d3eb29bb (patch)
treedbc96090fbe6f6f1a436eb52af697b2bda0c3aef /sys
parent9153afce541c7bf8812d5685fab0a3211c182222 (diff)
Print the negotiated feature bits
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/viomb.c19
-rw-r--r--sys/dev/pci/viornd.c9
2 files changed, 20 insertions, 8 deletions
diff --git a/sys/dev/pci/viomb.c b/sys/dev/pci/viomb.c
index dbff778c89a..c77b901be5a 100644
--- a/sys/dev/pci/viomb.c
+++ b/sys/dev/pci/viomb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: viomb.c,v 1.4 2015/05/04 14:02:13 ozaki-r Exp $ */
+/* $NetBSD: viomb.c,v 1.5 2015/10/27 16:04:19 christos Exp $ */
/*
* Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.4 2015/05/04 14:02:13 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.5 2015/10/27 16:04:19 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,6 +54,11 @@ __KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.4 2015/05/04 14:02:13 ozaki-r Exp $");
#define VIRTIO_BALLOON_F_MUST_TELL_HOST (1<<0)
#define VIRTIO_BALLOON_F_STATS_VQ (1<<1)
+#define VIRTIO_BALLOON_FLAG_BITS \
+ VIRTIO_COMMON_FLAG_BITS \
+ "\x02""STATS_VQ" \
+ "\x01""MUST_TELL_HOST"
+
#define PGS_PER_REQ (256) /* 1MB, 4KB/page */
CTASSERT((PAGE_SIZE) == (VIRTIO_PAGE_SIZE)); /* XXX */
@@ -118,6 +123,8 @@ viomb_attach(device_t parent, device_t self, void *aux)
struct viomb_softc *sc = device_private(self);
struct virtio_softc *vsc = device_private(parent);
const struct sysctlnode *node;
+ uint32_t features;
+ char buf[256];
if (vsc->sc_child != NULL) {
aprint_normal(": child already attached for %s; "
@@ -129,7 +136,6 @@ viomb_attach(device_t parent, device_t self, void *aux)
aprint_normal(": balloon already exists; something wrong...\n");
goto err_none;
}
- aprint_normal("\n");
sc->sc_dev = self;
sc->sc_virtio = vsc;
@@ -142,8 +148,11 @@ viomb_attach(device_t parent, device_t self, void *aux)
vsc->sc_intrhand = virtio_vq_intr;
vsc->sc_flags = 0;
- virtio_negotiate_features(vsc,
- VIRTIO_CONFIG_DEVICE_FEATURES);
+ features = virtio_negotiate_features(vsc,
+ VIRTIO_CONFIG_DEVICE_FEATURES);
+
+ snprintb(buf, sizeof(buf), VIRTIO_BALLOON_FLAG_BITS, features);
+ aprint_normal(": Features: %s\n", buf);
if ((virtio_alloc_vq(vsc, &sc->sc_vq[0], 0,
sizeof(uint32_t)*PGS_PER_REQ, 1,
"inflate") != 0) ||
diff --git a/sys/dev/pci/viornd.c b/sys/dev/pci/viornd.c
index c402ca96a71..62523841cfc 100644
--- a/sys/dev/pci/viornd.c
+++ b/sys/dev/pci/viornd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: viornd.c,v 1.8 2015/05/05 10:56:13 ozaki-r Exp $ */
+/* $NetBSD: viornd.c,v 1.9 2015/10/27 16:04:19 christos Exp $ */
/* $OpenBSD: viornd.c,v 1.1 2014/01/21 21:14:58 sf Exp $ */
/*
@@ -134,6 +134,8 @@ viornd_attach( device_t parent, device_t self, void *aux)
bus_dma_segment_t segs[1];
int nsegs;
int error;
+ uint32_t features;
+ char buf[256];
vsc->sc_vqs = &sc->sc_vq;
vsc->sc_nvqs = 1;
@@ -146,10 +148,11 @@ viornd_attach( device_t parent, device_t self, void *aux)
sc->sc_virtio = vsc;
sc->sc_dev = self;
- aprint_normal("\n");
+ features = virtio_negotiate_features(vsc, 0);
+ snprintb(buf, sizeof(buf), VIRTIO_COMMON_FLAG_BITS, features);
+ aprint_normal(": Features: %s\n", buf);
aprint_naive("\n");
- (void)virtio_negotiate_features(vsc, 0);
mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_VM);