All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH envytools] nvbios: Fix reading of ram_restrict_group_count.
@ 2014-08-30 17:05 Christian Costa
       [not found] ` <1409418318-31648-1-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Costa @ 2014-08-30 17:05 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH envytools] nvbios: Truncate nb of entries to avoid displaying garbage
       [not found] ` <1409418318-31648-1-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-08-30 17:05   ` Christian Costa
  2014-08-30 17:05   ` [PATCH envytools] nvamemtiming: Make deep mode take range into account and treat range end as included Christian Costa
  2014-08-30 23:00   ` [PATCH envytools] nvbios: Fix reading of ram_restrict_group_count Martin Peres
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Costa @ 2014-08-30 17:05 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH envytools] nvamemtiming: Make deep mode take range into account and treat range end as included
       [not found] ` <1409418318-31648-1-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-08-30 17:05   ` [PATCH envytools] nvbios: Truncate nb of entries to avoid displaying garbage Christian Costa
@ 2014-08-30 17:05   ` Christian Costa
  2014-08-30 23:00   ` [PATCH envytools] nvbios: Fix reading of ram_restrict_group_count Martin Peres
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Costa @ 2014-08-30 17:05 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH envytools] nvbios: Fix reading of ram_restrict_group_count.
       [not found] ` <1409418318-31648-1-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-08-30 17:05   ` [PATCH envytools] nvbios: Truncate nb of entries to avoid displaying garbage Christian Costa
  2014-08-30 17:05   ` [PATCH envytools] nvamemtiming: Make deep mode take range into account and treat range end as included Christian Costa
@ 2014-08-30 23:00   ` Martin Peres
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Peres @ 2014-08-30 23:00 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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 ;)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-30 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-30 17:05 [PATCH envytools] nvbios: Fix reading of ram_restrict_group_count Christian Costa
     [not found] ` <1409418318-31648-1-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-30 17:05   ` [PATCH envytools] nvbios: Truncate nb of entries to avoid displaying garbage Christian Costa
2014-08-30 17:05   ` [PATCH envytools] nvamemtiming: Make deep mode take range into account and treat range end as included Christian Costa
2014-08-30 23:00   ` [PATCH envytools] nvbios: Fix reading of ram_restrict_group_count Martin Peres

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.