net/ionic: register and initialize adapter
[dpdk.git] / drivers / net / ionic / ionic_osdep.h
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
3  */
4
5 #ifndef _IONIC_OSDEP_
6 #define _IONIC_OSDEP_
7
8 #include <string.h>
9 #include <stdint.h>
10 #include <stdio.h>
11 #include <stdarg.h>
12
13 #include <rte_common.h>
14 #include <rte_debug.h>
15 #include <rte_cycles.h>
16 #include <rte_log.h>
17 #include <rte_byteorder.h>
18 #include <rte_io.h>
19 #include <rte_memory.h>
20
21 #include "ionic_logs.h"
22
23 #define DELAY(x) rte_delay_us(x)
24 #define usec_delay(x) DELAY(x)
25 #define msec_delay(x) DELAY(1000 * (x))
26
27 #define BIT(nr)            (1UL << (nr))
28 #define BIT_ULL(nr)        (1ULL << (nr))
29 #define BITS_TO_LONGS(nr)  div_round_up(nr, 8 * sizeof(long))
30
31 #ifndef PAGE_SHIFT
32 #define PAGE_SHIFT      12
33 #define PAGE_SIZE       (1 << PAGE_SHIFT)
34 #endif
35
36 #define __iomem
37
38 typedef uint8_t  u8;
39 typedef uint16_t u16;
40 typedef uint32_t u32;
41 typedef uint64_t u64;
42
43 typedef uint16_t __le16;
44 typedef uint32_t __le32;
45 typedef uint64_t __le64;
46
47 #ifndef __cplusplus
48 typedef uint8_t bool;
49 #define false   0
50 #define true    1
51 #endif
52
53 static inline uint32_t div_round_up(uint32_t n, uint32_t d)
54 {
55         return (n + d - 1) / d;
56 }
57
58 #define ioread8(reg)            rte_read8(reg)
59 #define ioread32(reg)           rte_read32(reg)
60 #define iowrite8(value, reg)    rte_write8(value, reg)
61 #define iowrite32(value, reg)   rte_write32(value, reg)
62 #define writeq(value, reg)      rte_write64(value, reg)
63
64 #endif