summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/pc/devpccard.c9
-rw-r--r--sys/src/9/pc/ether82543gc.c11
-rw-r--r--sys/src/9/pc/ether82557.c10
-rw-r--r--sys/src/9/pc/ether82563.c25
-rw-r--r--sys/src/9/pc/ether82598.c6
-rw-r--r--sys/src/9/pc/etherigbe.c5
-rw-r--r--sys/src/9/pc/etheriwl.c5
-rw-r--r--sys/src/9/pc/etherm10g.c4
-rw-r--r--sys/src/9/pc/ethervt6102.c2
-rw-r--r--sys/src/9/pc/ethervt6105m.c2
-rw-r--r--sys/src/9/pc/etheryuk.c7
-rw-r--r--sys/src/9/pc/pcrandom.c7
-rw-r--r--sys/src/9/pc/sdiahci.c2
-rw-r--r--sys/src/9/pc/sdmv50xx.c2
-rw-r--r--sys/src/9/pc/sdodin.c2
-rw-r--r--sys/src/9/pc/wavelan.c4
-rw-r--r--sys/src/9/pc/wifi.c13
17 files changed, 89 insertions, 27 deletions
diff --git a/sys/src/9/pc/devpccard.c b/sys/src/9/pc/devpccard.c
index 8055cf9bc..5f884c63d 100644
--- a/sys/src/9/pc/devpccard.c
+++ b/sys/src/9/pc/devpccard.c
@@ -449,10 +449,13 @@ eventoccured(void)
static void
processevents(void *)
{
- while (1) {
- int message;
- Cardbus *cb;
+ int message;
+ Cardbus *cb;
+ while(waserror())
+ ;
+
+ for(;;){
sleep(&revents, (int (*)(void *))eventoccured, nil);
cb = nil;
diff --git a/sys/src/9/pc/ether82543gc.c b/sys/src/9/pc/ether82543gc.c
index e90b84845..db9aaa6e0 100644
--- a/sys/src/9/pc/ether82543gc.c
+++ b/sys/src/9/pc/ether82543gc.c
@@ -1228,18 +1228,19 @@ gc82543watchdog(void* arg)
Ctlr *ctlr;
edev = arg;
+ while(waserror())
+ ;
for(;;){
tsleep(&up->sleep, return0, 0, 1000);
-
ctlr = edev->ctlr;
- if(ctlr == nil){
- print("%s: exiting\n", up->text);
- pexit("disabled", 0);
- }
+ if(ctlr == nil)
+ break;
gc82543checklink(ctlr);
gc82543replenish(ctlr);
}
+ print("%s: exiting\n", up->text);
+ pexit("disabled", 1);
}
static void
diff --git a/sys/src/9/pc/ether82557.c b/sys/src/9/pc/ether82557.c
index be7971d67..7194d39c8 100644
--- a/sys/src/9/pc/ether82557.c
+++ b/sys/src/9/pc/ether82557.c
@@ -348,6 +348,8 @@ watchdog(void* arg)
static void txstart(Ether*);
ether = arg;
+ while(waserror())
+ ;
for(;;){
tsleep(&up->sleep, return0, 0, 4000);
@@ -357,10 +359,8 @@ watchdog(void* arg)
* the future.
*/
ctlr = ether->ctlr;
- if(ctlr == nil || ctlr->state == 0){
- print("%s: exiting\n", up->text);
- pexit("disabled", 0);
- }
+ if(ctlr == nil || ctlr->state == 0)
+ break;
ilock(&ctlr->cblock);
if(ctlr->tick++){
@@ -369,6 +369,8 @@ watchdog(void* arg)
}
iunlock(&ctlr->cblock);
}
+ print("%s: exiting\n", up->text);
+ pexit("disabled", 1);
}
static void
diff --git a/sys/src/9/pc/ether82563.c b/sys/src/9/pc/ether82563.c
index 1d7e28496..34a18d97f 100644
--- a/sys/src/9/pc/ether82563.c
+++ b/sys/src/9/pc/ether82563.c
@@ -853,6 +853,8 @@ i82563tproc(void *v)
i82563txinit(ctlr);
tdt = ctlr->tdt;
+ while(waserror())
+ ;
for(;;){
n = NEXT(tdt, ctlr->ntd);
if(n == i82563cleanup(ctlr)){
@@ -986,6 +988,8 @@ i82563rproc(void *arg)
}else
im = Rxt0|Rxo|Rxdmt0|Rxseq|Ack;
+ while(waserror())
+ ;
for(;;){
i82563im(ctlr, im);
ctlr->rsleep++;
@@ -1163,9 +1167,13 @@ phyl79proc(void *v)
c = e->ctlr;
phyno = phyprobe(c, 3<<1);
- if(phyno == ~0)
- return;
+ if(phyno == ~0){
+ print("%s: no phy, exiting\n", up->text);
+ pexit("no phy", 1);
+ }
+ while(waserror())
+ ;
for(;;){
phy = phyread(c, phyno, Phystat);
if(phy == ~0){
@@ -1203,11 +1211,16 @@ phylproc(void *v)
c = e->ctlr;
phyno = phyprobe(c, 3<<1);
- if(phyno == ~0)
- return;
+ if(phyno == ~0){
+ print("%s: no phy, exiting\n", up->text);
+ pexit("no phy", 1);
+ }
if(c->type == i82573 && (phy = phyread(c, phyno, Phyier)) != ~0)
phywrite(c, phyno, Phyier, phy | Lscie | Ancie | Spdie | Panie);
+
+ while(waserror())
+ ;
for(;;){
phy = phyread(c, phyno, Physsr);
if(phy == ~0){
@@ -1263,6 +1276,8 @@ pcslproc(void *v)
if(c->type == i82575 || c->type == i82576)
csr32w(c, Connsw, Enrgirq);
+ while(waserror())
+ ;
for(;;){
phy = csr32r(c, Pcsstat);
e->link = phy & Linkok;
@@ -1290,6 +1305,8 @@ serdeslproc(void *v)
e = v;
c = e->ctlr;
+ while(waserror())
+ ;
for(;;){
rx = csr32r(c, Rxcw);
tx = csr32r(c, Txcw);
diff --git a/sys/src/9/pc/ether82598.c b/sys/src/9/pc/ether82598.c
index eaba15e82..b786eced7 100644
--- a/sys/src/9/pc/ether82598.c
+++ b/sys/src/9/pc/ether82598.c
@@ -375,6 +375,8 @@ lproc(void *v)
e = v;
c = e->ctlr;
+ while(waserror())
+ ;
for (;;) {
r = c->reg[Links];
e->link = (r & Lnkup) != 0;
@@ -467,6 +469,8 @@ tproc(void *v)
e = v;
c = e->ctlr;
+ while(waserror())
+ ;
for (;;) {
sleep(&c->trendez, tim, c); /* transmit kicks us */
c->tim = 0;
@@ -551,6 +555,8 @@ rproc(void *v)
c = e->ctlr;
m = c->nrd - 1;
rdh = 0;
+ while(waserror())
+ ;
loop:
replenish(c, rdh);
im(c, Irx0);
diff --git a/sys/src/9/pc/etherigbe.c b/sys/src/9/pc/etherigbe.c
index 0b82aad14..059287ec6 100644
--- a/sys/src/9/pc/etherigbe.c
+++ b/sys/src/9/pc/etherigbe.c
@@ -782,6 +782,8 @@ igbelproc(void* arg)
edev = arg;
ctlr = edev->ctlr;
+ while(waserror())
+ ;
for(;;){
if(ctlr->mii == nil || ctlr->mii->curphy == nil)
continue;
@@ -1091,6 +1093,9 @@ igberproc(void* arg)
r |= Ren;
csr32w(ctlr, Rctl, r);
+ while(waserror())
+ ;
+
for(;;){
ctlr->rim = 0;
igbeim(ctlr, Rxt0|Rxo|Rxdmt0|Rxseq);
diff --git a/sys/src/9/pc/etheriwl.c b/sys/src/9/pc/etheriwl.c
index 777de1512..c6eece284 100644
--- a/sys/src/9/pc/etheriwl.c
+++ b/sys/src/9/pc/etheriwl.c
@@ -1997,11 +1997,10 @@ iwlrecover(void *arg)
edev = arg;
ctlr = edev->ctlr;
+ while(waserror())
+ ;
for(;;){
- while(waserror())
- ;
tsleep(&up->sleep, return0, 0, 4000);
- poperror();
qlock(ctlr);
for(;;){
diff --git a/sys/src/9/pc/etherm10g.c b/sys/src/9/pc/etherm10g.c
index 69a1245aa..a27768ab0 100644
--- a/sys/src/9/pc/etherm10g.c
+++ b/sys/src/9/pc/etherm10g.c
@@ -1082,6 +1082,8 @@ m10rx(void *v)
e = v;
c = e->ctlr;
+ while(waserror())
+ ;
for(;;){
replenish(&c->sm);
replenish(&c->bg);
@@ -1144,6 +1146,8 @@ txproc(void *v)
e = v;
c = e->ctlr;
tx = &c->tx;
+ while(waserror())
+ ;
for(;;){
sleep(&c->txrendez, txcansleep, c);
txcleanup(tx, gbit32(c->stats->txcnt));
diff --git a/sys/src/9/pc/ethervt6102.c b/sys/src/9/pc/ethervt6102.c
index 7b5fe980b..2e7b65c0a 100644
--- a/sys/src/9/pc/ethervt6102.c
+++ b/sys/src/9/pc/ethervt6102.c
@@ -440,6 +440,8 @@ vt6102lproc(void* arg)
edev = arg;
ctlr = edev->ctlr;
+ while(waserror())
+ ;
for(;;){
if(ctlr->mii == nil || ctlr->mii->curphy == nil)
break;
diff --git a/sys/src/9/pc/ethervt6105m.c b/sys/src/9/pc/ethervt6105m.c
index 9b608c422..888edcc2a 100644
--- a/sys/src/9/pc/ethervt6105m.c
+++ b/sys/src/9/pc/ethervt6105m.c
@@ -547,6 +547,8 @@ vt6105Mlproc(void* arg)
edev = arg;
ctlr = edev->ctlr;
+ while(waserror())
+ ;
for(;;){
if(ctlr->mii == nil || ctlr->mii->curphy == nil)
break;
diff --git a/sys/src/9/pc/etheryuk.c b/sys/src/9/pc/etheryuk.c
index 0ca3dfb94..e4c5ba548 100644
--- a/sys/src/9/pc/etheryuk.c
+++ b/sys/src/9/pc/etheryuk.c
@@ -1243,6 +1243,8 @@ tproc(void *v)
txinit(e);
linkup(c, Txen);
+ while(waserror())
+ ;
for(;;){
if((b = qbread(e->oq, 100000)) == nil)
break;
@@ -1381,6 +1383,8 @@ rproc(void *v)
rxinit(e);
linkup(c, Rxen);
+ while(waserror())
+ ;
for(;;)
if(replenish(e, c) == 0){
starve(k);
@@ -1750,7 +1754,8 @@ iproc(void *v)
e = v;
c = e->ctlr;
k = &c->iproc;
-
+ while(waserror())
+ ;
for(;;){
starve(k);
cause = c->reg[Eisr];
diff --git a/sys/src/9/pc/pcrandom.c b/sys/src/9/pc/pcrandom.c
index db77fbbdd..386d7bf8e 100644
--- a/sys/src/9/pc/pcrandom.c
+++ b/sys/src/9/pc/pcrandom.c
@@ -44,10 +44,11 @@ genrandom(void*)
up->basepri = PriNormal;
up->priority = up->basepri;
+ while(waserror())
+ ;
for(;;){
- for(;;)
- if(++rb.randomcount > 100000)
- break;
+ if(++rb.randomcount <= 100000)
+ continue;
if(anyhigher())
sched();
if(!rbnotfull(0))
diff --git a/sys/src/9/pc/sdiahci.c b/sys/src/9/pc/sdiahci.c
index 4a70c50ae..0c157d7a9 100644
--- a/sys/src/9/pc/sdiahci.c
+++ b/sys/src/9/pc/sdiahci.c
@@ -1177,6 +1177,8 @@ satakproc(void*)
{
int i;
+ while(waserror())
+ ;
for(;;){
tsleep(&up->sleep, return0, 0, Nms);
for(i = 0; i < niadrive; i++)
diff --git a/sys/src/9/pc/sdmv50xx.c b/sys/src/9/pc/sdmv50xx.c
index eb28df098..5ebb6d6fd 100644
--- a/sys/src/9/pc/sdmv50xx.c
+++ b/sys/src/9/pc/sdmv50xx.c
@@ -1100,6 +1100,8 @@ satakproc(void*)
{
int i;
+ while(waserror())
+ ;
for(;;){
tsleep(&up->sleep, return0, 0, Nms);
for(i = 0; i < nmvsatadrive; i++)
diff --git a/sys/src/9/pc/sdodin.c b/sys/src/9/pc/sdodin.c
index 3f35d7f51..0153b3db6 100644
--- a/sys/src/9/pc/sdodin.c
+++ b/sys/src/9/pc/sdodin.c
@@ -2272,6 +2272,8 @@ mskproc(void*)
{
int i;
+ while(waserror())
+ ;
for(;;){
tsleep(&up->sleep, return0, 0, Nms);
for(i = 0; i < nmsdrive; i++)
diff --git a/sys/src/9/pc/wavelan.c b/sys/src/9/pc/wavelan.c
index 27fe622e5..74437194a 100644
--- a/sys/src/9/pc/wavelan.c
+++ b/sys/src/9/pc/wavelan.c
@@ -682,6 +682,8 @@ w_timer(void* arg)
Ctlr* ctlr = (Ctlr*)ether->ctlr;
ctlr->timerproc = up;
+ while(waserror())
+ ;
for(;;){
tsleep(&up->sleep, return0, 0, MSperTick);
ctlr = (Ctlr*)ether->ctlr;
@@ -732,7 +734,7 @@ w_timer(void* arg)
}
iunlock(ctlr);
}
- pexit("terminated", 0);
+ pexit("terminated", 1);
}
void
diff --git a/sys/src/9/pc/wifi.c b/sys/src/9/pc/wifi.c
index a4e160fa1..39959d9f8 100644
--- a/sys/src/9/pc/wifi.c
+++ b/sys/src/9/pc/wifi.c
@@ -450,9 +450,14 @@ wifiproc(void *arg)
b = nil;
wifi = arg;
+ while(waserror())
+ ;
for(;;){
- if(b != nil)
+ if(b != nil){
freeb(b);
+ b = nil;
+ continue;
+ }
if((b = qbread(wifi->iq, 100000)) == nil)
break;
w = (Wifipkt*)b->rp;
@@ -526,7 +531,7 @@ wifiproc(void *arg)
break;
}
}
- pexit("wifi in queue closed", 0);
+ pexit("wifi in queue closed", 1);
}
static void
@@ -584,9 +589,11 @@ wifoproc(void *arg)
wifi = arg;
ether = wifi->ether;
+ while(waserror())
+ ;
while((b = qbread(ether->oq, 1000000)) != nil)
wifietheroq(wifi, b);
- pexit("ether out queue closed", 0);
+ pexit("ether out queue closed", 1);
}
static void