ice_osdep.h (2201B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* Copyright (c) 2018, Intel Corporation. */ 3 4#ifndef _ICE_OSDEP_H_ 5#define _ICE_OSDEP_H_ 6 7#include <linux/types.h> 8#include <linux/ctype.h> 9#include <linux/delay.h> 10#include <linux/io.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> 16#ifndef CONFIG_64BIT 17#include <linux/io-64-nonatomic-lo-hi.h> 18#endif 19#include <net/udp_tunnel.h> 20 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)) 25 26#define ice_flush(a) rd32((a), GLGEN_STAT) 27#define ICE_M(m, s) ((m) << (s)) 28 29struct ice_dma_mem { 30 void *va; 31 dma_addr_t pa; 32 size_t size; 33}; 34 35struct ice_hw; 36struct device *ice_hw_to_dev(struct ice_hw *hw); 37 38#ifdef CONFIG_DYNAMIC_DEBUG 39#define ice_debug(hw, type, fmt, args...) \ 40 dev_dbg(ice_hw_to_dev(hw), fmt, ##args) 41 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) 46#else 47#define ice_debug(hw, type, fmt, args...) \ 48do { \ 49 if ((type) & (hw)->debug_mask) \ 50 dev_info(ice_hw_to_dev(hw), fmt, ##args); \ 51} while (0) 52 53#ifdef DEBUG 54#define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \ 55do { \ 56 if ((type) & (hw)->debug_mask) \ 57 print_hex_dump_debug(KBUILD_MODNAME, \ 58 DUMP_PREFIX_OFFSET, \ 59 rowsize, groupsize, buf, \ 60 len, false); \ 61} while (0) 62#else 63#define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \ 64do { \ 65 struct ice_hw *hw_l = hw; \ 66 if ((type) & (hw_l)->debug_mask) { \ 67 u16 len_l = len; \ 68 u8 *buf_l = buf; \ 69 int i; \ 70 for (i = 0; i < (len_l - 16); i += 16) \ 71 ice_debug(hw_l, type, "0x%04X %16ph\n",\ 72 i, ((buf_l) + i)); \ 73 if (i < len_l) \ 74 ice_debug(hw_l, type, "0x%04X %*ph\n", \ 75 i, ((len_l) - i), ((buf_l) + i));\ 76 } \ 77} while (0) 78#endif /* DEBUG */ 79#endif /* CONFIG_DYNAMIC_DEBUG */ 80 81#endif /* _ICE_OSDEP_H_ */