-/* $OpenBSD: if_vio.c,v 1.2 2017/01/22 10:17:39 dlg Exp $ */
+/* $OpenBSD: if_vio.c,v 1.3 2017/05/30 17:47:11 krw Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
#endif
#if VIRTIO_DEBUG
-#define DBGPRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(x...) printf(x)
#else
-#define DBGPRINT(fmt, args...)
+#define DPRINTF(x...)
#endif
/*
}
}
if (m0 != NULL) {
- DBGPRINT("expected %d buffers, got %d", (int)hdr->num_buffers,
+ DPRINTF("%s: expected %d buffers, got %d\n", __func__,
+ (int)hdr->num_buffers,
(int)hdr->num_buffers - bufs_left);
ifp->if_ierrors++;
m_freem(m0);
r = EIO;
}
- DBGPRINT("cmd %d %d: %d", cmd, (int)onoff, r);
+ DPRINTF("%s: cmd %d %d: %d\n", __func__, cmd, (int)onoff, r);
out:
vio_ctrl_wakeup(sc, FREE);
return r;
-/* $OpenBSD: vioblk.c,v 1.5 2017/05/30 12:47:47 krw Exp $ */
+/* $OpenBSD: vioblk.c,v 1.6 2017/05/30 17:47:11 krw Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch.
}
#if VIRTIO_DEBUG > 0
-#define DBGPRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(x...) printf(x)
#else
-#define DBGPRINT(fmt, args...) do {} while (0)
+#define DPRINTF(x...) do {} while (0)
#endif
void
sc->sc_link.adapter_buswidth = 2;
sc->sc_link.luns = 1;
sc->sc_link.adapter_target = 2;
- DBGPRINT("; qsize: %d", qsize);
+ DPRINTF("%s: qsize: %d\n", __func__, qsize);
if (features & VIRTIO_BLK_F_RO)
sc->sc_link.flags |= SDEV_READONLY;
SLIST_REMOVE_HEAD(&sc->sc_freelist, vr_list);
mtx_leave(&sc->sc_vr_mtx);
- DBGPRINT("vioblk_req_get: %p\n", vr);
+ DPRINTF("%s: %p\n", __func__, vr);
return vr;
}
struct vioblk_softc *sc = cookie;
struct virtio_blk_req *vr = io;
- DBGPRINT("vioblk_req_put: %p\n", vr);
+ DPRINTF("%s: %p\n", __func__, vr);
mtx_enter(&sc->sc_vr_mtx);
/*
if (vr->vr_status != VIRTIO_BLK_S_OK) {
- DBGPRINT("EIO");
+ DPRINTF("%s: EIO\n", __func__);
xs->error = XS_DRIVER_STUFFUP;
xs->resid = xs->datalen;
} else {
*/
vd = &vq->vq_desc[slot];
for (r = 0; r < ALLOC_SEGS - 1; r++) {
- DBGPRINT("vd[%d].next = %d should be %d\n",
- r, vd[r].next, (slot + r + 1));
+ DPRINTF("%s: vd[%d].next = %d should be %d\n",
+ __func__, r, vd[r].next, (slot + r + 1));
if (vd[r].next != (slot + r + 1))
return i;
}
if (r == (ALLOC_SEGS -1) && vd[r].next != 0)
return i;
- DBGPRINT("Reserved slots are contiguous as required!\n");
+ DPRINTF("%s: reserved slots are contiguous (good!)\n",
+ __func__);
}
vr->vr_qe_index = slot;
-/* $OpenBSD: viocon.c,v 1.1 2017/01/21 11:22:38 reyk Exp $ */
+/* $OpenBSD: viocon.c,v 1.2 2017/05/30 17:47:11 krw Exp $ */
/*
* Copyright (c) 2013-2015 Stefan Fritsch <sf@sfritsch.de>
#define VIOCON_DEBUG 0
#if VIOCON_DEBUG
-#define DBGPRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
+#define DPRINTF(x...) printf(x)
#else
-#define DBGPRINT(fmt, args...)
+#define DPRINTF(x...)
#endif
struct virtio_feature_name viocon_feature_names[] = {
viocon_feature_names);
printf("\n");
- DBGPRINT("softc: %p\n", sc);
+ DPRINTF("%s: softc: %p\n", __func__, sc);
if (viocon_port_create(sc, 0) != 0) {
printf("\n%s: viocon_port_create failed\n", __func__);
goto err;
return ENOMEM;
sc->sc_ports[portidx] = vp;
vp->vp_sc = sc;
- DBGPRINT("vp: %p\n", vp);
+ DPRINTF("%s: vp: %p\n", __func__, vp);
if (portidx == 0)
rxidx = 0;
vp->vp_rx = &vsc->sc_vqs[rxidx];
vp->vp_rx->vq_done = viocon_rx_intr;
vp->vp_si = softintr_establish(IPL_TTY, viocon_rx_soft, vp);
- DBGPRINT("rx: %p\n", vp->vp_rx);
+ DPRINTF("%s: rx: %p\n", __func__, vp->vp_rx);
snprintf(name, sizeof(name), "p%dtx", portidx);
if (virtio_alloc_vq(vsc, &vsc->sc_vqs[txidx], txidx, BUFSIZE, 1,
}
vp->vp_tx = &vsc->sc_vqs[txidx];
vp->vp_tx->vq_done = viocon_tx_intr;
- DBGPRINT("tx: %p\n", vp->vp_tx);
+ DPRINTF("%s: tx: %p\n", __func__, vp->vp_tx);
vsc->sc_nvqs += 2;
tp->t_hwiflow = vioconhwiflow;
tp->t_dev = (sc->sc_dev.dv_unit << 4) | portidx;
vp->vp_tty = tp;
- DBGPRINT("tty: %p\n", tp);
+ DPRINTF("%s: tty: %p\n", __func__, tp);
virtio_start_vq_intr(vsc, vp->vp_rx);
virtio_start_vq_intr(vsc, vp->vp_tx);