summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-05-30 20:47:01 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-05-30 20:47:01 +0000
commit1c726ef63fd4be85dc4f48e37dc99420a2fa3722 (patch)
tree159b77e4d75fc8b573bf78db8ff04301318fb490 /sys
parent46fed973a86fb9ce5d506bcab702eb3bfbb729cf (diff)
Don't use biosbasemem and biosextmem to initialize iomem_ex, since on some
BIOSen it's a complete lie. Instead use the information from the memory map like we do on i386. ok weingart@, oga@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/machdep.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 83087b3953b..7b16c679bce 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.90 2009/04/30 01:16:56 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.91 2009/05/30 20:47:00 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -1171,6 +1171,7 @@ cpu_init_extents(void)
{
extern struct extent *iomem_ex;
static int already_done;
+ int i;
/* We get called for each CPU, only first should do this */
if (already_done)
@@ -1178,20 +1179,16 @@ cpu_init_extents(void)
/*
* 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.
+ * extent map.
*/
- if (extent_alloc_region(iomem_ex, 0, KBTOB(biosbasemem),
- EX_NOWAIT)) {
- /* XXX What should we do? */
- printf("WARNING: CAN'T ALLOCATE BASE MEMORY FROM "
- "IOMEM EXTENT MAP!\n");
- }
- if (extent_alloc_region(iomem_ex, IOM_END, KBTOB(biosextmem),
- EX_NOWAIT)) {
- /* XXX What should we do? */
- printf("WARNING: CAN'T ALLOCATE EXTENDED MEMORY FROM "
- "IOMEM EXTENT MAP!\n");
+ for (i = 0; i < mem_cluster_cnt; i++) {
+ if (extent_alloc_region(iomem_ex, mem_clusters[i].start,
+ mem_clusters[i].size, EX_NOWAIT)) {
+ /* XXX What should we do? */
+ printf("WARNING: CAN'T ALLOCATE RAM (%lx-%lx)"
+ " FROM IOMEM EXTENT MAP!\n", mem_clusters[i].start,
+ mem_clusters[i].start + mem_clusters[i].size - 1);
+ }
}
already_done = 1;
@@ -1366,6 +1363,8 @@ init_x86_64(paddr_t first_avail)
/* Nuke page zero */
if (s1 < avail_start) {
s1 = avail_start;
+ if (s1 > e1)
+ continue;
}
/* Crop to fit below 4GB for now */