drm/nouveau/core: fix the assumption that NVDEV_XXXX is always under 32
authorMartin Peres <martin.peres@labri.fr>
Mon, 26 Nov 2012 23:30:32 +0000 (00:30 +0100)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 28 Nov 2012 23:58:09 +0000 (09:58 +1000)
It fixes a bug that would have been introduced when adding more
sudevs/engines.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/fifo/base.c
drivers/gpu/drm/nouveau/core/engine/fifo/nv04.c
drivers/gpu/drm/nouveau/core/engine/fifo/nv10.c
drivers/gpu/drm/nouveau/core/engine/fifo/nv17.c
drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c
drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c
drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c
drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
drivers/gpu/drm/nouveau/core/include/core/parent.h
drivers/gpu/drm/nouveau/core/include/engine/fifo.h

index a7f41f8725cd51121d5a6bea489c4404e4707226..c2b9db33581626483cdd38dc6f2976eec669357e 100644 (file)
@@ -34,7 +34,7 @@ nouveau_fifo_channel_create_(struct nouveau_object *parent,
                             struct nouveau_object *engine,
                             struct nouveau_oclass *oclass,
                             int bar, u32 addr, u32 size, u32 pushbuf,
-                            u32 engmask, int len, void **ptr)
+                            u64 engmask, int len, void **ptr)
 {
        struct nouveau_device *device = nv_device(engine);
        struct nouveau_fifo *priv = (void *)engine;
index 1147aec96a68dff4b81c07712b56a0e27596dc69..8b4829ee4bd66199da91b0cf701a7b8dd3a4bc42 100644 (file)
@@ -126,9 +126,9 @@ nv04_fifo_chan_ctor(struct nouveau_object *parent,
 
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 0, 0x800000,
                                          0x10000, args->pushbuf,
-                                         (1 << NVDEV_ENGINE_DMAOBJ) |
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR), &chan);
+                                         (1ULL << NVDEV_ENGINE_DMAOBJ) |
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR), &chan);
        *pobject = nv_object(chan);
        if (ret)
                return ret;
index 4ba75422b89dd406be7bdd3e1b8f4eb0c638e939..2c927c1d173bdb9cfae210f57256af68d6f2e75f 100644 (file)
@@ -69,9 +69,9 @@ nv10_fifo_chan_ctor(struct nouveau_object *parent,
 
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 0, 0x800000,
                                          0x10000, args->pushbuf,
-                                         (1 << NVDEV_ENGINE_DMAOBJ) |
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR), &chan);
+                                         (1ULL << NVDEV_ENGINE_DMAOBJ) |
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR), &chan);
        *pobject = nv_object(chan);
        if (ret)
                return ret;
index b96e6b0ae2b18088640ef0dbb09ee4bd827d632c..a9cb51d38c5784bf6c55679ac21e600075d25263 100644 (file)
@@ -74,10 +74,10 @@ nv17_fifo_chan_ctor(struct nouveau_object *parent,
 
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 0, 0x800000,
                                          0x10000, args->pushbuf,
-                                         (1 << NVDEV_ENGINE_DMAOBJ) |
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR) |
-                                         (1 << NVDEV_ENGINE_MPEG), /* NV31- */
+                                         (1ULL << NVDEV_ENGINE_DMAOBJ) |
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR) |
+                                         (1ULL << NVDEV_ENGINE_MPEG), /* NV31- */
                                          &chan);
        *pobject = nv_object(chan);
        if (ret)
index 559c3b4e1b867cf691384657f0eb30839f39edbb..2b1f917212255059340855b155eea71793a87feb 100644 (file)
@@ -192,10 +192,10 @@ nv40_fifo_chan_ctor(struct nouveau_object *parent,
 
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 0, 0xc00000,
                                          0x1000, args->pushbuf,
-                                         (1 << NVDEV_ENGINE_DMAOBJ) |
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR) |
-                                         (1 << NVDEV_ENGINE_MPEG), &chan);
+                                         (1ULL << NVDEV_ENGINE_DMAOBJ) |
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR) |
+                                         (1ULL << NVDEV_ENGINE_MPEG), &chan);
        *pobject = nv_object(chan);
        if (ret)
                return ret;
