1 #include <linux/kernel.h>
3 #include <linux/ptrace.h>
4 #include <linux/interrupt.h>
6 #include <linux/init.h>
7 #include <linux/ioport.h>
10 #include <asm/system.h>
12 #include <asm/mach/pci.h>
16 #define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
19 via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
22 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
25 *value=inb(0xCFC + (where&3));
28 *value=inw(0xCFC + (where&2));
34 return PCIBIOS_SUCCESSFUL;
38 via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
41 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
44 outb(value, 0xCFC + (where&3));
47 outw(value, 0xCFC + (where&2));
53 return PCIBIOS_SUCCESSFUL;
56 static struct pci_ops via82c505_ops = {
57 .read = via82c505_read_config,
58 .write = via82c505_write_config,
61 void __init via82c505_preinit(void)
63 printk(KERN_DEBUG "PCI: VIA 82c505\n");
64 if (!request_region(0xA8,2,"via config")) {
65 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n");
68 if (!request_region(0xCF8,8,"pci config")) {
69 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xCF8\n");
70 release_region(0xA8, 2);
74 /* Enable compatible Mode */
82 int __init via82c505_setup(int nr, struct pci_sys_data *sys)
87 struct pci_bus * __init via82c505_scan_bus(int nr, struct pci_sys_data *sysdata)
90 return pci_scan_bus(0, &via82c505_ops, sysdata);