summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-12-23 14:14:07 +0800
committerGuo Mang <mang.guo@intel.com>2017-05-09 13:03:01 +0800
commitab8491ae95f1b31b941b596a20edb379c9da125e (patch)
treea8218039617201ec25584f25ad7f28da56ab9903
parentdabbd33c3dd316dfe28d1a4c63d356fb47add66f (diff)
downloadedk2-platforms-ab8491ae95f1b31b941b596a20edb379c9da125e.tar.xz
BroxtonPlatformPkg: Add PlatformStatusCodeHandler
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/BeepStatusCodeWorker.c52
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.c87
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.h58
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.inf56
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.c115
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.h86
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.inf69
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PostCodeStatusCodeWorker.c67
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c186
9 files changed, 776 insertions, 0 deletions
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/BeepStatusCodeWorker.c b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/BeepStatusCodeWorker.c
new file mode 100644
index 0000000000..675fb2052d
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/BeepStatusCodeWorker.c
@@ -0,0 +1,52 @@
+/** @file
+ Beep status code implementation.
+
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "PlatformStatusCodeHandlerRuntimeDxe.h"
+
+/**
+ Convert status code value to the times of beep.
+
+ @param[in] CodeType Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or
+ software entity. This includes information about the class and
+ subclass that is used to classify the entity as well as an operation.
+ For progress codes, the operation is the current activity.
+ For error codes, it is the exception.For debug codes,it is not defined at this time.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. A system may contain multiple entities that match a class/subclass
+ pairing. The instance differentiates between them. An instance of 0 indicates
+ that instance information is unavailable, not meaningful, or not relevant.
+ Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to beep successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BeepStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ return EFI_SUCCESS;
+}
+
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.c b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.c
new file mode 100644
index 0000000000..c93231f12c
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.c
@@ -0,0 +1,87 @@
+/** @file
+ Platform Port 80 implementation.
+
+ Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "PlatformPort80HandlerRuntimeDxe.h"
+
+EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
+EFI_EVENT mExitBootServicesEvent = NULL;
+
+
+/**
+ Unregister status code callback functions only available at boot time from
+ report status code router when exiting boot services.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context Pointer to the notification function's context, which is
+ always zero in current implementation.
+
+**/
+VOID
+EFIAPI
+UnregisterBootTimeHandlers (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ if (FeaturePcdGet (PcdStatusCodeUsePostCode)) {
+ mRscHandlerProtocol->Unregister (PostCodeStatusCodeReportWorker);
+ }
+}
+
+
+/**
+ Entry point of DXE Status Code Driver.
+
+ This function is the entry point of this DXE Status Code Driver.
+ It initializes registers status code handlers, and registers event for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+Port80HandlerRuntimeDxeEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gEfiRscHandlerProtocolGuid,
+ NULL,
+ (VOID **) &mRscHandlerProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (FeaturePcdGet (PcdStatusCodeUsePostCode)) {
+ mRscHandlerProtocol->Register (PostCodeStatusCodeReportWorker, TPL_HIGH_LEVEL);
+ }
+
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ UnregisterBootTimeHandlers,
+ NULL,
+ &gEfiEventExitBootServicesGuid,
+ &mExitBootServicesEvent
+ );
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.h b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.h
new file mode 100644
index 0000000000..a58cd7c27c
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.h
@@ -0,0 +1,58 @@
+/** @file
+ Header file for platform port 80 implementation.
+
+ Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __PORT_80_HANDLER_RUNTIME_DXE_H__
+#define __PORT_80_HANDLER_RUNTIME_DXE_H__
+
+#include <Protocol/ReportStatusCodeHandler.h>
+#include <Library/DebugLib.h>
+#include <Library/ReportStatusCodeLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/PostCodeLib.h>
+#include <Library/PlatformPostCodeMapLib.h>
+#include <Library/PcdLib.h>
+#include <Guid/EventGroup.h>
+#include <Library/HobLib.h>
+
+/**
+ Convert status code value and write data to port code.
+
+ @param[in] CodeType Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to port code successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+PostCodeStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+#endif
+
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.inf b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.inf
new file mode 100644
index 0000000000..6f6b54e20c
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformPort80HandlerRuntimeDxe.inf
@@ -0,0 +1,56 @@
+## @file
+# Platform Port 80 implementation.
+#
+# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010017
+ BASE_NAME = PlatformPort80HandlerDxe
+ FILE_GUID = AC0AD9E7-6BCA-4EF3-924F-BDE0D026BB23
+ VERSION_STRING = 0
+ MODULE_TYPE = DXE_RUNTIME_DRIVER
+ ENTRY_POINT = Port80HandlerRuntimeDxeEntry
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[LibraryClasses]
+ UefiRuntimeLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ ReportStatusCodeLib
+ DebugLib
+ PostCodeLib
+ PlatformPostCodeMapLib
+ PcdLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ BroxtonPlatformPkg/PlatformPkg.dec
+
+[FeaturePcd]
+ gPlatformModuleTokenSpaceGuid.PcdStatusCodeUsePostCode
+
+[Sources]
+ PlatformPort80HandlerRuntimeDxe.c
+ PlatformPort80HandlerRuntimeDxe.h
+ PostCodeStatusCodeWorker.c
+
+[Protocols]
+ gEfiRscHandlerProtocolGuid ## CONSUMES
+
+[Depex]
+ gEfiRscHandlerProtocolGuid
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.c b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.c
new file mode 100644
index 0000000000..fb69ea6fd5
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.c
@@ -0,0 +1,115 @@
+/** @file
+ Platform status code implementation.
+
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "PlatformStatusCodeHandlerRuntimeDxe.h"
+
+EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
+EFI_EVENT mExitBootServicesEvent = NULL;
+
+BOOLEAN
+IsFastBootEnabled (
+ VOID
+ )
+{
+ BOOLEAN FastBootEnabledStatus;
+ EFI_PEI_HOB_POINTERS Hob;
+
+ FastBootEnabledStatus = FALSE;
+ Hob.Raw = GetFirstGuidHob (&gFastBootFunctionEnabledHobGuid);
+ if (Hob.Raw != NULL) {
+ FastBootEnabledStatus = TRUE;
+ }
+
+ return FastBootEnabledStatus;
+}
+
+
+/**
+ Unregister status code callback functions only available at boot time from
+ report status code router when exiting boot services.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context Pointer to the notification function's context, which is
+ always zero in current implementation.
+
+**/
+VOID
+EFIAPI
+UnregisterBootTimeHandlers (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ if (FeaturePcdGet (PcdStatusCodeUseBeep)) {
+ mRscHandlerProtocol->Unregister (BeepStatusCodeReportWorker);
+ }
+
+ if ((FeaturePcdGet (PcdStatusCodeUseSerialPortPlatform)) &&
+ (FeaturePcdGet (PcdStatusCodeUnregisterSerialPort))) {
+ mRscHandlerProtocol->Unregister (SerialStatusCodeReportWorker);
+ }
+}
+
+
+/**
+ Entry point of DXE Status Code Driver.
+
+ This function is the entry point of this DXE Status Code Driver.
+ It initializes registers status code handlers, and registers event for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+StatusCodeHandlerRuntimeDxeEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gEfiRscHandlerProtocolGuid,
+ NULL,
+ (VOID **) &mRscHandlerProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (FeaturePcdGet (PcdStatusCodeUseBeep)) {
+ if (!IsFastBootEnabled ()) {
+ mRscHandlerProtocol->Register (BeepStatusCodeReportWorker, TPL_HIGH_LEVEL);
+ }
+ }
+
+ if (FeaturePcdGet (PcdStatusCodeUseSerialPortPlatform)) {
+ mRscHandlerProtocol->Register (SerialStatusCodeReportWorker, TPL_HIGH_LEVEL);
+ }
+
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ UnregisterBootTimeHandlers,
+ NULL,
+ &gEfiEventExitBootServicesGuid,
+ &mExitBootServicesEvent
+ );
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.h b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.h
new file mode 100644
index 0000000000..520ba03005
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.h
@@ -0,0 +1,86 @@
+/** @file
+ Header file for platform status code implementation.
+
+ Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __STATUS_CODE_HANDLER_RUNTIME_DXE_H__
+#define __STATUS_CODE_HANDLER_RUNTIME_DXE_H__
+
+#include <Protocol/ReportStatusCodeHandler.h>
+#include <Library/DebugLib.h>
+#include <Library/ReportStatusCodeLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/PlatformPostCodeMapLib.h>
+#include <Library/PcdLib.h>
+#include <Guid/EventGroup.h>
+#include <Library/HobLib.h>
+
+/**
+ Convert status code value to the times of beep.
+
+ @param[in] CodeType Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to beep successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BeepStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+/**
+ Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
+
+ @param[in] CodeType Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
+
+**/
+EFI_STATUS
+EFIAPI
+SerialStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+#endif
+
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.inf b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.inf
new file mode 100644
index 0000000000..b27d01528b
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PlatformStatusCodeHandlerRuntimeDxe.inf
@@ -0,0 +1,69 @@
+## @file
+# Platform status code implementation.
+#
+# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010017
+ BASE_NAME = PlatformStatusCodeHandlerDxe
+ FILE_GUID = DAE6B815-877D-4597-A637-CFCFCCC431ED
+ VERSION_STRING = 0
+ MODULE_TYPE = DXE_RUNTIME_DRIVER
+ ENTRY_POINT = StatusCodeHandlerRuntimeDxeEntry
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[LibraryClasses]
+ UefiRuntimeLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ ReportStatusCodeLib
+ DebugLib
+ PostCodeLib
+ PlatformPostCodeMapLib
+ SerialPortLib
+ PrintLib
+ DebugPrintErrorLevelLib
+ HobLib
+ PcdLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ BroxtonPlatformPkg/PlatformPkg.dec
+
+[FeaturePcd]
+ gPlatformModuleTokenSpaceGuid.PcdStatusCodeUsePostCode
+ gPlatformModuleTokenSpaceGuid.PcdStatusCodeUseBeep
+ gPlatformModuleTokenSpaceGuid.PcdStatusCodeUseSerialPortPlatform
+ gPlatformModuleTokenSpaceGuid.PcdStatusCodeUnregisterSerialPort
+
+[Sources]
+ PlatformStatusCodeHandlerRuntimeDxe.c
+ PlatformStatusCodeHandlerRuntimeDxe.h
+ PostCodeStatusCodeWorker.c
+ BeepStatusCodeWorker.c
+ SerialStatusCodeWorker.c
+
+[Protocols]
+ gEfiRscHandlerProtocolGuid ## CONSUMES
+
+[Guids]
+ gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID
+ gFastBootFunctionEnabledHobGuid ## SOMETIMES_CONSUMES ## HOB
+
+[Depex]
+ gEfiRscHandlerProtocolGuid
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PostCodeStatusCodeWorker.c b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PostCodeStatusCodeWorker.c
new file mode 100644
index 0000000000..fa98bec24b
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/PostCodeStatusCodeWorker.c
@@ -0,0 +1,67 @@
+/** @file
+ PostCode status code implementation.
+
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "PlatformPort80HandlerRuntimeDxe.h"
+
+/**
+ Convert status code value and write data to port code.
+
+ @param[in] CodeType Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or
+ software entity. This includes information about the class and
+ subclass that is used to classify the entity as well as an operation.
+ For progress codes, the operation is the current activity.
+ For error codes, it is the exception.For debug codes,it is not defined at this time.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. A system may contain multiple entities that match a class/subclass
+ pairing. The instance differentiates between them. An instance of 0 indicates
+ that instance information is unavailable, not meaningful, or not relevant.
+ Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to port code successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+PostCodeStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ UINT32 PostCodeValue;
+
+ PostCodeValue = GetPostCodeFromStatusCode (CodeType, Value);
+ if (PostCodeValue != 0) {
+ DEBUG ((DEBUG_INFO, "POSTCODE=<%02x>\n", PostCodeValue));
+ PostCode (PostCodeValue);
+ }
+
+ if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
+ //
+ // Print PROGRESS information into output buffer.
+ //
+ DEBUG ((DEBUG_INFO, "PROGRESS CODE: V%x I%x\n\r", Value, Instance));
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c
new file mode 100644
index 0000000000..fabcece8b5
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Console/PlatformStatusCodeHandler/RuntimeDxe/SerialStatusCodeWorker.c
@@ -0,0 +1,186 @@
+/** @file
+ Serial I/O status code reporting worker.
+
+ Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "PlatformStatusCodeHandlerRuntimeDxe.h"
+#include <Guid/StatusCodeDataTypeId.h>
+#include <Guid/StatusCodeDataTypeDebug.h>
+#include <Library/PcdLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/PrintLib.h>
+#include <Library/SerialPortLib.h>
+#include <Library/BaseDebugPrintErrorLevelLib.h>
+
+
+/**
+ Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
+
+ @param[in] CodeType Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is used to
+ classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different rules to
+ different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS Status code reported to serial I/O successfully.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.
+ @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.
+
+**/
+EFI_STATUS
+EFIAPI
+SerialStatusCodeReportWorker (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ CHAR8 *Filename;
+ CHAR8 *Description;
+ CHAR8 *Format;
+ CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
+ UINT32 ErrorLevel;
+ UINT32 LineNumber;
+ UINTN CharCount;
+ BASE_LIST Marker;
+ UINT32 DebugPrintErrorLevel;
+
+ Buffer[0] = '\0';
+
+ DebugPrintErrorLevel = GetDebugPrintErrorLevel ();
+
+ if (Data != NULL &&
+ ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
+ if ((DEBUG_ERROR & DebugPrintErrorLevel) == 0) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Print ASSERT() information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
+ Filename,
+ LineNumber,
+ Description
+ );
+ } else if (Data != NULL &&
+ ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
+ if ((ErrorLevel & DebugPrintErrorLevel) == 0) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Print DEBUG() information into output buffer.
+ //
+ CharCount = AsciiBSPrint (
+ Buffer,
+ sizeof (Buffer),
+ Format,
+ Marker
+ );
+ } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
+ if ((DEBUG_ERROR& DebugPrintErrorLevel) == 0) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Print ERROR information into output buffer.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "ERROR: C%08x:V%08x I%x",
+ CodeType,
+ Value,
+ Instance
+ );
+ ASSERT (CharCount > 0);
+
+ if (CallerId != NULL) {
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ " %g",
+ CallerId
+ );
+ }
+
+ if (Data != NULL) {
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ " %x",
+ Data
+ );
+ }
+
+ CharCount += AsciiSPrint (
+ &Buffer[CharCount],
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),
+ "\n\r"
+ );
+ } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
+ //
+ // Print PROGRESS information into output buffer.
+ //
+ // Print in PlatformPort80HandlerRuntimeDxe.efi for synchronizing all output channel
+ //
+ Buffer[0] = '\0';
+ CharCount = 0;
+ } else if (Data != NULL &&
+ CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid) &&
+ ((EFI_STATUS_CODE_STRING_DATA *) Data)->StringType == EfiStringAscii) {
+ if ((DEBUG_INFO & DebugPrintErrorLevel) == 0) {
+ return EFI_SUCCESS;
+ }
+ //
+ // EFI_STATUS_CODE_STRING_DATA
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "%a\n\r",
+ ((EFI_STATUS_CODE_STRING_DATA *) Data)->String.Ascii
+ );
+ } else {
+ if ((DEBUG_INFO & DebugPrintErrorLevel) == 0) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Code type is not defined.
+ //
+ CharCount = AsciiSPrint (
+ Buffer,
+ sizeof (Buffer),
+ "Undefined: C%x:V%x I%x\n\r",
+ CodeType,
+ Value,
+ Instance
+ );
+ }
+
+ //
+ // Call SerialPort Lib function to do print.
+ //
+ SerialPortWrite ((UINT8 *) Buffer, CharCount);
+
+ return EFI_SUCCESS;
+}
+