diff options
author | Aaron Durbin <adurbin@google.com> | 2007-07-21 11:10:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-21 21:37:10 -0400 |
commit | a5ba7971045a90a36cef8f7d5a3075600b475b74 (patch) | |
tree | 5a2cc7b4c818a36fec1c844903114142fdfd88bb /arch/i386/pci/mmconfig-shared.c | |
parent | 08705b89ecb0f4b0ba5735630ef988bd9fd9dd95 (diff) |
i386: insert unclaimed MMCONFIG resources
Insert the unclaimed MMCONFIG resources into the resource tree without the
IORESOURCE_BUSY flag during late initialization. This allows the MMCONFIG
regions to be visible in the iomem resource tree without interfering with
other system resources that were discovered during PCI initialization.
[akpm@linux-foundation.org: nanofixes]
Signed-off-by: Aaron Durbin <adurbin@google.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/i386/pci/mmconfig-shared.c')
-rw-r--r-- | arch/i386/pci/mmconfig-shared.c | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/arch/i386/pci/mmconfig-shared.c b/arch/i386/pci/mmconfig-shared.c index c7cabeed4d7b..4df637e34f81 100644 --- a/arch/i386/pci/mmconfig-shared.c +++ b/arch/i386/pci/mmconfig-shared.c | |||
@@ -24,6 +24,9 @@ | |||
24 | 24 | ||
25 | DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS); | 25 | DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS); |
26 | 26 | ||
27 | /* Indicate if the mmcfg resources have been placed into the resource table. */ | ||
28 | static int __initdata pci_mmcfg_resources_inserted; | ||
29 | |||
27 | /* K8 systems have some devices (typically in the builtin northbridge) | 30 | /* K8 systems have some devices (typically in the builtin northbridge) |
28 | that are only accessible using type1 | 31 | that are only accessible using type1 |
29 | Normally this can be expressed in the MCFG by not listing them | 32 | Normally this can be expressed in the MCFG by not listing them |
@@ -170,7 +173,7 @@ static int __init pci_mmcfg_check_hostbridge(void) | |||
170 | return name != NULL; | 173 | return name != NULL; |
171 | } | 174 | } |
172 | 175 | ||
173 | static void __init pci_mmcfg_insert_resources(void) | 176 | static void __init pci_mmcfg_insert_resources(unsigned long resource_flags) |
174 | { | 177 | { |
175 | #define PCI_MMCFG_RESOURCE_NAME_LEN 19 | 178 | #define PCI_MMCFG_RESOURCE_NAME_LEN 19 |
176 | int i; | 179 | int i; |
@@ -194,10 +197,13 @@ static void __init pci_mmcfg_insert_resources(void) | |||
194 | cfg->pci_segment); | 197 | cfg->pci_segment); |
195 | res->start = cfg->address; | 198 | res->start = cfg->address; |
196 | res->end = res->start + (num_buses << 20) - 1; | 199 | res->end = res->start + (num_buses << 20) - 1; |
197 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | 200 | res->flags = IORESOURCE_MEM | resource_flags; |
198 | insert_resource(&iomem_resource, res); | 201 | insert_resource(&iomem_resource, res); |
199 | names += PCI_MMCFG_RESOURCE_NAME_LEN; | 202 | names += PCI_MMCFG_RESOURCE_NAME_LEN; |
200 | } | 203 | } |
204 | |||
205 | /* Mark that the resources have been inserted. */ | ||
206 | pci_mmcfg_resources_inserted = 1; | ||
201 | } | 207 | } |
202 | 208 | ||
203 | static void __init pci_mmcfg_reject_broken(int type) | 209 | static void __init pci_mmcfg_reject_broken(int type) |
@@ -267,7 +273,43 @@ void __init pci_mmcfg_init(int type) | |||
267 | if (type == 1) | 273 | if (type == 1) |
268 | unreachable_devices(); | 274 | unreachable_devices(); |
269 | if (known_bridge) | 275 | if (known_bridge) |
270 | pci_mmcfg_insert_resources(); | 276 | pci_mmcfg_insert_resources(IORESOURCE_BUSY); |
271 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; | 277 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; |
278 | } else { | ||
279 | /* | ||
280 | * Signal not to attempt to insert mmcfg resources because | ||
281 | * the architecture mmcfg setup could not initialize. | ||
282 | */ | ||
283 | pci_mmcfg_resources_inserted = 1; | ||
272 | } | 284 | } |
273 | } | 285 | } |
286 | |||
287 | static int __init pci_mmcfg_late_insert_resources(void) | ||
288 | { | ||
289 | /* | ||
290 | * If resources are already inserted or we are not using MMCONFIG, | ||
291 | * don't insert the resources. | ||
292 | */ | ||
293 | if ((pci_mmcfg_resources_inserted == 1) || | ||
294 | (pci_probe & PCI_PROBE_MMCONF) == 0 || | ||
295 | (pci_mmcfg_config_num == 0) || | ||
296 | (pci_mmcfg_config == NULL) || | ||
297 | (pci_mmcfg_config[0].address == 0)) | ||
298 | return 1; | ||
299 | |||
300 | /* | ||
301 | * Attempt to insert the mmcfg resources but not with the busy flag | ||
302 | * marked so it won't cause request errors when __request_region is | ||
303 | * called. | ||
304 | */ | ||
305 | pci_mmcfg_insert_resources(0); | ||
306 | |||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | /* | ||
311 | * Perform MMCONFIG resource insertion after PCI initialization to allow for | ||
312 | * misprogrammed MCFG tables that state larger sizes but actually conflict | ||
313 | * with other system resources. | ||
314 | */ | ||
315 | late_initcall(pci_mmcfg_late_insert_resources); | ||