aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_sis.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_sis.c')
-rw-r--r--drivers/ata/pata_sis.c230
1 files changed, 26 insertions, 204 deletions
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index dc7e91562e43..e82c66e8d31b 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -156,24 +156,11 @@ static int sis_pre_reset(struct ata_link *link, unsigned long deadline)
156 /* Clear the FIFO settings. We can't enable the FIFO until 156 /* Clear the FIFO settings. We can't enable the FIFO until
157 we know we are poking at a disk */ 157 we know we are poking at a disk */
158 pci_write_config_byte(pdev, 0x4B, 0); 158 pci_write_config_byte(pdev, 0x4B, 0);
159 return ata_std_prereset(link, deadline); 159 return ata_sff_prereset(link, deadline);
160} 160}
161 161
162 162
163/** 163/**
164 * sis_error_handler - Probe specified port on PATA host controller
165 * @ap: Port to probe
166 *
167 * LOCKING:
168 * None (inherited from caller).
169 */
170
171static void sis_error_handler(struct ata_port *ap)
172{
173 ata_bmdma_drive_eh(ap, sis_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
174}
175
176/**
177 * sis_set_fifo - Set RWP fifo bits for this device 164 * sis_set_fifo - Set RWP fifo bits for this device
178 * @ap: Port 165 * @ap: Port
179 * @adev: Device 166 * @adev: Device
@@ -514,217 +501,57 @@ static void sis_133_set_dmamode (struct ata_port *ap, struct ata_device *adev)
514} 501}
515 502
516static struct scsi_host_template sis_sht = { 503static struct scsi_host_template sis_sht = {
517 .module = THIS_MODULE, 504 ATA_BMDMA_SHT(DRV_NAME),
518 .name = DRV_NAME,
519 .ioctl = ata_scsi_ioctl,
520 .queuecommand = ata_scsi_queuecmd,
521 .can_queue = ATA_DEF_QUEUE,
522 .this_id = ATA_SHT_THIS_ID,
523 .sg_tablesize = LIBATA_MAX_PRD,
524 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
525 .emulated = ATA_SHT_EMULATED,
526 .use_clustering = ATA_SHT_USE_CLUSTERING,
527 .proc_name = DRV_NAME,
528 .dma_boundary = ATA_DMA_BOUNDARY,
529 .slave_configure = ata_scsi_slave_config,
530 .slave_destroy = ata_scsi_slave_destroy,
531 .bios_param = ata_std_bios_param,
532}; 505};
533 506
534static const struct ata_port_operations sis_133_ops = { 507static struct ata_port_operations sis_133_for_sata_ops = {
508 .inherits = &ata_bmdma_port_ops,
535 .set_piomode = sis_133_set_piomode, 509 .set_piomode = sis_133_set_piomode,
536 .set_dmamode = sis_133_set_dmamode, 510 .set_dmamode = sis_133_set_dmamode,
537 .mode_filter = ata_pci_default_filter,
538
539 .tf_load = ata_tf_load,
540 .tf_read = ata_tf_read,
541 .check_status = ata_check_status,
542 .exec_command = ata_exec_command,
543 .dev_select = ata_std_dev_select,
544
545 .freeze = ata_bmdma_freeze,
546 .thaw = ata_bmdma_thaw,
547 .error_handler = sis_error_handler,
548 .post_internal_cmd = ata_bmdma_post_internal_cmd,
549 .cable_detect = sis_133_cable_detect, 511 .cable_detect = sis_133_cable_detect,
512};
550 513
551 .bmdma_setup = ata_bmdma_setup, 514static struct ata_port_operations sis_base_ops = {
552 .bmdma_start = ata_bmdma_start, 515 .inherits = &ata_bmdma_port_ops,
553 .bmdma_stop = ata_bmdma_stop, 516 .prereset = sis_pre_reset,
554 .bmdma_status = ata_bmdma_status,
555 .qc_prep = ata_qc_prep,
556 .qc_issue = ata_qc_issue_prot,
557 .data_xfer = ata_data_xfer,
558
559 .irq_handler = ata_interrupt,
560 .irq_clear = ata_bmdma_irq_clear,
561 .irq_on = ata_irq_on,
562
563 .port_start = ata_sff_port_start,
564}; 517};
565 518
566static const struct ata_port_operations sis_133_for_sata_ops = { 519static struct ata_port_operations sis_133_ops = {
520 .inherits = &sis_base_ops,
567 .set_piomode = sis_133_set_piomode, 521 .set_piomode = sis_133_set_piomode,
568 .set_dmamode = sis_133_set_dmamode, 522 .set_dmamode = sis_133_set_dmamode,
569 .mode_filter = ata_pci_default_filter,
570
571 .tf_load = ata_tf_load,
572 .tf_read = ata_tf_read,
573 .check_status = ata_check_status,
574 .exec_command = ata_exec_command,
575 .dev_select = ata_std_dev_select,
576
577 .freeze = ata_bmdma_freeze,
578 .thaw = ata_bmdma_thaw,
579 .error_handler = ata_bmdma_error_handler,
580 .post_internal_cmd = ata_bmdma_post_internal_cmd,
581 .cable_detect = sis_133_cable_detect, 523 .cable_detect = sis_133_cable_detect,
582
583 .bmdma_setup = ata_bmdma_setup,
584 .bmdma_start = ata_bmdma_start,
585 .bmdma_stop = ata_bmdma_stop,
586 .bmdma_status = ata_bmdma_status,
587 .qc_prep = ata_qc_prep,
588 .qc_issue = ata_qc_issue_prot,
589 .data_xfer = ata_data_xfer,
590
591 .irq_handler = ata_interrupt,
592 .irq_clear = ata_bmdma_irq_clear,
593 .irq_on = ata_irq_on,
594
595 .port_start = ata_sff_port_start,
596}; 524};
597 525
598static const struct ata_port_operations sis_133_early_ops = { 526static struct ata_port_operations sis_133_early_ops = {
527 .inherits = &sis_base_ops,
599 .set_piomode = sis_100_set_piomode, 528 .set_piomode = sis_100_set_piomode,
600 .set_dmamode = sis_133_early_set_dmamode, 529 .set_dmamode = sis_133_early_set_dmamode,
601 .mode_filter = ata_pci_default_filter,
602
603 .tf_load = ata_tf_load,
604 .tf_read = ata_tf_read,
605 .check_status = ata_check_status,
606 .exec_command = ata_exec_command,
607 .dev_select = ata_std_dev_select,
608
609 .freeze = ata_bmdma_freeze,
610 .thaw = ata_bmdma_thaw,
611 .error_handler = sis_error_handler,
612 .post_internal_cmd = ata_bmdma_post_internal_cmd,
613 .cable_detect = sis_66_cable_detect, 530 .cable_detect = sis_66_cable_detect,
614
615 .bmdma_setup = ata_bmdma_setup,
616 .bmdma_start = ata_bmdma_start,
617 .bmdma_stop = ata_bmdma_stop,
618 .bmdma_status = ata_bmdma_status,
619 .qc_prep = ata_qc_prep,
620 .qc_issue = ata_qc_issue_prot,
621 .data_xfer = ata_data_xfer,
622
623 .irq_handler = ata_interrupt,
624 .irq_clear = ata_bmdma_irq_clear,
625 .irq_on = ata_irq_on,
626
627 .port_start = ata_sff_port_start,
628}; 531};
629 532
630static const struct ata_port_operations sis_100_ops = { 533static struct ata_port_operations sis_100_ops = {
534 .inherits = &sis_base_ops,
631 .set_piomode = sis_100_set_piomode, 535 .set_piomode = sis_100_set_piomode,
632 .set_dmamode = sis_100_set_dmamode, 536 .set_dmamode = sis_100_set_dmamode,
633 .mode_filter = ata_pci_default_filter,
634
635 .tf_load = ata_tf_load,
636 .tf_read = ata_tf_read,
637 .check_status = ata_check_status,
638 .exec_command = ata_exec_command,
639 .dev_select = ata_std_dev_select,
640
641 .freeze = ata_bmdma_freeze,
642 .thaw = ata_bmdma_thaw,
643 .error_handler = sis_error_handler,
644 .post_internal_cmd = ata_bmdma_post_internal_cmd,
645 .cable_detect = sis_66_cable_detect, 537 .cable_detect = sis_66_cable_detect,
646
647 .bmdma_setup = ata_bmdma_setup,
648 .bmdma_start = ata_bmdma_start,
649 .bmdma_stop = ata_bmdma_stop,
650 .bmdma_status = ata_bmdma_status,
651 .qc_prep = ata_qc_prep,
652 .qc_issue = ata_qc_issue_prot,
653 .data_xfer = ata_data_xfer,
654
655 .irq_handler = ata_interrupt,
656 .irq_clear = ata_bmdma_irq_clear,
657 .irq_on = ata_irq_on,
658
659 .port_start = ata_sff_port_start,
660}; 538};
661 539
662static const struct ata_port_operations sis_66_ops = { 540static struct ata_port_operations sis_66_ops = {
541 .inherits = &sis_base_ops,
663 .set_piomode = sis_old_set_piomode, 542 .set_piomode = sis_old_set_piomode,
664 .set_dmamode = sis_66_set_dmamode, 543 .set_dmamode = sis_66_set_dmamode,
665 .mode_filter = ata_pci_default_filter,
666
667 .tf_load = ata_tf_load,
668 .tf_read = ata_tf_read,
669 .check_status = ata_check_status,
670 .exec_command = ata_exec_command,
671 .dev_select = ata_std_dev_select,
672 .cable_detect = sis_66_cable_detect, 544 .cable_detect = sis_66_cable_detect,
673
674 .freeze = ata_bmdma_freeze,
675 .thaw = ata_bmdma_thaw,
676 .error_handler = sis_error_handler,
677 .post_internal_cmd = ata_bmdma_post_internal_cmd,
678
679 .bmdma_setup = ata_bmdma_setup,
680 .bmdma_start = ata_bmdma_start,
681 .bmdma_stop = ata_bmdma_stop,
682 .bmdma_status = ata_bmdma_status,
683 .qc_prep = ata_qc_prep,
684 .qc_issue = ata_qc_issue_prot,
685 .data_xfer = ata_data_xfer,
686
687 .irq_handler = ata_interrupt,
688 .irq_clear = ata_bmdma_irq_clear,
689 .irq_on = ata_irq_on,
690
691 .port_start = ata_sff_port_start,
692}; 545};
693 546
694static const struct ata_port_operations sis_old_ops = { 547static struct ata_port_operations sis_old_ops = {
548 .inherits = &sis_base_ops,
695 .set_piomode = sis_old_set_piomode, 549 .set_piomode = sis_old_set_piomode,
696 .set_dmamode = sis_old_set_dmamode, 550 .set_dmamode = sis_old_set_dmamode,
697 .mode_filter = ata_pci_default_filter,
698
699 .tf_load = ata_tf_load,
700 .tf_read = ata_tf_read,
701 .check_status = ata_check_status,
702 .exec_command = ata_exec_command,
703 .dev_select = ata_std_dev_select,
704
705 .freeze = ata_bmdma_freeze,
706 .thaw = ata_bmdma_thaw,
707 .error_handler = sis_error_handler,
708 .post_internal_cmd = ata_bmdma_post_internal_cmd,
709 .cable_detect = ata_cable_40wire, 551 .cable_detect = ata_cable_40wire,
710
711 .bmdma_setup = ata_bmdma_setup,
712 .bmdma_start = ata_bmdma_start,
713 .bmdma_stop = ata_bmdma_stop,
714 .bmdma_status = ata_bmdma_status,
715 .qc_prep = ata_qc_prep,
716 .qc_issue = ata_qc_issue_prot,
717 .data_xfer = ata_data_xfer,
718
719 .irq_handler = ata_interrupt,
720 .irq_clear = ata_bmdma_irq_clear,
721 .irq_on = ata_irq_on,
722
723 .port_start = ata_sff_port_start,
724}; 552};
725 553
726static const struct ata_port_info sis_info = { 554static const struct ata_port_info sis_info = {
727 .sht = &sis_sht,
728 .flags = ATA_FLAG_SLAVE_POSS, 555 .flags = ATA_FLAG_SLAVE_POSS,
729 .pio_mask = 0x1f, /* pio0-4 */ 556 .pio_mask = 0x1f, /* pio0-4 */
730 .mwdma_mask = 0x07, 557 .mwdma_mask = 0x07,
@@ -732,7 +559,6 @@ static const struct ata_port_info sis_info = {
732 .port_ops = &sis_old_ops, 559 .port_ops = &sis_old_ops,
733}; 560};
734static const struct ata_port_info sis_info33 = { 561static const struct ata_port_info sis_info33 = {
735 .sht = &sis_sht,
736 .flags = ATA_FLAG_SLAVE_POSS, 562 .flags = ATA_FLAG_SLAVE_POSS,
737 .pio_mask = 0x1f, /* pio0-4 */ 563 .pio_mask = 0x1f, /* pio0-4 */
738 .mwdma_mask = 0x07, 564 .mwdma_mask = 0x07,
@@ -740,42 +566,36 @@ static const struct ata_port_info sis_info33 = {
740 .port_ops = &sis_old_ops, 566 .port_ops = &sis_old_ops,
741}; 567};
742static const struct ata_port_info sis_info66 = { 568static const struct ata_port_info sis_info66 = {
743 .sht = &sis_sht,
744 .flags = ATA_FLAG_SLAVE_POSS, 569 .flags = ATA_FLAG_SLAVE_POSS,
745 .pio_mask = 0x1f, /* pio0-4 */ 570 .pio_mask = 0x1f, /* pio0-4 */
746 .udma_mask = ATA_UDMA4, /* UDMA 66 */ 571 .udma_mask = ATA_UDMA4, /* UDMA 66 */
747 .port_ops = &sis_66_ops, 572 .port_ops = &sis_66_ops,
748}; 573};
749static const struct ata_port_info sis_info100 = { 574static const struct ata_port_info sis_info100 = {
750 .sht = &sis_sht,
751 .flags = ATA_FLAG_SLAVE_POSS, 575 .flags = ATA_FLAG_SLAVE_POSS,
752 .pio_mask = 0x1f, /* pio0-4 */ 576 .pio_mask = 0x1f, /* pio0-4 */
753 .udma_mask = ATA_UDMA5, 577 .udma_mask = ATA_UDMA5,
754 .port_ops = &sis_100_ops, 578 .port_ops = &sis_100_ops,
755}; 579};
756static const struct ata_port_info sis_info100_early = { 580static const struct ata_port_info sis_info100_early = {
757 .sht = &sis_sht,
758 .flags = ATA_FLAG_SLAVE_POSS, 581 .flags = ATA_FLAG_SLAVE_POSS,
759 .udma_mask = ATA_UDMA5, 582 .udma_mask = ATA_UDMA5,
760 .pio_mask = 0x1f, /* pio0-4 */ 583 .pio_mask = 0x1f, /* pio0-4 */
761 .port_ops = &sis_66_ops, 584 .port_ops = &sis_66_ops,
762}; 585};
763static const struct ata_port_info sis_info133 = { 586static const struct ata_port_info sis_info133 = {
764 .sht = &sis_sht,
765 .flags = ATA_FLAG_SLAVE_POSS, 587 .flags = ATA_FLAG_SLAVE_POSS,
766 .pio_mask = 0x1f, /* pio0-4 */ 588 .pio_mask = 0x1f, /* pio0-4 */
767 .udma_mask = ATA_UDMA6, 589 .udma_mask = ATA_UDMA6,
768 .port_ops = &sis_133_ops, 590 .port_ops = &sis_133_ops,
769}; 591};
770const struct ata_port_info sis_info133_for_sata = { 592const struct ata_port_info sis_info133_for_sata = {
771 .sht = &sis_sht,
772 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 593 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
773 .pio_mask = 0x1f, /* pio0-4 */ 594 .pio_mask = 0x1f, /* pio0-4 */
774 .udma_mask = ATA_UDMA6, 595 .udma_mask = ATA_UDMA6,
775 .port_ops = &sis_133_for_sata_ops, 596 .port_ops = &sis_133_for_sata_ops,
776}; 597};
777static const struct ata_port_info sis_info133_early = { 598static const struct ata_port_info sis_info133_early = {
778 .sht = &sis_sht,
779 .flags = ATA_FLAG_SLAVE_POSS, 599 .flags = ATA_FLAG_SLAVE_POSS,
780 .pio_mask = 0x1f, /* pio0-4 */ 600 .pio_mask = 0x1f, /* pio0-4 */
781 .udma_mask = ATA_UDMA6, 601 .udma_mask = ATA_UDMA6,
@@ -857,11 +677,11 @@ static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
857static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 677static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
858{ 678{
859 static int printed_version; 679 static int printed_version;
860 struct ata_port_info port; 680 const struct ata_port_info *ppi[] = { NULL, NULL };
861 const struct ata_port_info *ppi[] = { &port, NULL };
862 struct pci_dev *host = NULL; 681 struct pci_dev *host = NULL;
863 struct sis_chipset *chipset = NULL; 682 struct sis_chipset *chipset = NULL;
864 struct sis_chipset *sets; 683 struct sis_chipset *sets;
684 int rc;
865 685
866 static struct sis_chipset sis_chipsets[] = { 686 static struct sis_chipset sis_chipsets[] = {
867 687
@@ -914,8 +734,11 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
914 dev_printk(KERN_DEBUG, &pdev->dev, 734 dev_printk(KERN_DEBUG, &pdev->dev,
915 "version " DRV_VERSION "\n"); 735 "version " DRV_VERSION "\n");
916 736
917 /* We have to find the bridge first */ 737 rc = pcim_enable_device(pdev);
738 if (rc)
739 return rc;
918 740
741 /* We have to find the bridge first */
919 for (sets = &sis_chipsets[0]; sets->device; sets++) { 742 for (sets = &sis_chipsets[0]; sets->device; sets++) {
920 host = pci_get_device(PCI_VENDOR_ID_SI, sets->device, NULL); 743 host = pci_get_device(PCI_VENDOR_ID_SI, sets->device, NULL);
921 if (host != NULL) { 744 if (host != NULL) {
@@ -994,12 +817,11 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
994 if (chipset == NULL) 817 if (chipset == NULL)
995 return -ENODEV; 818 return -ENODEV;
996 819
997 port = *chipset->info; 820 ppi[0] = chipset->info;
998 port.private_data = chipset;
999 821
1000 sis_fixup(pdev, chipset); 822 sis_fixup(pdev, chipset);
1001 823
1002 return ata_pci_init_one(pdev, ppi); 824 return ata_pci_sff_init_one(pdev, ppi, &sis_sht, chipset);
1003} 825}
1004 826
1005static const struct pci_device_id sis_pci_tbl[] = { 827static const struct pci_device_id sis_pci_tbl[] = {