Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544291 > unrolled thread

[PATCH 15/21] MIPS memblock: Alter weakened MAAR initialization method

Started bySerge Semin <fancer.lancer@gmail.com>
First post2016-12-19 03:20 +0100
Last post2016-12-19 03:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 15/21] MIPS memblock: Alter weakened MAAR initialization method Serge Semin <fancer.lancer@gmail.com> - 2016-12-19 03:20 +0100

#1544291 — [PATCH 15/21] MIPS memblock: Alter weakened MAAR initialization method

FromSerge Semin <fancer.lancer@gmail.com>
Date2016-12-19 03:20 +0100
Subject[PATCH 15/21] MIPS memblock: Alter weakened MAAR initialization method
Message-ID<sPVIu-1Cr-35@gated-at.bofh.it>
MAAR initialization method can be slightly simplified, since
memblock allocator is fully available.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
---
 arch/mips/mm/init.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index a4f49c7..49db909 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -22,6 +22,7 @@
 #include <linux/ptrace.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
+#include <linux/memblock.h>
 #include <linux/bootmem.h>
 #include <linux/highmem.h>
 #include <linux/swap.h>
@@ -245,28 +246,26 @@ void __init fixrange_init(unsigned long start, unsigned long end,
 #endif
 }
 
-unsigned __weak platform_maar_init(unsigned num_pairs)
+/*
+ * Platform-specific method of MAAR registers initialization
+ */
+unsigned int __weak platform_maar_init(unsigned int num_pairs)
 {
 	struct maar_config cfg[BOOT_MEM_MAP_MAX];
-	unsigned i, num_configured, num_cfg = 0;
+	struct memblock_region *reg;
+	unsigned int num_configured, num_cfg = 0;
 
-	for (i = 0; i < boot_mem_map.nr_map; i++) {
-		switch (boot_mem_map.map[i].type) {
-		case BOOT_MEM_RAM:
-		case BOOT_MEM_INIT_RAM:
+	/* Collect RAM regions within MAAR config array */
+	for_each_memblock(memory, reg) {
+		if (num_cfg >= BOOT_MEM_MAP_MAX) {
+			pr_info("Too many memory regions to init MAARs");
 			break;
-		default:
-			continue;
 		}
-
 		/* Round lower up */
-		cfg[num_cfg].lower = boot_mem_map.map[i].addr;
-		cfg[num_cfg].lower = (cfg[num_cfg].lower + 0xffff) & ~0xffff;
+		cfg[num_cfg].lower = (reg->base + 0xffff) & ~0xffff;
 
 		/* Round upper down */
-		cfg[num_cfg].upper = boot_mem_map.map[i].addr +
-					boot_mem_map.map[i].size;
-		cfg[num_cfg].upper = (cfg[num_cfg].upper & ~0xffff) - 1;
+		cfg[num_cfg].upper = ((reg->base + reg->size) & ~0xffff) - 1;
 
 		cfg[num_cfg].attrs = MIPS_MAAR_S;
 		num_cfg++;
-- 
2.6.6

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web