[U-Boot] [PATCH 1/2] rpi: save firmware provided boot param for later use
Jonathan Liu
net147 at gmail.com
Sun Nov 6 01:36:28 CET 2016
Hi Cédric,
On 3 November 2016 at 05:06, Cédric Schieli <cschieli at gmail.com> wrote:
> At U-Boot entry point, the r2 register holds the address of the
> firmware provided boot param. Let's save it for further processing.
>
> Signed-off-by: Cédric Schieli <cschieli at gmail.com>
> ---
>
> board/raspberrypi/rpi/Makefile | 1 +
> board/raspberrypi/rpi/lowlevel_init.S | 26 ++++++++++++++++++++++++++
> include/configs/rpi.h | 4 ++++
> 3 files changed, 31 insertions(+)
> create mode 100644 board/raspberrypi/rpi/lowlevel_init.S
>
> diff --git a/board/raspberrypi/rpi/Makefile b/board/raspberrypi/rpi/Makefile
> index 4ce2c98..dcb25ac 100644
> --- a/board/raspberrypi/rpi/Makefile
> +++ b/board/raspberrypi/rpi/Makefile
> @@ -5,3 +5,4 @@
> #
>
> obj-y := rpi.o
> +obj-y += lowlevel_init.o
> diff --git a/board/raspberrypi/rpi/lowlevel_init.S b/board/raspberrypi/rpi/lowlevel_init.S
> new file mode 100644
> index 0000000..446a70b
> --- /dev/null
> +++ b/board/raspberrypi/rpi/lowlevel_init.S
> @@ -0,0 +1,26 @@
> +/*
> + * (C) Copyright 2016
> + * Cédric Schieli <cschieli at gmail.com>
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include <config.h>
> +
> +.global fw_boot_param
> +fw_boot_param:
> + .word 0x00000000
> +
> +/*
> + * Routine: save_boot_params (called after reset from start.S)
> + * Description: save ATAG/FDT address provided by the firmware at boot time
> + */
> +
> +.global save_boot_params
> +save_boot_params:
> +
> + /* The firmware provided ATAG/FDT address can be found in r2 */
> + str r2, fw_boot_param
> +
> + /* Returns */
> + b save_boot_params_ret
> diff --git a/include/configs/rpi.h b/include/configs/rpi.h
> index 8d4ad5d..2d1e619 100644
> --- a/include/configs/rpi.h
> +++ b/include/configs/rpi.h
> @@ -208,5 +208,9 @@
> ENV_MEM_LAYOUT_SETTINGS \
> BOOTENV
>
> +#ifndef __ASSEMBLY__
> +/* Firmware provided boot param */
> +extern const void *fw_boot_param;
> +#endif
>
> #endif
> --
> 2.7.3
I did a similar patch without noticing you already submitted this series.
The save_boot_params function can be written in C instead of assembly
and placed in rpi.c.
See https://lists.yoctoproject.org/pipermail/yocto/2016-November/032934.html
for how to write save_boot_params in C as this can simplify your
patch. It also has a U-Boot script for using the FDT provided by the
firmware, though you would need to change ${fdt_addr_r} to
${fw_fdt_addr} for it to work with your patch series.
Regards,
Jonathan
More information about the U-Boot
mailing list