|
@@ -181,10 +181,9 @@ static inline dma_addr_t buf_map_to_sec4_sg(struct device *jrdev,
|
|
/* Map req->src and put it in link table */
|
|
/* Map req->src and put it in link table */
|
|
static inline void src_map_to_sec4_sg(struct device *jrdev,
|
|
static inline void src_map_to_sec4_sg(struct device *jrdev,
|
|
struct scatterlist *src, int src_nents,
|
|
struct scatterlist *src, int src_nents,
|
|
- struct sec4_sg_entry *sec4_sg,
|
|
|
|
- bool chained)
|
|
|
|
|
|
+ struct sec4_sg_entry *sec4_sg)
|
|
{
|
|
{
|
|
- dma_map_sg_chained(jrdev, src, src_nents, DMA_TO_DEVICE, chained);
|
|
|
|
|
|
+ dma_map_sg(jrdev, src, src_nents, DMA_TO_DEVICE);
|
|
sg_to_sec4_sg_last(src, src_nents, sec4_sg, 0);
|
|
sg_to_sec4_sg_last(src, src_nents, sec4_sg, 0);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -585,7 +584,6 @@ badkey:
|
|
* ahash_edesc - s/w-extended ahash descriptor
|
|
* ahash_edesc - s/w-extended ahash descriptor
|
|
* @dst_dma: physical mapped address of req->result
|
|
* @dst_dma: physical mapped address of req->result
|
|
* @sec4_sg_dma: physical mapped address of h/w link table
|
|
* @sec4_sg_dma: physical mapped address of h/w link table
|
|
- * @chained: if source is chained
|
|
|
|
* @src_nents: number of segments in input scatterlist
|
|
* @src_nents: number of segments in input scatterlist
|
|
* @sec4_sg_bytes: length of dma mapped sec4_sg space
|
|
* @sec4_sg_bytes: length of dma mapped sec4_sg space
|
|
* @sec4_sg: pointer to h/w link table
|
|
* @sec4_sg: pointer to h/w link table
|
|
@@ -594,7 +592,6 @@ badkey:
|
|
struct ahash_edesc {
|
|
struct ahash_edesc {
|
|
dma_addr_t dst_dma;
|
|
dma_addr_t dst_dma;
|
|
dma_addr_t sec4_sg_dma;
|
|
dma_addr_t sec4_sg_dma;
|
|
- bool chained;
|
|
|
|
int src_nents;
|
|
int src_nents;
|
|
int sec4_sg_bytes;
|
|
int sec4_sg_bytes;
|
|
struct sec4_sg_entry *sec4_sg;
|
|
struct sec4_sg_entry *sec4_sg;
|
|
@@ -606,8 +603,7 @@ static inline void ahash_unmap(struct device *dev,
|
|
struct ahash_request *req, int dst_len)
|
|
struct ahash_request *req, int dst_len)
|
|
{
|
|
{
|
|
if (edesc->src_nents)
|
|
if (edesc->src_nents)
|
|
- dma_unmap_sg_chained(dev, req->src, edesc->src_nents,
|
|
|
|
- DMA_TO_DEVICE, edesc->chained);
|
|
|
|
|
|
+ dma_unmap_sg(dev, req->src, edesc->src_nents, DMA_TO_DEVICE);
|
|
if (edesc->dst_dma)
|
|
if (edesc->dst_dma)
|
|
dma_unmap_single(dev, edesc->dst_dma, dst_len, DMA_FROM_DEVICE);
|
|
dma_unmap_single(dev, edesc->dst_dma, dst_len, DMA_FROM_DEVICE);
|
|
|
|
|
|
@@ -788,7 +784,6 @@ static int ahash_update_ctx(struct ahash_request *req)
|
|
dma_addr_t ptr = ctx->sh_desc_update_dma;
|
|
dma_addr_t ptr = ctx->sh_desc_update_dma;
|
|
int src_nents, sec4_sg_bytes, sec4_sg_src_index;
|
|
int src_nents, sec4_sg_bytes, sec4_sg_src_index;
|
|
struct ahash_edesc *edesc;
|
|
struct ahash_edesc *edesc;
|
|
- bool chained = false;
|
|
|
|
int ret = 0;
|
|
int ret = 0;
|
|
int sh_len;
|
|
int sh_len;
|
|
|
|
|
|
@@ -797,8 +792,8 @@ static int ahash_update_ctx(struct ahash_request *req)
|
|
to_hash = in_len - *next_buflen;
|
|
to_hash = in_len - *next_buflen;
|
|
|
|
|
|
if (to_hash) {
|
|
if (to_hash) {
|
|
- src_nents = __sg_count(req->src, req->nbytes - (*next_buflen),
|
|
|
|
- &chained);
|
|
|
|
|
|
+ src_nents = sg_nents_for_len(req->src,
|
|
|
|
+ req->nbytes - (*next_buflen));
|
|
sec4_sg_src_index = 1 + (*buflen ? 1 : 0);
|
|
sec4_sg_src_index = 1 + (*buflen ? 1 : 0);
|
|
sec4_sg_bytes = (sec4_sg_src_index + src_nents) *
|
|
sec4_sg_bytes = (sec4_sg_src_index + src_nents) *
|
|
sizeof(struct sec4_sg_entry);
|
|
sizeof(struct sec4_sg_entry);
|
|
@@ -816,7 +811,6 @@ static int ahash_update_ctx(struct ahash_request *req)
|
|
}
|
|
}
|
|
|
|
|
|
edesc->src_nents = src_nents;
|
|
edesc->src_nents = src_nents;
|
|
- edesc->chained = chained;
|
|
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
DESC_JOB_IO_LEN;
|
|
DESC_JOB_IO_LEN;
|
|
@@ -833,8 +827,7 @@ static int ahash_update_ctx(struct ahash_request *req)
|
|
|
|
|
|
if (src_nents) {
|
|
if (src_nents) {
|
|
src_map_to_sec4_sg(jrdev, req->src, src_nents,
|
|
src_map_to_sec4_sg(jrdev, req->src, src_nents,
|
|
- edesc->sec4_sg + sec4_sg_src_index,
|
|
|
|
- chained);
|
|
|
|
|
|
+ edesc->sec4_sg + sec4_sg_src_index);
|
|
if (*next_buflen)
|
|
if (*next_buflen)
|
|
scatterwalk_map_and_copy(next_buf, req->src,
|
|
scatterwalk_map_and_copy(next_buf, req->src,
|
|
to_hash - *buflen,
|
|
to_hash - *buflen,
|
|
@@ -996,11 +989,10 @@ static int ahash_finup_ctx(struct ahash_request *req)
|
|
int src_nents;
|
|
int src_nents;
|
|
int digestsize = crypto_ahash_digestsize(ahash);
|
|
int digestsize = crypto_ahash_digestsize(ahash);
|
|
struct ahash_edesc *edesc;
|
|
struct ahash_edesc *edesc;
|
|
- bool chained = false;
|
|
|
|
int ret = 0;
|
|
int ret = 0;
|
|
int sh_len;
|
|
int sh_len;
|
|
|
|
|
|
- src_nents = __sg_count(req->src, req->nbytes, &chained);
|
|
|
|
|
|
+ src_nents = sg_nents_for_len(req->src, req->nbytes);
|
|
sec4_sg_src_index = 1 + (buflen ? 1 : 0);
|
|
sec4_sg_src_index = 1 + (buflen ? 1 : 0);
|
|
sec4_sg_bytes = (sec4_sg_src_index + src_nents) *
|
|
sec4_sg_bytes = (sec4_sg_src_index + src_nents) *
|
|
sizeof(struct sec4_sg_entry);
|
|
sizeof(struct sec4_sg_entry);
|
|
@@ -1018,7 +1010,6 @@ static int ahash_finup_ctx(struct ahash_request *req)
|
|
init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | HDR_REVERSE);
|
|
init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | HDR_REVERSE);
|
|
|
|
|
|
edesc->src_nents = src_nents;
|
|
edesc->src_nents = src_nents;
|
|
- edesc->chained = chained;
|
|
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
DESC_JOB_IO_LEN;
|
|
DESC_JOB_IO_LEN;
|
|
@@ -1033,7 +1024,7 @@ static int ahash_finup_ctx(struct ahash_request *req)
|
|
last_buflen);
|
|
last_buflen);
|
|
|
|
|
|
src_map_to_sec4_sg(jrdev, req->src, src_nents, edesc->sec4_sg +
|
|
src_map_to_sec4_sg(jrdev, req->src, src_nents, edesc->sec4_sg +
|
|
- sec4_sg_src_index, chained);
|
|
|
|
|
|
+ sec4_sg_src_index);
|
|
|
|
|
|
edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
|
|
edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
|
|
sec4_sg_bytes, DMA_TO_DEVICE);
|
|
sec4_sg_bytes, DMA_TO_DEVICE);
|
|
@@ -1081,14 +1072,12 @@ static int ahash_digest(struct ahash_request *req)
|
|
int src_nents, sec4_sg_bytes;
|
|
int src_nents, sec4_sg_bytes;
|
|
dma_addr_t src_dma;
|
|
dma_addr_t src_dma;
|
|
struct ahash_edesc *edesc;
|
|
struct ahash_edesc *edesc;
|
|
- bool chained = false;
|
|
|
|
int ret = 0;
|
|
int ret = 0;
|
|
u32 options;
|
|
u32 options;
|
|
int sh_len;
|
|
int sh_len;
|
|
|
|
|
|
- src_nents = sg_count(req->src, req->nbytes, &chained);
|
|
|
|
- dma_map_sg_chained(jrdev, req->src, src_nents ? : 1, DMA_TO_DEVICE,
|
|
|
|
- chained);
|
|
|
|
|
|
+ src_nents = sg_count(req->src, req->nbytes);
|
|
|
|
+ dma_map_sg(jrdev, req->src, src_nents ? : 1, DMA_TO_DEVICE);
|
|
sec4_sg_bytes = src_nents * sizeof(struct sec4_sg_entry);
|
|
sec4_sg_bytes = src_nents * sizeof(struct sec4_sg_entry);
|
|
|
|
|
|
/* allocate space for base edesc and hw desc commands, link tables */
|
|
/* allocate space for base edesc and hw desc commands, link tables */
|
|
@@ -1102,7 +1091,6 @@ static int ahash_digest(struct ahash_request *req)
|
|
DESC_JOB_IO_LEN;
|
|
DESC_JOB_IO_LEN;
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->src_nents = src_nents;
|
|
edesc->src_nents = src_nents;
|
|
- edesc->chained = chained;
|
|
|
|
|
|
|
|
sh_len = desc_len(sh_desc);
|
|
sh_len = desc_len(sh_desc);
|
|
desc = edesc->hw_desc;
|
|
desc = edesc->hw_desc;
|
|
@@ -1228,7 +1216,6 @@ static int ahash_update_no_ctx(struct ahash_request *req)
|
|
struct ahash_edesc *edesc;
|
|
struct ahash_edesc *edesc;
|
|
u32 *desc, *sh_desc = ctx->sh_desc_update_first;
|
|
u32 *desc, *sh_desc = ctx->sh_desc_update_first;
|
|
dma_addr_t ptr = ctx->sh_desc_update_first_dma;
|
|
dma_addr_t ptr = ctx->sh_desc_update_first_dma;
|
|
- bool chained = false;
|
|
|
|
int ret = 0;
|
|
int ret = 0;
|
|
int sh_len;
|
|
int sh_len;
|
|
|
|
|
|
@@ -1236,8 +1223,8 @@ static int ahash_update_no_ctx(struct ahash_request *req)
|
|
to_hash = in_len - *next_buflen;
|
|
to_hash = in_len - *next_buflen;
|
|
|
|
|
|
if (to_hash) {
|
|
if (to_hash) {
|
|
- src_nents = __sg_count(req->src, req->nbytes - (*next_buflen),
|
|
|
|
- &chained);
|
|
|
|
|
|
+ src_nents = sg_nents_for_len(req->src,
|
|
|
|
+ req->nbytes - (*next_buflen));
|
|
sec4_sg_bytes = (1 + src_nents) *
|
|
sec4_sg_bytes = (1 + src_nents) *
|
|
sizeof(struct sec4_sg_entry);
|
|
sizeof(struct sec4_sg_entry);
|
|
|
|
|
|
@@ -1254,7 +1241,6 @@ static int ahash_update_no_ctx(struct ahash_request *req)
|
|
}
|
|
}
|
|
|
|
|
|
edesc->src_nents = src_nents;
|
|
edesc->src_nents = src_nents;
|
|
- edesc->chained = chained;
|
|
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
DESC_JOB_IO_LEN;
|
|
DESC_JOB_IO_LEN;
|
|
@@ -1263,7 +1249,7 @@ static int ahash_update_no_ctx(struct ahash_request *req)
|
|
state->buf_dma = buf_map_to_sec4_sg(jrdev, edesc->sec4_sg,
|
|
state->buf_dma = buf_map_to_sec4_sg(jrdev, edesc->sec4_sg,
|
|
buf, *buflen);
|
|
buf, *buflen);
|
|
src_map_to_sec4_sg(jrdev, req->src, src_nents,
|
|
src_map_to_sec4_sg(jrdev, req->src, src_nents,
|
|
- edesc->sec4_sg + 1, chained);
|
|
|
|
|
|
+ edesc->sec4_sg + 1);
|
|
if (*next_buflen) {
|
|
if (*next_buflen) {
|
|
scatterwalk_map_and_copy(next_buf, req->src,
|
|
scatterwalk_map_and_copy(next_buf, req->src,
|
|
to_hash - *buflen,
|
|
to_hash - *buflen,
|
|
@@ -1343,11 +1329,10 @@ static int ahash_finup_no_ctx(struct ahash_request *req)
|
|
int sec4_sg_bytes, sec4_sg_src_index, src_nents;
|
|
int sec4_sg_bytes, sec4_sg_src_index, src_nents;
|
|
int digestsize = crypto_ahash_digestsize(ahash);
|
|
int digestsize = crypto_ahash_digestsize(ahash);
|
|
struct ahash_edesc *edesc;
|
|
struct ahash_edesc *edesc;
|
|
- bool chained = false;
|
|
|
|
int sh_len;
|
|
int sh_len;
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
|
|
- src_nents = __sg_count(req->src, req->nbytes, &chained);
|
|
|
|
|
|
+ src_nents = sg_nents_for_len(req->src, req->nbytes);
|
|
sec4_sg_src_index = 2;
|
|
sec4_sg_src_index = 2;
|
|
sec4_sg_bytes = (sec4_sg_src_index + src_nents) *
|
|
sec4_sg_bytes = (sec4_sg_src_index + src_nents) *
|
|
sizeof(struct sec4_sg_entry);
|
|
sizeof(struct sec4_sg_entry);
|
|
@@ -1365,7 +1350,6 @@ static int ahash_finup_no_ctx(struct ahash_request *req)
|
|
init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | HDR_REVERSE);
|
|
init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | HDR_REVERSE);
|
|
|
|
|
|
edesc->src_nents = src_nents;
|
|
edesc->src_nents = src_nents;
|
|
- edesc->chained = chained;
|
|
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
DESC_JOB_IO_LEN;
|
|
DESC_JOB_IO_LEN;
|
|
@@ -1374,8 +1358,7 @@ static int ahash_finup_no_ctx(struct ahash_request *req)
|
|
state->buf_dma, buflen,
|
|
state->buf_dma, buflen,
|
|
last_buflen);
|
|
last_buflen);
|
|
|
|
|
|
- src_map_to_sec4_sg(jrdev, req->src, src_nents, edesc->sec4_sg + 1,
|
|
|
|
- chained);
|
|
|
|
|
|
+ src_map_to_sec4_sg(jrdev, req->src, src_nents, edesc->sec4_sg + 1);
|
|
|
|
|
|
edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
|
|
edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
|
|
sec4_sg_bytes, DMA_TO_DEVICE);
|
|
sec4_sg_bytes, DMA_TO_DEVICE);
|
|
@@ -1429,7 +1412,6 @@ static int ahash_update_first(struct ahash_request *req)
|
|
dma_addr_t src_dma;
|
|
dma_addr_t src_dma;
|
|
u32 options;
|
|
u32 options;
|
|
struct ahash_edesc *edesc;
|
|
struct ahash_edesc *edesc;
|
|
- bool chained = false;
|
|
|
|
int ret = 0;
|
|
int ret = 0;
|
|
int sh_len;
|
|
int sh_len;
|
|
|
|
|
|
@@ -1438,10 +1420,8 @@ static int ahash_update_first(struct ahash_request *req)
|
|
to_hash = req->nbytes - *next_buflen;
|
|
to_hash = req->nbytes - *next_buflen;
|
|
|
|
|
|
if (to_hash) {
|
|
if (to_hash) {
|
|
- src_nents = sg_count(req->src, req->nbytes - (*next_buflen),
|
|
|
|
- &chained);
|
|
|
|
- dma_map_sg_chained(jrdev, req->src, src_nents ? : 1,
|
|
|
|
- DMA_TO_DEVICE, chained);
|
|
|
|
|
|
+ src_nents = sg_count(req->src, req->nbytes - (*next_buflen));
|
|
|
|
+ dma_map_sg(jrdev, req->src, src_nents ? : 1, DMA_TO_DEVICE);
|
|
sec4_sg_bytes = src_nents * sizeof(struct sec4_sg_entry);
|
|
sec4_sg_bytes = src_nents * sizeof(struct sec4_sg_entry);
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -1457,7 +1437,6 @@ static int ahash_update_first(struct ahash_request *req)
|
|
}
|
|
}
|
|
|
|
|
|
edesc->src_nents = src_nents;
|
|
edesc->src_nents = src_nents;
|
|
- edesc->chained = chained;
|
|
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg_bytes = sec4_sg_bytes;
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
|
|
DESC_JOB_IO_LEN;
|
|
DESC_JOB_IO_LEN;
|