Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/i386 Fix bugs in the BIOS memory probe.
details: https://anonhg.NetBSD.org/src/rev/da2365c80ce2
branches: trunk
changeset: 538434:da2365c80ce2
user: kanaoka <kanaoka%NetBSD.org@localhost>
date: Sun Oct 20 10:35:41 2002 +0000
description:
Fix bugs in the BIOS memory probe.
- If the BIOS reports the same memory cluster multiple times,
only allocate the extent once.
- If we fail to allocate an extent,
don't add it to mem_clusters and don't increment mem_cluster_cnt.
- When loading the physical extents,
make sure we don't try to add an extent with zero length (seg_start == tmp).
port-i386/13399: from maximum entropy <entropy%tappedin.com@localhost>.
diffstat:
sys/arch/i386/i386/machdep.c | 53 ++++++++++++++++++++++++++++++++-----------
1 files changed, 39 insertions(+), 14 deletions(-)
diffs (113 lines):
diff -r 5b02d781d3b5 -r da2365c80ce2 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Sun Oct 20 10:17:14 2002 +0000
+++ b/sys/arch/i386/i386/machdep.c Sun Oct 20 10:35:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.491 2002/10/18 00:51:22 yamt Exp $ */
+/* $NetBSD: machdep.c,v 1.492 2002/10/20 10:35:41 kanaoka Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.491 2002/10/18 00:51:22 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.492 2002/10/20 10:35:41 kanaoka Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@@ -2728,6 +2728,7 @@
u_int32_t type;
{
extern struct extent *iomem_ex;
+ int i;
if (seg_end > 0x100000000ULL) {
printf("WARNING: skipping large "
@@ -2749,6 +2750,17 @@
if (seg_end <= seg_start)
return;
+ for (i = 0; i < mem_cluster_cnt; i++) {
+ if ((mem_clusters[i].start == round_page(seg_start))
+ && (mem_clusters[i].size
+ == trunc_page(seg_end) - mem_clusters[i].start)) {
+#ifdef DEBUG_MEMLOAD
+ printf("WARNING: skipping duplicate segment entry\n");
+#endif
+ return;
+ }
+ }
+
/*
* Allocate the physical addresses used by RAM
* from the iomem extent map. This is done before
@@ -2763,6 +2775,7 @@
"(0x%qx/0x%qx/0x%x) FROM "
"IOMEM EXTENT MAP!\n",
seg_start, seg_end - seg_start, type);
+ return;
}
/*
@@ -2918,6 +2931,10 @@
avail_start += realmode_reserved_size;
}
+#ifdef DEBUG_MEMLOAD
+ printf("mem_cluster_count: %d\n", mem_cluster_cnt);
+#endif
+
/*
* Call pmap initialization to make new kernel address space.
* We must do this before loading pages into the VM system.
@@ -3106,14 +3123,18 @@
tmp = (16 * 1024 * 1024);
else
tmp = seg_end;
+
+ if (tmp != seg_start) {
#ifdef DEBUG_MEMLOAD
- printf("loading 0x%qx-0x%qx (0x%lx-0x%lx)\n",
- seg_start, tmp,
- atop(seg_start), atop(tmp));
+ printf("loading 0x%qx-0x%qx "
+ "(0x%lx-0x%lx)\n",
+ seg_start, tmp,
+ atop(seg_start), atop(tmp));
#endif
- uvm_page_physload(atop(seg_start),
- atop(tmp), atop(seg_start),
- atop(tmp), first16q);
+ uvm_page_physload(atop(seg_start),
+ atop(tmp), atop(seg_start),
+ atop(tmp), first16q);
+ }
seg_start = tmp;
}
@@ -3139,14 +3160,18 @@
tmp = (16 * 1024 * 1024);
else
tmp = seg_end1;
+
+ if (tmp != seg_start1) {
#ifdef DEBUG_MEMLOAD
- printf("loading 0x%qx-0x%qx (0x%lx-0x%lx)\n",
- seg_start1, tmp,
- atop(seg_start1), atop(tmp));
+ printf("loading 0x%qx-0x%qx "
+ "(0x%lx-0x%lx)\n",
+ seg_start1, tmp,
+ atop(seg_start1), atop(tmp));
#endif
- uvm_page_physload(atop(seg_start1),
- atop(tmp), atop(seg_start1),
- atop(tmp), first16q);
+ uvm_page_physload(atop(seg_start1),
+ atop(tmp), atop(seg_start1),
+ atop(tmp), first16q);
+ }
seg_start1 = tmp;
}
Home |
Main Index |
Thread Index |
Old Index