From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 12 17:50:11 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACC0116A41F for ; Fri, 12 Aug 2005 17:50:11 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7969B43D46 for ; Fri, 12 Aug 2005 17:50:11 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j7CHoBw1027341 for ; Fri, 12 Aug 2005 17:50:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j7CHoBZ0027338; Fri, 12 Aug 2005 17:50:11 GMT (envelope-from gnats) Date: Fri, 12 Aug 2005 17:50:11 GMT Message-Id: <200508121750.j7CHoBZ0027338@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Joost Bekkers Cc: Subject: Re: kern/84799: can't read beyond track 0 on fdc (IBM thinkpad G40) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Joost Bekkers List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2005 17:50:11 -0000 The following reply was made to PR kern/84799; it has been noted by GNATS. From: Joost Bekkers 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