On Friday 18 April 2008 17:40:09 [EMAIL PROTECTED] wrote:
> The current code checks for the special signature that signifies
> a revision 4 SPROM. Now that a rev. 8 SPROM with a 440-byte length
> has been found that may not have any special code, this check could
> be relaxed. With this patch, if the CRC is incorrect for a 256-byte
> SPROM, the code will immediately check for a 440-byte SPROM. If there
> is still a CRC error, the size is set to 440 bytes, which allows dumping
> of most of any 512-byte SPROM if one is encountered.
> 
> Signed-off-by: Larry Finger <[EMAIL PROTECTED]>
> ---
> 
> 
> 
> Index: wireless-testing/drivers/ssb/pci.c
> ===================================================================
> --- wireless-testing.orig/drivers/ssb/pci.c
> +++ wireless-testing/drivers/ssb/pci.c
> @@ -505,17 +505,15 @@ static int ssb_pci_sprom_get(struct ssb_
>       sprom_do_read(bus, buf);
>       err = sprom_check_crc(buf, bus->sprom_size);
>       if (err) {
> -             /* check for rev 4 sprom - has special signature */
> -             if (buf[32] == 0x5372) {
> -                     kfree(buf);
> -                     buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
> -                                   GFP_KERNEL);
> -                     if (!buf)
> -                             goto out;
> -                     bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
> -                     sprom_do_read(bus, buf);
> -                     err = sprom_check_crc(buf, bus->sprom_size);
> -             }
> +             /* try for a 440 byte SPROM - revision 4 and higher */
> +             kfree(buf);
> +             buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
> +                           GFP_KERNEL);
> +             if (!buf)
> +                     goto out;
> +             bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
> +             sprom_do_read(bus, buf);
> +             err = sprom_check_crc(buf, bus->sprom_size);
>               if (err)
>                       ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
>                                  " SPROM CRC (corrupt SPROM)\n");
> 
> 


One day this crc8 based checking for the sprom type is going to blow
up into our faces. In my opinion it simply is too likely that such
a check can actually pass with completely bogus data. The chances are
not that low.
The SPROM design is simply braindead and I'd like to punch the one
who actually designed that. :)

So can we actually add some revision based checking to this?
So if the first CRC did succeed, additionally do a revision check
for <= 3. Same for the second CRC check. This way we based our decisions
on 16bit instead of 8bit, at least.

-- 
Greetings Michael.
_______________________________________________
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to