kern/64637: [PATCH] ata1-slave: stat=0x01 err=0x00 lsb=0x00 msb=0x00 <- repeats for exactly 30 seconds during boot when no slave is wired

Paul Seniura pdseniura at
Wed Apr 28 09:28:54 PDT 2004


I saw Soren's private msg (heh, I can't figure out how to spell his name correctly ;) .
I know anything this low-level is a thorny thing to be modifying.

But this is one of those irritating things that bother one so much that it compels one to try fixing it oneself.

I'm no expert, but 30 years of building electronics and interfacing some of them to computers & writing drivers for them, I kinda have a knack.  ;)

The dmesg may be showing the 'answer' to this, up a bit further, in the tp1 lines:
 ata0: reset tp1 mask=03 ostat0=50 ostat1=00
 ata1: reset tp1 mask=03 ostat0=50 ostat1=00

I _think_ we are _already_ getting a definitive response that there are no slaves connected.

Let me hear from y'all if this is correct or not:

The ostat1 in particular comes from the query for the ATA_SLAVE device on that channel (shown by 'ata#:') and getting the ATA_STATUS from that query (see patch below).

A zero value means nothing is busy, nothing is ready, nothing has an error, etc. etc. etc. (status flags defined following line #82 in ata-all.h v1.78).

We're seeing zeroes because nothing is there to respond.

Ergo, no slave device there.

What I do _not_ know is why we aren't getting ATA_NO_SLAVE lit up, but that part of ata-lowlevel.c (under line #556) is being executed anyway (this _is_ an older IBM 300PL model with its latest BIOS; its ACPI and APM modes make no difference here).

I also don't know if a zero value should prompt the code to check other flags -- if so, where & what & how??

So I am testing this patch for the time being:

===== cut here =====
--- ata-lowlevel.c_orig	Wed Apr 28 00:43:17 2004
+++ ata-lowlevel.c	Wed Apr 28 10:33:44 2004
@@ -546,7 +546,7 @@ ata_generic_reset(struct ata_channel *ch
     ostat0 = ATA_IDX_INB(ch, ATA_STATUS);
-    if ((ostat0 & 0xf8) != 0xf8 && ostat0 != 0xa5) {
+    if ((ostat0 & 0xf8) != 0xf8 && ostat0 != 0xa5 && ostat0 != 0) {
 	stat0 = ATA_S_BUSY;
 	mask |= 0x01;
@@ -557,7 +557,7 @@ ata_generic_reset(struct ata_channel *ch
     /* in some setups we dont want to test for a slave */
     if (!(ch->flags & ATA_NO_SLAVE)) {
-	if ((ostat1 & 0xf8) != 0xf8 && ostat1 != 0xa5) {
+	if ((ostat1 & 0xf8) != 0xf8 && ostat1 != 0xa5 && ostat1 != 0) {
 	    stat1 = ATA_S_BUSY;
 	    mask |= 0x02;
===== cut here =====

It's fixed the problem as best that I can figure out.  ;)

This IBM model does not have a ribbon connector for an extra drive (altho empty physical slot exist, but IBM wants to $ell you a new part for 'upgrading', see), so I'm not able to test this further.  Does anyone out there have the 'nads to try this patch?  ;)

  --  thx, Paul Seniura.

More information about the freebsd-current mailing list