Christian Costa
2014-Aug-30 17:05 UTC
[Nouveau] [PATCH envytools] nvbios: Fix reading of ram_restrict_group_count.
The entry offset was use instead of the data it points to. Probably a regression. The files showing script parsing errors has been reduced from 410 to 6 with the database of 505 vbios. --- nvbios/mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvbios/mem.c b/nvbios/mem.c index 81f2d1b..e4797e3 100644 --- a/nvbios/mem.c +++ b/nvbios/mem.c @@ -232,11 +232,11 @@ envy_bios_parse_bit_M (struct envy_bios *bios, struct envy_bios_bit_entry *bit) if (bit->version == 1) { if (bit->t_len >= 5) { - bios_u8(bios, bit->offset+2, &ram_restrict_group_count); + bios_u8(bios, bit->t_offset+2, &ram_restrict_group_count); } } else if (bit->version == 2) { if (bit->t_len >= 3) { - bios_u8(bios, bit->offset, &ram_restrict_group_count); + bios_u8(bios, bit->t_offset, &ram_restrict_group_count); } } -- 1.9.1
Christian Costa
2014-Aug-30 17:05 UTC
[Nouveau] [PATCH envytools] nvbios: Truncate nb of entries to avoid displaying garbage
We return an error but this does not prevent the display so just make sure only valid data are printed. --- nvbios/mem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nvbios/mem.c b/nvbios/mem.c index e4797e3..00f5cd5 100644 --- a/nvbios/mem.c +++ b/nvbios/mem.c @@ -112,6 +112,7 @@ envy_bios_parse_mem_train (struct envy_bios *bios) { entry->offset = mt->offset + mt->hlen + ((mt->rlen + mt->subentries * mt->subentrylen) * i); err |= bios_u8(bios, entry->offset, &entry->u00); if (mt->subentries > sizeof(entry->subentry)) { + mt->subentries = sizeof(entry->subentry); ENVY_BIOS_ERR("Error when parsing mem train: subentries = %d > %lu\n", mt->subentries, sizeof(entry->subentry)); return -EFAULT; } -- 1.9.1
Christian Costa
2014-Aug-30 17:05 UTC
[Nouveau] [PATCH envytools] nvamemtiming: Make deep mode take range into account and treat range end as included
--- nva/set_timings.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nva/set_timings.c b/nva/set_timings.c index 7376486..6cd831c 100644 --- a/nva/set_timings.c +++ b/nva/set_timings.c @@ -448,14 +448,14 @@ deep_dump(struct nvamemtiming_conf *conf) if (conf->range.start == (unsigned char) -1) conf->range.start = 0; if (conf->range.end == (unsigned char) -1) - conf->range.end = conf->vbios.timing_entry_length; + conf->range.end = conf->vbios.timing_entry_length - 1; fprintf(stderr, "Deep mode: Will iterate between %i and %i\n", conf->range.start, conf->range.end); launch(conf, outf, 0, NO_COLOR); /* iterate through the vbios timing values */ - for (i = 0; i < conf->vbios.timing_entry_length; i++) { + for (i = conf->range.start; i <= conf->range.end; i++) { uint8_t orig = conf->vbios.data[conf->vbios.timing_entry_offset + i]; if (timing_value_types[i] == VALUE || @@ -506,14 +506,14 @@ shallow_dump(struct nvamemtiming_conf *conf) if (conf->range.start == (unsigned char) -1) conf->range.start = 0; if (conf->range.end == (unsigned char) -1) - conf->range.end = conf->vbios.timing_entry_length; + conf->range.end = conf->vbios.timing_entry_length - 1; fprintf(stderr, "Shallow mode: Will iterate between %i and %i\n", conf->range.start, conf->range.end); launch(conf, outf, 0, NO_COLOR); /* iterate through the vbios timing values */ - for (i = conf->range.start; i < conf->range.end; i++) { + for (i = conf->range.start; i <= conf->range.end; i++) { uint8_t orig = conf->vbios.data[conf->vbios.timing_entry_offset + i]; if (timing_value_types[i] == VALUE || -- 1.9.1
Martin Peres
2014-Aug-30 23:00 UTC
[Nouveau] [PATCH envytools] nvbios: Fix reading of ram_restrict_group_count.
On 30/08/2014 19:05, Christian Costa wrote:> The entry offset was use instead of the data it points to. Probably a regression. > The files showing script parsing errors has been reduced from 410 to 6 with the database of 505 vbios. > --- > nvbios/mem.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/nvbios/mem.c b/nvbios/mem.c > index 81f2d1b..e4797e3 100644 > --- a/nvbios/mem.c > +++ b/nvbios/mem.c > @@ -232,11 +232,11 @@ envy_bios_parse_bit_M (struct envy_bios *bios, struct envy_bios_bit_entry *bit) > > if (bit->version == 1) { > if (bit->t_len >= 5) { > - bios_u8(bios, bit->offset+2, &ram_restrict_group_count); > + bios_u8(bios, bit->t_offset+2, &ram_restrict_group_count); > } > } else if (bit->version == 2) { > if (bit->t_len >= 3) { > - bios_u8(bios, bit->offset, &ram_restrict_group_count); > + bios_u8(bios, bit->t_offset, &ram_restrict_group_count); > } > } >A very big thank you Christian for this fix! It had been bothering a few of us but we never really looked into it because we always was reminded of this bug while doing something else. I pushed all three patches! Looking forward to seeing what's next ;)
Maybe Matching Threads
- [PATCH envytools] Fix range end to the last value of timing table.
- [PATCH envytools] demmio: Add decoding of some MEM_TIMINGS registers for NVC0.
- [PATCH envytools] Fix range end to the last value of timing table.
- [PATCH 1/2] drm/nouveau: Kill global state in NvShadowBIOS
- [PATCH envytools] nvbios: Add missing null byte to string read from file.