public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] acpi-20030916-2.6.0-pre5.diff
       [not found]     ` <1063926206.2680.200.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
@ 2003-09-18 22:53       ` Andrew Morton
  2003-09-18 22:54       ` Andrew Morton
  2003-09-18 22:57       ` Andrew Morton
  2 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2003-09-18 22:53 UTC (permalink / raw)
  To: Len Brown; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>
> This patch updates 2.6.0-test5 to the current ACPI in 2.4.22-pre5
> If nothing explodes, I'll be releasing it to Linus shortly via BK.

Well it stomps all over the below patch, which I've had for some time.

What's up?


From: Andrew de Quincey <adq_dvb-fmPXVN3awWJAJAzL26g0SA@public.gmane.org>

Hi, this is my next round of ACPI IRQ fixes.  Attached are patches for
linux-2.4.23-pre3 and linux-2.6.0-test4.

Please CC me on any replies.  I seem to be having issues with
vger.kernel.org right now.

This patch addresses the following issues:

1) ACPI now drops back to PIC mode if configuration in APIC mode fails.

2) Removed 2 lines of erroneous code in mpparse.c which causes
   IO-APICs to be misconfigured.

3) ACPI now supports PIC controllers properly.

4) This patch includes a patch by "Jun Nakajima"
   <jun.nakajima-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> which fixes ACPI IRQ routing for all VIA
   motherboards I have had tested so far.  I've included it in this
   patch as it changes one of the same files.

5) Now retries with an extended IRQ descriptor if programming a link
   device with a "standard" IRQ descriptor fails.

This has already been tested successfully by multiple people.



 25-akpm/arch/i386/kernel/acpi/Makefile   |    2 
 25-akpm/arch/i386/kernel/acpi/pic.c      |  102 ++++++++++++++
 25-akpm/arch/i386/kernel/mpparse.c       |   27 +++
 25-akpm/arch/ia64/kernel/iosapic.c       |   19 ++
 25-akpm/arch/x86_64/kernel/acpi/Makefile |    2 
 25-akpm/arch/x86_64/kernel/acpi/pic.c    |  102 ++++++++++++++
 25-akpm/arch/x86_64/kernel/mpparse.c     |   22 ++-
 25-akpm/drivers/acpi/bus.c               |    2 
 25-akpm/drivers/acpi/pci_irq.c           |  218 +++++++++++++++++++++++--------
 25-akpm/drivers/acpi/pci_link.c          |   89 +++++++++---
 25-akpm/include/acpi/acpi_bus.h          |    2 
 25-akpm/include/acpi/acpi_drivers.h      |    8 -
 25-akpm/include/asm-i386/acpi.h          |    3 
 25-akpm/include/asm-i386/mpspec.h        |    2 
 25-akpm/include/asm-ia64/acpi.h          |    3 
 25-akpm/include/asm-ia64/iosapic.h       |    2 
 25-akpm/include/asm-x86_64/acpi.h        |    3 
 25-akpm/include/asm-x86_64/mpspec.h      |    2 
 25-akpm/include/linux/acpi.h             |    2 
 19 files changed, 522 insertions(+), 90 deletions(-)

diff -puN arch/i386/kernel/acpi/Makefile~acpi-irq-fixes arch/i386/kernel/acpi/Makefile
--- 25/arch/i386/kernel/acpi/Makefile~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/arch/i386/kernel/acpi/Makefile	Wed Sep 10 10:09:28 2003
@@ -1,3 +1,3 @@
-obj-$(CONFIG_ACPI_BOOT)		:= boot.o
+obj-$(CONFIG_ACPI_BOOT)		:= boot.o pic.o
 obj-$(CONFIG_ACPI_SLEEP)	+= sleep.o wakeup.o
 
