summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/pmmc.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-07-26 04:37:32 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-07-26 04:37:32 +0200
commit2009d55643b87d6d0618c2fcfce5c440147138eb (patch)
tree9634647b7ed4f9960f8d54c5c9c83a83474b05da /sys/src/9/pc/pmmc.c
parentac52599eef2ab79a64c30a8046a51b62501ca9ab (diff)
ether82563, etheriwl, pmmc: fix potential multiprocessor races with wakeup
make sure that the wakeup enable conditions are seen by different processors before sleep is called. the problems havnt been observed so far.
Diffstat (limited to 'sys/src/9/pc/pmmc.c')
-rw-r--r--sys/src/9/pc/pmmc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/src/9/pc/pmmc.c b/sys/src/9/pc/pmmc.c
index 7c95d74bb..2d2cd8af6 100644
--- a/sys/src/9/pc/pmmc.c
+++ b/sys/src/9/pc/pmmc.c
@@ -362,7 +362,9 @@ intrwait(Ctlr *c, u32int mask, int tmo)
{
u32int status;
+ ilock(c);
c->waitmsk = Seint | mask;
+ iunlock(c);
do {
if(!waserror()){
tsleep(&c->r, waitcond, c, 100);
@@ -373,11 +375,10 @@ intrwait(Ctlr *c, u32int mask, int tmo)
break;
tmo -= 100;
} while(tmo > 0);
-
ilock(c);
+ c->waitmsk = 0;
status = c->waitsts;
c->waitsts &= ~(status & mask);
- c->waitmsk = 0;
if((status & mask) == 0 || (status & Seint) != 0){
/* abort command on timeout/error interrupt */
softreset(c, 0);
@@ -386,7 +387,7 @@ intrwait(Ctlr *c, u32int mask, int tmo)
}
iunlock(c);
- return status;
+ return status & mask;
}