Browse Source

Plan 9 from Bell Labs 2008-09-07

David du Colombier 15 years ago
parent
commit
bff067cf58

+ 6 - 6
dist/replica/_plan9.db

@@ -5857,7 +5857,7 @@ sys/games - 20000000775 sys sys 1117225532 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1220448032 270186
+sys/games/lib/fortunes - 664 sys sys 1220675972 270514
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -7772,7 +7772,7 @@ sys/man/4/telco - 664 sys sys 1208111302 4561
 sys/man/4/u9fs - 664 sys sys 1206913743 5223
 sys/man/4/u9fs - 664 sys sys 1206913743 5223
 sys/man/4/upasfs - 664 sys sys 1196638944 6212
 sys/man/4/upasfs - 664 sys sys 1196638944 6212
 sys/man/4/usb - 664 sys sys 1206739773 5725
 sys/man/4/usb - 664 sys sys 1206739773 5725
-sys/man/4/usbd - 664 sys sys 1202846392 1035
+sys/man/4/usbd - 664 sys sys 1220676054 1038
 sys/man/4/usbdisk - 664 sys sys 1205857582 3044
 sys/man/4/usbdisk - 664 sys sys 1205857582 3044
 sys/man/4/vacfs - 664 sys sys 1196638944 1545
 sys/man/4/vacfs - 664 sys sys 1196638944 1545
 sys/man/4/webcookies - 664 sys sys 1196638944 3525
 sys/man/4/webcookies - 664 sys sys 1196638944 3525
@@ -8104,7 +8104,7 @@ sys/src/9/pc/audio.h - 664 sys sys 1015014513 343
 sys/src/9/pc/bios32.c - 664 sys sys 1173287378 3029
 sys/src/9/pc/bios32.c - 664 sys sys 1173287378 3029
 sys/src/9/pc/cga.c - 664 sys sys 1015014513 1843
 sys/src/9/pc/cga.c - 664 sys sys 1015014513 1843
 sys/src/9/pc/dat.h - 664 sys sys 1206317920 7549
 sys/src/9/pc/dat.h - 664 sys sys 1206317920 7549
-sys/src/9/pc/devarch.c - 664 sys sys 1206317920 19865
+sys/src/9/pc/devarch.c - 664 sys sys 1220676708 20525
 sys/src/9/pc/devether.c - 664 sys sys 1196687022 10567
 sys/src/9/pc/devether.c - 664 sys sys 1196687022 10567
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devi82365.c - 664 sys sys 1146318335 20504
 sys/src/9/pc/devi82365.c - 664 sys sys 1146318335 20504
@@ -8158,7 +8158,7 @@ sys/src/9/pc/i8259.c - 664 sys sys 1131290399 4586
 sys/src/9/pc/init9.c - 664 sys sys 1040002518 94
 sys/src/9/pc/init9.c - 664 sys sys 1040002518 94
 sys/src/9/pc/initcode.s - 664 sys sys 1015014519 282
 sys/src/9/pc/initcode.s - 664 sys sys 1015014519 282
 sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
 sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
-sys/src/9/pc/kbd.c - 664 sys sys 1203021286 12940
+sys/src/9/pc/kbd.c - 664 sys sys 1220676682 13290
 sys/src/9/pc/l.s - 664 sys sys 1196193040 29691
 sys/src/9/pc/l.s - 664 sys sys 1196193040 29691
 sys/src/9/pc/main.c - 664 sys sys 1168306227 15337
 sys/src/9/pc/main.c - 664 sys sys 1168306227 15337
 sys/src/9/pc/mem.h - 664 sys sys 1196193040 5308
 sys/src/9/pc/mem.h - 664 sys sys 1196193040 5308
@@ -8166,7 +8166,7 @@ sys/src/9/pc/memory.c - 664 sys sys 1196193039 18878
 sys/src/9/pc/mkfile - 664 sys sys 1204231465 4152
 sys/src/9/pc/mkfile - 664 sys sys 1204231465 4152
 sys/src/9/pc/mmu.c - 664 sys sys 1218342291 24548
 sys/src/9/pc/mmu.c - 664 sys sys 1218342291 24548
 sys/src/9/pc/mouse.c - 664 sys sys 1203981356 7190
 sys/src/9/pc/mouse.c - 664 sys sys 1203981356 7190
