aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-18 00:14:55 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:37 -0400
commitcbcdd87593a1d85c5c4b259945a3a09eee12814d (patch)
treeee03df963a12ec7f30f6c3a8742421daf2c34f50 /drivers/ata/libata-core.c
parente923090ddd9fef1d4e06dc6c5295e29baced19f3 (diff)
libata: implement and use ata_port_desc() to report port configuration
Currently, port configuration reporting has the following problems. * iomapped address is reported instead of raw address * report contains irrelevant fields or lacks necessary fields for non-SFF controllers. * host->irq/irq2 are there just for reporting and hacky. This patch implements and uses ata_port_desc() and ata_port_pbar_desc(). ata_port_desc() is almost identical to ata_ehi_push_desc() except that it takes @ap instead of @ehi, has no locking requirement, can only be used during host initialization and " " is used as separator instead of ", ". ata_port_pbar_desc() is a helper to ease reporting of a PCI BAR or an offsetted address into it. LLD pushes whatever description it wants using the above two functions. The accumulated description is printed on host registration after "[S/P]ATA max MAX_XFERMODE ". SFF init helpers and ata_host_activate() automatically add descriptions for addresses and irq respectively, so only LLDs which isn't standard SFF need to add custom descriptions. In many cases, such controllers need to report different things anyway. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c27
1 files changed, 11 insertions, 16 deletions
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);