From: Sean Anderson Date: Thu, 10 Sep 2020 07:04:37 -0400 Subject: [PATCH 1/3] riscv: define function set_gd() In-Reply-To: <20200910110048.21446-2-xypron.glpk@gmx.de> References: <20200910110048.21446-1-xypron.glpk@gmx.de> <20200910110048.21446-2-xypron.glpk@gmx.de> Message-ID: <8de736ff-36c7-f319-b756-15b561c85ee5@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 9/10/20 7:00 AM, Heinrich Schuchardt wrote: > 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(+) > > 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 */ > -- > 2.28.0 > Can't we just use arch_setup_gd? --Sean