summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index e867ac2f50..ec0fe3567c 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -163,6 +163,7 @@ int ata_read_sectors(unsigned long start,
163 return -1; 163 return -1;
164 } 164 }
165#endif 165#endif
166 sleeping = false;
166 } 167 }
167#endif 168#endif
168 mutex_lock(&ata_mtx); 169 mutex_lock(&ata_mtx);
@@ -179,7 +180,7 @@ int ata_read_sectors(unsigned long start,
179 ATA_NSECTOR = 0; /* 0 means 256 sectors */ 180 ATA_NSECTOR = 0; /* 0 means 256 sectors */
180 else 181 else
181 ATA_NSECTOR = (unsigned char)count; 182 ATA_NSECTOR = (unsigned char)count;
182 183
183 ATA_SECTOR = start & 0xff; 184 ATA_SECTOR = start & 0xff;
184 ATA_LCYL = (start >> 8) & 0xff; 185 ATA_LCYL = (start >> 8) & 0xff;
185 ATA_HCYL = (start >> 16) & 0xff; 186 ATA_HCYL = (start >> 16) & 0xff;
@@ -239,6 +240,7 @@ int ata_write_sectors(unsigned long start,
239 last_disk_activity = current_tick; 240 last_disk_activity = current_tick;
240 241
241#ifndef USE_STANDBY 242#ifndef USE_STANDBY
243 if ( sleeping ) {
242#ifdef USE_POWEROFF 244#ifdef USE_POWEROFF
243 if (ata_power_on()) { 245 if (ata_power_on()) {
244 return -1; 246 return -1;
@@ -248,6 +250,8 @@ int ata_write_sectors(unsigned long start,
248 return -1; 250 return -1;
249 } 251 }
250#endif 252#endif
253 sleeping = false;
254 }
251#endif 255#endif
252 mutex_lock(&ata_mtx); 256 mutex_lock(&ata_mtx);
253 257
@@ -408,6 +412,7 @@ static void ata_thread(void)
408 while (1) { 412 while (1) {
409 while ( queue_empty( &ata_queue ) ) { 413 while ( queue_empty( &ata_queue ) ) {
410 if ( sleep_timeout && 414 if ( sleep_timeout &&
415 !sleeping &&
411 TIME_AFTER( current_tick, 416 TIME_AFTER( current_tick,
412 last_user_activity + sleep_timeout ) && 417 last_user_activity + sleep_timeout ) &&
413 TIME_AFTER( current_tick, 418 TIME_AFTER( current_tick,