-sys/src/9/pc/mp.c - 664 sys sys 1162388126 17349
+sys/src/9/pc/mp.c - 664 sys sys 1220676659 17394
 sys/src/9/pc/mp.h - 664 sys sys 1173288116 6799
 sys/src/9/pc/mp.h - 664 sys sys 1173288116 6799
 sys/src/9/pc/nv_dma.h - 664 sys sys 1081384508 12943
 sys/src/9/pc/nv_dma.h - 664 sys sys 1081384508 12943
 sys/src/9/pc/pc - 664 sys sys 1204231598 1551
 sys/src/9/pc/pc - 664 sys sys 1204231598 1551
@@ -15134,7 +15134,7 @@ sys/src/libc/port/nan.c - 664 sys sys 1014927399 610
 sys/src/libc/port/needsrcquote.c - 664 sys sys 1155363805 152
 sys/src/libc/port/needsrcquote.c - 664 sys sys 1155363805 152
 sys/src/libc/port/netcrypt.c - 664 sys sys 1014927400 317
 sys/src/libc/port/netcrypt.c - 664 sys sys 1014927400 317
 sys/src/libc/port/netmkaddr.c - 664 sys sys 1014927400 863
 sys/src/libc/port/netmkaddr.c - 664 sys sys 1014927400 863
-sys/src/libc/port/nrand.c - 664 sys sys 1035832917 191
+sys/src/libc/port/nrand.c - 664 sys sys 1220676342 262
 sys/src/libc/port/ntruerand.c - 664 sys sys 1014927400 371
 sys/src/libc/port/ntruerand.c - 664 sys sys 1014927400 371
 sys/src/libc/port/perror.c - 664 sys sys 1014927400 199
 sys/src/libc/port/perror.c - 664 sys sys 1014927400 199
 sys/src/libc/port/pool.acid - 664 sys sys 1143759318 12028
 sys/src/libc/port/pool.acid - 664 sys sys 1143759318 12028

+ 6 - 6
dist/replica/plan9.db

@@ -5857,7 +5857,7 @@ sys/games - 20000000775 sys sys 1117225532 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1220448032 270186
+sys/games/lib/fortunes - 664 sys sys 1220675972 270514
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -7772,7 +7772,7 @@ sys/man/4/telco - 664 sys sys 1208111302 4561
 sys/man/4/u9fs - 664 sys sys 1206913743 5223
 sys/man/4/u9fs - 664 sys sys 1206913743 5223
 sys/man/4/upasfs - 664 sys sys 1196638944 6212
 sys/man/4/upasfs - 664 sys sys 1196638944 6212
 sys/man/4/usb - 664 sys sys 1206739773 5725
 sys/man/4/usb - 664 sys sys 1206739773 5725
-sys/man/4/usbd - 664 sys sys 1202846392 1035
+sys/man/4/usbd - 664 sys sys 1220676054 1038
 sys/man/4/usbdisk - 664 sys sys 1205857582 3044
 sys/man/4/usbdisk - 664 sys sys 1205857582 3044
 sys/man/4/vacfs - 664 sys sys 1196638944 1545
 sys/man/4/vacfs - 664 sys sys 1196638944 1545
 sys/man/4/webcookies - 664 sys sys 1196638944 3525
 sys/man/4/webcookies - 664 sys sys 1196638944 3525
@@ -8104,7 +8104,7 @@ sys/src/9/pc/audio.h - 664 sys sys 1015014513 343
 sys/src/9/pc/bios32.c - 664 sys sys 1173287378 3029
 sys/src/9/pc/bios32.c - 664 sys sys 1173287378 3029
 sys/src/9/pc/cga.c - 664 sys sys 1015014513 1843
 sys/src/9/pc/cga.c - 664 sys sys 1015014513 1843
 sys/src/9/pc/dat.h - 664 sys sys 1206317920 7549
 sys/src/9/pc/dat.h - 664 sys sys 1206317920 7549
-sys/src/9/pc/devarch.c - 664 sys sys 1206317920 19865
+sys/src/9/pc/devarch.c - 664 sys sys 1220676708 20525
 sys/src/9/pc/devether.c - 664 sys sys 1196687022 10567
 sys/src/9/pc/devether.c - 664 sys sys 1196687022 10567
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devi82365.c - 664 sys sys 1146318335 20504
 sys/src/9/pc/devi82365.c - 664 sys sys 1146318335 20504
