Browse Source

Plan 9 from Bell Labs 2008-07-24

David du Colombier 12 years ago
parent
commit
2a0b80ce41

+ 10 - 11
dist/replica/_plan9.db

@@ -386,7 +386,7 @@
 386/bin/pump - 775 sys sys 1213813262 60580
 386/bin/pwd - 775 sys sys 1148500685 36932
 386/bin/ramfs - 775 sys sys 1209184388 89491
-386/bin/rc - 775 sys sys 1215402260 145546
+386/bin/rc - 775 sys sys 1216785116 145872
 386/bin/rdbfs - 775 sys sys 1210392910 173349
 386/bin/read - 775 sys sys 1168402347 58283
 386/bin/replica - 20000000775 sys sys 1018321168 0
@@ -9174,7 +9174,7 @@ sys/src/boot/bitsy/sinflate - 775 sys sys 1176753922 20696
 sys/src/boot/bitsy/uart.c - 664 sys sys 1173299930 1495
 sys/src/boot/mkfile - 664 sys sys 1173300033 192
 sys/src/boot/pc - 20000000775 sys sys 1144961189 0
-sys/src/boot/pc/8250.c - 664 sys sys 1212010481 5725
+sys/src/boot/pc/8250.c - 664 sys sys 1216786716 5741
 sys/src/boot/pc/ahci.h - 664 sys sys 1199911245 6283
 sys/src/boot/pc/alarm.c - 664 sys sys 1015007947 1668
 sys/src/boot/pc/aoe.h - 664 sys sys 1193336543 826
@@ -9182,13 +9182,13 @@ sys/src/boot/pc/apm.c - 664 sys sys 1015007947 289
 sys/src/boot/pc/bcom.c - 664 sys sys 1212010473 6460
 sys/src/boot/pc/boot.c - 664 sys sys 1130887226 8421
 sys/src/boot/pc/bootld.c - 664 sys sys 1015007948 1801
-sys/src/boot/pc/bootp.c - 664 sys sys 1194650469 12624
+sys/src/boot/pc/bootp.c - 664 sys sys 1216859040 12923
 sys/src/boot/pc/cga.c - 664 sys sys 1015007948 1362
 sys/src/boot/pc/cis.c - 664 sys sys 1144961189 9232
 sys/src/boot/pc/clock.c - 664 sys sys 1212010463 6825
 sys/src/boot/pc/conf.c - 664 sys sys 1094674484 10217
 sys/src/boot/pc/console.c - 664 sys sys 1212010517 3422
-sys/src/boot/pc/dat.h - 664 sys sys 1216774050 3637
+sys/src/boot/pc/dat.h - 664 sys sys 1216753913 3653
 sys/src/boot/pc/devbios.c - 664 sys sys 1212010497 9431
 sys/src/boot/pc/devfloppy.c - 664 sys sys 1212010456 15657
 sys/src/boot/pc/devfloppy.h - 664 sys sys 1032409559 4081
@@ -9209,7 +9209,7 @@ sys/src/boot/pc/ether8003.c - 664 sys sys 1015007950 6446
 sys/src/boot/pc/ether8139.c - 664 sys sys 1121393459 14823
 sys/src/boot/pc/ether8169.c - 664 sys sys 1212010436 21868
 sys/src/boot/pc/ether82557.c - 664 sys sys 1212010428 19134
-sys/src/boot/pc/ether82563.c - 664 sys sys 1213016004 28290
+sys/src/boot/pc/ether82563.c - 664 sys sys 1216858647 28292
 sys/src/boot/pc/ether83815.c - 664 sys sys 1144961190 21993
 sys/src/boot/pc/ether8390.c - 664 sys sys 1212010420 16207
 sys/src/boot/pc/ether8390.h - 664 sys sys 1015007951 1392
@@ -9231,23 +9231,23 @@ sys/src/boot/pc/ilock.c - 664 sys sys 1015007952 303
 sys/src/boot/pc/inflate.c - 664 sys sys 1021579984 2802
 sys/src/boot/pc/io.h - 664 sys sys 1194556593 8134
 sys/src/boot/pc/ip.h - 664 sys sys 1094674489 2461
