Index: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c =================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c @@ -675,36 +675,6 @@ } /** - * @brief Send a request to get all our pending offers. - */ -int -hv_vmbus_request_channel_offers(void) -{ - int ret; - hv_vmbus_channel_msg_header* msg; - hv_vmbus_channel_msg_info* msg_info; - - msg_info = (hv_vmbus_channel_msg_info *) - malloc(sizeof(hv_vmbus_channel_msg_info) - + sizeof(hv_vmbus_channel_msg_header), M_DEVBUF, M_NOWAIT); - - if (msg_info == NULL) { - if(bootverbose) - printf("Error VMBUS: malloc failed for Request Offers\n"); - return (ENOMEM); - } - - msg = (hv_vmbus_channel_msg_header*) msg_info->msg; - msg->message_type = HV_CHANNEL_MESSAGE_REQUEST_OFFERS; - - ret = hv_vmbus_post_message(msg, sizeof(hv_vmbus_channel_msg_header)); - - free(msg_info, M_DEVBUF); - - return (ret); -} - -/** * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) */ void Index: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h =================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h @@ -397,7 +397,6 @@ hv_vmbus_channel* hv_vmbus_allocate_channel(void); void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); -int hv_vmbus_request_channel_offers(void); void hv_vmbus_release_unattached_channels(void); uint16_t hv_vmbus_post_msg_via_msg_ipc( Index: head/sys/dev/hyperv/vmbus/vmbus.c =================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c +++ head/sys/dev/hyperv/vmbus/vmbus.c @@ -98,6 +98,7 @@ static int vmbus_init(struct vmbus_softc *); static int vmbus_init_contact(struct vmbus_softc *, uint32_t); +static int vmbus_req_channels(struct vmbus_softc *sc); static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); static void vmbus_msghc_ctx_destroy( @@ -417,6 +418,26 @@ return ENXIO; } +static int +vmbus_req_channels(struct vmbus_softc *sc) +{ + struct vmbus_chanmsg_channel_req *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) + return ENXIO; + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHANNEL_REQ; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + return error; +} + static void vmbus_msg_task(void *xsc, int pending __unused) { @@ -1012,7 +1033,9 @@ else sc->vmbus_event_proc = vmbus_event_proc; - hv_vmbus_request_channel_offers(); + ret = vmbus_req_channels(sc); + if (ret != 0) + goto cleanup; vmbus_scan(); bus_generic_attach(sc->vmbus_dev); Index: head/sys/dev/hyperv/vmbus/vmbus_reg.h =================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h @@ -83,6 +83,7 @@ * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. */ +#define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ @@ -107,4 +108,9 @@ uint8_t chm_supp; } __packed; +/* VMBUS_CHANMSG_TYPE_CHANNEL_REQ */ +struct vmbus_chanmsg_channel_req { + struct vmbus_chanmsg_hdr chm_hdr; +} __packed; + #endif /* !_VMBUS_REG_H_ */