Skip to content

Commit 4bedea9

Browse files
Chris ZankelLinus Torvalds
authored andcommitted
[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 2
The attached patches provides part 2 of an architecture implementation for the Tensilica Xtensa CPU series. Signed-off-by: Chris Zankel <chris@zankel.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 8e1a6dd commit 4bedea9

13 files changed

Lines changed: 3279 additions & 0 deletions

File tree

‎arch/xtensa/boot/Makefile‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# arch/xtensa/boot/Makefile
3+
#
4+
# This file is subject to the terms and conditions of the GNU General Public
5+
# License. See the file "COPYING" in the main directory of this archive
6+
# for more details.
7+
#
8+
#
9+
10+
11+
CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
12+
HOSTFLAGS += -Iarch/$(ARCH)/boot/include
13+
14+
BIG_ENDIAN := $(shell echo -e "\#ifdef __XTENSA_EL__\nint little;\n\#else\nint big;\n\#endif" | $(CC) -E -|grep -c big)
15+
16+
17+
export CFLAGS
18+
export AFLAGS
19+
export BIG_ENDIAN
20+
21+
# Subdirs for the boot loader(s)
22+
23+
bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf
24+
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf
25+
26+
subdir-y := lib/
27+
28+
subdir-y += boot-elf/ boot-redboot/
29+
30+
zImage zImage.initrd Image Image.initrd: $(bootdir-y)
31+
32+
$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
33+
$(addprefix $(obj)/,$(host-progs))
34+
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
35+
36+
37+

‎arch/xtensa/boot/boot-elf/Makefile‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# This file is subject to the terms and conditions of the GNU General Public
3+
# License. See the file "COPYING" in the main directory of this archive
4+
# for more details.
5+
#
6+
7+
GZIP = gzip
8+
GZIP_FLAGS = -v9fc
9+
10+
ifeq ($(BIG_ENDIAN),1)
11+
OBJCOPY_ARGS := -O elf32-xtensa-be
12+
else
13+
OBJCOPY_ARGS := -O elf32-xtensa-le
14+
endif
15+
16+
export OBJCOPY_ARGS
17+
18+
boot-y := bootstrap.o
19+
20+
OBJS := $(addprefix $(obj)/,$(boot-y))
21+
22+
Image: vmlinux $(OBJS)
23+
$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
24+
vmlinux vmlinux.tmp
25+
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
26+
--add-section image=vmlinux.tmp \
27+
--set-section-flags image=contents,alloc,load,load,data \
28+
$(OBJS) $@.tmp
29+
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
30+
-T arch/$(ARCH)/boot/boot-elf/boot.ld \
31+
-o arch/$(ARCH)/boot/$@.elf $@.tmp
32+
rm -f $@.tmp vmlinux.tmp
33+
34+
Image.initrd: vmlinux $(OBJS)
35+
$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
36+
--add-section .initrd=arch/$(ARCH)/boot/ramdisk \
37+
--set-section-flags .initrd=contents,alloc,load,load,data \
38+
vmlinux vmlinux.tmp
39+
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
40+
--add-section image=vmlinux.tmp \
41+
--set-section-flags image=contents,alloc,load,load,data \
42+
$(OBJS) $@.tmp
43+
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
44+
-T arch/$(ARCH)/boot/boot-elf/boot.ld \
45+
-o arch/$(ARCH)/boot/$@.elf $@.tmp
46+
rm -f $@.tmp vmlinux.tmp
47+
48+
49+
zImage: Image
50+
51+
zImage.initrd: Image.initrd
52+

‎arch/xtensa/boot/boot-elf/boot.ld‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
OUTPUT_ARCH(xtensa)
2+
3+
SECTIONS
4+
{
5+
.start 0xD0000000 : { *(.start) }
6+
7+
.text 0xD0000000:
8+
{
9+
__reloc_start = . ;
10+
_text_start = . ;
11+
*(.literal .text.literal .text)
12+
_text_end = . ;
13+
}
14+
15+
.rodata ALIGN(0x04):
16+
{
17+
*(.rodata)
18+
*(.rodata1)
19+
}
20+
21+
.data ALIGN(0x04):
22+
{
23+
*(.data)
24+
*(.data1)
25+
*(.sdata)
26+
*(.sdata2)
27+
*(.got.plt)
28+
*(.got)
29+
*(.dynamic)
30+
}
31+
32+
__reloc_end = . ;
33+
34+
.initrd ALIGN(0x10) :
35+
{
36+
boot_initrd_start = . ;
37+
*(.initrd)
38+
boot_initrd_end = .;
39+
}
40+
41+
. = ALIGN(0x10);
42+
__image_load = . ;
43+
.image 0xd0001000:
44+
{
45+
_image_start = .;
46+
*(image)
47+
. = (. + 3) & ~ 3;
48+
_image_end = . ;
49+
}
50+
51+
52+
.bss ((LOADADDR(.image) + SIZEOF(.image) + 3) & ~ 3):
53+
{
54+
__bss_start = .;
55+
*(.sbss)
56+
*(.scommon)
57+
*(.dynbss)
58+
*(.bss)
59+
__bss_end = .;
60+
}
61+
_end = .;
62+
_param_start = .;
63+
64+
.ResetVector.text 0xfe000020 :
65+
{
66+
*(.ResetVector.text)
67+
}
68+
69+
70+
PROVIDE (end = .);
71+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
#include <xtensa/config/specreg.h>
3+
#include <xtensa/config/core.h>
4+
5+
#include <linux/config.h>
6+
#include <asm/bootparam.h>
7+
8+
9+
/* ResetVector
10+
*/
11+
.section .ResetVector.text, "ax"
12+
.global _ResetVector
13+
_ResetVector:
14+
_j reset
15+
.align 4
16+
RomInitAddr:
17+
.word 0xd0001000
18+
RomBootParam:
19+
.word _bootparam
20+
reset:
21+
l32r a0, RomInitAddr
22+
l32r a2, RomBootParam
23+
movi a3, 0
24+
movi a4, 0
25+
jx a0
26+
27+
.align 4
28+
.section .bootstrap.data, "aw"
29+
30+
.globl _bootparam
31+
_bootparam:
32+
.short BP_TAG_FIRST
33+
.short 4
34+
.long BP_VERSION
35+
.short BP_TAG_LAST
36+
.short 0
37+
.long 0
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# This file is subject to the terms and conditions of the GNU General Public
3+
# License. See the file "COPYING" in the main directory of this archive
4+
# for more details.
5+
#
6+
7+
GZIP = gzip
8+
GZIP_FLAGS = -v9fc
9+
ifeq ($(BIG_ENDIAN),1)
10+
OBJCOPY_ARGS := -O elf32-xtensa-be
11+
else
12+
OBJCOPY_ARGS := -O elf32-xtensa-le
13+
endif
14+
15+
LD_ARGS = -T $(obj)/boot.ld
16+
17+
boot-y := bootstrap.o
18+
19+
OBJS := $(addprefix $(obj)/,$(boot-y))
20+
LIBS := arch/$(ARCH)/boot/lib/lib.a arch/$(ARCH)/lib/lib.a
21+
22+
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
23+
24+
zImage: vmlinux $(OBJS) $(LIBS)
25+
$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
26+
$(TOPDIR)/vmlinux vmlinux.tmp
27+
gzip -vf9 vmlinux.tmp
28+
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
29+
--add-section image=vmlinux.tmp.gz \
30+
--set-section-flags image=contents,alloc,load,load,data \
31+
$(OBJS) $@.tmp
32+
$(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
33+
$(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/images/$@.redboot
34+
# rm -f $@.tmp $@.elf vmlinux.tmp.gz
35+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
OUTPUT_ARCH(xtensa)
2+
3+
SECTIONS
4+
{
5+
.start 0xD0200000 : { *(.start) }
6+
7+
.text :
8+
{
9+
__reloc_start = . ;
10+
_text_start = . ;
11+
*(.literal .text.literal .text)
12+
_text_end = . ;
13+
}
14+
15+
.rodata ALIGN(0x04):
16+
{
17+
*(.rodata)
18+
*(.rodata1)
19+
}
20+
21+
.data ALIGN(0x04):
22+
{
23+
*(.data)
24+
*(.data1)
25+
*(.sdata)
26+
*(.sdata2)
27+
*(.got.plt)
28+
*(.got)
29+
*(.dynamic)
30+
}
31+
32+
__reloc_end = . ;
33+
34+
.initrd ALIGN(0x10) :
35+
{
36+
boot_initrd_start = . ;
37+
*(.initrd)
38+
boot_initrd_end = .;
39+
}
40+
41+
. = ALIGN(0x10);
42+
__image_load = . ;
43+
.image 0xd0001000: AT(__image_load)
44+
{
45+
_image_start = .;
46+
*(image)
47+
. = (. + 3) & ~ 3;
48+
_image_end = . ;
49+
}
50+
51+
52+
.bss ((LOADADDR(.image) + SIZEOF(.image) + 3) & ~ 3):
53+
{
54+
__bss_start = .;
55+
*(.sbss)
56+
*(.scommon)
57+
*(.dynbss)
58+
*(.bss)
59+
__bss_end = .;
60+
}
61+
_end = .;
62+
_param_start = .;
63+
64+
65+
PROVIDE (end = .);
66+
}

0 commit comments

Comments
 (0)