2009-12-25 07:49:52 +01:00
|
|
|
/** @file
|
|
|
|
Status Code Handler Driver which produces general handlers and hook them
|
2020-12-31 10:56:51 +01:00
|
|
|
onto the MM status code router.
|
2009-12-25 07:49:52 +01:00
|
|
|
|
2020-06-10 04:56:31 +02:00
|
|
|
Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
|
2019-04-04 01:05:13 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2009-12-25 07:49:52 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
2020-12-31 10:56:51 +01:00
|
|
|
#include "StatusCodeHandlerMm.h"
|
2009-12-25 07:49:52 +01:00
|
|
|
|
2021-12-05 23:54:02 +01:00
|
|
|
EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
|
2009-12-25 07:49:52 +01:00
|
|
|
|
|
|
|
/**
|
2018-06-27 15:08:52 +02:00
|
|
|
Dispatch initialization request to sub status code devices based on
|
2009-12-25 07:49:52 +01:00
|
|
|
customized feature flags.
|
2018-06-27 15:08:52 +02:00
|
|
|
|
2009-12-25 07:49:52 +01:00
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
InitializationDispatcherWorker (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
2021-12-05 23:54:02 +01:00
|
|
|
EFI_STATUS Status;
|
2009-12-25 07:49:52 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// If enable UseSerial, then initialize serial port.
|
|
|
|
// if enable UseRuntimeMemory, then initialize runtime memory status code worker.
|
|
|
|
//
|
2020-06-10 04:56:31 +02:00
|
|
|
if (PcdGetBool (PcdStatusCodeUseSerial)) {
|
2009-12-25 07:49:52 +01:00
|
|
|
//
|
|
|
|
// Call Serial Port Lib API to initialize serial port.
|
|
|
|
//
|
|
|
|
Status = SerialPortInitialize ();
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
}
|
2021-12-05 23:54:02 +01:00
|
|
|
|
2020-06-10 04:56:31 +02:00
|
|
|
if (PcdGetBool (PcdStatusCodeUseMemory)) {
|
2009-12-25 07:49:52 +01:00
|
|
|
Status = MemoryStatusCodeInitializeWorker ();
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-12-31 10:56:51 +01:00
|
|
|
Entry point of Common MM Status Code Driver.
|
2009-12-25 07:49:52 +01:00
|
|
|
|
2020-12-31 10:56:51 +01:00
|
|
|
This function is the entry point of MM Status Code Driver.
|
2018-06-27 15:08:52 +02:00
|
|
|
|
2009-12-25 07:49:52 +01:00
|
|
|
@retval EFI_SUCCESS The entry point is executed successfully.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
2020-12-31 10:56:51 +01:00
|
|
|
StatusCodeHandlerCommonEntry (
|
|
|
|
VOID
|
2009-12-25 07:49:52 +01:00
|
|
|
)
|
|
|
|
{
|
2021-12-05 23:54:02 +01:00
|
|
|
EFI_STATUS Status;
|
2009-12-25 07:49:52 +01:00
|
|
|
|
2020-12-31 10:56:51 +01:00
|
|
|
Status = gMmst->MmLocateProtocol (
|
|
|
|
&gEfiMmRscHandlerProtocolGuid,
|
2009-12-25 07:49:52 +01:00
|
|
|
NULL,
|
2021-12-05 23:54:02 +01:00
|
|
|
(VOID **)&mRscHandlerProtocol
|
2009-12-25 07:49:52 +01:00
|
|
|
);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Dispatch initialization request to supported devices
|
|
|
|
//
|
|
|
|
InitializationDispatcherWorker ();
|
|
|
|
|
2020-06-10 04:56:31 +02:00
|
|
|
if (PcdGetBool (PcdStatusCodeUseSerial)) {
|
2009-12-25 07:49:52 +01:00
|
|
|
mRscHandlerProtocol->Register (SerialStatusCodeReportWorker);
|
|
|
|
}
|
2021-12-05 23:54:02 +01:00
|
|
|
|
2020-06-10 04:56:31 +02:00
|
|
|
if (PcdGetBool (PcdStatusCodeUseMemory)) {
|
2009-12-25 07:49:52 +01:00
|
|
|
mRscHandlerProtocol->Register (MemoryStatusCodeReportWorker);
|
|
|
|
}
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|