i40e_osdep.h 1.5 KB

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