diff -puN /dev/null arch/i386/kernel/acpi/pic.c
--- /dev/null	Thu Apr 11 07:25:15 2002
+++ 25-akpm/arch/i386/kernel/acpi/pic.c	Wed Sep 10 10:09:28 2003
@@ -0,0 +1,102 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2003 Andrew de Quincey - All Rights Reserved
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
+ *   USA; either version 2 of the License, or (at your option) any later
+ *   version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <linux/mm.h>
+#include <linux/irq.h>
+#include <linux/init.h>
+#include <linux/acpi.h>
+#include <linux/delay.h>
+#include <linux/config.h>
+#include <linux/bootmem.h>
+#include <linux/smp_lock.h>
+#include <linux/kernel_stat.h>
+
+#include <asm/acpi.h>
+
+#ifdef CONFIG_ACPI_PCI
+
+extern void eisa_set_level_irq(unsigned int irq);
+
+int __init pic_parse_prt (void)
+{
+	struct list_head	*node = NULL;
+	struct acpi_prt_entry	*entry = NULL;
+	struct acpi_prt_list	*prt_list = NULL;
+	int			edge_level = 0;
+	int			active_high_low = 0;
+	int			irq = 0;
+	int			programmed[16];
+
+	/* Get the current PRT */
+	prt_list = acpi_pci_get_prt_list();
+
+	if (!prt_list->count) {
+		acpi_pci_destroy_prt_list(prt_list);
+		printk(KERN_WARNING PREFIX "ACPI tables contain no PIC PCI IRQ "
+			"routing entries\n");
+		return_VALUE(-ENODEV);
+	}
+
+	/* mark all IRQs as unprogrammed */
+	memset(programmed, 0, sizeof(programmed));
+
+	/*
+	 * Parsing through the PCI Interrupt Routing Table (PRT) and program
+	 * IRQs if necessary.
+	 */
+	list_for_each(node, &prt_list->entries) {
+		entry = list_entry(node, struct acpi_prt_entry, node);
+
+		/* 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 < 0) {
+				acpi_pci_destroy_prt_list(prt_list);
+				return -ENODEV;
+			}
+ 			if (!irq)
+				continue;
+		}
+
+		/* sanity check + update entry */
+		if ((irq < 0) || (irq > 15)) {
+			printk(KERN_ERR "Invalid IRQ (%i) passed to PIC programming code\n", irq);
+			entry->irq = 0;
+			continue;
+		}
+		entry->irq = irq;
+
+		/* check if it has already been dealt with */
+		if (programmed[irq]) {
+			printk(KERN_DEBUG "PIC: IRQ (%i) already programmed\n", irq);
+			continue;
+		}
+		programmed[irq] = 1;
+
+		/* program it */
+		if (edge_level) {
+			eisa_set_level_irq(irq);
+		}
+
+		printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> IRQ %d Mode %d Trigger %d\n",
+			entry->id.segment, entry->id.bus,
+			entry->id.device, ('A' + entry->pin),
+			entry->irq, edge_level, active_high_low);
+	}
+
+	/* if we get here, the PRT was fine. commit it */
+	acpi_pci_commit_prt_list(prt_list);
+
+	return 0;
+}
+
+#endif /*CONFIG_ACPI_PCI*/
diff -puN arch/i386/kernel/mpparse.c~acpi-irq-fixes arch/i386/kernel/mpparse.c
--- 25/arch/i386/kernel/mpparse.c~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/arch/i386/kernel/mpparse.c	Wed Sep 10 10:09:28 2003
@@ -1078,10 +1078,11 @@ void __init mp_config_ioapic_for_sci(int
 
 #ifdef CONFIG_ACPI_PCI
 
-void __init mp_parse_prt (void)
+int __init mp_parse_prt (void)
 {
 	struct list_head	*node = NULL;
 	struct acpi_prt_entry	*entry = NULL;
+ 	struct acpi_prt_list	*prt_list = NULL;
 	int			ioapic = -1;
 	int			ioapic_pin = 0;
 	int			irq = 0;
@@ -1089,16 +1090,31 @@ void __init mp_parse_prt (void)
 	int			edge_level = 0;
 	int			active_high_low = 0;
 
+ 	/* Get the current PRT */
+ 	prt_list = acpi_pci_get_prt_list();
+
+ 	if (!prt_list->count) {
+ 		acpi_pci_destroy_prt_list(prt_list);
+ 		printk(KERN_WARNING PREFIX "ACPI tables contain no IO-APIC PCI IRQ "
+ 			"routing entries\n");
+ 		return_VALUE(-ENODEV);
+ 	}
+
 	/*
 	 * Parsing through the PCI Interrupt Routing Table (PRT) and program
 	 * routing for all entries.
 	 */
-	list_for_each(node, &acpi_prt.entries) {
+	list_for_each(node, &prt_list->entries) {
 		entry = list_entry(node, struct acpi_prt_entry, node);
 
 		/* 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 < 0) {
+				acpi_pci_destroy_prt_list(prt_list);
+				return -ENODEV;
+			}
+
 			if (!irq)
 				continue;
 		}
@@ -1118,8 +1134,6 @@ void __init mp_parse_prt (void)
 			continue;
 		ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start;
 
-		if (!ioapic && (irq < 16))
-			irq += 16;
 		/* 
 		 * Avoid pin reprogramming.  PRTs typically include entries  
 		 * with redundant pin->irq mappings (but unique PCI devices);
@@ -1151,6 +1165,11 @@ void __init mp_parse_prt (void)
 			mp_ioapic_routing[ioapic].apic_id, ioapic_pin, 
 			entry->irq);
 	}
+
+ 	/* if we get here, the PRT was fine. commit it */
+ 	acpi_pci_commit_prt_list(prt_list);
+
+	return 0;
 }
 
 #endif /*CONFIG_ACPI_PCI*/
diff -puN arch/ia64/kernel/iosapic.c~acpi-irq-fixes arch/ia64/kernel/iosapic.c
--- 25/arch/ia64/kernel/iosapic.c~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/arch/ia64/kernel/iosapic.c	Wed Sep 10 10:09:28 2003
@@ -680,7 +680,7 @@ iosapic_enable_intr (unsigned int vector
 
 #ifdef CONFIG_ACPI_PCI
 
-void __init
+int __init
 iosapic_parse_prt (void)
 {
 	struct acpi_prt_entry *entry;
@@ -690,8 +690,19 @@ iosapic_parse_prt (void)
 	char pci_id[16];
 	struct hw_interrupt_type *irq_type = &irq_type_iosapic_level;
 	irq_desc_t *idesc;
+ 	struct acpi_prt_list	*prt_list = NULL;
 
-	list_for_each(node, &acpi_prt.entries) {
+ 	/* Get the current PRT */
+ 	prt_list = acpi_pci_get_prt_list();
+
+ 	if (!prt_list->count) {
+ 		acpi_pci_destroy_prt_list(prt_list);
+ 		printk(KERN_WARNING PREFIX "ACPI tables contain no IO-APIC PCI IRQ "
+ 			"routing entries\n");
+ 		return_VALUE(-ENODEV);
+ 	}
+
+	list_for_each(node, &prt_list->entries) {
 		entry = list_entry(node, struct acpi_prt_entry, node);
 
 		/* We're only interested in static (non-link) entries.  */
@@ -729,6 +740,10 @@ iosapic_parse_prt (void)
 				      IOSAPIC_LEVEL);
 
 	}
+
+ 	/* if we get here, the PRT was fine. commit it */
+ 	acpi_pci_commit_prt_list(prt_list);
+	return 0;
 }
 
 #endif /* CONFIG_ACPI */
diff -puN arch/x86_64/kernel/acpi/Makefile~acpi-irq-fixes arch/x86_64/kernel/acpi/Makefile
--- 25/arch/x86_64/kernel/acpi/Makefile~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/arch/x86_64/kernel/acpi/Makefile	Wed Sep 10 10:09:28 2003
@@ -1,3 +1,3 @@
-obj-$(CONFIG_ACPI_BOOT)		:= boot.o
+obj-$(CONFIG_ACPI_BOOT)		:= boot.o pic.o
 obj-$(CONFIG_ACPI_SLEEP)	+= sleep.o wakeup.o
 
diff -puN /dev/null arch/x86_64/kernel/acpi/pic.c
--- /dev/null	Thu Apr 11 07:25:15 2002
+++ 25-akpm/arch/x86_64/kernel/acpi/pic.c	Wed Sep 10 10:09:28 2003
@@ -0,0 +1,102 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2003 Andrew de Quincey - All Rights Reserved
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
+ *   USA; either version 2 of the License, or (at your option) any later
+ *   version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <linux/mm.h>
+#include <linux/irq.h>
+#include <linux/init.h>
+#include <linux/acpi.h>
+#include <linux/delay.h>
+#include <linux/config.h>
+#include <linux/bootmem.h>
+#include <linux/smp_lock.h>
+#include <linux/kernel_stat.h>
+
+#include <asm/acpi.h>
+
+#ifdef CONFIG_ACPI_PCI
+
+extern void eisa_set_level_irq(unsigned int irq);
+
+int __init pic_parse_prt (void)
+{
+	struct list_head	*node = NULL;
+	struct acpi_prt_entry	*entry = NULL;
+	struct acpi_prt_list	*prt_list = NULL;
+	int			edge_level = 0;
+	int			active_high_low = 0;
+	int			irq = 0;
+	int			programmed[16];
+
+	/* Get the current PRT */
+	prt_list = acpi_pci_get_prt_list();
+
+	if (!prt_list->count) {
+		acpi_pci_destroy_prt_list(prt_list);
+		printk(KERN_WARNING PREFIX "ACPI tables contain no PIC PCI IRQ "
+			"routing entries\n");
+		return_VALUE(-ENODEV);
+	}
+
+	/* mark all IRQs as unprogrammed */
+	memset(programmed, 0, sizeof(programmed));
+
+	/*
+	 * Parsing through the PCI Interrupt Routing Table (PRT) and program
+	 * IRQs if necessary.
+	 */
+	list_for_each(node, &prt_list->entries) {
+		entry = list_entry(node, struct acpi_prt_entry, node);
+
+		/* 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 < 0) {
+				acpi_pci_destroy_prt_list(prt_list);
+				return -ENODEV;
+			}
+ 			if (!irq)
+				continue;
+		}
+
+		/* sanity check + update entry */
+		if ((irq < 0) || (irq > 15)) {
+			printk(KERN_ERR "Invalid IRQ (%i) passed to PIC programming code\n", irq);
+			entry->irq = 0;
+			continue;
+		}
+		entry->irq = irq;
+
+		/* check if it has already been dealt with */
+		if (programmed[irq]) {
+			printk(KERN_DEBUG "PIC: IRQ (%i) already programmed\n", irq);
+			continue;
+		}
+		programmed[irq] = 1;
+
+		/* program it */
+		if (edge_level) {
+			eisa_set_level_irq(irq);
+		}
+
+		printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> IRQ %d Mode %d Trigger %d\n",
+			entry->id.segment, entry->id.bus,
+			entry->id.device, ('A' + entry->pin),
+			entry->irq, edge_level, active_high_low);
+	}
+
+	/* if we get here, the PRT was fine. commit it */
+	acpi_pci_commit_prt_list(prt_list);
+
+	return 0;
+}
+
+#endif /*CONFIG_ACPI_PCI*/
diff -puN arch/x86_64/kernel/mpparse.c~acpi-irq-fixes arch/x86_64/kernel/mpparse.c
--- 25/arch/x86_64/kernel/mpparse.c~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/arch/x86_64/kernel/mpparse.c	Wed Sep 10 10:09:28 2003
@@ -889,16 +889,31 @@ void __init mp_parse_prt (void)
 	int			edge_level = 0;
 	int			active_high_low = 0;
 
+ 	/* Get the current PRT */
+ 	prt_list = acpi_pci_get_prt_list();
+
+ 	if (!prt_list->count) {
+ 		acpi_pci_destroy_prt_list(prt_list);
+ 		printk(KERN_WARNING PREFIX "ACPI tables contain no IO-APIC PCI IRQ "
+ 			"routing entries\n");
+ 		return_VALUE(-ENODEV);
+ 	}
+
 	/*
 	 * Parsing through the PCI Interrupt Routing Table (PRT) and program
 	 * routing for all static (IOAPIC-direct) entries.
 	 */
-	list_for_each(node, &acpi_prt.entries) {
+	list_for_each(node, &acpi_prt->entries) {
 		entry = list_entry(node, struct acpi_prt_entry, node);
 
 		/* 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 < 0) {
+				acpi_pci_destroy_prt_list(prt_list);
+				return -ENODEV;
+			}
+
 			if (!irq)
 				continue;
 		} else {
@@ -949,8 +964,11 @@ void __init mp_parse_prt (void)
 			mp_ioapic_routing[ioapic].apic_id, ioapic_pin, vector, 
 			entry->irq);
 	}
+
+ 	/* if we get here, the PRT was fine. commit it */
+ 	acpi_pci_commit_prt_list(prt_list);
 	
-	return;
+	return 0;
 }
 
 #endif /*CONFIG_ACPI_PCI*/
diff -puN drivers/acpi/bus.c~acpi-irq-fixes drivers/acpi/bus.c
--- 25/drivers/acpi/bus.c~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/drivers/acpi/bus.c	Wed Sep 10 10:09:28 2003
@@ -536,7 +536,7 @@ acpi_bus_notify (
                              Initialization/Cleanup
    -------------------------------------------------------------------------- */
 
-static int __init
+int
 acpi_bus_init_irq (void)
 {
 	acpi_status		status = AE_OK;
diff -puN drivers/acpi/pci_irq.c~acpi-irq-fixes drivers/acpi/pci_irq.c
--- 25/drivers/acpi/pci_irq.c~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/drivers/acpi/pci_irq.c	Wed Sep 10 10:09:28 2003
@@ -48,7 +48,22 @@
 #define _COMPONENT		ACPI_PCI_COMPONENT
 ACPI_MODULE_NAME		("pci_irq")
 
-struct acpi_prt_list		acpi_prt;
+struct acpi_prt_list*		acpi_prt = NULL;
+
+struct acpi_prt_ref {
+	struct list_head	node;
+	struct acpi_device	*device;
+	acpi_handle		handle;
+	int segment;
+	int bus;
+};
+
+struct acpi_prt_ref_list {
+	int			count;
+	struct list_head	entries;
+};
+
+struct acpi_prt_ref_list acpi_prt_ref_list;
 
 #ifdef CONFIG_X86
 extern void eisa_set_level_irq(unsigned int irq);
@@ -71,13 +86,19 @@ acpi_pci_irq_find_prt_entry (
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry");
 
+	/* ensure we're not called before the routing table has been determined */
+	if (acpi_prt == NULL) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Called before acpi_prt determined"));
+		return_PTR(NULL);
+ 	}
+
 	/*
 	 * Parse through all PRT entries looking for a match on the specified
 	 * PCI device's segment, bus, device, and pin (don't care about func).
 	 *
 	 * TBD: Acquire/release lock
 	 */
-	list_for_each(node, &acpi_prt.entries) {
+	list_for_each(node, &acpi_prt->entries) {
 		entry = list_entry(node, struct acpi_prt_entry, node);
 		if ((segment == entry->id.segment) 
 			&& (bus == entry->id.bus) 
@@ -93,6 +114,7 @@ acpi_pci_irq_find_prt_entry (
 
 static int
 acpi_pci_irq_add_entry (
+	struct acpi_prt_list*		prt_list,
 	acpi_handle			handle,
 	int				segment,
 	int				bus,
@@ -149,12 +171,116 @@ acpi_pci_irq_add_entry (
 		('A' + entry->pin), prt->source, entry->link.index));
 
 	/* TBD: Acquire/release lock */
-	list_add_tail(&entry->node, &acpi_prt.entries);
-	acpi_prt.count++;
+	list_add_tail(&entry->node, &prt_list->entries);
+	prt_list->count++;
+
+	return_VALUE(0);
+}
+
+
+struct acpi_prt_list*
+acpi_pci_get_prt_list (void)
+{
+	acpi_status			status = AE_OK;
+	struct acpi_buffer		buffer = {0, NULL};
+	struct acpi_pci_routing_table	*prt = NULL;
+	struct acpi_pci_routing_table	*entry = NULL;
+	struct acpi_prt_list		*prt_list = NULL;
+	struct acpi_prt_ref		*prt_ref_entry = NULL;
+	struct list_head		*node = NULL;
+
+	ACPI_FUNCTION_TRACE("acpi_pci_irq_get_prt_list");
+
+	/* Create a brand new acpi_prt_list */
+	prt_list = kmalloc(sizeof(struct acpi_prt_list), GFP_KERNEL);
+	if (!prt_list)
+		return_PTR(NULL);
+	memset(prt_list, 0, sizeof(struct acpi_prt_list));
+
+	prt_list->count = 0;
+	INIT_LIST_HEAD(&prt_list->entries);
+
+	/* iterate over all entries in acpi_prt_ref_list, extracting the current _PRT entries */
+	list_for_each(node, &acpi_prt_ref_list.entries) {
+		prt_ref_entry = list_entry(node, struct acpi_prt_ref, node);
+
+		/*
+		 * Evaluate this _PRT and add its entries to our local list (prt_list).
+		 */
+
+		buffer.length = 0;
+		buffer.pointer = NULL;
+		status = acpi_get_irq_routing_table(prt_ref_entry->handle, &buffer);
+		if (status != AE_BUFFER_OVERFLOW) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
+				acpi_format_exception(status)));
+			kfree(prt_list);
+			return_PTR(NULL);
+		}
+
+		prt = kmalloc(buffer.length, GFP_KERNEL);
+		if (!prt) {
+			kfree(prt_list);
+			return_VALUE(NULL);
+		}
+		memset(prt, 0, buffer.length);
+		buffer.pointer = prt;
+
+		status = acpi_get_irq_routing_table(prt_ref_entry->handle, &buffer);
+		if (ACPI_FAILURE(status)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
+				acpi_format_exception(status)));
+			kfree(buffer.pointer);
+			kfree(prt_list);
+			return_PTR(NULL);
+		}
+
+		entry = prt;
+
+		while (entry && (entry->length > 0)) {
+			acpi_pci_irq_add_entry(prt_list, prt_ref_entry->handle, prt_ref_entry->segment,
+				prt_ref_entry->bus, entry);
+			entry = (struct acpi_pci_routing_table *)
+				((unsigned long) entry + entry->length);
+		}
+
+		kfree(prt);
+	}
+
+	return_PTR(prt_list);
+}
+
+int
+acpi_pci_destroy_prt_list (struct acpi_prt_list* prt_list) {
+	struct list_head	*node = NULL;
+	struct list_head	*tmp = NULL;
+	struct acpi_prt_entry	*entry = NULL;
+
+	ACPI_FUNCTION_TRACE("acpi_pci_irq_destroy_prt_list");
+
+	list_for_each_safe(node, tmp, &prt_list->entries) {
+		entry = list_entry(node, struct acpi_prt_entry, node);
+		list_del(node);
+		kfree(entry);
+	}
+	kfree(prt_list);
 
 	return_VALUE(0);
 }
 
+int
+acpi_pci_commit_prt_list (struct acpi_prt_list* prt_list) {
+
+	ACPI_FUNCTION_TRACE("acpi_pci_irq_commit_prt_list");
+
+	if (acpi_prt != NULL) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Attempt to commit acpi_prt twice\n"));
+		return_VALUE(-ENODEV);
+	}
+
+	acpi_prt = prt_list;
+	return_VALUE(0);
+}
 
 int
 acpi_pci_irq_add_prt (
@@ -162,21 +288,20 @@ acpi_pci_irq_add_prt (
 	int			segment,
 	int			bus)
 {
-	acpi_status			status = AE_OK;
-	char				pathname[ACPI_PATHNAME_MAX] = {0};
-	struct acpi_buffer		buffer = {0, NULL};
-	struct acpi_pci_routing_table	*prt = NULL;
-	struct acpi_pci_routing_table	*entry = NULL;
-	static int			first_time = 1;
+	static int		first_time = 1;
+	struct acpi_prt_ref	*entry = NULL;
+	struct acpi_buffer	buffer = {0, NULL};
+	char			pathname[ACPI_PATHNAME_MAX] = {0};
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt");
 
 	if (first_time) {
-		acpi_prt.count = 0;
-		INIT_LIST_HEAD(&acpi_prt.entries);
+		acpi_prt_ref_list.count = 0;
+		INIT_LIST_HEAD(&acpi_prt_ref_list.entries);
 		first_time = 0;
 	}
 
+
 	/* 
 	 * NOTE: We're given a 'handle' to the _PRT object's parent device
 	 *       (either a PCI root bridge or PCI-PCI bridge).
@@ -189,42 +314,19 @@ acpi_pci_irq_add_prt (
 	printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n",
 		pathname);
 
-	/* 
-	 * Evaluate this _PRT and add its entries to our global list (acpi_prt).
-	 */
 
-	buffer.length = 0;
-	buffer.pointer = NULL;
-	status = acpi_get_irq_routing_table(handle, &buffer);
-	if (status != AE_BUFFER_OVERFLOW) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
-			acpi_format_exception(status)));
-		return_VALUE(-ENODEV);
-	}
 
-	prt = kmalloc(buffer.length, GFP_KERNEL);
-	if (!prt)
+	entry = kmalloc(sizeof(struct acpi_prt_ref), GFP_KERNEL);
+	if (!entry)
 		return_VALUE(-ENOMEM);
-	memset(prt, 0, buffer.length);
-	buffer.pointer = prt;
-
-	status = acpi_get_irq_routing_table(handle, &buffer);
-	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
-			acpi_format_exception(status)));
-		kfree(buffer.pointer);
-		return_VALUE(-ENODEV);
-	}
+	memset(entry, 0, sizeof(struct acpi_prt_ref));
 
