From f017b372bdbc102793407da5520d2a09004774f3 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Wed, 9 Jan 2008 12:39:03 +0000 Subject: [PATCH] added more debug output, read device error register after a reset git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23305 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/ata/basic_protocol.c | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/ata/basic_protocol.c b/src/add-ons/kernel/bus_managers/ata/basic_protocol.c index f53b5565e1..a54e4e1ef9 100644 --- a/src/add-ons/kernel/bus_managers/ata/basic_protocol.c +++ b/src/add-ons/kernel/bus_managers/ata/basic_protocol.c @@ -87,17 +87,20 @@ reset_bus(ide_bus_info *bus, bool *devicePresent0, uint32 *sigDev0, bool *device // wait up to 31 seconds for busy to clear, abort when error is set status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); if (status != B_OK) { - if (status == B_TIMED_OUT) - dprintf("ATA: reset_bus: timeout\n"); - else - dprintf("ATA: reset_bus: error bit set\n"); + dprintf("ATA: reset_bus: timeout\n"); goto error; } if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | - ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high | ide_mask_error) != B_OK) goto error; + if (tf.read.error != 0x01 && tf.read.error != 0x81) + dprintf("ATA: device 0 failed, error code is 0x%02\n", tf.read.error); + + if (tf.read.error >= 0x80) + dprintf("ATA: device 0 indicates that device 1 failed, error code is 0x%02\n", tf.read.error); + *sigDev0 = tf.lba.sector_count; *sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; *sigDev0 |= ((uint32)tf.lba.lba_8_15) << 16; @@ -114,17 +117,17 @@ reset_bus(ide_bus_info *bus, bool *devicePresent0, uint32 *sigDev0, bool *device // wait up to 31 seconds for busy to clear, abort when error is set status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); if (status != B_OK) { - if (status == B_TIMED_OUT) - dprintf("ATA: reset_bus: timeout\n"); - else - dprintf("ATA: reset_bus: error bit set\n"); + dprintf("ATA: reset_bus: timeout\n"); goto error; } if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | - ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high | ide_mask_error) != B_OK) goto error; + if (tf.read.error != 0x01) + dprintf("ATA: device 1 failed, error code is 0x%02\n", tf.read.error); + *sigDev1 = tf.lba.sector_count; *sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; *sigDev1 |= ((uint32)tf.lba.lba_8_15) << 16;