10 #include <linux/kernel.h>
11 #include <linux/pci.h>
12 #include <linux/types.h>
24 static int set_config_address(
unsigned int busno,
unsigned int devfn,
int reg)
26 if ((devfn > 255) || (reg > 255))
29 if (busno == 0 && devfn >=
PCI_DEVFN(8, 0))
33 ((busno & 0xff) << 16) |
34 ((devfn & 0xff) << 8) |
40 static int pcimt_read(
struct pci_bus *
bus,
unsigned int devfn,
int reg,
45 if ((res = set_config_address(bus->
number, devfn, reg)))
63 static int pcimt_write(
struct pci_bus *bus,
unsigned int devfn,
int reg,
68 if ((res = set_config_address(bus->
number, devfn, reg)))
91 static int pcit_set_config_address(
unsigned int busno,
unsigned int devfn,
int reg)
93 if ((devfn > 255) || (reg > 255) || (busno > 255))
96 outl((1 << 31) | ((busno & 0xff) << 16) | ((devfn & 0xff) << 8) | (reg & 0xfc), 0xcf8);
100 static int pcit_read(
struct pci_bus *bus,
unsigned int devfn,
int reg,
111 pcit_set_config_address(0, 0, 0x68);
112 outl(
inl(0xcfc) | 0xc0000000, 0xcfc);
113 if ((res = pcit_set_config_address(0, devfn, 0)))
115 outl(0xffffffff, 0xcfc);
116 pcit_set_config_address(0, 0, 0x68);
117 if (
inl(0xcfc) & 0x100000)
120 if ((res = pcit_set_config_address(bus->
number, devfn, reg)))
137 static int pcit_write(
struct pci_bus *bus,
unsigned int devfn,
int reg,
142 if ((res = pcit_set_config_address(bus->
number, devfn, reg)))