summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorSteve Cornelius <steve.cornelius@freescale.com>2012-04-19 17:26:40 -0700
committerJason Liu <r64343@freescale.com>2012-07-20 13:36:52 +0800
commit7f3f3137f4892c1a2081c6b9bede141238532d52 (patch)
tree2537e14d0a4caa0dd32b9902045cbb19b06eb9b4 /drivers/crypto
parent8db4466630621162bbb45a986f8284a5601a227f (diff)
ENGR00180943-14: Update internal definition of hardware link table list
Update internal definition of hardware link table list such that it can work properly on both big and little endian 32-bit configurations. This required pointer resizing, reserved-field initialization, and the combination of both buffer-pool ID and offset fields into a common 32-bit value that can burst-read correctly. Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/caam/caamalg.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 7b257c22cd66..3c3e76b6ee1f 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -777,19 +777,29 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher,
return ret;
}
-/* 16-byte hardware scatter/gather table */
+/*
+ * 16-byte hardware scatter/gather table
+ * An 8-byte table exists in the hardware spec, but has never been
+ * implemented to date. The 8/16 option is selected at RTL-compile-time.
+ * and this selection is visible in the Compile Time Parameters Register
+ */
+
+#define LINKTBL_EXT 0x80000000 /* Entry points to table */
+#define LINKTBL_FINAL 0x40000000 /* Last ent in table */
+#define LINKTBL_BPID_MASK 0x000000ff
+#define LINKTBL_BPID_SHIFT 16
+#define LINKTBL_LEN_MASK 0x3fffffff /* Excludes EXT and FINAL */
+#define LINKTBL_OFFS_MASK 0x00001fff
struct link_tbl_entry {
-#ifdef CONFIG_ARM /* FIXME: re-do for 32/64 portability */
+#ifdef CONFIG_64BIT
+ u64 ptr;
+#else
u32 reserved;
u32 ptr;
-#else
- u64 ptr;
#endif
u32 len;
- u8 reserved1;
- u8 buf_pool_id;
- u16 offset;
+ u32 bpid_offset; /* BPID in high, offset in lowest bits */
};
/*
@@ -1059,11 +1069,14 @@ static void ablkcipher_decrypt_done(struct device *jrdev, u32 *desc, u32 err,
static void sg_to_link_tbl_one(struct link_tbl_entry *link_tbl_ptr,
dma_addr_t dma, u32 len, u32 offset)
{
+#ifndef CONFIG_64BIT
+ link_tbl_ptr->reserved = 0; /* ensure high half is zero */
+#endif
link_tbl_ptr->ptr = dma;
- link_tbl_ptr->len = len;
- link_tbl_ptr->reserved = 0;
- link_tbl_ptr->buf_pool_id = 0;
- link_tbl_ptr->offset = offset;
+ link_tbl_ptr->len = (len & LINKTBL_LEN_MASK);
+ /* Does not add in buffer pool ID's at this time */
+ link_tbl_ptr->bpid_offset = (offset & LINKTBL_OFFS_MASK);
+
#ifdef DEBUG
print_hex_dump(KERN_ERR, "link_tbl_ptr@"xstr(__LINE__)": ",
DUMP_PREFIX_ADDRESS, 16, 4, link_tbl_ptr,
@@ -1097,7 +1110,7 @@ static void sg_to_link_tbl_last(struct scatterlist *sg, int sg_count,
struct link_tbl_entry *link_tbl_ptr, u32 offset)
{
link_tbl_ptr = sg_to_link_tbl(sg, sg_count, link_tbl_ptr, offset);
- link_tbl_ptr->len |= 0x40000000;
+ link_tbl_ptr->len |= LINKTBL_FINAL;
}
/*