Module Name:    src
Committed By:   riastradh
Date:           Wed Aug  6 15:01:34 UTC 2014

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_bios.h nouveau_bo.c
            nouveau_connector.c nouveau_display.c nouveau_dma.c nouveau_drm.c
            nouveau_fbcon.h nouveau_gem.c
        src/sys/external/bsd/drm2/dist/drm/nouveau/core: os.h
        src/sys/external/bsd/drm2/dist/drm/nouveau/core/core:
            nouveau_core_printk.c nouveau_core_subdev.c
        src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device:
            nouveau_engine_device_base.c
        src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo:
            nouveau_engine_fifo_base.c
        src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core: device.h
            object.h
        src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine: fifo.h
        src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04:
            nouveau_dispnv04_arb.c nouveau_dispnv04_disp.c
            nouveau_dispnv04_hw.c nouveau_dispnv04_overlay.c
            nouveau_dispnv04_tvmodesnv17.c nouveau_dispnv04_tvnv04.c
            nouveau_dispnv04_tvnv17.c tvnv17.h
        src/sys/external/bsd/drm2/include/linux: i2c.h mutex.h
            platform_device.h
        src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
Whack some nouveau moles.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h
cvs rdiff -u -r1.3 -r1.4 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c \
    src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
    
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
    
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
cvs rdiff -u -r1.2 -r1.3 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c \
    src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c 
\
    src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c \
    
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c \
    
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c
 \
    
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c \
    
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c \
    src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/tvnv17.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/i2c.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/mutex.h
cvs rdiff -u -r1.3 -r1.4 \
    src/sys/external/bsd/drm2/include/linux/platform_device.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/nouveau/files.nouveau

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h:1.1.1.1	Wed Jul 16 19:35:26 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h	Wed Aug  6 15:01:33 2014
@@ -24,6 +24,8 @@
 #ifndef __NOUVEAU_DISPBIOS_H__
 #define __NOUVEAU_DISPBIOS_H__
 
+#include <asm/byteorder.h>
+
 #define DCB_MAX_NUM_ENTRIES 16
 #define DCB_MAX_NUM_I2C_ENTRIES 16
 #define DCB_MAX_NUM_GPIO_ENTRIES 32
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h:1.1.1.1	Wed Jul 16 19:35:26 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h	Wed Aug  6 15:01:33 2014
@@ -41,6 +41,7 @@ struct nouveau_fbdev {
 
 void nouveau_fbcon_restore(void);
 
+#ifndef __NetBSD__
 int nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region);
 int nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
 int nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image);
@@ -57,6 +58,7 @@ int nvc0_fbcon_imageblit(struct fb_info 
 int nvc0_fbcon_accel_init(struct fb_info *info);
 
 void nouveau_fbcon_gpu_lockup(struct fb_info *info);
+#endif
 
 int nouveau_fbcon_init(struct drm_device *dev);
 void nouveau_fbcon_fini(struct drm_device *dev);

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c:1.3	Wed Aug  6 13:54:10 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_bo.c,v 1.3 2014/08/06 13:54:10 riastradh Exp $	*/
+/*	$NetBSD: nouveau_bo.c,v 1.4 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright 2007 Dave Airlied
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.3 2014/08/06 13:54:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.4 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/engine.h>
 #include <linux/swiotlb.h>
@@ -146,7 +146,11 @@ nouveau_bo_del_ttm(struct ttm_buffer_obj
 	struct drm_device *dev = drm->dev;
 	struct nouveau_bo *nvbo = nouveau_bo(bo);
 
+#ifdef __NetBSD__
+	if (unlikely(nvbo->gem.gemo_shm_uao))
+#else
 	if (unlikely(nvbo->gem.filp))
+#endif
 		DRM_ERROR("bo %p still attached to GEM object\n", bo);
 	WARN_ON(nvbo->pin_refcnt > 0);
 	nv10_bo_put_tile_region(dev, nvbo->tile, NULL);
@@ -428,6 +432,7 @@ nouveau_bo_validate(struct nouveau_bo *n
  */
 
 #  define	__iomem			volatile
+#  define	__force
 #  define	ioread16_native		fake_ioread16_native
 #  define	ioread32_native		fake_ioread32_native
 #  define	iowrite16_native	fake_iowrite16_native
@@ -455,20 +460,20 @@ ioread32_native(const void __iomem *ptr)
 	return htole32(v);
 }
 
-static inline uint16_t
-iowrite16_native(uint16_t v, const void __iomem *ptr)
+static inline void
+iowrite16_native(uint16_t v, void __iomem *ptr)
 {
 
 	membar_producer();
-	*(const uint16_t __iomem *)ptr = le16toh(v);
+	*(uint16_t __iomem *)ptr = le16toh(v);
 }
 
