Skip to content

Commit 1b9f95f

Browse files
Nicolas Pitrenpitre
authored andcommitted
ARM: prepare for removal of a bunch of <mach/memory.h> files
When the CONFIG_NO_MACH_MEMORY_H symbol is selected by a particular machine class, the machine specific memory.h include file is no longer used and can be removed. In that case the equivalent information can be obtained dynamically at runtime by enabling CONFIG_ARM_PATCH_PHYS_VIRT or by specifying the physical memory address at kernel configuration time. If/when all instances of mach/memory.h are removed then this symbol could be removed. Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
1 parent 67f462b commit 1b9f95f

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

‎arch/arm/Kconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,17 @@ config ARM_PATCH_PHYS_VIRT
211211
this feature (eg, building a kernel for a single machine) and
212212
you need to shrink the kernel to the minimal size.
213213

214+
config NO_MACH_MEMORY_H
215+
bool
216+
help
217+
Select this when mach/memory.h is removed.
218+
219+
config PHYS_OFFSET
220+
hex "Physical address of main memory"
221+
depends on !ARM_PATCH_PHYS_VIRT && NO_MACH_MEMORY_H
222+
help
223+
Please provide the physical address corresponding to the
224+
location of main memory in your system.
214225

215226
source "init/Kconfig"
216227

‎arch/arm/include/asm/memory.h‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
#include <linux/compiler.h>
1717
#include <linux/const.h>
1818
#include <linux/types.h>
19-
#include <mach/memory.h>
2019
#include <asm/sizes.h>
2120

21+
#ifndef CONFIG_NO_MACH_MEMORY_H
22+
#include <mach/memory.h>
23+
#endif
24+
2225
/*
2326
* Allow for constants defined here to be used from assembly code
2427
* by prepending the UL suffix only with actual C code compilation.
@@ -184,7 +187,11 @@ static inline unsigned long __phys_to_virt(unsigned long x)
184187
#endif
185188

186189
#ifndef PHYS_OFFSET
190+
#ifdef PLAT_PHYS_OFFSET
187191
#define PHYS_OFFSET PLAT_PHYS_OFFSET
192+
#else
193+
#define PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
194+
#endif
188195
#endif
189196

190197
/*

‎arch/arm/kernel/head.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ ENTRY(stext)
9595
sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET)
9696
add r8, r8, r4 @ PHYS_OFFSET
9797
#else
98-
ldr r8, =PLAT_PHYS_OFFSET
98+
ldr r8, =PHYS_OFFSET @ always constant in this case
9999
#endif
100100

101101
/*

0 commit comments

Comments
 (0)