Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/utilities/hv_shutdown.c
Show All 40 Lines | |||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <dev/hyperv/include/hyperv.h> | #include <dev/hyperv/include/hyperv.h> | ||||
#include <dev/hyperv/include/vmbus.h> | #include <dev/hyperv/include/vmbus.h> | ||||
#include <dev/hyperv/utilities/hv_utilreg.h> | #include <dev/hyperv/utilities/hv_utilreg.h> | ||||
#include "hv_util.h" | #include "hv_util.h" | ||||
#include "vmbus_if.h" | #include "vmbus_if.h" | ||||
static const struct hyperv_guid service_guid = { .hv_guid = | static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { | ||||
{0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49, | { | ||||
0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB} }; | .ic_guid = { .hv_guid = { | ||||
0x31, 0x60, 0x0b, 0x0e, 0x13, 0x52, 0x34, 0x49, | |||||
0x81, 0x8b, 0x38, 0xd9, 0x0c, 0xed, 0x39, 0xdb } }, | |||||
.ic_desc = "Hyper-V Shutdown" | |||||
}, | |||||
VMBUS_IC_DESC_END | |||||
}; | |||||
/** | /** | ||||
* Shutdown | * Shutdown | ||||
*/ | */ | ||||
static void | static void | ||||
hv_shutdown_cb(struct vmbus_channel *channel, void *context) | hv_shutdown_cb(struct vmbus_channel *channel, void *context) | ||||
{ | { | ||||
uint8_t* buf; | uint8_t* buf; | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | hv_shutdown_cb(struct vmbus_channel *channel, void *context) | ||||
if (execute_shutdown) | if (execute_shutdown) | ||||
shutdown_nice(RB_POWEROFF); | shutdown_nice(RB_POWEROFF); | ||||
} | } | ||||
static int | static int | ||||
hv_shutdown_probe(device_t dev) | hv_shutdown_probe(device_t dev) | ||||
{ | { | ||||
if (resource_disabled("hvshutdown", 0)) | |||||
return ENXIO; | |||||
if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { | return (vmbus_ic_probe(dev, vmbus_shutdown_descs)); | ||||
device_set_desc(dev, "Hyper-V Shutdown Service"); | |||||
return BUS_PROBE_DEFAULT; | |||||
} | |||||
return ENXIO; | |||||
} | } | ||||
static int | static int | ||||
hv_shutdown_attach(device_t dev) | hv_shutdown_attach(device_t dev) | ||||
{ | { | ||||
return hv_util_attach(dev, hv_shutdown_cb); | return hv_util_attach(dev, hv_shutdown_cb); | ||||
} | } | ||||
Show All 15 Lines |