summaryrefslogtreecommitdiffstats
path: root/drivers/net/ifc/base/ifcvf_osdep.h
blob: cf151ef52b97d68f8e7c3e84fc63aacb32e2d8e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2018 Intel Corporation
 */

#ifndef _IFCVF_OSDEP_H_
#define _IFCVF_OSDEP_H_

#include <stdint.h>
#include <linux/pci_regs.h>

#include <rte_cycles.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_log.h>
#include <rte_io.h>

#define DEBUGOUT(S, args...)    RTE_LOG(DEBUG, PMD, S, ##args)
#define STATIC                  static

#define msec_delay	rte_delay_ms

#define IFCVF_READ_REG8(reg)		rte_read8(reg)
#define IFCVF_WRITE_REG8(val, reg)	rte_write8((val), (reg))
#define IFCVF_READ_REG16(reg)		rte_read16(reg)
#define IFCVF_WRITE_REG16(val, reg)	rte_write16((val), (reg))
#define IFCVF_READ_REG32(reg)		rte_read32(reg)
#define IFCVF_WRITE_REG32(val, reg)	rte_write32((val), (reg))

typedef struct rte_pci_device PCI_DEV;

#define PCI_READ_CONFIG_BYTE(dev, val, where) \
	rte_pci_read_config(dev, val, 1, where)

#define PCI_READ_CONFIG_DWORD(dev, val, where) \
	rte_pci_read_config(dev, val, 4, where)

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 int64_t    s64;
typedef uint64_t   u64;

static inline int
PCI_READ_CONFIG_RANGE(PCI_DEV *dev, uint32_t *val, int size, int where)
{
	return rte_pci_read_config(dev, val, size, where);
}

#endif /* _IFCVF_OSDEP_H_ */