From patchwork Thu Sep 10 11:00:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1361496 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=BvQGGzmF; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BnGCs4Th4z9sSJ for ; Thu, 10 Sep 2020 21:01:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 416D38229B; Thu, 10 Sep 2020 13:01:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="BvQGGzmF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 463D7822D8; Thu, 10 Sep 2020 13:01:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 39BBE82286 for ; Thu, 10 Sep 2020 13:01:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599735660; bh=KFXHb20OkLMl66BAk5eXXMX8DUjC/FwA1OCRtZHGnzo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=BvQGGzmFGGpEFf0rqqtXkgnwtc5HRTyOXn0tyMuIA00knPDBYqDj8AeiXvG30HdmE wipitzK1hZxKW0euer/hQYH6Ngea+OH+Jlx+8kW3CT2lw+hgR+aw8pFhTJNySHHKC6 aAl03aMoPG7qdLp9i75UAtRl4eoVKSX8FnBXy5CE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from workstation4.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MhU9j-1kl0BD2iGJ-00ebsq; Thu, 10 Sep 2020 13:01:00 +0200 From: Heinrich Schuchardt To: Alexander Graf Cc: Rick Chen , Bin Meng , Atish Patra , Sean Anderson , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/3] riscv: define function set_gd() Date: Thu, 10 Sep 2020 13:00:46 +0200 Message-Id: <20200910110048.21446-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910110048.21446-1-xypron.glpk@gmx.de> References: <20200910110048.21446-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:oODD43ozV0NoQVhpvvyS88ysst61hoyMt0Vvs2i/51DyTBH20yc OJ2hN7NlQj1qUVvc9UpOINUDtKaTlEXnkNibb9YVMMir3bDTsIyNXpq45rH1m9QF4MAfiNJ mwFv6gOQGn3aAYQLlgO1GoWNib9qrJ1DSouVQPZl5H8qPf6eYU0RbtOjWhV+16Pnbte5K5r OK/6o6efqe9+8qeEfmbgw== X-UI-Out-Filterresults: notjunk:1;V03:K0:TDVZ8kY2Rhs=:/aYAipDzbVJFiQXoDeblCS FOm3BV9WPQnQrE97JdJEJ2lnXFvQhPdP0lJ9ccsb99Ll7XyujsIr6drvxH5odW0wxW0Yr7T9U 03XAcMeTe7R0vKnir05TxK+WM0V5JALTfmROmyKyeJE9HeNwpqEzEOJ8I6q5fsPNktsT9S7em dtsMbQDr/GYGMSmUOKDXNYouq6e1doEPWZVWFknj3y9EAOC/yzfFlPtDH2nkqGt6aSGfA+BJU jTiT8XczV+dfRbFWX4Ty4vuDonw8SBHovXT+aOA1Ue1/C9EIZy+hsBh7J+3SMCpbW/8pr99gG QPp/yL2mmUsudNr3fTmpZ17fWFu56T+EhRRF2+fYb/UQqWqAt9H+nL+/Lbp+R0xnz5bCqz62/ sVeZk0QExf0jKfeJ19ABz0b/djJ+b1uFiLmgXzKEjiqgyr7I6ejlPwiD5DeKN9ScTqVLtsU8C dywqXI6qdQ7UL+syqA4k6BbuGQ40STu+S4jAmNA5xdD6YM4wApwLllYCWq3GD83DPfVAwqXbw fS3mUyOyFSoeN3uQxb1NRfxl36Ov8cRCuvEqT94arZh9dIKyFDq4y75uthfVzoyXLuNKrnVp4 F91lnqRox47EyL96+o7v2VJ4qUZOUZ6COscwbPNxVoIHusYaf0l2H2B1YUJGsyQRX3eL0WdsD ohnLrgHnNjeKrTjQmq2aatXUpQe5ZqkjwChw2y2748UZZFf/9QMgCOy4IxWqvbFfCSeuB81Or wCztl0jDJ+8U2jMk8yT8PWsG1S34vZEa9zpdEWMOPRDn1E0U34wT9wQzDa55SRxB29yP+fHQL gcr/YtnbOINkh5w001lt6Ur2kJ8K7Yk7QfW1+CPwYqv/Ltk11J8FJSZDTpYXwFrlt+kPOg9uv rAtW0nZm/qsJ9Sq+IMH25z9iNWAEX8orbao15+W2HARn4zWNBk8DOlD/0t/Sg6CUVf+0Ysr8w HY4zBlQqD4bpqJ7eM+trj7q71sjc+m5c3pePQPolYtFbQ+M0/gO4C3w0+4fFD9O0neJ9EZ92f nkg7C2VOQ+y6Tq+4mKDZlPuJUcQAMcBL6rLm6Ai2KdqdGyc3mYMWCYDfvV74DOMv+BA1/kCTO D+PtteY9AfmiyTHT9TR8+BB1AnzcZbjn3DHDE6peBKf3TuLSso6cQZg+whgDRpZ908XhvY45g Jl/Cm+hQAVQjZhAPHZlTcg46NVMseq6Iq1qJ/QPfq6A+bd5hXDCIn9v+ATlSb7trwfGoayeka 4H0RczCTTiaatwJP02b6Zc/LW5wf1N+7ALX6gXA== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Function set_gd() is needed in the UEFI sub-system if the global data pointer is stored in a register. Signed-off-by: Heinrich Schuchardt --- arch/riscv/include/asm/global_data.h | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.28.0 diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h index 2eb14815bc..b711fcc44d 100644 --- a/arch/riscv/include/asm/global_data.h +++ b/arch/riscv/include/asm/global_data.h @@ -39,4 +39,13 @@ struct arch_global_data { #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("gp") +static inline void set_gd(volatile gd_t *gd_ptr) +{ +#ifdef CONFIG_64BIT + asm volatile("ld gp, %0\n" : : "m"(gd_ptr)); +#else + asm volatile("lw gp, %0\n" : : "m"(gd_ptr)); +#endif +} + #endif /* __ASM_GBL_DATA_H */ From patchwork Thu Sep 10 11:00:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1361495 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=iMkIzx1W; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BnGCj20R4z9sSJ for ; Thu, 10 Sep 2020 21:01:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BDC7C822A7; Thu, 10 Sep 2020 13:01:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="iMkIzx1W"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C7ACA822CD; Thu, 10 Sep 2020 13:01:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3108D81F67 for ; Thu, 10 Sep 2020 13:01:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599735661; bh=7HAZ/lyYsWyUf+o6i/juiXeNdT/6iXccijR5Sl9gloY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=iMkIzx1WpMwrTT5ix1zO/HKX/HMefdAdyLZKNVT8D9Wj4Mu24dvkNQimkxZWaUGRm JiPPyC+FiKFoFjEkfXeTemevO1x8iIg4RSy+k6qkgmxLxGrYuQoZyzWK2DZsf78MRS PdjwZYv3i5Sq57NvBCYR4PajubK00QCXdqYnbh6A= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from workstation4.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MiJVG-1klp7q3zeA-00fQhF; Thu, 10 Sep 2020 13:01:01 +0200 From: Heinrich Schuchardt To: Alexander Graf Cc: Rick Chen , Bin Meng , Atish Patra , Sean Anderson , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 2/3] efi_loader: save global data pointer on RISC-V Date: Thu, 10 Sep 2020 13:00:47 +0200 Message-Id: <20200910110048.21446-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910110048.21446-1-xypron.glpk@gmx.de> References: <20200910110048.21446-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:poj/CcdH6wjGZMPoL6GLgHUPgAjhxwn7nUy7ziKbJ2tZJ+Zs3H4 LbeXxge8D5udt7GoQPwvmRUZzq2yD305Z5mpQiX69fdcNoklOkeUrCQrn64LagxClONbIVM vpzgyeel/YT2xLYQjsbOTpHVVz0JA0rmscLZYRDoTKlcb9Ys/L1OMUcRrY6vDYN8FbaHt91 rZrlZsfu4kovQeb+hoH9Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:jWOo3Wc++Eo=:pcG2uOO5e3d57vdxctPcBV wwHwZMaBG/KF9ecObd65ho1xIccpt/OdWt2/VKcOetROwR3xuCpDK9fYSjWPD5T4MDMq//xrM 9Y+OWbw3XAEXLqVyZiW+zehEJZd3REYNnBmbSwURprkxS9YOtI3ozDhuP9QOqtFtYUyrnqo3W 2HWwhqhLkjyb86sqjELAM8WOkgnxa4kYuoURa5FfVX7tL2HPrAeS5NY6OEClD2Z14/+/2U7hl 5rOv8hj8Hmsccjl1ndQm5dQAUEmlXZS+82q0ajc6CKDX6kRzfTQfipgmJwdfl8cgc38GN+c74 PqBJq80xNXx10YSTGWUqOXng2yS7595goqcqWihdah6a9vAMBF4EmgjiFC+EvfwpbCSSC11Cx oJJ4pleKiV+wibE5iL1koCQBn8Y28SiREk9ZQFKGjcjYt0Nw9I0nMiAlt8Drbu/kMTPK1lc+x qbpcB2puEvAVyHKoEpqI7tR6kdyP8Yh4hk7HMUFy5ovFCMFAfmpUfXsSmPUeSY9IKEYWk3Ek8 q54Ig9jzYMJDh/KVvihSw+sbrOK8sE7/7/eCqO8vWrdnel3Z8vUwLdWexzHpgMmIvXal3uJcb cPP/BiBUW5oPbdQzssQvO4c6hrX7zGS4Q+pJGIobdY/J3+yNeSxuYaj5lBO+Ac3wP6RPx+Qx8 Du6u/qD+taT1MVwsLd6bJBg2nbAWb99Wh/8rpzpfXaTScpgSHr8IQrZTClJXIUDAhDzdPsIzH hL1BR1g5yM1mxHmJ68RfYumhx6AiH9oP0HEJaKieQNjILCoglxj/zScas977E3/03e+PQy9YO 1OINm7d2s+72vdj0MG0X6tgbfWIuE1OpbTJ3TfPsTvBNqf7orMYvpiKG94DBygVSJCNa87X6u OUSNk3yvfAxLTaIPSB+3xuvi4YOeLD2Zb5Zd969p7VPNG/380opcMacAUyuQrSu4GbLjMV7xU ah3yUpkzpS0LmlU14VKE+GgIaFeScfnmreRZfLzoysIt7PELeUlZfLcQHM48Fibt/d1LAp6j+ GEa2GTxLeKRrqh5inCaxNkt8OOm340RbLh5plVAyRNge/nHLw6CdtCTSAs7OJAGi4zMeKGOHu 0WXGLVIUgzNf7MuepY7J4HEBcClH+zW7wGdw3DX3ise2rQ+SBy1Cv3CC4Q5uF+3AJ0+7JjKPc mbE4DnLF91dHZYVww2UKWRjP2RGGxS6U/jnqPovr5Rsak0Oyn/UTa35i5oBwoQFjgda34JFyU V9MzJRizif5ubbxnLEx9u/S4bsoLJ0/3itOsRlQ== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean On RISC-V the global data pointer is stored in register gp. When a UEFI binary calls the EFI API we have to restore it. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.28.0 diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index dcd3eec894..bf78176217 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -42,9 +42,9 @@ LIST_HEAD(efi_register_notify_events); /* Handle of the currently executing image */ static efi_handle_t current_image; -#ifdef CONFIG_ARM +#if defined(CONFIG_ARM) || defined(CONFIG_RISCV) /* - * The "gd" pointer lives in a register on ARM and AArch64 that we declare + * The "gd" pointer lives in a register on ARM and RISC-V that we declare * fixed when compiling U-Boot. However, the payload does not know about that * restriction so we need to manually swap its and our view of that register on * EFI callback entry/exit. @@ -86,7 +86,7 @@ static efi_status_t EFIAPI efi_disconnect_controller( int __efi_entry_check(void) { int ret = entry_count++ == 0; -#ifdef CONFIG_ARM +#if defined(CONFIG_ARM) || defined(CONFIG_RISCV) assert(efi_gd); app_gd = gd; set_gd(efi_gd); @@ -98,7 +98,7 @@ int __efi_entry_check(void) int __efi_exit_check(void) { int ret = --entry_count == 0; -#ifdef CONFIG_ARM +#if defined(CONFIG_ARM) || defined(CONFIG_RISCV) set_gd(app_gd); #endif return ret; @@ -107,7 +107,7 @@ int __efi_exit_check(void) /** * efi_save_gd() - save global data register * - * On the ARM architecture gd is mapped to a fixed register (r9 or x18). + * On the ARM and RISC-V architectures gd is mapped to a fixed register. * As this register may be overwritten by an EFI payload we save it here * and restore it on every callback entered. * @@ -115,7 +115,7 @@ int __efi_exit_check(void) */ void efi_save_gd(void) { -#ifdef CONFIG_ARM +#if defined(CONFIG_ARM) || defined(CONFIG_RISCV) efi_gd = gd; #endif } @@ -123,13 +123,13 @@ void efi_save_gd(void) /** * efi_restore_gd() - restore global data register * - * On the ARM architecture gd is mapped to a fixed register (r9 or x18). + * On the ARM and RISC-V architectures gd is mapped to a fixed register. * Restore it after returning from the UEFI world to the value saved via * efi_save_gd(). */ void efi_restore_gd(void) { -#ifdef CONFIG_ARM +#if defined(CONFIG_ARM) || defined(CONFIG_RISCV) /* Only restore if we're already in EFI context */ if (!efi_gd) return; @@ -2920,7 +2920,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle, * us to the current line. This implies that the second half * of the EFI_CALL macro has not been executed. */ -#ifdef CONFIG_ARM +#if defined(CONFIG_ARM) || defined(CONFIG_RISCV) /* * efi_exit() called efi_restore_gd(). We have to undo this * otherwise __efi_entry_check() will put the wrong value into From patchwork Thu Sep 10 11:00:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1361497 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=TdaElxDf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BnGD46KrWz9sTg for ; Thu, 10 Sep 2020 21:01:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4B388822E3; Thu, 10 Sep 2020 13:01:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="TdaElxDf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 68E4D822CD; Thu, 10 Sep 2020 13:01:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8973B821DB for ; Thu, 10 Sep 2020 13:01:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599735661; bh=U4laNpUrOkWhfVQdXOpcv7ckMdJw1J77/6Jfz/tUqyU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=TdaElxDfhCvNjb6D5DMVyPO1WH8SmTTCm+DNH1DTRSjIWr2W9CKPKe6USswB/w8+K xlqjb670zPS8yNyMllxz6XeDp5yad9D8a0xV9QYMYFEZ5iBLohf2a4gWIxr2veXcC+ nIaaZqdDu+H+aEul0YWtEJY08fJJrj8+/RIXmyq0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from workstation4.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MeCtj-1kqTow0zu3-00bK5g; Thu, 10 Sep 2020 13:01:01 +0200 From: Heinrich Schuchardt To: Alexander Graf Cc: Rick Chen , Bin Meng , Atish Patra , Sean Anderson , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 3/3] efi_selftest: restore gd before do_reset() Date: Thu, 10 Sep 2020 13:00:48 +0200 Message-Id: <20200910110048.21446-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910110048.21446-1-xypron.glpk@gmx.de> References: <20200910110048.21446-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Df8h+vpCos+LItk/DykizZG3MQ4SQ8XGYy/stHo9+Qqkvol3qP0 bXLG+ar0MqoaXIaBU2iwvFl8JAgg9KPQHdYw9VkS4Ve106tmFRmrtSPN8mL7KstVxraQisG H/COpfNvoTarVBOhFsZrUaFJKgKKZhs0XvizjaMXk0pMhPHbf5d14BIQmi6HD/DXDeseB6S 1GafGAZqrBe0vOG3V3AeQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:R0InLhFICGQ=:YpynVwUD7UvpW7pWkZV4dl 0NKL4FKPgPj8BgJhP8et22F1Ji+opTFVVgLMyJj5u5q+H4SnmFpOFruifP4qm7tfE24mwOKX7 3NQ1wm6Yz5Obd1v7JLjkP8yhYGhU3qCVePFvmdRtS7mRC/vqRo65d8Gt6U0N8JysT5IljwWOO ypAw90Bo7Wp2xVQ4lNwcq/Yn37tglyty+23ZC9QZ7voAjKTQCisKPhtucEvb9Ta/7yfWSwsG7 lDeL6Z+aB9TAn3vCKn7h4jsCgsel4ht+qZVoyIPNtlmC170guIqDyUrCpjltHlwoRFcYxCS0o MPfwjnBEgyvwATbYZCDbVCRuxRrSLLSElitUZRVh/ZkXX/BKw4AeZouVJFkf6weNyJVFSie6A Fim4XR9jIFcjAQAQOiXqTT+BGbzpygJQF9WYhKtg5qVA8ZuP88nXNVylEFSJPebDGQJrdqn7z OOW44e5afVZzo5qFntNE6D672mrLw5dGzobAfHftGMnUCvpHcUX1XXmf/0+GQ4NpAZmzwFlR0 QnErUG6s8q6Zt75lmQptrsbNBwGjvmdifZr1p/R8jjzFVCPGbOQsJVHaJ5BZkPJ/9r9VbvG7k QEX4wSnD0RQ9THyqR5g69rayQkenogLlS95hXqvmkYXlE3tTEQxAs5jFKDil354tDzwz2WqR5 HmkdACMTDbD49h138gMjgdwd6B/PfWRiXw/QNGl/Sm9lJOn/4FW2yDpQk3wQr79HzU3JznQmC CGotFQN5PuUPCJJoW9K57ibwzKx4orA4xAAPxsf+Dyzi5mG34G7Sw0HOtA85ToH6IoMVXEftS qhBtwbIZV/C+IRItW52IIXaSseOOPRnCGLJkbcOBgW1e5+24xSCkeJaWrCinTvPcrPcM+OfFL fL2frfKlhBcG/E2e+FOd06i8gevDiv3I/76GHkKjKzlhdOvE3bu3561GEVicUZ4rqLVJexz2D 18difRPHaNH9+NiRN7oT0UUkKVM4sMkY+DXTsUi3o49NNAvvhgY41DfOELnNL7R+Q/sB0Xcs9 RHG8tck6utL8s37TDWVASW0WJoK5dlba8nMz30ZJzNe3suQixm5KL8C1rNry+DAT1kq3i/QmX Mi4jtNGMix9cfeE8CPNuyFGHA8iFs/PIhK/vaXdtYleFH0jAG99Guhr1Ac9uQYlQi5+1QVvyV 1YcqNQzw7CpUV81EKeAQLHjr8NqQ6j2rDnif5HCYZcdRyujUJ9VUey+80Is/ZuI1Bg3K2vbhv 4vQhqMydgll9jwXo6gQGF/WyO5IzqBdd+zdJ29w== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Before calling do_reset() in the EFI selftest we must restore the global data pointer. Fixes: fa63753f86cc ("efi_selftest: substitute ResetSystem() by do_reset()") Signed-off-by: Heinrich Schuchardt --- lib/efi_selftest/efi_selftest.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.28.0 diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index 6eec8ae2a7..165fa265f2 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -311,11 +311,13 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, efi_st_printf("Preparing for reset. Press any key...\n"); efi_st_get_key(); - if (IS_ENABLED(CONFIG_EFI_HAVE_RUNTIME_RESET)) + if (IS_ENABLED(CONFIG_EFI_HAVE_RUNTIME_RESET)) { runtime->reset_system(EFI_RESET_WARM, EFI_NOT_READY, sizeof(reset_message), reset_message); - else + } else { + efi_restore_gd(); do_reset(NULL, 0, 0, NULL); + } efi_st_printf("\n"); efi_st_error("Reset failed\n");