-	entry = prt;
-
-	while (entry && (entry->length > 0)) {
-		acpi_pci_irq_add_entry(handle, segment, bus, entry);
-		entry = (struct acpi_pci_routing_table *)
-			((unsigned long) entry + entry->length);
-	}
+	entry->handle = handle;
+	entry->segment = segment;
+	entry->bus = bus;
 
-	kfree(prt);
+	list_add_tail(&entry->node, &acpi_prt_ref_list.entries);
+	acpi_prt_ref_list.count++;
 
 	return_VALUE(0);
 }
@@ -383,6 +485,14 @@ acpi_pci_irq_enable (
 	return_VALUE(dev->irq);
 }
 
+static void __init acpi_irq_pic_mode(void)
+{
+	acpi_irq_model = ACPI_IRQ_MODEL_PIC;
+	acpi_bus_init_irq();
+
+        /* recalculate penalties */
+ 	acpi_pci_link_calc_penalties();
+}
 
 int __init
 acpi_pci_irq_init (void)
@@ -391,27 +501,27 @@ acpi_pci_irq_init (void)
 
 	ACPI_FUNCTION_TRACE("acpi_pci_irq_init");
 
-	if (!acpi_prt.count) {
-		printk(KERN_WARNING PREFIX "ACPI tables contain no PCI IRQ "
-			"routing entries\n");
-		return_VALUE(-ENODEV);
-	}
 
-	/* Make sure all link devices have a valid IRQ. */
-	if (acpi_pci_link_check()) {
-		return_VALUE(-ENODEV);
-	}
+ 	/* Calculate IRQ penalties for each link device */
+ 	acpi_pci_link_calc_penalties();
 
 #ifdef CONFIG_X86_IO_APIC
 	/* Program IOAPICs using data from PRT entries. */
 	if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC)
-		mp_parse_prt();
+ 		if (mp_parse_prt())
+ 			acpi_irq_pic_mode();
 #endif
 #ifdef CONFIG_IOSAPIC
 	if (acpi_irq_model == ACPI_IRQ_MODEL_IOSAPIC)
-		iosapic_parse_prt();
+ 		if (iosapic_parse_prt())
+			return_VALUE(-ENODEV);
 #endif
 
+ 	/* This one is last, as a catchall */
+ 	if (acpi_irq_model == ACPI_IRQ_MODEL_PIC)
+ 		if (pic_parse_prt())
+ 			return_VALUE(-ENODEV);
+
 	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
 		acpi_pci_irq_enable(dev);
 
diff -puN drivers/acpi/pci_link.c~acpi-irq-fixes drivers/acpi/pci_link.c
--- 25/drivers/acpi/pci_link.c~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/drivers/acpi/pci_link.c	Wed Sep 10 10:09:28 2003
@@ -281,6 +281,32 @@ end:
 
 
 static int
+acpi_pci_link_try_get_current (
+	struct acpi_pci_link *link,
+	int irq)
+{
+	int result;
+
+	ACPI_FUNCTION_TRACE("acpi_pci_link_try_get_current");
+
+	result = acpi_pci_link_get_current(link);
+	if (result && link->irq.active)
+	{
+		return_VALUE(result);
+	}
+
+	if (!link->irq.active)
+	{
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No active IRQ resource found\n"));
+		printk(KERN_WARNING "_CRS returns NULL! Using IRQ %d for device (%s [%s]).\n", irq, acpi_device_name(link->device), acpi_device_bid(link->device));
+		link->irq.active = irq;
+	}
+
+	return 0;
+}
+
+
+static int
 acpi_pci_link_set (
 	struct acpi_pci_link	*link,
 	int			irq)
@@ -294,6 +320,7 @@ acpi_pci_link_set (
 	struct acpi_buffer	buffer = {sizeof(resource)+1, &resource};
 	int			i = 0;
 	int			valid = 0;
+	int			resource_type = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_link_set");
 
@@ -317,20 +344,32 @@ acpi_pci_link_set (
 		}
 	}
 
+	/* If IRQ<=15, first try with a "normal" IRQ descriptor. If that fails, try with
+	 * an extended one */
+	if (irq <= 15) {
+		resource_type = ACPI_RSTYPE_IRQ;
+	} else {
+		resource_type = ACPI_RSTYPE_EXT_IRQ;
+	}
+
+retry_programming:
+
 	memset(&resource, 0, sizeof(resource));
 
 	/* NOTE: PCI interrupts are always level / active_low / shared. But not all
 	   interrupts > 15 are PCI interrupts. Rely on the ACPI IRQ definition for 
 	   parameters */
