Browse Source

Plan 9 from Bell Labs 2007-03-31

David du Colombier 13 years ago
parent
commit
c525990206

+ 5 - 5
dist/replica/_plan9.db

@@ -1,8 +1,8 @@
 386 - 20000000775 sys sys 1010957353 0
 386/9load - 775 sys sys 1171784718 220040
-386/9loaddebug - 775 sys sys 1175111768 401962
+386/9loaddebug - 775 sys sys 1175311076 402159
 386/9loadlite - 775 sys sys 1171784720 137116
-386/9loadlitedebug - 775 sys sys 1174186577 202506
+386/9loadlitedebug - 775 sys sys 1175311076 202588
 386/9pc - 775 sys sys 1161230890 1924142
 386/9pc.gz - 664 sys sys 1161232307 821176
 386/9pccpu - 775 sys sys 1161230955 1636008
@@ -7999,7 +7999,7 @@ sys/src/9/pc/ether82557.c - 664 sys sys 1153082663 30197
 sys/src/9/pc/ether83815.c - 664 sys sys 1172259521 26346
 sys/src/9/pc/ether8390.c - 664 sys sys 1131290377 17702
 sys/src/9/pc/ether8390.h - 664 sys sys 1015014517 1511
-sys/src/9/pc/etherdp83820.c - 664 sys sys 1160069116 29352
+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
@@ -9070,7 +9070,7 @@ sys/src/boot/pc/ether8390.h - 664 sys sys 1015007951 1392
 sys/src/boot/pc/etherec2t.c - 664 sys sys 1015007951 3598
 sys/src/boot/pc/etherelnk3.c - 664 sys sys 1158012439 44736
 sys/src/boot/pc/etherelnk3x.c - 664 sys sys 1015007951 24989
-sys/src/boot/pc/etherga620.c - 664 sys sys 1174944362 26969
+sys/src/boot/pc/etherga620.c - 664 sys sys 1175289484 27168
 sys/src/boot/pc/etherga620fw.h - 664 sys sys 1174080072 222295
 sys/src/boot/pc/etherif.h - 664 sys sys 1174077279 1338
 sys/src/boot/pc/etherigbe.c - 664 sys sys 1140710606 40769
@@ -9089,7 +9089,7 @@ sys/src/boot/pc/kfs.h - 664 sys sys 1032215924 861
 sys/src/boot/pc/kfsboot.c - 664 sys sys 1032215914 4788
 sys/src/boot/pc/l.s - 664 sys sys 1130887225 18115
 sys/src/boot/pc/lib.h - 664 sys sys 1135487939 2796
-sys/src/boot/pc/load.c - 664 sys sys 1174077194 9288
+sys/src/boot/pc/load.c - 664 sys sys 1175289729 9410
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mem.h - 664 sys sys 1130887225 3371
 sys/src/boot/pc/memory.c - 664 sys sys 1019533021 10272

+ 5 - 5
dist/replica/plan9.db

@@ -1,8 +1,8 @@
 386 - 20000000775 sys sys 1010957353 0
 386/9load - 775 sys sys 1171784718 220040
-386/9loaddebug - 775 sys sys 1175111768 401962
+386/9loaddebug - 775 sys sys 1175311076 402159
 386/9loadlite - 775 sys sys 1171784720 137116
-386/9loadlitedebug - 775 sys sys 1174186577 202506
+386/9loadlitedebug - 775 sys sys 1175311076 202588
 386/9pc - 775 sys sys 1161230890 1924142
 386/9pc.gz - 664 sys sys 1161232307 821176
 386/9pccpu - 775 sys sys 1161230955 1636008
@@ -7999,7 +7999,7 @@ sys/src/9/pc/ether82557.c - 664 sys sys 1153082663 30197
 sys/src/9/pc/ether83815.c - 664 sys sys 1172259521 26346
 sys/src/9/pc/ether8390.c - 664 sys sys 1131290377 17702
 sys/src/9/pc/ether8390.h - 664 sys sys 1015014517 1511
-sys/src/9/pc/etherdp83820.c - 664 sys sys 1160069116 29352
+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
@@ -9070,7 +9070,7 @@ sys/src/boot/pc/ether8390.h - 664 sys sys 1015007951 1392
 sys/src/boot/pc/etherec2t.c - 664 sys sys 1015007951 3598
 sys/src/boot/pc/etherelnk3.c - 664 sys sys 1158012439 44736
 sys/src/boot/pc/etherelnk3x.c - 664 sys sys 1015007951 24989
-sys/src/boot/pc/etherga620.c - 664 sys sys 1174944362 26969
+sys/src/boot/pc/etherga620.c - 664 sys sys 1175289484 27168
 sys/src/boot/pc/etherga620fw.h - 664 sys sys 1174080072 222295
 sys/src/boot/pc/etherif.h - 664 sys sys 1174077279 1338
 sys/src/boot/pc/etherigbe.c - 664 sys sys 1140710606 40769
@@ -9089,7 +9089,7 @@ sys/src/boot/pc/kfs.h - 664 sys sys 1032215924 861
 sys/src/boot/pc/kfsboot.c - 664 sys sys 1032215914 4788
 sys/src/boot/pc/l.s - 664 sys sys 1130887225 18115
 sys/src/boot/pc/lib.h - 664 sys sys 1135487939 2796
-sys/src/boot/pc/load.c - 664 sys sys 1174077194 9288
+sys/src/boot/pc/load.c - 664 sys sys 1175289729 9410
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mem.h - 664 sys sys 1130887225 3371
 sys/src/boot/pc/memory.c - 664 sys sys 1019533021 10272

