Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/utilities/hv_heartbeat.c
Show All 35 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" | ||||
/* Heartbeat Service */ | static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { | ||||
static const struct hyperv_guid service_guid = { .hv_guid = | { | ||||
{0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, | .ic_guid = { .hv_guid = { | ||||
0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} }; | 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, | ||||
0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} }, | |||||
.ic_desc = "Hyper-V Heartbeat" | |||||
}, | |||||
VMBUS_IC_DESC_END | |||||
}; | |||||
/** | /** | ||||
* Process heartbeat message | * Process heartbeat message | ||||
*/ | */ | ||||
static void | static void | ||||
hv_heartbeat_cb(struct vmbus_channel *channel, void *context) | hv_heartbeat_cb(struct vmbus_channel *channel, void *context) | ||||
{ | { | ||||
uint8_t* buf; | uint8_t* buf; | ||||
Show All 35 Lines | heartbeat_msg->seq_num += 1; | ||||
vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, | vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, | ||||
buf, recvlen, requestid); | buf, recvlen, requestid); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
hv_heartbeat_probe(device_t dev) | hv_heartbeat_probe(device_t dev) | ||||
{ | { | ||||
if (resource_disabled("hvheartbeat", 0)) | |||||
return ENXIO; | |||||
if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { | return (vmbus_ic_probe(dev, vmbus_heartbeat_descs)); | ||||
device_set_desc(dev, "Hyper-V Heartbeat Service"); | |||||
return BUS_PROBE_DEFAULT; | |||||
} | |||||
return ENXIO; | |||||
} | } | ||||
static int | static int | ||||
hv_heartbeat_attach(device_t dev) | hv_heartbeat_attach(device_t dev) | ||||
{ | { | ||||
return hv_util_attach(dev, hv_heartbeat_cb); | return hv_util_attach(dev, hv_heartbeat_cb); | ||||
} | } | ||||
Show All 15 Lines |