• Andre Przywara's avatar
    rpi4: Accommodate "armstub8.bin" header at the beginning of BL31 image · c4597e13
    Andre Przywara authored
    
    
    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: default avatarAndre Przywara <andre.przywara@arm.com>
    c4597e13
armstub8_header.S 773 Bytes