[PATCH 2/5] firmware: Add common FW_FDT_PATH compile-time option

Anup Patel Anup.Patel at wdc.com
Sun Oct 18 00:06:09 EDT 2020



> -----Original Message-----
> From: Atish Patra <atishp at atishpatra.org>
> Sent: 17 October 2020 04:39
> To: Anup Patel <Anup.Patel at wdc.com>
> Cc: Atish Patra <Atish.Patra at wdc.com>; Alistair Francis
> <Alistair.Francis at wdc.com>; Anup Patel <anup at brainfault.org>; Damien Le
> Moal <Damien.LeMoal at wdc.com>; OpenSBI <opensbi at lists.infradead.org>
> Subject: Re: [PATCH 2/5] firmware: Add common FW_FDT_PATH compile-
> time option
> 
> On Thu, Oct 15, 2020 at 1:12 AM Anup Patel <anup.patel at wdc.com> wrote:
> >
> > Currently, only FW_PAYLOAD has mechanism to embed external FDT using
> > FW_PAYLOAD_FDT_PATH compile-time option.
> >
> > This patch adds a commong FW_FDT_PATH compile-time option to embed
> > external FDT for all OpenSBI firmwares (i.e FW_JUMP, FW_PAYLOAD, and
> > FW_DYNAMIC).
> >
> 
> /s/commong/common

Okay, will update.

> 
> > Signed-off-by: Anup Patel <anup.patel at wdc.com>
> > ---
> >  docs/firmware/fw.md       | 14 +++++++++-----
> >  firmware/external_deps.mk |  4 ++++
> >  firmware/fw_base.S        | 16 ++++++++++++++++
> >  firmware/objects.mk       |  7 +++++++
> >  4 files changed, 36 insertions(+), 5 deletions(-)
> >
> > diff --git a/docs/firmware/fw.md b/docs/firmware/fw.md index
> > 4133c23..1efdadf 100644
> > --- a/docs/firmware/fw.md
> > +++ b/docs/firmware/fw.md
> > @@ -51,11 +51,15 @@ case, a *FW_PAYLOAD* firmware allows
> embedding a
> > flattened device tree in the  Firmware Configuration and Compilation
> >  --------------------------------------
> >
> > -All firmware types mandate the definition of the following compile
> > time -configuration parameter.
> > -
> > -* **FW_TEXT_ADDR** - Defines the address at which the previous
> > booting stage
> > -  loads OpenSBI firmware.
> > +All firmware types support the following common compile time
> > +configuration
> > +parameters:
> > +
> > +* **FW_TEXT_ADDR** - Defines the execution address of the OpenSBI
> firmware.
> > +  This configuration parameter is mandatory.
> > +* **FW_FDT_PATH** - Path to an external flattened device tree binary
> > +file to
> > +  be embedded in the *.rodata* section of the final firmware. If this
> > +option
> > +  is not provided then the firmware will expect the FDT to be passed
> > +as an
> > +  argument by the prior booting stage.
> >
> >  Additionally, each firmware type as a set of type specific
> > configuration  parameters. Detailed information for each firmware type
> > can be found in the diff --git a/firmware/external_deps.mk
> > b/firmware/external_deps.mk index 2b8f9f6..f43ac06 100644
> > --- a/firmware/external_deps.mk
> > +++ b/firmware/external_deps.mk
> > @@ -7,5 +7,9 @@
> >  #   Anup Patel <anup.patel at wdc.com>
> >  #
> >
> > +$(platform_build_dir)/firmware/fw_dynamic.o: $(FW_FDT_PATH)
> > +$(platform_build_dir)/firmware/fw_jump.o: $(FW_FDT_PATH)
> > +$(platform_build_dir)/firmware/fw_payload.o: $(FW_FDT_PATH)
> > +
> >  $(platform_build_dir)/firmware/fw_payload.o:
> $(FW_PAYLOAD_PATH_FINAL)
> >  $(platform_build_dir)/firmware/fw_payload.o:
> $(FW_PAYLOAD_FDT_PATH)
> > diff --git a/firmware/fw_base.S b/firmware/fw_base.S index
> > 0271d9a..95197da 100644
> > --- a/firmware/fw_base.S
> > +++ b/firmware/fw_base.S
> > @@ -182,6 +182,11 @@ _bss_zero:
> >         call    fw_save_info
> >         MOV_5R  a0, s0, a1, s1, a2, s2, a3, s3, a4, s4
> >
> > +#ifdef FW_FDT_PATH
> > +       /* Override previous arg1 */
> > +       la      a1, fw_fdt_bin
> > +#endif
> > +
> >         /* Override previous arg1 */
> >         MOV_3R  s0, a0, s1, a1, s2, a2
> >         call    fw_prev_arg1
> > @@ -668,3 +673,14 @@ _reset_regs:
> >         csrw CSR_MSCRATCH, 0
> >
> >         ret
> > +
> > +#ifdef FW_FDT_PATH
> > +       .section .rodata
> > +       .align 4
> > +       .globl fw_fdt_bin
> > +fw_fdt_bin:
> > +       .incbin FW_FDT_PATH
> > +#ifdef FW_FDT_PADDING
> > +       .fill FW_FDT_PADDING, 1, 0
> > +#endif
> > +#endif
> > diff --git a/firmware/objects.mk b/firmware/objects.mk index
> > c980362..2eea54c 100644
> > --- a/firmware/objects.mk
> > +++ b/firmware/objects.mk
> > @@ -17,6 +17,13 @@ ifdef FW_TEXT_START  firmware-genflags-y +=
> > -DFW_TEXT_START=$(FW_TEXT_START)  endif
> >
> > +ifdef FW_FDT_PATH
> > +firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\"
> > +ifdef FW_FDT_PADDING
> > +firmware-genflags-y += -DFW_FDT_PADDING=$(FW_FDT_PADDING)
> > +endif
> > +endif
> > +
> >  firmware-bins-$(FW_DYNAMIC) += fw_dynamic.bin
> >
> >  firmware-bins-$(FW_JUMP) += fw_jump.bin
> > --
> > 2.25.1
> >
> >
> > --
> > opensbi mailing list
> > opensbi at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi
> 
> I think we should document FW_FDT_PADDING as well.

Sure, I will add documentation for FW_FDT_PADDING.

> 
> Other than that, looks good.
> 
> Reviewed-by: Atish Patra <atish.patra at wdc.com>
> 
> 
> --
> Regards,
> Atish

Regards,
Anup


More information about the opensbi mailing list