Notice: We have migrated to GitLab launching 2024-05-01 see here:

#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:

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

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);

ATA_DEV_INFO(ctrl_minor, 1).present = 1;


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 02/22/08 at 10:27:43 by Nickolay Semyonov-Kolchin

Cc: Nickolay Semyonov-Kolchin added

comment:2 Changed on 05/29/10 at 03:51:10 by Chris Johns

Owner: changed from Joel Sherrill to Chris Johns
Status: newassigned,

comment:3 Changed on 05/31/10 at 00:42:11 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 11/20/14 at 03:53:27 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.