Subject: port-i386/2213: wd driver bug
To: None <gnats-bugs@NetBSD.ORG>
From: David Carrel <carrel@cisco.com>
List: netbsd-bugs
Date: 03/13/1996 12:52:19
>Number:         2213
>Category:       port-i386
>Synopsis:       The wd driver is not robust enough for some BIOS bugs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 13 16:20:04 1996
>Last-Modified:
>Originator:     David Carrel
>Organization:
	Just little ol' me.
>Release:        Supped 12 March 1996
>Environment:
System: NetBSD spy 1.1 NetBSD 1.1 (DAVE) #46: Tue Dec 19 00:26:57 PST 1995 carrel@spy:/home/NetBSD/sys/arch/i386/compile/DAVE i386


>Description:
	There is a bug in several laptop BIOSes when the disk spins down or
the laptop suspends.  Afterwards the wd driver is in a "confused" state.
The visible symptoms are repeated hard errors and no further successful
disk access.
NOTE:  This is a duplicate of a bug I submitted several weeks ago with an
old version of send-pr.  I recieved error msgs back and I don't see that pr
in the database, so I'm resending.  Hope I'm not creating a duplicate.
>How-To-Repeat:
	On a GATEWAY 2000 with early BIOS (later BIOS fixes this) or many
of the IBM Thinkpads, just let the disk spin down or suspend the machine.
>Fix:
	The following patch fixes this bug and should not cause any hard on
other systems that do not exhibit the problem. I have been running this
code for > 6 months as have others.

*** wd.c.orig	Sat Mar  2 09:05:01 1996
--- wd.c	Sat Mar  2 09:03:49 1996
***************
*** 786,792 ****
  			goto bad;
  #endif
  	
! 		if (++wdc->sc_errors < WDIORETRIES)
  			goto restart;
  		wderror(wd, bp, "hard error");
  
--- 786,793 ----
  			goto bad;
  #endif
  	
! 		wdcunwedge(wdc);	/* increments wdc->sc_errors */
! 		if (wdc->sc_errors < WDIORETRIES)
  			goto restart;
  		wderror(wd, bp, "hard error");
  

>Audit-Trail:
>Unformatted: