From 6d8fae3868d6ccf2ab57da5e372bd791fe6bc351 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Mon, 5 Jun 2017 09:36:21 +0200
Subject: [PATCH 54/55] WIP

---
 sys/conf/files                                | 28 +++++++++----------
 sys/dev/drm/include/asm/io.h                  |  7 -----
 sys/dev/drm/include/linux/fb.h                |  9 ------
 sys/dev/drm/nouveau/Makefile                  | 28 +++++++++----------
 .../nouveau/core/core/nouveau_core_client.c   |  2 +-
 .../nouveau/core/core/nouveau_core_ioctl.c    |  6 ++--
 .../engine/copy/nouveau_engine_copy_nva3.c    |  2 +-
 .../engine/crypt/nouveau_engine_crypt_nv84.c  |  2 +-
 .../engine/crypt/nouveau_engine_crypt_nv98.c  |  2 +-
 .../device/nouveau_engine_device_base.c       |  8 +++---
 .../dmaobj/nouveau_engine_dmaobj_base.c       |  2 +-
 .../engine/fifo/nouveau_engine_fifo_nv04.c    |  2 +-
 .../engine/fifo/nouveau_engine_fifo_nv10.c    |  2 +-
 .../engine/fifo/nouveau_engine_fifo_nv17.c    |  2 +-
 .../engine/fifo/nouveau_engine_fifo_nv40.c    |  2 +-
 .../engine/fifo/nouveau_engine_fifo_nv50.c    |  4 +--
 .../engine/fifo/nouveau_engine_fifo_nv84.c    |  4 +--
 .../engine/fifo/nouveau_engine_fifo_nvc0.c    |  6 ++--
 .../engine/fifo/nouveau_engine_fifo_nve0.c    |  6 ++--
 .../engine/graph/nouveau_engine_graph_nv50.c  |  6 ++--
 .../engine/graph/nouveau_engine_graph_nvc0.c  |  8 +++---
 .../core/engine/nouveau_engine_xtensa.c       |  2 +-
 .../drm/nouveau/core/include/core/device.h    |  6 ++--
 .../drm/nouveau/core/include/core/object.h    | 12 ++++----
 sys/dev/drm/nouveau/core/include/subdev/i2c.h | 14 +++++-----
 .../subdev/bios/nouveau_subdev_bios_base.c    |  4 +--
 .../subdev/bios/nouveau_subdev_bios_init.c    | 12 ++++----
 .../subdev/fb/nouveau_subdev_fb_ramgk20a.c    |  2 +-
 .../subdev/fb/nouveau_subdev_fb_ramnv1a.c     |  4 +--
 .../subdev/fb/nouveau_subdev_fb_ramnv40.c     |  2 +-
 .../subdev/i2c/nouveau_subdev_i2c_anx9805.c   |  8 +++---
 .../core/subdev/i2c/nouveau_subdev_i2c_aux.c  |  2 +-
 .../core/subdev/mxm/nouveau_subdev_mxm_base.c |  6 ++--
 .../core/subdev/mxm/nouveau_subdev_mxm_nv50.c |  2 +-
 .../core/subdev/vm/nouveau_subdev_vm_nv41.c   |  2 +-
 .../core/subdev/vm/nouveau_subdev_vm_nv44.c   |  2 +-
 .../nouveau/dispnv04/nouveau_dispnv04_crtc.c  |  8 ++----
 .../nouveau/dispnv04/nouveau_dispnv04_dac.c   |  4 +--
 .../nouveau/dispnv04/nouveau_dispnv04_dfp.c   |  4 +--
 .../nouveau/dispnv04/nouveau_dispnv04_disp.c  |  6 ++--
 .../dispnv04/nouveau_dispnv04_tvnv04.c        |  4 +--
 .../dispnv04/nouveau_dispnv04_tvnv17.c        |  4 +--
 sys/dev/drm/nouveau/nouveau_abi16.c           |  2 +-
 sys/dev/drm/nouveau/nouveau_connector.c       |  4 +--
 sys/dev/drm/nouveau/nouveau_display.c         |  4 +--
 sys/dev/drm/nouveau/nouveau_drm.c             |  2 +-
 sys/dev/drm/nouveau/nouveau_encoder.h         |  2 +-
 sys/dev/drm/nouveau/nouveau_gem.c             |  7 ++---
 sys/dev/drm/nouveau/nouveau_nv50_display.c    |  3 +-
 sys/dev/drm/nouveau/nouveau_ttm.c             |  4 +--
 50 files changed, 129 insertions(+), 147 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index 8531dd7536..b34307a0c7 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2435,20 +2435,20 @@ dev/drm/nouveau/core/subdev/gpio/nouveau_subdev_gpio_nv50.c		optional nouveau dr
 dev/drm/nouveau/core/subdev/gpio/nouveau_subdev_gpio_nv92.c		optional nouveau drm
 dev/drm/nouveau/core/subdev/gpio/nouveau_subdev_gpio_nvd0.c		optional nouveau drm
 dev/drm/nouveau/core/subdev/gpio/nouveau_subdev_gpio_nve0.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_anx9805.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_aux.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_base.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_bit.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_gf117.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nv04.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nv4e.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nv50.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nv94.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nvd0.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nve0.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_pad.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_padnv04.c		optional nouveau drm
-#dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_padnv94.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_anx9805.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_aux.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_base.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_bit.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_gf117.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nv04.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nv4e.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nv50.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nv94.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nvd0.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_nve0.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_pad.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_padnv04.c		optional nouveau drm
+dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_padnv94.c		optional nouveau drm
 dev/drm/nouveau/core/subdev/ibus/nouveau_subdev_ibus_gk20a.c		optional nouveau drm
 dev/drm/nouveau/core/subdev/ibus/nouveau_subdev_ibus_nvc0.c		optional nouveau drm
 dev/drm/nouveau/core/subdev/ibus/nouveau_subdev_ibus_nve0.c		optional nouveau drm
diff --git a/sys/dev/drm/include/asm/io.h b/sys/dev/drm/include/asm/io.h
index 379b26ead6..60fc3ef047 100644
--- a/sys/dev/drm/include/asm/io.h
+++ b/sys/dev/drm/include/asm/io.h
@@ -81,13 +81,6 @@ writeq(u64 value, volatile void __iomem *addr)
 		*(volatile uint32_t *)((char *)addr) = data;	\
 	} while (0)
 
-#undef writew
-static inline void
-writew(uint16_t b, void *addr)
-{
-        *(volatile uint16_t *)addr = b;
-}
-
 #include <linux/vmalloc.h>
 
 /* ioremap function family: map bus addresses into CPU space */
diff --git a/sys/dev/drm/include/linux/fb.h b/sys/dev/drm/include/linux/fb.h
index 80ed315dc6..3802ec42c9 100644
--- a/sys/dev/drm/include/linux/fb.h
+++ b/sys/dev/drm/include/linux/fb.h
@@ -38,15 +38,6 @@
 
 #define	KHZ2PICOS(a)	(1000000000UL/(a))
 
-struct fb_copyarea{
-};
-
-struct fb_fillrect {
-};
-
-struct fb_image {
-};
-
 extern int fb_get_options(const char *name, char **option);
 
 #define FBINFO_STATE_RUNNING	0
