c1689b6f83fc5aa6d8a2d0ec547ddf8b3ff9c33c
[dpdk.git] / drivers / common / cnxk / roc_io_generic.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #ifndef _ROC_IO_GENERIC_H_
6 #define _ROC_IO_GENERIC_H_
7
8 #define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
9
10 #define roc_load_pair(val0, val1, addr)                                        \
11         do {                                                                   \
12                 val0 = plt_read64((void *)(addr));                             \
13                 val1 = plt_read64((uint8_t *)(addr) + 8);                      \
14         } while (0)
15
16 #define roc_store_pair(val0, val1, addr)                                       \
17         do {                                                                   \
18                 plt_write64(val0, (void *)(addr));                             \
19                 plt_write64(val1, (((uint8_t *)(addr)) + 8));                  \
20         } while (0)
21
22 #define roc_prefetch_store_keep(ptr)                                           \
23         do {                                                                   \
24         } while (0)
25
26 static __plt_always_inline void
27 roc_atomic128_cas_noreturn(uint64_t swap0, uint64_t swap1, uint64_t ptr)
28 {
29         PLT_SET_USED(swap0);
30         PLT_SET_USED(swap1);
31         PLT_SET_USED(ptr);
32 }
33
34 static __plt_always_inline uint64_t
35 roc_atomic64_cas(uint64_t compare, uint64_t swap, int64_t *ptr)
36 {
37         PLT_SET_USED(swap);
38         PLT_SET_USED(ptr);
39
40         return compare;
41 }
42
43 static inline uint64_t
44 roc_atomic64_add_nosync(int64_t incr, int64_t *ptr)
45 {
46         PLT_SET_USED(ptr);
47         PLT_SET_USED(incr);
48
49         return 0;
50 }
51
52 static inline uint64_t
53 roc_atomic64_add_sync(int64_t incr, int64_t *ptr)
54 {
55         PLT_SET_USED(ptr);
56         PLT_SET_USED(incr);
57
58         return 0;
59 }
60
61 static inline uint64_t
62 roc_lmt_submit_ldeor(plt_iova_t io_address)
63 {
64         PLT_SET_USED(io_address);
65
66         return 0;
67 }
68
69 static __plt_always_inline uint64_t
70 roc_lmt_submit_ldeorl(plt_iova_t io_address)
71 {
72         PLT_SET_USED(io_address);
73
74         return 0;
75 }
76
77 static inline void
78 roc_lmt_submit_steor(uint64_t data, plt_iova_t io_address)
79 {
80         PLT_SET_USED(data);
81         PLT_SET_USED(io_address);
82 }
83
84 static inline void
85 roc_lmt_submit_steorl(uint64_t data, plt_iova_t io_address)
86 {
87         PLT_SET_USED(data);
88         PLT_SET_USED(io_address);
89 }
90
91 static __plt_always_inline void
92 roc_lmt_mov(void *out, const void *in, const uint32_t lmtext)
93 {
94         PLT_SET_USED(in);
95         PLT_SET_USED(lmtext);
96         memset(out, 0, sizeof(__uint128_t) * (lmtext ? lmtext > 1 ? 4 : 3 : 2));
97 }
98
99 static __plt_always_inline void
100 roc_lmt_mov_seg(void *out, const void *in, const uint16_t segdw)
101 {
102         PLT_SET_USED(out);
103         PLT_SET_USED(in);
104         PLT_SET_USED(segdw);
105 }
106
107 static __plt_always_inline void
108 roc_lmt_mov_one(void *out, const void *in)
109 {
110         PLT_SET_USED(out);
111         PLT_SET_USED(in);
112 }
113
114 static __plt_always_inline void
115 roc_lmt_mov_seg_nv(void *out, const void *in, const uint16_t segdw)
116 {
117         PLT_SET_USED(out);
118         PLT_SET_USED(in);
119         PLT_SET_USED(segdw);
120 }
121
122 #endif /* _ROC_IO_GENERIC_H_ */