1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
5 #ifndef _OSDEP_RAW_GENERIC_H
6 #define _OSDEP_RAW_GENERIC_H
8 #define compiler_barrier() (asm volatile ("" : : : "memory"))
10 #define io_wmb() compiler_barrier()
11 #define io_rmb() compiler_barrier()
13 static inline uint8_t opae_readb(const volatile void *addr)
17 val = *(const volatile uint8_t *)addr;
22 static inline uint16_t opae_readw(const volatile void *addr)
26 val = *(const volatile uint16_t *)addr;
31 static inline uint32_t opae_readl(const volatile void *addr)
35 val = *(const volatile uint32_t *)addr;
40 static inline uint64_t opae_readq(const volatile void *addr)
44 val = *(const volatile uint64_t *)addr;
49 static inline void opae_writeb(uint8_t value, volatile void *addr)
52 *(volatile uint8_t *)addr = value;
55 static inline void opae_writew(uint16_t value, volatile void *addr)
58 *(volatile uint16_t *)addr = value;
61 static inline void opae_writel(uint32_t value, volatile void *addr)
64 *(volatile uint32_t *)addr = value;
67 static inline void opae_writeq(uint64_t value, volatile void *addr)
70 *(volatile uint64_t *)addr = value;
73 #define opae_free(addr) free(addr)
74 #define opae_memcpy(a, b, c) memcpy((a), (b), (c))