On 11/02/2016 12:06 PM, Cédric Schieli 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.
diff --git a/board/raspberrypi/rpi/lowlevel_init.S b/board/raspberrypi/rpi/lowlevel_init.S
+.global fw_boot_param +fw_boot_param: + .word 0x00000000
fw_dtb_pointer might be a better name; there are multiple different registers set up by the FW in some cases; best to be explicit about what kind of parameter is being saved.
See the note later about the size/alignment requirements for this value.
+/* + * 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
For the 64-bit RPi builds, you need to save x0 not r2. The assembly above doesn't compile since r2 isn't a valid register (it's named x2 on 64-bit), plus the DTB pointer is actually in x0 not x2.
+ /* Returns */ + b save_boot_params_ret
With these patches applied, the build of rpi_defconfig fails since the ARM1176 CPU startup file doesn't define that symbol.
diff --git a/include/configs/rpi.h b/include/configs/rpi.h
+#ifndef __ASSEMBLY__ +/* Firmware provided boot param */ +extern const void *fw_boot_param; +#endif
For the rpi_3 build, a void* is a 64-bit value, yet in lowlevel_init.S, it's defined a a .word (32-bit) rather than a .dword (64-bit).
I'd suggest adjusting the assembly file so that fw_boot_param is either a .word or a .dword depending on whether the code is being built for 32-bit or 64-bit mode. That will allow the C definition to be identical across all RPi builds.
Note: In the .dword case the symbol must be aligned to 8-bytes, and it won't hurt in the 32-bit case; see the following patch:
https://patchwork.ozlabs.org/patch/684429/ ARM: tegra: ensure nvtboot_boot_x0 alignment _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot