Date: Wed, 28 Aug 1996 23:24:11 -0700 From: Arve Ronning <arver@sn.no> To: freebsd-hackers@freebsd.org Cc: Jan Knepper <106030.3360@CompuServe.COM>, "Daniel C. Sobral" <e8917523@antares.linf.unb.br>, Arve.Ronning@alcatel.no Subject: Re: 2.1.5R & ATAPI CDROM Problems Message-ID: <3225378B.2748@sn.no>
next in thread | raw e-mail | index | archive | help
Hello FreeBSD world ! After a rather busy week at work, I'm back with my FreeBSD 2.1.5R box and the 'mount_cd9660: /dev/wcd0c: Device not configured' problem with my Hitachi CDR-7730 ATAPI CDROM drive. By a combination of pure luck and some inspiration from Daniel C. Sobral (thanks Daniel, your mail to 'hackers' 18 Jul generated some ideas), I inserted a printf() near the end of atapi_start_cmd() in /sys/i386/isa/atapi.c to check the AR_STATUS register state; and *!presto!* the mount started to work (sort'a). A swift scan through the ATA-2 rev.3 draft revealed a mismatch in atapi_wait_cmd() related to the interpretation of bits in the AR_STATUS register. ATA section 6.2.12. says : "When the BSY bit is equal to one, no other bits in this register and all other Command Block registers are not valid." With the klutch (kludge+patch:) included below, my CDR-7730 now seems to work ok. (The 3 msec wait limit was a little short for reliable operation, so I added another 2). Btw I have also tried the atapi_wait_cmd() from -current and it only works for me with a similar klutch. I think this should be included in future -SNAPs for the benefit of owners of ATAPI CDROM drives that probe ok but malfunction during install & use. In addition, some feedback would be nice; anyone care to try it ? - Arve *** atapi.c.ori Sat Sep 30 01:11:15 1995 --- atapi.c Wed Aug 28 21:23:01 1996 *************** *** 536,550 **** int atapi_wait_cmd (struct atapi *ata, struct atapicmd *ac) { /* Wait for DRQ from 50 usec to 3 msec for slow devices */ ! int cnt = ata->intrcmd ? 10000 : ata->slow ? 3000 : 50; for (; cnt>0; cnt-=10) { ac->result.status = inb (ata->port + AR_STATUS); ! if (ac->result.status & ARS_DRQ) break; DELAY (10); } ! if (! (ac->result.status & ARS_DRQ)) { printf ("atapi%d.%d: no cmd drq\n", ata->ctrlr, ac->unit); ac->result.code = RES_NODRQ; ac->result.error = inb (ata->port + AR_ERROR); --- 536,554 ---- int atapi_wait_cmd (struct atapi *ata, struct atapicmd *ac) { /* Wait for DRQ from 50 usec to 3 msec for slow devices */ ! /* Add another 2 msec for slooow devices (eg CDR-7730) */ ! int cnt = ata->intrcmd ? 10000 : ata->slow ? 3000+2000 : 50; for (; cnt>0; cnt-=10) { ac->result.status = inb (ata->port + AR_STATUS); ! /* ! * According to ATA, ARS_DRQ is only valid when ARS_BSY is low ! */ ! if ((ac->result.status & (ARS_BSY | ARS_DRQ)) == ARS_DRQ) break; DELAY (10); } ! if ((ac->result.status & (ARS_BSY | ARS_DRQ)) != ARS_DRQ) { printf ("atapi%d.%d: no cmd drq\n", ata->ctrlr, ac->unit); ac->result.code = RES_NODRQ; ac->result.error = inb (ata->port + AR_ERROR);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3225378B.2748>