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