{"id":816741,"url":"http://patchwork.ozlabs.org/api/covers/816741/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/cover/1505981969-49480-1-git-send-email-philipp.tomsich@theobroma-systems.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505981969-49480-1-git-send-email-philipp.tomsich@theobroma-systems.com>","list_archive_url":null,"date":"2017-09-21T08:19:23","name":"[U-Boot,v3,0/6] rockchip: back-to-bootrom: replace assembly-implementation with C-code","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/people/53488/?format=json","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/cover/1505981969-49480-1-git-send-email-philipp.tomsich@theobroma-systems.com/mbox/","series":[{"id":4327,"url":"http://patchwork.ozlabs.org/api/series/4327/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=4327","date":"2017-09-21T08:19:25","name":"rockchip: back-to-bootrom: replace assembly-implementation with C-code","version":3,"mbox":"http://patchwork.ozlabs.org/series/4327/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/816741/comments/","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyV1b0MzSz9t3C\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 18:21:07 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid C6B54C21F5E; Thu, 21 Sep 2017 08:20:30 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 4BA1CC21F8D;\n\tThu, 21 Sep 2017 08:19:52 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid D94CCC21E85; Thu, 21 Sep 2017 08:19:47 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id 7F60CC21EB1\n\tfor <u-boot@lists.denx.de>; Thu, 21 Sep 2017 08:19:46 +0000 (UTC)","from [86.59.122.178] (port=36209 helo=android.lan)\n\tby mail.theobroma-systems.com with esmtpsa\n\t(TLS1.2:RSA_AES_128_CBC_SHA256:128)\n\t(Exim 4.80) (envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1duwhx-0003Re-GQ; Thu, 21 Sep 2017 10:19:41 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","From":"Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","To":"u-boot@lists.denx.de","Date":"Thu, 21 Sep 2017 10:19:23 +0200","Message-Id":"<1505981969-49480-1-git-send-email-philipp.tomsich@theobroma-systems.com>","X-Mailer":"git-send-email 2.1.4","Cc":"Klaus Goger <klaus.goger@theobroma-systems.com>,\n\tStefan Roese <sr@denx.de>, Stephen Warren <swarren@nvidia.com>,\n\tAndre Przywara <andre.przywara@arm.com>, \n\tNisal Menuka <nisalmenuka23@gmail.com>, Jagan Teki <jagan@openedev.com>, \n\tAndy Yan <andy.yan@rock-chips.com>","Subject":"[U-Boot] [PATCH v3 0/6] rockchip: back-to-bootrom: replace\n\tassembly-implementation with C-code","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"Recent discussions confirmed (what the code always assumed): the\nRockchip BROM always enters U-Boot with the stack-pointer valid\n(i.e. the U-Boot startup code is running off the BROM stack).\n\nWe can thus replace the back-to-bootrom code (i.e. both the\nsave_boot_params and back_to_bootrom implementations) using C-code\nbased on setjmp/longjmp.  The new implementation is already structured\nto allow an easy drop-in of Andy's changes to enter download-mode when\nreturning to the BROM.\n\nThis turned out to require a some tweaking to system.h (making sure\nthat the prototype for save_boot_params_ret is visible for A64)and\nstart.S (so binutils knows that this is a possible function entry and\nit can correctly insert A32-to-Thumb transitions) and taking the axe\nto setjmp.h (which created quite a few issues with it not expecting\nA32/T32/Thumb call-sites and some fragility from GCC being smart about\nthe clobber-list of the inline assembly... which led to r9 not being\nsaved or restored).\n\nChanges in v3:\n- tracked the root-cause why no interwork branch was emitted and fixed\n  it using a '.type'-directive in start.S to mark save_boot_params_ret\n  as a (possible) function-entry.\n- converted setjmp/longjmp from inline-assembly to separate .S files\n  to improve predicatability if emitted code\n\nChanges in v2:\n- [added in v2] chain back_to_bootrom calls for SPL, first returning\n  to the TPL (using the same mechanism) and the to the BROM from the\n  TPL\n- also covers the RK3188 (which I had originally missed)\n\nPhilipp Tomsich (6):\n  arm: make save_boot_params_ret prototype visible for AArch64\n  arm: mark save_boot_params_ret as a function\n  arm: provide a PCS-compliant setjmp implementation\n  rockchip: back-to-bootrom: replace assembly-implementation with C-code\n  rockchip: back-to-bootrom: rk3188: chain from SPL via TPL to the BROM\n  rockchip: back-to-bootrom: allow passing a cmd to the bootrom\n\n arch/arm/cpu/armv7/start.S                   |  1 +\n arch/arm/include/asm/arch-rockchip/bootrom.h | 30 ++++++---\n arch/arm/include/asm/setjmp.h                | 94 ++++------------------------\n arch/arm/include/asm/system.h                | 62 +++++++++---------\n arch/arm/lib/Makefile                        |  6 ++\n arch/arm/lib/setjmp.S                        | 37 +++++++++++\n arch/arm/lib/setjmp_aarch64.S                | 42 +++++++++++++\n arch/arm/mach-rockchip/Makefile              |  4 +-\n arch/arm/mach-rockchip/bootrom.c             | 54 +++++++++++++++-\n arch/arm/mach-rockchip/rk3036-board-spl.c    |  2 +-\n arch/arm/mach-rockchip/rk3188-board-spl.c    | 14 +----\n arch/arm/mach-rockchip/rk3188-board-tpl.c    | 19 +++---\n arch/arm/mach-rockchip/rk322x-board-spl.c    |  2 +-\n arch/arm/mach-rockchip/rk3288-board-spl.c    |  4 +-\n arch/arm/mach-rockchip/rk3368-board-tpl.c    |  2 +-\n arch/arm/mach-rockchip/rk3399-board-spl.c    |  2 +-\n arch/arm/mach-rockchip/save_boot_param.S     | 69 --------------------\n 17 files changed, 226 insertions(+), 218 deletions(-)\n create mode 100644 arch/arm/lib/setjmp.S\n create mode 100644 arch/arm/lib/setjmp_aarch64.S\n delete mode 100644 arch/arm/mach-rockchip/save_boot_param.S"}