Subject: kern/6663: pcic_attach() broken for Cirrus Logic PD-672x
To: None <gnats-bugs@gnats.netbsd.org>
From: None <stephenm@employees.org>
List: netbsd-bugs
Date: 12/27/1998 22:33:32
>Number:         6663
>Category:       kern
>Synopsis:       pcic_attach() broken for Cirrus Logic PD-672x
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 27 22:50:01 1998
>Last-Modified:
>Originator:     Stephen Ma
>Organization:
	People's Front for the correct spelling of the word "Organisation"
>Release:        NetBSD-current 981227
>Environment:
System: NetBSD tirath 1.3I NetBSD 1.3I (TIRATH) #4: Sun Dec 27 17:29:46 EST 1998 stephenm@tirath:/usr/src/sys/arch/i386/compile/TIRATH i386

>Description:
	During attach of the pcic controller in bootup, the kernel panics
in pcic_attach(). This appears to be due to an uninitialised member of the
pcic_softc struct - notably parts of the pcic_handle for controller 2.
>How-To-Repeat:
	Boot up on a notebook with the PD6722, on a kernel with pcic0 at isa?
configured.
>Fix:
--- /v1/netbsd/src/sys/dev/ic/i82365.c	Sat Dec 26 23:17:36 1998
+++ /sys/dev/ic/i82365.c	Sun Dec 27 17:09:23 1998
@@ -211,26 +211,26 @@
 	 */
 	sc->handle[2].sc = sc;
 	sc->handle[2].sock = C1SA;
+	sc->handle[2].flags = 0;
+
+	sc->handle[3].sc = sc;
+	sc->handle[3].sock = C1SB;
+	sc->handle[3].flags = 0;
+
 	if (pcic_vendor(&sc->handle[0]) != PCIC_VENDOR_CIRRUS_PD672X ||
 	    pcic_read(&sc->handle[2], PCIC_IDENT) != 0) {
 		if (pcic_ident_ok(reg = pcic_read(&sc->handle[2],
 						  PCIC_IDENT))) {
 			sc->handle[2].flags = PCIC_FLAG_SOCKETP;
 			count++;
-		} else {
-			sc->handle[2].flags = 0;
 		}
 
 		DPRINTF((" 0x%02x", reg));
 
-		sc->handle[3].sc = sc;
-		sc->handle[3].sock = C1SB;
 		if (pcic_ident_ok(reg = pcic_read(&sc->handle[3],
 						  PCIC_IDENT))) {
 			sc->handle[3].flags = PCIC_FLAG_SOCKETP;
 			count++;
-		} else {
-			sc->handle[3].flags = 0;
 		}
 
 		DPRINTF((" 0x%02x\n", reg));
>Audit-Trail:
>Unformatted: