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 Worker function to parse CPU BIST information from Guided HOB.
20 @param[out] StructureSize Pointer to the variable describing size of the input buffer.
21 @param[out] StructureBuffer Pointer to the buffer save CPU BIST information.
23 @retval EFI_SUCCESS The data was successfully returned.
24 @retval EFI_BUFFER_TOO_SMALL The buffer was too small.
29 IN OUT UINT64
*StructureSize
,
30 IN OUT VOID
*StructureBuffer
33 EFI_HOB_GUID_TYPE
*GuidHob
;
37 GuidHob
= GetFirstGuidHob (&gEfiCallerIdGuid
);
38 if (GuidHob
== NULL
) {
43 DataInHob
= GET_GUID_HOB_DATA (GuidHob
);
44 DataSize
= GET_GUID_HOB_DATA_SIZE (GuidHob
);
47 // return the information from BistHob
49 if ((*StructureSize
) < (UINT64
) DataSize
) {
50 *StructureSize
= (UINT64
) DataSize
;
51 return EFI_BUFFER_TOO_SMALL
;
54 *StructureSize
= (UINT64
) DataSize
;
55 CopyMem (StructureBuffer
, DataInHob
, DataSize
);
60 Implementation of the PlatformInformation service in EFI_SEC_PLATFORM_INFORMATION_PPI.
62 @param[in] PeiServices Pointer to the PEI Services Table.
63 @param[out] StructureSize Pointer to the variable describing size of the input buffer.
64 @param[out PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
66 @retval EFI_SUCCESS The data was successfully returned.
67 @retval EFI_BUFFER_TOO_SMALL The buffer was too small.
72 SecPlatformInformationBist (
73 IN CONST EFI_PEI_SERVICES
**PeiServices
,
74 IN OUT UINT64
*StructureSize
,
75 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD
*PlatformInformationRecord
78 return GetBistFromHob (StructureSize
, PlatformInformationRecord
);
82 Implementation of the PlatformInformation2 service in EFI_SEC_PLATFORM_INFORMATION2_PPI.
84 @param[in] PeiServices The pointer to the PEI Services Table.
85 @param[out] StructureSize The pointer to the variable describing size of the input buffer.
86 @param[out] PlatformInformationRecord2 The pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD2.
88 @retval EFI_SUCCESS The data was successfully returned.
89 @retval EFI_BUFFER_TOO_SMALL The buffer was too small. The current buffer size needed to
90 hold the record is returned in StructureSize.
95 SecPlatformInformation2Bist (
96 IN CONST EFI_PEI_SERVICES
**PeiServices
,
97 IN OUT UINT64
*StructureSize
,
98 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2
*PlatformInformationRecord2
101 return GetBistFromHob (StructureSize
, PlatformInformationRecord2
);
105 Worker function to get CPUs' BIST by calling SecPlatformInformationPpi
106 or SecPlatformInformation2Ppi.
108 @param[in] PeiServices Pointer to PEI Services Table
109 @param[in] Guid PPI Guid
110 @param[out] PpiDescriptor Return a pointer to instance of the
111 EFI_PEI_PPI_DESCRIPTOR
112 @param[out] BistInformationData Pointer to BIST information data
113 @param[out] BistInformationSize Return the size in bytes of BIST information
115 @retval EFI_SUCCESS Retrieve of the BIST data successfully
116 @retval EFI_NOT_FOUND No sec platform information(2) ppi export
117 @retval EFI_DEVICE_ERROR Failed to get CPU Information
122 IN CONST EFI_PEI_SERVICES
**PeiServices
,
123 IN CONST EFI_GUID
*Guid
,
124 OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
125 OUT VOID
**BistInformationData
,
126 OUT UINT64
*BistInformationSize OPTIONAL
130 EFI_SEC_PLATFORM_INFORMATION2_PPI
*SecPlatformInformation2Ppi
;
131 EFI_SEC_PLATFORM_INFORMATION_RECORD2
*SecPlatformInformation2
;
132 UINT64 InformationSize
;
134 Status
= PeiServicesLocatePpi (
137 PpiDescriptor
, // EFI_PEI_PPI_DESCRIPTOR
138 (VOID
**)&SecPlatformInformation2Ppi
// PPI
140 if (Status
== EFI_NOT_FOUND
) {
141 return EFI_NOT_FOUND
;
144 if (Status
== EFI_SUCCESS
) {
146 // Get the size of the sec platform information2(BSP/APs' BIST data)
149 SecPlatformInformation2
= NULL
;
150 Status
= SecPlatformInformation2Ppi
->PlatformInformation2 (
153 SecPlatformInformation2
155 if (Status
== EFI_BUFFER_TOO_SMALL
) {
156 Status
= PeiServicesAllocatePool (
157 (UINTN
) InformationSize
,
158 (VOID
**) &SecPlatformInformation2
160 if (Status
== EFI_SUCCESS
) {
162 // Retrieve BIST data
164 Status
= SecPlatformInformation2Ppi
->PlatformInformation2 (
167 SecPlatformInformation2
169 if (Status
== EFI_SUCCESS
) {
170 *BistInformationData
= SecPlatformInformation2
;
171 if (BistInformationSize
!= NULL
) {
172 *BistInformationSize
= InformationSize
;
180 return EFI_DEVICE_ERROR
;