aboutsummaryrefslogtreecommitdiffstats
path: root/arch/hexagon/kernel
diff options
context:
space:
mode:
authorRichard Kuo <rkuo@codeaurora.org>2013-03-22 17:05:40 -0400
committerRichard Kuo <rkuo@codeaurora.org>2013-04-30 20:40:22 -0400
commit8f5a0b9dffeb3cb94f2b0622b6fe0717512ef54b (patch)
treed85d4b7531645b4b189fb88dd8d6b4b62072284b /arch/hexagon/kernel
parente0025a72c37ca404fbf31d569439c20bfb04295e (diff)
Hexagon: add support for ARCH_PFN_OFFSET
Add support for loading the kernel at a physical offset. The offset should still be 4M aligned. Signed-off-by: Richard Kuo <rkuo@codeaurora.org>
Diffstat (limited to 'arch/hexagon/kernel')
-rw-r--r--arch/hexagon/kernel/head.S22
-rw-r--r--arch/hexagon/kernel/setup.c2
-rw-r--r--arch/hexagon/kernel/vmlinux.lds.S10
3 files changed, 22 insertions, 12 deletions
diff --git a/arch/hexagon/kernel/head.S b/arch/hexagon/kernel/head.S
index d859402c73ba..477320c455f7 100644
--- a/arch/hexagon/kernel/head.S
+++ b/arch/hexagon/kernel/head.S
@@ -43,14 +43,21 @@ ENTRY(stext)
43 * Symbol is kernel segment address, but we need 43 * Symbol is kernel segment address, but we need
44 * the logical/physical address. 44 * the logical/physical address.
45 */ 45 */
46 r24 = asl(r24, #2) 46 r25 = pc;
47 r24 = lsr(r24, #2) 47 r2.h = #0xffc0;
48 r2.l = #0x0000;
49 r25 = and(r2,r25); /* R25 holds PHYS_OFFSET now */
50 r1.h = #HI(PAGE_OFFSET);
51 r1.l = #LO(PAGE_OFFSET);
52 r24 = sub(r24,r1); /* swapper_pg_dir - PAGE_OFFSET */
53 r24 = add(r24,r25); /* + PHYS_OFFSET */
48 54
49 r0 = r24 55 r0 = r24; /* aka __pa(swapper_pg_dir) */
50 56
51 /* 57 /*
52 * Initialize a 16MB PTE to make the virtual and physical 58 * Initialize page dir to make the virtual and physical
53 * addresses where the kernel was loaded be identical. 59 * addresses where the kernel was loaded be identical.
60 * Done in 4MB chunks.
54 */ 61 */
55#define PTE_BITS ( __HVM_PTE_R | __HVM_PTE_W | __HVM_PTE_X \ 62#define PTE_BITS ( __HVM_PTE_R | __HVM_PTE_W | __HVM_PTE_X \
56 | __HEXAGON_C_WB_L2 << 6 \ 63 | __HEXAGON_C_WB_L2 << 6 \
@@ -143,6 +150,13 @@ __head_s_vaddr_target:
143 r2 = sub(r2,r0); 150 r2 = sub(r2,r0);
144 call memset; 151 call memset;
145 152
153 /* Set PHYS_OFFSET; should still be in R25 */
154#ifdef CONFIG_HEXAGON_PHYS_OFFSET
155 r0.l = #LO(__phys_offset);
156 r0.h = #HI(__phys_offset);
157 memw(r0) = r25;
158#endif
159
146 /* Time to make the doughnuts. */ 160 /* Time to make the doughnuts. */
147 call start_kernel 161 call start_kernel
148 162
diff --git a/arch/hexagon/kernel/setup.c b/arch/hexagon/kernel/setup.c
index 94a387835008..2e2304f7b7ee 100644
--- a/arch/hexagon/kernel/setup.c
+++ b/arch/hexagon/kernel/setup.c
@@ -68,6 +68,8 @@ void __init setup_arch(char **cmdline_p)
68 */ 68 */
69 __vmsetvec(_K_VM_event_vector); 69 __vmsetvec(_K_VM_event_vector);
70 70
71 printk(KERN_INFO "PHYS_OFFSET=0x%08x\n", PHYS_OFFSET);
72
71 /* 73 /*
72 * Simulator has a few differences from the hardware. 74 * Simulator has a few differences from the hardware.
73 * For now, check uninitialized-but-mapped memory 75 * For now, check uninitialized-but-mapped memory
diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S
index 14e793f6abbf..fafb886511e3 100644
--- a/arch/hexagon/kernel/vmlinux.lds.S
+++ b/arch/hexagon/kernel/vmlinux.lds.S
@@ -18,8 +18,6 @@
18 * 02110-1301, USA. 18 * 02110-1301, USA.
19 */ 19 */
20 20
21#define LOAD_OFFSET PAGE_OFFSET
22
23#include <asm-generic/vmlinux.lds.h> 21#include <asm-generic/vmlinux.lds.h>
24#include <asm/asm-offsets.h> /* Most of the kernel defines are here */ 22#include <asm/asm-offsets.h> /* Most of the kernel defines are here */
25#include <asm/mem-layout.h> /* except for page_offset */ 23#include <asm/mem-layout.h> /* except for page_offset */
@@ -36,13 +34,9 @@ See asm-generic/sections.h for seemingly required labels.
36 34
37#define PAGE_SIZE _PAGE_SIZE 35#define PAGE_SIZE _PAGE_SIZE
38 36
39/* This LOAD_OFFSET is temporary for debugging on the simulator; it may change
40 for hypervisor pseudo-physical memory. */
41
42
43SECTIONS 37SECTIONS
44{ 38{
45 . = PAGE_OFFSET + LOAD_ADDRESS; 39 . = PAGE_OFFSET;
46 40
47 __init_begin = .; 41 __init_begin = .;
48 HEAD_TEXT_SECTION 42 HEAD_TEXT_SECTION
@@ -52,7 +46,7 @@ SECTIONS
52 46
53 . = ALIGN(_PAGE_SIZE); 47 . = ALIGN(_PAGE_SIZE);
54 _stext = .; 48 _stext = .;
55 .text : AT(ADDR(.text) - LOAD_OFFSET) { 49 .text : AT(ADDR(.text)) {
56 _text = .; 50 _text = .;
57 TEXT_TEXT 51 TEXT_TEXT
58 SCHED_TEXT 52 SCHED_TEXT