12 #include <linux/pci.h>
20 #define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG))
23 static u32 mmcfg_last_accessed_device;
24 static int mmcfg_last_accessed_cpu;
29 static u32 get_base_addr(
unsigned int seg,
int bus,
unsigned devfn)
41 static void pci_exp_set_dev_base(
unsigned int base,
int bus,
int devfn)
45 if (dev_base != mmcfg_last_accessed_device ||
46 cpu != mmcfg_last_accessed_cpu) {
47 mmcfg_last_accessed_device = dev_base;
48 mmcfg_last_accessed_cpu =
cpu;
53 static int pci_mmcfg_read(
unsigned int seg,
unsigned int bus,
59 if ((bus > 255) || (devfn > 255) || (reg > 4095)) {
65 base = get_base_addr(seg, bus, devfn);
73 pci_exp_set_dev_base(base, bus, devfn);
92 static int pci_mmcfg_write(
unsigned int seg,
unsigned int bus,
93 unsigned int devfn,
int reg,
int len,
u32 value)
98 if ((bus > 255) || (devfn > 255) || (reg > 4095))
102 base = get_base_addr(seg, bus, devfn);
110 pci_exp_set_dev_base(base, bus, devfn);
130 .read = pci_mmcfg_read,
131 .write = pci_mmcfg_write,
156 mmcfg_last_accessed_device = 0;