Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Print the negotiated feature bits



details:   https://anonhg.NetBSD.org/src/rev/0ee46553d4fe
branches:  trunk
changeset: 811384:0ee46553d4fe
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Oct 27 16:04:19 2015 +0000

description:
Print the negotiated feature bits

diffstat:

 sys/dev/pci/viomb.c  |  19 ++++++++++++++-----
 sys/dev/pci/viornd.c |   9 ++++++---
 2 files changed, 20 insertions(+), 8 deletions(-)

diffs (93 lines):

diff -r 50dcdd726a3a -r 0ee46553d4fe sys/dev/pci/viomb.c
--- a/sys/dev/pci/viomb.c       Tue Oct 27 16:04:05 2015 +0000
+++ b/sys/dev/pci/viomb.c       Tue Oct 27 16:04:19 2015 +0000
@@ -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 @@
 #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 @@
        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 @@
                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 @@
        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 -r 50dcdd726a3a -r 0ee46553d4fe sys/dev/pci/viornd.c
--- a/sys/dev/pci/viornd.c      Tue Oct 27 16:04:05 2015 +0000
+++ b/sys/dev/pci/viornd.c      Tue Oct 27 16:04:19 2015 +0000
@@ -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 @@
        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 @@
        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);
 



Home | Main Index | Thread Index | Old Index