1#ifndef __ASM_PARISC_PCI_H
2#define __ASM_PARISC_PCI_H
3
4#include <asm/scatterlist.h>
5
6
7
8
9
10
11
12
13
14
15
16
17
18#define PCI_MAX_BUSSES 256
19
20
21
22
23
24
25
26
27
28
29#define pci_post_reset_delay 50
30
31
32
33
34
35
36
37
38
39
40
41struct pci_hba_data {
42 void __iomem *base_addr;
43 const struct parisc_device *dev;
44 struct pci_bus *hba_bus;
45 int hba_num;
46 struct resource bus_num;
47 struct resource io_space;
48 struct resource lmmio_space;
49 struct resource elmmio_space;
50 struct resource gmmio_space;
51
52
53
54
55 #define DINO_MAX_LMMIO_RESOURCES 3
56
57 unsigned long lmmio_space_offset;
58 void * iommu;
59
60
61 #define HBA_NAME_SIZE 16
62 char io_name[HBA_NAME_SIZE];
63 char lmmio_name[HBA_NAME_SIZE];
64 char elmmio_name[HBA_NAME_SIZE];
65 char gmmio_name[HBA_NAME_SIZE];
66};
67
68#define HBA_DATA(d) ((struct pci_hba_data *) (d))
69
70
71
72
73
74
75#define HBA_PORT_SPACE_BITS 16
76
77#define HBA_PORT_BASE(h) ((h) << HBA_PORT_SPACE_BITS)
78#define HBA_PORT_SPACE_SIZE (1UL << HBA_PORT_SPACE_BITS)
79
80#define PCI_PORT_HBA(a) ((a) >> HBA_PORT_SPACE_BITS)
81#define PCI_PORT_ADDR(a) ((a) & (HBA_PORT_SPACE_SIZE - 1))
82
83#ifdef CONFIG_64BIT
84#define PCI_F_EXTEND 0xffffffff00000000UL
85#define PCI_IS_LMMIO(hba,a) pci_is_lmmio(hba,a)
86
87
88
89
90static __inline__ int pci_is_lmmio(struct pci_hba_data *hba, unsigned long a)
91{
92 return(((a) & PCI_F_EXTEND) == PCI_F_EXTEND);
93}
94
95
96
97
98
99
100
101
102
103#define PCI_BUS_ADDR(hba,a) (PCI_IS_LMMIO(hba,a) \
104 ? ((a) - hba->lmmio_space_offset) \
105 : (a))
106#define PCI_HOST_ADDR(hba,a) (((a) & PCI_F_EXTEND) == 0 \
107 ? (a) + hba->lmmio_space_offset \
108 : (a))
109
110#else
111
112#define PCI_BUS_ADDR(hba,a) (a)
113#define PCI_HOST_ADDR(hba,a) (a)
114#define PCI_F_EXTEND 0UL
115#define PCI_IS_LMMIO(hba,a) (1)
116
117#endif
118
119
120
121
122
123struct pci_bus;
124struct pci_dev;
125
126
127
128
129
130
131#ifdef CONFIG_PA20
132
133#define PCI_DMA_BUS_IS_PHYS 0
134#define parisc_has_iommu() do { } while (0)
135#else
136
137#if defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA)
138extern int parisc_bus_is_phys;
139#define PCI_DMA_BUS_IS_PHYS parisc_bus_is_phys
140#define parisc_has_iommu() do { parisc_bus_is_phys = 0; } while (0)
141#else
142#define PCI_DMA_BUS_IS_PHYS 1
143#define parisc_has_iommu() do { } while (0)
144#endif
145
146#endif
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171struct pci_port_ops {
172 u8 (*inb) (struct pci_hba_data *hba, u16 port);
173 u16 (*inw) (struct pci_hba_data *hba, u16 port);
174 u32 (*inl) (struct pci_hba_data *hba, u16 port);
175 void (*outb) (struct pci_hba_data *hba, u16 port, u8 data);
176 void (*outw) (struct pci_hba_data *hba, u16 port, u16 data);
177 void (*outl) (struct pci_hba_data *hba, u16 port, u32 data);
178};
179
180
181struct pci_bios_ops {
182 void (*init)(void);
183 void (*fixup_bus)(struct pci_bus *bus);
184};
185
186
187#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
188 dma_addr_t ADDR_NAME;
189#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
190 __u32 LEN_NAME;
191#define pci_unmap_addr(PTR, ADDR_NAME) \
192 ((PTR)->ADDR_NAME)
193#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
194 (((PTR)->ADDR_NAME) = (VAL))
195#define pci_unmap_len(PTR, LEN_NAME) \
196 ((PTR)->LEN_NAME)
197#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
198 (((PTR)->LEN_NAME) = (VAL))
199
200
201
202
203extern struct pci_port_ops *pci_port;
204extern struct pci_bios_ops *pci_bios;
205
206#ifdef CONFIG_PCI
207extern void pcibios_register_hba(struct pci_hba_data *);
208extern void pcibios_set_master(struct pci_dev *);
209#else
210static inline void pcibios_register_hba(struct pci_hba_data *x)
211{
212}
213#endif
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235#define pcibios_assign_all_busses() (1)
236#define pcibios_scan_all_fns(a, b) (0)
237
238#define PCIBIOS_MIN_IO 0x10
239#define PCIBIOS_MIN_MEM 0x1000
240
241
242#include <asm-generic/pci-dma-compat.h>
243
244#ifdef CONFIG_PCI
245static inline void pci_dma_burst_advice(struct pci_dev *pdev,
246 enum pci_dma_burst_strategy *strat,
247 unsigned long *strategy_parameter)
248{
249 unsigned long cacheline_size;
250 u8 byte;
251
252 pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
253 if (byte == 0)
254 cacheline_size = 1024;
255 else
256 cacheline_size = (int) byte * 4;
257
258 *strat = PCI_DMA_BURST_MULTIPLE;
259 *strategy_parameter = cacheline_size;
260}
261#endif
262
263extern void
264pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
265 struct resource *res);
266
267extern void
268pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
269 struct pci_bus_region *region);
270
271static inline struct resource *
272pcibios_select_root(struct pci_dev *pdev, struct resource *res)
273{
274 struct resource *root = NULL;
275
276 if (res->flags & IORESOURCE_IO)
277 root = &ioport_resource;
278 if (res->flags & IORESOURCE_MEM)
279 root = &iomem_resource;
280
281 return root;
282}
283
284static inline void pcibios_penalize_isa_irq(int irq, int active)
285{
286
287}
288
289static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
290{
291 return channel ? 15 : 14;
292}
293
294#endif
295