diff options
author | Victoria Milhoan <vicki.milhoan@freescale.com> | 2015-01-14 12:00:59 -0700 |
---|---|---|
committer | Victoria Milhoan <vicki.milhoan@freescale.com> | 2015-01-15 20:55:34 -0700 |
commit | 420c89c35a6674c55d74e1058ca8b6f6e43b5b30 (patch) | |
tree | 57bba8d2c7edf79f21d3815bdcd645747196352c /drivers/crypto | |
parent | e8abf2e26dcd9231fd0b42fa9e9b1167331e59c9 (diff) |
MLK-9769-24 Add cache coherency support to CAAM scatterlist implementation
Add cache coherency support to the CAAM scatterlist implementation.
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/sg_sw_sec4.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h index ce28a563effc..73eab16cdbc7 100644 --- a/drivers/crypto/caam/sg_sw_sec4.h +++ b/drivers/crypto/caam/sg_sw_sec4.h @@ -1,7 +1,7 @@ /* * CAAM/SEC 4.x functions for using scatterlists in caam driver * - * Copyright 2008-2011 Freescale Semiconductor, Inc. + * Copyright 2008-2015 Freescale Semiconductor, Inc. * */ @@ -91,13 +91,22 @@ static int dma_map_sg_chained(struct device *dev, struct scatterlist *sg, { if (unlikely(chained)) { int i; + struct scatterlist *tsg = sg; + + /* We use a local copy of the sg pointer to avoid moving the + * head of the list pointed to by sg as we wall the list. + */ for (i = 0; i < nents; i++) { - dma_map_sg(dev, sg, 1, dir); - sg = scatterwalk_sg_next(sg); + dma_map_sg(dev, tsg, 1, dir); + tsg = scatterwalk_sg_next(tsg); } } else { dma_map_sg(dev, sg, nents, dir); } + + if ((dir == DMA_TO_DEVICE) || (dir == DMA_BIDIRECTIONAL)) + dma_sync_sg_for_device(dev, sg, nents, dir); + return nents; } @@ -105,6 +114,9 @@ static int dma_unmap_sg_chained(struct device *dev, struct scatterlist *sg, unsigned int nents, enum dma_data_direction dir, bool chained) { + if ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL)) + dma_sync_sg_for_cpu(dev, sg, nents, dir); + if (unlikely(chained)) { int i; for (i = 0; i < nents; i++) { |