Page MenuHomeFreeBSD

D41728.id127265.diff
No OneTemporary

D41728.id127265.diff

diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c
--- a/sys/dev/hyperv/vmbus/vmbus.c
+++ b/sys/dev/hyperv/vmbus/vmbus.c
@@ -137,6 +137,7 @@
static int vmbus_doattach(struct vmbus_softc *);
static void vmbus_event_proc_dummy(struct vmbus_softc *,
int);
+static bus_dma_tag_t vmbus_get_dma_tag(device_t parent, device_t child);
static struct vmbus_softc *vmbus_sc;
SYSCTL_NODE(_hw, OID_AUTO, vmbus, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
@@ -183,6 +184,7 @@
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD(bus_get_cpus, bus_generic_get_cpus),
+ DEVMETHOD(bus_get_dma_tag, vmbus_get_dma_tag),
/* pcib interface */
DEVMETHOD(pcib_alloc_msi, vmbus_alloc_msi),
@@ -219,6 +221,37 @@
return vmbus_sc;
}
+static bus_dma_tag_t
+vmbus_get_dma_tag(device_t dev, device_t child)
+{
+ struct vmbus_softc *sc = vmbus_get_softc();
+ device_t dev_res;
+ ACPI_HANDLE handle;
+ unsigned int coherent;
+
+ /* Coherency attribute */
+ dev_res = devclass_get_device(devclass_find("vmbus_res"), 0);
+ handle = acpi_get_handle(dev_res);
+ if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent)))
+ coherent = 0;
+ if (bootverbose)
+ device_printf(sc->vmbus_dev, "Bus is%s cache-coherent\n",
+ coherent ? "" : " not");
+
+ bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
+ 1, 0, /* alignment, bounds */
+ BUS_SPACE_MAXADDR, /* lowaddr */
+ BUS_SPACE_MAXADDR, /* highaddr */
+ NULL, NULL, /* filter, filterarg */
+ BUS_SPACE_MAXSIZE, /* maxsize */
+ BUS_SPACE_UNRESTRICTED, /* nsegments */
+ BUS_SPACE_MAXSIZE, /* maxsegsize */
+ coherent ? BUS_DMA_COHERENT : 0, /* flags */
+ NULL, NULL, /* lockfunc, lockarg */
+ &sc->dmat);
+ return (sc->dmat);
+}
+
void
vmbus_msghc_reset(struct vmbus_msghc *mh, size_t dsize)
{
diff --git a/sys/dev/hyperv/vmbus/vmbus_var.h b/sys/dev/hyperv/vmbus/vmbus_var.h
--- a/sys/dev/hyperv/vmbus/vmbus_var.h
+++ b/sys/dev/hyperv/vmbus/vmbus_var.h
@@ -129,6 +129,7 @@
void *icookie;
int vector;
#endif
+ bus_dma_tag_t dmat;
};
#define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */

File Metadata

Mime Type
text/plain
Expires
Sat, Jun 13, 1:05 AM (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33918032
Default Alt Text
D41728.id127265.diff (2 KB)

Event Timeline