Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2 Whack some nouveau moles.



details:   https://anonhg.NetBSD.org/src/rev/e061d7aaa2e6
branches:  trunk
changeset: 798021:e061d7aaa2e6
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Aug 06 15:01:33 2014 +0000

description:
Whack some nouveau moles.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c                 |   7 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c                 |  10 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c |  22 ++++-
 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c     |  17 +++-
 sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h                      |   5 +
 sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h                      |   2 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h                      |   5 +
 sys/external/bsd/drm2/dist/drm/nouveau/core/os.h                                       |   2 +
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c                 |  10 +-
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c                |   6 +-
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c                  |  44 +++++++++-
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c             |  15 ++-
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c         |  14 +-
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c              |   6 +-
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c              |  24 ++--
 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/tvnv17.h                               |   4 +-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h                                  |   2 +
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c                                    |  32 +++++--
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c                             |  10 +-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c                               |  10 +-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c                                   |  14 ++-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c                                   |  15 ++-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h                                 |   2 +
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c                                   |  11 ++-
 sys/external/bsd/drm2/include/linux/i2c.h                                              |   3 +-
 sys/external/bsd/drm2/include/linux/mutex.h                                            |  10 ++-
 sys/external/bsd/drm2/include/linux/platform_device.h                                  |   3 +-
 sys/external/bsd/drm2/nouveau/files.nouveau                                            |  18 +++-
 28 files changed, 251 insertions(+), 72 deletions(-)

diffs (truncated from 1118 to 300 lines):

diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c    Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c    Wed Aug 06 15:01:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_core_printk.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $    */
+/*     $NetBSD: nouveau_core_printk.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $        */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_core_printk.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_core_printk.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/client.h>
@@ -67,7 +67,8 @@
        if (object && !nv_iclass(object, NV_CLIENT_CLASS)) {
                struct nouveau_object *device = object;
                struct nouveau_object *subdev = object;
-               char obuf[64], *ofmt = "";
+               char obuf[64];
+               const char *ofmt = "";
 
                if (object->engine) {
                        snprintf(obuf, sizeof(obuf), "[0x%08x][%p]",
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c    Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c    Wed Aug 06 15:01:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_core_subdev.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $    */
+/*     $NetBSD: nouveau_core_subdev.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $        */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_core_subdev.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_core_subdev.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/subdev.h>
@@ -110,7 +110,13 @@
        if (parent) {
                struct nouveau_device *device = nv_device(parent);
                subdev->debug = nouveau_dbgopt(device->dbgopt, subname);
+#ifdef __NetBSD__
+               subdev->mmiot = nv_subdev(device)->mmiot;
+               subdev->mmioh = nv_subdev(device)->mmioh;
+               subdev->mmiosz = nv_subdev(device)->mmiosz;
+#else
                subdev->mmio  = nv_subdev(device)->mmio;
+#endif
        }
 
        return 0;
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c    Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c    Wed Aug 06 15:01:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_engine_device_base.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $     */
+/*     $NetBSD: nouveau_engine_device_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $ */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/device.h>
@@ -453,6 +453,24 @@
        nouveau_engine_destroy(&device->base);
 }
 
+#ifdef __NetBSD__
+bus_space_tag_t
+nv_device_resource_tag(struct nouveau_device *device, unsigned int bar)
+{
+       if (nv_device_is_pci(device)) {
+               const struct pci_attach_args *const pa = &device->pdev->pd_pa;
+               if (PCI_MAPREG_TYPE(pci_mapreg_type(pa->pa_pc, pa->pa_tag,
+                           PCI_BAR(bar))) == PCI_MAPREG_TYPE_MEM)
+                       return pa->pa_memt;
+               else
+                       return pa->pa_iot;
+       } else {
+               /* XXX nouveau platform device */
+               panic("can't handle non-PCI nouveau devices");
+       }
+}
+#endif
+
 resource_size_t
 nv_device_resource_start(struct nouveau_device *device, unsigned int bar)
 {
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c        Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c        Wed Aug 06 15:01:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_engine_fifo_base.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $       */
+/*     $NetBSD: nouveau_engine_fifo_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $   */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
 
 #include <core/client.h>
 #include <core/object.h>
@@ -91,10 +91,19 @@
        }
 
        /* map fifo control registers */
+#ifdef __NetBSD__
+       /* XXX errno NetBSD->Linux */
+       chan->bst = nv_device_resource_tag(device, bar)
+       ret = -bus_space_map(chan->bst, nv_device_resource_start(device, bar),
+           (addr + (chan->chid * size)), 0, size, &chan->bsh);
+       if (ret)
+               return ret;
+#else
        chan->user = ioremap(nv_device_resource_start(device, bar) + addr +
                             (chan->chid * size), size);
        if (!chan->user)
                return -EFAULT;
+#endif
 
        nouveau_event_trigger(priv->cevent, 0);
 
@@ -108,7 +117,11 @@
        struct nouveau_fifo *priv = (void *)nv_object(chan)->engine;
        unsigned long flags;
 
+#ifdef __NetBSD__
+       bus_space_unmap(chan->bst, chan->bsh, chan->size);
+#else
        iounmap(chan->user);
+#endif
 
        spin_lock_irqsave(&priv->lock, flags);
        priv->channel[chan->chid] = NULL;
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h Wed Aug 06 15:01:33 2014 +0000
@@ -156,6 +156,11 @@
                                          &device->platformdev->dev;
 }
 
+#ifdef __NetBSD__
+bus_space_tag_t
+nv_device_resource_tag(struct nouveau_device *device, unsigned int bar);
+#endif
+
 resource_size_t
 nv_device_resource_start(struct nouveau_device *device, unsigned int bar);
 
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h Wed Aug 06 15:01:33 2014 +0000
@@ -41,7 +41,7 @@
 }
 
 #ifdef __NetBSD__
