]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / StatusCodeHandler / Smm / StatusCodeHandlerSmm.c
1 /** @file
2 Status Code Handler Driver which produces general handlers and hook them
3 onto the SMM status code router.
4
5 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
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 #include "StatusCodeHandlerSmm.h"
17
18 EFI_SMM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
19
20
21 /**
22 Dispatch initialization request to sub status code devices based on
23 customized feature flags.
24
25 **/
26 VOID
27 InitializationDispatcherWorker (
28 VOID
29 )
30 {
31 EFI_STATUS Status;
32
33 //
34 // If enable UseSerial, then initialize serial port.
35 // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
36 //
37 if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
38 //
39 // Call Serial Port Lib API to initialize serial port.
40 //
41 Status = SerialPortInitialize ();
42 ASSERT_EFI_ERROR (Status);
43 }
44 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
45 Status = MemoryStatusCodeInitializeWorker ();
46 ASSERT_EFI_ERROR (Status);
47 }
48 }
49
50 /**
51 Entry point of SMM Status Code Driver.
52
53 This function is the entry point of SMM Status Code Driver.
54
55 @param ImageHandle The firmware allocated handle for the EFI image.
56 @param SystemTable A pointer to the EFI System Table.
57
58 @retval EFI_SUCCESS The entry point is executed successfully.
59
60 **/
61 EFI_STATUS
62 EFIAPI
63 StatusCodeHandlerSmmEntry (
64 IN EFI_HANDLE ImageHandle,
65 IN EFI_SYSTEM_TABLE *SystemTable
66 )
67 {
68 EFI_STATUS Status;
69
70 Status = gSmst->SmmLocateProtocol (
71 &gEfiSmmRscHandlerProtocolGuid,
72 NULL,
73 (VOID **) &mRscHandlerProtocol
74 );
75 ASSERT_EFI_ERROR (Status);
76
77 //
78 // Dispatch initialization request to supported devices
79 //
80 InitializationDispatcherWorker ();
81
82 if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
83 mRscHandlerProtocol->Register (SerialStatusCodeReportWorker);
84 }
85 if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
86 mRscHandlerProtocol->Register (MemoryStatusCodeReportWorker);
87 }
88
89 return EFI_SUCCESS;
90 }