event/cnxk: add timer adapter capabilities
[dpdk.git] / drivers / event / cnxk / cnxk_tim_evdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #ifndef __CNXK_TIM_EVDEV_H__
6 #define __CNXK_TIM_EVDEV_H__
7
8 #include <stddef.h>
9 #include <stdint.h>
10 #include <stdlib.h>
11 #include <string.h>
12
13 #include <eventdev_pmd_pci.h>
14 #include <rte_event_timer_adapter.h>
15 #include <rte_memzone.h>
16
17 #include "roc_api.h"
18
19 #define CNXK_TIM_EVDEV_NAME        cnxk_tim_eventdev
20 #define CNXK_TIM_RING_DEF_CHUNK_SZ (4096)
21
22 struct cnxk_tim_evdev {
23         struct roc_tim tim;
24         struct rte_eventdev *event_dev;
25         uint16_t nb_rings;
26         uint32_t chunk_sz;
27 };
28
29 static inline struct cnxk_tim_evdev *
30 cnxk_tim_priv_get(void)
31 {
32         const struct rte_memzone *mz;
33
34         mz = rte_memzone_lookup(RTE_STR(CNXK_TIM_EVDEV_NAME));
35         if (mz == NULL)
36                 return NULL;
37
38         return mz->addr;
39 }
40
41 int cnxk_tim_caps_get(const struct rte_eventdev *dev, uint64_t flags,
42                       uint32_t *caps,
43                       const struct rte_event_timer_adapter_ops **ops);
44
45 void cnxk_tim_init(struct roc_sso *sso);
46 void cnxk_tim_fini(void);
47
48 #endif /* __CNXK_TIM_EVDEV_H__ */