Make ATA code not bother to retry requests that return IDNF (specified sector not valid).

There's no point retrying these requests for five seconds, the sector number isn't going to get any more valid. It interferes with being able to detect broken drives like the 5.5G 80GB iPod's.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25525 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Torne Wuff 2010-04-07 20:01:21 +00:00
parent b3d44fcb57
commit 62321ed0bd
9 changed files with 19 additions and 0 deletions

View File

@ -478,6 +478,7 @@ static int ata_transfer_sectors(unsigned long start,
int sectors;
int wordcount;
int status;
int error;
if (!wait_for_start_of_transfer()) {
/* We have timed out waiting for RDY and/or DRQ, possibly
@ -502,6 +503,7 @@ static int ata_transfer_sectors(unsigned long start,
/* read the status register exactly once per loop */
status = ATA_STATUS;
error = ATA_ERROR;
if (count >= multisectors )
sectors = multisectors;
@ -526,6 +528,9 @@ static int ata_transfer_sectors(unsigned long start,
if ( status & (STATUS_BSY | STATUS_ERR | STATUS_DF) ) {
perform_soft_reset();
ret = -6;
/* no point retrying IDNF, sector no. was invalid */
if (error & ERROR_IDNF)
break;
goto retry;
}
@ -537,8 +542,14 @@ static int ata_transfer_sectors(unsigned long start,
}
if(!ret && !wait_for_end_of_transfer()) {
int error;
error = ATA_ERROR;
perform_soft_reset();
ret = -4;
/* no point retrying IDNF, sector no. was invalid */
if (error & ERROR_IDNF)
break;
goto retry;
}
break;

View File

@ -39,6 +39,7 @@
#define STATUS_DRQ 0x08
#define STATUS_ERR 0x01
#define ERROR_ABRT 0x04
#define ERROR_IDNF 0x10
#define WRITE_PATTERN1 0xa5
#define WRITE_PATTERN2 0x5a

View File

@ -38,6 +38,7 @@
#define STATUS_DRQ 0x08
#define STATUS_ERR 0x01
#define ERROR_ABRT 0x04
#define ERROR_IDNF 0x10
#define WRITE_PATTERN1 0xa5
#define WRITE_PATTERN2 0x5a

View File

@ -52,6 +52,7 @@
#define STATUS_DRQ 0x08
#define STATUS_ERR 0x01
#define ERROR_ABRT 0x04
#define ERROR_IDNF 0x10
#define WRITE_PATTERN1 0xa5
#define WRITE_PATTERN2 0x5a

View File

@ -50,6 +50,7 @@ void copy_read_sectors(unsigned char* buf, int wordcount);
#define STATUS_DRQ 0x08
#define STATUS_ERR 0x01
#define ERROR_ABRT 0x04
#define ERROR_IDNF 0x10
#define WRITE_PATTERN1 0xa5
#define WRITE_PATTERN2 0x5a

View File

@ -59,6 +59,7 @@ extern int _ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
#define STATUS_DRQ 0x08
#define STATUS_ERR 0x01
#define ERROR_ABRT 0x04
#define ERROR_IDNF 0x10
#define WRITE_PATTERN1 0xa5
#define WRITE_PATTERN2 0x5a

View File

@ -55,6 +55,7 @@ void copy_write_sectors(const unsigned char* buf, int wordcount);
#define STATUS_DRQ 0x08
#define STATUS_ERR 0x01
#define ERROR_ABRT 0x04
#define ERROR_IDNF 0x10
#define WRITE_PATTERN1 0xa5
#define WRITE_PATTERN2 0x5a

View File

@ -44,6 +44,7 @@
#define STATUS_ERR 0x0100
#define ERROR_ABRT 0x0400
#define ERROR_IDNF 0x1000
#define WRITE_PATTERN1 0xa5
#define WRITE_PATTERN2 0x5a

View File

@ -46,6 +46,7 @@
#define STATUS_ERR 0x01
#define ERROR_ABRT 0x04
#define ERROR_IDNF 0x10
#define WRITE_PATTERN1 0xa5
#define WRITE_PATTERN2 0x5a