From 516108a214d464c523685f3be2bbc4169dee95d2 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 20 Sep 1994 22:25:00 +0000 Subject: Better documentation, 1ms calibration, default 5 seconds BOOTWAIT Reviewed by: adam Submitted by: rgrimes --- sys/i386/boot/Makefile | 8 ++++---- sys/i386/boot/biosboot/Makefile | 8 ++++---- sys/i386/boot/biosboot/io.c | 19 +++++++++++++++---- sys/i386/boot/biosboot/sys.c | 16 ++++++++++------ sys/i386/boot/io.c | 19 +++++++++++++++---- sys/i386/boot/sys.c | 16 ++++++++++------ 6 files changed, 58 insertions(+), 28 deletions(-) (limited to 'sys/i386') diff --git a/sys/i386/boot/Makefile b/sys/i386/boot/Makefile index 30ef810..568fec9 100644 --- a/sys/i386/boot/Makefile +++ b/sys/i386/boot/Makefile @@ -20,7 +20,7 @@ # the rights to redistribute these changes. # # from: Mach, Revision 2.2 92/04/04 11:33:46 rpd -# $Id: Makefile,v 1.14 1994/09/18 19:10:11 swallace Exp $ +# $Id: Makefile,v 1.15 1994/09/19 19:54:49 adam Exp $ # wd0: @@ -32,9 +32,9 @@ wd0: NOPROG= noprog NOMAN= noman -# tunable loopcount parameter, waiting for keypress (*1/100s) -BOOTWAIT?= 1000 - +# tunable timeout parameter, waiting for keypress, calibrated in mS +BOOTWAIT?= 5000 + CFLAGS = -O2 -DDO_BAD144 -DBOOTWAIT=${BOOTWAIT} -I${.CURDIR} LIBS= -lc INC= -I${.CURDIR}/../.. diff --git a/sys/i386/boot/biosboot/Makefile b/sys/i386/boot/biosboot/Makefile index 30ef810..568fec9 100644 --- a/sys/i386/boot/biosboot/Makefile +++ b/sys/i386/boot/biosboot/Makefile @@ -20,7 +20,7 @@ # the rights to redistribute these changes. # # from: Mach, Revision 2.2 92/04/04 11:33:46 rpd -# $Id: Makefile,v 1.14 1994/09/18 19:10:11 swallace Exp $ +# $Id: Makefile,v 1.15 1994/09/19 19:54:49 adam Exp $ # wd0: @@ -32,9 +32,9 @@ wd0: NOPROG= noprog NOMAN= noman -# tunable loopcount parameter, waiting for keypress (*1/100s) -BOOTWAIT?= 1000 - +# tunable timeout parameter, waiting for keypress, calibrated in mS +BOOTWAIT?= 5000 + CFLAGS = -O2 -DDO_BAD144 -DBOOTWAIT=${BOOTWAIT} -I${.CURDIR} LIBS= -lc INC= -I${.CURDIR}/../.. diff --git a/sys/i386/boot/biosboot/io.c b/sys/i386/boot/biosboot/io.c index 5c460d9..ce2b1fe 100644 --- a/sys/i386/boot/biosboot/io.c +++ b/sys/i386/boot/biosboot/io.c @@ -25,7 +25,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:35:57 rpd - * $Id: io.c,v 1.7 1994/09/16 13:33:17 davidg Exp $ + * $Id: io.c,v 1.8 1994/09/18 07:39:55 swallace Exp $ */ #include @@ -139,9 +139,20 @@ getchar() } #if BOOTWAIT -spinwait(i) -int i; +/* + * This routine uses an inb to an unused port, the time to execute that + * inb is approximately 1.25uS. This value is pretty constant across + * all CPU's and all buses, with the exception of some PCI implentations + * that do not forward this I/O adress to the ISA bus as they know it + * is not a valid ISA bus address, those machines execute this inb in + * 60 nS :-(. + * + * XXX we need to use BIOS timer calls or something more reliable to + * produce timeouts in the boot code. + */ +delay1ms() { + int i = 800; while (--i >= 0) (void)inb(0x84); } @@ -154,7 +165,7 @@ char *buf; char *ptr=buf; #if BOOTWAIT - for (i = BOOTWAIT; i>0; spinwait(10000),i--) + for (i = BOOTWAIT; i>0; delay1ms(),i--) #endif if (ischar()) for (;;) diff --git a/sys/i386/boot/biosboot/sys.c b/sys/i386/boot/biosboot/sys.c index 0b9476c..48cbade 100644 --- a/sys/i386/boot/biosboot/sys.c +++ b/sys/i386/boot/biosboot/sys.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd - * $Id: sys.c,v 1.3 1993/10/16 19:11:39 rgrimes Exp $ + * $Id: sys.c,v 1.4 1994/08/21 17:47:26 paul Exp $ */ #include "boot.h" @@ -178,12 +178,16 @@ openrd() /*******************************************************\ * Look inside brackets for unit number, and partition * \*******************************************************/ + /* + * Allow any valid digit as the unit number, as the BIOS + * will complain if the unit number is out of range. + * Restricting the range here prevents the possibilty of using + * BIOSes that support more than 2 units. + * XXX Bad values may cause strange errors, need to check if + * what happens when a value out of range is supplied. + */ if (*cp >= '0' && *cp <= '9') - if ((unit = *cp++ - '0') > 1) - { - printf("Bad unit\n"); - return 1; - } + unit = *cp++ - '0'; if (!*cp || (*cp == ',' && !*++cp)) return 1; if (*cp >= 'a' && *cp <= 'p') diff --git a/sys/i386/boot/io.c b/sys/i386/boot/io.c index 5c460d9..ce2b1fe 100644 --- a/sys/i386/boot/io.c +++ b/sys/i386/boot/io.c @@ -25,7 +25,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:35:57 rpd - * $Id: io.c,v 1.7 1994/09/16 13:33:17 davidg Exp $ + * $Id: io.c,v 1.8 1994/09/18 07:39:55 swallace Exp $ */ #include @@ -139,9 +139,20 @@ getchar() } #if BOOTWAIT -spinwait(i) -int i; +/* + * This routine uses an inb to an unused port, the time to execute that + * inb is approximately 1.25uS. This value is pretty constant across + * all CPU's and all buses, with the exception of some PCI implentations + * that do not forward this I/O adress to the ISA bus as they know it + * is not a valid ISA bus address, those machines execute this inb in + * 60 nS :-(. + * + * XXX we need to use BIOS timer calls or something more reliable to + * produce timeouts in the boot code. + */ +delay1ms() { + int i = 800; while (--i >= 0) (void)inb(0x84); } @@ -154,7 +165,7 @@ char *buf; char *ptr=buf; #if BOOTWAIT - for (i = BOOTWAIT; i>0; spinwait(10000),i--) + for (i = BOOTWAIT; i>0; delay1ms(),i--) #endif if (ischar()) for (;;) diff --git a/sys/i386/boot/sys.c b/sys/i386/boot/sys.c index 0b9476c..48cbade 100644 --- a/sys/i386/boot/sys.c +++ b/sys/i386/boot/sys.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd - * $Id: sys.c,v 1.3 1993/10/16 19:11:39 rgrimes Exp $ + * $Id: sys.c,v 1.4 1994/08/21 17:47:26 paul Exp $ */ #include "boot.h" @@ -178,12 +178,16 @@ openrd() /*******************************************************\ * Look inside brackets for unit number, and partition * \*******************************************************/ + /* + * Allow any valid digit as the unit number, as the BIOS + * will complain if the unit number is out of range. + * Restricting the range here prevents the possibilty of using + * BIOSes that support more than 2 units. + * XXX Bad values may cause strange errors, need to check if + * what happens when a value out of range is supplied. + */ if (*cp >= '0' && *cp <= '9') - if ((unit = *cp++ - '0') > 1) - { - printf("Bad unit\n"); - return 1; - } + unit = *cp++ - '0'; if (!*cp || (*cp == ',' && !*++cp)) return 1; if (*cp >= 'a' && *cp <= 'p') -- cgit v1.1