1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright(c) 2013 - 2018 Intel Corporation. */ 3 4 #ifndef _I40E_OSDEP_H_ 5 #define _I40E_OSDEP_H_ 6 7 #include <linux/types.h> 8 #include <linux/if_ether.h> 9 #include <linux/if_vlan.h> 10 #include <linux/tcp.h> 11 #include <linux/pci.h> 12 #include <linux/highuid.h> 13 14 /* get readq/writeq support for 32 bit kernels, use the low-first version */ 15 #include <linux/io-64-nonatomic-lo-hi.h> 16 17 /* File to be the magic between shared code and 18 * actual OS primitives 19 */ 20 21 #define hw_dbg(hw, S, A...) \ 22 do { \ 23 dev_dbg(&((struct i40e_pf *)hw->back)->pdev->dev, S, ##A); \ 24 } while (0) 25 26 #define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg))) 27 #define rd32(a, reg) readl((a)->hw_addr + (reg)) 28 29 #define rd64(a, reg) readq((a)->hw_addr + (reg)) 30 #define i40e_flush(a) readl((a)->hw_addr + I40E_GLGEN_STAT) 31 32 /* memory allocation tracking */ 33 struct i40e_dma_mem { 34 void *va; 35 dma_addr_t pa; 36 u32 size; 37 }; 38 39 #define i40e_allocate_dma_mem(h, m, unused, s, a) \ 40 i40e_allocate_dma_mem_d(h, m, s, a) 41 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m) 42 43 struct i40e_virt_mem { 44 void *va; 45 u32 size; 46 }; 47 48 #define i40e_allocate_virt_mem(h, m, s) i40e_allocate_virt_mem_d(h, m, s) 49 #define i40e_free_virt_mem(h, m) i40e_free_virt_mem_d(h, m) 50 51 #define i40e_debug(h, m, s, ...) \ 52 do { \ 53 if (((m) & (h)->debug_mask)) \ 54 pr_info("i40e %02x:%02x.%x " s, \ 55 (h)->bus.bus_id, (h)->bus.device, \ 56 (h)->bus.func, ##__VA_ARGS__); \ 57 } while (0) 58 59 #endif /* _I40E_OSDEP_H_ */ 60