aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-08-10 03:59:14 -0400
committerTejun Heo <htejun@gmail.com>2006-08-10 03:59:14 -0400
commitc4b01f1de254820175fe2d02b4cf7c0fab335846 (patch)
tree316335e3faa6ee6d1dcb3c102d95d7a9d4cf575b
parentdd5b06c490de72440ec39f814de99a714a45a1a9 (diff)
[PATCH] libata: use dummy port for stolen legacy ports
Use dummy port for stolen legacy ports. This makes ap->port_no always equal ap->hard_port_no. Signed-off-by: Tejun Heo <htejun@gmail.com>
-rw-r--r--drivers/scsi/libata-bmdma.c41
-rw-r--r--drivers/scsi/libata-core.c2
2 files changed, 17 insertions, 26 deletions
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c
index e694f6075c3b..158f62dbf21b 100644
--- a/drivers/scsi/libata-bmdma.c
+++ b/drivers/scsi/libata-bmdma.c
@@ -872,50 +872,43 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
872 struct ata_probe_ent *probe_ent; 872 struct ata_probe_ent *probe_ent;
873 unsigned long bmdma = pci_resource_start(pdev, 4); 873 unsigned long bmdma = pci_resource_start(pdev, 4);
874 874
875 int port_num = 0;
876
877 probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); 875 probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]);
878 if (!probe_ent) 876 if (!probe_ent)
879 return NULL; 877 return NULL;
880 878
881 probe_ent->legacy_mode = 1; 879 probe_ent->n_ports = 2;
882 probe_ent->hard_port_no = 0;
883 probe_ent->private_data = port[0]->private_data; 880 probe_ent->private_data = port[0]->private_data;
884 881
885 if (port_mask & ATA_PORT_PRIMARY) { 882 if (port_mask & ATA_PORT_PRIMARY) {
886 probe_ent->irq = 14; 883 probe_ent->irq = 14;
887 probe_ent->port[port_num].cmd_addr = ATA_PRIMARY_CMD; 884 probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD;
888 probe_ent->port[port_num].altstatus_addr = 885 probe_ent->port[0].altstatus_addr =
889 probe_ent->port[port_num].ctl_addr = ATA_PRIMARY_CTL; 886 probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL;
890 if (bmdma) { 887 if (bmdma) {
891 probe_ent->port[0].bmdma_addr = bmdma; 888 probe_ent->port[0].bmdma_addr = bmdma;
892 if (inb(bmdma + 2) & 0x80) 889 if (inb(bmdma + 2) & 0x80)
893 probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; 890 probe_ent->host_set_flags |= ATA_HOST_SIMPLEX;
894 } 891 }
895 ata_std_ports(&probe_ent->port[port_num]); 892 ata_std_ports(&probe_ent->port[0]);
896 port_num ++; 893 } else
897 } 894 probe_ent->dummy_port_mask |= ATA_PORT_PRIMARY;
895
898 if (port_mask & ATA_PORT_SECONDARY) { 896 if (port_mask & ATA_PORT_SECONDARY) {
899 if (port_num == 1) 897 if (probe_ent->irq)
900 probe_ent->irq2 = 15; 898 probe_ent->irq2 = 15;
901 else { 899 else
902 /* Secondary only. IRQ 15 only and "first" port is port 1 */
903 probe_ent->irq = 15; 900 probe_ent->irq = 15;
904 probe_ent->hard_port_no = 1; 901 probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD;
905 } 902 probe_ent->port[1].altstatus_addr =
906 probe_ent->port[port_num].cmd_addr = ATA_SECONDARY_CMD; 903 probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL;
907 probe_ent->port[port_num].altstatus_addr =
908 probe_ent->port[port_num].ctl_addr = ATA_SECONDARY_CTL;
909 if (bmdma) { 904 if (bmdma) {
910 probe_ent->port[port_num].bmdma_addr = bmdma + 8; 905 probe_ent->port[1].bmdma_addr = bmdma + 8;
911 if (inb(bmdma + 10) & 0x80) 906 if (inb(bmdma + 10) & 0x80)
912 probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; 907 probe_ent->host_set_flags |= ATA_HOST_SIMPLEX;
913 } 908 }
914 ata_std_ports(&probe_ent->port[port_num]); 909 ata_std_ports(&probe_ent->port[1]);
915 port_num ++; 910 } else
916 } 911 probe_ent->dummy_port_mask |= ATA_PORT_SECONDARY;
917
918 probe_ent->n_ports = port_num;
919 912
920 return probe_ent; 913 return probe_ent;
921} 914}
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index f2e7e2f13db9..2ef86b4e7f6d 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -5224,8 +5224,6 @@ void ata_port_init(struct ata_port *ap, struct ata_host_set *host_set,
5224 ap->dev = ent->dev; 5224 ap->dev = ent->dev;
5225 ap->port_no = port_no; 5225 ap->port_no = port_no;
5226 ap->hard_port_no = port_no; 5226 ap->hard_port_no = port_no;
5227 if (ent->legacy_mode)
5228 ap->hard_port_no += ent->hard_port_no;
5229 ap->pio_mask = ent->pio_mask; 5227 ap->pio_mask = ent->pio_mask;
5230 ap->mwdma_mask = ent->mwdma_mask; 5228 ap->mwdma_mask = ent->mwdma_mask;
5231 ap->udma_mask = ent->udma_mask; 5229 ap->udma_mask = ent->udma_mask;