From owner-freebsd-hackers Wed Aug 28 14:58:48 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA01511 for hackers-outgoing; Wed, 28 Aug 1996 14:58:48 -0700 (PDT) Received: from ekeberg.sn.no (ekeberg.sn.no [194.143.8.8]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id OAA01502 for ; Wed, 28 Aug 1996 14:58:41 -0700 (PDT) Received: from oppegard103.telepost.no (oppegard103.telepost.no [193.214.217.146]) by ekeberg.sn.no (8.7.5/8.7.3/on4) with SMTP id ; Wed, 28 Aug 1996 23:57:58 +0200 (MET DST) X-Authentication-Warning: ekeberg.sn.no: Host oppegard103.telepost.no [193.214.217.146] didn't use HELO protocol Message-ID: <3225378B.2748@sn.no> Date: Wed, 28 Aug 1996 23:24:11 -0700 From: Arve Ronning X-Mailer: Mozilla 2.0 (Win16; I) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org CC: Jan Knepper <106030.3360@CompuServe.COM>, "Daniel C. Sobral" , Arve.Ronning@alcatel.no Subject: Re: 2.1.5R & ATAPI CDROM Problems Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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);