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