1 #include <linux/config.h>
2 #include <linux/kernel.h>
4 #include <linux/ptrace.h>
5 #include <linux/interrupt.h>
7 #include <linux/init.h>
8 #include <linux/ioport.h>
11 #include <asm/system.h>
13 #include <asm/mach/pci.h>
17 #define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
20 via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
23 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
26 *value=inb(0xCFC + (where&3));
29 *value=inw(0xCFC + (where&2));
35 return PCIBIOS_SUCCESSFUL;
39 via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
42 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
45 outb(value, 0xCFC + (where&3));
48 outw(value, 0xCFC + (where&2));
54 return PCIBIOS_SUCCESSFUL;
57 static struct pci_ops via82c505_ops = {
58 .read = via82c505_read_config,
59 .write = via82c505_write_config,
62 void __init via82c505_preinit(void)
64 printk(KERN_DEBUG "PCI: VIA 82c505\n");
65 if (!request_region(0xA8,2,"via config")) {
66 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n");
69 if (!request_region(0xCF8,8,"pci config")) {
70 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xCF8\n");
71 release_region(0xA8, 2);
75 /* Enable compatible Mode */
83 int __init via82c505_setup(int nr, struct pci_sys_data *sys)
88 struct pci_bus * __init via82c505_scan_bus(int nr, struct pci_sys_data *sysdata)
91 return pci_scan_bus(0, &via82c505_ops, sysdata);