1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2018, Intel Corporation. */
7 #include <linux/types.h>
10 #include <linux/io-64-nonatomic-lo-hi.h>
13 #define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
14 #define rd32(a, reg) readl((a)->hw_addr + (reg))
15 #define wr64(a, reg, value) writeq((value), ((a)->hw_addr + (reg)))
16 #define rd64(a, reg) readq((a)->hw_addr + (reg))
18 #define ice_flush(a) rd32((a), GLGEN_STAT)
19 #define ICE_M(m, s) ((m) << (s))
27 #define ice_hw_to_dev(ptr) \
28 (&(container_of((ptr), struct ice_pf, hw))->pdev->dev)
30 #ifdef CONFIG_DYNAMIC_DEBUG
31 #define ice_debug(hw, type, fmt, args...) \
32 dev_dbg(ice_hw_to_dev(hw), fmt, ##args)
34 #define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \
35 print_hex_dump_debug(KBUILD_MODNAME " ", \
36 DUMP_PREFIX_OFFSET, rowsize, \
37 groupsize, buf, len, false)
39 #define ice_debug(hw, type, fmt, args...) \
41 if ((type) & (hw)->debug_mask) \
42 dev_info(ice_hw_to_dev(hw), fmt, ##args); \
46 #define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \
48 if ((type) & (hw)->debug_mask) \
49 print_hex_dump_debug(KBUILD_MODNAME, \
51 rowsize, groupsize, buf, \
55 #define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \
57 struct ice_hw *hw_l = hw; \
58 if ((type) & (hw_l)->debug_mask) { \
62 for (i = 0; i < (len_l - 16); i += 16) \
63 ice_debug(hw_l, type, "0x%04X %16ph\n",\
66 ice_debug(hw_l, type, "0x%04X %*ph\n", \
67 i, ((len_l) - i), ((buf_l) + i));\
71 #endif /* CONFIG_DYNAMIC_DEBUG */
73 #endif /* _ICE_OSDEP_H_ */