diff options
Diffstat (limited to 'drivers/scsi/libata-bmdma.c')
-rw-r--r-- | drivers/scsi/libata-bmdma.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c index 95d81d86d8b7..835dff0bafdc 100644 --- a/drivers/scsi/libata-bmdma.c +++ b/drivers/scsi/libata-bmdma.c | |||
@@ -703,6 +703,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
703 | struct ata_probe_ent *probe_ent = | 703 | struct ata_probe_ent *probe_ent = |
704 | ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); | 704 | ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); |
705 | int p = 0; | 705 | int p = 0; |
706 | unsigned long bmdma; | ||
706 | 707 | ||
707 | if (!probe_ent) | 708 | if (!probe_ent) |
708 | return NULL; | 709 | return NULL; |
@@ -716,7 +717,12 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
716 | probe_ent->port[p].altstatus_addr = | 717 | probe_ent->port[p].altstatus_addr = |
717 | probe_ent->port[p].ctl_addr = | 718 | probe_ent->port[p].ctl_addr = |
718 | pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; | 719 | pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; |
719 | probe_ent->port[p].bmdma_addr = pci_resource_start(pdev, 4); | 720 | bmdma = pci_resource_start(pdev, 4); |
721 | if (bmdma) { | ||
722 | if (inb(bmdma + 2) & 0x80) | ||
723 | probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; | ||
724 | probe_ent->port[p].bmdma_addr = bmdma; | ||
725 | } | ||
720 | ata_std_ports(&probe_ent->port[p]); | 726 | ata_std_ports(&probe_ent->port[p]); |
721 | p++; | 727 | p++; |
722 | } | 728 | } |
@@ -726,7 +732,13 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
726 | probe_ent->port[p].altstatus_addr = | 732 | probe_ent->port[p].altstatus_addr = |
727 | probe_ent->port[p].ctl_addr = | 733 | probe_ent->port[p].ctl_addr = |
728 | pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; | 734 | pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; |
729 | probe_ent->port[p].bmdma_addr = pci_resource_start(pdev, 4) + 8; | 735 | bmdma = pci_resource_start(pdev, 4); |
736 | if (bmdma) { | ||
737 | bmdma += 8; | ||
738 | if(inb(bmdma + 2) & 0x80) | ||
739 | probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; | ||
740 | probe_ent->port[p].bmdma_addr = bmdma; | ||
741 | } | ||
730 | ata_std_ports(&probe_ent->port[p]); | 742 | ata_std_ports(&probe_ent->port[p]); |
731 | p++; | 743 | p++; |
732 | } | 744 | } |
@@ -740,6 +752,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, | |||
740 | struct ata_port_info *port, int port_num) | 752 | struct ata_port_info *port, int port_num) |
741 | { | 753 | { |
742 | struct ata_probe_ent *probe_ent; | 754 | struct ata_probe_ent *probe_ent; |
755 | unsigned long bmdma; | ||
743 | 756 | ||
744 | probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port); | 757 | probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port); |
745 | if (!probe_ent) | 758 | if (!probe_ent) |
@@ -766,8 +779,13 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, | |||
766 | break; | 779 | break; |
767 | } | 780 | } |
768 | 781 | ||
769 | probe_ent->port[0].bmdma_addr = | 782 | bmdma = pci_resource_start(pdev, 4); |
770 | pci_resource_start(pdev, 4) + 8 * port_num; | 783 | if (bmdma != 0) { |
784 | bmdma += 8 * port_num; | ||
785 | probe_ent->port[0].bmdma_addr = bmdma; | ||
786 | if (inb(bmdma + 2) & 0x80) | ||
787 | probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; | ||
788 | } | ||
771 | ata_std_ports(&probe_ent->port[0]); | 789 | ata_std_ports(&probe_ent->port[0]); |
772 | 790 | ||
773 | return probe_ent; | 791 | return probe_ent; |