@@ -8158,7 +8158,7 @@ sys/src/9/pc/i8259.c - 664 sys sys 1131290399 4586
 sys/src/9/pc/init9.c - 664 sys sys 1040002518 94
 sys/src/9/pc/init9.c - 664 sys sys 1040002518 94
 sys/src/9/pc/initcode.s - 664 sys sys 1015014519 282
 sys/src/9/pc/initcode.s - 664 sys sys 1015014519 282
 sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
 sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
-sys/src/9/pc/kbd.c - 664 sys sys 1203021286 12940
+sys/src/9/pc/kbd.c - 664 sys sys 1220676682 13290
 sys/src/9/pc/l.s - 664 sys sys 1196193040 29691
 sys/src/9/pc/l.s - 664 sys sys 1196193040 29691
 sys/src/9/pc/main.c - 664 sys sys 1168306227 15337
 sys/src/9/pc/main.c - 664 sys sys 1168306227 15337
 sys/src/9/pc/mem.h - 664 sys sys 1196193040 5308
 sys/src/9/pc/mem.h - 664 sys sys 1196193040 5308
@@ -8166,7 +8166,7 @@ sys/src/9/pc/memory.c - 664 sys sys 1196193039 18878
 sys/src/9/pc/mkfile - 664 sys sys 1204231465 4152
 sys/src/9/pc/mkfile - 664 sys sys 1204231465 4152
 sys/src/9/pc/mmu.c - 664 sys sys 1218342291 24548
 sys/src/9/pc/mmu.c - 664 sys sys 1218342291 24548
 sys/src/9/pc/mouse.c - 664 sys sys 1203981356 7190
 sys/src/9/pc/mouse.c - 664 sys sys 1203981356 7190
-sys/src/9/pc/mp.c - 664 sys sys 1162388126 17349
+sys/src/9/pc/mp.c - 664 sys sys 1220676659 17394
 sys/src/9/pc/mp.h - 664 sys sys 1173288116 6799
 sys/src/9/pc/mp.h - 664 sys sys 1173288116 6799
 sys/src/9/pc/nv_dma.h - 664 sys sys 1081384508 12943
 sys/src/9/pc/nv_dma.h - 664 sys sys 1081384508 12943
 sys/src/9/pc/pc - 664 sys sys 1204231598 1551
 sys/src/9/pc/pc - 664 sys sys 1204231598 1551
@@ -15134,7 +15134,7 @@ sys/src/libc/port/nan.c - 664 sys sys 1014927399 610
 sys/src/libc/port/needsrcquote.c - 664 sys sys 1155363805 152
 sys/src/libc/port/needsrcquote.c - 664 sys sys 1155363805 152
 sys/src/libc/port/netcrypt.c - 664 sys sys 1014927400 317
 sys/src/libc/port/netcrypt.c - 664 sys sys 1014927400 317
 sys/src/libc/port/netmkaddr.c - 664 sys sys 1014927400 863
 sys/src/libc/port/netmkaddr.c - 664 sys sys 1014927400 863
-sys/src/libc/port/nrand.c - 664 sys sys 1035832917 191
+sys/src/libc/port/nrand.c - 664 sys sys 1220676342 262
 sys/src/libc/port/ntruerand.c - 664 sys sys 1014927400 371
 sys/src/libc/port/ntruerand.c - 664 sys sys 1014927400 371
 sys/src/libc/port/perror.c - 664 sys sys 1014927400 199
 sys/src/libc/port/perror.c - 664 sys sys 1014927400 199
 sys/src/libc/port/pool.acid - 664 sys sys 1143759318 12028
 sys/src/libc/port/pool.acid - 664 sys sys 1143759318 12028

+ 6 - 0
dist/replica/plan9.log

@@ -36101,3 +36101,9 @@
 1220412605 0 c 386/lib/ape/libbsd.a - 664 sys sys 1220411684 185404
 1220412605 0 c 386/lib/ape/libbsd.a - 664 sys sys 1220411684 185404
 1220448603 0 c sys/games/lib/fortunes - 664 sys sys 1220448032 270186
 1220448603 0 c sys/games/lib/fortunes - 664 sys sys 1220448032 270186
 1220477404 0 c sys/lib/lp/process/generic - 775 sys sys 1220475687 4661
 1220477404 0 c sys/lib/lp/process/generic - 775 sys sys 1220475687 4661
