]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/etherdp83820.c
merge
[plan9front.git] / sys / src / 9 / pc / etherdp83820.c
index 35c6789cf620ded5d6fedcd497daeba73021f579..deb427fb4eaefaf563c13bd51f77409471612990 100644 (file)
@@ -10,6 +10,7 @@
 #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"
@@ -342,7 +343,7 @@ enum {
 
 typedef struct Ctlr Ctlr;
 typedef struct Ctlr {
-       int     port;
+       uvlong  port;
        Pcidev* pcidev;
        Ctlr*   next;
        int     active;
@@ -1148,6 +1149,8 @@ dp83820pci(void)
        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:
@@ -1156,9 +1159,9 @@ dp83820pci(void)
                        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;
                }
 
@@ -1167,7 +1170,7 @@ dp83820pci(void)
                        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;