1 #include <linux/kernel.h>
3 #include <linux/interrupt.h>
5 #include <linux/init.h>
6 #include <linux/ioport.h>
9 #include <asm/system.h>
11 #include <asm/mach/pci.h>
15 #define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
18 via82c505_read_config(struct pci_bus
*bus
, unsigned int devfn
, int where
,
21 outl(CONFIG_CMD(bus
,devfn
,where
),0xCF8);
24 *value
=inb(0xCFC + (where
&3));
27 *value
=inw(0xCFC + (where
&2));
33 return PCIBIOS_SUCCESSFUL
;
37 via82c505_write_config(struct pci_bus
*bus
, unsigned int devfn
, int where
,
40 outl(CONFIG_CMD(bus
,devfn
,where
),0xCF8);
43 outb(value
, 0xCFC + (where
&3));
46 outw(value
, 0xCFC + (where
&2));
52 return PCIBIOS_SUCCESSFUL
;
55 static struct pci_ops via82c505_ops
= {
56 .read
= via82c505_read_config
,
57 .write
= via82c505_write_config
,
60 void __init
via82c505_preinit(void)
62 printk(KERN_DEBUG
"PCI: VIA 82c505\n");
63 if (!request_region(0xA8,2,"via config")) {
64 printk(KERN_WARNING
"VIA 82c505: Unable to request region 0xA8\n");
67 if (!request_region(0xCF8,8,"pci config")) {
68 printk(KERN_WARNING
"VIA 82c505: Unable to request region 0xCF8\n");
69 release_region(0xA8, 2);
73 /* Enable compatible Mode */
81 int __init
via82c505_setup(int nr
, struct pci_sys_data
*sys
)
86 struct pci_bus
* __init
via82c505_scan_bus(int nr
, struct pci_sys_data
*sysdata
)
89 return pci_scan_bus(0, &via82c505_ops
, sysdata
);