diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-11-13 19:34:08 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-11-24 18:29:11 -0500 |
commit | df5eb1d67e8074dfbc23cf396c556116728187b3 (patch) | |
tree | 1512457b52c6763ee9921094f62690d0a3b8b1e3 /arch/x86/pci/mmconfig-shared.c | |
parent | f7ca69848786bb99fdfafb511791b078c298438e (diff) |
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.c | 16 |
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) | |||
355 | snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN, | 355 | snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN, |
356 | "PCI MMCONFIG %u [%02x-%02x]", cfg->pci_segment, | 356 | "PCI MMCONFIG %u [%02x-%02x]", cfg->pci_segment, |
357 | cfg->start_bus_number, cfg->end_bus_number); | 357 | cfg->start_bus_number, cfg->end_bus_number); |
358 | res->start = cfg->address + (cfg->start_bus_number << 20); | 358 | res->start = cfg->address + |
359 | res->end = res->start + (num_buses << 20) - 1; | 359 | PCI_MMCFG_BUS_OFFSET(cfg->start_bus_number); |
360 | res->end = res->start + PCI_MMCFG_BUS_OFFSET(num_buses) - 1; | ||
360 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | 361 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
361 | insert_resource(&iomem_resource, res); | 362 | insert_resource(&iomem_resource, res); |
362 | names += PCI_MMCFG_RESOURCE_NAME_LEN; | 363 | names += PCI_MMCFG_RESOURCE_NAME_LEN; |
@@ -478,15 +479,14 @@ static void __init pci_mmcfg_reject_broken(int early) | |||
478 | return; | 479 | return; |
479 | 480 | ||
480 | for (i = 0; i < pci_mmcfg_config_num; i++) { | 481 | for (i = 0; i < pci_mmcfg_config_num; i++) { |
481 | int valid = 0; | 482 | int num_buses, valid = 0; |
482 | u64 addr, size; | 483 | u64 addr, size; |
483 | 484 | ||
484 | cfg = &pci_mmcfg_config[i]; | 485 | cfg = &pci_mmcfg_config[i]; |
485 | addr = cfg->start_bus_number; | 486 | addr = cfg->address + |
486 | addr <<= 20; | 487 | PCI_MMCFG_BUS_OFFSET(cfg->start_bus_number); |
487 | addr += cfg->address; | 488 | num_buses = cfg->end_bus_number - cfg->start_bus_number + 1; |
488 | size = cfg->end_bus_number + 1 - cfg->start_bus_number; | 489 | size = PCI_MMCFG_BUS_OFFSET(num_buses); |
489 | size <<= 20; | ||
490 | printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " | 490 | printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " |
491 | "segment %hu buses %u - %u\n", | 491 | "segment %hu buses %u - %u\n", |
492 | i, (unsigned long)cfg->address, cfg->pci_segment, | 492 | i, (unsigned long)cfg->address, cfg->pci_segment, |