xref: /freebsd/sys/dev/vmware/vmci/vmci_kernel_defs.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
163a93856SMark Peek /*-
2*3eeb7511SMark Peek  * Copyright (c) 2018 VMware, Inc.
363a93856SMark Peek  *
48c302b2eSMark Peek  * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0)
563a93856SMark Peek  */
663a93856SMark Peek 
763a93856SMark Peek /* Some common utilities used by the VMCI kernel module. */
863a93856SMark Peek 
963a93856SMark Peek #ifndef _VMCI_KERNEL_DEFS_H_
1063a93856SMark Peek #define _VMCI_KERNEL_DEFS_H_
1163a93856SMark Peek 
1263a93856SMark Peek #include <sys/param.h>
1363a93856SMark Peek #include <sys/systm.h>
1463a93856SMark Peek 
1563a93856SMark Peek typedef uint32_t PPN;
1663a93856SMark Peek 
177953f98eSConrad Meyer #define ASSERT(cond)		KASSERT(cond, ("%s", #cond))
1863a93856SMark Peek #define ASSERT_ON_COMPILE(e)	_Static_assert(e, #e);
1963a93856SMark Peek 
207953f98eSConrad Meyer #define LIKELY(_exp)		__predict_true(_exp)
217953f98eSConrad Meyer #define UNLIKELY(_exp)		__predict_false(_exp)
2263a93856SMark Peek 
237953f98eSConrad Meyer #define CONST64U(c)		UINT64_C(c)
2463a93856SMark Peek 
257953f98eSConrad Meyer #define ARRAYSIZE(a)		nitems(a)
2663a93856SMark Peek 
277953f98eSConrad Meyer #define ROUNDUP(x, y)		roundup(x, y)
287953f98eSConrad Meyer #define CEILING(x, y)		howmany(x, y)
2963a93856SMark Peek 
3063a93856SMark Peek #endif /* !_VMCI_KERNEL_DEFS_H_ */
31