1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2018, Intel Corporation. */
7 #include <linux/types.h>
8 #include <linux/ctype.h>
9 #include <linux/delay.h>
11 #include <linux/bitops.h>
12 #include <linux/ethtool.h>
13 #include <linux/etherdevice.h>
14 #include <linux/if_ether.h>
15 #include <linux/pci_ids.h>
17 #include <linux/io-64-nonatomic-lo-hi.h>
19 #include <net/udp_tunnel.h>
21 #define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
22 #define rd32(a, reg) readl((a)->hw_addr + (reg))
23 #define wr64(a, reg, value) writeq((value), ((a)->hw_addr + (reg)))
24 #define rd64(a, reg) readq((a)->hw_addr + (reg))
26 #define ice_flush(a) rd32((a), GLGEN_STAT)
27 #define ICE_M(m, s) ((m) << (s))
36 struct device *ice_hw_to_dev(struct ice_hw *hw);
38 #ifdef CONFIG_DYNAMIC_DEBUG
39 #define ice_debug(hw, type, fmt, args...) \
40 dev_dbg(ice_hw_to_dev(hw), fmt, ##args)
42 #define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \
43 print_hex_dump_debug(KBUILD_MODNAME " ", \
44 DUMP_PREFIX_OFFSET, rowsize, \
45 groupsize, buf, len, false)
47 #define ice_debug(hw, type, fmt, args...) \
49 if ((type) & (hw)->debug_mask) \
50 dev_info(ice_hw_to_dev(hw), fmt, ##args); \
54 #define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \
56 if ((type) & (hw)->debug_mask) \
57 print_hex_dump_debug(KBUILD_MODNAME, \
59 rowsize, groupsize, buf, \
63 #define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \
65 struct ice_hw *hw_l = hw; \
66 if ((type) & (hw_l)->debug_mask) { \
70 for (i = 0; i < (len_l - 16); i += 16) \
71 ice_debug(hw_l, type, "0x%04X %16ph\n",\
74 ice_debug(hw_l, type, "0x%04X %*ph\n", \
75 i, ((len_l) - i), ((buf_l) + i));\
79 #endif /* CONFIG_DYNAMIC_DEBUG */
81 #endif /* _ICE_OSDEP_H_ */