summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-10-09 19:04:19 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-10-09 19:04:19 +0000
commit9594b8260b35e1cc7cfa14ce58e92388881e95f6 (patch)
tree5a8712c9f4c840f1b6191743484fe25e5d806b5c /sys/arch
parenta380e96290d8cc7f60fb2d23afd14098e1908852 (diff)
Skip memory areas smaller than 1 MB above the 16 MB boundary to deal with
buggy ACP BIOSes. Based on a diff from weingart@. ok deraadt@, oga@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/machdep.c13
-rw-r--r--sys/arch/i386/i386/machdep.c19
2 files changed, 23 insertions, 9 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index b87d7509213..418903872c9 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.83 2008/10/06 21:05:56 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.84 2008/10/09 19:04:18 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -1305,6 +1305,17 @@ init_x86_64(paddr_t first_avail)
e1 = trunc_page(bmp->addr + bmp->size);
s2 = e2 = 0; s3 = e3 = 0; s4 = e4 = 0;
+ /*
+ * XXX Some buggy ACPI BIOSes use memory that they
+ * declare as free. Typically the affected memory
+ * areas are small blocks between areas reserved for
+ * ACPI and other BIOS goo. So skip areas smaller
+ * than 1 MB above the 16 MB boundary (to avoid
+ * affecting legacy stuff).
+ */
+ if (s1 > 16*1024*1024 && (e1 - s1) < 1*1024*1024)
+ continue;
+
/* Check and adjust our segment(s) */
/* Nuke page zero */
if (s1 < avail_start) {
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 87e091c6ec0..80b7c6f392b 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.436 2008/10/06 19:46:21 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.437 2008/10/09 19:04:18 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -3005,8 +3005,8 @@ init386(paddr_t first_avail)
if (a < 8 * NBPG)
a = 8 * NBPG;
- /* skip regions which are zero or negative in size */
- if (a >= e) {
+ /* skip shorter than page regions */
+ if (a >= e || (e - a) < NBPG) {
#ifdef DEBUG
printf("-S");
#endif
@@ -3014,12 +3014,15 @@ init386(paddr_t first_avail)
}
/*
- * XXX - This is a hack to work around BIOS bugs and
- * a bug in the msgbuf allocation. We skip regions
- * smaller than the message buffer or 16-bit segment
- * limit in size.
+ * XXX Some buggy ACPI BIOSes use memory that
+ * they declare as free. Typically the
+ * affected memory areas are small blocks
+ * between areas reserved for ACPI and other
+ * BIOS goo. So skip areas smaller than 1 MB
+ * above the 16 MB boundary (to avoid
+ * affecting legacy stuff).
*/
- if ((e - a) < max((MSGBUFSIZE / NBPG), (64 * 1024))) {
+ if (a > 16*1024*1024 && (e - a) < 1*1024*1024) {
#ifdef DEBUG
printf("-X");
#endif