+1220677205 0 c sys/games/lib/fortunes - 664 sys sys 1220675972 270514
+1220677205 1 c sys/man/4/usbd - 664 sys sys 1220676054 1038
+1220677205 2 c sys/src/9/pc/devarch.c - 664 sys sys 1220676708 20525
+1220677205 3 c sys/src/9/pc/kbd.c - 664 sys sys 1220676682 13290
+1220677205 4 c sys/src/9/pc/mp.c - 664 sys sys 1220676659 17394
+1220677205 5 c sys/src/libc/port/nrand.c - 664 sys sys 1220676342 262

+ 6 - 0
sys/games/lib/fortunes

@@ -4230,3 +4230,9 @@ Your IP address is: <? echo getenv('REMOTE_ADDR'); ?>. By continuing to browse t
 You chose to apply Shadow Ram extend feature, while you knew it was risky. If the system hangs during boot, please restart the system and come here to change the setting.
 You chose to apply Shadow Ram extend feature, while you knew it was risky. If the system hangs during boot, please restart the system and come here to change the setting.
 An amateur thinks it's really funny if you dress a man up as an old lady, put him in a wheelchair, and give the wheelchair a push that sends it spinning down a slope towards a stone wall. For a pro, it's got to be a real old lady. - Groucho Marx.
 An amateur thinks it's really funny if you dress a man up as an old lady, put him in a wheelchair, and give the wheelchair a push that sends it spinning down a slope towards a stone wall. For a pro, it's got to be a real old lady. - Groucho Marx.
 Error Code: -2147483648
 Error Code: -2147483648
+Pardon the abruptness of this letter; it is due to its exigency. 
+The source of the money is legal and authoritative.
+Please note that I do not intend to waste my time and yours.
+The Internet is still a fascination to me.
+Sometimes one needs to take chances.
+#define MIG_ARRAY_TOO_LARGE     -307    /* array not large enough */

+ 1 - 1
sys/man/4/usbd

@@ -10,7 +10,7 @@ usbd \- Universal Serial Bus daemon
 .I bitmask
 .I bitmask
 ] [
 ] [
 .B -u
 .B -u
-root-hub-num
+.I root-hub-num
 ]
 ]
 .SH DESCRIPTION
 .SH DESCRIPTION
 .I Usbd
 .I Usbd

+ 27 - 3
sys/src/9/pc/devarch.c

@@ -498,6 +498,30 @@ nop(void)
 {
 {
 }
 }
 
 
+static void
+archreset(void)
+{
+	i8042reset();
+
+	/*
+	 * Often the BIOS hangs during restart if a conventional 8042
+	 * warm-boot sequence is tried. The following is Intel specific and
+	 * seems to perform a cold-boot, but at least it comes back.
+	 * And sometimes there is no keyboard...
+	 *
+	 * The reset register (0xcf9) is usually in one of the bridge
+	 * chips. The actual location and sequence could be extracted from
+	 * ACPI but why bother, this is the end of the line anyway.
+	 */
+	print("Takes a licking and keeps on ticking...\n");
+	*(ushort*)KADDR(0x472) = 0x1234;	/* BIOS warm-boot flag */
+	outb(0xcf9, 0x02);
+	outb(0xcf9, 0x06);
+
+	for(;;)
+		idle();
+}
+
 /*
 /*
  * 386 has no compare-and-swap instruction.
  * 386 has no compare-and-swap instruction.
  * Run it with interrupts turned off instead.
  * Run it with interrupts turned off instead.
@@ -532,7 +556,7 @@ extern PCArch* knownarch[];
 PCArch archgeneric = {
 PCArch archgeneric = {
 .id=		"generic",
 .id=		"generic",
 .ident=		0,
 .ident=		0,
-.reset=		i8042reset,
+.reset=		archreset,
 .serialpower=	unimplemented,
 .serialpower=	unimplemented,
 .modempower=	unimplemented,
 .modempower=	unimplemented,
 
 
@@ -540,8 +564,8 @@ PCArch archgeneric = {
 .intrenable=	i8259enable,
 .intrenable=	i8259enable,
 .intrvecno=	i8259vecno,
 .intrvecno=	i8259vecno,
 .intrdisable=	i8259disable,
 .intrdisable=	i8259disable,
-.intron=		i8259on,
-.introff=		i8259off,
+.intron=	i8259on,
+.introff=	i8259off,
 
 
 .clockenable=	i8253enable,
 .clockenable=	i8253enable,
 .fastclock=	i8253read,
 .fastclock=	i8253read,

+ 38 - 13
sys/src/9/pc/kbd.c

@@ -176,6 +176,7 @@ void (*kbdmouse)(int);
 static Lock i8042lock;
 static Lock i8042lock;
 static uchar ccc;
 static uchar ccc;
 static void (*auxputc)(int, int);
 static void (*auxputc)(int, int);
+static int nokbd = 1;
 
 
 /*
 /*
  *  wait for output no longer busy
  *  wait for output no longer busy
@@ -215,10 +216,12 @@ inready(void)
 void
 void
 i8042reset(void)
 i8042reset(void)
 {
 {
-	ushort *s = KADDR(0x472);
 	int i, x;
 	int i, x;
 
 
-	*s = 0x1234;		/* BIOS warm-boot flag */
+	if(nokbd)
+		return;
+
+	*((ushort*)KADDR(0x472)) = 0x1234;	/* BIOS warm-boot flag */
 
 
 	/*
 	/*
 	 *  newer reset the machine command
 	 *  newer reset the machine command
@@ -543,35 +546,57 @@ i8042auxenable(void (*putc)(int, int))
 	iunlock(&i8042lock);
 	iunlock(&i8042lock);
 }
 }
 
 
+static char *initfailed = "i8042: kbdinit failed\n";
+
+static int
+outbyte(int port, int c)
+{
+	outb(port, c);
+	if(outready() < 0) {
+		print(initfailed);
+		return -1;
+	}
+	return 0;
+}
+
 void
 void
 kbdinit(void)
 kbdinit(void)
 {
 {
-	int c;
+	int c, try;
 
 
 	/* wait for a quiescent controller */
 	/* wait for a quiescent controller */
