diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2016-01-15 18:20:42 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2016-01-15 18:20:42 +0000 |
commit | 2c066c3027d165ca891899d9ea76efec9f73f294 (patch) | |
tree | 4bdc6c52f138d8e2185faee66a21c84f625594b8 /sys | |
parent | 539440461665d91b11f55381ab2b6962f718fcc3 (diff) |
Cleanup dmesg output, disable debugging; prodding and suggestions from reyk@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pv/xen.c | 78 | ||||
-rw-r--r-- | sys/dev/pv/xenstore.c | 18 | ||||
-rw-r--r-- | sys/dev/pv/xenvar.h | 4 |
3 files changed, 27 insertions, 73 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c index 51b47eed52f..747d21a6828 100644 --- a/sys/dev/pv/xen.c +++ b/sys/dev/pv/xen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xen.c,v 1.27 2016/01/15 14:27:08 mikeb Exp $ */ +/* $OpenBSD: xen.c,v 1.28 2016/01/15 18:20:41 mikeb Exp $ */ /* * Copyright (c) 2015 Mike Belopuhov @@ -39,7 +39,6 @@ struct xen_softc *xen_sc; int xen_init_hypercall(struct xen_softc *); -int xen_getversion(struct xen_softc *); int xen_getfeatures(struct xen_softc *); int xen_init_info_page(struct xen_softc *); int xen_init_cbvec(struct xen_softc *); @@ -119,16 +118,12 @@ xen_attach(struct device *parent, struct device *self, void *aux) sc->sc_base = hv->hv_base; - printf("\n"); - if (xen_init_hypercall(sc)) return; /* Wire it up to the global */ xen_sc = sc; - if (xen_getversion(sc)) - return; if (xen_getfeatures(sc)) return; @@ -199,23 +194,18 @@ xen_init_hypercall(struct xen_softc *sc) /* We don't support more than one hypercall page */ if (regs[0] != 1) { - printf("%s: requested %d hypercall pages\n", - sc->sc_dev.dv_xname, regs[0]); + printf(": requested %d hypercall pages\n", regs[0]); return (-1); } sc->sc_hc = &xen_hypercall_page; if (!pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_hc, &pa)) { - printf("%s: hypercall page PA extraction failed\n", - sc->sc_dev.dv_xname); + printf(": hypercall page PA extraction failed\n"); return (-1); } wrmsr(regs[1], pa); - DPRINTF("%s: hypercall page at va %p pa %#lx\n", sc->sc_dev.dv_xname, - sc->sc_hc, pa); - return (0); } @@ -360,44 +350,23 @@ xen_hypercallv(struct xen_softc *sc, int op, int argc, ulong *argv) } int -xen_getversion(struct xen_softc *sc) -{ - char buf[16]; - int version; - ulong argv[2] = { XENVER_extraversion, (ulong)&buf[0] }; - int argc = 2; - - memset(buf, 0, sizeof(buf)); - if ((version = xen_hypercall(sc, XC_VERSION, 1, XENVER_version)) < 0) { - printf("%s: failed to fetch version\n", sc->sc_dev.dv_xname); - return (-1); - } - if (xen_hypercallv(sc, XC_VERSION, argc, argv) < 0) { - printf("%s: failed to fetch extended version\n", - sc->sc_dev.dv_xname); - return (-1); - } - printf("%s: version %d.%d%s\n", sc->sc_dev.dv_xname, - version >> 16, version & 0xffff, buf); - return (0); -} - -int xen_getfeatures(struct xen_softc *sc) { struct xen_feature_info xfi; - ulong argv[2] = { XENVER_get_features, (ulong)&xfi }; - int argc = 2; memset(&xfi, 0, sizeof(xfi)); - if (xen_hypercallv(sc, XC_VERSION, argc, argv) < 0) { - printf("%s: failed to fetch features\n", sc->sc_dev.dv_xname); + if (xen_hypercall(sc, XC_VERSION, 2, XENVER_get_features, &xfi) < 0) { + printf(": failed to fetch features\n"); return (-1); } sc->sc_features = xfi.submap; - printf("%s: features %b\n", sc->sc_dev.dv_xname, sc->sc_features, +#ifdef XEN_DEBUG + printf(": features %b", sc->sc_features, "\20\014DOM0\013PIRQ\012PVCLOCK\011CBVEC\010GNTFLAGS\007HMA" "\006PTUPD\005PAE4G\004SUPERVISOR\003AUTOPMAP\002WDT\001WPT"); +#else + printf(": features %#x", sc->sc_features); +#endif return (0); } @@ -454,13 +423,11 @@ xen_init_info_page(struct xen_softc *sc) sc->sc_ipg = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_ipg == NULL) { - printf("%s: failed to allocate shared info page\n", - sc->sc_dev.dv_xname); + printf(": failed to allocate shared info page\n"); return (-1); } if (!pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_ipg, &pa)) { - printf("%s: shared info page PA extraction failed\n", - sc->sc_dev.dv_xname); + printf(": shared info page PA extraction failed\n"); free(sc->sc_ipg, M_DEVBUF, PAGE_SIZE); return (-1); } @@ -469,13 +436,10 @@ xen_init_info_page(struct xen_softc *sc) xatp.space = XENMAPSPACE_shared_info; xatp.gpfn = atop(pa); if (xen_hypercall(sc, XC_MEMORY, 2, XENMEM_add_to_physmap, &xatp)) { - printf("%s: failed to register shared info page\n", - sc->sc_dev.dv_xname); + printf(": failed to register shared info page\n"); free(sc->sc_ipg, M_DEVBUF, PAGE_SIZE); return (-1); } - DPRINTF("%s: shared info page at va %p pa %#lx\n", sc->sc_dev.dv_xname, - sc->sc_ipg, pa); return (0); } @@ -494,8 +458,7 @@ xen_init_cbvec(struct xen_softc *sc) /* Will retry with the xspd(4) PCI interrupt */ return (ENOENT); } - DPRINTF("%s: registered callback IDT vector %d\n", - sc->sc_dev.dv_xname, LAPIC_XEN_VECTOR); + DPRINTF(", idtvec %d", LAPIC_XEN_VECTOR); sc->sc_flags |= XSF_CBVEC; @@ -781,13 +744,12 @@ xen_init_grant_tables(struct xen_softc *sc) gqs.dom = DOMID_SELF; if (xen_hypercall(sc, XC_GNTTAB, 3, GNTTABOP_query_size, &gqs, 1)) { - printf("%s: failed the query for grant table pages\n", - sc->sc_dev.dv_xname); + printf(": failed the query for grant table pages\n"); return (-1); } if (gqs.nr_frames == 0 || gqs.nr_frames > gqs.max_nr_frames) { - printf("%s: invalid number of grant table pages: %u/%u\n", - sc->sc_dev.dv_xname, gqs.nr_frames, gqs.max_nr_frames); + printf(": invalid number of grant table pages: %u/%u\n", + gqs.nr_frames, gqs.max_nr_frames); return (-1); } @@ -796,8 +758,7 @@ xen_init_grant_tables(struct xen_softc *sc) if (xen_hypercall(sc, XC_GNTTAB, 3, GNTTABOP_set_version, &gsv, 1) || xen_hypercall(sc, XC_GNTTAB, 3, GNTTABOP_get_version, &ggv, 1) || ggv.version != 1) { - printf("%s: failed to set grant tables API version\n", - sc->sc_dev.dv_xname); + printf(": failed to set grant tables API version\n"); return (-1); } @@ -807,8 +768,7 @@ xen_init_grant_tables(struct xen_softc *sc) if (xen_grant_table_grow(sc) == NULL) break; - DPRINTF("%s: grant table frames allocated %u/%u\n", - sc->sc_dev.dv_xname, sc->sc_gntcnt, gqs.max_nr_frames); + printf(", %u grant table frames", sc->sc_gntcnt); xen_bus_dma_init(sc); diff --git a/sys/dev/pv/xenstore.c b/sys/dev/pv/xenstore.c index 9b844398026..48548d47e4a 100644 --- a/sys/dev/pv/xenstore.c +++ b/sys/dev/pv/xenstore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xenstore.c,v 1.17 2016/01/12 12:12:05 mikeb Exp $ */ +/* $OpenBSD: xenstore.c,v 1.18 2016/01/15 18:20:41 mikeb Exp $ */ /* * Copyright (c) 2015 Mike Belopuhov @@ -177,8 +177,7 @@ xs_attach(struct xen_softc *sc) int i; if ((xs = malloc(sizeof(*xs), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { - printf("%s: failed to allocate xenstore softc\n", - sc->sc_dev.dv_xname); + printf(": failed to allocate xenstore softc\n"); return (-1); } sc->sc_xs = xs; @@ -188,12 +187,13 @@ xs_attach(struct xen_softc *sc) memset(&xhv, 0, sizeof(xhv)); xhv.domid = DOMID_SELF; xhv.index = HVM_PARAM_STORE_EVTCHN; - if (xen_hypercall(sc, XC_HVM, 2, HVMOP_get_param, &xhv)) + if (xen_hypercall(sc, XC_HVM, 2, HVMOP_get_param, &xhv)) { + printf(": failed to obtain a xenstore event channel\n"); goto fail_1; + } xs->xs_port = xhv.value; - DPRINTF("%s: xenstore event channel %d\n", sc->sc_dev.dv_xname, - xs->xs_port); + printf(", event channel %d\n", xs->xs_port); /* Fetch a frame number (PA) of a shared xenstore page */ memset(&xhv, 0, sizeof(xhv)); @@ -211,15 +211,9 @@ xs_attach(struct xen_softc *sc) pmap_kenter_pa((vaddr_t)xs->xs_ring, pa, PROT_READ | PROT_WRITE); pmap_update(pmap_kernel()); - DPRINTF("%s: xenstore ring at va %p pa %#lx\n", sc->sc_dev.dv_xname, - xs->xs_ring, pa & ~PMAP_NOCACHE); - if (xen_intr_establish(xs->xs_port, &xs->xs_ih, xs_intr, xs, "xs0")) goto fail_2; - DPRINTF("%s: xenstore interrupt established for port %d\n", - sc->sc_dev.dv_xname, xs->xs_ih); - xs->xs_wchan = "xswrite"; xs->xs_rchan = "xsread"; diff --git a/sys/dev/pv/xenvar.h b/sys/dev/pv/xenvar.h index ef599b6e159..d72d930e175 100644 --- a/sys/dev/pv/xenvar.h +++ b/sys/dev/pv/xenvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xenvar.h,v 1.20 2016/01/15 14:27:08 mikeb Exp $ */ +/* $OpenBSD: xenvar.h,v 1.21 2016/01/15 18:20:41 mikeb Exp $ */ /* * Copyright (c) 2015 Mike Belopuhov @@ -19,7 +19,7 @@ #ifndef _XENVAR_H_ #define _XENVAR_H_ -#define XEN_DEBUG +/* #define XEN_DEBUG */ #ifdef XEN_DEBUG #define DPRINTF(x...) printf(x) |