34 #include <linux/types.h>
35 #include <linux/pci.h>
36 #include <linux/kernel.h>
40 #include <linux/tty.h>
51 #define CFGOFFSET(bus, devfn, where) (((bus)<<16)+((devfn)<<8)+(where))
52 #define CFGADDR(bus, devfn, where) CFGOFFSET((bus)->number, (devfn), where)
54 static void *ht_cfg_space;
56 #define PCI_BUS_ENABLED 1
57 #define PCI_DEVICE_MODE 2
59 static int bcm1480ht_bus_status;
61 #define PCI_BRIDGE_DEVICE 0
62 #define HT_BRIDGE_DEVICE 1
75 return *(
u32 *)(ht_cfg_space + (addr&~3));
80 *(
u32 *)(ht_cfg_space + (addr & ~3)) = data;
109 static int bcm1480ht_pcibios_read(
struct pci_bus *bus,
unsigned int devfn,
114 if ((size == 2) && (where & 1))
116 else if ((size == 4) && (where & 3))
119 if (bcm1480ht_can_access(bus, devfn))
120 data = READCFG32(
CFGADDR(bus, devfn, where));
125 *val = (data >> ((where & 3) << 3)) & 0xff;
127 *val = (data >> ((where & 3) << 3)) & 0xffff;
134 static int bcm1480ht_pcibios_write(
struct pci_bus *bus,
unsigned int devfn,
135 int where,
int size,
u32 val)
140 if ((size == 2) && (where & 1))
142 else if ((size == 4) && (where & 3))
145 if (!bcm1480ht_can_access(bus, devfn))
148 data = READCFG32(cfgaddr);
151 data = (data & ~(0xff << ((where & 3) << 3))) |
152 (val << ((where & 3) << 3));
154 data = (data & ~(0xffff << ((where & 3) << 3))) |
155 (val << ((where & 3) << 3));
159 WRITECFG32(cfgaddr, data);
164 static int bcm1480ht_pcibios_get_busno(
void)
170 .read = bcm1480ht_pcibios_read,
171 .write = bcm1480ht_pcibios_write,
174 static struct resource bcm1480ht_mem_resource = {
175 .name =
"BCM1480 HT MEM",
181 static struct resource bcm1480ht_io_resource = {
182 .name =
"BCM1480 HT I/O",
190 .mem_resource = &bcm1480ht_mem_resource,
191 .io_resource = &bcm1480ht_io_resource,
193 .get_busno = bcm1480ht_pcibios_get_busno,
197 static int __init bcm1480ht_pcibios_init(
void)
207 bcm1480ht_controller.io_map_base = (
unsigned long)
209 bcm1480ht_controller.io_map_base -= bcm1480ht_controller.io_offset;