From ea2141e197b17dc1c50a72226257b311f0255161 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 12 Dec 2006 11:20:19 +0000 Subject: [PATCH] Suggested changes to support CPU cache flushing before doing DMA to target devices. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@46 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scsi_tgt.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scst/include/scsi_tgt.h b/scst/include/scsi_tgt.h index 23a25b7e7..1f1c5666e 100644 --- a/scst/include/scsi_tgt.h +++ b/scst/include/scsi_tgt.h @@ -1013,6 +1013,13 @@ struct scst_cmd */ unsigned int mem_checked:1; + /* + * Set if target driver may need to call dma_sync_sg() or similar + * function before transferring cmd' data to the target device + * via DMA. + */ + unsigned int may_need_dma_sync:1; + /**************************************************************/ unsigned long cmd_flags; /* cmd's async flags */ @@ -1895,6 +1902,19 @@ static inline void scst_cmd_set_expected(struct scst_cmd *cmd, cmd->expected_values_set = 1; } +/* + * Get/clear functions for cmd's may_need_dma_sync + */ +static inline int scst_get_may_need_dma_sync(struct scst_cmd *cmd) +{ + return cmd->may_need_dma_sync; +} + +static inline void scst_clear_may_need_dma_sync(struct scst_cmd *cmd) +{ + cmd->may_need_dma_sync = 0; +} + /* * Get/Set function for mgmt cmd's target private data */ @@ -1931,6 +1951,7 @@ int __scst_get_buf(struct scst_cmd *cmd, uint8_t **buf); static inline int scst_get_buf_first(struct scst_cmd *cmd, uint8_t **buf) { cmd->get_sg_buf_entry_num = 0; + cmd->may_need_dma_sync = 1; return __scst_get_buf(cmd, buf); }