diff options
author | Jiang Liu <jiang.liu@linux.intel.com> | 2014-06-09 04:19:59 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-06-21 17:05:43 -0400 |
commit | d7b830013f59cf586c1cec3caa1ce7156da59a13 (patch) | |
tree | 2f0e6aa5ee8df3506a9a61db8080f66b1afe7a86 /arch/x86/kernel/acpi | |
parent | 15a3c7cc9154321fc3ed1f7738bb7bbe690af91d (diff) |
x86, irq, ACPI: Use common irqdomain map interface to program IOAPIC pins
Refine ACPI to use common irqdomain map interface to program IOAPIC pins,
so we can unify the callsite to progam IOAPIC pins.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Link: http://lkml.kernel.org/r/1402302011-23642-31-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/acpi')
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 8d9aee1e67e8..9add76f15cb0 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -405,11 +405,7 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger, | |||
405 | static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, | 405 | static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, |
406 | int polarity) | 406 | int polarity) |
407 | { | 407 | { |
408 | int irq; | 408 | int irq, node; |
409 | int ioapic; | ||
410 | int ioapic_pin; | ||
411 | struct io_apic_irq_attr irq_attr; | ||
412 | int ret; | ||
413 | 409 | ||
414 | if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) | 410 | if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) |
415 | return gsi; | 411 | return gsi; |
@@ -418,39 +414,27 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, | |||
418 | if (acpi_gbl_FADT.sci_interrupt == gsi) | 414 | if (acpi_gbl_FADT.sci_interrupt == gsi) |
419 | return gsi; | 415 | return gsi; |
420 | 416 | ||
417 | trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1; | ||
418 | polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1; | ||
419 | node = dev ? dev_to_node(dev) : NUMA_NO_NODE; | ||
420 | if (mp_set_gsi_attr(gsi, trigger, polarity, node)) { | ||
421 | pr_warn("Failed to set pin attr for GSI%d\n", gsi); | ||
422 | return -1; | ||
423 | } | ||
424 | |||
421 | irq = map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC); | 425 | irq = map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC); |
422 | if (irq < 0) | 426 | if (irq < 0) |
423 | return irq; | 427 | return irq; |
424 | 428 | ||
425 | ioapic = mp_find_ioapic(gsi); | ||
426 | if (ioapic < 0) { | ||
427 | printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi); | ||
428 | return gsi; | ||
429 | } | ||
430 | |||
431 | ioapic_pin = mp_find_ioapic_pin(ioapic, gsi); | ||
432 | |||
433 | if (ioapic_pin > MP_MAX_IOAPIC_PIN) { | ||
434 | printk(KERN_ERR "Invalid reference to IOAPIC pin " | ||
435 | "%d-%d\n", mpc_ioapic_id(ioapic), | ||
436 | ioapic_pin); | ||
437 | return gsi; | ||
438 | } | ||
439 | |||
440 | if (enable_update_mptable) | 429 | if (enable_update_mptable) |
441 | mp_config_acpi_gsi(dev, gsi, trigger, polarity); | 430 | mp_config_acpi_gsi(dev, gsi, trigger, polarity); |
442 | 431 | ||
443 | set_io_apic_irq_attr(&irq_attr, ioapic, ioapic_pin, | ||
444 | trigger == ACPI_EDGE_SENSITIVE ? 0 : 1, | ||
445 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); | ||
446 | ret = io_apic_set_pci_routing(dev, irq, &irq_attr); | ||
447 | if (ret < 0) | ||
448 | irq = -1; | ||
449 | |||
450 | return irq; | 432 | return irq; |
451 | } | 433 | } |
452 | 434 | ||
453 | static struct irq_domain_ops acpi_irqdomain_ops; | 435 | static struct irq_domain_ops acpi_irqdomain_ops = { |
436 | .map = mp_irqdomain_map, | ||
437 | }; | ||
454 | 438 | ||
455 | static int __init | 439 | static int __init |
456 | acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) | 440 | acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) |
@@ -622,10 +606,6 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) | |||
622 | int irq = map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); | 606 | int irq = map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); |
623 | 607 | ||
624 | if (irq >= 0) { | 608 | if (irq >= 0) { |
625 | #ifdef CONFIG_X86_IO_APIC | ||
626 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) | ||
627 | setup_IO_APIC_irq_extra(gsi); | ||
628 | #endif | ||
629 | *irqp = irq; | 609 | *irqp = irq; |
630 | return 0; | 610 | return 0; |
631 | } | 611 | } |