baseband/la12xx: support multiple modems
[dpdk.git] / drivers / baseband / la12xx / bbdev_la12xx.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020-2021 NXP
3  */
4
5 #ifndef __BBDEV_LA12XX_H__
6 #define __BBDEV_LA12XX_H__
7
8 #define BBDEV_IPC_ENC_OP_TYPE   1
9 #define BBDEV_IPC_DEC_OP_TYPE   2
10
11 #define MAX_LDPC_ENC_FECA_QUEUES        4
12 #define MAX_LDPC_DEC_FECA_QUEUES        4
13
14 #define MAX_CHANNEL_DEPTH 16
15 /* private data structure */
16 struct bbdev_la12xx_private {
17         void *ipc_priv;
18         uint8_t num_valid_queues;
19         uint8_t max_nb_queues;
20         uint8_t num_ldpc_enc_queues;
21         uint8_t num_ldpc_dec_queues;
22         int8_t modem_id;
23         struct bbdev_la12xx_q_priv *queues_priv[32];
24 };
25
26 struct hugepage_info {
27         void *vaddr;
28         phys_addr_t paddr;
29         size_t len;
30 };
31
32 struct bbdev_la12xx_q_priv {
33         struct bbdev_la12xx_private *bbdev_priv;
34         uint32_t q_id;  /**< Channel ID */
35         uint32_t feca_blk_id;   /** FECA block ID for processing */
36         uint32_t feca_blk_id_be32; /**< FECA Block ID for this queue */
37         uint8_t en_napi; /* 0: napi disabled, 1: napi enabled */
38         uint16_t queue_size;    /**< Queue depth */
39         int32_t eventfd;        /**< Event FD value */
40         enum rte_bbdev_op_type op_type; /**< Operation type */
41         uint32_t la12xx_core_id;
42                 /* LA12xx core ID on which this will be scheduled */
43         struct rte_mempool *mp; /**< Pool from where buffers would be cut */
44         void *bbdev_op[MAX_CHANNEL_DEPTH];
45                         /**< Stores bbdev op for each index */
46         void *msg_ch_vaddr[MAX_CHANNEL_DEPTH];
47                         /**< Stores msg channel addr for modem->host */
48         uint32_t host_pi;       /**< Producer_Index for HOST->MODEM */
49         uint32_t host_ci;       /**< Consumer Index for MODEM->HOST */
50         host_ipc_params_t *host_params; /**< Host parameters */
51 };
52
53 #define lower_32_bits(x) ((uint32_t)((uint64_t)x))
54 #define upper_32_bits(x) ((uint32_t)(((uint64_t)(x) >> 16) >> 16))
55
56 #endif