+ 5 - 0
dist/replica/plan9.log

@@ -48100,3 +48100,8 @@
 1175142616 0 c sys/lib/tmac/tmac.an - 664 sys sys 1175141775 8441
 1175146216 0 c sys/man/3/fs - 664 sys sys 1175145095 3147
 1175146216 1 c sys/src/9/port/devfs.c - 664 sys sys 1175146085 11517
+1175290216 0 c sys/src/boot/pc/load.c - 664 sys sys 1175289729 9410
+1175290216 1 c sys/src/boot/pc/etherga620.c - 664 sys sys 1175289484 27168
+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

+ 27 - 9
sys/src/9/pc/etherdp83820.c

@@ -973,6 +973,26 @@ dp83820multicast(void*, uchar*, int)
 {
 }
 
+static int
+dp83820detach(Ctlr* ctlr)
+{
+	/*
+	 * Soft reset the controller.
+	 */
+	csr32w(ctlr, Cr, Rst);
+	delay(1);
+	while(csr32r(ctlr, Cr) & Rst)
+		delay(1);
+	return 0;
+}
+
+static void
+dp83820shutdown(Ether* ether)
+{
+print("dp83820shutdown\n");
+	dp83820detach(ether->ctlr);
+}
+
 static int
 atc93c46r(Ctlr* ctlr, int address)
 {
@@ -1056,14 +1076,13 @@ dp83820reset(Ctlr* ctlr)
 	 * of the Cfg and Gpior bits which should be cleared by
 	 * the reset.
 	 */
-	csr32w(ctlr, Cr, Rst);
-	delay(1);
-	while(csr32r(ctlr, Cr) & Rst)
-		delay(1);
+	dp83820detach(ctlr);
 
 	atc93c46r(ctlr, 0);
-	if(ctlr->eeprom == nil)
+	if(ctlr->eeprom == nil) {
+		print("dp83820reset: no eeprom\n");
 		return -1;
+	}
 	sum = 0;
 	for(i = 0; i < 0x0E; i++){
 		r = atc93c46r(ctlr, i);
@@ -1128,7 +1147,7 @@ dp83820pci(void)
 
 	p = nil;
 	while(p = pcimatch(p, 0, 0)){
-		if(p->ccrb != 0x02 || p->ccru != 0)
+		if(p->ccrb != Pcibcnet || p->ccru != Pciscether)
 			continue;
 
 		switch((p->did<<16)|p->vid){
@@ -1201,12 +1220,11 @@ dp83820pnp(Ether* edev)
 	 * loading the station address in the hardware.
 	 */
 	memset(ea, 0, Eaddrlen);
-	if(memcmp(ea, edev->ea, Eaddrlen) == 0){
+	if(memcmp(ea, edev->ea, Eaddrlen) == 0)
 		for(i = 0; i < Eaddrlen/2; i++){
 			edev->ea[2*i] = ctlr->eeprom[0x0C-i];
 			edev->ea[2*i+1] = ctlr->eeprom[0x0C-i]>>8;
 		}
-	}
 
 	edev->attach = dp83820attach;
 	edev->transmit = dp83820transmit;
@@ -1216,7 +1234,7 @@ dp83820pnp(Ether* edev)
 	edev->arg = edev;
 	edev->promiscuous = dp83820promiscuous;
 	edev->multicast = dp83820multicast;
-//	edev->shutdown = dp83820shutdown;
+	edev->shutdown = dp83820shutdown;
 
 	return 0;
 }

+ 13 - 3
sys/src/boot/pc/etherga620.c

@@ -323,16 +323,25 @@ ga620command(Ctlr* ctlr, int cmd, int flags, int index)
 }
 
 static void
-ga620attach(Ether* edev)
+ga620attach(Ether* )
+{
+}
+
+static void
+waitforlink(Ether *edev)
 {
 	int i;
 
 	if (edev->mbps == 0) {
-		print("ga620: waiting for link...");
-		for (i = 0; i < 30 && edev->mbps == 0; i++) {
+		print("#l%d: ga620: waiting for link", edev->ctlrno);
+		/* usually takes about 10 seconds */
+		for (i = 0; i < 20 && edev->mbps == 0; i++) {
 			print(".");
 			delay(1000);
 		}
+		print("\n");
+		if (i == 20 && edev->mbps == 0)
+			edev->mbps = 1;			/* buggered */
 	}
 }
 
@@ -380,6 +389,7 @@ _ga620transmit(Ether* edev)
 	 * ring and try to fill it back up. Tuning comes later.
 	 */
 	ctlr = edev->ctlr;
+	waitforlink(edev);
 	ilock(&ctlr->srlock);
 
 	/*

+ 10 - 2
sys/src/boot/pc/load.c

@@ -270,6 +270,14 @@ probe(int type, int flag, int dev)
 	return 0;
 }
 
+static char *typenm[] = {
+	[Tnil]		"nil",
+	[Tfloppy]	"Tfloppy",
+	[Tsd]		"Tsd",
+	[Tether]	"Tether",
+	[Tcd]		"Tcd",
+};
+
 void
 main(void)
 {
@@ -292,8 +300,8 @@ main(void)
 
 	readlsconf();
 	for(tp = types; tp->type != Tnil; tp++){
-		//if(tp->type == Tether)
-		//	continue;
+		if(!pxe && tp->type == Tether)
+			continue;
 		if((mp = probe(tp->type, Fini, Dany)) && (mp->flag & Fini)){
 			print("using %s!%s!%s\n", mp->name, mp->part, mp->ini);
 			iniread = !dotini(mp->inifs);