arm64 patch
Subsystems (2)
v5 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.
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
David Feng (4):
core support of arm64
board support of arm64
generic board patch of manual reloc and zero gd_t 64bit initrd start address support
arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++ arch/arm/cpu/armv8/cache.S | 145 ++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 ++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 +++ arch/arm/cpu/armv8/cpu.c | 68 +++++ arch/arm/cpu/armv8/crt0.S | 130 +++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++ arch/arm/cpu/armv8/relocate.S | 71 +++++ arch/arm/cpu/armv8/start.S | 200 ++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 +++++++ arch/arm/cpu/armv8/tlb.S | 38 +++ arch/arm/cpu/armv8/u-boot.lds | 83 ++++++ arch/arm/include/asm/arch-armv8/armv8.h | 44 ++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 ++ arch/arm/include/asm/arch-armv8/mmu.h | 117 ++++++++ arch/arm/include/asm/byteorder.h | 12 + arch/arm/include/asm/config.h | 10 + arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 ++ arch/arm/include/asm/posix_types.h | 31 +++ arch/arm/include/asm/proc-armv/ptrace.h | 38 +++ arch/arm/include/asm/proc-armv/system.h | 58 +++- arch/arm/include/asm/types.h | 14 + arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 + arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ board/armltd/dts/vexpress64.dts | 439 +++++++++++++++++++++++++++++++ board/armltd/vexpress64/Makefile | 43 +++ board/armltd/vexpress64/vexpress64.c | 79 ++++++ boards.cfg | 1 + common/board_f.c | 19 +- common/board_r.c | 17 ++ common/fdt_support.c | 66 ++--- common/image.c | 1 + doc/README.armv8 | 14 + examples/standalone/stubs.c | 15 ++ include/configs/vexpress_aemv8a.h | 203 ++++++++++++++ include/image.h | 1 + 43 files changed, 2816 insertions(+), 46 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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/armv8.h 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 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
v5 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.
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
David Feng (4):
core support of arm64
board support of arm64
generic board patch of manual reloc and zero gd_t 64bit initrd start address support
arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++ arch/arm/cpu/armv8/cache.S | 145 ++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 ++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 +++ arch/arm/cpu/armv8/cpu.c | 68 +++++ arch/arm/cpu/armv8/crt0.S | 130 +++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++ arch/arm/cpu/armv8/relocate.S | 71 +++++ arch/arm/cpu/armv8/start.S | 200 ++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 +++++++ arch/arm/cpu/armv8/tlb.S | 38 +++ arch/arm/cpu/armv8/u-boot.lds | 83 ++++++ arch/arm/include/asm/arch-armv8/armv8.h | 44 ++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 ++ arch/arm/include/asm/arch-armv8/mmu.h | 117 ++++++++ arch/arm/include/asm/byteorder.h | 12 + arch/arm/include/asm/config.h | 10 + arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 ++ arch/arm/include/asm/posix_types.h | 31 +++ arch/arm/include/asm/proc-armv/ptrace.h | 38 +++ arch/arm/include/asm/proc-armv/system.h | 58 +++- arch/arm/include/asm/types.h | 14 + arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 + arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ board/armltd/dts/vexpress64.dts | 439 +++++++++++++++++++++++++++++++ board/armltd/vexpress64/Makefile | 43 +++ board/armltd/vexpress64/vexpress64.c | 79 ++++++ boards.cfg | 1 + common/board_f.c | 19 +- common/board_r.c | 17 ++ common/fdt_support.c | 66 ++--- common/image.c | 1 + doc/README.armv8 | 14 + examples/standalone/stubs.c | 15 ++ include/configs/vexpress_aemv8a.h | 203 ++++++++++++++ include/image.h | 1 + 43 files changed, 2816 insertions(+), 46 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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/armv8.h 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 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 v5 1/4 core support of arm64
In reply to fenghua at phytium.com.cnFrom: David Feng <[email protected]>
---
Changeds for v4:
- 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
arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++++ arch/arm/cpu/armv8/cache.S | 145 +++++++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 ++++ arch/arm/cpu/armv8/cpu.c | 68 ++++++++ arch/arm/cpu/armv8/crt0.S | 130 ++++++++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++++++ arch/arm/cpu/armv8/relocate.S | 71 ++++++++ arch/arm/cpu/armv8/start.S | 200 +++++++++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 ++++++++++ arch/arm/cpu/armv8/tlb.S | 38 ++++ arch/arm/cpu/armv8/u-boot.lds | 83 +++++++++ arch/arm/include/asm/arch-armv8/armv8.h | 44 +++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 +++ arch/arm/include/asm/arch-armv8/mmu.h | 117 +++++++++++++ arch/arm/include/asm/byteorder.h | 12 ++ arch/arm/include/asm/config.h | 10 ++ arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 +++ arch/arm/include/asm/posix_types.h | 31 ++++ arch/arm/include/asm/proc-armv/ptrace.h | 38 ++++ arch/arm/include/asm/proc-armv/system.h | 58 +++++- arch/arm/include/asm/types.h | 14 ++ arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 ++ arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ common/image.c | 1 + doc/README.armv8 | 14 ++ examples/standalone/stubs.c | 15 ++ include/image.h | 1 + 35 files changed, 1987 insertions(+), 8 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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/armv8.h 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 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 +56 -0
56 lines not on this page · raw message
arch/arm/cpu/armv8/cache.S new file +145 -0
145 lines not on this page · raw message
arch/arm/cpu/armv8/cache_v8.c new file +291 -0
291 lines not on this page · raw message
arch/arm/cpu/armv8/config.mk new file +31 -0
@@ -0,0 +1,31 @@ +# +# Copyright (c) 2013 FengHua <[email protected]> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +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 +68 -0
68 lines not on this page · raw message
arch/arm/cpu/armv8/crt0.S new file +130 -0
130 lines not on this page · raw message
arch/arm/cpu/armv8/exceptions.S new file +182 -0
182 lines not on this page · raw message
arch/arm/cpu/armv8/interrupts.c new file +116 -0
116 lines not on this page · raw message
arch/arm/cpu/armv8/relocate.S new file +71 -0
71 lines not on this page · raw message
arch/arm/cpu/armv8/start.S new file +200 -0
200 lines not on this page · raw message
arch/arm/cpu/armv8/timer.c new file +95 -0
95 lines not on this page · raw message
arch/arm/cpu/armv8/tlb.S new file +38 -0
@@ -0,0 +1,38 @@ +/* + * Copyright (c) 2013 David Feng <[email protected]> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <asm-offsets.h> +#include <config.h> +#include <version.h> +#include <linux/linkage.h> + +/* + * void __asm_invalidate_tlb_all(void) + * + * invalidate all tlb entries. + */ +ENTRY(__asm_invalidate_tlb_all) + tlbi alle2 + dsb sy + isb + ret +ENDPROC(__asm_invalidate_tlb_all)
arch/arm/cpu/armv8/u-boot.lds new file +83 -0
83 lines not on this page · raw message
arch/arm/include/asm/arch-armv8/armv8.h new file +44 -0
44 lines not on this page · raw message
arch/arm/include/asm/arch-armv8/gpio.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright (c) 2013 David Feng <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#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 +117 -0
117 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 +#ifndef CONFIG_ARMV8 +#ifdef __ARMEB__#include <linux/byteorder/big_endian.h> #else #include <linux/byteorder/little_endian.h> #endif +#else /* CONFIG_ARMV8 */ + +#ifdef __AARCH64EB__ +#include <linux/byteorder/big_endian.h> +#else +#include <linux/byteorder/little_endian.h> +#endif + +#endif /* CONFIG_ARMV8 */ +#endif
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") +#ifndef CONFIG_ARMV8 +#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") +#else +#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18") +#endif #endif /* __ASM_GBL_DATA_H */
arch/arm/include/asm/io.h +6 -6
@@ -75,42 +75,42 @@ 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 +26 -0
@@ -54,5 +54,31 @@ bcs 1b .endm +#ifdef CONFIG_ARMV8 +/* +* Register aliases. +*/ +lr .req x30 // link register + +/* + * Stack pushing/popping (register pairs only). + * Equivalent to store decrement before, + * load increment after. + */ +.macro push, xreg1, xreg2 + stp \xreg1, \xreg2, [sp, #-16]! +.endm + +.macro pop, xreg1, xreg2 + ldp \xreg1, \xreg2, [sp], #16 +.endm + +.macro ventry label + .align 7 + b \label +.endm + +#endif /* CONFIG_ARMV8 */ +#endif /* __ASSEMBLY__ */ #endif /* __ASM_ARM_MACRO_H__ */
arch/arm/include/asm/posix_types.h +31 -0
@@ -19,6 +19,8 @@* assume GCC is being used. */ +#ifndef CONFIG_ARMV8 +typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;
@@ -44,6 +46,35 @@ typedef unsigned int __kernel_gid32_t;typedef unsigned short __kernel_old_uid_t ;typedef unsigned short __kernel_old_gid_t ; +#else /* CONFIG_ARMV8 */ + +typedef unsigned short __kernel_dev_t ; +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __kernel_gid_t ; +typedef unsigned long __kernel_size_t ; +typedef long __kernel_ssize_t ; +typedef long __kernel_ptrdiff_t ; +typedef long __kernel_time_t ; +typedef long __kernel_suseconds_t ; +typedef long __kernel_clock_t ; +typedef long __kernel_daddr_t ; +typedef char *__kernel_caddr_t ; +typedef unsigned short __kernel_uid16_t ; +typedef unsigned short __kernel_gid16_t ; +typedef unsigned int __kernel_uid32_t ; +typedef unsigned int __kernel_gid32_t ; + +typedef __kernel_uid_t __kernel_old_uid_t ; +typedef __kernel_gid_t __kernel_old_gid_t ; + +#endif /* CONFIG_ARMV8 */ +#ifdef __GNUC__typedef long long __kernel_loff_t ;#endif
arch/arm/include/asm/proc-armv/ptrace.h +38 -0
@@ -12,6 +12,8 @@#include <linux/config.h> +#ifndef CONFIG_ARMV8 +#define USR26_MODE 0x00#define FIQ26_MODE 0x01#define IRQ26_MODE 0x02
@@ -106,4 +108,40 @@ static inline int valid_user_regs(struct pt_regs *regs)#endif /* __ASSEMBLY__ */ +#else /* CONFIG_ARMV8 */ + +#define PCMASK 0 + +#define S_X0 (0)/* offsetof(struct pt_regs, regs[0]) */ +#define S_X1 (8)/* offsetof(struct pt_regs, regs[1]) */ +#define S_X2 (16)/* offsetof(struct pt_regs, regs[2]) */ +#define S_X3 (24/* offsetof(struct pt_regs, regs[3]) */ +#define S_X4 (32)/* offsetof(struct pt_regs, regs[4]) */ +#define S_X5 (40)/* offsetof(struct pt_regs, regs[5]) */ +#define S_X6 (48)/* offsetof(struct pt_regs, regs[6]) */ +#define S_X7 (56)/* offsetof(struct pt_regs, regs[7]) */ +#define S_LR (240)/* offsetof(struct pt_regs, regs[30]) */ +#define S_SP (248)/* offsetof(struct pt_regs, sp) */ +#define S_PC (256)/* offsetof(struct pt_regs, pc) */ +#define S_PSTATE (264)/* offsetof(struct pt_regs, pstate) */ +#define S_FRAME_SIZE (272)/* sizeof(struct pt_regs) */ + +#ifndef __ASSEMBLY__ + +/* +* This struct defines the way the registers are stored on the stack during an +* exception. Note that sizeof(struct pt_regs) has to be a multiple of 16 (for +* stack alignment). struct user_pt_regs must form a prefix of struct pt_regs. +*/ +struct pt_regs { +u64 regs[31 ]; +u64 sp; +u64 pc; +u64 pstate; +}; + +#endif /* __ASSEMBLY__ */ + +#endif /* CONFIG_ARMV8 */ +#endif
arch/arm/include/asm/proc-armv/system.h +57 -1
70 lines not on this page · raw message
arch/arm/include/asm/types.h +14 -0
@@ -18,8 +18,13 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ;#if defined(__GNUC__) +#ifndef CONFIG_ARMV8 __extension__typedef __signed__ long long __s64 ; __extension__typedef unsigned long long __u64 ; +#else /* CONFIG_ARMV8 */ +__extension__typedef __signed__ long __s64 ; +__extension__typedef unsigned long __u64 ; +#endif /* CONFIG_ARMV8 */ #endif /*
@@ -36,10 +41,19 @@ typedef unsigned short u16;typedef signed int s32 ;typedef unsigned int u32 ; +#ifndef CONFIG_ARMV8 typedef signed long long s64 ;typedef unsigned long long u64 ; +#else /* CONFIG_ARMV8 */ +typedef signed long s64 ; +typedef unsigned long u64 ; +#endif /* CONFIG_ARMV8 */ +#ifndef CONFIG_ARMV8 #define BITS_PER_LONG 32 +#else /* CONFIG_ARMV8 */ +#define BITS_PER_LONG 64 +#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 +14 -0
@@ -8,6 +8,8 @@/* * Select endianness */ +#ifndef CONFIG_ARMV8 +#ifndef __ARMEB__#define get_unaligned __get_unaligned_le#define put_unaligned __put_unaligned_le
@@ -16,4 +18,16 @@#define put_unaligned __put_unaligned_be#endif +#else /* CONFIG_ARMV8 */ + +#ifndef __AARCH64EB__ +#define get_unaligned __get_unaligned_le +#define put_unaligned __put_unaligned_le +#else +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be +#endif + +#endif /* CONFIG_ARMV8 */ +#endif /* _ASM_ARM_UNALIGNED_H */
arch/arm/lib/Makefile +8 -0
@@ -10,6 +10,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(ARCH).o LIBGCC = $(obj)libgcc.o +ifndef CONFIG_ARMV8 GLSOBJS += _ashldi3.o GLSOBJS += _ashrdi3.o GLSOBJS += _divsi3.o
@@ -21,9 +22,12 @@ GLSOBJS += _umodsi3.o GLCOBJS += div0.o SOBJS-y += crt0.o +endif ifndef CONFIG_SPL_BUILD +ifndef CONFIG_ARMV8 SOBJS-y += relocate.o +endif ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o endif
@@ -38,11 +42,15 @@ else COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o endif +ifndef CONFIG_ARMV8 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 +18 -0
@@ -344,7 +344,11 @@ void board_init_f(ulong bootflag)#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))/* reserve TLB table */ +#ifndef CONFIG_ARMV8 gd->arch.tlb_size =4096 *4 ; +#else + gd->arch.tlb_size =0x10000 ; +#endif addr -= gd->arch.tlb_size;/* round down to next 64 kB limit */
@@ -419,6 +423,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 +436,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 +532,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,7 @@ static void boot_prep_linux(bootm_headers_t *images)/* Subcommand: GO */ static void boot_jump_linux (bootm_headers_t *images,int flag) { +#ifndef CONFIG_ARMV8 unsigned long machid = gd->bd->bi_arch_number;char *s;void (*kernel_entry)(int zero,int arch,uint params);
@@ -248,6 +249,21 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)if (!fake)kernel_entry (0 , machid, r2); +#else +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); +#endif }/* Main Entry point for arm bootm implementation
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 +14 -0
@@ -0,0 +1,14 @@ +Notes: + +1. Currenly, u-boot running at EL2. + +2. GOT is used to relocate u-boot and CONFIG_NEEDS_MANUAL_RELOC is needed. + +3. Fdt should be placed in 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. + +4. Generic board is supported. + +TODO: + +1. So much print info are formated with %08lx, maybe it should be modified to %016lx.
examples/standalone/stubs.c +15 -0
@@ -39,6 +39,7 @@ gd_t *global_data; " bctr\n" \ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");#elif defined(CONFIG_ARM ) +#ifndef CONFIG_ARMV8 /* * r8 holds the pointer to the global_data, ip is a call-clobbered * register
@@ -50,6 +51,20 @@ 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"); +#else +/* +* 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 *)) : "x19"); +#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 v5 1/4 core support of arm64
Quoted 9 lines · fenghua at phytium.com.cn
From: David Feng <[email protected]>
Signed-off-by David Feng <[email protected]>---
Changeds for v4:
- Replace__ARMEB__with__AARCH64EB__inbyteorder.handunaligned.h, gcc for aarch64 use__AARCH64EB__and__AARCH64EL__to identify endian.
- Some modification to README.armv8
Quoted 14 lines
arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++++ arch/arm/cpu/armv8/cache.S | 145 +++++++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 ++++ arch/arm/cpu/armv8/cpu.c | 68 ++++++++ arch/arm/cpu/armv8/crt0.S | 130 ++++++++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++++++ arch/arm/cpu/armv8/relocate.S | 71 ++++++++ arch/arm/cpu/armv8/start.S | 200 +++++++++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 ++++++++++ arch/arm/cpu/armv8/tlb.S | 38 ++++ arch/arm/cpu/armv8/u-boot.lds | 83 +++++++++
Subject says "arm64", files say "armv8".
Some of these, such as relocate.S, probably are not going to be armv8-specific but just arm64-specific.
Quoted 45 lines
arch/arm/include/asm/arch-armv8/armv8.h | 44 +++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 +++ arch/arm/include/asm/arch-armv8/mmu.h | 117 +++++++++++++ arch/arm/include/asm/byteorder.h | 12 ++ arch/arm/include/asm/config.h | 10 ++ arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 +++ arch/arm/include/asm/posix_types.h | 31 ++++ arch/arm/include/asm/proc-armv/ptrace.h | 38 ++++ arch/arm/include/asm/proc-armv/system.h | 58 +++++- arch/arm/include/asm/types.h | 14 ++ arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 ++ arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ common/image.c | 1 + doc/README.armv8 | 14 ++ examples/standalone/stubs.c | 15 ++ include/image.h | 1 + 35 files changed, 1987 insertions(+), 8 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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/armv8.h 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 doc/README.armv8arch/arm/config.mk +0
-0
arch/arm/config.mk endif · line 79
Quoted 6 lines
arch/arm/config.mk +2
-0@@ -74,7 +74,9 @@ endif endif # needed for relocation +ifndef CONFIG_ARMV8 LDFLAGS_u-boot += -pie +endif
CONFIG_ARM64 (until we fix this, of course)
arch/arm/config.mk endif · line 104
Quoted 11 lines
arch/arm/config.mk +2
-0# # 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
ARM64, though I've got a patch coming that will make the check work with arm64.
Likewise elsewhere -- most if not all of the CONFIG_ARMV8 uses should be CONFIG_ARM64.
arch/arm/config.mk
Quoted 9 lines
arch/arm/config.mk +9
-0+/* + * void __asm_flush_dcache_level(level) + * + * clean and invalidate one level cache. + * + * x0: cache level + * x1~x9: clobbered + */ +ENTRY(__asm_flush_dcache_level)
Why the leading underscores?
arch/arm/config.mk
Quoted 8 lines
arch/arm/config.mk +8
-0+/* to activate the MMU we need to set up virtual memory */ +static inline void mmu_setup(void) +{ + int i, j; + bd_t *bd = gd->bd; + static int table_initialized = 0; + + if (!table_initialized) {
Instead of this, have separate mmu_setup() and mmu_enable().
arch/arm/config.mk
Quoted 13 lines
arch/arm/config.mk +13
-0+ /* Setup an identity-mapping for all spaces */ + for (i = 0; i < (PAGE_SIZE >> 3); i++) + set_pgtable_section(i, MT_DEVICE_nGnRnE); + + /* Setup an identity-mapping for all RAM space */ + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + debug("%s: bank: %d\n", __func__, i); + for (j = bd->bi_dram[i].start >> SECTION_SHIFT; + j < (bd->bi_dram[i].start + bd->bi_dram[i].size) >> SECTION_SHIFT; + j++) { + set_pgtable_section(i, MT_NORMAL); + } + }
This is odd alignment... Why are the second and third instances of "j" lined up with "bd->..." rather than with the first "j"?
arch/arm/config.mk
Quoted 3 lines
arch/arm/config.mk +3
-0+#endif /* CONFIG_SYS_DCACHE_OFF */ + +#ifndef CONFIG_SYS_ICACHE_OFF
This isn't new to this patch, but I'd like to point out that the whole "CONFIG" versus "CONFIG_SYS" thing is widely misused and should probably just go away when we kconfigize.
Quoted 16 lines
arch/arm/config.mk +16
-0+/* + * Stub implementations for outer cache operations + */ +void __v8_outer_cache_enable(void) {} +void v8_outer_cache_enable(void) + __attribute__((weak, alias("__v8_outer_cache_enable"))); + +void __v8_outer_cache_disable(void) {} +void v8_outer_cache_disable(void) + __attribute__((weak, alias("__v8_outer_cache_disable"))); + +void __v8_outer_cache_flush_all(void) {} +void v8_outer_cache_flush_all(void) + __attribute__((weak, alias("__v8_outer_cache_flush_all"))); + +void __v8_outer_cache_inval_all(void) {}
arch/arm/config.mk
Quoted 10 lines
arch/arm/config.mk +10
-0+void v8_outer_cache_inval_all(void) + __attribute__((weak, alias("__v8_outer_cache_inval_all"))); + +void __v8_outer_cache_flush_range(u64 start, u64 end) {} +void v8_outer_cache_flush_range(u64 start, u64 end) + __attribute__((weak, alias("__v8_outer_cache_flush_range"))); + +void __v8_outer_cache_inval_range(u64 start, u64 end) {} +void v8_outer_cache_inval_range(u64 start, u64 end) + __attribute__((weak, alias("__v8_outer_cache_inval_range")));
What level do you anticipate these being overriden at? Individual chips? Why?
Quoted 18 lines
arch/arm/cpu/armv8/config.mk new file +12
-0@@ -0,0 +1,31 @@ +# +# Copyright (c) 2013 FengHua <[email protected]> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful,
arch/arm/cpu/armv8/config.mk line 22
Quoted 10 lines
arch/arm/cpu/armv8/config.mk new file +10
-0+# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +PLATFORM_RELFLAGS += -fno-common -ffixed-x18
Is -ffixed-x18 necessary, or will GCC do the right thing when it sees that x18 has been declared as a register variable?
Quoted 17 lines
arch/arm/cpu/armv8/exceptions.S new file +11
-0@@ -0,0 +1,182 @@ +/* + * Copyright (c) 2013 David Feng <[email protected]> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + *
arch/arm/cpu/armv8/exceptions.S line 21
Quoted 10 lines
arch/arm/cpu/armv8/exceptions.S new file +10
-0+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */
I'm skeptical that you actually rewrote this from scratch (e.g. same registers are used in some places where there's no reason to pick any particular register, overall structure very similar, etc). It looks like you just changed the comments and names up a bit.
Any code that you did not write *from scratch* must be identified, with copyrights retained, and can only be used if it can be licensed GPLv2+ (unless Tom/Wolfgang say they'll accept v2-only code from Linux in this case).
Quoted 5 lines
arch/arm/cpu/armv8/exceptions.S new file +5
-0+void show_regs (struct pt_regs *regs) +{ + int i; + + printf("PC is at %lx\n", regs->pc);
arch/arm/cpu/armv8/exceptions.S line 36
Quoted 10 lines
arch/arm/cpu/armv8/exceptions.S new file +10
-0+ printf("LR is at %lx\n", regs->regs[30]); + printf("PSTATE: %08lx\n", regs->pstate); + printf("SP : %lx\n", regs->sp); + for (i = 29; i >= 0; i--) { + printf("x%-2d: %016lx ", i, regs->regs[i]); + if (i % 2 == 0) + printf("\n"); + } + printf("\n"); +}
This is almost identical to the Linux code, yet I don't see any attribution (and the license is incompatible).
arch/arm/cpu/armv8/relocate.S line 7
Quoted 13 lines
arch/arm/cpu/armv8/relocate.S new file +7
-0@@ -0,0 +1,71 @@ +/* + * relocate - common relocation function for ARM64 U-Boot + * + * Copyright (c) 2013 David Feng <[email protected]> + * + * See file CREDITS for list of people who contributed to this + * project.
This is obviously derived from arch/arm/lib/relocate.S, but I see no attribution or retained copyright notice.
arch/arm/cpu/armv8/relocate.S line 17
Quoted 10 lines
arch/arm/cpu/armv8/relocate.S new file +10
-0+#ifdef __ASSEMBLY__ +#define _AC(X,Y) X +#define _AT(T,X) X +#else +#define __AC(X,Y) (X##Y) +#define _AC(X,Y) __AC(X,Y) +#define _AT(T,X) ((T)(X)) +#endif + +#define UL(x) _AC(x, UL)
This needs a code comment, better names, and should be moved to a more common place.
Where do you use _AT?
Quoted 16 lines
arch/arm/include/asm/macro.h +8
-0@@ -54,5 +54,31 @@ bcs 1b .endm +#ifdef CONFIG_ARMV8 +/* +* Register aliases. +*/ +lr .req x30 // link register + +/* +* Stack pushing/popping (register pairs only).
arch/arm/include/asm/macro.h line 74
Quoted 10 lines
arch/arm/include/asm/macro.h +10
-0+* Equivalent to store decrement before, +* load increment after. +*/ +.macro push, xreg1, xreg2 + stp \xreg1, \xreg2, [sp, #-16]! +.endm + +.macro pop, xreg1, xreg2 + ldp \xreg1, \xreg2, [sp], #16 +.endm
More uncredited and license-incompatible Linux copying (the macros themselves might not be copyrightable, but the comments are...).
arch/arm/include/asm/posix_types.h line 22
Quoted 9 lines
arch/arm/include/asm/posix_types.h +1
-0@@ -19,6 +19,8 @@* assume GCC is being used. */ +#ifndef CONFIG_ARMV8
You need to include config.h first. For example, the warnings in lib/hashtable.c are due to picking up the 32-bit definition of __kernel_size_t.
You should be considering these warnings to be errors.
Quoted 25 lines
arch/arm/include/asm/posix_types.h +18
-0typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;@@ -44,6 +46,35 @@ typedef unsigned int __kernel_gid32_t;typedef unsigned short __kernel_old_uid_t ;typedef unsigned short __kernel_old_gid_t ; +#else /* CONFIG_ARMV8 */ + +typedef unsigned short __kernel_dev_t ; +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __kernel_gid_t ; +typedef unsigned long __kernel_size_t ; +typedef long __kernel_ssize_t ; +typedef long __kernel_ptrdiff_t ; +typedef long __kernel_time_t ; +typedef long __kernel_suseconds_t ; +typedef long __kernel_clock_t ; +typedef long __kernel_daddr_t ;
arch/arm/include/asm/posix_types.h typedef unsigned int __kernel_gid32_t; · line 76
Quoted 10 lines
arch/arm/include/asm/posix_types.h +10
-0+typedef char *__kernel_caddr_t ; +typedef unsigned short __kernel_uid16_t ; +typedef unsigned short __kernel_gid16_t ; +typedef unsigned int __kernel_uid32_t ; +typedef unsigned int __kernel_gid32_t ; + +typedef __kernel_uid_t __kernel_old_uid_t ; +typedef __kernel_gid_t __kernel_old_gid_t ; + +#endif /* CONFIG_ARMV8 */
Most of these types do not need to be different between 32 and 64 bit (FWIW, I find it pretty obnoxious that GCC insists on "unsigned int" for %zu on 32-bit, rather than "unsigned long").
Also please use positive logic for if/else -- that is, use "ifdef/else/endif" rather than "ifndef/else/endif".
Quoted 6 lines
iff --git
a/arch/arm/include/asm/types.hb/arch/arm/include/asm/types.hindex 71dc049..128dd3e 100644arch/arm/include/asm/types.h +0
-0@@ -18,8 +18,13 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ;
arch/arm/include/asm/types.h typedef __signed__ int __s32; · line 28
Quoted 10 lines
arch/arm/include/asm/types.h +5
-0#if defined(__GNUC__) +#ifndef CONFIG_ARMV8 __extension__typedef __signed__ long long __s64 ; __extension__typedef unsigned long long __u64 ; +#else /* CONFIG_ARMV8 */ +__extension__typedef __signed__ long __s64 ; +__extension__typedef unsigned long __u64 ; +#endif /* CONFIG_ARMV8 */ #endif
Please just always use long long here. It makes it easier to use u64 in printf().
Quoted 14 lines
arch/arm/include/asm/unaligned.h +2
-0@@ -8,6 +8,8 @@/* * Select endianness */ +#ifndef CONFIG_ARMV8 +#ifndef __ARMEB__#define get_unaligned __get_unaligned_le#define put_unaligned __put_unaligned_le
arch/arm/include/asm/unaligned.h line 23
Quoted 6 lines
arch/arm/include/asm/unaligned.h +3
-0@@ -16,4 +18,16 @@#define put_unaligned __put_unaligned_be#endif +#else /* CONFIG_ARMV8 */ + +#ifndef __AARCH64EB__
Can you use __BYTE_ORDER__ instead so that 32/64 becomes irrelevant? Likewise elsewhere.
examples/standalone/stubs.c gd_t *global_data; · line 42
Quoted 9 lines
examples/standalone/stubs.c +1
-0@@ -39,6 +39,7 @@ gd_t *global_data; " bctr\n" \ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");#elif defined(CONFIG_ARM ) +#ifndef CONFIG_ARMV8
CONFIG_ARM64, and use positive logic for if/else
Quoted 11 lines
examples/standalone/stubs.c +4
-0/* * r8 holds the pointer to the global_data, ip is a call-clobbered * register @@ -50,6 +51,20 @@ 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"); +#else +/* +* x18 holds the pointer to the global_data, x9 is a call-clobbered +* register
examples/standalone/stubs.c gd_t *global_data; · line 67
Quoted 10 lines
examples/standalone/stubs.c +10
-0+*/ +#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 *)) : "x19"); +#endif
Clobber should be x9, not x19.
-Scott
PATCH v5 1/4 core support of arm64
Fisrt, thank scott for checking the patch.
Quoted 106 lines
-----????-----
???: "Scott Wood" <[email protected]> ????: 2013?9?7? ???
???: fenghua at phytium.com.cn
??: u-boot at lists.denx.de, trini at ti.com ??: Re: [U-Boot] [PATCH v5 1/4] core support of arm64Quoted 9 lines · fenghua at phytium.com.cn
From: David Feng <[email protected]>
Signed-off-by David Feng <[email protected]>---
Changeds for v4:
- Replace__ARMEB__with__AARCH64EB__inbyteorder.handunaligned.h, gcc for aarch64 use__AARCH64EB__and__AARCH64EL__to identify endian.
- Some modification to README.armv8Quoted 14 lines
arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++++ arch/arm/cpu/armv8/cache.S | 145 +++++++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 ++++ arch/arm/cpu/armv8/cpu.c | 68 ++++++++ arch/arm/cpu/armv8/crt0.S | 130 ++++++++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++++++ arch/arm/cpu/armv8/relocate.S | 71 ++++++++ arch/arm/cpu/armv8/start.S | 200 +++++++++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 ++++++++++ arch/arm/cpu/armv8/tlb.S | 38 ++++ arch/arm/cpu/armv8/u-boot.lds | 83 +++++++++Subject says "arm64", files say "armv8".
Some of these, such as
relocate.S, probably are not going to be armv8-specific but just arm64-specific.Quoted 45 lines
arch/arm/include/asm/arch-armv8/armv8.h | 44 +++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 +++ arch/arm/include/asm/arch-armv8/mmu.h | 117 +++++++++++++ arch/arm/include/asm/byteorder.h | 12 ++ arch/arm/include/asm/config.h | 10 ++ arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 +++ arch/arm/include/asm/posix_types.h | 31 ++++ arch/arm/include/asm/proc-armv/ptrace.h | 38 ++++ arch/arm/include/asm/proc-armv/system.h | 58 +++++- arch/arm/include/asm/types.h | 14 ++ arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 ++ arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ common/image.c | 1 + doc/README.armv8 | 14 ++ examples/standalone/stubs.c | 15 ++ include/image.h | 1 + 35 files changed, 1987 insertions(+), 8 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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/armv8.h 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 doc/README.armv8arch/arm/config.mk +0
-0arch/arm/config.mk endif · line 79
Quoted 6 lines
arch/arm/config.mk +2
-0@@ -74,7 +74,9 @@ endif endif # needed for relocation +ifndef CONFIG_ARMV8 LDFLAGS_u-boot += -pie +endif
CONFIG_ARM64(until we fix this, of course)arch/arm/config.mk endif · line 104
Quoted 11 lines
arch/arm/config.mk +2
-0# # 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 +endifARM64, though I've got a patch coming that will make the check work with arm64.
Quoted 3 lines
Likewise elsewhere -- most if not all of the
CONFIG_ARMV8uses should beCONFIG_ARM64.
Actually, the naming is so confusing. The directory's name is armv8,
but it only represents aarch64 here. So, whether CONFIG_ARMV8 or CONFIG_ARM64 should be used is difficult to make decision.
Quoted 12 lines
arch/arm/config.mk
Quoted 9 lines
arch/arm/config.mk +9
-0+/* + * void __asm_flush_dcache_level(level) + * + * clean and invalidate one level cache. + * + * x0: cache level + * x1~x9: clobbered + */ +ENTRY(__asm_flush_dcache_level)Why the leading underscores?
Is there any convention with underscores? I just know the underscore represent that the function is best not be called directly.
Quoted 11 lines
arch/arm/config.mk
Quoted 8 lines
arch/arm/config.mk +8
-0+/* to activate the MMU we need to set up virtual memory */ +static inline void mmu_setup(void) +{ + int i, j; + bd_t *bd = gd->bd; + static int table_initialized = 0; + + if (!table_initialized) {Instead of this, have separate
mmu_setup()andmmu_enable().
Quoted 16 lines
arch/arm/config.mk
Quoted 13 lines
arch/arm/config.mk +13
-0+ /* Setup an identity-mapping for all spaces */ + for (i = 0; i < (PAGE_SIZE >> 3); i++) + set_pgtable_section(i, MT_DEVICE_nGnRnE); + + /* Setup an identity-mapping for all RAM space */ + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + debug("%s: bank: %d\n", __func__, i); + for (j = bd->bi_dram[i].start >> SECTION_SHIFT; + j < (bd->bi_dram[i].start + bd->bi_dram[i].size) >> SECTION_SHIFT; + j++) { + set_pgtable_section(i, MT_NORMAL); + } + }This is odd alignment... Why are the second and third instances of "j" lined up with "bd->..." rather than with the first "j"?
It's a bug, I will fix it.
Quoted 30 lines
arch/arm/config.mk
Quoted 4 lines
arch/arm/config.mk +3
-0+#endif /* CONFIG_SYS_DCACHE_OFF */ + +#ifndef CONFIG_SYS_ICACHE_OFFThis isn't new to this patch, but I'd like to point out that the whole "CONFIG" versus "
CONFIG_SYS" thing is widely misused and should probably just go away when we kconfigize.Quoted 21 lines
arch/arm/config.mk +21
-0+/* + * Stub implementations for outer cache operations + */ +void __v8_outer_cache_enable(void) {} +void v8_outer_cache_enable(void) + __attribute__((weak, alias("__v8_outer_cache_enable"))); + +void __v8_outer_cache_disable(void) {} +void v8_outer_cache_disable(void) + __attribute__((weak, alias("__v8_outer_cache_disable"))); + +void __v8_outer_cache_flush_all(void) {} +void v8_outer_cache_flush_all(void) + __attribute__((weak, alias("__v8_outer_cache_flush_all"))); + +void __v8_outer_cache_inval_all(void) {} +void v8_outer_cache_inval_all(void) + __attribute__((weak, alias("__v8_outer_cache_inval_all"))); + +void __v8_outer_cache_flush_range(u64 start, u64 end) {} +void v8_outer_cache_flush_range(u64 start, u64 end)
Quoted 8 lines
arch/arm/config.mk
Quoted 5 lines
arch/arm/config.mk +5
-0+ __attribute__((weak, alias("__v8_outer_cache_flush_range"))); + +void __v8_outer_cache_inval_range(u64 start, u64 end) {} +void v8_outer_cache_inval_range(u64 start, u64 end) + __attribute__((weak, alias("__v8_outer_cache_inval_range")));What level do you anticipate these being overriden at? Individual chips? Why?
It's socs. I don't know how the armv8 processor would like to be. It's just derived from __v7_outer_cache*.
Quoted 24 lines
Quoted 24 lines
arch/arm/cpu/armv8/config.mk new file +17
-0@@ -0,0 +1,31 @@ +# +# Copyright (c) 2013 FengHua <[email protected]> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License
Quoted 9 lines
arch/arm/cpu/armv8/config.mk line 22
Quoted 5 lines
arch/arm/cpu/armv8/config.mk new file +5
-0+# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +PLATFORM_RELFLAGS += -fno-common -ffixed-x18Is -ffixed-x18 necessary, or will GCC do the right thing when it sees that x18 has been declared as a register variable?
I am not sure and will check it.
Quoted 48 lines
Quoted 17 lines
arch/arm/cpu/armv8/exceptions.S new file +11
-0@@ -0,0 +1,182 @@ +/* + * Copyright (c) 2013 David Feng <[email protected]> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + *arch/arm/cpu/armv8/exceptions.S line 21
Quoted 10 lines
arch/arm/cpu/armv8/exceptions.S new file +10
-0+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */I'm skeptical that you actually rewrote this from scratch (e.g. same registers are used in some places where there's no reason to pick any particular register, overall structure very similar, etc). It looks like you just changed the comments and names up a bit.
Any code that you did not write *from scratch* must be identified, with copyrights retained, and can only be used if it can be licensed GPLv2+ (unless Tom/Wolfgang say they'll accept v2-only code from Linux in this case).
Quoted 10 lines
arch/arm/cpu/armv8/exceptions.S new file +10
-0+void show_regs (struct pt_regs *regs) +{ + int i; + + printf("PC is at %lx\n", regs->pc); + printf("LR is at %lx\n", regs->regs[30]); + printf("PSTATE: %08lx\n", regs->pstate); + printf("SP : %lx\n", regs->sp); + for (i = 29; i >= 0; i--) { + printf("x%-2d: %016lx ", i, regs->regs[i]);
Quoted 9 lines
arch/arm/cpu/armv8/exceptions.S line 36
Quoted 5 lines
arch/arm/cpu/armv8/exceptions.S new file +5
-0+ if (i % 2 == 0) + printf("\n"); + } + printf("\n"); +}This is almost identical to the Linux code, yet I don't see any attribution (and the license is incompatible).
I will rewrite it.
Quoted 54 lines
arch/arm/cpu/armv8/relocate.S line 7
Quoted 13 lines
arch/arm/cpu/armv8/relocate.S new file +7
-0@@ -0,0 +1,71 @@ +/* + * relocate - common relocation function for ARM64 U-Boot + * + * Copyright (c) 2013 David Feng <[email protected]> + * + * See file CREDITS for list of people who contributed to this + * project.This is obviously derived from
arch/arm/lib/relocate.S, but I see no attribution or retained copyright notice.arch/arm/cpu/armv8/relocate.S line 17
Quoted 10 lines
arch/arm/cpu/armv8/relocate.S new file +10
-0+#ifdef __ASSEMBLY__ +#define _AC(X,Y) X +#define _AT(T,X) X +#else +#define __AC(X,Y) (X##Y) +#define _AC(X,Y) __AC(X,Y) +#define _AT(T,X) ((T)(X)) +#endif + +#define UL(x) _AC(x, UL)This needs a code comment, better names, and should be moved to a more common place.
Where do you use
_AT?Quoted 21 lines
arch/arm/include/asm/macro.h +13
-0@@ -54,5 +54,31 @@ bcs 1b .endm +#ifdef CONFIG_ARMV8 +/* +* Register aliases. +*/ +lr .req x30 // link register + +/* + * Stack pushing/popping (register pairs only). + * Equivalent to store decrement before, + * load increment after. + */ +.macro push, xreg1, xreg2 + stp \xreg1, \xreg2, [sp, #-16]!
Quoted 9 lines
arch/arm/include/asm/macro.h line 74
Quoted 5 lines
arch/arm/include/asm/macro.h +5
-0+.endm + +.macro pop, xreg1, xreg2 + ldp \xreg1, \xreg2, [sp], #16 +.endmMore uncredited and license-incompatible Linux copying (the macros themselves might not be copyrightable, but the comments are...).
I will modify the comments.
Quoted 8 lines
Quoted 8 lines
arch/arm/include/asm/posix_types.h +0
-0@@ -19,6 +19,8 @@* assume GCC is being used. */
Quoted 5 lines
arch/arm/include/asm/posix_types.h line 22
Quoted 1 line
arch/arm/include/asm/posix_types.h +1
-0+#ifndef CONFIG_ARMV8 You need to include
config.hfirst. For example, the warnings inlib/hashtable.care due to picking up the 32-bit definition of__kernel_size_t.
Maybe, it is better that config.h is included in hashtable.c
Quoted 3 lines
You should be considering these warnings to be errors.
I will remove all the warnings.
Quoted 50 lines
Quoted 25 lines
arch/arm/include/asm/posix_types.h +18
-0typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;@@ -44,6 +46,35 @@ typedef unsigned int __kernel_gid32_t;typedef unsigned short __kernel_old_uid_t ;typedef unsigned short __kernel_old_gid_t ; +#else /* CONFIG_ARMV8 */ + +typedef unsigned short __kernel_dev_t ; +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __kernel_gid_t ; +typedef unsigned long __kernel_size_t ; +typedef long __kernel_ssize_t ; +typedef long __kernel_ptrdiff_t ; +typedef long __kernel_time_t ; +typedef long __kernel_suseconds_t ; +typedef long __kernel_clock_t ; +typedef long __kernel_daddr_t ;arch/arm/include/asm/posix_types.h typedef unsigned int __kernel_gid32_t; · line 76
Quoted 10 lines
arch/arm/include/asm/posix_types.h +10
-0+typedef char *__kernel_caddr_t ; +typedef unsigned short __kernel_uid16_t ; +typedef unsigned short __kernel_gid16_t ; +typedef unsigned int __kernel_uid32_t ; +typedef unsigned int __kernel_gid32_t ; + +typedef __kernel_uid_t __kernel_old_uid_t ; +typedef __kernel_gid_t __kernel_old_gid_t ; + +#endif /* CONFIG_ARMV8 */ Most of these types do not need to be different between 32 and 64 bit (FWIW, I find it pretty obnoxious that GCC insists on "unsigned int" for %zu on 32-bit, rather than "unsigned long").
Also please use positive logic for if/else -- that is, use "ifdef/else/endif" rather than "ifndef/else/endif".
Quoted 7 lines
iff --git
a/arch/arm/include/asm/types.hb/arch/arm/include/asm/types.hindex 71dc049..128dd3e 100644arch/arm/include/asm/types.h +0
-0@@ -18,8 +18,13 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ;
Quoted 13 lines
arch/arm/include/asm/types.h typedef __signed__ int __s32; · line 28
Quoted 9 lines
arch/arm/include/asm/types.h +5
-0#if defined(__GNUC__) +#ifndef CONFIG_ARMV8 __extension__typedef __signed__ long long __s64 ; __extension__typedef unsigned long long __u64 ; +#else /* CONFIG_ARMV8 */ +__extension__typedef __signed__ long __s64 ; +__extension__typedef unsigned long __u64 ; +#endif /* CONFIG_ARMV8 */ #endif Please just always use long long here. It makes it easier to use u64 in
printf().
That's right.
Quoted 17 lines
Quoted 17 lines
arch/arm/include/asm/unaligned.h +2
-0@@ -8,6 +8,8 @@/* * Select endianness */ +#ifndef CONFIG_ARMV8 +#ifndef __ARMEB__#define get_unaligned __get_unaligned_le#define put_unaligned __put_unaligned_le@@ -16,4 +18,16 @@#define put_unaligned __put_unaligned_be#endif
Quoted 7 lines
arch/arm/include/asm/unaligned.h line 23
Quoted 3 lines
arch/arm/include/asm/unaligned.h +3
-0+#else /* CONFIG_ARMV8 */ + +#ifndef __AARCH64EB__Can you use
__BYTE_ORDER__instead so that 32/64 becomes irrelevant? Likewise elsewhere.
__ARMEB__ is used in a few files, we can replace it with __BYTE_ORDER here. other file has no relationship with armv8, I will keep it.
Quoted 27 lines
examples/standalone/stubs.c gd_t *global_data; · line 42
Quoted 9 lines
examples/standalone/stubs.c +1
-0@@ -39,6 +39,7 @@ gd_t *global_data; " bctr\n" \ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");#elif defined(CONFIG_ARM ) +#ifndef CONFIG_ARMV8
CONFIG_ARM64, and use positive logic for if/elseQuoted 15 lines
examples/standalone/stubs.c +8
-0/* * r8 holds the pointer to the global_data, ip is a call-clobbered * register @@ -50,6 +51,20 @@ 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"); +#else +/* +* x18 holds the pointer to the global_data, x9 is a call-clobbered +* register +*/ +#define EXPORT_FUNC (x) \ + asm volatile ( \ +" .globl " #x "\n" \
Quoted 8 lines
examples/standalone/stubs.c gd_t *global_data; · line 67
Quoted 6 lines
examples/standalone/stubs.c +6
-0+#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 *)) : "x19"); +#endif Clobber should be x9, not x19.
Sorry, It's a neglect.
Quoted 5 lines
-Scott
PATCH v5 1/4 core support of arm64
Quoted 108 lines · FengHua
Fisrt, thank scott for checking the patch.
Quoted 106 lines
-----????-----
???: "Scott Wood" <[email protected]> ????: 2013?9?7? ???
???: fenghua at phytium.com.cn
??: u-boot at lists.denx.de, trini at ti.com ??: Re: [U-Boot] [PATCH v5 1/4] core support of arm64Quoted 9 lines · fenghua at phytium.com.cn
From: David Feng <[email protected]>
Signed-off-by David Feng <[email protected]>---
Changeds for v4:
- Replace__ARMEB__with__AARCH64EB__inbyteorder.handunaligned.h, gcc for aarch64 use__AARCH64EB__and__AARCH64EL__to identify endian.
- Some modification to README.armv8Quoted 14 lines
arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++++ arch/arm/cpu/armv8/cache.S | 145 +++++++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 ++++ arch/arm/cpu/armv8/cpu.c | 68 ++++++++ arch/arm/cpu/armv8/crt0.S | 130 ++++++++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++++++ arch/arm/cpu/armv8/relocate.S | 71 ++++++++ arch/arm/cpu/armv8/start.S | 200 +++++++++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 ++++++++++ arch/arm/cpu/armv8/tlb.S | 38 ++++ arch/arm/cpu/armv8/u-boot.lds | 83 +++++++++Subject says "arm64", files say "armv8".
Some of these, such as
relocate.S, probably are not going to be armv8-specific but just arm64-specific.Quoted 45 lines
arch/arm/include/asm/arch-armv8/armv8.h | 44 +++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 +++ arch/arm/include/asm/arch-armv8/mmu.h | 117 +++++++++++++ arch/arm/include/asm/byteorder.h | 12 ++ arch/arm/include/asm/config.h | 10 ++ arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 +++ arch/arm/include/asm/posix_types.h | 31 ++++ arch/arm/include/asm/proc-armv/ptrace.h | 38 ++++ arch/arm/include/asm/proc-armv/system.h | 58 +++++- arch/arm/include/asm/types.h | 14 ++ arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 ++ arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ common/image.c | 1 + doc/README.armv8 | 14 ++ examples/standalone/stubs.c | 15 ++ include/image.h | 1 + 35 files changed, 1987 insertions(+), 8 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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/armv8.h 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 doc/README.armv8arch/arm/config.mk +0
-0arch/arm/config.mk endif · line 79
Quoted 6 lines
arch/arm/config.mk +2
-0@@ -74,7 +74,9 @@ endif endif # needed for relocation +ifndef CONFIG_ARMV8 LDFLAGS_u-boot += -pie +endif
CONFIG_ARM64(until we fix this, of course)arch/arm/config.mk endif · line 104
Quoted 11 lines
arch/arm/config.mk +2
-0# # 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 +endifARM64, though I've got a patch coming that will make the check work with arm64.
Quoted 7 lines
Quoted 3 lines
Likewise elsewhere -- most if not all of the
CONFIG_ARMV8uses should beCONFIG_ARM64.Actually, the naming is so confusing. The directory's name is armv8,
but it only represents aarch64 here. So, whetherCONFIG_ARMV8orCONFIG_ARM64should be used is difficult to make decision.
Files that are about 64-bit rather than armv8 should not go in the armv8 directory. E.g. relocate should be arch/arm/lib/relocate64.S.
Quoted 13 lines
Quoted 12 lines
arch/arm/config.mk
Quoted 9 lines
arch/arm/config.mk +9
-0+/* + * void __asm_flush_dcache_level(level) + * + * clean and invalidate one level cache. + * + * x0: cache level + * x1~x9: clobbered + */ +ENTRY(__asm_flush_dcache_level)Why the leading underscores?
Quoted 1 line
Is there any convention with underscores? I just know the underscore represent that the function is best not be called directly.
Sometimes that's done when there are multiple versions of a function, but it's bad practice since you're in a reserved namespace (especially if you go and do the same thing in a normal userspace program). In this case there isn't even a non-underscore version, so it's just gratuitous.
Quoted 29 lines
Quoted 21 lines
Quoted 21 lines
arch/arm/config.mk +21
-0+/* + * Stub implementations for outer cache operations + */ +void __v8_outer_cache_enable(void) {} +void v8_outer_cache_enable(void) + __attribute__((weak, alias("__v8_outer_cache_enable"))); + +void __v8_outer_cache_disable(void) {} +void v8_outer_cache_disable(void) + __attribute__((weak, alias("__v8_outer_cache_disable"))); + +void __v8_outer_cache_flush_all(void) {} +void v8_outer_cache_flush_all(void) + __attribute__((weak, alias("__v8_outer_cache_flush_all"))); + +void __v8_outer_cache_inval_all(void) {} +void v8_outer_cache_inval_all(void) + __attribute__((weak, alias("__v8_outer_cache_inval_all"))); + +void __v8_outer_cache_flush_range(u64 start, u64 end) {} +void v8_outer_cache_flush_range(u64 start, u64 end)Quoted 8 lines
arch/arm/config.mk
Quoted 5 lines
arch/arm/config.mk +5
-0+ __attribute__((weak, alias("__v8_outer_cache_flush_range"))); + +void __v8_outer_cache_inval_range(u64 start, u64 end) {} +void v8_outer_cache_inval_range(u64 start, u64 end) + __attribute__((weak, alias("__v8_outer_cache_inval_range")));What level do you anticipate these being overriden at? Individual chips? Why?
Quoted 1 line
It's socs. I don't know how the armv8 processor would like to be. It's just derived from __v7_outer_cache*.
Is this for flushing caches that are outside the core? On powerpc you could do that with architected instructions for a range flush -- is that not the case with ARM? Do the IC/DC instructions not operate on caches outside the core?
Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
arch/arm/cpu/armv8/config.mk new file +17
-0@@ -0,0 +1,31 @@ +# +# Copyright (c) 2013 FengHua <[email protected]> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public LicenseQuoted 9 lines
arch/arm/cpu/armv8/config.mk line 22
Quoted 5 lines
arch/arm/cpu/armv8/config.mk new file +5
-0+# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +PLATFORM_RELFLAGS += -fno-common -ffixed-x18Is -ffixed-x18 necessary, or will GCC do the right thing when it sees that x18 has been declared as a register variable?
Quoted 1 line
I am not sure and will check it.
GCC complains without --fixed-x18 because it views it as a volatile register. The ABI says this about it: "The Platform Register. If the platform ABI needs a dedicated register, this is it. Otherwise a temporary register."
Quoted 30 lines
Quoted 21 lines
Quoted 21 lines
arch/arm/include/asm/macro.h +13
-0@@ -54,5 +54,31 @@ bcs 1b .endm +#ifdef CONFIG_ARMV8 +/* +* Register aliases. +*/ +lr .req x30 // link register + +/* + * Stack pushing/popping (register pairs only). + * Equivalent to store decrement before, + * load increment after. + */ +.macro push, xreg1, xreg2 + stp \xreg1, \xreg2, [sp, #-16]!Quoted 9 lines
arch/arm/include/asm/macro.h line 74
Quoted 5 lines
arch/arm/include/asm/macro.h +5
-0+.endm + +.macro pop, xreg1, xreg2 + ldp \xreg1, \xreg2, [sp], #16 +.endmMore uncredited and license-incompatible Linux copying (the macros themselves might not be copyrightable, but the comments are...).
Quoted 1 line
I will modify the comments.
Please be aware that modifying the comments is generally not an acceptable alternative to rewriting from scratch. The non-comment portion of the above quote might not be regarded as copyrightable, but we're not lawyers and shouldn't rely on such things if we can avoid it.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/include/asm/posix_types.h +0
-0@@ -19,6 +19,8 @@* assume GCC is being used. */
Quoted 7 lines
Quoted 5 lines
arch/arm/include/asm/posix_types.h line 22
Quoted 1 line
arch/arm/include/asm/posix_types.h +1
-0+#ifndef CONFIG_ARMV8 You need to include
config.hfirst. For example, the warnings inlib/hashtable.care due to picking up the 32-bit definition of__kernel_size_t.Maybe, it is better that
config.his included inhashtable.c
No. If you use a config symbol in this file, then this file should include config.h. Otherwise we'll silently break on the next file that has a similar problem.
-Scott
PATCH v5 1/4 core support of arm64
Quoted 123 lines
-----????-----
???: "Scott Wood" <[email protected]> ????: 2013?9?10? ???
???: FengHua <[email protected]>
??: u-boot at lists.denx.de, trini at ti.com
??: Re: Re: [U-Boot] [PATCH v5 1/4] core support of arm64Quoted 112 lines · FengHua
Fisrt, thank scott for checking the patch.
Quoted 109 lines
-----????-----
???: "Scott Wood" <[email protected]> ????: 2013?9?7? ???
???: fenghua at phytium.com.cn
??: u-boot at lists.denx.de, trini at ti.com ??: Re: [U-Boot] [PATCH v5 1/4] core support of arm64Quoted 9 lines · fenghua at phytium.com.cn
From: David Feng <[email protected]>
Signed-off-by David Feng <[email protected]>---
Changeds for v4:
- Replace__ARMEB__with__AARCH64EB__inbyteorder.handunaligned.h, gcc for aarch64 use__AARCH64EB__and__AARCH64EL__to identify endian.
- Some modification to README.armv8Quoted 14 lines
arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++++ arch/arm/cpu/armv8/cache.S | 145 +++++++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 ++++ arch/arm/cpu/armv8/cpu.c | 68 ++++++++ arch/arm/cpu/armv8/crt0.S | 130 ++++++++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++++++ arch/arm/cpu/armv8/relocate.S | 71 ++++++++ arch/arm/cpu/armv8/start.S | 200 +++++++++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 ++++++++++ arch/arm/cpu/armv8/tlb.S | 38 ++++ arch/arm/cpu/armv8/u-boot.lds | 83 +++++++++Subject says "arm64", files say "armv8".
Some of these, such as
relocate.S, probably are not going to be armv8-specific but just arm64-specific.Quoted 45 lines
arch/arm/include/asm/arch-armv8/armv8.h | 44 +++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 +++ arch/arm/include/asm/arch-armv8/mmu.h | 117 +++++++++++++ arch/arm/include/asm/byteorder.h | 12 ++ arch/arm/include/asm/config.h | 10 ++ arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 +++ arch/arm/include/asm/posix_types.h | 31 ++++ arch/arm/include/asm/proc-armv/ptrace.h | 38 ++++ arch/arm/include/asm/proc-armv/system.h | 58 +++++- arch/arm/include/asm/types.h | 14 ++ arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 ++ arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ common/image.c | 1 + doc/README.armv8 | 14 ++ examples/standalone/stubs.c | 15 ++ include/image.h | 1 + 35 files changed, 1987 insertions(+), 8 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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/armv8.h 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 doc/README.armv8arch/arm/config.mk +0
-0arch/arm/config.mk endif · line 79
Quoted 6 lines
arch/arm/config.mk +2
-0@@ -74,7 +74,9 @@ endif endif # needed for relocation +ifndef CONFIG_ARMV8 LDFLAGS_u-boot += -pie +endif
CONFIG_ARM64(until we fix this, of course)arch/arm/config.mk endif · line 104
Quoted 11 lines
arch/arm/config.mk +2
-0# # 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 +endifARM64, though I've got a patch coming that will make the check work with arm64.
Likewise elsewhere -- most if not all of the
CONFIG_ARMV8uses should beCONFIG_ARM64.
Quoted 7 lines
Quoted 3 lines
Actually, the naming is so confusing. The directory's name is armv8,
but it only represents aarch64 here. So, whetherCONFIG_ARMV8orCONFIG_ARM64should be used is difficult to make decision.Files that are about 64-bit rather than armv8 should not go in the armv8 directory. E.g. relocate should be
arch/arm/lib/relocate64.S.
crt0.S and relocate.S both could be moved to /arm/lib/ and renamed. Currently, I try to keep armv8 specific codes within armv8 directory
and do not mixed with original arm code. Absolutely we should did so when armv9 coming.
Quoted 49 lines
Quoted 13 lines
Quoted 12 lines
arch/arm/config.mk
Quoted 9 lines
arch/arm/config.mk +9
-0+/* + * void __asm_flush_dcache_level(level) + * + * clean and invalidate one level cache. + * + * x0: cache level + * x1~x9: clobbered + */ +ENTRY(__asm_flush_dcache_level)Why the leading underscores?
Quoted 1 line
Is there any convention with underscores? I just know the underscore represent that the function is best not be called directly.
Sometimes that's done when there are multiple versions of a function, but it's bad practice since you're in a reserved namespace (especially if you go and do the same thing in a normal userspace program). In this case there isn't even a non-underscore version, so it's just gratuitous.
Quoted 29 lines
Quoted 29 lines
Quoted 16 lines
arch/arm/config.mk +16
-0+/* + * Stub implementations for outer cache operations + */ +void __v8_outer_cache_enable(void) {} +void v8_outer_cache_enable(void) + __attribute__((weak, alias("__v8_outer_cache_enable"))); + +void __v8_outer_cache_disable(void) {} +void v8_outer_cache_disable(void) + __attribute__((weak, alias("__v8_outer_cache_disable"))); + +void __v8_outer_cache_flush_all(void) {} +void v8_outer_cache_flush_all(void) + __attribute__((weak, alias("__v8_outer_cache_flush_all"))); + +void __v8_outer_cache_inval_all(void) {}arch/arm/config.mk
Quoted 10 lines
arch/arm/config.mk +10
-0+void v8_outer_cache_inval_all(void) + __attribute__((weak, alias("__v8_outer_cache_inval_all"))); + +void __v8_outer_cache_flush_range(u64 start, u64 end) {} +void v8_outer_cache_flush_range(u64 start, u64 end) + __attribute__((weak, alias("__v8_outer_cache_flush_range"))); + +void __v8_outer_cache_inval_range(u64 start, u64 end) {} +void v8_outer_cache_inval_range(u64 start, u64 end) + __attribute__((weak, alias("__v8_outer_cache_inval_range")));What level do you anticipate these being overriden at? Individual chips? Why?
Quoted 6 lines
Quoted 1 line
It's socs. I don't know how the armv8 processor would like to be. It's just derived from __v7_outer_cache*.
Is this for flushing caches that are outside the core? On powerpc you could do that with architected instructions for a range flush -- is that not the case with ARM? Do the IC/DC instructions not operate on caches outside the core?
I noticed that cache-pl310.c implements v7_outer_* functions. IC/DC instructions could maintain caches in cache hierarchy of armv8 whatever the cache is outside the core or inside the core. But armv8 architecture reference manual(not totally completed) do not require all caches exist in the cache hierarchy. Maybe some processors have it's own cache level that is not maintained by IC/DC instructions. who knows.
I keep this just because it existed in armv7.
Best regards,
David
Quoted 101 lines
Quoted 33 lines
Quoted 24 lines
Quoted 24 lines
arch/arm/cpu/armv8/config.mk new file +17
-0@@ -0,0 +1,31 @@ +# +# Copyright (c) 2013 FengHua <[email protected]> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public LicenseQuoted 9 lines
arch/arm/cpu/armv8/config.mk line 22
Quoted 5 lines
arch/arm/cpu/armv8/config.mk new file +5
-0+# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +PLATFORM_RELFLAGS += -fno-common -ffixed-x18Is -ffixed-x18 necessary, or will GCC do the right thing when it sees that x18 has been declared as a register variable?
Quoted 1 line
I am not sure and will check it.
GCC complains without --fixed-x18 because it views it as a volatile register. The ABI says this about it: "The Platform Register. If the platform ABI needs a dedicated register, this is it. Otherwise a temporary register."
Quoted 30 lines
Quoted 21 lines
Quoted 21 lines
arch/arm/include/asm/macro.h +13
-0@@ -54,5 +54,31 @@ bcs 1b .endm +#ifdef CONFIG_ARMV8 +/* +* Register aliases. +*/ +lr .req x30 // link register + +/* + * Stack pushing/popping (register pairs only). + * Equivalent to store decrement before, + * load increment after. + */ +.macro push, xreg1, xreg2 + stp \xreg1, \xreg2, [sp, #-16]!Quoted 9 lines
arch/arm/include/asm/macro.h line 74
Quoted 5 lines
arch/arm/include/asm/macro.h +5
-0+.endm + +.macro pop, xreg1, xreg2 + ldp \xreg1, \xreg2, [sp], #16 +.endmMore uncredited and license-incompatible Linux copying (the macros themselves might not be copyrightable, but the comments are...).
Quoted 1 line
I will modify the comments.
Please be aware that modifying the comments is generally not an acceptable alternative to rewriting from scratch. The non-comment portion of the above quote might not be regarded as copyrightable, but we're not lawyers and shouldn't rely on such things if we can avoid it.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/include/asm/posix_types.h +0
-0@@ -19,6 +19,8 @@* assume GCC is being used. */ Quoted 7 lines
Quoted 5 lines
arch/arm/include/asm/posix_types.h line 22
Quoted 1 line
arch/arm/include/asm/posix_types.h +1
-0+#ifndef CONFIG_ARMV8 You need to include
config.hfirst. For example, the warnings inlib/hashtable.care due to picking up the 32-bit definition of__kernel_size_t.Maybe, it is better that
config.his included inhashtable.cNo. If you use a config symbol in this file, then this file should include
config.h. Otherwise we'll silently break on the next file that has a similar problem.-Scott
PATCH v5 1/4 core support of arm64
Quoted 21 lines · FengHua
Quoted 21 lines
-----????-----
???: "Scott Wood" <[email protected]> ????: 2013?9?10? ???
???: FengHua <[email protected]>
??: u-boot at lists.denx.de, trini at ti.com
??: Re: Re: [U-Boot] [PATCH v5 1/4] core support of arm64Quoted 10 lines · FengHua
Quoted 6 lines
ARM64, though I've got a patch coming that will make the check work with arm64.
Likewise elsewhere -- most if not all of the
CONFIG_ARMV8uses should beCONFIG_ARM64.Actually, the naming is so confusing. The directory's name is armv8,
but it only represents aarch64 here. So, whetherCONFIG_ARMV8orCONFIG_ARM64should be used is difficult to make decision.
Quoted 7 lines
Quoted 3 lines
Files that are about 64-bit rather than armv8 should not go in the armv8 directory. E.g. relocate should be
arch/arm/lib/relocate64.S.
crt0.Sandrelocate.Sboth could be moved to /arm/lib/ and renamed. Currently, I try to keep armv8 specific codes within armv8 directory
and do not mixed with original arm code. Absolutely we should did so when armv9 coming.
crt0 and relocate should be in in lib now. The others can probably stay in armv8 until we see what is different in armv9.
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 5 lines
arch/arm/cpu/armv8/cache_v8.c line 291
Quoted 2 lines
arch/arm/cpu/armv8/cache_v8.c new file +2
-0+void v8_outer_cache_inval_range (u64 start,u64 end) + __attribute__((weak,alias ("__v8_outer_cache_inval_range" )));What level do you anticipate these being overriden at? Individual chips? Why?
It's socs. I don't know how the armv8 processor would like to be. It's just derived from __v7_outer_cache*.
Is this for flushing caches that are outside the core? On powerpc you could do that with architected instructions for a range flush -- is that not the case with ARM? Do the IC/DC instructions not operate on caches outside the core?
Quoted 8 lines
I noticed that
cache-pl310.cimplements v7_outer_* functions. IC/DC instructions could maintain caches in cache hierarchy of armv8 whatever the cache is outside the core or inside the core. But armv8 architecture reference manual(not totally completed) do not require all caches exist in the cache hierarchy. Maybe some processors have it's own cache level that is not maintained by IC/DC instructions. who knows.
I keep this just because it existed in armv7.
I'd leave it out until a need is observed.
-Scott
PATCH v5 1/4 core support of arm64
In reply to fenghua at phytium.com.cnFrom: David Feng <[email protected]>
---
Changeds for v4:
- 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
arch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++++ arch/arm/cpu/armv8/cache.S | 145 +++++++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 ++++ arch/arm/cpu/armv8/cpu.c | 68 ++++++++ arch/arm/cpu/armv8/crt0.S | 130 ++++++++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++++++ arch/arm/cpu/armv8/relocate.S | 71 ++++++++ arch/arm/cpu/armv8/start.S | 200 +++++++++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 ++++++++++ arch/arm/cpu/armv8/tlb.S | 38 ++++ arch/arm/cpu/armv8/u-boot.lds | 83 +++++++++ arch/arm/include/asm/arch-armv8/armv8.h | 44 +++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 +++ arch/arm/include/asm/arch-armv8/mmu.h | 117 +++++++++++++ arch/arm/include/asm/byteorder.h | 12 ++ arch/arm/include/asm/config.h | 10 ++ arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 +++ arch/arm/include/asm/posix_types.h | 31 ++++ arch/arm/include/asm/proc-armv/ptrace.h | 38 ++++ arch/arm/include/asm/proc-armv/system.h | 58 +++++- arch/arm/include/asm/types.h | 14 ++ arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 ++ arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ common/image.c | 1 + doc/README.armv8 | 14 ++ examples/standalone/stubs.c | 15 ++ include/image.h | 1 + 35 files changed, 1987 insertions(+), 8 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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/armv8.h 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 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 +56 -0
56 lines not on this page · raw message
arch/arm/cpu/armv8/cache.S new file +145 -0
145 lines not on this page · raw message
arch/arm/cpu/armv8/cache_v8.c new file +291 -0
291 lines not on this page · raw message
arch/arm/cpu/armv8/config.mk new file +31 -0
@@ -0,0 +1,31 @@ +# +# Copyright (c) 2013 FengHua <[email protected]> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +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 +68 -0
68 lines not on this page · raw message
arch/arm/cpu/armv8/crt0.S new file +130 -0
130 lines not on this page · raw message
arch/arm/cpu/armv8/exceptions.S new file +182 -0
182 lines not on this page · raw message
arch/arm/cpu/armv8/interrupts.c new file +116 -0
116 lines not on this page · raw message
arch/arm/cpu/armv8/relocate.S new file +71 -0
71 lines not on this page · raw message
arch/arm/cpu/armv8/start.S new file +200 -0
200 lines not on this page · raw message
arch/arm/cpu/armv8/timer.c new file +95 -0
95 lines not on this page · raw message
arch/arm/cpu/armv8/tlb.S new file +38 -0
@@ -0,0 +1,38 @@ +/* + * Copyright (c) 2013 David Feng <[email protected]> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <asm-offsets.h> +#include <config.h> +#include <version.h> +#include <linux/linkage.h> + +/* + * void __asm_invalidate_tlb_all(void) + * + * invalidate all tlb entries. + */ +ENTRY(__asm_invalidate_tlb_all) + tlbi alle2 + dsb sy + isb + ret +ENDPROC(__asm_invalidate_tlb_all)
arch/arm/cpu/armv8/u-boot.lds new file +83 -0
83 lines not on this page · raw message
arch/arm/include/asm/arch-armv8/armv8.h new file +44 -0
44 lines not on this page · raw message
arch/arm/include/asm/arch-armv8/gpio.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright (c) 2013 David Feng <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#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 +117 -0
117 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 +#ifndef CONFIG_ARMV8 +#ifdef __ARMEB__#include <linux/byteorder/big_endian.h> #else #include <linux/byteorder/little_endian.h> #endif +#else /* CONFIG_ARMV8 */ + +#ifdef __AARCH64EB__ +#include <linux/byteorder/big_endian.h> +#else +#include <linux/byteorder/little_endian.h> +#endif + +#endif /* CONFIG_ARMV8 */ +#endif
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") +#ifndef CONFIG_ARMV8 +#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") +#else +#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18") +#endif #endif /* __ASM_GBL_DATA_H */
arch/arm/include/asm/io.h +6 -6
@@ -75,42 +75,42 @@ 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 +26 -0
@@ -54,5 +54,31 @@ bcs 1b .endm +#ifdef CONFIG_ARMV8 +/* +* Register aliases. +*/ +lr .req x30 // link register + +/* + * Stack pushing/popping (register pairs only). + * Equivalent to store decrement before, + * load increment after. + */ +.macro push, xreg1, xreg2 + stp \xreg1, \xreg2, [sp, #-16]! +.endm + +.macro pop, xreg1, xreg2 + ldp \xreg1, \xreg2, [sp], #16 +.endm + +.macro ventry label + .align 7 + b \label +.endm + +#endif /* CONFIG_ARMV8 */ +#endif /* __ASSEMBLY__ */ #endif /* __ASM_ARM_MACRO_H__ */
arch/arm/include/asm/posix_types.h +31 -0
@@ -19,6 +19,8 @@* assume GCC is being used. */ +#ifndef CONFIG_ARMV8 +typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;
@@ -44,6 +46,35 @@ typedef unsigned int __kernel_gid32_t;typedef unsigned short __kernel_old_uid_t ;typedef unsigned short __kernel_old_gid_t ; +#else /* CONFIG_ARMV8 */ + +typedef unsigned short __kernel_dev_t ; +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __kernel_gid_t ; +typedef unsigned long __kernel_size_t ; +typedef long __kernel_ssize_t ; +typedef long __kernel_ptrdiff_t ; +typedef long __kernel_time_t ; +typedef long __kernel_suseconds_t ; +typedef long __kernel_clock_t ; +typedef long __kernel_daddr_t ; +typedef char *__kernel_caddr_t ; +typedef unsigned short __kernel_uid16_t ; +typedef unsigned short __kernel_gid16_t ; +typedef unsigned int __kernel_uid32_t ; +typedef unsigned int __kernel_gid32_t ; + +typedef __kernel_uid_t __kernel_old_uid_t ; +typedef __kernel_gid_t __kernel_old_gid_t ; + +#endif /* CONFIG_ARMV8 */ +#ifdef __GNUC__typedef long long __kernel_loff_t ;#endif
arch/arm/include/asm/proc-armv/ptrace.h +38 -0
@@ -12,6 +12,8 @@#include <linux/config.h> +#ifndef CONFIG_ARMV8 +#define USR26_MODE 0x00#define FIQ26_MODE 0x01#define IRQ26_MODE 0x02
@@ -106,4 +108,40 @@ static inline int valid_user_regs(struct pt_regs *regs)#endif /* __ASSEMBLY__ */ +#else /* CONFIG_ARMV8 */ + +#define PCMASK 0 + +#define S_X0 (0)/* offsetof(struct pt_regs, regs[0]) */ +#define S_X1 (8)/* offsetof(struct pt_regs, regs[1]) */ +#define S_X2 (16)/* offsetof(struct pt_regs, regs[2]) */ +#define S_X3 (24/* offsetof(struct pt_regs, regs[3]) */ +#define S_X4 (32)/* offsetof(struct pt_regs, regs[4]) */ +#define S_X5 (40)/* offsetof(struct pt_regs, regs[5]) */ +#define S_X6 (48)/* offsetof(struct pt_regs, regs[6]) */ +#define S_X7 (56)/* offsetof(struct pt_regs, regs[7]) */ +#define S_LR (240)/* offsetof(struct pt_regs, regs[30]) */ +#define S_SP (248)/* offsetof(struct pt_regs, sp) */ +#define S_PC (256)/* offsetof(struct pt_regs, pc) */ +#define S_PSTATE (264)/* offsetof(struct pt_regs, pstate) */ +#define S_FRAME_SIZE (272)/* sizeof(struct pt_regs) */ + +#ifndef __ASSEMBLY__ + +/* +* This struct defines the way the registers are stored on the stack during an +* exception. Note that sizeof(struct pt_regs) has to be a multiple of 16 (for +* stack alignment). struct user_pt_regs must form a prefix of struct pt_regs. +*/ +struct pt_regs { +u64 regs[31 ]; +u64 sp; +u64 pc; +u64 pstate; +}; + +#endif /* __ASSEMBLY__ */ + +#endif /* CONFIG_ARMV8 */ +#endif
arch/arm/include/asm/proc-armv/system.h +57 -1
70 lines not on this page · raw message
arch/arm/include/asm/types.h +14 -0
@@ -18,8 +18,13 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ;#if defined(__GNUC__) +#ifndef CONFIG_ARMV8 __extension__typedef __signed__ long long __s64 ; __extension__typedef unsigned long long __u64 ; +#else /* CONFIG_ARMV8 */ +__extension__typedef __signed__ long __s64 ; +__extension__typedef unsigned long __u64 ; +#endif /* CONFIG_ARMV8 */ #endif /*
@@ -36,10 +41,19 @@ typedef unsigned short u16;typedef signed int s32 ;typedef unsigned int u32 ; +#ifndef CONFIG_ARMV8 typedef signed long long s64 ;typedef unsigned long long u64 ; +#else /* CONFIG_ARMV8 */ +typedef signed long s64 ; +typedef unsigned long u64 ; +#endif /* CONFIG_ARMV8 */ +#ifndef CONFIG_ARMV8 #define BITS_PER_LONG 32 +#else /* CONFIG_ARMV8 */ +#define BITS_PER_LONG 64 +#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 +14 -0
@@ -8,6 +8,8 @@/* * Select endianness */ +#ifndef CONFIG_ARMV8 +#ifndef __ARMEB__#define get_unaligned __get_unaligned_le#define put_unaligned __put_unaligned_le
@@ -16,4 +18,16 @@#define put_unaligned __put_unaligned_be#endif +#else /* CONFIG_ARMV8 */ + +#ifndef __AARCH64EB__ +#define get_unaligned __get_unaligned_le +#define put_unaligned __put_unaligned_le +#else +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be +#endif + +#endif /* CONFIG_ARMV8 */ +#endif /* _ASM_ARM_UNALIGNED_H */
arch/arm/lib/Makefile +8 -0
@@ -10,6 +10,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(ARCH).o LIBGCC = $(obj)libgcc.o +ifndef CONFIG_ARMV8 GLSOBJS += _ashldi3.o GLSOBJS += _ashrdi3.o GLSOBJS += _divsi3.o
@@ -21,9 +22,12 @@ GLSOBJS += _umodsi3.o GLCOBJS += div0.o SOBJS-y += crt0.o +endif ifndef CONFIG_SPL_BUILD +ifndef CONFIG_ARMV8 SOBJS-y += relocate.o +endif ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o endif
@@ -38,11 +42,15 @@ else COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o endif +ifndef CONFIG_ARMV8 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 +18 -0
@@ -344,7 +344,11 @@ void board_init_f(ulong bootflag)#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))/* reserve TLB table */ +#ifndef CONFIG_ARMV8 gd->arch.tlb_size =4096 *4 ; +#else + gd->arch.tlb_size =0x10000 ; +#endif addr -= gd->arch.tlb_size;/* round down to next 64 kB limit */
@@ -419,6 +423,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 +436,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 +532,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,7 @@ static void boot_prep_linux(bootm_headers_t *images)/* Subcommand: GO */ static void boot_jump_linux (bootm_headers_t *images,int flag) { +#ifndef CONFIG_ARMV8 unsigned long machid = gd->bd->bi_arch_number;char *s;void (*kernel_entry)(int zero,int arch,uint params);
@@ -248,6 +249,21 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)if (!fake)kernel_entry (0 , machid, r2); +#else +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); +#endif }/* Main Entry point for arm bootm implementation
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 +14 -0
@@ -0,0 +1,14 @@ +Notes: + +1. Currenly, u-boot running at EL2. + +2. GOT is used to relocate u-boot and CONFIG_NEEDS_MANUAL_RELOC is needed. + +3. Fdt should be placed in 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. + +4. Generic board is supported. + +TODO: + +1. So much print info are formated with %08lx, maybe it should be modified to %016lx.
examples/standalone/stubs.c +15 -0
@@ -39,6 +39,7 @@ gd_t *global_data; " bctr\n" \ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");#elif defined(CONFIG_ARM ) +#ifndef CONFIG_ARMV8 /* * r8 holds the pointer to the global_data, ip is a call-clobbered * register
@@ -50,6 +51,20 @@ 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"); +#else +/* +* 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 *)) : "x19"); +#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 v5 2/4 board support of arm64
In reply to fenghua at phytium.com.cnFrom: David Feng <[email protected]>
---
Changes for v4:
- No
board/armltd/dts/vexpress64.dts | 439 ++++++++++++++++++++++++++++++++++ board/armltd/vexpress64/Makefile | 43 ++++ board/armltd/vexpress64/vexpress64.c | 79 ++++++ boards.cfg | 1 + include/configs/vexpress_aemv8a.h | 203 ++++++++++++++++ 5 files changed, 765 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
board/armltd/dts/vexpress64.dts new file +439 -0
@@ -0,0 +1,439 @@ +/* + * ARM Ltd. Fast Models + * + * Architecture Envelope Model (AEM) ARMv8-A + * ARMAEMv8AMPCT + * + * RTSM_VE_AEMv8A.lisa + */ + +/dts-v1/; + +/memreserve/ 0x80000000 0x00010000; + +/ { + /* boot configurations for u-boot */ + config { + /*bootdelay = <1>;*/ + kernel-offset = <0x100000>; + rootdisk-offset = <0x800000>; + bootcmd = "bootm 0x100000 0x800000:0x2000000"; + }; +}; + +/ { + model = "RTSM_VE_AEMv8A"; + compatible = "arm,rtsm_ve,aemv8a", "arm,vexpress"; + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + /* chosen */ + /* generated by u-boot */ + + + aliases { + serial0 = &v2m_serial0; + serial1 = &v2m_serial1; + serial2 = &v2m_serial2; + serial3 = &v2m_serial3; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu at 0 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <1>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 2 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <2>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 3 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <3>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + }; + + memory at 80000000 { + device_type = "memory"; + reg = <0x00000000 0x80000000 0 0x80000000>, + <0x00000008 0x80000000 0 0x80000000>; + }; + + gic: interrupt-controller at 2c001000 { + compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + #address-cells = <0>; + interrupt-controller; + reg = <0x0 0x2c001000 0 0x1000>, + <0x0 0x2c002000 0 0x1000>, + <0x0 0x2c004000 0 0x2000>, + <0x0 0x2c006000 0 0x2000>; + interrupts = <1 9 0xf04>; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = <1 13 0xff01>, + <1 14 0xff01>, + <1 11 0xff01>, + <1 10 0xff01>; + clock-frequency = <100000000>; + }; + + pmu { + compatible = "arm,armv8-pmuv3"; + interrupts = <0 60 4>, + <0 61 4>, + <0 62 4>, + <0 63 4>; + }; + + smb { + compatible = "simple-bus"; + + #address-cells = <2>; + #size-cells = <1>; + ranges = <0 0 0 0x08000000 0x04000000>, + <1 0 0 0x14000000 0x04000000>, + <2 0 0 0x18000000 0x04000000>, + <3 0 0 0x1c000000 0x04000000>, + <4 0 0 0x0c000000 0x04000000>, + <5 0 0 0x10000000 0x04000000>; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 63>; + interrupt-map = <0 0 0 &gic 0 0 4>, + <0 0 1 &gic 0 1 4>, + <0 0 2 &gic 0 2 4>, + <0 0 3 &gic 0 3 4>, + <0 0 4 &gic 0 4 4>, + <0 0 5 &gic 0 5 4>, + <0 0 6 &gic 0 6 4>, + <0 0 7 &gic 0 7 4>, + <0 0 8 &gic 0 8 4>, + <0 0 9 &gic 0 9 4>, + <0 0 10 &gic 0 10 4>, + <0 0 11 &gic 0 11 4>, + <0 0 12 &gic 0 12 4>, + <0 0 13 &gic 0 13 4>, + <0 0 14 &gic 0 14 4>, + <0 0 15 &gic 0 15 4>, + <0 0 16 &gic 0 16 4>, + <0 0 17 &gic 0 17 4>, + <0 0 18 &gic 0 18 4>, + <0 0 19 &gic 0 19 4>, + <0 0 20 &gic 0 20 4>, + <0 0 21 &gic 0 21 4>, + <0 0 22 &gic 0 22 4>, + <0 0 23 &gic 0 23 4>, + <0 0 24 &gic 0 24 4>, + <0 0 25 &gic 0 25 4>, + <0 0 26 &gic 0 26 4>, + <0 0 27 &gic 0 27 4>, + <0 0 28 &gic 0 28 4>, + <0 0 29 &gic 0 29 4>, + <0 0 30 &gic 0 30 4>, + <0 0 31 &gic 0 31 4>, + <0 0 32 &gic 0 32 4>, + <0 0 33 &gic 0 33 4>, + <0 0 34 &gic 0 34 4>, + <0 0 35 &gic 0 35 4>, + <0 0 36 &gic 0 36 4>, + <0 0 37 &gic 0 37 4>, + <0 0 38 &gic 0 38 4>, + <0 0 39 &gic 0 39 4>, + <0 0 40 &gic 0 40 4>, + <0 0 41 &gic 0 41 4>, + <0 0 42 &gic 0 42 4>; + + motherboard { + arm,v2m-memory-map = "rs1"; + compatible = "arm,vexpress,v2m-p1", "simple-bus"; + #address-cells = <2>; /* SMB chipselect number and offset */ + #size-cells = <1>; + #interrupt-cells = <1>; + ranges; + + flash at 0,00000000 { + compatible = "arm,vexpress-flash", "cfi-flash"; + reg = <0 0x00000000 0x04000000>, + <4 0x00000000 0x04000000>; + bank-width = <4>; + }; + + vram at 2,00000000 { + compatible = "arm,vexpress-vram"; + reg = <2 0x00000000 0x00800000>; + }; + + ethernet at 2,02000000 { + compatible = "smsc,lan91c111"; + reg = <2 0x02000000 0x10000>; + interrupts = <15>; + }; + + v2m_clk24mhz: clk24mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-output-names = "v2m:clk24mhz"; + }; + + v2m_refclk1mhz: refclk1mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1000000>; + clock-output-names = "v2m:refclk1mhz"; + }; + + v2m_refclk32khz: refclk32khz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "v2m:refclk32khz"; + }; + + iofpga at 3,00000000 { + compatible = "arm,amba-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 3 0 0x200000>; + + v2m_sysreg: sysreg at 010000 { + compatible = "arm,vexpress-sysreg"; + reg = <0x010000 0x1000>; + gpio-controller; + #gpio-cells = <2>; + }; + + v2m_sysctl: sysctl at 020000 { + compatible = "arm,sp810", "arm,primecell"; + reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_clk24mhz>; + clock-names = "refclk", "timclk", "apb_pclk"; + #clock-cells = <1>; + clock-output-names = "timerclken0", "timerclken1", "timerclken2", "timerclken3"; + }; + + aaci at 040000 { + compatible = "arm,pl041", "arm,primecell"; + reg = <0x040000 0x1000>; + interrupts = <11>; + clocks = <&v2m_clk24mhz>; + clock-names = "apb_pclk"; + }; + + mmci at 050000 { + compatible = "arm,pl180", "arm,primecell"; + reg = <0x050000 0x1000>; + interrupts = <9 10>; + cd-gpios = <&v2m_sysreg 0 0>; + wp-gpios = <&v2m_sysreg 1 0>; + max-frequency = <12000000>; + vmmc-supply = <&v2m_fixed_3v3>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "mclk", "apb_pclk"; + }; + + kmi at 060000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x060000 0x1000>; + interrupts = <12>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "KMIREFCLK", "apb_pclk"; + }; + + kmi at 070000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x070000 0x1000>; + interrupts = <13>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "KMIREFCLK", "apb_pclk"; + }; + + v2m_serial0: uart at 090000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x090000 0x1000>; + interrupts = <5>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial1: uart at 0a0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0a0000 0x1000>; + interrupts = <6>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial2: uart at 0b0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0b0000 0x1000>; + interrupts = <7>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial3: uart at 0c0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0c0000 0x1000>; + interrupts = <8>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + wdt at 0f0000 { + compatible = "arm,sp805", "arm,primecell"; + reg = <0x0f0000 0x1000>; + interrupts = <0>; + clocks = <&v2m_refclk32khz>, <&v2m_clk24mhz>; + clock-names = "wdogclk", "apb_pclk"; + }; + + v2m_timer01: timer at 110000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0x110000 0x1000>; + interrupts = <2>; + clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&v2m_clk24mhz>; + clock-names = "timclken1", "timclken2", "apb_pclk"; + }; + + v2m_timer23: timer at 120000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0x120000 0x1000>; + interrupts = <3>; + clocks = <&v2m_sysctl 2>, <&v2m_sysctl 3>, <&v2m_clk24mhz>; + clock-names = "timclken1", "timclken2", "apb_pclk"; + }; + + rtc at 170000 { + compatible = "arm,pl031", "arm,primecell"; + reg = <0x170000 0x1000>; + interrupts = <4>; + clocks = <&v2m_clk24mhz>; + clock-names = "apb_pclk"; + }; + + clcd at 1f0000 { + compatible = "arm,pl111", "arm,primecell"; + reg = <0x1f0000 0x1000>; + interrupts = <14>; + clocks = <&v2m_oscclk1>, <&v2m_clk24mhz>; + clock-names = "clcdclk", "apb_pclk"; + }; + }; + + v2m_fixed_3v3: fixedregulator at 0 { + compatible = "regulator-fixed"; + regulator-name = "3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + mcc { + compatible = "arm,vexpress,config-bus", "simple-bus"; + arm,vexpress,config-bridge = <&v2m_sysreg>; + + v2m_oscclk1: osc at 1 { + /* CLCD clock */ + compatible = "arm,vexpress-osc"; + arm,vexpress-sysreg,func = <1 1>; + freq-range = <23750000 63500000>; + #clock-cells = <0>; + clock-output-names = "v2m:oscclk1"; + }; + + reset at 0 { + compatible = "arm,vexpress-reset"; + arm,vexpress-sysreg,func = <5 0>; + }; + + muxfpga at 0 { + compatible = "arm,vexpress-muxfpga"; + arm,vexpress-sysreg,func = <7 0>; + }; + + shutdown at 0 { + compatible = "arm,vexpress-shutdown"; + arm,vexpress-sysreg,func = <8 0>; + }; + + reboot at 0 { + compatible = "arm,vexpress-reboot"; + arm,vexpress-sysreg,func = <9 0>; + }; + + dvimode at 0 { + compatible = "arm,vexpress-dvimode"; + arm,vexpress-sysreg,func = <11 0>; + }; + }; + }; + }; + + panels { + panel at 0 { + compatible = "panel"; + mode = "VGA"; + refresh = <60>; + xres = <640>; + yres = <480>; + pixclock = <39721>; + left_margin = <40>; + right_margin = <24>; + upper_margin = <32>; + lower_margin = <11>; + hsync_len = <96>; + vsync_len = <2>; + sync = <0>; + vmode = "FB_VMODE_NONINTERLACED"; + tim2 = "TIM2_BCD", "TIM2_IPC"; + cntl = "CNTL_LCDTFT", "CNTL_BGR", "CNTL_LCDVCOMP(1)"; + caps = "CLCD_CAP_5551", "CLCD_CAP_565", "CLCD_CAP_888"; + bpp = <16>; + }; + + panel at 1 { + compatible = "panel"; + mode = "XVGA"; + refresh = <60>; + xres = <1024>; + yres = <768>; + pixclock = <15748>; + left_margin = <152>; + right_margin = <48>; + upper_margin = <23>; + lower_margin = <3>; + hsync_len = <104>; + vsync_len = <4>; + sync = <0>; + vmode = "FB_VMODE_NONINTERLACED"; + tim2 = "TIM2_BCD", "TIM2_IPC"; + cntl = "CNTL_LCDTFT", "CNTL_BGR", "CNTL_LCDVCOMP(1)"; + caps = "CLCD_CAP_5551", "CLCD_CAP_565", "CLCD_CAP_888"; + bpp = <16>; + }; + }; +};
board/armltd/vexpress64/Makefile new file +43 -0
43 lines not on this page · raw message
board/armltd/vexpress64/vexpress64.c new file +79 -0
79 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 +203 -0
203 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v5 2/4 board support of arm64
In reply to fenghua at phytium.com.cnFrom: David Feng <[email protected]>
--- board/armltd/dts/vexpress64.dts | 439 ++++++++++++++++++++++++++++++++++ board/armltd/vexpress64/Makefile | 43 ++++ board/armltd/vexpress64/vexpress64.c | 79 ++++++ boards.cfg | 1 + include/configs/vexpress_aemv8a.h | 203 ++++++++++++++++ 5 files changed, 765 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
board/armltd/dts/vexpress64.dts new file +439 -0
@@ -0,0 +1,439 @@ +/* + * ARM Ltd. Fast Models + * + * Architecture Envelope Model (AEM) ARMv8-A + * ARMAEMv8AMPCT + * + * RTSM_VE_AEMv8A.lisa + */ + +/dts-v1/; + +/memreserve/ 0x80000000 0x00010000; + +/ { + /* boot configurations for u-boot */ + config { + /*bootdelay = <1>;*/ + kernel-offset = <0x100000>; + rootdisk-offset = <0x800000>; + bootcmd = "bootm 0x100000 0x800000:0x2000000"; + }; +}; + +/ { + model = "RTSM_VE_AEMv8A"; + compatible = "arm,rtsm_ve,aemv8a", "arm,vexpress"; + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + /* chosen */ + /* generated by u-boot */ + + + aliases { + serial0 = &v2m_serial0; + serial1 = &v2m_serial1; + serial2 = &v2m_serial2; + serial3 = &v2m_serial3; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu at 0 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <1>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 2 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <2>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 3 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <3>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + }; + + memory at 80000000 { + device_type = "memory"; + reg = <0x00000000 0x80000000 0 0x80000000>, + <0x00000008 0x80000000 0 0x80000000>; + }; + + gic: interrupt-controller at 2c001000 { + compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + #address-cells = <0>; + interrupt-controller; + reg = <0x0 0x2c001000 0 0x1000>, + <0x0 0x2c002000 0 0x1000>, + <0x0 0x2c004000 0 0x2000>, + <0x0 0x2c006000 0 0x2000>; + interrupts = <1 9 0xf04>; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = <1 13 0xff01>, + <1 14 0xff01>, + <1 11 0xff01>, + <1 10 0xff01>; + clock-frequency = <100000000>; + }; + + pmu { + compatible = "arm,armv8-pmuv3"; + interrupts = <0 60 4>, + <0 61 4>, + <0 62 4>, + <0 63 4>; + }; + + smb { + compatible = "simple-bus"; + + #address-cells = <2>; + #size-cells = <1>; + ranges = <0 0 0 0x08000000 0x04000000>, + <1 0 0 0x14000000 0x04000000>, + <2 0 0 0x18000000 0x04000000>, + <3 0 0 0x1c000000 0x04000000>, + <4 0 0 0x0c000000 0x04000000>, + <5 0 0 0x10000000 0x04000000>; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 63>; + interrupt-map = <0 0 0 &gic 0 0 4>, + <0 0 1 &gic 0 1 4>, + <0 0 2 &gic 0 2 4>, + <0 0 3 &gic 0 3 4>, + <0 0 4 &gic 0 4 4>, + <0 0 5 &gic 0 5 4>, + <0 0 6 &gic 0 6 4>, + <0 0 7 &gic 0 7 4>, + <0 0 8 &gic 0 8 4>, + <0 0 9 &gic 0 9 4>, + <0 0 10 &gic 0 10 4>, + <0 0 11 &gic 0 11 4>, + <0 0 12 &gic 0 12 4>, + <0 0 13 &gic 0 13 4>, + <0 0 14 &gic 0 14 4>, + <0 0 15 &gic 0 15 4>, + <0 0 16 &gic 0 16 4>, + <0 0 17 &gic 0 17 4>, + <0 0 18 &gic 0 18 4>, + <0 0 19 &gic 0 19 4>, + <0 0 20 &gic 0 20 4>, + <0 0 21 &gic 0 21 4>, + <0 0 22 &gic 0 22 4>, + <0 0 23 &gic 0 23 4>, + <0 0 24 &gic 0 24 4>, + <0 0 25 &gic 0 25 4>, + <0 0 26 &gic 0 26 4>, + <0 0 27 &gic 0 27 4>, + <0 0 28 &gic 0 28 4>, + <0 0 29 &gic 0 29 4>, + <0 0 30 &gic 0 30 4>, + <0 0 31 &gic 0 31 4>, + <0 0 32 &gic 0 32 4>, + <0 0 33 &gic 0 33 4>, + <0 0 34 &gic 0 34 4>, + <0 0 35 &gic 0 35 4>, + <0 0 36 &gic 0 36 4>, + <0 0 37 &gic 0 37 4>, + <0 0 38 &gic 0 38 4>, + <0 0 39 &gic 0 39 4>, + <0 0 40 &gic 0 40 4>, + <0 0 41 &gic 0 41 4>, + <0 0 42 &gic 0 42 4>; + + motherboard { + arm,v2m-memory-map = "rs1"; + compatible = "arm,vexpress,v2m-p1", "simple-bus"; + #address-cells = <2>; /* SMB chipselect number and offset */ + #size-cells = <1>; + #interrupt-cells = <1>; + ranges; + + flash at 0,00000000 { + compatible = "arm,vexpress-flash", "cfi-flash"; + reg = <0 0x00000000 0x04000000>, + <4 0x00000000 0x04000000>; + bank-width = <4>; + }; + + vram at 2,00000000 { + compatible = "arm,vexpress-vram"; + reg = <2 0x00000000 0x00800000>; + }; + + ethernet at 2,02000000 { + compatible = "smsc,lan91c111"; + reg = <2 0x02000000 0x10000>; + interrupts = <15>; + }; + + v2m_clk24mhz: clk24mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-output-names = "v2m:clk24mhz"; + }; + + v2m_refclk1mhz: refclk1mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1000000>; + clock-output-names = "v2m:refclk1mhz"; + }; + + v2m_refclk32khz: refclk32khz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "v2m:refclk32khz"; + }; + + iofpga at 3,00000000 { + compatible = "arm,amba-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 3 0 0x200000>; + + v2m_sysreg: sysreg at 010000 { + compatible = "arm,vexpress-sysreg"; + reg = <0x010000 0x1000>; + gpio-controller; + #gpio-cells = <2>; + }; + + v2m_sysctl: sysctl at 020000 { + compatible = "arm,sp810", "arm,primecell"; + reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_clk24mhz>; + clock-names = "refclk", "timclk", "apb_pclk"; + #clock-cells = <1>; + clock-output-names = "timerclken0", "timerclken1", "timerclken2", "timerclken3"; + }; + + aaci at 040000 { + compatible = "arm,pl041", "arm,primecell"; + reg = <0x040000 0x1000>; + interrupts = <11>; + clocks = <&v2m_clk24mhz>; + clock-names = "apb_pclk"; + }; + + mmci at 050000 { + compatible = "arm,pl180", "arm,primecell"; + reg = <0x050000 0x1000>; + interrupts = <9 10>; + cd-gpios = <&v2m_sysreg 0 0>; + wp-gpios = <&v2m_sysreg 1 0>; + max-frequency = <12000000>; + vmmc-supply = <&v2m_fixed_3v3>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "mclk", "apb_pclk"; + }; + + kmi at 060000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x060000 0x1000>; + interrupts = <12>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "KMIREFCLK", "apb_pclk"; + }; + + kmi at 070000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x070000 0x1000>; + interrupts = <13>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "KMIREFCLK", "apb_pclk"; + }; + + v2m_serial0: uart at 090000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x090000 0x1000>; + interrupts = <5>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial1: uart at 0a0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0a0000 0x1000>; + interrupts = <6>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial2: uart at 0b0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0b0000 0x1000>; + interrupts = <7>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial3: uart at 0c0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0c0000 0x1000>; + interrupts = <8>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + wdt at 0f0000 { + compatible = "arm,sp805", "arm,primecell"; + reg = <0x0f0000 0x1000>; + interrupts = <0>; + clocks = <&v2m_refclk32khz>, <&v2m_clk24mhz>; + clock-names = "wdogclk", "apb_pclk"; + }; + + v2m_timer01: timer at 110000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0x110000 0x1000>; + interrupts = <2>; + clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&v2m_clk24mhz>; + clock-names = "timclken1", "timclken2", "apb_pclk"; + }; + + v2m_timer23: timer at 120000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0x120000 0x1000>; + interrupts = <3>; + clocks = <&v2m_sysctl 2>, <&v2m_sysctl 3>, <&v2m_clk24mhz>; + clock-names = "timclken1", "timclken2", "apb_pclk"; + }; + + rtc at 170000 { + compatible = "arm,pl031", "arm,primecell"; + reg = <0x170000 0x1000>; + interrupts = <4>; + clocks = <&v2m_clk24mhz>; + clock-names = "apb_pclk"; + }; + + clcd at 1f0000 { + compatible = "arm,pl111", "arm,primecell"; + reg = <0x1f0000 0x1000>; + interrupts = <14>; + clocks = <&v2m_oscclk1>, <&v2m_clk24mhz>; + clock-names = "clcdclk", "apb_pclk"; + }; + }; + + v2m_fixed_3v3: fixedregulator at 0 { + compatible = "regulator-fixed"; + regulator-name = "3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + mcc { + compatible = "arm,vexpress,config-bus", "simple-bus"; + arm,vexpress,config-bridge = <&v2m_sysreg>; + + v2m_oscclk1: osc at 1 { + /* CLCD clock */ + compatible = "arm,vexpress-osc"; + arm,vexpress-sysreg,func = <1 1>; + freq-range = <23750000 63500000>; + #clock-cells = <0>; + clock-output-names = "v2m:oscclk1"; + }; + + reset at 0 { + compatible = "arm,vexpress-reset"; + arm,vexpress-sysreg,func = <5 0>; + }; + + muxfpga at 0 { + compatible = "arm,vexpress-muxfpga"; + arm,vexpress-sysreg,func = <7 0>; + }; + + shutdown at 0 { + compatible = "arm,vexpress-shutdown"; + arm,vexpress-sysreg,func = <8 0>; + }; + + reboot at 0 { + compatible = "arm,vexpress-reboot"; + arm,vexpress-sysreg,func = <9 0>; + }; + + dvimode at 0 { + compatible = "arm,vexpress-dvimode"; + arm,vexpress-sysreg,func = <11 0>; + }; + }; + }; + }; + + panels { + panel at 0 { + compatible = "panel"; + mode = "VGA"; + refresh = <60>; + xres = <640>; + yres = <480>; + pixclock = <39721>; + left_margin = <40>; + right_margin = <24>; + upper_margin = <32>; + lower_margin = <11>; + hsync_len = <96>; + vsync_len = <2>; + sync = <0>; + vmode = "FB_VMODE_NONINTERLACED"; + tim2 = "TIM2_BCD", "TIM2_IPC"; + cntl = "CNTL_LCDTFT", "CNTL_BGR", "CNTL_LCDVCOMP(1)"; + caps = "CLCD_CAP_5551", "CLCD_CAP_565", "CLCD_CAP_888"; + bpp = <16>; + }; + + panel at 1 { + compatible = "panel"; + mode = "XVGA"; + refresh = <60>; + xres = <1024>; + yres = <768>; + pixclock = <15748>; + left_margin = <152>; + right_margin = <48>; + upper_margin = <23>; + lower_margin = <3>; + hsync_len = <104>; + vsync_len = <4>; + sync = <0>; + vmode = "FB_VMODE_NONINTERLACED"; + tim2 = "TIM2_BCD", "TIM2_IPC"; + cntl = "CNTL_LCDTFT", "CNTL_BGR", "CNTL_LCDVCOMP(1)"; + caps = "CLCD_CAP_5551", "CLCD_CAP_565", "CLCD_CAP_888"; + bpp = <16>; + }; + }; +};
board/armltd/vexpress64/Makefile new file +43 -0
43 lines not on this page · raw message
board/armltd/vexpress64/vexpress64.c new file +79 -0
79 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 +203 -0
203 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v5 3/4 generic board patch of manual reloc and zero gd_t
In reply to fenghua at phytium.com.cnFrom: David Feng <[email protected]>
1. function board_init_f in board_f.c should firstly zero gd_t structure before it call initcall_run_list, otherwise the debug print will go run if DEBUG is defined. Because the printf function will use global data to determine whether serial port is initialized and could be written.
2. function board_init_r in board_r.c should firstly relocate init_sequence_r table before it call initcall_run_list. Command table also should be relocated.
---
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.
common/board_f.c | 19 +++++++++++++------ common/board_r.c | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-)
common/board_f.c +13 -6
@@ -458,7 +458,11 @@ static int reserve_round_4k(void)static int reserve_mmu (void ) {/* reserve TLB table */ +#ifndef CONFIG_ARMV8 gd->arch.tlb_size =4096 *4 ; +#else + gd->arch.tlb_size =0x10000 ; +#endif gd->relocaddr -= gd->arch.tlb_size;/* round down to next 64 kB limit */
@@ -610,7 +614,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 +811,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
@@ -1005,6 +1004,14 @@ void board_init_f(ulong boot_flags) gd = &data;#endif +/* +* Zero gd_t first, otherwise the debug print 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 +17 -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,15 @@ 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 v5 3/4 generic board patch of manual reloc and zero gd_t
In reply to fenghua at phytium.com.cnFrom: David Feng <[email protected]>
1. function board_init_f in board_f.c should firstly zero gd_t structure before it call initcall_run_list, otherwise the debug print will go run if DEBUG is defined. Because the printf function will use global data to determine whether serial port is initialized and could be written.
2. function board_init_r in board_r.c should firstly relocate init_sequence_r table before it call initcall_run_list. Command table also should be relocated.
---
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.
common/board_f.c | 19 +++++++++++++------ common/board_r.c | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-)
common/board_f.c +13 -6
@@ -458,7 +458,11 @@ static int reserve_round_4k(void)static int reserve_mmu (void ) {/* reserve TLB table */ +#ifndef CONFIG_ARMV8 gd->arch.tlb_size =4096 *4 ; +#else + gd->arch.tlb_size =0x10000 ; +#endif gd->relocaddr -= gd->arch.tlb_size;/* round down to next 64 kB limit */
@@ -610,7 +614,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 +811,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
@@ -1005,6 +1004,14 @@ void board_init_f(ulong boot_flags) gd = &data;#endif +/* +* Zero gd_t first, otherwise the debug print 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 +17 -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,15 @@ 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 v5 4/4 64bit initrd start address support
In reply to fenghua at phytium.com.cnFrom: David Feng <[email protected]>
This patch fix the fdt_initrd function.
It will get #adress_cells property fisrt, then write "linux,initrd-start" and "linux,initrd-end" property value to fdt according to address cell size such that the 64bit initrd start address could be supported.
---
Changes for v4:
- No
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 v5 4/4 64bit initrd start address support
In reply to fenghua at phytium.com.cnFrom: David Feng <[email protected]>
This patch fix the fdt_initrd function.
It will get #adress_cells property fisrt, then write "linux,initrd-start" and "linux,initrd-end" property value to fdt according to address cell size such that the 64bit initrd start address could be supported.
---
Changes for v4:
- No
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
v5 cover arm64 patch
In reply to fenghua at phytium.com.cnQuoted 1 line · fenghua at phytium.com.cn
From: David Feng <[email protected]>
Hi David,
I don't suppose you have a convenient git tree do you?
Thanks,
Ian.
v5 cover arm64 patch
Yes, currently I clone a git tree from u-boot and work on it. It's a little complicated when I update a new version patch. I must restore the git tree status and make modification then commit and generate the patches. Actually I use svn before. I am learning git now.
Many Thanks.
Best Regards.
David
Quoted 18 lines
-----????-----
???: "Ian Campbell" <[email protected]>
????: 2013?8?28? ???
???: fenghua at phytium.com.cn
??: u-boot at lists.denx.de, trini at ti.com
??: Re: [U-Boot] [PATCH v5 0/4] arm64 patchQuoted 1 line · fenghua at phytium.com.cn
From: David Feng <[email protected]>
Hi David,
I don't suppose you have a convenient git tree do you?
Thanks,
Ian.
v5 cover arm64 patch
In reply to fenghua at phytium.com.cnDear fenghua at phytium.com.cn,
Quoted 78 lines
From: David Feng <[email protected]>
The porting has been merged with arm architecture.
Most architecture codes are placed inarch/arm/cpu/armv8directory. Generic board is also supported after a few bugs are fixed.Changes for v4:
- fix the genericboard_f.c, removezero_global_datafrominit_sequence_f
array and move it toboard_init_f()function withCONFIG_X86switch. The previous fixup is inaccurate.
- Replace__ARMEB__with__AARCH64EB__inbyteorder.handunaligned.h, gcc for aarch64 use__AARCH64EB__and__AARCH64EL__to identify endian.
- Some modification to README.armv8David Feng (4):
core support of arm64
board support of arm64
generic board patch of manual reloc and zerogd_t64bit initrd start address supportarch/arm/config.mk | 4 + arch/arm/cpu/armv8/Makefile | 56 ++++ arch/arm/cpu/armv8/cache.S | 145 ++++++++++ arch/arm/cpu/armv8/cache_v8.c | 291 ++++++++++++++++++++ arch/arm/cpu/armv8/config.mk | 31 +++ arch/arm/cpu/armv8/cpu.c | 68 +++++ arch/arm/cpu/armv8/crt0.S | 130 +++++++++ arch/arm/cpu/armv8/exceptions.S | 182 +++++++++++++ arch/arm/cpu/armv8/interrupts.c | 116 ++++++++ arch/arm/cpu/armv8/relocate.S | 71 +++++ arch/arm/cpu/armv8/start.S | 200 ++++++++++++++ arch/arm/cpu/armv8/timer.c | 95 +++++++ arch/arm/cpu/armv8/tlb.S | 38 +++ arch/arm/cpu/armv8/u-boot.lds | 83 ++++++ arch/arm/include/asm/arch-armv8/armv8.h | 44 ++++ arch/arm/include/asm/arch-armv8/gpio.h | 26 ++ arch/arm/include/asm/arch-armv8/mmu.h | 117 ++++++++ arch/arm/include/asm/byteorder.h | 12 + arch/arm/include/asm/config.h | 10 + arch/arm/include/asm/global_data.h | 6 +- arch/arm/include/asm/io.h | 12 +- arch/arm/include/asm/macro.h | 26 ++ arch/arm/include/asm/posix_types.h | 31 +++ arch/arm/include/asm/proc-armv/ptrace.h | 38 +++ arch/arm/include/asm/proc-armv/system.h | 58 +++- arch/arm/include/asm/types.h | 14 + arch/arm/include/asm/u-boot.h | 4 + arch/arm/include/asm/unaligned.h | 14 + arch/arm/lib/Makefile | 8 + arch/arm/lib/board.c | 18 ++ arch/arm/lib/bootm.c | 16 ++ board/armltd/dts/vexpress64.dts | 439 +++++++++++++++++++++++++++++++ board/armltd/vexpress64/Makefile | 43 +++ board/armltd/vexpress64/vexpress64.c | 79 ++++++ boards.cfg | 1 + common/board_f.c | 19 +- common/board_r.c | 17 ++ common/fdt_support.c | 66 ++--- common/image.c | 1 + doc/README.armv8 | 14 + examples/standalone/stubs.c | 15 ++ include/configs/vexpress_aemv8a.h | 203 ++++++++++++++ include/image.h | 1 + 43 files changed, 2816 insertions(+), 46 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/crt0.S create mode 100644 arch/arm/cpu/armv8/exceptions.S create mode 100644 arch/arm/cpu/armv8/interrupts.c create mode 100644 arch/arm/cpu/armv8/relocate.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
Quoted 8 lines
create mode 100644 arch/arm/include/asm/arch-armv8/armv8.h 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 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
Quick skim over the patches seems rather OK.
Best regards,
Marek Vasut