diff options
author | gibbs <gibbs@FreeBSD.org> | 2013-10-18 23:19:27 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 2013-10-18 23:19:27 +0000 |
commit | ecdcee0674e19d97166a740fe724d6b340d47e28 (patch) | |
tree | f2776e9445ea4f032f2610c3d3e497f5b1288d49 /sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c | |
parent | 084ebbef83ad0a31d7aa6099c1eedad33eba707d (diff) | |
download | FreeBSD-src-ecdcee0674e19d97166a740fe724d6b340d47e28.zip FreeBSD-src-ecdcee0674e19d97166a740fe724d6b340d47e28.tar.gz |
MFC r256425:
Centralize the detection logic for the Hyper-V hypervisor.
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
Reviewed by: gibbs, grehan
Approved by: re (gjb)
sys/sys/systm.h:
* Add a new VM_GUEST type, VM_GUEST_HV (HyperV guest).
sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c:
sys/dev/hyperv/vmbus/hv_hv.c:
sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c:
* Set vm_guest to VM_GUEST_HV and use that on other HyperV related
devices instead of cloning the cpuid hypervisor check.
* Cleanup the vmbus_identify function.
------------------------------------------------------------------------
Diffstat (limited to 'sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c')
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c index fb9e147..7f1647b 100644 --- a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c +++ b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c @@ -295,11 +295,15 @@ hv_vmbus_child_device_unregister(struct hv_device *child_dev) return(ret); } -static void vmbus_identify(driver_t *driver, device_t parent) { +static void +vmbus_identify(driver_t *driver, device_t parent) +{ + if (!hv_vmbus_query_hypervisor_presence()) + return; + + vm_guest = VM_GUEST_HV; + BUS_ADD_CHILD(parent, 0, "vmbus", 0); - if (device_find_child(parent, "vmbus", 0) == NULL) { - BUS_ADD_CHILD(parent, 0, "vmbus", 0); - } } static int @@ -307,9 +311,6 @@ vmbus_probe(device_t dev) { if(bootverbose) device_printf(dev, "VMBUS: probe\n"); - if (!hv_vmbus_query_hypervisor_presence()) - return (ENXIO); - device_set_desc(dev, "Vmbus Devices"); return (0); @@ -491,10 +492,13 @@ vmbus_attach(device_t dev) static void vmbus_init(void) { + if (vm_guest != VM_GUEST_HV) + return; + /* * If the system has already booted and thread - * scheduling is possible indicated by the global - * cold set to zero, we just call the driver + * scheduling is possible, as indicated by the + * global cold set to zero, we just call the driver * initialization directly. */ if (!cold) |