ARM: 8639/1: Define KERNEL_START and KERNEL_END
authorFlorian Fainelli <f.fainelli@gmail.com>
Sun, 15 Jan 2017 02:57:40 +0000 (03:57 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Tue, 28 Feb 2017 11:05:46 +0000 (11:05 +0000)
In preparation for adding CONFIG_DEBUG_VIRTUAL support, define a set of
common constants: KERNEL_START and KERNEL_END which abstract
CONFIG_XIP_KERNEL vs. !CONFIG_XIP_KERNEL. Update the code where
relevant.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/memory.h
arch/arm/mm/init.c
arch/arm/mm/mmu.c

index 76cbd9c674dff7815e7f25a293a8b03e80e3b442..bee7511c50982dfa87031295813b9a3e8791169e 100644 (file)
 
 #endif /* !CONFIG_MMU */
 
+#ifdef CONFIG_XIP_KERNEL
+#define KERNEL_START           _sdata
+#else
+#define KERNEL_START           _stext
+#endif
+#define KERNEL_END             _end
+
 /*
  * We fix the TCM memories max 32 KiB ITCM resp DTCM at these
  * locations
index 370581aeb87104273df695409af37876956c639f..4127f578086cd801af192303ef3b817b86cb20dd 100644 (file)
@@ -230,11 +230,8 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
 void __init arm_memblock_init(const struct machine_desc *mdesc)
 {
        /* Register the kernel text, kernel data and initrd with memblock. */
-#ifdef CONFIG_XIP_KERNEL
-       memblock_reserve(__pa(_sdata), _end - _sdata);
-#else
-       memblock_reserve(__pa(_stext), _end - _stext);
-#endif
+       memblock_reserve(__pa(KERNEL_START), KERNEL_END - KERNEL_START);
+
 #ifdef CONFIG_BLK_DEV_INITRD
        /* FDT scan will populate initrd_start */
        if (initrd_start && !phys_initrd_size) {
index 5cbfd9f8641228b272419516c79c0f09ecfca796..4e016d7f37b3af6568282aa1a909a14406247bb2 100644 (file)
@@ -1422,11 +1422,7 @@ static void __init kmap_init(void)
 static void __init map_lowmem(void)
 {
        struct memblock_region *reg;
-#ifdef CONFIG_XIP_KERNEL
-       phys_addr_t kernel_x_start = round_down(__pa(_sdata), SECTION_SIZE);
-#else
-       phys_addr_t kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);
-#endif
+       phys_addr_t kernel_x_start = round_down(__pa(KERNEL_START), SECTION_SIZE);
        phys_addr_t kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);
 
        /* Map all the lowmem memory banks. */