Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 May 2015 15:29:56 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r283409 - in stable/10/sys/boot/uboot: fdt lib
Message-ID:  <201505241529.t4OFTuXV051925@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sun May 24 15:29:56 2015
New Revision: 283409
URL: https://svnweb.freebsd.org/changeset/base/283409

Log:
  MFC r280194:
  
    Fix fdt_platform_fixups() mem region handling.

Modified:
  stable/10/sys/boot/uboot/fdt/uboot_fdt.c
  stable/10/sys/boot/uboot/lib/glue.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/uboot/fdt/uboot_fdt.c
==============================================================================
--- stable/10/sys/boot/uboot/fdt/uboot_fdt.c	Sun May 24 15:29:20 2015	(r283408)
+++ stable/10/sys/boot/uboot/fdt/uboot_fdt.c	Sun May 24 15:29:56 2015	(r283409)
@@ -88,7 +88,7 @@ fdt_platform_load_dtb(void)
 void
 fdt_platform_fixups(void)
 {
-	struct fdt_mem_region regions[3];
+	static struct fdt_mem_region regions[UB_MAX_MR];
 	const char *env, *str;
 	char *end, *ethstr;
 	int eth_no, i, len, n;
@@ -165,17 +165,15 @@ fdt_platform_fixups(void)
 	/* Modify cpu(s) and bus clock frequenties in /cpus node [Hz] */
 	fdt_fixup_cpubusfreqs(si->clk_cpu, si->clk_bus);
 
-	/* Copy the data into a useful form */
-	for (i = 0; i < si->mr_no; i++) {
-		if (i > nitems(regions)) {
-			i = nitems(regions);
-			break;
+	/* Extract the DRAM regions into fdt_mem_region format. */
+	for (i = 0, n = 0; i < si->mr_no && n < nitems(regions); i++) {
+		if (si->mr[i].flags == MR_ATTR_DRAM) {
+			regions[n].start = si->mr[i].start;
+			regions[n].size = si->mr[i].size;
+			n++;
 		}
-
-		regions[i].start = si->mr[i].start;
-		regions[i].size = si->mr[i].size;
 	}
 
 	/* Fixup memory regions */
-	fdt_fixup_memory(regions, i);
+	fdt_fixup_memory(regions, n);
 }

Modified: stable/10/sys/boot/uboot/lib/glue.h
==============================================================================
--- stable/10/sys/boot/uboot/lib/glue.h	Sun May 24 15:29:20 2015	(r283408)
+++ stable/10/sys/boot/uboot/lib/glue.h	Sun May 24 15:29:56 2015	(r283409)
@@ -40,7 +40,7 @@ void *syscall_ptr;
 
 int api_search_sig(struct api_signature **sig);
 
-#define	UB_MAX_MR	5		/* max mem regions number */
+#define	UB_MAX_MR	16		/* max mem regions number */
 #define	UB_MAX_DEV	6		/* max devices number */
 
 /*



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