Lines 2271-2281
Link Here
|
2271 |
* Sleep until ATA Status register bit BSY clears, |
2271 |
* Sleep until ATA Status register bit BSY clears, |
2272 |
* or a timeout occurs. |
2272 |
* or a timeout occurs. |
2273 |
* |
2273 |
* |
2274 |
* LOCKING: None. |
2274 |
* LOCKING: |
|
|
2275 |
* Kernel thread context (may sleep). |
2276 |
* |
2277 |
* RETURNS: |
2278 |
* 0 on success, -errno otherwise. |
2275 |
*/ |
2279 |
*/ |
2276 |
|
2280 |
int ata_busy_sleep(struct ata_port *ap, |
2277 |
unsigned int ata_busy_sleep (struct ata_port *ap, |
2281 |
unsigned long tmout_pat, unsigned long tmout) |
2278 |
unsigned long tmout_pat, unsigned long tmout) |
|
|
2279 |
{ |
2282 |
{ |
2280 |
unsigned long timer_start, timeout; |
2283 |
unsigned long timer_start, timeout; |
2281 |
u8 status; |
2284 |
u8 status; |
Lines 2283-2307
Link Here
|
2283 |
status = ata_busy_wait(ap, ATA_BUSY, 300); |
2286 |
status = ata_busy_wait(ap, ATA_BUSY, 300); |
2284 |
timer_start = jiffies; |
2287 |
timer_start = jiffies; |
2285 |
timeout = timer_start + tmout_pat; |
2288 |
timeout = timer_start + tmout_pat; |
2286 |
while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) { |
2289 |
while (status != 0xff && (status & ATA_BUSY) && |
|
|
2290 |
time_before(jiffies, timeout)) { |
2287 |
msleep(50); |
2291 |
msleep(50); |
2288 |
status = ata_busy_wait(ap, ATA_BUSY, 3); |
2292 |
status = ata_busy_wait(ap, ATA_BUSY, 3); |
2289 |
} |
2293 |
} |
2290 |
|
2294 |
|
2291 |
if (status & ATA_BUSY) |
2295 |
if (status != 0xff && (status & ATA_BUSY)) |
2292 |
ata_port_printk(ap, KERN_WARNING, |
2296 |
ata_port_printk(ap, KERN_WARNING, |
2293 |
"port is slow to respond, please be patient\n"); |
2297 |
"port is slow to respond, please be patient\n"); |
2294 |
|
2298 |
|
2295 |
timeout = timer_start + tmout; |
2299 |
timeout = timer_start + tmout; |
2296 |
while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) { |
2300 |
while (status != 0xff && (status & ATA_BUSY) && |
2297 |
msleep(50); |
2301 |
time_before(jiffies, timeout)) { |
2298 |
status = ata_chk_status(ap); |
2302 |
status = ata_chk_status(ap); |
2299 |
} |
2303 |
} |
2300 |
|
2304 |
|
|
|
2305 |
if (status == 0xff) |
2306 |
return -ENODEV; |
2307 |
|
2301 |
if (status & ATA_BUSY) { |
2308 |
if (status & ATA_BUSY) { |
2302 |
ata_port_printk(ap, KERN_ERR, "port failed to respond " |
2309 |
ata_port_printk(ap, KERN_ERR, "port failed to respond " |
2303 |
"(%lu secs)\n", tmout / HZ); |
2310 |
"(%lu secs)\n", tmout / HZ); |
2304 |
return 1; |
2311 |
return -EBUSY; |
2305 |
} |
2312 |
} |
2306 |
|
2313 |
|
2307 |
return 0; |
2314 |
return 0; |
Lines 2392-2401
Link Here
|
2392 |
* the bus shows 0xFF because the odd clown forgets the D7 |
2399 |
* the bus shows 0xFF because the odd clown forgets the D7 |
2393 |
* pulldown resistor. |
2400 |
* pulldown resistor. |
2394 |
*/ |
2401 |
*/ |
2395 |
if (ata_check_status(ap) == 0xFF) { |
2402 |
if (ata_check_status(ap) == 0xFF) |
2396 |
ata_port_printk(ap, KERN_ERR, "SRST failed (status 0xFF)\n"); |
2403 |
return 0; |
2397 |
return AC_ERR_OTHER; |
|
|
2398 |
} |
2399 |
|
2404 |
|
2400 |
ata_bus_post_reset(ap, devmask); |
2405 |
ata_bus_post_reset(ap, devmask); |
2401 |
|
2406 |
|