diff options
author | sephe <sephe@FreeBSD.org> | 2017-01-04 02:39:00 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2017-01-04 02:39:00 +0000 |
commit | 273a5a38d4c101ccfe5588a69d5941cadbcd6b28 (patch) | |
tree | b672f4fb5766ca01cdd3f8b3baa19a085bc49be0 /sys/dev/hyperv/utilities/hv_shutdown.c | |
parent | 923185c1556e28efc10e1d35ad9c829c7bf02ab1 (diff) | |
download | FreeBSD-src-273a5a38d4c101ccfe5588a69d5941cadbcd6b28.zip FreeBSD-src-273a5a38d4c101ccfe5588a69d5941cadbcd6b28.tar.gz |
MFC 310312-310314
310312
hyperv/ic: Factor out function to send IC response
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8844
310313
hyperv/ic: Cleanup common struct and functions.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8845
310314
hyperv/ic: Rename cleaned up header file.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8846
Diffstat (limited to 'sys/dev/hyperv/utilities/hv_shutdown.c')
-rw-r--r-- | sys/dev/hyperv/utilities/hv_shutdown.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/dev/hyperv/utilities/hv_shutdown.c b/sys/dev/hyperv/utilities/hv_shutdown.c index e511b21..701d64c 100644 --- a/sys/dev/hyperv/utilities/hv_shutdown.c +++ b/sys/dev/hyperv/utilities/hv_shutdown.c @@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$"); #include <dev/hyperv/include/hyperv.h> #include <dev/hyperv/include/vmbus.h> -#include <dev/hyperv/utilities/hv_util.h> #include <dev/hyperv/utilities/vmbus_icreg.h> +#include <dev/hyperv/utilities/vmbus_icvar.h> #include "vmbus_if.h" @@ -62,7 +62,7 @@ static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { static void vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) { - struct hv_util_sc *sc = xsc; + struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; struct vmbus_icmsg_shutdown *msg; int dlen, error, do_shutdown = 0; @@ -72,7 +72,7 @@ vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) /* * Receive request. */ - data = sc->receive_buffer; + data = sc->ic_buf; dlen = sc->ic_buflen; error = vmbus_chan_recv(chan, data, &dlen, &xactid); KASSERT(error != ENOBUFS, ("icbuf is not large enough")); @@ -122,13 +122,9 @@ vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) } /* - * Send response by echoing the updated request back. + * Send response by echoing the request back. */ - hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; - error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, - data, dlen, xactid); - if (error) - device_printf(sc->ic_dev, "resp send failed: %d\n", error); + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); if (do_shutdown) shutdown_nice(RB_POWEROFF); @@ -145,18 +141,22 @@ static int hv_shutdown_attach(device_t dev) { - return (hv_util_attach(dev, vmbus_shutdown_cb)); + return (vmbus_ic_attach(dev, vmbus_shutdown_cb)); } static device_method_t shutdown_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hv_shutdown_probe), DEVMETHOD(device_attach, hv_shutdown_attach), - DEVMETHOD(device_detach, hv_util_detach), + DEVMETHOD(device_detach, vmbus_ic_detach), { 0, 0 } }; -static driver_t shutdown_driver = { "hvshutdown", shutdown_methods, sizeof(hv_util_sc)}; +static driver_t shutdown_driver = { + "hvshutdown", + shutdown_methods, + sizeof(struct vmbus_ic_softc) +}; static devclass_t shutdown_devclass; |