Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2013 - 2018 Intel Corporation. */
0003 
0004 #ifndef _I40E_OSDEP_H_
0005 #define _I40E_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 #include <linux/highuid.h>
0013 
0014 /* get readq/writeq support for 32 bit kernels, use the low-first version */
0015 #include <linux/io-64-nonatomic-lo-hi.h>
0016 
0017 /* File to be the magic between shared code and
0018  * actual OS primitives
0019  */
0020 
0021 #define hw_dbg(hw, S, A...)                         \
0022 do {                                        \
0023     dev_dbg(&((struct i40e_pf *)hw->back)->pdev->dev, S, ##A);      \
0024 } while (0)
0025 
0026 #define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
0027 #define rd32(a, reg)        readl((a)->hw_addr + (reg))
0028 
0029 #define rd64(a, reg)        readq((a)->hw_addr + (reg))
0030 #define i40e_flush(a)       readl((a)->hw_addr + I40E_GLGEN_STAT)
0031 
0032 /* memory allocation tracking */
0033 struct i40e_dma_mem {
0034     void *va;
0035     dma_addr_t pa;
0036     u32 size;
0037 };
0038 
0039 #define i40e_allocate_dma_mem(h, m, unused, s, a) \
0040             i40e_allocate_dma_mem_d(h, m, s, a)
0041 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
0042 
0043 struct i40e_virt_mem {
0044     void *va;
0045     u32 size;
0046 };
0047 
0048 #define i40e_allocate_virt_mem(h, m, s) i40e_allocate_virt_mem_d(h, m, s)
0049 #define i40e_free_virt_mem(h, m) i40e_free_virt_mem_d(h, m)
0050 
0051 #define i40e_debug(h, m, s, ...)                \
0052 do {                                \
0053     if (((m) & (h)->debug_mask))                \
0054         pr_info("i40e %02x:%02x.%x " s,         \
0055             (h)->bus.bus_id, (h)->bus.device,   \
0056             (h)->bus.func, ##__VA_ARGS__);      \
0057 } while (0)
0058 
0059 typedef enum i40e_status_code i40e_status;
0060 #endif /* _I40E_OSDEP_H_ */