Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jan 1997 11:14:14 -0500 (EST)
From:      Dug Song <dugsong@monkey.org>
To:        Thomas Graichen <graichen@rzpd.de>
Cc:        tech@openbsd.org, hackers@freebsd.org
Subject:   Re: magic of western digital disks ... ?
Message-ID:  <Pine.NEB.3.95.970119111224.7361A-100000@naughty.monkey.org>
In-Reply-To: <199701191244.NAA00878@prospero.at.home>

next in thread | previous in thread | raw e-mail | index | archive | help
had the same problem trying to install 2.0 on my thinkpad. jim rees gave
me this patch, which seemed to fix things:

>From rees@umich.edu Mon Jan 13 14:51:40 1997
Date: Mon, 13 Jan 1997 13:43:23 -0500
From: Jim Rees <rees@umich.edu>
To: dugsong@umich.edu
Subject: wd fixes

*** wd.c-	Sun Sep 22 05:02:32 1996
--- wd.c	Wed Nov 27 15:33:52 1996
***************
*** 790,796 ****
  	part = WDPART(dev);
  
  	/* Make sure it was initialized. */
! 	if (d_link->sc_state < OPEN)
  		return ENXIO;
  
  	wdc = (void *)wd->sc_dev.dv_parent;
--- 790,796 ----
  	part = WDPART(dev);
  
  	/* Make sure it was initialized. */
! 	if (d_link->sc_state < READY)
  		return ENXIO;
  
  	wdc = (void *)wd->sc_dev.dv_parent;
*** wdc.c-	Sun Sep 22 05:02:33 1996
--- wdc.c	Wed Nov 27 15:32:20 1996
***************
*** 348,361 ****
  	d_link=xfer->d_link;
  
  	if (wdc->sc_errors >= WDIORETRIES) {
! 		wderror(d_link, bp, "hard error");
  		xfer->c_flags |= C_ERROR;
  		wdc_ata_done(wdc, xfer);
  		return;
  	}
  
  	/* Do control operations specially. */
