1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016 Cavium, Inc
12 #include "rte_cpuflags.h"
14 #define RTE_NATIVE_WRITE32_WC
15 #include "generic/rte_io.h"
21 static __rte_always_inline void
22 __rte_x86_movdiri(uint32_t value, volatile void *addr)
26 ".byte 0x40, 0x0f, 0x38, 0xf9, 0x02"
28 : "a" (value), "d" (addr));
32 static __rte_always_inline void
33 rte_write32_wc_relaxed(uint32_t value, volatile void *addr)
35 static int _x86_movdiri_flag = -1;
37 if (_x86_movdiri_flag == 1) {
38 __rte_x86_movdiri(value, addr);
39 } else if (_x86_movdiri_flag == 0) {
40 rte_write32_relaxed(value, addr);
43 (rte_cpu_get_flag_enabled(RTE_CPUFLAG_MOVDIRI) > 0);
44 if (_x86_movdiri_flag == 1)
45 __rte_x86_movdiri(value, addr);
47 rte_write32_relaxed(value, addr);
52 static __rte_always_inline void
53 rte_write32_wc(uint32_t value, volatile void *addr)
55 /* gcc complains about calling this experimental function even
56 * when not using it. Hide it with ALLOW_EXPERIMENTAL_API.
58 #ifdef ALLOW_EXPERIMENTAL_API
60 rte_write32_wc_relaxed(value, addr);
62 rte_write32(value, addr);
70 #endif /* _RTE_IO_X86_H_ */