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