summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-07-18 00:37:16 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-07-18 00:37:16 +0000
commit356dfc94edc41fd30e29c170f8e292585618617d (patch)
treeb84f42deb92fb23d078e54b6c98411ff02078722 /sys/arch/i386
parentd834d51b5c22f9e09b54fe12c8a5a862e6265e35 (diff)
yet another small step towards MI boot
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/stand/libsa/Makefile4
-rw-r--r--sys/arch/i386/stand/libsa/machdep.c100
2 files changed, 102 insertions, 2 deletions
diff --git a/sys/arch/i386/stand/libsa/Makefile b/sys/arch/i386/stand/libsa/Makefile
index 9cf9e601bdc..b4621a95651 100644
--- a/sys/arch/i386/stand/libsa/Makefile
+++ b/sys/arch/i386/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.14 1997/07/17 23:20:24 mickey Exp $
+# $OpenBSD: Makefile,v 1.15 1997/07/18 00:37:15 mickey Exp $
LIB= sa
@@ -15,7 +15,7 @@ DIR_KERN=$S/lib/libkern
# i386 stuff (so, it will possibly load in the same 64k)
SRCS= unixsys.S bioscom.S biosdisk.S bioskbd.S biostime.S biosmem.S gidt.S \
debug_i386.S dev_i386.c exec_i386.c biosdev.c gateA20.c memprobe.c \
- time.c alloca.S apm_init.S # kentry.c machdep.c
+ time.c alloca.S apm_init.S machdep.c # kentry.c
# stand routines
SRCS+= alloc.c exit.c exec.c getfile.c gets.c globals.c strcmp.c strlen.c \
diff --git a/sys/arch/i386/stand/libsa/machdep.c b/sys/arch/i386/stand/libsa/machdep.c
new file mode 100644
index 00000000000..ccafe778175
--- /dev/null
+++ b/sys/arch/i386/stand/libsa/machdep.c
@@ -0,0 +1,100 @@
+/* $OpenBSD: machdep.c,v 1.1 1997/07/18 00:37:15 mickey Exp $ */
+
+/*
+ * Copyright (c) 1997 Michael Shalayeff
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Michael Shalayeff.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <i386/stand/libsa/libsa.h>
+#include <machine/biosvar.h>
+#include <machine/apmvar.h>
+#include "debug.h"
+
+struct apm_connect_info apminfo;
+
+void
+machdep()
+{
+#ifdef DEBUG
+ *(u_int16_t*)0xb8148 = 0x4730;
+#endif
+ gateA20(1);
+ debug_init();
+ cons_probe(); /* call console init before any io */
+#ifndef _TEST
+ memprobe();
+#endif
+#ifdef DEBUG
+ *(u_int16_t*)0xb8148 = 0x4f31;
+#endif
+ printf("apm_init: ");
+ switch(apminfo.apm_detail = apm_init()) {
+ case APMINI_CANTFIND:
+ printf("not supported");
+ break;
+
+ case APMINI_NOT32BIT:
+ printf("no 32 bit interface");
+ break;
+
+ case APMINI_CONNECTERR:
+ printf("connect error");
+ break;
+
+ case APMINI_BADVER:
+ printf("bad version");
+ break;
+
+ default:
+ /* valid: detail, dx, bx */
+ apminfo.apm_code32_seg_base = (BIOS_regs.br_ax & 0xffff) << 4;
+ apminfo.apm_code16_seg_base = (BIOS_regs.br_cx & 0xffff) << 4;
+ apminfo.apm_data_seg_base = (BIOS_regs.br_dx & 0xffff) << 4;
+#if 0
+ apminfo.apm_code32_seg_len = BIOS_regs.br_si & 0xffff;
+ apminfo.apm_data_seg_len = BIOS_regs.br_di & 0xffff;
+#else
+ apminfo.apm_code32_seg_len = 0x10000;
+ apminfo.apm_data_seg_len = 0x10000;
+#endif
+ apminfo.apm_entrypt = BIOS_regs.br_bx;
+#ifdef DEBUG
+ printf("%x text=%x/%x[%x] data=%x[%x] @ %x",
+ apminfo.apm_detail,
+ apminfo.apm_code32_seg_base,
+ apminfo.apm_code16_seg_base,
+ apminfo.apm_code32_seg_len,
+ apminfo.apm_data_seg_base,
+ apminfo.apm_data_seg_len,
+ apminfo.apm_entrypt);
+#endif
+ }
+ putchar('\n');
+}