[U-Boot] [PATCH v3 0/6] rockchip: back-to-bootrom: replace assembly-implementation with C-code

Philipp Tomsich philipp.tomsich at theobroma-systems.com
Thu Sep 21 08:19:23 UTC 2017


Recent discussions confirmed (what the code always assumed): the
Rockchip BROM always enters U-Boot with the stack-pointer valid
(i.e. the U-Boot startup code is running off the BROM stack).

We can thus replace the back-to-bootrom code (i.e. both the
save_boot_params and back_to_bootrom implementations) using C-code
based on setjmp/longjmp.  The new implementation is already structured
to allow an easy drop-in of Andy's changes to enter download-mode when
returning to the BROM.

This turned out to require a some tweaking to system.h (making sure
that the prototype for save_boot_params_ret is visible for A64)and
start.S (so binutils knows that this is a possible function entry and
it can correctly insert A32-to-Thumb transitions) and taking the axe
to setjmp.h (which created quite a few issues with it not expecting
A32/T32/Thumb call-sites and some fragility from GCC being smart about
the clobber-list of the inline assembly... which led to r9 not being
saved or restored).

Changes in v3:
- tracked the root-cause why no interwork branch was emitted and fixed
  it using a '.type'-directive in start.S to mark save_boot_params_ret
  as a (possible) function-entry.
- converted setjmp/longjmp from inline-assembly to separate .S files
  to improve predicatability if emitted code

Changes in v2:
- [added in v2] chain back_to_bootrom calls for SPL, first returning
  to the TPL (using the same mechanism) and the to the BROM from the
  TPL
- also covers the RK3188 (which I had originally missed)

Philipp Tomsich (6):
  arm: make save_boot_params_ret prototype visible for AArch64
  arm: mark save_boot_params_ret as a function
  arm: provide a PCS-compliant setjmp implementation
  rockchip: back-to-bootrom: replace assembly-implementation with C-code
  rockchip: back-to-bootrom: rk3188: chain from SPL via TPL to the BROM
  rockchip: back-to-bootrom: allow passing a cmd to the bootrom

 arch/arm/cpu/armv7/start.S                   |  1 +
 arch/arm/include/asm/arch-rockchip/bootrom.h | 30 ++++++---
 arch/arm/include/asm/setjmp.h                | 94 ++++------------------------
 arch/arm/include/asm/system.h                | 62 +++++++++---------
 arch/arm/lib/Makefile                        |  6 ++
 arch/arm/lib/setjmp.S                        | 37 +++++++++++
 arch/arm/lib/setjmp_aarch64.S                | 42 +++++++++++++
 arch/arm/mach-rockchip/Makefile              |  4 +-
 arch/arm/mach-rockchip/bootrom.c             | 54 +++++++++++++++-
 arch/arm/mach-rockchip/rk3036-board-spl.c    |  2 +-
 arch/arm/mach-rockchip/rk3188-board-spl.c    | 14 +----
 arch/arm/mach-rockchip/rk3188-board-tpl.c    | 19 +++---
 arch/arm/mach-rockchip/rk322x-board-spl.c    |  2 +-
 arch/arm/mach-rockchip/rk3288-board-spl.c    |  4 +-
 arch/arm/mach-rockchip/rk3368-board-tpl.c    |  2 +-
 arch/arm/mach-rockchip/rk3399-board-spl.c    |  2 +-
 arch/arm/mach-rockchip/save_boot_param.S     | 69 --------------------
 17 files changed, 226 insertions(+), 218 deletions(-)
 create mode 100644 arch/arm/lib/setjmp.S
 create mode 100644 arch/arm/lib/setjmp_aarch64.S
 delete mode 100644 arch/arm/mach-rockchip/save_boot_param.S

-- 
2.1.4



More information about the U-Boot mailing list