aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/boot
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2012-12-03 06:01:43 -0500
committerChris Zankel <chris@zankel.net>2013-05-09 04:07:09 -0400
commite85e335f8ff615f74e29e09cc2599f095600114b (patch)
tree8f09bbab5ca6a37f027fef17bf1de523ab574f10 /arch/xtensa/boot
parentd83ff0bb828854d9e7172ac5d8d007a7466934c9 (diff)
xtensa: add MMU v3 support
MMUv3 comes out of reset with identity vaddr -> paddr mapping in the TLB way 6: Way 6 (512 MB) Vaddr Paddr ASID Attr RWX Cache ---------- ---------- ---- ---- --- ------- 0x00000000 0x00000000 0x01 0x03 RWX Bypass 0x20000000 0x20000000 0x01 0x03 RWX Bypass 0x40000000 0x40000000 0x01 0x03 RWX Bypass 0x60000000 0x60000000 0x01 0x03 RWX Bypass 0x80000000 0x80000000 0x01 0x03 RWX Bypass 0xa0000000 0xa0000000 0x01 0x03 RWX Bypass 0xc0000000 0xc0000000 0x01 0x03 RWX Bypass 0xe0000000 0xe0000000 0x01 0x03 RWX Bypass This patch adds remapping code at the reset vector or at the kernel _start (depending on CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) that reconfigures MMUv3 as MMUv2: Way 5 (128 MB) Vaddr Paddr ASID Attr RWX Cache ---------- ---------- ---- ---- --- ------- 0xd0000000 0x00000000 0x01 0x07 RWX WB 0xd8000000 0x00000000 0x01 0x03 RWX Bypass Way 6 (256 MB) Vaddr Paddr ASID Attr RWX Cache ---------- ---------- ---- ---- --- ------- 0xe0000000 0xf0000000 0x01 0x07 RWX WB 0xf0000000 0xf0000000 0x01 0x03 RWX Bypass Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa/boot')
-rw-r--r--arch/xtensa/boot/boot-elf/Makefile1
-rw-r--r--arch/xtensa/boot/boot-elf/boot.lds.S64
-rw-r--r--arch/xtensa/boot/boot-elf/bootstrap.S101
-rw-r--r--arch/xtensa/boot/boot-uboot/Makefile6
4 files changed, 118 insertions, 54 deletions
diff --git a/arch/xtensa/boot/boot-elf/Makefile b/arch/xtensa/boot/boot-elf/Makefile
index 1fe01b78c124..89db089f5a12 100644
--- a/arch/xtensa/boot/boot-elf/Makefile
+++ b/arch/xtensa/boot/boot-elf/Makefile
@@ -12,6 +12,7 @@ endif
12 12
13export OBJCOPY_ARGS 13export OBJCOPY_ARGS
14export CPPFLAGS_boot.lds += -P -C 14export CPPFLAGS_boot.lds += -P -C
15export KBUILD_AFLAGS += -mtext-section-literals
15 16
16boot-y := bootstrap.o 17boot-y := bootstrap.o
17 18
diff --git a/arch/xtensa/boot/boot-elf/boot.lds.S b/arch/xtensa/boot/boot-elf/boot.lds.S
index 7b646e0a6486..932b58ef33d4 100644
--- a/arch/xtensa/boot/boot-elf/boot.lds.S
+++ b/arch/xtensa/boot/boot-elf/boot.lds.S
@@ -1,41 +1,29 @@
1#include <variant/core.h> 1/*
2 * linux/arch/xtensa/boot/boot-elf/boot.lds.S
3 *
4 * Copyright (C) 2008 - 2013 by Tensilica Inc.
5 *
6 * Chris Zankel <chris@zankel.net>
7 * Marc Gauthier <marc@tensilica.com
8 * Pete Delaney <piet@tensilica.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <asm/vectors.h>
2OUTPUT_ARCH(xtensa) 16OUTPUT_ARCH(xtensa)
3ENTRY(_ResetVector) 17ENTRY(_ResetVector)
4 18
5SECTIONS 19SECTIONS
6{ 20{
7 .start 0xD0000000 : { *(.start) } 21 .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
8
9 .text 0xD0000000:
10 {
11 __reloc_start = . ;
12 _text_start = . ;
13 *(.literal .text.literal .text)
14 _text_end = . ;
15 }
16
17 .rodata ALIGN(0x04):
18 {
19 *(.rodata)
20 *(.rodata1)
21 }
22
23 .data ALIGN(0x04):
24 { 22 {
25 *(.data) 23 *(.ResetVector.text)
26 *(.data1)
27 *(.sdata)
28 *(.sdata2)
29 *(.got.plt)
30 *(.got)
31 *(.dynamic)
32 } 24 }
33 25
34 __reloc_end = . ; 26 .image KERNELOFFSET: AT (LOAD_MEMORY_ADDRESS)
35
36 . = ALIGN(0x10);
37 __image_load = . ;
38 .image 0xd0001000:
39 { 27 {
40 _image_start = .; 28 _image_start = .;
41 *(image) 29 *(image)
@@ -43,7 +31,6 @@ SECTIONS
43 _image_end = . ; 31 _image_end = . ;
44 } 32 }
45 33
46
47 .bss ((LOADADDR(.image) + SIZEOF(.image) + 3) & ~ 3): 34 .bss ((LOADADDR(.image) + SIZEOF(.image) + 3) & ~ 3):
48 { 35 {
49 __bss_start = .; 36 __bss_start = .;
@@ -53,14 +40,15 @@ SECTIONS
53 *(.bss) 40 *(.bss)
54 __bss_end = .; 41 __bss_end = .;
55 } 42 }
56 _end = .;
57 _param_start = .;
58 43
59 .ResetVector.text XCHAL_RESET_VECTOR_VADDR : 44 /*
45 * This is a remapped copy of the Reset Vector Code.
46 * It keeps gdb in sync with the PC after switching
47 * to the temporary mapping used while setting up
48 * the V2 MMU mappings for Linux.
49 */
50 .ResetVector.remapped_text 0x46000000 (INFO):
60 { 51 {
61 *(.ResetVector.text) 52 *(.ResetVector.remapped_text)
62 } 53 }
63
64
65 PROVIDE (end = .);
66} 54}
diff --git a/arch/xtensa/boot/boot-elf/bootstrap.S b/arch/xtensa/boot/boot-elf/bootstrap.S
index 464298bc348b..1388a499753b 100644
--- a/arch/xtensa/boot/boot-elf/bootstrap.S
+++ b/arch/xtensa/boot/boot-elf/bootstrap.S
@@ -1,18 +1,77 @@
1/*
2 * arch/xtensa/boot/boot-elf/bootstrap.S
3 *
4 * Low-level exception handling
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2004 - 2013 by Tensilica Inc.
11 *
12 * Chris Zankel <chris@zankel.net>
13 * Marc Gauthier <marc@tensilica.com>
14 * Piet Delaney <piet@tensilica.com>
15 */
1 16
2#include <asm/bootparam.h> 17#include <asm/bootparam.h>
18#include <asm/processor.h>
19#include <asm/pgtable.h>
20#include <asm/page.h>
21#include <asm/cacheasm.h>
22#include <asm/initialize_mmu.h>
23#include <linux/linkage.h>
3 24
4 25 .section .ResetVector.text, "ax"
5/* ResetVector
6 */
7 .section .ResetVector.text, "ax"
8 .global _ResetVector 26 .global _ResetVector
27 .global reset
28
9_ResetVector: 29_ResetVector:
10 _j reset 30 _j _SetupMMU
31
32 .begin no-absolute-literals
33 .literal_position
34
11 .align 4 35 .align 4
12RomInitAddr: 36RomInitAddr:
13 .word 0xd0001000 37#if defined(CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) && \
38 XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
39 .word 0x00003000
40#else
41 .word 0xd0003000
42#endif
14RomBootParam: 43RomBootParam:
15 .word _bootparam 44 .word _bootparam
45_bootparam:
46 .short BP_TAG_FIRST
47 .short 4
48 .long BP_VERSION
49 .short BP_TAG_LAST
50 .short 0
51 .long 0
52
53 .align 4
54_SetupMMU:
55 movi a0, 0
56 wsr a0, windowbase
57 rsync
58 movi a0, 1
59 wsr a0, windowstart
60 rsync
61 movi a0, 0x1F
62 wsr a0, ps
63 rsync
64
65 Offset = _SetupMMU - _ResetVector
66
67#ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
68 initialize_mmu
69#endif
70
71 .end no-absolute-literals
72
73 rsil a0, XCHAL_DEBUGLEVEL-1
74 rsync
16reset: 75reset:
17 l32r a0, RomInitAddr 76 l32r a0, RomInitAddr
18 l32r a2, RomBootParam 77 l32r a2, RomBootParam
@@ -21,13 +80,25 @@ reset:
21 jx a0 80 jx a0
22 81
23 .align 4 82 .align 4
24 .section .bootstrap.data, "aw"
25 83
26 .globl _bootparam 84 .section .ResetVector.remapped_text, "x"
27_bootparam: 85 .global _RemappedResetVector
28 .short BP_TAG_FIRST 86
29 .short 4 87 /* Do org before literals */
30 .long BP_VERSION 88 .org 0
31 .short BP_TAG_LAST 89
32 .short 0 90_RemappedResetVector:
33 .long 0 91 .begin no-absolute-literals
92 .literal_position
93
94 _j _RemappedSetupMMU
95
96 /* Position Remapped code at the same location as the original code */
97 . = _RemappedResetVector + Offset
98
99_RemappedSetupMMU:
100#ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
101 initialize_mmu
102#endif
103
104 .end no-absolute-literals
diff --git a/arch/xtensa/boot/boot-uboot/Makefile b/arch/xtensa/boot/boot-uboot/Makefile
index bfbf8af582f1..545759819ef9 100644
--- a/arch/xtensa/boot/boot-uboot/Makefile
+++ b/arch/xtensa/boot/boot-uboot/Makefile
@@ -4,7 +4,11 @@
4# for more details. 4# for more details.
5# 5#
6 6
7UIMAGE_LOADADDR = 0xd0001000 7ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
8UIMAGE_LOADADDR = 0x00003000
9else
10UIMAGE_LOADADDR = 0xd0003000
11endif
8UIMAGE_COMPRESSION = gzip 12UIMAGE_COMPRESSION = gzip
9 13
10$(obj)/../uImage: vmlinux.bin.gz FORCE 14$(obj)/../uImage: vmlinux.bin.gz FORCE