diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2010-06-24 11:59:16 -0400 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-10-22 16:25:41 -0400 |
commit | 2f065aef17b8d50a51a72451d03c7d7304249fb5 (patch) | |
tree | 433f2efacaa16ec36578a8131a594db8f51a69b1 /arch/x86/kernel/acpi | |
parent | 42a1de56f35a9c87932f45439dc1b09c8da0cc95 (diff) |
acpi: use indirect call to register gsi in different modes
Rather than using a tree of conditionals, use function pointer
for acpi_register_gsi.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'arch/x86/kernel/acpi')
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index c05872aa3ce0..031f0c238916 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -513,35 +513,61 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi) | |||
513 | return 0; | 513 | return 0; |
514 | } | 514 | } |
515 | 515 | ||
516 | /* | 516 | static int acpi_register_gsi_pic(struct device *dev, u32 gsi, |
517 | * success: return IRQ number (>=0) | 517 | int trigger, int polarity) |
518 | * failure: return < 0 | ||
519 | */ | ||
520 | int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) | ||
521 | { | 518 | { |
522 | unsigned int irq; | ||
523 | unsigned int plat_gsi = gsi; | ||
524 | |||
525 | #ifdef CONFIG_PCI | 519 | #ifdef CONFIG_PCI |
526 | /* | 520 | /* |
527 | * Make sure all (legacy) PCI IRQs are set as level-triggered. | 521 | * Make sure all (legacy) PCI IRQs are set as level-triggered. |
528 | */ | 522 | */ |
529 | if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { | 523 | if (trigger == ACPI_LEVEL_SENSITIVE) |
530 | if (trigger == ACPI_LEVEL_SENSITIVE) | 524 | eisa_set_level_irq(gsi); |
531 | eisa_set_level_irq(gsi); | ||
532 | } | ||
533 | #endif | 525 | #endif |
534 | 526 | ||
527 | return gsi; | ||
528 | } | ||
529 | |||
530 | static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi, | ||
531 | int trigger, int polarity) | ||
532 | { | ||
535 | #ifdef CONFIG_X86_IO_APIC | 533 | #ifdef CONFIG_X86_IO_APIC |
536 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { | 534 | gsi = mp_register_gsi(dev, gsi, trigger, polarity); |
537 | plat_gsi = mp_register_gsi(dev, gsi, trigger, polarity); | ||
538 | } | ||
539 | #endif | 535 | #endif |
536 | |||
537 | return gsi; | ||
538 | } | ||
539 | |||
540 | static int (*__acpi_register_gsi)(struct device *dev, u32 gsi, int trigger, int polarity) = acpi_register_gsi_pic; | ||
541 | |||
542 | /* | ||
543 | * success: return IRQ number (>=0) | ||
544 | * failure: return < 0 | ||
545 | */ | ||
546 | int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) | ||
547 | { | ||
548 | unsigned int irq; | ||
549 | unsigned int plat_gsi = gsi; | ||
550 | |||
551 | plat_gsi = (*__acpi_register_gsi)(dev, gsi, trigger, polarity); | ||
540 | irq = gsi_to_irq(plat_gsi); | 552 | irq = gsi_to_irq(plat_gsi); |
541 | 553 | ||
542 | return irq; | 554 | return irq; |
543 | } | 555 | } |
544 | 556 | ||
557 | void __init acpi_set_irq_model_pic(void) | ||
558 | { | ||
559 | acpi_irq_model = ACPI_IRQ_MODEL_PIC; | ||
560 | __acpi_register_gsi = acpi_register_gsi_pic; | ||
561 | acpi_ioapic = 0; | ||
562 | } | ||
563 | |||
564 | void __init acpi_set_irq_model_ioapic(void) | ||
565 | { | ||
566 | acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; | ||
567 | __acpi_register_gsi = acpi_register_gsi_ioapic; | ||
568 | acpi_ioapic = 1; | ||
569 | } | ||
570 | |||
545 | /* | 571 | /* |
546 | * ACPI based hotplug support for CPU | 572 | * ACPI based hotplug support for CPU |
547 | */ | 573 | */ |
@@ -1259,8 +1285,7 @@ static void __init acpi_process_madt(void) | |||
1259 | */ | 1285 | */ |
1260 | error = acpi_parse_madt_ioapic_entries(); | 1286 | error = acpi_parse_madt_ioapic_entries(); |
1261 | if (!error) { | 1287 | if (!error) { |
1262 | acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; | 1288 | acpi_set_irq_model_ioapic(); |
1263 | acpi_ioapic = 1; | ||
1264 | 1289 | ||
1265 | smp_found_config = 1; | 1290 | smp_found_config = 1; |
1266 | } | 1291 | } |