Date: Wed, 25 Mar 1998 19:39:43 -0800 From: Scott Michel <scottm@CS.UCLA.EDU> To: luoqi@watermarkgroup.com (Luoqi Chen) Cc: freebsd-multimedia@FreeBSD.ORG, scottm@CS.UCLA.EDU Subject: Re: NEC 276 CDrom drive Message-ID: <199803260339.TAA00308@mordred.cs.ucla.edu> In-Reply-To: Your message of "Tue, 24 Mar 1998 22:48:12 EST." <9803250348.AA28812@watermarkgroup.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I say that this patch should be committed. I can vouch that it works. Probably needs more testing to make sure that everyone else's drive still works, but at least mine is... -scooter > I have a NEC 273/4.21 drive, and I saw the same message during bootup. > Signal timing for these NEC drives doesn't exactly follow the spec: > when data transfer is done, the drive should assert IO/CMD first, then > deassert ARQ and BSY, then assert INTRQ. > > Try the following patch: > > Index: atapi.c > =================================================================== > RCS file: /fun/cvs/src/sys/i386/isa/atapi.c,v > retrieving revision 1.24 > diff -u -r1.24 atapi.c > --- atapi.c 1998/03/01 18:57:27 1.24 > +++ atapi.c 1998/03/24 07:48:05 > @@ -711,7 +711,9 @@ > { > u_char ireason; > u_short len, i; > + int retry = 100; > > +again: > if (atapi_wait (ata->port, 0) < 0) { > ac->result.status = inb (ata->port + AR_STATUS); > ac->result.error = inb (ata->port + AR_ERROR); > @@ -734,8 +736,13 @@ > ac->result.status, ARS_BITS, > ac->result.error, AER_BITS); > } > - switch ((ireason & (ARI_CMD | ARI_IN)) | (ac->result.status & ARS_DRQ)) { > + switch ((ireason & (ARI_CMD|ARI_IN)) | (ac->result.status & ARS_DRQ)) { > default: > + /* we could be between phases for immediate requests */ > + if (!ac->callback && retry--) { > + DELAY(10); > + goto again; > + } > printf ("atapi%d.%d: unknown phase\n", ata->ctrlr, ac->unit); > ac->result.code = RES_ERR; > break; > @@ -948,20 +955,13 @@ > /* Send packet command. */ > atapi_send_cmd (ata, ac); > > - /* Wait for data i/o phase. */ > - for (cnt=20000; cnt>0; --cnt) > - if (((inb (ata->port + AR_IREASON) & (ARI_CMD | ARI_IN)) | > - (inb (ata->port + AR_STATUS) & ARS_DRQ)) != PHASE_CMDOUT) > - break; > - > - /* Do all needed i/o. */ > - while (atapi_io (ata, ac)) > - /* Wait for DRQ deassert. */ > + do { > for (cnt=2000; cnt>0; --cnt) { > - if (! (inb (ata->port + AR_STATUS) & ARS_DRQ)) > + u_char s = inb(ata->port + AR_STATUS); > + if ((s & (ARS_DRQ | ARS_BSY)) == ARS_BSY) > break; > - DELAY(10); > } > + } while (atapi_io(ata, ac)); > } > return (ac->result); > } > > > > > -scooter > > -- > > Scott Michel | In life, there are sheep and there are > > UCLA Computer Science | wolves. > > PhD Graduate Student | ... And I don't bleed ... > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-multimedia" in the body of the message > > > > -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803260339.TAA00308>