Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Sep 2002 07:00:03 +0900 (JST)
From:      Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
To:        current@FreeBSD.ORG
Subject:   [PATCH] Workaround for bogus INT 12H BIOS service implementation
Message-ID:  <20020930.070003.70227125.iwasaki@jp.FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hi, I've found that some recent machine's BIOS doesn't support INT 12H
(Get base memory size) BIOS service, instead they seems to support
SMAP (system memory map: INT 15H function e820H) for this purpose.
I already checked that there is no problems on Linux or Windows or
others, but FreeBSD won't boot at all.

I'll report bogus INT 12H BIOS service implementation to BIOS vendors
if I get chances.  On the other hand, I think we need to have a
workaround in a safety way for this problem for newer machines.

Here is the patches.  I'll commit them in a few days if no objection.

Thanks

Index: sys/boot/i386/boot2/boot2.c
===================================================================
RCS file: /home/ncvs/src/sys/boot/i386/boot2/boot2.c,v
retrieving revision 1.44
diff -u -r1.44 boot2.c
--- sys/boot/i386/boot2/boot2.c	1 Sep 2002 21:29:10 -0000	1.44
+++ sys/boot/i386/boot2/boot2.c	29 Sep 2002 21:16:19 -0000
@@ -231,7 +231,7 @@
     dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1;
     bootinfo.bi_version = BOOTINFO_VERSION;
     bootinfo.bi_size = sizeof(bootinfo);
-    bootinfo.bi_basemem = memsize(MEM_BASE);
+    bootinfo.bi_basemem = 0;	/* XXX will be filled at loader or kernel */
     bootinfo.bi_extmem = memsize(MEM_EXT);
     bootinfo.bi_memsizes_valid++;
     for (i = 0; i < N_BIOS_GEOM; i++)
Index: sys/boot/i386/loader/main.c
===================================================================
RCS file: /home/ncvs/src/sys/boot/i386/loader/main.c,v
retrieving revision 1.25
diff -u -r1.25 main.c
--- sys/boot/i386/loader/main.c	5 Nov 2001 19:03:01 -0000	1.25
+++ sys/boot/i386/loader/main.c	29 Sep 2002 21:01:51 -0000
@@ -129,6 +129,10 @@
 	if (devsw[i]->dv_init != NULL)
 	    (devsw[i]->dv_init)();
     printf("BIOS %dkB/%dkB available memory\n", bios_basemem / 1024, bios_extmem / 1024);
+    if (initial_bootinfo != NULL) {
+	initial_bootinfo->bi_basemem = bios_basemem / 1024;
+	initial_bootinfo->bi_extmem = bios_extmem / 1024;
+    }
 
     /* detect ACPI for future reference */
     biosacpi_detect();
Index: sys/i386/i386/machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.532
diff -u -r1.532 machdep.c
--- sys/i386/i386/machdep.c	7 Sep 2002 19:12:42 -0000	1.532
+++ sys/i386/i386/machdep.c	29 Sep 2002 21:15:26 -0000
@@ -1269,8 +1269,12 @@
 	/*
 	 * Perform "base memory" related probes & setup
 	 */
-	vm86_intcall(0x12, &vmf);
-	basemem = vmf.vmf_ax;
+	if (bootinfo.bi_basemem != 0) {
+		basemem = bootinfo.bi_basemem;
+	} else {
+		vm86_intcall(0x12, &vmf);
+		basemem = vmf.vmf_ax;
+	}
 	if (basemem > 640) {
 		printf("Preposterous BIOS basemem of %uK, truncating to 640K\n",
 			basemem);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020930.070003.70227125.iwasaki>