drm/nouveau: Fix AGP reset when AGP FW is already enabled on init.

Previously nouveau_mem_reset_agp() was only disabling AGP fast writes
when coming back from suspend. However, the "locked out of the card
because of FW" problem can also be reproduced on init if you
unload/reload nouveau.ko several times. This patch makes the AGP code
reset FW on init.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Francisco Jerez 2010-07-30 13:57:54 +02:00 committed by Ben Skeggs
parent 0d3470d218
commit 2b495268fc
1 changed files with 4 additions and 3 deletions

View File

@ -351,7 +351,7 @@ nouveau_mem_reset_agp(struct drm_device *dev)
/* First of all, disable fast writes, otherwise if it's /* First of all, disable fast writes, otherwise if it's
* already enabled in the AGP bridge and we disable the card's * already enabled in the AGP bridge and we disable the card's
* AGP controller we might be locking ourselves out of it. */ * AGP controller we might be locking ourselves out of it. */
if (dev->agp->acquired) { if (nv_rd32(dev, NV04_PBUS_PCI_NV_19) & PCI_AGP_COMMAND_FW) {
struct drm_agp_info info; struct drm_agp_info info;
struct drm_agp_mode mode; struct drm_agp_mode mode;
@ -359,7 +359,7 @@ nouveau_mem_reset_agp(struct drm_device *dev)
if (ret) if (ret)
return ret; return ret;
mode.mode = info.mode & ~0x10; mode.mode = info.mode & ~PCI_AGP_COMMAND_FW;
ret = drm_agp_enable(dev, mode); ret = drm_agp_enable(dev, mode);
if (ret) if (ret)
return ret; return ret;
@ -405,6 +405,8 @@ nouveau_mem_init_agp(struct drm_device *dev)
} }
} }
nouveau_mem_reset_agp(dev);
ret = drm_agp_info(dev, &info); ret = drm_agp_info(dev, &info);
if (ret) { if (ret) {
NV_ERROR(dev, "Unable to get AGP info: %d\n", ret); NV_ERROR(dev, "Unable to get AGP info: %d\n", ret);
@ -492,7 +494,6 @@ nouveau_mem_init(struct drm_device *dev)
/* GART */ /* GART */
#if !defined(__powerpc__) && !defined(__ia64__) #if !defined(__powerpc__) && !defined(__ia64__)
if (drm_device_is_agp(dev) && dev->agp && !nouveau_noagp) { if (drm_device_is_agp(dev) && dev->agp && !nouveau_noagp) {
nouveau_mem_reset_agp(dev);
ret = nouveau_mem_init_agp(dev); ret = nouveau_mem_init_agp(dev);
if (ret) if (ret)
NV_ERROR(dev, "Error initialising AGP: %d\n", ret); NV_ERROR(dev, "Error initialising AGP: %d\n", ret);