aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_sil24.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/sata_sil24.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/sata_sil24.c')
-rw-r--r--drivers/ata/sata_sil24.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 2d7cf3264587..39cb07baebae 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -316,7 +316,7 @@ struct sil24_port_priv {
316 struct ata_taskfile tf; /* Cached taskfile registers */ 316 struct ata_taskfile tf; /* Cached taskfile registers */
317}; 317};
318 318
319/* ap->host_set->private_data */ 319/* ap->host->private_data */
320struct sil24_host_priv { 320struct sil24_host_priv {
321 void __iomem *host_base; /* global controller control (128 bytes @BAR0) */ 321 void __iomem *host_base; /* global controller control (128 bytes @BAR0) */
322 void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */ 322 void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */
@@ -337,7 +337,7 @@ static void sil24_error_handler(struct ata_port *ap);
337static void sil24_post_internal_cmd(struct ata_queued_cmd *qc); 337static void sil24_post_internal_cmd(struct ata_queued_cmd *qc);
338static int sil24_port_start(struct ata_port *ap); 338static int sil24_port_start(struct ata_port *ap);
339static void sil24_port_stop(struct ata_port *ap); 339static void sil24_port_stop(struct ata_port *ap);
340static void sil24_host_stop(struct ata_host_set *host_set); 340static void sil24_host_stop(struct ata_host *host);
341static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 341static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
342#ifdef CONFIG_PM 342#ifdef CONFIG_PM
343static int sil24_pci_device_resume(struct pci_dev *pdev); 343static int sil24_pci_device_resume(struct pci_dev *pdev);
@@ -415,7 +415,7 @@ static const struct ata_port_operations sil24_ops = {
415}; 415};
416 416
417/* 417/*
418 * Use bits 30-31 of host_flags to encode available port numbers. 418 * Use bits 30-31 of port_flags to encode available port numbers.
419 * Current maxium is 4. 419 * Current maxium is 4.
420 */ 420 */
421#define SIL24_NPORTS2FLAG(nports) ((((unsigned)(nports) - 1) & 0x3) << 30) 421#define SIL24_NPORTS2FLAG(nports) ((((unsigned)(nports) - 1) & 0x3) << 30)
@@ -425,7 +425,7 @@ static struct ata_port_info sil24_port_info[] = {
425 /* sil_3124 */ 425 /* sil_3124 */
426 { 426 {
427 .sht = &sil24_sht, 427 .sht = &sil24_sht,
428 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(4) | 428 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(4) |
429 SIL24_FLAG_PCIX_IRQ_WOC, 429 SIL24_FLAG_PCIX_IRQ_WOC,
430 .pio_mask = 0x1f, /* pio0-4 */ 430 .pio_mask = 0x1f, /* pio0-4 */
431 .mwdma_mask = 0x07, /* mwdma0-2 */ 431 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -435,7 +435,7 @@ static struct ata_port_info sil24_port_info[] = {
435 /* sil_3132 */ 435 /* sil_3132 */
436 { 436 {
437 .sht = &sil24_sht, 437 .sht = &sil24_sht,
438 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(2), 438 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(2),
439 .pio_mask = 0x1f, /* pio0-4 */ 439 .pio_mask = 0x1f, /* pio0-4 */
440 .mwdma_mask = 0x07, /* mwdma0-2 */ 440 .mwdma_mask = 0x07, /* mwdma0-2 */
441 .udma_mask = 0x3f, /* udma0-5 */ 441 .udma_mask = 0x3f, /* udma0-5 */
@@ -444,7 +444,7 @@ static struct ata_port_info sil24_port_info[] = {
444 /* sil_3131/sil_3531 */ 444 /* sil_3131/sil_3531 */
445 { 445 {
446 .sht = &sil24_sht, 446 .sht = &sil24_sht,
447 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(1), 447 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(1),
448 .pio_mask = 0x1f, /* pio0-4 */ 448 .pio_mask = 0x1f, /* pio0-4 */
449 .mwdma_mask = 0x07, /* mwdma0-2 */ 449 .mwdma_mask = 0x07, /* mwdma0-2 */
450 .udma_mask = 0x3f, /* udma0-5 */ 450 .udma_mask = 0x3f, /* udma0-5 */
@@ -871,8 +871,8 @@ static inline void sil24_host_intr(struct ata_port *ap)
871 871
872static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs) 872static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
873{ 873{
874 struct ata_host_set *host_set = dev_instance; 874 struct ata_host *host = dev_instance;
875 struct sil24_host_priv *hpriv = host_set->private_data; 875 struct sil24_host_priv *hpriv = host->private_data;
876 unsigned handled = 0; 876 unsigned handled = 0;
877 u32 status; 877 u32 status;
878 int i; 878 int i;
@@ -888,20 +888,20 @@ static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *
888 if (!(status & IRQ_STAT_4PORTS)) 888 if (!(status & IRQ_STAT_4PORTS))
889 goto out; 889 goto out;
890 890
891 spin_lock(&host_set->lock); 891 spin_lock(&host->lock);
892 892
893 for (i = 0; i < host_set->n_ports; i++) 893 for (i = 0; i < host->n_ports; i++)
894 if (status & (1 << i)) { 894 if (status & (1 << i)) {
895 struct ata_port *ap = host_set->ports[i]; 895 struct ata_port *ap = host->ports[i];
896 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) { 896 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) {
897 sil24_host_intr(host_set->ports[i]); 897 sil24_host_intr(host->ports[i]);
898 handled++; 898 handled++;
899 } else 899 } else
900 printk(KERN_ERR DRV_NAME 900 printk(KERN_ERR DRV_NAME
901 ": interrupt from disabled port %d\n", i); 901 ": interrupt from disabled port %d\n", i);
902 } 902 }
903 903
904 spin_unlock(&host_set->lock); 904 spin_unlock(&host->lock);
905 out: 905 out:
906 return IRQ_RETVAL(handled); 906 return IRQ_RETVAL(handled);
907} 907}
@@ -941,7 +941,7 @@ static inline void sil24_cblk_free(struct sil24_port_priv *pp, struct device *de
941 941
942static int sil24_port_start(struct ata_port *ap) 942static int sil24_port_start(struct ata_port *ap)
943{ 943{
944 struct device *dev = ap->host_set->dev; 944 struct device *dev = ap->host->dev;
945 struct sil24_port_priv *pp; 945 struct sil24_port_priv *pp;
946 union sil24_cmd_block *cb; 946 union sil24_cmd_block *cb;
947 size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS; 947 size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS;
@@ -980,7 +980,7 @@ err_out:
980 980
981static void sil24_port_stop(struct ata_port *ap) 981static void sil24_port_stop(struct ata_port *ap)
982{ 982{
983 struct device *dev = ap->host_set->dev; 983 struct device *dev = ap->host->dev;
984 struct sil24_port_priv *pp = ap->private_data; 984 struct sil24_port_priv *pp = ap->private_data;
985 985
986 sil24_cblk_free(pp, dev); 986 sil24_cblk_free(pp, dev);
@@ -988,10 +988,10 @@ static void sil24_port_stop(struct ata_port *ap)
988 kfree(pp); 988 kfree(pp);
989} 989}
990 990
991static void sil24_host_stop(struct ata_host_set *host_set) 991static void sil24_host_stop(struct ata_host *host)
992{ 992{
993 struct sil24_host_priv *hpriv = host_set->private_data; 993 struct sil24_host_priv *hpriv = host->private_data;
994 struct pci_dev *pdev = to_pci_dev(host_set->dev); 994 struct pci_dev *pdev = to_pci_dev(host->dev);
995 995
996 pci_iounmap(pdev, hpriv->host_base); 996 pci_iounmap(pdev, hpriv->host_base);
997 pci_iounmap(pdev, hpriv->port_base); 997 pci_iounmap(pdev, hpriv->port_base);
@@ -999,7 +999,7 @@ static void sil24_host_stop(struct ata_host_set *host_set)
999} 999}
1000 1000
1001static void sil24_init_controller(struct pci_dev *pdev, int n_ports, 1001static void sil24_init_controller(struct pci_dev *pdev, int n_ports,
1002 unsigned long host_flags, 1002 unsigned long port_flags,
1003 void __iomem *host_base, 1003 void __iomem *host_base,
1004 void __iomem *port_base) 1004 void __iomem *port_base)
1005{ 1005{
@@ -1032,7 +1032,7 @@ static void sil24_init_controller(struct pci_dev *pdev, int n_ports,
1032 } 1032 }
1033 1033
1034 /* Configure IRQ WoC */ 1034 /* Configure IRQ WoC */
1035 if (host_flags & SIL24_FLAG_PCIX_IRQ_WOC) 1035 if (port_flags & SIL24_FLAG_PCIX_IRQ_WOC)
1036 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_STAT); 1036 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_STAT);
1037 else 1037 else
1038 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR); 1038 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR);
@@ -1101,12 +1101,12 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1101 INIT_LIST_HEAD(&probe_ent->node); 1101 INIT_LIST_HEAD(&probe_ent->node);
1102 1102
1103 probe_ent->sht = pinfo->sht; 1103 probe_ent->sht = pinfo->sht;
1104 probe_ent->host_flags = pinfo->host_flags; 1104 probe_ent->port_flags = pinfo->flags;
1105 probe_ent->pio_mask = pinfo->pio_mask; 1105 probe_ent->pio_mask = pinfo->pio_mask;
1106 probe_ent->mwdma_mask = pinfo->mwdma_mask; 1106 probe_ent->mwdma_mask = pinfo->mwdma_mask;
1107 probe_ent->udma_mask = pinfo->udma_mask; 1107 probe_ent->udma_mask = pinfo->udma_mask;
1108 probe_ent->port_ops = pinfo->port_ops; 1108 probe_ent->port_ops = pinfo->port_ops;
1109 probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->host_flags); 1109 probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->flags);
1110 1110
1111 probe_ent->irq = pdev->irq; 1111 probe_ent->irq = pdev->irq;
1112 probe_ent->irq_flags = IRQF_SHARED; 1112 probe_ent->irq_flags = IRQF_SHARED;
@@ -1144,14 +1144,14 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1144 } 1144 }
1145 1145
1146 /* Apply workaround for completion IRQ loss on PCI-X errata */ 1146 /* Apply workaround for completion IRQ loss on PCI-X errata */
1147 if (probe_ent->host_flags & SIL24_FLAG_PCIX_IRQ_WOC) { 1147 if (probe_ent->port_flags & SIL24_FLAG_PCIX_IRQ_WOC) {
1148 tmp = readl(host_base + HOST_CTRL); 1148 tmp = readl(host_base + HOST_CTRL);
1149 if (tmp & (HOST_CTRL_TRDY | HOST_CTRL_STOP | HOST_CTRL_DEVSEL)) 1149 if (tmp & (HOST_CTRL_TRDY | HOST_CTRL_STOP | HOST_CTRL_DEVSEL))
1150 dev_printk(KERN_INFO, &pdev->dev, 1150 dev_printk(KERN_INFO, &pdev->dev,
1151 "Applying completion IRQ loss on PCI-X " 1151 "Applying completion IRQ loss on PCI-X "
1152 "errata fix\n"); 1152 "errata fix\n");
1153 else 1153 else
1154 probe_ent->host_flags &= ~SIL24_FLAG_PCIX_IRQ_WOC; 1154 probe_ent->port_flags &= ~SIL24_FLAG_PCIX_IRQ_WOC;
1155 } 1155 }
1156 1156
1157 for (i = 0; i < probe_ent->n_ports; i++) { 1157 for (i = 0; i < probe_ent->n_ports; i++) {
@@ -1164,7 +1164,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1164 ata_std_ports(&probe_ent->port[i]); 1164 ata_std_ports(&probe_ent->port[i]);
1165 } 1165 }
1166 1166
1167 sil24_init_controller(pdev, probe_ent->n_ports, probe_ent->host_flags, 1167 sil24_init_controller(pdev, probe_ent->n_ports, probe_ent->port_flags,
1168 host_base, port_base); 1168 host_base, port_base);
1169 1169
1170 pci_set_master(pdev); 1170 pci_set_master(pdev);
@@ -1191,19 +1191,18 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1191#ifdef CONFIG_PM 1191#ifdef CONFIG_PM
1192static int sil24_pci_device_resume(struct pci_dev *pdev) 1192static int sil24_pci_device_resume(struct pci_dev *pdev)
1193{ 1193{
1194 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 1194 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1195 struct sil24_host_priv *hpriv = host_set->private_data; 1195 struct sil24_host_priv *hpriv = host->private_data;
1196 1196
1197 ata_pci_device_do_resume(pdev); 1197 ata_pci_device_do_resume(pdev);
1198 1198
1199 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) 1199 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND)
1200 writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL); 1200 writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL);
1201 1201
1202 sil24_init_controller(pdev, host_set->n_ports, 1202 sil24_init_controller(pdev, host->n_ports, host->ports[0]->flags,
1203 host_set->ports[0]->flags,
1204 hpriv->host_base, hpriv->port_base); 1203 hpriv->host_base, hpriv->port_base);
1205 1204
1206 ata_host_set_resume(host_set); 1205 ata_host_resume(host);
1207 1206
1208 return 0; 1207 return 0;
1209} 1208}