mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-08-16 01:17:01 +02:00
The Raspberry Pi GPU firmware checks for a magic value at offset 240 (0xf0) of the armstub8.bin image it loads. If that value matches, it writes the kernel load address and the DTB address into subsequent memory locations. We can use these addresses to avoid hardcoding these values into the BL31 image, to make it more flexible and a drop-in replacement for the official armstub8.bin. Reserving just 16 bytes at offset 240 of the final image file is not easily possible, though, as this location is in the middle of the generic BL31 entry point code. However we can prepend an extra section before the actual BL31 image, to contain the magic and addresses. This needs to be 4KB, because the actual BL31 entry point needs to be page aligned. Use the platform linker script hook that the generic code provides, to add an almost empty 4KB code block before the entry point code. The very first word contains a branch instruction to jump over this page, into the actual entry code. This also gives us plenty of room for the SMP pens later. Change-Id: I38caa5e7195fa39cbef8600933a03d86f09263d6 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
24 lines
619 B
ArmAsm
24 lines
619 B
ArmAsm
/*
|
|
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*
|
|
* Stub linker script to provide the armstub8.bin header before the actual
|
|
* code. If the GPU firmware finds a magic value at offset 240 in
|
|
* armstub8.bin, it will put the DTB and kernel load address in subsequent
|
|
* words. We can then read those values to find the proper NS entry point
|
|
* and find our DTB more flexibly.
|
|
*/
|
|
|
|
MEMORY {
|
|
PRERAM (rwx): ORIGIN = 0, LENGTH = 4096
|
|
}
|
|
|
|
SECTIONS
|
|
{
|
|
.armstub8 . : {
|
|
*armstub8_header.o(.text*)
|
|
KEEP(*(.armstub8))
|
|
} >PRERAM
|
|
}
|