aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/include
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-30 10:12:36 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-09-03 14:53:37 -0400
commitb40f451d56de69477a2244a0b4082f644699673f (patch)
treea1f113a598fd28f61ae9a26e8eb19e528309beff /arch/tile/include
parent6d715790ef6b5b903779a14d995ce3d9e680bec0 (diff)
tile PCI RC: make default consistent DMA mask 32-bit
This change sets the PCI devices' initial DMA capabilities conservatively and promotes them at the request of the driver, as opposed to assuming advanced DMA capabilities. The old design runs the risk of breaking drivers that assume default capabilities. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/include')
-rw-r--r--arch/tile/include/asm/device.h5
-rw-r--r--arch/tile/include/asm/dma-mapping.h21
2 files changed, 17 insertions, 9 deletions
diff --git a/arch/tile/include/asm/device.h b/arch/tile/include/asm/device.h
index 5182705bd056..6ab8bf146d4c 100644
--- a/arch/tile/include/asm/device.h
+++ b/arch/tile/include/asm/device.h
@@ -23,7 +23,10 @@ struct dev_archdata {
23 /* Offset of the DMA address from the PA. */ 23 /* Offset of the DMA address from the PA. */
24 dma_addr_t dma_offset; 24 dma_addr_t dma_offset;
25 25
26 /* Highest DMA address that can be generated by this device. */ 26 /*
27 * Highest DMA address that can be generated by devices that
28 * have limited DMA capability, i.e. non 64-bit capable.
29 */
27 dma_addr_t max_direct_dma_addr; 30 dma_addr_t max_direct_dma_addr;
28}; 31};
29 32
diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h
index 6f522d569132..1eae359d8315 100644
--- a/arch/tile/include/asm/dma-mapping.h
+++ b/arch/tile/include/asm/dma-mapping.h
@@ -92,14 +92,19 @@ dma_set_mask(struct device *dev, u64 mask)
92{ 92{
93 struct dma_map_ops *dma_ops = get_dma_ops(dev); 93 struct dma_map_ops *dma_ops = get_dma_ops(dev);
94 94
95 /* Handle legacy PCI devices with limited memory addressability. */ 95 /*
96 if ((dma_ops == gx_pci_dma_map_ops || 96 * For PCI devices with 64-bit DMA addressing capability, promote
97 dma_ops == gx_hybrid_pci_dma_map_ops || 97 * the dma_ops to hybrid, with the consistent memory DMA space limited
98 dma_ops == gx_legacy_pci_dma_map_ops) && 98 * to 32-bit. For 32-bit capable devices, limit the streaming DMA
99 (mask <= DMA_BIT_MASK(32))) { 99 * address range to max_direct_dma_addr.
100 set_dma_ops(dev, gx_legacy_pci_dma_map_ops); 100 */
101 set_dma_offset(dev, 0); 101 if (dma_ops == gx_pci_dma_map_ops ||
102 if (mask > dev->archdata.max_direct_dma_addr) 102 dma_ops == gx_hybrid_pci_dma_map_ops ||
103 dma_ops == gx_legacy_pci_dma_map_ops) {
104 if (mask == DMA_BIT_MASK(64) &&
105 dma_ops == gx_legacy_pci_dma_map_ops)
106 set_dma_ops(dev, gx_hybrid_pci_dma_map_ops);
107 else if (mask > dev->archdata.max_direct_dma_addr)
103 mask = dev->archdata.max_direct_dma_addr; 108 mask = dev->archdata.max_direct_dma_addr;
104 } 109 }
105 110