]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/ethervt6102.c
merge
[plan9front.git] / sys / src / 9 / pc / ethervt6102.c
index ef419636822a814ce03a9731a66a1647289465ec..9ea47f1aee7d3140a288af1f5e98d42c26956a63 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 {
        Par0            = 0x00,         /* Ethernet Address */
@@ -948,7 +948,7 @@ vt6102pci(void)
 {
        Pcidev *p;
        Ctlr *ctlr;
-       int cls, port;
+       int port;
 
        p = nil;
        while(p = pcimatch(p, 0, 0)){
@@ -963,7 +963,7 @@ vt6102pci(void)
                        break;
                }
 
-               port = p->mem[0].bar & ~0x01;
+               port = p->mem[0].bar & ~3;
                if(ioalloc(port, p->mem[0].size, 0, "vt6102") < 0){
                        print("vt6102: port 0x%uX in use\n", port);
                        continue;
@@ -976,10 +976,9 @@ vt6102pci(void)
                }
                ctlr->port = port;
                ctlr->pcidev = p;
+               pcienable(p);
                ctlr->id = (p->did<<16)|p->vid;
-               if((cls = pcicfgr8(p, PciCLS)) == 0 || cls == 0xFF)
-                       cls = 0x10;
-               ctlr->cls = cls*4;
+               ctlr->cls = p->cls*4;
                ctlr->tft = Ctft64;
 
                if(vt6102reset(ctlr)){