Browse Source

Plan 9 from Bell Labs 2007-04-01

David du Colombier 14 years ago
parent
commit
a72235377f

+ 3 - 3
dist/replica/_plan9.db

@@ -8002,7 +8002,7 @@ sys/src/9/pc/ether8390.h - 664 sys sys 1015014517 1511
 sys/src/9/pc/etherdp83820.c - 664 sys sys 1175292818 29621
 sys/src/9/pc/etherec2t.c - 664 sys sys 1135784135 4092
 sys/src/9/pc/etherelnk3.c - 664 sys sys 1158012427 48807
-sys/src/9/pc/etherga620.c - 664 sys sys 1174020176 29882
+sys/src/9/pc/etherga620.c - 664 sys sys 1175322931 29912
 sys/src/9/pc/etherga620fw.h - 664 sys sys 1026847642 222295
 sys/src/9/pc/etherif.h - 664 sys sys 1088178711 961
 sys/src/9/pc/etherigbe.c - 664 sys sys 1168306113 44967
@@ -14098,11 +14098,11 @@ sys/src/cmd/upas/filterkit/readaddrs.c - 664 sys sys 1143759341 1331
 sys/src/cmd/upas/filterkit/token.c - 664 sys sys 1162952184 1319
 sys/src/cmd/upas/fs - 20000000775 sys sys 1143946985 0
 sys/src/cmd/upas/fs/dat.h - 664 sys sys 1143929916 4189
-sys/src/cmd/upas/fs/fs.c - 664 sys sys 1165967907 26929
+sys/src/cmd/upas/fs/fs.c - 664 sys sys 1175322795 26929
 sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1165967944 16484
 sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1165967884 27070
 sys/src/cmd/upas/fs/mkfile - 664 sys sys 1047490336 321
-sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1165967878 7480
+sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1175322803 7498
 sys/src/cmd/upas/fs/pop3.c - 664 sys sys 1133988332 13024
 sys/src/cmd/upas/fs/readdir.c - 664 sys sys 944961331 203
 sys/src/cmd/upas/fs/rfc2047-test - 664 sys sys 1143946985 1146

+ 3 - 3
dist/replica/plan9.db

@@ -8002,7 +8002,7 @@ sys/src/9/pc/ether8390.h - 664 sys sys 1015014517 1511
 sys/src/9/pc/etherdp83820.c - 664 sys sys 1175292818 29621
 sys/src/9/pc/etherec2t.c - 664 sys sys 1135784135 4092
 sys/src/9/pc/etherelnk3.c - 664 sys sys 1158012427 48807
-sys/src/9/pc/etherga620.c - 664 sys sys 1174020176 29882
+sys/src/9/pc/etherga620.c - 664 sys sys 1175322931 29912
 sys/src/9/pc/etherga620fw.h - 664 sys sys 1026847642 222295
 sys/src/9/pc/etherif.h - 664 sys sys 1088178711 961
 sys/src/9/pc/etherigbe.c - 664 sys sys 1168306113 44967
@@ -14098,11 +14098,11 @@ sys/src/cmd/upas/filterkit/readaddrs.c - 664 sys sys 1143759341 1331
 sys/src/cmd/upas/filterkit/token.c - 664 sys sys 1162952184 1319
 sys/src/cmd/upas/fs - 20000000775 sys sys 1143946985 0
 sys/src/cmd/upas/fs/dat.h - 664 sys sys 1143929916 4189
-sys/src/cmd/upas/fs/fs.c - 664 sys sys 1165967907 26929
+sys/src/cmd/upas/fs/fs.c - 664 sys sys 1175322795 26929
 sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1165967944 16484
 sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1165967884 27070
 sys/src/cmd/upas/fs/mkfile - 664 sys sys 1047490336 321
-sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1165967878 7480
+sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1175322803 7498
 sys/src/cmd/upas/fs/pop3.c - 664 sys sys 1133988332 13024
 sys/src/cmd/upas/fs/readdir.c - 664 sys sys 944961331 203
 sys/src/cmd/upas/fs/rfc2047-test - 664 sys sys 1143946985 1146

+ 3 - 0
dist/replica/plan9.log

@@ -48105,3 +48105,6 @@
 1175293867 0 c sys/src/9/pc/etherdp83820.c - 664 sys sys 1175292818 29621
 1175311806 0 c 386/9loaddebug - 775 sys sys 1175311076 402159
 1175311806 1 c 386/9loadlitedebug - 775 sys sys 1175311076 202588
+1175324417 0 c sys/src/9/pc/etherga620.c - 664 sys sys 1175322931 29912
+1175324417 1 c sys/src/cmd/upas/fs/fs.c - 664 sys sys 1175322795 26929
+1175324417 2 c sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1175322803 7498

+ 27 - 26
sys/src/9/pc/etherga620.c

