Commit 78538bf1 authored by Dave Airlie's avatar Dave Airlie

drm/radeon: map registers at load time

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.

Fixes (at least partially) kernel bz #11891.
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 5d8e6bb7
...@@ -1751,6 +1751,12 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1751,6 +1751,12 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
else else
dev_priv->flags |= RADEON_IS_PCI; 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", DRM_DEBUG("%s card detected\n",
((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI")))); ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI"))));
return ret; return ret;
...@@ -1767,12 +1773,6 @@ int radeon_driver_firstopen(struct drm_device *dev) ...@@ -1767,12 +1773,6 @@ int radeon_driver_firstopen(struct drm_device *dev)
dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE; 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); dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0);
ret = drm_addmap(dev, dev_priv->fb_aper_offset, ret = drm_addmap(dev, dev_priv->fb_aper_offset,
drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER, drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER,
...@@ -1788,6 +1788,9 @@ int radeon_driver_unload(struct drm_device *dev) ...@@ -1788,6 +1788,9 @@ int radeon_driver_unload(struct drm_device *dev)
drm_radeon_private_t *dev_priv = dev->dev_private; drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
drm_rmmap(dev, dev_priv->mmio);
drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER); drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER);
dev->dev_private = NULL; dev->dev_private = NULL;
......
...@@ -287,7 +287,6 @@ typedef struct drm_radeon_private { ...@@ -287,7 +287,6 @@ typedef struct drm_radeon_private {
unsigned long gart_textures_offset; unsigned long gart_textures_offset;
drm_local_map_t *sarea; drm_local_map_t *sarea;
drm_local_map_t *mmio;
drm_local_map_t *cp_ring; drm_local_map_t *cp_ring;
drm_local_map_t *ring_rptr; drm_local_map_t *ring_rptr;
drm_local_map_t *gart_textures; drm_local_map_t *gart_textures;
...@@ -318,6 +317,7 @@ typedef struct drm_radeon_private { ...@@ -318,6 +317,7 @@ typedef struct drm_radeon_private {
int num_gb_pipes; int num_gb_pipes;
int track_flush; int track_flush;
drm_local_map_t *mmio;
} drm_radeon_private_t; } drm_radeon_private_t;
typedef struct drm_radeon_buf_priv { typedef struct drm_radeon_buf_priv {
......
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