提交 7d607c6a 编写于 作者: L LEROY Christophe 提交者: Herbert Xu

crypto: talitos - adaptation of talitos_submit() for SEC1

SEC1 descriptor is a bit different to SEC2+ descriptor.
talitos_submit() will have to copy hdr field into hdr1 field and
send the descriptor starting at hdr1 up to next_desc.
For SEC2, it remains unchanged and next_desc is just ignored.
Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 922f9dc8
...@@ -236,6 +236,7 @@ int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc, ...@@ -236,6 +236,7 @@ int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc,
struct talitos_request *request; struct talitos_request *request;
unsigned long flags; unsigned long flags;
int head; int head;
bool is_sec1 = has_ftr_sec1(priv);
spin_lock_irqsave(&priv->chan[ch].head_lock, flags); spin_lock_irqsave(&priv->chan[ch].head_lock, flags);
...@@ -249,8 +250,17 @@ int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc, ...@@ -249,8 +250,17 @@ int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc,
request = &priv->chan[ch].fifo[head]; request = &priv->chan[ch].fifo[head];
/* map descriptor and save caller data */ /* map descriptor and save caller data */
request->dma_desc = dma_map_single(dev, desc, sizeof(*desc), if (is_sec1) {
DMA_BIDIRECTIONAL); desc->hdr1 = desc->hdr;
desc->next_desc = 0;
request->dma_desc = dma_map_single(dev, &desc->hdr1,
TALITOS_DESC_SIZE,
DMA_BIDIRECTIONAL);
} else {
request->dma_desc = dma_map_single(dev, desc,
TALITOS_DESC_SIZE,
DMA_BIDIRECTIONAL);
}
request->callback = callback; request->callback = callback;
request->context = context; request->context = context;
...@@ -282,16 +292,21 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch) ...@@ -282,16 +292,21 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch)
struct talitos_request *request, saved_req; struct talitos_request *request, saved_req;
unsigned long flags; unsigned long flags;
int tail, status; int tail, status;
bool is_sec1 = has_ftr_sec1(priv);
spin_lock_irqsave(&priv->chan[ch].tail_lock, flags); spin_lock_irqsave(&priv->chan[ch].tail_lock, flags);
tail = priv->chan[ch].tail; tail = priv->chan[ch].tail;
while (priv->chan[ch].fifo[tail].desc) { while (priv->chan[ch].fifo[tail].desc) {
__be32 hdr;
request = &priv->chan[ch].fifo[tail]; request = &priv->chan[ch].fifo[tail];
/* descriptors with their done bits set don't get the error */ /* descriptors with their done bits set don't get the error */
rmb(); rmb();
if ((request->desc->hdr & DESC_HDR_DONE) == DESC_HDR_DONE) hdr = is_sec1 ? request->desc->hdr1 : request->desc->hdr;
if ((hdr & DESC_HDR_DONE) == DESC_HDR_DONE)
status = 0; status = 0;
else else
if (!error) if (!error)
...@@ -300,7 +315,7 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch) ...@@ -300,7 +315,7 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch)
status = error; status = error;
dma_unmap_single(dev, request->dma_desc, dma_unmap_single(dev, request->dma_desc,
sizeof(struct talitos_desc), TALITOS_DESC_SIZE,
DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
/* copy entries so we can call callback outside lock */ /* copy entries so we can call callback outside lock */
......
...@@ -69,6 +69,8 @@ struct talitos_desc { ...@@ -69,6 +69,8 @@ struct talitos_desc {
__be32 next_desc; /* next descriptor (SEC1) */ __be32 next_desc; /* next descriptor (SEC1) */
}; };
#define TALITOS_DESC_SIZE (sizeof(struct talitos_desc) - sizeof(__be32))
/** /**
* talitos_request - descriptor submission request * talitos_request - descriptor submission request
* @desc: descriptor pointer (kernel virtual) * @desc: descriptor pointer (kernel virtual)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册