#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"
typedef struct Ctlr Ctlr;
typedef struct Ctlr {
- int port;
+ uvlong port;
Pcidev* pcidev;
Ctlr* next;
int active;
while(p = pcimatch(p, 0, 0)){
if(p->ccrb != Pcibcnet || p->ccru != Pciscether)
continue;
+ if(p->mem[1].bar & 1)
+ continue;
switch((p->did<<16)|p->vid){
default:
break;
}
- mem = vmap(p->mem[1].bar & ~0x0F, p->mem[1].size);
- if(mem == 0){
- print("DP83820: can't map %8.8luX\n", p->mem[1].bar);
+ mem = vmap(p->mem[1].bar & ~0xF, p->mem[1].size);
+ if(mem == nil){
+ print("DP83820: can't map %llux\n", p->mem[1].bar & ~0xF);
continue;
}
print("DP83820: can't allocate memory\n");
continue;
}
- ctlr->port = p->mem[1].bar & ~0x0F;
+ ctlr->port = p->mem[1].bar & ~0xF;
ctlr->pcidev = p;
pcienable(p);
ctlr->id = (p->did<<16)|p->vid;