33 #include <linux/types.h>
34 #include <linux/pci.h>
35 #include <linux/kernel.h>
39 #include <linux/tty.h>
53 #define CFGOFFSET(bus, devfn, where) (((bus)<<16) + ((devfn)<<8) + (where))
54 #define CFGADDR(bus, devfn, where) CFGOFFSET((bus)->number, (devfn), where)
56 static void *cfg_space;
58 #define PCI_BUS_ENABLED 1
59 #define LDT_BUS_ENABLED 2
60 #define PCI_DEVICE_MODE 4
62 static int sb1250_bus_status;
64 #define PCI_BRIDGE_DEVICE 0
65 #define LDT_BRIDGE_DEVICE 1
67 #ifdef CONFIG_SIBYTE_HAS_LDT
72 unsigned long ldt_eoi_space;
80 return *(
u32 *) (cfg_space + (addr & ~3));
85 *(
u32 *) (cfg_space + (addr & ~3)) = data;
129 static int sb1250_pcibios_read(
struct pci_bus *bus,
unsigned int devfn,
134 if ((size == 2) && (where & 1))
136 else if ((size == 4) && (where & 3))
139 if (sb1250_pci_can_access(bus, devfn))
140 data = READCFG32(
CFGADDR(bus, devfn, where));
145 *val = (data >> ((where & 3) << 3)) & 0xff;
147 *val = (data >> ((where & 3) << 3)) & 0xffff;
154 static int sb1250_pcibios_write(
struct pci_bus *bus,
unsigned int devfn,
155 int where,
int size,
u32 val)
160 if ((size == 2) && (where & 1))
162 else if ((size == 4) && (where & 3))
165 if (!sb1250_pci_can_access(bus, devfn))
168 data = READCFG32(cfgaddr);
171 data = (data & ~(0xff << ((where & 3) << 3))) |
172 (val << ((where & 3) << 3));
174 data = (data & ~(0xffff << ((where & 3) << 3))) |
175 (val << ((where & 3) << 3));
179 WRITECFG32(cfgaddr, data);
185 .read = sb1250_pcibios_read,
186 .write = sb1250_pcibios_write,
189 static struct resource sb1250_mem_resource = {
190 .name =
"SB1250 PCI MEM",
191 .start = 0x40000000
UL,
196 static struct resource sb1250_io_resource = {
197 .name =
"SB1250 PCI I/O",
198 .start = 0x00000000
UL,
205 .mem_resource = &sb1250_mem_resource,
206 .io_resource = &sb1250_io_resource,
209 static int __init sb1250_pcibios_init(
void)
216 pci_set_flags(PCI_PROBE_ONLY);
227 ioremap(A_PHYS_LDTPCI_CFG_MATCH_BITS, 16 * 1024 * 1024);
233 if (!(reg & M_SYS_PCI_HOST)) {
242 (
"PCI: Skipping PCI probe. Bus is not initialized.\n");
257 io_map_base =
ioremap(A_PHYS_LDTPCI_IO_MATCH_BYTES, 1024 * 1024);
258 sb1250_controller.io_map_base = (
unsigned long)io_map_base;
259 set_io_port_base((
unsigned long)io_map_base);
261 #ifdef CONFIG_SIBYTE_HAS_LDT
277 ldt_eoi_space = (
unsigned long)
278 ioremap(A_PHYS_LDT_SPECIAL_MATCH_BYTES,
285 #ifdef CONFIG_VGA_CONSOLE