Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Nov 2003 13:09:11 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 42384 for review
Message-ID:  <200311142109.hAEL9BUZ074498@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=42384

Change 42384 by peter@peter_daintree on 2003/11/14 13:08:37

	ugh! I feel so unclean after touching this file.  Must.. wash.. hands..

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/machdep.c#67 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/machdep.c#67 (text+ko) ====

@@ -799,7 +799,6 @@
 getmemsize(caddr_t kmdp, u_int64_t first)
 {
 	int i, physmap_idx, pa_indx;
-	u_int extmem;
 	vm_paddr_t pa, physmap[PHYSMAP_SIZE];
 	pt_entry_t *pte;
 	char *cp;
@@ -818,12 +817,9 @@
 	 * ie: an int32_t immediately precedes smap.
 	 */
 	smapbase = (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_SMAP);
-	if (smapbase == 0)
-		smapbase = (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | 0x0009);	/* Old value for MODINFOMD_SMAP */
-	if (smapbase == 0) {
+	if (smapbase == NULL)
 		panic("No BIOS smap info from loader!");
-		goto deep_shit;
-	}
+
 	smapsize = *((u_int32_t *)smapbase - 1);
 	smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize);
 
@@ -832,14 +828,11 @@
 			printf("SMAP type=%02x base=%016lx len=%016lx\n",
 			    smap->type, smap->base, smap->length);
 
-		if (smap->type != 0x01) {
+		if (smap->type != 0x01)
 			continue;
-		}
 
-		if (smap->length == 0) {
-next_run:
+		if (smap->length == 0)
 			continue;
-		}
 
 		for (i = 0; i <= physmap_idx; i += 2) {
 			if (smap->base < physmap[i + 1]) {
@@ -852,6 +845,7 @@
 
 		if (smap->base == physmap[physmap_idx + 1]) {
 			physmap[physmap_idx + 1] += smap->length;
+next_run:
 			continue;
 		}
 
@@ -866,70 +860,18 @@
 	}
 
 	/*
-	 * Perform "base memory" related probes & setup based on SMAP
+	 * Find the 'base memory' segment for SMP
 	 */
-deep_shit:
-	if (basemem == 0) {
-		for (i = 0; i <= physmap_idx; i += 2) {
-			if (physmap[i] == 0x00000000) {
-				basemem = physmap[i + 1] / 1024;
-				break;
-			}
-		}
-
-		if (basemem == 0) {
-			basemem = rtcin(RTC_BASELO) + (rtcin(RTC_BASEHI) << 8);
-		}
-
-		if (basemem == 0) {
-			basemem = 640;
-		}
-
-		if (basemem > 640) {
-			printf("Preposterous BIOS basemem of %uK, truncating to 640K\n",
-				basemem);
-			basemem = 640;
+	basemem = 0;
+	for (i = 0; i <= physmap_idx; i += 2) {
+		if (physmap[i] == 0x00000000) {
+			basemem = physmap[i + 1] / 1024;
+			break;
 		}
-
-#if 0
-		for (pa = trunc_page(basemem * 1024);
-		     pa < ISA_HOLE_START; pa += PAGE_SIZE)
-			pmap_kenter(KERNBASE + pa, pa);
-#endif
 	}
-
-	if (physmap[1] != 0)
-		goto physmap_done;
+	if (basemem == 0)
+		panic("BIOS smap did not include a basemem segment!");
 
-	/*
-	 * Prefer the RTC value for extended memory.
-	 */
-	extmem = rtcin(RTC_EXTLO) + (rtcin(RTC_EXTHI) << 8);
-
-	/*
-	 * Special hack for chipsets that still remap the 384k hole when
-	 * there's 16MB of memory - this really confuses people that
-	 * are trying to use bus mastering ISA controllers with the
-	 * "16MB limit"; they only have 16MB, but the remapping puts
-	 * them beyond the limit.
-	 *
-	 * If extended memory is between 15-16MB (16-17MB phys address range),
-	 *	chop it to 15MB.
-	 */
-	if ((extmem > 15 * 1024) && (extmem < 16 * 1024))
-		extmem = 15 * 1024;
-
-	physmap[0] = 0;
-	physmap[1] = basemem * 1024;
-	physmap_idx = 2;
-	physmap[physmap_idx] = 0x100000;
-	physmap[physmap_idx + 1] = physmap[physmap_idx] + extmem * 1024;
-
-physmap_done:
-	/*
-	 * Now, physmap contains a map of physical memory.
-	 */
-
 #ifdef SMP
 	/* make hole for AP bootstrap code */
 	physmap[1] = mp_bootaddress(physmap[1] / 1024);
@@ -951,7 +893,8 @@
 	 * hw.physmem is a size in bytes; we also allow k, m, and g suffixes
 	 * for the appropriate modifiers.  This overrides MAXMEM.
 	 */
-	if ((cp = getenv("hw.physmem")) != NULL) {
+	cp = getenv("hw.physmem");
+	if (cp != NULL) {
 		u_int64_t AllowMem, sanity;
 		char *ep;
 



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