[x86 setup] Handle case of improperly terminated E820 chain
[linux-2.6] / arch / ppc / platforms / pal4_pci.c
1 /*
2  * PCI support for SBS Palomar IV
3  *
4  * Author: Dan Cox
5  *
6  * 2002 (c) MontaVista, Software, Inc.  This file is licensed under
7  * the terms of the GNU General Public License version 2.  This program
8  * is licensed "as is" without any warranty of any kind, whether express
9  * or implied.
10  */
11
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/pci.h>
15
16 #include <asm/byteorder.h>
17 #include <asm/machdep.h>
18 #include <asm/io.h>
19 #include <asm/pci-bridge.h>
20 #include <asm/uaccess.h>
21
22 #include <syslib/cpc700.h>
23
24 #include "pal4.h"
25
26 /* not much to this.... */
27 static inline int __init
28 pal4_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
29 {
30         if (idsel == 9)
31                 return PAL4_ETH;
32         else
33                 return PAL4_INTA + (idsel - 3);
34 }
35
36 void __init
37 pal4_find_bridges(void)
38 {
39         struct pci_controller *hose;
40
41         hose = pcibios_alloc_controller();
42         if (!hose)
43                 return;
44
45         hose->first_busno = 0;
46         hose->last_busno = 0xff;
47         hose->pci_mem_offset = 0;
48
49         /* Could snatch these from the CPC700.... */
50         pci_init_resource(&hose->io_resource,
51                           0x0,
52                           0x03ffffff,
53                           IORESOURCE_IO,
54                           "PCI host bridge");
55
56         pci_init_resource(&hose->mem_resources[0],
57                           0x90000000,
58                           0x9fffffff,
59                           IORESOURCE_MEM,
60                           "PCI host bridge");
61
62         hose->io_space.start = 0x00800000;
63         hose->io_space.end = 0x03ffffff;
64         hose->mem_space.start = 0x90000000;
65         hose->mem_space.end = 0x9fffffff;
66         hose->io_base_virt = (void *) 0xf8000000;
67
68         setup_indirect_pci(hose, CPC700_PCI_CONFIG_ADDR,
69                            CPC700_PCI_CONFIG_DATA);
70
71         hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
72
73         ppc_md.pci_swizzle = common_swizzle;
74         ppc_md.pci_map_irq = pal4_map_irq;
75 }