Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/arch/i386/i386 Pull up revision 1.492 via patch (re...



details:   https://anonhg.NetBSD.org/src/rev/f2c8621f1638
branches:  netbsd-1-6
changeset: 529178:f2c8621f1638
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Oct 21 02:17:28 2002 +0000

description:
Pull up revision 1.492 via patch (requested by kanaoka in ticket #934):
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 9c044bb973b1 -r f2c8621f1638 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Mon Oct 21 01:57:41 2002 +0000
+++ b/sys/arch/i386/i386/machdep.c      Mon Oct 21 02:17:28 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.471 2002/05/12 23:16:53 matt Exp $       */
+/*     $NetBSD: machdep.c,v 1.471.4.1 2002/10/21 02:17:28 lukem 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.471 2002/05/12 23:16:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.471.4.1 2002/10/21 02:17:28 lukem Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -2606,6 +2606,7 @@
        u_int32_t type;
 {
        extern struct extent *iomem_ex;
+       int i;
 
        if (seg_end > 0x100000000ULL) {
                printf("WARNING: skipping large "
@@ -2627,6 +2628,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
@@ -2641,6 +2653,7 @@
                    "(0x%qx/0x%qx/0x%x) FROM "
                    "IOMEM EXTENT MAP!\n",
                    seg_start, seg_end - seg_start, type);
+               return;
        }
 
        /*
@@ -2800,6 +2813,10 @@
        }
 #endif /* ! REALBASEMEM && ! REALEXTMEM */
 
+#ifdef DEBUG_MEMLOAD
+       printf("mem_cluster_count: %d\n", mem_cluster_cnt);
+#endif
+
        /*
         * If the loop above didn't find any valid segment, fall back to
         * former code.
@@ -2918,14 +2935,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;
                        }
 
@@ -2951,14 +2972,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