Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bedea94 authored by Chris Zankel's avatar Chris Zankel Committed by Linus Torvalds
Browse files

[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: default avatarChris Zankel <chris@zankel.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8e1a6dd2
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
#
# arch/xtensa/boot/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
#
#


CFLAGS 		+= -fno-builtin -Iarch/$(ARCH)/boot/include
HOSTFLAGS	+= -Iarch/$(ARCH)/boot/include

BIG_ENDIAN	:= $(shell echo -e "\#ifdef __XTENSA_EL__\nint little;\n\#else\nint big;\n\#endif" | $(CC) -E -|grep -c big)


export CFLAGS
export AFLAGS
export BIG_ENDIAN

# Subdirs for the boot loader(s)

bootdir-$(CONFIG_XTENSA_PLATFORM_ISS)	 += boot-elf
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf

subdir-y	:= lib/

subdir-y	+= boot-elf/ boot-redboot/

zImage zImage.initrd Image Image.initrd: $(bootdir-y)

$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
	      $(addprefix $(obj)/,$(host-progs))
	$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)


+52 −0
Original line number Diff line number Diff line
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
#

GZIP = gzip
GZIP_FLAGS = -v9fc

ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS    := -O elf32-xtensa-be
else
OBJCOPY_ARGS    := -O elf32-xtensa-le
endif

export OBJCOPY_ARGS

boot-y		:= bootstrap.o

OBJS		:= $(addprefix $(obj)/,$(boot-y))

Image:	vmlinux $(OBJS)
	$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
		vmlinux vmlinux.tmp
	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
		--add-section image=vmlinux.tmp \
		--set-section-flags image=contents,alloc,load,load,data \
		$(OBJS) $@.tmp
	$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
		-T arch/$(ARCH)/boot/boot-elf/boot.ld \
		-o arch/$(ARCH)/boot/$@.elf $@.tmp
	rm -f $@.tmp vmlinux.tmp

Image.initrd:	vmlinux $(OBJS)
	$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
		--add-section .initrd=arch/$(ARCH)/boot/ramdisk \
		--set-section-flags .initrd=contents,alloc,load,load,data \
		vmlinux vmlinux.tmp
	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
		--add-section image=vmlinux.tmp \
		--set-section-flags image=contents,alloc,load,load,data \
		$(OBJS) $@.tmp
	$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
		-T arch/$(ARCH)/boot/boot-elf/boot.ld \
		-o arch/$(ARCH)/boot/$@.elf $@.tmp
	rm -f $@.tmp vmlinux.tmp


zImage:	Image

zImage.initrd:	Image.initrd
+71 −0
Original line number Diff line number Diff line
OUTPUT_ARCH(xtensa)

SECTIONS
{
	.start 0xD0000000 : { *(.start) }

	.text 0xD0000000:
	{
		__reloc_start = . ;
		_text_start = . ;
		*(.literal .text.literal .text)
		_text_end = . ;
	}

	.rodata ALIGN(0x04):
	{
		*(.rodata)
		*(.rodata1)
	}

	.data ALIGN(0x04):
	{
		*(.data)
		*(.data1)
		*(.sdata)
		*(.sdata2)
		*(.got.plt)
		*(.got)
		*(.dynamic)
	}

	__reloc_end = . ;

	.initrd ALIGN(0x10) :
	{
		boot_initrd_start = . ;
		*(.initrd)
		boot_initrd_end = .;
	}

	. = ALIGN(0x10);
	__image_load = . ;
	.image 0xd0001000:
	{
		_image_start = .;
		*(image)
		. = (. + 3) & ~ 3;
		_image_end = .	;
	}


	.bss ((LOADADDR(.image) + SIZEOF(.image) + 3) & ~ 3):
	{
		__bss_start = .;
		*(.sbss)
		*(.scommon)
		*(.dynbss)
		*(.bss)
		__bss_end = .;
	}
	_end = .;
	_param_start = .;

	.ResetVector.text 0xfe000020 :
	{
		*(.ResetVector.text)
	}


	PROVIDE (end = .);
}
+37 −0
Original line number Diff line number Diff line

#include <xtensa/config/specreg.h>
#include <xtensa/config/core.h>

#include <linux/config.h>
#include <asm/bootparam.h>


/* ResetVector
 */
	.section        .ResetVector.text, "ax"
	.global         _ResetVector
_ResetVector:
	_j reset
	.align 4
RomInitAddr:
	.word 0xd0001000
RomBootParam:
	.word _bootparam
reset:
	l32r    a0, RomInitAddr
	l32r	a2, RomBootParam
	movi	a3, 0
	movi	a4, 0
	jx      a0

	.align 4
	.section .bootstrap.data, "aw"

	.globl _bootparam
_bootparam:
	.short	BP_TAG_FIRST
	.short	4
	.long	BP_VERSION
	.short	BP_TAG_LAST
	.short	0
	.long	0
+35 −0
Original line number Diff line number Diff line
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
#

GZIP = gzip
GZIP_FLAGS = -v9fc
ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS 	:= -O elf32-xtensa-be
else
OBJCOPY_ARGS 	:= -O elf32-xtensa-le
endif

LD_ARGS	= -T $(obj)/boot.ld

boot-y	:= bootstrap.o

OBJS	:= $(addprefix $(obj)/,$(boot-y))
LIBS	:= arch/$(ARCH)/boot/lib/lib.a arch/$(ARCH)/lib/lib.a

LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)

zImage: vmlinux $(OBJS) $(LIBS)
	$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
		$(TOPDIR)/vmlinux vmlinux.tmp
	gzip -vf9 vmlinux.tmp
	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
		--add-section image=vmlinux.tmp.gz \
		--set-section-flags image=contents,alloc,load,load,data \
		$(OBJS) $@.tmp
	$(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
	$(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/images/$@.redboot
#	rm -f $@.tmp $@.elf vmlinux.tmp.gz
Loading