M boot/rc.c => boot/rc.c +8 -1
@@ 2,10 2,17 @@
#include <libc.h>
#include <../boot/boot.h>
+/* minimal rc main */
+char rcmain[] = "home=/\n"
+ "ifs=' \t\n'\n"
+ "prompt=('% ' '\t')\n"
+ "path=/\n";
+
void
configrc(Method *)
{
- execl("/rc", "/rc", "-m", "/rcmain", "-i", 0);
+ setenv("rcmain", rcmain);
+ execl("/rc", "/rc", "-m", "#e/rcmain", "-i", 0);
fatal("rc");
}
M pc/ether82543gc.c => pc/ether82543gc.c +40 -0
@@ 316,6 316,8 @@ typedef struct Ctlr {
int tdh; /* transmit descriptor head */
int tdt; /* transmit descriptor tail */
int ett; /* early transmit threshold */
+
+ ulong multimask[128]; /* bit mask for multicast addresses */
} Ctlr;
static Ctlr* ctlrhead;
@@ 949,6 951,42 @@ print("status1 %8.8uX\n", csr32r(ctlr, Status));
}
}
+static void
+gc82543promiscuous(void* arg, int on)
+{
+ Ether *edev=arg;
+ Ctlr *ctlr;
+ ulong ctl;
+
+ ctlr = edev->ctlr;
+ ctl = csr32r(ctlr, Rctl);
+ ctl &= ~MoMASK; /* make sure we're using bits 47:36 */
+ if(on)
+ ctl |= Upe|Mpe;
+ else
+ ctl &= ~(Upe|Mpe);
+ csr32w(ctlr, Rctl, ctl);
+}
+
+static void
+gc82543multicast(void* arg, uchar *addr, int on)
+{
+ Ether *edev=arg;
+ Ctlr *ctlr;
+ int x;
+ int bit;
+
+ ctlr = edev->ctlr;
+ x = addr[5]>>1;
+ bit = ((addr[5]&1)<<4)|(addr[4]>>4);
+ if(on)
+ ctlr->multimask[x] |= 1<<bit;
+ else
+ ctlr->multimask[x] &= ~(1<<bit);
+
+ csr32w(ctlr, Mta+x*4, ctlr->multimask[x]);
+}
+
static int
gc82543pnp(Ether* edev)
{
@@ 1002,6 1040,8 @@ gc82543pnp(Ether* edev)
edev->interrupt = gc82543interrupt;
edev->ifstat = gc82543ifstat;
edev->shutdown = gc82543shutdown;
+ edev->promiscuous = gc82543promiscuous;
+ edev->multicast = gc82543multicast;
edev->arg = edev;
edev->promiscuous = nil;
M port/alarm.c => port/alarm.c +0 -1
@@ 14,7 14,6 @@ alarmkproc(void*)
Proc *rp;
ulong now;
-print("alarmkproc\n");
for(;;){
now = MACHP(0)->ticks;
qlock(&alarms);
M port/chan.c => port/chan.c +29 -9
@@ 418,6 418,26 @@ eqchantdqid(Chan *a, int type, int dev, Qid qid, int pathonly)
return 1;
}
+Mhead*
+newmhead(Chan *from)
+{
+ Mhead *mh;
+ int n;
+
+ mh = smalloc(sizeof(Mhead));
+ mh->ref = 1;
+ mh->from = from;
+ incref(from);
+
+ n = from->name->len;
+ if(n >= sizeof(mh->fromname))
+ n = sizeof(mh->fromname)-1;
+ memmove(mh->fromname, from->name->s, n);
+ mh->fromname[n] = 0;
+
+ return mh;
+}
+
int
cmount(Chan **newp, Chan *old, int flag, char *spec)
{
@@ 430,8 450,7 @@ cmount(Chan **newp, Chan *old, int flag, char *spec)
if(QTDIR & (old->qid.type^(*newp)->qid.type))
error(Emount);
-if(old->umh)
- print("cmount old extra umh\n");
+if(old->umh)print("cmount old extra umh\n");
order = flag&MORDER;
@@ 476,11 495,7 @@ if(old->umh)
* nothing mounted here yet. create a mount
* head and add to the hash table.
*/
- m = smalloc(sizeof(Mhead));
- m->ref = 1;
- m->from = old;
- incref(old);
- m->hash = *l;
+ m = newmhead(old);
*l = m;
/*
@@ 584,7 599,6 @@ cunmount(Chan *mnt, Chan *mounted)
putmhead(m);
return;
}
- wunlock(&pg->ns);
p = &m->mount;
for(f = *p; f; f = f->next) {
@@ 598,15 612,18 @@ cunmount(Chan *mnt, Chan *mounted)
*l = m->hash;
cclose(m->from);
wunlock(&m->lock);
+ wunlock(&pg->ns);
putmhead(m);
return;
}
wunlock(&m->lock);
+ wunlock(&pg->ns);
return;
}
p = &f->next;
}
wunlock(&m->lock);
+ wunlock(&pg->ns);
error(Eunion);
}
@@ 1131,6 1148,8 @@ namec(char *aname, int amode, int omode, ulong perm)
m = nil;
if(!nomount)
domount(&c, &m);
+ if(c->umh != nil)
+ putmhead(c->umh);
c->umh = m;
break;
@@ 1159,8 1178,9 @@ namec(char *aname, int amode, int omode, ulong perm)
case Aopen:
case Acreate:
if(c->umh != nil){
- print("cunique umh\n");
+ print("cunique umh Open\n");
putmhead(c->umh);
+ c->umh = nil;
}
/* only save the mount head if it's a multiple element union */
M port/pgrp.c => port/pgrp.c +1 -4
@@ 134,10 134,7 @@ pgrpcpy(Pgrp *to, Pgrp *from)
l = tom++;
for(f = from->mnthash[i]; f; f = f->hash) {
rlock(&f->lock);
- mh = smalloc(sizeof(Mhead));
- mh->from = f->from;
- mh->ref = 1;
- incref(mh->from);
+ mh = newmhead(f->from);
*l = mh;
l = &mh->hash;
link = &mh->mount;
M port/portdat.h => port/portdat.h +1 -0
@@ 250,6 250,7 @@ struct Mount
struct Mhead
{
+ char fromname[32]; /* temporary for debugging */
Ref;
RWlock lock;
Chan* from; /* channel mounted upon */
M port/portfns.h => port/portfns.h +1 -0
@@ 182,6 182,7 @@ Chan* namec(char*, int, int, ulong);
#define nelem(x) (sizeof(x)/sizeof(x[0]))
Chan* newchan(void);
int newfd(Chan*);
+Mhead* newmhead(Chan*);
Mount* newmount(Mhead*, Chan*, int, char*);
Page* newpage(int, Segment **, ulong);
Pgrp* newpgrp(void);