| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __x8664_PCI_H | 
|  | 2 | #define __x8664_PCI_H | 
|  | 3 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 |  | 
|  | 5 | #ifdef __KERNEL__ | 
|  | 6 |  | 
| Jeff Garzik | a79e419 | 2007-10-11 16:58:30 -0400 | [diff] [blame] | 7 |  | 
| Muli Ben-Yehuda | 08f1c19 | 2007-07-22 00:23:39 +0300 | [diff] [blame] | 8 | #ifdef CONFIG_CALGARY_IOMMU | 
|  | 9 | static inline void* pci_iommu(struct pci_bus *bus) | 
|  | 10 | { | 
|  | 11 | struct pci_sysdata *sd = bus->sysdata; | 
|  | 12 | return sd->iommu; | 
|  | 13 | } | 
|  | 14 |  | 
|  | 15 | static inline void set_pci_iommu(struct pci_bus *bus, void *val) | 
|  | 16 | { | 
|  | 17 | struct pci_sysdata *sd = bus->sysdata; | 
|  | 18 | sd->iommu = val; | 
|  | 19 | } | 
|  | 20 | #endif /* CONFIG_CALGARY_IOMMU */ | 
|  | 21 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value); | 
|  | 24 | extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value); | 
|  | 25 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 |  | 
| Jon Mason | 0dc243a | 2006-06-26 13:58:11 +0200 | [diff] [blame] | 28 | extern void pci_iommu_alloc(void); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | extern int iommu_setup(char *opt); | 
|  | 30 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | /* The PCI address space does equal the physical memory | 
|  | 32 | * address space.  The networking and block device layers use | 
|  | 33 | * this boolean for bounce buffer decisions | 
|  | 34 | * | 
| Muli Ben-Yehuda | 17a941d | 2006-01-11 22:44:42 +0100 | [diff] [blame] | 35 | * On AMD64 it mostly equals, but we set it to zero if a hardware | 
|  | 36 | * IOMMU (gart) of sotware IOMMU (swiotlb) is available. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | */ | 
| Muli Ben-Yehuda | 17a941d | 2006-01-11 22:44:42 +0100 | [diff] [blame] | 38 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) | 
|  | 39 |  | 
| Joerg Roedel | 966396d | 2007-10-24 12:49:48 +0200 | [diff] [blame] | 40 | #if defined(CONFIG_GART_IOMMU) || defined(CONFIG_CALGARY_IOMMU) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)	\ | 
|  | 43 | dma_addr_t ADDR_NAME; | 
|  | 44 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)		\ | 
|  | 45 | __u32 LEN_NAME; | 
|  | 46 | #define pci_unmap_addr(PTR, ADDR_NAME)			\ | 
|  | 47 | ((PTR)->ADDR_NAME) | 
|  | 48 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL)		\ | 
|  | 49 | (((PTR)->ADDR_NAME) = (VAL)) | 
|  | 50 | #define pci_unmap_len(PTR, LEN_NAME)			\ | 
|  | 51 | ((PTR)->LEN_NAME) | 
|  | 52 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL)		\ | 
|  | 53 | (((PTR)->LEN_NAME) = (VAL)) | 
|  | 54 |  | 
|  | 55 | #else | 
|  | 56 | /* No IOMMU */ | 
|  | 57 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | 
|  | 59 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | 
|  | 60 | #define pci_unmap_addr(PTR, ADDR_NAME)		(0) | 
|  | 61 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL)	do { } while (0) | 
|  | 62 | #define pci_unmap_len(PTR, LEN_NAME)		(0) | 
|  | 63 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL)	do { } while (0) | 
|  | 64 |  | 
|  | 65 | #endif | 
|  | 66 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | #endif /* __KERNEL__ */ | 
|  | 68 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 |  | 
|  | 70 | #endif /* __x8664_PCI_H */ |