-sys/src/boot/pc/kbd.c - 664 sys sys 1015007952 10188
+sys/src/boot/pc/kbd.c - 664 sys sys 1216784682 10409
 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 1193167045 18213
+sys/src/boot/pc/l.s - 664 sys sys 1216786858 18260
 sys/src/boot/pc/lib.h - 664 sys sys 1212090562 3280
-sys/src/boot/pc/load.c - 664 sys sys 1212004261 10578
+sys/src/boot/pc/load.c - 664 sys sys 1216858654 11008
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mem.h - 664 sys sys 1190921475 3437
 sys/src/boot/pc/memory.c - 664 sys sys 1212010326 10266
-sys/src/boot/pc/mkfile - 664 sys sys 1193359312 3224
+sys/src/boot/pc/mkfile - 664 sys sys 1216788017 3614
 sys/src/boot/pc/noether.c - 664 sys sys 1193336537 416
 sys/src/boot/pc/part.c - 664 sys sys 1200690166 7158
 sys/src/boot/pc/pbs.s - 664 sys sys 1143465387 8291
 sys/src/boot/pc/pbsdebug.s - 664 sys sys 1205786244 6371
 sys/src/boot/pc/pbslba.s - 664 sys sys 1186031549 8180
 sys/src/boot/pc/pbslbadebug.s - 664 sys sys 1205786244 6021
-sys/src/boot/pc/pci.c - 664 sys sys 1196312243 20667
+sys/src/boot/pc/pci.c - 664 sys sys 1216784600 20769
 sys/src/boot/pc/print.c - 664 sys sys 1094674483 219
 sys/src/boot/pc/queue.c - 664 sys sys 1015007954 566
 sys/src/boot/pc/sd.h - 664 sys sys 1200690169 2249
@@ -15883,4 +15883,3 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
-sys/src/boot/pc/pci.c - 664 sys sys 1216784600 20769

+ 9 - 9
dist/replica/plan9.db

@@ -386,7 +386,7 @@
 386/bin/pump - 775 sys sys 1213813262 60580
 386/bin/pwd - 775 sys sys 1148500685 36932
 386/bin/ramfs - 775 sys sys 1209184388 89491
-386/bin/rc - 775 sys sys 1215402260 145546
+386/bin/rc - 775 sys sys 1216785116 145872
 386/bin/rdbfs - 775 sys sys 1210392910 173349
 386/bin/read - 775 sys sys 1168402347 58283
 386/bin/replica - 20000000775 sys sys 1018321168 0
@@ -9174,7 +9174,7 @@ sys/src/boot/bitsy/sinflate - 775 sys sys 1176753922 20696
 sys/src/boot/bitsy/uart.c - 664 sys sys 1173299930 1495
 sys/src/boot/mkfile - 664 sys sys 1173300033 192
 sys/src/boot/pc - 20000000775 sys sys 1144961189 0
-sys/src/boot/pc/8250.c - 664 sys sys 1212010481 5725
+sys/src/boot/pc/8250.c - 664 sys sys 1216786716 5741
 sys/src/boot/pc/ahci.h - 664 sys sys 1199911245 6283
 sys/src/boot/pc/alarm.c - 664 sys sys 1015007947 1668
 sys/src/boot/pc/aoe.h - 664 sys sys 1193336543 826
@@ -9182,13 +9182,13 @@ sys/src/boot/pc/apm.c - 664 sys sys 1015007947 289
 sys/src/boot/pc/bcom.c - 664 sys sys 1212010473 6460
 sys/src/boot/pc/boot.c - 664 sys sys 1130887226 8421
 sys/src/boot/pc/bootld.c - 664 sys sys 1015007948 1801
-sys/src/boot/pc/bootp.c - 664 sys sys 1194650469 12624
+sys/src/boot/pc/bootp.c - 664 sys sys 1216859040 12923
 sys/src/boot/pc/cga.c - 664 sys sys 1015007948 1362
 sys/src/boot/pc/cis.c - 664 sys sys 1144961189 9232
 sys/src/boot/pc/clock.c - 664 sys sys 1212010463 6825
 sys/src/boot/pc/conf.c - 664 sys sys 1094674484 10217
 sys/src/boot/pc/console.c - 664 sys sys 1212010517 3422
