Re: [PATCH 2/6] MIPS: Loongson64: Distinguish firmware dependencies DTB/LEFI.

From: Thomas Bogendoerfer
Date: Tue Feb 09 2021 - 10:40:01 EST


On Tue, Feb 09, 2021 at 05:32:20PM +0800, Qing Zhang wrote:
> Add DTB boot support, only support LS2K1000 processor for now,
> determine whether to use the built-in DTB or the DTB from the
> firmware by checking the range of CKSEG0 and XKPHYS.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
> Signed-off-by: Qing Zhang <zhangqing@xxxxxxxxxxx>
> Signed-off-by: Xingxing Su <suxingxing@xxxxxxxxxxx>
> ---
> .../include/asm/mach-loongson64/boot_param.h | 6 ++++++
> arch/mips/include/asm/mach-loongson64/loongson.h | 3 ++-
> arch/mips/loongson64/env.c | 13 ++++++++++++-
> arch/mips/loongson64/init.c | 16 ++++++++++++++--
> 4 files changed, 34 insertions(+), 4 deletions(-)
>
> diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
> index 4592841b6b0c..53c29a305ff0 100644
> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> @@ -198,7 +198,13 @@ enum loongson_bridge_type {
> VIRTUAL = 3
> };
>
> +enum loongson_fw_interface {
> + LOONGSON_LEFI = 0,
> + LOONGSON_DTB = 1,
> +};
> +
> struct loongson_system_configuration {
> + enum loongson_fw_interface fw_interface;

do you need this for future use ? Right now this information is only
needed in init.c and doesn't need to be exported...

> + if (fw_arg2 == 0 || (be32_to_cpup((__be32 *)fw_arg2) == OF_DT_HEADER)) {

what about using fdt_magic(fw_arg2) == FDT_MAGIC ?

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]