--- /sys/src/9/pc/etheriwl.c +++ /sys/src/9/pc/etheriwl.c @@ -329,7 +329,18 @@ SchedTransTblOff = 0x7E0, // +q*2 }; +/* + * uCode capabilities + */ enum { + /* capa[0] */ + UcodeCapLar = (1<<1), + + /* capa[2] */ + UcodeCapLar2 = (1<<9), +}; + +enum { FilterPromisc = 1<<0, FilterCtl = 1<<1, FilterMulticast = 1<<2, @@ -635,7 +646,7 @@ Type2030 = 12, Type2000 = 16, - Type7260 = 30, + Type7260 = 20, Type8265 = 35, }; @@ -1984,7 +1995,7 @@ *p++ = mcc[0]; *p++ = 0; *p++ = 0; // reserved - if(1){ + if(ctlr->fw->capa[2] & UcodeCapLar2){ p += 4; p += 5*4; } @@ -2272,7 +2283,9 @@ ea[5] = a1 >> 0; } } else { - readnvmsect(ctlr, 0, ea, Eaddrlen, 0x15<<1); + /* fw gets angry if we read 6 bytes instead of 8 */ + readnvmsect(ctlr, 0, buf, 8, 0x15<<1); + memmove(ea, buf, Eaddrlen); } memmove(ctlr->edev->addr, ea, Eaddrlen); @@ -2822,13 +2835,13 @@ return cmd(ctlr, 210, c, 11*4); } -static void +static char* tttxbackoff(Ctlr *ctlr) { uchar c[4]; put32(c, 0); - cmd(ctlr, 126, c, sizeof(c)); + return cmd(ctlr, 126, c, sizeof(c)); } static char* @@ -2897,16 +2910,16 @@ /* Initialize tx backoffs to the minimum. */ if(ctlr->family == 7000) - tttxbackoff(ctlr); + if((err = tttxbackoff(ctlr)) != nil) + return err; if((err = updatedevicepower(ctlr)) != nil){ print("can't update device power: %s\n", err); return err; } - if((err = sendmccupdate(ctlr, "ZZ")) != nil){ - print("can't disable beacon filter: %s\n", err); - return err; - } + if(ctlr->fw->capa[0] & UcodeCapLar) + if((err = sendmccupdate(ctlr, "ZZ")) != nil) + return err; if((err = disablebeaconfilter(ctlr)) != nil){ print("can't disable beacon filter: %s\n", err); return err; @@ -3452,7 +3465,7 @@ return "qcmd: broken"; } /* wake up the nic (just needed for 7k) */ - if(ctlr->family == 7000 && q->n == 0) + if(ctlr->family == 7000 && qid == 4 && q->n == 0) if(niclock(ctlr) != nil){ iunlock(ctlr); return "qcmd: busy"; @@ -4283,8 +4296,8 @@ if(tx != nil && tx->n > 0){ tx->n--; wakeup(tx); - /* unlock 7k family nics as all commands are done */ - if(ctlr->family == 7000 && tx->n == 0) + /* unlock 7k family nics as the command is done */ + if(ctlr->family == 7000 && qid == 4 && tx->n == 0) nicunlock(ctlr); } }