-sys/src/boot/pc/dat.h - 664 sys sys 1216774050 3637
+sys/src/boot/pc/dat.h - 664 sys sys 1216753913 3653
 sys/src/boot/pc/devbios.c - 664 sys sys 1212010497 9431
 sys/src/boot/pc/devfloppy.c - 664 sys sys 1212010456 15657
 sys/src/boot/pc/devfloppy.h - 664 sys sys 1032409559 4081
@@ -9209,7 +9209,7 @@ sys/src/boot/pc/ether8003.c - 664 sys sys 1015007950 6446
 sys/src/boot/pc/ether8139.c - 664 sys sys 1121393459 14823
 sys/src/boot/pc/ether8169.c - 664 sys sys 1212010436 21868
 sys/src/boot/pc/ether82557.c - 664 sys sys 1212010428 19134
-sys/src/boot/pc/ether82563.c - 664 sys sys 1213016004 28290
+sys/src/boot/pc/ether82563.c - 664 sys sys 1216858647 28292
 sys/src/boot/pc/ether83815.c - 664 sys sys 1144961190 21993
 sys/src/boot/pc/ether8390.c - 664 sys sys 1212010420 16207
 sys/src/boot/pc/ether8390.h - 664 sys sys 1015007951 1392
@@ -9231,16 +9231,16 @@ sys/src/boot/pc/ilock.c - 664 sys sys 1015007952 303
 sys/src/boot/pc/inflate.c - 664 sys sys 1021579984 2802
 sys/src/boot/pc/io.h - 664 sys sys 1194556593 8134
 sys/src/boot/pc/ip.h - 664 sys sys 1094674489 2461
-sys/src/boot/pc/kbd.c - 664 sys sys 1015007952 10188
+sys/src/boot/pc/kbd.c - 664 sys sys 1216784682 10409
 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 1193167045 18213
+sys/src/boot/pc/l.s - 664 sys sys 1216786858 18260
 sys/src/boot/pc/lib.h - 664 sys sys 1212090562 3280
-sys/src/boot/pc/load.c - 664 sys sys 1212004261 10578
+sys/src/boot/pc/load.c - 664 sys sys 1216858654 11008
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mem.h - 664 sys sys 1190921475 3437
 sys/src/boot/pc/memory.c - 664 sys sys 1212010326 10266
-sys/src/boot/pc/mkfile - 664 sys sys 1193359312 3224
+sys/src/boot/pc/mkfile - 664 sys sys 1216788017 3614
 sys/src/boot/pc/noether.c - 664 sys sys 1193336537 416
 sys/src/boot/pc/part.c - 664 sys sys 1200690166 7158
 sys/src/boot/pc/pbs.s - 664 sys sys 1143465387 8291

+ 10 - 0
dist/replica/plan9.log

@@ -20075,3 +20075,13 @@
 1216774804 2 c sys/src/boot/pc/load.c - 664 sys sys 1212004261 10578
 1216774804 3 c sys/src/cmd/rc/exec.c - 664 sys sys 1216774327 16980
 1216783804 0 c sys/src/boot/pc/pci.c - 664 sys sys 1216784600 20769
+1216785604 0 c 386/bin/rc - 775 sys sys 1216785116 145872
+1216785604 1 c sys/src/boot/pc/dat.h - 664 sys sys 1216753913 3653
+1216785604 2 c sys/src/boot/pc/kbd.c - 664 sys sys 1216784682 10409
+1216787404 0 c sys/src/boot/pc/8250.c - 664 sys sys 1216786716 5741
+1216787404 1 c sys/src/boot/pc/l.s - 664 sys sys 1216786858 18260
+1216789206 0 c sys/src/boot/pc/load.c - 664 sys sys 1216788286 11006
+1216789206 1 c sys/src/boot/pc/mkfile - 664 sys sys 1216788017 3614
+1216859404 0 c sys/src/boot/pc/bootp.c - 664 sys sys 1216859040 12923
+1216859404 1 c sys/src/boot/pc/load.c - 664 sys sys 1216858654 11008
+1216859404 2 c sys/src/boot/pc/ether82563.c - 664 sys sys 1216858647 28292

