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 | #include <asm/io.h> |
| 5 | |
| 6 | #ifdef __KERNEL__ |
| 7 | |
Muli Ben-Yehuda | 08f1c19 | 2007-07-22 00:23:39 +0300 | [diff] [blame] | 8 | struct pci_sysdata { |
| 9 | int node; /* NUMA node */ |
| 10 | void* iommu; /* IOMMU private data */ |
| 11 | }; |
| 12 | |
Muli Ben-Yehuda | 73c59af | 2007-08-10 13:01:19 -0700 | [diff] [blame] | 13 | extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); |
| 14 | |
Muli Ben-Yehuda | 08f1c19 | 2007-07-22 00:23:39 +0300 | [diff] [blame] | 15 | #ifdef CONFIG_CALGARY_IOMMU |
| 16 | static inline void* pci_iommu(struct pci_bus *bus) |
| 17 | { |
| 18 | struct pci_sysdata *sd = bus->sysdata; |
| 19 | return sd->iommu; |
| 20 | } |
| 21 | |
| 22 | static inline void set_pci_iommu(struct pci_bus *bus, void *val) |
| 23 | { |
| 24 | struct pci_sysdata *sd = bus->sysdata; |
| 25 | sd->iommu = val; |
| 26 | } |
| 27 | #endif /* CONFIG_CALGARY_IOMMU */ |
| 28 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include <linux/mm.h> /* for struct page */ |
| 30 | |
| 31 | /* Can be used to override the logic in pci_scan_bus for skipping |
| 32 | already-configured bus numbers - to be used for buggy BIOSes |
| 33 | or architectures with incomplete PCI setup by the loader */ |
| 34 | |
| 35 | #ifdef CONFIG_PCI |
| 36 | extern unsigned int pcibios_assign_all_busses(void); |
| 37 | #else |
| 38 | #define pcibios_assign_all_busses() 0 |
| 39 | #endif |
| 40 | #define pcibios_scan_all_fns(a, b) 0 |
| 41 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | extern unsigned long pci_mem_start; |
Linus Torvalds | 2ba8468 | 2005-08-14 18:21:30 -0700 | [diff] [blame] | 43 | #define PCIBIOS_MIN_IO 0x1000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #define PCIBIOS_MIN_MEM (pci_mem_start) |
| 45 | |
Linus Torvalds | 2ba8468 | 2005-08-14 18:21:30 -0700 | [diff] [blame] | 46 | #define PCIBIOS_MIN_CARDBUS_IO 0x4000 |
| 47 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | void pcibios_config_init(void); |
| 49 | struct pci_bus * pcibios_scan_root(int bus); |
| 50 | extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value); |
| 51 | extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value); |
| 52 | |
| 53 | void pcibios_set_master(struct pci_dev *dev); |
David Shaohua Li | c9c3e45 | 2005-04-01 00:07:31 -0500 | [diff] [blame] | 54 | void pcibios_penalize_isa_irq(int irq, int active); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | struct irq_routing_table *pcibios_get_irq_routing_table(void); |
| 56 | int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); |
| 57 | |
| 58 | #include <linux/types.h> |
| 59 | #include <linux/slab.h> |
| 60 | #include <asm/scatterlist.h> |
| 61 | #include <linux/string.h> |
| 62 | #include <asm/page.h> |
| 63 | |
Jon Mason | 0dc243a | 2006-06-26 13:58:11 +0200 | [diff] [blame] | 64 | extern void pci_iommu_alloc(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | extern int iommu_setup(char *opt); |
| 66 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | /* The PCI address space does equal the physical memory |
| 68 | * address space. The networking and block device layers use |
| 69 | * this boolean for bounce buffer decisions |
| 70 | * |
Muli Ben-Yehuda | 17a941d | 2006-01-11 22:44:42 +0100 | [diff] [blame] | 71 | * On AMD64 it mostly equals, but we set it to zero if a hardware |
| 72 | * IOMMU (gart) of sotware IOMMU (swiotlb) is available. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | */ |
Muli Ben-Yehuda | 17a941d | 2006-01-11 22:44:42 +0100 | [diff] [blame] | 74 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) |
| 75 | |
Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 76 | #if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ |
| 79 | dma_addr_t ADDR_NAME; |
| 80 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ |
| 81 | __u32 LEN_NAME; |
| 82 | #define pci_unmap_addr(PTR, ADDR_NAME) \ |
| 83 | ((PTR)->ADDR_NAME) |
| 84 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \ |
| 85 | (((PTR)->ADDR_NAME) = (VAL)) |
| 86 | #define pci_unmap_len(PTR, LEN_NAME) \ |
| 87 | ((PTR)->LEN_NAME) |
| 88 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ |
| 89 | (((PTR)->LEN_NAME) = (VAL)) |
| 90 | |
| 91 | #else |
| 92 | /* No IOMMU */ |
| 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) |
| 95 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) |
| 96 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) |
| 97 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) |
| 98 | #define pci_unmap_len(PTR, LEN_NAME) (0) |
| 99 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) |
| 100 | |
| 101 | #endif |
| 102 | |
| 103 | #include <asm-generic/pci-dma-compat.h> |
| 104 | |
Andrew Morton | bb4a61b | 2005-06-06 23:07:46 -0700 | [diff] [blame] | 105 | #ifdef CONFIG_PCI |
David S. Miller | e24c2d9 | 2005-06-02 12:55:50 -0700 | [diff] [blame] | 106 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
| 107 | enum pci_dma_burst_strategy *strat, |
| 108 | unsigned long *strategy_parameter) |
| 109 | { |
| 110 | *strat = PCI_DMA_BURST_INFINITY; |
| 111 | *strategy_parameter = ~0UL; |
| 112 | } |
Andrew Morton | bb4a61b | 2005-06-06 23:07:46 -0700 | [diff] [blame] | 113 | #endif |
David S. Miller | e24c2d9 | 2005-06-02 12:55:50 -0700 | [diff] [blame] | 114 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | #define HAVE_PCI_MMAP |
| 116 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
| 117 | enum pci_mmap_state mmap_state, int write_combine); |
| 118 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | #endif /* __KERNEL__ */ |
| 120 | |
| 121 | /* generic pci stuff */ |
| 122 | #ifdef CONFIG_PCI |
| 123 | #include <asm-generic/pci.h> |
| 124 | #endif |
| 125 | |
| 126 | #endif /* __x8664_PCI_H */ |