On Tue, Feb 21, 2012 at 2:45 AM, Jonathan Nieder <[email protected]> wrote: > Just like radeontool, avivotool should not blindly fall back to > region 0 when the expected memory areas cannot be found. Noticed by > code inspection. (Compare commits 51a87cf0 and 7e3e9808.)
region 0 is always the frame buffer and region 2 is always mmio. radeontool and avivotool should be cleaned up the same way radeonreg is. Alex > > Signed-off-by: Jonathan Nieder <[email protected]> > --- > avivotool.c | 29 ++++++++++++++++++++++------- > 1 files changed, 22 insertions(+), 7 deletions(-) > > diff --git a/avivotool.c b/avivotool.c > index 9a01a9fd..62f96a8e 100644 > --- a/avivotool.c > +++ b/avivotool.c > @@ -57,7 +57,7 @@ int reg_type[0x8001]; > /* Not the address but what it points to is volatile. */ > struct pci_device *avivo_device = NULL; > RADEONCardInfo *card_info = NULL; > -unsigned int ctrl_region, fb_region; > +int ctrl_region = -1, fb_region = -1; > unsigned char * volatile ctrl_mem; > unsigned char * volatile fb_mem; > > @@ -1846,14 +1846,29 @@ static int map_radeon_mem(void) > } > > for (i = 0; i < 6; i++) { > - if (device->regions[i].size == 64 * 1024) > + if (device->regions[i].size == 64 * 1024 || > + device->regions[i].size == 128 * 1024 || > + device->regions[i].size == 256 * 1024) { > + if (ctrl_region != -1) { > + printf("cannot distinguish ctrl region\n"); > + return -1; > + } > 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) > + } else if (device->regions[i].size >= 128 * 1024 * 1024) { > + if (fb_region != -1) { > + printf("cannot distinguish fb region\n"); > + return -1; > + } > fb_region = i; > + } > + } > + if (ctrl_region == -1) { > + printf("cannot find ctrl region\n"); > + return -1; > + } > + if (fb_region == -1) { > + printf("cannot find fb region\n"); > + return -1; > } > avivo_device = device; > if(skip-- == 0) { > -- > 1.7.9.1 > > _______________________________________________ > xorg-driver-ati mailing list > [email protected] > http://lists.x.org/mailman/listinfo/xorg-driver-ati _______________________________________________ xorg-driver-ati mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-driver-ati
