On Wed, Nov 5, 2008 at 2:08 PM, Jesse Barnes <[EMAIL PROTECTED]> wrote:
> Now that the radeon driver has suspend/resume functions, it needs to map its
> registers at load time or it will likely crash if a suspend operation occurs
> before the driver has been initialized.
>
> This patch moves the register mapping code from firstopen to load and makes
> the mapping into a _DRM_DRIVER one so that the core won't remove it at
> lastclose time.

Looks good.  Thanks Jesse!

Alex

>
> Fixes (at least partially) kernel bz #11891.
>
> Signed-off-by: Jesse Barnes <[EMAIL PROTECTED]>
>
> diff --git a/drivers/gpu/drm/radeon/radeon_cp.c 
> b/drivers/gpu/drm/radeon/radeon_cp.c
> index 0738948..abdc1ae 100644
> --- a/drivers/gpu/drm/radeon/radeon_cp.c
> +++ b/drivers/gpu/drm/radeon/radeon_cp.c
> @@ -1751,6 +1751,12 @@ int radeon_driver_load(struct drm_device *dev, 
> unsigned long flags)
>        else
>                dev_priv->flags |= RADEON_IS_PCI;
>
> +       ret = drm_addmap(dev, drm_get_resource_start(dev, 2),
> +                        drm_get_resource_len(dev, 2), _DRM_REGISTERS,
> +                        _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio);
> +       if (ret != 0)
> +               return ret;
> +
>        DRM_DEBUG("%s card detected\n",
>                  ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : 
> (((dev_priv->flags & RADEON_IS_PCIE) ?
> "PCIE" : "PCI"))));
>        return ret;
> @@ -1767,12 +1773,6 @@ int radeon_driver_firstopen(struct drm_device *dev)
>
>        dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE;
>
> -       ret = drm_addmap(dev, drm_get_resource_start(dev, 2),
> -                        drm_get_resource_len(dev, 2), _DRM_REGISTERS,
> -                        _DRM_READ_ONLY, &dev_priv->mmio);
> -       if (ret != 0)
> -               return ret;
> -
>        dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0);
>        ret = drm_addmap(dev, dev_priv->fb_aper_offset,
>                         drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER,
> @@ -1788,6 +1788,9 @@ int radeon_driver_unload(struct drm_device *dev)
>        drm_radeon_private_t *dev_priv = dev->dev_private;
>
>        DRM_DEBUG("\n");
> +
> +       drm_rmmap(dev, dev_priv->mmio);
> +
>        drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER);
>
>        dev->dev_private = NULL;
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> --
> _______________________________________________
> Dri-devel mailing list
> Dri-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dri-devel
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to