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