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 Another round of nouveau whack-a-mole.



details:   https://anonhg.NetBSD.org/src/rev/f733053e1a34
branches:  trunk
changeset: 336319:f733053e1a34
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Feb 25 14:57:04 2015 +0000

description:
Another round of nouveau whack-a-mole.

Derived from a patch by chs@.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/core/os.h                                   |   2 +
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c |  12 +-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c                      |  58 +++++++--
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c                        |  15 ++-
 sys/external/bsd/drm2/nouveau/files.nouveau                                        |   4 +-
 5 files changed, 73 insertions(+), 18 deletions(-)

diffs (231 lines):

diff -r 3763a7ff8275 -r f733053e1a34 sys/external/bsd/drm2/dist/drm/nouveau/core/os.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h  Wed Feb 25 14:56:17 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h  Wed Feb 25 14:57:04 2015 +0000
@@ -28,6 +28,8 @@
 #include <linux/list.h>
 #include <linux/spinlock.h>
 
+#include <asm/byteorder.h>
+#include <asm/io.h>
 #include <asm/unaligned.h>
 
 #ifndef __NetBSD__             /* XXX ioread */
diff -r 3763a7ff8275 -r f733053e1a34 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c        Wed Feb 25 14:56:17 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c        Wed Feb 25 14:57:04 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_bios_base.c,v 1.1.1.1 2014/08/06 12:36:28 riastradh Exp $       */
+/*     $NetBSD: nouveau_subdev_bios_base.c,v 1.2 2015/02/25 14:57:05 riastradh Exp $   */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bios_base.c,v 1.1.1.1 2014/08/06 12:36:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bios_base.c,v 1.2 2015/02/25 14:57:05 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/device.h>
@@ -262,6 +262,10 @@
        }
 }
 
+#ifdef __NetBSD__
+#  define      __iomem __pci_rom_iomem
+#endif
+
 static void
 nouveau_bios_shadow_pci(struct nouveau_bios *bios)
 {
@@ -300,6 +304,10 @@
        }
 }
 
+#ifdef __NetBSD__
+#  undef       __iomem
+#endif
+
 static int
 nouveau_bios_score(struct nouveau_bios *bios, const bool writeable)
 {
diff -r 3763a7ff8275 -r f733053e1a34 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c     Wed Feb 25 14:56:17 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c     Wed Feb 25 14:57:04 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_nv50_display.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $       */
+/*     $NetBSD: nouveau_nv50_display.c,v 1.3 2015/02/25 14:57:04 riastradh Exp $       */
 
        /*
  * Copyright 2011 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.3 2015/02/25 14:57:04 riastradh Exp $");
 
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
@@ -51,6 +51,37 @@
 #include <subdev/fb.h>
 #include <subdev/i2c.h>
 
+#ifdef __NetBSD__
+/*
+ * XXX Can't use bus_space here because this is all mapped through the
+ * nvbo_kmap abstraction.  Can't assume we're x86 because this is
+ * Nouveau, not Intel.
+ */
+
+#  define      __iomem         volatile
+#  define      readw           fake_readw
+#  define      writew          fake_writew
+
+static inline uint32_t
+fake_readw(const void __iomem *ptr)
+{
+       uint16_t v;
+
+       v = *(const uint16_t __iomem *)ptr;
+       membar_consumer();
+
+       return v;
+}
+
+static inline void
+fake_writew(uint16_t v, void __iomem *ptr)
+{
+
+       membar_producer();
+       *(uint16_t __iomem *)ptr = v;
+}
+#endif
+
 #define EVO_DMA_NR 9
 
 #define EVO_MASTER  (0x00)
@@ -151,17 +182,18 @@
 nv50_dmac_destroy(struct nouveau_object *core, struct nv50_dmac *dmac)
 {
        if (dmac->ptr) {
+               struct pci_dev *pdev = nv_device(core)->pdev;
 #ifdef __NetBSD__
-               const bus_dma_tag_t dmat = nv_device(core)->dmat;
+               /* XXX pa_dmat or pa_dmat64? */
+               const bus_dma_tag_t dmat = pdev->pd_pa.pa_dmat64;
 
-               bus_dmamem_unload(dmat, dmac->dmamap);
+               bus_dmamap_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
        }
@@ -311,7 +343,7 @@
 
 #ifdef __NetBSD__
     {
-       const bus_dma_tag_t dmat = nv_device(core)->dmat;
+       const bus_dma_tag_t dmat = nv_device(core)->pdev->pd_pa.pa_dmat64;
        int rsegs;
 
        /* XXX errno NetBSD->Linux */
@@ -336,7 +368,7 @@
                return ret;
        }
        ret = -bus_dmamap_load(dmat, dmac->dmamap, dmac->dmakva, PAGE_SIZE,
-           BUS_DMA_WAITOK);
+           NULL, BUS_DMA_WAITOK);
        if (ret) {
                bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE);
                bus_dmamap_destroy(dmat, dmac->dmamap);
@@ -1262,13 +1294,13 @@
                u16 b = nv_crtc->lut.b[i] >> 2;
 
                if (nv_mclass(disp->core) < NVD0_DISP_CLASS) {
-                       writew(r + 0x0000, lut + (i * 0x08) + 0);
-                       writew(g + 0x0000, lut + (i * 0x08) + 2);
-                       writew(b + 0x0000, lut + (i * 0x08) + 4);
+                       writew(r + 0x0000, (char __iomem *)lut + (i * 0x08) + 0);
+                       writew(g + 0x0000, (char __iomem *)lut + (i * 0x08) + 2);
+                       writew(b + 0x0000, (char __iomem *)lut + (i * 0x08) + 4);
                } else {
-                       writew(r + 0x6000, lut + (i * 0x20) + 0);
-                       writew(g + 0x6000, lut + (i * 0x20) + 2);
-                       writew(b + 0x6000, lut + (i * 0x20) + 4);
+                       writew(r + 0x6000, (char __iomem *)lut + (i * 0x20) + 0);
+                       writew(g + 0x6000, (char __iomem *)lut + (i * 0x20) + 2);
+                       writew(b + 0x6000, (char __iomem *)lut + (i * 0x20) + 4);
                }
        }
 }
