diff options
author | sephe <sephe@FreeBSD.org> | 2016-10-13 02:45:08 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2016-10-13 02:45:08 +0000 |
commit | 4eba089e0941ca313b7a477ead5ef9370fac5257 (patch) | |
tree | 1490eced8a9acf855c52122d1cb59a60cabc393c /sys/dev/hyperv/utilities/hv_util.c | |
parent | b8a954894105ede942a8dd90e34b80e5bcc7ad00 (diff) | |
download | FreeBSD-src-4eba089e0941ca313b7a477ead5ef9370fac5257.zip FreeBSD-src-4eba089e0941ca313b7a477ead5ef9370fac5257.tar.gz |
MFC 304270,304273
304270
hyperv/util: Don't reference hn_softc in KVP
hn_softc is private data struct.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7519
304273
hyperv/util: Factor out helper for IC device_probe DEVMETHOD
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7530
Diffstat (limited to 'sys/dev/hyperv/utilities/hv_util.c')
-rw-r--r-- | sys/dev/hyperv/utilities/hv_util.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/hyperv/utilities/hv_util.c b/sys/dev/hyperv/utilities/hv_util.c index e7ecf32..e60a654 100644 --- a/sys/dev/hyperv/utilities/hv_util.c +++ b/sys/dev/hyperv/utilities/hv_util.c @@ -42,7 +42,9 @@ #include <dev/hyperv/include/hyperv.h> #include <dev/hyperv/include/vmbus.h> #include <dev/hyperv/utilities/hv_utilreg.h> -#include "hv_util.h" +#include <dev/hyperv/utilities/hv_util.h> + +#include "vmbus_if.h" #define VMBUS_IC_BRSIZE (4 * PAGE_SIZE) @@ -75,6 +77,24 @@ hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf) } int +vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]) +{ + device_t bus = device_get_parent(dev); + const struct vmbus_ic_desc *d; + + if (resource_disabled(device_get_name(dev), 0)) + return (ENXIO); + + for (d = descs; d->ic_desc != NULL; ++d) { + if (VMBUS_PROBE_GUID(bus, dev, &d->ic_guid) == 0) { + device_set_desc(dev, d->ic_desc); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); +} + +int hv_util_attach(device_t dev, vmbus_chan_callback_t cb) { struct hv_util_sc *sc = device_get_softc(dev); |