Module Name: src Committed By: riastradh Date: Sat Aug 23 08:03:34 UTC 2014
Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_bo.c nouveau_drm.c nouveau_drm.h nouveau_fence.c nouveau_gem.c nouveau_nv10_fence.c nouveau_nv50_display.c src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine: nouveau_engine_xtensa.c src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy: nouveau_engine_copy_nva3.c src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt: nouveau_engine_crypt_nv84.c nouveau_engine_crypt_nv98.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/disp: nouveau_engine_disp_dacnv50.c nouveau_engine_disp_nv04.c nouveau_engine_disp_nv50.c nouveau_engine_disp_nvd0.c nv50.h src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo: nouveau_engine_fifo_base.c nouveau_engine_fifo_nvc0.c nouveau_engine_fifo_nve0.c nve0.h src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph: nouveau_engine_graph_ctxnvd7.c nouveau_engine_graph_gm107.c nouveau_engine_graph_nv50.c nouveau_engine_graph_nvc0.c src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/perfmon: nouveau_engine_perfmon_base.c src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core: device.h src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine: device.h src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev: bar.h fb.h pwr.h src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar: nouveau_subdev_bar_base.c src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem: nouveau_subdev_instmem_nv04.c nouveau_subdev_instmem_nv40.c nv04.h src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr: nouveau_subdev_pwr_base.c src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04: nouveau_dispnv04_tvmodesnv17.c nouveau_dispnv04_tvnv17.c src/sys/external/bsd/drm2/include/drm: drm_agp_netbsd.h src/sys/external/bsd/drm2/include/linux: bitops.h i2c.h mutex.h pagemap.h pm_runtime.h spinlock.h vmalloc.h src/sys/external/bsd/drm2/nouveau: files.nouveau nouveau_module.c Log Message: Another round of nouveau whack-a-mole. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/nouveau_engine_xtensa.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c cvs rdiff -u -r1.2 -r1.3 \ 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/disp/nouveau_engine_disp_dacnv50.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv04.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv50.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nv50.h cvs rdiff -u -r1.2 -r1.3 \ 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/engine/fifo/nouveau_engine_fifo_nvc0.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nve0.h cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxnvd7.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gm107.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/perfmon/nouveau_engine_perfmon_base.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/device.h cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/bar.h cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/fb.h \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv04.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nv04.h cvs rdiff -u -r1.1.1.1 -r1.2 \ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c \ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/drm/drm_agp_netbsd.h cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/bitops.h cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/i2c.h cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/mutex.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/pagemap.h \ src/sys/external/bsd/drm2/include/linux/pm_runtime.h cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/spinlock.h \ src/sys/external/bsd/drm2/include/linux/vmalloc.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/nouveau/files.nouveau cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/nouveau/nouveau_module.c 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_bo.c diff -u 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.5 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c:1.4 Wed Aug 6 15:01:33 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_bo.c,v 1.4 2014/08/06 15:01:33 riastradh Exp $ */ +/* $NetBSD: nouveau_bo.c,v 1.5 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2007 Dave Airlied @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.4 2014/08/06 15:01:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.5 2014/08/23 08:03:33 riastradh Exp $"); #include <core/engine.h> #include <linux/swiotlb.h> @@ -1401,8 +1401,10 @@ static int nouveau_ttm_tt_populate(struct ttm_tt *ttm) { struct ttm_dma_tt *ttm_dma = (void *)ttm; -#ifndef __NetBSD__ +#if defined(__OS_HAS_AGP) || !defined(__NetBSD__) struct nouveau_drm *drm; +#endif +#ifndef __NetBSD__ struct nouveau_device *device; struct drm_device *dev; unsigned i; @@ -1425,8 +1427,10 @@ nouveau_ttm_tt_populate(struct ttm_tt *t } #endif -#ifndef __NetBSD__ +#if defined(__OS_HAS_AGP) || !defined(__NetBSD__) drm = nouveau_bdev(ttm->bdev); +#endif +#ifndef __NetBSD__ device = nv_device(drm->device); dev = drm->dev; #endif @@ -1472,8 +1476,10 @@ static void nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm) { struct ttm_dma_tt *ttm_dma = (void *)ttm; -#ifndef __NetBSD__ +#if defined(__OS_HAS_AGP) || !defined(__NetBSD__) struct nouveau_drm *drm; +#endif +#ifndef __NetBSD__ struct nouveau_device *device; struct drm_device *dev; unsigned i; @@ -1483,8 +1489,10 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt if (slave) return; -#ifndef __NetBSD__ +#if defined(__OS_HAS_AGP) || !defined(__NetBSD__) drm = nouveau_bdev(ttm->bdev); +#endif +#ifndef __NetBSD__ device = nv_device(drm->device); dev = drm->dev; #endif 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.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.2 Wed Aug 6 15:01:33 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_drm.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $ */ +/* $NetBSD: nouveau_drm.c,v 1.3 2014/08/23 08:03: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.2 2014/08/06 15:01:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $"); #include <linux/console.h> #include <linux/module.h> @@ -85,12 +85,20 @@ int nouveau_runtime_pm = -1; module_param_named(runpm, nouveau_runtime_pm, int, 0400); static struct drm_driver driver; +#ifdef __NetBSD__ +struct drm_driver *const nouveau_drm_driver = &driver; +#endif static u64 nouveau_pci_name(struct pci_dev *pdev) { +#ifdef __NetBSD__ + u64 name = (u64)device_unit(device_parent(pdev->pd_dev)) << 32; + name |= (u64)pdev->pd_pa.pa_bus << 16; +#else u64 name = (u64)pci_domain_nr(pdev->bus) << 32; name |= pdev->bus->number << 16; +#endif name |= PCI_SLOT(pdev->devfn) << 8; return name | PCI_FUNC(pdev->devfn); } @@ -335,6 +343,7 @@ static int nouveau_drm_probe(struct pci_ static void nouveau_get_hdmi_dev(struct nouveau_drm *drm) { +#ifndef __NetBSD__ /* XXX nouveau hdmi */ struct pci_dev *pdev = drm->dev->pdev; if (!pdev) { @@ -358,6 +367,7 @@ nouveau_get_hdmi_dev(struct nouveau_drm drm->hdmi_device = NULL; return; } +#endif } static int @@ -504,12 +514,15 @@ nouveau_drm_unload(struct drm_device *de nouveau_agp_fini(drm); nouveau_vga_fini(drm); +#ifndef __NetBSD__ /* XXX nouveau hdmi */ if (drm->hdmi_device) pci_dev_put(drm->hdmi_device); +#endif nouveau_cli_destroy(&drm->client); return 0; } +#ifndef __NetBSD__ /* XXX nouveau detach */ static void nouveau_drm_remove(struct pci_dev *pdev) { @@ -524,7 +537,9 @@ nouveau_drm_remove(struct pci_dev *pdev) nouveau_object_ref(NULL, &device); nouveau_object_debug(); } +#endif +#ifndef __NetBSD__ /* XXX nouveau pm */ static int nouveau_do_suspend(struct drm_device *dev, bool runtime) { @@ -706,14 +721,18 @@ static int nouveau_pmops_thaw(struct dev nouveau_display_resume(drm_dev); return 0; } - +#endif /* XXX nouveau pm */ static int nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) { struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_cli *cli; +#ifdef __NetBSD__ + const char name[] = "user"; +#else char name[32], tmpname[TASK_COMM_LEN]; +#endif int ret; /* need to bring up power immediately if opening device */ @@ -721,8 +740,10 @@ nouveau_drm_open(struct drm_device *dev, if (ret < 0 && ret != -EACCES) return ret; +#ifndef __NetBSD__ get_task_comm(tmpname, current); snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid)); +#endif ret = nouveau_cli_create(nouveau_name(dev), name, sizeof(*cli), (void **)&cli); @@ -794,6 +815,7 @@ nouveau_ioctls[] = { DRM_IOCTL_DEF_DRV(NOUVEAU_GEM_INFO, nouveau_gem_ioctl_info, DRM_UNLOCKED|DRM_AUTH|DRM_RENDER_ALLOW), }; +#ifndef __NetBSD__ /* XXX nouveau pm */ long nouveau_drm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { @@ -826,6 +848,7 @@ nouveau_driver_fops = { #endif .llseek = noop_llseek, }; +#endif static struct drm_driver driver = { @@ -853,8 +876,11 @@ driver = { .ioctls = nouveau_ioctls, .num_ioctls = ARRAY_SIZE(nouveau_ioctls), +#ifndef __NetBSD__ .fops = &nouveau_driver_fops, +#endif +#ifndef __NetBSD__ /* XXX drm prime */ .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_export = drm_gem_prime_export, @@ -865,6 +891,7 @@ driver = { .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table, .gem_prime_vmap = nouveau_gem_prime_vmap, .gem_prime_vunmap = nouveau_gem_prime_vunmap, +#endif .gem_free_object = nouveau_gem_object_del, .gem_open_object = nouveau_gem_object_open, @@ -886,6 +913,7 @@ driver = { .patchlevel = DRIVER_PATCHLEVEL, }; +#ifndef __NetBSD__ static struct pci_device_id nouveau_drm_pci_table[] = { { @@ -900,7 +928,9 @@ nouveau_drm_pci_table[] = { }, {} }; +#endif +#ifndef __NetBSD__ /* XXX nouveau pm */ static int nouveau_pmops_runtime_suspend(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); @@ -977,6 +1007,7 @@ static int nouveau_pmops_runtime_idle(st return -EBUSY; } +#ifndef __NetBSD__ /* XXX nouveau hdmi */ /* if we have a hdmi audio device - make sure it has a driver loaded */ if (drm->hdmi_device) { if (!drm->hdmi_device->driver) { @@ -985,6 +1016,7 @@ static int nouveau_pmops_runtime_idle(st return -EBUSY; } } +#endif list_for_each_entry(crtc, &drm->dev->mode_config.crtc_list, head) { if (crtc->enabled) { @@ -1009,7 +1041,9 @@ static const struct dev_pm_ops nouveau_p .runtime_resume = nouveau_pmops_runtime_resume, .runtime_idle = nouveau_pmops_runtime_idle, }; +#endif /* XXX nouveau pm */ +#ifndef __NetBSD__ static struct pci_driver nouveau_drm_pci_driver = { .name = "nouveau", @@ -1064,6 +1098,7 @@ nouveau_drm_exit(void) drm_pci_exit(&driver, &nouveau_drm_pci_driver); nouveau_unregister_dsm_handler(); } +#endif module_init(nouveau_drm_init); module_exit(nouveau_drm_exit); Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.2 Wed Aug 6 13:35:13 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_fence.c,v 1.2 2014/08/06 13:35:13 riastradh Exp $ */ +/* $NetBSD: nouveau_fence.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright (C) 2007 Ben Skeggs. @@ -27,10 +27,11 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.2 2014/08/06 13:35:13 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $"); #include <drm/drmP.h> +#include <asm/param.h> #include <linux/ktime.h> #include <linux/hrtimer.h> @@ -210,12 +211,12 @@ nouveau_fence_wait_uevent(struct nouveau #ifdef __NetBSD__ spin_lock(&priv->waitlock); if (intr) { - DRM_SPIN_TIMED_WAIT_UNITL(ret, + DRM_SPIN_TIMED_WAIT_UNTIL(ret, &priv->waitqueue, &priv->waitlock, timeout, nouveau_fence_done(fence)); } else { - DRM_SPIN_TIMED_WAIT_NOINTR_UNITL(ret, + DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret, &priv->waitqueue, &priv->waitlock, timeout, nouveau_fence_done(fence)); @@ -275,8 +276,10 @@ nouveau_fence_wait(struct nouveau_fence { struct nouveau_channel *chan = fence->channel; struct nouveau_fence_priv *priv = chan ? chan->drm->fence : NULL; +#ifndef __NetBSD__ unsigned long sleep_time = NSEC_PER_MSEC / 1000; ktime_t t; +#endif int ret = 0; while (priv && priv->uevent && lazy && !nouveau_fence_done(fence)) { 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.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.2 Wed Aug 6 15:01:33 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_gem.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $ */ +/* $NetBSD: nouveau_gem.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright (C) 2008 Ben Skeggs. @@ -27,10 +27,12 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_gem.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_gem.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $"); #include <subdev/fb.h> +#include <linux/err.h> /* XXX */ + #include "nouveau_drm.h" #include "nouveau_dma.h" #include "nouveau_fence.h" @@ -45,8 +47,10 @@ nouveau_gem_object_del(struct drm_gem_ob struct nouveau_bo *nvbo = nouveau_gem_object(gem); struct ttm_buffer_object *bo = &nvbo->bo; +#ifndef __NetBSD__ /* XXX drm prime */ if (gem->import_attach) drm_prime_gem_destroy(gem, nvbo->bo.sg); +#endif drm_gem_object_release(gem); @@ -459,6 +463,10 @@ validate_sync(struct nouveau_channel *ch return ret; } +#ifdef __NetBSD__ /* XXX yargleblargh */ +# define __force +#endif + static int validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli, struct list_head *list, struct drm_nouveau_gem_pushbuf_bo *pbbo, Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h:1.1.1.1 Wed Jul 16 19:35:26 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h Sat Aug 23 08:03:33 2014 @@ -139,7 +139,9 @@ struct nouveau_drm { bool have_disp_power_ref; struct dev_pm_domain vga_pm_domain; +#ifndef __NetBSD__ /* XXX nouveau hdmi */ struct pci_dev *hdmi_device; +#endif }; static inline struct nouveau_drm * Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c:1.1.1.1 Wed Aug 6 12:36:23 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_nv10_fence.c,v 1.1.1.1 2014/08/06 12:36:23 riastradh Exp $ */ +/* $NetBSD: nouveau_nv10_fence.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_nv10_fence.c,v 1.1.1.1 2014/08/06 12:36:23 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_nv10_fence.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/object.h> #include <core/class.h> @@ -70,7 +70,7 @@ nv10_fence_context_del(struct nouveau_ch kfree(fctx); } -int +static int nv10_fence_context_new(struct nouveau_channel *chan) { struct nv10_fence_chan *fctx; Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.1.1.1 Wed Aug 6 12:36:23 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_nv50_display.c,v 1.1.1.1 2014/08/06 12:36:23 riastradh Exp $ */ +/* $NetBSD: nouveau_nv50_display.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2011 Red Hat Inc. @@ -25,9 +25,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.1.1.1 2014/08/06 12:36:23 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <linux/dma-mapping.h> +#include <linux/err.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> @@ -132,6 +133,11 @@ nv50_pioc_create(struct nouveau_object * struct nv50_dmac { struct nv50_chan base; +#ifdef __NetBSD__ + bus_dma_segment_t dmaseg; + bus_dmamap_t dmamap; + void *dmakva; +#endif dma_addr_t handle; u32 *ptr; @@ -145,10 +151,25 @@ static void nv50_dmac_destroy(struct nouveau_object *core, struct nv50_dmac *dmac) { if (dmac->ptr) { +#ifdef __NetBSD__ + const bus_dma_tag_t dmat = nv_device(core)->dmat; + + bus_dmamem_unload(dmat, dmac->dmamap); + bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE); + bus_dmamap_destroy(dmat, dmac->dmamap); + bus_dmamem_free(dmat, &dmac->dmaseg, 1); + dmac->handle = 0; + dmac->ptr = NULL; +#else struct pci_dev *pdev = nv_device(core)->pdev; pci_free_consistent(pdev, PAGE_SIZE, dmac->ptr, dmac->handle); +#endif } +#ifdef __NetBSD__ + linux_mutex_destroy(&dmac->lock); +#endif + nv50_chan_destroy(core, &dmac->base); } @@ -282,12 +303,56 @@ nv50_dmac_create(struct nouveau_object * u32 pushbuf = *(u32 *)data; int ret; +#ifdef __NetBSD__ + linux_mutex_init(&dmac->lock); +#else mutex_init(&dmac->lock); +#endif + +#ifdef __NetBSD__ + { + const bus_dma_tag_t dmat = nv_device(core)->dmat; + int rsegs; + + /* XXX errno NetBSD->Linux */ + ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0, &dmac->dmaseg, + 1, &rsegs, BUS_DMA_WAITOK); + if (ret) + return ret; + KASSERT(rsegs == 1); + /* XXX errno NetBSD->Linux */ + ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0, + BUS_DMA_WAITOK, &dmac->dmamap); + if (ret) { + bus_dmamem_free(dmat, &dmac->dmaseg, 1); + return ret; + } + /* XXX errno NetBSD->Linux */ + ret = -bus_dmamem_map(dmat, &dmac->dmaseg, 1, PAGE_SIZE, &dmac->dmakva, + BUS_DMA_WAITOK); + if (ret) { + bus_dmamap_destroy(dmat, dmac->dmamap); + bus_dmamem_free(dmat, &dmac->dmaseg, 1); + return ret; + } + ret = -bus_dmamap_load(dmat, dmac->dmamap, dmac->dmakva, PAGE_SIZE, + BUS_DMA_WAITOK); + if (ret) { + bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE); + bus_dmamap_destroy(dmat, dmac->dmamap); + bus_dmamem_free(dmat, &dmac->dmaseg, 1); + return ret; + } + dmac->handle = dmac->dmamap->dm_segs[0].ds_addr; + dmac->ptr = dmac->dmakva; + } +#else dmac->ptr = pci_alloc_consistent(nv_device(core)->pdev, PAGE_SIZE, &dmac->handle); if (!dmac->ptr) return -ENOMEM; +#endif ret = nouveau_object_new(client, NVDRM_DEVICE, pushbuf, NV_DMA_FROM_MEMORY_CLASS, Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/nouveau_engine_xtensa.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/nouveau_engine_xtensa.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/nouveau_engine_xtensa.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/nouveau_engine_xtensa.c:1.1.1.1 Wed Aug 6 12:36:24 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/nouveau_engine_xtensa.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_xtensa.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_xtensa.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2013 Ilia Mirkin @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_xtensa.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_xtensa.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <engine/xtensa.h> @@ -136,8 +136,8 @@ _nouveau_xtensa_init(struct nouveau_obje return ret; } - nv_debug(xtensa, "Loading firmware to address: 0x%llx\n", - xtensa->gpu_fw->addr); + nv_debug(xtensa, "Loading firmware to address: 0x%"PRIxMAX"\n", + (uintmax_t)xtensa->gpu_fw->addr); for (i = 0; i < fw->size / 4; i++) nv_wo32(xtensa->gpu_fw, i * 4, *((u32 *)fw->data + i)); Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c:1.1.1.1 Wed Aug 6 12:36:24 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_copy_nva3.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_copy_nva3.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_copy_nva3.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_copy_nva3.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <engine/falcon.h> #include <engine/fifo.h> @@ -107,7 +107,7 @@ nva3_copy_intr(struct nouveau_subdev *su if (stat & 0x00000040) { nv_error(falcon, "DISPATCH_ERROR ["); nouveau_enum_print(nva3_copy_isr_error_name, ssta); - pr_cont("] ch %d [0x%010llx %s] subc %d mthd 0x%04x data 0x%08x\n", + pr_cont("] ch %d [0x%010"PRIx64" %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); Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c:1.1.1.1 Wed Aug 6 12:36:24 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_crypt_nv84.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_crypt_nv84.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_crypt_nv84.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_crypt_nv84.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/client.h> #include <core/os.h> @@ -134,7 +134,7 @@ nv84_crypt_intr(struct nouveau_subdev *s if (stat) { nv_error(priv, "%s", ""); nouveau_bitfield_print(nv84_crypt_intr_mask, stat); - pr_cont(" ch %d [0x%010llx %s] mthd 0x%04x data 0x%08x\n", + pr_cont(" ch %d [0x%010"PRIx64" %s] mthd 0x%04x data 0x%08x\n", chid, (u64)inst << 12, nouveau_client_name(engctx), mthd, data); } Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c:1.1.1.1 Wed Aug 6 12:36:24 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_crypt_nv98.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_crypt_nv98.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_crypt_nv98.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_crypt_nv98.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/client.h> #include <core/os.h> @@ -108,7 +108,7 @@ nv98_crypt_intr(struct nouveau_subdev *s if (stat & 0x00000040) { nv_error(priv, "DISPATCH_ERROR ["); nouveau_enum_print(nv98_crypt_isr_error_name, ssta); - pr_cont("] ch %d [0x%010llx %s] subc %d mthd 0x%04x data 0x%08x\n", + pr_cont("] ch %d [0x%010"PRIx64" %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); 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.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.2 Wed Aug 6 15:01:33 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_device_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_device_base.c,v 1.3 2014/08/23 08:03: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.2 2014/08/06 15:01:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $"); #include <core/object.h> #include <core/device.h> @@ -36,8 +36,27 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_engi #include "priv.h" +#ifdef __NetBSD__ +static struct mutex nv_devices_mutex; +static struct list_head nv_devices = LIST_HEAD_INIT(nv_devices); + +void +nouveau_devices_init(void) +{ + + linux_mutex_init(&nv_devices_mutex); +} + +void +nouveau_devices_fini(void) +{ + + linux_mutex_destroy(&nv_devices_mutex); +} +#else static DEFINE_MUTEX(nv_devices_mutex); static LIST_HEAD(nv_devices); +#endif struct nouveau_device * nouveau_device_find(u64 name) @@ -112,7 +131,12 @@ nouveau_devobj_ctor(struct nouveau_objec struct nv_device_class *args = data; u32 boot0, strap; u64 disable, mmio_base, mmio_size; +#ifdef __NetBSD__ + bus_space_tag_t mmiot; + bus_space_handle_t mmioh; +#else void __iomem *map; +#endif int ret, i, c; if (size < sizeof(struct nv_device_class)) @@ -136,6 +160,9 @@ nouveau_devobj_ctor(struct nouveau_objec if (ret) return ret; +#ifdef __NetBSD__ + mmiot = nv_device_resource_tag(device, 0); +#endif mmio_base = nv_device_resource_start(device, 0); mmio_size = nv_device_resource_len(device, 0); @@ -149,6 +176,21 @@ nouveau_devobj_ctor(struct nouveau_objec /* identify the chipset, and determine classes of subdev/engines */ if (!(args->disable & NV_DEVICE_DISABLE_IDENTIFY) && !device->card_type) { +#ifdef __NetBSD__ + if (bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh) != 0) + return -ENOMEM; + +#ifndef __BIG_ENDIAN + if (bus_space_read_4(mmiot, mmioh, 4) != 0) +#else + if (bus_space_read_4(mmiot, mmioh, 4) == 0) +#endif + bus_space_write_4(mmiot, mmioh, 4, 0x01000001); + + boot0 = bus_space_read_4(mmiot, mmioh, 0x000000); + strap = bus_space_read_4(mmiot, mmioh, 0x101000); + bus_space_unmap(mmiot, mmioh, mmio_size); +#else map = ioremap(mmio_base, 0x102000); if (map == NULL) return -ENOMEM; @@ -165,6 +207,7 @@ nouveau_devobj_ctor(struct nouveau_objec boot0 = ioread32_native(map + 0x000000); strap = ioread32_native(map + 0x101000); iounmap(map); +#endif /* determine chipset and derive architecture from it */ if ((boot0 & 0x1f000000) > 0) { @@ -247,6 +290,19 @@ nouveau_devobj_ctor(struct nouveau_objec nv_debug(device, "crystal freq: %dKHz\n", device->crystal); } +#ifdef __NetBSD__ + if (!(args->disable & NV_DEVICE_DISABLE_MMIO) && + !nv_subdev(device)->mmiosz) { + if (bus_space_map(mmiot, mmio_base, mmio_size, 0, + &nv_subdev(device)->mmioh) != 0) { + nv_error(device, "unable to map device registers\n"); + return -ENOMEM; + } + nv_subdev(device)->mmiot = mmiot; + nv_subdev(device)->mmioh = mmioh; + nv_subdev(device)->mmiosz = mmio_size; + } +#else if (!(args->disable & NV_DEVICE_DISABLE_MMIO) && !nv_subdev(device)->mmio) { nv_subdev(device)->mmio = ioremap(mmio_base, mmio_size); @@ -255,6 +311,7 @@ nouveau_devobj_ctor(struct nouveau_objec return -ENOMEM; } } +#endif /* ensure requested subsystems are available for use */ for (i = 1, c = 1; i < NVDEV_SUBDEV_NR; i++) { @@ -447,8 +504,14 @@ nouveau_device_dtor(struct nouveau_objec list_del(&device->head); mutex_unlock(&nv_devices_mutex); +#ifdef __NetBSD__ + if (nv_subdev(device)->mmiosz) + bus_space_unmap(nv_subdev(device)->mmiot, + nv_subdev(device)->mmioh, nv_subdev(device)->mmiosz); +#else if (nv_subdev(device)->mmio) iounmap(nv_subdev(device)->mmio); +#endif nouveau_engine_destroy(&device->base); } @@ -477,12 +540,17 @@ nv_device_resource_start(struct nouveau_ if (nv_device_is_pci(device)) { return pci_resource_start(device->pdev, bar); } else { +#ifdef __NetBSD__ + /* XXX nouveau platform device */ + panic("can't handle non-PCI nouveau devices"); +#else struct resource *res; res = platform_get_resource(device->platformdev, IORESOURCE_MEM, bar); if (!res) return 0; return res->start; +#endif } } @@ -492,15 +560,21 @@ nv_device_resource_len(struct nouveau_de if (nv_device_is_pci(device)) { return pci_resource_len(device->pdev, bar); } else { +#ifdef __NetBSD__ + /* XXX nouveau platform device */ + panic("can't handle non-PCI nouveau devices"); +#else struct resource *res; res = platform_get_resource(device->platformdev, IORESOURCE_MEM, bar); if (!res) return 0; return resource_size(res); +#endif } } +#ifndef __NetBSD__ dma_addr_t nv_device_map_page(struct nouveau_device *device, struct page *page) { @@ -525,15 +599,31 @@ nv_device_unmap_page(struct nouveau_devi pci_unmap_page(device->pdev, addr, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); } +#endif int nv_device_get_irq(struct nouveau_device *device, bool stall) { if (nv_device_is_pci(device)) { +#ifdef __NetBSD__ + pci_intr_handle_t ih; + + CTASSERT(sizeof ih <= sizeof(int)); /* XXX */ + if (pci_intr_map(&device->pdev->pd_pa, &ih)) + panic("unable to map nouveau interrupt"); /* XXX */ + + return ih; +#else return device->pdev->irq; +#endif } else { +#ifdef __NetBSD__ + /* XXX nouveau platform device */ + panic("can't handle non-PCI nouveau devices"); +#else return platform_get_irq_byname(device->platformdev, stall ? "stall" : "nonstall"); +#endif } } Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_dacnv50.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_dacnv50.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_dacnv50.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_dacnv50.c:1.1.1.1 Wed Aug 6 12:36:24 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_dacnv50.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_disp_dacnv50.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_disp_dacnv50.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_dacnv50.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_dacnv50.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/os.h> #include <core/class.h> @@ -97,6 +97,7 @@ nv50_dac_mthd(struct nouveau_object *obj break; default: BUG_ON(1); + ret = -EIO; /* XXX GCC */ } return ret; Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv04.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv04.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv04.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv04.c:1.1.1.1 Wed Aug 6 12:36:24 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv04.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_disp_nv04.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_disp_nv04.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,13 +25,15 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nv04.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nv04.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include "priv.h" #include <core/event.h> #include <core/class.h> +#include <linux/ktime.h> /* XXX */ + struct nv04_disp_priv { struct nouveau_disp base; }; Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv50.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv50.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv50.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv50.c:1.1.1.1 Wed Aug 6 12:36:24 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv50.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_disp_nv50.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_disp_nv50.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nv50.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nv50.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/object.h> #include <core/parent.h> @@ -42,6 +42,10 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_engi #include <subdev/timer.h> #include <subdev/fb.h> +#include <asm/div64.h> /* XXX */ +#include <linux/bitops.h> /* XXX */ +#include <linux/ktime.h> /* XXX */ + #include "nv50.h" /******************************************************************************* @@ -1355,7 +1359,7 @@ nv50_disp_intr_unk20_2_dp(struct nv50_di int TU, VTUi, VTUf, VTUa; u64 link_data_rate, link_ratio, unk; u32 best_diff = 64 * symbol; - u32 link_nr, link_bw, bits, r; + u32 link_nr, link_bw, bits; /* calculate packed data rate for each lane */ if (dpctrl > 0x00030000) link_nr = 4; @@ -1375,7 +1379,7 @@ nv50_disp_intr_unk20_2_dp(struct nv50_di /* calculate ratio of packed data rate to link symbol rate */ link_ratio = link_data_rate * symbol; - r = do_div(link_ratio, link_bw); + (void)do_div(link_ratio, link_bw); for (TU = 64; TU >= 32; TU--) { /* calculate average number of valid symbols in each TU */ @@ -1436,8 +1440,8 @@ nv50_disp_intr_unk20_2_dp(struct nv50_di /* XXX close to vbios numbers, but not right */ unk = (symbol - link_ratio) * bestTU; unk *= link_ratio; - r = do_div(unk, symbol); - r = do_div(unk, symbol); + (void)do_div(unk, symbol); + (void)do_div(unk, symbol); unk += 6; nv_mask(priv, 0x61c10c + loff, 0x000001fc, bestTU << 2); Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c:1.1.1.1 Wed Aug 6 12:36:24 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_disp_nvd0.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_disp_nvd0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nvd0.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nvd0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/object.h> #include <core/parent.h> @@ -43,6 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_engi #include <subdev/fb.h> #include <subdev/timer.h> +#include <asm/div64.h> /* XXX */ +#include <linux/ktime.h> /* XXX */ + #include "nv50.h" /******************************************************************************* Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nv50.h diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nv50.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nv50.h:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nv50.h:1.1.1.1 Thu Jul 17 01:50:58 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nv50.h Sat Aug 23 08:03:33 2014 @@ -9,6 +9,8 @@ #include <engine/dmaobj.h> +#include <linux/workqueue.h> /* XXX */ + #include "dport.h" #include "priv.h" 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.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c:1.2 Wed Aug 6 15:01:33 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_fifo_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_fifo_base.c,v 1.3 2014/08/23 08:03: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.2 2014/08/06 15:01:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $"); #include <core/client.h> #include <core/object.h> @@ -92,10 +92,10 @@ nouveau_fifo_channel_create_(struct nouv /* map fifo control registers */ #ifdef __NetBSD__ + chan->bst = nv_device_resource_tag(device, bar); /* 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); + ret = -bus_space_map(chan->bst, nv_device_resource_start(device, bar) + + addr + (chan->chid * size), size, 0, &chan->bsh); if (ret) return ret; #else @@ -143,14 +143,22 @@ u32 _nouveau_fifo_channel_rd32(struct nouveau_object *object, u64 addr) { struct nouveau_fifo_chan *chan = (void *)object; +#ifdef __NetBSD__ + return bus_space_read_4(chan->bst, chan->bsh, addr); +#else return ioread32_native(chan->user + addr); +#endif } void _nouveau_fifo_channel_wr32(struct nouveau_object *object, u64 addr, u32 data) { struct nouveau_fifo_chan *chan = (void *)object; +#ifdef __NetBSD__ + bus_space_write_4(chan->bst, chan->bsh, addr, data); +#else iowrite32_native(data, chan->user + addr); +#endif } static int Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.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_nvc0.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_fifo_nvc0.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_fifo_nvc0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_nvc0.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_nvc0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/client.h> #include <core/handle.h> @@ -44,6 +44,9 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_engi #include <engine/dmaobj.h> #include <engine/fifo.h> +#include <drm/drmP.h> /* XXX */ +#include <linux/workqueue.h> /* XXX */ + struct nvc0_fifo_priv { struct nouveau_fifo base; @@ -53,7 +56,12 @@ struct nvc0_fifo_priv { struct { struct nouveau_gpuobj *mem[2]; int active; +#ifdef __NetBSD__ + spinlock_t lock; + drm_waitqueue_t wait; +#else wait_queue_head_t wait; +#endif } runlist; struct { @@ -106,10 +114,24 @@ nvc0_fifo_runlist_update(struct nvc0_fif nv_wr32(priv, 0x002270, cur->addr >> 12); nv_wr32(priv, 0x002274, 0x01f00000 | (p >> 3)); +#ifdef __NetBSD__ + { + int ret; + + spin_lock(&priv->runlist.lock); + DRM_SPIN_TIMED_WAIT_UNTIL(ret, &priv->runlist.wait, + &priv->runlist.lock, msecs_to_jiffies(2000), + !(nv_rd32(priv, 0x00227c) & 0x00100000)); + if (ret == -ETIMEDOUT) + nv_error(priv, "runlist update timeout\n"); + spin_unlock(&priv->runlist.lock); + } +#else if (wait_event_timeout(priv->runlist.wait, !(nv_rd32(priv, 0x00227c) & 0x00100000), msecs_to_jiffies(2000)) == 0) nv_error(priv, "runlist update timeout\n"); +#endif mutex_unlock(&nv_subdev(priv)->mutex); } @@ -649,8 +671,8 @@ nvc0_fifo_intr_fault(struct nvc0_fifo_pr if (!ec) snprintf(ecunk, sizeof(ecunk), "UNK%02x", client); - nv_error(priv, "%s fault at 0x%010llx [%s] from %s/%s%s%s%s on " - "channel 0x%010llx [%s]\n", write ? "write" : "read", + nv_error(priv, "%s fault at 0x%010"PRIx64" [%s] from %s/%s%s%s%s on " + "channel 0x%010"PRIx64" [%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, @@ -714,7 +736,13 @@ nvc0_fifo_intr_runlist(struct nvc0_fifo_ u32 intr = nv_rd32(priv, 0x002a00); if (intr & 0x10000000) { +#ifdef __NetBSD__ + spin_lock(&priv->runlist.lock); + DRM_SPIN_WAKEUP_ONE(&priv->runlist.wait, &priv->runlist.lock); + spin_unlock(&priv->runlist.lock); +#else wake_up(&priv->runlist.wait); +#endif nv_wr32(priv, 0x002a00, 0x10000000); intr &= ~0x10000000; } @@ -860,6 +888,11 @@ nvc0_fifo_ctor(struct nouveau_object *pa INIT_WORK(&priv->fault, nvc0_fifo_recover_work); +#ifdef __NetBSD__ + spin_lock_init(&priv->runlist.lock); + DRM_INIT_WAITQUEUE(&priv->runlist.wait, "nvfifo"); +#endif + ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x1000, 0x1000, 0, &priv->runlist.mem[0]); if (ret) @@ -870,7 +903,9 @@ nvc0_fifo_ctor(struct nouveau_object *pa if (ret) return ret; +#ifndef __NetBSD__ init_waitqueue_head(&priv->runlist.wait); +#endif ret = nouveau_gpuobj_new(nv_object(priv), NULL, 128 * 0x1000, 0x1000, 0, &priv->user.mem); @@ -903,6 +938,11 @@ nvc0_fifo_dtor(struct nouveau_object *ob nouveau_gpuobj_ref(NULL, &priv->runlist.mem[0]); nouveau_gpuobj_ref(NULL, &priv->runlist.mem[1]); +#ifdef __NetBSD__ + DRM_DESTROY_WAITQUEUE(&priv->runlist.wait); + spin_lock_destroy(&priv->runlist.lock); +#endif + nouveau_fifo_destroy(&priv->base); } Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.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_nve0.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_fifo_nve0.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_fifo_nve0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_nve0.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_nve0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/client.h> #include <core/handle.h> @@ -43,6 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_engi #include <engine/dmaobj.h> +#include <drm/drmP.h> /* XXX */ +#include <linux/workqueue.h> /* XXX */ + #include "nve0.h" #define _(a,b) { (a), ((1ULL << (a)) | (b)) } @@ -65,7 +68,12 @@ static const struct { struct nve0_fifo_engn { struct nouveau_gpuobj *runlist[2]; int cur_runlist; +#ifdef __NetBSD__ + spinlock_t lock; + drm_waitqueue_t wait; +#else wait_queue_head_t wait; +#endif }; struct nve0_fifo_priv { @@ -127,10 +135,25 @@ nve0_fifo_runlist_update(struct nve0_fif nv_wr32(priv, 0x002270, cur->addr >> 12); nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3)); +#ifdef __NetBSD__ + { + int ret; + + spin_lock(&engn->lock); + DRM_SPIN_TIMED_WAIT_UNTIL(ret, &engn->wait, &engn->lock, + msecs_to_jiffies(2000), + !(nv_rd32(priv, 0x002284 + + (engine * 0x08)) & 0x00100000)); + if (ret == -ETIMEDOUT) + nv_error(priv, "runlist %d update timeout\n", engine); + spin_unlock(&engn->lock); + } +#else if (wait_event_timeout(engn->wait, !(nv_rd32(priv, 0x002284 + (engine * 0x08)) & 0x00100000), msecs_to_jiffies(2000)) == 0) nv_error(priv, "runlist %d update timeout\n", engine); +#endif mutex_unlock(&nv_subdev(priv)->mutex); } @@ -764,8 +787,8 @@ nve0_fifo_intr_fault(struct nve0_fifo_pr if (!ec) snprintf(ecunk, sizeof(ecunk), "UNK%02x", client); - nv_error(priv, "%s fault at 0x%010llx [%s] from %s/%s%s%s%s on " - "channel 0x%010llx [%s]\n", write ? "write" : "read", + nv_error(priv, "%s fault at 0x%010"PRIx64" [%s] from %s/%s%s%s%s on " + "channel 0x%010"PRIx64" [%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, @@ -855,7 +878,14 @@ nve0_fifo_intr_runlist(struct nve0_fifo_ u32 mask = nv_rd32(priv, 0x002a00); while (mask) { u32 engn = __ffs(mask); +#ifdef __NetBSD__ + spin_lock(&priv->engine[engn].lock); + DRM_SPIN_WAKEUP_ONE(&priv->engine[engn].wait, + &priv->engine[engn].lock); + spin_unlock(&priv->engine[engn].lock); +#else wake_up(&priv->engine[engn].wait); +#endif nv_wr32(priv, 0x002a00, 1 << engn); mask &= ~(1 << engn); } @@ -1026,6 +1056,10 @@ nve0_fifo_dtor(struct nouveau_object *ob for (i = 0; i < FIFO_ENGINE_NR; i++) { nouveau_gpuobj_ref(NULL, &priv->engine[i].runlist[1]); nouveau_gpuobj_ref(NULL, &priv->engine[i].runlist[0]); +#ifdef __NetBSD__ + DRM_DESTROY_WAITQUEUE(&priv->engine[i].wait); + spin_lock_destroy(&priv->engine[i].lock); +#endif } nouveau_fifo_destroy(&priv->base); @@ -1059,7 +1093,12 @@ nve0_fifo_ctor(struct nouveau_object *pa if (ret) return ret; +#ifdef __NetBSD__ + spin_lock_init(&priv->engine[i].lock); + DRM_INIT_WAITQUEUE(&priv->engine[i].wait, "nve0fifo"); +#else init_waitqueue_head(&priv->engine[i].wait); +#endif } ret = nouveau_gpuobj_new(nv_object(priv), NULL, impl->channels * 0x200, Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nve0.h diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nve0.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nve0.h:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nve0.h:1.1.1.1 Thu Jul 17 01:50:58 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nve0.h Sat Aug 23 08:03:33 2014 @@ -8,6 +8,7 @@ int nve0_fifo_ctor(struct nouveau_objec struct nouveau_object **); void nve0_fifo_dtor(struct nouveau_object *); int nve0_fifo_init(struct nouveau_object *); +int nve0_fifo_fini(struct nouveau_object *, bool); struct nve0_fifo_impl { struct nouveau_oclass base; Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxnvd7.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxnvd7.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxnvd7.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxnvd7.c:1.1.1.1 Wed Aug 6 12:36:25 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxnvd7.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_graph_ctxnvd7.c,v 1.1.1.1 2014/08/06 12:36:25 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_graph_ctxnvd7.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2013 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_graph_ctxnvd7.c,v 1.1.1.1 2014/08/06 12:36:25 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_graph_ctxnvd7.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include "ctxnvc0.h" @@ -222,7 +222,7 @@ nvd7_grctx_generate_mods(struct nvc0_gra mmio_list(0x17e91c, 0x03060609, 0, 0); /* different from kepler */ } -void +static void nvd7_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info) { struct nvc0_grctx_oclass *oclass = (void *)nv_engine(priv)->cclass; Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gm107.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gm107.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gm107.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gm107.c:1.1.1.1 Wed Aug 6 12:36:25 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gm107.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_graph_gm107.c,v 1.1.1.1 2014/08/06 12:36:25 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_graph_gm107.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2013 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_graph_gm107.c,v 1.1.1.1 2014/08/06 12:36:25 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_graph_gm107.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <subdev/bios.h> #include <subdev/bios/P0260.h> @@ -323,7 +323,7 @@ gm107_graph_init_bios(struct nvc0_graph_ } } -int +static int gm107_graph_init(struct nouveau_object *object) { struct nvc0_graph_oclass *oclass = (void *)object->oclass; Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c:1.1.1.1 Wed Aug 6 12:36:26 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_graph_nv50.c,v 1.1.1.1 2014/08/06 12:36:26 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_graph_nv50.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_graph_nv50.c,v 1.1.1.1 2014/08/06 12:36:26 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_graph_nv50.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); #include <core/os.h> #include <core/class.h> @@ -621,7 +621,7 @@ nv50_graph_trap_handler(struct nv50_grap nv_error(priv, "TRAP DISPATCH_FAULT\n"); if (display && (addr & 0x80000000)) { nv_error(priv, - "ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x%08x 400808 0x%08x 400848 0x%08x\n", + "ch %d [0x%010"PRIx64" %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); @@ -646,7 +646,7 @@ nv50_graph_trap_handler(struct nv50_grap nv_error(priv, "TRAP DISPATCH_QUERY\n"); if (display && (addr & 0x80000000)) { nv_error(priv, - "ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x 40084c 0x%08x\n", + "ch %d [0x%010"PRIx64" %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); @@ -850,7 +850,7 @@ nv50_graph_intr(struct nouveau_subdev *s pr_cont("\n"); } nv_error(priv, - "ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n", + "ch %d [0x%010"PRIx64" %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); } Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c:1.1.1.1 Wed Aug 6 12:36:26 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_graph_nvc0.c,v 1.1.1.1 2014/08/06 12:36:26 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_graph_nvc0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_graph_nvc0.c,v 1.1.1.1 2014/08/06 12:36:26 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_graph_nvc0.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $"); + +#include <linux/string.h> /* XXX */ #include "nvc0.h" #include "ctxnvc0.h" @@ -832,7 +834,7 @@ nvc0_graph_intr(struct nouveau_subdev *s handle = nouveau_handle_get_class(engctx, class); if (!handle || nv_call(handle->object, mthd, data)) { nv_error(priv, - "ILLEGAL_MTHD ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n", + "ILLEGAL_MTHD ch %d [0x%010"PRIx64" %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n", chid, inst << 12, nouveau_client_name(engctx), subc, class, mthd, data); } @@ -843,7 +845,7 @@ nvc0_graph_intr(struct nouveau_subdev *s if (stat & 0x00000020) { nv_error(priv, - "ILLEGAL_CLASS ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n", + "ILLEGAL_CLASS ch %d [0x%010"PRIx64" %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); @@ -853,7 +855,7 @@ nvc0_graph_intr(struct nouveau_subdev *s if (stat & 0x00100000) { nv_error(priv, "DATA_ERROR ["); nouveau_enum_print(nv50_data_error_names, code); - pr_cont("] ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n", + pr_cont("] ch %d [0x%010"PRIx64" %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); @@ -861,7 +863,7 @@ nvc0_graph_intr(struct nouveau_subdev *s } if (stat & 0x00200000) { - nv_error(priv, "TRAP ch %d [0x%010llx %s]\n", chid, inst << 12, + nv_error(priv, "TRAP ch %d [0x%010"PRIx64" %s]\n", chid, inst << 12, nouveau_client_name(engctx)); nvc0_graph_trap_intr(priv); nv_wr32(priv, 0x400100, 0x00200000); @@ -883,7 +885,7 @@ nvc0_graph_intr(struct nouveau_subdev *s nouveau_engctx_put(engctx); } -void +static void nvc0_graph_init_fw(struct nvc0_graph_priv *priv, u32 fuc_base, struct nvc0_graph_fuc *code, struct nvc0_graph_fuc *data) { @@ -1212,7 +1214,7 @@ nvc0_graph_dtor_fw(struct nvc0_graph_fuc fuc->data = NULL; } -int +static int nvc0_graph_ctor_fw(struct nvc0_graph_priv *priv, const char *fwname, struct nvc0_graph_fuc *fuc) { Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/perfmon/nouveau_engine_perfmon_base.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/perfmon/nouveau_engine_perfmon_base.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/perfmon/nouveau_engine_perfmon_base.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/perfmon/nouveau_engine_perfmon_base.c:1.1.1.1 Wed Aug 6 12:36:27 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/perfmon/nouveau_engine_perfmon_base.c Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_engine_perfmon_base.c,v 1.1.1.1 2014/08/06 12:36:27 riastradh Exp $ */ +/* $NetBSD: nouveau_engine_perfmon_base.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $ */ /* * Copyright 2013 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_perfmon_base.c,v 1.1.1.1 2014/08/06 12:36:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_perfmon_base.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $"); #include <core/option.h> #include <core/class.h> @@ -60,7 +60,7 @@ nouveau_perfsig_find_(struct nouveau_per return NULL; } -struct nouveau_perfsig * +static struct nouveau_perfsig * nouveau_perfsig_find(struct nouveau_perfmon *ppm, const char *name, u32 size, struct nouveau_perfdom **pdom) { 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.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.2 Wed Aug 6 15:01:33 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h Sat Aug 23 08:03:34 2014 @@ -167,11 +167,13 @@ nv_device_resource_start(struct nouveau_ resource_size_t nv_device_resource_len(struct nouveau_device *device, unsigned int bar); +#ifndef __NetBSD__ dma_addr_t nv_device_map_page(struct nouveau_device *device, struct page *page); void nv_device_unmap_page(struct nouveau_device *device, dma_addr_t addr); +#endif int nv_device_get_irq(struct nouveau_device *device, bool stall); Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/device.h diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/device.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/device.h:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/device.h:1.1.1.1 Thu Jul 17 01:50:59 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/device.h Sat Aug 23 08:03:34 2014 @@ -30,4 +30,9 @@ int gm100_identify(struct nouveau_device struct nouveau_device *nouveau_device_find(u64 name); +#ifdef __NetBSD__ +void nouveau_devices_init(void); +void nouveau_devices_fini(void); +#endif + #endif Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/bar.h diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/bar.h:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/bar.h:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/bar.h:1.2 Wed Aug 6 13:35:13 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/bar.h Sat Aug 23 08:03:34 2014 @@ -13,8 +13,9 @@ struct nouveau_bar { int (*alloc)(struct nouveau_bar *, struct nouveau_object *, struct nouveau_mem *, struct nouveau_object **); #ifdef __NetBSD__ - bus_space_tag_t bst; - bus_space_handle_t bsh; + bus_space_tag_t iomemt; + bus_space_handle_t iomemh; + bus_size_t iomemsz; #else void __iomem *iomem; #endif Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/fb.h diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/fb.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/fb.h:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/fb.h:1.1.1.1 Thu Jul 17 01:50:59 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/fb.h Sat Aug 23 08:03:34 2014 @@ -33,7 +33,11 @@ struct nouveau_mem { struct nouveau_mm_node *tag; struct list_head regions; +#ifdef __NetBSD__ + bus_dmamap_t pages; +#else dma_addr_t *pages; +#endif u32 memtype; u64 offset; u64 size; Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h:1.1.1.1 Thu Jul 17 01:50:59 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h Sat Aug 23 08:03:34 2014 @@ -3,6 +3,8 @@ #include <core/subdev.h> #include <core/device.h> +#include <linux/workqueue.h> /* XXX */ +#include <drm/drmP.h> /* XXX */ struct nouveau_pwr { struct nouveau_subdev base; @@ -29,7 +31,12 @@ struct nouveau_pwr { u32 size; struct work_struct work; +#ifdef __NetBSD__ + struct mutex lock; + drm_waitqueue_t wait; +#else wait_queue_head_t wait; +#endif u32 process; u32 message; u32 data[2]; @@ -59,7 +66,11 @@ nouveau_pwr(void *obj) int nouveau_pwr_create_(struct nouveau_object *, struct nouveau_object *, struct nouveau_oclass *, int, void **); +#ifdef __NetBSD__ +int _nouveau_pwr_dtor(struct nouveau_object *); +#else #define _nouveau_pwr_dtor _nouveau_subdev_dtor +#endif int _nouveau_pwr_init(struct nouveau_object *); int _nouveau_pwr_fini(struct nouveau_object *, bool); Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c:1.1.1.1 Wed Aug 6 12:36:28 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_subdev_bar_base.c,v 1.1.1.1 2014/08/06 12:36:28 riastradh Exp $ */ +/* $NetBSD: nouveau_subdev_bar_base.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bar_base.c,v 1.1.1.1 2014/08/06 12:36:28 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bar_base.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $"); #include <core/object.h> @@ -37,7 +37,12 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_subd struct nouveau_barobj { struct nouveau_object base; struct nouveau_vma vma; +#ifdef __NetBSD__ + bus_space_tag_t iomemt; + bus_space_handle_t iomemh; +#else void __iomem *iomem; +#endif }; static int @@ -59,7 +64,15 @@ nouveau_barobj_ctor(struct nouveau_objec if (ret) return ret; +#ifdef __NetBSD__ + barobj->iomemt = bar->iomemt; + if (bus_space_subregion(bar->iomemt, bar->iomemh, barobj->vma.offset, + bar->iomemsz - barobj->vma.offset, &barobj->iomemh) != 0) + /* XXX error branch */ + return ret; +#else barobj->iomem = bar->iomem + (u32)barobj->vma.offset; +#endif return 0; } @@ -77,14 +90,22 @@ static u32 nouveau_barobj_rd32(struct nouveau_object *object, u64 addr) { struct nouveau_barobj *barobj = (void *)object; +#ifdef __NetBSD__ + return bus_space_read_4(barobj->iomemt, barobj->iomemh, addr); +#else return ioread32_native(barobj->iomem + addr); +#endif } static void nouveau_barobj_wr32(struct nouveau_object *object, u64 addr, u32 data) { struct nouveau_barobj *barobj = (void *)object; +#ifdef __NetBSD__ + bus_space_write_4(barobj->iomemt, barobj->iomemh, addr, data); +#else iowrite32_native(data, barobj->iomem + addr); +#endif } static struct nouveau_oclass @@ -123,16 +144,29 @@ nouveau_bar_create_(struct nouveau_objec if (ret) return ret; +#ifdef __NetBSD__ + bar->iomemt = nv_device_resource_tag(device, 3); + bar->iomemsz = nv_device_resource_len(device, 3); + if (bus_space_map(bar->iomemt, nv_device_resource_start(device, 3), + bar->iomemsz, 0, &bar->iomemh)) + bar->iomemsz = 0; /* XXX Fail? */ +#else bar->iomem = ioremap(nv_device_resource_start(device, 3), nv_device_resource_len(device, 3)); +#endif return 0; } void nouveau_bar_destroy(struct nouveau_bar *bar) { +#ifdef __NetBSD__ + if (bar->iomemsz) + bus_space_unmap(bar->iomemt, bar->iomemh, bar->iomemsz); +#else if (bar->iomem) iounmap(bar->iomem); +#endif nouveau_subdev_destroy(&bar->base); } Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv04.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv04.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv04.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv04.c:1.1.1.1 Wed Aug 6 12:36:31 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv04.c Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_subdev_instmem_nv04.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $ */ +/* $NetBSD: nouveau_subdev_instmem_nv04.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_instmem_nv04.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_instmem_nv04.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $"); #include "nv04.h" @@ -121,8 +121,13 @@ nv04_instmem_dtor(struct nouveau_object nouveau_ramht_ref(NULL, &priv->ramht); nouveau_gpuobj_ref(NULL, &priv->vbios); nouveau_mm_fini(&priv->heap); +#ifdef __NetBSD__ + if (priv->iomemsz) + bus_space_unmap(priv->iomemt, priv->iomemh, priv->iomemsz); +#else if (priv->iomem) iounmap(priv->iomem); +#endif nouveau_instmem_destroy(&priv->base); } Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c:1.1.1.1 Wed Aug 6 12:36:31 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_subdev_instmem_nv40.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $ */ +/* $NetBSD: nouveau_subdev_instmem_nv40.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $ */ /* * Copyright 2012 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_instmem_nv40.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_instmem_nv40.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $"); #include <engine/graph/nv40.h> @@ -39,14 +39,22 @@ static u32 nv40_instmem_rd32(struct nouveau_object *object, u64 addr) { struct nv04_instmem_priv *priv = (void *)object; +#ifdef __NetBSD__ + return bus_space_read_4(priv->iomemt, priv->iomemh, addr); +#else return ioread32_native(priv->iomem + addr); +#endif } static void nv40_instmem_wr32(struct nouveau_object *object, u64 addr, u32 data) { struct nv04_instmem_priv *priv = (void *)object; +#ifdef __NetBSD__ + bus_space_write_4(priv->iomemt, priv->iomemh, addr, data); +#else iowrite32_native(data, priv->iomem + addr); +#endif } static int @@ -69,12 +77,23 @@ nv40_instmem_ctor(struct nouveau_object else bar = 3; +#ifdef __NetBSD__ + priv->iomemt = nv_device_resource_tag(device, bar); + priv->iomemsz = nv_device_resource_len(device, bar); + if (bus_space_map(priv->iomemt, nv_device_resource_start(device, bar), + priv->iomemsz, 0, &priv->iomemh)) { + priv->iomemsz = 0; + nv_error(priv, "unable to map PRAMIN BAR\n"); + return -EFAULT; + } +#else priv->iomem = ioremap(nv_device_resource_start(device, bar), nv_device_resource_len(device, bar)); if (!priv->iomem) { nv_error(priv, "unable to map PRAMIN BAR\n"); return -EFAULT; } +#endif /* PRAMIN aperture maps over the end of vram, reserve enough space * to fit graphics contexts for every channel, the magics come Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nv04.h diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nv04.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nv04.h:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nv04.h:1.1.1.1 Thu Jul 17 01:50:59 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nv04.h Sat Aug 23 08:03:34 2014 @@ -12,7 +12,13 @@ extern struct nouveau_instobj_impl nv04_ struct nv04_instmem_priv { struct nouveau_instmem base; +#ifdef __NetBSD__ + bus_space_tag_t iomemt; + bus_space_handle_t iomemh; + bus_size_t iomemsz; +#else void __iomem *iomem; +#endif struct nouveau_mm heap; struct nouveau_gpuobj *vbios; Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c:1.2 --- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c:1.1.1.1 Wed Aug 6 12:36:31 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_subdev_pwr_base.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $ */ +/* $NetBSD: nouveau_subdev_pwr_base.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $ */ /* * Copyright 2013 Red Hat Inc. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_pwr_base.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_pwr_base.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $"); #include <subdev/pwr.h> #include <subdev/timer.h> @@ -110,16 +110,27 @@ nouveau_pwr_recv(struct work_struct *wor nv_wr32(ppwr, 0x10a580, 0x00000000); /* wake process if it's waiting on a synchronous reply */ +#ifdef __NetBSD__ + mutex_lock(&ppwr->recv.lock); +#endif if (ppwr->recv.process) { if (process == ppwr->recv.process && message == ppwr->recv.message) { ppwr->recv.data[0] = data0; ppwr->recv.data[1] = data1; ppwr->recv.process = 0; +#ifdef __NetBSD__ + DRM_WAKEUP_ONE(&ppwr->recv.wait, &ppwr->recv.lock); + mutex_unlock(&ppwr->recv.lock); +#else wake_up(&ppwr->recv.wait); +#endif return; } } +#ifdef __NetBSD__ + mutex_unlock(&ppwr->recv.lock); +#endif /* right now there's no other expected responses from the engine, * so assume that any unexpected message is an error. @@ -247,6 +258,24 @@ nouveau_pwr_create_(struct nouveau_objec return ret; INIT_WORK(&ppwr->recv.work, nouveau_pwr_recv); +#ifdef __NetBSD__ + linux_mutex_init(&ppwr->recv.lock); + DRM_INIT_WAITQUEUE(&ppwr->recv.wait, "nvppwr"); +#else init_waitqueue_head(&ppwr->recv.wait); +#endif return 0; } + +#ifdef __NetBSD__ +int +_nouveau_pwr_dtor(struct nouveau_object *object) +{ + struct nouveau_pwr *ppwr = (void *)object; + + DRM_DESTROY_WAITQUEUE(&ppwr->recv.wait); + linux_mutex_destroy(&ppwr->recv.lock); + + _nouveau_subdev_dtor(object); +} +#endif 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.2 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c:1.2 Wed Aug 6 15:01:34 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_dispnv04_tvmodesnv17.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $ */ +/* $NetBSD: nouveau_dispnv04_tvmodesnv17.c,v 1.3 2014/08/23 08:03:34 riastradh Exp $ */ /* * Copyright (C) 2009 Francisco Jerez. @@ -27,8 +27,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvmodesnv17.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvmodesnv17.c,v 1.3 2014/08/23 08:03:34 riastradh Exp $"); +#include <asm/div64.h> /* XXX */ #include <drm/drmP.h> #include <drm/drm_crtc_helper.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.2 src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c:1.2 Wed Aug 6 15:01:34 2014 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_dispnv04_tvnv17.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $ */ +/* $NetBSD: nouveau_dispnv04_tvnv17.c,v 1.3 2014/08/23 08:03: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.2 2014/08/06 15:01:34 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_tvnv17.c,v 1.3 2014/08/23 08:03:34 riastradh Exp $"); #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> @@ -324,7 +324,7 @@ static int nv17_tv_mode_valid(struct drm 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 = + const struct drm_display_mode *output_mode = &tv_norm->ctv_enc_mode.mode; if (mode->clock > 400000) @@ -534,7 +534,7 @@ static void nv17_tv_mode_set(struct drm_ tv_regs->tv_enc[i] = tv_norm->tv_enc_mode.tv_enc[i]; } else { - struct drm_display_mode *output_mode = + const struct drm_display_mode *output_mode = &tv_norm->ctv_enc_mode.mode; /* The registers in PRAMDAC+0xc00 control some timings and CSC Index: src/sys/external/bsd/drm2/include/drm/drm_agp_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_agp_netbsd.h:1.3 src/sys/external/bsd/drm2/include/drm/drm_agp_netbsd.h:1.4 --- src/sys/external/bsd/drm2/include/drm/drm_agp_netbsd.h:1.3 Wed Jul 16 20:56:25 2014 +++ src/sys/external/bsd/drm2/include/drm/drm_agp_netbsd.h Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_agp_netbsd.h,v 1.3 2014/07/16 20:56:25 riastradh Exp $ */ +/* $NetBSD: drm_agp_netbsd.h,v 1.4 2014/08/23 08:03:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -41,6 +41,7 @@ #include <sys/agpio.h> #include <dev/pci/pcivar.h> /* XXX include order botch */ +#include <dev/pci/agpreg.h> #include <dev/pci/agpvar.h> #include <linux/kernel.h> @@ -48,6 +49,8 @@ #define __OS_HAS_AGP 1 +#define PCI_AGP_COMMAND_FW AGPCMD_FWEN + __CTASSERT(PAGE_SIZE == AGP_PAGE_SIZE); __CTASSERT(PAGE_SHIFT == AGP_PAGE_SHIFT); Index: src/sys/external/bsd/drm2/include/linux/bitops.h diff -u src/sys/external/bsd/drm2/include/linux/bitops.h:1.7 src/sys/external/bsd/drm2/include/linux/bitops.h:1.8 --- src/sys/external/bsd/drm2/include/linux/bitops.h:1.7 Wed Aug 6 13:50:38 2014 +++ src/sys/external/bsd/drm2/include/linux/bitops.h Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: bitops.h,v 1.7 2014/08/06 13:50:38 riastradh Exp $ */ +/* $NetBSD: bitops.h,v 1.8 2014/08/23 08:03:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -43,6 +43,12 @@ #include <lib/libkern/libkern.h> static inline unsigned long +__ffs(unsigned long x) +{ + return ffs64(x); +} + +static inline unsigned long __ffs64(uint64_t x) { return ffs64(x); Index: src/sys/external/bsd/drm2/include/linux/i2c.h diff -u src/sys/external/bsd/drm2/include/linux/i2c.h:1.5 src/sys/external/bsd/drm2/include/linux/i2c.h:1.6 --- src/sys/external/bsd/drm2/include/linux/i2c.h:1.5 Wed Aug 6 15:01:33 2014 +++ src/sys/external/bsd/drm2/include/linux/i2c.h Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.h,v 1.5 2014/08/06 15:01:33 riastradh Exp $ */ +/* $NetBSD: i2c.h,v 1.6 2014/08/23 08:03:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -52,6 +52,10 @@ struct i2c_board_info { void *platform_data; }; +#define I2C_BOARD_INFO(board_type, board_addr) \ + .type = (board_type), \ + .addr = (board_addr) + static inline void i2c_new_device(const struct i2c_adapter *adapter __unused, const struct i2c_board_info *board __unused) Index: src/sys/external/bsd/drm2/include/linux/mutex.h diff -u src/sys/external/bsd/drm2/include/linux/mutex.h:1.6 src/sys/external/bsd/drm2/include/linux/mutex.h:1.7 --- src/sys/external/bsd/drm2/include/linux/mutex.h:1.6 Wed Aug 6 15:01:33 2014 +++ src/sys/external/bsd/drm2/include/linux/mutex.h Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mutex.h,v 1.6 2014/08/06 15:01:33 riastradh Exp $ */ +/* $NetBSD: mutex.h,v 1.7 2014/08/23 08:03:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,6 +36,9 @@ #include <lib/libkern/libkern.h> /* KASSERT */ +#define __acquires(lock) /* XXX lockdep stuff */ +#define __releases(lock) /* XXX lockdep stuff */ + struct mutex { kmutex_t mtx_lock; }; Index: src/sys/external/bsd/drm2/include/linux/pagemap.h diff -u src/sys/external/bsd/drm2/include/linux/pagemap.h:1.2 src/sys/external/bsd/drm2/include/linux/pagemap.h:1.3 --- src/sys/external/bsd/drm2/include/linux/pagemap.h:1.2 Tue Mar 18 18:20:43 2014 +++ src/sys/external/bsd/drm2/include/linux/pagemap.h Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: pagemap.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $ */ +/* $NetBSD: pagemap.h,v 1.3 2014/08/23 08:03:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,6 +32,8 @@ #ifndef _LINUX_PAGEMAP_H_ #define _LINUX_PAGEMAP_H_ +#include <sys/types.h> + static inline int fault_in_multipages_readable(const char *uaddr __unused, size_t len __unused) { Index: src/sys/external/bsd/drm2/include/linux/pm_runtime.h diff -u src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.2 src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.3 --- src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.2 Wed Jul 16 20:59:58 2014 +++ src/sys/external/bsd/drm2/include/linux/pm_runtime.h Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: pm_runtime.h,v 1.2 2014/07/16 20:59:58 riastradh Exp $ */ +/* $NetBSD: pm_runtime.h,v 1.3 2014/08/23 08:03:33 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -56,6 +56,11 @@ pm_runtime_mark_last_busy(struct device } static inline void +pm_runtime_put(struct device *dev __unused) +{ +} + +static inline void pm_runtime_put_autosuspend(struct device *dev __unused) { } Index: src/sys/external/bsd/drm2/include/linux/spinlock.h diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.3 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.4 --- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.3 Wed Aug 6 13:53:12 2014 +++ src/sys/external/bsd/drm2/include/linux/spinlock.h Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: spinlock.h,v 1.3 2014/08/06 13:53:12 riastradh Exp $ */ +/* $NetBSD: spinlock.h,v 1.4 2014/08/23 08:03:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,6 +35,9 @@ #include <sys/cdefs.h> #include <sys/mutex.h> +#define __acquires(lock) /* XXX lockdep stuff */ +#define __releases(lock) /* XXX lockdep stuff */ + typedef struct spinlock { kmutex_t sl_lock; } spinlock_t; Index: src/sys/external/bsd/drm2/include/linux/vmalloc.h diff -u src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.3 src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.4 --- src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.3 Wed Jul 16 20:56:25 2014 +++ src/sys/external/bsd/drm2/include/linux/vmalloc.h Sat Aug 23 08:03:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vmalloc.h,v 1.3 2014/07/16 20:56:25 riastradh Exp $ */ +/* $NetBSD: vmalloc.h,v 1.4 2014/08/23 08:03:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,6 +38,19 @@ #include <linux/mm_types.h> +static inline bool +is_vmalloc_addr(void *addr) +{ + /* XXX Assumes vmalloc and kmalloc both use malloc(9). */ + return true; +} + +static inline void * +vmalloc(unsigned long size) +{ + return malloc(size, M_TEMP, M_WAITOK); +} + static inline void * vmalloc_user(unsigned long size) { Index: src/sys/external/bsd/drm2/nouveau/files.nouveau diff -u src/sys/external/bsd/drm2/nouveau/files.nouveau:1.2 src/sys/external/bsd/drm2/nouveau/files.nouveau:1.3 --- src/sys/external/bsd/drm2/nouveau/files.nouveau:1.2 Wed Aug 6 15:01:34 2014 +++ src/sys/external/bsd/drm2/nouveau/files.nouveau Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -# $NetBSD: files.nouveau,v 1.2 2014/08/06 15:01:34 riastradh Exp $ +# $NetBSD: files.nouveau,v 1.3 2014/08/23 08:03:34 riastradh Exp $ device nouveau: drmkms, drmkms_pci, drmkms_ttm, genfb, wsemuldisplaydev attach nouveau at pci @@ -29,6 +29,90 @@ makeoptions nouveau "CWARNFLAGS.nouveau_ 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" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_crypt_nv84.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_crypt_nv98.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_device_base.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_device_ctrl.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_gm107.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nv04.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nv50.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nv84.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nv94.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nva0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nva3.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nvd0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nve0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_disp_nvf0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_dmaobj_base.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_dmaobj_nv04.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_dmaobj_nv50.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_dmaobj_nvc0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_dmaobj_nvd0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nv04.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nv10.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nv108.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nv17.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nv40.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nv50.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nv84.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nvc0.c"+="-Wno-missing-field-initializers -Wno-shadow" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_fifo_nve0.c"+="-Wno-missing-field-initializers -Wno-shadow" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxgm107.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnv108.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnvc0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnvc1.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnvc4.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnvc8.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnvd7.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnvd9.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnve4.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_ctxnvf0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_gm107.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv04.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv10.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv108.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv20.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv25.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv2a.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv30.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv34.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv35.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv40.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nv50.c"+="-Wno-missing-field-initializers -Wno-shadow" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nvc0.c"+="-Wno-missing-field-initializers -Wno-shadow" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nvc1.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nvc4.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nvc8.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nvd7.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nvd9.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nve4.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_graph_nvf0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_mpeg_nv31.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_mpeg_nv40.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_mpeg_nv44.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_mpeg_nv50.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_mpeg_nv84.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_base.c"+="-Wno-missing-field-initializers -Wno-type-limits" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_daemon.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_nv40.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_nv50.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_nv84.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_nva3.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_nvc0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_nve0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_perfmon_nvf0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_ppp_nvc0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_ppp_nv98.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_software_nv04.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_software_nv10.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_software_nv50.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_software_nvc0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_vp_nv84.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_vp_nv98.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_vp_nvc0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_engine_vp_nve0.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bar_base.c"+="-Wno-missing-field-initializers" +makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bar_nvc0.c"+="-Wno-missing-field-initializers" file external/bsd/drm2/nouveau/nouveau_module.c nouveau @@ -347,21 +431,21 @@ file external/bsd/drm2/dist/drm/nouveau/ file external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_dp.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c nouveau -file external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c nouveau +#file external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_hwmon.c nouveau -file external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fbcon.c nouveau +#file external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fbcon.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_nv04_fence.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_nv17_fence.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c nouveau -file external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_fbcon.c nouveau +#file external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_fbcon.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_fence.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c nouveau -file external/bsd/drm2/dist/drm/nouveau/nouveau_nvc0_fbcon.c nouveau +#file external/bsd/drm2/dist/drm/nouveau/nouveau_nvc0_fbcon.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_nvc0_fence.c nouveau -file external/bsd/drm2/dist/drm/nouveau/nouveau_prime.c nouveau +#file external/bsd/drm2/dist/drm/nouveau/nouveau_prime.c nouveau # XXX drm prime file external/bsd/drm2/dist/drm/nouveau/nouveau_sgdma.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_sysfs.c nouveau file external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.c nouveau Index: src/sys/external/bsd/drm2/nouveau/nouveau_module.c diff -u src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.1 src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.2 --- src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.1 Wed Aug 6 13:36:07 2014 +++ src/sys/external/bsd/drm2/nouveau/nouveau_module.c Sat Aug 23 08:03:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_module.c,v 1.1 2014/08/06 13:36:07 riastradh Exp $ */ +/* $NetBSD: nouveau_module.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.1 2014/08/06 13:36:07 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $"); #include <sys/types.h> #include <sys/module.h> @@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_modu #include <drm/drmP.h> #include <core/object.h> +#include <engine/device.h> MODULE(MODULE_CLASS_DRIVER, nouveau, "drmkms,drmkms_pci"); /* XXX drmkms_i2c, drmkms_ttm */ @@ -49,6 +50,8 @@ MODULE(MODULE_CLASS_DRIVER, nouveau, "dr #include "ioconf.c" #endif +extern struct drm_driver *const nouveau_drm_driver; /* XXX */ + static int nouveau_init(void) { @@ -66,9 +69,12 @@ nouveau_init(void) } nouveau_objects_init(); + nouveau_devices_init(); #if 0 /* XXX nouveau acpi */ nouveau_register_dsm_handler(); #endif + + return 0; } int nouveau_guarantee_initialized(void); /* XXX */ @@ -91,6 +97,7 @@ nouveau_fini(void) #if 0 /* XXX nouveau acpi */ nouveau_unregister_dsm_handler(); #endif + nouveau_devices_fini(); nouveau_objects_fini(); drm_pci_exit(nouveau_drm_driver, NULL); }