aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-05-24 23:47:16 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-05-28 02:06:28 -0400
commitd13102c6b4836289138431e3fbfc08e90c925ffd (patch)
tree5208465fcf72117479373789909a06de6a06b3e5 /drivers
parent7fc74f17e6c9b4d86371c3a947afc32bd6bc9691 (diff)
drm/nouveau: fix POST detection for certain chipsets
We totally fail at detecting un-POSTed chipsets prior to G80. This commit changes the pre-G80 POST detection to read the programmed horizontal total from CRTC 0, and assume the card isn't POSTed if it's 0. NVIDIA use some other heuristics more similar to what we do on G80, but I wasted quite a long time trying to figure out the exact specifics of what they do so we can try this for a bit instead. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index e7e69ccce5c9..61d932261356 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -6205,6 +6205,30 @@ nouveau_bios_i2c_devices_takedown(struct drm_device *dev)
6205 nouveau_i2c_fini(dev, entry); 6205 nouveau_i2c_fini(dev, entry);
6206} 6206}
6207 6207
6208static bool
6209nouveau_bios_posted(struct drm_device *dev)
6210{
6211 struct drm_nouveau_private *dev_priv = dev->dev_private;
6212 bool was_locked;
6213 unsigned htotal;
6214
6215 if (dev_priv->chipset >= NV_50) {
6216 if (NVReadVgaCrtc(dev, 0, 0x00) == 0 &&
6217 NVReadVgaCrtc(dev, 0, 0x1a) == 0)
6218 return false;
6219 return true;
6220 }
6221
6222 was_locked = NVLockVgaCrtcs(dev, false);
6223 htotal = NVReadVgaCrtc(dev, 0, 0x06);
6224 htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x01) << 8;
6225 htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x20) << 4;
6226 htotal |= (NVReadVgaCrtc(dev, 0, 0x25) & 0x01) << 10;
6227 htotal |= (NVReadVgaCrtc(dev, 0, 0x41) & 0x01) << 11;
6228 NVLockVgaCrtcs(dev, was_locked);
6229 return (htotal != 0);
6230}
6231
6208int 6232int
6209nouveau_bios_init(struct drm_device *dev) 6233nouveau_bios_init(struct drm_device *dev)
6210{ 6234{
@@ -6239,9 +6263,7 @@ nouveau_bios_init(struct drm_device *dev)
6239 bios->execute = false; 6263 bios->execute = false;
6240 6264
6241 /* ... unless card isn't POSTed already */ 6265 /* ... unless card isn't POSTed already */
6242 if (dev_priv->card_type >= NV_10 && 6266 if (!nouveau_bios_posted(dev)) {
6243 NVReadVgaCrtc(dev, 0, 0x00) == 0 &&
6244 NVReadVgaCrtc(dev, 0, 0x1a) == 0) {
6245 NV_INFO(dev, "Adaptor not initialised\n"); 6267 NV_INFO(dev, "Adaptor not initialised\n");
6246 if (dev_priv->card_type < NV_50) { 6268 if (dev_priv->card_type < NV_50) {
6247 NV_ERROR(dev, "Unable to POST this chipset\n"); 6269 NV_ERROR(dev, "Unable to POST this chipset\n");