Subject: Bug in wd driver on some laptops
To: None <netbsd-bugs@NetBSD.ORG>
From: None <carrel@cisco.com>
List: netbsd-bugs
Date: 02/22/1996 17:06:40
>Submitter-Id:	net
>Originator:	David Carrel
>Organization:
Just a regular guy!
>Confidential:	no
>Synopsis:	WD driver breaks on some laptops
>Severity:	serious
>Priority:	medium
>Category:	port-i386
>Class:		sw-bug
>Release:	1.1
>Environment:
	NetBSD i386 versions 1.1 and 1.1A
System: 
Architecture: i386

>Description:
	The wd driver locks up on several laptops when the disk spins down.
This seems to be a bug in the BIOS as a BIOS upgrade to one laptop made the
problem go away.  However the fix is simple and makes the NetBSD driver
more resilliant.  There should be no side effects to this change.  Many of
the IBM ThinkPads suffer from this problem.  I have run this patch on
several different laptops that did suffer from this bug as well as some
that did not.
>How-To-Repeat:
	Run NetBSD and let the disk spin down.  Only happens on some
laptops with less than brilliant BIOS.
>Fix:
*** NetBSD/src/sys/dev/isa/wd.c.orig	Mon Jan  8 09:41:29 1996
--- NetBSD/src/sys/dev/isa/wd.c	Mon Jan  8 09:41:34 1996
***************
*** 784,790 ****
  			goto bad;
  #endif
  	
! 		if (++wdc->sc_errors < WDIORETRIES)
  			goto restart;
  		wderror(wd, bp, "hard error");
  
--- 784,791 ----
  			goto bad;
  #endif
  	
! 		wdcunwedge(wdc);	/* increments wdc->sc_errors */
! 		if (wdc->sc_errors < WDIORETRIES)
  			goto restart;
  		wderror(wd, bp, "hard error");