3 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Ppi/SecPlatformInformation.h>
11 #include <Ppi/TopOfTemporaryRam.h>
13 #include <Library/BaseMemoryLib.h>
14 #include <Library/DebugLib.h>
17 This interface conveys state information out of the Security (SEC) phase into PEI.
19 @param PeiServices Pointer to the PEI Services Table.
20 @param StructureSize Pointer to the variable describing size of the input buffer.
21 @param PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
23 @retval EFI_SUCCESS The data was successfully returned.
24 @retval EFI_BUFFER_TOO_SMALL The buffer was too small.
29 SecPlatformInformation (
30 IN CONST EFI_PEI_SERVICES
**PeiServices
,
31 IN OUT UINT64
*StructureSize
,
32 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD
*PlatformInformationRecord
38 UINT32 TopOfTemporaryRam
;
39 VOID
*TopOfTemporaryRamPpi
;
42 DEBUG ((DEBUG_INFO
, "SecPlatformInformation\n"));
44 Status
= (*PeiServices
)->LocatePpi (
46 &gTopOfTemporaryRamPpiGuid
,
49 (VOID
**) &TopOfTemporaryRamPpi
51 if (EFI_ERROR (Status
)) {
56 // The entries of BIST information, together with the number of them,
57 // reside in the bottom of stack, left untouched by normal stack operation.
58 // This routine copies the BIST information to the buffer pointed by
59 // PlatformInformationRecord for output.
61 TopOfTemporaryRam
= (UINT32
)(UINTN
)TopOfTemporaryRamPpi
- sizeof (UINT32
);
62 TopOfTemporaryRam
-= sizeof(UINT32
) * 2;
63 Count
= *((UINT32
*)(UINTN
) (TopOfTemporaryRam
- sizeof (UINT32
)));
64 Size
= Count
* sizeof (IA32_HANDOFF_STATUS
);
66 if ((*StructureSize
) < (UINT64
) Size
) {
67 *StructureSize
= Size
;
68 return EFI_BUFFER_TOO_SMALL
;
71 *StructureSize
= Size
;
72 Bist
= (UINT32
*) (TopOfTemporaryRam
- sizeof (UINT32
) - Size
);
74 CopyMem (PlatformInformationRecord
, Bist
, Size
);