aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-05-28 08:33:01 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-09 12:17:34 -0400
commitdab632e8c483532bd84e1f3401c72612e39a7c40 (patch)
tree43d70da1e30389457ac3cfb4f7ded5e5429fb4cc /drivers/ata/ahci.c
parentab2181cf390902f0371f30e4ebeb407b4aaa7314 (diff)
[libata] ahci: minor internal cleanups
Minor cleanups, in preparation for merging Marvell PATA AHCI support in the future. Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 779a2b0aadda..b14e7ef343f3 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -229,6 +229,9 @@ static void ahci_error_handler(struct ata_port *ap);
229static void ahci_vt8251_error_handler(struct ata_port *ap); 229static void ahci_vt8251_error_handler(struct ata_port *ap);
230static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); 230static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
231static int ahci_port_resume(struct ata_port *ap); 231static int ahci_port_resume(struct ata_port *ap);
232static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl);
233static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
234 u32 opts);
232#ifdef CONFIG_PM 235#ifdef CONFIG_PM
233static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg); 236static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
234static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 237static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
@@ -481,11 +484,17 @@ static inline int ahci_nr_ports(u32 cap)
481 return (cap & 0x1f) + 1; 484 return (cap & 0x1f) + 1;
482} 485}
483 486
484static inline void __iomem *ahci_port_base(struct ata_port *ap) 487static inline void __iomem *__ahci_port_base(struct ata_host *host,
488 unsigned int port_no)
485{ 489{
486 void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; 490 void __iomem *mmio = host->iomap[AHCI_PCI_BAR];
487 491
488 return mmio + 0x100 + (ap->port_no * 0x80); 492 return mmio + 0x100 + (port_no * 0x80);
493}
494
495static inline void __iomem *ahci_port_base(struct ata_port *ap)
496{
497 return __ahci_port_base(ap->host, ap->port_no);
489} 498}
490 499
491/** 500/**
@@ -1750,14 +1759,18 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1750 host->private_data = hpriv; 1759 host->private_data = hpriv;
1751 1760
1752 for (i = 0; i < host->n_ports; i++) { 1761 for (i = 0; i < host->n_ports; i++) {
1753 if (hpriv->port_map & (1 << i)) { 1762 struct ata_port *ap = host->ports[i];
1754 struct ata_port *ap = host->ports[i]; 1763 void __iomem *port_mmio = ahci_port_base(ap);
1755 void __iomem *port_mmio = ahci_port_base(ap);
1756 1764
1765 /* standard SATA port setup */
1766 if (hpriv->port_map & (1 << i)) {
1757 ap->ioaddr.cmd_addr = port_mmio; 1767 ap->ioaddr.cmd_addr = port_mmio;
1758 ap->ioaddr.scr_addr = port_mmio + PORT_SCR; 1768 ap->ioaddr.scr_addr = port_mmio + PORT_SCR;
1759 } else 1769 }
1760 host->ports[i]->ops = &ata_dummy_port_ops; 1770
1771 /* disabled/not-implemented port */
1772 else
1773 ap->ops = &ata_dummy_port_ops;
1761 } 1774 }
1762 1775
1763 /* initialize adapter */ 1776 /* initialize adapter */