From 22a6e4bb80ac3242749093f607dd4b9d0bd6f34e Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 22 Apr 2009 00:14:33 +0000 Subject: [PATCH] Only use 2 bytes of the signature instead of all four. Even though the specs clearly state that the other two bytes need to be 0x01 (and they always did, even back to the very first ATA/ATAPI specs), I have one device here that doesn't set the sector count register to 1. Since those two bytes are the unique ones of the signatures anyway, it shouldn't harm to just ignore the others. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30311 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/ata/ATAChannel.cpp | 20 +++++++++---------- .../kernel/bus_managers/ata/ATAPrivate.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp b/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp index 3df867c40d..2ca513cb9e 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp +++ b/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp @@ -123,7 +123,7 @@ ATAChannel::ScanBus() } bool devicePresent[fDeviceCount]; - uint32 deviceSignature[fDeviceCount]; + uint16 deviceSignature[fDeviceCount]; status_t result = Reset(devicePresent, deviceSignature); if (result != B_OK) { TRACE_ERROR("resetting the channel failed\n"); @@ -289,7 +289,7 @@ ATAChannel::SelectedDevice() status_t -ATAChannel::Reset(bool *presence, uint32 *signatures) +ATAChannel::Reset(bool *presence, uint16 *signatures) { TRACE_FUNCTION("\n"); @@ -335,8 +335,8 @@ ATAChannel::Reset(bool *presence, uint32 *signatures) } ata_task_file taskFile; - if (_ReadRegs(&taskFile, ATA_MASK_SECTOR_COUNT | ATA_MASK_LBA_LOW - | ATA_MASK_LBA_MID | ATA_MASK_LBA_HIGH | ATA_MASK_ERROR) != B_OK) { + if (_ReadRegs(&taskFile, ATA_MASK_LBA_MID | ATA_MASK_LBA_HIGH + | ATA_MASK_ERROR) != B_OK) { TRACE_ERROR("reading status failed\n"); return B_ERROR; } @@ -357,12 +357,12 @@ ATAChannel::Reset(bool *presence, uint32 *signatures) if (presence != NULL) presence[i] = true; - if (signatures != NULL) { - signatures[i] = taskFile.lba.sector_count - | (((uint32)taskFile.lba.lba_0_7) << 8) - | (((uint32)taskFile.lba.lba_8_15) << 16) - | (((uint32)taskFile.lba.lba_16_23) << 24); - } + uint16 signature = taskFile.lba.lba_8_15 + | (((uint16)taskFile.lba.lba_16_23) << 8); + TRACE_ALWAYS("signature of device %d: 0x%04x\n", i, signature); + + if (signatures != NULL) + signatures[i] = signature; } return B_OK; diff --git a/src/add-ons/kernel/bus_managers/ata/ATAPrivate.h b/src/add-ons/kernel/bus_managers/ata/ATAPrivate.h index 7d9be24eb0..bde085b554 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATAPrivate.h +++ b/src/add-ons/kernel/bus_managers/ata/ATAPrivate.h @@ -29,9 +29,9 @@ #define ATA_MAX_DMA_FAILURES 3 #define ATA_STANDARD_TIMEOUT 10 * 1000 * 1000 #define ATA_RELEASE_TIMEOUT 10 * 1000 * 1000 -#define ATA_SIGNATURE_ATA 0x00000101 -#define ATA_SIGNATURE_ATAPI 0xeb140101 -#define ATA_SIGNATURE_SATA 0xc33c0101 +#define ATA_SIGNATURE_ATA 0x0000 +#define ATA_SIGNATURE_ATAPI 0xeb14 +#define ATA_SIGNATURE_SATA 0xc33c #define ATA_SIM_MODULE_NAME "bus_managers/ata/sim/driver_v1" #define ATA_CHANNEL_ID_GENERATOR "ide/channel_id" #define ATA_CHANNEL_ID_ITEM "ide/channel_id" @@ -79,7 +79,7 @@ public: status_t SelectDevice(uint8 index); uint8 SelectedDevice(); - status_t Reset(bool *presence, uint32 *signatures); + status_t Reset(bool *presence, uint16 *signatures); bool UseDMA() { return fUseDMA; };