1 #include <linux/kernel.h>
4 #include <asm/bootinfo.h>
9 #define PCI_ACCESS_READ 0
10 #define PCI_ACCESS_WRITE 1
12 #define LO(reg) (reg / 4)
13 #define HI(reg) (reg / 4 + 1)
19 static int nile4_pcibios_config_access(
unsigned char access_type,
25 if ((busnum == 0) && (
PCI_SLOT(devfn) > 8))
31 if ((busnum == 0) && (devfn ==
PCI_DEVFN(0, 0))) {
77 static int nile4_pcibios_read(
struct pci_bus *bus,
unsigned int devfn,
84 if ((size == 2) && (where & 1))
86 else if ((size == 4) && (where & 3))
92 spin_unlock_irqrestore(&nile4_pci_lock, flags);
98 *val = (data >> ((where & 3) << 3)) & 0xff;
100 *val = (data >> ((where & 3) << 3)) & 0xffff;
107 static int nile4_pcibios_write(
struct pci_bus *bus,
unsigned int devfn,
108 int where,
int size,
u32 val)
114 if ((size == 2) && (where & 1))
116 else if ((size == 4) && (where & 3))
122 spin_unlock_irqrestore(&nile4_pci_lock, flags);
128 data = (data & ~(0xff << ((where & 3) << 3))) |
129 (val << ((where & 3) << 3));
131 data = (data & ~(0xffff << ((where & 3) << 3))) |
132 (val << ((where & 3) << 3));
136 if (nile4_pcibios_config_access
144 .read = nile4_pcibios_read,
145 .write = nile4_pcibios_write,