Commit | Line | Data |
---|---|---|
f3e6f164 GKH |
1 | #ifndef __x86_PCI_H |
2 | #define __x86_PCI_H | |
3 | ||
4 | #include <linux/mm.h> /* for struct page */ | |
5 | #include <linux/types.h> | |
6 | #include <linux/slab.h> | |
7 | #include <linux/string.h> | |
8 | #include <asm/scatterlist.h> | |
9 | #include <asm/io.h> | |
10 | ||
f3e6f164 GKH |
11 | #ifdef __KERNEL__ |
12 | ||
13 | struct pci_sysdata { | |
14 | int domain; /* PCI domain */ | |
15 | int node; /* NUMA node */ | |
16 | #ifdef CONFIG_X86_64 | |
69bdb7bc | 17 | void *iommu; /* IOMMU private data */ |
f3e6f164 GKH |
18 | #endif |
19 | }; | |
20 | ||
07156509 | 21 | extern int pci_routeirq; |
a9322f64 | 22 | extern int noioapicquirk; |
07156509 | 23 | |
f3e6f164 | 24 | /* scan a bus after allocating a pci_sysdata for it */ |
871d5f8d YL |
25 | extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, |
26 | int node); | |
f3e6f164 GKH |
27 | extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); |
28 | ||
29 | static inline int pci_domain_nr(struct pci_bus *bus) | |
30 | { | |
31 | struct pci_sysdata *sd = bus->sysdata; | |
32 | return sd->domain; | |
33 | } | |
34 | ||
35 | static inline int pci_proc_domain(struct pci_bus *bus) | |
36 | { | |
37 | return pci_domain_nr(bus); | |
38 | } | |
39 | ||
40 | ||
41 | /* Can be used to override the logic in pci_scan_bus for skipping | |
42 | already-configured bus numbers - to be used for buggy BIOSes | |
43 | or architectures with incomplete PCI setup by the loader */ | |
44 | ||
45 | #ifdef CONFIG_PCI | |
46 | extern unsigned int pcibios_assign_all_busses(void); | |
47 | #else | |
48 | #define pcibios_assign_all_busses() 0 | |
49 | #endif | |
50 | #define pcibios_scan_all_fns(a, b) 0 | |
51 | ||
52 | extern unsigned long pci_mem_start; | |
53 | #define PCIBIOS_MIN_IO 0x1000 | |
54 | #define PCIBIOS_MIN_MEM (pci_mem_start) | |
55 | ||
56 | #define PCIBIOS_MIN_CARDBUS_IO 0x4000 | |
57 | ||
58 | void pcibios_config_init(void); | |
69bdb7bc | 59 | struct pci_bus *pcibios_scan_root(int bus); |
f3e6f164 GKH |
60 | |
61 | void pcibios_set_master(struct pci_dev *dev); | |
62 | void pcibios_penalize_isa_irq(int irq, int active); | |
63 | struct irq_routing_table *pcibios_get_irq_routing_table(void); | |
64 | int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); | |
65 | ||
66 | ||
67 | #define HAVE_PCI_MMAP | |
68 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |
69bdb7bc JP |
69 | enum pci_mmap_state mmap_state, |
70 | int write_combine); | |
f3e6f164 GKH |
71 | |
72 | ||
73 | #ifdef CONFIG_PCI | |
376ff035 | 74 | extern void early_quirks(void); |
f3e6f164 GKH |
75 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
76 | enum pci_dma_burst_strategy *strat, | |
77 | unsigned long *strategy_parameter) | |
78 | { | |
79 | *strat = PCI_DMA_BURST_INFINITY; | |
80 | *strategy_parameter = ~0UL; | |
81 | } | |
376ff035 TG |
82 | #else |
83 | static inline void early_quirks(void) { } | |
f3e6f164 GKH |
84 | #endif |
85 | ||
f3e6f164 GKH |
86 | #endif /* __KERNEL__ */ |
87 | ||
96a388de TG |
88 | #ifdef CONFIG_X86_32 |
89 | # include "pci_32.h" | |
90 | #else | |
91 | # include "pci_64.h" | |
f3e6f164 GKH |
92 | #endif |
93 | ||
94 | /* implement the pci_ DMA API in terms of the generic device dma_ one */ | |
95 | #include <asm-generic/pci-dma-compat.h> | |
96 | ||
97 | /* generic pci stuff */ | |
98 | #include <asm-generic/pci.h> | |
99 | ||
b4ea9299 TG |
100 | #ifdef CONFIG_NUMA |
101 | /* Returns the node based on pci bus */ | |
102 | static inline int __pcibus_to_node(struct pci_bus *bus) | |
103 | { | |
104 | struct pci_sysdata *sd = bus->sysdata; | |
105 | ||
106 | return sd->node; | |
107 | } | |
f3e6f164 | 108 | |
b4ea9299 TG |
109 | static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus) |
110 | { | |
111 | return node_to_cpumask(__pcibus_to_node(bus)); | |
112 | } | |
113 | #endif | |
f3e6f164 | 114 | |
96a388de | 115 | #endif |