diff options
author | Tobias Weingartner <weingart@cvs.openbsd.org> | 1998-02-24 22:06:57 +0000 |
---|---|---|
committer | Tobias Weingartner <weingart@cvs.openbsd.org> | 1998-02-24 22:06:57 +0000 |
commit | 0bb9b7b7dca2172711ad9e6d3a1f6326861f5583 (patch) | |
tree | 7fc87e984297ab2cbb4798168fc77310dcb716f9 /sys/arch/i386 | |
parent | 56d872e11254cc8a8ca03e06d9b6ae78fb8a078a (diff) |
Changes/updates to /boot stuff. More to come.
Fixes many divide by zero and pointer bugs.
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/stand/Makefile | 8 | ||||
-rw-r--r-- | sys/arch/i386/stand/README | 15 | ||||
-rw-r--r-- | sys/arch/i386/stand/biosboot/biosboot.S | 8 | ||||
-rw-r--r-- | sys/arch/i386/stand/boot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/Makefile | 8 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/alloca.S | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/apmprobe.c | 3 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdev.c | 34 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/cmd_i386.c | 70 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/debug_i386.S | 11 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/diskprobe.c | 3 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/gateA20.c | 73 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/gidt.S | 22 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/libsa.h | 3 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/memprobe.c | 42 |
16 files changed, 228 insertions, 92 deletions
diff --git a/sys/arch/i386/stand/Makefile b/sys/arch/i386/stand/Makefile index e380e37f026..25032315e27 100644 --- a/sys/arch/i386/stand/Makefile +++ b/sys/arch/i386/stand/Makefile @@ -1,5 +1,11 @@ -# $OpenBSD: Makefile,v 1.7 1997/07/28 22:03:25 mickey Exp $ +# $OpenBSD: Makefile,v 1.8 1998/02/24 22:06:36 weingart Exp $ SUBDIR= etc libsa libz biosboot installboot boot mbr +test-fd0: + sudo mount /dev/fd0a /mnt + sudo cp /usr/mdec/boot /mnt + sudo /usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot fd0 + sudo umount /mnt + .include <bsd.subdir.mk> diff --git a/sys/arch/i386/stand/README b/sys/arch/i386/stand/README index e596ac29873..170ef1fb354 100644 --- a/sys/arch/i386/stand/README +++ b/sys/arch/i386/stand/README @@ -1,4 +1,4 @@ -$OpenBSD: README,v 1.11 1997/10/17 15:03:16 weingart Exp $ +$OpenBSD: README,v 1.12 1998/02/24 22:06:37 weingart Exp $ # hmm, no copyright @@ -129,10 +129,6 @@ for that drive and other info. APM connect info is passed as well not in that apm0 structure, so apm0 will become a slave on bios0 soon. To get your /boot installed properly on a hardrive you have to load /bsd from that hd/partition (since only boot drive geometry is passed). -The passed geometry will be used for all the drives, if you -will try to installboot on other disks (floppies and pseudo-disks will -honor the disklabel), that might be useful on some bioses, -esp. SCSI HAs which use fixed translated geometry for all the drives. Mon Oct 13 16:41:18 CDT 1997 @@ -144,3 +140,12 @@ preliminary support for passing a memory map to the kernel, instead of cnvmem/extmem. This should make weird boards easier to support in the future. + +Tue Jan 6 19:51:43 CST 1998 +---------------------------- + +Query and pass PCI BIOS information to the kernel. This should help in +determening the correct configuration mode to use. Pass in cnvmem/extmem +as the user sets the amount of memory with the 'set memory' command, or +the amount calculated by the memory find/probe routines. + diff --git a/sys/arch/i386/stand/biosboot/biosboot.S b/sys/arch/i386/stand/biosboot/biosboot.S index fd4072302c6..a14c286b5a1 100644 --- a/sys/arch/i386/stand/biosboot/biosboot.S +++ b/sys/arch/i386/stand/biosboot/biosboot.S @@ -1,4 +1,4 @@ -/* $OpenBSD: biosboot.S,v 1.21 1997/11/05 02:12:54 mickey Exp $ */ +/* $OpenBSD: biosboot.S,v 1.22 1998/02/24 22:06:39 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -94,7 +94,7 @@ ebpb: .long 16 /* hidden sectors */ .word 0 /* physical disk */ .byte 0x29 /* signature, needed by NT */ .space 4, 0 /* volume serial number */ - .asciz "NO LABEL " + .asciz "UNIX LABEL" .asciz "UFS 4.4" /* boot code */ @@ -179,7 +179,7 @@ ebpb: .long 16 /* hidden sectors */ /* read error */ puts(2f) - jmp 5f + jmp halt 2: .asciz "\r\nRead error\r\n" 3: /* read next block */ @@ -207,7 +207,7 @@ ebpb: .long 16 /* hidden sectors */ je 3f puts(1f) -5: +halt: cli hlt 1: .ascii "Bad magic" diff --git a/sys/arch/i386/stand/boot/conf.c b/sys/arch/i386/stand/boot/conf.c index ce3572c6e9b..7b6c4629986 100644 --- a/sys/arch/i386/stand/boot/conf.c +++ b/sys/arch/i386/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.10 1997/10/26 23:22:09 mickey Exp $ */ +/* $OpenBSD: conf.c,v 1.11 1998/02/24 22:06:40 weingart Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -47,7 +47,7 @@ #include <biosdev.h> #include <dev/cons.h> -const char version[] = "1.06"; +const char version[] = "1.20"; int debug; struct fs_ops file_system[] = { diff --git a/sys/arch/i386/stand/libsa/Makefile b/sys/arch/i386/stand/libsa/Makefile index a3ee13f8b14..67be2420a55 100644 --- a/sys/arch/i386/stand/libsa/Makefile +++ b/sys/arch/i386/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.29 1997/10/22 23:34:35 mickey Exp $ +# $OpenBSD: Makefile,v 1.30 1998/02/24 22:06:42 weingart Exp $ LIB= sa @@ -16,11 +16,13 @@ DIR_KERN=$S/lib/libkern SRCS= gidt.S debug_i386.S alloca.S \ machdep.c dev_i386.c exec_i386.c cmd_i386.c \ biosdev.c bioscons.c gateA20.c apmprobe.c \ - memprobe.c diskprobe.c time.c + memprobe.c diskprobe.c pciprobe.c smpprobe.c \ + time.c # stand routines SRCS+= alloc.c exit.c exec.c getfile.c gets.c globals.c strcmp.c strlen.c \ - strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c + strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c \ + strtol.c # math for cd9660 #SRCS+= divdi3.c qdivrem.c diff --git a/sys/arch/i386/stand/libsa/alloca.S b/sys/arch/i386/stand/libsa/alloca.S index 6e14bbd3bc6..d6b2cc40f84 100644 --- a/sys/arch/i386/stand/libsa/alloca.S +++ b/sys/arch/i386/stand/libsa/alloca.S @@ -38,10 +38,10 @@ #if defined(LIBC_SCCS) .text - .asciz "$OpenBSD: alloca.S,v 1.1 1997/04/30 18:10:06 mickey Exp $" + .asciz "$OpenBSD: alloca.S,v 1.2 1998/02/24 22:06:43 weingart Exp $" #endif -/* like alloc, but automatic automatic free in return */ +/* like alloc, but automatic free in return */ ENTRY(alloca) popl %edx /* pop return addr */ diff --git a/sys/arch/i386/stand/libsa/apmprobe.c b/sys/arch/i386/stand/libsa/apmprobe.c index bb6b37b61d8..aee1192594c 100644 --- a/sys/arch/i386/stand/libsa/apmprobe.c +++ b/sys/arch/i386/stand/libsa/apmprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apmprobe.c,v 1.3 1997/11/30 21:51:36 mickey Exp $ */ +/* $OpenBSD: apmprobe.c,v 1.4 1998/02/24 22:06:44 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -144,7 +144,6 @@ apmprobe() #else printf(" apm"); #endif - putchar('\n'); addbootarg(BOOTARG_APMINFO, sizeof(ai), &ai); } } diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c index 014da740ef1..cb5e4a6599b 100644 --- a/sys/arch/i386/stand/libsa/biosdev.c +++ b/sys/arch/i386/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.49 1997/11/30 21:51:38 mickey Exp $ */ +/* $OpenBSD: biosdev.c,v 1.50 1998/02/24 22:06:46 weingart Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -89,9 +89,8 @@ bios_getdiskinfo(dev, pdi) { u_int rv; - rv = biosdreset(dev); - if(rv) - return(1); + /* Just reset, don't check return code */ + biosdreset(dev); #ifdef BIOS_DEBUG printf("getinfo: try #8, %x,%p\n", dev, pdi); @@ -105,16 +104,19 @@ bios_getdiskinfo(dev, pdi) "=b" (pdi->bios_sectors) : "0" (0x0800), "1" (dev) : "cc"); +#ifdef BIOS_DEBUG + printf("getinfo: got #8\n"); + printf("disk 0x%x: %d,%d,%d\n", dev, pdi->bios_cylinders, + pdi->bios_heads, pdi->bios_sectors); +#endif + if (rv & 0xff) + return(1); + /* Fix up info */ pdi->bios_number = dev; pdi->bios_heads++; pdi->bios_cylinders &= 0x3ff; pdi->bios_cylinders++; -#ifdef BIOS_DEBUG - printf("getinfo: got #8\n"); -#endif - if (rv & 0xff || !pdi->bios_cylinders) - return(1); #if 0 /* NOTE: @@ -144,7 +146,7 @@ bios_getdiskinfo(dev, pdi) /* * NOTE: This seems to hang on certain machines. Use function #8 * first, and verify with #21 IFF #8 succeeds first. - * don't try this for a: + * Do not try this for floppy 0 (to support CD-ROM boot). */ if (dev) { __asm __volatile (DOINT(0x13) "; setc %b0" @@ -155,6 +157,14 @@ bios_getdiskinfo(dev, pdi) return(1); } + /* XXX - Sanity check */ + if (!pdi->bios_cylinders || !pdi->bios_heads || !pdi->bios_sectors) + return(1); + + /* CD-ROMs sometimes return heads == 1 */ + if (pdi->bios_heads < 2) + return(1); + return(0); } @@ -288,6 +298,10 @@ bios_getdisklabel(bd, label) int cyl, head, sect; int error, i; + /* XXX - Sanity check */ + if(bd->bios_heads == 0 || bd->bios_sectors == 0) + return("failed to read disklabel"); + /* Read MBR */ btochs(DOSBBSECTOR, cyl, head, sect, bd->bios_heads, bd->bios_sectors); diff --git a/sys/arch/i386/stand/libsa/cmd_i386.c b/sys/arch/i386/stand/libsa/cmd_i386.c index 50a5cb36e49..c294da1be5f 100644 --- a/sys/arch/i386/stand/libsa/cmd_i386.c +++ b/sys/arch/i386/stand/libsa/cmd_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd_i386.c,v 1.19 1997/11/30 21:51:41 mickey Exp $ */ +/* $OpenBSD: cmd_i386.c,v 1.20 1998/02/24 22:06:47 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff, Tobias Weingartner @@ -42,22 +42,54 @@ #include "libsa.h" #include <cmd.h> -static int Xdiskinfo __P((void)); -static int Xregs __P((void)); + +extern const char version[]; + static int Xboot __P((void)); +static int Xdiskinfo __P((void)); static int Xmemory __P((void)); +static int Xregs __P((void)); +static int Xcnvmem __P((void)); +static int Xextmem __P((void)); /* From gidt.S */ -int bootbuf __P((int, int)); +int bootbuf __P((void*, int)); const struct cmd_table cmd_machine[] = { - { "diskinfo", CMDT_CMD, Xdiskinfo }, - { "regs", CMDT_CMD, Xregs }, { "boot", CMDT_CMD, Xboot }, + { "diskinfo", CMDT_CMD, Xdiskinfo }, { "memory", CMDT_CMD, Xmemory }, + { "regs", CMDT_CMD, Xregs }, + {"cnvmem", CMDT_CMD, Xcnvmem}, + {"extmem", CMDT_CMD, Xextmem}, { NULL, 0 } }; + +/* Set size of conventional ram */ +static int +Xcnvmem() +{ + if (cmd.argc != 2) + printf("cnvmem %d\n", cnvmem); + else + cnvmem = strtol(cmd.argv[1], NULL, 0); + + return 0; +} + +/* Set size of extended ram */ +static int +Xextmem() +{ + if (cmd.argc != 2) + printf("extmem %d\n", extmem); + else + extmem = strtol(cmd.argv[1], NULL, 0); + + return 0; +} + static int Xdiskinfo() { @@ -77,10 +109,12 @@ static int Xboot() { int dev, part, st; - char *buf = (void *)0x7c00; + char buf[DEV_BSIZE], *dest = (void*)0x7c00; if(cmd.argc != 2) { - printf("machine boot {fd,hd}[0123][abcd]\n"); + printf("machine boot {fd,hd}<0123>[abcd]\n"); + printf("Where [0123] is the disk number," + " and [abcd] is the partition.\n"); return 0; } @@ -91,7 +125,7 @@ Xboot() goto bad; if(cmd.argv[1][2] < '0' || cmd.argv[1][2] > '3') goto bad; - if(cmd.argv[1][3] < 'a' || cmd.argv[1][3] > 'd') + if((cmd.argv[1][3] < 'a' || cmd.argv[1][3] > 'd') && cmd.argv[1][3] != '\0') goto bad; printf("Booting from %s ", cmd.argv[1]); @@ -100,27 +134,29 @@ Xboot() dev += (cmd.argv[1][2] - '0'); part = (cmd.argv[1][3] - 'a'); - printf("[%x,%d]\n", dev, part); + if (part > 0) + printf("[%x,%d]\n", dev, part); + else + printf("[%x]\n", dev); /* Read boot sector from device */ - st = biosd_io(F_READ, dev, 0, 0, 1, 1, buf); + st = biosd_io(F_READ, dev, 0, 0, 0, 1, buf); if(st) goto bad; /* Frob boot flag in buffer from HD */ - if(dev & 0x80){ + if((dev & 0x80) && (part > 0)){ int i, j; for(i = 0, j = DOSPARTOFF; i < 4; i++, j += 16) if(part == i) - buf[j] = 0x80; + buf[j] |= 0x80; else - buf[j] = 0x00; + buf[j] &= ~0x80; } - printf("%x %x %x %x %x\n", buf[0], buf[1], buf[2], buf[3], buf[4]); - /* Load %dl, ljmp */ - bootbuf(dev, part); + bcopy(buf, dest, DEV_BSIZE); + bootbuf(dest, dev); bad: printf("Invalid device!\n"); diff --git a/sys/arch/i386/stand/libsa/debug_i386.S b/sys/arch/i386/stand/libsa/debug_i386.S index eb3966aa194..35da12bed59 100644 --- a/sys/arch/i386/stand/libsa/debug_i386.S +++ b/sys/arch/i386/stand/libsa/debug_i386.S @@ -1,4 +1,4 @@ -/* $OpenBSD: debug_i386.S,v 1.7 1997/09/18 18:38:00 mickey Exp $ */ +/* $OpenBSD: debug_i386.S,v 1.8 1998/02/24 22:06:48 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -52,11 +52,11 @@ alltraps: #ifdef DEBUG movl $0xb8280, %edi movl 0x0c*4(%esp), %eax # trapno - addb $'@', %al + addb $'0', %al movb $0x17, %ah shll $16, %eax movb 0x0d*4(%esp), %al # error - addl $' ', %al + addl $'0', %al movb $0x17, %ah movl %ax, (%edi) hlt @@ -73,6 +73,7 @@ alltraps: popl %ds popal addl $0x8, %esp + hlt iret ENTRY(check_regs) @@ -98,8 +99,8 @@ ENTRY(check_regs) movl %ss, %eax; stosl # %ss movl 0x04*4(%esp), %eax; stosl # %ds movl 0x03*4(%esp), %eax; stosl # %es - movl 0x02*4(%esp), %eax; stosl # %ds - movl 0x01*4(%esp), %eax; stosl # %es + movl 0x02*4(%esp), %eax; stosl # %fs + movl 0x01*4(%esp), %eax; stosl # %gs #ifdef DEBUG movl $0xb8288, %edi diff --git a/sys/arch/i386/stand/libsa/diskprobe.c b/sys/arch/i386/stand/libsa/diskprobe.c index 3342ff37b10..38ef5db6c4c 100644 --- a/sys/arch/i386/stand/libsa/diskprobe.c +++ b/sys/arch/i386/stand/libsa/diskprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diskprobe.c,v 1.13 1997/12/22 04:39:22 mickey Exp $ */ +/* $OpenBSD: diskprobe.c,v 1.14 1998/02/24 22:06:50 weingart Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -176,7 +176,6 @@ diskprobe() #endif hardprobe(); - /* Checksumming of hard disks */ for (i = 0; disksum(i++) && i < MAX_CKSUMLEN; ) ; diff --git a/sys/arch/i386/stand/libsa/gateA20.c b/sys/arch/i386/stand/libsa/gateA20.c index 8e81e1e834b..76837a4b6db 100644 --- a/sys/arch/i386/stand/libsa/gateA20.c +++ b/sys/arch/i386/stand/libsa/gateA20.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gateA20.c,v 1.4 1997/07/17 23:00:26 mickey Exp $ */ +/* $OpenBSD: gateA20.c,v 1.5 1998/02/24 22:06:51 weingart Exp $ */ /* * Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 @@ -28,17 +28,33 @@ * the rights to redistribute these changes. */ +#include <sys/param.h> #include <sys/types.h> #include <machine/pio.h> -#include <lib/libsa/stand.h> #include <dev/ic/i8042reg.h> +#include "libsa.h" + #define KC_CMD_WOUT 0xd1 /* write output port */ #define KB_A20 0xdf /* enable A20, enable output buffer full interrupt enable data line enable clock line */ + +#define A20_KBD 0 +#define A20_0x92 1 + +/* + * Check for an oddball IBM_L40 machine. + */ +int +getA20type() +{ + return(A20_KBD); +} + + /* * Gate A20 for high memory */ @@ -46,24 +62,37 @@ void gateA20(on) int on; { -#ifdef IBM_L40 - outb(0x92, 0x2); -#else IBM_L40 - while (inb(KBSTATP) & KBS_IBF); - - while (inb(KBSTATP) & KBS_DIB) - (void)inb(KBDATAP); - - outb(KBCMDP, KC_CMD_WOUT); - while (inb(KBSTATP) & KBS_IBF); - - if (on) - outb(KBDATAP, KB_A20); - else - outb(KBDATAP, 0xcd); - while (inb(KBSTATP) & KBS_IBF); - - while (inb(KBSTATP) & KBS_DIB) - (void)inb(KBDATAP); -#endif IBM_L40 + + if (getA20type() == A20_0x92) { + int data; + + /* Try to use 0x92 to turn on A20 */ + if (on) { + data = inb(0x92); + outb(0x92, data | 0x2); + } else { + data = inb(0x92); + outb(0x92, data & ~0x2); + } + } else { + + /* XXX - These whiles might need to be changed to bounded for loops */ + while (inb(KBSTATP) & KBS_IBF); + + while (inb(KBSTATP) & KBS_DIB) + (void)inb(KBDATAP); + + outb(KBCMDP, KC_CMD_WOUT); + while (inb(KBSTATP) & KBS_IBF); + + if (on) + outb(KBDATAP, KB_A20); + else + outb(KBDATAP, 0xcd); + while (inb(KBSTATP) & KBS_IBF); + + while (inb(KBSTATP) & KBS_DIB) + (void)inb(KBDATAP); + } } + diff --git a/sys/arch/i386/stand/libsa/gidt.S b/sys/arch/i386/stand/libsa/gidt.S index 35e03b91085..76b3f62b518 100644 --- a/sys/arch/i386/stand/libsa/gidt.S +++ b/sys/arch/i386/stand/libsa/gidt.S @@ -1,4 +1,4 @@ -/* $OpenBSD: gidt.S,v 1.18 1997/10/24 22:22:26 mickey Exp $ */ +/* $OpenBSD: gidt.S,v 1.19 1998/02/24 22:06:52 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -216,7 +216,7 @@ idt: idte(xx); idte(xx); idte(xx); idte(xx); idte(xx); idte(xx) idte(xx); idte(xx); idte(xx); idte(xx); idte(xx); idte(xx) idte(xx) - /* Maskable interrupts (32-255) */ + /* Maskable interrupts (32-255) */ /* BIOS entry points (32-63) */ /* DOS entry points (64-80) */ #define idtb(b) idte(emu/**/b) @@ -338,6 +338,7 @@ IEMUENT(44); IEMUENT(45); IEMUENT(46); IEMUENT(47) * Return: %eax, %edx, %ecx, %eflags (as returned from BIOS) * */ +.globl EMUh EMUh: /* save %eax */ movl %eax, 3f @@ -419,10 +420,19 @@ intno = . - 1 /* Call buffer at 07c0:0000 in real mode to simulate a BIOS boot */ ENTRY(bootbuf) popl %eax /* Don't need return address */ + popl %esi /* Buffer */ popl %edx /* Device */ - popl %eax /* Partition - Not used, overwritten */ - prot2real /* Switch */ + prot2real /* Switch */ + + /* Set up stack */ + cli + xorl %eax, %eax + pushl %ax + popl %ss + movl $0xfffc, %esp + sti + + /* Jump to buffer */ addr32 - data32 - ljmp $0x7c0, $0x000 + ljmp $0x0, $0x7c00 diff --git a/sys/arch/i386/stand/libsa/libsa.h b/sys/arch/i386/stand/libsa/libsa.h index 54b8b8aee1a..d9148e98684 100644 --- a/sys/arch/i386/stand/libsa/libsa.h +++ b/sys/arch/i386/stand/libsa/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.23 1997/11/30 21:51:44 mickey Exp $ */ +/* $OpenBSD: libsa.h,v 1.24 1998/02/24 22:06:54 weingart Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -41,6 +41,7 @@ void smpprobe __P((void)); void memprobe __P((void)); void diskprobe __P((void)); void apmprobe __P((void)); +void pciprobe __P((void)); void devboot __P((dev_t, char *)); void *alloca __P((size_t)); diff --git a/sys/arch/i386/stand/libsa/machdep.c b/sys/arch/i386/stand/libsa/machdep.c index 366c04e6574..5e4aec98b31 100644 --- a/sys/arch/i386/stand/libsa/machdep.c +++ b/sys/arch/i386/stand/libsa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.22 1997/11/30 21:51:46 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.23 1998/02/24 22:06:55 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -55,11 +55,13 @@ machdep() cninit(); CKPT('3'); #ifndef _TEST memprobe(); CKPT('4'); - diskprobe(); CKPT('6'); + diskprobe(); CKPT('5'); printf("bios:"); - apmprobe(); CKPT('7'); - printf("\n"); + apmprobe(); CKPT('6'); + pciprobe(); CKPT('7'); + smpprobe(); CKPT('8'); + printf("\n\n"); #endif - CKPT('9'); + CKPT('Z'); } diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c index 984b19f1efb..1deadbe9616 100644 --- a/sys/arch/i386/stand/libsa/memprobe.c +++ b/sys/arch/i386/stand/libsa/memprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memprobe.c,v 1.25 1997/11/30 21:51:47 mickey Exp $ */ +/* $OpenBSD: memprobe.c,v 1.26 1998/02/24 22:06:56 weingart Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner, Michael Shalayeff @@ -37,10 +37,33 @@ #include <stand/boot/bootarg.h> #include "libsa.h" -static int addrprobe __P((u_int)); u_int cnvmem, extmem; /* XXX - compatibility */ bios_memmap_t *memory_map; + +/* Check gateA20 + * + * A sanity check. + */ +static __inline int +checkA20(void) +{ + char *p = (char *)0x100000; + char *q = (char *)0x000000; + int st; + + /* Simple check */ + if(*p != *q) + return(1); + + /* Complex check */ + *p = ~(*p); + st = (*p != *q); + *p = ~(*p); + + return(st); +} + /* BIOS int 15, AX=E820 * * This is the "prefered" method. @@ -283,14 +306,23 @@ memprobe() /* XXX - Compatibility, remove later */ extmem = cnvmem = 0; for(im = bm; im->type != BIOS_MAP_END; im++) { - if (im->type == BIOS_MAP_FREE) { + /* Count only "good" memory chunks 4K an up in size */ + if ((im->type == BIOS_MAP_FREE) && (im->size >= 4)) { printf(" %luK", (u_long)im->size); - if(im->addr < 0x100000) + /* We ignore "good" memory in the 640K-1M hole */ + if(im->addr < 0xA0000) cnvmem += im->size; - else + if(im->addr >= 0x100000) extmem += im->size; } } + + /* Check if gate A20 is on */ + if(checkA20()) + printf(" [A20 on]"); + else + printf(" [A20 off!]"); + printf("\n"); } |