-	if (irq <= 15) {
+	switch(resource_type) {
+	case ACPI_RSTYPE_IRQ:
 		resource.res.id = ACPI_RSTYPE_IRQ;
 		resource.res.length = sizeof(struct acpi_resource);
 		resource.res.data.irq.edge_level = link->irq.edge_level;
 		resource.res.data.irq.active_high_low = link->irq.active_high_low;
 		resource.res.data.irq.number_of_interrupts = 1;
 		resource.res.data.irq.interrupts[0] = irq;
-	}
-	else {
+		break;
+
+	case ACPI_RSTYPE_EXT_IRQ:
 		resource.res.id = ACPI_RSTYPE_EXT_IRQ;
 		resource.res.length = sizeof(struct acpi_resource);
 		resource.res.data.extended_irq.producer_consumer = ACPI_CONSUMER;
@@ -339,11 +378,21 @@ acpi_pci_link_set (
 		resource.res.data.extended_irq.number_of_interrupts = 1;
 		resource.res.data.extended_irq.interrupts[0] = irq;
 		/* ignore resource_source, it's optional */
+		break;
 	}
 	resource.end.id = ACPI_RSTYPE_END_TAG;
 
 	/* Attempt to set the resource */
 	status = acpi_set_current_resources(link->handle, &buffer);
+
+	/* if we failed and IRQ <= 15, try again with an extended descriptor */
+	if (ACPI_FAILURE(status) && (resource_type == ACPI_RSTYPE_IRQ)) {
+                resource_type = ACPI_RSTYPE_EXT_IRQ;
+                printk(PREFIX "Retrying with extended IRQ descriptor\n");
+                goto retry_programming;
+	}
+
+	/* check for total failure */
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n"));
 		return_VALUE(-ENODEV);
@@ -361,7 +410,7 @@ acpi_pci_link_set (
 	}
 
 	/* Make sure the active IRQ is the one we requested. */
-	result = acpi_pci_link_get_current(link);
+	result = acpi_pci_link_try_get_current(link, irq);
 	if (result) {
 		return_VALUE(result);
 	}
@@ -401,22 +450,25 @@ acpi_pci_link_set (
  * as 'best bets' for PCI use.
  */
 
-static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
+static int acpi_irq_default_penalty[ACPI_MAX_IRQS] = {
 	1000000,  1000000,  1000000,    10000, 
 	  10000,        0,    10000,    10000,
 	  10000,        0,        0,        0, 
 	  10000,   100000,   100000,   100000,
 };
 
+static int acpi_irq_penalty[ACPI_MAX_IRQS] = { 0 };
 
 int
-acpi_pci_link_check (void)
+acpi_pci_link_calc_penalties (void)
 {
 	struct list_head	*node = NULL;
 	struct acpi_pci_link    *link = NULL;
 	int			i = 0;
 
-	ACPI_FUNCTION_TRACE("acpi_pci_link_check");
+	ACPI_FUNCTION_TRACE("acpi_pci_link_calc_penalties");
+
+	memcpy(&acpi_irq_penalty, &acpi_irq_default_penalty, sizeof(acpi_irq_default_penalty));
 
 	/*
 	 * Update penalties to facilitate IRQ balancing.
@@ -428,6 +480,7 @@ acpi_pci_link_check (void)
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));
 			continue;
 		}
+		link->irq.setonboot = 0;
 
 		if (link->irq.active)
 			acpi_irq_penalty[link->irq.active] += 100;
@@ -458,18 +511,18 @@ static int acpi_pci_link_allocate(struct
 		irq = link->irq.possible[0];
 	}
 
-		/* 
-		 * Select the best IRQ.  This is done in reverse to promote 
-		 * the use of IRQs 9, 10, 11, and >15.
-		 */
-		for (i=(link->irq.possible_count-1); i>0; i--) {
-			if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]])
-				irq = link->irq.possible[i];
-		}
+	/*
+	 * Select the best IRQ.  This is done in reverse to promote
+	 * the use of IRQs 9, 10, 11, and >15.
+	 */
+	for (i=(link->irq.possible_count-1); i>0; i--) {
+		if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]])
+			irq = link->irq.possible[i];
+	}
 
 	/* Attempt to enable the link device at this IRQ. */
 	if (acpi_pci_link_set(link, irq)) {
-		printk(PREFIX "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS). Aborting ACPI-based IRQ routing. Try pci=noacpi or acpi=off\n",
+		printk(PREFIX "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS, please report to acpi-devel!)\n",
 			acpi_device_name(link->device),
 			acpi_device_bid(link->device));
 		return_VALUE(-ENODEV);
@@ -574,10 +627,6 @@ acpi_pci_link_add (
 		else
 			printk(" %d", link->irq.possible[i]);
 	}
-	if (!link->irq.active)
-		printk(", disabled");
-	else if (!found)
-		printk(", enabled at IRQ %d", link->irq.active);
 	printk(")\n");
 
 	/* TBD: Acquire/release lock */
diff -puN include/acpi/acpi_bus.h~acpi-irq-fixes include/acpi/acpi_bus.h
--- 25/include/acpi/acpi_bus.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/acpi/acpi_bus.h	Wed Sep 10 10:09:28 2003
@@ -307,6 +307,8 @@ int acpi_bus_unregister_driver (struct a
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
+int acpi_bus_init_irq (void);
+
 #endif /*CONFIG_ACPI_BUS*/
 
 #endif /*__ACPI_BUS_H__*/
diff -puN include/acpi/acpi_drivers.h~acpi-irq-fixes include/acpi/acpi_drivers.h
--- 25/include/acpi/acpi_drivers.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/acpi/acpi_drivers.h	Wed Sep 10 10:09:28 2003
@@ -26,6 +26,9 @@
 #ifndef __ACPI_DRIVERS_H__
 #define __ACPI_DRIVERS_H__
 
+/* forward definitions */
+struct acpi_prt_list;
+
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
 
@@ -59,12 +62,15 @@ void acpi_pci_get_translations (struct a
 
 /* ACPI PCI Interrupt Link (pci_link.c) */
 
-int acpi_pci_link_check (void);
+int acpi_pci_link_calc_penalties (void);
 int acpi_pci_link_get_irq (acpi_handle handle, int index, int* edge_level, int* active_high_low);
 
 /* ACPI PCI Interrupt Routing (pci_irq.c) */
 
 int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus);
+int acpi_pci_commit_prt_list (struct acpi_prt_list* prt_list);
+int acpi_pci_destroy_prt_list (struct acpi_prt_list* prt_list);
+struct acpi_prt_list* acpi_pci_get_prt_list (void);
 
 /* ACPI PCI Device Binding (pci_bind.c) */
 
diff -puN include/asm-i386/acpi.h~acpi-irq-fixes include/asm-i386/acpi.h
--- 25/include/asm-i386/acpi.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/asm-i386/acpi.h	Wed Sep 10 10:09:28 2003
@@ -151,6 +151,9 @@ extern unsigned long acpi_wakeup_address
 /* early initialization routine */
 extern void acpi_reserve_bootmem(void);
 
+/* ACPI-based PIC initialisation */
+extern int pic_parse_prt (void);
+
 #endif /*CONFIG_ACPI_SLEEP*/
 
 #endif /*__KERNEL__*/
diff -puN include/asm-i386/mpspec.h~acpi-irq-fixes include/asm-i386/mpspec.h
--- 25/include/asm-i386/mpspec.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/asm-i386/mpspec.h	Wed Sep 10 10:09:28 2003
@@ -37,7 +37,7 @@ extern void mp_register_lapic_address (u
 extern void mp_register_ioapic (u8 id, u32 address, u32 irq_base);
 extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 global_irq);
 extern void mp_config_acpi_legacy_irqs (void);
-extern void mp_parse_prt (void);
+extern int mp_parse_prt (void);
 
 #ifdef CONFIG_X86_IO_APIC
 extern void mp_config_ioapic_for_sci(int irq);
diff -puN include/asm-ia64/acpi.h~acpi-irq-fixes include/asm-ia64/acpi.h
--- 25/include/asm-ia64/acpi.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/asm-ia64/acpi.h	Wed Sep 10 10:09:28 2003
@@ -100,6 +100,9 @@ extern int __initdata pxm_to_nid_map[MAX
 extern int __initdata nid_to_pxm_map[NR_NODES];
 #endif
 
+/* ia64 machines don't have PIC controllers */
+static inline int pic_parse_prt(void) { return -1; }
+
 #endif /*__KERNEL__*/
 
 #endif /*_ASM_ACPI_H*/
diff -puN include/asm-ia64/iosapic.h~acpi-irq-fixes include/asm-ia64/iosapic.h
--- 25/include/asm-ia64/iosapic.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/asm-ia64/iosapic.h	Wed Sep 10 10:09:28 2003
@@ -57,7 +57,7 @@ extern void __init iosapic_init (unsigne
 				    unsigned int gsi_base);
 extern int gsi_to_vector (unsigned int gsi);
 extern int gsi_to_irq (unsigned int gsi);
-extern void __init iosapic_parse_prt (void);
+extern int __init iosapic_parse_prt (void);
 extern void iosapic_enable_intr (unsigned int vector);
 extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity,
 				  unsigned long trigger);
diff -puN include/asm-x86_64/acpi.h~acpi-irq-fixes include/asm-x86_64/acpi.h
--- 25/include/asm-x86_64/acpi.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/asm-x86_64/acpi.h	Wed Sep 10 10:09:28 2003
@@ -146,6 +146,9 @@ extern int acpi_disabled;
 #define BROKEN_ACPI_Sx		0x0001
 #define BROKEN_INIT_AFTER_S1	0x0002
 
+/* ACPI-based PIC initialisation */
+extern int pic_parse_prt (void);
+
 #endif /*__KERNEL__*/
 
 #endif /*_ASM_ACPI_H*/
diff -puN include/asm-x86_64/mpspec.h~acpi-irq-fixes include/asm-x86_64/mpspec.h
--- 25/include/asm-x86_64/mpspec.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/asm-x86_64/mpspec.h	Wed Sep 10 10:09:28 2003
@@ -189,7 +189,7 @@ extern void mp_register_lapic_address (u
 extern void mp_register_ioapic (u8 id, u32 address, u32 irq_base);
 extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 global_irq);
 extern void mp_config_acpi_legacy_irqs (void);
-extern void mp_parse_prt (void);
+extern int mp_parse_prt (void);
 #endif /*CONFIG_X86_IO_APIC*/
 #endif
 
diff -puN include/linux/acpi.h~acpi-irq-fixes include/linux/acpi.h
--- 25/include/linux/acpi.h~acpi-irq-fixes	Wed Sep 10 10:09:28 2003
+++ 25-akpm/include/linux/acpi.h	Wed Sep 10 10:09:28 2003
@@ -399,7 +399,7 @@ struct acpi_prt_list {
 	struct list_head	entries;
 };
 
-extern struct acpi_prt_list	acpi_prt;
+extern struct acpi_prt_list*	acpi_prt;
 
 struct pci_dev;
 

_



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: [PATCH] acpi-20030916-2.6.0-pre5.diff
       [not found]     ` <1063926206.2680.200.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
  2003-09-18 22:53       ` Andrew Morton
@ 2003-09-18 22:54       ` Andrew Morton
  2003-09-18 22:57       ` Andrew Morton
  2 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2003-09-18 22:54 UTC (permalink / raw)
  To: Len Brown; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Andi Kleen

Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>
> This patch updates 2.6.0-test5 to the current ACPI in 2.4.22-pre5
> If nothing explodes, I'll be releasing it to Linus shortly via BK.

And it doesn't include this fix


From: Andi Kleen <ak-l3A5Bk7waGM@public.gmane.org>

Try this (untested) patch

(2.6 version untested, I tested a similar patch on the 2.4 backport of
ACPI):



 25-akpm/arch/i386/pci/acpi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN arch/i386/pci/acpi.c~acpi_off-fix arch/i386/pci/acpi.c
--- 25/arch/i386/pci/acpi.c~acpi_off-fix	Tue Sep  9 12:12:00 2003
+++ 25-akpm/arch/i386/pci/acpi.c	Tue Sep  9 12:12:00 2003
@@ -15,10 +15,11 @@ struct pci_bus * __devinit pci_acpi_scan
 
 static int __init pci_acpi_init(void)
 {
+	extern int acpi_disabled;
 	if (pcibios_scanned)
 		return 0;
 
-	if (!(pci_probe & PCI_NO_ACPI_ROUTING)) {
+	if (!(pci_probe & PCI_NO_ACPI_ROUTING) && !acpi_disabled) {
 		if (!acpi_pci_irq_init()) {
 			printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
 			printk(KERN_INFO "PCI: if you experience problems, try using option 'pci=noacpi' or even 'acpi=off'\n");

_



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: [PATCH] acpi-20030916-2.6.0-pre5.diff
       [not found]     ` <1063926206.2680.200.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
  2003-09-18 22:53       ` Andrew Morton
  2003-09-18 22:54       ` Andrew Morton
@ 2003-09-18 22:57       ` Andrew Morton
       [not found]         ` <20030918155715.61a41697.akpm-3NddpPZAyC0@public.gmane.org>
  2 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2003-09-18 22:57 UTC (permalink / raw)
  To: Len Brown; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>
> This patch updates 2.6.0-test5 to the current ACPI in 2.4.22-pre5
> If nothing explodes, I'll be releasing it to Linus shortly via BK.

And it doesn't include this fix.




From: Andrew de Quincey <adq_dvb-fmPXVN3awWJAJAzL26g0SA@public.gmane.org>

With the help of Chris Wright testing several failed patches, I've tracked
down another ACPI IRQ problem.  On many systems, the BIOS pre-allocates
IRQs for certain PCI devices, providing a list of alternate possibilities
as well.

On some systems, changing the IRQ to one of those alternate possibilities
works fine.  On others however, it really isn't a good idea.  As theres no
way to tell which systems are good and bad in advance, this patch simply
ensures that ACPI does not change an IRQ if the BIOS has pre-allocated it.



 25-akpm/drivers/acpi/pci_link.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff -puN drivers/acpi/pci_link.c~acpi-bios-preallocation-fix drivers/acpi/pci_link.c
--- 25/drivers/acpi/pci_link.c~acpi-bios-preallocation-fix	Tue Sep 16 16:17:11 2003
+++ 25-akpm/drivers/acpi/pci_link.c	Tue Sep 16 16:18:00 2003
@@ -509,15 +509,14 @@ static int acpi_pci_link_allocate(struct
 		irq = link->irq.active;
 	} else {
 		irq = link->irq.possible[0];
-	}
-
-	/*
-	 * Select the best IRQ.  This is done in reverse to promote
-	 * the use of IRQs 9, 10, 11, and >15.
-	 */
-	for (i=(link->irq.possible_count-1); i>0; i--) {
-		if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]])
-			irq = link->irq.possible[i];
+		/*
+		 * Select the best IRQ.  This is done in reverse to promote
+		 * the use of IRQs 9, 10, 11, and >15.
+		 */
+		for (i=(link->irq.possible_count-1); i>0; i--) {
+			if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]])
+				irq = link->irq.possible[i];
+		}
 	}
 
 	/* Attempt to enable the link device at this IRQ. */

_



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* [PATCH] acpi-20030916-2.6.0-pre5.diff
       [not found] ` <20030823150219.21c951aa.akpm-3NddpPZAyC0@public.gmane.org>
@ 2003-09-18 23:03   ` Len Brown
       [not found]     ` <1063926206.2680.200.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Len Brown @ 2003-09-18 23:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 2083 bytes --]

Andrew & Co,
This patch updates 2.6.0-test5 to the current ACPI in 2.4.22-pre5
If nothing explodes, I'll be releasing it to Linus shortly via BK.

(then I'll send a patch with the upcoming linux-acpi-test-2.6.0 changes)

The thing most 2.6 users will notice is that the CONFIG_ACPI_HT_ONLY
scheme has been returned to the one used in 2.4.22 that people
liked better; but several key platform fixes are included too.

cheers,
-Len

It is also available here:
http://linux-acpi.bkbits.net:8080/linux-acpi-release-2.6.0

and here:
http://prdownloads.sourceforge.net/acpi/acpi-20030916-2.6.0-test5.diff?download

ChangeSet-GekAy/qdEr7X/YFgETsMoA@public.gmane.org, 2003-09-18 12:01:37-07:00, len.brown@intel.com
  ACPI_CA_VERSION                 0x20030916

ChangeSet-GekAy/qdEr7pel47pPzWjg@public.gmane.org, 2003-09-18 11:59:12-07:00, len.brown@intel.com
  remove ASUS A7V BIOS version 1011 from blacklist (Eric Valette)

ChangeSet-GekAy/qdEr55DzOukK9tOg@public.gmane.org, 2003-09-18 11:41:51-07:00, len.brown@intel.com
  IBM ThinkPAD T30/T40 oops (David Shaohua Li)
  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=98849

ChangeSet-GekAy/qdEr5Jt70yizMaYw@public.gmane.org, 2003-09-18 11:29:42-07:00, len.brown@intel.com
  Extended IRQ resource type for nForce (Andrew de Quincey)

ChangeSet-GekAy/qdEr7kfKl135yGWg@public.gmane.org, 2003-09-18 10:58:41-07:00, len.brown@intel.com
  [ACPI] Handle systems that specify non-ACPI-compliant SCI over-rides
(Jun Naka
jima)

ChangeSet-GekAy/qdEr4txE93JcnU2Q@public.gmane.org, 2003-09-18 10:54:11-07:00, len.brown@intel.com
  Handle BIOS with _CRS that fails (Jun Nakajima)

ChangeSet-GekAy/qdEr5bgfau97FWYA@public.gmane.org, 2003-09-18 00:52:06-04:00, len.brown@intel.com
  [ACPI] merge 2.4.22 cleanup into 2.6
  Restores CONFIG_ACPI_HT_ONLY as an alternative to CONFIG_ACPI
  rather than a prerequisite

ChangeSet-1Cvhk1ijdKctxE93JcnU2Q@public.gmane.org, 2003-09-15 00:34:00-04:00, len.brown@intel.com
  sync 2.4.22 changes into 2.6
  Note that this restores CONFIG_ACPI_HT_ONLY as a sub-set of
CONFIG_ACPI rather
 than a dependency.




[-- Attachment #2: acpi-20030916-2.6.0-test5.diff --]
[-- Type: text/plain, Size: 20196 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1315  -> 1.1322 
#	include/linux/acpi.h	1.28    -> 1.29   
#	drivers/acpi/pci_link.c	1.17    -> 1.19   
#	   arch/i386/Kconfig	1.76    -> 1.77   
#	arch/i386/kernel/mpparse.c	1.50    -> 1.52   
#	arch/i386/kernel/dmi_scan.c	1.44    -> 1.46   
#	    init/do_mounts.c	1.55    -> 1.56   
#	arch/i386/kernel/setup.c	1.96    -> 1.97   
#	   drivers/acpi/ec.c	1.24    -> 1.25   
#	    init/do_mounts.h	1.6.1.1 -> 1.8    
#	drivers/acpi/events/evregion.c	1.19    -> 1.20   
#	include/acpi/acconfig.h	1.42    -> 1.43   
#	arch/i386/kernel/acpi/boot.c	1.31    -> 1.32   
#	include/asm-i386/acpi.h	1.8     -> 1.9    
#	drivers/acpi/Makefile	1.35    -> 1.36   
#	drivers/acpi/Kconfig	1.20    -> 1.21   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/15	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org	1.1130.1.2
# sync 2.4.22 changes into 2.6
# Note that this restores CONFIG_ACPI_HT_ONLY as a sub-set of CONFIG_ACPI rather than a dependency.
# --------------------------------------------
# 03/09/18	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org	1.1316
# [ACPI] merge 2.4.22 cleanup into 2.6
# Restores CONFIG_ACPI_HT_ONLY as an alternative to CONFIG_ACPI
# rather than a prerequisite
# --------------------------------------------
# 03/09/18	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org	1.1317
# Handle BIOS with _CRS that fails (Jun Nakajima)
# --------------------------------------------
# 03/09/18	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org	1.1318
# [ACPI] Handle systems that specify non-ACPI-compliant SCI over-rides (Jun Nakajima)
# --------------------------------------------
# 03/09/18	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org	1.1319
# Extended IRQ resource type for nForce (Andrew de Quincey)
# --------------------------------------------
# 03/09/18	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org	1.1320
# IBM ThinkPAD T30/T40 oops (David Shaohua Li)
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=98849
# --------------------------------------------
# 03/09/18	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org	1.1321
# remove ASUS A7V BIOS version 1011 from blacklist (Eric Valette)
# --------------------------------------------
# 03/09/18	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org	1.1322
# ACPI_CA_VERSION                 0x20030916
# --------------------------------------------
#
diff -Nru a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
--- a/arch/i386/kernel/acpi/boot.c	Thu Sep 18 14:19:28 2003
+++ b/arch/i386/kernel/acpi/boot.c	Thu Sep 18 14:19:28 2003
@@ -183,8 +183,7 @@
 
 #endif /*CONFIG_X86_LOCAL_APIC*/
 
-#ifdef CONFIG_X86_IO_APIC
-
+#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
 
 static int __init
 acpi_parse_ioapic (
@@ -368,7 +367,6 @@
 
 	result = acpi_table_parse(ACPI_APIC, acpi_parse_madt);
 	if (!result) {
-		printk(KERN_WARNING PREFIX "MADT not present\n");
 		return 0;
 	}
 	else if (result < 0) {
@@ -416,7 +414,7 @@
 
 #endif /*CONFIG_X86_LOCAL_APIC*/
 
-#ifdef CONFIG_X86_IO_APIC
+#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
 
 	/* 
 	 * I/O APIC 
@@ -472,7 +470,8 @@
 	acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
 
 	acpi_ioapic = 1;
-#endif /*CONFIG_X86_IO_APIC*/
+
+#endif /* CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER */
 
 #ifdef CONFIG_X86_LOCAL_APIC
 	if (acpi_lapic && acpi_ioapic) {
@@ -480,6 +479,7 @@
 		clustered_apic_check();
 	}
 #endif
+
 #ifdef CONFIG_HPET_TIMER
 	acpi_table_parse(ACPI_HPET, acpi_parse_hpet);
 #endif
diff -Nru a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
--- a/arch/i386/kernel/dmi_scan.c	Thu Sep 18 14:19:28 2003
+++ b/arch/i386/kernel/dmi_scan.c	Thu Sep 18 14:19:28 2003
@@ -939,11 +939,6 @@
 			MATCH(DMI_BOARD_NAME, "CUR-DLS"),
 			NO_MATCH, NO_MATCH }},
 
-	{ force_acpi_ht, "ASUS A7V", {
-			MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
-			MATCH(DMI_BOARD_NAME, "<A7V>"),
-			MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1011"), NO_MATCH }},
-
 	{ force_acpi_ht, "ABIT i440BX-W83977", {
 			MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
 			MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
@@ -978,7 +973,10 @@
 	{ disable_acpi_pci, "ASUS A7V", {
 			MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
 			MATCH(DMI_BOARD_NAME, "<A7V>"),
-			MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"), NO_MATCH }},
+			/* newer BIOS, Revision 1011, does work */
+			MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"),
+			NO_MATCH }},
+
 #endif
 
 	{ NULL, }
diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
--- a/arch/i386/kernel/mpparse.c	Thu Sep 18 14:19:28 2003
+++ b/arch/i386/kernel/mpparse.c	Thu Sep 18 14:19:28 2003
@@ -830,7 +830,7 @@
 	MP_processor_info(&processor);
 }
 
-#ifdef CONFIG_X86_IO_APIC
+#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
 
 #define MP_ISA_BUS		0
 #define MP_MAX_IOAPIC_PIN	127
@@ -1019,10 +1019,6 @@
 	}
 }
 
-#ifdef	CONFIG_ACPI
-
-/* Ensure the ACPI SCI interrupt level is active low, edge-triggered */
-
 extern FADT_DESCRIPTOR acpi_fadt;
 
 void __init mp_config_ioapic_for_sci(int irq)
@@ -1031,6 +1027,7 @@
 	int ioapic_pin;
 	struct acpi_table_madt *madt;
 	struct acpi_table_int_src_ovr *entry = NULL;
+	acpi_interrupt_flags flags;
 	void *madt_end;
 	acpi_status status;
 
@@ -1054,15 +1051,12 @@
 				 * See the note at the end of ACPI 2.0b section
 				 * 5.2.10.8 for what this is about.
 				 */
-				if (entry->bus_irq != entry->global_irq) {
-					acpi_fadt.sci_int = entry->global_irq;
-					irq = entry->global_irq;
-					break;
-				}
-				else
-                			return;
+				flags = entry->flags;
+				acpi_fadt.sci_int = entry->global_irq;
+				irq = entry->global_irq;
+				break;
 			}
-
+			
                 	entry = (struct acpi_table_int_src_ovr *)
                 	        ((unsigned long) entry + entry->header.length);
         	}
@@ -1072,9 +1066,14 @@
 
 	ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start;
 
-	io_apic_set_pci_routing(ioapic, ioapic_pin, irq, 1, 1); // Active low, level triggered
+	if (flags.polarity == 0)
+		flags.polarity = 0x3;	/* Active low */ 
+	if (flags.trigger == 0) 
+		flags.trigger = 0x3;	/* Level-triggered */
+
+	io_apic_set_pci_routing(ioapic, ioapic_pin, irq, 
+				(flags.trigger >> 1) , (flags.polarity >> 1));
 }
-#endif	/* CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI_PCI
 
@@ -1154,5 +1153,5 @@
 }
 
 #endif /*CONFIG_ACPI_PCI*/
-#endif	/* CONFIG_X86_IO_APIC */
+#endif /*CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER*/
 #endif /*CONFIG_ACPI_BOOT*/
diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c	Thu Sep 18 14:19:28 2003
+++ b/arch/i386/kernel/setup.c	Thu Sep 18 14:19:28 2003
@@ -64,7 +64,7 @@
 unsigned long mmu_cr4_features;
 EXPORT_SYMBOL_GPL(mmu_cr4_features);
 
-#ifdef	CONFIG_ACPI
+#ifdef	CONFIG_ACPI_INTERPRETER
 	int acpi_disabled __initdata = 0;
 #else
 	int acpi_disabled __initdata = 1;
diff -Nru a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
--- a/drivers/acpi/Kconfig	Thu Sep 18 14:19:28 2003
+++ b/drivers/acpi/Kconfig	Thu Sep 18 14:19:28 2003
@@ -3,34 +3,14 @@
 #
 
 menu "ACPI (Advanced Configuration and Power Interface) Support"
-
-config ACPI_HT
-	bool "ACPI Processor Enumeration for HT"
-	depends on X86
-	default y
-	---help---
-	  ACPI enumerates both logical (a.k.a. Hyper-Threaded -- HT)
-	  and physical processors.  It is designed to obsolete several older
-	  specifications, including the MultiProcessor Specification (MPS),
-	  which supported only physical processors.
-
-	  CONFIG_ACPI_HT includes the minimal ACPI boot-time code
-	  necessary to enumerate logical processors and enable HT.
-
-	  CONFIG_ACPI includes CONFIG_ACPI_HT, plus IO APIC enumeration,
-	  and the hooks to run the ACPI AML interpreter for run-time events.
-
-	  When CONFIG_ACPI is selected, the command-line option "acpi=ht"
-	  is available to run just the ACPI boot-time code -- just as if
-	  only CONFIG_ACPI_HT were selected.
-
-	  Note that "acpi=off" can be used to disable all ACPI code in the kernel.
-
-config ACPI
-	bool "Full ACPI Support"
 	depends on !X86_VISWS
 	depends on !IA64_HP_SIM
-	depends on IA64 || (X86 || ACPI_HT)
+	depends on IA64 || X86
+
+config ACPI
+	bool "ACPI Support"
+	depends on IA64 || X86
+
 	default y
 	---help---
 	  Advanced Configuration and Power Interface (ACPI) support for 
@@ -60,14 +40,47 @@
 	  available at:
 	  <http://www.acpi.info>
 
+config ACPI_HT_ONLY
+	bool "Restrict ACPI to minimum boot code to enable HT"
+	depends on X86
+	depends on ACPI
+	depends on SMP
+	default n
+	---help---
+	  ACPI enumerates both logical (a.k.a. Hyper-Threaded -- HT)
+	  and physical processors.  It is designed to obsolete several older
+	  specifications, including the MultiProcessor Specification (MPS),
+	  which supported only physical processors.
+
+	  CONFIG_ACPI_HT_ONLY includes just the minimal ACPI boot-time code
+	  necessary to enumerate logical processors and enable HT.
+
+	  CONFIG_ACPI includes this, plus IO APIC enumeration,
+	  and the hooks to run the ACPI AML interpreter for run-time events.
+
+	  When CONFIG_ACPI is selected, the command-line option "acpi=ht"
+	  is available to run just the ACPI boot-time code -- just as if
+	  only CONFIG_ACPI_HT_ONLY were selected.
+
+	  Note that "acpi=off" can be used to disable all ACPI code in the kernel.
+
+
 config ACPI_BOOT
 	bool
-	depends on ACPI || ACPI_HT
+	depends on ACPI
+	default y
+
+config ACPI_INTERPRETER
+	bool
+	depends on ACPI
+	depends on !IA64_SGI_SN
+	depends on !ACPI_HT_ONLY
 	default y
 
 config ACPI_SLEEP
 	bool "Sleep States (EXPERIMENTAL)"
 	depends on X86 && ACPI
+	depends on ACPI_INTERPRETER
 	depends on EXPERIMENTAL && PM
 	select SOFTWARE_SUSPEND
 	default y
@@ -94,7 +107,8 @@
 
 config ACPI_AC
 	tristate "AC Adapter"
-	depends on X86 && ACPI
+	depends on X86
+	depends on ACPI_INTERPRETER
 	default m
 	help
 	  This driver adds support for the AC Adapter object, which indicates
@@ -103,7 +117,8 @@
 
 config ACPI_BATTERY
 	tristate "Battery"
-	depends on X86 && ACPI
+	depends on X86
+	depends on ACPI_INTERPRETER
 	default m
 	help
 	  This driver adds support for battery information through
@@ -112,7 +127,7 @@
 
 config ACPI_BUTTON
 	tristate "Button"
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on !IA64_SGI_SN
 	default m
 	help
@@ -124,7 +139,7 @@
 
 config ACPI_FAN
 	tristate "Fan"
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on !IA64_SGI_SN
 	default m
 	help
@@ -133,7 +148,7 @@
 
 config ACPI_PROCESSOR
 	tristate "Processor"
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on !IA64_SGI_SN
 	default m
 	help
@@ -153,14 +168,15 @@
 
 config ACPI_NUMA
 	bool "NUMA support"
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on NUMA
 	depends on !X86_64
 	default y if IA64_GENERIC || IA64_SGI_SN2
 
 config ACPI_ASUS
         tristate "ASUS/Medion Laptop Extras"
-        depends on X86 && ACPI
+	depends on X86
+	depends on ACPI_INTERPRETER
 	default m
         ---help---
           This driver provides support for extra features of ACPI-compatible
@@ -186,7 +202,8 @@
           
 config ACPI_TOSHIBA
 	tristate "Toshiba Laptop Extras"
-	depends on X86 && ACPI
+	depends on X86
+	depends on ACPI_INTERPRETER
 	default m
 	---help---
 	  This driver adds support for access to certain system settings
@@ -213,7 +230,7 @@
 
 config ACPI_DEBUG
 	bool "Debug Statements"
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on !IA64_SGI_SN
 	default n
 	help
@@ -223,19 +240,14 @@
 
 config ACPI_BUS
 	bool
-	depends on ACPI
-	depends on !IA64_SGI_SN
-	default y
-
-config ACPI_INTERPRETER
-	bool
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on !IA64_SGI_SN
 	default y
 
 config ACPI_EC
 	bool
-	depends on X86 && ACPI
+	depends on X86
+	depends on ACPI_INTERPRETER
 	default y
 	help
 	  This driver is required on some systems for the proper operation of
@@ -244,19 +256,19 @@
 
 config ACPI_POWER
 	bool
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on !IA64_SGI_SN
 	default y
 
 config ACPI_PCI
 	bool
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on !IA64_SGI_SN
 	default PCI
 
 config ACPI_SYSTEM
 	bool
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on !IA64_SGI_SN
 	default y
 	help
@@ -265,7 +277,7 @@
 
 config ACPI_EFI
 	bool
-	depends on ACPI
+	depends on ACPI_INTERPRETER
 	depends on IA64
 	default y
 
diff -Nru a/drivers/acpi/Makefile b/drivers/acpi/Makefile
--- a/drivers/acpi/Makefile	Thu Sep 18 14:19:28 2003
+++ b/drivers/acpi/Makefile	Thu Sep 18 14:19:28 2003
@@ -18,7 +18,7 @@
 # ACPI Boot-Time Table Parsing
 #
 obj-$(CONFIG_ACPI_BOOT)		+= tables.o
-obj-$(CONFIG_ACPI)		+= blacklist.o
+obj-$(CONFIG_ACPI_INTERPRETER)	+= blacklist.o
 
 #
 # ACPI Core Subsystem (Interpreter)
diff -Nru a/drivers/acpi/ec.c b/drivers/acpi/ec.c
--- a/drivers/acpi/ec.c	Thu Sep 18 14:19:28 2003
+++ b/drivers/acpi/ec.c	Thu Sep 18 14:19:28 2003
@@ -32,7 +32,7 @@
 #include <asm/io.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
-
+#include <acpi/actypes.h>
 
 #define _COMPONENT		ACPI_EC_COMPONENT
 ACPI_MODULE_NAME		("acpi_ec")
@@ -412,7 +412,10 @@
 	 * The EC object is in the handler context and is needed
 	 * when calling the acpi_ec_space_handler.
 	 */
-	*return_context = handler_context;
+	if(function == ACPI_REGION_DEACTIVATE) 
+		*return_context = NULL;
+	else 
+		*return_context = handler_context;
 
 	return AE_OK;
 }
diff -Nru a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
--- a/drivers/acpi/events/evregion.c	Thu Sep 18 14:19:28 2003
+++ b/drivers/acpi/events/evregion.c	Thu Sep 18 14:19:28 2003
@@ -382,7 +382,7 @@
 	union acpi_operand_object       *obj_desc;
 	union acpi_operand_object       **last_obj_ptr;
 	acpi_adr_space_setup            region_setup;
-	void                            *region_context;
+	void                            **region_context;
 	union acpi_operand_object       *region_obj2;
 	acpi_status                     status;
 
@@ -394,7 +394,7 @@
 	if (!region_obj2) {
 		return_VOID;
 	}
-	region_context = region_obj2->extra.region_context;
+	region_context = &region_obj2->extra.region_context;
 
 	/* Get the address handler from the region object */
 
@@ -450,7 +450,7 @@
 
 			region_setup = handler_obj->address_space.setup;
 			status = region_setup (region_obj, ACPI_REGION_DEACTIVATE,
-					  handler_obj->address_space.context, &region_context);
+					  handler_obj->address_space.context, region_context);
 
 			/* Init routine may fail, Just ignore errors */
 
diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
--- a/drivers/acpi/pci_link.c	Thu Sep 18 14:19:28 2003
+++ b/drivers/acpi/pci_link.c	Thu Sep 18 14:19:28 2003
@@ -220,7 +220,6 @@
 	return AE_CTRL_TERMINATE;
 }
 
-
 static int
 acpi_pci_link_get_current (
 	struct acpi_pci_link	*link)
@@ -279,6 +278,28 @@
 	return_VALUE(result);
 }
 
+static int
+acpi_pci_link_try_get_current (
+	struct acpi_pci_link *link,
+	int irq)
+{
+	int result;
+
+	ACPI_FUNCTION_TRACE("acpi_pci_link_try_get_current");
+
+	result = acpi_pci_link_get_current(link);
+	if (result && link->irq.active) {
+ 		return_VALUE(result);
+ 	}
+
+	if (!link->irq.active) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No active IRQ resource found\n"));
+		printk(KERN_WARNING "_CRS returns NULL! Using IRQ %d for device (%s [%s]).\n", irq, acpi_device_name(link->device), acpi_device_bid(link->device));
+		link->irq.active = irq;
+	}
+	
+	return 0;
+}
 
 static int
 acpi_pci_link_set (
@@ -294,6 +315,7 @@
 	struct acpi_buffer	buffer = {sizeof(resource)+1, &resource};
 	int			i = 0;
 	int			valid = 0;
+	int			resource_type = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_pci_link_set");
 
@@ -317,20 +339,32 @@
 		}
 	}
 
