3 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials are licensed and
5 made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php.
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Ppi/SecPlatformInformation.h>
17 #include <Ppi/TopOfTemporaryRam.h>
19 #include <Library/BaseMemoryLib.h>
20 #include <Library/DebugLib.h>
23 This interface conveys state information out of the Security (SEC) phase into PEI.
25 @param PeiServices Pointer to the PEI Services Table.
26 @param StructureSize Pointer to the variable describing size of the input buffer.
27 @param PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
29 @retval EFI_SUCCESS The data was successfully returned.
30 @retval EFI_BUFFER_TOO_SMALL The buffer was too small.
35 SecPlatformInformation (
36 IN CONST EFI_PEI_SERVICES
**PeiServices
,
37 IN OUT UINT64
*StructureSize
,
38 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD
*PlatformInformationRecord
44 UINT32 TopOfTemporaryRam
;
45 VOID
*TopOfTemporaryRamPpi
;
48 DEBUG ((DEBUG_INFO
, "SecPlatformInformation\n"));
50 Status
= (*PeiServices
)->LocatePpi (
52 &gTopOfTemporaryRamPpiGuid
,
55 (VOID
**) &TopOfTemporaryRamPpi
57 if (EFI_ERROR (Status
)) {
62 // The entries of BIST information, together with the number of them,
63 // reside in the bottom of stack, left untouched by normal stack operation.
64 // This routine copies the BIST information to the buffer pointed by
65 // PlatformInformationRecord for output.
67 TopOfTemporaryRam
= (UINT32
)(UINTN
)TopOfTemporaryRamPpi
- sizeof (UINT32
);
68 TopOfTemporaryRam
-= sizeof(UINT32
) * 2;
69 Count
= *((UINT32
*)(UINTN
) (TopOfTemporaryRam
- sizeof (UINT32
)));
70 Size
= Count
* sizeof (IA32_HANDOFF_STATUS
);
72 if ((*StructureSize
) < (UINT64
) Size
) {
73 *StructureSize
= Size
;
74 return EFI_BUFFER_TOO_SMALL
;
77 *StructureSize
= Size
;
78 Bist
= (UINT32
*) (TopOfTemporaryRam
- sizeof (UINT32
) - Size
);
80 CopyMem (PlatformInformationRecord
, Bist
, Size
);