+ 2 - 1
sys/src/boot/pc/8250.c

@@ -303,6 +303,7 @@ uartdrain(void)
 
 	if((up = uart) == nil)
 		return;
-	for(timeo = 0; timeo < 10000 && up->txbusy; timeo++)
+	for(timeo = 0; timeo < 2000 && up->txbusy; timeo++)
 		delay(1);
+	up->txbusy = 0;
 }

+ 15 - 2
sys/src/boot/pc/bootp.c

@@ -436,7 +436,7 @@ tftpread(int ctlrno, Netaddr *a, Tftp *tftp, int dlen)
 }
 
 static int
-bootpopen(int ctlrno, char *file, Bootp *rep, int dotftpopen)
+bootpopen1(int ctlrno, char *file, Bootp *rep, int dotftpopen)
 {
 	Bootp req;
 	int i, n;
@@ -492,7 +492,7 @@ bootpopen(int ctlrno, char *file, Bootp *rep, int dotftpopen)
 			break;
 	}
 	if(i >= 10) {
-		print("bootp timed out\n");
+		print("bootp on ether%d for %s timed out\n", ctlrno, file);
 		return -1;
 	}
 
@@ -526,6 +526,19 @@ bootpopen(int ctlrno, char *file, Bootp *rep, int dotftpopen)
 	return n;
 }
 
