summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/vmbus/vmbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/hyperv/vmbus/vmbus.c')
-rw-r--r--sys/dev/hyperv/vmbus/vmbus.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c
index a2d807d..7e7439d 100644
--- a/sys/dev/hyperv/vmbus/vmbus.c
+++ b/sys/dev/hyperv/vmbus/vmbus.c
@@ -1212,6 +1212,9 @@ vmbus_doattach(struct vmbus_softc *sc)
sc->vmbus_gpadl = VMBUS_GPADL_START;
mtx_init(&sc->vmbus_chlist_lock, "vmbus chlist", NULL, MTX_DEF);
TAILQ_INIT(&sc->vmbus_chlist);
+ sc->vmbus_chmap = malloc(
+ sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX, M_DEVBUF,
+ M_WAITOK | M_ZERO);
/*
* Create context for "post message" Hypercalls
@@ -1246,12 +1249,8 @@ vmbus_doattach(struct vmbus_softc *sc)
sc->vmbus_flags |= VMBUS_FLAG_SYNIC;
/*
- * Connect to VMBus in the root partition
+ * Initialize vmbus, e.g. connect to Hypervisor.
*/
- ret = hv_vmbus_connect(sc);
- if (ret != 0)
- goto cleanup;
-
ret = vmbus_init(sc);
if (ret != 0)
goto cleanup;
@@ -1281,7 +1280,9 @@ cleanup:
vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc);
sc->vmbus_msg_hc = NULL;
}
+ free(sc->vmbus_chmap, M_DEVBUF);
mtx_destroy(&sc->vmbus_scan_lock);
+ mtx_destroy(&sc->vmbus_chlist_lock);
return (ret);
}
@@ -1342,7 +1343,6 @@ vmbus_detach(device_t dev)
hv_vmbus_release_unattached_channels(sc);
vmbus_disconnect(sc);
- hv_vmbus_disconnect();
if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) {
sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC;
@@ -1357,7 +1357,10 @@ vmbus_detach(device_t dev)
sc->vmbus_msg_hc = NULL;
}
+ free(sc->vmbus_chmap, M_DEVBUF);
mtx_destroy(&sc->vmbus_scan_lock);
+ mtx_destroy(&sc->vmbus_chlist_lock);
+
return (0);
}
OpenPOWER on IntegriCloud