+	/* If IRQ<=15, first try with a "normal" IRQ descriptor. If that fails, try with
+	 * an extended one */
+	if (irq <= 15) {
+		resource_type = ACPI_RSTYPE_IRQ;
+	} else {
+		resource_type = ACPI_RSTYPE_EXT_IRQ;
+	}
+
+retry_programming:
+   
 	memset(&resource, 0, sizeof(resource));
 
 	/* NOTE: PCI interrupts are always level / active_low / shared. But not all
 	   interrupts > 15 are PCI interrupts. Rely on the ACPI IRQ definition for 
 	   parameters */
-	if (irq <= 15) {
+	switch(resource_type) {
+	case ACPI_RSTYPE_IRQ:
 		resource.res.id = ACPI_RSTYPE_IRQ;
 		resource.res.length = sizeof(struct acpi_resource);
 		resource.res.data.irq.edge_level = link->irq.edge_level;
 		resource.res.data.irq.active_high_low = link->irq.active_high_low;
 		resource.res.data.irq.number_of_interrupts = 1;
 		resource.res.data.irq.interrupts[0] = irq;
-	}
-	else {
+		break;
+	   
+	case ACPI_RSTYPE_EXT_IRQ:
 		resource.res.id = ACPI_RSTYPE_EXT_IRQ;
 		resource.res.length = sizeof(struct acpi_resource);
 		resource.res.data.extended_irq.producer_consumer = ACPI_CONSUMER;
@@ -339,11 +373,21 @@
 		resource.res.data.extended_irq.number_of_interrupts = 1;
 		resource.res.data.extended_irq.interrupts[0] = irq;
 		/* ignore resource_source, it's optional */
+		break;
 	}
 	resource.end.id = ACPI_RSTYPE_END_TAG;
 
 	/* Attempt to set the resource */
 	status = acpi_set_current_resources(link->handle, &buffer);
+
+	/* if we failed and IRQ <= 15, try again with an extended descriptor */
+	if (ACPI_FAILURE(status) && (resource_type == ACPI_RSTYPE_IRQ)) {
+                resource_type = ACPI_RSTYPE_EXT_IRQ;
+                printk(PREFIX "Retrying with extended IRQ descriptor\n");
+                goto retry_programming;
+	}
+  
+	/* check for total failure */
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n"));
 		return_VALUE(-ENODEV);
@@ -361,7 +405,7 @@
 	}
 
 	/* Make sure the active IRQ is the one we requested. */
