2 Get SEC platform information(2) PPI and reinstall it.
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Implementation of the PlatformInformation2 service in EFI_SEC_PLATFORM_INFORMATION2_PPI.
20 @param PeiServices The pointer to the PEI Services Table.
21 @param StructureSize The pointer to the variable describing size of the input buffer.
22 @param PlatformInformationRecord2 The pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD2.
24 @retval EFI_SUCCESS The data was successfully returned.
25 @retval EFI_BUFFER_TOO_SMALL The buffer was too small. The current buffer size needed to
26 hold the record is returned in StructureSize.
31 SecPlatformInformation2 (
32 IN CONST EFI_PEI_SERVICES
**PeiServices
,
33 IN OUT UINT64
*StructureSize
,
34 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2
*PlatformInformationRecord2
37 EFI_HOB_GUID_TYPE
*GuidHob
;
41 GuidHob
= GetFirstGuidHob (&gEfiSecPlatformInformation2PpiGuid
);
42 if (GuidHob
== NULL
) {
47 DataInHob
= GET_GUID_HOB_DATA (GuidHob
);
48 DataSize
= GET_GUID_HOB_DATA_SIZE (GuidHob
);
51 // return the information from BistHob
53 if ((*StructureSize
) < (UINT64
) DataSize
) {
54 *StructureSize
= (UINT64
) DataSize
;
55 return EFI_BUFFER_TOO_SMALL
;
58 *StructureSize
= (UINT64
) DataSize
;
59 CopyMem (PlatformInformationRecord2
, DataInHob
, DataSize
);
64 Worker function to get CPUs' BIST by calling SecPlatformInformationPpi
65 or SecPlatformInformation2Ppi.
67 @param PeiServices Pointer to PEI Services Table
69 @param PpiDescriptor Return a pointer to instance of the
70 EFI_PEI_PPI_DESCRIPTOR
71 @param BistInformationData Pointer to BIST information data
72 @param BistInformationSize Return the size in bytes of BIST information
74 @retval EFI_SUCCESS Retrieve of the BIST data successfully
75 @retval EFI_NOT_FOUND No sec platform information(2) ppi export
76 @retval EFI_DEVICE_ERROR Failed to get CPU Information
81 IN CONST EFI_PEI_SERVICES
**PeiServices
,
82 IN CONST EFI_GUID
*Guid
,
83 OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
84 OUT VOID
**BistInformationData
,
85 OUT UINT64
*BistInformationSize OPTIONAL
89 EFI_SEC_PLATFORM_INFORMATION2_PPI
*SecPlatformInformation2Ppi
;
90 EFI_SEC_PLATFORM_INFORMATION_RECORD2
*SecPlatformInformation2
;
91 UINT64 InformationSize
;
93 Status
= PeiServicesLocatePpi (
96 PpiDescriptor
, // EFI_PEI_PPI_DESCRIPTOR
97 (VOID
**)&SecPlatformInformation2Ppi
// PPI
99 if (Status
== EFI_NOT_FOUND
) {
100 return EFI_NOT_FOUND
;
103 if (Status
== EFI_SUCCESS
) {
105 // Get the size of the sec platform information2(BSP/APs' BIST data)
108 SecPlatformInformation2
= NULL
;
109 Status
= SecPlatformInformation2Ppi
->PlatformInformation2 (
112 SecPlatformInformation2
114 if (Status
== EFI_BUFFER_TOO_SMALL
) {
115 Status
= PeiServicesAllocatePool (
116 (UINTN
) InformationSize
,
117 (VOID
**) &SecPlatformInformation2
119 if (Status
== EFI_SUCCESS
) {
121 // Retrieve BIST data
123 Status
= SecPlatformInformation2Ppi
->PlatformInformation2 (
126 SecPlatformInformation2
128 if (Status
== EFI_SUCCESS
) {
129 *BistInformationData
= SecPlatformInformation2
;
130 if (BistInformationSize
!= NULL
) {
131 *BistInformationSize
= InformationSize
;
139 return EFI_DEVICE_ERROR
;