aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:21 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:21 -0400
commit3a7d24841ad794ae64c90d7d00d62a83741912aa (patch)
treed71a36678fa88ed1e0b279390b6169f5018186bf /drivers/ide/ide-io.c
parentf26b3d75959e9a0e43a2e1e1148c075592746c3d (diff)
ide: use ATA_* defines instead of *_STAT and *_ERR ones
* ERR_STAT -> ATA_ERR * INDEX_STAT -> ATA_IDX * ECC_STAT -> ATA_CORR * DRQ_STAT -> ATA_DRQ * SEEK_STAT -> ATA_DSC * WRERR_STAT -> ATA_DF * READY_STAT -> ATA_DRDY * BUSY_STAT -> ATA_BUSY * MARK_ERR -> ATA_AMNF * TRK0_ERR -> ATA_TRK0NF * ABRT_ERR -> ATA_ABORTED * MCR_ERR -> ATA_MCR * ID_ERR -> ATA_IDNF * MC_ERR -> ATA_MC * ECC_ERR -> ATA_UNC * ICRC_ERR -> ATA_ICRC * BBD_ERR -> ATA_BBK Also: * ILI_ERR -> ATAPI_ILI * EOM_ERR -> ATAPI_EOM * LFS_ERR -> ATAPI_LFS * CD -> ATAPI_COD * IO -> ATAPI_IO Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index ce9ecd138836..8dd7b46b41b7 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -322,7 +322,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
322 ide_task_t *task = (ide_task_t *)rq->special; 322 ide_task_t *task = (ide_task_t *)rq->special;
323 323
324 if (rq->errors == 0) 324 if (rq->errors == 0)
325 rq->errors = !OK_STAT(stat, READY_STAT, BAD_STAT); 325 rq->errors = !OK_STAT(stat, ATA_DRDY, BAD_STAT);
326 326
327 if (task) { 327 if (task) {
328 struct ide_taskfile *tf = &task->tf; 328 struct ide_taskfile *tf = &task->tf;
@@ -373,12 +373,12 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
373{ 373{
374 ide_hwif_t *hwif = drive->hwif; 374 ide_hwif_t *hwif = drive->hwif;
375 375
376 if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) { 376 if ((stat & ATA_BUSY) || ((stat & ATA_DF) && !drive->nowerr)) {
377 /* other bits are useless when BUSY */ 377 /* other bits are useless when BUSY */
378 rq->errors |= ERROR_RESET; 378 rq->errors |= ERROR_RESET;
379 } else if (stat & ERR_STAT) { 379 } else if (stat & ATA_ERR) {
380 /* err has different meaning on cdrom and tape */ 380 /* err has different meaning on cdrom and tape */
381 if (err == ABRT_ERR) { 381 if (err == ATA_ABORTED) {
382 if (drive->select.b.lba && 382 if (drive->select.b.lba &&
383 /* some newer drives don't support ATA_CMD_INIT_DEV_PARAMS */ 383 /* some newer drives don't support ATA_CMD_INIT_DEV_PARAMS */
384 hwif->tp_ops->read_status(hwif) == ATA_CMD_INIT_DEV_PARAMS) 384 hwif->tp_ops->read_status(hwif) == ATA_CMD_INIT_DEV_PARAMS)
@@ -386,16 +386,16 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
386 } else if ((err & BAD_CRC) == BAD_CRC) { 386 } else if ((err & BAD_CRC) == BAD_CRC) {
387 /* UDMA crc error, just retry the operation */ 387 /* UDMA crc error, just retry the operation */
388 drive->crc_count++; 388 drive->crc_count++;
389 } else if (err & (BBD_ERR | ECC_ERR)) { 389 } else if (err & (ATA_BBK | ATA_UNC)) {
390 /* retries won't help these */ 390 /* retries won't help these */
391 rq->errors = ERROR_MAX; 391 rq->errors = ERROR_MAX;
392 } else if (err & TRK0_ERR) { 392 } else if (err & ATA_TRK0NF) {
393 /* help it find track zero */ 393 /* help it find track zero */
394 rq->errors |= ERROR_RECAL; 394 rq->errors |= ERROR_RECAL;
395 } 395 }
396 } 396 }
397 397
398 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && 398 if ((stat & ATA_DRQ) && rq_data_dir(rq) == READ &&
399 (hwif->host_flags & IDE_HFLAG_ERROR_STOPS_FIFO) == 0) { 399 (hwif->host_flags & IDE_HFLAG_ERROR_STOPS_FIFO) == 0) {
400 int nsect = drive->mult_count ? drive->mult_count : 1; 400 int nsect = drive->mult_count ? drive->mult_count : 1;
401 401
@@ -407,7 +407,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
407 return ide_stopped; 407 return ide_stopped;
408 } 408 }
409 409
410 if (hwif->tp_ops->read_status(hwif) & (BUSY_STAT | DRQ_STAT)) 410 if (hwif->tp_ops->read_status(hwif) & (ATA_BUSY | ATA_DRQ))
411 rq->errors |= ERROR_RESET; 411 rq->errors |= ERROR_RESET;
412 412
413 if ((rq->errors & ERROR_RESET) == ERROR_RESET) { 413 if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
@@ -427,14 +427,14 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u
427{ 427{
428 ide_hwif_t *hwif = drive->hwif; 428 ide_hwif_t *hwif = drive->hwif;
429 429
430 if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) { 430 if ((stat & ATA_BUSY) || ((stat & ATA_DF) && !drive->nowerr)) {
431 /* other bits are useless when BUSY */ 431 /* other bits are useless when BUSY */
432 rq->errors |= ERROR_RESET; 432 rq->errors |= ERROR_RESET;
433 } else { 433 } else {
434 /* add decoding error stuff */ 434 /* add decoding error stuff */
435 } 435 }
436 436
437 if (hwif->tp_ops->read_status(hwif) & (BUSY_STAT | DRQ_STAT)) 437 if (hwif->tp_ops->read_status(hwif) & (ATA_BUSY | ATA_DRQ))
438 /* force an abort */ 438 /* force an abort */
439 hwif->tp_ops->exec_command(hwif, ATA_CMD_IDLEIMMEDIATE); 439 hwif->tp_ops->exec_command(hwif, ATA_CMD_IDLEIMMEDIATE);
440 440
@@ -804,7 +804,8 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
804 ide_check_pm_state(drive, rq); 804 ide_check_pm_state(drive, rq);
805 805
806 SELECT_DRIVE(drive); 806 SELECT_DRIVE(drive);
807 if (ide_wait_stat(&startstop, drive, drive->ready_stat, BUSY_STAT|DRQ_STAT, WAIT_READY)) { 807 if (ide_wait_stat(&startstop, drive, drive->ready_stat,
808 ATA_BUSY | ATA_DRQ, WAIT_READY)) {
808 printk(KERN_ERR "%s: drive not ready for command\n", drive->name); 809 printk(KERN_ERR "%s: drive not ready for command\n", drive->name);
809 return startstop; 810 return startstop;
810 } 811 }
@@ -1324,7 +1325,7 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
1324 if (hwif->irq == irq) { 1325 if (hwif->irq == irq) {
1325 stat = hwif->tp_ops->read_status(hwif); 1326 stat = hwif->tp_ops->read_status(hwif);
1326 1327
1327 if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { 1328 if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) {
1328 /* Try to not flood the console with msgs */ 1329 /* Try to not flood the console with msgs */
1329 static unsigned long last_msgtime, count; 1330 static unsigned long last_msgtime, count;
1330 ++count; 1331 ++count;