summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/include/linux/kernel.h
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-06-08 04:47:57 +0000
committerjsg <jsg@openbsd.org>2020-06-08 04:47:57 +0000
commitc349dbc7938c71a30e13c1be4acc1976165f4630 (patch)
tree8798187dfd7a927a15123e8dad31b782b074baa8 /sys/dev/pci/drm/include/linux/kernel.h
parentThe errcheck() function treats an errno of ERANGE or EDOM as something (diff)
downloadwireguard-openbsd-c349dbc7938c71a30e13c1be4acc1976165f4630.tar.xz
wireguard-openbsd-c349dbc7938c71a30e13c1be4acc1976165f4630.zip
update drm to linux 5.7
adds kernel support for amdgpu: vega20, raven2, renoir, navi10, navi14 inteldrm: icelake, tigerlake Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for helping, patrick@ for helping adapt rockchip drm and many developers for testing.
Diffstat (limited to 'sys/dev/pci/drm/include/linux/kernel.h')
-rw-r--r--sys/dev/pci/drm/include/linux/kernel.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/include/linux/kernel.h b/sys/dev/pci/drm/include/linux/kernel.h
index 99fa7b4bb8b..059680589db 100644
--- a/sys/dev/pci/drm/include/linux/kernel.h
+++ b/sys/dev/pci/drm/include/linux/kernel.h
@@ -36,8 +36,6 @@
#define U64_C(x) UINT64_C(x)
#define U64_MAX UINT64_MAX
-#define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0)
-
#define ARRAY_SIZE nitems
#define lower_32_bits(n) ((u32)(n))
@@ -66,6 +64,7 @@
#define mult_frac(x, n, d) (((x) * (n)) / (d))
+#define roundup2(x, y) (((x) + ((y) - 1)) & (~((__typeof(x))(y) - 1)))
#define round_up(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#define round_down(x, y) (((x) / (y)) * (y)) /* y is power of two */
#define rounddown(x, y) (((x) / (y)) * (y)) /* arbitary y */
@@ -76,6 +75,9 @@
#define DIV_ROUND_CLOSEST(x, y) (((x) + ((y) / 2)) / (y))
#define DIV_ROUND_CLOSEST_ULL(x, y) DIV_ROUND_CLOSEST(x, y)
+#define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0)
+#define PTR_ALIGN(x, y) ((__typeof(x))roundup2((unsigned long)(x), (y)))
+
static inline char *
kasprintf(int flags, const char *fmt, ...)
{
@@ -114,6 +116,18 @@ kvasprintf(int flags, const char *fmt, va_list ap)
}
static inline int
+vscnprintf(char *buf, size_t size, const char *fmt, va_list ap)
+{
+ int nc;
+
+ nc = vsnprintf(buf, size, fmt, ap);
+ if (nc > (size - 1))
+ return (size - 1);
+ else
+ return nc;
+}
+
+static inline int
_in_dbg_master(void)
{
#ifdef DDB
@@ -129,8 +143,13 @@ _in_dbg_master(void)
#define add_taint(x, y)
#define TAINT_MACHINE_CHECK 0
+#define TAINT_WARN 1
#define LOCKDEP_STILL_OK 0
#define u64_to_user_ptr(x) ((void *)(uintptr_t)(x))
+#define _RET_IP_ __builtin_return_address(0)
+
+#define STUB() do { printf("%s: stub\n", __func__); } while(0)
+
#endif