Subject: port-i386/3253: isapnp_map_readport should check for resource conflicts
To: None <>
From: Christoph Badura <>
List: netbsd-bugs
Date: 02/24/1997 22:49:48
>Number:         3253
>Category:       port-i386
>Synopsis:       isapnp_map_readport should check if other devices have
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 14:05:00 1997
>Originator:     Christoph Badura
>Release:        1997-02-22
486 Saturn PCI board and a Gigabyte GA586HX (430HX) with NE2000 at 0x300.

System: NetBSD 1.2C NetBSD 1.2C (KLIC) #28: Sat Feb 22 20:14:50 MET 1997 i386

With the addition of the isapnp code kernels with isapnp have been locking
up solid in two test machines.  One has PNP support the other doesn't.
Both machines have no PNP cards installed.  Both have a NE2000 at 0x300.
When locking up the machines would respond only to a hard reset.

I traced it down to isapnp_findcard setting the READ_PORT to 0x313 and 0x317.
Both addresses are claimed by the ed driver in my machines.

Since making the trivial changes to isapnp_map_readport to check if other
devices have claimed the to-be-mapped address already both machines boot
reliably again.


Put a non-PNP NE2000 configured at io port 0x300 in a board with no PNP-Cards.
Try booting a GENERIC kernel.

Patch sys/arch/i386/isa/isapnp_machdep.c as follows.

Index: isapnp_machdep.c
RCS file: /u2/src.master/netbsd/src/sys/arch/i386/isa/isapnp_machdep.c,v
retrieving revision
diff -u -r1.1.1.1 isapnp_machdep.c
--- isapnp_machdep.c	1997/02/06 19:21:31
+++ isapnp_machdep.c	1997/02/24 21:16:45
@@ -94,11 +94,17 @@
 	struct isapnp_softc *sc;
+	int error;
 	if (sc->sc_iot != I386_BUS_SPACE_IO)
 		panic("isapnp_map_readport: bogus bus space tag");
-	sc->sc_read_ioh = sc->sc_read_port;
+	/* Check if some other device has already claimed this port. */
+	if ((error = bus_space_map(sc->sc_iot,
+				  sc->sc_read_port,
+				  1, 0,
+				  &sc->sc_read_ioh)))
+		return (error);
 	return (0);
@@ -110,5 +116,5 @@
 	struct isapnp_softc *sc;
-	/* Do nothing. */
+	bus_space_unmap(sc->sc_iot, sc->sc_read_ioh, 1);
already claimed the READ_PORT.