summaryrefslogtreecommitdiff
path: root/arch/x86/pci/mmconfig_64.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-11-14 03:34:08 +0300
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-25 02:29:11 +0300
commitdf5eb1d67e8074dfbc23cf396c556116728187b3 (patch)
tree1512457b52c6763ee9921094f62690d0a3b8b1e3 /arch/x86/pci/mmconfig_64.c
parentf7ca69848786bb99fdfafb511791b078c298438e (diff)
downloadlinux-df5eb1d67e8074dfbc23cf396c556116728187b3.tar.xz
x86/PCI: MMCONFIG: add PCI_MMCFG_BUS_OFFSET() to factor common expression
This factors out the common "bus << 20" expression used when computing the MMCONFIG address. Reviewed-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
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
addr = get_virt(seg, bus);
if (!addr)
return NULL;
- return addr + ((bus << 20) | (devfn << 12));
+ return addr + (PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12));
}
static 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)
{
void __iomem *addr;
u64 start, size;
+ int num_buses;
- start = cfg->start_bus_number;
- start <<= 20;
- start += cfg->address;
- size = cfg->end_bus_number + 1 - cfg->start_bus_number;
- size <<= 20;
+ start = cfg->address + PCI_MMCFG_BUS_OFFSET(cfg->start_bus_number);
+ num_buses = cfg->end_bus_number - cfg->start_bus_number + 1;
+ size = PCI_MMCFG_BUS_OFFSET(num_buses);
addr = ioremap_nocache(start, size);
if (addr) {
printk(KERN_INFO "PCI: Using MMCONFIG at %Lx - %Lx\n",
start, start + size - 1);
- addr -= cfg->start_bus_number << 20;
+ addr -= PCI_MMCFG_BUS_OFFSET(cfg->start_bus_number);
}
return addr;
}
@@ -162,7 +161,7 @@ void __init pci_mmcfg_arch_free(void)
for (i = 0; i < pci_mmcfg_config_num; ++i) {
if (pci_mmcfg_virt[i].virt) {
- iounmap(pci_mmcfg_virt[i].virt + (pci_mmcfg_virt[i].cfg->start_bus_number << 20));
+ iounmap(pci_mmcfg_virt[i].virt + PCI_MMCFG_BUS_OFFSET(pci_mmcfg_virt[i].cfg->start_bus_number));
pci_mmcfg_virt[i].virt = NULL;
pci_mmcfg_virt[i].cfg = NULL;
}