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>
This commit is contained in:
parent
cdb6e375c3
commit
2dea2e29b9
|
@ -133,13 +133,6 @@ int radeon_agp_init(struct radeon_device *rdev)
|
||||||
bool is_v3;
|
bool is_v3;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (rdev->ddev->agp->agp_info.aper_size < 32) {
|
|
||||||
dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
|
|
||||||
"need at least 32M, disabling AGP\n",
|
|
||||||
rdev->ddev->agp->agp_info.aper_size);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Acquire AGP. */
|
/* Acquire AGP. */
|
||||||
if (!rdev->ddev->agp->acquired) {
|
if (!rdev->ddev->agp->acquired) {
|
||||||
ret = drm_agp_acquire(rdev->ddev);
|
ret = drm_agp_acquire(rdev->ddev);
|
||||||
|
@ -154,6 +147,14 @@ int radeon_agp_init(struct radeon_device *rdev)
|
||||||
DRM_ERROR("Unable to get AGP info: %d\n", ret);
|
DRM_ERROR("Unable to get AGP info: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rdev->ddev->agp->agp_info.aper_size < 32) {
|
||||||
|
dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
|
||||||
|
"need at least 32M, disabling AGP\n",
|
||||||
|
rdev->ddev->agp->agp_info.aper_size);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
mode.mode = info.mode;
|
mode.mode = info.mode;
|
||||||
agp_status = (RREG32(RADEON_AGP_STATUS) | RADEON_AGPv3_MODE) & mode.mode;
|
agp_status = (RREG32(RADEON_AGP_STATUS) | RADEON_AGPv3_MODE) & mode.mode;
|
||||||
is_v3 = !!(agp_status & RADEON_AGPv3_MODE);
|
is_v3 = !!(agp_status & RADEON_AGPv3_MODE);
|
||||||
|
|
Loading…
Reference in New Issue