-	while((c = inb(Status)) & (Outbusy | Inready))
+	try = 1000;
+	while(try-- > 0 && (c = inb(Status)) & (Outbusy | Inready)) {
 		if(c & Inready)
 		if(c & Inready)
 			inb(Data);
 			inb(Data);
+		delay(1);
+	}
+	if (try <= 0) {
+		print(initfailed);
+		return;
+	}
 
 
 	/* get current controller command byte */
 	/* get current controller command byte */
 	outb(Cmd, 0x20);
 	outb(Cmd, 0x20);
 	if(inready() < 0){
 	if(inready() < 0){
-		print("kbdinit: can't read ccc\n");
+		print("i8042: kbdinit can't read ccc\n");
 		ccc = 0;
 		ccc = 0;
 	} else
 	} else
 		ccc = inb(Data);
 		ccc = inb(Data);
 
 
 	/* enable kbd xfers and interrupts */
 	/* enable kbd xfers and interrupts */
-	/* disable mouse */
 	ccc &= ~Ckbddis;
 	ccc &= ~Ckbddis;
 	ccc |= Csf | Ckbdint | Cscs1;
 	ccc |= Csf | Ckbdint | Cscs1;
-	if(outready() < 0)
-		print("kbd init failed\n");
-	outb(Cmd, 0x60);
-	if(outready() < 0)
-		print("kbd init failed\n");
-	outb(Data, ccc);
-	outready();
+	if(outready() < 0) {
+		print(initfailed);
+		return;
+	}
+
+	nokbd = 0;
+
+	/* disable mouse */
+	if (outbyte(Cmd, 0x60) < 0 || outbyte(Data, ccc) < 0)
+		print("i8042: kbdinit mouse disable failed\n");
 }
 }
 
 
 void
 void

+ 2 - 1
sys/src/9/pc/mp.c

@@ -775,7 +775,8 @@ mpintrenable(Vctl* v)
 		if(vno != -1)
 		if(vno != -1)
 			return vno;
 			return vno;
 	}
 	}
-	print("mpintrenable: out of choices %d %d\n", mpeisabus, mpisabus);
+	print("mpintrenable: out of choices eisa %d isa %d tbdf %#ux irq %d\n",
+		mpeisabus, mpisabus, v->tbdf, v->irq);
 	return -1;
 	return -1;
 }
 }
 
 

+ 3 - 0
sys/src/libc/port/nrand.c

@@ -10,6 +10,9 @@ nrand(int n)
 
 
 	if(n < 0)
 	if(n < 0)
 		return n;
 		return n;
+	if(n == 1)
+		return 0;
+	/* and if n == 0, you deserve what you get */
 	slop = MASK % n;
 	slop = MASK % n;
 	do
 	do
 		v = lrand();
 		v = lrand();