X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=sys%2Fsrc%2F9%2Fpc%2Fethervirtio.c;h=eb1fa98c10a733a2565b809684866feb5ceb831c;hb=e38f75fc45bba789ceea05d5e62f1d8662bf508b;hp=f62dd9a71b6e174de25d19a95abbbebec86c3d3d;hpb=48c5da7a64804bf649ff815c778064dfe8c59711;p=plan9front.git diff --git a/sys/src/9/pc/ethervirtio.c b/sys/src/9/pc/ethervirtio.c index f62dd9a71..eb1fa98c1 100644 --- a/sys/src/9/pc/ethervirtio.c +++ b/sys/src/9/pc/ethervirtio.c @@ -6,7 +6,7 @@ #include "io.h" #include "../port/error.h" #include "../port/netif.h" -#include "etherif.h" +#include "../port/etherif.h" /* * virtio ethernet driver @@ -325,7 +325,7 @@ rxproc(void *v) blocks[i] = nil; b->wp = b->rp + u->len - VheaderSize; - etheriq(edev, b, 1); + etheriq(edev, b); q->lastused++; } } @@ -470,6 +470,7 @@ shutdown(Ether* edev) { Ctlr *ctlr = edev->ctlr; outb(ctlr->port+Qstatus, 0); + pciclrbme(ctlr->pcidev); } static void @@ -577,6 +578,7 @@ pciprobe(int typ) c->typ = typ; c->pcidev = p; + pcienable(p); c->id = (p->did<<16)|p->vid; /* §3.1.2 Legacy Device Initialization */ @@ -603,6 +605,7 @@ pciprobe(int typ) } if(i < 2){ print("ethervirtio: no queues\n"); + pcidisable(p); free(c); continue; } @@ -626,9 +629,8 @@ reset(Ether* edev) Ctlr *ctlr; int i; - if(ctlrhead == nil) { + if(ctlrhead == nil) ctlrhead = pciprobe(1); - } for(ctlr = ctlrhead; ctlr != nil; ctlr = ctlr->next){ if(ctlr->active) @@ -661,7 +663,6 @@ reset(Ether* edev) edev->attach = attach; edev->shutdown = shutdown; - edev->interrupt = interrupt; edev->ifstat = ifstat; if((ctlr->feat & (Fctrlvq|Fctrlrx)) == (Fctrlvq|Fctrlrx)){ @@ -669,6 +670,9 @@ reset(Ether* edev) edev->promiscuous = promiscuous; } + pcisetbme(ctlr->pcidev); + intrenable(edev->irq, interrupt, edev, edev->tbdf, edev->name); + return 0; }