aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/mmconfig_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/pci/mmconfig_64.c')
-rw-r--r--arch/x86/pci/mmconfig_64.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c
index 94349f8b2f96..8588711924cc 100644
--- a/arch/x86/pci/mmconfig_64.c
+++ b/arch/x86/pci/mmconfig_64.c
@@ -43,7 +43,7 @@ static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned i
43 addr = get_virt(seg, bus); 43 addr = get_virt(seg, bus);
44 if (!addr) 44 if (!addr)
45 return NULL; 45 return NULL;
46 return addr + ((bus << 20) | (devfn << 12)); 46 return addr + (PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12));
47} 47}
48 48
49static int pci_mmcfg_read(unsigned int seg, unsigned int bus, 49static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
@@ -113,17 +113,16 @@ static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg)
113{ 113{
114 void __iomem *addr; 114 void __iomem *addr;
115 u64 start, size; 115 u64 start, size;
116 int num_buses;
116 117
117 start = cfg->start_bus_number; 118 start = cfg->address + PCI_MMCFG_BUS_OFFSET(cfg->start_bus_number);
118 start <<= 20; 119 num_buses = cfg->end_bus_number - cfg->start_bus_number + 1;
119 start += cfg->address; 120 size = PCI_MMCFG_BUS_OFFSET(num_buses);
120 size = cfg->end_bus_number + 1 - cfg->start_bus_number;
121 size <<= 20;
122 addr = ioremap_nocache(start, size); 121 addr = ioremap_nocache(start, size);
123 if (addr) { 122 if (addr) {
124 printk(KERN_INFO "PCI: Using MMCONFIG at %Lx - %Lx\n", 123 printk(KERN_INFO "PCI: Using MMCONFIG at %Lx - %Lx\n",
125 start, start + size - 1); 124 start, start + size - 1);
126 addr -= cfg->start_bus_number << 20; 125 addr -= PCI_MMCFG_BUS_OFFSET(cfg->start_bus_number);
127 } 126 }
128 return addr; 127 return addr;
129} 128}
@@ -162,7 +161,7 @@ void __init pci_mmcfg_arch_free(void)
162 161
163 for (i = 0; i < pci_mmcfg_config_num; ++i) { 162 for (i = 0; i < pci_mmcfg_config_num; ++i) {
164 if (pci_mmcfg_virt[i].virt) { 163 if (pci_mmcfg_virt[i].virt) {
165 iounmap(pci_mmcfg_virt[i].virt + (pci_mmcfg_virt[i].cfg->start_bus_number << 20)); 164 iounmap(pci_mmcfg_virt[i].virt + PCI_MMCFG_BUS_OFFSET(pci_mmcfg_virt[i].cfg->start_bus_number));
166 pci_mmcfg_virt[i].virt = NULL; 165 pci_mmcfg_virt[i].virt = NULL;
167 pci_mmcfg_virt[i].cfg = NULL; 166 pci_mmcfg_virt[i].cfg = NULL;
168 } 167 }