Author: ian
Date: Fri Feb 13 23:30:48 2015
New Revision: 278730
URL: https://svnweb.freebsd.org/changeset/base/278730

Log:
  MFC r277532, r277533:  Add Maxmem global for arm.

Modified:
  stable/10/sys/arm/arm/physmem.c
  stable/10/sys/arm/include/md_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/arm/physmem.c
==============================================================================
--- stable/10/sys/arm/arm/physmem.c     Fri Feb 13 23:19:35 2015        
(r278729)
+++ stable/10/sys/arm/arm/physmem.c     Fri Feb 13 23:30:48 2015        
(r278730)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <vm/vm.h>
+#include <machine/md_var.h>
 #include <machine/physmem.h>
 
 /*
@@ -86,8 +87,12 @@ static size_t excnt;
 vm_paddr_t phys_avail[MAX_AVAIL_ENTRIES + 2]; /* +2 to allow for a pair  */
 vm_paddr_t dump_avail[MAX_AVAIL_ENTRIES + 2]; /* of zeroes to terminate. */
 
-/* This is the total number of hardware pages, excluded or not. */
+/*
+ * realmem is the total number of hardware pages, excluded or not.
+ * Maxmem is one greater than the last physical page number.
+ */
 long realmem;
+long Maxmem;
 
 /* The address at which the kernel was loaded.  Set early in initarm(). */
 vm_paddr_t arm_physmem_kernaddr;
@@ -152,8 +157,8 @@ arm_physmem_print_tables()
  *
  * Returns the number of pages of non-excluded memory added to the avail list.
  */
-static long
-regions_to_avail(vm_paddr_t *avail, uint32_t exflags)
+static size_t
+regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
 {
        size_t acnt, exi, hwi;
        vm_paddr_t end, start, xend, xstart;
@@ -236,7 +241,9 @@ regions_to_avail(vm_paddr_t *avail, uint
                        panic("Not enough space in the dump/phys_avail arrays");
        }
 
-       return (availmem);
+       if (pavail)
+               *pavail = availmem;
+       return (acnt);
 }
 
 /*
@@ -311,13 +318,23 @@ void arm_physmem_exclude_region(vm_paddr
 
 /*
  * Process all the regions added earlier into the global avail lists.
+ *
+ * Updates the kernel global 'physmem' with the number of physical pages
+ * available for use (all pages not in any exclusion region).
+ *
+ * Updates the kernel global 'Maxmem' with the page number one greater then the
+ * last page of physical memory in the system.
  */
 void
 arm_physmem_init_kernel_globals(void)
 {
+       size_t nextidx;
 
-       regions_to_avail(dump_avail, EXFLAG_NODUMP);
-       physmem = regions_to_avail(phys_avail, EXFLAG_NOALLOC);
+       regions_to_avail(dump_avail, EXFLAG_NODUMP, NULL);
+       nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, &physmem);
+       if (nextidx == 0)
+               panic("No memory entries in phys_avail");
+       Maxmem = atop(phys_avail[nextidx - 1]);
 }
 
 #ifdef DDB

Modified: stable/10/sys/arm/include/md_var.h
==============================================================================
--- stable/10/sys/arm/include/md_var.h  Fri Feb 13 23:19:35 2015        
(r278729)
+++ stable/10/sys/arm/include/md_var.h  Fri Feb 13 23:30:48 2015        
(r278730)
@@ -33,6 +33,7 @@
 #ifndef        _MACHINE_MD_VAR_H_
 #define        _MACHINE_MD_VAR_H_
 
+extern long Maxmem;
 extern char sigcode[];
 extern int szsigcode;
 extern uint32_t *vm_page_dump;
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to