Back to home page

OSCL-LXR

 
 

    


0001 #ifndef _IOMMU_H
0002 #define _IOMMU_H 1
0003 
0004 #include <linux/pci.h>
0005 
0006 struct parisc_device;
0007 struct ioc;
0008 
0009 static inline struct pci_hba_data *parisc_walk_tree(struct device *dev)
0010 {
0011     struct device *otherdev;
0012 
0013     if (likely(dev->platform_data))
0014         return dev->platform_data;
0015 
0016     /* OK, just traverse the bus to find it */
0017     for (otherdev = dev->parent;
0018          otherdev;
0019          otherdev = otherdev->parent) {
0020         if (otherdev->platform_data) {
0021             dev->platform_data = otherdev->platform_data;
0022             break;
0023         }
0024     }
0025 
0026     return dev->platform_data;
0027 }
0028 
0029 static inline struct ioc *GET_IOC(struct device *dev)
0030 {
0031     struct pci_hba_data *pdata = parisc_walk_tree(dev);
0032 
0033     if (!pdata)
0034         return NULL;
0035     return pdata->iommu;
0036 }
0037 
0038 #ifdef CONFIG_IOMMU_CCIO
0039 void *ccio_get_iommu(const struct parisc_device *dev);
0040 int ccio_request_resource(const struct parisc_device *dev,
0041         struct resource *res);
0042 int ccio_allocate_resource(const struct parisc_device *dev,
0043         struct resource *res, unsigned long size,
0044         unsigned long min, unsigned long max, unsigned long align);
0045 #else /* !CONFIG_IOMMU_CCIO */
0046 #define ccio_get_iommu(dev) NULL
0047 #define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res)
0048 #define ccio_allocate_resource(dev, res, size, min, max, align) \
0049         allocate_resource(&iomem_resource, res, size, min, max, \
0050                 align, NULL, NULL)
0051 #endif /* !CONFIG_IOMMU_CCIO */
0052 
0053 void *sba_get_iommu(struct parisc_device *dev);
0054 
0055 #endif /* _IOMMU_H */