summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2015-12-21 18:17:37 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2015-12-21 18:17:37 +0000
commit932fc7e63cf867956c5bc5e85dcf052c6ac41a8b (patch)
tree78c1081b3d8ed3e271716894bf28e9eb21dcb62a
parentb3e95ceff30e2fed20e3c3f788ec7f1b60548973 (diff)
Cleanup hypercall subsystem type defines
-rw-r--r--sys/dev/pci/xspd.c4
-rw-r--r--sys/dev/pv/xen.c24
-rw-r--r--sys/dev/pv/xenstore.c6
-rw-r--r--sys/dev/pv/xenvar.h11
4 files changed, 23 insertions, 22 deletions
diff --git a/sys/dev/pci/xspd.c b/sys/dev/pci/xspd.c
index eb7eb5b3c25..47a703bfb59 100644
--- a/sys/dev/pci/xspd.c
+++ b/sys/dev/pci/xspd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xspd.c,v 1.2 2015/12/12 21:09:20 reyk Exp $ */
+/* $OpenBSD: xspd.c,v 1.3 2015/12/21 18:17:36 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -101,7 +101,7 @@ xspd_attach(struct device *parent, struct device *self, void *aux)
else
xhp.value = HVM_CALLBACK_GSI(pci_intr_line(pa->pa_pc, ih));
- if (xen_hypercall(xen_sc, hvm_op, 2, HVMOP_set_param, &xhp)) {
+ if (xen_hypercall(xen_sc, XC_HVM, 2, HVMOP_set_param, &xhp)) {
printf("%s: failed to register callback PCI vector\n",
sc->sc_dev.dv_xname);
pci_intr_disestablish(pa->pa_pc, sc->sc_ih);
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c
index b1e692ecd3a..2a93d5d07ec 100644
--- a/sys/dev/pv/xen.c
+++ b/sys/dev/pv/xen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xen.c,v 1.16 2015/12/21 18:13:44 mikeb Exp $ */
+/* $OpenBSD: xen.c,v 1.17 2015/12/21 18:17:36 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -329,11 +329,11 @@ xen_getversion(struct xen_softc *sc)
int argc = 2;
memset(buf, 0, sizeof(buf));
- if ((version = xen_hypercall(sc, xen_version, 1, XENVER_version)) < 0) {
+ 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, xen_version, argc, argv) < 0) {
+ if (xen_hypercallv(sc, XC_VERSION, argc, argv) < 0) {
printf("%s: failed to fetch extended version\n",
sc->sc_dev.dv_xname);
return (-1);
@@ -351,7 +351,7 @@ xen_getfeatures(struct xen_softc *sc)
int argc = 2;
memset(&xfi, 0, sizeof(xfi));
- if (xen_hypercallv(sc, xen_version, argc, argv) < 0) {
+ if (xen_hypercallv(sc, XC_VERSION, argc, argv) < 0) {
printf("%s: failed to fetch features\n", sc->sc_dev.dv_xname);
return (-1);
}
@@ -429,7 +429,7 @@ xen_init_info_page(struct xen_softc *sc)
xatp.idx = 0;
xatp.space = XENMAPSPACE_shared_info;
xatp.gpfn = atop(pa);
- if (xen_hypercall(sc, memory_op, 2, XENMEM_add_to_physmap, &xatp)) {
+ 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);
free(sc->sc_ipg, M_DEVBUF, PAGE_SIZE);
@@ -451,7 +451,7 @@ xen_init_cbvec(struct xen_softc *sc)
xhp.domid = DOMID_SELF;
xhp.index = HVM_PARAM_CALLBACK_IRQ;
xhp.value = HVM_CALLBACK_VECTOR(LAPIC_XEN_VECTOR);
- if (xen_hypercall(sc, hvm_op, 2, HVMOP_set_param, &xhp)) {
+ if (xen_hypercall(sc, XC_HVM, 2, HVMOP_set_param, &xhp)) {
/* Will retry with the xspd(4) PCI interrupt */
return (ENOENT);
}
@@ -552,7 +552,7 @@ xen_intr_signal(xen_intr_handle_t xih)
if ((xi = xen_lookup_intsrc(sc, (evtchn_port_t)xih)) != NULL) {
es.port = xi->xi_port;
- xen_hypercall(sc, event_channel_op, 2, EVTCHNOP_send, &es);
+ xen_hypercall(sc, XC_EVTCHN, 2, EVTCHNOP_send, &es);
}
}
@@ -588,7 +588,7 @@ xen_intr_establish(evtchn_port_t port, xen_intr_handle_t *xih,
/* We're being asked to allocate a new event port */
memset(&eau, 0, sizeof(eau));
eau.dom = DOMID_SELF;
- if (xen_hypercall(sc, event_channel_op, 2,
+ if (xen_hypercall(sc, XC_EVTCHN, 2,
EVTCHNOP_alloc_unbound, &eau) != 0) {
DPRINTF("%s: failed to allocate new event port\n",
sc->sc_dev.dv_xname);
@@ -610,7 +610,7 @@ xen_intr_establish(evtchn_port_t port, xen_intr_handle_t *xih,
memset(&ebv, 0, sizeof(ebv));
ebv.port = xi->xi_port;
ebv.vcpu = 0;
- if (xen_hypercall(sc, event_channel_op, 2, EVTCHNOP_bind_vcpu, &ebv)) {
+ if (xen_hypercall(sc, XC_EVTCHN, 2, EVTCHNOP_bind_vcpu, &ebv)) {
printf("%s: failed to bind interrupt on port %u to vcpu%d\n",
sc->sc_dev.dv_xname, ebv.port, ebv.vcpu);
}
@@ -624,7 +624,7 @@ xen_intr_establish(evtchn_port_t port, xen_intr_handle_t *xih,
memset(&es, 0, sizeof(es));
es.dom = DOMID_SELF;
es.port = xi->xi_port;
- if (xen_hypercall(sc, event_channel_op, 2, EVTCHNOP_status, &es)) {
+ if (xen_hypercall(sc, XC_EVTCHN, 2, EVTCHNOP_status, &es)) {
printf("%s: failed to obtain status for port %d\n",
sc->sc_dev.dv_xname, es.port);
}
@@ -667,7 +667,7 @@ xen_intr_disestablish(xen_intr_handle_t xih)
if (!xi->xi_noclose) {
ec.port = xi->xi_port;
- if (xen_hypercall(sc, event_channel_op, 2, EVTCHNOP_close,
+ if (xen_hypercall(sc, XC_EVTCHN, 2, EVTCHNOP_close,
&ec)) {
DPRINTF("%s: failed to close event port %u\n",
sc->sc_dev.dv_xname, xi->xi_port);
@@ -688,7 +688,7 @@ xen_intr_enable(void)
SLIST_FOREACH(xi, &sc->sc_intrs, xi_entry) {
if (!xi->xi_masked) {
eu.port = xi->xi_port;
- if (xen_hypercall(sc, event_channel_op, 2,
+ if (xen_hypercall(sc, XC_EVTCHN, 2,
EVTCHNOP_unmask, &eu) ||
isset(sc->sc_ipg->evtchn_mask, xi->xi_port))
printf("%s: unmasking port %u failed\n",
diff --git a/sys/dev/pv/xenstore.c b/sys/dev/pv/xenstore.c
index 9af70ec5f2c..53e67283cc4 100644
--- a/sys/dev/pv/xenstore.c
+++ b/sys/dev/pv/xenstore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xenstore.c,v 1.8 2015/12/19 09:12:29 mikeb Exp $ */
+/* $OpenBSD: xenstore.c,v 1.9 2015/12/21 18:17:36 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -185,7 +185,7 @@ 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, hvm_op, 2, HVMOP_get_param, &xhv))
+ if (xen_hypercall(sc, XC_HVM, 2, HVMOP_get_param, &xhv))
goto fail_1;
xs->xs_port = xhv.value;
@@ -196,7 +196,7 @@ xs_attach(struct xen_softc *sc)
memset(&xhv, 0, sizeof(xhv));
xhv.domid = DOMID_SELF;
xhv.index = HVM_PARAM_STORE_PFN;
- if (xen_hypercall(sc, hvm_op, 2, HVMOP_get_param, &xhv))
+ if (xen_hypercall(sc, XC_HVM, 2, HVMOP_get_param, &xhv))
goto fail_1;
pa = ptoa(xhv.value);
/* Allocate a page of virtual memory */
diff --git a/sys/dev/pv/xenvar.h b/sys/dev/pv/xenvar.h
index bb07c772958..4d306ba68f4 100644
--- a/sys/dev/pv/xenvar.h
+++ b/sys/dev/pv/xenvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xenvar.h,v 1.13 2015/12/19 09:12:29 mikeb Exp $ */
+/* $OpenBSD: xenvar.h,v 1.14 2015/12/21 18:17:36 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -69,10 +69,11 @@ struct xen_attach_args {
/*
* Hypercalls
*/
-#define memory_op 12
-#define xen_version 17
-#define event_channel_op 32
-#define hvm_op 34
+#define XC_MEMORY 12
+#define XC_VERSION 17
+#define XC_GNTTAB 20
+#define XC_EVTCHN 32
+#define XC_HVM 34
int xen_hypercall(struct xen_softc *, int, int, ...);
int xen_hypercallv(struct xen_softc *, int, int, ulong *);