FspsWrapperPeim.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. /** @file
  2. This will be invoked only once. It will call FspMemoryInit API,
  3. register TemporaryRamDonePpi to call TempRamExit API, and register MemoryDiscoveredPpi
  4. notify to call FspSiliconInit API.
  5. Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. #include <PiPei.h>
  9. #include <Library/PeimEntryPoint.h>
  10. #include <Library/PeiServicesLib.h>
  11. #include <Library/PeiServicesTablePointerLib.h>
  12. #include <Library/BaseLib.h>
  13. #include <Library/DebugLib.h>
  14. #include <Library/BaseMemoryLib.h>
  15. #include <Library/HobLib.h>
  16. #include <Library/PcdLib.h>
  17. #include <Library/MemoryAllocationLib.h>
  18. #include <Library/FspWrapperPlatformLib.h>
  19. #include <Library/FspWrapperHobProcessLib.h>
  20. #include <Library/TimerLib.h>
  21. #include <Library/PerformanceLib.h>
  22. #include <Library/FspWrapperApiLib.h>
  23. #include <Library/FspMeasurementLib.h>
  24. #include <Ppi/FspSiliconInitDone.h>
  25. #include <Ppi/EndOfPeiPhase.h>
  26. #include <Ppi/MemoryDiscovered.h>
  27. #include <Ppi/TemporaryRamDone.h>
  28. #include <Ppi/SecPlatformInformation.h>
  29. #include <Ppi/Tcg.h>
  30. #include <Ppi/FirmwareVolumeInfoMeasurementExcluded.h>
  31. #include <Library/FspWrapperApiTestLib.h>
  32. #include <FspEas.h>
  33. #include <FspStatusCode.h>
  34. extern EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc;
  35. extern EFI_GUID gFspHobGuid;
  36. /**
  37. This function handles S3 resume task at the end of PEI.
  38. @param[in] PeiServices Pointer to PEI Services Table.
  39. @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
  40. caused this function to execute.
  41. @param[in] Ppi Pointer to the PPI data associated with this function.
  42. @retval EFI_STATUS Always return EFI_SUCCESS
  43. **/
  44. EFI_STATUS
  45. EFIAPI
  46. S3EndOfPeiNotify (
  47. IN EFI_PEI_SERVICES **PeiServices,
  48. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
  49. IN VOID *Ppi
  50. );
  51. EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc = {
  52. (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
  53. &gEfiEndOfPeiSignalPpiGuid,
  54. S3EndOfPeiNotify
  55. };
  56. /**
  57. This function handles S3 resume task at the end of PEI.
  58. @param[in] PeiServices Pointer to PEI Services Table.
  59. @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
  60. caused this function to execute.
  61. @param[in] Ppi Pointer to the PPI data associated with this function.
  62. @retval EFI_STATUS Always return EFI_SUCCESS
  63. **/
  64. EFI_STATUS
  65. EFIAPI
  66. S3EndOfPeiNotify (
  67. IN EFI_PEI_SERVICES **PeiServices,
  68. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
  69. IN VOID *Ppi
  70. )
  71. {
  72. NOTIFY_PHASE_PARAMS NotifyPhaseParams;
  73. EFI_STATUS Status;
  74. DEBUG ((DEBUG_INFO, "S3EndOfPeiNotify enter\n"));
  75. NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;
  76. Status = CallFspNotifyPhase (&NotifyPhaseParams);
  77. DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration status: 0x%x\n", Status));
  78. //
  79. // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
  80. //
  81. if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
  82. DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration requested reset 0x%x\n", Status));
  83. CallFspWrapperResetSystem (Status);
  84. }
  85. NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;
  86. Status = CallFspNotifyPhase (&NotifyPhaseParams);
  87. DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status: 0x%x\n", Status));
  88. //
  89. // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
  90. //
  91. if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
  92. DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot requested reset 0x%x\n", Status));
  93. CallFspWrapperResetSystem (Status);
  94. }
  95. NotifyPhaseParams.Phase = EnumInitPhaseEndOfFirmware;
  96. Status = CallFspNotifyPhase (&NotifyPhaseParams);
  97. DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware status: 0x%x\n", Status));
  98. //
  99. // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
  100. //
  101. if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
  102. DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware requested reset 0x%x\n", Status));
  103. CallFspWrapperResetSystem (Status);
  104. }
  105. return EFI_SUCCESS;
  106. }
  107. /**
  108. Return Hob list produced by FSP.
  109. @param[in] PeiServices The pointer to the PEI Services Table.
  110. @param[in] This The pointer to this instance of this PPI.
  111. @param[out] FspHobList The pointer to Hob list produced by FSP.
  112. @return EFI_SUCCESS Return Hob list produced by FSP successfully.
  113. **/
  114. EFI_STATUS
  115. EFIAPI
  116. FspSiliconInitDoneGetFspHobList (
  117. IN CONST EFI_PEI_SERVICES **PeiServices,
  118. IN FSP_SILICON_INIT_DONE_PPI *This,
  119. OUT VOID **FspHobList
  120. );
  121. FSP_SILICON_INIT_DONE_PPI mFspSiliconInitDonePpi = {
  122. FspSiliconInitDoneGetFspHobList
  123. };
  124. EFI_PEI_PPI_DESCRIPTOR mPeiFspSiliconInitDonePpi = {
  125. EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
  126. &gFspSiliconInitDonePpiGuid,
  127. &mFspSiliconInitDonePpi
  128. };
  129. /**
  130. Return Hob list produced by FSP.
  131. @param[in] PeiServices The pointer to the PEI Services Table.
  132. @param[in] This The pointer to this instance of this PPI.
  133. @param[out] FspHobList The pointer to Hob list produced by FSP.
  134. @return EFI_SUCCESS Return Hob list produced by FSP successfully.
  135. **/
  136. EFI_STATUS
  137. EFIAPI
  138. FspSiliconInitDoneGetFspHobList (
  139. IN CONST EFI_PEI_SERVICES **PeiServices,
  140. IN FSP_SILICON_INIT_DONE_PPI *This,
  141. OUT VOID **FspHobList
  142. )
  143. {
  144. EFI_HOB_GUID_TYPE *GuidHob;
  145. GuidHob = GetFirstGuidHob (&gFspHobGuid);
  146. if (GuidHob != NULL) {
  147. *FspHobList = *(VOID **)GET_GUID_HOB_DATA (GuidHob);
  148. return EFI_SUCCESS;
  149. } else {
  150. return EFI_NOT_FOUND;
  151. }
  152. }
  153. /**
  154. Get the FSP S UPD Data address
  155. @return FSP-S UPD Data Address
  156. **/
  157. UINTN
  158. GetFspsUpdDataAddress (
  159. VOID
  160. )
  161. {
  162. if (PcdGet64 (PcdFspsUpdDataAddress64) != 0) {
  163. return (UINTN)PcdGet64 (PcdFspsUpdDataAddress64);
  164. } else {
  165. return (UINTN)PcdGet32 (PcdFspsUpdDataAddress);
  166. }
  167. }
  168. /**
  169. This function is for FSP dispatch mode to perform post FSP-S process.
  170. @param[in] PeiServices Pointer to PEI Services Table.
  171. @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
  172. caused this function to execute.
  173. @param[in] Ppi Pointer to the PPI data associated with this function.
  174. @retval EFI_STATUS Status returned by PeiServicesInstallPpi ()
  175. **/
  176. EFI_STATUS
  177. EFIAPI
  178. FspsWrapperEndOfPeiNotify (
  179. IN EFI_PEI_SERVICES **PeiServices,
  180. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
  181. IN VOID *Ppi
  182. )
  183. {
  184. EFI_STATUS Status;
  185. //
  186. // This step may include platform specific process in some boot loaders so
  187. // aligning the same behavior between API and Dispatch modes.
  188. // Note: In Dispatch mode no FspHobList so passing NULL to function and
  189. // expecting function will handle it.
  190. //
  191. PostFspsHobProcess (NULL);
  192. //
  193. // Install FspSiliconInitDonePpi so that any other driver can consume this info.
  194. //
  195. Status = PeiServicesInstallPpi (&mPeiFspSiliconInitDonePpi);
  196. ASSERT_EFI_ERROR (Status);
  197. return Status;
  198. }
  199. EFI_PEI_NOTIFY_DESCRIPTOR mFspsWrapperEndOfPeiNotifyDesc = {
  200. (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
  201. &gEfiEndOfPeiSignalPpiGuid,
  202. FspsWrapperEndOfPeiNotify
  203. };
  204. /**
  205. This function is called after PEI core discover memory and finish migration.
  206. @param[in] PeiServices Pointer to PEI Services Table.
  207. @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
  208. caused this function to execute.
  209. @param[in] Ppi Pointer to the PPI data associated with this function.
  210. @retval EFI_STATUS Always return EFI_SUCCESS
  211. **/
  212. EFI_STATUS
  213. EFIAPI
  214. PeiMemoryDiscoveredNotify (
  215. IN EFI_PEI_SERVICES **PeiServices,
  216. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
  217. IN VOID *Ppi
  218. );
  219. EFI_PEI_NOTIFY_DESCRIPTOR mPeiMemoryDiscoveredNotifyDesc = {
  220. (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
  221. &gEfiPeiMemoryDiscoveredPpiGuid,
  222. PeiMemoryDiscoveredNotify
  223. };
  224. /**
  225. This function is called after PEI core discover memory and finish migration.
  226. @param[in] PeiServices Pointer to PEI Services Table.
  227. @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
  228. caused this function to execute.
  229. @param[in] Ppi Pointer to the PPI data associated with this function.
  230. @retval EFI_STATUS Always return EFI_SUCCESS
  231. **/
  232. EFI_STATUS
  233. EFIAPI
  234. PeiMemoryDiscoveredNotify (
  235. IN EFI_PEI_SERVICES **PeiServices,
  236. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
  237. IN VOID *Ppi
  238. )
  239. {
  240. FSP_INFO_HEADER *FspsHeaderPtr;
  241. UINT64 TimeStampCounterStart;
  242. EFI_STATUS Status;
  243. VOID *FspHobListPtr;
  244. EFI_HOB_GUID_TYPE *GuidHob;
  245. FSPS_UPD_COMMON *FspsUpdDataPtr;
  246. UINTN *SourceData;
  247. DEBUG ((DEBUG_INFO, "PeiMemoryDiscoveredNotify enter\n"));
  248. FspsUpdDataPtr = NULL;
  249. FspsHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspsBaseAddress));
  250. DEBUG ((DEBUG_INFO, "FspsHeaderPtr - 0x%x\n", FspsHeaderPtr));
  251. if (FspsHeaderPtr == NULL) {
  252. return EFI_DEVICE_ERROR;
  253. }
  254. if ((GetFspsUpdDataAddress () == 0) && (FspsHeaderPtr->CfgRegionSize != 0) && (FspsHeaderPtr->CfgRegionOffset != 0)) {
  255. //
  256. // Copy default FSP-S UPD data from Flash
  257. //
  258. FspsUpdDataPtr = (FSPS_UPD_COMMON *)AllocateZeroPool ((UINTN)FspsHeaderPtr->CfgRegionSize);
  259. ASSERT (FspsUpdDataPtr != NULL);
  260. SourceData = (UINTN *)((UINTN)FspsHeaderPtr->ImageBase + (UINTN)FspsHeaderPtr->CfgRegionOffset);
  261. CopyMem (FspsUpdDataPtr, SourceData, (UINTN)FspsHeaderPtr->CfgRegionSize);
  262. } else {
  263. FspsUpdDataPtr = (FSPS_UPD_COMMON *)GetFspsUpdDataAddress ();
  264. ASSERT (FspsUpdDataPtr != NULL);
  265. }
  266. UpdateFspsUpdData ((VOID *)FspsUpdDataPtr);
  267. TimeStampCounterStart = AsmReadTsc ();
  268. PERF_START_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
  269. Status = CallFspSiliconInit ((VOID *)FspsUpdDataPtr);
  270. PERF_END_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
  271. DEBUG ((DEBUG_INFO, "Total time spent executing FspSiliconInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));
  272. //
  273. // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
  274. //
  275. if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
  276. DEBUG ((DEBUG_INFO, "FspSiliconInitApi requested reset 0x%x\n", Status));
  277. CallFspWrapperResetSystem (Status);
  278. }
  279. if (EFI_ERROR (Status)) {
  280. DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspSiliconInitApi(), Status = %r\n", Status));
  281. }
  282. DEBUG ((DEBUG_INFO, "FspSiliconInit status: 0x%x\n", Status));
  283. ASSERT_EFI_ERROR (Status);
  284. Status = TestFspSiliconInitApiOutput ((VOID *)NULL);
  285. if (RETURN_ERROR (Status)) {
  286. DEBUG ((DEBUG_ERROR, "ERROR - TestFspSiliconInitApiOutput () fail, Status = %r\n", Status));
  287. }
  288. //
  289. // Now FspHobList complete, process it
  290. //
  291. GuidHob = GetFirstGuidHob (&gFspHobGuid);
  292. ASSERT (GuidHob != NULL);
  293. FspHobListPtr = *(VOID **)GET_GUID_HOB_DATA (GuidHob);
  294. DEBUG ((DEBUG_INFO, "FspHobListPtr - 0x%x\n", FspHobListPtr));
  295. PostFspsHobProcess (FspHobListPtr);
  296. //
  297. // Install FspSiliconInitDonePpi so that any other driver can consume this info.
  298. //
  299. Status = PeiServicesInstallPpi (&mPeiFspSiliconInitDonePpi);
  300. ASSERT_EFI_ERROR (Status);
  301. return Status;
  302. }
  303. /**
  304. Do FSP initialization in API mode.
  305. @retval EFI_STATUS Always return EFI_SUCCESS
  306. **/
  307. EFI_STATUS
  308. FspsWrapperInitApiMode (
  309. VOID
  310. )
  311. {
  312. EFI_STATUS Status;
  313. EFI_BOOT_MODE BootMode;
  314. //
  315. // Register MemoryDiscovered Notify to run FspSiliconInit
  316. //
  317. Status = PeiServicesNotifyPpi (&mPeiMemoryDiscoveredNotifyDesc);
  318. ASSERT_EFI_ERROR (Status);
  319. //
  320. // Register EndOfPei Notify for S3 to run FSP NotifyPhase
  321. //
  322. PeiServicesGetBootMode (&BootMode);
  323. if (BootMode == BOOT_ON_S3_RESUME) {
  324. Status = PeiServicesNotifyPpi (&mS3EndOfPeiNotifyDesc);
  325. ASSERT_EFI_ERROR (Status);
  326. }
  327. return EFI_SUCCESS;
  328. }
  329. /**
  330. Do FSP initialization in Dispatch mode.
  331. @retval FSP initialization status.
  332. **/
  333. EFI_STATUS
  334. FspsWrapperInitDispatchMode (
  335. VOID
  336. )
  337. {
  338. EFI_STATUS Status;
  339. EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *MeasurementExcludedFvPpi;
  340. EFI_PEI_PPI_DESCRIPTOR *MeasurementExcludedPpiList;
  341. MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));
  342. ASSERT (MeasurementExcludedFvPpi != NULL);
  343. MeasurementExcludedFvPpi->Count = 1;
  344. MeasurementExcludedFvPpi->Fv[0].FvBase = PcdGet32 (PcdFspsBaseAddress);
  345. MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength;
  346. MeasurementExcludedPpiList = AllocatePool (sizeof (*MeasurementExcludedPpiList));
  347. ASSERT (MeasurementExcludedPpiList != NULL);
  348. MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
  349. MeasurementExcludedPpiList->Guid = &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid;
  350. MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi;
  351. Status = PeiServicesInstallPpi (MeasurementExcludedPpiList);
  352. ASSERT_EFI_ERROR (Status);
  353. //
  354. // FSP-S Wrapper running in Dispatch mode and reports FSP-S FV to PEI dispatcher.
  355. //
  356. PeiServicesInstallFvInfoPpi (
  357. NULL,
  358. (VOID *)(UINTN)PcdGet32 (PcdFspsBaseAddress),
  359. (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength,
  360. NULL,
  361. NULL
  362. );
  363. //
  364. // Register EndOfPei Nofity to run post FSP-S process.
  365. //
  366. Status = PeiServicesNotifyPpi (&mFspsWrapperEndOfPeiNotifyDesc);
  367. ASSERT_EFI_ERROR (Status);
  368. return Status;
  369. }
  370. /**
  371. This function is called after TCG installed PPI.
  372. @param[in] PeiServices Pointer to PEI Services Table.
  373. @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
  374. caused this function to execute.
  375. @param[in] Ppi Pointer to the PPI data associated with this function.
  376. @retval EFI_STATUS Always return EFI_SUCCESS
  377. **/
  378. EFI_STATUS
  379. EFIAPI
  380. TcgPpiNotify (
  381. IN EFI_PEI_SERVICES **PeiServices,
  382. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
  383. IN VOID *Ppi
  384. );
  385. EFI_PEI_NOTIFY_DESCRIPTOR mTcgPpiNotifyDesc = {
  386. (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
  387. &gEdkiiTcgPpiGuid,
  388. TcgPpiNotify
  389. };
  390. /**
  391. This function is called after TCG installed PPI.
  392. @param[in] PeiServices Pointer to PEI Services Table.
  393. @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
  394. caused this function to execute.
  395. @param[in] Ppi Pointer to the PPI data associated with this function.
  396. @retval EFI_STATUS Always return EFI_SUCCESS
  397. **/
  398. EFI_STATUS
  399. EFIAPI
  400. TcgPpiNotify (
  401. IN EFI_PEI_SERVICES **PeiServices,
  402. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
  403. IN VOID *Ppi
  404. )
  405. {
  406. UINT32 FspMeasureMask;
  407. DEBUG ((DEBUG_INFO, "TcgPpiNotify FSPS\n"));
  408. FspMeasureMask = PcdGet32 (PcdFspMeasurementConfig);
  409. if ((FspMeasureMask & FSP_MEASURE_FSPS) != 0) {
  410. MeasureFspFirmwareBlob (
  411. 0,
  412. "FSPS",
  413. PcdGet32 (PcdFspsBaseAddress),
  414. (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength
  415. );
  416. }
  417. return EFI_SUCCESS;
  418. }
  419. /**
  420. This is the entrypoint of PEIM.
  421. @param[in] FileHandle Handle of the file being invoked.
  422. @param[in] PeiServices Describes the list of possible PEI Services.
  423. @retval EFI_SUCCESS if it completed successfully.
  424. **/
  425. EFI_STATUS
  426. EFIAPI
  427. FspsWrapperPeimEntryPoint (
  428. IN EFI_PEI_FILE_HANDLE FileHandle,
  429. IN CONST EFI_PEI_SERVICES **PeiServices
  430. )
  431. {
  432. EFI_STATUS Status;
  433. DEBUG ((DEBUG_INFO, "FspsWrapperPeimEntryPoint\n"));
  434. Status = PeiServicesNotifyPpi (&mTcgPpiNotifyDesc);
  435. ASSERT_EFI_ERROR (Status);
  436. if (PcdGet8 (PcdFspModeSelection) == 1) {
  437. FspsWrapperInitApiMode ();
  438. } else {
  439. FspsWrapperInitDispatchMode ();
  440. }
  441. return EFI_SUCCESS;
  442. }