]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StandaloneMmPkg/Include/Library/AArch64/StandaloneMmCoreEntryPoint.h
StandaloneMmPkg: Add an AArch64 specific entry point library.
[mirror_edk2.git] / StandaloneMmPkg / Include / Library / AArch64 / StandaloneMmCoreEntryPoint.h
diff --git a/StandaloneMmPkg/Include/Library/AArch64/StandaloneMmCoreEntryPoint.h b/StandaloneMmPkg/Include/Library/AArch64/StandaloneMmCoreEntryPoint.h
new file mode 100644 (file)
index 0000000..e4e5875
--- /dev/null
@@ -0,0 +1,215 @@
+/** @file\r
+  Entry point to the Standalone MM Foundation when initialized during the SEC\r
+  phase on ARM platforms\r
+\r
+Copyright (c) 2017 - 2018, ARM Ltd. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __STANDALONEMMCORE_ENTRY_POINT_H__\r
+#define __STANDALONEMMCORE_ENTRY_POINT_H__\r
+\r
+#include <Library/PeCoffLib.h>\r
+#include <Library/FvLib.h>\r
+\r
+#define CPU_INFO_FLAG_PRIMARY_CPU  0x00000001\r
+\r
+typedef struct {\r
+  UINT8  Type;       /* type of the structure */\r
+  UINT8  Version;    /* version of this structure */\r
+  UINT16 Size;      /* size of this structure in bytes */\r
+  UINT32 Attr;      /* attributes: unused bits SBZ */\r
+} EFI_PARAM_HEADER;\r
+\r
+typedef struct {\r
+  UINT64 Mpidr;\r
+  UINT32 LinearId;\r
+  UINT32 Flags;\r
+} EFI_SECURE_PARTITION_CPU_INFO;\r
+\r
+typedef struct {\r
+  EFI_PARAM_HEADER              Header;\r
+  UINT64                        SpMemBase;\r
+  UINT64                        SpMemLimit;\r
+  UINT64                        SpImageBase;\r
+  UINT64                        SpStackBase;\r
+  UINT64                        SpHeapBase;\r
+  UINT64                        SpNsCommBufBase;\r
+  UINT64                        SpSharedBufBase;\r
+  UINT64                        SpImageSize;\r
+  UINT64                        SpPcpuStackSize;\r
+  UINT64                        SpHeapSize;\r
+  UINT64                        SpNsCommBufSize;\r
+  UINT64                        SpPcpuSharedBufSize;\r
+  UINT32                        NumSpMemRegions;\r
+  UINT32                        NumCpus;\r
+  EFI_SECURE_PARTITION_CPU_INFO *CpuInfo;\r
+} EFI_SECURE_PARTITION_BOOT_INFO;\r
+\r
+typedef\r
+EFI_STATUS\r
+(*PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT) (\r
+  IN UINTN EventId,\r
+  IN UINTN CpuNumber,\r
+  IN UINTN NsCommBufferAddr\r
+  );\r
+\r
+typedef struct {\r
+  PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *ArmTfCpuDriverEpPtr;\r
+} ARM_TF_CPU_DRIVER_EP_DESCRIPTOR;\r
+\r
+typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC) (\r
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
+  IN  UINT64                    Length\r
+  );\r
+\r
+/**\r
+  Privileged firmware assigns RO & Executable attributes to all memory occupied\r
+  by the Boot Firmware Volume. This function sets the correct permissions of\r
+  sections in the Standalone MM Core module to be able to access RO and RW data\r
+  and make further progress in the boot process.\r
+\r
+  @param  ImageContext           Pointer to PE/COFF image context\r
+  @param  SectionHeaderOffset    Offset of PE/COFF image section header\r
+  @param  NumberOfSections       Number of Sections\r
+  @param  TextUpdater            Function to change code permissions\r
+  @param  ReadOnlyUpdater        Function to change RO permissions\r
+  @param  ReadWriteUpdater       Function to change RW permissions\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UpdateMmFoundationPeCoffPermissions (\r
+  IN  CONST PE_COFF_LOADER_IMAGE_CONTEXT      *ImageContext,\r
+  IN  UINT32                                  SectionHeaderOffset,\r
+  IN  CONST  UINT16                           NumberOfSections,\r
+  IN  REGION_PERMISSION_UPDATE_FUNC           TextUpdater,\r
+  IN  REGION_PERMISSION_UPDATE_FUNC           ReadOnlyUpdater,\r
+  IN  REGION_PERMISSION_UPDATE_FUNC           ReadWriteUpdater\r
+  );\r
+\r
+\r
+/**\r
+  Privileged firmware assigns RO & Executable attributes to all memory occupied\r
+  by the Boot Firmware Volume. This function locates the section information of\r
+  the Standalone MM Core module to be able to change permissions of the\r
+  individual sections later in the boot process.\r
+\r
+  @param  TeData                 Pointer to PE/COFF image data\r
+  @param  ImageContext           Pointer to PE/COFF image context\r
+  @param  SectionHeaderOffset    Offset of PE/COFF image section header\r
+  @param  NumberOfSections       Number of Sections\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetStandaloneMmCorePeCoffSections (\r
+  IN        VOID                            *TeData,\r
+  IN  OUT   PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,\r
+  IN  OUT   UINT32                          *SectionHeaderOffset,\r
+  IN  OUT   UINT16                          *NumberOfSections\r
+  );\r
+\r
+\r
+/**\r
+  Privileged firmware assigns RO & Executable attributes to all memory occupied\r
+  by the Boot Firmware Volume. This function locates the Standalone MM Core\r
+  module PE/COFF image in the BFV and returns this information.\r
+\r
+  @param  BfvAddress             Base Address of Boot Firmware Volume\r
+  @param  TeData                 Pointer to address for allocating memory for\r
+                                 PE/COFF image data\r
+  @param  TeDataSize             Pointer to size of PE/COFF image data\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LocateStandaloneMmCorePeCoffData (\r
+  IN        EFI_FIRMWARE_VOLUME_HEADER      *BfvAddress,\r
+  IN  OUT   VOID                            **TeData,\r
+  IN  OUT   UINTN                           *TeDataSize\r
+  );\r
+\r
+\r
+/**\r
+  Use the boot information passed by privileged firmware to populate a HOB list\r
+  suitable for consumption by the MM Core and drivers.\r
+\r
+  @param  CpuDriverEntryPoint    Address of MM CPU driver entrypoint\r
+  @param  PayloadBootInfo        Boot information passed by privileged firmware\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+CreateHobListFromBootInfo (\r
+  IN  OUT  PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,\r
+  IN       EFI_SECURE_PARTITION_BOOT_INFO     *PayloadBootInfo\r
+  );\r
+\r
+\r
+/**\r
+  The entry point of Standalone MM Foundation.\r
+\r
+  @param  SharedBufAddress  Pointer to the Buffer between SPM and SP.\r
+  @param  cookie1.\r
+  @param  cookie2.\r
+**/\r
+VOID\r
+EFIAPI\r
+_ModuleEntryPoint (\r
+  IN VOID    *SharedBufAddress,\r
+  IN UINT64  SharedBufSize,\r
+  IN UINT64  cookie1,\r
+  IN UINT64  cookie2\r
+  );\r
+\r
+\r
+/**\r
+  Auto generated function that calls the library constructors for all of the module's dependent libraries.\r
+\r
+  This function must be called by _ModuleEntryPoint().\r
+  This function calls the set of library constructors for the set of library instances\r
+  that a module depends on.  This includes library instances that a module depends on\r
+  directly and library instances that a module depends on indirectly through other\r
+  libraries. This function is auto generated by build tools and those build tools are\r
+  responsible for collecting the set of library instances, determine which ones have\r
+  constructors, and calling the library constructors in the proper order based upon\r
+  each of the library instances own dependencies.\r
+\r
+  @param  ImageHandle  The image handle of the DXE Core.\r
+  @param  SystemTable  A pointer to the EFI System Table.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ProcessLibraryConstructorList (\r
+  IN EFI_HANDLE             ImageHandle,\r
+  IN EFI_MM_SYSTEM_TABLE  *MmSystemTable\r
+  );\r
+\r
+\r
+/**\r
+  Auto generated function that calls a set of module entry points.\r
+\r
+  This function must be called by _ModuleEntryPoint().\r
+  This function calls the set of module entry points.\r
+  This function is auto generated by build tools and those build tools are responsible\r
+  for collecting the module entry points and calling them in a specified order.\r
+\r
+  @param  HobStart  Pointer to the beginning of the HOB List passed in from the PEI Phase.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ProcessModuleEntryPointList (\r
+  IN VOID  *HobStart\r
+  );\r
+\r
+#endif\r