^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright 2013-2016 Freescale Semiconductor Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright 2017-2018 NXP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef _DPSECI_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define _DPSECI_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Data Path SEC Interface API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Contains initialization APIs and runtime control APIs for DPSECI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct fsl_mc_io;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * General DPSECI macros
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * Maximum number of Tx/Rx queues per DPSECI object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define DPSECI_MAX_QUEUE_NUM 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * All queues considered; see dpseci_set_rx_queue()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define DPSECI_ALL_QUEUES (u8)(-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) int dpseci_open(struct fsl_mc_io *mc_io, u32 cmd_flags, int dpseci_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) u16 *token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int dpseci_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * Enable the Congestion Group support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define DPSECI_OPT_HAS_CG 0x000020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * struct dpseci_cfg - Structure representing DPSECI configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * @options: Any combination of the following flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * DPSECI_OPT_HAS_CG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * @num_tx_queues: num of queues towards the SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * @num_rx_queues: num of queues back from the SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * @priorities: Priorities for the SEC hardware processing;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * each place in the array is the priority of the tx queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * towards the SEC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * valid priorities are configured with values 1-8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct dpseci_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) u32 options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) u8 num_tx_queues;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) u8 num_rx_queues;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) u8 priorities[DPSECI_MAX_QUEUE_NUM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) int dpseci_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) int dpseci_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int dpseci_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) int dpseci_is_enabled(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) int *en);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * struct dpseci_attr - Structure representing DPSECI attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * @id: DPSECI object ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * @num_tx_queues: number of queues towards the SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * @num_rx_queues: number of queues back from the SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * @options: any combination of the following flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * DPSECI_OPT_HAS_CG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct dpseci_attr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) int id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) u8 num_tx_queues;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) u8 num_rx_queues;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) u32 options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) int dpseci_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) struct dpseci_attr *attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * enum dpseci_dest - DPSECI destination types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * @DPSECI_DEST_NONE: Unassigned destination; The queue is set in parked mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * and does not generate FQDAN notifications; user is expected to dequeue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * from the queue based on polling or other user-defined method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * @DPSECI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * notifications to the specified DPIO; user is expected to dequeue from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * the queue only after notification is received
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * @DPSECI_DEST_DPCON: The queue is set in schedule mode and does not generate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * FQDAN notifications, but is connected to the specified DPCON object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * user is expected to dequeue from the DPCON channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) enum dpseci_dest {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) DPSECI_DEST_NONE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) DPSECI_DEST_DPIO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) DPSECI_DEST_DPCON
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * struct dpseci_dest_cfg - Structure representing DPSECI destination parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * @dest_type: Destination type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * @priority: Priority selection within the DPIO or DPCON channel; valid values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * are 0-1 or 0-7, depending on the number of priorities in that channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * not relevant for 'DPSECI_DEST_NONE' option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct dpseci_dest_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) enum dpseci_dest dest_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int dest_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) u8 priority;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * DPSECI queue modification options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * Select to modify the user's context associated with the queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define DPSECI_QUEUE_OPT_USER_CTX 0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * Select to modify the queue's destination
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define DPSECI_QUEUE_OPT_DEST 0x00000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * Select to modify the queue's order preservation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) #define DPSECI_QUEUE_OPT_ORDER_PRESERVATION 0x00000004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * struct dpseci_rx_queue_cfg - DPSECI RX queue configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * @options: Flags representing the suggested modifications to the queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * Use any combination of 'DPSECI_QUEUE_OPT_<X>' flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * @order_preservation_en: order preservation configuration for the rx queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * valid only if 'DPSECI_QUEUE_OPT_ORDER_PRESERVATION' is contained in 'options'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * @user_ctx: User context value provided in the frame descriptor of each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * dequeued frame; valid only if 'DPSECI_QUEUE_OPT_USER_CTX' is contained
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * in 'options'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * @dest_cfg: Queue destination parameters; valid only if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * 'DPSECI_QUEUE_OPT_DEST' is contained in 'options'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct dpseci_rx_queue_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) u32 options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) int order_preservation_en;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) u64 user_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct dpseci_dest_cfg dest_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) int dpseci_set_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) u8 queue, const struct dpseci_rx_queue_cfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * struct dpseci_rx_queue_attr - Structure representing attributes of Rx queues
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * @user_ctx: User context value provided in the frame descriptor of each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * dequeued frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * @order_preservation_en: Status of the order preservation configuration on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * @dest_cfg: Queue destination configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * @fqid: Virtual FQID value to be used for dequeue operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct dpseci_rx_queue_attr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) u64 user_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) int order_preservation_en;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct dpseci_dest_cfg dest_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) u32 fqid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) int dpseci_get_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) u8 queue, struct dpseci_rx_queue_attr *attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * struct dpseci_tx_queue_attr - Structure representing attributes of Tx queues
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * @fqid: Virtual FQID to be used for sending frames to SEC hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * @priority: SEC hardware processing priority for the queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) struct dpseci_tx_queue_attr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) u32 fqid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) u8 priority;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) int dpseci_get_tx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) u8 queue, struct dpseci_tx_queue_attr *attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * struct dpseci_sec_attr - Structure representing attributes of the SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * hardware accelerator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * @ip_id: ID for SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * @major_rev: Major revision number for SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * @minor_rev: Minor revision number for SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * @era: SEC Era
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * @deco_num: The number of copies of the DECO that are implemented in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * @zuc_auth_acc_num: The number of copies of ZUCA that are implemented in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) * version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * @zuc_enc_acc_num: The number of copies of ZUCE that are implemented in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) * version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) * @snow_f8_acc_num: The number of copies of the SNOW-f8 module that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) * implemented in this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * @snow_f9_acc_num: The number of copies of the SNOW-f9 module that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * implemented in this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) * @crc_acc_num: The number of copies of the CRC module that are implemented in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * @pk_acc_num: The number of copies of the Public Key module that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) * implemented in this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) * @kasumi_acc_num: The number of copies of the Kasumi module that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) * implemented in this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * @rng_acc_num: The number of copies of the Random Number Generator that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * implemented in this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * @md_acc_num: The number of copies of the MDHA (Hashing module) that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) * implemented in this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) * @arc4_acc_num: The number of copies of the ARC4 module that are implemented
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * in this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) * @des_acc_num: The number of copies of the DES module that are implemented in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) * this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) * @aes_acc_num: The number of copies of the AES module that are implemented in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) * this version of SEC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) * @ccha_acc_num: The number of copies of the ChaCha20 module that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) * implemented in this version of SEC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) * @ptha_acc_num: The number of copies of the Poly1305 module that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) * implemented in this version of SEC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) **/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) struct dpseci_sec_attr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) u16 ip_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) u8 major_rev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) u8 minor_rev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) u8 era;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) u8 deco_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) u8 zuc_auth_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) u8 zuc_enc_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) u8 snow_f8_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) u8 snow_f9_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) u8 crc_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) u8 pk_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) u8 kasumi_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) u8 rng_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) u8 md_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) u8 arc4_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) u8 des_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) u8 aes_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) u8 ccha_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) u8 ptha_acc_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) int dpseci_get_sec_attr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) struct dpseci_sec_attr *attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) int dpseci_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) u16 *major_ver, u16 *minor_ver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * enum dpseci_congestion_unit - DPSECI congestion units
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * @DPSECI_CONGESTION_UNIT_BYTES: bytes units
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) * @DPSECI_CONGESTION_UNIT_FRAMES: frames units
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) enum dpseci_congestion_unit {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) DPSECI_CONGESTION_UNIT_BYTES = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) DPSECI_CONGESTION_UNIT_FRAMES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * CSCN message is written to message_iova once entering a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * congestion state (see 'threshold_entry')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) #define DPSECI_CGN_MODE_WRITE_MEM_ON_ENTER 0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) * CSCN message is written to message_iova once exiting a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * congestion state (see 'threshold_exit')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) #define DPSECI_CGN_MODE_WRITE_MEM_ON_EXIT 0x00000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) * CSCN write will attempt to allocate into a cache (coherent write);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * valid only if 'DPSECI_CGN_MODE_WRITE_MEM_<X>' is selected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) #define DPSECI_CGN_MODE_COHERENT_WRITE 0x00000004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) * if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' CSCN message is sent to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) * DPIO/DPCON's WQ channel once entering a congestion state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) * (see 'threshold_entry')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #define DPSECI_CGN_MODE_NOTIFY_DEST_ON_ENTER 0x00000008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) * if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' CSCN message is sent to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) * DPIO/DPCON's WQ channel once exiting a congestion state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * (see 'threshold_exit')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) #define DPSECI_CGN_MODE_NOTIFY_DEST_ON_EXIT 0x00000010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) * if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' when the CSCN is written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) * to the sw-portal's DQRR, the DQRI interrupt is asserted immediately
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) * (if enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) #define DPSECI_CGN_MODE_INTR_COALESCING_DISABLED 0x00000020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) * struct dpseci_congestion_notification_cfg - congestion notification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) * configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) * @units: units type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) * @threshold_entry: above this threshold we enter a congestion state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) * set it to '0' to disable it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) * @threshold_exit: below this threshold we exit the congestion state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) * @message_ctx: The context that will be part of the CSCN message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) * @message_iova: I/O virtual address (must be in DMA-able memory),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) * must be 16B aligned;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) * @dest_cfg: CSCN can be send to either DPIO or DPCON WQ channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) * @notification_mode: Mask of available options; use 'DPSECI_CGN_MODE_<X>'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) * values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) struct dpseci_congestion_notification_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) enum dpseci_congestion_unit units;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) u32 threshold_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) u32 threshold_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) u64 message_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) u64 message_iova;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) struct dpseci_dest_cfg dest_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) u16 notification_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) int dpseci_set_congestion_notification(struct fsl_mc_io *mc_io, u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) u16 token, const struct dpseci_congestion_notification_cfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) int dpseci_get_congestion_notification(struct fsl_mc_io *mc_io, u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) u16 token, struct dpseci_congestion_notification_cfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) #endif /* _DPSECI_H_ */