diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-03-31 13:25:09 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-05-02 16:18:32 +1000 |
commit | 661b5426fe6dc51f33ad8387846d3cc5c5107d14 (patch) | |
tree | 392c4bab76e8b13044a85f8455a4641df75e3813 /nvkm/subdev | |
parent | f8c7f0822d2f1ee2f0e3d56008910b91ed93d6a2 (diff) | |
download | nouveau-661b5426fe6dc51f33ad8387846d3cc5c5107d14.tar.gz |
bios: fix shadowing from PROM on big-endian systems
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nvkm/subdev')
-rw-r--r-- | nvkm/subdev/bios/base.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/nvkm/subdev/bios/base.c b/nvkm/subdev/bios/base.c index fb0b6b2d1..222e8ebb6 100644 --- a/nvkm/subdev/bios/base.c +++ b/nvkm/subdev/bios/base.c @@ -168,7 +168,8 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios) */ i = 16; do { - if ((nv_rd32(bios, 0x300000) & 0xffff) == 0xaa55) + u32 data = le32_to_cpu(nv_rd32(bios, 0x300000)) & 0xffff; + if (data == 0xaa55) break; } while (i--); @@ -176,14 +177,15 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios) goto out; /* read entire bios image to system memory */ - bios->size = ((nv_rd32(bios, 0x300000) >> 16) & 0xff) * 512; + bios->size = (le32_to_cpu(nv_rd32(bios, 0x300000)) >> 16) & 0xff; + bios->size = bios->size * 512; if (!bios->size) goto out; bios->data = kmalloc(bios->size, GFP_KERNEL); if (bios->data) { - for (i = 0; i < bios->size; i+=4) - nv_wo32(bios, i, nv_rd32(bios, 0x300000 + i)); + for (i = 0; i < bios->size; i += 4) + ((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i); } /* check the PCI record header */ |