Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48406
b: refs/heads/master
c: faed197
h: refs/heads/master
v: v3
  • Loading branch information
OGAWA Hirofumi authored and Andi Kleen committed Feb 13, 2007
1 parent e7d3423 commit c3bb732
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6a0668fc41fa479df617151c2d4e297299a4ffe2
refs/heads/master: faed197b7b44a6c4e6b81dd2db649fd452b0a7ef
46 changes: 35 additions & 11 deletions trunk/arch/x86_64/pci/mmconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,39 @@ struct mmcfg_virt {
};
static struct mmcfg_virt *pci_mmcfg_virt;

static inline int mcfg_broken(void)
{
struct acpi_mcfg_allocation *cfg = &pci_mmcfg_config[0];

/* Handle more broken MCFG tables on Asus etc.
They only contain a single entry for bus 0-0. Assume
this applies to all busses. */
if (pci_mmcfg_config_num == 1 &&
cfg->pci_segment_group_number == 0 &&
(cfg->start_bus_number | cfg->end_bus_number) == 0)
return 1;
return 0;
}

static void __iomem *mcfg_ioremap(struct acpi_mcfg_allocation *cfg)
{
void __iomem *addr;
u32 size;

if (mcfg_broken())
size = 256 << 20;
else
size = (cfg->end_bus_number + 1) << 20;

addr = ioremap_nocache(cfg->base_address, size);
if (addr) {
printk(KERN_INFO "PCI: Using MMCONFIG at %x - %x\n",
cfg->base_address,
cfg->base_address + size - 1);
}
return addr;
}

static char __iomem *get_virt(unsigned int seg, unsigned bus)
{
int cfg_num = -1;
Expand All @@ -45,13 +78,7 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus)
return pci_mmcfg_virt[cfg_num].virt;
}

/* Handle more broken MCFG tables on Asus etc.
They only contain a single entry for bus 0-0. Assume
this applies to all busses. */
cfg = &pci_mmcfg_config[0];
if (pci_mmcfg_config_num == 1 &&
cfg->pci_segment == 0 &&
(cfg->start_bus_number | cfg->end_bus_number) == 0)
if (mcfg_broken())
return pci_mmcfg_virt[0].virt;

/* Fall back to type 0 */
Expand Down Expand Up @@ -145,16 +172,13 @@ int __init pci_mmcfg_arch_init(void)

for (i = 0; i < pci_mmcfg_config_num; ++i) {
pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i];
pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].address,
MMCONFIG_APER_MAX);
pci_mmcfg_virt[i].virt = mcfg_ioremap(&pci_mmcfg_config[i]);
if (!pci_mmcfg_virt[i].virt) {
printk(KERN_ERR "PCI: Cannot map mmconfig aperture for "
"segment %d\n",
pci_mmcfg_config[i].pci_segment);
return 0;
}
printk(KERN_INFO "PCI: Using MMCONFIG at %Lx\n",
pci_mmcfg_config[i].address);
}
raw_pci_ops = &pci_mmcfg;
return 1;
Expand Down

0 comments on commit c3bb732

Please sign in to comment.