ArmPlatformPkg: Capture TransferList Information for SEC

Capture TransferList address from register x3
Refer to section 3 of the FW Handoff Specification
https://firmwarehandoff.github.io/firmware_handoff
The TransferList header is present at the base address
captured by this variable.
For platforms with no TransferList support,
boot continues without any errors.

Signed-off-by: Prachotan Bathi <prachotan.bathi@arm.com>
This commit is contained in:
Prachotan Bathi
2025-07-01 11:28:58 -05:00
committed by mergify[bot]
parent 078414f045
commit 6a329eb853
4 changed files with 41 additions and 4 deletions

View File

@@ -8,6 +8,19 @@
#include <AsmMacroLib.h>
ASM_FUNC(_ModuleEntryPoint)
// Check if register assignment at handoff matches spec
MOV64 (x4, 0x14a0fb10b)
// Check if x1 holds TransferList signature
cmp x1, x4
b.ne _SkipTransferList
// Skip TransferList init if x2 is not equal to 0
cbnz x2, _SkipTransferList
// Set the TransferList Base Address from register x3
mov x10, x3
_SkipTransferList:
// Do early platform specific actions
bl ASM_PFX(ArmPlatformPeiBootAction)
@@ -47,7 +60,8 @@ ASM_PFX(MainEntryPoint):
// The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
MOV64 (x2, FixedPcdGet64(PcdFvBaseAddress))
ldr x0, [x2, #8]
// Pass the TransferList Base Address
mov x1, x10
// Move sec startup address into a data register
// Ensure we're jumping to FV version of the code (not boot remapped alias)
ldr x3, =ASM_PFX(CEntryPoint)

View File

@@ -151,12 +151,15 @@ PrintFirmwareVersion (
@param[in] PeiCoreEntryPoint Address in ram of the entrypoint of the PEI
core
@param[in] TransferListBaseAddr Address of the Transfer List base address
**/
STATIC
VOID
EFIAPI
SecMain (
IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint,
IN UINTN TransferListBaseAddr
)
{
EFI_SEC_PEI_HAND_OFF SecCoreData;
@@ -164,6 +167,21 @@ SecMain (
EFI_PEI_PPI_DESCRIPTOR *PpiList;
UINTN TemporaryRamBase;
UINTN TemporaryRamSize;
VOID *TransferListBase;
// Dump the Transfer List
TransferListBase = (VOID *)TransferListBaseAddr;
if (TransferListBase != NULL) {
if (TransferListCheckHeader (TransferListBase) != TRANSFER_LIST_OPS_INVALID) {
DEBUG_CODE_BEGIN ();
TransferListDump (TransferListBase);
DEBUG_CODE_END ();
} else {
DEBUG ((DEBUG_ERROR, "%a: No valid operations possible on TransferList found @ 0x%p\n", __func__, TransferListBase));
}
} else {
DEBUG ((DEBUG_INFO, "%a: No TransferList found, continuing boot\n", __func__));
}
CreatePpiList (&PpiListSize, &PpiList);
@@ -197,10 +215,13 @@ SecMain (
@param[in] PeiCoreEntryPoint Address in ram of the entrypoint of the PEI
core
@param[in] TransferListBaseAddr Address of the Transfer List base address
**/
VOID
CEntryPoint (
IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint,
IN UINTN TransferListBaseAddr
)
{
if (!ArmMmuEnabled ()) {
@@ -237,7 +258,7 @@ CEntryPoint (
ArmPlatformInitialize (ArmReadMpidr ());
// Goto primary Main.
SecMain (PeiCoreEntryPoint);
SecMain (PeiCoreEntryPoint, TransferListBaseAddr);
// PEI Core should always load and never return
ASSERT (FALSE);

View File

@@ -23,6 +23,7 @@
#include <Library/SerialPortLib.h>
#include <Ppi/TemporaryRamSupport.h>
#include <Library/ArmTransferListLib.h>
/**
Helper function to switch to a different stack. Implemented in assembler as

View File

@@ -48,6 +48,7 @@
PrintLib
SerialPortLib
StackCheckLib
ArmTransferListLib
[Ppis]
gEfiTemporaryRamSupportPpiGuid