summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2004-07-03 18:12:44 -0400
committerJeff Garzik <jgarzik@pobox.com>2004-07-03 18:12:44 -0400
commit2b50a905c4687d32459f93d980bbbdc541ee9431 (patch)
tree82cfc0c4bcc78640435a7df9ce732784d2c60f68
parent827081674bda3777277a4586a689de758e539924 (diff)
[libata sata_promise] update driver to use new ->qc_issue hook
The ->qc_issue hook was designed to allow drivers to override some or all of the actual delivery of the taskfile to hardware. In the case of Promise, the hardware has its own packet format when doing read/write DMA commands, but uses traditional ATA taskfile registers for other types of commands.
-rw-r--r--drivers/scsi/sata_promise.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index dcaebcf7110c..a2eefb6bcb32 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -74,7 +74,6 @@ struct pdc_port_priv {
static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg);
static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
-static void pdc_dma_setup(struct ata_queued_cmd *qc);
static void pdc_dma_start(struct ata_queued_cmd *qc);
static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
static void pdc_eng_timeout(struct ata_port *ap);
@@ -87,6 +86,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
static inline void pdc_dma_complete (struct ata_port *ap,
struct ata_queued_cmd *qc, int have_err);
static void pdc_irq_clear(struct ata_port *ap);
+static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
static Scsi_Host_Template pdc_sata_sht = {
.module = THIS_MODULE,
@@ -113,10 +113,8 @@ static struct ata_port_operations pdc_sata_ops = {
.check_status = ata_check_status_mmio,
.exec_command = pdc_exec_command_mmio,
.phy_reset = pdc_phy_reset,
- .bmdma_setup = pdc_dma_setup,
- .bmdma_start = pdc_dma_start,
.qc_prep = pdc_qc_prep,
- .qc_issue = ata_qc_issue_prot,
+ .qc_issue = pdc_qc_issue_prot,
.eng_timeout = pdc_eng_timeout,
.irq_handler = pdc_interrupt,
.irq_clear = pdc_irq_clear,
@@ -442,13 +440,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
return IRQ_RETVAL(handled);
}
-static void pdc_dma_setup(struct ata_queued_cmd *qc)
-{
- /* nothing for now. later, we will call standard
- * code in libata-core for ATAPI here */
-}
-
-static void pdc_dma_start(struct ata_queued_cmd *qc)
+static inline void pdc_dma_start(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct pdc_port_priv *pp = ap->private_data;
@@ -466,17 +458,35 @@ static void pdc_dma_start(struct ata_queued_cmd *qc)
readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */
}
+static int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
+{
+ switch (qc->tf.protocol) {
+ case ATA_PROT_DMA:
+ pdc_dma_start(qc);
+ return 0;
+
+ case ATA_PROT_ATAPI_DMA:
+ BUG();
+ break;
+
+ default:
+ break;
+ }
+
+ return ata_qc_issue_prot(qc);
+}
+
static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
{
- if (tf->protocol != ATA_PROT_DMA)
- ata_tf_load_mmio(ap, tf);
+ WARN_ON (tf->protocol == ATA_PROT_DMA);
+ ata_tf_load_mmio(ap, tf);
}
static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
{
- if (tf->protocol != ATA_PROT_DMA)
- ata_exec_command_mmio(ap, tf);
+ WARN_ON (tf->protocol == ATA_PROT_DMA);
+ ata_exec_command_mmio(ap, tf);
}