* [PATCH] clean up some ACPI IRQ conversions
@ 2004-03-09 23:19 Bjorn Helgaas
2004-03-09 23:24 ` [ACPI] [PATCH] 1 of 6 sync mpparse Bjorn Helgaas
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: Bjorn Helgaas @ 2004-03-09 23:19 UTC (permalink / raw)
To: acpi-devel, linux-ia64; +Cc: Andi Kleen, Nakajima, Jun, Brown, Len
Back in January, I posted a patch to clean up some ACPI IRQ
handling:
http://www.gelato.unsw.edu.au/linux-ia64/0401/8019.html
http://www.gelato.unsw.edu.au/linux-ia64/0401/8005.html
At the time, it conflicted with some pending MSI updates, so we
put it off until those went in. Those are now in, so I'll post
my updated patches as responses to this note.
I originally proposed "acpi_interrupt_to_irq" as a better name for
"acpi_irq_to_vector", but I'm now proposing "acpi_global_irq_to_irq".
ia64 uses "gsi" rather than "global_irq", but "global_irq" seems to
be already established in include/linux/acpi.h, so I went that way.
If people think "acpi_global_irq_to_irq" is too clunky, I'd be glad
to change it, but it'd be nice to at least get these changes in as
a start.
I split it into six easy pieces:
1: i386 and x86_64: whitespace and typo changes to sync mpparse.c
2: x86_64: add acpi_irq_to_vector() to be same as i386
3: i386, x86_64: rename "irq" to "global_irq" (local vars, arguments)
(this also fixes a potential i386 bug; we used to do
irq = acpi_irq_to_vector(irq);
entry->irq = irq;
continue;
where we convert "irq" from an ACPI global irq to a Linux IRQ,
then go through the loop again. So we could find another PRT
entry where the global IRQ happens to match the Linux IRQ we
previously found, and screw things up.)
4: i386, x86_64, ia64, acpi: rename "acpi_irq_to_vector()" to "acpi_global_irq_to_irq()"
5: acpi: fix double conversion in acpi_os_install_interrupt_handler()
(this fixes the bug mentioned as the "fishy" part in
http://www.gelato.unsw.edu.au/linux-ia64/0401/8005.html)
6: acpi: rename acpi_irq variables for clarity
These changes (all together, not individually) have been built and
booted on ia64 and built for i386.
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [ACPI] [PATCH] 1 of 6 sync mpparse 2004-03-09 23:19 [PATCH] clean up some ACPI IRQ conversions Bjorn Helgaas @ 2004-03-09 23:24 ` Bjorn Helgaas 2004-03-09 23:25 ` [ACPI] [PATCH] 2 of 6 add acpi_irq_to_vector for x86_64 Bjorn Helgaas ` (3 subsequent siblings) 4 siblings, 0 replies; 13+ messages in thread From: Bjorn Helgaas @ 2004-03-09 23:24 UTC (permalink / raw) To: acpi-devel, linux-ia64; +Cc: Andi Kleen, Nakajima, Jun, Brown, Len i386, x86_64: sync mpparse.c slightly This cleans up a little whitespace and a couple typos to remove needless differences between mpparse.c for i386 and x86_64. diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c --- a/arch/i386/kernel/mpparse.c Tue Mar 9 13:13:20 2004 +++ b/arch/i386/kernel/mpparse.c Tue Mar 9 13:13:20 2004 @@ -1,5 +1,5 @@ /* - * Intel Multiprocessor Specificiation 1.1 and 1.4 + * Intel Multiprocessor Specification 1.1 and 1.4 * compliant MP-table parsing routines. * * (c) 1995 Alan Cox, Building #3 <alan@redhat.com> @@ -1158,19 +1158,19 @@ if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", mp_ioapic_routing[ioapic].apic_id, ioapic_pin); - entry->irq = acpi_irq_to_vector(irq); + entry->irq = acpi_irq_to_vector(irq); continue; } mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); if (!io_apic_set_pci_routing(ioapic, ioapic_pin, irq, edge_level, active_high_low)) { - entry->irq = acpi_irq_to_vector(irq); - } + entry->irq = acpi_irq_to_vector(irq); + } printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", - entry->id.segment, entry->id.bus, - entry->id.device, ('A' + entry->pin), - mp_ioapic_routing[ioapic].apic_id, ioapic_pin, + entry->id.segment, entry->id.bus, + entry->id.device, ('A' + entry->pin), + mp_ioapic_routing[ioapic].apic_id, ioapic_pin, entry->irq); } diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c --- a/arch/x86_64/kernel/mpparse.c Tue Mar 9 13:13:20 2004 +++ b/arch/x86_64/kernel/mpparse.c Tue Mar 9 13:13:20 2004 @@ -9,7 +9,7 @@ * Erich Boleyn : MP v1.4 and additional changes. * Alan Cox : Added EBDA scanning * Ingo Molnar : various cleanups and rewrites - * Maciej W. Rozycki : Bits for default MP configurations + * Maciej W. Rozycki: Bits for default MP configurations * Paul Diefenbaugh: Added full ACPI support */ @@ -1009,14 +1009,14 @@ if (use_pci_vector() && !platform_legacy_irq(irq)) irq = IO_APIC_VECTOR(irq); entry->irq = irq; - } - printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d" - " -> IRQ %d\n", entry->id.segment, entry->id.bus, - entry->id.device, ('A' + entry->pin), + } + printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", + entry->id.segment, entry->id.bus, + entry->id.device, ('A' + entry->pin), mp_ioapic_routing[ioapic].apic_id, ioapic_pin, entry->irq); } - + print_IO_APIC(); return; ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ACPI] [PATCH] 2 of 6 add acpi_irq_to_vector for x86_64 2004-03-09 23:19 [PATCH] clean up some ACPI IRQ conversions Bjorn Helgaas 2004-03-09 23:24 ` [ACPI] [PATCH] 1 of 6 sync mpparse Bjorn Helgaas @ 2004-03-09 23:25 ` Bjorn Helgaas [not found] ` <200403091619.04333.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org> ` (2 subsequent siblings) 4 siblings, 0 replies; 13+ messages in thread From: Bjorn Helgaas @ 2004-03-09 23:25 UTC (permalink / raw) To: acpi-devel, linux-ia64; +Cc: Andi Kleen, Nakajima, Jun, Brown, Len x86_64: Add acpi_irq_to_vector() to follow i386 diff -Nru a/arch/x86_64/kernel/acpi/boot.c b/arch/x86_64/kernel/acpi/boot.c --- a/arch/x86_64/kernel/acpi/boot.c Tue Mar 9 13:21:53 2004 +++ b/arch/x86_64/kernel/acpi/boot.c Tue Mar 9 13:21:53 2004 @@ -323,6 +323,15 @@ #endif /* CONFIG_ACPI_BUS */ +#ifdef CONFIG_X86_IO_APIC +int acpi_irq_to_vector(u32 irq) +{ + if (use_pci_vector() && !platform_legacy_irq(irq)) + irq = IO_APIC_VECTOR(irq); + return irq; +} +#endif + static unsigned long __init acpi_scan_rsdp ( unsigned long start, diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c --- a/arch/x86_64/kernel/mpparse.c Tue Mar 9 13:21:53 2004 +++ b/arch/x86_64/kernel/mpparse.c Tue Mar 9 13:21:53 2004 @@ -998,17 +998,13 @@ if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", mp_ioapic_routing[ioapic].apic_id, ioapic_pin); - if (use_pci_vector() && !platform_legacy_irq(irq)) - irq = IO_APIC_VECTOR(irq); - entry->irq = irq; + entry->irq = acpi_irq_to_vector(irq); continue; } mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); if (!io_apic_set_pci_routing(ioapic, ioapic_pin, irq, edge_level, active_high_low)) { - if (use_pci_vector() && !platform_legacy_irq(irq)) - irq = IO_APIC_VECTOR(irq); - entry->irq = irq; + entry->irq = acpi_irq_to_vector(irq); } printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", entry->id.segment, entry->id.bus, ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <200403091619.04333.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>]
* Re: [ACPI] [PATCH] 3 of 6 use global_irq to refer to ACPI global IRQs [not found] ` <200403091619.04333.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org> @ 2004-03-09 23:26 ` Bjorn Helgaas 2004-03-09 23:26 ` [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() Bjorn Helgaas 2004-03-09 23:26 ` [ACPI] [PATCH] 5 of 6 avoid double conversion of ACPI OS interrupt Bjorn Helgaas 2 siblings, 0 replies; 13+ messages in thread From: Bjorn Helgaas @ 2004-03-09 23:26 UTC (permalink / raw) To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-ia64-u79uwXL29TY76Z2rM5mHXA Cc: Andi Kleen, Nakajima, Jun, Brown, Len i386, x86_64: Use "global_irq", not "irq", when referring to ACPI global IRQs In mpparse.c, rename "irq" to "global_irq" to make it clear these are ACPI global IRQs, not the usual Linux IRQs. diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c --- a/arch/i386/kernel/mpparse.c Tue Mar 9 15:25:27 2004 +++ b/arch/i386/kernel/mpparse.c Tue Mar 9 15:25:27 2004 @@ -851,18 +851,18 @@ static int __init mp_find_ioapic ( - int irq) + int global_irq) { int i = 0; - /* Find the IOAPIC that manages this IRQ. */ + /* Find the IOAPIC that manages this global IRQ. */ for (i = 0; i < nr_ioapics; i++) { - if ((irq >= mp_ioapic_routing[i].irq_start) - && (irq <= mp_ioapic_routing[i].irq_end)) + if ((global_irq >= mp_ioapic_routing[i].irq_start) + && (global_irq <= mp_ioapic_routing[i].irq_end)) return i; } - printk(KERN_ERR "ERROR: Unable to locate IOAPIC for IRQ %d\n", irq); + printk(KERN_ERR "ERROR: Unable to locate IOAPIC for global IRQ %d\n", global_irq); return -1; } @@ -906,7 +906,7 @@ io_apic_get_redir_entries(idx); printk("IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, " - "IRQ %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, + "global IRQ %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, mp_ioapic_routing[idx].irq_start, mp_ioapic_routing[idx].irq_end); @@ -1029,7 +1029,7 @@ extern FADT_DESCRIPTOR acpi_fadt; -void __init mp_config_ioapic_for_sci(int irq) +void __init mp_config_ioapic_for_sci(int global_irq) { int ioapic; int ioapic_pin; @@ -1076,11 +1076,11 @@ */ flags = entry->flags; acpi_fadt.sci_int = entry->global_irq; - irq = entry->global_irq; + global_irq = entry->global_irq; - ioapic = mp_find_ioapic(irq); + ioapic = mp_find_ioapic(global_irq); - ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start; + ioapic_pin = global_irq - mp_ioapic_routing[ioapic].irq_start; /* * MPS INTI flags: @@ -1088,7 +1088,7 @@ * polarity: 0Þfault, 1=high, 3=low * Per ACPI spec, default for SCI means level/low. */ - io_apic_set_pci_routing(ioapic, ioapic_pin, irq, + io_apic_set_pci_routing(ioapic, ioapic_pin, global_irq, (flags.trigger = 1 ? 0 : 1), (flags.polarity = 1 ? 0 : 1)); } @@ -1100,7 +1100,7 @@ struct acpi_prt_entry *entry = NULL; int ioapic = -1; int ioapic_pin = 0; - int irq = 0; + int global_irq = 0; int idx, bit = 0; int edge_level = 0; int active_high_low = 0; @@ -1114,32 +1114,32 @@ /* Need to get irq for dynamic entry */ if (entry->link.handle) { - irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low); - if (!irq) + global_irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low); + if (!global_irq) continue; } else { /* Hardwired IRQ. Assume PCI standard settings */ - irq = entry->link.index; + global_irq = entry->link.index; edge_level = 1; active_high_low = 1; } /* Don't set up the ACPI SCI because it's already set up */ - if (acpi_fadt.sci_int = irq) { - irq = acpi_irq_to_vector(irq); - entry->irq = irq; /* we still need to set entry's irq */ + if (acpi_fadt.sci_int = global_irq) { + global_irq = acpi_irq_to_vector(global_irq); + entry->irq = global_irq; /* we still need to set entry's irq */ continue; } - ioapic = mp_find_ioapic(irq); + ioapic = mp_find_ioapic(global_irq); if (ioapic < 0) continue; - ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start; + ioapic_pin = global_irq - mp_ioapic_routing[ioapic].irq_start; if (es7000_plat) { - if (!ioapic && (irq < 16)) - irq += 16; + if (!ioapic && (global_irq < 16)) + global_irq += 16; } /* @@ -1158,14 +1158,14 @@ if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", mp_ioapic_routing[ioapic].apic_id, ioapic_pin); - entry->irq = acpi_irq_to_vector(irq); + entry->irq = acpi_irq_to_vector(global_irq); continue; } mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); - if (!io_apic_set_pci_routing(ioapic, ioapic_pin, irq, edge_level, active_high_low)) { - entry->irq = acpi_irq_to_vector(irq); + if (!io_apic_set_pci_routing(ioapic, ioapic_pin, global_irq, edge_level, active_high_low)) { + entry->irq = acpi_irq_to_vector(global_irq); } printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", entry->id.segment, entry->id.bus, diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c --- a/arch/x86_64/kernel/mpparse.c Tue Mar 9 15:25:27 2004 +++ b/arch/x86_64/kernel/mpparse.c Tue Mar 9 15:25:27 2004 @@ -697,18 +697,18 @@ static int __init mp_find_ioapic ( - int irq) + int global_irq) { int i = 0; - /* Find the IOAPIC that manages this IRQ. */ + /* Find the IOAPIC that manages this global IRQ. */ for (i = 0; i < nr_ioapics; i++) { - if ((irq >= mp_ioapic_routing[i].irq_start) - && (irq <= mp_ioapic_routing[i].irq_end)) + if ((global_irq >= mp_ioapic_routing[i].irq_start) + && (global_irq <= mp_ioapic_routing[i].irq_end)) return i; } - printk(KERN_ERR "ERROR: Unable to locate IOAPIC for IRQ %d\n", irq); + printk(KERN_ERR "ERROR: Unable to locate IOAPIC for global IRQ %d\n", global_irq); return -1; } @@ -752,7 +752,7 @@ io_apic_get_redir_entries(idx); printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " - "IRQ %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, + "global IRQ %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, mp_ioapic_routing[idx].irq_start, mp_ioapic_routing[idx].irq_end); @@ -878,7 +878,7 @@ extern FADT_DESCRIPTOR acpi_fadt; -void __init mp_config_ioapic_for_sci(int irq) +void __init mp_config_ioapic_for_sci(int global_irq) { int ioapic; int ioapic_pin; @@ -925,11 +925,11 @@ */ flags = entry->flags; acpi_fadt.sci_int = entry->global_irq; - irq = entry->global_irq; + global_irq = entry->global_irq; - ioapic = mp_find_ioapic(irq); + ioapic = mp_find_ioapic(global_irq); - ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start; + ioapic_pin = global_irq - mp_ioapic_routing[ioapic].irq_start; /* * MPS INTI flags: @@ -937,7 +937,7 @@ * polarity: 0Þfault, 1=high, 3=low * Per ACPI spec, default for SCI means level/low. */ - io_apic_set_pci_routing(ioapic, ioapic_pin, irq, + io_apic_set_pci_routing(ioapic, ioapic_pin, global_irq, (flags.trigger = 1 ? 0 : 1), (flags.polarity = 1 ? 0 : 1)); } @@ -949,7 +949,7 @@ struct acpi_prt_entry *entry = NULL; int ioapic = -1; int ioapic_pin = 0; - int irq = 0; + int global_irq = 0; int idx, bit = 0; int edge_level = 0; int active_high_low = 0; @@ -963,24 +963,24 @@ /* Need to get irq for dynamic entry */ if (entry->link.handle) { - irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low); - if (!irq) + global_irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low); + if (!global_irq) continue; } else { /* Hardwired IRQ. Assume PCI standard settings */ - irq = entry->link.index; + global_irq = entry->link.index; edge_level = 1; active_high_low = 1; } /* Don't set up the ACPI SCI because it's already set up */ - if (acpi_fadt.sci_int = irq) + if (acpi_fadt.sci_int = global_irq) continue; - ioapic = mp_find_ioapic(irq); + ioapic = mp_find_ioapic(global_irq); if (ioapic < 0) continue; - ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start; + ioapic_pin = global_irq - mp_ioapic_routing[ioapic].irq_start; /* * Avoid pin reprogramming. PRTs typically include entries @@ -998,13 +998,13 @@ if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", mp_ioapic_routing[ioapic].apic_id, ioapic_pin); - entry->irq = acpi_irq_to_vector(irq); + entry->irq = acpi_irq_to_vector(global_irq); continue; } mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); - if (!io_apic_set_pci_routing(ioapic, ioapic_pin, irq, edge_level, active_high_low)) { - entry->irq = acpi_irq_to_vector(irq); + if (!io_apic_set_pci_routing(ioapic, ioapic_pin, global_irq, edge_level, active_high_low)) { + entry->irq = acpi_irq_to_vector(global_irq); } printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", entry->id.segment, entry->id.bus, ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() [not found] ` <200403091619.04333.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org> 2004-03-09 23:26 ` [ACPI] [PATCH] 3 of 6 use global_irq to refer to ACPI global IRQs Bjorn Helgaas @ 2004-03-09 23:26 ` Bjorn Helgaas 2004-03-09 23:44 ` David Mosberger 2004-03-10 0:00 ` Nakajima, Jun 2004-03-09 23:26 ` [ACPI] [PATCH] 5 of 6 avoid double conversion of ACPI OS interrupt Bjorn Helgaas 2 siblings, 2 replies; 13+ messages in thread From: Bjorn Helgaas @ 2004-03-09 23:26 UTC (permalink / raw) To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-ia64-u79uwXL29TY76Z2rM5mHXA Cc: Andi Kleen, Nakajima, Jun, Brown, Len i386, x86_64, ia64, ACPI: Introduce acpi_global_irq_to_irq() Rename acpi_irq_to_vector() to acpi_global_irq_to_irq(). This function takes an ACPI global IRQ (often called a "global system interrupt", but "global_irq" seems to be commonly used in Linux), and converts it to a Linux IRQ. This removes IA64 and PCI_USE_VECTOR #ifdefs from ACPI. diff -Nru a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c --- a/arch/i386/kernel/acpi/boot.c Tue Mar 9 15:29:18 2004 +++ b/arch/i386/kernel/acpi/boot.c Tue Mar 9 15:29:18 2004 @@ -349,11 +349,13 @@ #endif /* CONFIG_ACPI_BUS */ #ifdef CONFIG_X86_IO_APIC -int acpi_irq_to_vector(u32 irq) +int acpi_global_irq_to_irq(u32 global_irq, unsigned int *irq) { - if (use_pci_vector() && !platform_legacy_irq(irq)) - irq = IO_APIC_VECTOR(irq); - return irq; + if (use_pci_vector() && !platform_legacy_irq(global_irq)) + *irq = IO_APIC_VECTOR(global_irq); + else + *irq = global_irq; + return 0; } #endif diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c --- a/arch/i386/kernel/mpparse.c Tue Mar 9 15:29:18 2004 +++ b/arch/i386/kernel/mpparse.c Tue Mar 9 15:29:18 2004 @@ -1127,8 +1127,8 @@ /* Don't set up the ACPI SCI because it's already set up */ if (acpi_fadt.sci_int = global_irq) { - global_irq = acpi_irq_to_vector(global_irq); - entry->irq = global_irq; /* we still need to set entry's irq */ + /* we still need to set entry's irq */ + acpi_global_irq_to_irq(global_irq, &entry->irq); continue; } @@ -1158,14 +1158,14 @@ if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", mp_ioapic_routing[ioapic].apic_id, ioapic_pin); - entry->irq = acpi_irq_to_vector(global_irq); + acpi_global_irq_to_irq(global_irq, &entry->irq); continue; } mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); if (!io_apic_set_pci_routing(ioapic, ioapic_pin, global_irq, edge_level, active_high_low)) { - entry->irq = acpi_irq_to_vector(global_irq); + acpi_global_irq_to_irq(global_irq, &entry->irq); } printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", entry->id.segment, entry->id.bus, diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c --- a/arch/ia64/kernel/acpi.c Tue Mar 9 15:29:18 2004 +++ b/arch/ia64/kernel/acpi.c Tue Mar 9 15:29:18 2004 @@ -627,12 +627,20 @@ } int -acpi_irq_to_vector (u32 gsi) +acpi_global_irq_to_irq (u32 gsi, unsigned int *irq) { + int vector; + if (has_8259 && gsi < 16) - return isa_irq_to_vector(gsi); + *irq = isa_irq_to_vector(gsi); + else { + vector = gsi_to_vector(gsi); + if (vector = -1) + return -1; - return gsi_to_vector(gsi); + *irq = vector; + } + return 0; } int diff -Nru a/arch/x86_64/kernel/acpi/boot.c b/arch/x86_64/kernel/acpi/boot.c --- a/arch/x86_64/kernel/acpi/boot.c Tue Mar 9 15:29:18 2004 +++ b/arch/x86_64/kernel/acpi/boot.c Tue Mar 9 15:29:18 2004 @@ -324,11 +324,13 @@ #endif /* CONFIG_ACPI_BUS */ #ifdef CONFIG_X86_IO_APIC -int acpi_irq_to_vector(u32 irq) +int acpi_global_irq_to_irq(u32 global_irq, unsigned int *irq) { - if (use_pci_vector() && !platform_legacy_irq(irq)) - irq = IO_APIC_VECTOR(irq); - return irq; + if (use_pci_vector() && !platform_legacy_irq(global_irq)) + *irq = IO_APIC_VECTOR(global_irq); + else + *irq = global_irq; + return 0; } #endif diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c --- a/arch/x86_64/kernel/mpparse.c Tue Mar 9 15:29:18 2004 +++ b/arch/x86_64/kernel/mpparse.c Tue Mar 9 15:29:18 2004 @@ -998,13 +998,13 @@ if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", mp_ioapic_routing[ioapic].apic_id, ioapic_pin); - entry->irq = acpi_irq_to_vector(global_irq); + acpi_global_irq_to_irq(global_irq, &entry->irq); continue; } mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); if (!io_apic_set_pci_routing(ioapic, ioapic_pin, global_irq, edge_level, active_high_low)) { - entry->irq = acpi_irq_to_vector(global_irq); + acpi_global_irq_to_irq(global_irq, &entry->irq); } printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", entry->id.segment, entry->id.bus, diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c --- a/drivers/acpi/osl.c Tue Mar 9 15:29:18 2004 +++ b/drivers/acpi/osl.c Tue Mar 9 15:29:18 2004 @@ -240,23 +240,22 @@ } acpi_status -acpi_os_install_interrupt_handler(u32 irq, OSD_HANDLER handler, void *context) +acpi_os_install_interrupt_handler(u32 global_irq, OSD_HANDLER handler, void *context) { + unsigned int irq; + /* * Ignore the irq from the core, and use the value in our copy of the * FADT. It may not be the same if an interrupt source override exists * for the SCI. */ - irq = acpi_fadt.sci_int; + global_irq = acpi_fadt.sci_int; -#if defined(CONFIG_IA64) || defined(CONFIG_PCI_USE_VECTOR) - irq = acpi_irq_to_vector(irq); - if (irq < 0) { + if (acpi_global_irq_to_irq(global_irq, &irq) < 0) { printk(KERN_ERR PREFIX "SCI (ACPI interrupt %d) not registered\n", - acpi_fadt.sci_int); + global_irq); return AE_OK; } -#endif acpi_irq_handler = handler; acpi_irq_context = context; if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) { @@ -269,12 +268,15 @@ } acpi_status -acpi_os_remove_interrupt_handler(u32 irq, OSD_HANDLER handler) +acpi_os_remove_interrupt_handler(u32 global_irq, OSD_HANDLER handler) { - if (irq) { -#if defined(CONFIG_IA64) || defined(CONFIG_PCI_USE_VECTOR) - irq = acpi_irq_to_vector(irq); -#endif + unsigned int irq; + + if (global_irq) { + if (acpi_global_irq_to_irq(global_irq, &irq) < 0) { + printk(KERN_ERR PREFIX "Can't remove ACPI interrupt handler\n"); + return AE_ERROR; + } free_irq(irq, acpi_irq); acpi_irq_handler = NULL; acpi_irq_irq = 0; diff -Nru a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h --- a/include/asm-i386/acpi.h Tue Mar 9 15:29:18 2004 +++ b/include/asm-i386/acpi.h Tue Mar 9 15:29:18 2004 @@ -115,9 +115,9 @@ /* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */ #define FIX_ACPI_PAGES 4 +extern int acpi_global_irq_to_irq(u32 global_irq, unsigned int *irq); #ifdef CONFIG_X86_IO_APIC extern int skip_ioapic_setup; -extern int acpi_irq_to_vector(u32 irq); static inline void disable_ioapic_setup(void) { diff -Nru a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h --- a/include/asm-ia64/acpi.h Tue Mar 9 15:29:18 2004 +++ b/include/asm-ia64/acpi.h Tue Mar 9 15:29:18 2004 @@ -93,7 +93,7 @@ const char *acpi_get_sysname (void); int acpi_request_vector (u32 int_type); int acpi_register_irq (u32 gsi, u32 polarity, u32 trigger); -int acpi_irq_to_vector (u32 irq); +int acpi_global_irq_to_irq (u32 global_irq, unsigned int *irq); #ifdef CONFIG_ACPI_NUMA /* Proximity bitmap length; _PXM is at most 255 (8 bit)*/ diff -Nru a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h --- a/include/asm-x86_64/acpi.h Tue Mar 9 15:29:18 2004 +++ b/include/asm-x86_64/acpi.h Tue Mar 9 15:29:18 2004 @@ -109,6 +109,8 @@ /* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */ #define FIX_ACPI_PAGES 4 +extern int acpi_global_irq_to_irq(u32 global_irq, unsigned int *irq); + #else /* !CONFIG_ACPI_BOOT */ #define acpi_lapic 0 #define acpi_ioapic 0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() 2004-03-09 23:26 ` [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() Bjorn Helgaas @ 2004-03-09 23:44 ` David Mosberger 2004-03-10 0:00 ` Nakajima, Jun 1 sibling, 0 replies; 13+ messages in thread From: David Mosberger @ 2004-03-09 23:44 UTC (permalink / raw) To: Bjorn Helgaas Cc: acpi-devel, linux-ia64, Andi Kleen, Nakajima, Jun, Brown, Len >>>>> On Tue, 9 Mar 2004 16:26:31 -0700, Bjorn Helgaas <bjorn.helgaas@hp.com> said: Bjorn> i386, x86_64, ia64, ACPI: Introduce acpi_global_irq_to_irq() Bjorn> Rename acpi_irq_to_vector() to acpi_global_irq_to_irq(). Bjorn> This function takes an ACPI global IRQ (often called a Bjorn> "global system interrupt", but "global_irq" seems to be Bjorn> commonly used in Linux), and converts it to a Linux IRQ. Bjorn> This removes IA64 and PCI_USE_VECTOR #ifdefs from ACPI. The ia64-specific changes have my blessing. However, I'd _much_ prefer "gsi" in lieu of "global_irq". It's much easier to think of the former as a numbering-scheme separate from the Linux irq numbers. Justs my 2 cents... --david ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() 2004-03-09 23:26 ` [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() Bjorn Helgaas 2004-03-09 23:44 ` David Mosberger @ 2004-03-10 0:00 ` Nakajima, Jun 2004-03-10 0:09 ` Bjorn Helgaas 1 sibling, 1 reply; 13+ messages in thread From: Nakajima, Jun @ 2004-03-10 0:00 UTC (permalink / raw) To: davidm, Bjorn Helgaas; +Cc: acpi-devel, linux-ia64, Andi Kleen, Brown, Len I agree with David. And GSI is more consistent with the ACPI spec, and you don't need to explain what it is. Jun >-----Original Message----- >From: David Mosberger [mailto:davidm@napali.hpl.hp.com] >Sent: Tuesday, March 09, 2004 3:45 PM >To: Bjorn Helgaas >Cc: acpi-devel@lists.sourceforge.net; linux-ia64@vger.kernel.org; Andi >Kleen; Nakajima, Jun; Brown, Len >Subject: Re: [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() > >>>>>> On Tue, 9 Mar 2004 16:26:31 -0700, Bjorn Helgaas ><bjorn.helgaas@hp.com> said: > > Bjorn> i386, x86_64, ia64, ACPI: Introduce acpi_global_irq_to_irq() > Bjorn> Rename acpi_irq_to_vector() to acpi_global_irq_to_irq(). > Bjorn> This function takes an ACPI global IRQ (often called a > Bjorn> "global system interrupt", but "global_irq" seems to be > Bjorn> commonly used in Linux), and converts it to a Linux IRQ. > > Bjorn> This removes IA64 and PCI_USE_VECTOR #ifdefs from ACPI. > >The ia64-specific changes have my blessing. > >However, I'd _much_ prefer "gsi" in lieu of "global_irq". It's much >easier to think of the former as a numbering-scheme separate from the >Linux irq numbers. Justs my 2 cents... > > --david ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() 2004-03-10 0:00 ` Nakajima, Jun @ 2004-03-10 0:09 ` Bjorn Helgaas 0 siblings, 0 replies; 13+ messages in thread From: Bjorn Helgaas @ 2004-03-10 0:09 UTC (permalink / raw) To: Nakajima, Jun, davidm; +Cc: acpi-devel, linux-ia64, Andi Kleen, Brown, Len On Tuesday 09 March 2004 5:00 pm, Nakajima, Jun wrote: > I agree with David. And GSI is more consistent with the ACPI spec, and > you don't need to explain what it is. OK, once we get the current patches squared away, I'll prepare a patch to change to "gsi". (It will be more extensive, because I think it makes sense to change the names in include/linux/acpi.h, such as those in struct acpi_table_ioapic and struct acpi_table_iosapic, at the same time.) ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ACPI] [PATCH] 5 of 6 avoid double conversion of ACPI OS interrupt [not found] ` <200403091619.04333.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org> 2004-03-09 23:26 ` [ACPI] [PATCH] 3 of 6 use global_irq to refer to ACPI global IRQs Bjorn Helgaas 2004-03-09 23:26 ` [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() Bjorn Helgaas @ 2004-03-09 23:26 ` Bjorn Helgaas 2 siblings, 0 replies; 13+ messages in thread From: Bjorn Helgaas @ 2004-03-09 23:26 UTC (permalink / raw) To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-ia64-u79uwXL29TY76Z2rM5mHXA Cc: Andi Kleen, Nakajima, Jun, Brown, Len ACPI: Avoid double conversion of ACPI OS interrupt The global IRQ used to be converted once in acpi_os_install_interrupt_handler() and again in acpi_os_remove_interrupt_handler(). diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c --- a/drivers/acpi/osl.c Tue Mar 9 14:24:15 2004 +++ b/drivers/acpi/osl.c Tue Mar 9 14:24:15 2004 @@ -262,7 +262,7 @@ printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); return AE_NOT_ACQUIRED; } - acpi_irq_irq = irq; + acpi_irq_irq = global_irq; return AE_OK; } ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ACPI] [PATCH] 6 of 6 rename some ACPI IRQ variables 2004-03-09 23:19 [PATCH] clean up some ACPI IRQ conversions Bjorn Helgaas ` (2 preceding siblings ...) [not found] ` <200403091619.04333.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org> @ 2004-03-09 23:27 ` Bjorn Helgaas 2004-03-09 23:54 ` [PATCH] clean up some ACPI IRQ conversions Andi Kleen 4 siblings, 0 replies; 13+ messages in thread From: Bjorn Helgaas @ 2004-03-09 23:27 UTC (permalink / raw) To: acpi-devel, linux-ia64; +Cc: Andi Kleen, Nakajima, Jun, Brown, Len ACPI: Rename ACPI IRQ variables for clarity acpi_irq_irq -> acpi_irq_global_irq acpi_irq -> acpi_irq_trampoline diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c --- a/drivers/acpi/osl.c Tue Mar 9 14:44:25 2004 +++ b/drivers/acpi/osl.c Tue Mar 9 14:44:25 2004 @@ -63,7 +63,7 @@ extern char line_buf[80]; #endif /*ENABLE_DEBUGGER*/ -static int acpi_irq_irq; +static int acpi_irq_global_irq; static OSD_HANDLER acpi_irq_handler; static void *acpi_irq_context; @@ -88,7 +88,7 @@ acpi_os_terminate(void) { if (acpi_irq_handler) { - acpi_os_remove_interrupt_handler(acpi_irq_irq, + acpi_os_remove_interrupt_handler(acpi_irq_global_irq, acpi_irq_handler); } @@ -234,7 +234,7 @@ } static irqreturn_t -acpi_irq(int irq, void *dev_id, struct pt_regs *regs) +acpi_irq_trampoline(int irq, void *dev_id, struct pt_regs *regs) { return (*acpi_irq_handler)(acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE; } @@ -258,11 +258,11 @@ } acpi_irq_handler = handler; acpi_irq_context = context; - if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) { + if (request_irq(irq, acpi_irq_trampoline, SA_SHIRQ, "acpi", acpi_irq_trampoline)) { printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); return AE_NOT_ACQUIRED; } - acpi_irq_irq = global_irq; + acpi_irq_global_irq = global_irq; return AE_OK; } @@ -277,9 +277,9 @@ printk(KERN_ERR PREFIX "Can't remove ACPI interrupt handler\n"); return AE_ERROR; } - free_irq(irq, acpi_irq); + free_irq(irq, acpi_irq_trampoline); acpi_irq_handler = NULL; - acpi_irq_irq = 0; + acpi_irq_global_irq = 0; } return AE_OK; ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] clean up some ACPI IRQ conversions 2004-03-09 23:19 [PATCH] clean up some ACPI IRQ conversions Bjorn Helgaas ` (3 preceding siblings ...) 2004-03-09 23:27 ` [ACPI] [PATCH] 6 of 6 rename some ACPI IRQ variables Bjorn Helgaas @ 2004-03-09 23:54 ` Andi Kleen 2004-03-10 16:41 ` Bjorn Helgaas 4 siblings, 1 reply; 13+ messages in thread From: Andi Kleen @ 2004-03-09 23:54 UTC (permalink / raw) To: Bjorn Helgaas Cc: acpi-devel, linux-ia64, Andi Kleen, Nakajima, Jun, Brown, Len > These changes (all together, not individually) have been built and > booted on ia64 and built for i386. The x86-64 changes look fine to me. I suppose you will submit them directly? Before you do that I would appreciate it if you could at least compile check x86-64 and fix any compile errors that may have been introduced. Cross compilers for that can be found in ftp://ftp.suse.com/pub/suse/x86_64/supplementary/CrossTools/8.1-i386 (or ftp://ftp.gwdg.de:/pub/suse/... if suse.com is too slow) -Andi ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] clean up some ACPI IRQ conversions 2004-03-09 23:54 ` [PATCH] clean up some ACPI IRQ conversions Andi Kleen @ 2004-03-10 16:41 ` Bjorn Helgaas 2004-03-10 17:10 ` Andi Kleen 0 siblings, 1 reply; 13+ messages in thread From: Bjorn Helgaas @ 2004-03-10 16:41 UTC (permalink / raw) Cc: acpi-devel, linux-ia64, Andi Kleen, Nakajima, Jun, Brown, Len On Tuesday 09 March 2004 4:54 pm, Andi Kleen wrote: > > These changes (all together, not individually) have been built and > > booted on ia64 and built for i386. > > The x86-64 changes look fine to me. I suppose you will submit them directly? > Before you do that I would appreciate it if you could at least compile > check x86-64 and fix any compile errors that may have been introduced. "make defconfig" compiles and links OK with the x86-64 cross compiler. I couldn't see a way to turn on CONFIG_PCI_USE_VECTOR. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] clean up some ACPI IRQ conversions 2004-03-10 16:41 ` Bjorn Helgaas @ 2004-03-10 17:10 ` Andi Kleen 0 siblings, 0 replies; 13+ messages in thread From: Andi Kleen @ 2004-03-10 17:10 UTC (permalink / raw) To: Bjorn Helgaas Cc: Andi Kleen, acpi-devel, linux-ia64, Nakajima, Jun, Brown, Len On Wed, Mar 10, 2004 at 09:41:21AM -0700, Bjorn Helgaas wrote: > On Tuesday 09 March 2004 4:54 pm, Andi Kleen wrote: > > > These changes (all together, not individually) have been built and > > > booted on ia64 and built for i386. > > > > The x86-64 changes look fine to me. I suppose you will submit them directly? > > Before you do that I would appreciate it if you could at least compile > > check x86-64 and fix any compile errors that may have been introduced. > > "make defconfig" compiles and links OK with the x86-64 cross compiler. Thanks. > > I couldn't see a way to turn on CONFIG_PCI_USE_VECTOR. It's disabled because the generic code is too i386 centric. -Andi ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2004-03-10 17:10 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-09 23:19 [PATCH] clean up some ACPI IRQ conversions Bjorn Helgaas
2004-03-09 23:24 ` [ACPI] [PATCH] 1 of 6 sync mpparse Bjorn Helgaas
2004-03-09 23:25 ` [ACPI] [PATCH] 2 of 6 add acpi_irq_to_vector for x86_64 Bjorn Helgaas
[not found] ` <200403091619.04333.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2004-03-09 23:26 ` [ACPI] [PATCH] 3 of 6 use global_irq to refer to ACPI global IRQs Bjorn Helgaas
2004-03-09 23:26 ` [ACPI] [PATCH] 4 of 6 introduce acpi_global_irq_to_irq() Bjorn Helgaas
2004-03-09 23:44 ` David Mosberger
2004-03-10 0:00 ` Nakajima, Jun
2004-03-10 0:09 ` Bjorn Helgaas
2004-03-09 23:26 ` [ACPI] [PATCH] 5 of 6 avoid double conversion of ACPI OS interrupt Bjorn Helgaas
2004-03-09 23:27 ` [ACPI] [PATCH] 6 of 6 rename some ACPI IRQ variables Bjorn Helgaas
2004-03-09 23:54 ` [PATCH] clean up some ACPI IRQ conversions Andi Kleen
2004-03-10 16:41 ` Bjorn Helgaas
2004-03-10 17:10 ` Andi Kleen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox