MdePkg,MdeModulePkg: ArmFfaLib: Expand to include first 4 registers

The direct message arguments stripped off the header, making the
underlying FF-A function interface to lose information when it comes to
certain return code, i.e. FFA_YIELD and FFA_INTERRUPT.

This change adds back the header field for this purpose so that the
callers can decide how to act on the corresponding return codes.

It then populates the header field for this purpose in FFA direct
message functions so that the callers can decide how to act on the
corresponding return codes.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
This commit is contained in:
Kun Qin 2026-06-19 10:05:17 -07:00 committed by mergify[bot]
parent 6f2b09986b
commit 89c6073683
2 changed files with 19 additions and 3 deletions

View file

@ -749,13 +749,13 @@ ArmFfaLibRun (
ArmCallFfa (&FfaArgs);
Status = FfaArgsToEfiStatus (&FfaArgs);
if (EFI_ERROR (Status)) {
return Status;
}
if (DirectMsgArg != NULL) {
ZeroMem (DirectMsgArg, sizeof (DIRECT_MSG_ARGS));
// Copy the FFA header to the direct message arguments
CopyMem (&(DirectMsgArg->Header), &FfaArgs, sizeof (DirectMsgArg->Header));
if (FfaArgs.Arg0 == ARM_FID_FFA_MSG_SEND_DIRECT_RESP) {
DirectMsgArg->Arg0 = FfaArgs.Arg3;
DirectMsgArg->Arg1 = FfaArgs.Arg4;
@ -790,6 +790,8 @@ ArmFfaLibRun (
@param [in] Flags Message flags
@param [in, out] ImpDefArgs Implemented defined arguments and
Implemented defined return values
The header registers (x0-x2) will be initialized
with the values from DestPartId and Flags.
@retval EFI_SUCCESS Success
@retval Others Error
@ -831,6 +833,7 @@ ArmFfaLibMsgSendDirectReq (
Status = FfaArgsToEfiStatus (&FfaArgs);
if (EFI_ERROR (Status)) {
CopyMem (ImpDefArgs, &FfaArgs, sizeof (DIRECT_MSG_ARGS));
return Status;
}
@ -850,6 +853,8 @@ ArmFfaLibMsgSendDirectReq (
@param [in] ServiceGuid Service guid
@param [in, out] ImpDefArgs Implemented defined arguments and
Implemented defined return values
The header registers (x0-x3) will be
initialized with the values from DestPartId and ServiceGuid.
@retval EFI_SUCCESS Success
@retval Others Error
@ -915,6 +920,7 @@ ArmFfaLibMsgSendDirectReq2 (
Status = FfaArgsToEfiStatus (&FfaArgs);
if (EFI_ERROR (Status)) {
CopyMem (ImpDefArgs, &FfaArgs, sizeof (DIRECT_MSG_ARGS));
return Status;
}

View file

@ -53,6 +53,14 @@ typedef struct ArmFfaArgs {
* FFA_SEND_MSG_DIRECT_REQ2/FFA_SEND_MSG_DIRECT_RESP2 (i.e. v2)
*/
typedef struct DirectMsgArgs {
/// Header containing the arguments for the header registers (x0-x2 (v1) or x0-x3 (v2))
struct {
UINTN x0;
UINTN x1;
UINTN x2;
UINTN x3;
} Header;
/// Implementation define argument 0, this will be set to/from x3(v1) or x4(v2)
UINTN Arg0;
@ -96,6 +104,8 @@ typedef struct DirectMsgArgs {
UINTN Arg13;
} DIRECT_MSG_ARGS;
STATIC_ASSERT (sizeof (DIRECT_MSG_ARGS) == sizeof (ARM_FFA_ARGS), "DIRECT_MSG_ARGS and ARM_FFA_ARGS must be the same size");
/**
Trigger FF-A ABI call according to PcdFfaLibConduitSmc.