blob: 88926eb44f5cb764b3a5db8e2ff6046709469b9a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __x8664_PCI_H
2#define __x8664_PCI_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <asm/io.h>
5
6#ifdef __KERNEL__
7
Muli Ben-Yehuda08f1c192007-07-22 00:23:39 +03008struct pci_sysdata {
9 int node; /* NUMA node */
10 void* iommu; /* IOMMU private data */
11};
12
13#ifdef CONFIG_CALGARY_IOMMU
14static inline void* pci_iommu(struct pci_bus *bus)
15{
16 struct pci_sysdata *sd = bus->sysdata;
17 return sd->iommu;
18}
19
20static inline void set_pci_iommu(struct pci_bus *bus, void *val)
21{
22 struct pci_sysdata *sd = bus->sysdata;
23 sd->iommu = val;
24}
25#endif /* CONFIG_CALGARY_IOMMU */
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <linux/mm.h> /* for struct page */
28
29/* Can be used to override the logic in pci_scan_bus for skipping
30 already-configured bus numbers - to be used for buggy BIOSes
31 or architectures with incomplete PCI setup by the loader */
32
33#ifdef CONFIG_PCI
34extern unsigned int pcibios_assign_all_busses(void);
35#else
36#define pcibios_assign_all_busses() 0
37#endif
38#define pcibios_scan_all_fns(a, b) 0
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040extern unsigned long pci_mem_start;
Linus Torvalds2ba84682005-08-14 18:21:30 -070041#define PCIBIOS_MIN_IO 0x1000
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#define PCIBIOS_MIN_MEM (pci_mem_start)
43
Linus Torvalds2ba84682005-08-14 18:21:30 -070044#define PCIBIOS_MIN_CARDBUS_IO 0x4000
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046void pcibios_config_init(void);
47struct pci_bus * pcibios_scan_root(int bus);
48extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
49extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value);
50
51void pcibios_set_master(struct pci_dev *dev);
David Shaohua Lic9c3e452005-04-01 00:07:31 -050052void pcibios_penalize_isa_irq(int irq, int active);
Linus Torvalds1da177e2005-04-16 15:20:36 -070053struct irq_routing_table *pcibios_get_irq_routing_table(void);
54int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
55
56#include <linux/types.h>
57#include <linux/slab.h>
58#include <asm/scatterlist.h>
59#include <linux/string.h>
60#include <asm/page.h>
61
Jon Mason0dc243a2006-06-26 13:58:11 +020062extern void pci_iommu_alloc(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070063extern int iommu_setup(char *opt);
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065/* The PCI address space does equal the physical memory
66 * address space. The networking and block device layers use
67 * this boolean for bounce buffer decisions
68 *
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +010069 * On AMD64 it mostly equals, but we set it to zero if a hardware
70 * IOMMU (gart) of sotware IOMMU (swiotlb) is available.
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 */
Muli Ben-Yehuda17a941d2006-01-11 22:44:42 +010072#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
73
Jon Masone4650582006-06-26 13:58:14 +020074#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Linus Torvalds1da177e2005-04-16 15:20:36 -070076#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
77 dma_addr_t ADDR_NAME;
78#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
79 __u32 LEN_NAME;
80#define pci_unmap_addr(PTR, ADDR_NAME) \
81 ((PTR)->ADDR_NAME)
82#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
83 (((PTR)->ADDR_NAME) = (VAL))
84#define pci_unmap_len(PTR, LEN_NAME) \
85 ((PTR)->LEN_NAME)
86#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
87 (((PTR)->LEN_NAME) = (VAL))
88
89#else
90/* No IOMMU */
91
Linus Torvalds1da177e2005-04-16 15:20:36 -070092#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
93#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
94#define pci_unmap_addr(PTR, ADDR_NAME) (0)
95#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
96#define pci_unmap_len(PTR, LEN_NAME) (0)
97#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
98
99#endif
100
101#include <asm-generic/pci-dma-compat.h>
102
Andrew Mortonbb4a61b2005-06-06 23:07:46 -0700103#ifdef CONFIG_PCI
David S. Millere24c2d92005-06-02 12:55:50 -0700104static inline void pci_dma_burst_advice(struct pci_dev *pdev,
105 enum pci_dma_burst_strategy *strat,
106 unsigned long *strategy_parameter)
107{
108 *strat = PCI_DMA_BURST_INFINITY;
109 *strategy_parameter = ~0UL;
110}
Andrew Mortonbb4a61b2005-06-06 23:07:46 -0700111#endif
David S. Millere24c2d92005-06-02 12:55:50 -0700112
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113#define HAVE_PCI_MMAP
114extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
115 enum pci_mmap_state mmap_state, int write_combine);
116
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117#endif /* __KERNEL__ */
118
119/* generic pci stuff */
120#ifdef CONFIG_PCI
121#include <asm-generic/pci.h>
122#endif
123
124#endif /* __x8664_PCI_H */