Update IntelFspWrapperPkg according to FSP1.1.
[mirror_edk2.git] / IntelFspWrapperPkg / Library / BaseFspPlatformInfoLibSample / FspPlatformInfoLibSample.c
CommitLineData
a33a2f62
JY
1/** @file\r
2 Sample to provide FSP platform information 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#include <Library/PcdLib.h>\r
17\r
18/**\r
19 Get current boot mode.\r
20\r
21 @note At this point, memory is ready, PeiServices are NOT available to use.\r
22 Platform can get some data from chipset register.\r
23\r
24 @return BootMode current boot mode.\r
25**/\r
26UINT32\r
27EFIAPI\r
28GetBootMode (\r
29 VOID\r
30 )\r
31{\r
32 return BOOT_WITH_FULL_CONFIGURATION;\r
33}\r
34\r
35/**\r
36 Get NVS buffer parameter.\r
37\r
38 @note At this point, memory is NOT ready, PeiServices are available to use.\r
39\r
40 @return NvsBuffer NVS buffer parameter.\r
41**/\r
42VOID *\r
43EFIAPI\r
44GetNvsBuffer (\r
45 VOID\r
46 )\r
47{\r
48 return NULL;\r
49}\r
50\r
51/**\r
52 Get UPD region size.\r
53\r
54 @note At this point, memory is NOT ready, PeiServices are available to use.\r
55\r
56 @return UPD region size.\r
57**/\r
58UINT32\r
59EFIAPI\r
60GetUpdRegionSize (\r
61 VOID\r
62 )\r
63{\r
64 return 0;\r
65}\r
66\r
67/**\r
68 This function overrides the default configurations in the UPD data region.\r
69\r
70 @note At this point, memory is NOT ready, PeiServices are available to use.\r
71\r
72 @param[in,out] FspUpdRgnPtr A pointer to the UPD data region data strcture.\r
73\r
74 @return FspUpdRgnPtr A pointer to the UPD data region data strcture.\r
75**/\r
76VOID *\r
77EFIAPI\r
78UpdateFspUpdConfigs (\r
79 IN OUT VOID *FspUpdRgnPtr\r
80 )\r
81{\r
82 return NULL;\r
83}\r
84\r
d8043ce9
JY
85/**\r
86 Get TempRamExit parameter.\r
87\r
88 @note At this point, memory is ready, PeiServices are available to use.\r
89\r
90 @return TempRamExit parameter.\r
91**/\r
92VOID *\r
93EFIAPI\r
94GetTempRamExitParam (\r
95 VOID\r
96 )\r
97{\r
98 return NULL;\r
99}\r
100\r
101/**\r
102 Get FspSiliconInit parameter.\r
103\r
104 @note At this point, memory is ready, PeiServices are available to use.\r
105\r
106 @return FspSiliconInit parameter.\r
107**/\r
108VOID *\r
109EFIAPI\r
110GetFspSiliconInitParam (\r
111 VOID\r
112 )\r
113{\r
114 return NULL;\r
115}\r
116\r
a33a2f62
JY
117/**\r
118 Get S3 PEI memory information.\r
119\r
120 @note At this point, memory is ready, and PeiServices are available to use.\r
121 Platform can get some data from SMRAM directly.\r
122\r
123 @param[out] S3PeiMemSize PEI memory size to be installed in S3 phase.\r
124 @param[out] S3PeiMemBase PEI memory base to be installed in S3 phase.\r
125\r
126 @return If S3 PEI memory information is got successfully.\r
127**/\r
128EFI_STATUS\r
129EFIAPI\r
130GetS3MemoryInfo (\r
131 OUT UINT64 *S3PeiMemSize,\r
132 OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase\r
133 )\r
134{\r
135 return EFI_UNSUPPORTED;\r
136}\r
137\r
138/**\r
139 Get stack information according to boot mode.\r
140\r
141 @note If BootMode is BOOT_ON_S3_RESUME or BOOT_ON_FLASH_UPDATE,\r
142 this stack should be in some reserved memory space.\r
143\r
144 @note If FspInitDone is TRUE, memory is ready, but no PeiServices there.\r
145 Platform can get some data from SMRAM directly.\r
146 @note If FspInitDone is FALSE, memory is NOT ready, but PeiServices are available to use.\r
147 Platform can get some data from variable via VariablePpi.\r
148\r
149 @param[in] BootMode Current boot mode.\r
150 @param[in] FspInitDone If FspInit is called.\r
151 @param[out] StackSize Stack size to be used in PEI phase.\r
152 @param[out] StackBase Stack base to be used in PEI phase.\r
153\r
154 @return If Stack information is got successfully.\r
155**/\r
156EFI_STATUS\r
157EFIAPI\r
158GetStackInfo (\r
159 IN UINT32 BootMode,\r
160 IN BOOLEAN FspInitDone,\r
161 OUT UINT64 *StackSize,\r
162 OUT EFI_PHYSICAL_ADDRESS *StackBase\r
163 )\r
164{\r
165 *StackBase = PcdGet32 (PcdTemporaryRamBase);\r
166 *StackSize = PcdGet32 (PcdTemporaryRamSize);\r
167\r
168 if (BootMode == BOOT_ON_S3_RESUME) {\r
169 if (!FspInitDone) {\r
170 } else {\r
171 }\r
172 } else if (BootMode == BOOT_ON_FLASH_UPDATE) {\r
173 if (!FspInitDone) {\r
174 } else {\r
175 }\r
176 }\r
177\r
178 return EFI_SUCCESS;\r
179}\r