complete vector disabling code for nix Reference: /n/atom/patch/applied2013/vectordisable Date: Sat Dec 28 01:58:59 CET 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/port/uartp8250.h Sat Dec 28 01:58:12 2013 +++ /sys/src/nix/port/uartp8250.h Sat Dec 28 01:58:13 2013 @@ -103,6 +103,8 @@ int hasfifo; int checkfifo; int fena; + + void *vector; }; extern PhysUart p8250physuart; --- /sys/src/nix/k10/uarti8250.c Sat Dec 28 01:58:14 2013 +++ /sys/src/nix/k10/uarti8250.c Sat Dec 28 01:58:15 2013 @@ -46,10 +46,10 @@ c = u->regs; if(on) - intrenable(c->irq, i8250interrupt, u, c->tbdf, u->name); + c->vector = intrenable(c->irq, i8250interrupt, u, c->tbdf, u->name); else /* this causes hangs. please debug. */ -// return intrdisable(c->irq, i8250interrupt, u, c->tbdf, u->name); +// return intrdisable(c->vector); return -1; return 0; } --- /sys/src/nix/k10/uartox958.c Sat Dec 28 01:58:16 2013 +++ /sys/src/nix/k10/uartox958.c Sat Dec 28 01:58:17 2013 @@ -37,10 +37,10 @@ c = u->regs; if(on) - intrenable(c->irq, i8250interrupt, u, c->tbdf, u->name); + c->vector = intrenable(c->irq, i8250interrupt, u, c->tbdf, u->name); else{ /* this causes hangs. please debug. */ -// return intrdisable(c->irq, i8250interrupt, u, c->tbdf, u->name); +// return intrdisable(c->vector); return -1; } return 0; --- /sys/src/nix/k10/uartpci.c Sat Dec 28 01:58:18 2013 +++ /sys/src/nix/k10/uartpci.c Sat Dec 28 01:58:18 2013 @@ -38,10 +38,10 @@ c = u->regs; if(on) - intrenable(c->irq, i8250interrupt, u, c->tbdf, u->name); + c->vector = intrenable(c->irq, i8250interrupt, u, c->tbdf, u->name); else{ /* this causes hangs. please debug. */ -// return intrdisable(c->irq, i8250interrupt, u, c->tbdf, u->name); + // return intrdisable(c->vector); return -1; } return 0; --- /sys/src/nix/k10/sdahci.c Sat Dec 28 01:58:21 2013 +++ /sys/src/nix/k10/sdahci.c Sat Dec 28 01:58:23 2013 @@ -162,6 +162,7 @@ Drive* drive[NCtlrdrv]; int ndrive; uint pi; + void *vector; }; static Ctlr iactlr[NCtlr]; @@ -1286,7 +1287,7 @@ panic("iaenable: zero s->ctlr->ndrive"); pcisetbme(c->pci); snprint(name, sizeof name, "%s (%s)", s->name, s->ifc->name); - intrenable(c->pci->intl, iainterrupt, c, c->pci->tbdf, name); + c->vector = intrenable(c->pci->intl, iainterrupt, c, c->pci->tbdf, name); /* supposed to squelch leftover interrupts here. */ ahcienable(c->hba); c->enabled = 1; @@ -1308,7 +1309,7 @@ ahcidisable(c->hba); snprint(name, sizeof name, "%s (%s)", s->name, s->ifc->name); print("missing the intrdisable because intrdisable is wierd\n"); -// intrdisable(c->pci->intl, iainterrupt, c, c->pci->tbdf, name); + intrdisable(c->vector); c->enabled = 0; iunlock(c); return 1; --- /sys/src/nix/k10/sdide.c Sat Dec 28 01:58:25 2013 +++ /sys/src/nix/k10/sdide.c Sat Dec 28 01:58:26 2013 @@ -64,6 +64,8 @@ // Lock irqmask; Rendez; + + void *vector; }; struct Drive { @@ -851,7 +853,7 @@ // ctlr->prdt = mallocalign(Nprd*sizeof(Prd), 4, 0, 64*1024); } snprint(name, sizeof name, "%s (%s)", s->name, s->ifc->name); - intrenable(c->intl, interrupt, c, c->tbdf, name); + c->vector = intrenable(c->intl, interrupt, c, c->tbdf, name); outb(c->ctl+Dc, 0); // if(c->ienable != nil) // c->ienable(c); @@ -876,7 +878,7 @@ c = s->ctlr; outb(c->ctl+Dc, Nien); /* disable interrupts */ snprint(name, sizeof(name), "%s (%s)", sdev->name, sdev->ifc->name); -// intrdisable(c->intl, interrupt, c, c->tbdf, name); +// intrdisable(c->vector); // free(c->prdt); // c->prdt = nil; if(c->p != nil) --- /sys/src/nix/k10/sdmpt2.c Sat Dec 28 01:58:29 2013 +++ /sys/src/nix/k10/sdmpt2.c Sat Dec 28 01:58:30 2013 @@ -219,6 +219,7 @@ char direct; Queue *eventq; + void *vector; }; static u32int @@ -1766,20 +1767,13 @@ mpt2disable(SDev *sdev) { Ctlr *ctlr; - Pcidev *p; - char name[32]; ctlr = sdev->ctlr; - p = ctlr->pcidev; ilock(ctlr); disablectlr(ctlr); iunlock(ctlr); - snprint(name, sizeof name, "%s (%s)", sdev->name, sdev->ifc->name); - -// must fix intrdisable -// intrdisable(p->intl, mpt2interrupt, ctlr, p->tbdf, name); - USED(p); + intrdisable(ctlr->vector); return 1; } --- /sys/src/nix/k10/sdodin.c Sat Dec 28 01:58:34 2013 +++ /sys/src/nix/k10/sdodin.c Sat Dec 28 01:58:36 2013 @@ -534,6 +534,8 @@ Drive drive[Nctlrdrv]; uint ndrive; uint prderr; + + void *vector; }; static Ctlr msctlr[Nctlr]; @@ -2020,15 +2022,13 @@ static int msdisable(SDev *s) { - char buf[32]; Ctlr *c; c = s->ctlr; ilock(c); // disable(c->hba); c->reg[Gctl] &= ~Intenable; - snprint(buf, sizeof buf, "%s (%s)", s->name, s->ifc->name); -// intrdisable(c->pci->intl, msinterrupt, c, c->pci->tbdf, buf); + intrdisable(c->vector); c->enabled = 0; iunlock(c); return 1; --- /sys/src/nix/k10/sdvanir.c Sat Dec 28 01:58:39 2013 +++ /sys/src/nix/k10/sdvanir.c Sat Dec 28 01:58:41 2013 @@ -586,6 +586,8 @@ Drive drive[Nctlrdrv]; uint ndrive; uint nfn; + + void *vector; }; static Ctlr msctlr[Nctlr]; @@ -2022,14 +2024,12 @@ static int msdisable(SDev *s) { - char buf[32]; Ctlr *c; c = s->ctlr; ilock(c); // disable(c->hba); - snprint(buf, sizeof buf, "%s (%s)", s->name, s->ifc->name); -// intrdisable(c->pci->intl, msinterrupt, c, c->pci->tbdf, buf); + intrdisable(c->vector); c->enabled = 0; iunlock(c); return 1; --- /sys/src/nix/k10/etherif.h Sat Dec 28 01:58:42 2013 +++ /sys/src/nix/k10/etherif.h Sat Dec 28 01:58:42 2013 @@ -13,6 +13,7 @@ struct Ether { Pciconf; /* hardware info */ Netif; + void *vector; int ctlrno; uchar ea[Eaddrlen]; --- /sys/src/nix/k10/devether.c Sat Dec 28 01:58:44 2013 +++ /sys/src/nix/k10/devether.c Sat Dec 28 01:58:45 2013 @@ -177,7 +177,6 @@ { int len, loopback; Etherpkt *pkt; - Mpl pl; ether->outpackets++; @@ -194,12 +193,10 @@ len = BLEN(bp); loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0; if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){ - pl = splhi(); if(loopback) etheriq(ether, bp, -1); else etheriq(ether, bp, 0); - splx(pl); } if(!loopback){ @@ -400,13 +397,6 @@ return nil; } - /* - * IRQ2 doesn't really exist, it's used to gang the interrupt - * controllers together. A device set to IRQ2 will appear on - * the second interrupt controller as IRQ9. - */ - if(ether->irq == 2) - ether->irq = 9; snprint(name, sizeof(name), "ether%d", ctlrno); /* @@ -414,10 +404,10 @@ * used by ethersink. */ if(ether->irq >= 0) - intrenable(ether->irq, ether->interrupt, ether, ether->tbdf, name); + ether->vector = intrenable(ether->irq, ether->interrupt, ether, ether->tbdf, name); e = buf + sizeof buf; - p = seprint(buf, e, "#l%d: %s: %dMbps port %#p irq %d tu %d", - ctlrno, cards[cardno].type, ether->mbps, ether->port, ether->irq, ether->mtu); + p = seprint(buf, e, "#l%d: %s: %dMbps port %#p tu %d", + ctlrno, cards[cardno].type, ether->mbps, ether->port, ether->mtu); if(ether->mem) p = seprint(p, e, " addr %#p", ether->mem); seprint(p, e, " %E\n", ether->ea); @@ -487,9 +477,8 @@ continue; } snprint(name, sizeof(name), "ether%d", i); - if(ether->irq >= 0){ - // intrdisable(ether->irq, ether->interrupt, ether, ether->tbdf, name); - } + if(ether->vector != nil) + intrdisable(ether->vector); (*ether->shutdown)(ether); } }