]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/etheryuk.c
[9front] [PATCH] audiohda: add PCI ID for Intel C610/X99
[plan9front.git] / sys / src / 9 / pc / etheryuk.c
index d049a3595fc9b62f668af00a42a8c6d56bce45f3..fca2933299e72f8d498a7231196eb5fac16ac441 100644 (file)
@@ -8,9 +8,10 @@
 #include "dat.h"
 #include "fns.h"
 #include "io.h"
+#include "../port/pci.h"
 #include "../port/error.h"
 #include "../port/netif.h"
-#include "etherif.h"
+#include "../port/etherif.h"
 
 #define Pciwaddrh(x)   0
 #define Pciwaddrl(x)   PCIWADDR(x)
@@ -680,7 +681,7 @@ struct Ctlr {
        uchar   rev;
        uchar   nports;
        uchar   portno;
-       uintptr io;
+       uvlong  io;
        uchar   *reg8;
        ushort  *reg16;
        uint    *reg;
@@ -740,6 +741,7 @@ static Chipid idtab[] = {
 static Vtab vtab[] = {
        0x11ab, 0x4354, 1514,   "88e8040",      /* unsure on mtu */
        0x11ab, 0x4362, 1514,   "88e8053",
+       0x11ab, 0x4363, 1514,   "88e8055",
        0x11ab, 0x4364, 1514,   "88e8056",
        0x11ab, 0x4380, 1514,   "88e8057",
        0x11ab, 0x436b, 1514,   "88e8071",      /* unsure on mtu */
@@ -1206,11 +1208,11 @@ rxscrew(Ether *e, Sring *r, Status *t, uint wp)
 
        c = e->ctlr;
        if((int)(wp - r->rp) >= r->cnt){
-               print("rxscrew1 wp %ud(%ud) rp %ud %lud\n", wp, r->wp, r->rp, t-r->r);
+               print("rxscrew1 wp %ud(%ud) rp %ud %zd\n", wp, r->wp, r->rp, t-r->r);
                return -1;
        }
        if(c->rbring[t - r->r]){
-               print("rxscrew2 wp %ud rp %ud %lud\n", wp, r->rp, t-r->r);
+               print("rxscrew2 wp %ud rp %ud %zd\n", wp, r->rp, t-r->r);
                descriptorfu(e, Qr);
                return -1;
        }
@@ -1429,7 +1431,7 @@ rx(Ether *e, uint l, uint x, uint flag)
        }else{
                b->wp += l;
                b->flag |= flag;
-               etheriq(e, b, 1);
+               etheriq(e, b);
        }
        unstarve(&c->rxmit);
 }
@@ -2128,12 +2130,15 @@ setup(Ctlr *c)
        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;
@@ -2156,15 +2161,15 @@ setup(Ctlr *c)
        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;
 }
 
@@ -2228,7 +2233,7 @@ pnp(Ether *e)
                c = ctlrtab[i];
                if(c == nil || c->flag&Fprobe)
                        continue;
-               if(e->port != 0 && e->port != (ulong)c->reg)
+               if(e->port != 0 && e->port != (ulong)(uintptr)c->reg)
                        continue;
                c->flag |= Fprobe;
                if(setup(c) != 0)
@@ -2246,12 +2251,13 @@ pnp(Ether *e)
        e->attach = attach;
        e->ctl = ctl;
        e->ifstat = ifstat;
-       e->interrupt = interrupt;
        e->multicast = multicast;
        e->promiscuous = promiscuous;
        e->shutdown = shutdown;
        e->transmit = nil;
 
+       intrenable(e->irq, interrupt, e, e->tbdf, e->name);
+
        return 0;
 }