diff -r 3763a7ff8275 -r f733053e1a34 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c       Wed Feb 25 14:56:17 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c       Wed Feb 25 14:57:04 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_nv84_fence.c,v 1.1.1.1 2014/08/06 12:36:23 riastradh Exp $     */
+/*     $NetBSD: nouveau_nv84_fence.c,v 1.2 2015/02/25 14:57:04 riastradh Exp $ */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv84_fence.c,v 1.1.1.1 2014/08/06 12:36:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv84_fence.c,v 1.2 2015/02/25 14:57:04 riastradh Exp $");
 
 #include <core/object.h>
 #include <core/client.h>
@@ -215,6 +215,12 @@
 nv84_fence_destroy(struct nouveau_drm *drm)
 {
        struct nv84_fence_priv *priv = drm->fence;
+
+#ifdef __NetBSD__
+       spin_lock_destroy(&priv->base.waitlock);
+       DRM_DESTROY_WAITQUEUE(&priv->base.waitqueue);
+#endif
+
        nouveau_bo_unmap(priv->bo_gart);
        if (priv->bo_gart)
                nouveau_bo_unpin(priv->bo_gart);
@@ -244,7 +250,12 @@
        priv->base.context_new = nv84_fence_context_new;
        priv->base.context_del = nv84_fence_context_del;
 
+#ifdef __NetBSD__
+       spin_lock_init(&priv->base.waitlock);
+       DRM_INIT_WAITQUEUE(&priv->base.waitqueue, "nvfenceq");
+#else
        init_waitqueue_head(&priv->base.waiting);
+#endif
        priv->base.uevent = true;
 
        ret = nouveau_bo_new(drm->dev, 16 * (pfifo->max + 1), 0,
diff -r 3763a7ff8275 -r f733053e1a34 sys/external/bsd/drm2/nouveau/files.nouveau
--- a/sys/external/bsd/drm2/nouveau/files.nouveau       Wed Feb 25 14:56:17 2015 +0000
+++ b/sys/external/bsd/drm2/nouveau/files.nouveau       Wed Feb 25 14:57:04 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.nouveau,v 1.4 2014/12/03 22:59:22 riastradh Exp $
+#      $NetBSD: files.nouveau,v 1.5 2015/02/25 14:57:04 riastradh Exp $
 
 device nouveau: drmkms, drmkms_pci, drmkms_ttm, genfb, wsemuldisplaydev
 attach nouveau at pci
@@ -112,7 +112,9 @@
 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_nv50_fence.c"+="-Wno-shadow"
+makeoptions    nouveau "CWARNFLAGS.nouveau_nv50_display.c"+="-Wno-unused-but-set-variable"
 makeoptions    nouveau "CWARNFLAGS.nouveau_subdev_bar_base.c"+="-Wno-missing-field-initializers"
+makeoptions    nouveau "CWARNFLAGS.nouveau_subdev_bar_nv50.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



Home | Main Index | Thread Index | Old Index