]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/nouveau/bios: add more checks to PRAMIN image fetching
authorBen Skeggs <bskeggs@redhat.com>
Wed, 26 Feb 2014 00:14:15 +0000 (10:14 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 26 Mar 2014 04:08:05 +0000 (14:08 +1000)
Prevents an attempt to access VRAM on an un-posted board, which, on a
particular system with a GRID K1 installed, causes a MCE and chokes
the entire system.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/subdev/bios/base.c

index 13bb829f959cec50117f7024dafc3c7c49818994..56085304a847687b421a40b498110709ef013e33 100644 (file)
@@ -99,7 +99,17 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
                                return;
                }
 
-               addr = (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8;
+               addr = nv_rd32(bios, 0x619f04);
+               if (!(addr & 0x00000008)) {
+                       nv_debug(bios, "... not enabled\n");
+                       return;
+               }
+               if ( (addr & 0x00000003) != 1) {
+                       nv_debug(bios, "... not in vram\n");
+                       return;
+               }
+
+               addr = (u64)(addr >> 8) << 8;
                if (!addr) {
                        addr  = (u64)nv_rd32(bios, 0x001700) << 16;
                        addr += 0xf0000;