
Hi David,
On Thu, Aug 15, 2013 at 11:02 PM, FengHua fenghua@phytium.com.cn wrote:
hi Simon, I have worked on generic board for a few days, but something confuse me. Why it is needed? Each processor architecture has different features, this will affect processor specific and board specific code. Putting board_init_* code of each platform into one file with many macro switch make things messy, the board_f.c and board_r.c become very complicated and less readable. Is it really needed? We should make it clear that what parts are common between architecture and what parts are specific. Actually, I have different opinion with this. Architecture specific board.c file have more advantages. how ahout your opinion?
Scott's reply jogged my memory to reply to this.
I suspect having a board.c for each arch was a good idea at the start, and it was hard to reconcile the different ordering and init needs of each arch as it was added. It was much each when porting to a new arch to just copy one of the existing archs and modify the code until it works.
Unfortunately, this means we have about 10 different versions of what turns out to be mostly the same code. The generic board effort was an attempt to unify these into one. While I agree there are lots of #idefs I think that is a separate problem, and at least the code is now all in one file. As a first step it would be nice to sort through and weed out the arch-specific #idefs in common/board_{f,r}.c.
Related to this is global_data and the board data in bd_t. These structures have been unified and again found to contain a lot of common elements across archs.
As a specific example of where having generic board init helps, it is now possible to add a new feature to all archs without changing 10 different files. For example the trace feature was added that way. Decide tree support (CONFIG_OF_CONTROL) can in principle be turned on for any arch by porting it to generic board.
So far ARM and PowerPC support generic board, and x86 and sandbox use it exclusively (i.e. their old board.c code is removed).
As it turns out, this board.c file is not really very arch-specific, as Scott says. It should not be a huge job to make aarch64 use it instead of its own board.c although I am sure there will be a few curly problems.
We have not talked about this on the list, and it is far to early yet, but at some point it would be nice to deprecate the old board.c files.
Regards, Simon
Best Regards. David
-----原始邮件----- 发件人: "Simon Glass" sjg@chromium.org 发送时间: 2013年8月16日 星期五 收件人: fenghua@phytium.com.cn 抄送: "U-Boot Mailing List" u-boot@lists.denx.de, "trini@ti.com" trini@ti.com 主题: Re: [U-Boot] [PATCH v3 0/5] arm64 patch
Hi David,
On Thu, Aug 15, 2013 at 7:47 AM, fenghua@phytium.com.cn wrote:
From: David Feng fenghua@phytium.com.cn
*** BLURB HERE *** Changes for v3: - rewrite cache.S and exception.S that partly originated from linux kernel, so the license should be ok. - according to scott wood's advice, make the fdt 64bit initrd start address support a seperate patch.
David Feng (5): core support of arm64 board support of arm64 arch support 1 of arm64 arch support 2 of arm64 64bit initrd start address support
arch/arm64/config.mk | 32 +++ arch/arm64/cpu/armv8/Makefile | 51 ++++ arch/arm64/cpu/armv8/cache.S | 144 ++++++++++ arch/arm64/cpu/armv8/config.mk | 29 ++ arch/arm64/cpu/armv8/cpu.c | 108 ++++++++ arch/arm64/cpu/armv8/exceptions.S | 189 +++++++++++++ arch/arm64/cpu/armv8/start.S | 197 ++++++++++++++ arch/arm64/cpu/armv8/tlb.S | 38 +++ arch/arm64/cpu/u-boot.lds | 73 +++++ arch/arm64/dts/aemv8a.dtsi | 234 ++++++++++++++++ arch/arm64/include/asm/arch-armv8/mmu.h | 117 ++++++++ arch/arm64/include/asm/atomic.h | 115 ++++++++ arch/arm64/include/asm/bitops.h | 153 +++++++++++ arch/arm64/include/asm/byteorder.h | 31 +++ arch/arm64/include/asm/cache.h | 53 ++++ arch/arm64/include/asm/config.h | 41 +++ arch/arm64/include/asm/errno.h | 1 + arch/arm64/include/asm/global_data.h | 38 +++ arch/arm64/include/asm/gpio.h | 1 + arch/arm64/include/asm/io.h | 193 +++++++++++++ arch/arm64/include/asm/linkage.h | 49 ++++ arch/arm64/include/asm/posix_types.h | 61 +++++ arch/arm64/include/asm/processor.h | 59 ++++ arch/arm64/include/asm/ptrace.h | 64 +++++ arch/arm64/include/asm/sections.h | 27 ++ arch/arm64/include/asm/string.h | 49 ++++ arch/arm64/include/asm/system.h | 106 ++++++++ arch/arm64/include/asm/types.h | 67 +++++ arch/arm64/include/asm/u-boot.h | 38 +++ arch/arm64/include/asm/unaligned.h | 28 ++ arch/arm64/include/asm/utils.h | 56 ++++ arch/arm64/lib/Makefile | 64 +++++ arch/arm64/lib/board.c | 453 +++++++++++++++++++++++++++++++
Instead of this file, it would be good if you could make it use generic board - see CONFIG_SYS_GENERIC_BOARD in the README.
arch/arm64/lib/bootm.c | 211 ++++++++++++++ arch/arm64/lib/cache.c | 282 +++++++++++++++++++ arch/arm64/lib/crt0.S | 129 +++++++++ arch/arm64/lib/interrupts.c | 109 ++++++++ arch/arm64/lib/relocate.S | 72 +++++ arch/arm64/lib/reset.c | 37 +++ arch/arm64/lib/timer.c | 95 +++++++ board/armltd/dts/vexpress64.dts | 215 +++++++++++++++ board/armltd/vexpress64/Makefile | 43 +++ board/armltd/vexpress64/vexpress64.c | 63 +++++ boards.cfg | 1 + common/cmd_bdinfo.c | 32 +++ common/fdt_support.c | 66 ++--- common/image.c | 5 +- doc/README.arm64 | 10 + examples/standalone/stubs.c | 13 + include/configs/vexpress_aemv8a.h | 200 ++++++++++++++ include/image.h | 1 + lib/asm-offsets.c | 4 - 52 files changed, 4509 insertions(+), 38 deletions(-) create mode 100644 arch/arm64/config.mk create mode 100644 arch/arm64/cpu/armv8/Makefile create mode 100644 arch/arm64/cpu/armv8/cache.S create mode 100644 arch/arm64/cpu/armv8/config.mk create mode 100644 arch/arm64/cpu/armv8/cpu.c create mode 100644 arch/arm64/cpu/armv8/exceptions.S create mode 100644 arch/arm64/cpu/armv8/start.S create mode 100644 arch/arm64/cpu/armv8/tlb.S create mode 100644 arch/arm64/cpu/u-boot.lds create mode 100644 arch/arm64/dts/aemv8a.dtsi create mode 100644 arch/arm64/include/asm/arch-armv8/mmu.h create mode 100644 arch/arm64/include/asm/atomic.h create mode 100644 arch/arm64/include/asm/bitops.h create mode 100644 arch/arm64/include/asm/byteorder.h create mode 100644 arch/arm64/include/asm/cache.h create mode 100644 arch/arm64/include/asm/config.h create mode 100644 arch/arm64/include/asm/errno.h create mode 100644 arch/arm64/include/asm/global_data.h create mode 100644 arch/arm64/include/asm/gpio.h create mode 100644 arch/arm64/include/asm/io.h create mode 100644 arch/arm64/include/asm/linkage.h create mode 100644 arch/arm64/include/asm/posix_types.h create mode 100644 arch/arm64/include/asm/processor.h create mode 100644 arch/arm64/include/asm/ptrace.h create mode 100644 arch/arm64/include/asm/sections.h create mode 100644 arch/arm64/include/asm/string.h create mode 100644 arch/arm64/include/asm/system.h create mode 100644 arch/arm64/include/asm/types.h create mode 100644 arch/arm64/include/asm/u-boot.h create mode 100644 arch/arm64/include/asm/unaligned.h create mode 100644 arch/arm64/include/asm/utils.h create mode 100644 arch/arm64/lib/Makefile create mode 100644 arch/arm64/lib/board.c create mode 100644 arch/arm64/lib/bootm.c create mode 100644 arch/arm64/lib/cache.c create mode 100644 arch/arm64/lib/crt0.S create mode 100644 arch/arm64/lib/interrupts.c create mode 100644 arch/arm64/lib/relocate.S create mode 100644 arch/arm64/lib/reset.c create mode 100644 arch/arm64/lib/timer.c 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.arm64 create mode 100644 include/configs/vexpress_aemv8a.h
Regards, Simon