slow probe for ata channel with only an atapi master on it

From: Bruce Evans <bde_at_zeta.org.au>
Date: Mon, 29 Dec 2003 16:36:13 +1100 (EST)
Probing for a nonexistent slave on ata1 now takes 31+epsilon seconds
in -current.  The master is a cdrom burner (<RICOH CD-RW MP7320A/bp13>)
jumpered as a master:

%%%
ata1: reset tp1 mask=03 ostat0=50 ostat1=01
ata1-master: stat=0x00 err=0x01 lsb=0x14 msb=0xeb
ata1-slave:  stat=0x01 err=0x00 lsb=0x00 msb=0x00
[... 310 - 2 = 308 more of these deleted]
ata1-slave:  stat=0x01 err=0x00 lsb=0x00 msb=0x00
ata1: reset tp2 mask=01 stat0=00 stat1=81 devices=0x4<ATAPI_MASTER>
ata1: at 0x170 irq 15 on atapci0
ata1: [MPSAFE]
%%%

This is because the slave status is always 1 and ata_reset() doesn't
understand this.

Another channel with an atapi slave only works a bit better, although
this setup is outside of the ata spec:

%%%
atapci1: <HighPoint HPT366 UDMA66 controller> port 0xbc00-0xbcff,0xb800-0xb803,0xb400-0xb407 irq 11 at device 19.0 on pci0
atapci1: [MPSAFE]
ata2: reset tp1 mask=03 ostat0=7f ostat1=50
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-slave:  stat=0x00 err=0x01 lsb=0x14 msb=0xeb
ata2: reset tp2 mask=02 stat0=ff stat1=00 devices=0x8<ATAPI_SLAVE>
ata2: at 0xb400 on atapci1
ata2: [MPSAFE]
%%%

Here it takes 23 status reports to time out the master.  I think 23 is
from the magic 20 in the code (don't know why it is 3 more).

These problems are missing in my version.  It trusts the busy bits and
decides that the nonexistent device is not there immediately after both
the busy bits become clear, which happens after just 1 or 2 iterations
of the loop (with a delay of 10 msec instead of 100 msec between the
iterations).

%%%
ata1: reset tp1 mask=03 ostat0=50 ostat1=01
ata1: master _at_1.038311: d0 00 00 02; slave _at_1.038334: 01 00 00 00
             [^^^^^^^^ uptime when we read the registers]
ata1: master _at_1.038826: 00 01 14 eb; slave _at_1.038848: 01 00 00 00
ata1-master: stat=0x00 err=0x01 lsb=0x14 msb=0xeb
ata1-slave:  stat=0x01 err=0x00 lsb=0x00 msb=0x00
ata1: reset tp2 mask=03 stat0=00 stat1=01 devices=0x4<ATAPI_MASTER>
                     ^^
		     not adjusted since it doesn't affect the loop in my version
ata1: at 0x170 irq 15 on atapci0
ata1: [MPSAFE]
...
atapci1: <HighPoint HPT366 UDMA66 controller> port 0xbc00-0xbcff,0xb800-0xb803,0xb400-0xb407 irq 11 at device 19.0 on pci0
atapci1: [MPSAFE]
ata2: reset tp1 mask=03 ostat0=7f ostat1=50
ata2: master _at_1.060667: 7f 7f 7f 7f; slave _at_1.060696: 00 01 14 eb
ata2-master: stat=0x7f err=0x7f lsb=0x7f msb=0x7f
ata2-slave:  stat=0x00 err=0x01 lsb=0x14 msb=0xeb
ata2: reset tp2 mask=03 stat0=7f stat1=00 devices=0x8<ATAPI_SLAVE>
ata2: at 0xb400 on atapci1
ata2: [MPSAFE]
%%%

Bruce
Received on Sun Dec 28 2003 - 20:36:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:35 UTC