aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-14 14:14:16 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-14 14:14:16 -0500
commit2c13b7cee045af689b36349c2bc6a9ed6e3d73fa (patch)
tree594a061fa9b9c1fa03bfe01c9177cc016e1bb1a4
parente1410f2d951d45aee3bdbcc05ecedaaa9db276e5 (diff)
[libata] minor fixes, new helpers
- in ata_dev_identify(), don't assume that all devices are either ATA or ATAPI. In the future, this code will see port multipliers and other devices. - make a debugging printk less verbose - add new helper ata_qc_reinit() - add new helper BPRINTK() and port flag ATA_FLAG_DEBUGMSG, for fine-grained debugging use.
-rw-r--r--drivers/scsi/libata-core.c11
-rw-r--r--include/linux/libata.h14
2 files changed, 17 insertions, 8 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 1ccaf467d516..3855bfa8e8d4 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1263,7 +1263,7 @@ retry:
1263 } 1263 }
1264 1264
1265 /* ATAPI-specific feature tests */ 1265 /* ATAPI-specific feature tests */
1266 else { 1266 else if (dev->class == ATA_DEV_ATAPI) {
1267 if (ata_id_is_ata(dev->id)) /* sanity check */ 1267 if (ata_id_is_ata(dev->id)) /* sanity check */
1268 goto err_out_nosup; 1268 goto err_out_nosup;
1269 1269
@@ -2399,7 +2399,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
2399 if (qc->flags & ATA_QCFLAG_SINGLE) 2399 if (qc->flags & ATA_QCFLAG_SINGLE)
2400 assert(qc->n_elem == 1); 2400 assert(qc->n_elem == 1);
2401 2401
2402 DPRINTK("unmapping %u sg elements\n", qc->n_elem); 2402 VPRINTK("unmapping %u sg elements\n", qc->n_elem);
2403 2403
2404 /* if we padded the buffer out to 32-bit bound, and data 2404 /* if we padded the buffer out to 32-bit bound, and data
2405 * xfer direction is from-device, we must copy from the 2405 * xfer direction is from-device, we must copy from the
@@ -3432,16 +3432,11 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
3432 3432
3433 qc = ata_qc_new(ap); 3433 qc = ata_qc_new(ap);
3434 if (qc) { 3434 if (qc) {
3435 qc->__sg = NULL;
3436 qc->flags = 0;
3437 qc->scsicmd = NULL; 3435 qc->scsicmd = NULL;
3438 qc->ap = ap; 3436 qc->ap = ap;
3439 qc->dev = dev; 3437 qc->dev = dev;
3440 qc->cursect = qc->cursg = qc->cursg_ofs = 0;
3441 qc->nsect = 0;
3442 qc->nbytes = qc->curbytes = 0;
3443 3438
3444 ata_tf_init(ap, &qc->tf, dev->devno); 3439 ata_qc_reinit(qc);
3445 } 3440 }
3446 3441
3447 return qc; 3442 return qc;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ad5996183ec2..f2dbb684ce9e 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -59,6 +59,8 @@
59#define VPRINTK(fmt, args...) 59#define VPRINTK(fmt, args...)
60#endif /* ATA_DEBUG */ 60#endif /* ATA_DEBUG */
61 61
62#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
63
62#ifdef ATA_NDEBUG 64#ifdef ATA_NDEBUG
63#define assert(expr) 65#define assert(expr)
64#else 66#else
@@ -119,6 +121,7 @@ enum {
119 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ 121 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */
120 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once 122 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once
121 * proper HSM is in place. */ 123 * proper HSM is in place. */
124 ATA_FLAG_DEBUGMSG = (1 << 10),
122 125
123 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 126 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
124 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 127 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
@@ -659,6 +662,17 @@ static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, uns
659 tf->device = ATA_DEVICE_OBS | ATA_DEV1; 662 tf->device = ATA_DEVICE_OBS | ATA_DEV1;
660} 663}
661 664
665static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
666{
667 qc->__sg = NULL;
668 qc->flags = 0;
669 qc->cursect = qc->cursg = qc->cursg_ofs = 0;
670 qc->nsect = 0;
671 qc->nbytes = qc->curbytes = 0;
672
673 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
674}
675
662 676
663/** 677/**
664 * ata_irq_on - Enable interrupts on a port. 678 * ata_irq_on - Enable interrupts on a port.