]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / StatusCodeHandler / Pei / StatusCodeHandlerPei.c
CommitLineData
3af9b388 1/** @file\r
2 Report Status Code Handler PEIM which produces general handlers and hook them\r
3 onto the PEI status code router.\r
4\r
d1102dba 5 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
3af9b388 7\r
8**/\r
9\r
10#include "StatusCodeHandlerPei.h"\r
11\r
12/**\r
13 Entry point of Status Code PEIM.\r
d1102dba 14\r
3af9b388 15 This function is the entry point of this Status Code PEIM.\r
16 It initializes supported status code devices according to PCD settings,\r
17 and installs Status Code PPI.\r
18\r
19 @param FileHandle Handle of the file being invoked.\r
20 @param PeiServices Describes the list of possible PEI Services.\r
21\r
22 @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully.\r
23\r
24**/\r
25EFI_STATUS\r
26EFIAPI\r
27StatusCodeHandlerPeiEntry (\r
28 IN EFI_PEI_FILE_HANDLE FileHandle,\r
29 IN CONST EFI_PEI_SERVICES **PeiServices\r
30 )\r
31{\r
32 EFI_STATUS Status;\r
33 EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi;\r
34\r
35 Status = PeiServicesLocatePpi (\r
36 &gEfiPeiRscHandlerPpiGuid,\r
37 0,\r
38 NULL,\r
39 (VOID **) &RscHandlerPpi\r
40 );\r
41 ASSERT_EFI_ERROR (Status);\r
42\r
43 //\r
44 // Dispatch initialization request to sub-statuscode-devices.\r
45 // If enable UseSerial, then initialize serial port.\r
46 // if enable UseMemory, then initialize memory status code worker.\r
47 //\r
48 if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
49 Status = SerialPortInitialize();\r
50 ASSERT_EFI_ERROR (Status);\r
d1102dba 51 Status = RscHandlerPpi->Register (SerialStatusCodeReportWorker);\r
3af9b388 52 ASSERT_EFI_ERROR (Status);\r
53 }\r
54 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
55 Status = MemoryStatusCodeInitializeWorker ();\r
56 ASSERT_EFI_ERROR (Status);\r
d1102dba 57 Status = RscHandlerPpi->Register (MemoryStatusCodeReportWorker);\r
3af9b388 58 ASSERT_EFI_ERROR (Status);\r
59 }\r
60\r
61 return EFI_SUCCESS;\r
62}\r
63\r