Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 May 2018 10:31:06 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334030 - head/sys/arm/arm
Message-ID:  <201805221031.w4MAV60N013041@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Tue May 22 10:31:06 2018
New Revision: 334030
URL: https://svnweb.freebsd.org/changeset/base/334030

Log:
  Allow the 32-bit arm physmem code to work on arm64.
  
  This will help simplify the arm64 code and allow us to properly exclude
  memory that should never be mapped.
  
  Obtained from:	ABT Systems Ltd
  Sponsored by:	Turing Robotic Industries

Modified:
  head/sys/arm/arm/physmem.c

Modified: head/sys/arm/arm/physmem.c
==============================================================================
--- head/sys/arm/arm/physmem.c	Tue May 22 10:23:12 2018	(r334029)
+++ head/sys/arm/arm/physmem.c	Tue May 22 10:31:06 2018	(r334030)
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <vm/vm.h>
 #include <machine/md_var.h>
-#include <machine/physmem.h>
+#include <arm/include/physmem.h>
 
 /*
  * These structures are used internally to keep track of regions of physical
@@ -51,7 +51,13 @@ __FBSDID("$FreeBSD$");
 #define	MAX_HWCNT	10
 #define	MAX_EXCNT	10
 
+#if defined(__arm__)
 #define	MAX_PHYS_ADDR	0xFFFFFFFFull
+#define	pm_btop(x)	arm32_btop(x)
+#elif defined(__aarch64__)
+#define	MAX_PHYS_ADDR	0xFFFFFFFFFFFFFFFFull
+#define	pm_btop(x)	arm64_btop(x)
+#endif
 
 struct region {
 	vm_paddr_t	addr;
@@ -175,7 +181,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, 
 	for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) {
 		start = hwp->addr;
 		end   = hwp->size + start;
-		realmem += arm32_btop((vm_offset_t)(end - start));
+		realmem += pm_btop((vm_offset_t)(end - start));
 		for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) {
 			/*
 			 * If the excluded region does not match given flags,
@@ -223,8 +229,8 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, 
 					avail[acnt++] = (vm_paddr_t)start;
 					avail[acnt++] = (vm_paddr_t)xstart;
 				}
-				availmem += 
-				    arm32_btop((vm_offset_t)(xstart - start));
+				availmem +=
+				    pm_btop((vm_offset_t)(xstart - start));
 				start = xend;
 				continue;
 			}
@@ -249,7 +255,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, 
 				avail[acnt++] = (vm_paddr_t)start;
 				avail[acnt++] = (vm_paddr_t)end;
 			}
-			availmem += arm32_btop((vm_offset_t)(end - start));
+			availmem += pm_btop((vm_offset_t)(end - start));
 		}
 		if (acnt >= MAX_AVAIL_ENTRIES)
 			panic("Not enough space in the dump/phys_avail arrays");



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