summaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/mmconfig-shared.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-11-13 17:34:08 -0700
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-24 15:29:11 -0800
commitdf5eb1d67e8074dfbc23cf396c556116728187b3 (patch)
tree1512457b52c6763ee9921094f62690d0a3b8b1e3 /arch/x86/pci/mmconfig-shared.c
parentf7ca69848786bb99fdfafb511791b078c298438e (diff)
downloadblackbird-op-linux-df5eb1d67e8074dfbc23cf396c556116728187b3.tar.gz
blackbird-op-linux-df5eb1d67e8074dfbc23cf396c556116728187b3.zip
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-shared.c')
-rw-r--r--arch/x86/pci/mmconfig-shared.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 067a2cfed15c..4820f0e8c594 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -355,8 +355,9 @@ static void __init pci_mmcfg_insert_resources(void)
snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN,
"PCI MMCONFIG %u [%02x-%02x]", cfg->pci_segment,
cfg->start_bus_number, cfg->end_bus_number);
- res->start = cfg->address + (cfg->start_bus_number << 20);
- res->end = res->start + (num_buses << 20) - 1;
+ res->start = cfg->address +
+ PCI_MMCFG_BUS_OFFSET(cfg->start_bus_number);
+ res->end = res->start + PCI_MMCFG_BUS_OFFSET(num_buses) - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
insert_resource(&iomem_resource, res);
names += PCI_MMCFG_RESOURCE_NAME_LEN;
@@ -478,15 +479,14 @@ static void __init pci_mmcfg_reject_broken(int early)
return;
for (i = 0; i < pci_mmcfg_config_num; i++) {
- int valid = 0;
+ int num_buses, valid = 0;
u64 addr, size;
cfg = &pci_mmcfg_config[i];
- addr = cfg->start_bus_number;
- addr <<= 20;
- addr += cfg->address;
- size = cfg->end_bus_number + 1 - cfg->start_bus_number;
- size <<= 20;
+ addr = 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);
printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx "
"segment %hu buses %u - %u\n",
i, (unsigned long)cfg->address, cfg->pci_segment,
OpenPOWER on IntegriCloud