summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/machdep.c25
-rw-r--r--sys/arch/i386/include/biosvar.h4
-rw-r--r--sys/arch/i386/stand/libsa/apmprobe.c34
3 files changed, 41 insertions, 22 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 6e7adc2e7eb..c4f7bf6325d 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.105 1999/03/16 08:34:40 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.106 1999/05/09 15:09:04 mickey Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -1869,26 +1869,27 @@ init386(first_avail)
#endif
/*
- * Allocate the physical addresses used by RAM from the iomem
- * extent map. This is done before the addresses are
- * page rounded just to make sure we get them all.
- */
- if (extent_alloc_region(iomem_ex, 0, IOM_BEGIN, EX_NOWAIT)) {
- /* XXX What should we do? */
- printf("WARNING: CAN'T ALLOCATE BASE RAM FROM IOMEM EXTENT MAP!\n");
- }
-
- /*
* BIOS leaves data in low memory and VM system doesn't work with
* phys 0, /boot leaves arguments at page 1.
*/
#if !defined(MACHINE_NEW_NONCONTIG)
avail_next =
#endif
- avail_start = bootapiver >= 2? i386_round_page(bootargv+bootargc): NBPG;
+ avail_start = bootapiver & BAPIV_VECTOR?
+ i386_round_page(bootargv+bootargc): NBPG;
avail_end = extmem ? IOM_END + extmem * 1024
: cnvmem * 1024; /* just temporary use */
+ /*
+ * Allocate the physical addresses used by RAM from the iomem
+ * extent map. This is done before the addresses are
+ * page rounded just to make sure we get them all.
+ */
+ if (extent_alloc_region(iomem_ex, avail_start, IOM_BEGIN, EX_NOWAIT)) {
+ /* XXX What should we do? */
+ printf("WARNING: CAN'T ALLOCATE BASE RAM FROM IOMEM EXTENT MAP!\n");
+ }
+
if (avail_end > IOM_END && extent_alloc_region(iomem_ex, IOM_END,
(avail_end - IOM_END), EX_NOWAIT)) {
/* XXX What should we do? */
diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h
index 2fef96b29d6..6109c9b5509 100644
--- a/sys/arch/i386/include/biosvar.h
+++ b/sys/arch/i386/include/biosvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosvar.h,v 1.28 1998/06/08 17:01:37 mickey Exp $ */
+/* $OpenBSD: biosvar.h,v 1.29 1999/05/09 15:09:05 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -37,7 +37,7 @@
#define BOOT_APIVER 0x00000002
#define BOOTARG_LEN (NBPG*1)
-#define BOOTARG_OFF (NBPG)
+#define BOOTARG_OFF (NBPG*2)
/* BIOS media ID */
#define BIOSM_F320K 0xff /* floppy ds/sd 8 spt */
diff --git a/sys/arch/i386/stand/libsa/apmprobe.c b/sys/arch/i386/stand/libsa/apmprobe.c
index 049c503f8f1..0760c376563 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.5 1998/04/18 07:39:40 deraadt Exp $ */
+/* $OpenBSD: apmprobe.c,v 1.6 1999/05/09 15:09:05 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -56,10 +56,15 @@
* FAX: (916)356-6100.
*/
+#include <sys/param.h>
#include "libsa.h"
#include <stand/boot/bootarg.h>
+
+#include <dev/isa/isareg.h>
+
#include <machine/apmvar.h>
#include <machine/biosvar.h>
+
#include "debug.h"
extern int debug;
@@ -117,15 +122,28 @@ apm_connect(ai)
"=d" (ai->apm_data_base)
: "0" (APM_PROT32_CONNECT), "1" (APM_DEV_APM_BIOS)
: "cc");
+ if (f & 0xff)
+ return f >> 8;
+
ai->apm_entry = BIOS_regs.biosr_bx;
-#if 0
- ai->apm_code_len = BIOS_regs.biosr_si & 0xffff;
- ai->apm_data_len = BIOS_regs.biosr_di & 0xffff;
-#else
- ai->apm_code_len = 0x10000;
ai->apm_data_len = 0x10000;
-#endif
- return (f & 0xff)? f >> 8 : 0;
+ ai->apm_code_len = 0x10000 - (ai->apm_code16_base & 0xffff);
+
+ /*
+ * this is a hack to make all those weird boxes keeping
+ * apm data in low mem work.
+ */
+ if (!ai->apm_data_len ||
+ ai->apm_data_base + ai->apm_data_len > IOM_END ||
+ (ai->apm_data_base < IOM_BEGIN &&
+ ai->apm_data_base + ai->apm_data_len > IOM_BEGIN))
+ ai->apm_data_len =
+ 0x10000 - (ai->apm_data_base & 0xffff);
+ if (ai->apm_data_base < BOOTARG_OFF)
+ ai->apm_data_len =
+ NBPG - (ai->apm_data_base & PGOFSET);
+
+ return 0;
}
void