11 #include <linux/bitmap.h>
16 #define PREFIX "PCI: "
18 static char __iomem *pci_dev_base(
unsigned int seg,
unsigned int bus,
unsigned int devfn)
27 static int pci_mmcfg_read(
unsigned int seg,
unsigned int bus,
33 if (
unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) {
39 addr = pci_dev_base(seg, bus, devfn);
47 *value = mmio_config_readb(addr + reg);
50 *value = mmio_config_readw(addr + reg);
53 *value = mmio_config_readl(addr + reg);
61 static int pci_mmcfg_write(
unsigned int seg,
unsigned int bus,
62 unsigned int devfn,
int reg,
int len,
u32 value)
67 if (
unlikely((bus > 255) || (devfn > 255) || (reg > 4095)))
71 addr = pci_dev_base(seg, bus, devfn);
79 mmio_config_writeb(addr + reg, value);
82 mmio_config_writew(addr + reg, value);
85 mmio_config_writel(addr + reg, value);
94 .read = pci_mmcfg_read,
95 .write = pci_mmcfg_write,
138 cfg->
virt = mcfg_ioremap(cfg);
149 if (cfg && cfg->
virt) {