#include "dat.h"
#include "fns.h"
#include "io.h"
+#include "../port/pci.h"
#include "../port/error.h"
#include "../port/netif.h"
#include "../port/etherif.h"
uchar rev;
uchar nports;
uchar portno;
- uintptr io;
+ uvlong io;
uchar *reg8;
ushort *reg16;
uint *reg;
}else{
b->wp += l;
b->flag |= flag;
- etheriq(e, b, 1);
+ etheriq(e, b);
}
unstarve(&c->rxmit);
}
Pcidev *p;
p = c->p;
+ if(p->mem[0].bar & 1)
+ return -1;
c->io = p->mem[0].bar&~0xf;
mem = vmap(c->io, p->mem[0].size);
if(mem == nil){
- print("yuk: cant map %#p\n", c->io);
+ print("yuk: cant map %llux\n", c->io);
return -1;
}
+ pcienable(p);
c->p = p;
c->reg = (uint*)mem;
c->reg8 = (uchar*)mem;
c->rx.r = slice(&v, 16*4096, sizeof c->rx.r[0] * c->rx.cnt);
c->nports = 1; /* BOTCH */
- pcisetbme(p);
if(reset(c)){
print("yuk: cant reset\n");
- pciclrbme(p);
free(c->alloc);
vunmap(mem, p->mem[0].size);
+ pcidisable(p);
return -1;
}
macinit(c);
+ pcisetbme(p);
return 0;
}