1 /* SPDX-License-Identifier: MIT */
2
3 /* Copyright 2024 Advanced Micro Devices, Inc. */
4 /* Copyright 2019 Raptor Engineering, LLC */
5
6 #ifndef _SPL_OS_TYPES_H_
7 #define _SPL_OS_TYPES_H_
8
9 #include <linux/slab.h>
10 #include <linux/kgdb.h>
11 #include <linux/kref.h>
12 #include <linux/types.h>
13 #include <linux/delay.h>
14 #include <linux/mm.h>
15
16 /*
17 *
18 * general debug capabilities
19 *
20 */
21 #define SPL_BREAK_TO_DEBUGGER() ASSERT(0)
22
spl_div_u64_rem(uint64_t dividend,uint32_t divisor,uint32_t * remainder)23 static inline uint64_t spl_div_u64_rem(uint64_t dividend, uint32_t divisor, uint32_t *remainder)
24 {
25 return div_u64_rem(dividend, divisor, remainder);
26 }
27
spl_div_u64(uint64_t dividend,uint32_t divisor)28 static inline uint64_t spl_div_u64(uint64_t dividend, uint32_t divisor)
29 {
30 return div_u64(dividend, divisor);
31 }
32
spl_div64_u64(uint64_t dividend,uint64_t divisor)33 static inline uint64_t spl_div64_u64(uint64_t dividend, uint64_t divisor)
34 {
35 return div64_u64(dividend, divisor);
36 }
37
spl_div64_u64_rem(uint64_t dividend,uint64_t divisor,uint64_t * remainder)38 static inline uint64_t spl_div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *remainder)
39 {
40 return div64_u64_rem(dividend, divisor, remainder);
41 }
42
spl_div64_s64(int64_t dividend,int64_t divisor)43 static inline int64_t spl_div64_s64(int64_t dividend, int64_t divisor)
44 {
45 return div64_s64(dividend, divisor);
46 }
47
48 #define spl_swap(a, b) \
49 do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
50
51 #ifndef spl_min
52 #define spl_min(a, b) (((a) < (b)) ? (a):(b))
53 #endif
54
55 #endif /* _SPL_OS_TYPES_H_ */
56