Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/utilities/hv_timesync.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#define HV_ICTIMESYNCFLAG_SAMPLE 2 | #define HV_ICTIMESYNCFLAG_SAMPLE 2 | ||||
#define HV_NANO_SEC_PER_SEC 1000000000 | #define HV_NANO_SEC_PER_SEC 1000000000 | ||||
/* Time Sync data */ | /* Time Sync data */ | ||||
typedef struct { | typedef struct { | ||||
uint64_t data; | uint64_t data; | ||||
} time_sync_data; | } time_sync_data; | ||||
/* Time Synch Service */ | static const struct vmbus_ic_desc vmbus_timesync_descs[] = { | ||||
static const struct hyperv_guid service_guid = {.hv_guid = | { | ||||
{0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, | .ic_guid = { .hv_guid = { | ||||
0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }; | 0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, | ||||
0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }, | |||||
.ic_desc = "Hyper-V Timesync" | |||||
}, | |||||
VMBUS_IC_DESC_END | |||||
}; | |||||
struct hv_ictimesync_data { | struct hv_ictimesync_data { | ||||
uint64_t parenttime; | uint64_t parenttime; | ||||
uint64_t childtime; | uint64_t childtime; | ||||
uint64_t roundtriptime; | uint64_t roundtriptime; | ||||
uint8_t flags; | uint8_t flags; | ||||
} __packed; | } __packed; | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | | HV_ICMSGHDRFLAG_RESPONSE; | ||||
vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, | vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, | ||||
time_buf, recvlen, requestId); | time_buf, recvlen, requestId); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
hv_timesync_probe(device_t dev) | hv_timesync_probe(device_t dev) | ||||
{ | { | ||||
if (resource_disabled("hvtimesync", 0)) | |||||
return ENXIO; | |||||
if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { | return (vmbus_ic_probe(dev, vmbus_timesync_descs)); | ||||
device_set_desc(dev, "Hyper-V Time Synch Service"); | |||||
return BUS_PROBE_DEFAULT; | |||||
} | |||||
return ENXIO; | |||||
} | } | ||||
static int | static int | ||||
hv_timesync_attach(device_t dev) | hv_timesync_attach(device_t dev) | ||||
{ | { | ||||
hv_timesync_sc *softc = device_get_softc(dev); | hv_timesync_sc *softc = device_get_softc(dev); | ||||
TASK_INIT(&softc->task, 1, hv_set_host_time, softc); | TASK_INIT(&softc->task, 1, hv_set_host_time, softc); | ||||
Show All 27 Lines |