arm64 patch
Subsystems (2)
v9 cover arm64 patch
From: David Feng <[email protected]>
The porting has been merged with arm architecture. Most architecture codes are placed in arch/arm/cpu/armv8 directory. Generic board is also supported after a few bugs are fixed. u-boot could be running at EL1 or EL2.
Changes for v8:
- add Signed-off-by information to patch "board support of vexpress_aemv8a" which SMC91111 support is integrated from Sharma Bhupesh's patch.
- adjust pt_regs struct and add exception state preservation in exception.S.
Changes for v7:
- Integrate SMC91111 patch of sharma bhupesh.
- remove v8_outer_cache* which is not need currently.
- Change license tag.
- Mov crt0.S/relocate.S/interrupts.c to arm/lib and rename them with _64 suffix.
- Make el3/el2 initializing process of start.S as two separate routines. It could be easier to be replaced with processor specific codes.
- Remove exception stack save and restore routine, it is unnecessary now.
- simplify __weak function declaration.
Changes for v6:
- Check the patches with checkpatch.pl and get rid of almost all warnings. There are a few warnings still, but I think it should be that.
- change printf format in cmd_pxe.c, use %zd indtead of %ld to format size_t type variable.
- add macro PGTABLE_SIZE to identify tlb table size.
Changes for v5:
- Make modification to inappropriate licensed file and bugs according to ScottWood's advice. Thanks Scott for his checking to these patches.
- Enable u-boot's running at EL1.
- Get rid of compiling warnings originated from cmd_pxe.c.
Changes for v4:
- fix the generic board_f.c, remove zero_global_data from init_sequence_f array and move it to board_init_f() function with CONFIG_X86 switch. The previous fixup is inaccurate.
- Replace __ARMEB__ with __AARCH64EB__ in byteorder.h and unaligned.h, gcc for aarch64 use __AARCH64EB__ and __AARCH64EL__ to identify endian.
- Some modification to README.armv8
Changes for v3:
- merge arm64 to arm architecture.
David Feng (5):
core support of arm64
board support of vexpress_aemv8a
generic board patch of manual reloc and zero gd_t 64bit initrd start address support
remove compiling warnings
MAINTAINERS | 4 + arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 38 +++ arch/arm/cpu/armv8/cache.S | 130 +++++++++ arch/arm/cpu/armv8/cache_v8.c | 228 ++++++++++++++++ arch/arm/cpu/armv8/config.mk | 16 ++ arch/arm/cpu/armv8/cpu.c | 67 +++++ arch/arm/cpu/armv8/exceptions.S | 115 ++++++++ arch/arm/cpu/armv8/start.S | 236 +++++++++++++++++ arch/arm/cpu/armv8/timer.c | 80 ++++++ arch/arm/cpu/armv8/tlb.S | 30 +++ arch/arm/cpu/armv8/u-boot.lds | 71 +++++ arch/arm/include/asm/arch-armv8/gpio.h | 11 + arch/arm/include/asm/arch-armv8/mmu.h | 106 ++++++++ arch/arm/include/asm/byteorder.h | 12 + arch/arm/include/asm/cache.h | 5 + arch/arm/include/asm/config.h | 10 + arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 15 +- arch/arm/include/asm/macro.h | 20 ++ arch/arm/include/asm/posix_types.h | 10 + arch/arm/include/asm/proc-armv/ptrace.h | 21 ++ arch/arm/include/asm/proc-armv/system.h | 59 ++++- arch/arm/include/asm/system.h | 77 ++++++ arch/arm/include/asm/types.h | 4 + arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 2 +- arch/arm/lib/Makefile | 14 + arch/arm/lib/board.c | 16 +- arch/arm/lib/bootm.c | 16 ++ arch/arm/lib/crt0_64.S | 116 ++++++++ arch/arm/lib/interrupts_64.c | 120 +++++++++ arch/arm/lib/relocate_64.S | 57 ++++ board/armltd/dts/vexpress64.dts | 439 +++++++++++++++++++++++++++++++ board/armltd/vexpress64/Makefile | 27 ++ board/armltd/vexpress64/vexpress64.c | 70 +++++ boards.cfg | 1 + common/board_f.c | 19 +- common/board_r.c | 18 ++ common/cmd_pxe.c | 4 +- common/fdt_support.c | 66 ++--- common/image.c | 1 + doc/README.armv8 | 18 ++ examples/standalone/stubs.c | 15 ++ include/configs/vexpress_aemv8a.h | 193 ++++++++++++++ include/image.h | 1 + 46 files changed, 2540 insertions(+), 52 deletions(-) create mode 100644 arch/arm/cpu/armv8/Makefile create mode 100644 arch/arm/cpu/armv8/cache.S create mode 100644 arch/arm/cpu/armv8/cache_v8.c create mode 100644 arch/arm/cpu/armv8/config.mk create mode 100644 arch/arm/cpu/armv8/cpu.c create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/start.S create mode 100644 arch/arm/cpu/armv8/timer.c create mode 100644 arch/arm/cpu/armv8/tlb.S create mode 100644 arch/arm/cpu/armv8/u-boot.lds create mode 100644 arch/arm/include/asm/arch-armv8/gpio.h create mode 100644 arch/arm/include/asm/arch-armv8/mmu.h create mode 100644 arch/arm/lib/crt0_64.S create mode 100644 arch/arm/lib/interrupts_64.c create mode 100644 arch/arm/lib/relocate_64.S create mode 100644 board/armltd/dts/vexpress64.dts create mode 100644 board/armltd/vexpress64/Makefile create mode 100644 board/armltd/vexpress64/vexpress64.c create mode 100644 doc/README.armv8 create mode 100644 include/configs/vexpress_aemv8a.h
Signature · 1 line
1.7.9.5
PATCH v9 1/5 core support of arm64
From: David Feng <[email protected]>
--- arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 38 +++++ arch/arm/cpu/armv8/cache.S | 130 +++++++++++++++++ arch/arm/cpu/armv8/cache_v8.c | 228 +++++++++++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 16 +++ arch/arm/cpu/armv8/cpu.c | 67 +++++++++ arch/arm/cpu/armv8/exceptions.S | 115 +++++++++++++++ arch/arm/cpu/armv8/start.S | 236 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv8/timer.c | 80 +++++++++++ arch/arm/cpu/armv8/tlb.S | 30 ++++ arch/arm/cpu/armv8/u-boot.lds | 71 ++++++++++ arch/arm/include/asm/arch-armv8/gpio.h | 11 ++ arch/arm/include/asm/arch-armv8/mmu.h | 106 ++++++++++++++ arch/arm/include/asm/byteorder.h | 12 ++ arch/arm/include/asm/cache.h | 5 + arch/arm/include/asm/config.h | 10 ++ arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 15 +- arch/arm/include/asm/macro.h | 20 +++ arch/arm/include/asm/posix_types.h | 10 ++ arch/arm/include/asm/proc-armv/ptrace.h | 21 +++ arch/arm/include/asm/proc-armv/system.h | 59 +++++++- arch/arm/include/asm/system.h | 77 ++++++++++ arch/arm/include/asm/types.h | 4 + arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 2 +- arch/arm/lib/Makefile | 14 ++ arch/arm/lib/board.c | 16 ++- arch/arm/lib/bootm.c | 16 +++ arch/arm/lib/crt0_64.S | 116 +++++++++++++++ arch/arm/lib/interrupts_64.c | 120 ++++++++++++++++ arch/arm/lib/relocate_64.S | 57 ++++++++ common/image.c | 1 + doc/README.armv8 | 18 +++ examples/standalone/stubs.c | 15 ++ include/image.h | 1 + 36 files changed, 1741 insertions(+), 10 deletions(-) create mode 100644 arch/arm/cpu/armv8/Makefile create mode 100644 arch/arm/cpu/armv8/cache.S create mode 100644 arch/arm/cpu/armv8/cache_v8.c create mode 100644 arch/arm/cpu/armv8/config.mk create mode 100644 arch/arm/cpu/armv8/cpu.c create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/start.S create mode 100644 arch/arm/cpu/armv8/timer.c create mode 100644 arch/arm/cpu/armv8/tlb.S create mode 100644 arch/arm/cpu/armv8/u-boot.lds create mode 100644 arch/arm/include/asm/arch-armv8/gpio.h create mode 100644 arch/arm/include/asm/arch-armv8/mmu.h create mode 100644 arch/arm/lib/crt0_64.S create mode 100644 arch/arm/lib/interrupts_64.c create mode 100644 arch/arm/lib/relocate_64.S create mode 100644 doc/README.armv8
arch/arm/config.mk +4 -0
@@ -74,7 +74,9 @@ endif endif # needed for relocation +ifndef CONFIG_ARMV8 LDFLAGS_u-boot += -pie +endif # # FIXME: binutils versions < 2.22 have a bug in the assembler where
@@ -95,6 +97,8 @@ endif endif # check that only R_ARM_RELATIVE relocations are generated +ifndef CONFIG_ARMV8 ifneq ($(CONFIG_SPL_BUILD),y) ALL-y += checkarmreloc endif +endif
arch/arm/cpu/armv8/Makefile new file +38 -0
@@ -0,0 +1,38 @@ +# +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(CPU).o + +START := start.o + +COBJS += cpu.o +COBJS += timer.o +COBJS += cache_v8.o + +SOBJS += exceptions.o +SOBJS += cache.o +SOBJS += tlb.o + +SRCS := $(START:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) +START := $(addprefix $(obj),$(START)) + +all: $(obj).depend $(START) $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/arm/cpu/armv8/cache.S new file +130 -0
130 lines not on this page · raw message
arch/arm/cpu/armv8/cache_v8.c new file +228 -0
228 lines not on this page · raw message
arch/arm/cpu/armv8/config.mk new file +16 -0
@@ -0,0 +1,16 @@ +# +# (C) Copyright 2002 +# Gary Jennejohn, DENX Software Engineering, <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# +PLATFORM_RELFLAGS += -fno-common -ffixed-x18 + +# SEE README.arm-unaligned-accesses +PF_NO_UNALIGNED := $(call cc-option, -mstrict-align) +PLATFORM_NO_UNALIGNED := $(PF_NO_UNALIGNED) + +PF_CPPFLAGS_ARMV8 := $(call cc-option, -march=armv8-a) +PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARMV8) +PLATFORM_CPPFLAGS += $(PF_NO_UNALIGNED) +PLATFORM_CPPFLAGS += -fpic
arch/arm/cpu/armv8/cpu.c new file +67 -0
67 lines not on this page · raw message
arch/arm/cpu/armv8/exceptions.S new file +115 -0
115 lines not on this page · raw message
arch/arm/cpu/armv8/start.S new file +236 -0
236 lines not on this page · raw message
arch/arm/cpu/armv8/timer.c new file +80 -0
80 lines not on this page · raw message
arch/arm/cpu/armv8/tlb.S new file +30 -0
@@ -0,0 +1,30 @@ +/* + * (C) Copyright 2013 + * David Feng <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <asm-offsets.h> +#include <config.h> +#include <version.h> +#include <linux/linkage.h> +#include <asm/macro.h> + +/* + * void __asm_invalidate_tlb_all(void) + * + * invalidate all tlb entries. + */ +ENTRY(__asm_invalidate_tlb_all) + switch_el1_el2 x9, 1f, 2f, 3f +1: tlbi vmalle1 + dsb sy + isb + b 3f +2: tlbi alle2 + dsb sy + isb +3: + ret +ENDPROC(__asm_invalidate_tlb_all)
arch/arm/cpu/armv8/u-boot.lds new file +71 -0
71 lines not on this page · raw message
arch/arm/include/asm/arch-armv8/gpio.h new file +11 -0
@@ -0,0 +1,11 @@ +/* +* (C) Copyright 2013 +* David Feng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _ASM_ARMV8_GPIO_H_ +#define _ASM_ARMV8_GPIO_H_ + +#endif /* _ASM_ARMV8_GPIO_H_ */
arch/arm/include/asm/arch-armv8/mmu.h new file +106 -0
106 lines not on this page · raw message
arch/arm/include/asm/byteorder.h +12 -0
@@ -23,10 +23,22 @@# define __SWAB_64_THRU_32__#endif +#ifdef CONFIG_ARMV8 + +#ifdef __AARCH64EB__ +#include <linux/byteorder/big_endian.h> +#else +#include <linux/byteorder/little_endian.h> +#endif + +#else /* CONFIG_ARMV8 */ +#ifdef __ARMEB__#include <linux/byteorder/big_endian.h> #else #include <linux/byteorder/little_endian.h> #endif +#endif /* CONFIG_ARMV8 */ +#endif
arch/arm/include/asm/cache.h +5 -0
@@ -11,6 +11,8 @@#include <asm/system.h> +#ifndef CONFIG_ARMV8 +/* * Invalidate L2 Cache using co-proc instruction */
@@ -28,6 +30,9 @@ void l2_cache_disable(void);void set_section_dcache (int section,enum dcache_option option);void dram_bank_mmu_setup (int bank); + +#endif +/* * The current upper bound for ARM L1 data cache line sizes is 64 bytes. We * use that value for aligning DMA buffers unless the board config has specified
arch/arm/include/asm/config.h +10 -0
@@ -9,4 +9,14 @@#define CONFIG_LMB #define CONFIG_SYS_BOOT_RAMDISK_HIGH + +#ifdef CONFIG_ARMV8 +/* +* Currently, GOT is used to relocate u-boot and +* configuration CONFIG_NEEDS_MANUAL_RELOC is needed. +*/ +#define CONFIG_NEEDS_MANUAL_RELOC +#define CONFIG_PHYS_64BIT +#endif +#endif
arch/arm/include/asm/global_data.h +5 -1
@@ -47,6 +47,10 @@ struct arch_global_data {#include <asm-generic/global_data.h> -#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") +#ifdef CONFIG_ARMV8 +#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18") +#else +#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") +#endif #endif /* __ASM_GBL_DATA_H */
arch/arm/include/asm/io.h +9 -6
@@ -75,42 +75,45 @@ static inline phys_addr_t virt_to_phys(void * vaddr)#define __arch_putw (v,a) (*(volatile unsigned short *)(a) = (v))#define __arch_putl (v,a) (*(volatile unsigned int *)(a) = (v)) -extern inline void __raw_writesb (unsigned int addr,const void *data,int bytelen) +extern inline void __raw_writesb (unsigned long addr,const void *data, +int bytelen) {uint8_t *buf = (uint8_t *)data;while (bytelen--)__arch_putb (*buf++, addr); } -extern inline void __raw_writesw (unsigned int addr,const void *data,int wordlen) +extern inline void __raw_writesw (unsigned long addr,const void *data, +int wordlen) {uint16_t *buf = (uint16_t *)data;while (wordlen--)__arch_putw (*buf++, addr); } -extern inline void __raw_writesl (unsigned int addr,const void *data,int longlen) +extern inline void __raw_writesl (unsigned long addr,const void *data, +int longlen) {uint32_t *buf = (uint32_t *)data;while (longlen--)__arch_putl (*buf++, addr); } -extern inline void __raw_readsb (unsigned int addr,void *data,int bytelen) +extern inline void __raw_readsb (unsigned long addr,void *data,int bytelen) {uint8_t *buf = (uint8_t *)data;while (bytelen--) *buf++ =__arch_getb (addr); } -extern inline void __raw_readsw (unsigned int addr,void *data,int wordlen) +extern inline void __raw_readsw (unsigned long addr,void *data,int wordlen) {uint16_t *buf = (uint16_t *)data;while (wordlen--) *buf++ =__arch_getw (addr); } -extern inline void __raw_readsl (unsigned int addr,void *data,int longlen) +extern inline void __raw_readsl (unsigned long addr,void *data,int longlen) {uint32_t *buf = (uint32_t *)data;while (longlen--)
arch/arm/include/asm/macro.h +20 -0
@@ -54,5 +54,25 @@ bcs 1b .endm +#ifdef CONFIG_ARMV8 +/* + * Register aliases. + */ +lr .req x30 + +/* + * Branch according to exception level + */ +.macro switch_el1_el2, xreg, el1_label, el2_label, fail_label + mrs \xreg, CurrentEL + cmp \xreg, 0x4 + b.eq \el1_label + cmp \xreg, 0x8 + b.eq \el2_label + b \fail_label +.endm + +#endif /* CONFIG_ARMV8 */ + #endif /* __ASSEMBLY__ */ #endif /* __ASM_ARM_MACRO_H__ */
arch/arm/include/asm/posix_types.h +10 -0
@@ -13,6 +13,8 @@#ifndef __ARCH_ARM_POSIX_TYPES_H#define __ARCH_ARM_POSIX_TYPES_H +#include <config.h> +/* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot
@@ -28,9 +30,17 @@ typedef int __kernel_pid_t;typedef unsigned short __kernel_ipc_pid_t ;typedef unsigned short __kernel_uid_t ;typedef unsigned short __kernel_gid_t ; + +#ifdef CONFIG_ARMV8 +typedef unsigned long __kernel_size_t ; +typedef long __kernel_ssize_t ; +typedef long __kernel_ptrdiff_t ; +#else /* CONFIG_ARMV8 */ typedef unsigned int __kernel_size_t ;typedef int __kernel_ssize_t ;typedef int __kernel_ptrdiff_t ; +#endif /* CONFIG_ARMV8 */ +typedef long __kernel_time_t ;typedef long __kernel_suseconds_t ;typedef long __kernel_clock_t ;
arch/arm/include/asm/proc-armv/ptrace.h +21 -0
@@ -12,6 +12,25 @@#include <linux/config.h> +#ifdef CONFIG_ARMV8 + +#define PCMASK 0 + +#ifndef __ASSEMBLY__ + +/* +* This struct defines the way the registers are stored +* on the stack during an exception. +*/ +struct pt_regs { +unsigned long elr; +unsigned long regs[31 ]; +}; + +#endif /* __ASSEMBLY__ */ + +#else /* CONFIG_ARMV8 */ +#define USR26_MODE 0x00#define FIQ26_MODE 0x01#define IRQ26_MODE 0x02
@@ -106,4 +125,6 @@ static inline int valid_user_regs(struct pt_regs *regs)#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_ARMV8 */ +#endif
arch/arm/include/asm/proc-armv/system.h +58 -1
71 lines not on this page · raw message
arch/arm/include/asm/system.h +77 -0
93 lines not on this page · raw message
arch/arm/include/asm/types.h +4 -0
@@ -39,7 +39,11 @@ typedef unsigned int u32;typedef signed long long s64 ;typedef unsigned long long u64 ; +#ifdef CONFIG_ARMV8 +#define BITS_PER_LONG 64 +#else /* CONFIG_ARMV8 */ #define BITS_PER_LONG 32 +#endif /* CONFIG_ARMV8 */ /* Dma addresses are 32-bits wide. */
arch/arm/include/asm/u-boot.h +4 -0
@@ -44,6 +44,10 @@ typedef struct bd_info {#endif /* !CONFIG_SYS_GENERIC_BOARD */ /* For image.h:image_check_target_arch() */ +#ifndef CONFIG_ARMV8 #define IH_ARCH_DEFAULT IH_ARCH_ARM +#else +#define IH_ARCH_DEFAULT IH_ARCH_ARM64 +#endif #endif /* _U_BOOT_H_ */
arch/arm/include/asm/unaligned.h +1 -1
@@ -8,7 +8,7 @@/* * Select endianness */ -#ifndef __ARMEB__ +#if __BYTE_ORDER == __LITTLE_ENDIAN#define get_unaligned __get_unaligned_le#define put_unaligned __put_unaligned_le#else
arch/arm/lib/Makefile +14 -0
@@ -10,6 +10,9 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(ARCH).o LIBGCC = $(obj)libgcc.o +ifdef CONFIG_ARMV8 +SOBJS-y += crt0_64.o +else GLSOBJS += _ashldi3.o GLSOBJS += _ashrdi3.o GLSOBJS += _divsi3.o
@@ -21,9 +24,14 @@ GLSOBJS += _umodsi3.o GLCOBJS += div0.o SOBJS-y += crt0.o +endif ifndef CONFIG_SPL_BUILD +ifdef CONFIG_ARMV8 +SOBJS-y += relocate_64.o +else SOBJS-y += relocate.o +endif ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o endif
@@ -38,11 +46,17 @@ else COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o endif +ifdef CONFIG_ARMV8 +COBJS-y += interrupts_64.o +else COBJS-y += interrupts.o +endif COBJS-y += reset.o COBJS-y += cache.o +ifndef CONFIG_ARMV8 COBJS-y += cache-cp15.o +endif SRCS := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \ $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
arch/arm/lib/board.c +15 -1
@@ -344,7 +344,7 @@ void board_init_f(ulong bootflag)#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))/* reserve TLB table */ - gd->arch.tlb_size =4096 *4 ; + gd->arch.tlb_size =PGTABLE_SIZE ; addr -= gd->arch.tlb_size;/* round down to next 64 kB limit */
@@ -419,6 +419,7 @@ void board_init_f(ulong bootflag) }#endif +#ifndef CONFIG_ARMV8 /* setup stackpointer for exeptions */ gd->irq_sp = addr_sp;#ifdef CONFIG_USE_IRQ
@@ -431,6 +432,10 @@ void board_init_f(ulong bootflag)/* 8-byte alignment for ABI compliance */ addr_sp &= ~0x07 ; +#else /* CONFIG_ARMV8 */ +/* 16-byte alignment for ABI compliance */ + addr_sp &= ~0x0f ; +#endif /* CONFIG_ARMV8 */ #else addr_sp +=128 ;/* leave 32 words for abort-stack */ gd->irq_sp = addr_sp;
@@ -523,6 +528,15 @@ void board_init_r(gd_t *id, ulong dest_addr)debug ("monitor flash len: %08lX\n" , monitor_flash_len);board_init ();/* Setup chipselects */ + +#ifdef CONFIG_NEEDS_MANUAL_RELOC +/* +* We have to relocate the command table manually +*/ +fixup_cmdtable (ll_entry_start (cmd_tbl_t, cmd), +ll_entry_count (cmd_tbl_t, cmd)); +#endif /* CONFIG_NEEDS_MANUAL_RELOC */ +/* * TODO: printing of the clock inforamtion of the board is now * implemented as part of bdinfo command. Currently only support for
arch/arm/lib/bootm.c +16 -0
@@ -222,6 +222,21 @@ static void boot_prep_linux(bootm_headers_t *images)/* Subcommand: GO */ static void boot_jump_linux (bootm_headers_t *images,int flag) { +#ifdef CONFIG_ARMV8 +void (*kernel_entry)(void *fdt_addr); +int fake = (flag &BOOTM_STATE_OS_FAKE_GO ); + + kernel_entry = (void (*)(void *fdt_addr))images->ep; + +debug ("## Transferring control to Linux (at address %lx)...\n" , + (ulong ) kernel_entry); +bootstage_mark (BOOTSTAGE_ID_RUN_OS ); + +announce_and_cleanup (fake); + +if (!fake) +kernel_entry (images->ft_addr); +#else unsigned long machid = gd->bd->bi_arch_number;char *s;void (*kernel_entry)(int zero,int arch,uint params);
@@ -248,6 +263,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)if (!fake)kernel_entry (0 , machid, r2); +#endif }/* Main Entry point for arm bootm implementation
arch/arm/lib/crt0_64.S new file +116 -0
116 lines not on this page · raw message
arch/arm/lib/interrupts_64.c new file +120 -0
120 lines not on this page · raw message
arch/arm/lib/relocate_64.S new file +57 -0
57 lines not on this page · raw message
common/image.c +1 -0
@@ -81,6 +81,7 @@ static const table_entry_t uimage_arch[] = { { IH_ARCH_NDS32, "nds32", "NDS32", }, { IH_ARCH_OPENRISC, "or1k", "OpenRISC 1000",}, { IH_ARCH_SANDBOX, "sandbox", "Sandbox", }, + { IH_ARCH_ARM64, "arm64", "AArch64", }, { -1, "", "", }, };
doc/README.armv8 new file +18 -0
@@ -0,0 +1,18 @@ +Notes: + +1. Currenly, u-boot could be running at EL1 or EL2. + +2. GOT is used to relocate u-boot and CONFIG_NEEDS_MANUAL_RELOC is needed. + +3. Fdt should be placed at a 2-megabyte boundary and within the first 512 + megabytes from the start of the kernel image. So, fdt_high should be + defined specially. + Please reference linux/Documentation/arm64/booting.txt for detail. + +4. Generic board is supported. + +Contributor: + Tom Rini <[email protected]> + Scott Wood <[email protected]> + Sharma Bhupesh <[email protected]> + Rob Herring <[email protected]>
examples/standalone/stubs.c +15 -0
@@ -39,6 +39,20 @@ gd_t *global_data; " bctr\n" \ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");#elif defined(CONFIG_ARM ) +#ifdef CONFIG_ARMV8 +/* +* x18 holds the pointer to the global_data, x9 is a call-clobbered +* register +*/ +#define EXPORT_FUNC (x) \ + asm volatile ( \ +" .globl " #x "\n" \ +#x ":\n" \ +" ldr x9, [x18, %0]\n" \ +" ldr x9, [x9, %1]\n" \ +" br x9\n" \ + : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "x9"); +#else /* * r8 holds the pointer to the global_data, ip is a call-clobbered * register
@@ -50,6 +64,7 @@ gd_t *global_data; " ldr ip, [r8, %0]\n" \ " ldr pc, [ip, %1]\n" \ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "ip"); +#endif #elif defined(CONFIG_MIPS)/* * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call-
include/image.h +1 -0
@@ -156,6 +156,7 @@ struct lmb;#define IH_ARCH_SANDBOX 19/* Sandbox architecture (test only) */ #define IH_ARCH_NDS32 20/* ANDES Technology - NDS32 */ #define IH_ARCH_OPENRISC 21/* OpenRISC 1000 */ +#define IH_ARCH_ARM64 22/* ARM64 */ /* * Image Types
Signature · 1 line
1.7.9.5
PATCH v9 2/5 board support of vexpress_aemv8a
From: David Feng <[email protected]>
--- MAINTAINERS | 4 + board/armltd/dts/vexpress64.dts | 439 ++++++++++++++++++++++++++++++++++ board/armltd/vexpress64/Makefile | 27 +++ board/armltd/vexpress64/vexpress64.c | 70 ++++++ boards.cfg | 1 + include/configs/vexpress_aemv8a.h | 193 +++++++++++++++ 6 files changed, 734 insertions(+) create mode 100644 board/armltd/dts/vexpress64.dts create mode 100644 board/armltd/vexpress64/Makefile create mode 100644 board/armltd/vexpress64/vexpress64.c create mode 100644 include/configs/vexpress_aemv8a.h
MAINTAINERS +4 -0
@@ -1095,6 +1095,10 @@ Sergey Yanovich <[email protected]> lp8x4x xscale/pxa +David Feng <[email protected]> + + vexpress_aemv8a ARM ARMV8 (Quad Core) + ------------------------------------------------------------------------- Unknown / orphaned boards:
board/armltd/dts/vexpress64.dts new file +439 -0
439 lines not on this page · raw message
board/armltd/vexpress64/Makefile new file +27 -0
@@ -0,0 +1,27 @@ +# +# (C) Copyright 2000-2004 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := vexpress64.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
board/armltd/vexpress64/vexpress64.c new file +70 -0
70 lines not on this page · raw message
boards.cfg +1 -0
@@ -1196,5 +1196,6 @@ gr_ep2s60 sparc leon3 - gaisler grsim sparc leon3 - gaisler gr_xc3s_1500 sparc leon3 - gaisler coreboot-x86 x86 x86 coreboot chromebook-x86 coreboot coreboot:SYS_TEXT_BASE=0x01110000 +vexpress_aemv8a arm armv8 vexpress64 armltd - vexpress_aemv8a:ARMV8 # Target ARCH CPU Board name Vendor SoC Options ########################################################################################################################
include/configs/vexpress_aemv8a.h new file +193 -0
193 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v9 3/5 generic board patch of manual reloc and zero gd_t
From: David Feng <[email protected]>
--- common/board_f.c | 19 +++++++++++-------- common/board_r.c | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 8 deletions(-)
common/board_f.c +11 -8
@@ -458,7 +458,7 @@ static int reserve_round_4k(void)static int reserve_mmu (void ) {/* reserve TLB table */ - gd->arch.tlb_size =4096 *4 ; + gd->arch.tlb_size =PGTABLE_SIZE ; gd->relocaddr -= gd->arch.tlb_size;/* round down to next 64 kB limit */
@@ -610,7 +610,7 @@ static int reserve_stacks(void)* TODO(sjg at chromium.org): Perhaps create arch_reserve_stack() * to handle this and put in arch/xxx/lib/stack.c */ -# ifdef CONFIG_ARM +# if defined(CONFIG_ARM ) && !defined(CONFIG_ARMV8 )# ifdef CONFIG_USE_IRQ gd->start_addr_sp -= (CONFIG_STACKSIZE_IRQ +CONFIG_STACKSIZE_FIQ ); debug("Reserving %zu Bytes for IRQ stack at: %08lx\n",
@@ -807,11 +807,6 @@ static int mark_bootstage(void) } static init_fnc_t init_sequence_f[] = { -#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \ - !defined (CONFIG_MPC83xx) && !defined (CONFIG_MPC85xx) && \ - !defined (CONFIG_MPC86xx) && !defined (CONFIG_X86 ) - zero_global_data, -#endif#ifdef CONFIG_SANDBOX setup_ram_buf,#endif
@@ -1001,10 +996,18 @@ void board_init_f(ulong boot_flags) {#ifndef CONFIG_X86 gd_t data; - gd = &data;#endif +/* +* Zero gd_t first, otherwise the debug print(if DEBUG defined) +* in initcall_run_list function before zero_global_data is called +* will go wrong. +*/ +#ifndef CONFIG_X86 +zero_global_data (); +#endif + gd->flags = boot_flags;if (initcall_run_list (init_sequence_f))
common/board_r.c +18 -0
@@ -157,6 +157,13 @@ static int initr_reloc_global_data(void)*/ gd->env_addr += gd->relocaddr -CONFIG_SYS_MONITOR_BASE ;#endif +#ifdef CONFIG_NEEDS_MANUAL_RELOC +/* +* We have to relocate the command table manually +*/ +fixup_cmdtable (ll_entry_start (cmd_tbl_t, cmd), +ll_entry_count (cmd_tbl_t, cmd)); +#endif /* CONFIG_NEEDS_MANUAL_RELOC */ return 0 ; }
@@ -899,6 +906,7 @@ init_fnc_t init_sequence_r[] = { initr_modem, #endif run_main_loop, + NULL, };void board_init_r (gd_t *new_gd,ulong dest_addr)
@@ -906,6 +914,16 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)#ifndef CONFIG_X86 gd = new_gd;#endif +#ifdef CONFIG_NEEDS_MANUAL_RELOC +/* +* We have to relocate the init_sequence_r table manually +*/ +init_fnc_t *init_fnc_ptr; +for (init_fnc_ptr = init_sequence_r; *init_fnc_ptr; ++init_fnc_ptr) + *init_fnc_ptr = (init_fnc_t *) + ((unsigned long )(*init_fnc_ptr) + gd->reloc_off); +#endif /* CONFIG_NEEDS_MANUAL_RELOC */ +if (initcall_run_list (init_sequence_r))hang ();
Signature · 1 line
1.7.9.5
PATCH v9 4/5 64bit initrd start address support
From: David Feng <[email protected]>
--- common/fdt_support.c | 66 ++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 32 deletions(-)
common/fdt_support.c +34 -32
@@ -21,6 +21,34 @@*/ DECLARE_GLOBAL_DATA_PTR ; +/* +* Get cells len in bytes +* if #NNNN-cells property is 2 then len is 8 +* otherwise len is 4 +*/ +static int get_cells_len (void *blob,char *nr_cells_name) +{ +const fdt32_t *cell; + + cell =fdt_getprop (blob,0 , nr_cells_name,NULL ); +if (cell &&fdt32_to_cpu (*cell) ==2 ) +return 8 ; + +return 4 ; +} + +/* +* Write a 4 or 8 byte big endian cell +*/ +static void write_cell (u8 *addr,u64 val,int size) +{ +int shift = (size -1 ) *8 ; +while (size-- >0 ) { + *addr++ = (val >> shift) &0xff ; + shift -=8 ; + } +} +/** * fdt_getprop_u32_default - Find a node and return it's property or a default *
@@ -131,9 +159,9 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)int fdt_initrd (void *fdt,ulong initrd_start,ulong initrd_end,int force) { -int nodeoffset; +int nodeoffset, addr_cell_len;int err, j, total; -fdt32_t tmp; +fdt64_t tmp;const char *path;uint64_t addr, size;
@@ -170,9 +198,11 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)return err; } + addr_cell_len =get_cells_len (fdt,"#address-cells" ); + path =fdt_getprop (fdt, nodeoffset,"linux,initrd-start" ,NULL );if ((path ==NULL ) || force) { - tmp =cpu_to_fdt32 (initrd_start); +write_cell ((u8 *)&tmp, initrd_start, addr_cell_len); err =fdt_setprop (fdt, nodeoffset,"linux,initrd-start" , &tmp,sizeof (tmp));if (err <0 ) {
@@ -181,7 +211,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force) fdt_strerror(err));return err; } - tmp =cpu_to_fdt32 (initrd_end); +write_cell ((u8 *)&tmp, initrd_end, addr_cell_len); err =fdt_setprop (fdt, nodeoffset,"linux,initrd-end" , &tmp,sizeof (tmp));if (err <0 ) {
@@ -343,34 +373,6 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,do_fixup_by_compat (fdt, compat, prop, &tmp,4 , create); } -/* -* Get cells len in bytes -* if #NNNN-cells property is 2 then len is 8 -* otherwise len is 4 -*/ -static int get_cells_len (void *blob,char *nr_cells_name) -{ -const fdt32_t *cell; - - cell =fdt_getprop (blob,0 , nr_cells_name,NULL ); -if (cell &&fdt32_to_cpu (*cell) ==2 ) -return 8 ; - -return 4 ; -} - -/* -* Write a 4 or 8 byte big endian cell -*/ -static void write_cell (u8 *addr,u64 val,int size) -{ -int shift = (size -1 ) *8 ; -while (size-- >0 ) { - *addr++ = (val >> shift) &0xff ; - shift -=8 ; - } -} -#ifdef CONFIG_NR_DRAM_BANKS #define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS#else
Signature · 1 line
1.7.9.5
PATCH v9 5/5 remove compiling warnings
From: David Feng <[email protected]>
--- common/cmd_pxe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
common/cmd_pxe.c +2 -2
@@ -57,7 +57,7 @@ static int format_mac_pxe(char *outbuf, size_t outbuf_len)uchar ethaddr[6 ];if (outbuf_len <21 ) { -printf ("outbuf is too small (%d < 21)\n" , outbuf_len); +printf ("outbuf is too small (%zd < 21)\n" , outbuf_len);return -EINVAL ; }
@@ -100,7 +100,7 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path, path_len = (last_slash - bootfile) +1 ;if (bootfile_path_size < path_len) { -printf ("bootfile_path too small. (%d < %d)\n" , +printf ("bootfile_path too small. (%zd < %zd)\n" , bootfile_path_size, path_len);return -1 ;
Signature · 1 line
1.7.9.5
PATCH v9 2/5 board support of vexpress_aemv8a
In reply to fenghua at phytium.com.cnHi David,
Quoted 8 lines
-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of fenghua at phytium.com.cn
Sent: Friday, September 13, 2013 2:09 PM
To: u-boot at lists.denx.de
Cc: trini at ti.com; David Feng; Wood Scott-B07421
Subject: [U-Boot] [PATCH v9 2/5] board support ofvexpress_aemv8a
Quoted 5 lines
From: David Feng <[email protected]>
Signed-off-by David Feng <[email protected]> and Sharma Bhupesh<[email protected]>
---
I would prefer that you add the S-o-b's in the following way (suggested in submitting patch guidelines) and also correct my S-o-b:
[snip..]
Regards,
Bhupesh
v9 cover arm64 patch
In reply to fenghua at phytium.com.cnDear fenghua at phytium.com.cn,
Quoted 8 lines · In message <[email protected]> you wrote:
From: David Feng <[email protected]>
The porting has been merged with arm architecture. Most architecture codes are placed in
arch/arm/cpu/armv8directory. Generic board is also supported after a few bugs are fixed. u-boot could be running at EL1 or EL2.
Quoted 6 lines
Changes for v8:
- add Signed-off-by information to patch "board support ofvexpress_aemv8a" which SMC91111 support is integrated from Sharma Bhupesh's patch.
- adjustpt_regsstruct and add exception state preservation inexception.S.
what exactly are the changes for V9 ?
Best regards,
Wolfgang Denk
Signature · 8 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Remember thee Ay, thou poor ghost while memory holds a seat In this distracted globe. Remember thee! Yea, from the table of my memory I'll wipe away all trivial fond records, All saws of books, all forms, all pressures past, That youth and observation copied there. Hamlet, I : v : 95 William Shakespeare
v9 cover arm64 patch
Quoted 21 lines
-----????-----
???: "Wolfgang Denk" <[email protected]>
????: 2013?9?14? ???
???: fenghua at phytium.com.cn
??: u-boot at lists.denx.de, trini at ti.com, albert.u.boot at aribaud.net, scottwood at freescale.com ??: Re: [PATCH v9 0/5] arm64 patchDear fenghua at phytium.com.cn,
Quoted 8 lines · In message <[email protected]> you wrote:
From: David Feng <[email protected]>
The porting has been merged with arm architecture. Most architecture codes are placed in
arch/arm/cpu/armv8directory. Generic board is also supported after a few bugs are fixed. u-boot could be running at EL1 or EL2.
Quoted 9 lines
Quoted 6 lines
Changes for v8:
- add Signed-off-by information to patch "board support ofvexpress_aemv8a" which SMC91111 support is integrated from Sharma Bhupesh's patch.
- adjustpt_regsstruct and add exception state preservation inexception.S.what exactly are the changes for V9 ?
The number is incorrect, the changes for v8 is actually for v9, I will correct it in the next.
Quoted 13 lines
Best regards,
Wolfgang Denk
Signature · 8 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Remember thee Ay, thou poor ghost while memory holds a seat In this distracted globe. Remember thee! Yea, from the table of my memory I'll wipe away all trivial fond records, All saws of books, all forms, all pressures past, That youth and observation copied there. Hamlet, I : v : 95 William Shakespeare