diff options
| author | Dexuan Cui <dexuan@FreeBSD.org> | 2016-11-25 04:35:40 +0000 |
|---|---|---|
| committer | Dexuan Cui <dexuan@FreeBSD.org> | 2016-11-25 04:35:40 +0000 |
| commit | cdb316ee878150ab9835601913f7b33b6ea1ff31 (patch) | |
| tree | 87edafa2af3d3b233bf69abac31d77ce742b0b54 /sys/dev/hyperv/vmbus | |
| parent | 28a116bab4c3c72aee7a0fa92842a39415e7e279 (diff) | |
Notes
Diffstat (limited to 'sys/dev/hyperv/vmbus')
| -rw-r--r-- | sys/dev/hyperv/vmbus/vmbus.c | 21 | ||||
| -rw-r--r-- | sys/dev/hyperv/vmbus/vmbus_var.h | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index 4695d9572574..a6315025cb43 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -1020,16 +1020,21 @@ static struct resource * vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { - struct vmbus_softc *sc = device_get_softc(dev); device_t parent = device_get_parent(dev); struct resource *res; - if (type != SYS_RES_MEMORY) - res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start, - end, count, flags); - else +#ifdef NEW_PCIB + if (type == SYS_RES_MEMORY) { + struct vmbus_softc *sc = device_get_softc(dev); + res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type, rid, start, end, count, flags); + } else +#endif + { + res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start, + end, count, flags); + } return (res); } @@ -1100,6 +1105,7 @@ vmbus_get_vcpu_id_method(device_t bus, device_t dev, int cpu) return (VMBUS_PCPU_GET(sc, vcpuid, cpu)); } +#ifdef NEW_PCIB #define VTPM_BASE_ADDR 0xfed40000 #define FOUR_GB (1ULL << 32) @@ -1231,6 +1237,7 @@ vmbus_free_mmio_res(device_t dev) pcib_host_res_free(dev, &sc->vmbus_mmio_res); } +#endif /* NEW_PCIB */ static int vmbus_probe(device_t dev) @@ -1269,7 +1276,9 @@ vmbus_doattach(struct vmbus_softc *sc) if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) return (0); +#ifdef NEW_PCIB vmbus_get_mmio_res(sc->vmbus_dev); +#endif sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; @@ -1417,7 +1426,9 @@ vmbus_detach(device_t dev) mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_chan_lock); +#ifdef NEW_PCIB vmbus_free_mmio_res(dev); +#endif return (0); } diff --git a/sys/dev/hyperv/vmbus/vmbus_var.h b/sys/dev/hyperv/vmbus/vmbus_var.h index 7aa035f94d85..a5f4db554c93 100644 --- a/sys/dev/hyperv/vmbus/vmbus_var.h +++ b/sys/dev/hyperv/vmbus/vmbus_var.h @@ -128,8 +128,10 @@ struct vmbus_softc { struct mtx vmbus_chan_lock; TAILQ_HEAD(, vmbus_channel) vmbus_chans; +#ifdef NEW_PCIB /* The list of usable MMIO ranges for PCIe pass-through */ struct pcib_host_resources vmbus_mmio_res; +#endif }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ |
