Date: Fri, 12 Aug 2005 17:50:11 GMT From: Joost Bekkers <joost@jodocus.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/84799: can't read beyond track 0 on fdc (IBM thinkpad G40) Message-ID: <200508121750.j7CHoBZ0027338@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/84799; it has been noted by GNATS. From: Joost Bekkers <joost@jodocus.org> To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/84799: can't read beyond track 0 on fdc (IBM thinkpad G40) Date: Fri, 12 Aug 2005 19:40:55 +0200 This seems to me a nice way to work around the faulty hardware. (diff against 6.0-B2, but should work on 5 too) diff -u fdc.dist/fdc.c fdc/fdc.c --- fdc.dist/fdc.c Fri Aug 12 19:24:39 2005 +++ fdc/fdc.c Fri Aug 12 19:27:15 2005 @@ -736,7 +736,7 @@ struct bio *bp; int i, nsect; int st0, st3, cyl, mfm, steptrac, cylinder, descyl, sec; - int head; + int head,prev_track; static int need_recal; struct fdc_readid *idp; struct fd_formb *finfo; @@ -953,7 +953,8 @@ if (cylinder != fd->track && ( fdc->fdct != FDC_ENHANCED || descyl != cylinder || - (bp->bio_cmd & (BIO_RDID|BIO_FMT)))) { + (bp->bio_cmd & (BIO_RDID|BIO_FMT)) || + (fdc->flags & FDC_NEEDSEEK))) { retry_line = __LINE__; if (fdc_cmd(fdc, 3, NE7CMD_SEEK, fd->fdsu, descyl, 0)) return (1); @@ -970,6 +971,7 @@ if (settle) msleep(fdc->fd, NULL, PRIBIO, "fdhdstl", settle); } + prev_track=fd->track; fd->track = cylinder; if (debugflags & 8) @@ -1114,6 +1116,11 @@ } retry_line = __LINE__; if(st0 == NE7_ST0_IC_AT && fdc->status[2] & NE7_ST2_WC) { + if (prev_track==0 && + cylinder!=0 && + !(fdc->flags & FDC_NEEDSEEK)) { + fdc->flags|=FDC_NEEDSEEK; + } need_recal |= (1 << fd->fdsu); return (1); } diff -u fdc.dist/fdcvar.h fdc/fdcvar.h --- fdc.dist/fdcvar.h Fri Aug 12 19:25:05 2005 +++ fdc/fdcvar.h Thu Aug 11 18:27:43 2005 @@ -40,6 +40,7 @@ int dmachan; int flags; #define FDC_HASDMA 0x01 +#define FDC_NEEDSEEK 0x02 /* enhanced controller that needs expl seek */ #define FDC_STAT_VALID 0x08 #define FDC_HAS_FIFO 0x10 #define FDC_NEEDS_RESET 0x20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508121750.j7CHoBZ0027338>