Skip to content

Commit

Permalink
drm/nouveau/bios: fix shadowing from PROM on big-endian systems
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed May 2, 2014
1 parent a3d0b12 commit ce23b23
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/gpu/drm/nouveau/core/subdev/bios/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,24 @@ 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--);

if (!i)
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 */
Expand Down

0 comments on commit ce23b23

Please sign in to comment.