diff options
Diffstat (limited to 'drivers/scsi/sata_promise.c')
-rw-r--r-- | drivers/scsi/sata_promise.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 538ad727bd2e..b41c977d6fab 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/sched.h> | 40 | #include <linux/sched.h> |
41 | #include <linux/device.h> | ||
41 | #include "scsi.h" | 42 | #include "scsi.h" |
42 | #include <scsi/scsi_host.h> | 43 | #include <scsi/scsi_host.h> |
43 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
@@ -87,8 +88,8 @@ static void pdc_port_stop(struct ata_port *ap); | |||
87 | static void pdc_pata_phy_reset(struct ata_port *ap); | 88 | static void pdc_pata_phy_reset(struct ata_port *ap); |
88 | static void pdc_sata_phy_reset(struct ata_port *ap); | 89 | static void pdc_sata_phy_reset(struct ata_port *ap); |
89 | static void pdc_qc_prep(struct ata_queued_cmd *qc); | 90 | static void pdc_qc_prep(struct ata_queued_cmd *qc); |
90 | static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); | 91 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
91 | static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); | 92 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
92 | static void pdc_irq_clear(struct ata_port *ap); | 93 | static void pdc_irq_clear(struct ata_port *ap); |
93 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); | 94 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); |
94 | 95 | ||
@@ -113,7 +114,7 @@ static Scsi_Host_Template pdc_ata_sht = { | |||
113 | .ordered_flush = 1, | 114 | .ordered_flush = 1, |
114 | }; | 115 | }; |
115 | 116 | ||
116 | static struct ata_port_operations pdc_sata_ops = { | 117 | static const struct ata_port_operations pdc_sata_ops = { |
117 | .port_disable = ata_port_disable, | 118 | .port_disable = ata_port_disable, |
118 | .tf_load = pdc_tf_load_mmio, | 119 | .tf_load = pdc_tf_load_mmio, |
119 | .tf_read = ata_tf_read, | 120 | .tf_read = ata_tf_read, |
@@ -136,7 +137,7 @@ static struct ata_port_operations pdc_sata_ops = { | |||
136 | .host_stop = ata_pci_host_stop, | 137 | .host_stop = ata_pci_host_stop, |
137 | }; | 138 | }; |
138 | 139 | ||
139 | static struct ata_port_operations pdc_pata_ops = { | 140 | static const struct ata_port_operations pdc_pata_ops = { |
140 | .port_disable = ata_port_disable, | 141 | .port_disable = ata_port_disable, |
141 | .tf_load = pdc_tf_load_mmio, | 142 | .tf_load = pdc_tf_load_mmio, |
142 | .tf_read = ata_tf_read, | 143 | .tf_read = ata_tf_read, |
@@ -195,6 +196,8 @@ static struct ata_port_info pdc_port_info[] = { | |||
195 | static struct pci_device_id pdc_ata_pci_tbl[] = { | 196 | static struct pci_device_id pdc_ata_pci_tbl[] = { |
196 | { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 197 | { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
197 | board_2037x }, | 198 | board_2037x }, |
199 | { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
200 | board_2037x }, | ||
198 | { PCI_VENDOR_ID_PROMISE, 0x3571, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 201 | { PCI_VENDOR_ID_PROMISE, 0x3571, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
199 | board_2037x }, | 202 | board_2037x }, |
200 | { PCI_VENDOR_ID_PROMISE, 0x3373, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 203 | { PCI_VENDOR_ID_PROMISE, 0x3373, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
@@ -207,6 +210,8 @@ static struct pci_device_id pdc_ata_pci_tbl[] = { | |||
207 | board_2037x }, | 210 | board_2037x }, |
208 | { PCI_VENDOR_ID_PROMISE, 0x3d75, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 211 | { PCI_VENDOR_ID_PROMISE, 0x3d75, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
209 | board_2037x }, | 212 | board_2037x }, |
213 | { PCI_VENDOR_ID_PROMISE, 0x3d73, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
214 | board_2037x }, | ||
210 | 215 | ||
211 | { PCI_VENDOR_ID_PROMISE, 0x3318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 216 | { PCI_VENDOR_ID_PROMISE, 0x3318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
212 | board_20319 }, | 217 | board_20319 }, |
@@ -324,7 +329,7 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | |||
324 | { | 329 | { |
325 | if (sc_reg > SCR_CONTROL) | 330 | if (sc_reg > SCR_CONTROL) |
326 | return 0xffffffffU; | 331 | return 0xffffffffU; |
327 | return readl((void *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 332 | return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
328 | } | 333 | } |
329 | 334 | ||
330 | 335 | ||
@@ -333,7 +338,7 @@ static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, | |||
333 | { | 338 | { |
334 | if (sc_reg > SCR_CONTROL) | 339 | if (sc_reg > SCR_CONTROL) |
335 | return; | 340 | return; |
336 | writel(val, (void *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 341 | writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
337 | } | 342 | } |
338 | 343 | ||
339 | static void pdc_qc_prep(struct ata_queued_cmd *qc) | 344 | static void pdc_qc_prep(struct ata_queued_cmd *qc) |
@@ -395,7 +400,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
395 | case ATA_PROT_DMA: | 400 | case ATA_PROT_DMA: |
396 | case ATA_PROT_NODATA: | 401 | case ATA_PROT_NODATA: |
397 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 402 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
398 | ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR); | 403 | drv_stat = ata_wait_idle(ap); |
404 | ata_qc_complete(qc, __ac_err_mask(drv_stat)); | ||
399 | break; | 405 | break; |
400 | 406 | ||
401 | default: | 407 | default: |
@@ -404,7 +410,7 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
404 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", | 410 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", |
405 | ap->id, qc->tf.command, drv_stat); | 411 | ap->id, qc->tf.command, drv_stat); |
406 | 412 | ||
407 | ata_qc_complete(qc, drv_stat); | 413 | ata_qc_complete(qc, ac_err_mask(drv_stat)); |
408 | break; | 414 | break; |
409 | } | 415 | } |
410 | 416 | ||
@@ -416,33 +422,30 @@ out: | |||
416 | static inline unsigned int pdc_host_intr( struct ata_port *ap, | 422 | static inline unsigned int pdc_host_intr( struct ata_port *ap, |
417 | struct ata_queued_cmd *qc) | 423 | struct ata_queued_cmd *qc) |
418 | { | 424 | { |
419 | u8 status; | 425 | unsigned int handled = 0, err_mask = 0; |
420 | unsigned int handled = 0, have_err = 0; | ||
421 | u32 tmp; | 426 | u32 tmp; |
422 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; | 427 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; |
423 | 428 | ||
424 | tmp = readl(mmio); | 429 | tmp = readl(mmio); |
425 | if (tmp & PDC_ERR_MASK) { | 430 | if (tmp & PDC_ERR_MASK) { |
426 | have_err = 1; | 431 | err_mask = AC_ERR_DEV; |
427 | pdc_reset_port(ap); | 432 | pdc_reset_port(ap); |
428 | } | 433 | } |
429 | 434 | ||
430 | switch (qc->tf.protocol) { | 435 | switch (qc->tf.protocol) { |
431 | case ATA_PROT_DMA: | 436 | case ATA_PROT_DMA: |
432 | case ATA_PROT_NODATA: | 437 | case ATA_PROT_NODATA: |
433 | status = ata_wait_idle(ap); | 438 | err_mask |= ac_err_mask(ata_wait_idle(ap)); |
434 | if (have_err) | 439 | ata_qc_complete(qc, err_mask); |
435 | status |= ATA_ERR; | ||
436 | ata_qc_complete(qc, status); | ||
437 | handled = 1; | 440 | handled = 1; |
438 | break; | 441 | break; |
439 | 442 | ||
440 | default: | 443 | default: |
441 | ap->stats.idle_irq++; | 444 | ap->stats.idle_irq++; |
442 | break; | 445 | break; |
443 | } | 446 | } |
444 | 447 | ||
445 | return handled; | 448 | return handled; |
446 | } | 449 | } |
447 | 450 | ||
448 | static void pdc_irq_clear(struct ata_port *ap) | 451 | static void pdc_irq_clear(struct ata_port *ap) |
@@ -523,8 +526,8 @@ static inline void pdc_packet_start(struct ata_queued_cmd *qc) | |||
523 | 526 | ||
524 | pp->pkt[2] = seq; | 527 | pp->pkt[2] = seq; |
525 | wmb(); /* flush PRD, pkt writes */ | 528 | wmb(); /* flush PRD, pkt writes */ |
526 | writel(pp->pkt_dma, (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); | 529 | writel(pp->pkt_dma, (void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); |
527 | readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ | 530 | readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ |
528 | } | 531 | } |
529 | 532 | ||
530 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) | 533 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) |
@@ -546,7 +549,7 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) | |||
546 | return ata_qc_issue_prot(qc); | 549 | return ata_qc_issue_prot(qc); |
547 | } | 550 | } |
548 | 551 | ||
549 | static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) | 552 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
550 | { | 553 | { |
551 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 554 | WARN_ON (tf->protocol == ATA_PROT_DMA || |
552 | tf->protocol == ATA_PROT_NODATA); | 555 | tf->protocol == ATA_PROT_NODATA); |
@@ -554,7 +557,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
554 | } | 557 | } |
555 | 558 | ||
556 | 559 | ||
557 | static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) | 560 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
558 | { | 561 | { |
559 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 562 | WARN_ON (tf->protocol == ATA_PROT_DMA || |
560 | tf->protocol == ATA_PROT_NODATA); | 563 | tf->protocol == ATA_PROT_NODATA); |
@@ -631,7 +634,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
631 | int rc; | 634 | int rc; |
632 | 635 | ||
633 | if (!printed_version++) | 636 | if (!printed_version++) |
634 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 637 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
635 | 638 | ||
636 | /* | 639 | /* |
637 | * If this driver happens to only be useful on Apple's K2, then | 640 | * If this driver happens to only be useful on Apple's K2, then |