-	result = acpi_pci_link_get_current(link);
+	result = acpi_pci_link_try_get_current(link, irq);
 	if (result) {
 		return_VALUE(result);
 	}
@@ -458,14 +502,14 @@
 		irq = link->irq.possible[0];
 	}
 
-		/* 
-		 * Select the best IRQ.  This is done in reverse to promote 
-		 * the use of IRQs 9, 10, 11, and >15.
-		 */
-		for (i=(link->irq.possible_count-1); i>0; i--) {
-			if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]])
-				irq = link->irq.possible[i];
-		}
+	/* 
+	 * Select the best IRQ.  This is done in reverse to promote 
+	 * the use of IRQs 9, 10, 11, and >15.
+	 */
+	for (i=(link->irq.possible_count-1); i>0; i--) {
+		if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]])
+			irq = link->irq.possible[i];
+	}
 
 	/* Attempt to enable the link device at this IRQ. */
 	if (acpi_pci_link_set(link, irq)) {
@@ -574,10 +618,6 @@
 		else
 			printk(" %d", link->irq.possible[i]);
 	}
-	if (!link->irq.active)
-		printk(", disabled");
-	else if (!found)
-		printk(", enabled at IRQ %d", link->irq.active);
 	printk(")\n");
 
 	/* TBD: Acquire/release lock */
