TianoCore EDK2 master
Loading...
Searching...
No Matches
SecMain.c File Reference

Go to the source code of this file.

Functions

STATIC EFI_STATUS EFIAPI TemporaryRamMigration (IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, IN UINTN CopySize)
 
STATIC EFI_STATUS FindFfsSectionInstance (IN VOID *Sections, IN UINTN SizeOfSections, IN EFI_SECTION_TYPE SectionType, IN UINTN Instance, OUT EFI_COMMON_SECTION_HEADER **FoundSection)
 
STATIC EFI_STATUS FindFfsSectionInSections (IN VOID *Sections, IN UINTN SizeOfSections, IN EFI_SECTION_TYPE SectionType, OUT EFI_COMMON_SECTION_HEADER **FoundSection)
 
STATIC EFI_STATUS FindFfsFileAndSection (IN EFI_FIRMWARE_VOLUME_HEADER *Fv, IN EFI_FV_FILETYPE FileType, IN EFI_SECTION_TYPE SectionType, OUT EFI_COMMON_SECTION_HEADER **FoundSection)
 
STATIC EFI_STATUS FindPeiCoreImageBaseInFv (IN EFI_FIRMWARE_VOLUME_HEADER *Fv, OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase)
 
STATIC VOID FindAndReportEntryPoints (IN EFI_FIRMWARE_VOLUME_HEADER **BootFirmwareVolumePtr, OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint)
 
STATIC VOID EFIAPI SecStartupPhase2 (IN VOID *Context)
 
VOID EFIAPI SecCoreStartupWithStack (IN EFI_FIRMWARE_VOLUME_HEADER *BootFv, IN VOID *TopOfCurrentStack)
 

Variables

STATIC EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi
 
STATIC EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTable []
 

Detailed Description

Main SEC phase code. Transitions to PEI.

Copyright (c) 2024 Loongson Technology Corporation Limited. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SecMain.c.

Function Documentation

◆ FindAndReportEntryPoints()

STATIC VOID FindAndReportEntryPoints ( IN EFI_FIRMWARE_VOLUME_HEADER **  BootFirmwareVolumePtr,
OUT EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint 
)

Find and return Pei Core entry point.

It also find SEC and PEI Core file debug information. It will report them if remote debug is enabled.

Definition at line 292 of file SecMain.c.

◆ FindFfsFileAndSection()

STATIC EFI_STATUS FindFfsFileAndSection ( IN EFI_FIRMWARE_VOLUME_HEADER Fv,
IN EFI_FV_FILETYPE  FileType,
IN EFI_SECTION_TYPE  SectionType,
OUT EFI_COMMON_SECTION_HEADER **  FoundSection 
)

Locates a FFS file with the specified file type and a section within that file with the specified section type.

Parameters
[in]FvThe firmware volume to search
[in]FileTypeThe file type to locate
[in]SectionTypeThe section type to locate
[out]FoundSectionThe FFS section if found
Return values
EFI_SUCCESSThe file and section was found
EFI_NOT_FOUNDThe file and section was not found
EFI_VOLUME_CORRUPTEDThe firmware volume was corrupted

Definition at line 178 of file SecMain.c.

◆ FindFfsSectionInSections()

STATIC EFI_STATUS FindFfsSectionInSections ( IN VOID Sections,
IN UINTN  SizeOfSections,
IN EFI_SECTION_TYPE  SectionType,
OUT EFI_COMMON_SECTION_HEADER **  FoundSection 
)

Locates a section within a series of sections with the specified section type.

Parameters
[in]SectionsThe sections to search
[in]SizeOfSectionsTotal size of all sections
[in]SectionTypeThe section type to locate
[out]FoundSectionThe FFS section if found
Return values
EFI_SUCCESSThe file and section was found
EFI_NOT_FOUNDThe file and section was not found
EFI_VOLUME_CORRUPTEDThe firmware volume was corrupted

Definition at line 147 of file SecMain.c.

◆ FindFfsSectionInstance()

