Author: dumbbell
Date: Sat Sep 14 17:24:41 2013
New Revision: 255573
URL: http://svnweb.freebsd.org/changeset/base/255573

Log:
  drm/radeon: Fix usage of pci_save_state() and pci_restore_state()
  
  Calling those functions with the drmn device as argument causes a panic,
  because it's not a direct child of pci$N. They must be called with the
  vgapci device instead.
  
  This fix is not enough to make suspend/resume work reliably.
  
  Approved by:  re (blanket)

Modified:
  head/sys/dev/drm2/radeon/r100.c
  head/sys/dev/drm2/radeon/r300.c
  head/sys/dev/drm2/radeon/radeon_device.c
  head/sys/dev/drm2/radeon/rs600.c

Modified: head/sys/dev/drm2/radeon/r100.c
==============================================================================
--- head/sys/dev/drm2/radeon/r100.c     Sat Sep 14 17:22:34 2013        
(r255572)
+++ head/sys/dev/drm2/radeon/r100.c     Sat Sep 14 17:24:41 2013        
(r255573)
@@ -2647,7 +2647,7 @@ int r100_asic_reset(struct radeon_device
        WREG32(RADEON_CP_RB_WPTR, 0);
        WREG32(RADEON_CP_RB_CNTL, tmp);
        /* save PCI state */
-       pci_save_state(rdev->dev);
+       pci_save_state(device_get_parent(rdev->dev));
        /* disable bus mastering */
        r100_bm_disable(rdev);
        WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_SE(1) |
@@ -2669,7 +2669,7 @@ int r100_asic_reset(struct radeon_device
        status = RREG32(R_000E40_RBBM_STATUS);
        dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, 
status);
        /* restore PCI & busmastering */
-       pci_restore_state(rdev->dev);
+       pci_restore_state(device_get_parent(rdev->dev));
        r100_enable_bm(rdev);
        /* Check if GPU is idle */
        if (G_000E40_SE_BUSY(status) || G_000E40_RE_BUSY(status) ||

Modified: head/sys/dev/drm2/radeon/r300.c
==============================================================================
--- head/sys/dev/drm2/radeon/r300.c     Sat Sep 14 17:22:34 2013        
(r255572)
+++ head/sys/dev/drm2/radeon/r300.c     Sat Sep 14 17:24:41 2013        
(r255573)
@@ -401,7 +401,7 @@ int r300_asic_reset(struct radeon_device
        WREG32(RADEON_CP_RB_WPTR, 0);
        WREG32(RADEON_CP_RB_CNTL, tmp);
        /* save PCI state */
-       pci_save_state(rdev->dev);
+       pci_save_state(device_get_parent(rdev->dev));
        /* disable bus mastering */
        r100_bm_disable(rdev);
        WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_VAP(1) |
@@ -425,7 +425,7 @@ int r300_asic_reset(struct radeon_device
        status = RREG32(R_000E40_RBBM_STATUS);
        dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, 
status);
        /* restore PCI & busmastering */
-       pci_restore_state(rdev->dev);
+       pci_restore_state(device_get_parent(rdev->dev));
        r100_enable_bm(rdev);
        /* Check if GPU is idle */
        if (G_000E40_GA_BUSY(status) || G_000E40_VAP_BUSY(status)) {

Modified: head/sys/dev/drm2/radeon/radeon_device.c
==============================================================================
--- head/sys/dev/drm2/radeon/radeon_device.c    Sat Sep 14 17:22:34 2013        
(r255572)
+++ head/sys/dev/drm2/radeon/radeon_device.c    Sat Sep 14 17:24:41 2013        
(r255573)
@@ -1316,7 +1316,7 @@ int radeon_suspend_kms(struct drm_device
 
        radeon_agp_suspend(rdev);
 
-       pci_save_state(dev->device);
+       pci_save_state(device_get_parent(rdev->dev));
 #ifdef DUMBBELL_WIP
        if (state.event == PM_EVENT_SUSPEND) {
                /* Shut down the device */
@@ -1356,7 +1356,7 @@ int radeon_resume_kms(struct drm_device 
        console_lock();
 #endif /* DUMBBELL_WIP */
        pci_set_powerstate(dev->device, PCI_POWERSTATE_D0);
-       pci_restore_state(dev->device);
+       pci_restore_state(device_get_parent(rdev->dev));
 #ifdef DUMBBELL_WIP
        if (pci_enable_device(dev->pdev)) {
                console_unlock();

Modified: head/sys/dev/drm2/radeon/rs600.c
==============================================================================
--- head/sys/dev/drm2/radeon/rs600.c    Sat Sep 14 17:22:34 2013        
(r255572)
+++ head/sys/dev/drm2/radeon/rs600.c    Sat Sep 14 17:24:41 2013        
(r255573)
@@ -373,7 +373,7 @@ int rs600_asic_reset(struct radeon_devic
        WREG32(RADEON_CP_RB_RPTR_WR, 0);
        WREG32(RADEON_CP_RB_WPTR, 0);
        WREG32(RADEON_CP_RB_CNTL, tmp);
-       pci_save_state(rdev->dev);
+       pci_save_state(device_get_parent(rdev->dev));
        /* disable bus mastering */
        pci_disable_busmaster(rdev->dev);
        DRM_MDELAY(1);
@@ -403,7 +403,7 @@ int rs600_asic_reset(struct radeon_devic
        status = RREG32(R_000E40_RBBM_STATUS);
        dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, 
status);
        /* restore PCI & busmastering */
-       pci_restore_state(rdev->dev);
+       pci_restore_state(device_get_parent(rdev->dev));
        /* Check if GPU is idle */
        if (G_000E40_GA_BUSY(status) || G_000E40_VAP_BUSY(status)) {
                dev_err(rdev->dev, "failed to reset GPU\n");
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to