xref: /linux/drivers/net/ethernet/intel/iavf/iavf_osdep.h (revision ae22a94997b8a03dcb3c922857c203246711f9d4)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2013 - 2018 Intel Corporation. */
3 
4 #ifndef _IAVF_OSDEP_H_
5 #define _IAVF_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 
13 /* get readq/writeq support for 32 bit kernels, use the low-first version */
14 #include <linux/io-64-nonatomic-lo-hi.h>
15 
16 #define wr32(a, reg, value)	writel((value), ((a)->hw_addr + (reg)))
17 #define rd32(a, reg)		readl((a)->hw_addr + (reg))
18 
19 #define wr64(a, reg, value)	writeq((value), ((a)->hw_addr + (reg)))
20 #define rd64(a, reg)		readq((a)->hw_addr + (reg))
21 #define iavf_flush(a)		readl((a)->hw_addr + IAVF_VFGEN_RSTAT)
22 
23 /* memory allocation tracking */
24 struct iavf_dma_mem {
25 	void *va;
26 	dma_addr_t pa;
27 	u32 size;
28 };
29 
30 #define iavf_allocate_dma_mem(h, m, unused, s, a) \
31 	iavf_allocate_dma_mem_d(h, m, s, a)
32 
33 struct iavf_virt_mem {
34 	void *va;
35 	u32 size;
36 };
37 
38 #define iavf_debug(h, m, s, ...)				\
39 do {								\
40 	if (((m) & (h)->debug_mask))				\
41 		pr_info("iavf %02x:%02x.%x " s,			\
42 			(h)->bus.bus_id, (h)->bus.device,	\
43 			(h)->bus.func, ##__VA_ARGS__);		\
44 } while (0)
45 
46 #endif /* _IAVF_OSDEP_H_ */
47