summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/utilities/hv_shutdown.c
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2017-01-05 08:02:37 +0000
committersephe <sephe@FreeBSD.org>2017-01-05 08:02:37 +0000
commit9da44c9ab9832ffacc7676d769538bef95c7f4e1 (patch)
tree3971ed2d3b19a1e4c59a7e9e5ea3eafec2532388 /sys/dev/hyperv/utilities/hv_shutdown.c
parent8642827c9ec3822a0bfd998c63fdd355df1a0c2f (diff)
downloadFreeBSD-src-9da44c9ab9832ffacc7676d769538bef95c7f4e1.zip
FreeBSD-src-9da44c9ab9832ffacc7676d769538bef95c7f4e1.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.c24
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;
OpenPOWER on IntegriCloud