diff options
Diffstat (limited to 'include/asm-sparc64/pbm.h')
-rw-r--r-- | include/asm-sparc64/pbm.h | 132 |
1 files changed, 7 insertions, 125 deletions
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h index 7a246d8a1828..c008cecca149 100644 --- a/include/asm-sparc64/pbm.h +++ b/include/asm-sparc64/pbm.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* $Id: pbm.h,v 1.27 2001/08/12 13:18:23 davem Exp $ | 1 | /* pbm.h: UltraSparc PCI controller software state. |
2 | * pbm.h: UltraSparc PCI controller software state. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 1997, 1998, 1999, 2007 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | ||
7 | #ifndef __SPARC64_PBM_H | 6 | #ifndef __SPARC64_PBM_H |
@@ -30,90 +29,7 @@ | |||
30 | * PCI bus. | 29 | * PCI bus. |
31 | */ | 30 | */ |
32 | 31 | ||
33 | struct pci_controller_info; | 32 | extern void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask); |
34 | |||
35 | /* This contains the software state necessary to drive a PCI | ||
36 | * controller's IOMMU. | ||
37 | */ | ||
38 | struct pci_iommu_arena { | ||
39 | unsigned long *map; | ||
40 | unsigned int hint; | ||
41 | unsigned int limit; | ||
42 | }; | ||
43 | |||
44 | struct pci_iommu { | ||
45 | /* This protects the controller's IOMMU and all | ||
46 | * streaming buffers underneath. | ||
47 | */ | ||
48 | spinlock_t lock; | ||
49 | |||
50 | struct pci_iommu_arena arena; | ||
51 | |||
52 | /* IOMMU page table, a linear array of ioptes. */ | ||
53 | iopte_t *page_table; /* The page table itself. */ | ||
54 | |||
55 | /* Base PCI memory space address where IOMMU mappings | ||
56 | * begin. | ||
57 | */ | ||
58 | u32 page_table_map_base; | ||
59 | |||
60 | /* IOMMU Controller Registers */ | ||
61 | unsigned long iommu_control; /* IOMMU control register */ | ||
62 | unsigned long iommu_tsbbase; /* IOMMU page table base register */ | ||
63 | unsigned long iommu_flush; /* IOMMU page flush register */ | ||
64 | unsigned long iommu_ctxflush; /* IOMMU context flush register */ | ||
65 | |||
66 | /* This is a register in the PCI controller, which if | ||
67 | * read will have no side-effects but will guarantee | ||
68 | * completion of all previous writes into IOMMU/STC. | ||
69 | */ | ||
70 | unsigned long write_complete_reg; | ||
71 | |||
72 | /* In order to deal with some buggy third-party PCI bridges that | ||
73 | * do wrong prefetching, we never mark valid mappings as invalid. | ||
74 | * Instead we point them at this dummy page. | ||
75 | */ | ||
76 | unsigned long dummy_page; | ||
77 | unsigned long dummy_page_pa; | ||
78 | |||
79 | /* CTX allocation. */ | ||
80 | unsigned long ctx_lowest_free; | ||
81 | unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)]; | ||
82 | |||
83 | /* Here a PCI controller driver describes the areas of | ||
84 | * PCI memory space where DMA to/from physical memory | ||
85 | * are addressed. Drivers interrogate the PCI layer | ||
86 | * if their device has addressing limitations. They | ||
87 | * do so via pci_dma_supported, and pass in a mask of | ||
88 | * DMA address bits their device can actually drive. | ||
89 | * | ||
90 | * The test for being usable is: | ||
91 | * (device_mask & dma_addr_mask) == dma_addr_mask | ||
92 | */ | ||
93 | u32 dma_addr_mask; | ||
94 | }; | ||
95 | |||
96 | extern void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask); | ||
97 | |||
98 | /* This describes a PCI bus module's streaming buffer. */ | ||
99 | struct pci_strbuf { | ||
100 | int strbuf_enabled; /* Present and using it? */ | ||
101 | |||
102 | /* Streaming Buffer Control Registers */ | ||
103 | unsigned long strbuf_control; /* STC control register */ | ||
104 | unsigned long strbuf_pflush; /* STC page flush register */ | ||
105 | unsigned long strbuf_fsync; /* STC flush synchronization reg */ | ||
106 | unsigned long strbuf_ctxflush; /* STC context flush register */ | ||
107 | unsigned long strbuf_ctxmatch_base; /* STC context flush match reg */ | ||
108 | unsigned long strbuf_flushflag_pa; /* Physical address of flush flag */ | ||
109 | volatile unsigned long *strbuf_flushflag; /* The flush flag itself */ | ||
110 | |||
111 | /* And this is the actual flush flag area. | ||
112 | * We allocate extra because the chips require | ||
113 | * a 64-byte aligned area. | ||
114 | */ | ||
115 | volatile unsigned long __flushflag_buf[(64 + (64 - 1)) / sizeof(long)]; | ||
116 | }; | ||
117 | 33 | ||
118 | #define PCI_STC_FLUSHFLAG_INIT(STC) \ | 34 | #define PCI_STC_FLUSHFLAG_INIT(STC) \ |
119 | (*((STC)->strbuf_flushflag) = 0UL) | 35 | (*((STC)->strbuf_flushflag) = 0UL) |
@@ -126,6 +42,8 @@ struct pci_strbuf { | |||
126 | #define PROM_PCIRNG_MAX 64 | 42 | #define PROM_PCIRNG_MAX 64 |
127 | #define PROM_PCIIMAP_MAX 64 | 43 | #define PROM_PCIIMAP_MAX 64 |
128 | 44 | ||
45 | struct pci_controller_info; | ||
46 | |||
129 | struct pci_pbm_info { | 47 | struct pci_pbm_info { |
130 | /* PCI controller we sit under. */ | 48 | /* PCI controller we sit under. */ |
131 | struct pci_controller_info *parent; | 49 | struct pci_controller_info *parent; |
@@ -160,11 +78,6 @@ struct pci_pbm_info { | |||
160 | 78 | ||
161 | /* OBP specific information. */ | 79 | /* OBP specific information. */ |
162 | struct device_node *prom_node; | 80 | struct device_node *prom_node; |
163 | struct linux_prom_pci_ranges *pbm_ranges; | ||
164 | int num_pbm_ranges; | ||
165 | struct linux_prom_pci_intmap *pbm_intmap; | ||
166 | int num_pbm_intmap; | ||
167 | struct linux_prom_pci_intmask *pbm_intmask; | ||
168 | u64 ino_bitmap; | 81 | u64 ino_bitmap; |
169 | 82 | ||
170 | /* PBM I/O and Memory space resources. */ | 83 | /* PBM I/O and Memory space resources. */ |
@@ -197,13 +110,10 @@ struct pci_pbm_info { | |||
197 | #endif /* !(CONFIG_PCI_MSI) */ | 110 | #endif /* !(CONFIG_PCI_MSI) */ |
198 | 111 | ||
199 | /* This PBM's streaming buffer. */ | 112 | /* This PBM's streaming buffer. */ |
200 | struct pci_strbuf stc; | 113 | struct strbuf stc; |
201 | 114 | ||
202 | /* IOMMU state, potentially shared by both PBM segments. */ | 115 | /* IOMMU state, potentially shared by both PBM segments. */ |
203 | struct pci_iommu *iommu; | 116 | struct iommu *iommu; |
204 | |||
205 | /* PCI slot mapping. */ | ||
206 | unsigned int pci_first_slot; | ||
207 | 117 | ||
208 | /* Now things for the actual PCI bus probes. */ | 118 | /* Now things for the actual PCI bus probes. */ |
209 | unsigned int pci_first_busno; | 119 | unsigned int pci_first_busno; |
@@ -220,17 +130,12 @@ struct pci_controller_info { | |||
220 | */ | 130 | */ |
221 | int index; | 131 | int index; |
222 | 132 | ||
223 | /* Do the PBMs both exist in the same PCI domain? */ | ||
224 | int pbms_same_domain; | ||
225 | |||
226 | /* The PCI bus modules controlled by us. */ | 133 | /* The PCI bus modules controlled by us. */ |
227 | struct pci_pbm_info pbm_A; | 134 | struct pci_pbm_info pbm_A; |
228 | struct pci_pbm_info pbm_B; | 135 | struct pci_pbm_info pbm_B; |
229 | 136 | ||
230 | /* Operations which are controller specific. */ | 137 | /* Operations which are controller specific. */ |
231 | void (*scan_bus)(struct pci_controller_info *); | 138 | void (*scan_bus)(struct pci_controller_info *); |
232 | void (*base_address_update)(struct pci_dev *, int); | ||
233 | void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *); | ||
234 | 139 | ||
235 | #ifdef CONFIG_PCI_MSI | 140 | #ifdef CONFIG_PCI_MSI |
236 | int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev, | 141 | int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev, |
@@ -244,27 +149,4 @@ struct pci_controller_info { | |||
244 | unsigned int pci_last_busno; | 149 | unsigned int pci_last_busno; |
245 | }; | 150 | }; |
246 | 151 | ||
247 | /* PCI devices which are not bridges have this placed in their pci_dev | ||
248 | * sysdata member. This makes OBP aware PCI device drivers easier to | ||
249 | * code. | ||
250 | */ | ||
251 | struct pcidev_cookie { | ||
252 | struct pci_pbm_info *pbm; | ||
253 | struct device_node *prom_node; | ||
254 | struct of_device *op; | ||
255 | struct linux_prom_pci_registers prom_regs[PROMREG_MAX]; | ||
256 | int num_prom_regs; | ||
257 | struct linux_prom_pci_registers prom_assignments[PROMREG_MAX]; | ||
258 | int num_prom_assignments; | ||
259 | #ifdef CONFIG_PCI_MSI | ||
260 | unsigned int msi_num; | ||
261 | #endif | ||
262 | }; | ||
263 | |||
264 | /* Currently these are the same across all PCI controllers | ||
265 | * we support. Someday they may not be... | ||
266 | */ | ||
267 | #define PCI_IRQ_IGN 0x000007c0 /* Interrupt Group Number */ | ||
268 | #define PCI_IRQ_INO 0x0000003f /* Interrupt Number */ | ||
269 | |||
270 | #endif /* !(__SPARC64_PBM_H) */ | 152 | #endif /* !(__SPARC64_PBM_H) */ |