1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2019 Marvell International Ltd.
3 */
4
5 #ifndef _OTX2_IO_GENERIC_H_
6 #define _OTX2_IO_GENERIC_H_
7
8 #include <string.h>
9
10 #define otx2_load_pair(val0, val1, addr) \
11 do { \
12 val0 = rte_read64_relaxed((void *)(addr)); \
13 val1 = rte_read64_relaxed((uint8_t *)(addr) + 8); \
14 } while (0)
15
16 #define otx2_store_pair(val0, val1, addr) \
17 do { \
18 rte_write64_relaxed(val0, (void *)(addr)); \
19 rte_write64_relaxed(val1, (((uint8_t *)(addr)) + 8)); \
20 } while (0)
21
22 #define otx2_prefetch_store_keep(ptr) do {} while (0)
23
24 static inline uint64_t
otx2_atomic64_add_nosync(int64_t incr,int64_t * ptr)25 otx2_atomic64_add_nosync(int64_t incr, int64_t *ptr)
26 {
27 RTE_SET_USED(ptr);
28 RTE_SET_USED(incr);
29
30 return 0;
31 }
32
33 static inline uint64_t
otx2_atomic64_add_sync(int64_t incr,int64_t * ptr)34 otx2_atomic64_add_sync(int64_t incr, int64_t *ptr)
35 {
36 RTE_SET_USED(ptr);
37 RTE_SET_USED(incr);
38
39 return 0;
40 }
41
42 static inline int64_t
otx2_lmt_submit(uint64_t io_address)43 otx2_lmt_submit(uint64_t io_address)
44 {
45 RTE_SET_USED(io_address);
46
47 return 0;
48 }
49
50 static inline int64_t
otx2_lmt_submit_release(uint64_t io_address)51 otx2_lmt_submit_release(uint64_t io_address)
52 {
53 RTE_SET_USED(io_address);
54
55 return 0;
56 }
57
58 static __rte_always_inline void
otx2_lmt_mov(void * out,const void * in,const uint32_t lmtext)59 otx2_lmt_mov(void *out, const void *in, const uint32_t lmtext)
60 {
61 /* Copy four words if lmtext = 0
62 * six words if lmtext = 1
63 * eight words if lmtext =2
64 */
65 memcpy(out, in, (4 + (2 * lmtext)) * sizeof(uint64_t));
66 }
67
68 static __rte_always_inline void
otx2_lmt_mov_seg(void * out,const void * in,const uint16_t segdw)69 otx2_lmt_mov_seg(void *out, const void *in, const uint16_t segdw)
70 {
71 RTE_SET_USED(out);
72 RTE_SET_USED(in);
73 RTE_SET_USED(segdw);
74 }
75 #endif /* _OTX2_IO_GENERIC_H_ */
76