diff -Nru a/include/acpi/acconfig.h b/include/acpi/acconfig.h
--- a/include/acpi/acconfig.h	Thu Sep 18 14:19:28 2003
+++ b/include/acpi/acconfig.h	Thu Sep 18 14:19:28 2003
@@ -64,7 +64,7 @@
 
 /* Version string */
 
-#define ACPI_CA_VERSION                 0x20030813
+#define ACPI_CA_VERSION                 0x20030916
 
 /* Maximum objects in the various object caches */
 
diff -Nru a/include/linux/acpi.h b/include/linux/acpi.h
--- a/include/linux/acpi.h	Thu Sep 18 14:19:28 2003
+++ b/include/linux/acpi.h	Thu Sep 18 14:19:28 2003
@@ -424,17 +424,17 @@
 
 #endif /*CONFIG_ACPI_EC*/
 
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_ACPI_INTERPRETER
 
 int acpi_blacklisted(void);
 
-#else
+#else /*!CONFIG_ACPI_INTERPRETER*/
 
 static inline int acpi_blacklisted(void)
 {
 	return 0;
 }
 
-#endif /*CONFIG_ACPI*/
+#endif /*!CONFIG_ACPI_INTERPRETER*/
 
 #endif /*_LINUX_ACPI_H*/
diff -Nru a/init/do_mounts.h b/init/do_mounts.h
--- a/init/do_mounts.h	Thu Sep 18 14:19:28 2003
+++ b/init/do_mounts.h	Thu Sep 18 14:19:28 2003
@@ -79,4 +79,3 @@
 static inline void md_run_setup(void) {}
 
 #endif
-

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

