diff options
| author | Yinghai Lu <Yinghai.Lu@Sun.COM> | 2008-02-15 04:28:41 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-04-26 17:41:03 -0400 |
| commit | 0b64ad7123eb013c3de26750f2d4c356cd566231 (patch) | |
| tree | f6c1f3ad3880a39eae7e309c0c24605063019fcf /arch | |
| parent | 7752d5cfe3d11ca0bb9c673ec38bd78ba6578f8e (diff) | |
x86: clear pci_mmcfg_virt when mmcfg get rejected
For x86_64, need to free pci_mmcfg_virt, and iounmap some pointers
when MMCONF is not reserved in E820 or acpi _CRS and get rejected.
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg KH <greg@kroah.com>
Cc: Greg KH <greg@kroah.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86/pci/mmconfig-shared.c | 1 | ||||
| -rw-r--r-- | arch/x86/pci/mmconfig_32.c | 4 | ||||
| -rw-r--r-- | arch/x86/pci/mmconfig_64.c | 22 | ||||
| -rw-r--r-- | arch/x86/pci/pci.h | 1 |
4 files changed, 27 insertions, 1 deletions
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 498e35ee428e..8f204955427c 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
| @@ -300,6 +300,7 @@ static void __init pci_mmcfg_reject_broken(void) | |||
| 300 | 300 | ||
| 301 | reject: | 301 | reject: |
| 302 | printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); | 302 | printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); |
| 303 | pci_mmcfg_arch_free(); | ||
| 303 | kfree(pci_mmcfg_config); | 304 | kfree(pci_mmcfg_config); |
| 304 | pci_mmcfg_config = NULL; | 305 | pci_mmcfg_config = NULL; |
| 305 | pci_mmcfg_config_num = 0; | 306 | pci_mmcfg_config_num = 0; |
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c index 081816ada057..f3c761dce695 100644 --- a/arch/x86/pci/mmconfig_32.c +++ b/arch/x86/pci/mmconfig_32.c | |||
| @@ -136,3 +136,7 @@ int __init pci_mmcfg_arch_init(void) | |||
| 136 | raw_pci_ext_ops = &pci_mmcfg; | 136 | raw_pci_ext_ops = &pci_mmcfg; |
| 137 | return 1; | 137 | return 1; |
| 138 | } | 138 | } |
| 139 | |||
| 140 | void __init pci_mmcfg_arch_free(void) | ||
| 141 | { | ||
| 142 | } | ||
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c index 9207fd49233c..a1994163c99d 100644 --- a/arch/x86/pci/mmconfig_64.c +++ b/arch/x86/pci/mmconfig_64.c | |||
| @@ -127,7 +127,7 @@ static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg) | |||
| 127 | int __init pci_mmcfg_arch_init(void) | 127 | int __init pci_mmcfg_arch_init(void) |
| 128 | { | 128 | { |
| 129 | int i; | 129 | int i; |
| 130 | pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * | 130 | pci_mmcfg_virt = kzalloc(sizeof(*pci_mmcfg_virt) * |
| 131 | pci_mmcfg_config_num, GFP_KERNEL); | 131 | pci_mmcfg_config_num, GFP_KERNEL); |
| 132 | if (pci_mmcfg_virt == NULL) { | 132 | if (pci_mmcfg_virt == NULL) { |
| 133 | printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n"); | 133 | printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n"); |
| @@ -141,9 +141,29 @@ int __init pci_mmcfg_arch_init(void) | |||
| 141 | printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " | 141 | printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " |
| 142 | "segment %d\n", | 142 | "segment %d\n", |
| 143 | pci_mmcfg_config[i].pci_segment); | 143 | pci_mmcfg_config[i].pci_segment); |
| 144 | pci_mmcfg_arch_free(); | ||
| 144 | return 0; | 145 | return 0; |
| 145 | } | 146 | } |
| 146 | } | 147 | } |
| 147 | raw_pci_ext_ops = &pci_mmcfg; | 148 | raw_pci_ext_ops = &pci_mmcfg; |
| 148 | return 1; | 149 | return 1; |
| 149 | } | 150 | } |
| 151 | |||
| 152 | void __init pci_mmcfg_arch_free(void) | ||
| 153 | { | ||
| 154 | int i; | ||
| 155 | |||
| 156 | if (pci_mmcfg_virt == NULL) | ||
| 157 | return; | ||
| 158 | |||
| 159 | for (i = 0; i < pci_mmcfg_config_num; ++i) { | ||
| 160 | if (pci_mmcfg_virt[i].virt) { | ||
| 161 | iounmap(pci_mmcfg_virt[i].virt); | ||
| 162 | pci_mmcfg_virt[i].virt = NULL; | ||
| 163 | pci_mmcfg_virt[i].cfg = NULL; | ||
| 164 | } | ||
| 165 | } | ||
| 166 | |||
| 167 | kfree(pci_mmcfg_virt); | ||
| 168 | pci_mmcfg_virt = NULL; | ||
| 169 | } | ||
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h index 28b9b72ce7c7..c8b89a832c66 100644 --- a/arch/x86/pci/pci.h +++ b/arch/x86/pci/pci.h | |||
| @@ -101,6 +101,7 @@ extern void pci_pcbios_init(void); | |||
| 101 | /* pci-mmconfig.c */ | 101 | /* pci-mmconfig.c */ |
| 102 | 102 | ||
| 103 | extern int __init pci_mmcfg_arch_init(void); | 103 | extern int __init pci_mmcfg_arch_init(void); |
| 104 | extern void __init pci_mmcfg_arch_free(void); | ||
| 104 | 105 | ||
| 105 | /* | 106 | /* |
| 106 | * AMD Fam10h CPUs are buggy, and cannot access MMIO config space | 107 | * AMD Fam10h CPUs are buggy, and cannot access MMIO config space |
