]> asedeno.scripts.mit.edu Git - linux.git/blob - drivers/parisc/iommu.h
parisc: move internal implementation details out of <asm/dma-mapping.h>
[linux.git] / drivers / parisc / iommu.h
1 #ifndef _IOMMU_H
2 #define _IOMMU_H 1
3
4 #include <linux/pci.h>
5
6 struct parisc_device;
7 struct ioc;
8
9 static inline void *parisc_walk_tree(struct device *dev)
10 {
11         struct device *otherdev;
12
13         if (likely(dev->platform_data))
14                 return dev->platform_data;
15
16         /* OK, just traverse the bus to find it */
17         for (otherdev = dev->parent;
18              otherdev;
19              otherdev = otherdev->parent) {
20                 if (otherdev->platform_data) {
21                         dev->platform_data = otherdev->platform_data;
22                         break;
23                 }
24         }
25
26         return dev->platform_data;
27 }
28
29 #define GET_IOC(dev) ({                                 \
30         void *__pdata = parisc_walk_tree(dev);          \
31         __pdata ? HBA_DATA(__pdata)->iommu : NULL;      \
32 })
33
34 #ifdef CONFIG_IOMMU_CCIO
35 void *ccio_get_iommu(const struct parisc_device *dev);
36 int ccio_request_resource(const struct parisc_device *dev,
37                 struct resource *res);
38 int ccio_allocate_resource(const struct parisc_device *dev,
39                 struct resource *res, unsigned long size,
40                 unsigned long min, unsigned long max, unsigned long align);
41 #else /* !CONFIG_IOMMU_CCIO */
42 #define ccio_get_iommu(dev) NULL
43 #define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res)
44 #define ccio_allocate_resource(dev, res, size, min, max, align) \
45                 allocate_resource(&iomem_resource, res, size, min, max, \
46                                 align, NULL, NULL)
47 #endif /* !CONFIG_IOMMU_CCIO */
48
49 void *sba_get_iommu(struct parisc_device *dev);
50
51 #endif /* _IOMMU_H */