STATIC EFI_STATUS FindFfsSectionInstance ( IN VOID Sections,
IN UINTN  SizeOfSections,
IN EFI_SECTION_TYPE  SectionType,
IN UINTN  Instance,
OUT EFI_COMMON_SECTION_HEADER **  FoundSection 
)

Locates a section within a series of sections with the specified section type.

The Instance parameter indicates which instance of the section type to return. (0 is first instance, 1 is second...)

Parameters
[in]SectionsThe sections to search
[in]SizeOfSectionsTotal size of all sections
[in]SectionTypeThe section type to locate
[in]InstanceThe section instance number
[out]FoundSectionThe FFS section if found
Return values
EFI_SUCCESSThe file and section was found
EFI_NOT_FOUNDThe file and section was not found
EFI_VOLUME_CORRUPTEDThe firmware volume was corrupted

Definition at line 75 of file SecMain.c.

◆ FindPeiCoreImageBaseInFv()

STATIC EFI_STATUS FindPeiCoreImageBaseInFv ( IN EFI_FIRMWARE_VOLUME_HEADER Fv,
OUT EFI_PHYSICAL_ADDRESS PeiCoreImageBase 
)

Locates the PEI Core entry point address

Parameters
[in]FvThe firmware volume to search
[out]PeiCoreEntryPointThe entry point of the PEI Core image
Return values
EFI_SUCCESSThe file and section was found
EFI_NOT_FOUNDThe file and section was not found
EFI_VOLUME_CORRUPTEDThe firmware volume was corrupted

Definition at line 253 of file SecMain.c.

◆ SecCoreStartupWithStack()

VOID EFIAPI SecCoreStartupWithStack ( IN EFI_FIRMWARE_VOLUME_HEADER BootFv,
IN VOID TopOfCurrentStack 
)

Entry point to the C language phase of SEC. initialize some temporary memory and set up the stack, the control is transferred to this function.

Parameters
[in]BootFvThe pointer to the PEI FV in memory.
[in]TopOfCurrentStackTop of Current Stack.

Definition at line 376 of file SecMain.c.

◆ SecStartupPhase2()

VOID NORETURN EFIAPI SecStartupPhase2 ( IN VOID Context)

Find the peicore entry point and jump to the entry point to execute.

Parameters
[in]ContextThe first input parameter of InitializeDebugAgent().

Caller provided function to be invoked at the end of InitializeDebugAgent().

Entry point to the C language phase of SEC. After the SEC assembly code has initialized some temporary memory and set up the stack, the control is transferred to this function.

Parameters
[in]ContextThe first input parameter of InitializeDebugAgent().

Definition at line 332 of file SecMain.c.

◆ TemporaryRamMigration()

EFI_STATUS EFIAPI TemporaryRamMigration ( IN CONST EFI_PEI_SERVICES **  PeiServices,
IN EFI_PHYSICAL_ADDRESS  TemporaryMemoryBase,
IN EFI_PHYSICAL_ADDRESS  PermanentMemoryBase,
IN UINTN  CopySize 
)

temporary memory to permanent memory and do stack switching.

Parameters
[in]PeiServicesPointer to the PEI Services Table.
[in]TemporaryMemoryBaseTemporary Memory Base address.
[in]PermanentMemoryBasePermanent Memory Base address.
[in]CopySizeThe size of memory that needs to be migrated.
Return values
EFI_SUCCESSMigration successful.

Definition at line 467 of file SecMain.c.

Variable Documentation

◆ mPrivateDispatchTable

STATIC EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTable[]
Initial value:
= {
{
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiTemporaryRamSupportPpiGuid,
&mTemporaryRamSupportPpi
},
}

Definition at line 48 of file SecMain.c.

◆ mTemporaryRamSupportPpi

STATIC EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi
Initial value:
= {
}
STATIC EFI_STATUS EFIAPI TemporaryRamMigration(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, IN UINTN CopySize)
Definition: SecMain.c:467

Definition at line 44 of file SecMain.c.