mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
[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 <[email protected]> Cc: James Bottomley <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Greg KH <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
f67637ee4b
commit
d3fa72e455
27 changed files with 137 additions and 126 deletions
|
|
@ -362,11 +362,11 @@ NCR_700_detect(struct scsi_host_template *tpnt,
|
|||
for (j = 0; j < PATCHES; j++)
|
||||
script[LABELPATCHES[j]] = bS_to_host(pScript + SCRIPT[LABELPATCHES[j]]);
|
||||
/* now patch up fixed addresses. */
|
||||
script_patch_32(script, MessageLocation,
|
||||
script_patch_32(hostdata->dev, script, MessageLocation,
|
||||
pScript + MSGOUT_OFFSET);
|
||||
script_patch_32(script, StatusAddress,
|
||||
script_patch_32(hostdata->dev, script, StatusAddress,
|
||||
pScript + STATUS_OFFSET);
|
||||
script_patch_32(script, ReceiveMsgAddress,
|
||||
script_patch_32(hostdata->dev, script, ReceiveMsgAddress,
|
||||
pScript + MSGIN_OFFSET);
|
||||
|
||||
hostdata->script = script;
|
||||
|
|
@ -821,8 +821,9 @@ process_extended_message(struct Scsi_Host *host,
|
|||
shost_printk(KERN_WARNING, host,
|
||||
"Unexpected SDTR msg\n");
|
||||
hostdata->msgout[0] = A_REJECT_MSG;
|
||||
dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE);
|
||||
script_patch_16(hostdata->script, MessageCount, 1);
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE);
|
||||
script_patch_16(hostdata->dev, hostdata->script,
|
||||
MessageCount, 1);
|
||||
/* SendMsgOut returns, so set up the return
|
||||
* address */
|
||||
resume_offset = hostdata->pScript + Ent_SendMessageWithATN;
|
||||
|
|
@ -833,8 +834,9 @@ process_extended_message(struct Scsi_Host *host,
|
|||
printk(KERN_INFO "scsi%d: (%d:%d), Unsolicited WDTR after CMD, Rejecting\n",
|
||||
host->host_no, pun, lun);
|
||||
hostdata->msgout[0] = A_REJECT_MSG;
|
||||
dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE);
|
||||
script_patch_16(hostdata->script, MessageCount, 1);
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE);
|
||||
script_patch_16(hostdata->dev, hostdata->script, MessageCount,
|
||||
1);
|
||||
resume_offset = hostdata->pScript + Ent_SendMessageWithATN;
|
||||
|
||||
break;
|
||||
|
|
@ -847,8 +849,9 @@ process_extended_message(struct Scsi_Host *host,
|
|||
printk("\n");
|
||||
/* just reject it */
|
||||
hostdata->msgout[0] = A_REJECT_MSG;
|
||||
dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE);
|
||||
script_patch_16(hostdata->script, MessageCount, 1);
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE);
|
||||
script_patch_16(hostdata->dev, hostdata->script, MessageCount,
|
||||
1);
|
||||
/* SendMsgOut returns, so set up the return
|
||||
* address */
|
||||
resume_offset = hostdata->pScript + Ent_SendMessageWithATN;
|
||||
|
|
@ -929,8 +932,9 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
|
|||
printk("\n");
|
||||
/* just reject it */
|
||||
hostdata->msgout[0] = A_REJECT_MSG;
|
||||
dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE);
|
||||
script_patch_16(hostdata->script, MessageCount, 1);
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgout, 1, DMA_TO_DEVICE);
|
||||
script_patch_16(hostdata->dev, hostdata->script, MessageCount,
|
||||
1);
|
||||
/* SendMsgOut returns, so set up the return
|
||||
* address */
|
||||
resume_offset = hostdata->pScript + Ent_SendMessageWithATN;
|
||||
|
|
@ -939,7 +943,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
|
|||
}
|
||||
NCR_700_writel(temp, host, TEMP_REG);
|
||||
/* set us up to receive another message */
|
||||
dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE, DMA_FROM_DEVICE);
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE, DMA_FROM_DEVICE);
|
||||
return resume_offset;
|
||||
}
|
||||
|
||||
|
|
@ -1019,9 +1023,9 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
|
|||
slot->SG[1].ins = bS_to_host(SCRIPT_RETURN);
|
||||
slot->SG[1].pAddr = 0;
|
||||
slot->resume_offset = hostdata->pScript;
|
||||
dma_cache_sync(slot->SG, sizeof(slot->SG[0])*2, DMA_TO_DEVICE);
|
||||
dma_cache_sync(SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
|
||||
|
||||
dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG[0])*2, DMA_TO_DEVICE);
|
||||
dma_cache_sync(hostdata->dev, SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
|
||||
|
||||
/* queue the command for reissue */
|
||||
slot->state = NCR_700_SLOT_QUEUED;
|
||||
slot->flags = NCR_700_FLAG_AUTOSENSE;
|
||||
|
|
@ -1136,11 +1140,12 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
|
|||
hostdata->cmd = slot->cmnd;
|
||||
|
||||
/* re-patch for this command */
|
||||
script_patch_32_abs(hostdata->script, CommandAddress,
|
||||
slot->pCmd);
|
||||
script_patch_16(hostdata->script,
|
||||
script_patch_32_abs(hostdata->dev, hostdata->script,
|
||||
CommandAddress, slot->pCmd);
|
||||
script_patch_16(hostdata->dev, hostdata->script,
|
||||
CommandCount, slot->cmnd->cmd_len);
|
||||
script_patch_32_abs(hostdata->script, SGScriptStartAddress,
|
||||
script_patch_32_abs(hostdata->dev, hostdata->script,
|
||||
SGScriptStartAddress,
|
||||
to32bit(&slot->pSG[0].ins));
|
||||
|
||||
/* Note: setting SXFER only works if we're
|
||||
|
|
@ -1150,13 +1155,13 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
|
|||
* should therefore always clear ACK */
|
||||
NCR_700_writeb(NCR_700_get_SXFER(hostdata->cmd->device),
|
||||
host, SXFER_REG);
|
||||
dma_cache_sync(hostdata->msgin,
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgin,
|
||||
MSG_ARRAY_SIZE, DMA_FROM_DEVICE);
|
||||
dma_cache_sync(hostdata->msgout,
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgout,
|
||||
MSG_ARRAY_SIZE, DMA_TO_DEVICE);
|
||||
/* I'm just being paranoid here, the command should
|
||||
* already have been flushed from the cache */
|
||||
dma_cache_sync(slot->cmnd->cmnd,
|
||||
dma_cache_sync(hostdata->dev, slot->cmnd->cmnd,
|
||||
slot->cmnd->cmd_len, DMA_TO_DEVICE);
|
||||
|
||||
|
||||
|
|
@ -1220,7 +1225,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
|
|||
hostdata->reselection_id = reselection_id;
|
||||
/* just in case we have a stale simple tag message, clear it */
|
||||
hostdata->msgin[1] = 0;
|
||||
dma_cache_sync(hostdata->msgin,
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgin,
|
||||
MSG_ARRAY_SIZE, DMA_BIDIRECTIONAL);
|
||||
if(hostdata->tag_negotiated & (1<<reselection_id)) {
|
||||
resume_offset = hostdata->pScript + Ent_GetReselectionWithTag;
|
||||
|
|
@ -1336,7 +1341,7 @@ process_selection(struct Scsi_Host *host, __u32 dsp)
|
|||
hostdata->cmd = NULL;
|
||||
/* clear any stale simple tag message */
|
||||
hostdata->msgin[1] = 0;
|
||||
dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE,
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE,
|
||||
DMA_BIDIRECTIONAL);
|
||||
|
||||
if(id == 0xff) {
|
||||
|
|
@ -1433,29 +1438,30 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
|
|||
NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION);
|
||||
}
|
||||
|
||||
script_patch_16(hostdata->script, MessageCount, count);
|
||||
script_patch_16(hostdata->dev, hostdata->script, MessageCount, count);
|
||||
|
||||
|
||||
script_patch_ID(hostdata->script,
|
||||
script_patch_ID(hostdata->dev, hostdata->script,
|
||||
Device_ID, 1<<scmd_id(SCp));
|
||||
|
||||
script_patch_32_abs(hostdata->script, CommandAddress,
|
||||
script_patch_32_abs(hostdata->dev, hostdata->script, CommandAddress,
|
||||
slot->pCmd);
|
||||
script_patch_16(hostdata->script, CommandCount, SCp->cmd_len);
|
||||
script_patch_16(hostdata->dev, hostdata->script, CommandCount,
|
||||
SCp->cmd_len);
|
||||
/* finally plumb the beginning of the SG list into the script
|
||||
* */
|
||||
script_patch_32_abs(hostdata->script, SGScriptStartAddress,
|
||||
to32bit(&slot->pSG[0].ins));
|
||||
script_patch_32_abs(hostdata->dev, hostdata->script,
|
||||
SGScriptStartAddress, to32bit(&slot->pSG[0].ins));
|
||||
NCR_700_clear_fifo(SCp->device->host);
|
||||
|
||||
if(slot->resume_offset == 0)
|
||||
slot->resume_offset = hostdata->pScript;
|
||||
/* now perform all the writebacks and invalidates */
|
||||
dma_cache_sync(hostdata->msgout, count, DMA_TO_DEVICE);
|
||||
dma_cache_sync(hostdata->msgin, MSG_ARRAY_SIZE,
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgout, count, DMA_TO_DEVICE);
|
||||
dma_cache_sync(hostdata->dev, hostdata->msgin, MSG_ARRAY_SIZE,
|
||||
DMA_FROM_DEVICE);
|
||||
dma_cache_sync(SCp->cmnd, SCp->cmd_len, DMA_TO_DEVICE);
|
||||
dma_cache_sync(hostdata->status, 1, DMA_FROM_DEVICE);
|
||||
dma_cache_sync(hostdata->dev, SCp->cmnd, SCp->cmd_len, DMA_TO_DEVICE);
|
||||
dma_cache_sync(hostdata->dev, hostdata->status, 1, DMA_FROM_DEVICE);
|
||||
|
||||
/* set the synchronous period/offset */
|
||||
NCR_700_writeb(NCR_700_get_SXFER(SCp->device),
|
||||
|
|
@ -1631,7 +1637,7 @@ NCR_700_intr(int irq, void *dev_id)
|
|||
slot->SG[i].ins = bS_to_host(SCRIPT_NOP);
|
||||
slot->SG[i].pAddr = 0;
|
||||
}
|
||||
dma_cache_sync(slot->SG, sizeof(slot->SG), DMA_TO_DEVICE);
|
||||
dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG), DMA_TO_DEVICE);
|
||||
/* and pretend we disconnected after
|
||||
* the command phase */
|
||||
resume_offset = hostdata->pScript + Ent_MsgInDuringData;
|
||||
|
|
@ -1897,9 +1903,9 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *))
|
|||
}
|
||||
slot->SG[i].ins = bS_to_host(SCRIPT_RETURN);
|
||||
slot->SG[i].pAddr = 0;
|
||||
dma_cache_sync(slot->SG, sizeof(slot->SG), DMA_TO_DEVICE);
|
||||
dma_cache_sync(hostdata->dev, slot->SG, sizeof(slot->SG), DMA_TO_DEVICE);
|
||||
DEBUG((" SETTING %08lx to %x\n",
|
||||
(&slot->pSG[i].ins),
|
||||
(&slot->pSG[i].ins),
|
||||
slot->SG[i].ins));
|
||||
}
|
||||
slot->resume_offset = 0;
|
||||
|
|
|
|||
|
|
@ -415,31 +415,31 @@ struct NCR_700_Host_Parameters {
|
|||
#define NCR_710_MIN_XFERP 0
|
||||
#define NCR_700_MIN_PERIOD 25 /* for SDTR message, 100ns */
|
||||
|
||||
#define script_patch_32(script, symbol, value) \
|
||||
#define script_patch_32(dev, script, symbol, value) \
|
||||
{ \
|
||||
int i; \
|
||||
for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \
|
||||
__u32 val = bS_to_cpu((script)[A_##symbol##_used[i]]) + value; \
|
||||
(script)[A_##symbol##_used[i]] = bS_to_host(val); \
|
||||
dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \
|
||||
dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \
|
||||
DEBUG((" script, patching %s at %d to 0x%lx\n", \
|
||||
#symbol, A_##symbol##_used[i], (value))); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define script_patch_32_abs(script, symbol, value) \
|
||||
#define script_patch_32_abs(dev, script, symbol, value) \
|
||||
{ \
|
||||
int i; \
|
||||
for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \
|
||||
(script)[A_##symbol##_used[i]] = bS_to_host(value); \
|
||||
dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \
|
||||
dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \
|
||||
DEBUG((" script, patching %s at %d to 0x%lx\n", \
|
||||
#symbol, A_##symbol##_used[i], (value))); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Used for patching the SCSI ID in the SELECT instruction */
|
||||
#define script_patch_ID(script, symbol, value) \
|
||||
#define script_patch_ID(dev, script, symbol, value) \
|
||||
{ \
|
||||
int i; \
|
||||
for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \
|
||||
|
|
@ -447,13 +447,13 @@ struct NCR_700_Host_Parameters {
|
|||
val &= 0xff00ffff; \
|
||||
val |= ((value) & 0xff) << 16; \
|
||||
(script)[A_##symbol##_used[i]] = bS_to_host(val); \
|
||||
dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \
|
||||
dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \
|
||||
DEBUG((" script, patching ID field %s at %d to 0x%x\n", \
|
||||
#symbol, A_##symbol##_used[i], val)); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define script_patch_16(script, symbol, value) \
|
||||
#define script_patch_16(dev, script, symbol, value) \
|
||||
{ \
|
||||
int i; \
|
||||
for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \
|
||||
|
|
@ -461,7 +461,7 @@ struct NCR_700_Host_Parameters {
|
|||
val &= 0xffff0000; \
|
||||
val |= ((value) & 0xffff); \
|
||||
(script)[A_##symbol##_used[i]] = bS_to_host(val); \
|
||||
dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \
|
||||
dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \
|
||||
DEBUG((" script, patching short field %s at %d to 0x%x\n", \
|
||||
#symbol, A_##symbol##_used[i], val)); \
|
||||
} \
|
||||
|
|
|
|||
Loading…
Reference in a new issue