/* init user callbacks */
TAILQ_INIT(&(cryptodev->link_intr_cbs));
+ if (dpaa2_svr_family == SVR_LX2160A)
+ rta_set_sec_era(RTA_SEC_ERA_10);
+
+ DPAA2_SEC_INFO("2-SEC ERA is %d", rta_get_sec_era());
+
/* Invoke PMD device initialization function */
retval = dpaa2_sec_dev_init(cryptodev);
if (retval == 0)
#include "hw/compat.h"
#endif
+extern enum rta_sec_era rta_sec_era;
+
/* Max size of any SEC descriptor in 32-bit words, inclusive of header */
#define MAX_CAAM_DESCSIZE 64
/* Start Index or SharedDesc Length */
#define HDR_START_IDX_SHIFT 16
#define HDR_START_IDX_MASK (0x3f << HDR_START_IDX_SHIFT)
+#define HDR_START_IDX_MASK_ERA10 (0x7f << HDR_START_IDX_SHIFT)
/* If shared descriptor header, 6-bit length */
#define HDR_DESCLEN_SHR_MASK 0x3f
+/* If shared descriptor header, 7-bit length era10 onwards*/
+#define HDR_DESCLEN_SHR_MASK_ERA10 0x7f
/* If non-shared header, 7-bit length */
#define HDR_DESCLEN_MASK 0x7f
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
cipherdata->keylen, INLINE_KEY(cipherdata));
- if (rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) {
+ if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
+ (rta_sec_era == RTA_SEC_ERA_10)) {
if (sn_size == PDCP_SN_SIZE_5)
PROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL_MIXED,
(uint16_t)cipherdata->algtype << 8);
REFERENCE(jump_back_to_sd_cmd);
REFERENCE(move_mac_i_to_desc_buf);
- if (rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) {
+ if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
+ (rta_sec_era == RTA_SEC_ERA_10)) {
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
cipherdata->keylen, INLINE_KEY(cipherdata));
KEY(p, KEY2, authdata->key_enc_flags, authdata->key,
KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
INLINE_KEY(authdata));
- if (rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) {
+ if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
+ (rta_sec_era == RTA_SEC_ERA_10)) {
int pclid;
if (sn_size == PDCP_SN_SIZE_5)
SET_LABEL(p, keyjump);
- if (rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) {
+ if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
+ (rta_sec_era == RTA_SEC_ERA_10)) {
int pclid;
if (sn_size == PDCP_SN_SIZE_5)
KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
INLINE_KEY(authdata));
- if (rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) {
+ if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
+ (rta_sec_era == RTA_SEC_ERA_10)) {
int pclid;
if (sn_size == PDCP_SN_SIZE_5)
KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
INLINE_KEY(authdata));
- if (rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) {
+ if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
+ (rta_sec_era == RTA_SEC_ERA_10)) {
int pclid;
if (sn_size == PDCP_SN_SIZE_5)
return -ENOTSUP;
}
- if (rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) {
+ if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
+ (rta_sec_era == RTA_SEC_ERA_10)) {
int pclid;
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_FIFO_LOAD_STORE_CMD_H__
* supported.
*/
static const unsigned int fifo_load_table_sz[] = {22, 22, 23, 23,
- 23, 23, 23, 23};
+ 23, 23, 23, 23,
+ 23, 23};
static inline int
rta_fifo_load(struct program *program, uint32_t src,
* supported.
*/
static const unsigned int fifo_store_table_sz[] = {21, 21, 21, 21,
- 22, 22, 22, 23};
+ 22, 22, 22, 23,
+ 23, 23};
static inline int
rta_fifo_store(struct program *program, uint32_t src,
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_HEADER_CMD_H__
DNR | TD | MTD | SHR | REO | RSMS | EXT,
DNR | TD | MTD | SHR | REO | RSMS | EXT,
DNR | TD | MTD | SHR | REO | RSMS | EXT,
+ DNR | TD | MTD | SHR | REO | EXT,
+ DNR | TD | MTD | SHR | REO | EXT,
DNR | TD | MTD | SHR | REO | EXT
};
DNR | SC | PD | CIF | RIF,
DNR | SC | PD | CIF | RIF,
DNR | SC | PD | CIF | RIF,
+ DNR | SC | PD | CIF | RIF,
+ DNR | SC | PD | CIF | RIF,
DNR | SC | PD | CIF | RIF
};
}
opcode |= HDR_ONE;
- opcode |= (start_idx << HDR_START_IDX_SHIFT) & HDR_START_IDX_MASK;
+ if (rta_sec_era >= RTA_SEC_ERA_10)
+ opcode |= (start_idx << HDR_START_IDX_SHIFT) &
+ HDR_START_IDX_MASK_ERA10;
+ else
+ opcode |= (start_idx << HDR_START_IDX_SHIFT) &
+ HDR_START_IDX_MASK;
if (flags & DNR)
opcode |= HDR_DNR;
}
opcode |= HDR_ONE;
- opcode |= ((start_idx << HDR_START_IDX_SHIFT) & HDR_START_IDX_MASK);
+ if (rta_sec_era >= RTA_SEC_ERA_10)
+ opcode |= (start_idx << HDR_START_IDX_SHIFT) &
+ HDR_START_IDX_MASK_ERA10;
+ else
+ opcode |= (start_idx << HDR_START_IDX_SHIFT) &
+ HDR_START_IDX_MASK;
if (flags & EXT) {
opcode |= HDR_EXT;
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_JUMP_CMD_H__
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_KEY_CMD_H__
ENC | NWB | EKT | TK,
ENC | NWB | EKT | TK,
ENC | NWB | EKT | TK | PTS,
+ ENC | NWB | EKT | TK | PTS,
+ ENC | NWB | EKT | TK | PTS,
ENC | NWB | EKT | TK | PTS
};
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_LOAD_CMD_H__
0x000000fe,
0x000000fe,
0x000000fe,
+ 0x000000fe,
+ 0x000000fe,
0x000000fe
};
0x000000ff,
0x000000ff,
0x000000ff,
+ 0x000000ff,
+ 0x000000ff,
0x000000ff
};
* Allowed LOAD destinations for each SEC Era.
* Values represent the number of entries from load_dst[] that are supported.
*/
-static const unsigned int load_dst_sz[] = { 31, 34, 34, 40, 40, 40, 40, 40 };
+static const unsigned int load_dst_sz[] = { 31, 34, 34, 40, 40,
+ 40, 40, 40, 40, 40};
static inline int
load_check_len_offset(int pos, uint32_t length, uint32_t offset)
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_MATH_CMD_H__
* Allowed MATH op1 sources for each SEC Era.
* Values represent the number of entries from math_op1[] that are supported.
*/
-static const unsigned int math_op1_sz[] = {10, 10, 12, 12, 12, 12, 12, 12};
+static const unsigned int math_op1_sz[] = {10, 10, 12, 12, 12, 12,
+ 12, 12, 12, 12};
static const uint32_t math_op2[][2] = {
/*1*/ { MATH0, MATH_SRC1_REG0 },
* Allowed MATH op2 sources for each SEC Era.
* Values represent the number of entries from math_op2[] that are supported.
*/
-static const unsigned int math_op2_sz[] = {8, 9, 13, 13, 13, 13, 13, 13};
+static const unsigned int math_op2_sz[] = {8, 9, 13, 13, 13, 13, 13, 13,
+ 13, 13};
static const uint32_t math_result[][2] = {
/*1*/ { MATH0, MATH_DEST_REG0 },
* Values represent the number of entries from math_result[] that are
* supported.
*/
-static const unsigned int math_result_sz[] = {9, 9, 10, 10, 10, 10, 10, 10};
+static const unsigned int math_result_sz[] = {9, 9, 10, 10, 10, 10, 10, 10,
+ 10, 10};
static inline int
rta_math(struct program *program, uint64_t operand1,
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_MOVE_CMD_H__
* Values represent the number of entries from move_src_table[] that are
* supported.
*/
-static const unsigned int move_src_table_sz[] = {9, 11, 14, 14, 14, 14, 14, 14};
+static const unsigned int move_src_table_sz[] = {9, 11, 14, 14, 14, 14, 14, 14,
+ 14, 14};
static const uint32_t move_dst_table[][2] = {
/*1*/ { CONTEXT1, MOVE_DEST_CLASS1CTX },
* supported.
*/
static const
-unsigned int move_dst_table_sz[] = {13, 14, 14, 15, 15, 15, 15, 15};
+unsigned int move_dst_table_sz[] = {13, 14, 14, 15, 15, 15, 15, 15, 15, 15};
static inline int
set_move_offset(struct program *program __maybe_unused,
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_NFIFO_CMD_H__
* Allowed NFIFO LOAD sources for each SEC Era.
* Values represent the number of entries from nfifo_src[] that are supported.
*/
-static const unsigned int nfifo_src_sz[] = {4, 5, 5, 5, 5, 5, 5, 7};
+static const unsigned int nfifo_src_sz[] = {4, 5, 5, 5, 5, 5, 5, 7, 7, 7};
static const uint32_t nfifo_data[][2] = {
{ MSG, NFIFOENTRY_DTYPE_MSG },
* Allowed NFIFO LOAD flags for each SEC Era.
* Values represent the number of entries from nfifo_flags[] that are supported.
*/
-static const unsigned int nfifo_flags_sz[] = {12, 14, 14, 14, 14, 14, 14, 14};
+static const unsigned int nfifo_flags_sz[] = {12, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14};
static const uint32_t nfifo_pad_flags[][2] = {
{ BM, NFIFOENTRY_BM },
* Values represent the number of entries from nfifo_pad_flags[] that are
* supported.
*/
-static const unsigned int nfifo_pad_flags_sz[] = {2, 2, 2, 2, 3, 3, 3, 3};
+static const unsigned int nfifo_pad_flags_sz[] = {2, 2, 2, 2, 3, 3, 3, 3, 3, 3};
static inline int
rta_nfifo_load(struct program *program, uint32_t src,
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_OPERATION_CMD_H__
* Allowed OPERATION algorithms for each SEC Era.
* Values represent the number of entries from alg_table[] that are supported.
*/
-static const unsigned int alg_table_sz[] = {14, 15, 15, 15, 17, 17, 11, 17};
+static const unsigned int alg_table_sz[] = {14, 15, 15, 15, 17, 17,
+ 11, 17, 17, 17};
static inline int
rta_operation(struct program *program, uint32_t cipher_algo,
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016, 2019 NXP
+ * Copyright 2016,2019 NXP
*
*/
OP_PCL_BLOB_EKT | OP_PCL_BLOB_REG_MASK | OP_PCL_BLOB_SEC_MEM,
OP_PCL_BLOB_FORMAT_MASK | OP_PCL_BLOB_BLACK | OP_PCL_BLOB_TKEK |
OP_PCL_BLOB_EKT | OP_PCL_BLOB_REG_MASK | OP_PCL_BLOB_SEC_MEM,
+ OP_PCL_BLOB_FORMAT_MASK | OP_PCL_BLOB_BLACK | OP_PCL_BLOB_TKEK |
+ OP_PCL_BLOB_EKT | OP_PCL_BLOB_REG_MASK | OP_PCL_BLOB_SEC_MEM,
+ OP_PCL_BLOB_FORMAT_MASK | OP_PCL_BLOB_BLACK | OP_PCL_BLOB_TKEK |
+ OP_PCL_BLOB_EKT | OP_PCL_BLOB_REG_MASK | OP_PCL_BLOB_SEC_MEM,
OP_PCL_BLOB_FORMAT_MASK | OP_PCL_BLOB_BLACK | OP_PCL_BLOB_TKEK |
OP_PCL_BLOB_EKT | OP_PCL_BLOB_REG_MASK | OP_PCL_BLOB_SEC_MEM
};
* Allowed OPERATION protocols for each SEC Era.
* Values represent the number of entries from proto_table[] that are supported.
*/
-static const unsigned int proto_table_sz[] = {21, 29, 29, 29, 29, 35, 37, 40};
+static const unsigned int proto_table_sz[] = {21, 29, 29, 29, 29, 35, 37,
+ 40, 40, 40};
static inline int
rta_proto_operation(struct program *program, uint32_t optype,
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_SEC_RUN_TIME_ASM_H__
RTA_SEC_ERA_6,
RTA_SEC_ERA_7,
RTA_SEC_ERA_8,
- MAX_SEC_ERA = RTA_SEC_ERA_8
+ RTA_SEC_ERA_9,
+ RTA_SEC_ERA_10,
+ MAX_SEC_ERA = RTA_SEC_ERA_10
};
/**
static inline unsigned int
rta_desc_len(uint32_t *buffer)
{
- if ((*buffer & CMD_MASK) == CMD_DESC_HDR)
+ if ((*buffer & CMD_MASK) == CMD_DESC_HDR) {
return *buffer & HDR_DESCLEN_MASK;
- else
- return *buffer & HDR_DESCLEN_SHR_MASK;
+ } else {
+ if (rta_sec_era >= RTA_SEC_ERA_10)
+ return *buffer & HDR_DESCLEN_SHR_MASK_ERA10;
+ else
+ return *buffer & HDR_DESCLEN_SHR_MASK;
+ }
}
static inline unsigned int
return -EINVAL;
opcode = bswap ? swab32(program->buffer[line]) : program->buffer[line];
+ if (rta_sec_era >= RTA_SEC_ERA_10) {
+ opcode &= (uint32_t)~HDR_START_IDX_MASK_ERA10;
+ opcode |= (new_ref << HDR_START_IDX_SHIFT) &
+ HDR_START_IDX_MASK_ERA10;
+ } else {
+ opcode &= (uint32_t)~HDR_START_IDX_MASK;
+ opcode |= (new_ref << HDR_START_IDX_SHIFT) & HDR_START_IDX_MASK;
+ }
- opcode &= (uint32_t)~HDR_START_IDX_MASK;
- opcode |= (new_ref << HDR_START_IDX_SHIFT) & HDR_START_IDX_MASK;
program->buffer[line] = bswap ? swab32(opcode) : opcode;
return 0;
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_SEQ_IN_OUT_PTR_CMD_H__
RBS | INL | SGF | PRE | EXT | RTO | RJD | SOP,
RBS | INL | SGF | PRE | EXT | RTO | RJD | SOP,
RBS | INL | SGF | PRE | EXT | RTO | RJD | SOP,
+ RBS | INL | SGF | PRE | EXT | RTO | RJD | SOP,
+ RBS | INL | SGF | PRE | EXT | RTO | RJD | SOP,
RBS | INL | SGF | PRE | EXT | RTO | RJD | SOP
};
SGF | PRE | EXT | RTO | RST | EWS,
SGF | PRE | EXT | RTO | RST | EWS,
SGF | PRE | EXT | RTO | RST | EWS,
+ SGF | PRE | EXT | RTO | RST | EWS,
+ SGF | PRE | EXT | RTO | RST | EWS,
SGF | PRE | EXT | RTO | RST | EWS
};
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
- *
+ * Copyright 2016,2019 NXP
*/
#ifndef __RTA_STORE_CMD_H__
* supported.
*/
static const unsigned int store_src_table_sz[] = {29, 31, 33, 33,
- 33, 33, 35, 35};
+ 33, 33, 35, 35,
+ 35, 35};
static inline int
rta_store(struct program *program, uint64_t src,