summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/ata.c')
-rw-r--r--firmware/drivers/ata.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 92332b580e..ec99bf799e 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -196,7 +196,6 @@ int ata_read_sectors(unsigned long start,
196 196
197 timeout = current_tick + READ_TIMEOUT; 197 timeout = current_tick + READ_TIMEOUT;
198 198
199 retry:
200 ATA_SELECT = ata_device; 199 ATA_SELECT = ata_device;
201 if (!wait_for_rdy()) 200 if (!wait_for_rdy())
202 { 201 {
@@ -205,6 +204,7 @@ int ata_read_sectors(unsigned long start,
205 return -2; 204 return -2;
206 } 205 }
207 206
207 retry:
208 buf = inbuf; 208 buf = inbuf;
209 count = incount; 209 count = incount;
210 while (TIME_BEFORE(current_tick, timeout)) { 210 while (TIME_BEFORE(current_tick, timeout)) {
@@ -363,10 +363,9 @@ int ata_write_sectors(unsigned long start,
363 363
364 for (i=0; i<count; i++) { 364 for (i=0; i<count; i++) {
365 int j; 365 int j;
366 if (!wait_for_start_of_transfer()) 366 if (!wait_for_start_of_transfer()) {
367 { 367 ret = -3;
368 mutex_unlock(&ata_mtx); 368 break;
369 return 0;
370 } 369 }
371 370
372 if (spinup) { 371 if (spinup) {
@@ -391,8 +390,8 @@ int ata_write_sectors(unsigned long start,
391 last_disk_activity = current_tick; 390 last_disk_activity = current_tick;
392 } 391 }
393 392
394 if(!wait_for_end_of_transfer()) 393 if(!ret && !wait_for_end_of_transfer())
395 ret = -3; 394 ret = -4;
396 395
397 led(false); 396 led(false);
398 397