]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFspWrapperPkg/Library/BaseFspPlatformInfoLibSample/FspPlatformInfoLibSample.c
Add IntelFspWrapper to support boot EDKII on FSP bin.
[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
85/**\r
86 Get S3 PEI memory information.\r
87\r
88 @note At this point, memory is ready, and PeiServices are available to use.\r
89 Platform can get some data from SMRAM directly.\r
90\r
91 @param[out] S3PeiMemSize PEI memory size to be installed in S3 phase.\r
92 @param[out] S3PeiMemBase PEI memory base to be installed in S3 phase.\r
93\r
94 @return If S3 PEI memory information is got successfully.\r
95**/\r
96EFI_STATUS\r
97EFIAPI\r
98GetS3MemoryInfo (\r
99 OUT UINT64 *S3PeiMemSize,\r
100 OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase\r
101 )\r
102{\r
103 return EFI_UNSUPPORTED;\r
104}\r
105\r
106/**\r
107 Get stack information according to boot mode.\r
108\r
109 @note If BootMode is BOOT_ON_S3_RESUME or BOOT_ON_FLASH_UPDATE,\r
110 this stack should be in some reserved memory space.\r
111\r
112 @note If FspInitDone is TRUE, memory is ready, but no PeiServices there.\r
113 Platform can get some data from SMRAM directly.\r
114 @note If FspInitDone is FALSE, memory is NOT ready, but PeiServices are available to use.\r
115 Platform can get some data from variable via VariablePpi.\r
116\r
117 @param[in] BootMode Current boot mode.\r
118 @param[in] FspInitDone If FspInit is called.\r
119 @param[out] StackSize Stack size to be used in PEI phase.\r
120 @param[out] StackBase Stack base to be used in PEI phase.\r
121\r
122 @return If Stack information is got successfully.\r
123**/\r
124EFI_STATUS\r
125EFIAPI\r
126GetStackInfo (\r
127 IN UINT32 BootMode,\r
128 IN BOOLEAN FspInitDone,\r
129 OUT UINT64 *StackSize,\r
130 OUT EFI_PHYSICAL_ADDRESS *StackBase\r
131 )\r
132{\r
133 *StackBase = PcdGet32 (PcdTemporaryRamBase);\r
134 *StackSize = PcdGet32 (PcdTemporaryRamSize);\r
135\r
136 if (BootMode == BOOT_ON_S3_RESUME) {\r
137 if (!FspInitDone) {\r
138 } else {\r
139 }\r
140 } else if (BootMode == BOOT_ON_FLASH_UPDATE) {\r
141 if (!FspInitDone) {\r
142 } else {\r
143 }\r
144 }\r
145\r
146 return EFI_SUCCESS;\r
147}\r