#ifndef _I40E_OSDEP_H
#define _I40E_OSDEP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/pci_cap.h>
#include <sys/sysmacros.h>
#include <sys/stdbool.h>
#define DEBUGOUT(S) i40e_debug(NULL, 0, S)
#define DEBUGOUT1(S, A) i40e_debug(NULL, 0, S, A)
#define DEBUGOUT2(S, A, B) i40e_debug(NULL, 0, S, A, B)
#define DEBUGOUT3(S, A, B, C) i40e_debug(NULL, 0, S, A, B, C)
#define DEBUGOUT4(S, A, B, C, D) \
i40e_debug(NULL, 0, S, A, B, C, D)
#define DEBUGOUT5(S, A, B, C, D, E) \
i40e_debug(NULL, 0, S, A, B, C, D, E)
#define DEBUGOUT6(S, A, B, C, D, E, F) \
i40e_debug(NULL, 0, S, A, B, C, D, E, F)
#define DEBUGOUT7(S, A, B, C, D, E, F, G) \
i40e_debug(NULL, 0, S, A, B, C, D, E, F, G)
#define DEBUGFUNC(F) DEBUGOUT(F);
#define UNREFERENCED_PARAMETER(x) _NOTE(ARGUNUSED(x))
#define UNREFERENCED_1PARAMETER(_p) UNREFERENCED_PARAMETER(_p)
#define UNREFERENCED_2PARAMETER(_p, _q) _NOTE(ARGUNUSED(_p, _q))
#define UNREFERENCED_3PARAMETER(_p, _q, _r) _NOTE(ARGUNUSED(_p, _q, _r))
#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) _NOTE(ARGUNUSED(_p, _q, _r, _s))
#define INLINE inline
#ifndef _I40E_MDB_DMOD
#define FALSE false
#define TRUE true
#endif
#define CPU_TO_LE16(o) LE_16(o)
#define CPU_TO_LE32(s) LE_32(s)
#define CPU_TO_LE64(h) LE_64(h)
#define LE16_TO_CPU(a) LE_16(a)
#define LE32_TO_CPU(c) LE_32(c)
#define LE64_TO_CPU(k) LE_64(k)
#define I40E_NTOHS(a) ntohs(a)
#define I40E_NTOHL(a) ntohl(a)
#define I40E_HTONS(a) htons(a)
#define I40E_HTONL(a) htonl(a)
#define i40e_memset(a, b, c, d) memset((a), (b), (c))
#define i40e_memcpy(a, b, c, d) bcopy((b), (a), (c))
#define i40e_usec_delay(x) drv_usecwait(x)
#define i40e_msec_delay(x) drv_usecwait(1000 * (x))
#define FIELD_SIZEOF(x, y) (sizeof (((x*)0)->y))
#define BIT(a) (1UL << (a))
#define BIT_ULL(a) (1ULL << (a))
typedef uint8_t u8;
typedef int8_t s8;
typedef uint16_t u16;
typedef int16_t s16;
typedef uint32_t u32;
typedef int32_t s32;
typedef uint64_t u64;
typedef enum i40e_status_code i40e_status;
#define __le16 u16
#define __le32 u32
#define __le64 u64
#define __be16 u16
#define __be32 u32
#define __be64 u64
struct i40e_spinlock {
kmutex_t ispl_mutex;
};
#define prefetch(x) prefetch_read_many(x)
struct i40e_osdep {
off_t ios_reg_size;
ddi_acc_handle_t ios_reg_handle;
ddi_acc_handle_t ios_cfg_handle;
struct i40e *ios_i40e;
};
struct i40e_virt_mem {
void *va;
u32 size;
};
struct i40e_dma_mem {
void *va;
u64 pa;
size_t size;
ddi_acc_handle_t idm_acc_handle;
ddi_dma_handle_t idm_dma_handle;
uint32_t idm_alignment;
};
struct i40e_hw;
#define OS_DEP(hw) ((struct i40e_osdep *)((hw)->back))
#define i40e_read_pci_cfg(hw, reg) \
(pci_config_get16(OS_DEP(hw)->ios_cfg_handle, (reg)))
#define i40e_write_pci_cfg(hw, reg, value) \
(pci_config_put16(OS_DEP(hw)->ios_cfg_handle, (reg), (value)))
#define wr32(hw, reg, value) \
ddi_put32(OS_DEP(hw)->ios_reg_handle, \
(uint32_t *)((uintptr_t)(hw)->hw_addr + (reg)), (value))
#define rd32(hw, reg) \
ddi_get32(OS_DEP(hw)->ios_reg_handle, \
(uint32_t *)((uintptr_t)(hw)->hw_addr + (reg)))
#define I40E_WRITE_REG wr32
#define I40E_READ_REG rd32
#define i40e_flush(hw) (void) rd32(hw, I40E_GLGEN_STAT)
extern void i40e_debug(void *, u32, char *, ...);
extern boolean_t i40e_set_hw_bus_info(struct i40e_hw *);
#ifdef __cplusplus
}
#endif
#endif