aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2011-01-28 14:01:01 -0500
committerJeff Garzik <jgarzik@redhat.com>2011-03-02 02:36:46 -0500
commit84b47e3b16f8a5bb416cd55774d679ebbdb19072 (patch)
tree95eb42a15e4ec8a60eb878d69185cf3e8d61cb2e /drivers/ata
parentd285e8bfe9d1a196e26b798cc04f8c5ebc60c856 (diff)
sata_dwc_460ex: fix misuse of ata_get_cmd_descript()
The driver erroneously uses ata_get_cmd_descript() not only for printing out the ATA commands but also the protocol and DMA direction enums. Add functions for properly printing those out... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/sata_dwc_460ex.c56
1 files changed, 46 insertions, 10 deletions
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 34fc1372d72d..843af13606e1 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -44,7 +44,7 @@
44#undef DRV_NAME 44#undef DRV_NAME
45#undef DRV_VERSION 45#undef DRV_VERSION
46#define DRV_NAME "sata-dwc" 46#define DRV_NAME "sata-dwc"
47#define DRV_VERSION "1.2" 47#define DRV_VERSION "1.3"
48 48
49/* SATA DMA driver Globals */ 49/* SATA DMA driver Globals */
50#define DMA_NUM_CHANS 1 50#define DMA_NUM_CHANS 1
@@ -336,11 +336,47 @@ static int dma_dwc_xfer_setup(struct scatterlist *sg, int num_elems,
336 void __iomem *addr, int dir); 336 void __iomem *addr, int dir);
337static void dma_dwc_xfer_start(int dma_ch); 337static void dma_dwc_xfer_start(int dma_ch);
338 338
339static const char *get_prot_descript(u8 protocol)
340{
341 switch ((enum ata_tf_protocols)protocol) {
342 case ATA_PROT_NODATA:
343 return "ATA no data";
344 case ATA_PROT_PIO:
345 return "ATA PIO";
346 case ATA_PROT_DMA:
347 return "ATA DMA";
348 case ATA_PROT_NCQ:
349 return "ATA NCQ";
350 case ATAPI_PROT_NODATA:
351 return "ATAPI no data";
352 case ATAPI_PROT_PIO:
353 return "ATAPI PIO";
354 case ATAPI_PROT_DMA:
355 return "ATAPI DMA";
356 default:
357 return "unknown";
358 }
359}
360
361static const char *get_dma_dir_descript(int dma_dir)
362{
363 switch ((enum dma_data_direction)dma_dir) {
364 case DMA_BIDIRECTIONAL:
365 return "bidirectional";
366 case DMA_TO_DEVICE:
367 return "to device";
368 case DMA_FROM_DEVICE:
369 return "from device";
370 default:
371 return "none";
372 }
373}
374
339static void sata_dwc_tf_dump(struct ata_taskfile *tf) 375static void sata_dwc_tf_dump(struct ata_taskfile *tf)
340{ 376{
341 dev_vdbg(host_pvt.dwc_dev, "taskfile cmd: 0x%02x protocol: %s flags:" 377 dev_vdbg(host_pvt.dwc_dev, "taskfile cmd: 0x%02x protocol: %s flags:"
342 "0x%lx device: %x\n", tf->command, ata_get_cmd_descript\ 378 "0x%lx device: %x\n", tf->command,
343 (tf->protocol), tf->flags, tf->device); 379 get_prot_descript(tf->protocol), tf->flags, tf->device);
344 dev_vdbg(host_pvt.dwc_dev, "feature: 0x%02x nsect: 0x%x lbal: 0x%x " 380 dev_vdbg(host_pvt.dwc_dev, "feature: 0x%02x nsect: 0x%x lbal: 0x%x "
345 "lbam: 0x%x lbah: 0x%x\n", tf->feature, tf->nsect, tf->lbal, 381 "lbam: 0x%x lbah: 0x%x\n", tf->feature, tf->nsect, tf->lbal,
346 tf->lbam, tf->lbah); 382 tf->lbam, tf->lbah);
@@ -970,7 +1006,7 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance)
970 } 1006 }
971 1007
972 dev_dbg(ap->dev, "%s non-NCQ cmd interrupt, protocol: %s\n", 1008 dev_dbg(ap->dev, "%s non-NCQ cmd interrupt, protocol: %s\n",
973 __func__, ata_get_cmd_descript(qc->tf.protocol)); 1009 __func__, get_prot_descript(qc->tf.protocol));
974DRVSTILLBUSY: 1010DRVSTILLBUSY:
975 if (ata_is_dma(qc->tf.protocol)) { 1011 if (ata_is_dma(qc->tf.protocol)) {
976 /* 1012 /*
@@ -1060,7 +1096,7 @@ DRVSTILLBUSY:
1060 1096
1061 /* Process completed command */ 1097 /* Process completed command */
1062 dev_dbg(ap->dev, "%s NCQ command, protocol: %s\n", __func__, 1098 dev_dbg(ap->dev, "%s NCQ command, protocol: %s\n", __func__,
1063 ata_get_cmd_descript(qc->tf.protocol)); 1099 get_prot_descript(qc->tf.protocol));
1064 if (ata_is_dma(qc->tf.protocol)) { 1100 if (ata_is_dma(qc->tf.protocol)) {
1065 host_pvt.dma_interrupt_count++; 1101 host_pvt.dma_interrupt_count++;
1066 if (hsdevp->dma_pending[tag] == \ 1102 if (hsdevp->dma_pending[tag] == \
@@ -1145,8 +1181,8 @@ static void sata_dwc_dma_xfer_complete(struct ata_port *ap, u32 check_status)
1145 if (tag > 0) { 1181 if (tag > 0) {
1146 dev_info(ap->dev, "%s tag=%u cmd=0x%02x dma dir=%s proto=%s " 1182 dev_info(ap->dev, "%s tag=%u cmd=0x%02x dma dir=%s proto=%s "
1147 "dmacr=0x%08x\n", __func__, qc->tag, qc->tf.command, 1183 "dmacr=0x%08x\n", __func__, qc->tag, qc->tf.command,
1148 ata_get_cmd_descript(qc->dma_dir), 1184 get_dma_dir_descript(qc->dma_dir),
1149 ata_get_cmd_descript(qc->tf.protocol), 1185 get_prot_descript(qc->tf.protocol),
1150 in_le32(&(hsdev->sata_dwc_regs->dmacr))); 1186 in_le32(&(hsdev->sata_dwc_regs->dmacr)));
1151 } 1187 }
1152#endif 1188#endif
@@ -1416,7 +1452,7 @@ static void sata_dwc_bmdma_start_by_tag(struct ata_queued_cmd *qc, u8 tag)
1416 1452
1417 dev_dbg(ap->dev, "%s qc=%p tag: %x cmd: 0x%02x dma_dir: %s " 1453 dev_dbg(ap->dev, "%s qc=%p tag: %x cmd: 0x%02x dma_dir: %s "
1418 "start_dma? %x\n", __func__, qc, tag, qc->tf.command, 1454 "start_dma? %x\n", __func__, qc, tag, qc->tf.command,
1419 ata_get_cmd_descript(qc->dma_dir), start_dma); 1455 get_dma_dir_descript(qc->dma_dir), start_dma);
1420 sata_dwc_tf_dump(&(qc->tf)); 1456 sata_dwc_tf_dump(&(qc->tf));
1421 1457
1422 if (start_dma) { 1458 if (start_dma) {
@@ -1467,7 +1503,7 @@ static void sata_dwc_qc_prep_by_tag(struct ata_queued_cmd *qc, u8 tag)
1467 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); 1503 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
1468 1504
1469 dev_dbg(ap->dev, "%s: port=%d dma dir=%s n_elem=%d\n", 1505 dev_dbg(ap->dev, "%s: port=%d dma dir=%s n_elem=%d\n",
1470 __func__, ap->port_no, ata_get_cmd_descript(qc->dma_dir), 1506 __func__, ap->port_no, get_dma_dir_descript(qc->dma_dir),
1471 qc->n_elem); 1507 qc->n_elem);
1472 1508
1473 dma_chan = dma_dwc_xfer_setup(sg, qc->n_elem, hsdevp->llit[tag], 1509 dma_chan = dma_dwc_xfer_setup(sg, qc->n_elem, hsdevp->llit[tag],
@@ -1494,7 +1530,7 @@ static unsigned int sata_dwc_qc_issue(struct ata_queued_cmd *qc)
1494 "prot=%s ap active_tag=0x%08x ap sactive=0x%08x\n", 1530 "prot=%s ap active_tag=0x%08x ap sactive=0x%08x\n",
1495 __func__, ap->print_id, qc->tf.command, 1531 __func__, ap->print_id, qc->tf.command,
1496 ata_get_cmd_descript(qc->tf.command), 1532 ata_get_cmd_descript(qc->tf.command),
1497 qc->tag, ata_get_cmd_descript(qc->tf.protocol), 1533 qc->tag, get_prot_descript(qc->tf.protocol),
1498 ap->link.active_tag, ap->link.sactive); 1534 ap->link.active_tag, ap->link.sactive);
1499#endif 1535#endif
1500 1536