From alsa-devel-owner@alsa.jcu.cz  Sun Feb  7 17:51:38 1999
Received: from caronte.csr.unibo.it (piccio@caronte.csr.unibo.it [137.204.72.197])
	by marvin.jcu.cz (8.9.1a/8.9.1) with ESMTP id RAA19752
	for <alsa-devel@alsa.jcu.cz>; Sun, 7 Feb 1999 17:48:55 +0100
Received: (from piccio@localhost) by caronte.csr.unibo.it (8.8.3/8.8.3) id RAA01074 for alsa-devel@alsa.jcu.cz; Sun, 7 Feb 1999 17:43:24 +0100
From: Massimo Piccioni <piccio@caronte.csr.unibo.it>
Message-Id: <199902071643.RAA01074@caronte.csr.unibo.it>
Subject: isapnp.c problem
To: alsa-devel@alsa.jcu.cz
Date: Sun, 7 Feb 1999 17:43:24 +0100 (MET)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

Hello.

The isapnp_pci_scan_bus routine in isapnp.c seems to be not reliable with
all PCI cards.

In my specific case the system (2.0.36) hangs after loading of isapnp
module if an AMD AM79C970 based ethernet card is present (i.e. this happens
at first access to the eth0 interface).

After a short mail exchange with Donald Becker (the pcnet32 module maintainer)
it seems to be due to specific PCI-config-space accesses AFTER chip
initialization (i.e. after pcnet32 module loading).

After various tests I've written a simple patch to fix this annoiyng problem
(the diff from last CVS sources follows).
It changes only the pcibios_read_config_xxx sequence of the original source.

Bye, Massimo.

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

diff -Nru alsa-driver/support/isapnp.c alsa-driver.new/support/isapnp.c
--- alsa-driver/support/isapnp.c	Thu Feb  4 19:53:36 1999
+++ alsa-driver.new/support/isapnp.c	Sun Feb  7 17:40:42 1999
@@ -2008,12 +2008,6 @@
 #ifdef ISAPNP_DEBUG
 		printk("PCI: devfn = %i, hdr_type = 0x%x, Vendor ID = 0x%x\n", devfn, (int)hdr_type, l);
 #endif
-		pcibios_read_config_byte(bus, devfn, PCI_INTERRUPT_LINE, &irq);
-#ifdef ISAPNP_DEBUG
-		printk("PCI: reserved IRQ: %i\n", irq);
-#endif
-		if (irq > 0 && irq < 15)
-			isapnp_do_reserve_irq(irq);
 
 		pcibios_read_config_dword(bus, devfn, PCI_CLASS_REVISION, &class_type);
 		class_type >>= 8;
@@ -2023,6 +2017,13 @@
 			if (buses)
 				isapnp_pci_scan_bus((buses >> 8) & 0xff);
 		}
+
+		pcibios_read_config_byte(bus, devfn, PCI_INTERRUPT_LINE, &irq);
+#ifdef ISAPNP_DEBUG
+		printk("PCI: reserved IRQ: %i\n", irq);
+#endif
+		if (irq > 0 && irq < 15)
+			isapnp_do_reserve_irq(irq);
 	}
 }
 

