aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/pci
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2007-02-13 07:26:20 -0500
committerAndi Kleen <andi@basil.nowhere.org>2007-02-13 07:26:20 -0500
commit44de0203fab205417b24322272c53ee0883c36e7 (patch)
treec5dbfa7e373ab07f517fc91fd97ff45045ccbb1b /arch/x86_64/pci
parentfaed197b7b44a6c4e6b81dd2db649fd452b0a7ef (diff)
[PATCH] mmconfig: Reject a broken MCFG tables on Asus etc
This rejects broken MCFG tables on Asus. When the table looks bogus just disable mmconfig Arjan and Andi suggested this. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64/pci')
-rw-r--r--arch/x86_64/pci/mmconfig.c50
1 files changed, 14 insertions, 36 deletions
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index 8e05449660fe..78e50b2c5cc5 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -28,39 +28,6 @@ struct mmcfg_virt {
28}; 28};
29static struct mmcfg_virt *pci_mmcfg_virt; 29static struct mmcfg_virt *pci_mmcfg_virt;
30 30
31static inline int mcfg_broken(void)
32{
33 struct acpi_mcfg_allocation *cfg = &pci_mmcfg_config[0];
34
35 /* Handle more broken MCFG tables on Asus etc.
36 They only contain a single entry for bus 0-0. Assume
37 this applies to all busses. */
38 if (pci_mmcfg_config_num == 1 &&
39 cfg->pci_segment_group_number == 0 &&
40 (cfg->start_bus_number | cfg->end_bus_number) == 0)
41 return 1;
42 return 0;
43}
44
45static void __iomem *mcfg_ioremap(struct acpi_mcfg_allocation *cfg)
46{
47 void __iomem *addr;
48 u32 size;
49
50 if (mcfg_broken())
51 size = 256 << 20;
52 else
53 size = (cfg->end_bus_number + 1) << 20;
54
55 addr = ioremap_nocache(cfg->base_address, size);
56 if (addr) {
57 printk(KERN_INFO "PCI: Using MMCONFIG at %x - %x\n",
58 cfg->base_address,
59 cfg->base_address + size - 1);
60 }
61 return addr;
62}
63
64static char __iomem *get_virt(unsigned int seg, unsigned bus) 31static char __iomem *get_virt(unsigned int seg, unsigned bus)
65{ 32{
66 int cfg_num = -1; 33 int cfg_num = -1;
@@ -78,9 +45,6 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus)
78 return pci_mmcfg_virt[cfg_num].virt; 45 return pci_mmcfg_virt[cfg_num].virt;
79 } 46 }
80 47
81 if (mcfg_broken())
82 return pci_mmcfg_virt[0].virt;
83
84 /* Fall back to type 0 */ 48 /* Fall back to type 0 */
85 return NULL; 49 return NULL;
86} 50}
@@ -160,6 +124,20 @@ static struct pci_raw_ops pci_mmcfg = {
160 .write = pci_mmcfg_write, 124 .write = pci_mmcfg_write,
161}; 125};
162 126
127static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg)
128{
129 void __iomem *addr;
130 u32 size;
131
132 size = (cfg->end_bus_number + 1) << 20;
133 addr = ioremap_nocache(cfg->address, size);
134 if (addr) {
135 printk(KERN_INFO "PCI: Using MMCONFIG at %Lx - %Lx\n",
136 cfg->address, cfg->address + size - 1);
137 }
138 return addr;
139}
140
163int __init pci_mmcfg_arch_init(void) 141int __init pci_mmcfg_arch_init(void)
164{ 142{
165 int i; 143 int i;