All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 00/18] rockchip: back-to-bootrom: replace assembly-implementation with C-code
Date: Tue, 10 Oct 2017 16:21:00 +0200	[thread overview]
Message-ID: <1507645279-25188-1-git-send-email-philipp.tomsich@theobroma-systems.com> (raw)


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).

For v4+: To fix issues with the RK3188 support, this also updates the
boot0 hook changes (i.e. allowing the boot0-hook to insert code/data
before the ARM vector table) that Kever had submitted this spring and
implements a similar "early back-to-bootrom" as suggested by Pawel
(for the RK3066) as a generic mechanism.


Changes in v5:
- set return value to 0 before returning to the BROM

Changes in v4:
- after merging the 'back-to-bootrom' series with the 'boot0-hook'
  series, this drops the TPL stub and builds only a single SPL image
  that uses the 'early back-to-bootrom' logic originally implemented
  by Pawel for the RK3066.
- changes the SPL_STACK_BASE to +0x800 (from +0x804), as the boot0
  hook already reserves the space for the SPL magic (previously
  inserted by mkimage)
- no longer updates rk3188-board-tpl.c (as we have just removed it
  in an earlier commit)

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)

Kever Yang (3):
  rockchip: boot0: align to 0x20 for armv7 '_start'
  rockchip: mkimage: use spl_boot0 for all Rockchip SoCs
  rockchip: rk3288: use aligned address for SPL_TEXT_BASE

Philipp Tomsich (15):
  arm: boot0 hook: move boot0 hook before '_start'
  rockchip: enable boot0-hook for all Rockchip SoCs
  rockchip: rk3036: use aligned address for SPL_TEXT_BASE
  socfpga: boot0 hook: adjust to unified boot0 semantics
  bcm235xx: boot0 hook: adjust to unified boot0 semantics
  bcm281xx: boot0 hook: adjust to unified boot0 semantics
  rockchip: boot0 hook: support early return for RK3188/RK3066-style
    BROM
  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: rk3188: use boot0 hook to load up SPL in 2 steps
  rockchip: back-to-bootrom: allow passing a cmd to the bootrom
  rockchip: rk3188: move CONFIG_SPL_* entries from rk3188_common.h to
    Kconfig
  rockchip: mkimage: remove unused code-paths (spl_boot0 is now implied)

 arch/arm/Kconfig                             |  1 +
 arch/arm/cpu/armv7/start.S                   |  1 +
 arch/arm/include/asm/arch-bcm235xx/boot0.h   |  2 +
 arch/arm/include/asm/arch-bcm281xx/boot0.h   |  2 +
 arch/arm/include/asm/arch-rockchip/boot0.h   | 38 ++++++++---
 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/lib/vectors.S                       | 54 ++++++++++------
 arch/arm/mach-rockchip/Kconfig               | 39 ++++++++++--
 arch/arm/mach-rockchip/Makefile              |  5 +-
 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    | 86 -------------------------
 arch/arm/mach-rockchip/rk322x-board-spl.c    |  2 +-
 arch/arm/mach-rockchip/rk3288-board-spl.c    |  4 +-
 arch/arm/mach-rockchip/rk3288-board-tpl.c    |  2 +-
 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 --------------------
 arch/arm/mach-socfpga/include/mach/boot0.h   |  3 +
 doc/README.rockchip                          | 10 +--
 include/configs/rk3036_common.h              |  2 +-
 include/configs/rk3188_common.h              | 18 +-----
 include/configs/rk3288_common.h              |  2 +-
 tools/rkcommon.c                             | 45 +++++--------
 30 files changed, 348 insertions(+), 382 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/rk3188-board-tpl.c
 delete mode 100644 arch/arm/mach-rockchip/save_boot_param.S

-- 
2.1.4

             reply	other threads:[~2017-10-10 14:21 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 14:21 Philipp Tomsich [this message]
2017-10-10 14:21 ` [U-Boot] [PATCH v5 01/18] arm: boot0 hook: move boot0 hook before '_start' Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 02/18] rockchip: boot0: align to 0x20 for armv7 '_start' Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-11-09 12:59   ` [U-Boot] [PATCH v5 " Andy Yan
2017-11-09 13:03     ` Dr. Philipp Tomsich
2017-11-10  3:43       ` Kever Yang
2017-10-10 14:21 ` [U-Boot] [PATCH v5 03/18] rockchip: enable boot0-hook for all Rockchip SoCs Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 04/18] rockchip: mkimage: use spl_boot0 " Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 05/18] rockchip: rk3288: use aligned address for SPL_TEXT_BASE Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 06/18] rockchip: rk3036: " Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 07/18] socfpga: boot0 hook: adjust to unified boot0 semantics Philipp Tomsich
2017-11-06 17:26   ` Dr. Philipp Tomsich
2017-11-06 17:54     ` Marek Vasut
2017-11-06 17:55       ` Dr. Philipp Tomsich
2017-11-06 17:57         ` Marek Vasut
2017-11-07  4:46           ` Chee, Tien Fong
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 08/18] bcm235xx: " Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 09/18] bcm281xx: " Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 10/18] rockchip: boot0 hook: support early return for RK3188/RK3066-style BROM Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 11/18] arm: make save_boot_params_ret prototype visible for AArch64 Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 12/18] arm: mark save_boot_params_ret as a function Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 13/18] arm: provide a PCS-compliant setjmp implementation Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 14/18] rockchip: back-to-bootrom: replace assembly-implementation with C-code Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 15/18] rockchip: rk3188: use boot0 hook to load up SPL in 2 steps Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 16/18] rockchip: back-to-bootrom: allow passing a cmd to the bootrom Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 17/18] rockchip: rk3188: move CONFIG_SPL_* entries from rk3188_common.h to Kconfig Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-10 14:21 ` [U-Boot] [PATCH v5 18/18] rockchip: mkimage: remove unused code-paths (spl_boot0 is now implied) Philipp Tomsich
2017-11-07 14:18   ` [U-Boot] [U-Boot, v5, " Philipp Tomsich
2017-10-11 13:07 ` [U-Boot] [PATCH v5 00/18] rockchip: back-to-bootrom: replace assembly-implementation with C-code Heiko Stuebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507645279-25188-1-git-send-email-philipp.tomsich@theobroma-systems.com \
    --to=philipp.tomsich@theobroma-systems.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.