update 82563 with latest changes Reference: /n/atom/patch/applied2013/fs82563upd Date: Mon Jul 29 22:24:33 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/fs/pc/ether82563.c Mon Jul 29 22:24:21 2013 +++ /sys/src/fs/pc/ether82563.c Mon Jul 29 22:24:21 2013 @@ -1,5 +1,5 @@ /* - * Intel 8256[367], 8257[1-9], 8258[03], i350 + * Intel 8256[367], 8257[1-9], 8258[03], i21[01], i350 * Gigabit Ethernet PCI-Express Controllers * Coraid EtherDrive® hba */ @@ -29,6 +29,7 @@ Fcah = 0x002C, /* Flow Control Address High */ Fct = 0x0030, /* Flow Control Type */ Kumctrlsta = 0x0034, /* Kumeran Control and Status Register */ + Connsw = 0x0034, /* copper / fiber switch control; 82575/82576 */ Vet = 0x0038, /* VLAN EtherType */ Fcttv = 0x0170, /* Flow Control Transmit Timer Value */ Txcw = 0x0178, /* Transmit Configuration Word */ @@ -139,6 +140,11 @@ Serdes = 3<<22, /* " serdes */ }; +enum { + /* Connsw */ + Enrgirq = 1<<2, /* interrupt on power detect (enrgsrc) */ +}; + enum { /* EEPROM content offsets */ Ea = 0x00, /* Ethernet Address */ }; @@ -209,7 +215,7 @@ Pcsstat = 0x420c, /* pcs status */ /* Pcsctl bits */ - Pan = 1<<16, /* autoegotiate */ + Pan = 1<<16, /* autonegotiate */ Prestart = 1<<17, /* restart an (self clearing) */ /* Pcsstat bits */ @@ -230,6 +236,7 @@ Mdac = 0x00000200, /* MDIO Access Completed */ Rxcfgset = 0x00000400, /* Receiving /C/ ordered sets */ Ack = 0x00020000, /* Receive ACK frame */ + Omed = 1<<20, /* media change; pcs interface */ }; enum { /* Txcw */ @@ -429,6 +436,7 @@ i82579, i82580, i82583, + i210, i350, Nctlrtype, }; @@ -446,35 +454,38 @@ struct Ctlrtype { int type; int mtu; + int phyno; int flag; char *name; }; static Ctlrtype cttab[Nctlrtype] = { - i82563, 9014, Fpba, "i82563", - i82566, 1514, Fload, "i82566", - i82567, 9234, Fload, "i82567", - i82567m, 1514, 0, "i82567m", - i82571, 9234, Fpba, "i82571", - i82572, 9234, Fpba, "i82572", - i82573, 8192, Fert, "i82573", /* terrible perf above 8k */ - i82574, 9018, 0, "i82574", - i82575, 9728, F75|Fflashea, "i82575", - i82576, 9728, F75, "i82576", - i82577, 4096, Fload|Fert, "i82577", - i82577m, 1514, Fload|Fert, "i82577", - i82578, 4096, Fload|Fert, "i82578", - i82578m, 1514, Fload|Fert, "i82578", - i82579, 9018, Fload|Fert|F79phy, "i82579", - i82580, 9728, F75|F79phy, "i82580", - i82583, 1514, 0, "i82583", - i350, 9728, F75|F79phy, "i350", + i82563, 9014, 1, Fpba, "i82563", + i82566, 1514, 1, Fload, "i82566", + i82567, 9234, 1, Fload, "i82567", + i82567m, 1514, 1, 0, "i82567m", + i82571, 9234, 1, Fpba, "i82571", + i82572, 9234, 1, Fpba, "i82572", + i82573, 8192, 1, Fert, "i82573", /* terrible perf above 8k */ + i82574, 9018, 1, 0, "i82574", + i82575, 9728, 1, F75|Fflashea, "i82575", + i82576, 9728, 2, F75, "i82576", + i82577, 4096, 2, Fload|Fert, "i82577", + i82577m, 1514, 2, Fload|Fert, "i82577", + i82578, 4096, 1, Fload|Fert, "i82578", + i82578m, 1514, 1, Fload|Fert, "i82578", + i82579, 9018, 2, Fload|Fert|F79phy, "i82579", + i82580, 9728, 1, F75|F79phy, "i82580", + i82583, 1514, 1, 0, "i82583", + i210, 9728, 1, F75|F79phy, "i210", + i350, 9728, 1, F75|F79phy, "i350", }; typedef void (*Freefn)(Msgbuf*); typedef struct Ctlr Ctlr; struct Ctlr { +// uintmem port; ulong port; Pcidev *pcidev; int active; @@ -515,7 +526,7 @@ int fcrtl; int fcrth; - uint pba; /* packet buffer allocation */ + u32int pba; /* packet buffer allocation */ char rname[NAMELEN]; char tname[NAMELEN]; @@ -808,8 +819,8 @@ Set(c, Rdh, 0); c->rdt = 0; Set(c, Rdt, 0); - c->rdtr = 25; - c->radv = 250; + c->rdtr = 0; //25; + c->radv = 0; //500; Set(c, Rdtr, c->rdtr); Set(c, Radv, c->radv); @@ -1128,7 +1139,7 @@ return; if(cttab[c->type].flag & Fflashea){ /* intel mb bug */ - u = (uvlong)Get(c, Rah)<<32u | (ulong)Get(c, Ral); + u = (uvlong)Get(c, Rah)<<32u | (uint)Get(c, Ral); for(i = 0; i < Easize; i++) ra[i] = u >> 8*i; } @@ -1173,7 +1184,7 @@ Set(c, Mta + i*4, 0); Set(c, Fcal, 0x00C28001); Set(c, Fcah, 0x0100); - if(c->type != i82579) + if(c->type != i82579 && c->type != i210 && c->type != i350) Set(c, Fct, 0x8808); Set(c, Fcttv, 0x0100); Set(c, Fcrtl, c->fcrtl); @@ -1257,6 +1268,14 @@ return i82580; case 0x1506: /* v */ return i82583; + case 0x1533: /* i210-t1 */ + case 0x1534: + case 0x1536: /* fiber */ + case 0x1538: + case 0x1539: /* i211 */ + case 0x153a: /* i217-lm */ + case 0x153b: /* i217-v */ + return i210; case 0x151f: /* “powerville” eeprom-less */ case 0x1521: /* copper */ case 0x1522: /* fiber */