aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_agp.c
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2010-01-31 14:38:03 -0500
committerDave Airlie <airlied@redhat.com>2010-01-31 20:19:31 -0500
commit2dea2e29b9fad48c759aa406b5ea426bff4339af (patch)
treedf7ef0a169d7bb96b326595affef6836e9f588d7 /drivers/gpu/drm/radeon/radeon_agp.c
parentcdb6e375c3c84558ed2c13c5461b22e8f7b7980e (diff)
drm/kms/radeon/agp: Move the check of the aper_size after drm_acp_acquire and drm_agp_info
First call drm_agp_acquire to check if agp has been acquired. Second call drm_agp_info to fill in the info data struct, including aper_size. Finally do the check to see if the aper_size makes sense. Signed-off-by: John Kacur <jkacur@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_agp.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_agp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c
index f58c5f46243..b634d984766 100644
--- a/drivers/gpu/drm/radeon/radeon_agp.c
+++ b/drivers/gpu/drm/radeon/radeon_agp.c
@@ -133,13 +133,6 @@ int radeon_agp_init(struct radeon_device *rdev)
133 bool is_v3; 133 bool is_v3;
134 int ret; 134 int ret;
135 135
136 if (rdev->ddev->agp->agp_info.aper_size < 32) {
137 dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
138 "need at least 32M, disabling AGP\n",
139 rdev->ddev->agp->agp_info.aper_size);
140 return -EINVAL;
141 }
142
143 /* Acquire AGP. */ 136 /* Acquire AGP. */
144 if (!rdev->ddev->agp->acquired) { 137 if (!rdev->ddev->agp->acquired) {
145 ret = drm_agp_acquire(rdev->ddev); 138 ret = drm_agp_acquire(rdev->ddev);
@@ -154,6 +147,14 @@ int radeon_agp_init(struct radeon_device *rdev)
154 DRM_ERROR("Unable to get AGP info: %d\n", ret); 147 DRM_ERROR("Unable to get AGP info: %d\n", ret);
155 return ret; 148 return ret;
156 } 149 }
150
151 if (rdev->ddev->agp->agp_info.aper_size < 32) {
152 dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
153 "need at least 32M, disabling AGP\n",
154 rdev->ddev->agp->agp_info.aper_size);
155 return -EINVAL;
156 }
157
157 mode.mode = info.mode; 158 mode.mode = info.mode;
158 agp_status = (RREG32(RADEON_AGP_STATUS) | RADEON_AGPv3_MODE) & mode.mode; 159 agp_status = (RREG32(RADEON_AGP_STATUS) | RADEON_AGPv3_MODE) & mode.mode;
159 is_v3 = !!(agp_status & RADEON_AGPv3_MODE); 160 is_v3 = !!(agp_status & RADEON_AGPv3_MODE);