1 #ifndef _PARISC_DMA_MAPPING_H
2 #define _PARISC_DMA_MAPPING_H
4 #include <asm/cacheflush.h>
7 ** We need to support 4 different coherent dma models with one binary:
9 ** I/O MMU consistent method dma_sync behavior
10 ** ============= ====================== =======================
11 ** a) PA-7x00LC uncachable host memory flush/purge
12 ** b) U2/Uturn cachable host memory NOP
13 ** c) Ike/Astro cachable host memory NOP
14 ** d) EPIC/SAGA memory on EPIC/SAGA flush/reset DMA channel
16 ** PA-7[13]00LC processors have a GSC bus interface and no I/O MMU.
18 ** Systems (eg PCX-T workstations) that don't fall into the above
19 ** categories will need to modify the needed drivers to perform
20 ** flush/purge and allocate "regular" cacheable pages for everything.
24 extern const struct dma_map_ops pcxl_dma_ops
;
25 extern const struct dma_map_ops pcx_dma_ops
;
28 extern const struct dma_map_ops
*hppa_dma_ops
;
30 static inline const struct dma_map_ops
*get_arch_dma_ops(struct bus_type
*bus
)
36 dma_cache_sync(struct device
*dev
, void *vaddr
, size_t size
,
37 enum dma_data_direction direction
)
39 if (hppa_dma_ops
->sync_single_for_cpu
)
40 flush_kernel_dcache_range((unsigned long)vaddr
, size
);
44 parisc_walk_tree(struct device
*dev
)
46 struct device
*otherdev
;
47 if(likely(dev
->platform_data
!= NULL
))
48 return dev
->platform_data
;
49 /* OK, just traverse the bus to find it */
50 for(otherdev
= dev
->parent
; otherdev
;
51 otherdev
= otherdev
->parent
) {
52 if(otherdev
->platform_data
) {
53 dev
->platform_data
= otherdev
->platform_data
;
57 return dev
->platform_data
;
60 #define GET_IOC(dev) ({ \
61 void *__pdata = parisc_walk_tree(dev); \
62 __pdata ? HBA_DATA(__pdata)->iommu : NULL; \
65 #ifdef CONFIG_IOMMU_CCIO
68 void * ccio_get_iommu(const struct parisc_device
*dev
);
69 int ccio_request_resource(const struct parisc_device
*dev
,
70 struct resource
*res
);
71 int ccio_allocate_resource(const struct parisc_device
*dev
,
72 struct resource
*res
, unsigned long size
,
73 unsigned long min
, unsigned long max
, unsigned long align
);
74 #else /* !CONFIG_IOMMU_CCIO */
75 #define ccio_get_iommu(dev) NULL
76 #define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res)
77 #define ccio_allocate_resource(dev, res, size, min, max, align) \
78 allocate_resource(&iomem_resource, res, size, min, max, \
80 #endif /* !CONFIG_IOMMU_CCIO */
82 #ifdef CONFIG_IOMMU_SBA
84 void * sba_get_iommu(struct parisc_device
*dev
);