ref: d1665eaf4df7dbdfef4e349b73bb1082bae18828
parent: 77438f99c83b3d3965a5672cbe6618f65c30b9b4
author: cinap_lenrek <[email protected]>
date: Wed Jan 9 01:41:37 EST 2013
add intel 82598 10gb ethernet to pcf and pccpuf configuration, add support for 82599 (from sources)
--- a/sys/src/9/pc/ether82598.c
+++ b/sys/src/9/pc/ether82598.c
@@ -264,7 +264,7 @@
Pcidev *p;
Ether *edev;
u32int *reg;
- u32int *reg3;
+ u32int *regmsi;
uchar flag;
int nrd;
int ntd;
@@ -888,8 +888,9 @@
static void
scan(void)
{
- ulong io, io3;
- void *mem, *mem3;
+ ulong io, iomsi;
+ void *mem, *memmsi;
+ int pciregs, pcimsix;
Ctlr *c;
Pcidev *p;
@@ -901,10 +902,15 @@
case 0x10b6: /* 82598 backplane */
case 0x10dd: /* 82598 at cx4 */
case 0x10ec: /* 82598 at cx4 dual port */
+ pcimsix = 3;
break;
+ case 0x10fb: /* 82599 */
+ pcimsix = 4;
+ break;
default:
continue;
}
+ pciregs = 0;
if(nctlr == nelem(ctlrtab)){
print("i82598: too many controllers\n");
return;
@@ -914,30 +920,30 @@
print("i82598: can't allocate memory\n");
continue;
}
- io = p->mem[0].bar & ~0xf;
- mem = vmap(io, p->mem[0].size);
+ io = p->mem[pciregs].bar & ~0xf;
+ mem = vmap(io, p->mem[pciregs].size);
if(mem == nil){
- print("i82598: can't map %#p\n", p->mem[0].bar);
+ print("i82598: can't map regs %#p\n", p->mem[pciregs].bar);
free(c);
continue;
}
- io3 = p->mem[3].bar & ~0xf;
- mem3 = vmap(io3, p->mem[3].size);
- if(mem3 == nil){
- print("i82598: can't map %#p\n", p->mem[3].bar);
- vunmap(mem, p->mem[0].size);
+ iomsi = p->mem[pcimsix].bar & ~0xf;
+ memmsi = vmap(iomsi, p->mem[pcimsix].size);
+ if(memmsi == nil){
+ print("i82598: can't map msi-x regs %#p\n", p->mem[pcimsix].bar);
+ vunmap(mem, p->mem[pciregs].size);
free(c);
continue;
}
c->p = p;
c->reg = (u32int*)mem;
- c->reg3 = (u32int*)mem3;
+ c->regmsi = (u32int*)memmsi;
c->rbsz = Rbsz;
if(reset(c)){
print("i82598: can't reset\n");
free(c);
- vunmap(mem, p->mem[0].size);
- vunmap(mem3, p->mem[3].size);
+ vunmap(mem, p->mem[pciregs].size);
+ vunmap(memmsi, p->mem[pcimsix].size);
continue;
}
pcisetbme(p);
--- a/sys/src/9/pc/pccpuf
+++ b/sys/src/9/pc/pccpuf
@@ -52,6 +52,7 @@
ether82543gc pci
ether82563 pci
ether82557 pci
+ ether82598 pci
ether83815 pci
etherdp83820 pci
etherbcm pci
--- a/sys/src/9/pc/pcf
+++ b/sys/src/9/pc/pcf
@@ -54,6 +54,7 @@
# ether82543gc pci
ether82557 pci
ether82563 pci
+ ether82598 pci
ether83815 pci
etherbcm pci
etherdp83820 pci