drm/nvc0-/gr: remove some more of the hardcoded register writes
authorBen Skeggs <bskeggs@redhat.com>
Fri, 5 Jul 2013 00:47:26 +0000 (10:47 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 5 Jul 2013 03:45:04 +0000 (13:45 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c
drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c
drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c

index b80723e7d49fca2675a915eb1177dc19495cc9d3..64dca260912ff645c8dce1a338c56cb9ceadd1ef 100644 (file)
@@ -929,11 +929,13 @@ nvc0_grctx_generate_tpcid(struct nvc0_graph_priv *priv)
 void
 nvc0_grctx_generate_r406028(struct nvc0_graph_priv *priv)
 {
-       u32 tmp = 0, i;
+       u32 tmp[GPC_MAX / 8] = {}, i = 0;
        for (i = 0; i < priv->gpc_nr; i++)
-               tmp |= priv->tpc_nr[i] << (i * 4);
-       nv_wr32(priv, 0x406028, tmp);
-       nv_wr32(priv, 0x405870, tmp);
+               tmp[i / 8] |= priv->tpc_nr[i] << ((i % 8) * 4);
+       for (i = 0; i < 4; i++) {
+               nv_wr32(priv, 0x406028 + (i * 4), tmp[i]);
+               nv_wr32(priv, 0x405870 + (i * 4), tmp[i]);
+       }
 }
 
 void
@@ -1069,14 +1071,6 @@ nvc0_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
 
        nvc0_grctx_generate_tpcid(priv);
        nvc0_grctx_generate_r406028(priv);
-
-       nv_wr32(priv, 0x40602c, 0x00000000);
-       nv_wr32(priv, 0x405874, 0x00000000);
-       nv_wr32(priv, 0x406030, 0x00000000);
-       nv_wr32(priv, 0x405878, 0x00000000);
-       nv_wr32(priv, 0x406034, 0x00000000);
-       nv_wr32(priv, 0x40587c, 0x00000000);
-
        nvc0_grctx_generate_r4060a8(priv);
        nvc0_grctx_generate_r418bb8(priv);
        nvc0_grctx_generate_r406800(priv);
index 36fa4da66abbcf63519de4f829da20debd372422..438e784108082956fd72343d60b8f0482ff20a56 100644 (file)
@@ -231,14 +231,6 @@ nvd7_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
 
        nvc0_grctx_generate_tpcid(priv);
        nvc0_grctx_generate_r406028(priv);
-
-       nv_wr32(priv, 0x40602c, 0x00000000);
-       nv_wr32(priv, 0x405874, 0x00000000);
-       nv_wr32(priv, 0x406030, 0x00000000);
-       nv_wr32(priv, 0x405878, 0x00000000);
-       nv_wr32(priv, 0x406034, 0x00000000);
-       nv_wr32(priv, 0x40587c, 0x00000000);
-
        nvc0_grctx_generate_r4060a8(priv);
        nve4_grctx_generate_r418bb8(priv);
        nvc0_grctx_generate_r406800(priv);
index 0b72d7240b0b72b5e640133f2cc52cb36650cda1..e2de73ee5eee529696b13914b92434cf5887cc6b 100644 (file)
@@ -937,14 +937,6 @@ nve4_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
 
        nvc0_grctx_generate_tpcid(priv);
        nvc0_grctx_generate_r406028(priv);
-
-       nv_wr32(priv, 0x40602c, 0x00000000);
-       nv_wr32(priv, 0x405874, 0x00000000);
-       nv_wr32(priv, 0x406030, 0x00000000);
-       nv_wr32(priv, 0x405878, 0x00000000);
-       nv_wr32(priv, 0x406034, 0x00000000);
-       nv_wr32(priv, 0x40587c, 0x00000000);
-
        nve4_grctx_generate_r418bb8(priv);
        nvc0_grctx_generate_r406800(priv);