index 536e7634a00d26fdb4145479164653cd71961307..3d3ed547ed4c6d762c27ebeeedeb225349c93ab0 100644 (file)
@@ -194,10 +194,10 @@ nv50_fifo_chan_ctor_dma(struct nouveau_object *parent,
 
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 0, 0xc00000,
                                          0x2000, args->pushbuf,
-                                         (1 << NVDEV_ENGINE_DMAOBJ) |
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR) |
-                                         (1 << NVDEV_ENGINE_MPEG), &chan);
+                                         (1ULL << NVDEV_ENGINE_DMAOBJ) |
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR) |
+                                         (1ULL << NVDEV_ENGINE_MPEG), &chan);
        *pobject = nv_object(chan);
        if (ret)
                return ret;
@@ -247,10 +247,10 @@ nv50_fifo_chan_ctor_ind(struct nouveau_object *parent,
 
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 0, 0xc00000,
                                          0x2000, args->pushbuf,
-                                         (1 << NVDEV_ENGINE_DMAOBJ) |
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR) |
-                                         (1 << NVDEV_ENGINE_MPEG), &chan);
+                                         (1ULL << NVDEV_ENGINE_DMAOBJ) |
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR) |
+                                         (1ULL << NVDEV_ENGINE_MPEG), &chan);
        *pobject = nv_object(chan);
        if (ret)
                return ret;
index b4fd26d8f166926849c10c4ad9251f2e868dff4f..7969df948cfa66f990e9d41f3064f2ee5d73e2ba 100644 (file)
@@ -163,17 +163,17 @@ nv84_fifo_chan_ctor_dma(struct nouveau_object *parent,
 
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 0, 0xc00000,
                                          0x2000, args->pushbuf,
-                                         (1 << NVDEV_ENGINE_DMAOBJ) |
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR) |
-                                         (1 << NVDEV_ENGINE_MPEG) |
-                                         (1 << NVDEV_ENGINE_ME) |
-                                         (1 << NVDEV_ENGINE_VP) |
-                                         (1 << NVDEV_ENGINE_CRYPT) |
-                                         (1 << NVDEV_ENGINE_BSP) |
-                                         (1 << NVDEV_ENGINE_PPP) |
-                                         (1 << NVDEV_ENGINE_COPY0) |
-                                         (1 << NVDEV_ENGINE_UNK1C1), &chan);
+                                         (1ULL << NVDEV_ENGINE_DMAOBJ) |
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR) |
+                                         (1ULL << NVDEV_ENGINE_MPEG) |
+                                         (1ULL << NVDEV_ENGINE_ME) |
+                                         (1ULL << NVDEV_ENGINE_VP) |
+                                         (1ULL << NVDEV_ENGINE_CRYPT) |
+                                         (1ULL << NVDEV_ENGINE_BSP) |
+                                         (1ULL << NVDEV_ENGINE_PPP) |
+                                         (1ULL << NVDEV_ENGINE_COPY0) |
+                                         (1ULL << NVDEV_ENGINE_UNK1C1), &chan);
        *pobject = nv_object(chan);
        if (ret)
                return ret;
@@ -225,17 +225,17 @@ nv84_fifo_chan_ctor_ind(struct nouveau_object *parent,
 
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 0, 0xc00000,
                                          0x2000, args->pushbuf,
-                                         (1 << NVDEV_ENGINE_DMAOBJ) |
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR) |
-                                         (1 << NVDEV_ENGINE_MPEG) |
-                                         (1 << NVDEV_ENGINE_ME) |
-                                         (1 << NVDEV_ENGINE_VP) |
-                                         (1 << NVDEV_ENGINE_CRYPT) |
-                                         (1 << NVDEV_ENGINE_BSP) |
-                                         (1 << NVDEV_ENGINE_PPP) |
-                                         (1 << NVDEV_ENGINE_COPY0) |
-                                         (1 << NVDEV_ENGINE_UNK1C1), &chan);
+                                         (1ULL << NVDEV_ENGINE_DMAOBJ) |
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR) |
+                                         (1ULL << NVDEV_ENGINE_MPEG) |
+                                         (1ULL << NVDEV_ENGINE_ME) |
+                                         (1ULL << NVDEV_ENGINE_VP) |
+                                         (1ULL << NVDEV_ENGINE_CRYPT) |
+                                         (1ULL << NVDEV_ENGINE_BSP) |
+                                         (1ULL << NVDEV_ENGINE_PPP) |
+                                         (1ULL << NVDEV_ENGINE_COPY0) |
+                                         (1ULL << NVDEV_ENGINE_UNK1C1), &chan);
        *pobject = nv_object(chan);
        if (ret)
                return ret;
