M port/devlance.c => port/devlance.c +2 -16
@@ 549,16 549,12 @@ lanceinit(void)
Chan*
lanceattach(char *spec)
{
- Chan *c;
-
if(l.kstarted == 0){
kproc("lancekproc", lancekproc, 0);/**/
l.kstarted = 1;
lancestart();
}
- c = devattach('l', spec);
- c->dev = 0;
- return c;
+ return devattach('l', spec);
}
Chan*
@@ 595,8 591,6 @@ lancestat(Chan *c, char *dp)
Chan*
lanceopen(Chan *c, int omode)
{
- extern Qinfo nonetinfo;
-
switch(c->qid.path){
case CHDIR:
case Ltraceqid:
@@ 623,16 617,8 @@ lancecreate(Chan *c, char *name, int omode, ulong perm)
void
lanceclose(Chan *c)
{
- /* real closing happens in lancestclose */
- switch(c->qid.path){
- case CHDIR:
- case Ltraceqid:
- case Lstatsqid:
- break;
- default:
+ if(c->stream)
streamclose(c);
- break;
- }
}
static long
M port/devnonet.c => port/devnonet.c +1 -1
@@ 276,7 276,7 @@ nonetopen(Chan *c, int omode)
line = STREAMID(c->qid.path);
ifc = &noifc[c->dev];
if(ifc->conv[line].state != Cannounced)
- error(Enoannounce);
+ errors("channel not announced");
nolisten(c, ifc);
break;
case Nraddrqid:
M port/stream.c => port/stream.c +44 -0
@@ 441,6 441,49 @@ putq(Queue *q, Block *bp)
unlock(q);
return delim;
}
+
+int
+blen(Block *bp)
+{
+ int len;
+
+ len = 0;
+ while(bp) {
+ len += BLEN(bp);
+ bp = bp->next;
+ }
+
+ return len;
+}
+
+/*
+ * bround - round a block to chain to some 2^n number of bytes
+ */
+int
+bround(Block *bp, int amount)
+{
+ Block *last;
+ int len, pad;
+
+ len = 0;
+ SET(last);
+ while(bp) {
+ len += BLEN(bp);
+ last = bp;
+ bp = bp->next;
+ }
+
+ pad = ((len + amount) & ~amount) - len;
+ if(pad) {
+ last->next = allocb(pad);
+ memset(last->next->rptr, 0, pad);
+ last->next->flags |= S_DELIM;
+ last->flags &= ~S_DELIM;
+ }
+
+ return len + pad;
+}
+
int
putb(Blist *q, Block *bp)
{
@@ 597,6 640,7 @@ prepend(Block *bp, int n)
}
}
+
/*
* put a block into the bit bucket
*/
M power/devhotrod.c => power/devhotrod.c +1 -0
@@ 13,6 13,7 @@
/*
* If defined, ENABMEMTEST causes memory test to be run at device open
*/
+#define ENABMEMTEST
#ifdef ENABMEMTEST
void mem(Hot*, ulong*, ulong);
#define NTESTBUF 256
M power/trap.c => power/trap.c +17 -1
@@ 176,6 176,7 @@ void
intr(Ureg *ur)
{
int i, any;
+ uchar xxx;
uchar pend, npend;
long v;
ulong cause;
@@ 215,7 216,8 @@ intr(Ureg *ur)
/*
* 3. read pending interrupts
*/
- npend = pend = SBCCREG->fintpending;
+ pend = SBCCREG->fintpending;
+ npend = pend;
/*
* 4. clear pending register
@@ 224,6 226,20 @@ intr(Ureg *ur)
USED(i);
/*
+ * 4a. attempt to fix problem
+ */
+ if(!(*INTPENDREG & (1<<5)))
+ print("pause again\n");
+ while(!(*INTPENDREG & (1<<5)))
+ ;
+ xxx = SBCCREG->fintpending;
+ if(xxx){
+ print("new pend %ux\n", xxx);
+ npend = pend |= xxx;
+ i = SBCCREG->flevel;
+ }
+
+ /*
* 5a. process lance, scsi
*/
if(pend & 1) {