Module Name: src Committed By: christos Date: Tue Oct 27 16:04:19 UTC 2015
Modified Files: src/sys/dev/pci: viomb.c viornd.c Log Message: Print the negotiated feature bits To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/viomb.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/viornd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/viomb.c diff -u src/sys/dev/pci/viomb.c:1.4 src/sys/dev/pci/viomb.c:1.5 --- src/sys/dev/pci/viomb.c:1.4 Mon May 4 10:02:13 2015 +++ src/sys/dev/pci/viomb.c Tue Oct 27 12:04:19 2015 @@ -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. #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 s 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 s 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 s 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) || Index: src/sys/dev/pci/viornd.c diff -u src/sys/dev/pci/viornd.c:1.8 src/sys/dev/pci/viornd.c:1.9 --- src/sys/dev/pci/viornd.c:1.8 Tue May 5 06:56:13 2015 +++ src/sys/dev/pci/viornd.c Tue Oct 27 12:04:19 2015 @@ -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 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 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);