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 static inline uint32_t div_round_up(uint32_t n, uint32_t d) 48 { 49 return (n + d - 1) / d; 50 } 51 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) 57 58 #endif 59