162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright 2013-2016 Freescale Semiconductor Inc. 462306a36Sopenharmony_ci * Copyright 2017-2018 NXP 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _DPSECI_CMD_H_ 862306a36Sopenharmony_ci#define _DPSECI_CMD_H_ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* DPSECI Version */ 1162306a36Sopenharmony_ci#define DPSECI_VER_MAJOR 5 1262306a36Sopenharmony_ci#define DPSECI_VER_MINOR 3 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#define DPSECI_VER(maj, min) (((maj) << 16) | (min)) 1562306a36Sopenharmony_ci#define DPSECI_VERSION DPSECI_VER(DPSECI_VER_MAJOR, DPSECI_VER_MINOR) 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci/* Command versioning */ 1862306a36Sopenharmony_ci#define DPSECI_CMD_BASE_VERSION 1 1962306a36Sopenharmony_ci#define DPSECI_CMD_BASE_VERSION_V2 2 2062306a36Sopenharmony_ci#define DPSECI_CMD_ID_OFFSET 4 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#define DPSECI_CMD_V1(id) (((id) << DPSECI_CMD_ID_OFFSET) | \ 2362306a36Sopenharmony_ci DPSECI_CMD_BASE_VERSION) 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define DPSECI_CMD_V2(id) (((id) << DPSECI_CMD_ID_OFFSET) | \ 2662306a36Sopenharmony_ci DPSECI_CMD_BASE_VERSION_V2) 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/* Command IDs */ 2962306a36Sopenharmony_ci#define DPSECI_CMDID_CLOSE DPSECI_CMD_V1(0x800) 3062306a36Sopenharmony_ci#define DPSECI_CMDID_OPEN DPSECI_CMD_V1(0x809) 3162306a36Sopenharmony_ci#define DPSECI_CMDID_GET_API_VERSION DPSECI_CMD_V1(0xa09) 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#define DPSECI_CMDID_ENABLE DPSECI_CMD_V1(0x002) 3462306a36Sopenharmony_ci#define DPSECI_CMDID_DISABLE DPSECI_CMD_V1(0x003) 3562306a36Sopenharmony_ci#define DPSECI_CMDID_GET_ATTR DPSECI_CMD_V1(0x004) 3662306a36Sopenharmony_ci#define DPSECI_CMDID_RESET DPSECI_CMD_V1(0x005) 3762306a36Sopenharmony_ci#define DPSECI_CMDID_IS_ENABLED DPSECI_CMD_V1(0x006) 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194) 4062306a36Sopenharmony_ci#define DPSECI_CMDID_GET_RX_QUEUE DPSECI_CMD_V1(0x196) 4162306a36Sopenharmony_ci#define DPSECI_CMDID_GET_TX_QUEUE DPSECI_CMD_V1(0x197) 4262306a36Sopenharmony_ci#define DPSECI_CMDID_GET_SEC_ATTR DPSECI_CMD_V2(0x198) 4362306a36Sopenharmony_ci#define DPSECI_CMDID_SET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x170) 4462306a36Sopenharmony_ci#define DPSECI_CMDID_GET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x171) 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci/* Macros for accessing command fields smaller than 1 byte */ 4762306a36Sopenharmony_ci#define DPSECI_MASK(field) \ 4862306a36Sopenharmony_ci GENMASK(DPSECI_##field##_SHIFT + DPSECI_##field##_SIZE - 1, \ 4962306a36Sopenharmony_ci DPSECI_##field##_SHIFT) 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#define dpseci_set_field(var, field, val) \ 5262306a36Sopenharmony_ci ((var) |= (((val) << DPSECI_##field##_SHIFT) & DPSECI_MASK(field))) 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#define dpseci_get_field(var, field) \ 5562306a36Sopenharmony_ci (((var) & DPSECI_MASK(field)) >> DPSECI_##field##_SHIFT) 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_cistruct dpseci_cmd_open { 5862306a36Sopenharmony_ci __le32 dpseci_id; 5962306a36Sopenharmony_ci}; 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#define DPSECI_ENABLE_SHIFT 0 6262306a36Sopenharmony_ci#define DPSECI_ENABLE_SIZE 1 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_cistruct dpseci_rsp_is_enabled { 6562306a36Sopenharmony_ci u8 is_enabled; 6662306a36Sopenharmony_ci}; 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_cistruct dpseci_rsp_get_attributes { 6962306a36Sopenharmony_ci __le32 id; 7062306a36Sopenharmony_ci __le32 pad0; 7162306a36Sopenharmony_ci u8 num_tx_queues; 7262306a36Sopenharmony_ci u8 num_rx_queues; 7362306a36Sopenharmony_ci u8 pad1[6]; 7462306a36Sopenharmony_ci __le32 options; 7562306a36Sopenharmony_ci}; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci#define DPSECI_DEST_TYPE_SHIFT 0 7862306a36Sopenharmony_ci#define DPSECI_DEST_TYPE_SIZE 4 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci#define DPSECI_ORDER_PRESERVATION_SHIFT 0 8162306a36Sopenharmony_ci#define DPSECI_ORDER_PRESERVATION_SIZE 1 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_cistruct dpseci_cmd_queue { 8462306a36Sopenharmony_ci __le32 dest_id; 8562306a36Sopenharmony_ci u8 priority; 8662306a36Sopenharmony_ci u8 queue; 8762306a36Sopenharmony_ci u8 dest_type; 8862306a36Sopenharmony_ci u8 pad; 8962306a36Sopenharmony_ci __le64 user_ctx; 9062306a36Sopenharmony_ci union { 9162306a36Sopenharmony_ci __le32 options; 9262306a36Sopenharmony_ci __le32 fqid; 9362306a36Sopenharmony_ci }; 9462306a36Sopenharmony_ci u8 order_preservation_en; 9562306a36Sopenharmony_ci}; 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_cistruct dpseci_rsp_get_tx_queue { 9862306a36Sopenharmony_ci __le32 pad; 9962306a36Sopenharmony_ci __le32 fqid; 10062306a36Sopenharmony_ci u8 priority; 10162306a36Sopenharmony_ci}; 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_cistruct dpseci_rsp_get_sec_attr { 10462306a36Sopenharmony_ci __le16 ip_id; 10562306a36Sopenharmony_ci u8 major_rev; 10662306a36Sopenharmony_ci u8 minor_rev; 10762306a36Sopenharmony_ci u8 era; 10862306a36Sopenharmony_ci u8 pad0[3]; 10962306a36Sopenharmony_ci u8 deco_num; 11062306a36Sopenharmony_ci u8 zuc_auth_acc_num; 11162306a36Sopenharmony_ci u8 zuc_enc_acc_num; 11262306a36Sopenharmony_ci u8 pad1; 11362306a36Sopenharmony_ci u8 snow_f8_acc_num; 11462306a36Sopenharmony_ci u8 snow_f9_acc_num; 11562306a36Sopenharmony_ci u8 crc_acc_num; 11662306a36Sopenharmony_ci u8 pad2; 11762306a36Sopenharmony_ci u8 pk_acc_num; 11862306a36Sopenharmony_ci u8 kasumi_acc_num; 11962306a36Sopenharmony_ci u8 rng_acc_num; 12062306a36Sopenharmony_ci u8 pad3; 12162306a36Sopenharmony_ci u8 md_acc_num; 12262306a36Sopenharmony_ci u8 arc4_acc_num; 12362306a36Sopenharmony_ci u8 des_acc_num; 12462306a36Sopenharmony_ci u8 aes_acc_num; 12562306a36Sopenharmony_ci u8 ccha_acc_num; 12662306a36Sopenharmony_ci u8 ptha_acc_num; 12762306a36Sopenharmony_ci}; 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_cistruct dpseci_rsp_get_api_version { 13062306a36Sopenharmony_ci __le16 major; 13162306a36Sopenharmony_ci __le16 minor; 13262306a36Sopenharmony_ci}; 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci#define DPSECI_CGN_DEST_TYPE_SHIFT 0 13562306a36Sopenharmony_ci#define DPSECI_CGN_DEST_TYPE_SIZE 4 13662306a36Sopenharmony_ci#define DPSECI_CGN_UNITS_SHIFT 4 13762306a36Sopenharmony_ci#define DPSECI_CGN_UNITS_SIZE 2 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_cistruct dpseci_cmd_congestion_notification { 14062306a36Sopenharmony_ci __le32 dest_id; 14162306a36Sopenharmony_ci __le16 notification_mode; 14262306a36Sopenharmony_ci u8 priority; 14362306a36Sopenharmony_ci u8 options; 14462306a36Sopenharmony_ci __le64 message_iova; 14562306a36Sopenharmony_ci __le64 message_ctx; 14662306a36Sopenharmony_ci __le32 threshold_entry; 14762306a36Sopenharmony_ci __le32 threshold_exit; 14862306a36Sopenharmony_ci}; 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci#endif /* _DPSECI_CMD_H_ */ 151