drm/nvd0-/disp: handle case where display engine is missing/disabled
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>
Thu, 27 Jun 2013 07:35:53 +0000 (17:35 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 1 Jul 2013 03:50:50 +0000 (13:50 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
drivers/gpu/drm/nouveau/core/engine/disp/nve0.c
drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c
drivers/gpu/drm/nouveau/core/subdev/bios/base.c
drivers/gpu/drm/nouveau/core/subdev/devinit/nvc0.c
drivers/gpu/drm/nouveau/nouveau_bios.c

index 3ed10b00e81cbaba22fa79bb44cf7096b65eeeeb..52dd7a1db729fdf086607cf703a210ec9aeba125 100644 (file)
@@ -958,6 +958,9 @@ nvd0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        int heads = nv_rd32(parent, 0x022448);
        int ret;
 
+       if (nv_rd32(parent, 0x022500) & 0x00000001)
+               return -ENODEV;
+
        ret = nouveau_disp_create(parent, engine, oclass, heads,
                                  "PDISP", "display", &priv);
        *pobject = nv_object(priv);
index 20725b363d582b3485b55f5ef4692247d20adce2..fb1fe6ae5e74ddbd6f3336a3d34de8eb58757b5b 100644 (file)
@@ -54,6 +54,9 @@ nve0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        int heads = nv_rd32(parent, 0x022448);
        int ret;
 
+       if (nv_rd32(parent, 0x022500) & 0x00000001)
+               return -ENODEV;
+
        ret = nouveau_disp_create(parent, engine, oclass, heads,
                                  "PDISP", "display", &priv);
        *pobject = nv_object(priv);
index a488c36e40f9dc0d7923362dd1c09e346b37b7dd..42aa6b97dbea3c5867676f0209151a1ead3a849d 100644 (file)
@@ -54,6 +54,9 @@ nvf0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        int heads = nv_rd32(parent, 0x022448);
        int ret;
 
+       if (nv_rd32(parent, 0x022500) & 0x00000001)
+               return -ENODEV;
+
        ret = nouveau_disp_create(parent, engine, oclass, heads,
                                  "PDISP", "display", &priv);
        *pobject = nv_object(priv);
index 0e2c1a4f16595b09a5fa2023ac93691fd74da3b9..aa0fbbec7f08212cd8b3106ecb57ec4ff491403b 100644 (file)
@@ -85,11 +85,15 @@ static void
 nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
 {
        struct nouveau_device *device = nv_device(bios);
+       u64 addr = 0;
        u32 bar0 = 0;
        int i;
 
        if (device->card_type >= NV_50) {
-               u64 addr = (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8;
+               if (  device->card_type < NV_C0 ||
+                   !(nv_rd32(bios, 0x022500) & 0x00000001))
+                       addr = (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8;
+
                if (!addr) {
                        addr  = (u64)nv_rd32(bios, 0x001700) << 16;
                        addr += 0xf0000;
index dd78efbcae1a09a8e47f3de8bbbd919d872c8023..af407a8637c70abf4a893276390f75775fda9814 100644 (file)
@@ -73,6 +73,8 @@ nvc0_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
                return ret;
 
        priv->base.pll_set = nvc0_devinit_pll_set;
+       if (nv_rd32(priv, 0x022500) & 0x00000001)
+               priv->base.post = true;
        return 0;
 }
 
index e09817df7934ce861d92d2619fdc959dc48ec77f..3e7287675ecf627fb3e6db850548e363e7ad2772 100644 (file)
@@ -2051,19 +2051,14 @@ nouveau_bios_posted(struct drm_device *dev)
        struct nouveau_drm *drm = nouveau_drm(dev);
        unsigned htotal;
 
-       if (nv_device(drm->device)->card_type >= NV_50) {
-               if (NVReadVgaCrtc(dev, 0, 0x00) == 0 &&
-                   NVReadVgaCrtc(dev, 0, 0x1a) == 0)
-                       return false;
+       if (nv_device(drm->device)->card_type >= NV_50)
                return true;
-       }
 
        htotal  = NVReadVgaCrtc(dev, 0, 0x06);
        htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x01) << 8;
        htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x20) << 4;
        htotal |= (NVReadVgaCrtc(dev, 0, 0x25) & 0x01) << 10;
        htotal |= (NVReadVgaCrtc(dev, 0, 0x41) & 0x01) << 11;
-
        return (htotal != 0);
 }