Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/vmbus/vmbus.c
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
#define VMBUS_MSGHC_CTXF_DESTROY 0x0001 | #define VMBUS_MSGHC_CTXF_DESTROY 0x0001 | ||||
static int vmbus_init(struct vmbus_softc *); | static int vmbus_init(struct vmbus_softc *); | ||||
static int vmbus_init_contact(struct vmbus_softc *, | static int vmbus_init_contact(struct vmbus_softc *, | ||||
uint32_t); | uint32_t); | ||||
static int vmbus_req_channels(struct vmbus_softc *sc); | static int vmbus_req_channels(struct vmbus_softc *sc); | ||||
static void vmbus_uninit(struct vmbus_softc *); | |||||
static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); | static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); | ||||
static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); | static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); | ||||
static void vmbus_msghc_ctx_destroy( | static void vmbus_msghc_ctx_destroy( | ||||
struct vmbus_msghc_ctx *); | struct vmbus_msghc_ctx *); | ||||
static void vmbus_msghc_ctx_free(struct vmbus_msghc_ctx *); | static void vmbus_msghc_ctx_free(struct vmbus_msghc_ctx *); | ||||
static struct vmbus_msghc *vmbus_msghc_alloc(bus_dma_tag_t); | static struct vmbus_msghc *vmbus_msghc_alloc(bus_dma_tag_t); | ||||
▲ Show 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | if (!error) { | ||||
(hv_vmbus_protocal_version >> 16), | (hv_vmbus_protocal_version >> 16), | ||||
(hv_vmbus_protocal_version & 0xffff)); | (hv_vmbus_protocal_version & 0xffff)); | ||||
return 0; | return 0; | ||||
} | } | ||||
} | } | ||||
return ENXIO; | return ENXIO; | ||||
} | } | ||||
static void | |||||
vmbus_uninit(struct vmbus_softc *sc) | |||||
{ | |||||
struct vmbus_chanmsg_unload *req; | |||||
struct vmbus_msghc *mh; | |||||
int error; | |||||
mh = vmbus_msghc_get(sc, sizeof(*req)); | |||||
if (mh == NULL) { | |||||
device_printf(sc->vmbus_dev, | |||||
"can not get msg hypercall for unload\n"); | |||||
return; | |||||
} | |||||
req = vmbus_msghc_dataptr(mh); | |||||
req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_UNLOAD; | |||||
error = vmbus_msghc_exec_noresult(mh); | |||||
vmbus_msghc_put(sc, mh); | |||||
if (error) { | |||||
device_printf(sc->vmbus_dev, | |||||
"unload msg hypercall failed\n"); | |||||
} | |||||
} | |||||
static int | static int | ||||
vmbus_req_channels(struct vmbus_softc *sc) | vmbus_req_channels(struct vmbus_softc *sc) | ||||
{ | { | ||||
struct vmbus_chanmsg_channel_req *req; | struct vmbus_chanmsg_channel_req *req; | ||||
struct vmbus_msghc *mh; | struct vmbus_msghc *mh; | ||||
int error; | int error; | ||||
mh = vmbus_msghc_get(sc, sizeof(*req)); | mh = vmbus_msghc_get(sc, sizeof(*req)); | ||||
▲ Show 20 Lines • Show All 698 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static int | static int | ||||
vmbus_detach(device_t dev) | vmbus_detach(device_t dev) | ||||
{ | { | ||||
struct vmbus_softc *sc = device_get_softc(dev); | struct vmbus_softc *sc = device_get_softc(dev); | ||||
hv_vmbus_release_unattached_channels(); | hv_vmbus_release_unattached_channels(); | ||||
vmbus_uninit(sc); | |||||
hv_vmbus_disconnect(); | hv_vmbus_disconnect(); | ||||
if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { | if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { | ||||
sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC; | sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC; | ||||
smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); | smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); | ||||
} | } | ||||
vmbus_intr_teardown(sc); | vmbus_intr_teardown(sc); | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |