aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_nv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_nv.c')
-rw-r--r--drivers/ata/sata_nv.c53
1 files changed, 23 insertions, 30 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 40dc73139858..40557fe2ffdf 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -340,7 +340,6 @@ static struct scsi_host_template nv_adma_sht = {
340}; 340};
341 341
342static const struct ata_port_operations nv_generic_ops = { 342static const struct ata_port_operations nv_generic_ops = {
343 .port_disable = ata_port_disable,
344 .tf_load = ata_tf_load, 343 .tf_load = ata_tf_load,
345 .tf_read = ata_tf_read, 344 .tf_read = ata_tf_read,
346 .exec_command = ata_exec_command, 345 .exec_command = ata_exec_command,
@@ -359,14 +358,12 @@ static const struct ata_port_operations nv_generic_ops = {
359 .data_xfer = ata_data_xfer, 358 .data_xfer = ata_data_xfer,
360 .irq_clear = ata_bmdma_irq_clear, 359 .irq_clear = ata_bmdma_irq_clear,
361 .irq_on = ata_irq_on, 360 .irq_on = ata_irq_on,
362 .irq_ack = ata_irq_ack,
363 .scr_read = nv_scr_read, 361 .scr_read = nv_scr_read,
364 .scr_write = nv_scr_write, 362 .scr_write = nv_scr_write,
365 .port_start = ata_port_start, 363 .port_start = ata_port_start,
366}; 364};
367 365
368static const struct ata_port_operations nv_nf2_ops = { 366static const struct ata_port_operations nv_nf2_ops = {
369 .port_disable = ata_port_disable,
370 .tf_load = ata_tf_load, 367 .tf_load = ata_tf_load,
371 .tf_read = ata_tf_read, 368 .tf_read = ata_tf_read,
372 .exec_command = ata_exec_command, 369 .exec_command = ata_exec_command,
@@ -385,14 +382,12 @@ static const struct ata_port_operations nv_nf2_ops = {
385 .data_xfer = ata_data_xfer, 382 .data_xfer = ata_data_xfer,
386 .irq_clear = ata_bmdma_irq_clear, 383 .irq_clear = ata_bmdma_irq_clear,
387 .irq_on = ata_irq_on, 384 .irq_on = ata_irq_on,
388 .irq_ack = ata_irq_ack,
389 .scr_read = nv_scr_read, 385 .scr_read = nv_scr_read,
390 .scr_write = nv_scr_write, 386 .scr_write = nv_scr_write,
391 .port_start = ata_port_start, 387 .port_start = ata_port_start,
392}; 388};
393 389
394static const struct ata_port_operations nv_ck804_ops = { 390static const struct ata_port_operations nv_ck804_ops = {
395 .port_disable = ata_port_disable,
396 .tf_load = ata_tf_load, 391 .tf_load = ata_tf_load,
397 .tf_read = ata_tf_read, 392 .tf_read = ata_tf_read,
398 .exec_command = ata_exec_command, 393 .exec_command = ata_exec_command,
@@ -411,7 +406,6 @@ static const struct ata_port_operations nv_ck804_ops = {
411 .data_xfer = ata_data_xfer, 406 .data_xfer = ata_data_xfer,
412 .irq_clear = ata_bmdma_irq_clear, 407 .irq_clear = ata_bmdma_irq_clear,
413 .irq_on = ata_irq_on, 408 .irq_on = ata_irq_on,
414 .irq_ack = ata_irq_ack,
415 .scr_read = nv_scr_read, 409 .scr_read = nv_scr_read,
416 .scr_write = nv_scr_write, 410 .scr_write = nv_scr_write,
417 .port_start = ata_port_start, 411 .port_start = ata_port_start,
@@ -419,7 +413,6 @@ static const struct ata_port_operations nv_ck804_ops = {
419}; 413};
420 414
421static const struct ata_port_operations nv_adma_ops = { 415static const struct ata_port_operations nv_adma_ops = {
422 .port_disable = ata_port_disable,
423 .tf_load = ata_tf_load, 416 .tf_load = ata_tf_load,
424 .tf_read = nv_adma_tf_read, 417 .tf_read = nv_adma_tf_read,
425 .check_atapi_dma = nv_adma_check_atapi_dma, 418 .check_atapi_dma = nv_adma_check_atapi_dma,
@@ -430,6 +423,7 @@ static const struct ata_port_operations nv_adma_ops = {
430 .bmdma_start = ata_bmdma_start, 423 .bmdma_start = ata_bmdma_start,
431 .bmdma_stop = ata_bmdma_stop, 424 .bmdma_stop = ata_bmdma_stop,
432 .bmdma_status = ata_bmdma_status, 425 .bmdma_status = ata_bmdma_status,
426 .qc_defer = ata_std_qc_defer,
433 .qc_prep = nv_adma_qc_prep, 427 .qc_prep = nv_adma_qc_prep,
434 .qc_issue = nv_adma_qc_issue, 428 .qc_issue = nv_adma_qc_issue,
435 .freeze = nv_adma_freeze, 429 .freeze = nv_adma_freeze,
@@ -439,7 +433,6 @@ static const struct ata_port_operations nv_adma_ops = {
439 .data_xfer = ata_data_xfer, 433 .data_xfer = ata_data_xfer,
440 .irq_clear = nv_adma_irq_clear, 434 .irq_clear = nv_adma_irq_clear,
441 .irq_on = ata_irq_on, 435 .irq_on = ata_irq_on,
442 .irq_ack = ata_irq_ack,
443 .scr_read = nv_scr_read, 436 .scr_read = nv_scr_read,
444 .scr_write = nv_scr_write, 437 .scr_write = nv_scr_write,
445 .port_start = nv_adma_port_start, 438 .port_start = nv_adma_port_start,
@@ -455,8 +448,8 @@ static const struct ata_port_info nv_port_info[] = {
455 /* generic */ 448 /* generic */
456 { 449 {
457 .sht = &nv_sht, 450 .sht = &nv_sht,
458 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 451 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
459 ATA_FLAG_HRST_TO_RESUME, 452 .link_flags = ATA_LFLAG_HRST_TO_RESUME,
460 .pio_mask = NV_PIO_MASK, 453 .pio_mask = NV_PIO_MASK,
461 .mwdma_mask = NV_MWDMA_MASK, 454 .mwdma_mask = NV_MWDMA_MASK,
462 .udma_mask = NV_UDMA_MASK, 455 .udma_mask = NV_UDMA_MASK,
@@ -466,8 +459,8 @@ static const struct ata_port_info nv_port_info[] = {
466 /* nforce2/3 */ 459 /* nforce2/3 */
467 { 460 {
468 .sht = &nv_sht, 461 .sht = &nv_sht,
469 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 462 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
470 ATA_FLAG_HRST_TO_RESUME, 463 .link_flags = ATA_LFLAG_HRST_TO_RESUME,
471 .pio_mask = NV_PIO_MASK, 464 .pio_mask = NV_PIO_MASK,
472 .mwdma_mask = NV_MWDMA_MASK, 465 .mwdma_mask = NV_MWDMA_MASK,
473 .udma_mask = NV_UDMA_MASK, 466 .udma_mask = NV_UDMA_MASK,
@@ -477,8 +470,8 @@ static const struct ata_port_info nv_port_info[] = {
477 /* ck804 */ 470 /* ck804 */
478 { 471 {
479 .sht = &nv_sht, 472 .sht = &nv_sht,
480 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 473 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
481 ATA_FLAG_HRST_TO_RESUME, 474 .link_flags = ATA_LFLAG_HRST_TO_RESUME,
482 .pio_mask = NV_PIO_MASK, 475 .pio_mask = NV_PIO_MASK,
483 .mwdma_mask = NV_MWDMA_MASK, 476 .mwdma_mask = NV_MWDMA_MASK,
484 .udma_mask = NV_UDMA_MASK, 477 .udma_mask = NV_UDMA_MASK,
@@ -489,8 +482,8 @@ static const struct ata_port_info nv_port_info[] = {
489 { 482 {
490 .sht = &nv_adma_sht, 483 .sht = &nv_adma_sht,
491 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 484 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
492 ATA_FLAG_HRST_TO_RESUME |
493 ATA_FLAG_MMIO | ATA_FLAG_NCQ, 485 ATA_FLAG_MMIO | ATA_FLAG_NCQ,
486 .link_flags = ATA_LFLAG_HRST_TO_RESUME,
494 .pio_mask = NV_PIO_MASK, 487 .pio_mask = NV_PIO_MASK,
495 .mwdma_mask = NV_MWDMA_MASK, 488 .mwdma_mask = NV_MWDMA_MASK,
496 .udma_mask = NV_UDMA_MASK, 489 .udma_mask = NV_UDMA_MASK,
@@ -594,7 +587,7 @@ static int nv_adma_slave_config(struct scsi_device *sdev)
594 /* Not a proper libata device, ignore */ 587 /* Not a proper libata device, ignore */
595 return rc; 588 return rc;
596 589
597 if (ap->device[sdev->id].class == ATA_DEV_ATAPI) { 590 if (ap->link.device[sdev->id].class == ATA_DEV_ATAPI) {
598 /* 591 /*
599 * NVIDIA reports that ADMA mode does not support ATAPI commands. 592 * NVIDIA reports that ADMA mode does not support ATAPI commands.
600 * Therefore ATAPI commands are sent through the legacy interface. 593 * Therefore ATAPI commands are sent through the legacy interface.
@@ -711,7 +704,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)
711 flags & (NV_CPB_RESP_ATA_ERR | 704 flags & (NV_CPB_RESP_ATA_ERR |
712 NV_CPB_RESP_CMD_ERR | 705 NV_CPB_RESP_CMD_ERR |
713 NV_CPB_RESP_CPB_ERR)))) { 706 NV_CPB_RESP_CPB_ERR)))) {
714 struct ata_eh_info *ehi = &ap->eh_info; 707 struct ata_eh_info *ehi = &ap->link.eh_info;
715 int freeze = 0; 708 int freeze = 0;
716 709
717 ata_ehi_clear_desc(ehi); 710 ata_ehi_clear_desc(ehi);
@@ -747,7 +740,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)
747 DPRINTK("Completing qc from tag %d\n",cpb_num); 740 DPRINTK("Completing qc from tag %d\n",cpb_num);
748 ata_qc_complete(qc); 741 ata_qc_complete(qc);
749 } else { 742 } else {
750 struct ata_eh_info *ehi = &ap->eh_info; 743 struct ata_eh_info *ehi = &ap->link.eh_info;
751 /* Notifier bits set without a command may indicate the drive 744 /* Notifier bits set without a command may indicate the drive
752 is misbehaving. Raise host state machine violation on this 745 is misbehaving. Raise host state machine violation on this
753 condition. */ 746 condition. */
@@ -764,7 +757,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)
764 757
765static int nv_host_intr(struct ata_port *ap, u8 irq_stat) 758static int nv_host_intr(struct ata_port *ap, u8 irq_stat)
766{ 759{
767 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); 760 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
768 761
769 /* freeze if hotplugged */ 762 /* freeze if hotplugged */
770 if (unlikely(irq_stat & (NV_INT_ADDED | NV_INT_REMOVED))) { 763 if (unlikely(irq_stat & (NV_INT_ADDED | NV_INT_REMOVED))) {
@@ -817,7 +810,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
817 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) { 810 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) {
818 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804) 811 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804)
819 >> (NV_INT_PORT_SHIFT * i); 812 >> (NV_INT_PORT_SHIFT * i);
820 if(ata_tag_valid(ap->active_tag)) 813 if(ata_tag_valid(ap->link.active_tag))
821 /** NV_INT_DEV indication seems unreliable at times 814 /** NV_INT_DEV indication seems unreliable at times
822 at least in ADMA mode. Force it on always when a 815 at least in ADMA mode. Force it on always when a
823 command is active, to prevent losing interrupts. */ 816 command is active, to prevent losing interrupts. */
@@ -852,7 +845,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
852 NV_ADMA_STAT_HOTUNPLUG | 845 NV_ADMA_STAT_HOTUNPLUG |
853 NV_ADMA_STAT_TIMEOUT | 846 NV_ADMA_STAT_TIMEOUT |
854 NV_ADMA_STAT_SERROR))) { 847 NV_ADMA_STAT_SERROR))) {
855 struct ata_eh_info *ehi = &ap->eh_info; 848 struct ata_eh_info *ehi = &ap->link.eh_info;
856 849
857 ata_ehi_clear_desc(ehi); 850 ata_ehi_clear_desc(ehi);
858 __ata_ehi_push_desc(ehi, "ADMA status 0x%08x: ", status ); 851 __ata_ehi_push_desc(ehi, "ADMA status 0x%08x: ", status );
@@ -879,10 +872,10 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
879 u32 check_commands; 872 u32 check_commands;
880 int pos, error = 0; 873 int pos, error = 0;
881 874
882 if(ata_tag_valid(ap->active_tag)) 875 if(ata_tag_valid(ap->link.active_tag))
883 check_commands = 1 << ap->active_tag; 876 check_commands = 1 << ap->link.active_tag;
884 else 877 else
885 check_commands = ap->sactive; 878 check_commands = ap->link.sactive;
886 879
887 /** Check CPBs for completed commands */ 880 /** Check CPBs for completed commands */
888 while ((pos = ffs(check_commands)) && !error) { 881 while ((pos = ffs(check_commands)) && !error) {
@@ -1333,7 +1326,7 @@ static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance)
1333 !(ap->flags & ATA_FLAG_DISABLED)) { 1326 !(ap->flags & ATA_FLAG_DISABLED)) {
1334 struct ata_queued_cmd *qc; 1327 struct ata_queued_cmd *qc;
1335 1328
1336 qc = ata_qc_from_tag(ap, ap->active_tag); 1329 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1337 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) 1330 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)))
1338 handled += ata_host_intr(ap, qc); 1331 handled += ata_host_intr(ap, qc);
1339 else 1332 else
@@ -1459,7 +1452,7 @@ static void nv_ck804_thaw(struct ata_port *ap)
1459 writeb(mask, mmio_base + NV_INT_ENABLE_CK804); 1452 writeb(mask, mmio_base + NV_INT_ENABLE_CK804);
1460} 1453}
1461 1454
1462static int nv_hardreset(struct ata_port *ap, unsigned int *class, 1455static int nv_hardreset(struct ata_link *link, unsigned int *class,
1463 unsigned long deadline) 1456 unsigned long deadline)
1464{ 1457{
1465 unsigned int dummy; 1458 unsigned int dummy;
@@ -1468,7 +1461,7 @@ static int nv_hardreset(struct ata_port *ap, unsigned int *class,
1468 * some controllers. Don't classify on hardreset. For more 1461 * some controllers. Don't classify on hardreset. For more
1469 * info, see http://bugme.osdl.org/show_bug.cgi?id=3352 1462 * info, see http://bugme.osdl.org/show_bug.cgi?id=3352
1470 */ 1463 */
1471 return sata_std_hardreset(ap, &dummy, deadline); 1464 return sata_std_hardreset(link, &dummy, deadline);
1472} 1465}
1473 1466
1474static void nv_error_handler(struct ata_port *ap) 1467static void nv_error_handler(struct ata_port *ap)
@@ -1485,7 +1478,7 @@ static void nv_adma_error_handler(struct ata_port *ap)
1485 int i; 1478 int i;
1486 u16 tmp; 1479 u16 tmp;
1487 1480
1488 if(ata_tag_valid(ap->active_tag) || ap->sactive) { 1481 if(ata_tag_valid(ap->link.active_tag) || ap->link.sactive) {
1489 u32 notifier = readl(mmio + NV_ADMA_NOTIFIER); 1482 u32 notifier = readl(mmio + NV_ADMA_NOTIFIER);
1490 u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR); 1483 u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR);
1491 u32 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL); 1484 u32 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL);
@@ -1501,8 +1494,8 @@ static void nv_adma_error_handler(struct ata_port *ap)
1501 1494
1502 for( i=0;i<NV_ADMA_MAX_CPBS;i++) { 1495 for( i=0;i<NV_ADMA_MAX_CPBS;i++) {
1503 struct nv_adma_cpb *cpb = &pp->cpb[i]; 1496 struct nv_adma_cpb *cpb = &pp->cpb[i];
1504 if( (ata_tag_valid(ap->active_tag) && i == ap->active_tag) || 1497 if( (ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) ||
1505 ap->sactive & (1 << i) ) 1498 ap->link.sactive & (1 << i) )
1506 ata_port_printk(ap, KERN_ERR, 1499 ata_port_printk(ap, KERN_ERR,
1507 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", 1500 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n",
1508 i, cpb->ctl_flags, cpb->resp_flags); 1501 i, cpb->ctl_flags, cpb->resp_flags);