public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86_64 part of ACPI IRQ cleanup
@ 2004-04-06 21:08 Bjorn Helgaas
       [not found] ` <200404061508.10717.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Helgaas @ 2004-04-06 21:08 UTC (permalink / raw)
  To: Andi Kleen; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Here's the x86_64 part of the ACPI IRQ cleanup I proposed here:

    http://www.gelato.unsw.edu.au/linux-ia64/0403/8979.html

No functional change in this patch; after x86_64, i386, and ia64
interfaces are in, I'll post the ACPI pci_irq.c changes to use them.

i386 and x86_64 share arch/i386/kernel/acpi/boot.c, so the x86_64
bit has to go in before the i386 one.

Booted on Altus 1000E.

===== arch/x86_64/kernel/mpparse.c 1.24 vs edited =====
--- 1.24/arch/x86_64/kernel/mpparse.c	Mon Mar 22 23:53:14 2004
+++ edited/arch/x86_64/kernel/mpparse.c	Tue Apr  6 14:19:30 2004
@@ -969,6 +969,49 @@
 
 #endif /*CONFIG_ACPI_PCI*/
 
+void mp_register_gsi (u32 gsi, int polarity, int trigger)
+{
+	int			ioapic = -1;
+	int			ioapic_pin = 0;
+	int			idx, bit = 0;
+
+	/* Don't set up the ACPI SCI because it's already set up */
+	if (acpi_fadt.sci_int == gsi)
+		return;
+
+	ioapic = mp_find_ioapic(gsi);
+	if (ioapic < 0) {
+		printk(KERN_WARNING "No IOAPIC for GSI 0x%x\n", gsi);
+		return;
+	}
+
+	ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_start;
+
+	/* 
+	 * Avoid pin reprogramming.  PRTs typically include entries  
+	 * with redundant pin->gsi mappings (but unique PCI devices);
+	 * we only only program the IOAPIC on the first.
+	 */
+	bit = ioapic_pin % 32;
+	idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32);
+	if (idx > 3) {
+		printk(KERN_ERR "Invalid reference to IOAPIC pin "
+			"%d-%d\n", mp_ioapic_routing[ioapic].apic_id, 
+			ioapic_pin);
+		return;
+	}
+	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);
+		return;
+	}
+
+	mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
+	io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
+		trigger == ACPI_EDGE_SENSITIVE ? 0 : 1,
+		polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
+}
+
 #endif /*CONFIG_X86_IO_APIC*/
 
 #endif /*CONFIG_ACPI_BOOT*/
===== include/asm-x86_64/mpspec.h 1.10 vs edited =====
--- 1.10/include/asm-x86_64/mpspec.h	Mon Mar 22 23:53:14 2004
+++ edited/include/asm-x86_64/mpspec.h	Tue Apr  6 14:21:14 2004
@@ -190,6 +190,7 @@
 extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi);
 extern void mp_config_acpi_legacy_irqs (void);
 extern void mp_parse_prt (void);
+extern void mp_register_gsi (u32 gsi, int polarity, int trigger);
 #endif /*CONFIG_X86_IO_APIC*/
 #endif
 


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86_64 part of ACPI IRQ cleanup
       [not found] ` <200404061508.10717.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
@ 2004-04-07 10:24   ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2004-04-07 10:24 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, 6 Apr 2004 15:08:10 -0600
Bjorn Helgaas <bjorn.helgaas-VXdhtT5mjnY@public.gmane.org> wrote:

> Here's the x86_64 part of the ACPI IRQ cleanup I proposed here:
> 
>     http://www.gelato.unsw.edu.au/linux-ia64/0403/8979.html

Looks ok to me.

-Andi


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-07 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-06 21:08 [PATCH] x86_64 part of ACPI IRQ cleanup Bjorn Helgaas
     [not found] ` <200404061508.10717.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2004-04-07 10:24   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox