#1274 closed defect

ATA driver fails to detect disk on slave interfaces

Reported by: strauman Owned by: Chris Johns
Priority: normal Milestone: 4.9
Component: fs Version: 4.7
Severity: normal Keywords:
Cc: thomas.doerfler@…, chrisj@…, nbkolchin@… Blocked By:
Blocking:

Description (last modified by Chris Johns)

At initialization the ATA driver issues DEVICE_DIAGNOSTIC
command on the ide interface. However, the interpretation of
the results is incorrect. Even if a working disk on the
slave interface is present the driver believes there isn't.

Can be confirmed with qemu -hda dsk0img -hdb dsk1img

After initializing the ATA driver there is "/dev/hda" but
no "/dev/hdb". If the test mentioned below is eliminated
then "/dev/hdb" appears. [sidenote: qemu needs to be patched;
it fails to set the READY bit when completing a WIN_DIAGNOSE
command].

This piece of code seems to be the culprit (libchip/ide/ata.c).

AFAIK, if bit 7 is set that means a failure of DEV1; however,
ATA_DEV1_PASSED_DEV0_FAILED == 0x80 which seems to be incorrect.

/* refine the returned codes */
if (ATA_DEV_INFO(ctrl_minor, 1).present != 0)
{

ide_controller_read_register(ctrl_minor, IDE_REGISTER_ERROR, &ec);
if (ec & ATA_DEV1_PASSED_DEV0_FAILED)

ATA_DEV_INFO(ctrl_minor, 1).present = 1;

else

ATA_DEV_INFO(ctrl_minor, 1).present = 0;

}

I'm not sure this check of 'refined return codes' does any good
(but it certainly prevents detection of a working slave disk).
AFAIK, the most we can know about dev1 is that it either failed
(0x80 set) or that it is OK-or-not-present (0x80 clear). I.e.,
we cannot distinguish between OK and 'not present'. Neither
with the original check nor the 'refined test'.

Change History (4)

comment:1 Changed on Feb 22, 2008 at 10:27:43 AM by Nickolay Semyonov-Kolchin

Cc: Nickolay Semyonov-Kolchin added

comment:2 Changed on May 29, 2010 at 3:51:10 AM by Chris Johns

Owner: changed from Joel Sherrill to Chris Johns
Status: newassigned, chrisj@rtems.org

comment:3 Changed on May 31, 2010 at 12:42:11 AM by Chris Johns

This code is currently ifdef'ed out. One of the reasons it has been removed is qemu being broken. The other reason is qemu boots a number of other operating systems so I can only conclude they work around the bug or do not perform this test.

FYI I agree with your original comments about the logic in the code being wrong.

comment:4 Changed on Nov 20, 2014 at 3:53:27 AM by Chris Johns

Description: modified (diff)
Resolution: wontfix
Status: assignedclosed

Not fixed in the 4.9 branch.

Note: See TracTickets for help on using tickets.