aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/53c700.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-12-06 23:38:56 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:41 -0500
commitd3fa72e4556ec1f04e46a0d561d9e785ecaa173d (patch)
tree9c9b51dbecc27e977135b4e4793ea3dc99e8ba66 /drivers/scsi/53c700.c
parentf67637ee4b5d90d41160d755b9a8cca18c394586 (diff)
[PATCH] Pass struct dev pointer to dma_cache_sync()
Pass struct dev pointer to dma_cache_sync() dma_cache_sync() is ill-designed in that it does not have a struct device pointer argument which makes proper support for systems that consist of a mix of coherent and non-coherent DMA devices hard. Change dma_cache_sync to take a struct device pointer as first argument and fix all its callers to pass it. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/scsi/53c700.c')
-rw-r--r--drivers/scsi/53c700.c80
1 files changed, 43 insertions, 37 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index acee062cd6f6..68103e508db7 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -362,11 +362,11 @@ NCR_700_detect(struct scsi_host_template *tpnt,
362 for (j = 0; j < PATCHES; j++) 362 for (j = 0; j < PATCHES; j++)
363 script[LABELPATCHES[j]] = bS_to_host(pScript + SCRIPT[LABELPATCHES[j]]); 363 script[LABELPATCHES[j]] = bS_to_host(pScript + SCRIPT[LABELPATCHES[j]]);
364 /* now patch up fixed addresses. */ 364 /* now patch up fixed addresses. */
365 script_patch_32(script, MessageLocation, 365 script_patch_32(hostdata->dev, script, MessageLocation,
366 pScript + MSGOUT_OFFSET); 366 pScript + MSGOUT_OFFSET);
367 script_patch_32(script, StatusAddress, 367 script_patch_32(hostdata->dev, script, StatusAddress,
368 pScript + STATUS_OFFSET); 368 pScript + STATUS_OFFSET);
369 script_patch_32(script, ReceiveMsgAddress, 369 script_patch_32(hostdata->dev, script, ReceiveMsgAddress,
370 pScript + MSGIN_OFFSET); 370 pScript + MSGIN_OFFSET);
371 371
372 hostdata->script = script; 372 hostdata->script = script;
@@ -821,8 +821,9 @@ process_extended_message(struct Scsi_Host *host,
821 shost_printk(KERN_WARNING, host, 821 shost_printk(KERN_WARNING, host,
822 "Unexpected SDTR msg\n"); 822 "Unexpected SDTR msg\n");
823 hostdata->msgout[0] = A_REJECT_MSG; 823 hostdata->msgout[0] = A_REJECT_MSG;
824 dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); 824 dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE);
825 script_patch_16(hostdata->script, MessageCount, 1); 825 script_patch_16(hostdata->dev, hostdata->script,
826 MessageCount, 1);
826 /* SendMsgOut returns, so set up the return 827 /* SendMsgOut returns, so set up the return
827 * address */ 828 * address */
828 resume_offset = hostdata->pScript + Ent_SendMessageWithATN; 829 resume_offset = hostdata->pScript + Ent_SendMessageWithATN;
@@ -833,8 +834,9 @@ process_extended_message(struct Scsi_Host *host,
833 printk(KERN_INFO "scsi%d: (%d:%d), Unsolicited WDTR after CMD, Rejecting\n", 834 printk(KERN_INFO "scsi%d: (%d:%d), Unsolicited WDTR after CMD, Rejecting\n",
834 host->host_no, pun, lun); 835 host->host_no, pun, lun);
835 hostdata->msgout[0] = A_REJECT_MSG; 836 hostdata->msgout[0] = A_REJECT_MSG;
836 dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); 837 dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE);
837 script_patch_16(hostdata->script, MessageCount, 1); 838 script_patch_16(hostdata->dev, hostdata->script, MessageCount,
839 1);
838 resume_offset = hostdata->pScript + Ent_SendMessageWithATN; 840 resume_offset = hostdata->pScript + Ent_SendMessageWithATN;
839 841
840 break; 842 break;
@@ -847,8 +849,9 @@ process_extended_message(struct Scsi_Host *host,
847 printk("\n"); 849 printk("\n");
848 /* just reject it */ 850 /* just reject it */
849 hostdata->msgout[0] = A_REJECT_MSG; 851 hostdata->msgout[0] = A_REJECT_MSG;
850 dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); 852 dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE);
851 script_patch_16(hostdata->script, MessageCount, 1); 853 script_patch_16(hostdata->dev, hostdata->script, MessageCount,
854 1);
852 /* SendMsgOut returns, so set up the return 855 /* SendMsgOut returns, so set up the return
853 * address */ 856 * address */
854 resume_offset = hostdata->pScript + Ent_SendMessageWithATN; 857 resume_offset = hostdata->pScript + Ent_SendMessageWithATN;
@@ -929,8 +932,9 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
929 printk("\n"); 932 printk("\n");
930 /* just reject it */ 933 /* just reject it */
931 hostdata->msgout[0] = A_REJECT_MSG; 934 hostdata->msgout[0] = A_REJECT_MSG;
932 dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); 935 dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE);
933 script_patch_16(hostdata->script, MessageCount, 1); 936 script_patch_16(hostdata->dev, hostdata->script, MessageCount,
937 1);
934 /* SendMsgOut returns, so set up the return 938 /* SendMsgOut returns, so set up the return
935 * address */ 939 * address */
936 resume_offset = hostdata->pScript + Ent_SendMessageWithATN; 940 resume_offset = hostdata->pScript + Ent_SendMessageWithATN;
@@ -939,7 +943,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
939 } 943 }
940 NCR_700_writel(temp, host, TEMP_REG); 944 NCR_700_writel(temp, host, TEMP_REG);
941 /* set us up to receive another message */ 945 /* set us up to receive another message */
942 dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE, DMA_FROM_DEVICE); 946 dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE, DMA_FROM_DEVICE);
943 return resume_offset; 947 return resume_offset;
944} 948}
945 949
@@ -1019,9 +1023,9 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
1019 slot->SG[1].ins = bS_to_host(SCRIPT_RETURN); 1023 slot->SG[1].ins = bS_to_host(SCRIPT_RETURN);
1020 slot->SG[1].pAddr = 0; 1024 slot->SG[1].pAddr = 0;
1021 slot->resume_offset = hostdata->pScript; 1025 slot->resume_offset = hostdata->pScript;
1022 dma_cache_sync(slot->SG, sizeof(slot->SG[0])*2, DMA_TO_DEVICE); 1026 dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG[0])*2, DMA_TO_DEVICE);
1023 dma_cache_sync(SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE); 1027 dma_cache_sync(hostdata->dev, SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
1024 1028
1025 /* queue the command for reissue */ 1029 /* queue the command for reissue */
1026 slot->state = NCR_700_SLOT_QUEUED; 1030 slot->state = NCR_700_SLOT_QUEUED;
1027 slot->flags = NCR_700_FLAG_AUTOSENSE; 1031 slot->flags = NCR_700_FLAG_AUTOSENSE;
@@ -1136,11 +1140,12 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
1136 hostdata->cmd = slot->cmnd; 1140 hostdata->cmd = slot->cmnd;
1137 1141
1138 /* re-patch for this command */ 1142 /* re-patch for this command */
1139 script_patch_32_abs(hostdata->script, CommandAddress, 1143 script_patch_32_abs(hostdata->dev, hostdata->script,
1140 slot->pCmd); 1144 CommandAddress, slot->pCmd);
1141 script_patch_16(hostdata->script, 1145 script_patch_16(hostdata->dev, hostdata->script,
1142 CommandCount, slot->cmnd->cmd_len); 1146 CommandCount, slot->cmnd->cmd_len);
1143 script_patch_32_abs(hostdata->script, SGScriptStartAddress, 1147 script_patch_32_abs(hostdata->dev, hostdata->script,
1148 SGScriptStartAddress,
1144 to32bit(&slot->pSG[0].ins)); 1149 to32bit(&slot->pSG[0].ins));
1145 1150
1146 /* Note: setting SXFER only works if we're 1151 /* Note: setting SXFER only works if we're
@@ -1150,13 +1155,13 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
1150 * should therefore always clear ACK */ 1155 * should therefore always clear ACK */
1151 NCR_700_writeb(NCR_700_get_SXFER(hostdata->cmd->device), 1156 NCR_700_writeb(NCR_700_get_SXFER(hostdata->cmd->device),
1152 host, SXFER_REG); 1157 host, SXFER_REG);
1153 dma_cache_sync(hostdata->msgin, 1158 dma_cache_sync(hostdata->dev, hostdata->msgin,
1154 MSG_ARRAY_SIZE, DMA_FROM_DEVICE); 1159 MSG_ARRAY_SIZE, DMA_FROM_DEVICE);
1155 dma_cache_sync(hostdata->msgout, 1160 dma_cache_sync(hostdata->dev, hostdata->msgout,
1156 MSG_ARRAY_SIZE, DMA_TO_DEVICE); 1161 MSG_ARRAY_SIZE, DMA_TO_DEVICE);
1157 /* I'm just being paranoid here, the command should 1162 /* I'm just being paranoid here, the command should
1158 * already have been flushed from the cache */ 1163 * already have been flushed from the cache */
1159 dma_cache_sync(slot->cmnd->cmnd, 1164 dma_cache_sync(hostdata->dev, slot->cmnd->cmnd,
1160 slot->cmnd->cmd_len, DMA_TO_DEVICE); 1165 slot->cmnd->cmd_len, DMA_TO_DEVICE);
1161 1166
1162 1167
@@ -1220,7 +1225,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
1220 hostdata->reselection_id = reselection_id; 1225 hostdata->reselection_id = reselection_id;
1221 /* just in case we have a stale simple tag message, clear it */ 1226 /* just in case we have a stale simple tag message, clear it */
1222 hostdata->msgin[1] = 0; 1227 hostdata->msgin[1] = 0;
1223 dma_cache_sync(hostdata->msgin, 1228 dma_cache_sync(hostdata->dev, hostdata->msgin,
1224 MSG_ARRAY_SIZE, DMA_BIDIRECTIONAL); 1229 MSG_ARRAY_SIZE, DMA_BIDIRECTIONAL);
1225 if(hostdata->tag_negotiated & (1<<reselection_id)) { 1230 if(hostdata->tag_negotiated & (1<<reselection_id)) {
1226 resume_offset = hostdata->pScript + Ent_GetReselectionWithTag; 1231 resume_offset = hostdata->pScript + Ent_GetReselectionWithTag;
@@ -1336,7 +1341,7 @@ process_selection(struct Scsi_Host *host, __u32 dsp)
1336 hostdata->cmd = NULL; 1341 hostdata->cmd = NULL;
1337 /* clear any stale simple tag message */ 1342 /* clear any stale simple tag message */
1338 hostdata->msgin[1] = 0; 1343 hostdata->msgin[1] = 0;
1339 dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE, 1344 dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE,
1340 DMA_BIDIRECTIONAL); 1345 DMA_BIDIRECTIONAL);
1341 1346
1342 if(id == 0xff) { 1347 if(id == 0xff) {
@@ -1433,29 +1438,30 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
1433 NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); 1438 NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION);
1434 } 1439 }
1435 1440
1436 script_patch_16(hostdata->script, MessageCount, count); 1441 script_patch_16(hostdata->dev, hostdata->script, MessageCount, count);
1437 1442
1438 1443
1439 script_patch_ID(hostdata->script, 1444 script_patch_ID(hostdata->dev, hostdata->script,
1440 Device_ID, 1<<scmd_id(SCp)); 1445 Device_ID, 1<<scmd_id(SCp));
1441 1446
1442 script_patch_32_abs(hostdata->script, CommandAddress, 1447 script_patch_32_abs(hostdata->dev, hostdata->script, CommandAddress,
1443 slot->pCmd); 1448 slot->pCmd);
1444 script_patch_16(hostdata->script, CommandCount, SCp->cmd_len); 1449 script_patch_16(hostdata->dev, hostdata->script, CommandCount,
1450 SCp->cmd_len);
1445 /* finally plumb the beginning of the SG list into the script 1451 /* finally plumb the beginning of the SG list into the script
1446 * */ 1452 * */
1447 script_patch_32_abs(hostdata->script, SGScriptStartAddress, 1453 script_patch_32_abs(hostdata->dev, hostdata->script,
1448 to32bit(&slot->pSG[0].ins)); 1454 SGScriptStartAddress, to32bit(&slot->pSG[0].ins));
1449 NCR_700_clear_fifo(SCp->device->host); 1455 NCR_700_clear_fifo(SCp->device->host);
1450 1456
1451 if(slot->resume_offset == 0) 1457 if(slot->resume_offset == 0)
1452 slot->resume_offset = hostdata->pScript; 1458 slot->resume_offset = hostdata->pScript;
1453 /* now perform all the writebacks and invalidates */ 1459 /* now perform all the writebacks and invalidates */
1454 dma_cache_sync(hostdata->msgout, count, DMA_TO_DEVICE); 1460 dma_cache_sync(hostdata->dev, hostdata->msgout, count, DMA_TO_DEVICE);
1455 dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE, 1461 dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE,
1456 DMA_FROM_DEVICE); 1462 DMA_FROM_DEVICE);
1457 dma_cache_sync(SCp->cmnd, SCp->cmd_len, DMA_TO_DEVICE); 1463 dma_cache_sync(hostdata->dev, SCp->cmnd, SCp->cmd_len, DMA_TO_DEVICE);
1458 dma_cache_sync(hostdata->status, 1, DMA_FROM_DEVICE); 1464 dma_cache_sync(hostdata->dev, hostdata->status, 1, DMA_FROM_DEVICE);
1459 1465
1460 /* set the synchronous period/offset */ 1466 /* set the synchronous period/offset */
1461 NCR_700_writeb(NCR_700_get_SXFER(SCp->device), 1467 NCR_700_writeb(NCR_700_get_SXFER(SCp->device),
@@ -1631,7 +1637,7 @@ NCR_700_intr(int irq, void *dev_id)
1631 slot->SG[i].ins = bS_to_host(SCRIPT_NOP); 1637 slot->SG[i].ins = bS_to_host(SCRIPT_NOP);
1632 slot->SG[i].pAddr = 0; 1638 slot->SG[i].pAddr = 0;
1633 } 1639 }
1634 dma_cache_sync(slot->SG, sizeof(slot->SG), DMA_TO_DEVICE); 1640 dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG), DMA_TO_DEVICE);
1635 /* and pretend we disconnected after 1641 /* and pretend we disconnected after
1636 * the command phase */ 1642 * the command phase */
1637 resume_offset = hostdata->pScript + Ent_MsgInDuringData; 1643 resume_offset = hostdata->pScript + Ent_MsgInDuringData;
@@ -1897,9 +1903,9 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *))
1897 } 1903 }
1898 slot->SG[i].ins = bS_to_host(SCRIPT_RETURN); 1904 slot->SG[i].ins = bS_to_host(SCRIPT_RETURN);
1899 slot->SG[i].pAddr = 0; 1905 slot->SG[i].pAddr = 0;
1900 dma_cache_sync(slot->SG, sizeof(slot->SG), DMA_TO_DEVICE); 1906 dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG), DMA_TO_DEVICE);
1901 DEBUG((" SETTING %08lx to %x\n", 1907 DEBUG((" SETTING %08lx to %x\n",
1902 (&slot->pSG[i].ins), 1908 (&slot->pSG[i].ins),
1903 slot->SG[i].ins)); 1909 slot->SG[i].ins));
1904 } 1910 }
1905 slot->resume_offset = 0; 1911 slot->resume_offset = 0;