Переглянути джерело

sh: Track the uncached mapping size.

This provides a variable for tracking the uncached mapping size, and uses
it for pretty printing the uncached lowmem range. Beyond this, we'll also
be building on top of this for figuring out from where the remainder of
P2 becomes usable when constructing unrelated mappings.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Paul Mundt 15 роки тому
батько
коміт
3125ee72dc
3 змінених файлів з 24 додано та 8 видалено
  1. 1 0
      arch/sh/include/asm/system.h
  2. 9 1
      arch/sh/kernel/head_32.S
  3. 14 7
      arch/sh/mm/init.c

+ 1 - 0
arch/sh/include/asm/system.h

@@ -137,6 +137,7 @@ extern unsigned int instruction_size(unsigned int insn);
 #endif
 
 extern unsigned long cached_to_uncached;
+extern unsigned long uncached_size;
 
 extern struct dentry *sh_debugfs_root;
 

+ 9 - 1
arch/sh/kernel/head_32.S

@@ -217,11 +217,18 @@ ENTRY(_stext)
 	__PMB_ITER_BY_SIZE(16)
 
 	/*
-	 * Now that we can access it, update cached_to_uncached.
+	 * Now that we can access it, update cached_to_uncached and
+	 * uncached_size.
 	 */
 	mov.l	.Lcached_to_uncached, r0
 	mov.l	r7, @r0
 
+	mov.l	.Luncached_size, r0
+	mov	#1, r7
+	shll16	r7
+	shll8	r7
+	mov.l	r7, @r0
+
 	/*
 	 * Clear the remaining PMB entries.
 	 *
@@ -300,5 +307,6 @@ ENTRY(stack_start)
 .LFIRST_DATA_ENTRY:	.long	__MEMORY_START | PMB_V
 .LMMUCR:		.long	MMUCR
 .Lcached_to_uncached:	.long	cached_to_uncached
+.Luncached_size:	.long	uncached_size
 .LMEMORY_SIZE:		.long	__MEMORY_SIZE
 #endif

+ 14 - 7
arch/sh/mm/init.c

@@ -27,15 +27,17 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD];
 
 #ifdef CONFIG_SUPERH32
 /*
- * Handle trivial transitions between cached and uncached
- * segments, making use of the 1:1 mapping relationship in
- * 512MB lowmem.
- *
  * This is the offset of the uncached section from its cached alias.
- * Default value only valid in 29 bit mode, in 32bit mode will be
- * overridden in pmb_init.
+ *
+ * Legacy platforms handle trivial transitions between cached and
+ * uncached segments by making use of the 1:1 mapping relationship in
+ * 512MB lowmem, others via a special uncached mapping.
+ *
+ * Default value only valid in 29 bit mode, in 32bit mode this will be
+ * updated by the early PMB initialization code.
  */
 unsigned long cached_to_uncached = P2SEG - P1SEG;
+unsigned long uncached_size = 0x20000000;
 #endif
 
 #ifdef CONFIG_MMU
@@ -281,7 +283,8 @@ void __init mem_init(void)
 		"    pkmap   : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 #endif
 		"    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-		"    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
+		"    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB) (cached)\n"
+		"            : 0x%08lx - 0x%08lx   (%4ld MB) (uncached)\n"
 		"      .init : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 		"      .data : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 		"      .text : 0x%08lx - 0x%08lx   (%4ld kB)\n",
@@ -299,6 +302,10 @@ void __init mem_init(void)
 		(unsigned long)memory_start, (unsigned long)high_memory,
 		((unsigned long)high_memory - (unsigned long)memory_start) >> 20,
 
+		(unsigned long)memory_start + cached_to_uncached,
+		(unsigned long)memory_start + cached_to_uncached + uncached_size,
+		uncached_size >> 20,
+
 		(unsigned long)&__init_begin, (unsigned long)&__init_end,
 		((unsigned long)&__init_end -
 		 (unsigned long)&__init_begin) >> 10,