drm/nouveau/bios: use size/type from pci data structure
authorBen Skeggs <bskeggs@redhat.com>
Mon, 22 Sep 2014 00:51:37 +0000 (10:51 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 2 Dec 2014 05:43:40 +0000 (15:43 +1000)
The field at +0x2 is technically processor specific, though I don't know
that it's ever mattered in practice (yet).

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

index 4b2120b1fab1df27040e6b2bc0d5391f4049e826..64ed641b82b4dab5ef1f981535115e52d011c76f 100644 (file)
 
 #include <subdev/bios.h>
 #include <subdev/bios/image.h>
+#include <subdev/bios/pcir.h>
 
 static bool
 nvbios_imagen(struct nouveau_bios *bios, struct nvbios_image *image)
 {
+       struct nvbios_pcirT pcir;
+       u8  ver;
+       u16 hdr;
        u32 data;
 
        switch ((data = nv_ro16(bios, image->base + 0x00))) {
@@ -39,8 +43,10 @@ nvbios_imagen(struct nouveau_bios *bios, struct nvbios_image *image)
                return false;
        }
 
-       image->size = nv_ro08(bios, image->base + 0x02) * 512;
-       image->type = 0x00;
+       if (!(data = nvbios_pcirTp(bios, image->base, &ver, &hdr, &pcir)))
+               return false;
+       image->size = pcir.image_size;
+       image->type = pcir.image_type;
        image->last = true;
        return true;
 }