M power/dat.h => power/dat.h +1 -0
@@ 144,6 144,7 @@ struct Mach
int syscall;
int load;
int intr;
+ int ledval; /* value last written to LED */
int stack[1];
};
M power/devhotrod.c => power/devhotrod.c +3 -0
@@ 412,9 412,11 @@ hotrodintr(int vec)
Hotmsg *hm;
ulong l;
+ LEDON(LEDhotintr);
h = &hotrod[vec - Vmevec];
if(h<hotrod || h>&hotrod[Nhotrod]){
print("bad hotrod vec\n");
+ LEDOFF(LEDhotintr);
return;
}
while(l = h->addr->replyq[h->ri]){ /* assign = */
@@ 427,4 429,5 @@ hotrodintr(int vec)
if(!hm->abort)
wakeup(&hm->r);
}
+ LEDOFF(LEDhotintr);
}
M power/faultmips.c => power/faultmips.c +4 -0
@@ 5,6 5,7 @@
#include "fns.h"
#include "ureg.h"
#include "../port/error.h"
+#include "io.h"
/*
* find out fault address and type of access.
@@ 18,6 19,7 @@ faultmips(Ureg *ur, int user, int code)
char buf[ERRLEN];
int read;
+ LEDON(LEDfault);
addr = ur->badvaddr;
addr &= ~(BY2PG-1);
read = !(code==CTLBM || code==CTLBS);
@@ 27,6 29,7 @@ faultmips(Ureg *ur, int user, int code)
sprint(buf, "sys: trap: fault %s addr=0x%lux",
read? "read" : "write", ur->badvaddr);
postnote(u->p, 1, buf, NDebug);
+ LEDOFF(LEDfault);
return;
}
print("kernel %s badvaddr=0x%lux\n", excname[code], ur->badvaddr);
@@ 34,6 37,7 @@ faultmips(Ureg *ur, int user, int code)
dumpregs(ur);
panic("fault");
}
+ LEDOFF(LEDfault);
}
/*
M power/io.h => power/io.h +8 -0
@@ 7,6 7,14 @@
#define SBSEMTOP SYNCBUS(ulong, 0x400000)
#define LED ((char*)0xBF200001)
+enum
+{
+ LEDhotintr= 1<<0,
+ LEDclock= 1<<1,
+ LEDfault= 1<<2,
+};
+#define LEDON(x) { m->ledval |= x; *LED = m->ledval; }
+#define LEDOFF(x) { m->ledval &= ~x; *LED = m->ledval; }
typedef struct SBCC SBCC;
typedef struct Timer Timer;
M power/trap.c => power/trap.c +2 -0
@@ 190,7 190,9 @@ intr(Ureg *ur)
m->intr++;
cause = ur->cause&(INTR5|INTR4|INTR3|INTR2|INTR1);
if(cause & (INTR2|INTR4)){
+ LEDON(LEDclock);
clock(ur);
+ LEDOFF(LEDclock);
cause &= ~(INTR2|INTR4);
}
if(cause & INTR1){