aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_nv.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-26 00:03:37 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-29 06:15:27 -0400
commit5796d1c4c89efff823259fda35b08ea66ebf8b23 (patch)
treef9396980d7a2bfe0fb29303fa90bce66fd87086a /drivers/ata/sata_nv.c
parentb447916e2b8c80f37aa88512ea39a05d5d11507d (diff)
[libata] Address some checkpatch-spotted issues
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/sata_nv.c')
-rw-r--r--drivers/ata/sata_nv.c70
1 files changed, 37 insertions, 33 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 8d55f7fb50af..fea8d8d448e8 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -291,7 +291,7 @@ struct nv_swncq_port_priv {
291}; 291};
292 292
293 293
294#define NV_ADMA_CHECK_INTR(GCTL, PORT) ((GCTL) & ( 1 << (19 + (12 * (PORT))))) 294#define NV_ADMA_CHECK_INTR(GCTL, PORT) ((GCTL) & (1 << (19 + (12 * (PORT)))))
295 295
296static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 296static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
297#ifdef CONFIG_PM 297#ifdef CONFIG_PM
@@ -884,8 +884,9 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)
884 /* Notifier bits set without a command may indicate the drive 884 /* Notifier bits set without a command may indicate the drive
885 is misbehaving. Raise host state machine violation on this 885 is misbehaving. Raise host state machine violation on this
886 condition. */ 886 condition. */
887 ata_port_printk(ap, KERN_ERR, "notifier for tag %d with no command?\n", 887 ata_port_printk(ap, KERN_ERR,
888 cpb_num); 888 "notifier for tag %d with no cmd?\n",
889 cpb_num);
889 ehi->err_mask |= AC_ERR_HSM; 890 ehi->err_mask |= AC_ERR_HSM;
890 ehi->action |= ATA_EH_SOFTRESET; 891 ehi->action |= ATA_EH_SOFTRESET;
891 ata_port_freeze(ap); 892 ata_port_freeze(ap);
@@ -1021,8 +1022,8 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
1021 while ((pos = ffs(check_commands)) && !error) { 1022 while ((pos = ffs(check_commands)) && !error) {
1022 pos--; 1023 pos--;
1023 error = nv_adma_check_cpb(ap, pos, 1024 error = nv_adma_check_cpb(ap, pos,
1024 notifier_error & (1 << pos) ); 1025 notifier_error & (1 << pos));
1025 check_commands &= ~(1 << pos ); 1026 check_commands &= ~(1 << pos);
1026 } 1027 }
1027 } 1028 }
1028 } 1029 }
@@ -1061,7 +1062,7 @@ static void nv_adma_freeze(struct ata_port *ap)
1061 tmp = readw(mmio + NV_ADMA_CTL); 1062 tmp = readw(mmio + NV_ADMA_CTL);
1062 writew(tmp & ~(NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN), 1063 writew(tmp & ~(NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN),
1063 mmio + NV_ADMA_CTL); 1064 mmio + NV_ADMA_CTL);
1064 readw(mmio + NV_ADMA_CTL ); /* flush posted write */ 1065 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1065} 1066}
1066 1067
1067static void nv_adma_thaw(struct ata_port *ap) 1068static void nv_adma_thaw(struct ata_port *ap)
@@ -1079,7 +1080,7 @@ static void nv_adma_thaw(struct ata_port *ap)
1079 tmp = readw(mmio + NV_ADMA_CTL); 1080 tmp = readw(mmio + NV_ADMA_CTL);
1080 writew(tmp | (NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN), 1081 writew(tmp | (NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN),
1081 mmio + NV_ADMA_CTL); 1082 mmio + NV_ADMA_CTL);
1082 readw(mmio + NV_ADMA_CTL ); /* flush posted write */ 1083 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1083} 1084}
1084 1085
1085static void nv_adma_irq_clear(struct ata_port *ap) 1086static void nv_adma_irq_clear(struct ata_port *ap)
@@ -1165,7 +1166,7 @@ static int nv_adma_port_start(struct ata_port *ap)
1165 pp->cpb_dma = mem_dma; 1166 pp->cpb_dma = mem_dma;
1166 1167
1167 writel(mem_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW); 1168 writel(mem_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW);
1168 writel((mem_dma >> 16 ) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH); 1169 writel((mem_dma >> 16) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH);
1169 1170
1170 mem += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ; 1171 mem += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ;
1171 mem_dma += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ; 1172 mem_dma += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ;
@@ -1189,15 +1190,15 @@ static int nv_adma_port_start(struct ata_port *ap)
1189 1190
1190 /* clear GO for register mode, enable interrupt */ 1191 /* clear GO for register mode, enable interrupt */
1191 tmp = readw(mmio + NV_ADMA_CTL); 1192 tmp = readw(mmio + NV_ADMA_CTL);
1192 writew( (tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN | 1193 writew((tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN |
1193 NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL); 1194 NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL);
1194 1195
1195 tmp = readw(mmio + NV_ADMA_CTL); 1196 tmp = readw(mmio + NV_ADMA_CTL);
1196 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1197 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1197 readw(mmio + NV_ADMA_CTL ); /* flush posted write */ 1198 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1198 udelay(1); 1199 udelay(1);
1199 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1200 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1200 readw(mmio + NV_ADMA_CTL ); /* flush posted write */ 1201 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1201 1202
1202 return 0; 1203 return 0;
1203} 1204}
@@ -1237,7 +1238,7 @@ static int nv_adma_port_resume(struct ata_port *ap)
1237 1238
1238 /* set CPB block location */ 1239 /* set CPB block location */
1239 writel(pp->cpb_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW); 1240 writel(pp->cpb_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW);
1240 writel((pp->cpb_dma >> 16 ) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH); 1241 writel((pp->cpb_dma >> 16) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH);
1241 1242
1242 /* clear any outstanding interrupt conditions */ 1243 /* clear any outstanding interrupt conditions */
1243 writew(0xffff, mmio + NV_ADMA_STAT); 1244 writew(0xffff, mmio + NV_ADMA_STAT);
@@ -1250,15 +1251,15 @@ static int nv_adma_port_resume(struct ata_port *ap)
1250 1251
1251 /* clear GO for register mode, enable interrupt */ 1252 /* clear GO for register mode, enable interrupt */
1252 tmp = readw(mmio + NV_ADMA_CTL); 1253 tmp = readw(mmio + NV_ADMA_CTL);
1253 writew( (tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN | 1254 writew((tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN |
1254 NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL); 1255 NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL);
1255 1256
1256 tmp = readw(mmio + NV_ADMA_CTL); 1257 tmp = readw(mmio + NV_ADMA_CTL);
1257 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1258 writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1258 readw(mmio + NV_ADMA_CTL ); /* flush posted write */ 1259 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1259 udelay(1); 1260 udelay(1);
1260 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); 1261 writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL);
1261 readw(mmio + NV_ADMA_CTL ); /* flush posted write */ 1262 readw(mmio + NV_ADMA_CTL); /* flush posted write */
1262 1263
1263 return 0; 1264 return 0;
1264} 1265}
@@ -1342,7 +1343,8 @@ static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb)
1342 idx = 0; 1343 idx = 0;
1343 1344
1344 ata_for_each_sg(sg, qc) { 1345 ata_for_each_sg(sg, qc) {
1345 aprd = (idx < 5) ? &cpb->aprd[idx] : &pp->aprd[NV_ADMA_SGTBL_LEN * qc->tag + (idx-5)]; 1346 aprd = (idx < 5) ? &cpb->aprd[idx] :
1347 &pp->aprd[NV_ADMA_SGTBL_LEN * qc->tag + (idx-5)];
1346 nv_adma_fill_aprd(qc, sg, idx, aprd); 1348 nv_adma_fill_aprd(qc, sg, idx, aprd);
1347 idx++; 1349 idx++;
1348 } 1350 }
@@ -1407,8 +1409,8 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc)
1407 } else 1409 } else
1408 memset(&cpb->aprd[0], 0, sizeof(struct nv_adma_prd) * 5); 1410 memset(&cpb->aprd[0], 0, sizeof(struct nv_adma_prd) * 5);
1409 1411
1410 /* Be paranoid and don't let the device see NV_CPB_CTL_CPB_VALID until we are 1412 /* Be paranoid and don't let the device see NV_CPB_CTL_CPB_VALID
1411 finished filling in all of the contents */ 1413 until we are finished filling in all of the contents */
1412 wmb(); 1414 wmb();
1413 cpb->ctl_flags = ctl_flags; 1415 cpb->ctl_flags = ctl_flags;
1414 wmb(); 1416 wmb();
@@ -1436,15 +1438,15 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
1436 wmb(); 1438 wmb();
1437 1439
1438 if (curr_ncq != pp->last_issue_ncq) { 1440 if (curr_ncq != pp->last_issue_ncq) {
1439 /* Seems to need some delay before switching between NCQ and non-NCQ 1441 /* Seems to need some delay before switching between NCQ and
1440 commands, else we get command timeouts and such. */ 1442 non-NCQ commands, else we get command timeouts and such. */
1441 udelay(20); 1443 udelay(20);
1442 pp->last_issue_ncq = curr_ncq; 1444 pp->last_issue_ncq = curr_ncq;
1443 } 1445 }
1444 1446
1445 writew(qc->tag, mmio + NV_ADMA_APPEND); 1447 writew(qc->tag, mmio + NV_ADMA_APPEND);
1446 1448
1447 DPRINTK("Issued tag %u\n",qc->tag); 1449 DPRINTK("Issued tag %u\n", qc->tag);
1448 1450
1449 return 0; 1451 return 0;
1450} 1452}
@@ -1654,7 +1656,8 @@ static void nv_adma_error_handler(struct ata_port *ap)
1654 u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT); 1656 u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT);
1655 u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX); 1657 u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX);
1656 1658
1657 ata_port_printk(ap, KERN_ERR, "EH in ADMA mode, notifier 0x%X " 1659 ata_port_printk(ap, KERN_ERR,
1660 "EH in ADMA mode, notifier 0x%X "
1658 "notifier_error 0x%X gen_ctl 0x%X status 0x%X " 1661 "notifier_error 0x%X gen_ctl 0x%X status 0x%X "
1659 "next cpb count 0x%X next cpb idx 0x%x\n", 1662 "next cpb count 0x%X next cpb idx 0x%x\n",
1660 notifier, notifier_error, gen_ctl, status, 1663 notifier, notifier_error, gen_ctl, status,
@@ -1663,7 +1666,7 @@ static void nv_adma_error_handler(struct ata_port *ap)
1663 for (i = 0; i < NV_ADMA_MAX_CPBS; i++) { 1666 for (i = 0; i < NV_ADMA_MAX_CPBS; i++) {
1664 struct nv_adma_cpb *cpb = &pp->cpb[i]; 1667 struct nv_adma_cpb *cpb = &pp->cpb[i];
1665 if ((ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) || 1668 if ((ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) ||
1666 ap->link.sactive & (1 << i) ) 1669 ap->link.sactive & (1 << i))
1667 ata_port_printk(ap, KERN_ERR, 1670 ata_port_printk(ap, KERN_ERR,
1668 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", 1671 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n",
1669 i, cpb->ctl_flags, cpb->resp_flags); 1672 i, cpb->ctl_flags, cpb->resp_flags);
@@ -1673,7 +1676,8 @@ static void nv_adma_error_handler(struct ata_port *ap)
1673 /* Push us back into port register mode for error handling. */ 1676 /* Push us back into port register mode for error handling. */
1674 nv_adma_register_mode(ap); 1677 nv_adma_register_mode(ap);
1675 1678
1676 /* Mark all of the CPBs as invalid to prevent them from being executed */ 1679 /* Mark all of the CPBs as invalid to prevent them from
1680 being executed */
1677 for (i = 0; i < NV_ADMA_MAX_CPBS; i++) 1681 for (i = 0; i < NV_ADMA_MAX_CPBS; i++)
1678 pp->cpb[i].ctl_flags &= ~NV_CPB_CTL_CPB_VALID; 1682 pp->cpb[i].ctl_flags &= ~NV_CPB_CTL_CPB_VALID;
1679 1683
@@ -2350,9 +2354,9 @@ static irqreturn_t nv_swncq_interrupt(int irq, void *dev_instance)
2350 return IRQ_RETVAL(handled); 2354 return IRQ_RETVAL(handled);
2351} 2355}
2352 2356
2353static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 2357static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2354{ 2358{
2355 static int printed_version = 0; 2359 static int printed_version;
2356 const struct ata_port_info *ppi[] = { NULL, NULL }; 2360 const struct ata_port_info *ppi[] = { NULL, NULL };
2357 struct ata_host *host; 2361 struct ata_host *host;
2358 struct nv_host_priv *hpriv; 2362 struct nv_host_priv *hpriv;
@@ -2364,7 +2368,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
2364 // Make sure this is a SATA controller by counting the number of bars 2368 // Make sure this is a SATA controller by counting the number of bars
2365 // (NVIDIA SATA controllers will always have six bars). Otherwise, 2369 // (NVIDIA SATA controllers will always have six bars). Otherwise,
2366 // it's an IDE controller and we ignore it. 2370 // it's an IDE controller and we ignore it.
2367 for (bar=0; bar<6; bar++) 2371 for (bar = 0; bar < 6; bar++)
2368 if (pci_resource_start(pdev, bar) == 0) 2372 if (pci_resource_start(pdev, bar) == 0)
2369 return -ENODEV; 2373 return -ENODEV;
2370 2374
@@ -2460,17 +2464,17 @@ static int nv_pci_device_resume(struct pci_dev *pdev)
2460 pp = host->ports[0]->private_data; 2464 pp = host->ports[0]->private_data;
2461 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) 2465 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE)
2462 tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT0_EN | 2466 tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT0_EN |
2463 NV_MCP_SATA_CFG_20_PORT0_PWB_EN); 2467 NV_MCP_SATA_CFG_20_PORT0_PWB_EN);
2464 else 2468 else
2465 tmp32 |= (NV_MCP_SATA_CFG_20_PORT0_EN | 2469 tmp32 |= (NV_MCP_SATA_CFG_20_PORT0_EN |
2466 NV_MCP_SATA_CFG_20_PORT0_PWB_EN); 2470 NV_MCP_SATA_CFG_20_PORT0_PWB_EN);
2467 pp = host->ports[1]->private_data; 2471 pp = host->ports[1]->private_data;
2468 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) 2472 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE)
2469 tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT1_EN | 2473 tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT1_EN |
2470 NV_MCP_SATA_CFG_20_PORT1_PWB_EN); 2474 NV_MCP_SATA_CFG_20_PORT1_PWB_EN);
2471 else 2475 else
2472 tmp32 |= (NV_MCP_SATA_CFG_20_PORT1_EN | 2476 tmp32 |= (NV_MCP_SATA_CFG_20_PORT1_EN |
2473 NV_MCP_SATA_CFG_20_PORT1_PWB_EN); 2477 NV_MCP_SATA_CFG_20_PORT1_PWB_EN);
2474 2478
2475 pci_write_config_dword(pdev, NV_MCP_SATA_CFG_20, tmp32); 2479 pci_write_config_dword(pdev, NV_MCP_SATA_CFG_20, tmp32);
2476 } 2480 }