summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2016-04-19 13:55:20 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2016-04-19 13:55:20 +0000
commit984e1d98a337bc7e4809cb61ebd60abfbf88b774 (patch)
tree9ab664f8d371fffe47dfd6380c37e21b8b34c28e
parent02487e6d12461ba9dc1a743d1fcc2ee19263715a (diff)
Pass down the backend-id property to children in the attach arguments
and pick it up in xnf(4) and print it in the dmesg line for now. We'll need to pass it down to the Grant Table code.
-rw-r--r--sys/dev/pv/if_xnf.c8
-rw-r--r--sys/dev/pv/xen.c24
-rw-r--r--sys/dev/pv/xenvar.h3
3 files changed, 29 insertions, 6 deletions
diff --git a/sys/dev/pv/if_xnf.c b/sys/dev/pv/if_xnf.c
index 4f23c6fe616..3bd471febc4 100644
--- a/sys/dev/pv/if_xnf.c
+++ b/sys/dev/pv/if_xnf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xnf.c,v 1.19 2016/04/19 12:39:31 mikeb Exp $ */
+/* $OpenBSD: if_xnf.c,v 1.20 2016/04/19 13:55:19 mikeb Exp $ */
/*
* Copyright (c) 2015, 2016 Mike Belopuhov
@@ -152,6 +152,7 @@ struct xnf_softc {
struct xen_attach_args sc_xa;
struct xen_softc *sc_xen;
bus_dma_tag_t sc_dmat;
+ int sc_domid;
struct arpcom sc_ac;
struct ifmedia sc_media;
@@ -243,6 +244,7 @@ xnf_attach(struct device *parent, struct device *self, void *aux)
sc->sc_xa = *xa;
sc->sc_xen = xa->xa_parent;
sc->sc_dmat = xa->xa_dmat;
+ sc->sc_domid = xa->xa_domid;
strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
@@ -257,8 +259,8 @@ xnf_attach(struct device *parent, struct device *self, void *aux)
}
xen_intr_mask(sc->sc_xih);
- printf(": event channel %u, address %s\n", sc->sc_xih,
- ether_sprintf(sc->sc_ac.ac_enaddr));
+ printf(": backend %d, event channel %u, address %s\n", sc->sc_domid,
+ sc->sc_xih, ether_sprintf(sc->sc_ac.ac_enaddr));
if (xnf_capabilities(sc)) {
xen_intr_disestablish(sc->sc_xih);
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c
index d5d0a5523b3..6f57daa490a 100644
--- a/sys/dev/pv/xen.c
+++ b/sys/dev/pv/xen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xen.c,v 1.52 2016/04/19 12:39:31 mikeb Exp $ */
+/* $OpenBSD: xen.c,v 1.53 2016/04/19 13:55:19 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -1221,6 +1221,19 @@ xen_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t addr,
}
static int
+atoi(char *cp, int *res)
+{
+ *res = 0;
+ do {
+ if (*cp < '0' || *cp > '9')
+ return (-1);
+ *res *= 10;
+ *res += *cp - '0';
+ } while (*(++cp) != '\0');
+ return (0);
+}
+
+static int
xen_attach_print(void *aux, const char *name)
{
struct xen_attach_args *xa = aux;
@@ -1238,6 +1251,7 @@ xen_probe_devices(struct xen_softc *sc)
struct xs_transaction xst;
struct iovec *iovp1 = NULL, *iovp2 = NULL;
int i, j, error = 0, iov1_cnt = 0, iov2_cnt = 0;
+ char domid[16];
char path[256];
memset(&xst, 0, sizeof(xst));
@@ -1266,11 +1280,17 @@ xen_probe_devices(struct xen_softc *sc)
snprintf(xa.xa_node, sizeof(xa.xa_node), "device/%s/%s",
(char *)iovp1[i].iov_base,
(char *)iovp2[j].iov_base);
- if (xs_getprop(sc, xa.xa_node, "backend", xa.xa_backend,
+ if (xs_getprop(sc, xa.xa_node, "backend-id", domid,
+ sizeof(domid)) ||
+ xs_getprop(sc, xa.xa_node, "backend", xa.xa_backend,
sizeof(xa.xa_backend))) {
printf("%s: failed to identify \"backend\" "
"for \"%s\"\n", sc->sc_dev.dv_xname,
xa.xa_node);
+ } else if (atoi(domid, &xa.xa_domid)) {
+ printf("%s: non-numeric backend domain id "
+ "\"%s\" for \"%s\"\n", sc->sc_dev.dv_xname,
+ domid, xa.xa_node);
}
config_found((struct device *)sc, &xa,
xen_attach_print);
diff --git a/sys/dev/pv/xenvar.h b/sys/dev/pv/xenvar.h
index afd60063045..f5ca5491822 100644
--- a/sys/dev/pv/xenvar.h
+++ b/sys/dev/pv/xenvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xenvar.h,v 1.30 2016/04/19 12:39:31 mikeb Exp $ */
+/* $OpenBSD: xenvar.h,v 1.31 2016/04/19 13:55:19 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -89,6 +89,7 @@ struct xen_attach_args {
char xa_name[16];
char xa_node[64];
char xa_backend[128];
+ int xa_domid;
bus_dma_tag_t xa_dmat;
};