event/octeontx2: add event queue config functions
[dpdk.git] / drivers / event / octeontx2 / otx2_evdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2019 Marvell International Ltd.
3  */
4
5 #ifndef __OTX2_EVDEV_H__
6 #define __OTX2_EVDEV_H__
7
8 #include <rte_eventdev.h>
9
10 #include "otx2_common.h"
11 #include "otx2_dev.h"
12 #include "otx2_mempool.h"
13
14 #define EVENTDEV_NAME_OCTEONTX2_PMD otx2_eventdev
15
16 #define sso_func_trace otx2_sso_dbg
17
18 #define OTX2_SSO_MAX_VHGRP                  RTE_EVENT_MAX_QUEUES_PER_DEV
19 #define OTX2_SSO_MAX_VHWS                   (UINT8_MAX)
20
21 /* SSO LF register offsets (BAR2) */
22 #define SSO_LF_GGRP_OP_ADD_WORK0            (0x0ull)
23 #define SSO_LF_GGRP_OP_ADD_WORK1            (0x8ull)
24
25 #define SSO_LF_GGRP_QCTL                    (0x20ull)
26 #define SSO_LF_GGRP_EXE_DIS                 (0x80ull)
27 #define SSO_LF_GGRP_INT                     (0x100ull)
28 #define SSO_LF_GGRP_INT_W1S                 (0x108ull)
29 #define SSO_LF_GGRP_INT_ENA_W1S             (0x110ull)
30 #define SSO_LF_GGRP_INT_ENA_W1C             (0x118ull)
31 #define SSO_LF_GGRP_INT_THR                 (0x140ull)
32 #define SSO_LF_GGRP_INT_CNT                 (0x180ull)
33 #define SSO_LF_GGRP_XAQ_CNT                 (0x1b0ull)
34 #define SSO_LF_GGRP_AQ_CNT                  (0x1c0ull)
35 #define SSO_LF_GGRP_AQ_THR                  (0x1e0ull)
36 #define SSO_LF_GGRP_MISC_CNT                (0x200ull)
37
38 #define USEC2NSEC(__us)                 ((__us) * 1E3)
39
40 enum otx2_sso_lf_type {
41         SSO_LF_GGRP,
42         SSO_LF_GWS
43 };
44
45 struct otx2_sso_evdev {
46         OTX2_DEV; /* Base class */
47         uint8_t max_event_queues;
48         uint8_t max_event_ports;
49         uint8_t is_timeout_deq;
50         uint8_t nb_event_queues;
51         uint8_t nb_event_ports;
52         uint8_t configured;
53         uint32_t deq_tmo_ns;
54         uint32_t min_dequeue_timeout_ns;
55         uint32_t max_dequeue_timeout_ns;
56         int32_t max_num_events;
57         /* HW const */
58         uint32_t xae_waes;
59         uint32_t xaq_buf_size;
60         uint32_t iue;
61 } __rte_cache_aligned;
62
63 static inline struct otx2_sso_evdev *
64 sso_pmd_priv(const struct rte_eventdev *event_dev)
65 {
66         return event_dev->data->dev_private;
67 }
68
69 /* Init and Fini API's */
70 int otx2_sso_init(struct rte_eventdev *event_dev);
71 int otx2_sso_fini(struct rte_eventdev *event_dev);
72
73 #endif /* __OTX2_EVDEV_H__ */