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