get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/814237/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 814237,
    "url": "http://patchwork.ozlabs.org/api/patches/814237/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1505476946-64991-3-git-send-email-philipp.tomsich@theobroma-systems.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "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": "<1505476946-64991-3-git-send-email-philipp.tomsich@theobroma-systems.com>",
    "list_archive_url": null,
    "date": "2017-09-15T12:02:25",
    "name": "[U-Boot,2/3] rockchip: back-to-bootrom: replace assembly-implementation with C-code",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6bcf4b16476615aebf3f8ef92c0d334e1e67bab2",
    "submitter": {
        "id": 53488,
        "url": "http://patchwork.ozlabs.org/api/people/53488/?format=api",
        "name": "Philipp Tomsich",
        "email": "philipp.tomsich@theobroma-systems.com"
    },
    "delegate": {
        "id": 69486,
        "url": "http://patchwork.ozlabs.org/api/users/69486/?format=api",
        "username": "ptomsich",
        "first_name": "Philipp",
        "last_name": "Tomsich",
        "email": "philipp.tomsich@theobroma-systems.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1505476946-64991-3-git-send-email-philipp.tomsich@theobroma-systems.com/mbox/",
    "series": [
        {
            "id": 3289,
            "url": "http://patchwork.ozlabs.org/api/series/3289/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=3289",
            "date": "2017-09-15T12:02:25",
            "name": "rockchip: back-to-bootrom: replace assembly-implementation with C-code",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/3289/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/814237/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/814237/checks/",
    "tags": {},
    "related": [],
    "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 3xtvDL5jZpz9t2h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 22:02:58 +1000 (AEST)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid 815ACC21FF8; Fri, 15 Sep 2017 12:02:54 +0000 (UTC)",
            "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 7440DC21E23;\n\tFri, 15 Sep 2017 12:02:50 +0000 (UTC)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid B23AFC21DDD; Fri, 15 Sep 2017 12:02:48 +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 EA415C21F67\n\tfor <u-boot@lists.denx.de>; Fri, 15 Sep 2017 12:02:35 +0000 (UTC)",
            "from [86.59.122.178] (port=33028 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 1dspKL-00029w-DF; Fri, 15 Sep 2017 14:02:33 +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": "Fri, 15 Sep 2017 14:02:25 +0200",
        "Message-Id": "<1505476946-64991-3-git-send-email-philipp.tomsich@theobroma-systems.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1505476946-64991-1-git-send-email-philipp.tomsich@theobroma-systems.com>",
        "References": "<1505476946-64991-1-git-send-email-philipp.tomsich@theobroma-systems.com>",
        "Cc": "Albert Aribaud <albert.u.boot@aribaud.net>,\n\tKlaus Goger <klaus.goger@theobroma-systems.com>,\n\tAndy Yan <andy.yan@rock-chips.com>",
        "Subject": "[U-Boot] [PATCH 2/3] 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": "The back-to-bootrom implementation for Rockchip has always relied on\nthe stack-pointer being valid on entry, so there was little reason to\nhave this as an assembly implementation.\n\nThis provides a new C-only implementation of save_boot_params and\nback_to_bootrom (relying on setjmp/longjmp) and removes the older\nassembly-only implementation.\n\nSigned-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n---\n\n arch/arm/include/asm/arch-rockchip/bootrom.h | 27 ++++++++---\n arch/arm/mach-rockchip/Makefile              |  4 +-\n arch/arm/mach-rockchip/bootrom.c             | 52 ++++++++++++++++++++-\n arch/arm/mach-rockchip/save_boot_param.S     | 69 ----------------------------\n 4 files changed, 73 insertions(+), 79 deletions(-)\n delete mode 100644 arch/arm/mach-rockchip/save_boot_param.S",
    "diff": "diff --git a/arch/arm/include/asm/arch-rockchip/bootrom.h b/arch/arm/include/asm/arch-rockchip/bootrom.h\nindex 169cc5e..2f61a33 100644\n--- a/arch/arm/include/asm/arch-rockchip/bootrom.h\n+++ b/arch/arm/include/asm/arch-rockchip/bootrom.h\n@@ -1,5 +1,6 @@\n /*\n  * (C) Copyright 2017 Heiko Stuebner <heiko@sntech.de>\n+ * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH\n  *\n  * SPDX-License-Identifier:\tGPL-2.0\n  */\n@@ -14,15 +15,27 @@\n extern u32 SAVE_SP_ADDR;\n \n /**\n- * Hand control back to the bootrom to load another\n- * boot stage.\n+ * back_to_bootrom() - return to bootrom (for TPL/SPL), passing a\n+ *                     result code\n+ *\n+ * Transfer control back to the Rockchip BROM, restoring necessary\n+ * register context and passing a command/result code to the BROM\n+ * to instruct its next actions (e.g. continue boot sequence, enter\n+ * download mode, ...).\n+ *\n+ * This function does not return.\n  */\n-void back_to_bootrom(void);\n+enum rockchip_bootrom_cmd {\n+\t/*\n+\t * These can not start at 0, as 0 has a special meaning\n+\t * for setjmp().\n+\t */\n \n-/**\n- * Assembler component for the above (do not call this directly)\n- */\n-void _back_to_bootrom_s(void);\n+\tBROM_BOOT_NEXTSTAGE = 1,  /* continue boot-sequence */\n+\tBROM_BOOT_ENTER_DNL,      /* have BROM enter download-mode */\n+};\n+\n+void back_to_bootrom(void);\n \n /**\n  * Boot-device identifiers as used by the BROM\ndiff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile\nindex 79e9704..f8b23ea 100644\n--- a/arch/arm/mach-rockchip/Makefile\n+++ b/arch/arm/mach-rockchip/Makefile\n@@ -8,8 +8,8 @@\n # this may have entered from ATF with the stack-pointer pointing to\n # inaccessible/protected memory (and the bootrom-helper assumes that\n # the stack-pointer is valid before switching to the U-Boot stack).\n-obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o save_boot_param.o\n-obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o save_boot_param.o\n+obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o\n+obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o\n \n obj-tpl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o\n obj-tpl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-tpl.o\ndiff --git a/arch/arm/mach-rockchip/bootrom.c b/arch/arm/mach-rockchip/bootrom.c\nindex 8380e4e..7b9b307 100644\n--- a/arch/arm/mach-rockchip/bootrom.c\n+++ b/arch/arm/mach-rockchip/bootrom.c\n@@ -6,11 +6,61 @@\n \n #include <common.h>\n #include <asm/arch/bootrom.h>\n+#include <asm/setjmp.h>\n+#include <asm/system.h>\n+\n+/*\n+ * Force the jmp_buf to the data-section, as .bss will not be valid\n+ * when save_boot_params is invoked.\n+ */\n+static jmp_buf brom_ctx __section(\".data\");\n \n void back_to_bootrom(void)\n {\n #if CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT)\n \tputs(\"Returning to boot ROM...\\n\");\n #endif\n-\t_back_to_bootrom_s();\n+\tlongjmp(brom_ctx, BROM_BOOT_NEXTSTAGE);\n+}\n+\n+/*\n+ * All Rockchip BROM implementations enter with a valid stack-pointer,\n+ * so this can safely be implemented in C (providing a single\n+ * implementation both for ARMv7 and AArch64).\n+ */\n+int save_boot_params(void)\n+{\n+\tint  ret = setjmp(brom_ctx);\n+\n+\tswitch (ret) {\n+\tcase 0:\n+\t\t/*\n+\t\t * This is the initial pass through this function\n+\t\t * (i.e. saving the context), setjmp just setup up the\n+\t\t * brom_ctx: transfer back into the startup-code at\n+\t\t * 'save_boot_params_ret' and let the compiler know\n+\t\t * that this will not return.\n+\t\t */\n+\t\tsave_boot_params_ret();\n+\t\twhile (true)\n+\t\t\t/* does not return */;\n+\t\tbreak;\n+\n+\tcase BROM_BOOT_NEXTSTAGE:\n+\t\t/*\n+\t\t * To instruct the BROM to boot the next stage, we\n+\t\t * need to return 0 to it: i.e. we need to rewrite\n+\t\t * the return code once more.\n+\t\t */\n+\t\tret = 0;\n+\t\tbreak;\n+\n+\tdefault:\n+#if CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT)\n+\t\tputs(\"FATAL: unexpected command to back_to_bootrom()\\n\");\n+#endif\n+\t\thang();\n+\t};\n+\n+\treturn ret;\n }\ndiff --git a/arch/arm/mach-rockchip/save_boot_param.S b/arch/arm/mach-rockchip/save_boot_param.S\ndeleted file mode 100644\nindex 50fce20..0000000\n--- a/arch/arm/mach-rockchip/save_boot_param.S\n+++ /dev/null\n@@ -1,69 +0,0 @@\n-/*\n- * (C) Copyright 2016 Rockchip Electronics Co., Ltd\n- * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH\n- *\n- * SPDX-License-Identifier:     GPL-2.0+\n- */\n-\n-#include <linux/linkage.h>\n-\n-#if defined(CONFIG_ARM64)\n-.globl\tSAVE_SP_ADDR\n-SAVE_SP_ADDR:\n-\t.quad 0\n-\n-ENTRY(save_boot_params)\n-\tsub\tsp, sp, #0x60\n-\tstp\tx29, x30, [sp, #0x50]\n-\tstp\tx27, x28, [sp, #0x40]\n-\tstp\tx25, x26, [sp, #0x30]\n-\tstp\tx23, x24, [sp, #0x20]\n-\tstp\tx21, x22, [sp, #0x10]\n-\tstp\tx19, x20, [sp, #0]\n-\tldr\tx8, =SAVE_SP_ADDR\n-\tmov\tx9, sp\n-\tstr\tx9, [x8]\n-\tb\tsave_boot_params_ret  /* back to my caller */\n-ENDPROC(save_boot_params)\n-\n-.globl _back_to_bootrom_s\n-ENTRY(_back_to_bootrom_s)\n-\tldr\tx0, =SAVE_SP_ADDR\n-\tldr\tx0, [x0]\n-\tmov\tsp, x0\n-\tldp\tx29, x30, [sp, #0x50]\n-\tldp\tx27, x28, [sp, #0x40]\n-\tldp\tx25, x26, [sp, #0x30]\n-\tldp\tx23, x24, [sp, #0x20]\n-\tldp\tx21, x22, [sp, #0x10]\n-\tldp\tx19, x20, [sp]\n-\tadd\tsp, sp, #0x60\n-\tmov\tx0, xzr\n-\tret\n-ENDPROC(_back_to_bootrom_s)\n-#else\n-.globl\tSAVE_SP_ADDR\n-SAVE_SP_ADDR:\n-\t.word 0\n-\n-/*\n- * void save_boot_params\n- *\n- * Save sp, lr, r1~r12\n- */\n-ENTRY(save_boot_params)\n-\tpush\t{r1-r12, lr}\n-\tldr\tr0, =SAVE_SP_ADDR\n-\tstr\tsp, [r0]\n-\tb\tsave_boot_params_ret\t\t@ back to my caller\n-ENDPROC(save_boot_params)\n-\n-\n-.globl _back_to_bootrom_s\n-ENTRY(_back_to_bootrom_s)\n-\tldr\tr0, =SAVE_SP_ADDR\n-\tldr\tsp, [r0]\n-\tmov\tr0, #0\n-\tpop\t{r1-r12, pc}\n-ENDPROC(_back_to_bootrom_s)\n-#endif\n",
    "prefixes": [
        "U-Boot",
        "2/3"
    ]
}