Commit 81a54877 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Ben Skeggs

nouveau: Fix endianness with new context program loader

When switching to request_firmware() to load the context programs,
some endian fixes need to be applied. This makes it work again on
my quad g5 nvidia 6600.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent b694dfb2
...@@ -252,8 +252,9 @@ nv40_grctx_init(struct drm_device *dev) ...@@ -252,8 +252,9 @@ nv40_grctx_init(struct drm_device *dev)
memcpy(pgraph->ctxprog, fw->data, fw->size); memcpy(pgraph->ctxprog, fw->data, fw->size);
cp = pgraph->ctxprog; cp = pgraph->ctxprog;
if (cp->signature != 0x5043564e || cp->version != 0 || if (le32_to_cpu(cp->signature) != 0x5043564e ||
cp->length != ((fw->size - 7) / 4)) { cp->version != 0 ||
le16_to_cpu(cp->length) != ((fw->size - 7) / 4)) {
NV_ERROR(dev, "ctxprog invalid\n"); NV_ERROR(dev, "ctxprog invalid\n");
release_firmware(fw); release_firmware(fw);
nv40_grctx_fini(dev); nv40_grctx_fini(dev);
...@@ -281,8 +282,9 @@ nv40_grctx_init(struct drm_device *dev) ...@@ -281,8 +282,9 @@ nv40_grctx_init(struct drm_device *dev)
memcpy(pgraph->ctxvals, fw->data, fw->size); memcpy(pgraph->ctxvals, fw->data, fw->size);
cv = (void *)pgraph->ctxvals; cv = (void *)pgraph->ctxvals;
if (cv->signature != 0x5643564e || cv->version != 0 || if (le32_to_cpu(cv->signature) != 0x5643564e ||
cv->length != ((fw->size - 9) / 8)) { cv->version != 0 ||
le32_to_cpu(cv->length) != ((fw->size - 9) / 8)) {
NV_ERROR(dev, "ctxvals invalid\n"); NV_ERROR(dev, "ctxvals invalid\n");
release_firmware(fw); release_firmware(fw);
nv40_grctx_fini(dev); nv40_grctx_fini(dev);
...@@ -294,8 +296,9 @@ nv40_grctx_init(struct drm_device *dev) ...@@ -294,8 +296,9 @@ nv40_grctx_init(struct drm_device *dev)
cp = pgraph->ctxprog; cp = pgraph->ctxprog;
nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0); nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
for (i = 0; i < cp->length; i++) for (i = 0; i < le16_to_cpu(cp->length); i++)
nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp->data[i]); nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA,
le32_to_cpu(cp->data[i]));
pgraph->accel_blocked = false; pgraph->accel_blocked = false;
return 0; return 0;
...@@ -329,8 +332,9 @@ nv40_grctx_vals_load(struct drm_device *dev, struct nouveau_gpuobj *ctx) ...@@ -329,8 +332,9 @@ nv40_grctx_vals_load(struct drm_device *dev, struct nouveau_gpuobj *ctx)
if (!cv) if (!cv)
return; return;
for (i = 0; i < cv->length; i++) for (i = 0; i < le32_to_cpu(cv->length); i++)
nv_wo32(dev, ctx, cv->data[i].offset, cv->data[i].value); nv_wo32(dev, ctx, le32_to_cpu(cv->data[i].offset),
le32_to_cpu(cv->data[i].value));
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment