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 wr64(a, reg, value) writeq((value), ((a)->hw_addr + (reg))) 30 #define rd64(a, reg) readq((a)->hw_addr + (reg)) 31 #define i40e_flush(a) readl((a)->hw_addr + I40E_GLGEN_STAT) 32 33 /* memory allocation tracking */ 34 struct i40e_dma_mem { 35 void *va; 36 dma_addr_t pa; 37 u32 size; 38 }; 39 40 #define i40e_allocate_dma_mem(h, m, unused, s, a) \ 41 i40e_allocate_dma_mem_d(h, m, s, a) 42 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m) 43 44 struct i40e_virt_mem { 45 void *va; 46 u32 size; 47 }; 48 49 #define i40e_allocate_virt_mem(h, m, s) i40e_allocate_virt_mem_d(h, m, s) 50 #define i40e_free_virt_mem(h, m) i40e_free_virt_mem_d(h, m) 51 52 #define i40e_debug(h, m, s, ...) \ 53 do { \ 54 if (((m) & (h)->debug_mask)) \ 55 pr_info("i40e %02x:%02x.%x " s, \ 56 (h)->bus.bus_id, (h)->bus.device, \ 57 (h)->bus.func, ##__VA_ARGS__); \ 58 } while (0) 59 60 typedef enum i40e_status_code i40e_status; 61 #endif /* _I40E_OSDEP_H_ */ 62