* Re: Re: [PATCH] acpi-20030916-2.6.0-pre5.diff
       [not found]         ` <20030918155715.61a41697.akpm-3NddpPZAyC0@public.gmane.org>
@ 2003-09-19  1:11           ` Andi Kleen
       [not found]             ` <20030919011149.GB20844-B4tOwbsTzaBolqkO4TVVkw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2003-09-19  1:11 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Len Brown, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, Sep 18, 2003 at 03:57:15PM -0700, Andrew Morton wrote:
> Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> >
> > This patch updates 2.6.0-test5 to the current ACPI in 2.4.22-pre5
> > If nothing explodes, I'll be releasing it to Linus shortly via BK.
> 
> And it doesn't include this fix.

This fix is also missing.

-Andi


-----------------------------------------------------------------

ACPI modules check acpi_disabled at module load time. This 
fixes random failures to load battery.o et.al.


diff -u linux-2.6.0test5-work/arch/i386/kernel/setup.c-ACPIINIT linux-2.6.0test5-work/arch/i386/kernel/setup.c
--- linux-2.6.0test5-work/arch/i386/kernel/setup.c-ACPIINIT	2003-09-09 20:55:26.000000000 +0200
+++ linux-2.6.0test5-work/arch/i386/kernel/setup.c	2003-09-15 18:12:23.000000000 +0200
@@ -64,9 +64,9 @@
 EXPORT_SYMBOL_GPL(mmu_cr4_features);
 
 #ifdef	CONFIG_ACPI
-	int acpi_disabled __initdata = 0;
+	int acpi_disabled = 0;
 #else
-	int acpi_disabled __initdata = 1;
+	int acpi_disabled = 1;
 #endif
 EXPORT_SYMBOL(acpi_disabled);
 
diff -u linux-2.6.0test5-work/arch/ia64/kernel/acpi.c-ACPIINIT linux-2.6.0test5-work/arch/ia64/kernel/acpi.c
--- linux-2.6.0test5-work/arch/ia64/kernel/acpi.c-ACPIINIT	2003-09-19 03:10:10.000000000 +0200
+++ linux-2.6.0test5-work/arch/ia64/kernel/acpi.c	2003-09-19 03:10:19.000000000 +0200
@@ -56,7 +56,7 @@
 
 unsigned char acpi_kbd_controller_present = 1;
 
-int acpi_disabled __initdata;	/* XXX this shouldn't be needed---we can't boot without ACPI! */
+int acpi_disabled;	/* XXX this shouldn't be needed---we can't boot without ACPI! */
 
 const char *
 acpi_get_sysname (void)
diff -u linux-2.6.0test5-work/arch/x86_64/kernel/setup.c-ACPIINIT linux-2.6.0test5-work/arch/x86_64/kernel/setup.c
--- linux-2.6.0test5-work/arch/x86_64/kernel/setup.c-ACPIINIT	2003-09-19 03:09:33.000000000 +0200
+++ linux-2.6.0test5-work/arch/x86_64/kernel/setup.c	2003-09-15 18:16:36.000000000 +0200
@@ -64,7 +64,7 @@
 unsigned long mmu_cr4_features;
 EXPORT_SYMBOL_GPL(mmu_cr4_features);
 
-int acpi_disabled __initdata = 0;
+int acpi_disabled = 0;
 
 /* For PCI or other memory-mapped resources */
 unsigned long pci_mem_start = 0x10000000;


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: [PATCH] acpi-20030916-2.6.0-pre5.diff
       [not found]             ` <20030919011149.GB20844-B4tOwbsTzaBolqkO4TVVkw@public.gmane.org>
@ 2003-09-19  3:41               ` Len Brown
       [not found]                 ` <1063942898.2676.391.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Len Brown @ 2003-09-19  3:41 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Andi,
Good hunting!

This fix has been integrated with others in the ACPI patch,
and is available now in these bitkeeper trees:

http://linux-acpi.bkbits.net/linux-acpi-test-2.4.22
http://linux-acpi.bkbits.net/linux-acpi-test-2.4.23
http://linux-acpi.bkbits.net/linux-acpi-test-2.6.0

thanks,
-Len

On Thu, 2003-09-18 at 21:11, Andi Kleen wrote:
> On Thu, Sep 18, 2003 at 03:57:15PM -0700, Andrew Morton wrote:
> > Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> > >
> > > This patch updates 2.6.0-test5 to the current ACPI in 2.4.22-pre5
> > > If nothing explodes, I'll be releasing it to Linus shortly via BK.
> > 
> > And it doesn't include this fix.
> 
> This fix is also missing.
> 
> -Andi
> 
> 
> -----------------------------------------------------------------
> 
> ACPI modules check acpi_disabled at module load time. This 
> fixes random failures to load battery.o et.al.
> 
> 
> diff -u linux-2.6.0test5-work/arch/i386/kernel/setup.c-ACPIINIT linux-2.6.0test5-work/arch/i386/kernel/setup.c
> --- linux-2.6.0test5-work/arch/i386/kernel/setup.c-ACPIINIT	2003-09-09 20:55:26.000000000 +0200
> +++ linux-2.6.0test5-work/arch/i386/kernel/setup.c	2003-09-15 18:12:23.000000000 +0200
> @@ -64,9 +64,9 @@
>  EXPORT_SYMBOL_GPL(mmu_cr4_features);
>  
>  #ifdef	CONFIG_ACPI
> -	int acpi_disabled __initdata = 0;
> +	int acpi_disabled = 0;
>  #else
> -	int acpi_disabled __initdata = 1;
> +	int acpi_disabled = 1;
>  #endif
>  EXPORT_SYMBOL(acpi_disabled);
>  
> diff -u linux-2.6.0test5-work/arch/ia64/kernel/acpi.c-ACPIINIT linux-2.6.0test5-work/arch/ia64/kernel/acpi.c
> --- linux-2.6.0test5-work/arch/ia64/kernel/acpi.c-ACPIINIT	2003-09-19 03:10:10.000000000 +0200
> +++ linux-2.6.0test5-work/arch/ia64/kernel/acpi.c	2003-09-19 03:10:19.000000000 +0200
> @@ -56,7 +56,7 @@
>  
>  unsigned char acpi_kbd_controller_present = 1;
>  
> -int acpi_disabled __initdata;	/* XXX this shouldn't be needed---we can't boot without ACPI! */
> +int acpi_disabled;	/* XXX this shouldn't be needed---we can't boot without ACPI! */
>  
>  const char *
>  acpi_get_sysname (void)
> diff -u linux-2.6.0test5-work/arch/x86_64/kernel/setup.c-ACPIINIT linux-2.6.0test5-work/arch/x86_64/kernel/setup.c
> --- linux-2.6.0test5-work/arch/x86_64/kernel/setup.c-ACPIINIT	2003-09-19 03:09:33.000000000 +0200
> +++ linux-2.6.0test5-work/arch/x86_64/kernel/setup.c	2003-09-15 18:16:36.000000000 +0200
> @@ -64,7 +64,7 @@
>  unsigned long mmu_cr4_features;
>  EXPORT_SYMBOL_GPL(mmu_cr4_features);
>  
> -int acpi_disabled __initdata = 0;
> +int acpi_disabled = 0;
>  
>  /* For PCI or other memory-mapped resources */
>  unsigned long pci_mem_start = 0x10000000;



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: [PATCH] acpi-20030916-2.6.0-pre5.diff
       [not found]                 ` <1063942898.2676.391.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
@ 2003-09-19  4:12                   ` Andi Kleen
  2003-09-21  3:58                   ` Andi Kleen
  1 sibling, 0 replies; 8+ messages in thread
From: Andi Kleen @ 2003-09-19  4:12 UTC (permalink / raw)
  To: Len Brown
  Cc: Andi Kleen, Andrew Morton,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, Sep 18, 2003 at 11:41:38PM -0400, Brown, Len wrote:
> Andi,
> Good hunting!
> 
> This fix has been integrated with others in the ACPI patch,
> and is available now in these bitkeeper trees:
> 
> http://linux-acpi.bkbits.net/linux-acpi-test-2.4.22
> http://linux-acpi.bkbits.net/linux-acpi-test-2.4.23
> http://linux-acpi.bkbits.net/linux-acpi-test-2.6.0

I think you could at least push this one directly to Andrew/Linus
without testing it in a separate tree first. It is an quite obvious fix with 
no risk to break anything.

-Andi


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: [PATCH] acpi-20030916-2.6.0-pre5.diff
       [not found]                 ` <1063942898.2676.391.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
  2003-09-19  4:12                   ` Andi Kleen
@ 2003-09-21  3:58                   ` Andi Kleen
  1 sibling, 0 replies; 8+ messages in thread
From: Andi Kleen @ 2003-09-21  3:58 UTC (permalink / raw)
  To: Len Brown
  Cc: Andi Kleen, Andrew Morton,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, Sep 18, 2003 at 11:41:38PM -0400, Brown, Len wrote:
> Andi,
> Good hunting!
> 
> This fix has been integrated with others in the ACPI patch,
> and is available now in these bitkeeper trees:
> 
> http://linux-acpi.bkbits.net/linux-acpi-test-2.4.22
> http://linux-acpi.bkbits.net/linux-acpi-test-2.4.23
> http://linux-acpi.bkbits.net/linux-acpi-test-2.6.0

I forgot to fix IA64 in the original patch. Please check that it is
fixed in arch/ia64/kernel/acpi.c too.

-Andi


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

end of thread, other threads:[~2003-09-21  3:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20030823150219.21c951aa.akpm@osdl.org>
     [not found] ` <20030823150219.21c951aa.akpm-3NddpPZAyC0@public.gmane.org>
2003-09-18 23:03   ` [PATCH] acpi-20030916-2.6.0-pre5.diff Len Brown
     [not found]     ` <1063926206.2680.200.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
2003-09-18 22:53       ` Andrew Morton
2003-09-18 22:54       ` Andrew Morton
2003-09-18 22:57       ` Andrew Morton
     [not found]         ` <20030918155715.61a41697.akpm-3NddpPZAyC0@public.gmane.org>
2003-09-19  1:11           ` Andi Kleen
     [not found]             ` <20030919011149.GB20844-B4tOwbsTzaBolqkO4TVVkw@public.gmane.org>
2003-09-19  3:41               ` Len Brown
     [not found]                 ` <1063942898.2676.391.camel-Tk/TtsB/rErDOqzlkpFKJg@public.gmane.org>
2003-09-19  4:12                   ` Andi Kleen
2003-09-21  3:58                   ` Andi Kleen

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