Commit 791dc143 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Ben Skeggs

drm/nvd0-/disp: handle case where display engine is missing/disabled

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent e99716f1
...@@ -958,6 +958,9 @@ nvd0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -958,6 +958,9 @@ nvd0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
int heads = nv_rd32(parent, 0x022448); int heads = nv_rd32(parent, 0x022448);
int ret; int ret;
if (nv_rd32(parent, 0x022500) & 0x00000001)
return -ENODEV;
ret = nouveau_disp_create(parent, engine, oclass, heads, ret = nouveau_disp_create(parent, engine, oclass, heads,
"PDISP", "display", &priv); "PDISP", "display", &priv);
*pobject = nv_object(priv); *pobject = nv_object(priv);
......
...@@ -54,6 +54,9 @@ nve0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -54,6 +54,9 @@ nve0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
int heads = nv_rd32(parent, 0x022448); int heads = nv_rd32(parent, 0x022448);
int ret; int ret;
if (nv_rd32(parent, 0x022500) & 0x00000001)
return -ENODEV;
ret = nouveau_disp_create(parent, engine, oclass, heads, ret = nouveau_disp_create(parent, engine, oclass, heads,
"PDISP", "display", &priv); "PDISP", "display", &priv);
*pobject = nv_object(priv); *pobject = nv_object(priv);
......
...@@ -54,6 +54,9 @@ nvf0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -54,6 +54,9 @@ nvf0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
int heads = nv_rd32(parent, 0x022448); int heads = nv_rd32(parent, 0x022448);
int ret; int ret;
if (nv_rd32(parent, 0x022500) & 0x00000001)
return -ENODEV;
ret = nouveau_disp_create(parent, engine, oclass, heads, ret = nouveau_disp_create(parent, engine, oclass, heads,
"PDISP", "display", &priv); "PDISP", "display", &priv);
*pobject = nv_object(priv); *pobject = nv_object(priv);
......
...@@ -85,11 +85,15 @@ static void ...@@ -85,11 +85,15 @@ static void
nouveau_bios_shadow_pramin(struct nouveau_bios *bios) nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
{ {
struct nouveau_device *device = nv_device(bios); struct nouveau_device *device = nv_device(bios);
u64 addr = 0;
u32 bar0 = 0; u32 bar0 = 0;
int i; int i;
if (device->card_type >= NV_50) { 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) { if (!addr) {
addr = (u64)nv_rd32(bios, 0x001700) << 16; addr = (u64)nv_rd32(bios, 0x001700) << 16;
addr += 0xf0000; addr += 0xf0000;
......
...@@ -73,6 +73,8 @@ nvc0_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -73,6 +73,8 @@ nvc0_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return ret; return ret;
priv->base.pll_set = nvc0_devinit_pll_set; priv->base.pll_set = nvc0_devinit_pll_set;
if (nv_rd32(priv, 0x022500) & 0x00000001)
priv->base.post = true;
return 0; return 0;
} }
......
...@@ -2051,19 +2051,14 @@ nouveau_bios_posted(struct drm_device *dev) ...@@ -2051,19 +2051,14 @@ nouveau_bios_posted(struct drm_device *dev)
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
unsigned htotal; unsigned htotal;
if (nv_device(drm->device)->card_type >= NV_50) { if (nv_device(drm->device)->card_type >= NV_50)
if (NVReadVgaCrtc(dev, 0, 0x00) == 0 &&
NVReadVgaCrtc(dev, 0, 0x1a) == 0)
return false;
return true; return true;
}
htotal = NVReadVgaCrtc(dev, 0, 0x06); htotal = NVReadVgaCrtc(dev, 0, 0x06);
htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x01) << 8; htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x01) << 8;
htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x20) << 4; htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x20) << 4;
htotal |= (NVReadVgaCrtc(dev, 0, 0x25) & 0x01) << 10; htotal |= (NVReadVgaCrtc(dev, 0, 0x25) & 0x01) << 10;
htotal |= (NVReadVgaCrtc(dev, 0, 0x41) & 0x01) << 11; htotal |= (NVReadVgaCrtc(dev, 0, 0x41) & 0x01) << 11;
return (htotal != 0); return (htotal != 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment