1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
5 #ifndef _ROC_IO_GENERIC_H_
6 #define _ROC_IO_GENERIC_H_
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)
11 #define roc_load_pair(val0, val1, addr) \
13 val0 = plt_read64((void *)(addr)); \
14 val1 = plt_read64((uint8_t *)(addr) + 8); \
17 #define roc_store_pair(val0, val1, addr) \
19 plt_write64(val0, (void *)(addr)); \
20 plt_write64(val1, (((uint8_t *)(addr)) + 8)); \
23 #define roc_prefetch_store_keep(ptr) \
27 static __plt_always_inline void
28 roc_atomic128_cas_noreturn(uint64_t swap0, uint64_t swap1, uint64_t ptr)
35 static __plt_always_inline uint64_t
36 roc_atomic64_cas(uint64_t compare, uint64_t swap, int64_t *ptr)
44 static inline uint64_t
45 roc_atomic64_add_nosync(int64_t incr, int64_t *ptr)
53 static inline uint64_t
54 roc_atomic64_add_sync(int64_t incr, int64_t *ptr)
62 static inline uint64_t
63 roc_lmt_submit_ldeor(plt_iova_t io_address)
65 PLT_SET_USED(io_address);
70 static __plt_always_inline uint64_t
71 roc_lmt_submit_ldeorl(plt_iova_t io_address)
73 PLT_SET_USED(io_address);
79 roc_lmt_submit_steor(uint64_t data, plt_iova_t io_address)
82 PLT_SET_USED(io_address);
86 roc_lmt_submit_steorl(uint64_t data, plt_iova_t io_address)
89 PLT_SET_USED(io_address);
92 static __plt_always_inline void
93 roc_lmt_mov(void *out, const void *in, const uint32_t lmtext)
97 memset(out, 0, sizeof(__uint128_t) * (lmtext ? lmtext > 1 ? 4 : 3 : 2));
100 static __plt_always_inline void
101 roc_lmt_mov_seg(void *out, const void *in, const uint16_t segdw)
108 static __plt_always_inline void
109 roc_lmt_mov_one(void *out, const void *in)
115 static __plt_always_inline void
116 roc_lmt_mov_seg_nv(void *out, const void *in, const uint16_t segdw)
123 static __plt_always_inline void
128 #endif /* _ROC_IO_GENERIC_H_ */