1 #include <linux/kernel.h>
3 #include <linux/interrupt.h>
5 #include <linux/init.h>
6 #include <linux/ioport.h>
10 #include <asm/mach/pci.h>
14 #define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
17 via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
20 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
23 *value=inb(0xCFC + (where&3));
26 *value=inw(0xCFC + (where&2));
32 return PCIBIOS_SUCCESSFUL;
36 via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
39 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
42 outb(value, 0xCFC + (where&3));
45 outw(value, 0xCFC + (where&2));
51 return PCIBIOS_SUCCESSFUL;
54 struct pci_ops via82c505_ops = {
55 .read = via82c505_read_config,
56 .write = via82c505_write_config,
59 void __init via82c505_preinit(void)
61 printk(KERN_DEBUG "PCI: VIA 82c505\n");
62 if (!request_region(0xA8,2,"via config")) {
63 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n");
66 if (!request_region(0xCF8,8,"pci config")) {
67 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xCF8\n");
68 release_region(0xA8, 2);
72 /* Enable compatible Mode */
80 int __init via82c505_setup(int nr, struct pci_sys_data *sys)