From cd457a5000e17d890689f002558ebb3dd2325c9a Mon Sep 17 00:00:00 2001 From: neil Date: Sat, 18 Jan 2014 00:19:00 +0000 Subject: [PATCH] For Identify commands, use polling instead of waiting for an IRQ. This is because some bad drives make us think that there are two devices on the bus when there is really only one, so when we send an Identify command to the phantom drive, we can't rely on getting an IRQ. The phantom drive will later be discarded when its Identify data is found to be invalid. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@48741 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/devs/ata/ata.conf | 2 +- rom/devs/ata/lowlevel.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rom/devs/ata/ata.conf b/rom/devs/ata/ata.conf index 0a859922f5..fd858f75b5 100644 --- a/rom/devs/ata/ata.conf +++ b/rom/devs/ata/ata.conf @@ -1,6 +1,6 @@ ##begin config basename ata -version 42.0 +version 42.1 libbasetype struct ataBase residentpri 4 beginio_func BeginIO diff --git a/rom/devs/ata/lowlevel.c b/rom/devs/ata/lowlevel.c index 912b26fe6f..59278de1ee 100644 --- a/rom/devs/ata/lowlevel.c +++ b/rom/devs/ata/lowlevel.c @@ -485,6 +485,15 @@ static BYTE ata_exec_cmd(struct ata_Unit* unit, ata_CommandBlock *block) APTR mem = block->buffer; UBYTE status; + /* + * For Identify commands, use polling instead of waiting for an IRQ. + * This is because some bad drives make us think that there are two + * devices on the bus when there is really only one, so when we send an + * Identify command to the phantom drive, we can't rely on getting an IRQ + */ + BOOL use_irq = block->command != ATA_IDENTIFY_DEVICE + && block->command != ATA_IDENTIFY_ATAPI; + if (FALSE == ata_SelectUnit(unit)) return IOERR_UNITBUSY; @@ -652,7 +661,7 @@ static BYTE ata_exec_cmd(struct ata_Unit* unit, ata_CommandBlock *block) /* * wait for drive to complete what it has to do */ - if (FALSE == ata_WaitBusyTO(unit, TIMEOUT, TRUE, NULL)) + if (FALSE == ata_WaitBusyTO(unit, TIMEOUT, use_irq, NULL)) { DERROR(bug("[ATA%02ld] ata_exec_cmd: Device is late - no response\n", unit->au_UnitNum)); err = IOERR_UNITBUSY; -- 2.11.4.GIT