aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/include/asm/sbus_32.h20
-rw-r--r--arch/sparc/include/asm/sbus_64.h48
-rw-r--r--arch/sparc/kernel/ioport.c43
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c2
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c2
5 files changed, 42 insertions, 73 deletions
diff --git a/arch/sparc/include/asm/sbus_32.h b/arch/sparc/include/asm/sbus_32.h
index a7b4fa21931d..61d99f1bb23c 100644
--- a/arch/sparc/include/asm/sbus_32.h
+++ b/arch/sparc/include/asm/sbus_32.h
@@ -109,8 +109,8 @@ extern void sbus_set_sbus64(struct sbus_dev *, int);
109extern void sbus_fill_device_irq(struct sbus_dev *); 109extern void sbus_fill_device_irq(struct sbus_dev *);
110 110
111/* These yield IOMMU mappings in consistent mode. */ 111/* These yield IOMMU mappings in consistent mode. */
112extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); 112extern void *sbus_alloc_consistent(struct device *, long, u32 *dma_addrp);
113extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32); 113extern void sbus_free_consistent(struct device *, long, void *, u32);
114void prom_adjust_ranges(struct linux_prom_ranges *, int, 114void prom_adjust_ranges(struct linux_prom_ranges *, int,
115 struct linux_prom_ranges *, int); 115 struct linux_prom_ranges *, int);
116 116
@@ -120,18 +120,14 @@ void prom_adjust_ranges(struct linux_prom_ranges *, int,
120#define SBUS_DMA_NONE DMA_NONE 120#define SBUS_DMA_NONE DMA_NONE
121 121
122/* All the rest use streaming mode mappings. */ 122/* All the rest use streaming mode mappings. */
123extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); 123extern dma_addr_t sbus_map_single(struct device *, void *, size_t, int);
124extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); 124extern void sbus_unmap_single(struct device *, dma_addr_t, size_t, int);
125extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); 125extern int sbus_map_sg(struct device *, struct scatterlist *, int, int);
126extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); 126extern void sbus_unmap_sg(struct device *, struct scatterlist *, int, int);
127 127
128/* Finally, allow explicit synchronization of streamable mappings. */ 128/* Finally, allow explicit synchronization of streamable mappings. */
129extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int); 129extern void sbus_dma_sync_single_for_cpu(struct device *, dma_addr_t, size_t, int);
130#define sbus_dma_sync_single sbus_dma_sync_single_for_cpu 130extern void sbus_dma_sync_single_for_device(struct device *, dma_addr_t, size_t, int);
131extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int);
132extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int);
133#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
134extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int);
135 131
136/* Eric Brower (ebrower@usa.net) 132/* Eric Brower (ebrower@usa.net)
137 * Translate SBus interrupt levels to ino values-- 133 * Translate SBus interrupt levels to ino values--
diff --git a/arch/sparc/include/asm/sbus_64.h b/arch/sparc/include/asm/sbus_64.h
index b606c14343fb..b22e99da49d8 100644
--- a/arch/sparc/include/asm/sbus_64.h
+++ b/arch/sparc/include/asm/sbus_64.h
@@ -100,17 +100,16 @@ extern struct sbus_bus *sbus_root;
100extern void sbus_set_sbus64(struct sbus_dev *, int); 100extern void sbus_set_sbus64(struct sbus_dev *, int);
101extern void sbus_fill_device_irq(struct sbus_dev *); 101extern void sbus_fill_device_irq(struct sbus_dev *);
102 102
103static inline void *sbus_alloc_consistent(struct sbus_dev *sdev , size_t size, 103static inline void *sbus_alloc_consistent(struct device *dev , size_t size,
104 dma_addr_t *dma_handle) 104 dma_addr_t *dma_handle)
105{ 105{
106 return dma_alloc_coherent(&sdev->ofdev.dev, size, 106 return dma_alloc_coherent(dev, size, dma_handle, GFP_ATOMIC);
107 dma_handle, GFP_ATOMIC);
108} 107}
109 108
110static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size, 109static inline void sbus_free_consistent(struct device *dev, size_t size,
111 void *vaddr, dma_addr_t dma_handle) 110 void *vaddr, dma_addr_t dma_handle)
112{ 111{
113 return dma_free_coherent(&sdev->ofdev.dev, size, vaddr, dma_handle); 112 return dma_free_coherent(dev, size, vaddr, dma_handle);
114} 113}
115 114
116#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL 115#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL
@@ -119,68 +118,51 @@ static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size,
119#define SBUS_DMA_NONE DMA_NONE 118#define SBUS_DMA_NONE DMA_NONE
120 119
121/* All the rest use streaming mode mappings. */ 120/* All the rest use streaming mode mappings. */
122static inline dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, 121static inline dma_addr_t sbus_map_single(struct device *dev, void *ptr,
123 size_t size, int direction) 122 size_t size, int direction)
124{ 123{
125 return dma_map_single(&sdev->ofdev.dev, ptr, size, 124 return dma_map_single(dev, ptr, size,
126 (enum dma_data_direction) direction); 125 (enum dma_data_direction) direction);
127} 126}
128 127
129static inline void sbus_unmap_single(struct sbus_dev *sdev, 128static inline void sbus_unmap_single(struct device *dev,
130 dma_addr_t dma_addr, size_t size, 129 dma_addr_t dma_addr, size_t size,
131 int direction) 130 int direction)
132{ 131{
133 dma_unmap_single(&sdev->ofdev.dev, dma_addr, size, 132 dma_unmap_single(dev, dma_addr, size,
134 (enum dma_data_direction) direction); 133 (enum dma_data_direction) direction);
135} 134}
136 135
137static inline int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, 136static inline int sbus_map_sg(struct device *dev, struct scatterlist *sg,
138 int nents, int direction) 137 int nents, int direction)
139{ 138{
140 return dma_map_sg(&sdev->ofdev.dev, sg, nents, 139 return dma_map_sg(dev, sg, nents,
141 (enum dma_data_direction) direction); 140 (enum dma_data_direction) direction);
142} 141}
143 142
144static inline void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, 143static inline void sbus_unmap_sg(struct device *dev, struct scatterlist *sg,
145 int nents, int direction) 144 int nents, int direction)
146{ 145{
147 dma_unmap_sg(&sdev->ofdev.dev, sg, nents, 146 dma_unmap_sg(dev, sg, nents,
148 (enum dma_data_direction) direction); 147 (enum dma_data_direction) direction);
149} 148}
150 149
151/* Finally, allow explicit synchronization of streamable mappings. */ 150/* Finally, allow explicit synchronization of streamable mappings. */
152static inline void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, 151static inline void sbus_dma_sync_single_for_cpu(struct device *dev,
153 dma_addr_t dma_handle, 152 dma_addr_t dma_handle,
154 size_t size, int direction) 153 size_t size, int direction)
155{ 154{
156 dma_sync_single_for_cpu(&sdev->ofdev.dev, dma_handle, size, 155 dma_sync_single_for_cpu(dev, dma_handle, size,
157 (enum dma_data_direction) direction); 156 (enum dma_data_direction) direction);
158} 157}
159#define sbus_dma_sync_single sbus_dma_sync_single_for_cpu
160 158
161static inline void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, 159static inline void sbus_dma_sync_single_for_device(struct device *dev,
162 dma_addr_t dma_handle, 160 dma_addr_t dma_handle,
163 size_t size, int direction) 161 size_t size, int direction)
164{ 162{
165 /* No flushing needed to sync cpu writes to the device. */ 163 /* No flushing needed to sync cpu writes to the device. */
166} 164}
167 165
168static inline void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev,
169 struct scatterlist *sg,
170 int nents, int direction)
171{
172 dma_sync_sg_for_cpu(&sdev->ofdev.dev, sg, nents,
173 (enum dma_data_direction) direction);
174}
175#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
176
177static inline void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev,
178 struct scatterlist *sg,
179 int nents, int direction)
180{
181 /* No flushing needed to sync cpu writes to the device. */
182}
183
184extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); 166extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
185extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); 167extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
186extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *); 168extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index f6158c4a3995..aa73b3b71e85 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -300,11 +300,10 @@ void __init sbus_fill_device_irq(struct sbus_dev *sdev)
300 * Allocate a chunk of memory suitable for DMA. 300 * Allocate a chunk of memory suitable for DMA.
301 * Typically devices use them for control blocks. 301 * Typically devices use them for control blocks.
302 * CPU may access them without any explicit flushing. 302 * CPU may access them without any explicit flushing.
303 *
304 * XXX Some clever people know that sdev is not used and supply NULL. Watch.
305 */ 303 */
306void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp) 304void *sbus_alloc_consistent(struct device *dev, long len, u32 *dma_addrp)
307{ 305{
306 struct of_device *op = to_of_device(dev);
308 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK; 307 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
309 unsigned long va; 308 unsigned long va;
310 struct resource *res; 309 struct resource *res;
@@ -341,10 +340,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
341 if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0) 340 if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0)
342 goto err_noiommu; 341 goto err_noiommu;
343 342
344 /* Set the resource name, if known. */ 343 res->name = op->node->name;
345 if (sdev) {
346 res->name = sdev->prom_name;
347 }
348 344
349 return (void *)(unsigned long)res->start; 345 return (void *)(unsigned long)res->start;
350 346
@@ -358,7 +354,7 @@ err_nopages:
358 return NULL; 354 return NULL;
359} 355}
360 356
361void sbus_free_consistent(struct sbus_dev *sdev, long n, void *p, u32 ba) 357void sbus_free_consistent(struct device *dev, long n, void *p, u32 ba)
362{ 358{
363 struct resource *res; 359 struct resource *res;
364 struct page *pgv; 360 struct page *pgv;
@@ -396,8 +392,10 @@ void sbus_free_consistent(struct sbus_dev *sdev, long n, void *p, u32 ba)
396 * CPU view of this memory may be inconsistent with 392 * CPU view of this memory may be inconsistent with
397 * a device view and explicit flushing is necessary. 393 * a device view and explicit flushing is necessary.
398 */ 394 */
399dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *va, size_t len, int direction) 395dma_addr_t sbus_map_single(struct device *dev, void *va, size_t len, int direction)
400{ 396{
397 struct sbus_dev *sdev = to_sbus_device(dev);
398
401 /* XXX why are some lengths signed, others unsigned? */ 399 /* XXX why are some lengths signed, others unsigned? */
402 if (len <= 0) { 400 if (len <= 0) {
403 return 0; 401 return 0;
@@ -409,13 +407,16 @@ dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *va, size_t len, int dire
409 return mmu_get_scsi_one(va, len, sdev->bus); 407 return mmu_get_scsi_one(va, len, sdev->bus);
410} 408}
411 409
412void sbus_unmap_single(struct sbus_dev *sdev, dma_addr_t ba, size_t n, int direction) 410void sbus_unmap_single(struct device *dev, dma_addr_t ba, size_t n, int direction)
413{ 411{
412 struct sbus_dev *sdev = to_sbus_device(dev);
414 mmu_release_scsi_one(ba, n, sdev->bus); 413 mmu_release_scsi_one(ba, n, sdev->bus);
415} 414}
416 415
417int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction) 416int sbus_map_sg(struct device *dev, struct scatterlist *sg, int n, int direction)
418{ 417{
418 struct sbus_dev *sdev = to_sbus_device(dev);
419
419 mmu_get_scsi_sgl(sg, n, sdev->bus); 420 mmu_get_scsi_sgl(sg, n, sdev->bus);
420 421
421 /* 422 /*
@@ -425,16 +426,19 @@ int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direct
425 return n; 426 return n;
426} 427}
427 428
428void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction) 429void sbus_unmap_sg(struct device *dev, struct scatterlist *sg, int n, int direction)
429{ 430{
431 struct sbus_dev *sdev = to_sbus_device(dev);
432
430 mmu_release_scsi_sgl(sg, n, sdev->bus); 433 mmu_release_scsi_sgl(sg, n, sdev->bus);
431} 434}
432 435
433/* 436/*
434 */ 437 */
435void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, dma_addr_t ba, size_t size, int direction) 438void sbus_dma_sync_single_for_cpu(struct device *dev, dma_addr_t ba, size_t size, int direction)
436{ 439{
437#if 0 440#if 0
441 struct sbus_dev *sdev = to_sbus_device(dev);
438 unsigned long va; 442 unsigned long va;
439 struct resource *res; 443 struct resource *res;
440 444
@@ -452,9 +456,10 @@ void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, dma_addr_t ba, size_t s
452#endif 456#endif
453} 457}
454 458
455void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, dma_addr_t ba, size_t size, int direction) 459void sbus_dma_sync_single_for_device(struct device *dev, dma_addr_t ba, size_t size, int direction)
456{ 460{
457#if 0 461#if 0
462 struct sbus_dev *sdev = to_sbus_device(dev);
458 unsigned long va; 463 unsigned long va;
459 struct resource *res; 464 struct resource *res;
460 465
@@ -472,16 +477,6 @@ void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, dma_addr_t ba, size_
472#endif 477#endif
473} 478}
474 479
475void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
476{
477 printk("sbus_dma_sync_sg_for_cpu: not implemented yet\n");
478}
479
480void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
481{
482 printk("sbus_dma_sync_sg_for_device: not implemented yet\n");
483}
484
485/* Support code for sbus_init(). */ 480/* Support code for sbus_init(). */
486/* 481/*
487 * XXX This functions appears to be a distorted version of 482 * XXX This functions appears to be a distorted version of
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 8a392d3d89e4..9d85a83586a1 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -163,8 +163,6 @@ EXPORT_SYMBOL(sbus_map_sg);
163EXPORT_SYMBOL(sbus_unmap_sg); 163EXPORT_SYMBOL(sbus_unmap_sg);
164EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu); 164EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu);
165EXPORT_SYMBOL(sbus_dma_sync_single_for_device); 165EXPORT_SYMBOL(sbus_dma_sync_single_for_device);
166EXPORT_SYMBOL(sbus_dma_sync_sg_for_cpu);
167EXPORT_SYMBOL(sbus_dma_sync_sg_for_device);
168EXPORT_SYMBOL(sbus_iounmap); 166EXPORT_SYMBOL(sbus_iounmap);
169EXPORT_SYMBOL(sbus_ioremap); 167EXPORT_SYMBOL(sbus_ioremap);
170#endif 168#endif
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 8e6ac5c1b7bd..1c56c8b854d5 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -170,8 +170,6 @@ EXPORT_SYMBOL(sbus_map_sg);
170EXPORT_SYMBOL(sbus_unmap_sg); 170EXPORT_SYMBOL(sbus_unmap_sg);
171EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu); 171EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu);
172EXPORT_SYMBOL(sbus_dma_sync_single_for_device); 172EXPORT_SYMBOL(sbus_dma_sync_single_for_device);
173EXPORT_SYMBOL(sbus_dma_sync_sg_for_cpu);
174EXPORT_SYMBOL(sbus_dma_sync_sg_for_device);
175#endif 173#endif
176EXPORT_SYMBOL(outsb); 174EXPORT_SYMBOL(outsb);
177EXPORT_SYMBOL(outsw); 175EXPORT_SYMBOL(outsw);