@@ -150,17 +150,17 @@ typedef struct Host64 {
 } Host64;
 
 typedef struct Ere {			/* Event Ring Element */
-	int	event;			/* (event<<24)|(code<<12)|index */
+	int	event;			/* event<<24 | code<<12 | index */
 	int	unused;
 } Ere;
 
-typedef int Cmd;			/* (cmd<<24)|(flags<<12)|index */
+typedef int Cmd;			/* cmd<<24 | flags<<12 | index */
 
 typedef struct Rbd {			/* Receive Buffer Descriptor */
 	Host64	addr;
-	int	indexlen;		/* (ring-index<<16)|buffer-length */
+	int	indexlen;		/* ring-index<<16 | buffer-length */
 	int	flags;			/* only lower 16-bits */
-	int	checksum;		/* (ip<<16)|tcp/udp */
+	int	checksum;		/* ip<<16 | tcp/udp */
 	int	error;			/* only upper 16-bits */
 	int	reserved;
 	void*	opaque;			/* passed to receive return ring */
@@ -168,7 +168,7 @@ typedef struct Rbd {			/* Receive Buffer Descriptor */
 
 typedef struct Sbd {			/* Send Buffer Descriptor */
 	Host64	addr;
-	int	lenflags;		/* (len<<16)|flags */
+	int	lenflags;		/* len<<16 | flags */
 	int	reserved;
 } Sbd;
 
@@ -196,7 +196,7 @@ enum {					/* Buffer Error Flags */
 
 typedef struct Rcb {			/* Ring Control Block */
 	Host64	addr;			/* points to the Rbd ring */
-	int	control;		/* (max_len<<16)|flags */
+	int	control;		/* max_len<<16 | flags */
 	int	unused;
 } Rcb;
 
@@ -318,7 +318,7 @@ ga620command(Ctlr* ctlr, int cmd, int flags, int index)
 	int cpi;
 
 	cpi = csr32r(ctlr, Cpi);
-	csr32w(ctlr, Cr+(cpi*4), (cmd<<24)|(flags<<12)|index);
+	csr32w(ctlr, Cr+(cpi*4), cmd<<24 | flags<<12 | index);
 	cpi = NEXT(cpi, Ncr);
 	csr32w(ctlr, Cpi, cpi);
 }
@@ -516,7 +516,7 @@ _ga620transmit(Ether* edev)
 
 		sbd = &ctlr->sr[spi];
 		sethost64(&sbd->addr, bp->rp);
-		sbd->lenflags = (BLEN(bp)<<16)|Fend;
+		sbd->lenflags = BLEN(bp)<<16 | Fend;
 
 		ctlr->srb[spi] = bp;
 		work++;
@@ -547,7 +547,7 @@ ga620replenish(Ctlr* ctlr)
 			break;
 		rbd = &ctlr->rsr[rspi];
 		sethost64(&rbd->addr, bp->rp);
-		rbd->indexlen = (rspi<<16)|(ETHERMAXTU+4);
+		rbd->indexlen = rspi<<16 | (ETHERMAXTU+4);
 		rbd->flags = 0;
 		rbd->opaque = bp;
 
@@ -576,8 +576,8 @@ ga620event(Ether *edev, int eci, int epi)
 			 * 3rd arg of 1 selects gigabit only; 2 10/100 only.
 			 */
 			ga620command(ctlr, 0x0B, 0x00, 0x00);
-			print("#l%d: ga620: port %8.8uX: event %8.8uX\n",
-				edev->ctlrno, ctlr->port, event);
+			print("#l%d: ga620: port %8.8uX: firmware is up\n",
+				edev->ctlrno, ctlr->port);
 			break;
 		case 0x04:		/* statistics updated */
 			break;
@@ -599,7 +599,8 @@ ga620event(Ether *edev, int eci, int epi)
 			break;
 		case 0x07:		/* event error */
 		default:
-			print("ga620: er[%d] = %8.8uX\n", eci, event);
+			print("#l%d: ga620: er[%d] = %8.8uX\n", edev->ctlrno,
+				eci, event);
 			break;
 		}
 		eci = NEXT(eci, Ner);
@@ -743,9 +744,9 @@ ga620init(Ether* edev)
 	/*
 	 * Load the MAC address.
 	 */
-	ea = (edev->ea[0]<<8)|edev->ea[1];
+	ea = edev->ea[0]<<8 | edev->ea[1];
 	csr32w(ctlr, Mac, ea);
-	ea = (edev->ea[2]<<24)|(edev->ea[3]<<16)|(edev->ea[4]<<8)|edev->ea[5];
+	ea = edev->ea[2]<<24 | edev->ea[3]<<16 | edev->ea[4]<<8 | edev->ea[5];
 	csr32w(ctlr, Mac+4, ea);
 
 	/*
@@ -801,7 +802,7 @@ ga620init(Ether* edev)
 		flags = HostRing;
 	if(ctlr->coalupdateonly) 
 		flags |= CoalUpdateOnly;
-	ctlr->gib->srcb.control = (Nsr<<16)|flags;
+	ctlr->gib->srcb.control = Nsr<<16 | flags;
 	sethost64(&ctlr->gib->scp, ctlr->sci);
 	csr32w(ctlr, Spi, 0);
 	ctlr->srb = malloc(sizeof(Block*)*Nsr);
@@ -815,7 +816,7 @@ ga620init(Ether* edev)
 		flags = TcpUdpCksum|NoPseudoHdrCksum;
 	else
 		flags = 0;
-	ctlr->gib->rsrcb.control = ((ETHERMAXTU+4)<<16)|flags;
+	ctlr->gib->rsrcb.control = (ETHERMAXTU+4)<<16 | flags;
 	csr32w(ctlr, Rspi, 0);
 
 	/*
@@ -831,7 +832,7 @@ ga620init(Ether* edev)
 	 */
 	ctlr->rrr = malign(sizeof(Rbd)*Nrrr);
 	sethost64(&ctlr->gib->rrrcb.addr, ctlr->rrr);
-	ctlr->gib->rrrcb.control = (Nrrr<<16)|0;
+	ctlr->gib->rrrcb.control = Nrrr<<16 | 0;
 	sethost64(&ctlr->gib->rrrpp, ctlr->rrrpi);
 	ctlr->rrrci = 0;
 
@@ -1053,8 +1054,8 @@ ga620detach(Ctlr* ctlr)
 	 * wait for code to be loaded from serial EEPROM or flash;
 	 * make sure CPU A is halted.
 	 */
-	csr32w(ctlr, Mhc, (Hr<<24)|Hr);
-	csr32w(ctlr, Mhc, ((Eews|Ci)<<24)|(Eews|Ci));
+	csr32w(ctlr, Mhc, Hr<<24 | Hr);
+	csr32w(ctlr, Mhc, (Eews|Ci)<<24 | Eews|Ci);
 
 	microdelay(1);
 	for(timeo = 0; timeo < 500000; timeo++){
@@ -1153,15 +1154,15 @@ ga620pci(void)
 		if(p->ccrb != 0x02 || p->ccru != 0)
 			continue;
 
-		switch((p->did<<16)|p->vid){
+		switch(p->did<<16 | p->vid){
 		default:
 			continue;
-		case (0x620A<<16)|0x1385:	/* Netgear GA620 */
-		case (0x630A<<16)|0x1385:	/* Netgear GA620T */
-		case (0x0001<<16)|0x12AE:	/* Alteon Acenic fiber
+		case 0x620A<<16 | 0x1385:	/* Netgear GA620 fiber */
+		case 0x630A<<16 | 0x1385:	/* Netgear GA620T copper */
+		case 0x0001<<16 | 0x12AE:	/* Alteon Acenic fiber
 						 * and DEC DEGPA-SA */
-		case (0x0002<<16)|0x12AE:	/* Alteon Acenic copper */
-		case (0x0009<<16)|0x10A9:	/* SGI Acenic */
+		case 0x0002<<16 | 0x12AE:	/* Alteon Acenic copper */
+		case 0x0009<<16 | 0x10A9:	/* SGI Acenic */
 			break;
 		}
 
@@ -1174,7 +1175,7 @@ ga620pci(void)
 		ctlr = malloc(sizeof(Ctlr));
 		ctlr->port = p->mem[0].bar & ~0x0F;
 		ctlr->pcidev = p;
-		ctlr->id = (p->did<<16)|p->vid;
+		ctlr->id = p->did<<16 | p->vid;
 
 		ctlr->nic = mem;
 		if(ga620reset(ctlr)){

+ 3 - 3
sys/src/cmd/upas/fs/fs.c

@@ -33,9 +33,9 @@ ulong	path;		// incremented for each new file
 Fid	*fids;
 int	mfd[2];
 char	user[Elemlen];
-int	messagesize = 4*1024*IOHDRSZ;
-uchar	mdata[8*1024*IOHDRSZ];
-uchar	mbuf[8*1024*IOHDRSZ];
+int	messagesize = 4*1024+IOHDRSZ;
+uchar	mdata[8*1024+IOHDRSZ];
+uchar	mbuf[8*1024+IOHDRSZ];
 Fcall	thdr;
 Fcall	rhdr;
 int	fflg;

+ 2 - 1
sys/src/cmd/upas/fs/plan9.c

@@ -42,11 +42,12 @@ addtomessage(Message *m, uchar *p, int n, int done)
 			m->end = m->start;
 		}
 		m->lim = m->start + len;
+		*m->lim = '\0';
 	}
 
 	memmove(m->end, p, n);
 	m->end += n;
-	*m->lim = '\0';
+	*m->end = '\0';
 }
 
 //