1 /** @file 2 The header file of Platform PEIM. 3 4 Copyright (c) 2013 Intel Corporation. 5 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 **/ 15 16 17 #ifndef __PLATFORM_EARLY_INIT_H__ 18 #define __PLATFORM_EARLY_INIT_H__ 19 20 #define PEI_STALL_RESOLUTION 1 21 #define STALL_PEIM_SIGNATURE SIGNATURE_32('p','p','u','s') 22 23 typedef struct { 24 UINT32 Signature; 25 EFI_FFS_FILE_HEADER *FfsHeader; 26 EFI_PEI_NOTIFY_DESCRIPTOR StallNotify; 27 } STALL_CALLBACK_STATE_INFORMATION; 28 29 #define STALL_PEIM_FROM_THIS(a) CR (a, STALL_CALLBACK_STATE_INFORMATION, StallNotify, STALL_PEIM_SIGNATURE) 30 31 // 32 // USB Phy Registers 33 // 34 #define USB2_GLOBAL_PORT 0x4001 35 #define USB2_PLL1 0x7F02 36 #define USB2_PLL2 0x7F03 37 #define USB2_COMPBG 0x7F04 38 39 /** 40 Peform the boot mode determination logic 41 If the box is closed, then 42 1. If it's first time to boot, it's boot with full config . 43 2. If the ChassisIntrution is selected, force to be a boot with full config 44 3. Otherwise it's boot with no change. 45 46 @param PeiServices General purpose services available to every PEIM. 47 48 @param BootMode The detected boot mode. 49 50 @retval EFI_SUCCESS if the boot mode could be set 51 **/ 52 EFI_STATUS 53 UpdateBootMode ( 54 IN EFI_PEI_SERVICES **PeiServices, 55 OUT EFI_BOOT_MODE *BootMode 56 ); 57 58 /** 59 This function reset the entire platform, including all processor and devices, and 60 reboots the system. 61 62 @param PeiServices General purpose services available to every PEIM. 63 64 @retval EFI_SUCCESS if it completed successfully. 65 **/ 66 EFI_STATUS 67 EFIAPI 68 ResetSystem ( 69 IN CONST EFI_PEI_SERVICES **PeiServices 70 ); 71 72 /** 73 This function will be called when MRC is done. 74 75 @param PeiServices General purpose services available to every PEIM. 76 77 @param NotifyDescriptor Information about the notify event.. 78 79 @param Ppi The notify context. 80 81 @retval EFI_SUCCESS If the function completed successfully. 82 **/ 83 EFI_STATUS 84 EFIAPI 85 MemoryDiscoveredPpiNotifyCallback ( 86 IN EFI_PEI_SERVICES **PeiServices, 87 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, 88 IN VOID *Ppi 89 ); 90 91 /** 92 This is the callback function notified by FvFileLoader PPI, it depends on FvFileLoader PPI to load 93 the PEIM into memory. 94 95 @param PeiServices General purpose services available to every PEIM. 96 @param NotifyDescriptor The context of notification. 97 @param Ppi The notify PPI. 98 99 @retval EFI_SUCCESS if it completed successfully. 100 **/ 101 EFI_STATUS 102 EFIAPI 103 FvFileLoaderPpiNotifyCallback ( 104 IN EFI_PEI_SERVICES **PeiServices, 105 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, 106 IN VOID *Ppi 107 ); 108 109 /** 110 This function provides a blocking stall for reset at least the given number of microseconds 111 stipulated in the final argument. 112 113 @param PeiServices General purpose services available to every PEIM. 114 115 @param this Pointer to the local data for the interface. 116 117 @param Microseconds number of microseconds for which to stall. 118 119 @retval EFI_SUCCESS the function provided at least the required stall. 120 **/ 121 EFI_STATUS 122 EFIAPI 123 Stall ( 124 IN CONST EFI_PEI_SERVICES **PeiServices, 125 IN CONST EFI_PEI_STALL_PPI *This, 126 IN UINTN Microseconds 127 ); 128 129 /** 130 This function initialize recovery functionality by installing the recovery PPI. 131 132 @param PeiServices General purpose services available to every PEIM. 133 134 @retval EFI_SUCCESS if the interface could be successfully installed. 135 **/ 136 EFI_STATUS 137 EFIAPI 138 PeimInitializeRecovery ( 139 IN EFI_PEI_SERVICES **PeiServices 140 ); 141 142 /** 143 This function 144 1. Calling MRC to initialize memory. 145 2. Install EFI Memory. 146 3. Create HOB of system memory. 147 148 @param PeiServices Pointer to the PEI Service Table 149 150 @retval EFI_SUCCESS If it completes successfully. 151 152 **/ 153 EFI_STATUS 154 MemoryInit ( 155 IN EFI_PEI_SERVICES **PeiServices 156 ); 157 158 /** Return info derived from Installing Memory by MemoryInit. 159 160 @param[out] RmuMainBaseAddressPtr Return RmuMainBaseAddress to this location. 161 @param[out] SmramDescriptorPtr Return start of Smram descriptor list to this location. 162 @param[out] NumSmramRegionsPtr Return numbers of Smram regions to this location. 163 164 @return Address of RMU shadow region at the top of available memory. 165 @return List of Smram descriptors for each Smram region. 166 @return Numbers of Smram regions. 167 **/ 168 VOID 169 EFIAPI 170 InfoPostInstallMemory ( 171 OUT UINT32 *RmuMainBaseAddressPtr OPTIONAL, 172 OUT EFI_SMRAM_DESCRIPTOR **SmramDescriptorPtr OPTIONAL, 173 OUT UINTN *NumSmramRegionsPtr OPTIONAL 174 ); 175 176 /** 177 This function provides the implementation of AtaController PPI Enable Channel function. 178 179 @param PeiServices General purpose services available to every PEIM. 180 @param this Pointer to the local data for the interface. 181 @param ChannelMask This parameter is used to specify primary or slavery IDE channel. 182 183 @retval EFI_SUCCESS Procedure returned successfully. 184 **/ 185 186 EFI_STATUS 187 EnableAtaChannel ( 188 IN EFI_PEI_SERVICES **PeiServices, 189 IN PEI_ATA_CONTROLLER_PPI *This, 190 IN UINT8 ChannelMask 191 ); 192 193 /** 194 This function provides the implementation of AtaController PPI Get IDE channel Register Base Address 195 196 @param PeiServices General purpose services available to every PEIM. 197 @param this Pointer to the local data for the interface. 198 @param IdeRegsBaseAddr Pointer to IDE_REGS_BASE_ADDR struct, which is used to record 199 IDE Command and Control regeisters Base Address. 200 201 @retval EFI_SUCCESS Procedure returned successfully. 202 **/ 203 204 EFI_STATUS 205 GetIdeRegsBaseAddr ( 206 IN EFI_PEI_SERVICES **PeiServices, 207 IN PEI_ATA_CONTROLLER_PPI *This, 208 IN IDE_REGS_BASE_ADDR *IdeRegsBaseAddr 209 ); 210 211 VOID 212 EFIAPI 213 InitializeUSBPhy ( 214 VOID 215 ); 216 217 /** 218 This function provides early platform initialisation. 219 220 @param PlatformInfo Pointer to platform Info structure. 221 222 **/ 223 VOID 224 EFIAPI 225 EarlyPlatformInit ( 226 VOID 227 ); 228 229 /** 230 This function provides early platform GPIO initialisation. 231 232 @param PlatformType Platform type for GPIO init. 233 234 **/ 235 VOID 236 EFIAPI 237 EarlyPlatformLegacyGpioInit ( 238 IN CONST EFI_PLATFORM_TYPE PlatformType 239 ); 240 241 /** 242 Performs any early platform specific GPIO manipulation. 243 244 @param PlatformType Platform type GPIO manipulation. 245 246 **/ 247 VOID 248 EFIAPI 249 EarlyPlatformLegacyGpioManipulation ( 250 IN CONST EFI_PLATFORM_TYPE PlatformType 251 ); 252 253 /** 254 Performs any early platform specific GPIO Controller init & manipulation. 255 256 @param PlatformType Platform type for GPIO init & manipulation. 257 258 **/ 259 VOID 260 EFIAPI 261 EarlyPlatformGpioCtrlerInitAndManipulation ( 262 IN CONST EFI_PLATFORM_TYPE PlatformType 263 ); 264 265 /** 266 Performs any early platform init of SoC Ethernet Mac devices. 267 268 @param IohMac0Address Mac address to program into Mac0 device. 269 @param IohMac1Address Mac address to program into Mac1 device. 270 271 **/ 272 VOID 273 EFIAPI 274 EarlyPlatformMacInit ( 275 IN CONST UINT8 *IohMac0Address, 276 IN CONST UINT8 *IohMac1Address 277 ); 278 279 /** 280 Find security headers using EFI_CAPSULE_VARIABLE_NAME variables and build Hobs. 281 282 @param PeiServices General purpose services available to every PEIM. 283 284 @retval 0 if no security headers found. 285 @return number of security header hobs built. 286 **/ 287 UINTN 288 EFIAPI 289 FindCapsuleSecurityHeadersAndBuildHobs ( 290 IN EFI_PEI_SERVICES **PeiServices 291 ); 292 293 /** 294 Build capsule security header hob. 295 296 @param SecHdr Pointer to security header. 297 298 @retval NULL if failure to build HOB. 299 @return pointer to built hob. 300 **/ 301 VOID * 302 EFIAPI 303 BuildCapsuleSecurityHeaderHob ( 304 IN VOID *SecHdr 305 ); 306 307 #endif 308