! 	if (d_link->sc_state < OPEN) {
  		/*
  		 * Actually, we want to be careful not to mess with the control
  		 * state if the device is currently busy, but we can assume
--- 348,361 ----
  	d_link=xfer->d_link;
  
  	if (wdc->sc_errors >= WDIORETRIES) {
! 		wderror(d_link, bp, "wdcstart hard error");
  		xfer->c_flags |= C_ERROR;
  		wdc_ata_done(wdc, xfer);
  		return;
  	}
  
  	/* Do control operations specially. */
! 	if (d_link->sc_state < READY) {
  		/*
  		 * Actually, we want to be careful not to mess with the control
  		 * state if the device is currently busy, but we can assume
***************
*** 671,681 ****
  	void *arg;
  {
  	struct wdc_softc *wdc = arg;
- 	bus_chipset_tag_t bc = wdc->sc_bc;
- 	bus_io_handle_t ioh = wdc->sc_ioh;
  	struct wdc_xfer *xfer;
  
  	if ((wdc->sc_flags & WDCF_IRQ_WAIT) == 0) {
  		u_char s;
  #ifdef ATAPI_DEBUG_WDC
  		u_char e, i;
--- 671,682 ----
  	void *arg;
  {
  	struct wdc_softc *wdc = arg;
  	struct wdc_xfer *xfer;
  
  	if ((wdc->sc_flags & WDCF_IRQ_WAIT) == 0) {
+ #ifndef REES
+ 		bus_chipset_tag_t bc = wdc->sc_bc;
+ 		bus_io_handle_t ioh = wdc->sc_ioh;
  		u_char s;
  #ifdef ATAPI_DEBUG_WDC
  		u_char e, i;
***************
*** 703,708 ****
--- 704,710 ----
  #endif
  			wdcbit_bucket (wdc, len);
  		}
+ #endif
  		return 0;
  	}
  
***************
*** 738,744 ****
  	untimeout(wdctimeout, wdc);
  
  	/* Is it not a transfer, but a control operation? */
! 	if (d_link->sc_state < OPEN) {
  		if (wdccontrol(d_link) == 0) {
  			/* The drive is busy.  Wait. */
  			return 1;
--- 740,746 ----
  	untimeout(wdctimeout, wdc);
  
  	/* Is it not a transfer, but a control operation? */
! 	if (d_link->sc_state < READY) {
  		if (wdccontrol(d_link) == 0) {
  			/* The drive is busy.  Wait. */
  			return 1;
***************
*** 773,781 ****
  			goto bad;
  #endif
  
  		wdcunwedge(wdc);
- 		if (wdc->sc_errors < WDIORETRIES)
  			return 1;
  
  		wderror(d_link, xfer->c_bp, "hard error");
  
--- 775,787 ----
  			goto bad;
  #endif
  
+ 		if (wdc->sc_errors == (WDIORETRIES + 1) / 2) {
+ 			wderror(d_link, NULL, "wedgie");
  			wdcunwedge(wdc);
  			return 1;
+ 		}
+ 		if (++wdc->sc_errors < WDIORETRIES)
+ 			goto restart;
  
  		wderror(d_link, xfer->c_bp, "hard error");
  
***************
*** 1235,1241 ****
  	case MULTIMODE:
  	multimode:
  		if (d_link->sc_mode != WDM_PIOMULTI)
! 			goto open;
  		bus_io_write_1(bc, ioh, wd_seccnt, d_link->sc_multiple);
  		if (wdccommandshort(wdc, d_link->sc_drive,
  		    WDCC_SETMULTI) != 0) {
--- 1241,1247 ----
  	case MULTIMODE:
  	multimode:
  		if (d_link->sc_mode != WDM_PIOMULTI)
! 			goto ready;
  		bus_io_write_1(bc, ioh, wd_seccnt, d_link->sc_multiple);
  		if (wdccommandshort(wdc, d_link->sc_drive,
  		    WDCC_SETMULTI) != 0) {
***************
*** 1254,1263 ****
  		}
  		/* fall through */
  
! 	case OPEN:
! 	open:
  		wdc->sc_errors = 0;
! 		d_link->sc_state = OPEN;
  		/*
  		 * The rest of the initialization can be done by normal means.
  		 */
--- 1260,1269 ----
  		}
  		/* fall through */
  
! 	case READY:
! 	ready:
  		wdc->sc_errors = 0;
! 		d_link->sc_state = READY;
  		/*
  		 * The rest of the initialization can be done by normal means.
  		 */
*** wdlink.h-	Wed Sep 11 03:27:04 1996
--- wdlink.h	Wed Nov 27 15:10:52 1996
***************
*** 85,91 ****
  #define GEOMETRY_WAIT	3		/* done uploading geometry */
  #define MULTIMODE	4		/* set multiple mode */
  #define MULTIMODE_WAIT	5		/* done setting multiple mode */
! #define OPEN		6		/* done with open */
  	int sc_mode;			/* transfer mode */
  #define WDM_PIOSINGLE	0		/* single-sector PIO */
  #define WDM_PIOMULTI	1		/* multi-sector PIO */
--- 85,91 ----
  #define GEOMETRY_WAIT	3		/* done uploading geometry */
  #define MULTIMODE	4		/* set multiple mode */
  #define MULTIMODE_WAIT	5		/* done setting multiple mode */
! #define READY		6		/* done with open */
  	int sc_mode;			/* transfer mode */
  #define WDM_PIOSINGLE	0		/* single-sector PIO */
  #define WDM_PIOMULTI	1		/* multi-sector PIO */


---
Douglas Song dugsong@{umich.edu,monkey.org}
University of Michigan ITD GPCC Unix Services
www: http://www-personal.umich.edu/~dugsong
keyid: C2263445 fingerprint: BF F5 20 EA DA 2F C4 F4  7D 68 4A 50 E4 35 D1 17




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.95.970119111224.7361A-100000>