aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-08-24 03:19:22 -0400
committerJeff Garzik <jeff@garzik.org>2006-08-24 03:19:22 -0400
commitcca3974e48607c3775dc73b544a5700b2e37c21a (patch)
tree0777d6121ba199af0aad196eb5a693510ec8e62e /drivers/ata/ahci.c
parent54a86bfc3d4601be9c36cd4e8a1bdc580c98fa6a (diff)
libata: Grand renaming.
The biggest change is that ata_host_set is renamed to ata_host. * ata_host_set => ata_host * ata_probe_ent->host_flags => ata_probe_ent->port_flags * ata_probe_ent->host_set_flags => ata_probe_ent->_host_flags * ata_host_stats => ata_port_stats * ata_port->host => ata_port->scsi_host * ata_port->host_set => ata_port->host * ata_port_info->host_flags => ata_port_info->flags * ata_(.*)host_set(.*)\(\) => ata_\1host\2() The leading underscore in ata_probe_ent->_host_flags is to avoid reusing ->host_flags for different purpose. Currently, the only user of the field is libata-bmdma.c and probe_ent itself is scheduled to be removed. ata_port->host is reused for different purpose but this field is used inside libata core proper and of different type. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 813031c01fba..3f1106fdaed1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -277,7 +277,7 @@ static const struct ata_port_info ahci_port_info[] = {
277 /* board_ahci */ 277 /* board_ahci */
278 { 278 {
279 .sht = &ahci_sht, 279 .sht = &ahci_sht,
280 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 280 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
281 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 281 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
282 ATA_FLAG_SKIP_D2H_BSY, 282 ATA_FLAG_SKIP_D2H_BSY,
283 .pio_mask = 0x1f, /* pio0-4 */ 283 .pio_mask = 0x1f, /* pio0-4 */
@@ -287,7 +287,7 @@ static const struct ata_port_info ahci_port_info[] = {
287 /* board_ahci_vt8251 */ 287 /* board_ahci_vt8251 */
288 { 288 {
289 .sht = &ahci_sht, 289 .sht = &ahci_sht,
290 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 290 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
291 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 291 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
292 ATA_FLAG_SKIP_D2H_BSY | 292 ATA_FLAG_SKIP_D2H_BSY |
293 AHCI_FLAG_RESET_NEEDS_CLO | AHCI_FLAG_NO_NCQ, 293 AHCI_FLAG_RESET_NEEDS_CLO | AHCI_FLAG_NO_NCQ,
@@ -709,7 +709,7 @@ static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
709static int ahci_clo(struct ata_port *ap) 709static int ahci_clo(struct ata_port *ap)
710{ 710{
711 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; 711 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;
712 struct ahci_host_priv *hpriv = ap->host_set->private_data; 712 struct ahci_host_priv *hpriv = ap->host->private_data;
713 u32 tmp; 713 u32 tmp;
714 714
715 if (!(hpriv->cap & HOST_CAP_CLO)) 715 if (!(hpriv->cap & HOST_CAP_CLO))
@@ -741,7 +741,7 @@ static int ahci_prereset(struct ata_port *ap)
741static int ahci_softreset(struct ata_port *ap, unsigned int *class) 741static int ahci_softreset(struct ata_port *ap, unsigned int *class)
742{ 742{
743 struct ahci_port_priv *pp = ap->private_data; 743 struct ahci_port_priv *pp = ap->private_data;
744 void __iomem *mmio = ap->host_set->mmio_base; 744 void __iomem *mmio = ap->host->mmio_base;
745 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 745 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
746 const u32 cmd_fis_len = 5; /* five dwords */ 746 const u32 cmd_fis_len = 5; /* five dwords */
747 const char *reason = NULL; 747 const char *reason = NULL;
@@ -850,7 +850,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
850 struct ahci_port_priv *pp = ap->private_data; 850 struct ahci_port_priv *pp = ap->private_data;
851 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 851 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
852 struct ata_taskfile tf; 852 struct ata_taskfile tf;
853 void __iomem *mmio = ap->host_set->mmio_base; 853 void __iomem *mmio = ap->host->mmio_base;
854 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 854 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
855 int rc; 855 int rc;
856 856
@@ -1039,7 +1039,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1039 1039
1040static void ahci_host_intr(struct ata_port *ap) 1040static void ahci_host_intr(struct ata_port *ap)
1041{ 1041{
1042 void __iomem *mmio = ap->host_set->mmio_base; 1042 void __iomem *mmio = ap->host->mmio_base;
1043 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1043 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1044 struct ata_eh_info *ehi = &ap->eh_info; 1044 struct ata_eh_info *ehi = &ap->eh_info;
1045 u32 status, qc_active; 1045 u32 status, qc_active;
@@ -1091,7 +1091,7 @@ static void ahci_irq_clear(struct ata_port *ap)
1091 1091
1092static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *regs) 1092static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
1093{ 1093{
1094 struct ata_host_set *host_set = dev_instance; 1094 struct ata_host *host = dev_instance;
1095 struct ahci_host_priv *hpriv; 1095 struct ahci_host_priv *hpriv;
1096 unsigned int i, handled = 0; 1096 unsigned int i, handled = 0;
1097 void __iomem *mmio; 1097 void __iomem *mmio;
@@ -1099,8 +1099,8 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
1099 1099
1100 VPRINTK("ENTER\n"); 1100 VPRINTK("ENTER\n");
1101 1101
1102 hpriv = host_set->private_data; 1102 hpriv = host->private_data;
1103 mmio = host_set->mmio_base; 1103 mmio = host->mmio_base;
1104 1104
1105 /* sigh. 0xffffffff is a valid return from h/w */ 1105 /* sigh. 0xffffffff is a valid return from h/w */
1106 irq_stat = readl(mmio + HOST_IRQ_STAT); 1106 irq_stat = readl(mmio + HOST_IRQ_STAT);
@@ -1108,22 +1108,22 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
1108 if (!irq_stat) 1108 if (!irq_stat)
1109 return IRQ_NONE; 1109 return IRQ_NONE;
1110 1110
1111 spin_lock(&host_set->lock); 1111 spin_lock(&host->lock);
1112 1112
1113 for (i = 0; i < host_set->n_ports; i++) { 1113 for (i = 0; i < host->n_ports; i++) {
1114 struct ata_port *ap; 1114 struct ata_port *ap;
1115 1115
1116 if (!(irq_stat & (1 << i))) 1116 if (!(irq_stat & (1 << i)))
1117 continue; 1117 continue;
1118 1118
1119 ap = host_set->ports[i]; 1119 ap = host->ports[i];
1120 if (ap) { 1120 if (ap) {
1121 ahci_host_intr(ap); 1121 ahci_host_intr(ap);
1122 VPRINTK("port %u\n", i); 1122 VPRINTK("port %u\n", i);
1123 } else { 1123 } else {
1124 VPRINTK("port %u (no irq)\n", i); 1124 VPRINTK("port %u (no irq)\n", i);
1125 if (ata_ratelimit()) 1125 if (ata_ratelimit())
1126 dev_printk(KERN_WARNING, host_set->dev, 1126 dev_printk(KERN_WARNING, host->dev,
1127 "interrupt on disabled port %u\n", i); 1127 "interrupt on disabled port %u\n", i);
1128 } 1128 }
1129 1129
@@ -1135,7 +1135,7 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
1135 handled = 1; 1135 handled = 1;
1136 } 1136 }
1137 1137
1138 spin_unlock(&host_set->lock); 1138 spin_unlock(&host->lock);
1139 1139
1140 VPRINTK("EXIT\n"); 1140 VPRINTK("EXIT\n");
1141 1141
@@ -1157,7 +1157,7 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
1157 1157
1158static void ahci_freeze(struct ata_port *ap) 1158static void ahci_freeze(struct ata_port *ap)
1159{ 1159{
1160 void __iomem *mmio = ap->host_set->mmio_base; 1160 void __iomem *mmio = ap->host->mmio_base;
1161 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1161 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1162 1162
1163 /* turn IRQ off */ 1163 /* turn IRQ off */
@@ -1166,7 +1166,7 @@ static void ahci_freeze(struct ata_port *ap)
1166 1166
1167static void ahci_thaw(struct ata_port *ap) 1167static void ahci_thaw(struct ata_port *ap)
1168{ 1168{
1169 void __iomem *mmio = ap->host_set->mmio_base; 1169 void __iomem *mmio = ap->host->mmio_base;
1170 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1170 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1171 u32 tmp; 1171 u32 tmp;
1172 1172
@@ -1181,7 +1181,7 @@ static void ahci_thaw(struct ata_port *ap)
1181 1181
1182static void ahci_error_handler(struct ata_port *ap) 1182static void ahci_error_handler(struct ata_port *ap)
1183{ 1183{
1184 void __iomem *mmio = ap->host_set->mmio_base; 1184 void __iomem *mmio = ap->host->mmio_base;
1185 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1185 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1186 1186
1187 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { 1187 if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
@@ -1198,7 +1198,7 @@ static void ahci_error_handler(struct ata_port *ap)
1198static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) 1198static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
1199{ 1199{
1200 struct ata_port *ap = qc->ap; 1200 struct ata_port *ap = qc->ap;
1201 void __iomem *mmio = ap->host_set->mmio_base; 1201 void __iomem *mmio = ap->host->mmio_base;
1202 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1202 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1203 1203
1204 if (qc->flags & ATA_QCFLAG_FAILED) 1204 if (qc->flags & ATA_QCFLAG_FAILED)
@@ -1213,9 +1213,9 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
1213 1213
1214static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) 1214static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
1215{ 1215{
1216 struct ahci_host_priv *hpriv = ap->host_set->private_data; 1216 struct ahci_host_priv *hpriv = ap->host->private_data;
1217 struct ahci_port_priv *pp = ap->private_data; 1217 struct ahci_port_priv *pp = ap->private_data;
1218 void __iomem *mmio = ap->host_set->mmio_base; 1218 void __iomem *mmio = ap->host->mmio_base;
1219 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1219 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1220 const char *emsg = NULL; 1220 const char *emsg = NULL;
1221 int rc; 1221 int rc;
@@ -1233,8 +1233,8 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
1233static int ahci_port_resume(struct ata_port *ap) 1233static int ahci_port_resume(struct ata_port *ap)
1234{ 1234{
1235 struct ahci_port_priv *pp = ap->private_data; 1235 struct ahci_port_priv *pp = ap->private_data;
1236 struct ahci_host_priv *hpriv = ap->host_set->private_data; 1236 struct ahci_host_priv *hpriv = ap->host->private_data;
1237 void __iomem *mmio = ap->host_set->mmio_base; 1237 void __iomem *mmio = ap->host->mmio_base;
1238 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1238 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1239 1239
1240 ahci_init_port(port_mmio, hpriv->cap, pp->cmd_slot_dma, pp->rx_fis_dma); 1240 ahci_init_port(port_mmio, hpriv->cap, pp->cmd_slot_dma, pp->rx_fis_dma);
@@ -1244,8 +1244,8 @@ static int ahci_port_resume(struct ata_port *ap)
1244 1244
1245static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) 1245static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
1246{ 1246{
1247 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 1247 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1248 void __iomem *mmio = host_set->mmio_base; 1248 void __iomem *mmio = host->mmio_base;
1249 u32 ctl; 1249 u32 ctl;
1250 1250
1251 if (mesg.event == PM_EVENT_SUSPEND) { 1251 if (mesg.event == PM_EVENT_SUSPEND) {
@@ -1264,9 +1264,9 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
1264 1264
1265static int ahci_pci_device_resume(struct pci_dev *pdev) 1265static int ahci_pci_device_resume(struct pci_dev *pdev)
1266{ 1266{
1267 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 1267 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1268 struct ahci_host_priv *hpriv = host_set->private_data; 1268 struct ahci_host_priv *hpriv = host->private_data;
1269 void __iomem *mmio = host_set->mmio_base; 1269 void __iomem *mmio = host->mmio_base;
1270 int rc; 1270 int rc;
1271 1271
1272 ata_pci_device_do_resume(pdev); 1272 ata_pci_device_do_resume(pdev);
@@ -1276,20 +1276,20 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
1276 if (rc) 1276 if (rc)
1277 return rc; 1277 return rc;
1278 1278
1279 ahci_init_controller(mmio, pdev, host_set->n_ports, hpriv->cap); 1279 ahci_init_controller(mmio, pdev, host->n_ports, hpriv->cap);
1280 } 1280 }
1281 1281
1282 ata_host_set_resume(host_set); 1282 ata_host_resume(host);
1283 1283
1284 return 0; 1284 return 0;
1285} 1285}
1286 1286
1287static int ahci_port_start(struct ata_port *ap) 1287static int ahci_port_start(struct ata_port *ap)
1288{ 1288{
1289 struct device *dev = ap->host_set->dev; 1289 struct device *dev = ap->host->dev;
1290 struct ahci_host_priv *hpriv = ap->host_set->private_data; 1290 struct ahci_host_priv *hpriv = ap->host->private_data;
1291 struct ahci_port_priv *pp; 1291 struct ahci_port_priv *pp;
1292 void __iomem *mmio = ap->host_set->mmio_base; 1292 void __iomem *mmio = ap->host->mmio_base;
1293 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1293 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1294 void *mem; 1294 void *mem;
1295 dma_addr_t mem_dma; 1295 dma_addr_t mem_dma;
@@ -1350,10 +1350,10 @@ static int ahci_port_start(struct ata_port *ap)
1350 1350
1351static void ahci_port_stop(struct ata_port *ap) 1351static void ahci_port_stop(struct ata_port *ap)
1352{ 1352{
1353 struct device *dev = ap->host_set->dev; 1353 struct device *dev = ap->host->dev;
1354 struct ahci_host_priv *hpriv = ap->host_set->private_data; 1354 struct ahci_host_priv *hpriv = ap->host->private_data;
1355 struct ahci_port_priv *pp = ap->private_data; 1355 struct ahci_port_priv *pp = ap->private_data;
1356 void __iomem *mmio = ap->host_set->mmio_base; 1356 void __iomem *mmio = ap->host->mmio_base;
1357 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1357 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1358 const char *emsg = NULL; 1358 const char *emsg = NULL;
1359 int rc; 1359 int rc;
@@ -1581,7 +1581,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1581 memset(hpriv, 0, sizeof(*hpriv)); 1581 memset(hpriv, 0, sizeof(*hpriv));
1582 1582
1583 probe_ent->sht = ahci_port_info[board_idx].sht; 1583 probe_ent->sht = ahci_port_info[board_idx].sht;
1584 probe_ent->host_flags = ahci_port_info[board_idx].host_flags; 1584 probe_ent->port_flags = ahci_port_info[board_idx].flags;
1585 probe_ent->pio_mask = ahci_port_info[board_idx].pio_mask; 1585 probe_ent->pio_mask = ahci_port_info[board_idx].pio_mask;
1586 probe_ent->udma_mask = ahci_port_info[board_idx].udma_mask; 1586 probe_ent->udma_mask = ahci_port_info[board_idx].udma_mask;
1587 probe_ent->port_ops = ahci_port_info[board_idx].port_ops; 1587 probe_ent->port_ops = ahci_port_info[board_idx].port_ops;
@@ -1599,9 +1599,9 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1599 if (rc) 1599 if (rc)
1600 goto err_out_hpriv; 1600 goto err_out_hpriv;
1601 1601
1602 if (!(probe_ent->host_flags & AHCI_FLAG_NO_NCQ) && 1602 if (!(probe_ent->port_flags & AHCI_FLAG_NO_NCQ) &&
1603 (hpriv->cap & HOST_CAP_NCQ)) 1603 (hpriv->cap & HOST_CAP_NCQ))
1604 probe_ent->host_flags |= ATA_FLAG_NCQ; 1604 probe_ent->port_flags |= ATA_FLAG_NCQ;
1605 1605
1606 ahci_print_info(probe_ent); 1606 ahci_print_info(probe_ent);
1607 1607
@@ -1632,27 +1632,27 @@ err_out:
1632static void ahci_remove_one (struct pci_dev *pdev) 1632static void ahci_remove_one (struct pci_dev *pdev)
1633{ 1633{
1634 struct device *dev = pci_dev_to_dev(pdev); 1634 struct device *dev = pci_dev_to_dev(pdev);
1635 struct ata_host_set *host_set = dev_get_drvdata(dev); 1635 struct ata_host *host = dev_get_drvdata(dev);
1636 struct ahci_host_priv *hpriv = host_set->private_data; 1636 struct ahci_host_priv *hpriv = host->private_data;
1637 unsigned int i; 1637 unsigned int i;
1638 int have_msi; 1638 int have_msi;
1639 1639
1640 for (i = 0; i < host_set->n_ports; i++) 1640 for (i = 0; i < host->n_ports; i++)
1641 ata_port_detach(host_set->ports[i]); 1641 ata_port_detach(host->ports[i]);
1642 1642
1643 have_msi = hpriv->flags & AHCI_FLAG_MSI; 1643 have_msi = hpriv->flags & AHCI_FLAG_MSI;
1644 free_irq(host_set->irq, host_set); 1644 free_irq(host->irq, host);
1645 1645
1646 for (i = 0; i < host_set->n_ports; i++) { 1646 for (i = 0; i < host->n_ports; i++) {
1647 struct ata_port *ap = host_set->ports[i]; 1647 struct ata_port *ap = host->ports[i];
1648 1648
1649 ata_scsi_release(ap->host); 1649 ata_scsi_release(ap->scsi_host);
1650 scsi_host_put(ap->host); 1650 scsi_host_put(ap->scsi_host);
1651 } 1651 }
1652 1652
1653 kfree(hpriv); 1653 kfree(hpriv);
1654 pci_iounmap(pdev, host_set->mmio_base); 1654 pci_iounmap(pdev, host->mmio_base);
1655 kfree(host_set); 1655 kfree(host);
1656 1656
1657 if (have_msi) 1657 if (have_msi)
1658 pci_disable_msi(pdev); 1658 pci_disable_msi(pdev);