Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Feb 2001 13:04:29 -0500
From:      David Dawes <dawes@xfree86.org>
To:        freebsd-stable@freebsd.org
Subject:   atapi slave probing problem (with workaround)
Message-ID:  <20010210130429.A819@xfree86.org>

next in thread | raw e-mail | index | archive | help
I upgraded my main box from 4.1 to 4.2-STABLE today, and got caught
by the problem probing for slave ATAPI devices.  I checked through
the archives, and it seems that I'm not the only one seeing the problem,
but it's still present in RELENG_4 as of yesterday.

Anyway, I looked into it a bit, comparing the 4.1 and 4.1.1 versions,
and the problem seems to be related to moving the ATAPI probing code
into the reset() routine.  In short, it seems that the slave clears its
busy flag before the master, but it doesn't return the correct ATAPI
magic numbers until some time after, perhaps when the master's busy flag
is also cleared?

With the following small patch it now works for me:

Index: ata-all.c
===================================================================
RCS file: /home/cvs/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.50.2.15
diff -u -r1.50.2.15 ata-all.c
--- ata-all.c	2001/01/04 09:08:56	1.50.2.15
+++ ata-all.c	2001/02/10 17:44:16
@@ -1281,7 +1281,7 @@
                     scp->devices |= ATA_ATAPI_MASTER;
             }
         }
-        if (status1 & ATA_S_BUSY) {
+        if (status1 & ATA_S_BUSY || !(scp->devices & ATA_ATAPI_SLAVE)) {
             outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_SLAVE);
             DELAY(10);
             status1 = inb(scp->ioaddr + ATA_STATUS);

I don't know enough about it to know if this is a "good" fix, but
it does work for me.

When I do 'boot -v', the relevant log messages are:

ata1: iobase=0x0170 altiobase=0x0376 bmaddr=0xffa8
ata1: mask=03 status0=50 status1=50
ata1: mask=03 ostat0=50 ostat2=50
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
 ... repeated lots of times
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=7f b=7f
ata1-slave: ATAPI probe a=14 b=eb
ata1-master: ATAPI probe a=14 b=eb
ata1: mask=03 status0=00 status1=00
ata1: devices=0c
ata1: at 0x170 irq 15 on atapci0

 ...

ata1-master: piomode=4 dmamode=2 udmamode=2 dmaflag=1
ata1-master: success setting PIO4 on generic chip
acd0: <CD-540E/1.0A> CDROM drive at ata1 as master
acd0: read 6890KB/s (6890KB/s), 128KB buffer, PIO4
acd0: Reads: CD-R, CD-RW, CD-DA stream, packet
acd0: Audio: play, 256 volume levels
acd0: Mechanism: ejectable tray
acd0: Medium: no/blank disc inside, unlocked
ata1-slave: piomode=4 dmamode=2 udmamode=2 dmaflag=1
ata1-slave: success setting PIO4 on generic chip
acd1: <Hewlett-Packard CD-Writer Plus 9100/1.0a> CD-RW drive at ata1 as slave
acd1: read 5512KB/s (5512KB/s) write 1377KB/s (1377KB/s), 4096KB buffer, PIO4
acd1: Reads: CD-R, CD-RW, CD-DA stream, packet
acd1: Writes: CD-R, CD-RW, test write
acd1: Audio: play, 256 volume levels
acd1: Mechanism: ejectable tray
acd1: Medium: no/blank disc inside, unlocked

I'm not subscribed to this list, so please cc replies.

David
-- 
David Dawes                                      Email: dawes@XFree86.org
Founder/President, The XFree86 Project, Inc      Phone: +1 510 687 6857
http://www.xfree86.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010210130429.A819>