24 #include <linux/types.h>
25 #include <linux/pci.h>
26 #include <linux/kernel.h>
31 #define PCI_ACCESS_READ 0
32 #define PCI_ACCESS_WRITE 1
38 #define PCI_CFG_TYPE0_REG_SHF 0
39 #define PCI_CFG_TYPE0_FUNC_SHF 8
42 #define PCI_CFG_TYPE1_REG_SHF 0
43 #define PCI_CFG_TYPE1_FUNC_SHF 8
44 #define PCI_CFG_TYPE1_DEV_SHF 11
45 #define PCI_CFG_TYPE1_BUS_SHF 16
47 static int msc_pcibios_config_access(
unsigned char access_type,
94 if ((size == 2) && (where & 1))
96 else if ((size == 4) && (where & 3))
104 *val = (data >> ((where & 3) << 3)) & 0xff;
106 *val = (data >> ((where & 3) << 3)) & 0xffff;
113 static int msc_pcibios_write(
struct pci_bus *bus,
unsigned int devfn,
114 int where,
int size,
u32 val)
118 if ((size == 2) && (where & 1))
120 else if ((size == 4) && (where & 3))
131 data = (data & ~(0xff << ((where & 3) << 3))) |
132 (val << ((where & 3) << 3));
134 data = (data & ~(0xffff << ((where & 3) << 3))) |
135 (val << ((where & 3) << 3));
146 .read = msc_pcibios_read,
147 .write = msc_pcibios_write