提交 2afc4901 编写于 作者: L Larry.Finger@lwfinger.net 提交者: John W. Linville

ssb: Allow reading of 440-byte SPROM that is not rev 4

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: NLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: NMichael Buesch <mb@bu3sch.de>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 3acea5b6
...@@ -510,17 +510,15 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus, ...@@ -510,17 +510,15 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
sprom_do_read(bus, buf); sprom_do_read(bus, buf);
err = sprom_check_crc(buf, bus->sprom_size); err = sprom_check_crc(buf, bus->sprom_size);
if (err) { if (err) {
/* check for rev 4 sprom - has special signature */ /* try for a 440 byte SPROM - revision 4 and higher */
if (buf[32] == 0x5372) { kfree(buf);
kfree(buf); buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16), GFP_KERNEL);
GFP_KERNEL); if (!buf)
if (!buf) goto out;
goto out; bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
bus->sprom_size = SSB_SPROMSIZE_WORDS_R4; sprom_do_read(bus, buf);
sprom_do_read(bus, buf); err = sprom_check_crc(buf, bus->sprom_size);
err = sprom_check_crc(buf, bus->sprom_size);
}
if (err) if (err)
ssb_printk(KERN_WARNING PFX "WARNING: Invalid" ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
" SPROM CRC (corrupt SPROM)\n"); " SPROM CRC (corrupt SPROM)\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册