summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2012-02-24 21:55:44 -0600
committerDave Airlie <airlied@redhat.com>2012-03-09 09:38:29 +0000
commita069eac6681e901c8592fb27810a6864678608f9 (patch)
tree76a973f6ed62bff4fc5b49e34b510c4ed4fcd5bd
parent7ea646985afb9eab22df863328f75c90346a0997 (diff)
radeontool, avivotool: remove unnecessary region autodetection magic
Trying to guess which region is which based on size is needlessly error-prone and complicated. Region 0 is always the frame buffer and region 2 is always mmio. radeonreg already hard-codes the appropriate region numbers. This patch teaches radeontool and avivotool to do the same. Suggested-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--avivotool.c14
-rw-r--r--radeontool.c18
2 files changed, 5 insertions, 27 deletions
diff --git a/avivotool.c b/avivotool.c
index 9c35fc7..bc827b3 100644
--- a/avivotool.c
+++ b/avivotool.c
@@ -1857,17 +1857,9 @@ static int map_radeon_mem(void)
printf("cannot find Radeon device\n");
return -1;
}
-
- for (i = 0; i < 6; i++) {
- if (device->regions[i].size == 64 * 1024)
- ctrl_region = i;
- else if (device->regions[i].size == 128 * 1024)
- ctrl_region = i;
- else if (device->regions[i].size == 256 * 1024)
- ctrl_region = i;
- else if (device->regions[i].size >= 128 * 1024 * 1024)
- fb_region = i;
- }
+
+ fb_region = 0;
+ ctrl_region = 2;
avivo_device = device;
if (pci_device_map_region(avivo_device, ctrl_region, 1) != 0) {
diff --git a/radeontool.c b/radeontool.c
index 9ed92c2..cb0d12d 100644
--- a/radeontool.c
+++ b/radeontool.c
@@ -948,22 +948,8 @@ static void map_radeon_cntl_mem(void)
if (!device)
die("cannot find Radeon device");
- for (i = 0; i < 6; i++) {
- if (device->regions[i].size >= 16 * 1024 &&
- device->regions[i].size <= 64 * 1024) {
- if (ctrl_region != -1)
- die("cannot distinguish ctrl region");
- ctrl_region = i;
- } else if (device->regions[i].size >= 64 * 1024 * 1024) {
- if (fb_region != -1)
- die("cannot distinguish fb region");
- fb_region = i;
- }
- }
- if (ctrl_region == -1)
- die("cannot find ctrl region");
- if (fb_region == -1)
- die("cannot find fb region");
+ fb_region = 0;
+ ctrl_region = 2;
avivo_device = device;
if (pci_device_map_region(avivo_device, ctrl_region, 1) != 0)