1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2 * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
13 #include <rte_common.h>
14 #include <rte_debug.h>
15 #include <rte_cycles.h>
17 #include <rte_byteorder.h>
19 #include <rte_memory.h>
21 #include "ionic_logs.h"
23 #define DELAY(x) rte_delay_us(x)
24 #define usec_delay(x) DELAY(x)
25 #define msec_delay(x) DELAY(1000 * (x))
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))
33 #define PAGE_SIZE (1 << PAGE_SHIFT)
43 typedef uint16_t __le16;
44 typedef uint32_t __le32;
45 typedef uint64_t __le64;
47 static inline uint32_t div_round_up(uint32_t n, uint32_t d)
49 return (n + d - 1) / d;
52 #define ioread8(reg) rte_read8(reg)
53 #define ioread32(reg) rte_read32(reg)
54 #define iowrite8(value, reg) rte_write8(value, reg)
55 #define iowrite32(value, reg) rte_write32(value, reg)
56 #define writeq(value, reg) rte_write64(value, reg)