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

Go to the source code of this file.

Data Structures

struct  _SEC_IDT_TABLE
 

Macros

#define SEC_IDT_ENTRY_COUNT   34
 

Typedefs

typedef struct _SEC_IDT_TABLE SEC_IDT_TABLE
 

Functions

VOID EFIAPI SecStartupPhase2 (IN VOID *Context)
 
EFI_STATUS EFIAPI TemporaryRamMigration (IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, IN UINTN CopySize)
 
EFI_STATUS FindMainFv (IN OUT EFI_FIRMWARE_VOLUME_HEADER **BootFv)
 
EFI_STATUS FindFfsSectionInstance (IN VOID *Sections, IN UINTN SizeOfSections, IN EFI_SECTION_TYPE SectionType, IN UINTN Instance, OUT EFI_COMMON_SECTION_HEADER **FoundSection)
 
EFI_STATUS FindFfsSectionInSections (IN VOID *Sections, IN UINTN SizeOfSections, IN EFI_SECTION_TYPE SectionType, OUT EFI_COMMON_SECTION_HEADER **FoundSection)
 
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)
 
EFI_STATUS DecompressMemFvs (IN OUT EFI_FIRMWARE_VOLUME_HEADER **Fv)
 
EFI_STATUS FindPeiCoreImageBaseInFv (IN EFI_FIRMWARE_VOLUME_HEADER *Fv, OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase)
 
STATIC UINT8 CmosRead8 (IN UINTN Index)
 
STATIC BOOLEAN IsS3Resume (VOID)
 
STATIC EFI_STATUS GetS3ResumePeiFv (IN OUT EFI_FIRMWARE_VOLUME_HEADER **PeiFv)
 
VOID FindPeiCoreImageBase (IN OUT EFI_FIRMWARE_VOLUME_HEADER **BootFv, OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase)
 
EFI_STATUS FindImageBase (IN EFI_FIRMWARE_VOLUME_HEADER *BootFirmwareVolumePtr, OUT EFI_PHYSICAL_ADDRESS *SecCoreImageBase)
 
VOID FindAndReportEntryPoints (IN EFI_FIRMWARE_VOLUME_HEADER **BootFirmwareVolumePtr, OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint)
 
STATIC VOID SecMtrrSetup (VOID)
 
VOID EFIAPI SecCoreStartupWithStack (IN EFI_FIRMWARE_VOLUME_HEADER *BootFv, IN VOID *TopOfCurrentStack)
 

Variables

EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi
 
EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTableMp []
 
EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTableUp []
 
IA32_IDT_GATE_DESCRIPTOR mIdtEntryTemplate
 

Detailed Description

Main SEC phase code. Transitions to PEI.

Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
Copyright (c) 2020, Advanced Micro Devices, Inc. All rights reserved.

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

Definition in file SecMain.c.

Macro Definition Documentation

◆ SEC_IDT_ENTRY_COUNT

#define SEC_IDT_ENTRY_COUNT   34

Definition at line 36 of file SecMain.c.

Function Documentation

◆ CmosRead8()

STATIC UINT8 CmosRead8 ( IN UINTN  Index)

Reads 8-bits of CMOS data.

Reads the 8-bits of CMOS data at the location specified by Index. The 8-bit read value is returned.

Parameters
IndexThe CMOS location to read.
Returns
The value read.

Definition at line 533 of file SecMain.c.

◆ DecompressMemFvs()

EFI_STATUS DecompressMemFvs ( IN OUT EFI_FIRMWARE_VOLUME_HEADER **  Fv)

Locates the compressed main firmware volume and decompresses it.

Parameters
[in,out]FvOn input, the firmware volume to search On output, the decompressed BOOT/PEI FV
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 341 of file SecMain.c.

◆ FindAndReportEntryPoints()

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

Definition at line 704 of file SecMain.c.

◆ FindFfsFileAndSection()

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 268 of file SecMain.c.

◆ FindFfsSectionInSections()

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 237 of file SecMain.c.

◆ FindFfsSectionInstance()

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 165 of file SecMain.c.

◆ FindImageBase()

EFI_STATUS FindImageBase ( IN EFI_FIRMWARE_VOLUME_HEADER BootFirmwareVolumePtr,
OUT EFI_PHYSICAL_ADDRESS SecCoreImageBase 
)

Find core image base.

Definition at line 612 of file SecMain.c.

◆ FindMainFv()

EFI_STATUS FindMainFv ( IN OUT EFI_FIRMWARE_VOLUME_HEADER **  BootFv)

Locates the main boot firmware volume.

Parameters
[in,out]BootFvOn input, the base of the BootFv On output, the decompressed main firmware volume
Return values
EFI_SUCCESSThe main firmware volume was located and decompressed
EFI_NOT_FOUNDThe main firmware volume was not found

Definition at line 115 of file SecMain.c.

◆ FindPeiCoreImageBase()

VOID FindPeiCoreImageBase ( IN OUT EFI_FIRMWARE_VOLUME_HEADER **  BootFv,
OUT EFI_PHYSICAL_ADDRESS PeiCoreImageBase 
)

Locates the PEI Core entry point address

Parameters
[in,out]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 572 of file SecMain.c.

◆ FindPeiCoreImageBaseInFv()

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 489 of file SecMain.c.

◆ GetS3ResumePeiFv()

STATIC EFI_STATUS GetS3ResumePeiFv ( IN OUT EFI_FIRMWARE_VOLUME_HEADER **  PeiFv)

Definition at line 552 of file SecMain.c.

◆ IsS3Resume()

STATIC BOOLEAN IsS3Resume ( VOID  )

Definition at line 543 of file SecMain.c.

◆ SecCoreStartupWithStack()

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

Definition at line 790 of file SecMain.c.

◆ SecMtrrSetup()

STATIC VOID SecMtrrSetup ( VOID  )

Definition at line 755 of file SecMain.c.

◆ SecStartupPhase2()

VOID EFIAPI SecStartupPhase2 ( IN VOID *  Context)

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 1010 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 
)

Definition at line 1054 of file SecMain.c.

Variable Documentation

◆ mIdtEntryTemplate

IA32_IDT_GATE_DESCRIPTOR mIdtEntryTemplate
Initial value:
= {
{
0xffe4,
0x10,
0x0,
IA32_IDT_GATE_TYPE_INTERRUPT_32,
0xffff
}
}

Definition at line 94 of file SecMain.c.

◆ mPrivateDispatchTableMp

EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTableMp[]
Initial value:
= {
{
(EFI_PEI_PPI_DESCRIPTOR_PPI),
&gEfiTemporaryRamSupportPpiGuid,
&mTemporaryRamSupportPpi
},
{
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPeiMpInitLibMpDepPpiGuid,
},
}
#define NULL
Definition: Base.h:319

Definition at line 65 of file SecMain.c.

◆ mPrivateDispatchTableUp

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

Definition at line 78 of file SecMain.c.

◆ mTemporaryRamSupportPpi

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 61 of file SecMain.c.