*** wd.c-	Fri Oct 13 22:39:22 1995
--- wd.c	Tue Mar 26 21:32:04 1996
***************
*** 57,63 ****
  #include <dev/isa/isavar.h>
  #include <dev/isa/wdreg.h>
  
! #define	WAITTIME	(4 * hz)	/* time to wait for a completion */
  #define	RECOVERYTIME	(hz / 2)	/* time to recover from an error */
  
  #define WDCDELAY	100
--- 57,63 ----
  #include <dev/isa/isavar.h>
  #include <dev/isa/wdreg.h>
  
! #define	WAITTIME	(8 * hz)	/* time to wait for a completion */
  #define	RECOVERYTIME	(hz / 2)	/* time to recover from an error */
  
  #define WDCDELAY	100
***************
*** 67,73 ****
  #define WDCNDELAY_DEBUG	10
  #endif
  
! #define	WDIORETRIES	5		/* number of retries before giving up */
  
  #define	WDUNIT(dev)			DISKUNIT(dev)
  #define	WDPART(dev)			DISKPART(dev)
--- 67,73 ----
  #define WDCNDELAY_DEBUG	10
  #endif
  
! #define	WDIORETRIES	3		/* number of retries before giving up */
  
  #define	WDUNIT(dev)			DISKUNIT(dev)
  #define	WDPART(dev)			DISKPART(dev)
***************
*** 568,574 ****
  		wd->sc_blkno = blkno / (lp->d_secsize / DEV_BSIZE);
  	} else {
  #ifdef WDDEBUG
! 		printf(" %d)%x", wd->sc_skip, inb(wd->sc_iobase+wd_altsts));
  #endif
  	}
  
--- 568,574 ----
  		wd->sc_blkno = blkno / (lp->d_secsize / DEV_BSIZE);
  	} else {
  #ifdef WDDEBUG
! 		printf(" %d)%x", wd->sc_skip, inb(wdc->sc_iobase+wd_altsts));
  #endif
  	}
  
***************
*** 676,682 ****
  
  #ifdef WDDEBUG
  		printf("sector %d cylin %d head %d addr %x sts %x\n", sector,
! 		    cylin, head, bp->b_data, inb(wd->sc_iobase+wd_altsts));
  #endif
  	} else if (wd->sc_nblks > 1) {
  		/* The number of blocks in the last stretch may be smaller. */
--- 676,682 ----
  
  #ifdef WDDEBUG
  		printf("sector %d cylin %d head %d addr %x sts %x\n", sector,
! 		    cylin, head, bp->b_data, inb(wdc->sc_iobase+wd_altsts));
  #endif
  	} else if (wd->sc_nblks > 1) {
  		/* The number of blocks in the last stretch may be smaller. */
***************
*** 723,733 ****
  	struct wd_softc *wd;
  	struct buf *bp;
  
! 	if ((wdc->sc_flags & WDCF_ACTIVE) == 0) {
! 		/* Clear the pending interrupt and abort. */
! 		(void) inb(wdc->sc_iobase+wd_status);
  		return 0;
- 	}
  
  	wdc->sc_flags &= ~WDCF_ACTIVE;
  	untimeout(wdctimeout, wdc);
--- 723,730 ----
  	struct wd_softc *wd;
  	struct buf *bp;
  
! 	if ((wdc->sc_flags & WDCF_ACTIVE) == 0)
  		return 0;
  
  	wdc->sc_flags &= ~WDCF_ACTIVE;
  	untimeout(wdctimeout, wdc);
***************
*** 736,742 ****
  	bp = wd->sc_q.b_actf;
  
  #ifdef WDDEBUG
! 	printf("I%d ", ctrlr);
  #endif
  
  	if (wait_for_unbusy(wdc) < 0) {
--- 733,739 ----
  	bp = wd->sc_q.b_actf;
  
  #ifdef WDDEBUG
! 	printf("I%s ", wdc->sc_dev.dv_xname);
  #endif
  
  	if (wait_for_unbusy(wdc) < 0) {
***************
*** 761,767 ****
  
  	/* Have we an error? */
  	if (wdc->sc_status & WDCS_ERR) {
- 	lose:
  #ifdef WDDEBUG
  		wderror(wd, NULL, "wdcintr");
  #endif
--- 758,763 ----
***************
*** 775,782 ****
  			goto bad;
  #endif
  	
! 		if (++wdc->sc_errors < WDIORETRIES)
! 			goto restart;
  		wderror(wd, bp, "hard error");
  
  	bad:
--- 771,779 ----
  			goto bad;
  #endif
  	
! 		wdcunwedge(wdc);        /* increments wdc->sc_errors */
! 		if (wdc->sc_errors < WDIORETRIES)
! 			return 1;
  		wderror(wd, bp, "hard error");
  
  	bad:
