Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168226241
D59065.id184712.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D59065.id184712.diff
View Options
diff --git a/sys/powerpc/ofw/ofw_pcibus.c b/sys/powerpc/ofw/ofw_pcibus.c
--- a/sys/powerpc/ofw/ofw_pcibus.c
+++ b/sys/powerpc/ofw/ofw_pcibus.c
@@ -64,6 +64,7 @@
static pci_assign_interrupt_t ofw_pcibus_assign_interrupt;
static ofw_bus_get_devinfo_t ofw_pcibus_get_devinfo;
static bus_child_deleted_t ofw_pcibus_child_deleted;
+static bus_get_dma_tag_t ofw_pcibus_get_dma_tag;
static int ofw_pcibus_child_pnpinfo_method(device_t cbdev, device_t child,
struct sbuf *sb);
@@ -80,6 +81,7 @@
DEVMETHOD(bus_child_pnpinfo, ofw_pcibus_child_pnpinfo_method),
DEVMETHOD(bus_rescan, bus_null_rescan),
DEVMETHOD(bus_get_cpus, ofw_pcibus_get_cpus),
+ DEVMETHOD(bus_get_dma_tag, ofw_pcibus_get_dma_tag),
DEVMETHOD(bus_get_domain, ofw_pcibus_get_domain),
/* PCI interface */
@@ -293,10 +295,39 @@
struct ofw_pcibus_devinfo *dinfo;
dinfo = device_get_ivars(child);
+ if (dinfo->opd_dma_tag != NULL)
+ bus_dma_tag_destroy(dinfo->opd_dma_tag);
ofw_bus_gen_destroy_devinfo(&dinfo->opd_obdinfo);
pci_child_deleted(dev, child);
}
+static bus_dma_tag_t
+ofw_pcibus_get_dma_tag(device_t bus, device_t child)
+{
+ struct ofw_pcibus_devinfo *dinfo;
+ bus_dma_tag_t parent, tag;
+ int domain, error;
+
+ if (device_get_parent(child) != bus)
+ return (pci_get_dma_tag(bus, child));
+ dinfo = device_get_ivars(child);
+ if (dinfo->opd_dma_tag != NULL)
+ return (dinfo->opd_dma_tag);
+
+ parent = pci_get_dma_tag(bus, child);
+ if (parent == NULL)
+ return (NULL);
+ error = bus_dma_tag_create(parent, 1, 0, BUS_SPACE_MAXADDR,
+ BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE,
+ BUS_SPACE_UNRESTRICTED, BUS_SPACE_MAXSIZE, 0, NULL, NULL, &tag);
+ if (error != 0)
+ return (parent);
+ if (bus_get_domain(child, &domain) == 0)
+ (void)bus_dma_tag_set_domain(tag, domain);
+ dinfo->opd_dma_tag = tag;
+ return (tag);
+}
+
static int
ofw_pcibus_child_pnpinfo_method(device_t cbdev, device_t child, struct sbuf *sb)
{
diff --git a/sys/powerpc/pseries/plpar_pcibus.c b/sys/powerpc/pseries/plpar_pcibus.c
--- a/sys/powerpc/pseries/plpar_pcibus.c
+++ b/sys/powerpc/pseries/plpar_pcibus.c
@@ -91,6 +91,7 @@
plpar_pcibus_get_dma_tag(device_t dev, device_t child)
{
struct ofw_pcibus_devinfo *dinfo;
+ int domain;
while (device_get_parent(child) != dev)
child = device_get_parent(child);
@@ -105,6 +106,8 @@
NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED,
BUS_SPACE_MAXSIZE, 0, NULL, NULL, &dinfo->opd_dma_tag);
phyp_iommu_set_dma_tag(dev, child, dinfo->opd_dma_tag);
+ if (bus_get_domain(child, &domain) == 0)
+ (void)bus_dma_tag_set_domain(dinfo->opd_dma_tag, domain);
return (dinfo->opd_dma_tag);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 28, 1:10 AM (4 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37276008
Default Alt Text
D59065.id184712.diff (2 KB)
Attached To
Mode
D59065: ofw_pcibus: Honor device proximity for DMA tags
Attached
Detach File
Event Timeline
Log In to Comment