Skip to content

Commit

Permalink
StandaloneMm/Library: Apply transfer list boot protocol in StandaloneMm
Browse files Browse the repository at this point in the history
To remove hob creation in StandaloneMm entrypoint,
TF-A should pass PHIT hob information to StandaloneMm.
When it passes PHIT hob, it passes according to firmware handoff specification[0].

This patch applies boot protocol using transfer list with firmware
handoff specification and remove hob creation in StandaloneMm
entrypoint.

Link: https://github.com/FirmwareHandoff/firmware_handoff [0]

Signed-off-by: Levi Yun <[email protected]>
  • Loading branch information
LeviYeoReum committed Aug 29, 2024
1 parent 0b05bde commit dece401
Show file tree
Hide file tree
Showing 5 changed files with 563 additions and 450 deletions.
107 changes: 57 additions & 50 deletions StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,73 @@
Entry point to the Standalone MM Foundation when initialized during the SEC
phase on ARM platforms
Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
Copyright (c) 2017 - 2024, Arm Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Glossary:
- SPM_MM - An implementation where the Secure Partition Manager resides at EL3
with management services running from an isolated Secure Partitions
at S-EL0, and the communication protocol is the Management Mode(MM)
interface.
- FF-A - Firmware Framework for Arm A-profile
- TL - Transfer List
@par Reference(s):
- Transfer List [https://github.com/FirmwareHandoff/firmware_handoff]
- Secure Partition Manager [https://trustedfirmware-a.readthedocs.io/en/latest/components/secure-partition-manager-mm.html].
- Arm Firmware Framework for Arm A-Profile [https://developer.arm.com/documentation/den0077/j/?lang=en]
**/

#ifndef __STANDALONEMMCORE_ENTRY_POINT_H__
#define __STANDALONEMMCORE_ENTRY_POINT_H__

#include <StandaloneMmCpu.h>
#include <Library/PeCoffLib.h>
#include <Library/FvLib.h>

#define CPU_INFO_FLAG_PRIMARY_CPU 0x00000001

/*
* BOOT protocol used to boot StandaloneMm
*/
typedef enum {
/// Unknown Boot protocol.
BootProtocolUnknown,

/// Boot information delivered via Transfer List
/// with 32 bits register convention
BootProtocolTl32,

/// Boot information delivered via Transfer List
/// with 64 bits register convention
BootProtocolTl64,

BootProtocolMax,
} BOOT_PROTOCOL;

/*
* Communication ABI protocol to communicate between normal/secure partition.
*/
typedef enum {
/// Unknown Communication ABI protocol
AbiProtocolUnknown,

/// Communicate via SPM_MM ABI protocol
AbiProtocolSpmMm,

/// Communicate via FF-A ABI protocol
AbiProtocolFfa,

AbiProtocolMax,
} ABI_PROTOCOL;

typedef struct {
UINT8 Type; /* type of the structure */
UINT8 Version; /* version of this structure */
UINT16 Size; /* size of this structure in bytes */
UINT32 Attr; /* attributes: unused bits SBZ */
} EFI_PARAM_HEADER;

typedef struct {
UINT64 Mpidr;
UINT32 LinearId;
UINT32 Flags;
} EFI_SECURE_PARTITION_CPU_INFO;

typedef struct {
EFI_PARAM_HEADER Header;
UINT64 SpMemBase;
UINT64 SpMemLimit;
UINT64 SpImageBase;
UINT64 SpStackBase;
UINT64 SpHeapBase;
UINT64 SpNsCommBufBase;
UINT64 SpSharedBufBase;
UINT64 SpImageSize;
UINT64 SpPcpuStackSize;
UINT64 SpHeapSize;
UINT64 SpNsCommBufSize;
UINT64 SpSharedBufSize;
UINT32 NumSpMemRegions;
UINT32 NumCpus;
EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;
} EFI_SECURE_PARTITION_BOOT_INFO;

typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC) (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
Expand Down Expand Up @@ -122,36 +143,22 @@ LocateStandaloneMmCorePeCoffData (
IN OUT UINTN *TeDataSize
);

/**
Use the boot information passed by privileged firmware to populate a HOB list
suitable for consumption by the MM Core and drivers.
@param [in] PayloadBootInfo Boot information passed by privileged
firmware
**/
VOID *
EFIAPI
CreateHobListFromBootInfo (
IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo
);

/**
The entry point of Standalone MM Foundation.
@param [in] SharedBufAddress Pointer to the Buffer between SPM and SP.
@param [in] SharedBufSize Size of the shared buffer.
@param [in] cookie1 Cookie 1
@param [in] cookie2 Cookie 2
@param [in] Arg0 Boot information passed according to boot protocol.
@param [in] Arg1 Boot information passed according to boot protocol.
@param [in] Arg2 Boot information passed according to boot protocol.
@param [in] Arg3 Boot information passed according to boot protocol.
**/
VOID
EFIAPI
_ModuleEntryPoint (
IN VOID *SharedBufAddress,
IN UINT64 SharedBufSize,
IN UINT64 cookie1,
IN UINT64 cookie2
IN UINTN Arg0,
IN UINTN Arg1,
IN UINTN Arg2,
IN UINTN Arg3
);

/**
Expand Down
194 changes: 0 additions & 194 deletions StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c

This file was deleted.

Loading

0 comments on commit dece401

Please sign in to comment.