+static int
+bootpopen(int ctlrno, char *file, Bootp *rep, int dotftpopen)
+{
+	int n;
+
+	while ((n = bootpopen1(ctlrno, file, rep, dotftpopen)) < 0 &&
+	    (pxe || getconf("*bootppersist") != nil)) {
+		print("pausing before retry\n");
+		delay(30*1000);
+	}
+	return n;
+}
+
 int
 bootpboot(int ctlrno, char *file, Boot *b)
 {

+ 1 - 1
sys/src/boot/pc/ether82563.c

@@ -979,7 +979,7 @@ i82563pci(void)
 	while(p = pcimatch(p, 0x8086, 0)){
 		if(p->ccrb != 0x02 || p->ccru != 0)
 			continue;
-print("i82563pci: did %4.4#x\n", p->did);
+//print("i82563pci: did %4.4#x\n", p->did);
 		switch(p->did){
 		case 0x1096:
 		case 0x10ba:

+ 3 - 1
sys/src/boot/pc/l.s

@@ -11,6 +11,7 @@
 #define PDB		0x08000
 #endif PXE
 
+/*#define VGA		1 */
 #define NoScreenBlank	1
 /*#define ResetDiscs	1*/
 
@@ -28,6 +29,7 @@ TEXT origin(SB), $0
 	MOVW	CS, AX
 	MOVW	AX, DS
 
+#ifdef VGA
 #ifdef NoScreenBlank
 	/*
 	 * Get the current video mode. If it isn't mode 3,
@@ -48,7 +50,7 @@ TEXT origin(SB), $0
 sayhello:
 	LWI(hello(SB), rSI)
 	CALL16(biosputs(SB))
-
+#endif	/* VGA */
 #ifdef ResetDiscs
 	XORL	AX, AX			/* reset disc system */
 	XORL	DX, DX

+ 30 - 20
sys/src/boot/pc/load.c

@@ -7,10 +7,6 @@
 #include "sd.h"
 #include "fs.h"
 
-#ifndef VERBOSE
-#define VERBOSE 0
-#endif
-
 /*
  * "cache" must be in this list so that 9load will pass the definition of
  * the cache partition into the kernel so that the disk named by the `cfs'
@@ -183,8 +179,8 @@ char **ini;
 int scsi0port;
 char *defaultpartition;
 int iniread;
-
 int debugload;
+int vga;
 
 static Medium*
 parse(char *line, char **file)
@@ -228,7 +224,7 @@ boot(Medium *mp, char *file)
 	}
 
 	sprint(BOOTLINE, "%s!%s", mp->name, file);
-	print("booting %s!%s\n", mp->name, file);
+//	print("booting %s!%s\n", mp->name, file);
 	return (*mp->type->boot)(mp->dev, file, &b);
 }
 
@@ -312,8 +308,6 @@ probe(int type, int flag, int dev)
 	return 0;
 }
 
-void	prcpuid(void);
-
 void
 main(void)
 {
@@ -329,35 +323,51 @@ main(void)
 	alarminit();
 	meminit(0);
 	spllo();
-	consinit("0", "9600");
+
+	/*
+	 * the soekris machines have no video but each has a serial port.
+	 * they must see serial output, if any, before cga output because
+	 * otherwise the soekris bios will translate cga output to serial
+	 * output, which will garble serial console output.
+	 */
+	pcimatch(nil, 0, 0);		/* force scan of pci table */
+	if (!vga) {
+		consinit("0", "9600");	/* e.g., for soekris debugging */
+		print("Plan 9 Bootstrap (serial console)\n");
+	}
 	kbdinit();
 	if((ulong)&end > (KZERO|(640*1024)))
 		panic("i'm too big");
 
-	prcpuid();
-	readlsconf();
-	print("initial probe, to find plan9.ini...");
+	if (debug)
+		print("initial probe, for plan9.ini...");
 	/* find and read plan9.ini, setting configuration variables */
 	for(tp = types; tp->type != Tnil; tp++){
 		/* skip bios until we have read plan9.ini */
 		if(!pxe && tp->type == Tether || tp->type == Tbios)
 			continue;
-		if (VERBOSE || debug)
+		if (debug)
 			print("probing %s...", typename(tp->type));
 		if((mp = probe(tp->type, Fini, Dany)) && (mp->flag & Fini)){
-			print("using %s!%s!%s\n", mp->name, mp->part, mp->ini);
+			if (debug)
+				print("using %s!%s!%s\n",
+					mp->name, mp->part, mp->ini);
 			iniread = !dotini(mp->inifs);
 			break;
 		}
 	}
-	print("\n");
-	apminit();
-
+	if (debug)
+		print("\n");
+	/*
+	 * we should now have read plan9.ini, if any.
+	 */
 	debugload = getconf("*debugload") != nil;
-	if((p = getconf("console")) != nil) {
-		consdrain();
+	if((p = getconf("console")) != nil)
 		consinit(p, getconf("baud"));
-	}
+
+	prcpuid();
+	readlsconf();
+	apminit();
 
 	devpccardlink();
 	devi82365link();

+ 21 - 2
sys/src/boot/pc/mkfile

@@ -4,10 +4,11 @@ BIN=/386
 
 TARG=\
 	9load\
-	9pxeload\
-	9loadlite\
 	9loaddebug\
+	9loadlite\
 	9loadlitedebug\
+	9pxeload\
+	9pxeloaddebug\
 	ld.com\
 	mbr\
 	pbs\
@@ -110,6 +111,12 @@ all:V:	$TARG
 	# acid $target
 	# map({"text", 0x80010000, 0x80090000, 0x00000020})
 
+9pxeloaddebug:	lpxe.$O $CORE $LOAD $ETHER
+	$LD -o $target -T0x80007C00 -l $prereq -lflate -lc -lip
+	ls -l $target
+	# acid $target
+	# map({"text", 0x80010000, 0x80090000, 0x00000020})
+
 9loadlite:	l.$O $CORE $LOAD noether.$O
 	$LD -o $target -H3 -T0x80010000 -l $prereq -lflate -lc
 	ls -l $target
@@ -133,9 +140,21 @@ lddebug:	ld.$O $CORE $BCOM
 ld.$O:	l.s
 	$AS -DDOTCOM -o $target l.s
 
+l.$O: l.s
+	$AS -DVGA -o $target l.s
+
 lpxe.$O: l.s
+	$AS -DPXE -DVGA -o $target l.s
+
+lnovga.$O: l.s
+	$AS -o $target l.s
+
+lpxenovga.$O: l.s
 	$AS -DPXE -o $target l.s
 
+loadverb.$O: load.c
+	$CC -o $target $CFLAGS '-DVERBOSE=1' load.c
+
 %.$O:	%.s
 	$AS $stem.s