-static inline uint32_t
-iowrite32_native(uint32_t v, const void __iomem *ptr)
+static inline void
+iowrite32_native(uint32_t v, void __iomem *ptr)
 {
 
 	membar_producer();
-	*(const uint32_t __iomem *)ptr = le32toh(v);
+	*(uint32_t __iomem *)ptr = le32toh(v);
 }
 #endif
 
@@ -522,6 +527,7 @@ nouveau_bo_wr32(struct nouveau_bo *nvbo,
 
 #ifdef __NetBSD__
 #  undef	__iomem
+#  undef	__force
 #  undef	ioread16_native
 #  undef	ioread32_native
 #  undef	iowrite16_native
@@ -1395,12 +1401,16 @@ static int
 nouveau_ttm_tt_populate(struct ttm_tt *ttm)
 {
 	struct ttm_dma_tt *ttm_dma = (void *)ttm;
+#ifndef __NetBSD__
 	struct nouveau_drm *drm;
 	struct nouveau_device *device;
 	struct drm_device *dev;
 	unsigned i;
 	int r;
+#endif
+#ifndef __NetBSD__		/* XXX drm prime */
 	bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
+#endif
 
 	if (ttm->state != tt_unpopulated)
 		return 0;
@@ -1415,9 +1425,11 @@ nouveau_ttm_tt_populate(struct ttm_tt *t
 	}
 #endif
 
+#ifndef __NetBSD__
 	drm = nouveau_bdev(ttm->bdev);
 	device = nv_device(drm->device);
 	dev = drm->dev;
+#endif
 
 #if __OS_HAS_AGP
 	if (drm->agp.stat == ENABLED) {
@@ -1460,10 +1472,10 @@ static void
 nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
 {
 	struct ttm_dma_tt *ttm_dma = (void *)ttm;
+#ifndef __NetBSD__
 	struct nouveau_drm *drm;
 	struct nouveau_device *device;
 	struct drm_device *dev;
-#ifndef __NetBSD__
 	unsigned i;
 #endif
 	bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
@@ -1471,9 +1483,11 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt 
 	if (slave)
 		return;
 
+#ifndef __NetBSD__
 	drm = nouveau_bdev(ttm->bdev);
 	device = nv_device(drm->device);
 	dev = drm->dev;
+#endif
 
 #if __OS_HAS_AGP
 	if (drm->agp.stat == ENABLED) {

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c:1.1.1.2	Wed Aug  6 12:36:23 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_connector.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $	*/
+/*	$NetBSD: nouveau_connector.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2008 Maarten Maathuis.
@@ -27,11 +27,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_connector.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_connector.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <acpi/button.h>
 
+#include <linux/err.h>
 #include <linux/pm_runtime.h>
+#include <linux/string.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_edid.h>
@@ -54,9 +56,12 @@ MODULE_PARM_DESC(tv_disable, "Disable TV
 static int nouveau_tv_disable = 0;
 module_param_named(tv_disable, nouveau_tv_disable, int, 0400);
 
+#if defined(CONFIG_ACPI_BUTTON) || \
+	(defined(CONFIG_ACPI_BUTTON_MODULE) && defined(MODULE))
 MODULE_PARM_DESC(ignorelid, "Ignore ACPI lid status");
 static int nouveau_ignorelid = 0;
 module_param_named(ignorelid, nouveau_ignorelid, int, 0400);
+#endif
 
 MODULE_PARM_DESC(duallink, "Allow dual-link TMDS (default: enabled)");
 static int nouveau_duallink = 1;
@@ -1052,7 +1057,6 @@ nouveau_connector_create(struct drm_devi
 	 * figure out something suitable ourselves
 	 */
 	if (nv_connector->type == DCB_CONNECTOR_NONE) {
-		struct nouveau_drm *drm = nouveau_drm(dev);
 		struct dcb_table *dcbt = &drm->vbios.dcb;
 		u32 encoders = 0;
 		int i;
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c:1.1.1.2	Wed Aug  6 12:36:23 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_display.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $	*/
+/*	$NetBSD: nouveau_display.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2008 Maarten Maathuis.
@@ -27,7 +27,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_display.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_display.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
+
+#include <linux/err.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
@@ -87,7 +89,7 @@ calc(int blanks, int blanke, int total, 
 	return line;
 }
 
-int
+static int
 nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
 				ktime_t *stime, ktime_t *etime)
 {
@@ -332,7 +334,7 @@ static const struct drm_mode_config_func
 struct nouveau_drm_prop_enum_list {
 	u8 gen_mask;
 	int type;
-	char *name;
+	const char *name;
 };
 
 static struct nouveau_drm_prop_enum_list underscan[] = {
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c:1.1.1.2	Wed Aug  6 12:36:23 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_dma.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $	*/
+/*	$NetBSD: nouveau_dma.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2007 Ben Skeggs.
@@ -27,13 +27,18 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dma.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dma.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/client.h>
 
 #include "nouveau_drm.h"
 #include "nouveau_dma.h"
 
+#ifdef __NetBSD__
+#  define	__iomem
+#  define	__force
+#endif
+
 void
 OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned nr_dwords)
 {
@@ -47,6 +52,11 @@ OUT_RINGp(struct nouveau_channel *chan, 
 	chan->dma.cur += nr_dwords;
 }
 
+#ifdef __NetBSD__
+#  undef	__force
+#  undef	__iomem
+#endif
+
 /* Fetch and adjust GPU GET pointer
  *
  * Returns:
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.1.1.2	Wed Aug  6 12:36:23 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_drm.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $	*/
+/*	$NetBSD: nouveau_drm.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <linux/console.h>
 #include <linux/module.h>
@@ -128,7 +128,11 @@ nouveau_cli_create(u64 name, const char 
 		return ret;
 	}
 
+#ifdef __NetBSD__
+	linux_mutex_init(&cli->mutex);
+#else
 	mutex_init(&cli->mutex);
+#endif
 	return 0;
 }
 
@@ -136,6 +140,11 @@ static void
 nouveau_cli_destroy(struct nouveau_cli *cli)
 {
 	struct nouveau_object *client = nv_object(cli);
+#ifdef __NetBSD__
+	linux_mutex_destroy(&cli->mutex);
+#else
+	mutex_destroy(&cli->mutex);
+#endif
 	nouveau_vm_ref(NULL, &cli->base.vm, NULL);
 	nouveau_client_fini(&cli->base, false);
 	atomic_set(&client->refcount, 1);
@@ -267,6 +276,7 @@ nouveau_accel_init(struct nouveau_drm *d
 	nouveau_bo_move_init(drm);
 }
 
+#ifndef __NetBSD__
 static int nouveau_drm_probe(struct pci_dev *pdev,
 			     const struct pci_device_id *pent)
 {
@@ -318,6 +328,7 @@ static int nouveau_drm_probe(struct pci_
 
 	return 0;
 }
+#endif
 
 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403
 
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.1.1.2	Wed Aug  6 12:36:23 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_gem.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $	*/
+/*	$NetBSD: nouveau_gem.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2008 Ben Skeggs.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_gem.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_gem.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <subdev/fb.h>
 
@@ -51,7 +51,12 @@ nouveau_gem_object_del(struct drm_gem_ob
 	drm_gem_object_release(gem);
 
 	/* reset filp so nouveau_bo_del_ttm() can test for it */
+#ifdef __NetBSD__
+	/* XXX Whattakludge!  */
+	gem->gemo_shm_uao = NULL;
+#else
 	gem->filp = NULL;
+#endif
 	ttm_bo_unref(&bo);
 }
 
@@ -189,7 +194,9 @@ nouveau_gem_new(struct drm_device *dev, 
 		return -ENOMEM;
 	}
 
+#ifndef __NetBSD__		/* XXX Let TTM swap; skip GEM like radeon.  */
 	nvbo->bo.persistent_swap_storage = nvbo->gem.filp;
+#endif
 	return 0;
 }
 

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h:1.2	Wed Aug  6 13:35:13 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h	Wed Aug  6 15:01:33 2014
@@ -30,6 +30,7 @@
 
 #include <asm/unaligned.h>
 
+#ifndef __NetBSD__		/* XXX ioread */
 #ifndef ioread32_native
 #ifdef __BIG_ENDIAN
 #define ioread16_native ioread16be
@@ -43,5 +44,6 @@
 #define iowrite32_native iowrite32
 #endif /* def __BIG_ENDIAN else */
 #endif /* !ioread32_native */
+#endif
 
 #endif

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c:1.1.1.1	Wed Aug  6 12:36:24 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_core_printk.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $	*/
+/*	$NetBSD: nouveau_core_printk.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_core_printk.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_core_printk.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/client.h>
@@ -67,7 +67,8 @@ nv_printk_(struct nouveau_object *object
 	if (object && !nv_iclass(object, NV_CLIENT_CLASS)) {
 		struct nouveau_object *device = object;
 		struct nouveau_object *subdev = object;
-		char obuf[64], *ofmt = "";
+		char obuf[64];
+		const char *ofmt = "";
 
 		if (object->engine) {
 			snprintf(obuf, sizeof(obuf), "[0x%08x][%p]",
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c:1.1.1.1	Wed Aug  6 12:36:24 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_core_subdev.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $	*/
+/*	$NetBSD: nouveau_core_subdev.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_core_subdev.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_core_subdev.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/subdev.h>
@@ -110,7 +110,13 @@ nouveau_subdev_create_(struct nouveau_ob
 	if (parent) {
 		struct nouveau_device *device = nv_device(parent);
 		subdev->debug = nouveau_dbgopt(device->dbgopt, subname);
+#ifdef __NetBSD__
+		subdev->mmiot = nv_subdev(device)->mmiot;
+		subdev->mmioh = nv_subdev(device)->mmioh;
+		subdev->mmiosz = nv_subdev(device)->mmiosz;
+#else
 		subdev->mmio  = nv_subdev(device)->mmio;
+#endif
 	}
 
 	return 0;

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.1.1.1	Wed Aug  6 12:36:24 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_engine_device_base.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $	*/
+/*	$NetBSD: nouveau_engine_device_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/device.h>
@@ -453,6 +453,24 @@ nouveau_device_dtor(struct nouveau_objec
 	nouveau_engine_destroy(&device->base);
 }
 
+#ifdef __NetBSD__
+bus_space_tag_t
+nv_device_resource_tag(struct nouveau_device *device, unsigned int bar)
+{
+	if (nv_device_is_pci(device)) {
+		const struct pci_attach_args *const pa = &device->pdev->pd_pa;
+		if (PCI_MAPREG_TYPE(pci_mapreg_type(pa->pa_pc, pa->pa_tag,
+			    PCI_BAR(bar))) == PCI_MAPREG_TYPE_MEM)
+			return pa->pa_memt;
+		else
+			return pa->pa_iot;
+	} else {
+		/* XXX nouveau platform device */
+		panic("can't handle non-PCI nouveau devices");
+	}
+}
+#endif
+
 resource_size_t
 nv_device_resource_start(struct nouveau_device *device, unsigned int bar)
 {

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c:1.1.1.1	Wed Aug  6 12:36:24 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_engine_fifo_base.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $	*/
+/*	$NetBSD: nouveau_engine_fifo_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/client.h>
 #include <core/object.h>
@@ -91,10 +91,19 @@ nouveau_fifo_channel_create_(struct nouv
 	}
 
 	/* map fifo control registers */
+#ifdef __NetBSD__
+	/* XXX errno NetBSD->Linux */
+	chan->bst = nv_device_resource_tag(device, bar)
+	ret = -bus_space_map(chan->bst, nv_device_resource_start(device, bar),
+	    (addr + (chan->chid * size)), 0, size, &chan->bsh);
+	if (ret)
+		return ret;
+#else
 	chan->user = ioremap(nv_device_resource_start(device, bar) + addr +
 			     (chan->chid * size), size);
 	if (!chan->user)
 		return -EFAULT;
+#endif
 
 	nouveau_event_trigger(priv->cevent, 0);
 
@@ -108,7 +117,11 @@ nouveau_fifo_channel_destroy(struct nouv
 	struct nouveau_fifo *priv = (void *)nv_object(chan)->engine;
 	unsigned long flags;
 
+#ifdef __NetBSD__
+	bus_space_unmap(chan->bst, chan->bsh, chan->size);
+#else
 	iounmap(chan->user);
+#endif
 
 	spin_lock_irqsave(&priv->lock, flags);
 	priv->channel[chan->chid] = NULL;

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.1.1.1	Thu Jul 17 01:50:59 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h	Wed Aug  6 15:01:33 2014
@@ -156,6 +156,11 @@ nv_device_base(struct nouveau_device *de
 					  &device->platformdev->dev;
 }
 
+#ifdef __NetBSD__
+bus_space_tag_t
+nv_device_resource_tag(struct nouveau_device *device, unsigned int bar);
+#endif
+
 resource_size_t
 nv_device_resource_start(struct nouveau_device *device, unsigned int bar);
 

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h:1.2	Wed Aug  6 13:35:13 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h	Wed Aug  6 15:01:33 2014
@@ -41,7 +41,7 @@ nv_object(void *obj)
 }
 
 #ifdef __NetBSD__
-void	nouveau_objcets_init(void);
+void	nouveau_objects_init(void);
 void	nouveau_objects_fini(void);
 #endif
 

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h:1.1.1.1	Thu Jul 17 01:50:59 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h	Wed Aug  6 15:01:33 2014
@@ -9,7 +9,12 @@ struct nouveau_fifo_chan {
 	struct nouveau_namedb base;
 	struct nouveau_dmaobj *pushdma;
 	struct nouveau_gpuobj *pushgpu;
+#ifdef __NetBSD__
+	bus_space_tag_t bst;
+	bus_space_handle_t bsh;
+#else
 	void __iomem *user;
+#endif
 	u32 size;
 	u16 chid;
 	atomic_t refcnt; /* NV04_NVSW_SET_REF */

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c:1.1.1.1	Wed Aug  6 12:36:32 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c	Wed Aug  6 15:01:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_dispnv04_arb.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_dispnv04_arb.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $	*/
 
 /*
  * Copyright 1993-2003 NVIDIA, Corporation
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_arb.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_arb.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
 
 #include <drm/drmP.h>
 
@@ -60,8 +60,8 @@ struct nv_sim_state {
 static void
 nv04_calc_arb(struct nv_fifo_info *fifo, struct nv_sim_state *arb)
 {
-	int pagemiss, cas, width, bpp;
-	int nvclks, mclks, pclks, crtpagemiss;
+	int pagemiss, cas, bpp;
+	int nvclks, mclks, crtpagemiss;
 	int found, mclk_extra, mclk_loop, cbs, m1, p1;
 	int mclk_freq, pclk_freq, nvclk_freq;
 	int us_m, us_n, us_p, crtc_drain_rate;
@@ -72,11 +72,9 @@ nv04_calc_arb(struct nv_fifo_info *fifo,
 	nvclk_freq = arb->nvclk_khz;
 	pagemiss = arb->mem_page_miss;
 	cas = arb->mem_latency;
-	width = arb->memory_width >> 6;
 	bpp = arb->bpp;
 	cbs = 128;
 
-	pclks = 2;
 	nvclks = 10;
 	mclks = 13 + cas;
 	mclk_extra = 3;
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c:1.1.1.1	Wed Aug  6 12:36:32 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c	Wed Aug  6 15:01:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_dispnv04_disp.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_dispnv04_disp.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $	*/
 
 /*
  * Copyright 2009 Red Hat Inc.
@@ -25,7 +25,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_disp.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_disp.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
+
+#include <linux/err.h>
 
 #include <core/object.h>
 #include <core/class.h>
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c:1.1.1.1	Wed Aug  6 12:36:32 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c	Wed Aug  6 15:01:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_dispnv04_hw.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_dispnv04_hw.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $	*/
 
 /*
  * Copyright 2006 Dave Airlie
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_hw.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_hw.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include "nouveau_drm.h"
@@ -290,7 +290,12 @@ nouveau_hw_fix_bad_vpll(struct drm_devic
  */
 
 static void nouveau_vga_font_io(struct drm_device *dev,
+#ifdef __NetBSD__
+				bus_space_tag_t iovramt,
+				bus_space_handle_t iovramh,
+#else
 				void __iomem *iovram,
+#endif
 				bool save, unsigned plane)
 {
 	unsigned i;
@@ -299,11 +304,21 @@ static void nouveau_vga_font_io(struct d
 	NVWriteVgaGr(dev, 0, NV_VIO_GX_READ_MAP_INDEX, plane);
 	for (i = 0; i < 16384; i++) {
 		if (save) {
+#ifdef __NetBSD__
+			nv04_display(dev)->saved_vga_font[plane][i] =
+			    bus_space_read_stream_4(iovramt, iovramh, i * 4);
+#else
 			nv04_display(dev)->saved_vga_font[plane][i] =
 					ioread32_native(iovram + i * 4);
+#endif
 		} else {
+#ifdef __NetBSD__
+			bus_space_write_stream_4(iovramt, iovramh, i * 4,
+			    nv04_display(dev)->saved_vga_font[plane][i]);
+#else
 			iowrite32_native(nv04_display(dev)->saved_vga_font[plane][i],
 							iovram + i * 4);
+#endif
 		}
 	}
 }
@@ -315,7 +330,13 @@ nouveau_hw_save_vga_fonts(struct drm_dev
 	uint8_t misc, gr4, gr5, gr6, seq2, seq4;
 	bool graphicsmode;
 	unsigned plane;
+#ifdef __NetBSD__
+	bus_space_tag_t iovramt;
+	bus_space_handle_t iovramh;
+	bus_size_t iovramsz;
+#else
 	void __iomem *iovram;
+#endif
 
 	if (nv_two_heads(dev))
 		NVSetOwner(dev, 0);
@@ -330,12 +351,23 @@ nouveau_hw_save_vga_fonts(struct drm_dev
 	NV_INFO(drm, "%sing VGA fonts\n", save ? "Sav" : "Restor");
 
 	/* map first 64KiB of VRAM, holds VGA fonts etc */
+#ifdef __NetBSD__
+	if (pci_mapreg_map(&dev->pdev->pd_pa, PCI_BAR(1),
+		pci_mapreg_type(dev->pdev->pd_pa.pa_pc,
+		    dev->pdev->pd_pa.pa_tag, PCI_BAR(1)),
+		0, &iovramt, &iovramh, NULL, &iovramsz)) {
+		NV_ERROR(drm, "Failed to map VRAM, "
+					"cannot save/restore VGA fonts.\n");
+		return;
+	}
+#else
 	iovram = ioremap(pci_resource_start(dev->pdev, 1), 65536);
 	if (!iovram) {
 		NV_ERROR(drm, "Failed to map VRAM, "
 					"cannot save/restore VGA fonts.\n");
 		return;
 	}
+#endif
 
 	if (nv_two_heads(dev))
 		NVBlankScreen(dev, 1, true);
@@ -356,7 +388,11 @@ nouveau_hw_save_vga_fonts(struct drm_dev
 
 	/* store font in planes 0..3 */
 	for (plane = 0; plane < 4; plane++)
+#ifdef __NetBSD__
+		nouveau_vga_font_io(dev, iovramt, iovramh, save, plane);
+#else
 		nouveau_vga_font_io(dev, iovram, save, plane);
+#endif
 
 	/* restore control regs */
 	NVWritePRMVIO(dev, 0, NV_PRMVIO_MISC__WRITE, misc);
@@ -370,7 +406,11 @@ nouveau_hw_save_vga_fonts(struct drm_dev
 		NVBlankScreen(dev, 1, false);
 	NVBlankScreen(dev, 0, false);
 
+#ifdef __NetBSD__
+	bus_space_unmap(iovramt, iovramh, iovramsz);
+#else
 	iounmap(iovram);
+#endif
 }
 
 /*
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c:1.1.1.1	Wed Aug  6 12:36:32 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c	Wed Aug  6 15:01:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_dispnv04_overlay.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_dispnv04_overlay.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $	*/
 
 /*
  * Copyright 2013 Ilia Mirkin
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_overlay.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_overlay.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_disp
 #include "nouveau_display.h"
 #include "nvreg.h"
 
+#include "dispnv04/disp.h"
 
 struct nouveau_plane {
 	struct drm_plane base;
@@ -64,7 +65,7 @@ struct nouveau_plane {
 	void (*set_params)(struct nouveau_plane *);
 };
 
-static uint32_t formats[] = {
+static const uint32_t formats[] = {
 	DRM_FORMAT_YUYV,
 	DRM_FORMAT_UYVY,
 	DRM_FORMAT_NV12,
@@ -117,7 +118,11 @@ nv10_update_plane(struct drm_plane *plan
 	src_w >>= 16;
 	src_h >>= 16;
 
+#ifdef __NetBSD__		/* XXX ALIGN means something else.  */
+	format = round_up(src_w * 4, 0x100);
+#else
 	format = ALIGN(src_w * 4, 0x100);
+#endif
 
 	if (format > 0xffff)
 		return -ERANGE;
@@ -362,7 +367,11 @@ nv04_update_plane(struct drm_plane *plan
 	src_w >>= 16;
 	src_h >>= 16;
 
+#ifdef __NetBSD__		/* XXX ALIGN means something else.  */
+	pitch = round_up(src_w * 4, 0x100);
+#else
 	pitch = ALIGN(src_w * 4, 0x100);
+#endif
 
 	if (pitch > 0xffff)
 		return -ERANGE;
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c:1.1.1.1	Wed Aug  6 12:36:32 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c	Wed Aug  6 15:01:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_dispnv04_tvmodesnv17.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_dispnv04_tvmodesnv17.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2009 Francisco Jerez.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvmodesnv17.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvmodesnv17.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
@@ -37,7 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_disp
 #include "hw.h"
 #include "tvnv17.h"
 
-char *nv17_tv_norm_names[NUM_TV_NORMS] = {
+const char *nv17_tv_norm_names[NUM_TV_NORMS] = {
 	[TV_NORM_PAL] = "PAL",
 	[TV_NORM_PAL_M] = "PAL-M",
 	[TV_NORM_PAL_N] = "PAL-N",
@@ -54,7 +54,7 @@ char *nv17_tv_norm_names[NUM_TV_NORMS] =
 
 /* TV standard specific parameters */
 
-struct nv17_tv_norm_params nv17_tv_norms[NUM_TV_NORMS] = {
+const struct nv17_tv_norm_params nv17_tv_norms[NUM_TV_NORMS] = {
 	[TV_NORM_PAL] = { TV_ENC_MODE, {
 			.tv_enc_mode = { 720, 576, 50000, {
 					0x2a, 0x9, 0x8a, 0xcb, 0x0, 0x0, 0xb, 0x18,
@@ -321,7 +321,7 @@ static struct filter_params{
 static void tv_setup_filter(struct drm_encoder *encoder)
 {
 	struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder);
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 	struct drm_display_mode *mode = &encoder->crtc->mode;
 	uint32_t (*filters[])[4][7] = {&tv_enc->state.hfilter,
 				       &tv_enc->state.vfilter};
@@ -479,7 +479,7 @@ void nv17_tv_update_properties(struct dr
 	struct drm_device *dev = encoder->dev;
 	struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder);
 	struct nv17_tv_state *regs = &tv_enc->state;
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 	int subconnector = tv_enc->select_subconnector ?
 						tv_enc->select_subconnector :
 						tv_enc->subconnector;
@@ -552,7 +552,7 @@ void nv17_ctv_update_rescaler(struct drm
 	int head = nouveau_crtc(encoder->crtc)->index;
 	struct nv04_crtc_reg *regs = &nv04_display(dev)->mode_reg.crtc_reg[head];
 	struct drm_display_mode *crtc_mode = &encoder->crtc->mode;
-	struct drm_display_mode *output_mode =
+	const struct drm_display_mode *output_mode =
 		&get_tv_norm(encoder)->ctv_enc_mode.mode;
 	int overscan, hmargin, vmargin, hratio, vratio;
 
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c:1.1.1.1	Wed Aug  6 12:36:32 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c	Wed Aug  6 15:01:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_dispnv04_tvnv04.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_dispnv04_tvnv04.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2009 Francisco Jerez.
@@ -27,7 +27,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvnv04.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvnv04.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
+
+#include <linux/err.h>
 
 #include <drm/drmP.h>
 #include "nouveau_drm.h"
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c:1.1.1.1	Wed Aug  6 12:36:32 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c	Wed Aug  6 15:01:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_dispnv04_tvnv17.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_dispnv04_tvnv17.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2009 Francisco Jerez.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvnv17.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvnv17.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
@@ -218,7 +218,7 @@ nv17_tv_detect(struct drm_encoder *encod
 static int nv17_tv_get_ld_modes(struct drm_encoder *encoder,
 				struct drm_connector *connector)
 {
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 	const struct drm_display_mode *tv_mode;
 	int n = 0;
 
@@ -248,8 +248,8 @@ static int nv17_tv_get_ld_modes(struct d
 static int nv17_tv_get_hd_modes(struct drm_encoder *encoder,
 				struct drm_connector *connector)
 {
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
-	struct drm_display_mode *output_mode = &tv_norm->ctv_enc_mode.mode;
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct drm_display_mode *output_mode = &tv_norm->ctv_enc_mode.mode;
 	struct drm_display_mode *mode;
 	const struct {
 		int hdisplay;
@@ -310,7 +310,7 @@ static int nv17_tv_get_hd_modes(struct d
 static int nv17_tv_get_modes(struct drm_encoder *encoder,
 			     struct drm_connector *connector)
 {
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 
 	if (tv_norm->kind == CTV_ENC_MODE)
 		return nv17_tv_get_hd_modes(encoder, connector);
@@ -321,7 +321,7 @@ static int nv17_tv_get_modes(struct drm_
 static int nv17_tv_mode_valid(struct drm_encoder *encoder,
 			      struct drm_display_mode *mode)
 {
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 
 	if (tv_norm->kind == CTV_ENC_MODE) {
 		struct drm_display_mode *output_mode =
@@ -363,7 +363,7 @@ static bool nv17_tv_mode_fixup(struct dr
 			       const struct drm_display_mode *mode,
 			       struct drm_display_mode *adjusted_mode)
 {
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 
 	if (nv04_dac_in_use(encoder))
 		return false;
@@ -382,7 +382,7 @@ static void  nv17_tv_dpms(struct drm_enc
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nouveau_gpio *gpio = nouveau_gpio(drm->device);
 	struct nv17_tv_state *regs = &to_tv_enc(encoder)->state;
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 
 	if (nouveau_encoder(encoder)->last_dpms == mode)
 		return;
@@ -416,7 +416,7 @@ static void nv17_tv_prepare(struct drm_e
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct drm_encoder_helper_funcs *helper = encoder->helper_private;
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const 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[
 							NV_CIO_CRE_LCD__INDEX];
@@ -481,7 +481,7 @@ static void nv17_tv_mode_set(struct drm_
 	int head = nouveau_crtc(encoder->crtc)->index;
 	struct nv04_crtc_reg *regs = &nv04_display(dev)->mode_reg.crtc_reg[head];
 	struct nv17_tv_state *tv_regs = &to_tv_enc(encoder)->state;
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 	int i;
 
 	regs->CRTC[NV_CIO_CRE_53] = 0x40; /* FP_HTIMING */
@@ -710,7 +710,7 @@ static int nv17_tv_set_property(struct d
 	struct drm_mode_config *conf = &encoder->dev->mode_config;
 	struct drm_crtc *crtc = encoder->crtc;
 	struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder);
-	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
+	const struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 	bool modes_changed = false;
 
 	if (property == conf->tv_overscan_property) {
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/tvnv17.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/tvnv17.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/tvnv17.h:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/tvnv17.h:1.1.1.1	Wed Jul 16 19:35:26 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/tvnv17.h	Wed Aug  6 15:01:34 2014
@@ -85,9 +85,9 @@ struct nv17_tv_encoder {
 #define to_tv_enc(x) container_of(nouveau_encoder(x),		\
 				  struct nv17_tv_encoder, base)
 
-extern char *nv17_tv_norm_names[NUM_TV_NORMS];
+extern const char *nv17_tv_norm_names[NUM_TV_NORMS];
 
-extern struct nv17_tv_norm_params {
+extern const struct nv17_tv_norm_params {
 	enum {
 		TV_ENC_MODE,
 		CTV_ENC_MODE,

Index: src/sys/external/bsd/drm2/include/linux/i2c.h
diff -u src/sys/external/bsd/drm2/include/linux/i2c.h:1.4 src/sys/external/bsd/drm2/include/linux/i2c.h:1.5
--- src/sys/external/bsd/drm2/include/linux/i2c.h:1.4	Wed Aug  6 13:51:37 2014
+++ src/sys/external/bsd/drm2/include/linux/i2c.h	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.h,v 1.4 2014/08/06 13:51:37 riastradh Exp $	*/
+/*	$NetBSD: i2c.h,v 1.5 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -49,6 +49,7 @@ struct i2c_msg;
 struct i2c_board_info {
 	char			type[I2C_NAME_SIZE];
 	uint16_t		addr;
+	void			*platform_data;
 };
 
 static inline void

Index: src/sys/external/bsd/drm2/include/linux/mutex.h
diff -u src/sys/external/bsd/drm2/include/linux/mutex.h:1.5 src/sys/external/bsd/drm2/include/linux/mutex.h:1.6
--- src/sys/external/bsd/drm2/include/linux/mutex.h:1.5	Wed Aug  6 13:51:49 2014
+++ src/sys/external/bsd/drm2/include/linux/mutex.h	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.5 2014/08/06 13:51:49 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.6 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -106,4 +106,12 @@ mutex_lock_nest_lock(struct mutex *mutex
 
 #define	lockdep_assert_held(m)	do {} while (0)
 
+#define	SINGLE_DEPTH_NESTING	0
+
+static inline void
+mutex_lock_nested(struct mutex *mutex, unsigned subclass __unused)
+{
+	mutex_lock(mutex);
+}
+
 #endif  /* _LINUX_MUTEX_H_ */

Index: src/sys/external/bsd/drm2/include/linux/platform_device.h
diff -u src/sys/external/bsd/drm2/include/linux/platform_device.h:1.3 src/sys/external/bsd/drm2/include/linux/platform_device.h:1.4
--- src/sys/external/bsd/drm2/include/linux/platform_device.h:1.3	Wed Aug  6 13:52:22 2014
+++ src/sys/external/bsd/drm2/include/linux/platform_device.h	Wed Aug  6 15:01:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: platform_device.h,v 1.3 2014/08/06 13:52:22 riastradh Exp $	*/
+/*	$NetBSD: platform_device.h,v 1.4 2014/08/06 15:01:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 
 struct platform_device {
 	struct device	dev;	/* XXX DON'T BELIEVE ME */
+	uint64_t	id;
 };
 
 #endif  /* _LINUX_PLATFORM_DEVICE_H_ */

Index: src/sys/external/bsd/drm2/nouveau/files.nouveau
diff -u src/sys/external/bsd/drm2/nouveau/files.nouveau:1.1 src/sys/external/bsd/drm2/nouveau/files.nouveau:1.2
--- src/sys/external/bsd/drm2/nouveau/files.nouveau:1.1	Wed Aug  6 13:36:07 2014
+++ src/sys/external/bsd/drm2/nouveau/files.nouveau	Wed Aug  6 15:01:34 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.nouveau,v 1.1 2014/08/06 13:36:07 riastradh Exp $
+#	$NetBSD: files.nouveau,v 1.2 2014/08/06 15:01:34 riastradh Exp $
 
 device	nouveau: drmkms, drmkms_pci, drmkms_ttm, genfb, wsemuldisplaydev
 attach	nouveau at pci
@@ -11,8 +11,24 @@ makeoptions	nouveau	CPPFLAGS+="-I$S/exte
 makeoptions	nouveau	CPPFLAGS+="-DCONFIG_NOUVEAU_DEBUG=1000"
 makeoptions	nouveau	CPPFLAGS+="-DCONFIG_NOUVEAU_DEBUG_DEFAULT=6"
 
+makeoptions	nouveau	"CWARNFLAGS.nouveau_agp.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_bios.c"+="-Wno-shadow"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_bo.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_connector.c"+="-Wno-missing-field-initializers"
 makeoptions	nouveau	"CWARNFLAGS.nouveau_core_client.c"+="-Wno-missing-field-initializers"
 makeoptions	nouveau	"CWARNFLAGS.nouveau_core_gpuobj.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_core_ramht.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_display.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_dispnv04_dfp.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_dispnv04_tvnv04.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_engine_bsp_nv84.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_engine_bsp_nv98.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_dispnv04_tvmodesnv17.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_engine_bsp_nvc0.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_engine_bsp_nve0.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_engine_copy_nva3.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_engine_copy_nvc0.c"+="-Wno-missing-field-initializers"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_engine_copy_nve0.c"+="-Wno-missing-field-initializers"
 
 file	external/bsd/drm2/nouveau/nouveau_module.c	nouveau
 

Reply via email to