summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand/libsa
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-08-22 20:13:45 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-08-22 20:13:45 +0000
commit98100e95950a0ee3f62ac533d1d945a5e50cbe79 (patch)
tree58af5ff237a7793f0c25950298635a7edc5b78ef /sys/arch/i386/stand/libsa
parent89697efdd4d2c2f615145d8dd494d2359b531201 (diff)
put values into BIOS_vars so kernel will get 'em soon
Diffstat (limited to 'sys/arch/i386/stand/libsa')
-rw-r--r--sys/arch/i386/stand/libsa/biosdev.c11
-rw-r--r--sys/arch/i386/stand/libsa/exec_i386.c21
-rw-r--r--sys/arch/i386/stand/libsa/libsa.h9
-rw-r--r--sys/arch/i386/stand/libsa/machdep.c45
-rw-r--r--sys/arch/i386/stand/libsa/memprobe.c9
5 files changed, 49 insertions, 46 deletions
diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c
index 143f2293bd8..abf52a4ccd6 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.25 1997/08/21 20:36:15 mickey Exp $ */
+/* $OpenBSD: biosdev.c,v 1.26 1997/08/22 20:13:42 mickey Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -254,10 +254,15 @@ biosopen(struct open_file *f, ...)
return ENXIO;
}
- bd->edd_flags = EDDcheck((dev_t)bd->biosdev);
- bootdev_geometry = bd->dinfo = biosdinfo((dev_t)bd->biosdev);
+ BIOS_vars.bios_dev = bd->biosdev;
+ bd->dinfo = biosdinfo((dev_t)bd->biosdev);
+ /* pass c: geometry for floppy */
+ BIOS_vars.bios_geometry = (bd->biosdev & 0x80)? bd->dinfo
+ : biosdinfo(0x80);
+
/* maj is fixed later w/ disklabel read */
bootdev = bd->bsddev = MAKEBOOTDEV(maj, 0, 0, unit, part);
+ bd->edd_flags = EDDcheck((dev_t)bd->biosdev);
#ifdef BIOS_DEBUG
if (debug) {
diff --git a/sys/arch/i386/stand/libsa/exec_i386.c b/sys/arch/i386/stand/libsa/exec_i386.c
index 9c259d8282c..eb855e7ab96 100644
--- a/sys/arch/i386/stand/libsa/exec_i386.c
+++ b/sys/arch/i386/stand/libsa/exec_i386.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_i386.c,v 1.12 1997/08/21 20:18:52 mickey Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.13 1997/08/22 20:13:43 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -37,11 +37,10 @@
#include <sys/param.h>
#include <sys/exec.h>
#include <sys/reboot.h>
+#include <dev/cons.h>
#include <machine/biosvar.h>
#include "libsa.h"
-int bootdev, bootdev_geometry;
-
#define round_to_size(x) (((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
void
@@ -59,19 +58,23 @@ machdep_start(startaddr, howto, loadaddr, ssym, esym)
x->a_midmag, x->a_text, x->a_data, x->a_bss, x->a_syms,
x->a_entry, x->a_trsize, x->a_drsize);
- printf("/bsd(%x,%x,%x,%x,%x,%x,%x,%x)\n",
- howto, bootdev, 0, round_to_size(esym),
- extmem, cnvmem, (int)&apminfo, (int)&kentry);
+ printf("/bsd(%x,%x,%x,%x,%x,%x,%x)\n",
+ howto, bootdev, 0, round_to_size(esym),
+ BIOS_vars.bios_extmem, BIOS_vars.bios_cnvmem,
+ (int)&BIOS_vars);
getchar();
#endif
+ if (cn_tab != NULL)
+ BIOS_vars.boot_consdev = cn_tab->cn_dev;
(int)startaddr &= 0xffffff;
printf("entry point at 0x%x\n", (int)startaddr);
/* stack and the gung is ok at this point, so, no need for asm setup */
- (*(int __attribute__((noreturn))(*)(int,int,int,int,int,int,int,int))
- startaddr)(howto, bootdev, 0, round_to_size(esym),
- extmem, cnvmem, (int)&apminfo, (int)&kentry);
+ (*(int __attribute__((noreturn))(*)(int,int,int,int,int,int,int))
+ startaddr)(howto, bootdev, 0, round_to_size(esym),
+ BIOS_vars.bios_extmem, BIOS_vars.bios_cnvmem,
+ (int)&BIOS_vars);
/* not reached */
}
diff --git a/sys/arch/i386/stand/libsa/libsa.h b/sys/arch/i386/stand/libsa/libsa.h
index 8cc5ef7f49b..d11f8a1815f 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.14 1997/08/21 22:04:33 mickey Exp $ */
+/* $OpenBSD: libsa.h,v 1.15 1997/08/22 20:13:43 mickey Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -39,12 +39,9 @@ void memprobe __P((void));
void devboot __P((dev_t, char *));
void *alloca __P((size_t));
void machdep __P((void));
-int kentry __P((u_int, u_int));
void time_print __P((void));
- /* XXX filled in assumption that last file opened is kernel */
-extern int bootdev, bootdev_geometry;
-extern u_int cnvmem, extmem;
-extern struct apm_connect_info apminfo;
extern const char bdevs[][4];
extern const int nbdevs;
+extern int bootdev; /* XXX pass through the global to exec_i386 */
+
diff --git a/sys/arch/i386/stand/libsa/machdep.c b/sys/arch/i386/stand/libsa/machdep.c
index 393901148fb..8143d27e2a3 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.11 1997/08/21 20:36:16 mickey Exp $ */
+/* $OpenBSD: machdep.c,v 1.12 1997/08/22 20:13:44 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -58,12 +58,12 @@
#include "libsa.h"
#include <machine/apmvar.h>
-#undef APM_DISCONNECT /* XXX temp hack */
#include <machine/biosvar.h>
#include "debug.h"
-struct apm_connect_info apminfo;
struct BIOS_regs BIOS_regs;
+struct BIOS_vars BIOS_vars;
+int bootdev;
#ifdef DEBUG
#define CKPT(c) (*(u_int16_t*)0xb8148 = 0x4700 + (c))
@@ -72,8 +72,8 @@ struct BIOS_regs BIOS_regs;
#endif
#ifdef BOOT_APM
-static u_int
-apm_init()
+static __inline u_int
+apm_check()
{
u_int detail;
u_int8_t f;
@@ -100,13 +100,13 @@ apm_disconnect() {
__asm __volatile(DOINT(0x15) "\n\t"
"setc %b0"
: "=a" (rv)
- : "a" (APM_DISCONNECT), "b" (PMDV_APMBIOS)
+ : "a" (APM_DISCONNECTANY), "b" (PMDV_APMBIOS)
: "%ecx", "%edx", "cc");
return (rv & 0xff)? rv >> 8 : 0;
}
static __inline int
-apm_connect(struct apm_connect_info *apminfo)
+apm_connect()
{
register u_int16_t f;
__asm __volatile (DOINT(0x15) "\n\t"
@@ -116,18 +116,18 @@ apm_connect(struct apm_connect_info *apminfo)
"movzwl %%cx, %%ecx\n\tshll $4, %2\n\t"
"movzwl %%dx, %%edx\n\tshll $4, %3\n\t"
: "=b" (f),
- "=a" (apminfo->apm_code32_seg_base),
- "=c" (apminfo->apm_code16_seg_base),
- "=d" (apminfo->apm_data_seg_base)
+ "=a" (BIOS_vars.apm_code32_base),
+ "=c" (BIOS_vars.apm_code16_base),
+ "=d" (BIOS_vars.apm_data_base)
: "a" (APM_PROT32CONNECT), "b" (PMDV_APMBIOS)
: "cc");
- apminfo->apm_entrypt = BIOS_regs.biosr_bx;
+ BIOS_vars.apm_entry = BIOS_regs.biosr_bx;
#if 0
- apminfo->apm_code32_seg_len = BIOS_regs.biosr_si & 0xffff;
- apminfo->apm_data_seg_len = BIOS_regs.biosr_di & 0xffff;
+ BIOS_vars.apm_code_len = BIOS_regs.biosr_si & 0xffff;
+ BIOS_vars.apm_data_len = BIOS_regs.biosr_di & 0xffff;
#else
- apminfo->apm_code32_seg_len = 0x10000;
- apminfo->apm_data_seg_len = 0x10000;
+ BIOS_vars.apm_code_len = 0x10000;
+ BIOS_vars.apm_data_len = 0x10000;
#endif
return (f & 0xff)? f >> 8 : 0;
}
@@ -146,21 +146,18 @@ machdep()
#endif
#ifdef BOOT_APM
- if ((apminfo.apm_detail = apm_init())) {
+ if ((BIOS_vars.apm_detail = apm_check())) {
printf("apm: ");
apm_disconnect();
- if (apm_connect(&apminfo) != 0)
+ if (apm_connect() != 0)
printf("connect error\n");
#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);
+ BIOS_vars.apm_detail, BIOS_vars.apm_code32_base,
+ BIOS_vars.apm_code16_base, BIOS_vars.apm_code_len,
+ BIOS_vars.apm_data_base, BIOS_vars.apm_data_len,
+ BIOS_vars.apm_entry);
#else
printf("present");
#endif
diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c
index 728c162e269..ba89600a367 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.9 1997/08/12 19:12:09 mickey Exp $ */
+/* $OpenBSD: memprobe.c,v 1.10 1997/08/22 20:13:44 mickey Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -43,8 +43,9 @@ memprobe()
{
int ram;
- __asm __volatile(DOINT(0x12) : "=a" (cnvmem) :: "%ecx", "%edx", "cc");
- cnvmem &= 0xffff;
+ __asm __volatile(DOINT(0x12) : "=a" (BIOS_vars.bios_cnvmem)
+ :: "%ecx", "%edx", "cc");
+ BIOS_vars.bios_cnvmem &= 0xffff;
/* probe extended memory
*
@@ -60,7 +61,7 @@ memprobe()
}
printf("Found %d KB extended memory.\n", ram-1024);
- extmem = ram - 1024;
+ BIOS_vars.bios_extmem = ram - 1024;
}
/* addrprobe(kloc): Probe memory at address kloc * 1024.