aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/dmar.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 16:22:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 16:23:01 -0400
commit9301975ec251bab1ad7cfcb84a688b26187e4e4a (patch)
tree91e48be0bdc67cbcb75bc8a299a3dcf168e0a814 /drivers/pci/dmar.c
parent7110879cf2afbfb7af79675f5ff109e63d631c25 (diff)
parentdd3a1db900f2a215a7d7dd71b836e149a6cf5fed (diff)
Merge branch 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
This merges branches irq/genirq, irq/sparseirq-v4, timers/hpet-percpu and x86/uv. The sparseirq branch is just preliminary groundwork: no sparse IRQs are actually implemented by this tree anymore - just the new APIs are added while keeping the old way intact as well (the new APIs map 1:1 to irq_desc[]). The 'real' sparse IRQ support will then be a relatively small patch ontop of this - with a v2.6.29 merge target. * 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (178 commits) genirq: improve include files intr_remapping: fix typo io_apic: make irq_mis_count available on 64-bit too genirq: fix name space collisions of nr_irqs in arch/* genirq: fix name space collision of nr_irqs in autoprobe.c genirq: use iterators for irq_desc loops proc: fixup irq iterator genirq: add reverse iterator for irq_desc x86: move ack_bad_irq() to irq.c x86: unify show_interrupts() and proc helpers x86: cleanup show_interrupts genirq: cleanup the sparseirq modifications genirq: remove artifacts from sparseirq removal genirq: revert dynarray genirq: remove irq_to_desc_alloc genirq: remove sparse irq code genirq: use inline function for irq_to_desc genirq: consolidate nr_irqs and for_each_irq_desc() x86: remove sparse irq from Kconfig genirq: define nr_irqs for architectures with GENERIC_HARDIRQS=n ...
Diffstat (limited to 'drivers/pci/dmar.c')
-rw-r--r--drivers/pci/dmar.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index e842e756308a..8b29c307f1a1 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -193,7 +193,7 @@ dmar_parse_dev(struct dmar_drhd_unit *dmaru)
193{ 193{
194 struct acpi_dmar_hardware_unit *drhd; 194 struct acpi_dmar_hardware_unit *drhd;
195 static int include_all; 195 static int include_all;
196 int ret; 196 int ret = 0;
197 197
198 drhd = (struct acpi_dmar_hardware_unit *) dmaru->hdr; 198 drhd = (struct acpi_dmar_hardware_unit *) dmaru->hdr;
199 199
@@ -212,7 +212,7 @@ dmar_parse_dev(struct dmar_drhd_unit *dmaru)
212 include_all = 1; 212 include_all = 1;
213 } 213 }
214 214
215 if (ret || (dmaru->devices_cnt == 0 && !dmaru->include_all)) { 215 if (ret) {
216 list_del(&dmaru->list); 216 list_del(&dmaru->list);
217 kfree(dmaru); 217 kfree(dmaru);
218 } 218 }
@@ -289,6 +289,24 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
289 } 289 }
290} 290}
291 291
292/**
293 * dmar_table_detect - checks to see if the platform supports DMAR devices
294 */
295static int __init dmar_table_detect(void)
296{
297 acpi_status status = AE_OK;
298
299 /* if we could find DMAR table, then there are DMAR devices */
300 status = acpi_get_table(ACPI_SIG_DMAR, 0,
301 (struct acpi_table_header **)&dmar_tbl);
302
303 if (ACPI_SUCCESS(status) && !dmar_tbl) {
304 printk (KERN_WARNING PREFIX "Unable to map DMAR\n");
305 status = AE_NOT_FOUND;
306 }
307
308 return (ACPI_SUCCESS(status) ? 1 : 0);
309}
292 310
293/** 311/**
294 * parse_dmar_table - parses the DMA reporting table 312 * parse_dmar_table - parses the DMA reporting table
@@ -300,6 +318,12 @@ parse_dmar_table(void)
300 struct acpi_dmar_header *entry_header; 318 struct acpi_dmar_header *entry_header;
301 int ret = 0; 319 int ret = 0;
302 320
321 /*
322 * Do it again, earlier dmar_tbl mapping could be mapped with
323 * fixed map.
324 */
325 dmar_table_detect();
326
303 dmar = (struct acpi_table_dmar *)dmar_tbl; 327 dmar = (struct acpi_table_dmar *)dmar_tbl;
304 if (!dmar) 328 if (!dmar)
305 return -ENODEV; 329 return -ENODEV;
@@ -373,10 +397,10 @@ dmar_find_matched_drhd_unit(struct pci_dev *dev)
373 397
374int __init dmar_dev_scope_init(void) 398int __init dmar_dev_scope_init(void)
375{ 399{
376 struct dmar_drhd_unit *drhd; 400 struct dmar_drhd_unit *drhd, *drhd_n;
377 int ret = -ENODEV; 401 int ret = -ENODEV;
378 402
379 for_each_drhd_unit(drhd) { 403 list_for_each_entry_safe(drhd, drhd_n, &dmar_drhd_units, list) {
380 ret = dmar_parse_dev(drhd); 404 ret = dmar_parse_dev(drhd);
381 if (ret) 405 if (ret)
382 return ret; 406 return ret;
@@ -384,8 +408,8 @@ int __init dmar_dev_scope_init(void)
384 408
385#ifdef CONFIG_DMAR 409#ifdef CONFIG_DMAR
386 { 410 {
387 struct dmar_rmrr_unit *rmrr; 411 struct dmar_rmrr_unit *rmrr, *rmrr_n;
388 for_each_rmrr_units(rmrr) { 412 list_for_each_entry_safe(rmrr, rmrr_n, &dmar_rmrr_units, list) {
389 ret = rmrr_parse_dev(rmrr); 413 ret = rmrr_parse_dev(rmrr);
390 if (ret) 414 if (ret)
391 return ret; 415 return ret;
@@ -430,30 +454,11 @@ int __init dmar_table_init(void)
430 return 0; 454 return 0;
431} 455}
432 456
433/**
434 * early_dmar_detect - checks to see if the platform supports DMAR devices
435 */
436int __init early_dmar_detect(void)
437{
438 acpi_status status = AE_OK;
439
440 /* if we could find DMAR table, then there are DMAR devices */
441 status = acpi_get_table(ACPI_SIG_DMAR, 0,
442 (struct acpi_table_header **)&dmar_tbl);
443
444 if (ACPI_SUCCESS(status) && !dmar_tbl) {
445 printk (KERN_WARNING PREFIX "Unable to map DMAR\n");
446 status = AE_NOT_FOUND;
447 }
448
449 return (ACPI_SUCCESS(status) ? 1 : 0);
450}
451
452void __init detect_intel_iommu(void) 457void __init detect_intel_iommu(void)
453{ 458{
454 int ret; 459 int ret;
455 460
456 ret = early_dmar_detect(); 461 ret = dmar_table_detect();
457 462
458#ifdef CONFIG_DMAR 463#ifdef CONFIG_DMAR
459 { 464 {
@@ -479,14 +484,16 @@ void __init detect_intel_iommu(void)
479 " x2apic support\n"); 484 " x2apic support\n");
480 485
481 dmar_disabled = 1; 486 dmar_disabled = 1;
482 return; 487 goto end;
483 } 488 }
484 489
485 if (ret && !no_iommu && !iommu_detected && !swiotlb && 490 if (ret && !no_iommu && !iommu_detected && !swiotlb &&
486 !dmar_disabled) 491 !dmar_disabled)
487 iommu_detected = 1; 492 iommu_detected = 1;
488 } 493 }
494end:
489#endif 495#endif
496 dmar_tbl = NULL;
490} 497}
491 498
492 499