aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c4
-rw-r--r--drivers/ata/libata-core.c27
-rw-r--r--drivers/ata/libata-eh.c67
-rw-r--r--drivers/ata/libata-sff.c23
-rw-r--r--drivers/ata/pata_cs5520.c23
-rw-r--r--drivers/ata/pata_hpt3x3.c6
-rw-r--r--drivers/ata/pata_icside.c19
-rw-r--r--drivers/ata/pata_isapnp.c4
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c13
-rw-r--r--drivers/ata/pata_legacy.c2
-rw-r--r--drivers/ata/pata_mpc52xx.c7
-rw-r--r--drivers/ata/pata_mpiix.c16
-rw-r--r--drivers/ata/pata_pcmcia.c2
-rw-r--r--drivers/ata/pata_pdc2027x.c17
-rw-r--r--drivers/ata/pata_platform.c4
-rw-r--r--drivers/ata/pata_qdi.c5
-rw-r--r--drivers/ata/pata_scc.c3
-rw-r--r--drivers/ata/pata_winbond.c7
-rw-r--r--drivers/ata/pdc_adma.c13
-rw-r--r--drivers/ata/sata_inic162x.c14
-rw-r--r--drivers/ata/sata_mv.c8
-rw-r--r--drivers/ata/sata_promise.c11
-rw-r--r--drivers/ata/sata_qstor.c11
-rw-r--r--drivers/ata/sata_sil.c6
-rw-r--r--drivers/ata/sata_sil24.c7
-rw-r--r--drivers/ata/sata_svw.c12
-rw-r--r--drivers/ata/sata_sx4.c19
-rw-r--r--drivers/ata/sata_uli.c13
-rw-r--r--drivers/ata/sata_via.c3
-rw-r--r--drivers/ata/sata_vsc.c12
30 files changed, 299 insertions, 79 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 0d80189d03f3..518c51830357 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1887,6 +1887,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1887 struct ata_port *ap = host->ports[i]; 1887 struct ata_port *ap = host->ports[i];
1888 void __iomem *port_mmio = ahci_port_base(ap); 1888 void __iomem *port_mmio = ahci_port_base(ap);
1889 1889
1890 ata_port_pbar_desc(ap, AHCI_PCI_BAR, -1, "abar");
1891 ata_port_pbar_desc(ap, AHCI_PCI_BAR,
1892 0x100 + ap->port_no * 0x80, "port");
1893
1890 /* standard SATA port setup */ 1894 /* standard SATA port setup */
1891 if (hpriv->port_map & (1 << i)) 1895 if (hpriv->port_map & (1 << i))
1892 ap->ioaddr.cmd_addr = port_mmio; 1896 ap->ioaddr.cmd_addr = port_mmio;
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index b81265d1e469..84d81b26e384 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6541,7 +6541,6 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6541 /* set cable, sata_spd_limit and report */ 6541 /* set cable, sata_spd_limit and report */
6542 for (i = 0; i < host->n_ports; i++) { 6542 for (i = 0; i < host->n_ports; i++) {
6543 struct ata_port *ap = host->ports[i]; 6543 struct ata_port *ap = host->ports[i];
6544 int irq_line;
6545 unsigned long xfer_mask; 6544 unsigned long xfer_mask;
6546 6545
6547 /* set SATA cable type if still unset */ 6546 /* set SATA cable type if still unset */
@@ -6551,24 +6550,16 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6551 /* init sata_spd_limit to the current value */ 6550 /* init sata_spd_limit to the current value */
6552 sata_link_init_spd(&ap->link); 6551 sata_link_init_spd(&ap->link);
6553 6552
6554 /* report the secondary IRQ for second channel legacy */ 6553 /* print per-port info to dmesg */
6555 irq_line = host->irq;
6556 if (i == 1 && host->irq2)
6557 irq_line = host->irq2;
6558
6559 xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, 6554 xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask,
6560 ap->udma_mask); 6555 ap->udma_mask);
6561 6556
6562 /* print per-port info to dmesg */
6563 if (!ata_port_is_dummy(ap)) 6557 if (!ata_port_is_dummy(ap))
6564 ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%p " 6558 ata_port_printk(ap, KERN_INFO,
6565 "ctl 0x%p bmdma 0x%p irq %d\n", 6559 "%cATA max %s %s\n",
6566 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P', 6560 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P',
6567 ata_mode_string(xfer_mask), 6561 ata_mode_string(xfer_mask),
6568 ap->ioaddr.cmd_addr, 6562 ap->link.eh_info.desc);
6569 ap->ioaddr.ctl_addr,
6570 ap->ioaddr.bmdma_addr,
6571 irq_line);
6572 else 6563 else
6573 ata_port_printk(ap, KERN_INFO, "DUMMY\n"); 6564 ata_port_printk(ap, KERN_INFO, "DUMMY\n");
6574 } 6565 }
@@ -6652,7 +6643,7 @@ int ata_host_activate(struct ata_host *host, int irq,
6652 irq_handler_t irq_handler, unsigned long irq_flags, 6643 irq_handler_t irq_handler, unsigned long irq_flags,
6653 struct scsi_host_template *sht) 6644 struct scsi_host_template *sht)
6654{ 6645{
6655 int rc; 6646 int i, rc;
6656 6647
6657 rc = ata_host_start(host); 6648 rc = ata_host_start(host);
6658 if (rc) 6649 if (rc)
@@ -6663,8 +6654,8 @@ int ata_host_activate(struct ata_host *host, int irq,
6663 if (rc) 6654 if (rc)
6664 return rc; 6655 return rc;
6665 6656
6666 /* Used to print device info at probe */ 6657 for (i = 0; i < host->n_ports; i++)
6667 host->irq = irq; 6658 ata_port_desc(host->ports[i], "irq %d", irq);
6668 6659
6669 rc = ata_host_register(host, sht); 6660 rc = ata_host_register(host, sht);
6670 /* if failed, just free the IRQ and leave ports alone */ 6661 /* if failed, just free the IRQ and leave ports alone */
@@ -7136,6 +7127,10 @@ EXPORT_SYMBOL_GPL(ata_pci_clear_simplex);
7136EXPORT_SYMBOL_GPL(__ata_ehi_push_desc); 7127EXPORT_SYMBOL_GPL(__ata_ehi_push_desc);
7137EXPORT_SYMBOL_GPL(ata_ehi_push_desc); 7128EXPORT_SYMBOL_GPL(ata_ehi_push_desc);
7138EXPORT_SYMBOL_GPL(ata_ehi_clear_desc); 7129EXPORT_SYMBOL_GPL(ata_ehi_clear_desc);
7130EXPORT_SYMBOL_GPL(ata_port_desc);
7131#ifdef CONFIG_PCI
7132EXPORT_SYMBOL_GPL(ata_port_pbar_desc);
7133#endif /* CONFIG_PCI */
7139EXPORT_SYMBOL_GPL(ata_eng_timeout); 7134EXPORT_SYMBOL_GPL(ata_eng_timeout);
7140EXPORT_SYMBOL_GPL(ata_port_schedule_eh); 7135EXPORT_SYMBOL_GPL(ata_port_schedule_eh);
7141EXPORT_SYMBOL_GPL(ata_link_abort); 7136EXPORT_SYMBOL_GPL(ata_link_abort);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 2ddc2ed9c29d..8219e2d71045 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -151,6 +151,73 @@ void ata_ehi_clear_desc(struct ata_eh_info *ehi)
151 ehi->desc_len = 0; 151 ehi->desc_len = 0;
152} 152}
153 153
154/**
155 * ata_port_desc - append port description
156 * @ap: target ATA port
157 * @fmt: printf format string
158 *
159 * Format string according to @fmt and append it to port
160 * description. If port description is not empty, " " is added
161 * in-between. This function is to be used while initializing
162 * ata_host. The description is printed on host registration.
163 *
164 * LOCKING:
165 * None.
166 */
167void ata_port_desc(struct ata_port *ap, const char *fmt, ...)
168{
169 va_list args;
170
171 WARN_ON(!(ap->pflags & ATA_PFLAG_INITIALIZING));
172
173 if (ap->link.eh_info.desc_len)
174 __ata_ehi_push_desc(&ap->link.eh_info, " ");
175
176 va_start(args, fmt);
177 __ata_ehi_pushv_desc(&ap->link.eh_info, fmt, args);
178 va_end(args);
179}
180
181#ifdef CONFIG_PCI
182
183/**
184 * ata_port_pbar_desc - append PCI BAR description
185 * @ap: target ATA port
186 * @bar: target PCI BAR
187 * @offset: offset into PCI BAR
188 * @name: name of the area
189 *
190 * If @offset is negative, this function formats a string which
191 * contains the name, address, size and type of the BAR and
192 * appends it to the port description. If @offset is zero or
193 * positive, only name and offsetted address is appended.
194 *
195 * LOCKING:
196 * None.
197 */
198void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
199 const char *name)
200{
201 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
202 char *type = "";
203 unsigned long long start, len;
204
205 if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM)
206 type = "m";
207 else if (pci_resource_flags(pdev, bar) & IORESOURCE_IO)
208 type = "i";
209
210 start = (unsigned long long)pci_resource_start(pdev, bar);
211 len = (unsigned long long)pci_resource_len(pdev, bar);
212
213 if (offset < 0)
214 ata_port_desc(ap, "%s %s%llu@0x%llx", name, type, len, start);
215 else
216 ata_port_desc(ap, "%s 0x%llx", name, start + offset);
217}
218
219#endif /* CONFIG_PCI */
220
154static void ata_ering_record(struct ata_ering *ering, int is_io, 221static void ata_ering_record(struct ata_ering *ering, int is_io,
155 unsigned int err_mask) 222 unsigned int err_mask)
156{ 223{
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index ccef99a0337c..026439e05afe 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -567,6 +567,9 @@ int ata_pci_init_bmdma(struct ata_host *host)
567 if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) && 567 if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) &&
568 (ioread8(bmdma + 2) & 0x80)) 568 (ioread8(bmdma + 2) & 0x80))
569 host->flags |= ATA_HOST_SIMPLEX; 569 host->flags |= ATA_HOST_SIMPLEX;
570
571 ata_port_desc(ap, "bmdma 0x%llx",
572 (unsigned long long)pci_resource_start(pdev, 4) + 8 * i);
570 } 573 }
571 574
572 return 0; 575 return 0;
@@ -634,6 +637,10 @@ int ata_pci_init_sff_host(struct ata_host *host)
634 ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS); 637 ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS);
635 ata_std_ports(&ap->ioaddr); 638 ata_std_ports(&ap->ioaddr);
636 639
640 ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
641 (unsigned long long)pci_resource_start(pdev, base),
642 (unsigned long long)pci_resource_start(pdev, base + 1));
643
637 mask |= 1 << i; 644 mask |= 1 << i;
638 } 645 }
639 646
@@ -804,24 +811,30 @@ int ata_pci_init_one(struct pci_dev *pdev,
804 IRQF_SHARED, DRV_NAME, host); 811 IRQF_SHARED, DRV_NAME, host);
805 if (rc) 812 if (rc)
806 goto err_out; 813 goto err_out;
807 host->irq = pdev->irq; 814
815 ata_port_desc(host->ports[0], "irq %d", pdev->irq);
816 ata_port_desc(host->ports[1], "irq %d", pdev->irq);
808 } else { 817 } else {
809 if (!ata_port_is_dummy(host->ports[0])) { 818 if (!ata_port_is_dummy(host->ports[0])) {
810 host->irq = ATA_PRIMARY_IRQ(pdev); 819 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
811 rc = devm_request_irq(dev, host->irq,
812 pi->port_ops->irq_handler, 820 pi->port_ops->irq_handler,
813 IRQF_SHARED, DRV_NAME, host); 821 IRQF_SHARED, DRV_NAME, host);
814 if (rc) 822 if (rc)
815 goto err_out; 823 goto err_out;
824
825 ata_port_desc(host->ports[0], "irq %d",
826 ATA_PRIMARY_IRQ(pdev));
816 } 827 }
817 828
818 if (!ata_port_is_dummy(host->ports[1])) { 829 if (!ata_port_is_dummy(host->ports[1])) {
819 host->irq2 = ATA_SECONDARY_IRQ(pdev); 830 rc = devm_request_irq(dev, ATA_SECONDARY_IRQ(pdev),
820 rc = devm_request_irq(dev, host->irq2,
821 pi->port_ops->irq_handler, 831 pi->port_ops->irq_handler,
822 IRQF_SHARED, DRV_NAME, host); 832 IRQF_SHARED, DRV_NAME, host);
823 if (rc) 833 if (rc)
824 goto err_out; 834 goto err_out;
835
836 ata_port_desc(host->ports[1], "irq %d",
837 ATA_SECONDARY_IRQ(pdev));
825 } 838 }
826 } 839 }
827 840
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 1ae6b6bd8564..ff1eb84c7d22 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -189,6 +189,8 @@ static struct ata_port_operations cs5520_port_ops = {
189 189
190static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 190static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
191{ 191{
192 static const unsigned int cmd_port[] = { 0x1F0, 0x170 };
193 static const unsigned int ctl_port[] = { 0x3F6, 0x376 };
192 struct ata_port_info pi = { 194 struct ata_port_info pi = {
193 .flags = ATA_FLAG_SLAVE_POSS, 195 .flags = ATA_FLAG_SLAVE_POSS,
194 .pio_mask = 0x1f, 196 .pio_mask = 0x1f,
@@ -242,10 +244,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
242 } 244 }
243 245
244 /* Map IO ports and initialize host accordingly */ 246 /* Map IO ports and initialize host accordingly */
245 iomap[0] = devm_ioport_map(&pdev->dev, 0x1F0, 8); 247 iomap[0] = devm_ioport_map(&pdev->dev, cmd_port[0], 8);
246 iomap[1] = devm_ioport_map(&pdev->dev, 0x3F6, 1); 248 iomap[1] = devm_ioport_map(&pdev->dev, ctl_port[0], 1);
247 iomap[2] = devm_ioport_map(&pdev->dev, 0x170, 8); 249 iomap[2] = devm_ioport_map(&pdev->dev, cmd_port[1], 8);
248 iomap[3] = devm_ioport_map(&pdev->dev, 0x376, 1); 250 iomap[3] = devm_ioport_map(&pdev->dev, ctl_port[1], 1);
249 iomap[4] = pcim_iomap(pdev, 2, 0); 251 iomap[4] = pcim_iomap(pdev, 2, 0);
250 252
251 if (!iomap[0] || !iomap[1] || !iomap[2] || !iomap[3] || !iomap[4]) 253 if (!iomap[0] || !iomap[1] || !iomap[2] || !iomap[3] || !iomap[4])
@@ -258,6 +260,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
258 ioaddr->bmdma_addr = iomap[4]; 260 ioaddr->bmdma_addr = iomap[4];
259 ata_std_ports(ioaddr); 261 ata_std_ports(ioaddr);
260 262
263 ata_port_desc(host->ports[0],
264 "cmd 0x%x ctl 0x%x", cmd_port[0], ctl_port[0]);
265 ata_port_pbar_desc(host->ports[0], 4, 0, "bmdma");
266
261 ioaddr = &host->ports[1]->ioaddr; 267 ioaddr = &host->ports[1]->ioaddr;
262 ioaddr->cmd_addr = iomap[2]; 268 ioaddr->cmd_addr = iomap[2];
263 ioaddr->ctl_addr = iomap[3]; 269 ioaddr->ctl_addr = iomap[3];
@@ -265,6 +271,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
265 ioaddr->bmdma_addr = iomap[4] + 8; 271 ioaddr->bmdma_addr = iomap[4] + 8;
266 ata_std_ports(ioaddr); 272 ata_std_ports(ioaddr);
267 273
274 ata_port_desc(host->ports[1],
275 "cmd 0x%x ctl 0x%x", cmd_port[1], ctl_port[1]);
276 ata_port_pbar_desc(host->ports[1], 4, 8, "bmdma");
277
268 /* activate the host */ 278 /* activate the host */
269 pci_set_master(pdev); 279 pci_set_master(pdev);
270 rc = ata_host_start(host); 280 rc = ata_host_start(host);
@@ -283,10 +293,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
283 if (rc) 293 if (rc)
284 return rc; 294 return rc;
285 295
286 if (i == 0) 296 ata_port_desc(ap, "irq %d", irq[i]);
287 host->irq = irq[0];
288 else
289 host->irq2 = irq[1];
290 } 297 }
291 298
292 return ata_host_register(host, &cs5520_sht); 299 return ata_host_register(host, &cs5520_sht);
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c
index 188d2176ec33..cb8bdb6887de 100644
--- a/drivers/ata/pata_hpt3x3.c
+++ b/drivers/ata/pata_hpt3x3.c
@@ -237,7 +237,8 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
237 base = host->iomap[4]; /* Bus mastering base */ 237 base = host->iomap[4]; /* Bus mastering base */
238 238
239 for (i = 0; i < host->n_ports; i++) { 239 for (i = 0; i < host->n_ports; i++) {
240 struct ata_ioports *ioaddr = &host->ports[i]->ioaddr; 240 struct ata_port *ap = host->ports[i];
241 struct ata_ioports *ioaddr = &ap->ioaddr;
241 242
242 ioaddr->cmd_addr = base + offset_cmd[i]; 243 ioaddr->cmd_addr = base + offset_cmd[i];
243 ioaddr->altstatus_addr = 244 ioaddr->altstatus_addr =
@@ -245,6 +246,9 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
245 ioaddr->scr_addr = NULL; 246 ioaddr->scr_addr = NULL;
246 ata_std_ports(ioaddr); 247 ata_std_ports(ioaddr);
247 ioaddr->bmdma_addr = base + 8 * i; 248 ioaddr->bmdma_addr = base + 8 * i;
249
250 ata_port_pbar_desc(ap, 4, -1, "ioport");
251 ata_port_pbar_desc(ap, 4, offset_cmd[i], "cmd");
248 } 252 }
249 pci_set_master(pdev); 253 pci_set_master(pdev);
250 return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED, 254 return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED,
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 4a69328a4c43..be30923566c5 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -70,6 +70,8 @@ struct pata_icside_info {
70 unsigned int mwdma_mask; 70 unsigned int mwdma_mask;
71 unsigned int nr_ports; 71 unsigned int nr_ports;
72 const struct portinfo *port[2]; 72 const struct portinfo *port[2];
73 unsigned long raw_base;
74 unsigned long raw_ioc_base;
73}; 75};
74 76
75#define ICS_TYPE_A3IN 0 77#define ICS_TYPE_A3IN 0
@@ -392,9 +394,10 @@ static struct ata_port_operations pata_icside_port_ops = {
392}; 394};
393 395
394static void __devinit 396static void __devinit
395pata_icside_setup_ioaddr(struct ata_ioports *ioaddr, void __iomem *base, 397pata_icside_setup_ioaddr(struct ata_port *ap, void __iomem *base,
396 const struct portinfo *info) 398 const struct portinfo *info)
397{ 399{
400 struct ata_ioports *ioaddr = &ap->ioaddr;
398 void __iomem *cmd = base + info->dataoffset; 401 void __iomem *cmd = base + info->dataoffset;
399 402
400 ioaddr->cmd_addr = cmd; 403 ioaddr->cmd_addr = cmd;
@@ -411,6 +414,13 @@ pata_icside_setup_ioaddr(struct ata_ioports *ioaddr, void __iomem *base,
411 414
412 ioaddr->ctl_addr = base + info->ctrloffset; 415 ioaddr->ctl_addr = base + info->ctrloffset;
413 ioaddr->altstatus_addr = ioaddr->ctl_addr; 416 ioaddr->altstatus_addr = ioaddr->ctl_addr;
417
418 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx",
419 info->raw_base + info->dataoffset,
420 info->raw_base + info->ctrloffset);
421
422 if (info->raw_ioc_base)
423 ata_port_desc(ap, "iocbase 0x%lx", info->raw_ioc_base);
414} 424}
415 425
416static int __devinit pata_icside_register_v5(struct pata_icside_info *info) 426static int __devinit pata_icside_register_v5(struct pata_icside_info *info)
@@ -431,6 +441,8 @@ static int __devinit pata_icside_register_v5(struct pata_icside_info *info)
431 info->nr_ports = 1; 441 info->nr_ports = 1;
432 info->port[0] = &pata_icside_portinfo_v5; 442 info->port[0] = &pata_icside_portinfo_v5;
433 443
444 info->raw_base = ecard_resource_start(ec, ECARD_RES_MEMC);
445
434 return 0; 446 return 0;
435} 447}
436 448
@@ -471,6 +483,9 @@ static int __devinit pata_icside_register_v6(struct pata_icside_info *info)
471 info->port[0] = &pata_icside_portinfo_v6_1; 483 info->port[0] = &pata_icside_portinfo_v6_1;
472 info->port[1] = &pata_icside_portinfo_v6_2; 484 info->port[1] = &pata_icside_portinfo_v6_2;
473 485
486 info->raw_base = ecard_resource_start(ec, ECARD_RES_EASI);
487 info->raw_ioc_base = ecard_resource_start(ec, ECARD_RES_IOCFAST);
488
474 return icside_dma_init(info); 489 return icside_dma_init(info);
475} 490}
476 491
@@ -507,7 +522,7 @@ static int __devinit pata_icside_add_ports(struct pata_icside_info *info)
507 ap->flags |= ATA_FLAG_SLAVE_POSS; 522 ap->flags |= ATA_FLAG_SLAVE_POSS;
508 ap->ops = &pata_icside_port_ops; 523 ap->ops = &pata_icside_port_ops;
509 524
510 pata_icside_setup_ioaddr(&ap->ioaddr, info->base, info->port[i]); 525 pata_icside_setup_ioaddr(ap, info->base, info->port[i]);
511 } 526 }
512 527
513 return ata_host_activate(host, ec->irq, ata_interrupt, 0, 528 return ata_host_activate(host, ec->irq, ata_interrupt, 0,
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 8ac1e8beabaf..88ab0e1d353f 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -110,6 +110,10 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
110 110
111 ata_std_ports(&ap->ioaddr); 111 ata_std_ports(&ap->ioaddr);
112 112
113 ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
114 (unsigned long long)pnp_port_start(idev, 0),
115 (unsigned long long)pnp_port_start(idev, 1));
116
113 /* activate */ 117 /* activate */
114 return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0, 118 return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0,
115 &isapnp_sht); 119 &isapnp_sht);
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index 7b0d2fc57484..fcd532afbf2e 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -131,8 +131,12 @@ static struct ata_port_operations ixp4xx_port_ops = {
131}; 131};
132 132
133static void ixp4xx_setup_port(struct ata_ioports *ioaddr, 133static void ixp4xx_setup_port(struct ata_ioports *ioaddr,
134 struct ixp4xx_pata_data *data) 134 struct ixp4xx_pata_data *data,
135 unsigned long raw_cs0, unsigned long raw_cs1)
135{ 136{
137 unsigned long raw_cmd = raw_cs0;
138 unsigned long raw_ctl = raw_cs1 + 0x06;
139
136 ioaddr->cmd_addr = data->cs0; 140 ioaddr->cmd_addr = data->cs0;
137 ioaddr->altstatus_addr = data->cs1 + 0x06; 141 ioaddr->altstatus_addr = data->cs1 + 0x06;
138 ioaddr->ctl_addr = data->cs1 + 0x06; 142 ioaddr->ctl_addr = data->cs1 + 0x06;
@@ -158,7 +162,12 @@ static void ixp4xx_setup_port(struct ata_ioports *ioaddr,
158 *(unsigned long *)&ioaddr->device_addr ^= 0x03; 162 *(unsigned long *)&ioaddr->device_addr ^= 0x03;
159 *(unsigned long *)&ioaddr->status_addr ^= 0x03; 163 *(unsigned long *)&ioaddr->status_addr ^= 0x03;
160 *(unsigned long *)&ioaddr->command_addr ^= 0x03; 164 *(unsigned long *)&ioaddr->command_addr ^= 0x03;
165
166 raw_cmd ^= 0x03;
167 raw_ctl ^= 0x03;
161#endif 168#endif
169
170 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", raw_cmd, raw_ctl);
162} 171}
163 172
164static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) 173static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
@@ -203,7 +212,7 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
203 ap->pio_mask = 0x1f; /* PIO4 */ 212 ap->pio_mask = 0x1f; /* PIO4 */
204 ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_NO_ATAPI; 213 ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_NO_ATAPI;
205 214
206 ixp4xx_setup_port(&ap->ioaddr, data); 215 ixp4xx_setup_port(ap, data, cs0->start, cs1->start);
207 216
208 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); 217 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
209 218
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 6cae26f4d272..7bed8d806381 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -799,6 +799,8 @@ static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl
799 ata_std_ports(&ap->ioaddr); 799 ata_std_ports(&ap->ioaddr);
800 ap->private_data = ld; 800 ap->private_data = ld;
801 801
802 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", io, ctrl);
803
802 ret = ata_host_activate(host, irq, ata_interrupt, 0, &legacy_sht); 804 ret = ata_host_activate(host, irq, ata_interrupt, 0, &legacy_sht);
803 if (ret) 805 if (ret)
804 goto fail; 806 goto fail;
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index a56694b2833e..412140f02853 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -302,7 +302,8 @@ static struct ata_port_operations mpc52xx_ata_port_ops = {
302}; 302};
303 303
304static int __devinit 304static int __devinit
305mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv) 305mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv,
306 unsigned long raw_ata_regs)
306{ 307{
307 struct ata_host *host; 308 struct ata_host *host;
308 struct ata_port *ap; 309 struct ata_port *ap;
@@ -336,6 +337,8 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv)
336 aio->status_addr = &priv->ata_regs->tf_command; 337 aio->status_addr = &priv->ata_regs->tf_command;
337 aio->command_addr = &priv->ata_regs->tf_command; 338 aio->command_addr = &priv->ata_regs->tf_command;
338 339
340 ata_port_desc(ap, "ata_regs 0x%lx", raw_ata_regs);
341
339 /* activate host */ 342 /* activate host */
340 return ata_host_activate(host, priv->ata_irq, ata_interrupt, 0, 343 return ata_host_activate(host, priv->ata_irq, ata_interrupt, 0,
341 &mpc52xx_ata_sht); 344 &mpc52xx_ata_sht);
@@ -432,7 +435,7 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
432 } 435 }
433 436
434 /* Register ourselves to libata */ 437 /* Register ourselves to libata */
435 rv = mpc52xx_ata_init_one(&op->dev, priv); 438 rv = mpc52xx_ata_init_one(&op->dev, priv, res_mem.start);
436 if (rv) { 439 if (rv) {
437 printk(KERN_ERR DRV_NAME ": " 440 printk(KERN_ERR DRV_NAME ": "
438 "Error while registering to ATA layer\n"); 441 "Error while registering to ATA layer\n");
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index cb78b7bfe143..d5483087a3fa 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -201,7 +201,7 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
201 struct ata_port *ap; 201 struct ata_port *ap;
202 void __iomem *cmd_addr, *ctl_addr; 202 void __iomem *cmd_addr, *ctl_addr;
203 u16 idetim; 203 u16 idetim;
204 int irq; 204 int cmd, ctl, irq;
205 205
206 if (!printed_version++) 206 if (!printed_version++)
207 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); 207 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
@@ -209,6 +209,7 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
209 host = ata_host_alloc(&dev->dev, 1); 209 host = ata_host_alloc(&dev->dev, 1);
210 if (!host) 210 if (!host)
211 return -ENOMEM; 211 return -ENOMEM;
212 ap = host->ports[0];
212 213
213 /* MPIIX has many functions which can be turned on or off according 214 /* MPIIX has many functions which can be turned on or off according
214 to other devices present. Make sure IDE is enabled before we try 215 to other devices present. Make sure IDE is enabled before we try
@@ -220,25 +221,28 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
220 221
221 /* See if it's primary or secondary channel... */ 222 /* See if it's primary or secondary channel... */
222 if (!(idetim & SECONDARY)) { 223 if (!(idetim & SECONDARY)) {
224 cmd = 0x1F0;
225 ctl = 0x3F6;
223 irq = 14; 226 irq = 14;
224 cmd_addr = devm_ioport_map(&dev->dev, 0x1F0, 8);
225 ctl_addr = devm_ioport_map(&dev->dev, 0x3F6, 1);
226 } else { 227 } else {
228 cmd = 0x170;
229 ctl = 0x376;
227 irq = 15; 230 irq = 15;
228 cmd_addr = devm_ioport_map(&dev->dev, 0x170, 8);
229 ctl_addr = devm_ioport_map(&dev->dev, 0x376, 1);
230 } 231 }
231 232
233 cmd_addr = devm_ioport_map(&dev->dev, cmd, 8);
234 ctl_addr = devm_ioport_map(&dev->dev, ctl, 1);
232 if (!cmd_addr || !ctl_addr) 235 if (!cmd_addr || !ctl_addr)
233 return -ENOMEM; 236 return -ENOMEM;
234 237
238 ata_port_desc(ap, "cmd 0x%x ctl 0x%x", cmd, ctl);
239
235 /* We do our own plumbing to avoid leaking special cases for whacko 240 /* We do our own plumbing to avoid leaking special cases for whacko
236 ancient hardware into the core code. There are two issues to 241 ancient hardware into the core code. There are two issues to
237 worry about. #1 The chip is a bridge so if in legacy mode and 242 worry about. #1 The chip is a bridge so if in legacy mode and
238 without BARs set fools the setup. #2 If you pci_disable_device 243 without BARs set fools the setup. #2 If you pci_disable_device
239 the MPIIX your box goes castors up */ 244 the MPIIX your box goes castors up */
240 245
241 ap = host->ports[0];
242 ap->ops = &mpiix_port_ops; 246 ap->ops = &mpiix_port_ops;
243 ap->pio_mask = 0x1F; 247 ap->pio_mask = 0x1F;
244 ap->flags |= ATA_FLAG_SLAVE_POSS; 248 ap->flags |= ATA_FLAG_SLAVE_POSS;
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 5baf531f652e..782ff4ada9d1 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -302,6 +302,8 @@ next_entry:
302 ap->ioaddr.ctl_addr = ctl_addr; 302 ap->ioaddr.ctl_addr = ctl_addr;
303 ata_std_ports(&ap->ioaddr); 303 ata_std_ports(&ap->ioaddr);
304 304
305 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", io_base, ctl_base);
306
305 /* activate */ 307 /* activate */
306 ret = ata_host_activate(host, pdev->irq.AssignedIRQ, ata_interrupt, 308 ret = ata_host_activate(host, pdev->irq.AssignedIRQ, ata_interrupt,
307 IRQF_SHARED, &pcmcia_sht); 309 IRQF_SHARED, &pcmcia_sht);
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 2141a99e4da1..f87c800be7f3 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -782,12 +782,14 @@ static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base)
782static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 782static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
783{ 783{
784 static int printed_version; 784 static int printed_version;
785 static const unsigned long cmd_offset[] = { 0x17c0, 0x15c0 };
786 static const unsigned long bmdma_offset[] = { 0x1000, 0x1008 };
785 unsigned int board_idx = (unsigned int) ent->driver_data; 787 unsigned int board_idx = (unsigned int) ent->driver_data;
786 const struct ata_port_info *ppi[] = 788 const struct ata_port_info *ppi[] =
787 { &pdc2027x_port_info[board_idx], NULL }; 789 { &pdc2027x_port_info[board_idx], NULL };
788 struct ata_host *host; 790 struct ata_host *host;
789 void __iomem *mmio_base; 791 void __iomem *mmio_base;
790 int rc; 792 int i, rc;
791 793
792 if (!printed_version++) 794 if (!printed_version++)
793 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 795 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
@@ -817,10 +819,15 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
817 819
818 mmio_base = host->iomap[PDC_MMIO_BAR]; 820 mmio_base = host->iomap[PDC_MMIO_BAR];
819 821
820 pdc_ata_setup_port(&host->ports[0]->ioaddr, mmio_base + 0x17c0); 822 for (i = 0; i < 2; i++) {
821 host->ports[0]->ioaddr.bmdma_addr = mmio_base + 0x1000; 823 struct ata_port *ap = host->ports[i];
822 pdc_ata_setup_port(&host->ports[1]->ioaddr, mmio_base + 0x15c0); 824
823 host->ports[1]->ioaddr.bmdma_addr = mmio_base + 0x1008; 825 pdc_ata_setup_port(&ap->ioaddr, mmio_base + cmd_offset[i]);
826 ap->ioaddr.bmdma_addr = mmio_base + bmdma_offset[i];
827
828 ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio");
829 ata_port_pbar_desc(ap, PDC_MMIO_BAR, cmd_offset[i], "cmd");
830 }
824 831
825 //pci_enable_intx(pdev); 832 //pci_enable_intx(pdev);
826 833
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index b04ce5f98410..fc72a965643d 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -208,6 +208,10 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
208 pp_info = pdev->dev.platform_data; 208 pp_info = pdev->dev.platform_data;
209 pata_platform_setup_port(&ap->ioaddr, pp_info); 209 pata_platform_setup_port(&ap->ioaddr, pp_info);
210 210
211 ata_port_desc(ap, "%s cmd 0x%llx ctl 0x%llx", mmio ? "mmio" : "ioport",
212 (unsigned long long)io_res->start,
213 (unsigned long long)ctl_res->start);
214
211 /* activate */ 215 /* activate */
212 return ata_host_activate(host, platform_get_irq(pdev, 0), 216 return ata_host_activate(host, platform_get_irq(pdev, 0),
213 ata_interrupt, pp_info ? pp_info->irq_flags 217 ata_interrupt, pp_info ? pp_info->irq_flags
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 032fa67acc8b..7d4c696c4cb6 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -234,6 +234,7 @@ static struct ata_port_operations qdi6580_port_ops = {
234 234
235static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast) 235static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast)
236{ 236{
237 unsigned long ctl = io + 0x206;
237 struct platform_device *pdev; 238 struct platform_device *pdev;
238 struct ata_host *host; 239 struct ata_host *host;
239 struct ata_port *ap; 240 struct ata_port *ap;
@@ -250,7 +251,7 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
250 251
251 ret = -ENOMEM; 252 ret = -ENOMEM;
252 io_addr = devm_ioport_map(&pdev->dev, io, 8); 253 io_addr = devm_ioport_map(&pdev->dev, io, 8);
253 ctl_addr = devm_ioport_map(&pdev->dev, io + 0x206, 1); 254 ctl_addr = devm_ioport_map(&pdev->dev, ctl, 1);
254 if (!io_addr || !ctl_addr) 255 if (!io_addr || !ctl_addr)
255 goto fail; 256 goto fail;
256 257
@@ -275,6 +276,8 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
275 ap->ioaddr.ctl_addr = ctl_addr; 276 ap->ioaddr.ctl_addr = ctl_addr;
276 ata_std_ports(&ap->ioaddr); 277 ata_std_ports(&ap->ioaddr);
277 278
279 ata_port_desc(ap, "cmd %lx ctl %lx", io, ctl);
280
278 /* 281 /*
279 * Hook in a private data structure per channel 282 * Hook in a private data structure per channel
280 */ 283 */
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index e138343b5d4e..2153def3f345 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -1159,6 +1159,9 @@ static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1159 return rc; 1159 return rc;
1160 host->iomap = pcim_iomap_table(pdev); 1160 host->iomap = pcim_iomap_table(pdev);
1161 1161
1162 ata_port_pbar_desc(host->ports[0], SCC_CTRL_BAR, -1, "ctrl");
1163 ata_port_pbar_desc(host->ports[0], SCC_BMID_BAR, -1, "bmid");
1164
1162 rc = scc_host_init(host); 1165 rc = scc_host_init(host);
1163 if (rc) 1166 if (rc)
1164 return rc; 1167 return rc;
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 553658bacce0..549cbbe9fd07 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -197,6 +197,7 @@ static __init int winbond_init_one(unsigned long port)
197 197
198 for (i = 0; i < 2 ; i ++) { 198 for (i = 0; i < 2 ; i ++) {
199 unsigned long cmd_port = 0x1F0 - (0x80 * i); 199 unsigned long cmd_port = 0x1F0 - (0x80 * i);
200 unsigned long ctl_port = cmd_port + 0x206;
200 struct ata_host *host; 201 struct ata_host *host;
201 struct ata_port *ap; 202 struct ata_port *ap;
202 void __iomem *cmd_addr, *ctl_addr; 203 void __iomem *cmd_addr, *ctl_addr;
@@ -212,14 +213,16 @@ static __init int winbond_init_one(unsigned long port)
212 host = ata_host_alloc(&pdev->dev, 1); 213 host = ata_host_alloc(&pdev->dev, 1);
213 if (!host) 214 if (!host)
214 goto err_unregister; 215 goto err_unregister;
216 ap = host->ports[0];
215 217
216 rc = -ENOMEM; 218 rc = -ENOMEM;
217 cmd_addr = devm_ioport_map(&pdev->dev, cmd_port, 8); 219 cmd_addr = devm_ioport_map(&pdev->dev, cmd_port, 8);
218 ctl_addr = devm_ioport_map(&pdev->dev, cmd_port + 0x0206, 1); 220 ctl_addr = devm_ioport_map(&pdev->dev, ctl_port, 1);
219 if (!cmd_addr || !ctl_addr) 221 if (!cmd_addr || !ctl_addr)
220 goto err_unregister; 222 goto err_unregister;
221 223
222 ap = host->ports[0]; 224 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", cmd_port, ctl_port);
225
223 ap->ops = &winbond_port_ops; 226 ap->ops = &winbond_port_ops;
224 ap->pio_mask = 0x1F; 227 ap->pio_mask = 0x1F;
225 ap->flags |= ATA_FLAG_SLAVE_POSS; 228 ap->flags |= ATA_FLAG_SLAVE_POSS;
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 42fd15aaba0b..8d1b03d5bcb1 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -704,9 +704,16 @@ static int adma_ata_init_one(struct pci_dev *pdev,
704 if (rc) 704 if (rc)
705 return rc; 705 return rc;
706 706
707 for (port_no = 0; port_no < ADMA_PORTS; ++port_no) 707 for (port_no = 0; port_no < ADMA_PORTS; ++port_no) {
708 adma_ata_setup_port(&host->ports[port_no]->ioaddr, 708 struct ata_port *ap = host->ports[port_no];
709 ADMA_ATA_REGS(mmio_base, port_no)); 709 void __iomem *port_base = ADMA_ATA_REGS(mmio_base, port_no);
710 unsigned int offset = port_base - mmio_base;
711
712 adma_ata_setup_port(&ap->ioaddr, port_base);
713
714 ata_port_pbar_desc(ap, ADMA_MMIO_BAR, -1, "mmio");
715 ata_port_pbar_desc(ap, ADMA_MMIO_BAR, offset, "port");
716 }
710 717
711 /* initialize adapter */ 718 /* initialize adapter */
712 adma_host_init(host, board_idx); 719 adma_host_init(host, board_idx);
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index f0ea0e166c11..08595f34b3e8 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -693,16 +693,24 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
693 host->iomap = iomap = pcim_iomap_table(pdev); 693 host->iomap = iomap = pcim_iomap_table(pdev);
694 694
695 for (i = 0; i < NR_PORTS; i++) { 695 for (i = 0; i < NR_PORTS; i++) {
696 struct ata_ioports *port = &host->ports[i]->ioaddr; 696 struct ata_port *ap = host->ports[i];
697 void __iomem *port_base = iomap[MMIO_BAR] + i * PORT_SIZE; 697 struct ata_ioports *port = &ap->ioaddr;
698 unsigned int offset = i * PORT_SIZE;
698 699
699 port->cmd_addr = iomap[2 * i]; 700 port->cmd_addr = iomap[2 * i];
700 port->altstatus_addr = 701 port->altstatus_addr =
701 port->ctl_addr = (void __iomem *) 702 port->ctl_addr = (void __iomem *)
702 ((unsigned long)iomap[2 * i + 1] | ATA_PCI_CTL_OFS); 703 ((unsigned long)iomap[2 * i + 1] | ATA_PCI_CTL_OFS);
703 port->scr_addr = port_base + PORT_SCR; 704 port->scr_addr = iomap[MMIO_BAR] + offset + PORT_SCR;
704 705
705 ata_std_ports(port); 706 ata_std_ports(port);
707
708 ata_port_pbar_desc(ap, MMIO_BAR, -1, "mmio");
709 ata_port_pbar_desc(ap, MMIO_BAR, offset, "port");
710 ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
711 (unsigned long long)pci_resource_start(pdev, 2 * i),
712 (unsigned long long)pci_resource_start(pdev, (2 * i + 1)) |
713 ATA_PCI_CTL_OFS);
706 } 714 }
707 715
708 hpriv->cached_hctl = readw(iomap[MMIO_BAR] + HOST_CTL); 716 hpriv->cached_hctl = readw(iomap[MMIO_BAR] + HOST_CTL);
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 68c3f22890d2..08077efa9afd 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -2584,8 +2584,14 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
2584 } 2584 }
2585 2585
2586 for (port = 0; port < host->n_ports; port++) { 2586 for (port = 0; port < host->n_ports; port++) {
2587 struct ata_port *ap = host->ports[port];
2587 void __iomem *port_mmio = mv_port_base(mmio, port); 2588 void __iomem *port_mmio = mv_port_base(mmio, port);
2588 mv_port_init(&host->ports[port]->ioaddr, port_mmio); 2589 unsigned int offset = port_mmio - mmio;
2590
2591 mv_port_init(&ap->ioaddr, port_mmio);
2592
2593 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio");
2594 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port");
2589 } 2595 }
2590 2596
2591 for (hc = 0; hc < n_hc; hc++) { 2597 for (hc = 0; hc < n_hc; hc++) {
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 983bff5c4def..903213153b5d 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -1003,10 +1003,15 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
1003 1003
1004 is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags); 1004 is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags);
1005 for (i = 0; i < host->n_ports; i++) { 1005 for (i = 0; i < host->n_ports; i++) {
1006 struct ata_port *ap = host->ports[i];
1006 unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4); 1007 unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4);
1007 pdc_ata_setup_port(host->ports[i], 1008 unsigned int port_offset = 0x200 + ata_no * 0x80;
1008 base + 0x200 + ata_no * 0x80, 1009 unsigned int scr_offset = 0x400 + ata_no * 0x100;
1009 base + 0x400 + ata_no * 0x100); 1010
1011 pdc_ata_setup_port(ap, base + port_offset, base + scr_offset);
1012
1013 ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio");
1014 ata_port_pbar_desc(ap, PDC_MMIO_BAR, port_offset, "port");
1010 } 1015 }
1011 1016
1012 /* initialize adapter */ 1017 /* initialize adapter */
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 10bf52ca1e19..c4c4cd29eebb 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -635,9 +635,14 @@ static int qs_ata_init_one(struct pci_dev *pdev,
635 return rc; 635 return rc;
636 636
637 for (port_no = 0; port_no < host->n_ports; ++port_no) { 637 for (port_no = 0; port_no < host->n_ports; ++port_no) {
638 void __iomem *chan = 638 struct ata_port *ap = host->ports[port_no];
639 host->iomap[QS_MMIO_BAR] + (port_no * 0x4000); 639 unsigned int offset = port_no * 0x4000;
640 qs_ata_setup_port(&host->ports[port_no]->ioaddr, chan); 640 void __iomem *chan = host->iomap[QS_MMIO_BAR] + offset;
641
642 qs_ata_setup_port(&ap->ioaddr, chan);
643
644 ata_port_pbar_desc(ap, QS_MMIO_BAR, -1, "mmio");
645 ata_port_pbar_desc(ap, QS_MMIO_BAR, offset, "port");
641 } 646 }
642 647
643 /* initialize adapter */ 648 /* initialize adapter */
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index df0ac77fcdd4..ea3a0ab7e027 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -687,7 +687,8 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
687 mmio_base = host->iomap[SIL_MMIO_BAR]; 687 mmio_base = host->iomap[SIL_MMIO_BAR];
688 688
689 for (i = 0; i < host->n_ports; i++) { 689 for (i = 0; i < host->n_ports; i++) {
690 struct ata_ioports *ioaddr = &host->ports[i]->ioaddr; 690 struct ata_port *ap = host->ports[i];
691 struct ata_ioports *ioaddr = &ap->ioaddr;
691 692
692 ioaddr->cmd_addr = mmio_base + sil_port[i].tf; 693 ioaddr->cmd_addr = mmio_base + sil_port[i].tf;
693 ioaddr->altstatus_addr = 694 ioaddr->altstatus_addr =
@@ -695,6 +696,9 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
695 ioaddr->bmdma_addr = mmio_base + sil_port[i].bmdma; 696 ioaddr->bmdma_addr = mmio_base + sil_port[i].bmdma;
696 ioaddr->scr_addr = mmio_base + sil_port[i].scr; 697 ioaddr->scr_addr = mmio_base + sil_port[i].scr;
697 ata_std_ports(ioaddr); 698 ata_std_ports(ioaddr);
699
700 ata_port_pbar_desc(ap, SIL_MMIO_BAR, -1, "mmio");
701 ata_port_pbar_desc(ap, SIL_MMIO_BAR, sil_port[i].tf, "tf");
698 } 702 }
699 703
700 /* initialize and activate */ 704 /* initialize and activate */
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index e0cd31aa8002..3dcb223117be 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1119,12 +1119,15 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1119 host->iomap = iomap; 1119 host->iomap = iomap;
1120 1120
1121 for (i = 0; i < host->n_ports; i++) { 1121 for (i = 0; i < host->n_ports; i++) {
1122 void __iomem *port = iomap[SIL24_PORT_BAR] + i * PORT_REGS_SIZE; 1122 struct ata_port *ap = host->ports[i];
1123 size_t offset = ap->port_no * PORT_REGS_SIZE;
1124 void __iomem *port = iomap[SIL24_PORT_BAR] + offset;
1123 1125
1124 host->ports[i]->ioaddr.cmd_addr = port; 1126 host->ports[i]->ioaddr.cmd_addr = port;
1125 host->ports[i]->ioaddr.scr_addr = port + PORT_SCONTROL; 1127 host->ports[i]->ioaddr.scr_addr = port + PORT_SCONTROL;
1126 1128
1127 ata_std_ports(&host->ports[i]->ioaddr); 1129 ata_port_pbar_desc(ap, SIL24_HOST_BAR, -1, "host");
1130 ata_port_pbar_desc(ap, SIL24_PORT_BAR, offset, "port");
1128 } 1131 }
1129 1132
1130 /* configure and activate the device */ 1133 /* configure and activate the device */
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 822cabfec951..12d613c48c19 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -443,9 +443,15 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
443 /* different controllers have different number of ports - currently 4 or 8 */ 443 /* different controllers have different number of ports - currently 4 or 8 */
444 /* All ports are on the same function. Multi-function device is no 444 /* All ports are on the same function. Multi-function device is no
445 * longer available. This should not be seen in any system. */ 445 * longer available. This should not be seen in any system. */
446 for (i = 0; i < host->n_ports; i++) 446 for (i = 0; i < host->n_ports; i++) {
447 k2_sata_setup_port(&host->ports[i]->ioaddr, 447 struct ata_port *ap = host->ports[i];
448 mmio_base + i * K2_SATA_PORT_OFFSET); 448 unsigned int offset = i * K2_SATA_PORT_OFFSET;
449
450 k2_sata_setup_port(&ap->ioaddr, mmio_base + offset);
451
452 ata_port_pbar_desc(ap, 5, -1, "mmio");
453 ata_port_pbar_desc(ap, 5, offset, "port");
454 }
449 455
450 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); 456 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
451 if (rc) 457 if (rc)
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index b425061dbe8c..9f9f7b30654a 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -1381,9 +1381,8 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
1381 const struct ata_port_info *ppi[] = 1381 const struct ata_port_info *ppi[] =
1382 { &pdc_port_info[ent->driver_data], NULL }; 1382 { &pdc_port_info[ent->driver_data], NULL };
1383 struct ata_host *host; 1383 struct ata_host *host;
1384 void __iomem *base;
1385 struct pdc_host_priv *hpriv; 1384 struct pdc_host_priv *hpriv;
1386 int rc; 1385 int i, rc;
1387 1386
1388 if (!printed_version++) 1387 if (!printed_version++)
1389 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 1388 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
@@ -1409,11 +1408,17 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
1409 return rc; 1408 return rc;
1410 host->iomap = pcim_iomap_table(pdev); 1409 host->iomap = pcim_iomap_table(pdev);
1411 1410
1412 base = host->iomap[PDC_MMIO_BAR] + PDC_CHIP0_OFS; 1411 for (i = 0; i < 4; i++) {
1413 pdc_sata_setup_port(&host->ports[0]->ioaddr, base + 0x200); 1412 struct ata_port *ap = host->ports[i];
1414 pdc_sata_setup_port(&host->ports[1]->ioaddr, base + 0x280); 1413 void __iomem *base = host->iomap[PDC_MMIO_BAR] + PDC_CHIP0_OFS;
1415 pdc_sata_setup_port(&host->ports[2]->ioaddr, base + 0x300); 1414 unsigned int offset = 0x200 + i * 0x80;
1416 pdc_sata_setup_port(&host->ports[3]->ioaddr, base + 0x380); 1415
1416 pdc_sata_setup_port(&ap->ioaddr, base + offset);
1417
1418 ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio");
1419 ata_port_pbar_desc(ap, PDC_DIMM_BAR, -1, "dimm");
1420 ata_port_pbar_desc(ap, PDC_MMIO_BAR, offset, "port");
1421 }
1417 1422
1418 /* configure and activate */ 1423 /* configure and activate */
1419 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); 1424 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 6c53a790805f..d394da085ae4 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -239,6 +239,12 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
239 hpriv->scr_cfg_addr[2] = ULI5287_BASE + ULI5287_OFFS*4; 239 hpriv->scr_cfg_addr[2] = ULI5287_BASE + ULI5287_OFFS*4;
240 ata_std_ports(ioaddr); 240 ata_std_ports(ioaddr);
241 241
242 ata_port_desc(host->ports[2],
243 "cmd 0x%llx ctl 0x%llx bmdma 0x%llx",
244 (unsigned long long)pci_resource_start(pdev, 0) + 8,
245 ((unsigned long long)pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS) + 4,
246 (unsigned long long)pci_resource_start(pdev, 4) + 16);
247
242 ioaddr = &host->ports[3]->ioaddr; 248 ioaddr = &host->ports[3]->ioaddr;
243 ioaddr->cmd_addr = iomap[2] + 8; 249 ioaddr->cmd_addr = iomap[2] + 8;
244 ioaddr->altstatus_addr = 250 ioaddr->altstatus_addr =
@@ -247,6 +253,13 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
247 ioaddr->bmdma_addr = iomap[4] + 24; 253 ioaddr->bmdma_addr = iomap[4] + 24;
248 hpriv->scr_cfg_addr[3] = ULI5287_BASE + ULI5287_OFFS*5; 254 hpriv->scr_cfg_addr[3] = ULI5287_BASE + ULI5287_OFFS*5;
249 ata_std_ports(ioaddr); 255 ata_std_ports(ioaddr);
256
257 ata_port_desc(host->ports[2],
258 "cmd 0x%llx ctl 0x%llx bmdma 0x%llx",
259 (unsigned long long)pci_resource_start(pdev, 2) + 9,
260 ((unsigned long long)pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS) + 4,
261 (unsigned long long)pci_resource_start(pdev, 4) + 24);
262
250 break; 263 break;
251 264
252 case uli_5289: 265 case uli_5289:
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 25162ec99384..f0757023ce9d 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -399,6 +399,9 @@ static void vt6421_init_addrs(struct ata_port *ap)
399 ioaddr->scr_addr = vt6421_scr_addr(iomap[5], ap->port_no); 399 ioaddr->scr_addr = vt6421_scr_addr(iomap[5], ap->port_no);
400 400
401 ata_std_ports(ioaddr); 401 ata_std_ports(ioaddr);
402
403 ata_port_pbar_desc(ap, ap->port_no, -1, "port");
404 ata_port_pbar_desc(ap, 4, ap->port_no * 8, "bmdma");
402} 405}
403 406
404static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) 407static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index b1777c3f6d5c..0d9be1684873 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -406,9 +406,15 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
406 406
407 mmio_base = host->iomap[VSC_MMIO_BAR]; 407 mmio_base = host->iomap[VSC_MMIO_BAR];
408 408
409 for (i = 0; i < host->n_ports; i++) 409 for (i = 0; i < host->n_ports; i++) {
410 vsc_sata_setup_port(&host->ports[i]->ioaddr, 410 struct ata_port *ap = host->ports[i];
411 mmio_base + (i + 1) * VSC_SATA_PORT_OFFSET); 411 unsigned int offset = (i + 1) * VSC_SATA_PORT_OFFSET;
412
413 vsc_sata_setup_port(&ap->ioaddr, mmio_base + offset);
414
415 ata_port_pbar_desc(ap, VSC_MMIO_BAR, -1, "mmio");
416 ata_port_pbar_desc(ap, VSC_MMIO_BAR, offset, "port");
417 }
412 418
413 /* 419 /*
414 * Use 32 bit DMA mask, because 64 bit address support is poor. 420 * Use 32 bit DMA mask, because 64 bit address support is poor.