On Tue, Jul 3, 2018 at 10:58 AM Andrey Smirnov <andrew.smirnov@xxxxxxxxx> wrote: > > On Sun, Jul 1, 2018 at 11:25 PM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote: > > > > On Fri, Jun 29, 2018 at 08:48:53PM -0700, Andrey Smirnov wrote: > > > Add a macro containing all of the code needed to load and transfer > > > control to BL31 ATF blob on i.MX8M. > > > > > > Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> > > > --- > > > arch/arm/mach-imx/include/mach/atf.h | 63 ++++++++++++++++++++++++++++ > > > 1 file changed, 63 insertions(+) > > > create mode 100644 arch/arm/mach-imx/include/mach/atf.h > > > > > > diff --git a/arch/arm/mach-imx/include/mach/atf.h b/arch/arm/mach-imx/include/mach/atf.h > > > new file mode 100644 > > > index 000000000..0b5018459 > > > --- /dev/null > > > +++ b/arch/arm/mach-imx/include/mach/atf.h > > > @@ -0,0 +1,63 @@ > > > +#ifndef __IMX_ATF_H__ > > > +#define __IMX_ATF_H__ > > > + > > > +#include <asm/system.h> > > > + > > > +#define MX8MQ_ATF_BL31_SIZE_LIMIT SZ_64K > > > +#define MX8MQ_ATF_BL31_BASE_ADDR 0x00910000 > > > +#define MX8MQ_ATF_BL33_BASE_ADDR 0x40200000 > > > + > > > +/** > > > + * imx8mq_atf_load_bl31 - Load ATF BL31 blob and transfer contol to it > > > + * > > > + * @name: Name of the BL31 blob > > > + * > > > + * This macro: > > > + > > > + * 1. Copies built-in BL31 blob to an address i.MX8M's BL31 > > > + * expects to be placed > > > + * > > > + * 2. Sets up temporary stack pointer for EL2, which is execution > > > + * level that BL31 will drop us off at after it completes its > > > + * initialization routine > > > + * > > > + * 3. Transfers control to BL31 > > > + * > > > + * NOTE: This has to be a macro in order delay the expansion of > > > + * get_builtin_firmware(), otherwise it'll incorrectly interpret > > > + * "name" literally > > > > You show a good reason why we should add the firmware name strings > > to the image along with a function that iterates over them. How > > to add the firmware name strings is already provided in the Kernels > > firmware/Makefile. > > > > OK, makes sense. I'll work on adding that feature as a part of v2. > Hmm, I just realized two things: - Implementing that besides porting a bunch of code would require early relocation, which I really would like to avoid - We can convert imx8mq_atf_load_bl31() into a function if we change its signature to accept a blob pointer and blob size. And leave it up to the user as to how that blob is obtained. Given the first and simplicity of the second, I think I am going to go that way for v2. Thanks, Andrey Smirnov _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox