]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/etherdp83820.c
merge
[plan9front.git] / sys / src / 9 / pc / etherdp83820.c
index 8945ff459589dd1fa58a31d4a7e11551cc48d621..deb427fb4eaefaf563c13bd51f77409471612990 100644 (file)
 #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"
-
-#include "ethermii.h"
+#include "../port/ethermii.h"
 
 enum {                                 /* Registers */
        Cr              = 0x00,         /* Command */
@@ -343,7 +343,7 @@ enum {
 
 typedef struct Ctlr Ctlr;
 typedef struct Ctlr {
-       int     port;
+       uvlong  port;
        Pcidev* pcidev;
        Ctlr*   next;
        int     active;
@@ -1149,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:
@@ -1157,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;
                }
 
@@ -1168,8 +1170,9 @@ 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;
 
                ctlr->nic = mem;