]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/FspPlatformSecLibVlv2.c
2b03cfaec9c7a5b90aaba17b577560c9fcbfb39d
[mirror_edk2.git] / Vlv2TbltDevicePkg / FspSupport / Library / SecFspPlatformSecLibVlv2 / FspPlatformSecLibVlv2.c
1 /** @file
2
3 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6 **/
7
8 #include <PiPei.h>
9
10 #include <Ppi/SecPlatformInformation.h>
11 #include <Ppi/SecPerformance.h>
12 #include <Ppi/TemporaryRamSupport.h>
13
14 #include <Library/LocalApicLib.h>
15
16 /**
17 This interface conveys state information out of the Security (SEC) phase into PEI.
18
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.
22
23 @retval EFI_SUCCESS The data was successfully returned.
24 @retval EFI_BUFFER_TOO_SMALL The buffer was too small.
25
26 **/
27 EFI_STATUS
28 EFIAPI
29 SecPlatformInformation (
30 IN CONST EFI_PEI_SERVICES **PeiServices,
31 IN OUT UINT64 *StructureSize,
32 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
33 );
34
35 /**
36 This interface conveys performance information out of the Security (SEC) phase into PEI.
37
38 This service is published by the SEC phase. The SEC phase handoff has an optional
39 EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is passed from SEC into the
40 PEI Foundation. As such, if the platform supports collecting performance data in SEC,
41 this information is encapsulated into the data structure abstracted by this service.
42 This information is collected for the boot-strap processor (BSP) on IA-32.
43
44 @param[in] PeiServices The pointer to the PEI Services Table.
45 @param[in] This The pointer to this instance of the PEI_SEC_PERFORMANCE_PPI.
46 @param[out] Performance The pointer to performance data collected in SEC phase.
47
48 @retval EFI_SUCCESS The data was successfully returned.
49
50 **/
51 EFI_STATUS
52 EFIAPI
53 SecGetPerformance (
54 IN CONST EFI_PEI_SERVICES **PeiServices,
55 IN PEI_SEC_PERFORMANCE_PPI *This,
56 OUT FIRMWARE_SEC_PERFORMANCE *Performance
57 );
58
59 /**
60 This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
61 permanent memory.
62
63 @param PeiServices Pointer to the PEI Services Table.
64 @param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
65 Temporary RAM contents.
66 @param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
67 Temporary RAM contents.
68 @param CopySize Amount of memory to migrate from temporary to permanent memory.
69
70 @retval EFI_SUCCESS The data was successfully returned.
71 @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
72 TemporaryMemoryBase > PermanentMemoryBase.
73
74 **/
75 EFI_STATUS
76 EFIAPI
77 SecTemporaryRamSupport (
78 IN CONST EFI_PEI_SERVICES **PeiServices,
79 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
80 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
81 IN UINTN CopySize
82 );
83
84 EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformationPpi = {
85 SecPlatformInformation
86 };
87
88 PEI_SEC_PERFORMANCE_PPI mSecPerformancePpi = {
89 SecGetPerformance
90 };
91
92 EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI gSecTemporaryRamSupportPpi = {
93 SecTemporaryRamSupport
94 };
95
96 EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformPpi[] = {
97 {
98 EFI_PEI_PPI_DESCRIPTOR_PPI,
99 &gEfiSecPlatformInformationPpiGuid,
100 &mSecPlatformInformationPpi
101 },
102 {
103 EFI_PEI_PPI_DESCRIPTOR_PPI,
104 &gPeiSecPerformancePpiGuid,
105 &mSecPerformancePpi
106 },
107 {
108 EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
109 &gEfiTemporaryRamSupportPpiGuid,
110 &gSecTemporaryRamSupportPpi
111 },
112 };
113
114 /**
115 A developer supplied function to perform platform specific operations.
116
117 It's a developer supplied function to perform any operations appropriate to a
118 given platform. It's invoked just before passing control to PEI core by SEC
119 core. Platform developer may modify the SecCoreData passed to PEI Core.
120 It returns a platform specific PPI list that platform wishes to pass to PEI core.
121 The Generic SEC core module will merge this list to join the final list passed to
122 PEI core.
123
124 @param SecCoreData The same parameter as passing to PEI core. It
125 could be overridden by this function.
126
127 @return The platform specific PPI list to be passed to PEI core or
128 NULL if there is no need of such platform specific PPI list.
129
130 **/
131 EFI_PEI_PPI_DESCRIPTOR *
132 EFIAPI
133 SecPlatformMain (
134 IN OUT EFI_SEC_PEI_HAND_OFF *SecCoreData
135 )
136 {
137 EFI_PEI_PPI_DESCRIPTOR *PpiList;
138
139 InitializeApicTimer (0, (UINT32) -1, TRUE, 5);
140
141 PpiList = &mPeiSecPlatformPpi[0];
142
143 return PpiList;
144 }