+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <PiPei.h>\r
-\r
-#include <Ppi/SecPlatformInformation.h>\r
-#include <Ppi/TopOfTemporaryRam.h>\r
-\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/DebugLib.h>\r
-\r
-/**\r
- This interface conveys state information out of the Security (SEC) phase into PEI.\r
-\r
- @param PeiServices Pointer to the PEI Services Table.\r
- @param StructureSize Pointer to the variable describing size of the input buffer.\r
- @param PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.\r
-\r
- @retval EFI_SUCCESS The data was successfully returned.\r
- @retval EFI_BUFFER_TOO_SMALL The buffer was too small.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SecPlatformInformation (\r
- IN CONST EFI_PEI_SERVICES **PeiServices,\r
- IN OUT UINT64 *StructureSize,\r
- OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord\r
- )\r
-{\r
- UINT32 *Bist;\r
- UINT32 Size;\r
- UINT32 Count;\r
- UINT32 TopOfTemporaryRam;\r
- VOID *TopOfTemporaryRamPpi;\r
- EFI_STATUS Status;\r
-\r
- DEBUG ((DEBUG_INFO, "SecPlatformInformation\n"));\r
-\r
- Status = (*PeiServices)->LocatePpi (\r
- PeiServices,\r
- &gTopOfTemporaryRamPpiGuid,\r
- 0,\r
- NULL,\r
- (VOID **) &TopOfTemporaryRamPpi\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_NOT_FOUND;\r
- }\r
-\r
- //\r
- // The entries of BIST information, together with the number of them,\r
- // reside in the bottom of stack, left untouched by normal stack operation.\r
- // This routine copies the BIST information to the buffer pointed by\r
- // PlatformInformationRecord for output.\r
- //\r
- TopOfTemporaryRam = (UINT32)(UINTN)TopOfTemporaryRamPpi - sizeof (UINT32);\r
- TopOfTemporaryRam -= sizeof(UINT32) * 2;\r
- Count = *((UINT32 *)(UINTN) (TopOfTemporaryRam - sizeof (UINT32)));\r
- Size = Count * sizeof (IA32_HANDOFF_STATUS);\r
-\r
- if ((*StructureSize) < (UINT64) Size) {\r
- *StructureSize = Size;\r
- return EFI_BUFFER_TOO_SMALL;\r
- }\r
-\r
- *StructureSize = Size;\r
- Bist = (UINT32 *) (TopOfTemporaryRam - sizeof (UINT32) - Size);\r
-\r
- CopyMem (PlatformInformationRecord, Bist, Size);\r
-\r
- return EFI_SUCCESS;\r
-}\r