2 This PEIM will parse the hoblist from fsp and report them into pei core.
3 This file contains the main entrypoint of the PEIM.
5 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <Library/DebugLib.h>
14 #include <Ppi/TopOfTemporaryRam.h>
15 #include <Ppi/SecPlatformInformation.h>
18 Save BIST value before call FspInit.
20 @param Bist BIST value.
28 Save Ticker value before call FspInit.
30 @param Ticker Ticker value.
38 Save SEC context before call FspInit.
40 @param PeiServices Pointer to PEI Services Table.
45 IN CONST EFI_PEI_SERVICES
**PeiServices
52 UINT32 TopOfTemporaryRam
;
53 VOID
*TopOfTemporaryRamPpi
;
56 DEBUG ((DEBUG_INFO
, "SaveSecContext - 0x%x\n", PeiServices
));
58 Status
= (*PeiServices
)->LocatePpi (
60 &gTopOfTemporaryRamPpiGuid
,
63 (VOID
**) &TopOfTemporaryRamPpi
65 if (EFI_ERROR (Status
)) {
69 DEBUG ((DEBUG_INFO
, "TopOfTemporaryRamPpi - 0x%x\n", TopOfTemporaryRamPpi
));
72 // The entries of BIST information, together with the number of them,
73 // reside in the bottom of stack, left untouched by normal stack operation.
74 // This routine copies the BIST information to the buffer pointed by
75 // PlatformInformationRecord for output.
77 // |--------------| <- TopOfTemporaryRam
90 TopOfTemporaryRam
= (UINT32
)(UINTN
)TopOfTemporaryRamPpi
- sizeof(UINT32
);
91 TopOfTemporaryRam
-= sizeof(UINT32
) * 2;
92 DEBUG ((DEBUG_INFO
, "TopOfTemporaryRam - 0x%x\n", TopOfTemporaryRam
));
93 Count
= *(UINT32
*)(UINTN
)(TopOfTemporaryRam
- sizeof(UINT32
));
94 DEBUG ((DEBUG_INFO
, "Count - 0x%x\n", Count
));
95 Size
= Count
* sizeof (IA32_HANDOFF_STATUS
);
96 DEBUG ((DEBUG_INFO
, "Size - 0x%x\n", Size
));
98 Bist
= (UINT32
*)(UINTN
)(TopOfTemporaryRam
- sizeof(UINT32
) - Size
);
99 DEBUG ((DEBUG_INFO
, "Bist - 0x%x\n", *Bist
));
100 Ticker
= (UINT64
*)(UINTN
)(TopOfTemporaryRam
- sizeof(UINT32
) - Size
- sizeof(UINT64
));
101 DEBUG ((DEBUG_INFO
, "Ticker - 0x%lx\n", *Ticker
));
104 // Just need record BSP
106 AsmSaveBistValue (*Bist
);
107 AsmSaveTickerValue (*Ticker
);