ref: aca2a9b9dce7fc3c14f318f12d52f2af48769533
parent: 7ce0db0b8609bd0bcf92eb55cd48ed8e44f10b4a
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Tue Feb 19 02:57:30 EST 2013
etheriwl: fix rominit we used use the *last* block in otp block list instead of the block *before* the last block resulting in wrong eeprom data (1000er series only)
--- a/sys/src/9/pc/etheriwl.c
+++ b/sys/src/9/pc/etheriwl.c
@@ -744,9 +744,9 @@
static char*
rominit(Ctlr *ctlr)
{+ uint prev, last;
uchar buf[2];
char *err;
- uint off;
int i;
ctlr->eeprom.otp = 0;
@@ -785,18 +785,19 @@
* Find the block before last block (contains the EEPROM image)
* for HW without OTP shadow RAM.
*/
- off = 0;
+ prev = last = 0;
for(i=0; i<3; i++){- if((err = eepromread(ctlr, buf, 2, off)) != nil)
+ if((err = eepromread(ctlr, buf, 2, last)) != nil)
return err;
if(get16(buf) == 0)
break;
- off = get16(buf);
+ prev = last;
+ last = get16(buf);
}
if(i == 0 || i >= 3)
return "rominit: missing eeprom image";
- ctlr->eeprom.off = off+1;
+ ctlr->eeprom.off = prev+1;
return nil;
}
--
⑨