Branch data Line data Source code
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.
4 : : */
5 : :
6 : : #ifndef _ENIC_COMPAT_H_
7 : : #define _ENIC_COMPAT_H_
8 : :
9 : : #include <stdio.h>
10 : : #include <unistd.h>
11 : :
12 : : #include <rte_malloc.h>
13 : : #include <rte_log.h>
14 : : #include <rte_io.h>
15 : :
16 : : #define ETH_ALEN 6
17 : :
18 : : #define __iomem
19 : :
20 : : #define pr_err(y, ...) dev_err(0, y, ##__VA_ARGS__)
21 : : #define pr_warn(y, ...) dev_warning(0, y, ##__VA_ARGS__)
22 : : #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
23 : :
24 : : #define VNIC_ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
25 : : #define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
26 : :
27 : : extern int enic_pmd_logtype;
28 : : #define RTE_LOGTYPE_ENIC_PMD enic_pmd_logtype
29 : :
30 : : #define dev_printk(level, fmt, ...) \
31 : : rte_log(RTE_LOG_ ## level, enic_pmd_logtype, \
32 : : "PMD: rte_enic_pmd: " fmt, ##__VA_ARGS__)
33 : :
34 : : #define dev_err(x, ...) dev_printk(ERR, __VA_ARGS__)
35 : : #define dev_info(x, ...) dev_printk(INFO, __VA_ARGS__)
36 : : #define dev_warning(x, ...) dev_printk(WARNING, __VA_ARGS__)
37 : : #define dev_debug(x, ...) dev_printk(DEBUG, __VA_ARGS__)
38 : :
39 : : #define ENICPMD_LOG(level, ...) \
40 : : RTE_LOG_LINE_PREFIX(level, ENIC_PMD, "%s ", __func__, __VA_ARGS__)
41 : : #define ENICPMD_FUNC_TRACE() ENICPMD_LOG(DEBUG, ">>")
42 : :
43 : : typedef unsigned long long dma_addr_t;
44 : :
45 : : static inline uint32_t ioread32(volatile void *addr)
46 : : {
47 : : return rte_read32(addr);
48 : : }
49 : :
50 : : static inline uint8_t ioread8(volatile void *addr)
51 : : {
52 : : return rte_read8(addr);
53 : : }
54 : :
55 : : static inline void iowrite32(uint32_t val, volatile void *addr)
56 : : {
57 : : rte_write32(val, addr);
58 : 0 : }
59 : :
60 : : static inline void iowrite32_relaxed(uint32_t val, volatile void *addr)
61 : : {
62 : : rte_write32_relaxed(val, addr);
63 : 0 : }
64 : :
65 : : static inline unsigned int readl(volatile void __iomem *addr)
66 : : {
67 : : return rte_read32(addr);
68 : : }
69 : :
70 : : static inline void writel(unsigned int val, volatile void __iomem *addr)
71 : : {
72 : : rte_write32(val, addr);
73 : : }
74 : :
75 : : #endif /* _ENIC_COMPAT_H_ */
|