summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-03-19 13:26:43 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-03-19 13:26:43 +0000
commit8bda0e10975b476a77a17777a733b783a4d718b4 (patch)
tree690333268d2c9cf6e9b21680f04658a3a899ceaf
parentaac5ca92b6fb4ca165ced08feac0d4e2341c2f60 (diff)
downloadrockbox-8bda0e10975b476a77a17777a733b783a4d718b4.tar.gz
rockbox-8bda0e10975b476a77a17777a733b783a4d718b4.zip
A hip shot trying to make the Red LED Death situation a little better
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4409 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 7641be7ec1..d12dfbec31 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -117,7 +117,7 @@ static int set_features(void);
117static int wait_for_bsy(void) __attribute__ ((section (".icode"))); 117static int wait_for_bsy(void) __attribute__ ((section (".icode")));
118static int wait_for_bsy(void) 118static int wait_for_bsy(void)
119{ 119{
120 int timeout = current_tick + HZ*10; 120 int timeout = current_tick + HZ*30;
121 while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) { 121 while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) {
122 last_disk_activity = current_tick; 122 last_disk_activity = current_tick;
123 yield(); 123 yield();
@@ -375,6 +375,15 @@ int ata_read_sectors(unsigned long start,
375 int status; 375 int status;
376 376
377 if (!wait_for_start_of_transfer()) { 377 if (!wait_for_start_of_transfer()) {
378 /* We have timed out waiting for RDY and/or DRQ, possibly
379 because the hard drive is shaking and has problems reading
380 the data. We have two options:
381 1) Wait some more
382 2) Perform a soft reset and try again.
383
384 We choose alternative 2.
385 */
386 ata_soft_reset();
378 ret = -4; 387 ret = -4;
379 goto retry; 388 goto retry;
380 } 389 }
@@ -409,6 +418,7 @@ int ata_read_sectors(unsigned long start,
409 -- ATA specification 418 -- ATA specification
410 */ 419 */
411 if ( status & (STATUS_BSY | STATUS_ERR | STATUS_DF) ) { 420 if ( status & (STATUS_BSY | STATUS_ERR | STATUS_DF) ) {
421 ata_soft_reset();
412 ret = -5; 422 ret = -5;
413 goto retry; 423 goto retry;
414 } 424 }
@@ -420,6 +430,7 @@ int ata_read_sectors(unsigned long start,
420 } 430 }
421 431
422 if(!ret && !wait_for_end_of_transfer()) { 432 if(!ret && !wait_for_end_of_transfer()) {
433 ata_soft_reset();
423 ret = -3; 434 ret = -3;
424 goto retry; 435 goto retry;
425 } 436 }