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 #include "roc_platform.h"
9
10 #define ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
11 #define ROC_LMT_CPT_BASE_ID_GET(lmt_addr, lmt_id) (lmt_id = 0)
12
13 #define roc_load_pair(val0, val1, addr) \
14 do { \
15 val0 = plt_read64((void *)(addr)); \
16 val1 = plt_read64((uint8_t *)(addr) + 8); \
17 } while (0)
18
19 #define roc_store_pair(val0, val1, addr) \
20 do { \
21 plt_write64(val0, (void *)(addr)); \
22 plt_write64(val1, (((uint8_t *)(addr)) + 8)); \
23 } while (0)
24
25 #define roc_prefetch_store_keep(ptr) \
26 do { \
27 } while (0)
28
29 static __plt_always_inline void
roc_atomic128_cas_noreturn(uint64_t swap0,uint64_t swap1,uint64_t ptr)30 roc_atomic128_cas_noreturn(uint64_t swap0, uint64_t swap1, uint64_t ptr)
31 {
32 PLT_SET_USED(swap0);
33 PLT_SET_USED(swap1);
34 PLT_SET_USED(ptr);
35 }
36
37 static __plt_always_inline uint64_t
roc_atomic64_cas(uint64_t compare,uint64_t swap,int64_t * ptr)38 roc_atomic64_cas(uint64_t compare, uint64_t swap, int64_t *ptr)
39 {
40 PLT_SET_USED(swap);
41 PLT_SET_USED(ptr);
42
43 return compare;
44 }
45
46 static __plt_always_inline uint64_t
roc_atomic64_casl(uint64_t compare,uint64_t swap,int64_t * ptr)47 roc_atomic64_casl(uint64_t compare, uint64_t swap, int64_t *ptr)
48 {
49 PLT_SET_USED(swap);
50 PLT_SET_USED(ptr);
51
52 return compare;
53 }
54
55 static inline uint64_t
roc_atomic64_add_nosync(int64_t incr,int64_t * ptr)56 roc_atomic64_add_nosync(int64_t incr, int64_t *ptr)
57 {
58 PLT_SET_USED(ptr);
59 PLT_SET_USED(incr);
60
61 return 0;
62 }
63
64 static inline uint64_t
roc_atomic64_add_sync(int64_t incr,int64_t * ptr)65 roc_atomic64_add_sync(int64_t incr, int64_t *ptr)
66 {
67 PLT_SET_USED(ptr);
68 PLT_SET_USED(incr);
69
70 return 0;
71 }
72
73 static inline uint64_t
roc_lmt_submit_ldeor(plt_iova_t io_address)74 roc_lmt_submit_ldeor(plt_iova_t io_address)
75 {
76 PLT_SET_USED(io_address);
77
78 return 0;
79 }
80
81 static __plt_always_inline uint64_t
roc_lmt_submit_ldeorl(plt_iova_t io_address)82 roc_lmt_submit_ldeorl(plt_iova_t io_address)
83 {
84 PLT_SET_USED(io_address);
85
86 return 0;
87 }
88
89 static inline void
roc_lmt_submit_steor(uint64_t data,plt_iova_t io_address)90 roc_lmt_submit_steor(uint64_t data, plt_iova_t io_address)
91 {
92 PLT_SET_USED(data);
93 PLT_SET_USED(io_address);
94 }
95
96 static inline void
roc_lmt_submit_steorl(uint64_t data,plt_iova_t io_address)97 roc_lmt_submit_steorl(uint64_t data, plt_iova_t io_address)
98 {
99 PLT_SET_USED(data);
100 PLT_SET_USED(io_address);
101 }
102
103 static __plt_always_inline void
roc_lmt_mov(void * out,const void * in,const uint32_t lmtext)104 roc_lmt_mov(void *out, const void *in, const uint32_t lmtext)
105 {
106 PLT_SET_USED(in);
107 PLT_SET_USED(lmtext);
108 memset(out, 0, sizeof(__uint128_t) * (lmtext ? lmtext > 1 ? 4 : 3 : 2));
109 }
110
111 static __plt_always_inline void
roc_lmt_mov64(void * out,const void * in)112 roc_lmt_mov64(void *out, const void *in)
113 {
114 PLT_SET_USED(out);
115 PLT_SET_USED(in);
116 }
117
118 static __plt_always_inline void
roc_lmt_mov_nv(void * out,const void * in,const uint32_t lmtext)119 roc_lmt_mov_nv(void *out, const void *in, const uint32_t lmtext)
120 {
121 PLT_SET_USED(in);
122 PLT_SET_USED(lmtext);
123 memset(out, 0, sizeof(__uint128_t) * (lmtext ? lmtext > 1 ? 4 : 3 : 2));
124 }
125
126 static __plt_always_inline void
roc_lmt_mov_seg(void * out,const void * in,const uint16_t segdw)127 roc_lmt_mov_seg(void *out, const void *in, const uint16_t segdw)
128 {
129 PLT_SET_USED(out);
130 PLT_SET_USED(in);
131 PLT_SET_USED(segdw);
132 }
133
134 static __plt_always_inline void
roc_lmt_mov_one(void * out,const void * in)135 roc_lmt_mov_one(void *out, const void *in)
136 {
137 PLT_SET_USED(out);
138 PLT_SET_USED(in);
139 }
140
141 static __plt_always_inline void
roc_lmt_mov_seg_nv(void * out,const void * in,const uint16_t segdw)142 roc_lmt_mov_seg_nv(void *out, const void *in, const uint16_t segdw)
143 {
144 PLT_SET_USED(out);
145 PLT_SET_USED(in);
146 PLT_SET_USED(segdw);
147 }
148
149 static __plt_always_inline void
roc_atf_ret(void)150 roc_atf_ret(void)
151 {
152 }
153
154 #endif /* _ROC_IO_GENERIC_H_ */
155