35 #include <linux/types.h>
36 #include <linux/pci.h>
37 #include <linux/kernel.h>
41 #include <linux/tty.h>
52 #define CFGOFFSET(bus, devfn, where) (((bus)<<16)+((devfn)<<8)+(where))
53 #define CFGADDR(bus, devfn, where) CFGOFFSET((bus)->number, (devfn), where)
55 static void *cfg_space;
57 #define PCI_BUS_ENABLED 1
58 #define PCI_DEVICE_MODE 2
60 static int bcm1480_bus_status;
62 #define PCI_BRIDGE_DEVICE 0
69 return *(
u32 *)(cfg_space + (addr&~3));
74 *(
u32 *)(cfg_space + (addr & ~3)) = data;
119 static int bcm1480_pcibios_read(
struct pci_bus *bus,
unsigned int devfn,
124 if ((size == 2) && (where & 1))
126 else if ((size == 4) && (where & 3))
129 if (bcm1480_pci_can_access(bus, devfn))
130 data = READCFG32(
CFGADDR(bus, devfn, where));
135 *val = (data >> ((where & 3) << 3)) & 0xff;
137 *val = (data >> ((where & 3) << 3)) & 0xffff;
144 static int bcm1480_pcibios_write(
struct pci_bus *bus,
unsigned int devfn,
145 int where,
int size,
u32 val)
150 if ((size == 2) && (where & 1))
152 else if ((size == 4) && (where & 3))
155 if (!bcm1480_pci_can_access(bus, devfn))
158 data = READCFG32(cfgaddr);
161 data = (data & ~(0xff << ((where & 3) << 3))) |
162 (val << ((where & 3) << 3));
164 data = (data & ~(0xffff << ((where & 3) << 3))) |
165 (val << ((where & 3) << 3));
169 WRITECFG32(cfgaddr, data);
175 bcm1480_pcibios_read,
176 bcm1480_pcibios_write,
179 static struct resource bcm1480_mem_resource = {
180 .name =
"BCM1480 PCI MEM",
186 static struct resource bcm1480_io_resource = {
187 .name =
"BCM1480 PCI I/O",
195 .mem_resource = &bcm1480_mem_resource,
196 .io_resource = &bcm1480_io_resource,
201 static int __init bcm1480_pcibios_init(
void)
207 pci_set_flags(PCI_PROBE_ONLY);
230 (
"PCI: Skipping PCI probe. Bus is not initialized.\n");
252 bcm1480_controller.io_map_base = (
unsigned long)
254 bcm1480_controller.io_map_base -= bcm1480_controller.io_offset;
255 set_io_port_base(bcm1480_controller.io_map_base);
259 #ifdef CONFIG_VGA_CONSOLE