-void   nouveau_objcets_init(void);
+void   nouveau_objects_init(void);
 void   nouveau_objects_fini(void);
 #endif
 
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h Wed Aug 06 15:01:33 2014 +0000
@@ -9,7 +9,12 @@
        struct nouveau_namedb base;
        struct nouveau_dmaobj *pushdma;
        struct nouveau_gpuobj *pushgpu;
+#ifdef __NetBSD__
+       bus_space_tag_t bst;
+       bus_space_handle_t bsh;
+#else
        void __iomem *user;
+#endif
        u32 size;
        u16 chid;
        atomic_t refcnt; /* NV04_NVSW_SET_REF */
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/core/os.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h  Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h  Wed Aug 06 15:01:33 2014 +0000
@@ -30,6 +30,7 @@
 
 #include <asm/unaligned.h>
 
+#ifndef __NetBSD__             /* XXX ioread */
 #ifndef ioread32_native
 #ifdef __BIG_ENDIAN
 #define ioread16_native ioread16be
@@ -43,5 +44,6 @@
 #define iowrite32_native iowrite32
 #endif /* def __BIG_ENDIAN else */
 #endif /* !ioread32_native */
+#endif
 
 #endif
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c    Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c    Wed Aug 06 15:01:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_dispnv04_arb.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $   */
+/*     $NetBSD: nouveau_dispnv04_arb.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $       */
 
 /*
  * Copyright 1993-2003 NVIDIA, Corporation
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_arb.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_arb.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
 
 #include <drm/drmP.h>
 
@@ -60,8 +60,8 @@
 static void
 nv04_calc_arb(struct nv_fifo_info *fifo, struct nv_sim_state *arb)
 {
-       int pagemiss, cas, width, bpp;
-       int nvclks, mclks, pclks, crtpagemiss;
+       int pagemiss, cas, bpp;
+       int nvclks, mclks, crtpagemiss;
        int found, mclk_extra, mclk_loop, cbs, m1, p1;
        int mclk_freq, pclk_freq, nvclk_freq;
        int us_m, us_n, us_p, crtc_drain_rate;
@@ -72,11 +72,9 @@
        nvclk_freq = arb->nvclk_khz;
        pagemiss = arb->mem_page_miss;
        cas = arb->mem_latency;
-       width = arb->memory_width >> 6;
        bpp = arb->bpp;
        cbs = 128;
 
-       pclks = 2;
        nvclks = 10;
        mclks = 13 + cas;
        mclk_extra = 3;
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c   Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c   Wed Aug 06 15:01:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_dispnv04_disp.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $  */
+/*     $NetBSD: nouveau_dispnv04_disp.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $      */
 
 /*
  * Copyright 2009 Red Hat Inc.
@@ -25,7 +25,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_disp.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_disp.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
+
+#include <linux/err.h>
 
 #include <core/object.h>
 #include <core/class.h>
diff -r d761353d01af -r e061d7aaa2e6 sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c     Wed Aug 06 14:23:53 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c     Wed Aug 06 15:01:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_dispnv04_hw.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $    */
+/*     $NetBSD: nouveau_dispnv04_hw.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $        */
 
 /*
  * Copyright 2006 Dave Airlie
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_hw.c,v 1.1.1.1 2014/08/06 12:36:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_dispnv04_hw.c,v 1.2 2014/08/06 15:01:34 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include "nouveau_drm.h"
@@ -290,7 +290,12 @@
  */
 
 static void nouveau_vga_font_io(struct drm_device *dev,
+#ifdef __NetBSD__
+                               bus_space_tag_t iovramt,
+                               bus_space_handle_t iovramh,



Home | Main Index | Thread Index | Old Index