aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64/dma-mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc64/dma-mapping.h')
-rw-r--r--include/asm-sparc64/dma-mapping.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index 2f858a2df94a..9329429fb7f6 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -10,10 +10,13 @@
10/* need struct page definitions */ 10/* need struct page definitions */
11#include <linux/mm.h> 11#include <linux/mm.h>
12 12
13#include <asm/of_device.h>
14
13static inline int 15static inline int
14dma_supported(struct device *dev, u64 mask) 16dma_supported(struct device *dev, u64 mask)
15{ 17{
16 BUG_ON(dev->bus != &pci_bus_type); 18 BUG_ON(dev->bus != &pci_bus_type &&
19 dev->bus != &ebus_bus_type);
17 20
18 return pci_dma_supported(to_pci_dev(dev), mask); 21 return pci_dma_supported(to_pci_dev(dev), mask);
19} 22}
@@ -21,7 +24,8 @@ dma_supported(struct device *dev, u64 mask)
21static inline int 24static inline int
22dma_set_mask(struct device *dev, u64 dma_mask) 25dma_set_mask(struct device *dev, u64 dma_mask)
23{ 26{
24 BUG_ON(dev->bus != &pci_bus_type); 27 BUG_ON(dev->bus != &pci_bus_type &&
28 dev->bus != &ebus_bus_type);
25 29
26 return pci_set_dma_mask(to_pci_dev(dev), dma_mask); 30 return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
27} 31}
@@ -30,7 +34,8 @@ static inline void *
30dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 34dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
31 gfp_t flag) 35 gfp_t flag)
32{ 36{
33 BUG_ON(dev->bus != &pci_bus_type); 37 BUG_ON(dev->bus != &pci_bus_type &&
38 dev->bus != &ebus_bus_type);
34 39
35 return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag); 40 return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag);
36} 41}
@@ -39,7 +44,8 @@ static inline void
39dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, 44dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
40 dma_addr_t dma_handle) 45 dma_addr_t dma_handle)
41{ 46{
42 BUG_ON(dev->bus != &pci_bus_type); 47 BUG_ON(dev->bus != &pci_bus_type &&
48 dev->bus != &ebus_bus_type);
43 49
44 pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle); 50 pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
45} 51}
@@ -48,7 +54,8 @@ static inline dma_addr_t
48dma_map_single(struct device *dev, void *cpu_addr, size_t size, 54dma_map_single(struct device *dev, void *cpu_addr, size_t size,
49 enum dma_data_direction direction) 55 enum dma_data_direction direction)
50{ 56{
51 BUG_ON(dev->bus != &pci_bus_type); 57 BUG_ON(dev->bus != &pci_bus_type &&
58 dev->bus != &ebus_bus_type);
52 59
53 return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction); 60 return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
54} 61}
@@ -57,7 +64,8 @@ static inline void
57dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 64dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
58 enum dma_data_direction direction) 65 enum dma_data_direction direction)
59{ 66{
60 BUG_ON(dev->bus != &pci_bus_type); 67 BUG_ON(dev->bus != &pci_bus_type &&
68 dev->bus != &ebus_bus_type);
61 69
62 pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction); 70 pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
63} 71}
@@ -67,7 +75,8 @@ dma_map_page(struct device *dev, struct page *page,
67 unsigned long offset, size_t size, 75 unsigned long offset, size_t size,
68 enum dma_data_direction direction) 76 enum dma_data_direction direction)
69{ 77{
70 BUG_ON(dev->bus != &pci_bus_type); 78 BUG_ON(dev->bus != &pci_bus_type &&
79 dev->bus != &ebus_bus_type);
71 80
72 return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction); 81 return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
73} 82}
@@ -76,7 +85,8 @@ static inline void
76dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, 85dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
77 enum dma_data_direction direction) 86 enum dma_data_direction direction)
78{ 87{
79 BUG_ON(dev->bus != &pci_bus_type); 88 BUG_ON(dev->bus != &pci_bus_type &&
89 dev->bus != &ebus_bus_type);
80 90
81 pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction); 91 pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
82} 92}
@@ -85,7 +95,8 @@ static inline int
85dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 95dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
86 enum dma_data_direction direction) 96 enum dma_data_direction direction)
87{ 97{
88 BUG_ON(dev->bus != &pci_bus_type); 98 BUG_ON(dev->bus != &pci_bus_type &&
99 dev->bus != &ebus_bus_type);
89 100
90 return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction); 101 return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
91} 102}
@@ -94,7 +105,8 @@ static inline void
94dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 105dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
95 enum dma_data_direction direction) 106 enum dma_data_direction direction)
96{ 107{
97 BUG_ON(dev->bus != &pci_bus_type); 108 BUG_ON(dev->bus != &pci_bus_type &&
109 dev->bus != &ebus_bus_type);
98 110
99 pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction); 111 pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
100} 112}
@@ -103,7 +115,8 @@ static inline void
103dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, 115dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
104 enum dma_data_direction direction) 116 enum dma_data_direction direction)
105{ 117{
106 BUG_ON(dev->bus != &pci_bus_type); 118 BUG_ON(dev->bus != &pci_bus_type &&
119 dev->bus != &ebus_bus_type);
107 120
108 pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle, 121 pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
109 size, (int)direction); 122 size, (int)direction);
@@ -113,7 +126,8 @@ static inline void
113dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, 126dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
114 enum dma_data_direction direction) 127 enum dma_data_direction direction)
115{ 128{
116 BUG_ON(dev->bus != &pci_bus_type); 129 BUG_ON(dev->bus != &pci_bus_type &&
130 dev->bus != &ebus_bus_type);
117 131
118 pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle, 132 pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
119 size, (int)direction); 133 size, (int)direction);
@@ -123,7 +137,8 @@ static inline void
123dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, 137dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
124 enum dma_data_direction direction) 138 enum dma_data_direction direction)
125{ 139{
126 BUG_ON(dev->bus != &pci_bus_type); 140 BUG_ON(dev->bus != &pci_bus_type &&
141 dev->bus != &ebus_bus_type);
127 142
128 pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction); 143 pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
129} 144}
@@ -132,7 +147,8 @@ static inline void
132dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, 147dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
133 enum dma_data_direction direction) 148 enum dma_data_direction direction)
134{ 149{
135 BUG_ON(dev->bus != &pci_bus_type); 150 BUG_ON(dev->bus != &pci_bus_type &&
151 dev->bus != &ebus_bus_type);
136 152
137 pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction); 153 pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
138} 154}