diff --git a/sys/dev/drm/nouveau/Makefile b/sys/dev/drm/nouveau/Makefile
index 8d8eba3537..5510ce3726 100644
--- a/sys/dev/drm/nouveau/Makefile
+++ b/sys/dev/drm/nouveau/Makefile
@@ -355,20 +355,20 @@ SRCS+=	\
 
 .PATH:	${.CURDIR}/core/subdev/i2c
 SRCS+=	\
-#	nouveau_subdev_i2c_anx9805.c \
-#	nouveau_subdev_i2c_aux.c \
-#	nouveau_subdev_i2c_base.c \
-#	nouveau_subdev_i2c_bit.c \
-#	nouveau_subdev_i2c_gf117.c \
-#	nouveau_subdev_i2c_nv04.c \
-#	nouveau_subdev_i2c_nv4e.c \
-#	nouveau_subdev_i2c_nv50.c \
-#	nouveau_subdev_i2c_nv94.c \
-#	nouveau_subdev_i2c_nvd0.c \
-#	nouveau_subdev_i2c_nve0.c \
-#	nouveau_subdev_i2c_pad.c \
-#	nouveau_subdev_i2c_padnv04.c \
-#	nouveau_subdev_i2c_padnv94.c
+	nouveau_subdev_i2c_anx9805.c \
+	nouveau_subdev_i2c_aux.c \
+	nouveau_subdev_i2c_base.c \
+	nouveau_subdev_i2c_bit.c \
+	nouveau_subdev_i2c_gf117.c \
+	nouveau_subdev_i2c_nv04.c \
+	nouveau_subdev_i2c_nv4e.c \
+	nouveau_subdev_i2c_nv50.c \
+	nouveau_subdev_i2c_nv94.c \
+	nouveau_subdev_i2c_nvd0.c \
+	nouveau_subdev_i2c_nve0.c \
+	nouveau_subdev_i2c_pad.c \
+	nouveau_subdev_i2c_padnv04.c \
+	nouveau_subdev_i2c_padnv94.c
 
 .PATH:	${.CURDIR}/core/subdev/ibus
 SRCS+=	\
