]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / StatusCodeHandler / Smm / StatusCodeHandlerSmm.c
CommitLineData
3af9b388 1/** @file\r
2 Status Code Handler Driver which produces general handlers and hook them\r
3 onto the SMM status code router.\r
4\r
d1102dba 5 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 6 This program and the accompanying materials\r
3af9b388 7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "StatusCodeHandlerSmm.h"\r
17\r
18EFI_SMM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;\r
19\r
20\r
21/**\r
d1102dba 22 Dispatch initialization request to sub status code devices based on\r
3af9b388 23 customized feature flags.\r
d1102dba 24\r
3af9b388 25**/\r
26VOID\r
27InitializationDispatcherWorker (\r
28 VOID\r
29 )\r
30{\r
31 EFI_STATUS Status;\r
32\r
33 //\r
34 // If enable UseSerial, then initialize serial port.\r
35 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.\r
36 //\r
37 if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
38 //\r
39 // Call Serial Port Lib API to initialize serial port.\r
40 //\r
41 Status = SerialPortInitialize ();\r
42 ASSERT_EFI_ERROR (Status);\r
43 }\r
44 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
45 Status = MemoryStatusCodeInitializeWorker ();\r
46 ASSERT_EFI_ERROR (Status);\r
47 }\r
48}\r
49\r
50/**\r
51 Entry point of SMM Status Code Driver.\r
52\r
53 This function is the entry point of SMM Status Code Driver.\r
54\r
55 @param ImageHandle The firmware allocated handle for the EFI image.\r
56 @param SystemTable A pointer to the EFI System Table.\r
d1102dba 57\r
3af9b388 58 @retval EFI_SUCCESS The entry point is executed successfully.\r
59\r
60**/\r
61EFI_STATUS\r
62EFIAPI\r
63StatusCodeHandlerSmmEntry (\r
64 IN EFI_HANDLE ImageHandle,\r
65 IN EFI_SYSTEM_TABLE *SystemTable\r
66 )\r
67{\r
68 EFI_STATUS Status;\r
69\r
70 Status = gSmst->SmmLocateProtocol (\r
71 &gEfiSmmRscHandlerProtocolGuid,\r
72 NULL,\r
73 (VOID **) &mRscHandlerProtocol\r
74 );\r
75 ASSERT_EFI_ERROR (Status);\r
76\r
77 //\r
78 // Dispatch initialization request to supported devices\r
79 //\r
80 InitializationDispatcherWorker ();\r
81\r
82 if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
83 mRscHandlerProtocol->Register (SerialStatusCodeReportWorker);\r
84 }\r
85 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
86 mRscHandlerProtocol->Register (MemoryStatusCodeReportWorker);\r
87 }\r
88\r
89 return EFI_SUCCESS;\r
90}\r