1 | /** @file
|
---|
2 | Status Code Handler Driver which produces general handlers and hook them
|
---|
3 | onto the MM status code router.
|
---|
4 |
|
---|
5 | Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #include "StatusCodeHandlerMm.h"
|
---|
11 |
|
---|
12 | EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | Dispatch initialization request to sub status code devices based on
|
---|
16 | customized feature flags.
|
---|
17 |
|
---|
18 | **/
|
---|
19 | VOID
|
---|
20 | InitializationDispatcherWorker (
|
---|
21 | VOID
|
---|
22 | )
|
---|
23 | {
|
---|
24 | EFI_STATUS Status;
|
---|
25 |
|
---|
26 | //
|
---|
27 | // If enable UseSerial, then initialize serial port.
|
---|
28 | // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
|
---|
29 | //
|
---|
30 | if (PcdGetBool (PcdStatusCodeUseSerial)) {
|
---|
31 | //
|
---|
32 | // Call Serial Port Lib API to initialize serial port.
|
---|
33 | //
|
---|
34 | Status = SerialPortInitialize ();
|
---|
35 | ASSERT_EFI_ERROR (Status);
|
---|
36 | }
|
---|
37 |
|
---|
38 | if (PcdGetBool (PcdStatusCodeUseMemory)) {
|
---|
39 | Status = MemoryStatusCodeInitializeWorker ();
|
---|
40 | ASSERT_EFI_ERROR (Status);
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | /**
|
---|
45 | Entry point of Common MM Status Code Driver.
|
---|
46 |
|
---|
47 | This function is the entry point of MM Status Code Driver.
|
---|
48 |
|
---|
49 | @retval EFI_SUCCESS The entry point is executed successfully.
|
---|
50 |
|
---|
51 | **/
|
---|
52 | EFI_STATUS
|
---|
53 | StatusCodeHandlerCommonEntry (
|
---|
54 | VOID
|
---|
55 | )
|
---|
56 | {
|
---|
57 | EFI_STATUS Status;
|
---|
58 |
|
---|
59 | Status = gMmst->MmLocateProtocol (
|
---|
60 | &gEfiMmRscHandlerProtocolGuid,
|
---|
61 | NULL,
|
---|
62 | (VOID **)&mRscHandlerProtocol
|
---|
63 | );
|
---|
64 | ASSERT_EFI_ERROR (Status);
|
---|
65 |
|
---|
66 | //
|
---|
67 | // Dispatch initialization request to supported devices
|
---|
68 | //
|
---|
69 | InitializationDispatcherWorker ();
|
---|
70 |
|
---|
71 | if (PcdGetBool (PcdStatusCodeUseSerial)) {
|
---|
72 | mRscHandlerProtocol->Register (SerialStatusCodeReportWorker);
|
---|
73 | }
|
---|
74 |
|
---|
75 | if (PcdGetBool (PcdStatusCodeUseMemory)) {
|
---|
76 | mRscHandlerProtocol->Register (MemoryStatusCodeReportWorker);
|
---|
77 | }
|
---|
78 |
|
---|
79 | return EFI_SUCCESS;
|
---|
80 | }
|
---|