diff --git a/sys/dev/drm/nouveau/core/core/nouveau_core_client.c b/sys/dev/drm/nouveau/core/core/nouveau_core_client.c
index 139adb3a2c..b54082fda6 100644
--- a/sys/dev/drm/nouveau/core/core/nouveau_core_client.c
+++ b/sys/dev/drm/nouveau/core/core/nouveau_core_client.c
@@ -116,7 +116,7 @@ nvkm_client_notify_new(struct nouveau_client *client,
 	nv_ioctl(client, "notify new size %d\n", size);
 	if (nvif_unpack(req->v0, 0, 0, true)) {
 		nv_ioctl(client, "notify new vers %d reply %d route %02x "
-				 "token %lx\n", req->v0.version,
+				 "token %llx\n", req->v0.version,
 			 req->v0.reply, req->v0.route, req->v0.token);
 		notify->version = req->v0.version;
 		notify->size = sizeof(notify->rep.v0);
diff --git a/sys/dev/drm/nouveau/core/core/nouveau_core_ioctl.c b/sys/dev/drm/nouveau/core/core/nouveau_core_ioctl.c
index 9a2409317f..f7e19bfb48 100644
--- a/sys/dev/drm/nouveau/core/core/nouveau_core_ioctl.c
+++ b/sys/dev/drm/nouveau/core/core/nouveau_core_ioctl.c
@@ -107,7 +107,7 @@ nvkm_ioctl_new(struct nouveau_handle *parent, void *data, u32 size)
 		return ret;
 
 	nv_ioctl(client, "new vers %d handle %08x class %08x "
-			 "route %02x token %lx\n",
+			 "route %02x token %llx\n",
 		args->v0.version, _handle, _oclass,
 		args->v0.route, args->v0.token);
 
@@ -234,7 +234,7 @@ nvkm_ioctl_rd(struct nouveau_handle *handle, void *data, u32 size)
 
 	nv_ioctl(object, "rd size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
-		nv_ioctl(object, "rd vers %d size %d addr %016lx\n",
+		nv_ioctl(object, "rd vers %d size %d addr %016llx\n",
 			args->v0.version, args->v0.size, args->v0.addr);
 		switch (args->v0.size) {
 		case 1:
@@ -276,7 +276,7 @@ nvkm_ioctl_wr(struct nouveau_handle *handle, void *data, u32 size)
 
 	nv_ioctl(object, "wr size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
-		nv_ioctl(object, "wr vers %d size %d addr %016lx data %08x\n",
+		nv_ioctl(object, "wr vers %d size %d addr %016llx data %08x\n",
 			 args->v0.version, args->v0.size, args->v0.addr,
 			 args->v0.data);
 		switch (args->v0.size) {
diff --git a/sys/dev/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c b/sys/dev/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c
index aa7d4fb0cd..abb410ef09 100644
--- a/sys/dev/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c
+++ b/sys/dev/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c
@@ -101,7 +101,7 @@ nva3_copy_intr(struct nouveau_subdev *subdev)
 	if (stat & 0x00000040) {
 		nv_error(falcon, "DISPATCH_ERROR [");
 		nouveau_enum_print(nva3_copy_isr_error_name, ssta);
-		pr_cont("] ch %d [0x%010lx %s] subc %d mthd 0x%04x data 0x%08x\n",
+		pr_cont("] ch %d [0x%010llx %s] subc %d mthd 0x%04x data 0x%08x\n",
 		       chid, inst << 12, nouveau_client_name(engctx), subc,
 		       mthd, data);
 		nv_wo32(falcon, 0x004, 0x00000040);
diff --git a/sys/dev/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c b/sys/dev/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c
index 0adb3ef56c..ea5c42f317 100644
--- a/sys/dev/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c
+++ b/sys/dev/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c
@@ -128,7 +128,7 @@ nv84_crypt_intr(struct nouveau_subdev *subdev)
 	if (stat) {
 		nv_error(priv, "%s", "");
 		nouveau_bitfield_print(nv84_crypt_intr_mask, stat);
-		pr_cont(" ch %d [0x%010lx %s] mthd 0x%04x data 0x%08x\n",
+		pr_cont(" ch %d [0x%010llx %s] mthd 0x%04x data 0x%08x\n",
 		       chid, (u64)inst << 12, nouveau_client_name(engctx),
 		       mthd, data);
 	}
diff --git a/sys/dev/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c b/sys/dev/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c
index d994d82b9a..5571c09534 100644
--- a/sys/dev/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c
+++ b/sys/dev/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c
@@ -102,7 +102,7 @@ nv98_crypt_intr(struct nouveau_subdev *subdev)
 	if (stat & 0x00000040) {
 		nv_error(priv, "DISPATCH_ERROR [");
 		nouveau_enum_print(nv98_crypt_isr_error_name, ssta);
-		pr_cont("] ch %d [0x%010lx %s] subc %d mthd 0x%04x data 0x%08x\n",
+		pr_cont("] ch %d [0x%010llx %s] subc %d mthd 0x%04x data 0x%08x\n",
 		       chid, (u64)inst << 12, nouveau_client_name(engctx),
 		       subc, mthd, data);
 		nv_wr32(priv, 0x087004, 0x00000040);
diff --git a/sys/dev/drm/nouveau/core/engine/device/nouveau_engine_device_base.c b/sys/dev/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
index f84aa8e540..7d7d8bc1d3 100644
--- a/sys/dev/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
+++ b/sys/dev/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
@@ -108,10 +108,10 @@ nouveau_devobj_info(struct nouveau_object *object, void *data, u32 size)
 		break;
 	default:
 		if (device->pdev) {
-			if (pci_find_extcap(device->pdev->dev, PCIY_AGP, NULL) == 0)
+			if (pci_find_extcap(device->pdev->dev.bsddev, PCIY_AGP, NULL) == 0)
 				args->v0.platform = NV_DEVICE_INFO_V0_AGP;
 			else
-			if (pci_find_extcap(device->pdev->dev, PCIY_EXPRESS, NULL) == 0)
+			if (pci_find_extcap(device->pdev->dev.bsddev, PCIY_EXPRESS, NULL) == 0)
 				args->v0.platform = NV_DEVICE_INFO_V0_PCIE;
 			else
 				args->v0.platform = NV_DEVICE_INFO_V0_PCI;
@@ -290,8 +290,8 @@ nouveau_devobj_ctor(struct nouveau_object *parent,
 
 	nv_ioctl(parent, "create device size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
-		nv_ioctl(parent, "create device v%d device %016lx "
-				 "disable %016lx debug0 %016lx\n",
+		nv_ioctl(parent, "create device v%d device %016llx "
+				 "disable %016llx debug0 %016llx\n",
 			 args->v0.version, args->v0.device,
 			 args->v0.disable, args->v0.debug0);
 	} else
diff --git a/sys/dev/drm/nouveau/core/engine/dmaobj/nouveau_engine_dmaobj_base.c b/sys/dev/drm/nouveau/core/engine/dmaobj/nouveau_engine_dmaobj_base.c
index 416773f8d8..e1500f77a5 100644
--- a/sys/dev/drm/nouveau/core/engine/dmaobj/nouveau_engine_dmaobj_base.c
+++ b/sys/dev/drm/nouveau/core/engine/dmaobj/nouveau_engine_dmaobj_base.c
@@ -80,7 +80,7 @@ nvkm_dmaobj_create_(struct nouveau_object *parent,
 	nv_ioctl(parent, "create dma size %d\n", *psize);
 	if (nvif_unpack(args->v0, 0, 0, true)) {
 		nv_ioctl(parent, "create dma vers %d target %d access %d "
-				 "start %016lx limit %016lx\n",
+				 "start %016llx limit %016llx\n",
 			 args->v0.version, args->v0.target, args->v0.access,
 			 args->v0.start, args->v0.limit);
 		dmaobj->target = args->v0.target;
diff --git a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv04.c b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv04.c
index a842b2a0d5..3878445910 100644
--- a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv04.c
+++ b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv04.c
@@ -128,7 +128,7 @@ nv04_fifo_chan_ctor(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel dma size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel dma vers %d pushbuf %08x "
-				 "offset %016lx\n", args->v0.version,
+				 "offset %016llx\n", args->v0.version,
 			 args->v0.pushbuf, args->v0.offset);
 	} else
 		return ret;
diff --git a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv10.c b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv10.c
index f9e1ce7f76..2a32add51c 100644
--- a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv10.c
+++ b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv10.c
@@ -70,7 +70,7 @@ nv10_fifo_chan_ctor(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel dma size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel dma vers %d pushbuf %08x "
-				 "offset %016lx\n", args->v0.version,
+				 "offset %016llx\n", args->v0.version,
 			 args->v0.pushbuf, args->v0.offset);
 	} else
 		return ret;
diff --git a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv17.c b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv17.c
index 340cd2c521..12d76c8adb 100644
--- a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv17.c
+++ b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv17.c
@@ -75,7 +75,7 @@ nv17_fifo_chan_ctor(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel dma size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel dma vers %d pushbuf %08x "
-				 "offset %016lx\n", args->v0.version,
+				 "offset %016llx\n", args->v0.version,
 			 args->v0.pushbuf, args->v0.offset);
 	} else
 		return ret;
diff --git a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c
index 4ab691a6a3..9f49c3a24d 100644
--- a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c
+++ b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c
@@ -193,7 +193,7 @@ nv40_fifo_chan_ctor(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel dma size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel dma vers %d pushbuf %08x "
-				 "offset %016lx\n", args->v0.version,
+				 "offset %016llx\n", args->v0.version,
 			 args->v0.pushbuf, args->v0.offset);
 	} else
 		return ret;
diff --git a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv50.c b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv50.c
index 359323f515..5d1e86bc24 100644
--- a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv50.c
+++ b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv50.c
@@ -206,7 +206,7 @@ nv50_fifo_chan_ctor_dma(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel dma size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel dma vers %d pushbuf %08x "
-				 "offset %016lx\n", args->v0.version,
+				 "offset %016llx\n", args->v0.version,
 			 args->v0.pushbuf, args->v0.offset);
 	} else
 		return ret;
@@ -269,7 +269,7 @@ nv50_fifo_chan_ctor_ind(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel gpfifo size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel gpfifo vers %d pushbuf %08x "
-				 "ioffset %016lx ilength %08x\n",
+				 "ioffset %016llx ilength %08x\n",
 			 args->v0.version, args->v0.pushbuf, args->v0.ioffset,
 			 args->v0.ilength);
 	} else
diff --git a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv84.c b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv84.c
index 061aa5f533..1f42996b35 100644
--- a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv84.c
+++ b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv84.c
@@ -172,7 +172,7 @@ nv84_fifo_chan_ctor_dma(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel dma size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel dma vers %d pushbuf %08x "
-				 "offset %016lx\n", args->v0.version,
+				 "offset %016llx\n", args->v0.version,
 			 args->v0.pushbuf, args->v0.offset);
 	} else
 		return ret;
@@ -244,7 +244,7 @@ nv84_fifo_chan_ctor_ind(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel gpfifo size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel gpfifo vers %d pushbuf %08x "
-				 "ioffset %016lx ilength %08x\n",
+				 "ioffset %016llx ilength %08x\n",
 			 args->v0.version, args->v0.pushbuf, args->v0.ioffset,
 			 args->v0.ilength);
 	} else
diff --git a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.c b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.c
index 8e1f73e971..285c58c3a7 100644
--- a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.c
+++ b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.c
@@ -201,7 +201,7 @@ nvc0_fifo_chan_ctor(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel gpfifo size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel gpfifo vers %d pushbuf %08x "
-				 "ioffset %016lx ilength %08x\n",
+				 "ioffset %016llx ilength %08x\n",
 			 args->v0.version, args->v0.pushbuf, args->v0.ioffset,
 			 args->v0.ilength);
 	} else
@@ -657,8 +657,8 @@ nvc0_fifo_intr_fault(struct nvc0_fifo_priv *priv, int unit)
 	if (!ec)
 		ksnprintf(ecunk, sizeof(ecunk), "UNK%02x", client);
 
-	nv_error(priv, "%s fault at 0x%010lx [%s] from %s/%s%s%s%s on "
-		       "channel 0x%010lx [%s]\n", write ? "write" : "read",
+	nv_error(priv, "%s fault at 0x%010llx [%s] from %s/%s%s%s%s on "
+		       "channel 0x%010llx [%s]\n", write ? "write" : "read",
 		 (u64)vahi << 32 | valo, er ? er->name : erunk,
 		 eu ? eu->name : euunk, hub ? "" : "GPC", gpcid, hub ? "" : "/",
 		 ec ? ec->name : ecunk, (u64)inst << 12,
diff --git a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c
index 076719264b..ab87e3b281 100644
--- a/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c
+++ b/sys/dev/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c
@@ -230,7 +230,7 @@ nve0_fifo_chan_ctor(struct nouveau_object *parent,
 	nv_ioctl(parent, "create channel gpfifo size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(parent, "create channel gpfifo vers %d pushbuf %08x "
-				 "ioffset %016lx ilength %08x engine %08x\n",
+				 "ioffset %016llx ilength %08x engine %08x\n",
 			 args->v0.version, args->v0.pushbuf, args->v0.ioffset,
 			 args->v0.ilength, args->v0.engine);
 	} else
@@ -772,8 +772,8 @@ nve0_fifo_intr_fault(struct nve0_fifo_priv *priv, int unit)
 	if (!ec)
 		ksnprintf(ecunk, sizeof(ecunk), "UNK%02x", client);
 
-	nv_error(priv, "%s fault at 0x%010lx [%s] from %s/%s%s%s%s on "
-		       "channel 0x%010lx [%s]\n", write ? "write" : "read",
+	nv_error(priv, "%s fault at 0x%010llx [%s] from %s/%s%s%s%s on "
+		       "channel 0x%010llx [%s]\n", write ? "write" : "read",
 		 (u64)vahi << 32 | valo, er ? er->name : erunk,
 		 eu ? eu->name : euunk, hub ? "" : "GPC", gpcid, hub ? "" : "/",
 		 ec ? ec->name : ecunk, (u64)inst << 12,
diff --git a/sys/dev/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c b/sys/dev/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c
index a815a925f6..31c9faac0a 100644
--- a/sys/dev/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c
+++ b/sys/dev/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c
@@ -615,7 +615,7 @@ nv50_graph_trap_handler(struct nv50_graph_priv *priv, u32 display,
 			nv_error(priv, "TRAP DISPATCH_FAULT\n");
 			if (display && (addr & 0x80000000)) {
 				nv_error(priv,
-					 "ch %d [0x%010lx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x%08x 400808 0x%08x 400848 0x%08x\n",
+					 "ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x%08x 400808 0x%08x 400848 0x%08x\n",
 					 chid, inst,
 					 nouveau_client_name(engctx), subc,
 					 class, mthd, datah, datal, addr, r848);
@@ -640,7 +640,7 @@ nv50_graph_trap_handler(struct nv50_graph_priv *priv, u32 display,
 			nv_error(priv, "TRAP DISPATCH_QUERY\n");
 			if (display && (addr & 0x80000000)) {
 				nv_error(priv,
-					 "ch %d [0x%010lx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x 40084c 0x%08x\n",
+					 "ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x 40084c 0x%08x\n",
 					 chid, inst,
 					 nouveau_client_name(engctx), subc,
 					 class, mthd, data, addr);
@@ -844,7 +844,7 @@ nv50_graph_intr(struct nouveau_subdev *subdev)
 			pr_cont("\n");
 		}
 		nv_error(priv,
-			 "ch %d [0x%010lx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
+			 "ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
 			 chid, (u64)inst << 12, nouveau_client_name(engctx),
 			 subc, class, mthd, data);
 	}
diff --git a/sys/dev/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c b/sys/dev/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c
index 95726443db..6144de3d73 100644
--- a/sys/dev/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c
+++ b/sys/dev/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c
@@ -1096,7 +1096,7 @@ nvc0_graph_intr(struct nouveau_subdev *subdev)
 		handle = nouveau_handle_get_class(engctx, class);
 		if (!handle || nv_call(handle->object, mthd, data)) {
 			nv_error(priv,
-				 "ILLEGAL_MTHD ch %d [0x%010lx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
+				 "ILLEGAL_MTHD ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
 				 chid, inst << 12, nouveau_client_name(engctx),
 				 subc, class, mthd, data);
 		}
@@ -1107,7 +1107,7 @@ nvc0_graph_intr(struct nouveau_subdev *subdev)
 
 	if (stat & 0x00000020) {
 		nv_error(priv,
-			 "ILLEGAL_CLASS ch %d [0x%010lx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
+			 "ILLEGAL_CLASS ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
 			 chid, inst << 12, nouveau_client_name(engctx), subc,
 			 class, mthd, data);
 		nv_wr32(priv, 0x400100, 0x00000020);
@@ -1117,7 +1117,7 @@ nvc0_graph_intr(struct nouveau_subdev *subdev)
 	if (stat & 0x00100000) {
 		nv_error(priv, "DATA_ERROR [");
 		nouveau_enum_print(nv50_data_error_names, code);
-		pr_cont("] ch %d [0x%010lx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
+		pr_cont("] ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
 			chid, inst << 12, nouveau_client_name(engctx), subc,
 			class, mthd, data);
 		nv_wr32(priv, 0x400100, 0x00100000);
@@ -1125,7 +1125,7 @@ nvc0_graph_intr(struct nouveau_subdev *subdev)
 	}
 
 	if (stat & 0x00200000) {
-		nv_error(priv, "TRAP ch %d [0x%010lx %s]\n", chid, inst << 12,
+		nv_error(priv, "TRAP ch %d [0x%010llx %s]\n", chid, inst << 12,
 			 nouveau_client_name(engctx));
 		nvc0_graph_trap_intr(priv);
 		nv_wr32(priv, 0x400100, 0x00200000);
diff --git a/sys/dev/drm/nouveau/core/engine/nouveau_engine_xtensa.c b/sys/dev/drm/nouveau/core/engine/nouveau_engine_xtensa.c
index da746210f7..23089ea8c3 100644
--- a/sys/dev/drm/nouveau/core/engine/nouveau_engine_xtensa.c
+++ b/sys/dev/drm/nouveau/core/engine/nouveau_engine_xtensa.c
@@ -131,7 +131,7 @@ _nouveau_xtensa_init(struct nouveau_object *object)
 			return ret;
 		}
 
-		nv_debug(xtensa, "Loading firmware to address: 0x%lx\n",
+		nv_debug(xtensa, "Loading firmware to address: 0x%llx\n",
 			 xtensa->gpu_fw->addr);
 
 		for (i = 0; i < fw->datasize / 4; i++)
diff --git a/sys/dev/drm/nouveau/core/include/core/device.h b/sys/dev/drm/nouveau/core/include/core/device.h
index 96b4ada11d..85e112bd9c 100644
--- a/sys/dev/drm/nouveau/core/include/core/device.h
+++ b/sys/dev/drm/nouveau/core/include/core/device.h
@@ -160,8 +160,10 @@ nv_device_is_pci(struct nouveau_device *device)
 static inline struct device *
 nv_device_base(struct nouveau_device *device)
 {
-	return nv_device_is_pci(device) ? device->pdev->dev :
-					  device->pdev->dev;
+	return nv_device_is_pci(device) ? &device->pdev->dev : NULL;
+#if 0
+					  &device->platformdev->dev;
+#endif
 }
 
 resource_size_t
diff --git a/sys/dev/drm/nouveau/core/include/core/object.h b/sys/dev/drm/nouveau/core/include/core/object.h
index c9dd0448a5..d7039482d6 100644
--- a/sys/dev/drm/nouveau/core/include/core/object.h
+++ b/sys/dev/drm/nouveau/core/include/core/object.h
@@ -140,7 +140,7 @@ static inline u8
 nv_ro08(void *obj, u64 addr)
 {
 	u8 data = nv_ofuncs(obj)->rd08(obj, addr);
-	nv_spam(obj, "nv_ro08 0x%08lx 0x%02x\n", addr, data);
+	nv_spam(obj, "nv_ro08 0x%08llx 0x%02x\n", addr, data);
 	return data;
 }
 
@@ -148,7 +148,7 @@ static inline u16
 nv_ro16(void *obj, u64 addr)
 {
 	u16 data = nv_ofuncs(obj)->rd16(obj, addr);
-	nv_spam(obj, "nv_ro16 0x%08lx 0x%04x\n", addr, data);
+	nv_spam(obj, "nv_ro16 0x%08llx 0x%04x\n", addr, data);
 	return data;
 }
 
@@ -156,28 +156,28 @@ static inline u32
 nv_ro32(void *obj, u64 addr)
 {
 	u32 data = nv_ofuncs(obj)->rd32(obj, addr);
-	nv_spam(obj, "nv_ro32 0x%08lx 0x%08x\n", addr, data);
+	nv_spam(obj, "nv_ro32 0x%08llx 0x%08x\n", addr, data);
 	return data;
 }
 
 static inline void
 nv_wo08(void *obj, u64 addr, u8 data)
 {
-	nv_spam(obj, "nv_wo08 0x%08lx 0x%02x\n", addr, data);
+	nv_spam(obj, "nv_wo08 0x%08llx 0x%02x\n", addr, data);
 	nv_ofuncs(obj)->wr08(obj, addr, data);
 }
 
 static inline void
 nv_wo16(void *obj, u64 addr, u16 data)
 {
-	nv_spam(obj, "nv_wo16 0x%08lx 0x%04x\n", addr, data);
+	nv_spam(obj, "nv_wo16 0x%08llx 0x%04x\n", addr, data);
 	nv_ofuncs(obj)->wr16(obj, addr, data);
 }
 
 static inline void
 nv_wo32(void *obj, u64 addr, u32 data)
 {
-	nv_spam(obj, "nv_wo32 0x%08lx 0x%08x\n", addr, data);
+	nv_spam(obj, "nv_wo32 0x%08llx 0x%08x\n", addr, data);
 	nv_ofuncs(obj)->wr32(obj, addr, data);
 }
 
diff --git a/sys/dev/drm/nouveau/core/include/subdev/i2c.h b/sys/dev/drm/nouveau/core/include/subdev/i2c.h
index 9a6ee28d59..11376201d1 100644
--- a/sys/dev/drm/nouveau/core/include/subdev/i2c.h
+++ b/sys/dev/drm/nouveau/core/include/subdev/i2c.h
@@ -95,12 +95,12 @@ nv_rdi2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg)
 {
 	u8 val;
 	struct i2c_msg msgs[] = {
-		{ .slave = addr << 1, .flags = 0, .len = 1, .buf = &reg },
-		{ .slave = addr << 1, .flags = I2C_M_RD, .len = 1, .buf = &val },
+		{ .addr = addr, .flags = 0, .len = 1, .buf = &reg },
+		{ .addr = addr, .flags = I2C_M_RD, .len = 1, .buf = &val },
 	};
 
-	int ret = iicbus_transfer(&port->adapter, msgs, 2);
-	if (ret != 0)
+	int ret = i2c_transfer(&port->adapter, msgs, 2);
+	if (ret != 2)
 		return -EIO;
 
 	return val;
@@ -111,11 +111,11 @@ nv_wri2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg, u8 val)
 {
 	u8 buf[2] = { reg, val };
 	struct i2c_msg msgs[] = {
-		{ .slave = addr << 1, .flags = 0, .len = 2, .buf = buf },
+		{ .addr = addr, .flags = 0, .len = 2, .buf = buf },
 	};
 
-	int ret = iicbus_transfer(&port->adapter, msgs, 1);
-	if (ret != 0)
+	int ret = i2c_transfer(&port->adapter, msgs, 1);
+	if (ret != 1)
 		return -EIO;
 
 	return 0;
diff --git a/sys/dev/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c b/sys/dev/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c
index 3950be55c1..28fce87e9e 100644
--- a/sys/dev/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c
+++ b/sys/dev/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c
@@ -265,7 +265,7 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios)
 	struct pci_dev *pdev = nv_device(bios)->pdev;
 	size_t size;
 
-	vga_dev = device_get_parent(pdev->dev);
+	vga_dev = device_get_parent(pdev->dev.bsddev);
 
 	if (!pci_enable_rom(pdev)) {
 		void __iomem *rom = vga_pci_map_bios(vga_dev, &size);
@@ -376,7 +376,7 @@ nouveau_bios_shadow(struct nouveau_bios *bios)
 		} while ((++mthd)->shadow);
 
 		/* attempt to load firmware image */
-		ret = request_firmware(&fw, source, nv_device(bios)->pdev->dev);
+		ret = request_firmware(&fw, source, &nv_device(bios)->pdev->dev);
 		if (ret == 0) {
 			bios->size = fw->datasize;
 			bios->data = kmemdup(fw->data, fw->datasize, GFP_KERNEL);
diff --git a/sys/dev/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_init.c b/sys/dev/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_init.c
index d92525a260..626380f9e4 100644
--- a/sys/dev/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_init.c
+++ b/sys/dev/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_init.c
@@ -1002,11 +1002,11 @@ init_zm_i2c(struct nvbios_init *init)
 	if (init_exec(init)) {
 		struct nouveau_i2c_port *port = init_i2c(init, index);
 		struct i2c_msg msg = {
-			.slave = addr << 1, .flags = 0, .len = count, .buf = data,
+			.addr = addr, .flags = 0, .len = count, .buf = data,
 		};
 		int ret;
 
-		if (port && (ret = iicbus_transfer(&port->adapter, &msg, 1)) != 0)
+		if (port && (ret = i2c_transfer(&port->adapter, &msg, 1)) != 1)
 			warn("i2c wr failed, %d\n", ret);
 	}
 }
@@ -2001,13 +2001,13 @@ init_i2c_long_if(struct nvbios_init *init)
 		u8 i[2] = { reghi, reglo };
 		u8 o[1] = {};
 		struct i2c_msg msg[] = {
-			{ .slave = addr << 1, .flags = 0, .len = 2, .buf = i },
-			{ .slave = addr << 1, .flags = I2C_M_RD, .len = 1, .buf = o }
+			{ .addr = addr, .flags = 0, .len = 2, .buf = i },
+			{ .addr = addr, .flags = I2C_M_RD, .len = 1, .buf = o }
 		};
 		int ret;
 
-		ret = iicbus_transfer(&port->adapter, msg, 2);
-		if (ret == 0 && ((o[0] & mask) == data))
+		ret = i2c_transfer(&port->adapter, msg, 2);
+		if (ret == 2 && ((o[0] & mask) == data))
 			return;
 	}
 
diff --git a/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramgk20a.c b/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramgk20a.c
index 6bc4865d60..4d77d75e46 100644
--- a/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramgk20a.c
+++ b/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramgk20a.c
@@ -59,7 +59,7 @@ gk20a_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
 	u32 npages, order;
 	int i;
 
-	nv_debug(pfb, "%s: size: %lx align: %x, ncmin: %x\n", __func__, size,
+	nv_debug(pfb, "%s: size: %llx align: %x, ncmin: %x\n", __func__, size,
 		 align, ncmin);
 
 	npages = size >> PAGE_SHIFT;
diff --git a/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramnv1a.c b/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramnv1a.c
index 8ad42a5022..215b99f51c 100644
--- a/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramnv1a.c
+++ b/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramnv1a.c
@@ -35,8 +35,8 @@ nv1a_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
 	u32 mem, mib;
 	int ret;
 
-	bridge.dev = pci_find_dbsf(0, 0, 0, 0);
-	if (!bridge.dev) {
+	bridge.dev.bsddev = pci_find_dbsf(0, 0, 0, 0);
+	if (!bridge.dev.bsddev) {
 		nv_fatal(pfb, "no bridge device\n");
 		return -ENODEV;
 	}
diff --git a/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramnv40.c b/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramnv40.c
index 7648beb111..9907559c37 100644
--- a/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramnv40.c
+++ b/sys/dev/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramnv40.c
@@ -74,7 +74,7 @@ nv40_ram_prog(struct nouveau_fb *pfb)
 	struct nv40_ram *ram = (void *)pfb->ram;
 	struct bit_entry M;
 	u32 crtc_mask = 0;
-	u8  sr1[2];
+	u8  sr1[2] = { 0, 0 };
 	int i;
 
 	/* determine which CRTCs are active, fetch VGA_SR1 for each */
diff --git a/sys/dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_anx9805.c b/sys/dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_anx9805.c
index cdbadc0a39..2c2731a6cf 100644
--- a/sys/dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_anx9805.c
+++ b/sys/dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_anx9805.c
@@ -184,8 +184,8 @@ anx9805_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 	mdelay(5);
 
 	while (cnt--) {
-		if ( (msg->flags & I2C_M_RD) && msg->slave == 0x50) {
-			nv_wri2cr(mast, port->addr, 0x40, msg->slave << 1);
+		if ( (msg->flags & I2C_M_RD) && msg->addr == 0x50) {
+			nv_wri2cr(mast, port->addr, 0x40, msg->addr << 1);
 			nv_wri2cr(mast, port->addr, 0x41, seg);
 			nv_wri2cr(mast, port->addr, 0x42, off);
 			nv_wri2cr(mast, port->addr, 0x44, msg->len);
@@ -202,10 +202,10 @@ anx9805_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 			}
 		} else
 		if (!(msg->flags & I2C_M_RD)) {
-			if (msg->slave == 0x50 && msg->len == 0x01) {
+			if (msg->addr == 0x50 && msg->len == 0x01) {
 				off = msg->buf[0];
 			} else
-			if (msg->slave == 0x30 && msg->len == 0x01) {
+			if (msg->addr == 0x30 && msg->len == 0x01) {
 				seg = msg->buf[0];
 			} else
 				goto done;
diff --git a/sys/dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_aux.c b/sys/dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_aux.c
index 3347ae5401..02eb42be2e 100644
--- a/sys/dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_aux.c
+++ b/sys/dev/drm/nouveau/core/subdev/i2c/nouveau_subdev_i2c_aux.c
@@ -85,7 +85,7 @@ aux_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 			if (mcnt || remaining > 16)
 				cmd |= 4; /* MOT */
 
-			ret = port->func->aux(port, true, cmd, msg->slave, ptr, cnt);
+			ret = port->func->aux(port, true, cmd, msg->addr, ptr, cnt);
 			if (ret < 0) {
 				i2c->release(port);
 				return ret;
diff --git a/sys/dev/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_base.c b/sys/dev/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_base.c
index 0289d30c2c..b263fd1a99 100644
--- a/sys/dev/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_base.c
+++ b/sys/dev/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_base.c
@@ -36,11 +36,11 @@ mxm_shadow_rom_fetch(struct nouveau_i2c_port *i2c, u8 addr,
 		     u8 offset, u8 size, u8 *data)
 {
 	struct i2c_msg msgs[] = {
-		{ .slave = addr << 1, .flags = 0, .len = 1, .buf = &offset },
-		{ .slave = addr << 1, .flags = I2C_M_RD, .len = size, .buf = data, },
+		{ .addr = addr, .flags = 0, .len = 1, .buf = &offset },
+		{ .addr = addr, .flags = I2C_M_RD, .len = size, .buf = data, },
 	};
 
-	return iicbus_transfer(&i2c->adapter, msgs, 2) == 0;
+	return i2c_transfer(&i2c->adapter, msgs, 2) == 2;
 }
 
 static bool
diff --git a/sys/dev/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_nv50.c b/sys/dev/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_nv50.c
index bf2519e78a..fcaabe8456 100644
--- a/sys/dev/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_nv50.c
+++ b/sys/dev/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_nv50.c
@@ -184,7 +184,7 @@ mxm_show_unmatched(struct nouveau_mxm *mxm, u8 *data, void *info)
 {
 	u64 desc = *(u64 *)data;
 	if ((desc & 0xf0) != 0xf0)
-	nv_info(mxm, "unmatched output device 0x%016lx\n", desc);
+	nv_info(mxm, "unmatched output device 0x%016llx\n", desc);
 	return true;
 }
 
diff --git a/sys/dev/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv41.c b/sys/dev/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv41.c
index 18578b4131..de34026ef1 100644
--- a/sys/dev/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv41.c
+++ b/sys/dev/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv41.c
@@ -92,7 +92,7 @@ nv41_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 	struct nv04_vmmgr_priv *priv;
 	int ret;
 
-	if (pci_find_extcap(device->pdev->dev, PCIY_AGP, NULL) == 0 ||
+	if (pci_find_extcap(device->pdev->dev.bsddev, PCIY_AGP, NULL) == 0 ||
 	    !nouveau_boolopt(device->cfgopt, "NvPCIE", true)) {
 		return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass,
 					   data, size, pobject);
diff --git a/sys/dev/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv44.c b/sys/dev/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv44.c
index 84c5643446..5fcfe79b88 100644
--- a/sys/dev/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv44.c
+++ b/sys/dev/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv44.c
@@ -164,7 +164,7 @@ nv44_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 	drm_dma_handle_t *dmah;
 	int ret;
 
-	if (pci_find_extcap(device->pdev->dev, PCIY_AGP, NULL) == 0 ||
+	if (pci_find_extcap(device->pdev->dev.bsddev, PCIY_AGP, NULL) == 0 ||
 	    !nouveau_boolopt(device->cfgopt, "NvPCIE", true)) {
 		return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass,
 					   data, size, pobject);
diff --git a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_crtc.c b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_crtc.c
index 0089856dc6..beff8b5b42 100644
--- a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_crtc.c
+++ b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_crtc.c
@@ -703,8 +703,7 @@ static void nv_crtc_prepare(struct drm_crtc *crtc)
 	struct drm_device *dev = crtc->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
-	struct drm_crtc_helper_funcs *funcs =
-	    __DECONST(void *, crtc->helper_private);
+	const struct drm_crtc_helper_funcs *funcs = crtc->helper_private;
 
 	if (nv_two_heads(dev))
 		NVSetOwner(dev, nv_crtc->index);
@@ -725,8 +724,7 @@ static void nv_crtc_prepare(struct drm_crtc *crtc)
 static void nv_crtc_commit(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_crtc_helper_funcs *funcs =
-	    __DECONST(void *, crtc->helper_private);
+	const struct drm_crtc_helper_funcs *funcs = crtc->helper_private;
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
 
 	nouveau_hw_load_state(dev, nv_crtc->index, &nv04_display(dev)->mode_reg);
@@ -1004,7 +1002,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 	if (width != 64 || height != 64)
 		return -EINVAL;
 
-	gem = drm_gem_object_lookup(dev, file_priv, buffer_handle);
+	gem = drm_gem_object_lookup(file_priv, buffer_handle);
 	if (!gem)
 		return -ENOENT;
 	cursor = nouveau_gem_object(gem);
diff --git a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_dac.c b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_dac.c
index 2d8056cde9..d33c7ca6c4 100644
--- a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_dac.c
+++ b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_dac.c
@@ -358,7 +358,7 @@ static bool nv04_dac_mode_fixup(struct drm_encoder *encoder,
 
 static void nv04_dac_prepare(struct drm_encoder *encoder)
 {
-	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
+	const struct drm_encoder_helper_funcs *helper = encoder->helper_private;
 	struct drm_device *dev = encoder->dev;
 	int head = nouveau_crtc(encoder->crtc)->index;
 
@@ -409,7 +409,7 @@ static void nv04_dac_commit(struct drm_encoder *encoder)
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
 	struct nouveau_drm *drm = nouveau_drm(encoder->dev);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
-	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
+	const struct drm_encoder_helper_funcs *helper = encoder->helper_private;
 
 	helper->dpms(encoder, DRM_MODE_DPMS_ON);
 
diff --git a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_dfp.c b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_dfp.c
index 42a5435259..da3e3d7daa 100644
--- a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_dfp.c
+++ b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_dfp.c
@@ -244,7 +244,7 @@ static void nv04_dfp_prepare_sel_clk(struct drm_device *dev,
 static void nv04_dfp_prepare(struct drm_encoder *encoder)
 {
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
-	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
+	const struct drm_encoder_helper_funcs *helper = encoder->helper_private;
 	struct drm_device *dev = encoder->dev;
 	int head = nouveau_crtc(encoder->crtc)->index;
 	struct nv04_crtc_reg *crtcstate = nv04_display(dev)->mode_reg.crtc_reg;
@@ -445,7 +445,7 @@ static void nv04_dfp_commit(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
+	const struct drm_encoder_helper_funcs *helper = encoder->helper_private;
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
 	struct dcb_output *dcbe = nv_encoder->dcb;
diff --git a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c
index 3d0afa1c6c..02746c4b6d 100644
--- a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c
+++ b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c
@@ -127,7 +127,7 @@ nv04_display_create(struct drm_device *dev)
 		crtc->funcs->save(crtc);
 
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
-		struct drm_encoder_helper_funcs *func = encoder->helper_private;
+		const struct drm_encoder_helper_funcs *func = encoder->helper_private;
 
 		func->save(encoder);
 	}
@@ -156,7 +156,7 @@ nv04_display_destroy(struct drm_device *dev)
 
 	/* Restore state */
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
-		struct drm_encoder_helper_funcs *func = encoder->helper_private;
+		const struct drm_encoder_helper_funcs *func = encoder->helper_private;
 
 		func->restore(encoder);
 	}
@@ -187,7 +187,7 @@ nv04_display_init(struct drm_device *dev)
 	 * on suspend too.
 	 */
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
-		struct drm_encoder_helper_funcs *func = encoder->helper_private;
+		const struct drm_encoder_helper_funcs *func = encoder->helper_private;
 
 		func->restore(encoder);
 	}
diff --git a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c
index 8061d8d0ce..aa49c13a53 100644
--- a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c
+++ b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c
@@ -122,7 +122,7 @@ static void nv04_tv_prepare(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
 	int head = nouveau_crtc(encoder->crtc)->index;
-	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
+	const struct drm_encoder_helper_funcs *helper = encoder->helper_private;
 
 	helper->dpms(encoder, DRM_MODE_DPMS_OFF);
 
@@ -164,7 +164,7 @@ static void nv04_tv_commit(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
-	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
+	const struct drm_encoder_helper_funcs *helper = encoder->helper_private;
 
 	helper->dpms(encoder, DRM_MODE_DPMS_ON);
 
diff --git a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c
index 72d2ab04db..03f56752bc 100644
--- a/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c
+++ b/sys/dev/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c
@@ -405,7 +405,7 @@ static void nv17_tv_prepare(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
+	const struct drm_encoder_helper_funcs *helper = encoder->helper_private;
 	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 	int head = nouveau_crtc(encoder->crtc)->index;
 	uint8_t *cr_lcd = &nv04_display(dev)->mode_reg.crtc_reg[head].CRTC[
@@ -583,7 +583,7 @@ static void nv17_tv_commit(struct drm_encoder *encoder)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
-	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
+	const struct drm_encoder_helper_funcs *helper = encoder->helper_private;
 
 	if (get_tv_norm(encoder)->kind == TV_ENC_MODE) {
 		nv17_tv_update_rescaler(encoder);
diff --git a/sys/dev/drm/nouveau/nouveau_abi16.c b/sys/dev/drm/nouveau/nouveau_abi16.c
index 1a27522ead..70e979db57 100644
--- a/sys/dev/drm/nouveau/nouveau_abi16.c
+++ b/sys/dev/drm/nouveau/nouveau_abi16.c
@@ -191,7 +191,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
 		if (drm_pci_device_is_agp(dev))
 			getparam->value = 0;
 		else
-		if (!pci_is_pcie(dev->dev))
+		if (!pci_is_pcie(dev->dev->bsddev))
 			getparam->value = 1;
 		else
 			getparam->value = 2;
diff --git a/sys/dev/drm/nouveau/nouveau_connector.c b/sys/dev/drm/nouveau/nouveau_connector.c
index e03c04fc45..061261ac5a 100644
--- a/sys/dev/drm/nouveau/nouveau_connector.c
+++ b/sys/dev/drm/nouveau/nouveau_connector.c
@@ -309,7 +309,7 @@ detect_analog:
 		nv_encoder = find_encoder(connector, DCB_OUTPUT_TV);
 	if (nv_encoder && force) {
 		struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
-		struct drm_encoder_helper_funcs *helper =
+		const struct drm_encoder_helper_funcs *helper =
 						encoder->helper_private;
 
 		if (helper->detect(encoder, connector) ==
@@ -575,7 +575,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
 static struct drm_display_mode *
 nouveau_connector_native_mode(struct drm_connector *connector)
 {
-	struct drm_connector_helper_funcs *helper = connector->helper_private;
+	const struct drm_connector_helper_funcs *helper = connector->helper_private;
 	struct nouveau_drm *drm = nouveau_drm(connector->dev);
 	struct nouveau_connector *nv_connector = nouveau_connector(connector);
 	struct drm_device *dev = connector->dev;
diff --git a/sys/dev/drm/nouveau/nouveau_display.c b/sys/dev/drm/nouveau/nouveau_display.c
index 678c6880f5..729bd34bea 100644
--- a/sys/dev/drm/nouveau/nouveau_display.c
+++ b/sys/dev/drm/nouveau/nouveau_display.c
@@ -275,7 +275,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
 	struct drm_gem_object *gem;
 	int ret = -ENOMEM;
 
-	gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]);
+	gem = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]);
 	if (!gem)
 		return ERR_PTR(-ENOENT);
 
@@ -876,7 +876,7 @@ nouveau_display_dumb_map_offset(struct drm_file *file_priv,
 {
 	struct drm_gem_object *gem;
 
-	gem = drm_gem_object_lookup(dev, file_priv, handle);
+	gem = drm_gem_object_lookup(file_priv, handle);
 	if (gem) {
 		struct nouveau_bo *bo = nouveau_gem_object(gem);
 		*poffset = bo->bo.addr_space_offset;
diff --git a/sys/dev/drm/nouveau/nouveau_drm.c b/sys/dev/drm/nouveau/nouveau_drm.c
index e4a584940f..eebacf8356 100644
--- a/sys/dev/drm/nouveau/nouveau_drm.c
+++ b/sys/dev/drm/nouveau/nouveau_drm.c
@@ -82,7 +82,7 @@ static struct drm_driver driver;
 static u64
 nouveau_pci_name(struct drm_device *ddev)
 {
-	u64 name = (u64)pci_get_domain(ddev->pdev->bus->self->dev) << 32;
+	u64 name = (u64)pci_get_domain(ddev->pdev->bus->self->dev.bsddev) << 32;
 	name |= ddev->pdev->bus->number << 16;
 	name |= ddev->pci_slot << 8;
 	return name | ddev->pci_func;
diff --git a/sys/dev/drm/nouveau/nouveau_encoder.h b/sys/dev/drm/nouveau/nouveau_encoder.h
index 5f0e37fc28..403bc56104 100644
--- a/sys/dev/drm/nouveau/nouveau_encoder.h
+++ b/sys/dev/drm/nouveau/nouveau_encoder.h
@@ -78,7 +78,7 @@ static inline struct drm_encoder *to_drm_encoder(struct nouveau_encoder *enc)
 	return &enc->base.base;
 }
 
-static inline struct drm_encoder_slave_funcs *
+static inline const struct drm_encoder_slave_funcs *
 get_slave_funcs(struct drm_encoder *enc)
 {
 	return to_encoder_slave(enc)->slave_funcs;
diff --git a/sys/dev/drm/nouveau/nouveau_gem.c b/sys/dev/drm/nouveau/nouveau_gem.c
index 1bd18731d1..07fb0a5552 100644
--- a/sys/dev/drm/nouveau/nouveau_gem.c
+++ b/sys/dev/drm/nouveau/nouveau_gem.c
@@ -344,7 +344,6 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
 	      int nr_buffers, struct validate_op *op)
 {
 	struct nouveau_cli *cli = nouveau_cli(file_priv);
-	struct drm_device *dev = chan->drm->dev;
 	int trycnt = 0;
 	int ret, i;
 	struct nouveau_bo *res_bo = NULL;
@@ -361,7 +360,7 @@ retry:
 		struct drm_gem_object *gem;
 		struct nouveau_bo *nvbo;
 
-		gem = drm_gem_object_lookup(dev, file_priv, b->handle);
+		gem = drm_gem_object_lookup(file_priv, b->handle);
 		if (!gem) {
 			NV_PRINTK(error, cli, "Unknown handle 0x%08x\n", b->handle);
 			ww_acquire_done(&op->ticket);
@@ -895,7 +894,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
 	bool no_wait = !!(req->flags & NOUVEAU_GEM_CPU_PREP_NOWAIT);
 	int ret = -EINVAL;
 
-	gem = drm_gem_object_lookup(dev, file_priv, req->handle);
+	gem = drm_gem_object_lookup(file_priv, req->handle);
 	if (!gem)
 		return -ENOENT;
 	nvbo = nouveau_gem_object(gem);
@@ -922,7 +921,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data,
 	struct drm_gem_object *gem;
 	int ret;
 
-	gem = drm_gem_object_lookup(dev, file_priv, req->handle);
+	gem = drm_gem_object_lookup(file_priv, req->handle);
 	if (!gem)
 		return -ENOENT;
 
diff --git a/sys/dev/drm/nouveau/nouveau_nv50_display.c b/sys/dev/drm/nouveau/nouveau_nv50_display.c
index c2f45360b6..b1a120dc1f 100644
--- a/sys/dev/drm/nouveau/nouveau_nv50_display.c
+++ b/sys/dev/drm/nouveau/nouveau_nv50_display.c
@@ -1224,7 +1224,6 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 		     uint32_t handle, uint32_t width, uint32_t height)
 {
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
-	struct drm_device *dev = crtc->dev;
 	struct drm_gem_object *gem;
 	struct nouveau_bo *nvbo;
 	bool visible = (handle != 0);
@@ -1234,7 +1233,7 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 		if (width != 64 || height != 64)
 			return -EINVAL;
 
-		gem = drm_gem_object_lookup(dev, file_priv, handle);
+		gem = drm_gem_object_lookup(file_priv, handle);
 		if (unlikely(!gem))
 			return -ENOENT;
 		nvbo = nouveau_gem_object(gem);
diff --git a/sys/dev/drm/nouveau/nouveau_ttm.c b/sys/dev/drm/nouveau/nouveau_ttm.c
index 059cbfa904..36e4b4d6ea 100644
--- a/sys/dev/drm/nouveau/nouveau_ttm.c
+++ b/sys/dev/drm/nouveau/nouveau_ttm.c
@@ -109,7 +109,7 @@ nouveau_vram_manager_debug(struct ttm_mem_type_manager *man, const char *prefix)
 
 	mutex_lock(&nv_subdev(pfb)->mutex);
 	list_for_each_entry(r, &mm->nodes, nl_entry) {
-		printk(KERN_DEBUG "%s %d: 0x%010lx 0x%010lx\n",
+		printk(KERN_DEBUG "%s %d: 0x%010llx 0x%010llx\n",
 		       prefix, r->type, ((u64)r->offset << 12),
 		       (((u64)r->offset + r->length) << 12));
 
@@ -119,7 +119,7 @@ nouveau_vram_manager_debug(struct ttm_mem_type_manager *man, const char *prefix)
 	}
 	mutex_unlock(&nv_subdev(pfb)->mutex);
 
-	printk(KERN_DEBUG "%s  total: 0x%010lx free: 0x%010lx\n",
+	printk(KERN_DEBUG "%s  total: 0x%010llx free: 0x%010llx\n",
 	       prefix, (u64)total << 12, (u64)free << 12);
 	printk(KERN_DEBUG "%s  block: 0x%08x\n",
 	       prefix, mm->block_size << 12);
-- 
2.23.0

