]>
Commit | Line | Data |
---|---|---|
a33a2f62 JY |
1 | /** @file\r |
2 | Sample to provide FSP wrapper platform sec related function.\r | |
3 | \r | |
4 | Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php.\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include <PiPei.h>\r | |
16 | \r | |
17 | #include <Ppi/SecPlatformInformation.h>\r | |
18 | #include <Ppi/SecPerformance.h>\r | |
19 | #include <Ppi/TemporaryRamSupport.h>\r | |
20 | \r | |
21 | #include <Library/LocalApicLib.h>\r | |
22 | \r | |
23 | /**\r | |
24 | This interface conveys state information out of the Security (SEC) phase into PEI.\r | |
25 | \r | |
26 | @param[in] PeiServices Pointer to the PEI Services Table.\r | |
27 | @param[in,out] StructureSize Pointer to the variable describing size of the input buffer.\r | |
28 | @param[out] PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.\r | |
29 | \r | |
30 | @retval EFI_SUCCESS The data was successfully returned.\r | |
31 | @retval EFI_BUFFER_TOO_SMALL The buffer was too small.\r | |
32 | \r | |
33 | **/\r | |
34 | EFI_STATUS\r | |
35 | EFIAPI\r | |
36 | SecPlatformInformation (\r | |
37 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
38 | IN OUT UINT64 *StructureSize,\r | |
39 | OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord\r | |
40 | );\r | |
41 | \r | |
42 | /**\r | |
43 | This interface conveys performance information out of the Security (SEC) phase into PEI.\r | |
44 | \r | |
45 | This service is published by the SEC phase. The SEC phase handoff has an optional\r | |
46 | EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is passed from SEC into the\r | |
47 | PEI Foundation. As such, if the platform supports collecting performance data in SEC,\r | |
48 | this information is encapsulated into the data structure abstracted by this service.\r | |
49 | This information is collected for the boot-strap processor (BSP) on IA-32.\r | |
50 | \r | |
51 | @param[in] PeiServices The pointer to the PEI Services Table.\r | |
52 | @param[in] This The pointer to this instance of the PEI_SEC_PERFORMANCE_PPI.\r | |
53 | @param[out] Performance The pointer to performance data collected in SEC phase.\r | |
54 | \r | |
55 | @retval EFI_SUCCESS The data was successfully returned.\r | |
56 | \r | |
57 | **/\r | |
58 | EFI_STATUS\r | |
59 | EFIAPI\r | |
60 | SecGetPerformance (\r | |
61 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
62 | IN PEI_SEC_PERFORMANCE_PPI *This,\r | |
63 | OUT FIRMWARE_SEC_PERFORMANCE *Performance\r | |
64 | );\r | |
65 | \r | |
66 | /**\r | |
67 | This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into\r | |
68 | permanent memory.\r | |
69 | \r | |
70 | @param[in] PeiServices Pointer to the PEI Services Table.\r | |
71 | @param[in] TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the\r | |
72 | Temporary RAM contents.\r | |
73 | @param[in] PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the\r | |
74 | Temporary RAM contents.\r | |
75 | @param[in] CopySize Amount of memory to migrate from temporary to permanent memory.\r | |
76 | \r | |
77 | @retval EFI_SUCCESS The data was successfully returned.\r | |
78 | @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when\r | |
79 | TemporaryMemoryBase > PermanentMemoryBase.\r | |
80 | \r | |
81 | **/\r | |
82 | EFI_STATUS\r | |
83 | EFIAPI\r | |
84 | SecTemporaryRamSupport (\r | |
85 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
86 | IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,\r | |
87 | IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,\r | |
88 | IN UINTN CopySize\r | |
89 | );\r | |
90 | \r | |
91 | EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformationPpi = {\r | |
92 | SecPlatformInformation\r | |
93 | };\r | |
94 | \r | |
95 | PEI_SEC_PERFORMANCE_PPI mSecPerformancePpi = {\r | |
96 | SecGetPerformance\r | |
97 | };\r | |
98 | \r | |
99 | EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI gSecTemporaryRamSupportPpi = {\r | |
100 | SecTemporaryRamSupport\r | |
101 | };\r | |
102 | \r | |
103 | EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformPpi[] = {\r | |
104 | {\r | |
105 | EFI_PEI_PPI_DESCRIPTOR_PPI,\r | |
106 | &gEfiSecPlatformInformationPpiGuid,\r | |
107 | &mSecPlatformInformationPpi\r | |
108 | },\r | |
109 | {\r | |
110 | EFI_PEI_PPI_DESCRIPTOR_PPI,\r | |
111 | &gPeiSecPerformancePpiGuid,\r | |
112 | &mSecPerformancePpi\r | |
113 | },\r | |
114 | {\r | |
115 | EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r | |
116 | &gEfiTemporaryRamSupportPpiGuid,\r | |
117 | &gSecTemporaryRamSupportPpi\r | |
118 | },\r | |
119 | };\r | |
120 | \r | |
121 | /**\r | |
122 | A developer supplied function to perform platform specific operations.\r | |
123 | \r | |
124 | It's a developer supplied function to perform any operations appropriate to a\r | |
125 | given platform. It's invoked just before passing control to PEI core by SEC\r | |
126 | core. Platform developer may modify the SecCoreData passed to PEI Core.\r | |
127 | It returns a platform specific PPI list that platform wishes to pass to PEI core.\r | |
128 | The Generic SEC core module will merge this list to join the final list passed to\r | |
129 | PEI core.\r | |
130 | \r | |
131 | @param[in,out] SecCoreData The same parameter as passing to PEI core. It\r | |
132 | could be overridden by this function.\r | |
133 | \r | |
134 | @return The platform specific PPI list to be passed to PEI core or\r | |
135 | NULL if there is no need of such platform specific PPI list.\r | |
136 | \r | |
137 | **/\r | |
138 | EFI_PEI_PPI_DESCRIPTOR *\r | |
139 | EFIAPI\r | |
140 | SecPlatformMain (\r | |
141 | IN OUT EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
142 | )\r | |
143 | {\r | |
144 | EFI_PEI_PPI_DESCRIPTOR *PpiList;\r | |
145 | \r | |
146 | InitializeApicTimer (0, (UINT32) -1, TRUE, 5);\r | |
147 | \r | |
148 | PpiList = &mPeiSecPlatformPpi[0];\r | |
149 | \r | |
150 | return PpiList;\r | |
151 | }\r |