index d7c3f3ef30aebb56af6fb88bc58984a4819f3ebd..048a421960ce8654b2430d4ca8892e8730d29af6 100644 (file)
@@ -181,13 +181,13 @@ nvc0_fifo_chan_ctor(struct nouveau_object *parent,
        ret = nouveau_fifo_channel_create(parent, engine, oclass, 1,
                                          priv->user.bar.offset, 0x1000,
                                          args->pushbuf,
-                                         (1 << NVDEV_ENGINE_SW) |
-                                         (1 << NVDEV_ENGINE_GR) |
-                                         (1 << NVDEV_ENGINE_COPY0) |
-                                         (1 << NVDEV_ENGINE_COPY1) |
-                                         (1 << NVDEV_ENGINE_BSP) |
-                                         (1 << NVDEV_ENGINE_VP) |
-                                         (1 << NVDEV_ENGINE_PPP), &chan);
+                                         (1ULL << NVDEV_ENGINE_SW) |
+                                         (1ULL << NVDEV_ENGINE_GR) |
+                                         (1ULL << NVDEV_ENGINE_COPY0) |
+                                         (1ULL << NVDEV_ENGINE_COPY1) |
+                                         (1ULL << NVDEV_ENGINE_BSP) |
+                                         (1ULL << NVDEV_ENGINE_VP) |
+                                         (1ULL << NVDEV_ENGINE_PPP), &chan);
        *pobject = nv_object(chan);
        if (ret)
                return ret;
index 1dcbe25e7af604ac5a489489042cd8ddf46f0ed4..9df59c028e45cde4aaf2a700f1cbfbdf4dce6de4 100644 (file)
 #include <engine/dmaobj.h>
 #include <engine/fifo.h>
 
-#define _(a,b) { (a), ((1 << (a)) | (b)) }
+#define _(a,b) { (a), ((1ULL << (a)) | (b)) }
 static const struct {
-       int subdev;
-       u32 mask;
+       u64 subdev;
+       u64 mask;
 } fifo_engine[] = {
-       _(NVDEV_ENGINE_GR      , (1 << NVDEV_ENGINE_SW)),
+       _(NVDEV_ENGINE_GR      , (1ULL << NVDEV_ENGINE_SW)),
        _(NVDEV_ENGINE_VP      , 0),
        _(NVDEV_ENGINE_PPP     , 0),
        _(NVDEV_ENGINE_BSP     , 0),
index 3c2e940eb0f83525f5d61b9acd7825f37ed7ba5b..31cd852c96dfccc8c12fca4f40082850b926eba3 100644 (file)
@@ -14,7 +14,7 @@ struct nouveau_parent {
        struct nouveau_object base;
 
        struct nouveau_sclass *sclass;
-       u32 engine;
+       u64 engine;
 
        int  (*context_attach)(struct nouveau_object *,
                               struct nouveau_object *);
index 039bd19c363863682a9519b98a43c17ee665a212..f18846c8c6febce1cbb6900fb3e1bd19b6b9d76e 100644 (file)
@@ -33,7 +33,7 @@ int  nouveau_fifo_channel_create_(struct nouveau_object *,
                                  struct nouveau_object *,
                                  struct nouveau_oclass *,
                                  int bar, u32 addr, u32 size, u32 push,
-                                 u32 engmask, int len, void **);
+                                 u64 engmask, int len, void **);
 void nouveau_fifo_channel_destroy(struct nouveau_fifo_chan *);
 
 #define _nouveau_fifo_channel_init _nouveau_namedb_init