diff options
-rw-r--r-- | arch/m68k/Kconfig | 4 | ||||
-rw-r--r-- | arch/m68k/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/m68k/kernel/bios32.c | 516 | ||||
-rw-r--r-- | include/asm-m68k/dma.h | 4 | ||||
-rw-r--r-- | include/asm-m68k/io.h | 66 | ||||
-rw-r--r-- | include/asm-m68k/pci.h | 46 |
6 files changed, 7 insertions, 630 deletions
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 2ec21f7fcb5..677c93a490f 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -122,10 +122,6 @@ config ATARI | |||
122 | this kernel on an Atari, say Y here and browse the material | 122 | this kernel on an Atari, say Y here and browse the material |
123 | available in <file:Documentation/m68k>; otherwise say N. | 123 | available in <file:Documentation/m68k>; otherwise say N. |
124 | 124 | ||
125 | config PCI | ||
126 | bool | ||
127 | help | ||
128 | |||
129 | config MAC | 125 | config MAC |
130 | bool "Macintosh support" | 126 | bool "Macintosh support" |
131 | select MMU_MOTOROLA if MMU | 127 | select MMU_MOTOROLA if MMU |
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index 3a7f6222550..55d5d6b680a 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile | |||
@@ -14,5 +14,4 @@ obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \ | |||
14 | 14 | ||
15 | devres-y = ../../../kernel/irq/devres.o | 15 | devres-y = ../../../kernel/irq/devres.o |
16 | 16 | ||
17 | obj-$(CONFIG_PCI) += bios32.o | ||
18 | obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo | 17 | obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo |
diff --git a/arch/m68k/kernel/bios32.c b/arch/m68k/kernel/bios32.c deleted file mode 100644 index 1c3b752f560..00000000000 --- a/arch/m68k/kernel/bios32.c +++ /dev/null | |||
@@ -1,516 +0,0 @@ | |||
1 | /* | ||
2 | * bios32.c - PCI BIOS functions for m68k systems. | ||
3 | * | ||
4 | * Written by Wout Klaren. | ||
5 | * | ||
6 | * Based on the DEC Alpha bios32.c by Dave Rusling and David Mosberger. | ||
7 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/kernel.h> | ||
11 | |||
12 | #if 0 | ||
13 | # define DBG_DEVS(args) printk args | ||
14 | #else | ||
15 | # define DBG_DEVS(args) | ||
16 | #endif | ||
17 | |||
18 | #ifdef CONFIG_PCI | ||
19 | |||
20 | /* | ||
21 | * PCI support for Linux/m68k. Currently only the Hades is supported. | ||
22 | * | ||
23 | * The support for PCI bridges in the DEC Alpha version has | ||
24 | * been removed in this version. | ||
25 | */ | ||
26 | |||
27 | #include <linux/pci.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/mm.h> | ||
30 | |||
31 | #include <asm/io.h> | ||
32 | #include <asm/pci.h> | ||
33 | #include <asm/uaccess.h> | ||
34 | |||
35 | #define KB 1024 | ||
36 | #define MB (1024*KB) | ||
37 | #define GB (1024*MB) | ||
38 | |||
39 | #define MAJOR_REV 0 | ||
40 | #define MINOR_REV 5 | ||
41 | |||
42 | /* | ||
43 | * Align VAL to ALIGN, which must be a power of two. | ||
44 | */ | ||
45 | |||
46 | #define ALIGN(val,align) (((val) + ((align) - 1)) & ~((align) - 1)) | ||
47 | |||
48 | /* | ||
49 | * Offsets relative to the I/O and memory base addresses from where resources | ||
50 | * are allocated. | ||
51 | */ | ||
52 | |||
53 | #define IO_ALLOC_OFFSET 0x00004000 | ||
54 | #define MEM_ALLOC_OFFSET 0x04000000 | ||
55 | |||
56 | /* | ||
57 | * Declarations of hardware specific initialisation functions. | ||
58 | */ | ||
59 | |||
60 | extern struct pci_bus_info *init_hades_pci(void); | ||
61 | |||
62 | /* | ||
63 | * Bus info structure of the PCI bus. A pointer to this structure is | ||
64 | * put in the sysdata member of the pci_bus structure. | ||
65 | */ | ||
66 | |||
67 | static struct pci_bus_info *bus_info; | ||
68 | |||
69 | static int pci_modify = 1; /* If set, layout the PCI bus ourself. */ | ||
70 | static int skip_vga; /* If set do not modify base addresses | ||
71 | of vga cards.*/ | ||
72 | static int disable_pci_burst; /* If set do not allow PCI bursts. */ | ||
73 | |||
74 | static unsigned int io_base; | ||
75 | static unsigned int mem_base; | ||
76 | |||
77 | /* | ||
78 | * static void disable_dev(struct pci_dev *dev) | ||
79 | * | ||
80 | * Disable PCI device DEV so that it does not respond to I/O or memory | ||
81 | * accesses. | ||
82 | * | ||
83 | * Parameters: | ||
84 | * | ||
85 | * dev - device to disable. | ||
86 | */ | ||
87 | |||
88 | static void __init disable_dev(struct pci_dev *dev) | ||
89 | { | ||
90 | unsigned short cmd; | ||
91 | |||
92 | if (((dev->class >> 8 == PCI_CLASS_NOT_DEFINED_VGA) || | ||
93 | (dev->class >> 8 == PCI_CLASS_DISPLAY_VGA) || | ||
94 | (dev->class >> 8 == PCI_CLASS_DISPLAY_XGA)) && skip_vga) | ||
95 | return; | ||
96 | |||
97 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
98 | |||
99 | cmd &= (~PCI_COMMAND_IO & ~PCI_COMMAND_MEMORY & ~PCI_COMMAND_MASTER); | ||
100 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
101 | } | ||
102 | |||
103 | /* | ||
104 | * static void layout_dev(struct pci_dev *dev) | ||
105 | * | ||
106 | * Layout memory and I/O for a device. | ||
107 | * | ||
108 | * Parameters: | ||
109 | * | ||
110 | * device - device to layout memory and I/O for. | ||
111 | */ | ||
112 | |||
113 | static void __init layout_dev(struct pci_dev *dev) | ||
114 | { | ||
115 | unsigned short cmd; | ||
116 | unsigned int base, mask, size, reg; | ||
117 | unsigned int alignto; | ||
118 | int i; | ||
119 | |||
120 | /* | ||
121 | * Skip video cards if requested. | ||
122 | */ | ||
123 | |||
124 | if (((dev->class >> 8 == PCI_CLASS_NOT_DEFINED_VGA) || | ||
125 | (dev->class >> 8 == PCI_CLASS_DISPLAY_VGA) || | ||
126 | (dev->class >> 8 == PCI_CLASS_DISPLAY_XGA)) && skip_vga) | ||
127 | return; | ||
128 | |||
129 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
130 | |||
131 | for (reg = PCI_BASE_ADDRESS_0, i = 0; reg <= PCI_BASE_ADDRESS_5; reg += 4, i++) | ||
132 | { | ||
133 | /* | ||
134 | * Figure out how much space and of what type this | ||
135 | * device wants. | ||
136 | */ | ||
137 | |||
138 | pci_write_config_dword(dev, reg, 0xffffffff); | ||
139 | pci_read_config_dword(dev, reg, &base); | ||
140 | |||
141 | if (!base) | ||
142 | { | ||
143 | /* this base-address register is unused */ | ||
144 | dev->resource[i].start = 0; | ||
145 | dev->resource[i].end = 0; | ||
146 | dev->resource[i].flags = 0; | ||
147 | continue; | ||
148 | } | ||
149 | |||
150 | /* | ||
151 | * We've read the base address register back after | ||
152 | * writing all ones and so now we must decode it. | ||
153 | */ | ||
154 | |||
155 | if (base & PCI_BASE_ADDRESS_SPACE_IO) | ||
156 | { | ||
157 | /* | ||
158 | * I/O space base address register. | ||
159 | */ | ||
160 | |||
161 | cmd |= PCI_COMMAND_IO; | ||
162 | |||
163 | base &= PCI_BASE_ADDRESS_IO_MASK; | ||
164 | mask = (~base << 1) | 0x1; | ||
165 | size = (mask & base) & 0xffffffff; | ||
166 | |||
167 | /* | ||
168 | * Align to multiple of size of minimum base. | ||
169 | */ | ||
170 | |||
171 | alignto = max_t(unsigned int, 0x040, size); | ||
172 | base = ALIGN(io_base, alignto); | ||
173 | io_base = base + size; | ||
174 | pci_write_config_dword(dev, reg, base | PCI_BASE_ADDRESS_SPACE_IO); | ||
175 | |||
176 | dev->resource[i].start = base; | ||
177 | dev->resource[i].end = dev->resource[i].start + size - 1; | ||
178 | dev->resource[i].flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO; | ||
179 | |||
180 | DBG_DEVS(("layout_dev: IO address: %lX\n", base)); | ||
181 | } | ||
182 | else | ||
183 | { | ||
184 | unsigned int type; | ||
185 | |||
186 | /* | ||
187 | * Memory space base address register. | ||
188 | */ | ||
189 | |||
190 | cmd |= PCI_COMMAND_MEMORY; | ||
191 | type = base & PCI_BASE_ADDRESS_MEM_TYPE_MASK; | ||
192 | base &= PCI_BASE_ADDRESS_MEM_MASK; | ||
193 | mask = (~base << 1) | 0x1; | ||
194 | size = (mask & base) & 0xffffffff; | ||
195 | switch (type) | ||
196 | { | ||
197 | case PCI_BASE_ADDRESS_MEM_TYPE_32: | ||
198 | case PCI_BASE_ADDRESS_MEM_TYPE_64: | ||
199 | break; | ||
200 | |||
201 | case PCI_BASE_ADDRESS_MEM_TYPE_1M: | ||
202 | printk("bios32 WARNING: slot %d, function %d " | ||
203 | "requests memory below 1MB---don't " | ||
204 | "know how to do that.\n", | ||
205 | PCI_SLOT(dev->devfn), | ||
206 | PCI_FUNC(dev->devfn)); | ||
207 | continue; | ||
208 | } | ||
209 | |||
210 | /* | ||
211 | * Align to multiple of size of minimum base. | ||
212 | */ | ||
213 | |||
214 | alignto = max_t(unsigned int, 0x1000, size); | ||
215 | base = ALIGN(mem_base, alignto); | ||
216 | mem_base = base + size; | ||
217 | pci_write_config_dword(dev, reg, base); | ||
218 | |||
219 | dev->resource[i].start = base; | ||
220 | dev->resource[i].end = dev->resource[i].start + size - 1; | ||
221 | dev->resource[i].flags = IORESOURCE_MEM; | ||
222 | |||
223 | if (type == PCI_BASE_ADDRESS_MEM_TYPE_64) | ||
224 | { | ||
225 | /* | ||
226 | * 64-bit address, set the highest 32 bits | ||
227 | * to zero. | ||
228 | */ | ||
229 | |||
230 | reg += 4; | ||
231 | pci_write_config_dword(dev, reg, 0); | ||
232 | |||
233 | i++; | ||
234 | dev->resource[i].start = 0; | ||
235 | dev->resource[i].end = 0; | ||
236 | dev->resource[i].flags = 0; | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * Enable device: | ||
243 | */ | ||
244 | |||
245 | if (dev->class >> 8 == PCI_CLASS_NOT_DEFINED || | ||
246 | dev->class >> 8 == PCI_CLASS_NOT_DEFINED_VGA || | ||
247 | dev->class >> 8 == PCI_CLASS_DISPLAY_VGA || | ||
248 | dev->class >> 8 == PCI_CLASS_DISPLAY_XGA) | ||
249 | { | ||
250 | /* | ||
251 | * All of these (may) have I/O scattered all around | ||
252 | * and may not use i/o-base address registers at all. | ||
253 | * So we just have to always enable I/O to these | ||
254 | * devices. | ||
255 | */ | ||
256 | cmd |= PCI_COMMAND_IO; | ||
257 | } | ||
258 | |||
259 | pci_write_config_word(dev, PCI_COMMAND, cmd | PCI_COMMAND_MASTER); | ||
260 | |||
261 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, (disable_pci_burst) ? 0 : 32); | ||
262 | |||
263 | if (bus_info != NULL) | ||
264 | bus_info->conf_device(dev); /* Machine dependent configuration. */ | ||
265 | |||
266 | DBG_DEVS(("layout_dev: bus %d slot 0x%x VID 0x%x DID 0x%x class 0x%x\n", | ||
267 | dev->bus->number, PCI_SLOT(dev->devfn), dev->vendor, dev->device, dev->class)); | ||
268 | } | ||
269 | |||
270 | /* | ||
271 | * static void layout_bus(struct pci_bus *bus) | ||
272 | * | ||
273 | * Layout memory and I/O for all devices on the given bus. | ||
274 | * | ||
275 | * Parameters: | ||
276 | * | ||
277 | * bus - bus. | ||
278 | */ | ||
279 | |||
280 | static void __init layout_bus(struct pci_bus *bus) | ||
281 | { | ||
282 | unsigned int bio, bmem; | ||
283 | struct pci_dev *dev; | ||
284 | |||
285 | DBG_DEVS(("layout_bus: starting bus %d\n", bus->number)); | ||
286 | |||
287 | if (!bus->devices && !bus->children) | ||
288 | return; | ||
289 | |||
290 | /* | ||
291 | * Align the current bases on appropriate boundaries (4K for | ||
292 | * IO and 1MB for memory). | ||
293 | */ | ||
294 | |||
295 | bio = io_base = ALIGN(io_base, 4*KB); | ||
296 | bmem = mem_base = ALIGN(mem_base, 1*MB); | ||
297 | |||
298 | /* | ||
299 | * PCI devices might have been setup by a PCI BIOS emulation | ||
300 | * running under TOS. In these cases there is a | ||
301 | * window during which two devices may have an overlapping | ||
302 | * address range. To avoid this causing trouble, we first | ||
303 | * turn off the I/O and memory address decoders for all PCI | ||
304 | * devices. They'll be re-enabled only once all address | ||
305 | * decoders are programmed consistently. | ||
306 | */ | ||
307 | |||
308 | DBG_DEVS(("layout_bus: disable_dev for bus %d\n", bus->number)); | ||
309 | |||
310 | for (dev = bus->devices; dev; dev = dev->sibling) | ||
311 | { | ||
312 | if ((dev->class >> 16 != PCI_BASE_CLASS_BRIDGE) || | ||
313 | (dev->class >> 8 == PCI_CLASS_BRIDGE_PCMCIA)) | ||
314 | disable_dev(dev); | ||
315 | } | ||
316 | |||
317 | /* | ||
318 | * Allocate space to each device: | ||
319 | */ | ||
320 | |||
321 | DBG_DEVS(("layout_bus: starting bus %d devices\n", bus->number)); | ||
322 | |||
323 | for (dev = bus->devices; dev; dev = dev->sibling) | ||
324 | { | ||
325 | if ((dev->class >> 16 != PCI_BASE_CLASS_BRIDGE) || | ||
326 | (dev->class >> 8 == PCI_CLASS_BRIDGE_PCMCIA)) | ||
327 | layout_dev(dev); | ||
328 | } | ||
329 | |||
330 | DBG_DEVS(("layout_bus: bus %d finished\n", bus->number)); | ||
331 | } | ||
332 | |||
333 | /* | ||
334 | * static void pcibios_fixup(void) | ||
335 | * | ||
336 | * Layout memory and I/O of all devices on the PCI bus if 'pci_modify' is | ||
337 | * true. This might be necessary because not every m68k machine with a PCI | ||
338 | * bus has a PCI BIOS. This function should be called right after | ||
339 | * pci_scan_bus() in pcibios_init(). | ||
340 | */ | ||
341 | |||
342 | static void __init pcibios_fixup(void) | ||
343 | { | ||
344 | if (pci_modify) | ||
345 | { | ||
346 | /* | ||
347 | * Set base addresses for allocation of I/O and memory space. | ||
348 | */ | ||
349 | |||
350 | io_base = bus_info->io_space.start + IO_ALLOC_OFFSET; | ||
351 | mem_base = bus_info->mem_space.start + MEM_ALLOC_OFFSET; | ||
352 | |||
353 | /* | ||
354 | * Scan the tree, allocating PCI memory and I/O space. | ||
355 | */ | ||
356 | |||
357 | layout_bus(pci_bus_b(pci_root.next)); | ||
358 | } | ||
359 | |||
360 | /* | ||
361 | * Fix interrupt assignments, etc. | ||
362 | */ | ||
363 | |||
364 | bus_info->fixup(pci_modify); | ||
365 | } | ||
366 | |||
367 | /* | ||
368 | * static void pcibios_claim_resources(struct pci_bus *bus) | ||
369 | * | ||
370 | * Claim all resources that are assigned to devices on the given bus. | ||
371 | * | ||
372 | * Parameters: | ||
373 | * | ||
374 | * bus - bus. | ||
375 | */ | ||
376 | |||
377 | static void __init pcibios_claim_resources(struct pci_bus *bus) | ||
378 | { | ||
379 | struct pci_dev *dev; | ||
380 | int i; | ||
381 | |||
382 | while (bus) | ||
383 | { | ||
384 | for (dev = bus->devices; (dev != NULL); dev = dev->sibling) | ||
385 | { | ||
386 | for (i = 0; i < PCI_NUM_RESOURCES; i++) | ||
387 | { | ||
388 | struct resource *r = &dev->resource[i]; | ||
389 | struct resource *pr; | ||
390 | struct pci_bus_info *bus_info = (struct pci_bus_info *) dev->sysdata; | ||
391 | |||
392 | if ((r->start == 0) || (r->parent != NULL)) | ||
393 | continue; | ||
394 | #if 1 | ||
395 | if (r->flags & IORESOURCE_IO) | ||
396 | pr = &bus_info->io_space; | ||
397 | else | ||
398 | pr = &bus_info->mem_space; | ||
399 | #else | ||
400 | if (r->flags & IORESOURCE_IO) | ||
401 | pr = &ioport_resource; | ||
402 | else | ||
403 | pr = &iomem_resource; | ||
404 | #endif | ||
405 | if (request_resource(pr, r) < 0) | ||
406 | { | ||
407 | printk(KERN_ERR "PCI: Address space collision on region %d of device %s\n", i, dev->name); | ||
408 | } | ||
409 | } | ||
410 | } | ||
411 | |||
412 | if (bus->children) | ||
413 | pcibios_claim_resources(bus->children); | ||
414 | |||
415 | bus = bus->next; | ||
416 | } | ||
417 | } | ||
418 | |||
419 | /* | ||
420 | * int pcibios_assign_resource(struct pci_dev *dev, int i) | ||
421 | * | ||
422 | * Assign a new address to a PCI resource. | ||
423 | * | ||
424 | * Parameters: | ||
425 | * | ||
426 | * dev - device. | ||
427 | * i - resource. | ||
428 | * | ||
429 | * Result: 0 if successful. | ||
430 | */ | ||
431 | |||
432 | int __init pcibios_assign_resource(struct pci_dev *dev, int i) | ||
433 | { | ||
434 | struct resource *r = &dev->resource[i]; | ||
435 | struct resource *pr = pci_find_parent_resource(dev, r); | ||
436 | unsigned long size = r->end + 1; | ||
437 | |||
438 | if (!pr) | ||
439 | return -EINVAL; | ||
440 | |||
441 | if (r->flags & IORESOURCE_IO) | ||
442 | { | ||
443 | if (size > 0x100) | ||
444 | return -EFBIG; | ||
445 | |||
446 | if (allocate_resource(pr, r, size, bus_info->io_space.start + | ||
447 | IO_ALLOC_OFFSET, bus_info->io_space.end, 1024)) | ||
448 | return -EBUSY; | ||
449 | } | ||
450 | else | ||
451 | { | ||
452 | if (allocate_resource(pr, r, size, bus_info->mem_space.start + | ||
453 | MEM_ALLOC_OFFSET, bus_info->mem_space.end, size)) | ||
454 | return -EBUSY; | ||
455 | } | ||
456 | |||
457 | if (i < 6) | ||
458 | pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, r->start); | ||
459 | |||
460 | return 0; | ||
461 | } | ||
462 | |||
463 | void __init pcibios_fixup_bus(struct pci_bus *bus) | ||
464 | { | ||
465 | struct pci_dev *dev; | ||
466 | void *sysdata; | ||
467 | |||
468 | sysdata = (bus->parent) ? bus->parent->sysdata : bus->sysdata; | ||
469 | |||
470 | for (dev = bus->devices; (dev != NULL); dev = dev->sibling) | ||
471 | dev->sysdata = sysdata; | ||
472 | } | ||
473 | |||
474 | void __init pcibios_init(void) | ||
475 | { | ||
476 | printk("Linux/m68k PCI BIOS32 revision %x.%02x\n", MAJOR_REV, MINOR_REV); | ||
477 | |||
478 | bus_info = NULL; | ||
479 | |||
480 | /* Hades code was: | ||
481 | if (MACH_IS_HADES) | ||
482 | bus_info = init_hades_pci(); | ||
483 | */ | ||
484 | |||
485 | if (bus_info != NULL) | ||
486 | { | ||
487 | printk("PCI: Probing PCI hardware\n"); | ||
488 | pci_scan_bus(0, bus_info->m68k_pci_ops, bus_info); | ||
489 | pcibios_fixup(); | ||
490 | pcibios_claim_resources(pci_root); | ||
491 | } | ||
492 | else | ||
493 | printk("PCI: No PCI bus detected\n"); | ||
494 | } | ||
495 | |||
496 | char * __init pcibios_setup(char *str) | ||
497 | { | ||
498 | if (!strcmp(str, "nomodify")) | ||
499 | { | ||
500 | pci_modify = 0; | ||
501 | return NULL; | ||
502 | } | ||
503 | else if (!strcmp(str, "skipvga")) | ||
504 | { | ||
505 | skip_vga = 1; | ||
506 | return NULL; | ||
507 | } | ||
508 | else if (!strcmp(str, "noburst")) | ||
509 | { | ||
510 | disable_pci_burst = 1; | ||
511 | return NULL; | ||
512 | } | ||
513 | |||
514 | return str; | ||
515 | } | ||
516 | #endif /* CONFIG_PCI */ | ||
diff --git a/include/asm-m68k/dma.h b/include/asm-m68k/dma.h index d0c9e61e57b..4240fbc946f 100644 --- a/include/asm-m68k/dma.h +++ b/include/asm-m68k/dma.h | |||
@@ -11,10 +11,6 @@ | |||
11 | extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ | 11 | extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ |
12 | extern void free_dma(unsigned int dmanr); /* release it again */ | 12 | extern void free_dma(unsigned int dmanr); /* release it again */ |
13 | 13 | ||
14 | #ifdef CONFIG_PCI | ||
15 | extern int isa_dma_bridge_buggy; | ||
16 | #else | ||
17 | #define isa_dma_bridge_buggy (0) | 14 | #define isa_dma_bridge_buggy (0) |
18 | #endif | ||
19 | 15 | ||
20 | #endif /* _M68K_DMA_H */ | 16 | #endif /* _M68K_DMA_H */ |
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h index 657187f0c7c..9e673e3bd43 100644 --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h | |||
@@ -7,15 +7,12 @@ | |||
7 | * - added skeleton for GG-II and Amiga PCMCIA | 7 | * - added skeleton for GG-II and Amiga PCMCIA |
8 | * 2/3/01 RZ: - moved a few more defs into raw_io.h | 8 | * 2/3/01 RZ: - moved a few more defs into raw_io.h |
9 | * | 9 | * |
10 | * inX/outX/readX/writeX should not be used by any driver unless it does | 10 | * inX/outX should not be used by any driver unless it does |
11 | * ISA or PCI access. Other drivers should use function defined in raw_io.h | 11 | * ISA access. Other drivers should use function defined in raw_io.h |
12 | * or define its own macros on top of these. | 12 | * or define its own macros on top of these. |
13 | * | 13 | * |
14 | * inX(),outX() are for PCI and ISA I/O | 14 | * inX(),outX() are for ISA I/O |
15 | * readX(),writeX() are for PCI memory | ||
16 | * isa_readX(),isa_writeX() are for ISA memory | 15 | * isa_readX(),isa_writeX() are for ISA memory |
17 | * | ||
18 | * moved mem{cpy,set}_*io inside CONFIG_PCI | ||
19 | */ | 16 | */ |
20 | 17 | ||
21 | #ifndef _IO_H | 18 | #ifndef _IO_H |
@@ -256,10 +253,7 @@ static inline void isa_delay(void) | |||
256 | (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \ | 253 | (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \ |
257 | raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) | 254 | raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) |
258 | 255 | ||
259 | #endif /* CONFIG_ISA */ | ||
260 | |||
261 | 256 | ||
262 | #if defined(CONFIG_ISA) && !defined(CONFIG_PCI) | ||
263 | #define inb isa_inb | 257 | #define inb isa_inb |
264 | #define inb_p isa_inb_p | 258 | #define inb_p isa_inb_p |
265 | #define outb isa_outb | 259 | #define outb isa_outb |
@@ -282,55 +276,9 @@ static inline void isa_delay(void) | |||
282 | #define readw isa_readw | 276 | #define readw isa_readw |
283 | #define writeb isa_writeb | 277 | #define writeb isa_writeb |
284 | #define writew isa_writew | 278 | #define writew isa_writew |
285 | #endif /* CONFIG_ISA */ | ||
286 | |||
287 | #if defined(CONFIG_PCI) | ||
288 | |||
289 | #define readl(addr) in_le32(addr) | ||
290 | #define writel(val,addr) out_le32((addr),(val)) | ||
291 | |||
292 | /* those can be defined for both ISA and PCI - it won't work though */ | ||
293 | #define readb(addr) in_8(addr) | ||
294 | #define readw(addr) in_le16(addr) | ||
295 | #define writeb(val,addr) out_8((addr),(val)) | ||
296 | #define writew(val,addr) out_le16((addr),(val)) | ||
297 | 279 | ||
298 | #define readb_relaxed(addr) readb(addr) | 280 | #else /* CONFIG_ISA */ |
299 | #define readw_relaxed(addr) readw(addr) | ||
300 | #define readl_relaxed(addr) readl(addr) | ||
301 | 281 | ||
302 | #ifndef CONFIG_ISA | ||
303 | #define inb(port) in_8(port) | ||
304 | #define outb(val,port) out_8((port),(val)) | ||
305 | #define inw(port) in_le16(port) | ||
306 | #define outw(val,port) out_le16((port),(val)) | ||
307 | #define inl(port) in_le32(port) | ||
308 | #define outl(val,port) out_le32((port),(val)) | ||
309 | |||
310 | #else | ||
311 | /* | ||
312 | * kernel with both ISA and PCI compiled in, those have | ||
313 | * conflicting defs for in/out. Simply consider port < 1024 | ||
314 | * ISA and everything else PCI. read,write not defined | ||
315 | * in this case | ||
316 | */ | ||
317 | #define inb(port) ((port)<1024 ? isa_inb(port) : in_8(port)) | ||
318 | #define inb_p(port) ((port)<1024 ? isa_inb_p(port) : in_8(port)) | ||
319 | #define inw(port) ((port)<1024 ? isa_inw(port) : in_le16(port)) | ||
320 | #define inw_p(port) ((port)<1024 ? isa_inw_p(port) : in_le16(port)) | ||
321 | #define inl(port) ((port)<1024 ? isa_inl(port) : in_le32(port)) | ||
322 | #define inl_p(port) ((port)<1024 ? isa_inl_p(port) : in_le32(port)) | ||
323 | |||
324 | #define outb(val,port) ((port)<1024 ? isa_outb((val),(port)) : out_8((port),(val))) | ||
325 | #define outb_p(val,port) ((port)<1024 ? isa_outb_p((val),(port)) : out_8((port),(val))) | ||
326 | #define outw(val,port) ((port)<1024 ? isa_outw((val),(port)) : out_le16((port),(val))) | ||
327 | #define outw_p(val,port) ((port)<1024 ? isa_outw_p((val),(port)) : out_le16((port),(val))) | ||
328 | #define outl(val,port) ((port)<1024 ? isa_outl((val),(port)) : out_le32((port),(val))) | ||
329 | #define outl_p(val,port) ((port)<1024 ? isa_outl_p((val),(port)) : out_le32((port),(val))) | ||
330 | #endif | ||
331 | #endif /* CONFIG_PCI */ | ||
332 | |||
333 | #if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) | ||
334 | /* | 282 | /* |
335 | * We need to define dummy functions for GENERIC_IOMAP support. | 283 | * We need to define dummy functions for GENERIC_IOMAP support. |
336 | */ | 284 | */ |
@@ -357,11 +305,11 @@ static inline void isa_delay(void) | |||
357 | #define writeb(val,addr) out_8((addr),(val)) | 305 | #define writeb(val,addr) out_8((addr),(val)) |
358 | #define readw(addr) in_le16(addr) | 306 | #define readw(addr) in_le16(addr) |
359 | #define writew(val,addr) out_le16((addr),(val)) | 307 | #define writew(val,addr) out_le16((addr),(val)) |
360 | #endif | 308 | |
361 | #if !defined(CONFIG_PCI) | 309 | #endif /* CONFIG_ISA */ |
310 | |||
362 | #define readl(addr) in_le32(addr) | 311 | #define readl(addr) in_le32(addr) |
363 | #define writel(val,addr) out_le32((addr),(val)) | 312 | #define writel(val,addr) out_le32((addr),(val)) |
364 | #endif | ||
365 | 313 | ||
366 | #define mmiowb() | 314 | #define mmiowb() |
367 | 315 | ||
diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h index d43febbc9c7..4ad0aea48ab 100644 --- a/include/asm-m68k/pci.h +++ b/include/asm-m68k/pci.h | |||
@@ -1,54 +1,8 @@ | |||
1 | #ifndef _ASM_M68K_PCI_H | 1 | #ifndef _ASM_M68K_PCI_H |
2 | #define _ASM_M68K_PCI_H | 2 | #define _ASM_M68K_PCI_H |
3 | 3 | ||
4 | /* | ||
5 | * asm-m68k/pci_m68k.h - m68k specific PCI declarations. | ||
6 | * | ||
7 | * Written by Wout Klaren. | ||
8 | */ | ||
9 | |||
10 | #include <asm/scatterlist.h> | ||
11 | #include <asm-generic/pci-dma-compat.h> | 4 | #include <asm-generic/pci-dma-compat.h> |
12 | 5 | ||
13 | struct pci_ops; | ||
14 | |||
15 | /* | ||
16 | * Structure with hardware dependent information and functions of the | ||
17 | * PCI bus. | ||
18 | */ | ||
19 | |||
20 | struct pci_bus_info | ||
21 | { | ||
22 | /* | ||
23 | * Resources of the PCI bus. | ||
24 | */ | ||
25 | |||
26 | struct resource mem_space; | ||
27 | struct resource io_space; | ||
28 | |||
29 | /* | ||
30 | * System dependent functions. | ||
31 | */ | ||
32 | |||
33 | struct pci_ops *m68k_pci_ops; | ||
34 | |||
35 | void (*fixup)(int pci_modify); | ||
36 | void (*conf_device)(struct pci_dev *dev); | ||
37 | }; | ||
38 | |||
39 | #define pcibios_assign_all_busses() 0 | ||
40 | #define pcibios_scan_all_fns(a, b) 0 | ||
41 | |||
42 | static inline void pcibios_set_master(struct pci_dev *dev) | ||
43 | { | ||
44 | /* No special bus mastering setup handling */ | ||
45 | } | ||
46 | |||
47 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
48 | { | ||
49 | /* We don't do dynamic PCI IRQ allocation */ | ||
50 | } | ||
51 | |||
52 | /* The PCI address space does equal the physical memory | 6 | /* The PCI address space does equal the physical memory |
53 | * address space. The networking and block device layers use | 7 | * address space. The networking and block device layers use |
54 | * this boolean for bounce buffer decisions. | 8 | * this boolean for bounce buffer decisions. |