1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2008-2017 Cisco Systems, Inc. All rights reserved.
3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
6 #ifndef _ENIC_COMPAT_H_
7 #define _ENIC_COMPAT_H_
12 #include <rte_atomic.h>
13 #include <rte_malloc.h>
21 #define pr_err(y, args...) dev_err(0, y, ##args)
22 #define pr_warn(y, args...) dev_warning(0, y, ##args)
23 #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
25 #define VNIC_ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
26 #define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
28 extern int enic_pmd_logtype;
30 #define dev_printk(level, fmt, args...) \
31 rte_log(RTE_LOG_ ## level, enic_pmd_logtype, \
32 "PMD: rte_enic_pmd: " fmt, ##args)
34 #define dev_err(x, args...) dev_printk(ERR, args)
35 #define dev_info(x, args...) dev_printk(INFO, args)
36 #define dev_warning(x, args...) dev_printk(WARNING, args)
37 #define dev_debug(x, args...) dev_printk(DEBUG, args)
39 #define ENICPMD_LOG(level, fmt, args...) \
40 rte_log(RTE_LOG_ ## level, enic_pmd_logtype, \
41 "%s " fmt "\n", __func__, ##args)
42 #define ENICPMD_FUNC_TRACE() ENICPMD_LOG(DEBUG, ">>")
44 typedef unsigned long long dma_addr_t;
46 static inline uint32_t ioread32(volatile void *addr)
48 return rte_read32(addr);
51 static inline uint8_t ioread8(volatile void *addr)
53 return rte_read8(addr);
56 static inline void iowrite32(uint32_t val, volatile void *addr)
58 rte_write32(val, addr);
61 static inline void iowrite32_relaxed(uint32_t val, volatile void *addr)
63 rte_write32_relaxed(val, addr);
66 static inline unsigned int readl(volatile void __iomem *addr)
68 return rte_read32(addr);
71 static inline void writel(unsigned int val, volatile void __iomem *addr)
73 rte_write32(val, addr);
76 #endif /* _ENIC_COMPAT_H_ */