summaryrefslogtreecommitdiffstats
path: root/sys/dev/pv/xen.c
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2016-04-19 13:55:19 +0000
committermikeb <mikeb@openbsd.org>2016-04-19 13:55:19 +0000
commit53d54b96febfc0b867b23132bd94b5429ec0a817 (patch)
tree0fb4708247c4d1537055d86ae45240acd6e5969f /sys/dev/pv/xen.c
parentRemove the ds_offset hack since object offset within a page (diff)
downloadwireguard-openbsd-53d54b96febfc0b867b23132bd94b5429ec0a817.tar.xz
wireguard-openbsd-53d54b96febfc0b867b23132bd94b5429ec0a817.zip
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.
Diffstat (limited to 'sys/dev/pv/xen.c')
-rw-r--r--sys/dev/pv/xen.c24
1 files changed, 22 insertions, 2 deletions
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);