Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2013 - 2018 Intel Corporation. */
0003 
0004 #ifndef _IAVF_OSDEP_H_
0005 #define _IAVF_OSDEP_H_
0006 
0007 #include <linux/types.h>
0008 #include <linux/if_ether.h>
0009 #include <linux/if_vlan.h>
0010 #include <linux/tcp.h>
0011 #include <linux/pci.h>
0012 
0013 /* get readq/writeq support for 32 bit kernels, use the low-first version */
0014 #include <linux/io-64-nonatomic-lo-hi.h>
0015 
0016 /* File to be the magic between shared code and
0017  * actual OS primitives
0018  */
0019 
0020 #define hw_dbg(hw, S, A...) do {} while (0)
0021 
0022 #define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
0023 #define rd32(a, reg)        readl((a)->hw_addr + (reg))
0024 
0025 #define wr64(a, reg, value) writeq((value), ((a)->hw_addr + (reg)))
0026 #define rd64(a, reg)        readq((a)->hw_addr + (reg))
0027 #define iavf_flush(a)       readl((a)->hw_addr + IAVF_VFGEN_RSTAT)
0028 
0029 /* memory allocation tracking */
0030 struct iavf_dma_mem {
0031     void *va;
0032     dma_addr_t pa;
0033     u32 size;
0034 };
0035 
0036 #define iavf_allocate_dma_mem(h, m, unused, s, a) \
0037     iavf_allocate_dma_mem_d(h, m, s, a)
0038 #define iavf_free_dma_mem(h, m) iavf_free_dma_mem_d(h, m)
0039 
0040 struct iavf_virt_mem {
0041     void *va;
0042     u32 size;
0043 };
0044 #define iavf_allocate_virt_mem(h, m, s) iavf_allocate_virt_mem_d(h, m, s)
0045 #define iavf_free_virt_mem(h, m) iavf_free_virt_mem_d(h, m)
0046 
0047 #define iavf_debug(h, m, s, ...)                \
0048 do {                                \
0049     if (((m) & (h)->debug_mask))                \
0050         pr_info("iavf %02x:%02x.%x " s,         \
0051             (h)->bus.bus_id, (h)->bus.device,   \
0052             (h)->bus.func, ##__VA_ARGS__);      \
0053 } while (0)
0054 
0055 #endif /* _IAVF_OSDEP_H_ */