* [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: add it. @ 2020-06-16 11:25 Tan, Ming 2020-06-16 11:25 ` [PATCH v7 2/2] Features/Intel/PostCodeDebugFeaturePkg: " Tan, Ming 2020-06-17 8:25 ` [edk2-devel] [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: " Dandan Bi 0 siblings, 2 replies; 5+ messages in thread From: Tan, Ming @ 2020-06-16 11:25 UTC (permalink / raw) To: devel; +Cc: Eric Dong, Liming Gao REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2792 The BeepDebugFeaturePkg include some useful beep debug libraries, such as get beep value from status code and beep. It provide a library BeepStatusCodeHandlerLib used by edk2 StatusCodeHandler.efi, used to do beep if needed. It also provide a library of BeepMap lib, it map the status code to beep value. A library of Beep lib is needed by platform, and this pkg has a Null implementation. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Ming Tan <ming.tan@intel.com> --- V7: Add the dec files in AdvancedFeaturesPcd.dsc. Combine Beep and PostCode to 2/2 patchs. V6: Modify some bug when include the platform dsc file. And modify Readme.md. V5: In .inf files, remove some useless library. In RuntimeDxeBeepStatusCodeHandlerLib.c, add a variable to indicate whether need unregister. V4: Change Include/BeepDebugFeature.dsc, make it can be included in platform dsc file. V3: Modify according the Eric's review comments. V2: Delete the last empty line in BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf .../Include/AdvancedFeaturesPcd.dsc | 83 +++--- .../BeepDebugFeaturePkg.dec | 36 +++ .../BeepDebugFeaturePkg.dsc | 30 ++ .../Include/BeepDebugFeature.dsc | 201 +++++++++++++ .../Include/Library/BeepLib.h | 33 +++ .../Include/Library/BeepMapLib.h | 32 +++ .../Library/BeepLib/BeepLibNull.c | 37 +++ .../Library/BeepLib/BeepLibNull.inf | 26 ++ .../Library/BeepMapLib/BeepMapLib.c | 116 ++++++++ .../Library/BeepMapLib/BeepMapLib.inf | 27 ++ .../BeepMapLib/PlatformStatusCodesInternal.h | 270 ++++++++++++++++++ .../PeiBeepStatusCodeHandlerLib.c | 101 +++++++ .../PeiBeepStatusCodeHandlerLib.inf | 49 ++++ .../RuntimeDxeBeepStatusCodeHandlerLib.c | 184 ++++++++++++ .../RuntimeDxeBeepStatusCodeHandlerLib.inf | 51 ++++ .../SmmBeepStatusCodeHandlerLib.c | 138 +++++++++ .../SmmBeepStatusCodeHandlerLib.inf | 50 ++++ .../Debugging/BeepDebugFeaturePkg/Readme.md | 125 ++++++++ 18 files changed, 1548 insertions(+), 41 deletions(-) create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dsc create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFeature.dsc create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLib.h create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepMapLib.h create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/PlatformStatusCodesInternal.h create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md diff --git a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc index 836da7c944..366b551bd3 100644 --- a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc +++ b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc @@ -1,41 +1,42 @@ -## @file -# DSC file for defining Pcd of advanced features. -# -# This file is intended to be included into another package so advanced features -# can be conditionally built by enabling the respective feature via its FeaturePCD. -# -# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -# -# The section references the package DEC files, -# it allow a FeaturePCD to be used in a conditional statement -# -[Packages] - MdePkg/MdePkg.dec - AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec - Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec - NetworkFeaturePkg/NetworkFeaturePkg.dec - IpmiFeaturePkg/IpmiFeaturePkg.dec - S3FeaturePkg/S3FeaturePkg.dec - SmbiosFeaturePkg/SmbiosFeaturePkg.dec - UserAuthFeaturePkg/UserAuthFeaturePkg.dec - LogoFeaturePkg/LogoFeaturePkg.dec - -# -# The section below sets all PCDs to FALSE in this DSC file so the feature is not enabled by default. -# Board can set PCDs to TRUE in its DSC file to enable a subset of advanced features -# -[PcdsFeatureFlag] - gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable |FALSE - gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable |FALSE - gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable |FALSE - gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |FALSE - gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable |FALSE - gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable |FALSE - gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable |FALSE - gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable |FALSE - gLogoFeaturePkgTokenSpaceGuid.PcdJpgEnable |FALSE +## @file +# DSC file for defining Pcd of advanced features. +# +# This file is intended to be included into another package so advanced features +# can be conditionally built by enabling the respective feature via its FeaturePCD. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +# +# The section references the package DEC files, +# it allow a FeaturePCD to be used in a conditional statement +# +[Packages] + MdePkg/MdePkg.dec + AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec + Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec + NetworkFeaturePkg/NetworkFeaturePkg.dec + IpmiFeaturePkg/IpmiFeaturePkg.dec + S3FeaturePkg/S3FeaturePkg.dec + SmbiosFeaturePkg/SmbiosFeaturePkg.dec + UserAuthFeaturePkg/UserAuthFeaturePkg.dec + LogoFeaturePkg/LogoFeaturePkg.dec + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec + +# +# The section below sets all PCDs to FALSE in this DSC file so the feature is not enabled by default. +# Board can set PCDs to TRUE in its DSC file to enable a subset of advanced features +# +[PcdsFeatureFlag] + gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable |FALSE + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable |FALSE + gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable |FALSE + gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |FALSE + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable |FALSE + gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable |FALSE + gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable |FALSE + gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable |FALSE + gLogoFeaturePkgTokenSpaceGuid.PcdJpgEnable |FALSE diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec new file mode 100644 index 0000000000..4f4b36b091 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec @@ -0,0 +1,36 @@ +## @file +# This package provides Beep Debug feature. +# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION = 0x00010017 + PACKAGE_NAME = BeepDebugFeaturePkg + PACKAGE_GUID = DD88CEBB-E68F-4155-B754-D11E4FDF008D + PACKAGE_VERSION = 0.1 + +[Includes] + Include + +[LibraryClasses] + ## @libraryclass Provide the function to map the status code to beep value. + BeepMapLib|Include/Library/BeepMapLib.h + + ## @libraryclass Provide the function to do the real beep. + BeepLib|Include/Library/BeepLib.h + +[Guids] + gBeepDebugFeaturePkgTokenSpaceGuid = {0x54f56fb5, 0xea0e, 0x4518, {0xa0, 0x3e, 0x1b, 0xeb, 0x56, 0x94, 0xd2, 0x16}} + +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] + # Beep is a legacy feature, disabled it by default + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep|FALSE|BOOLEAN|0x00000001 diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dsc b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dsc new file mode 100644 index 0000000000..47254f9974 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dsc @@ -0,0 +1,30 @@ +## @file +# This package provides Beep Debug feature. +# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + PLATFORM_NAME = BeepDebugFeaturePkg + PLATFORM_GUID = D716EDF2-77BB-4536-9C64-4D7EEF0F3896 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES = IA32|X64 + BUILD_TARGETS = DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER = DEFAULT + PEI_ARCH = IA32 + DXE_ARCH = X64 + +# +# This package always builds the feature. +# +!include Include/BeepDebugFeature.dsc diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFeature.dsc b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFeature.dsc new file mode 100644 index 0000000000..65e00b5979 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFeature.dsc @@ -0,0 +1,201 @@ +## @file +# This package provides Beep Debug feature. +# This file should be included into another package DSC file to build this feature. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] +!ifndef $(PEI_ARCH) + !error "PEI_ARCH must be specified to build this feature!" +!endif +!ifndef $(DXE_ARCH) + !error "DXE_ARCH must be specified to build this feature!" +!endif + +################################################################################ +# +# PCD Section - list of PCD Entries modified by the feature. +# +################################################################################ + +# Unmark the following and StatusCodeHandler.efi to build the .dsc file directly +#[PcdsDynamicDefault] +# gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep|TRUE + +################################################################################ +# +# Library Class section - list of all Library Classes needed by this feature. +# +################################################################################ +[LibraryClasses] + ####################################### + # Edk2 Packages + ####################################### + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + +[LibraryClasses.common.PEIM] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf + +[LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE,LibraryClasses.IA32.SEC] + ####################################### + # Edk2 Packages + ####################################### + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf + +[LibraryClasses.common.DXE_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + +[LibraryClasses.X64.DXE_SMM_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf + MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf + SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf + +################################################################################ +# +# Component section - list of all components that need built for this feature. +# +# Note: The EDK II DSC file is not used to specify how compiled binary images get placed +# into firmware volume images. This section is just a list of modules to compile from +# source into UEFI-compliant binaries. +# It is the FDF file that contains information on combining binary files into firmware +# volume images, whose concept is beyond UEFI and is described in PI specification. +# There may also be modules listed in this section that are not required in the FDF file, +# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be +# generated for it, but the binary will not be put into any firmware volume. +# +################################################################################ +# +# Feature PEI Components +# + +# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308 +# is completed. +[Components.IA32] + ##################################### + # Beep Debug Feature Package + ##################################### + + # Add library instances here that are not included in package components and should be tested + # in the package build. + BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.inf + + # The following is an example for used with StatusCodeHandler: +# MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf { +# <LibraryClasses> +# OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +# SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf +# BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf +# NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.inf +# } + + # Add components here that should be included in the package build. + +# +# Feature DXE Components +# + +# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308 +# is completed. +[Components.X64] + ##################################### + # Beep Debug Feature Package + ##################################### + + # Add library instances here that are not included in package components and should be tested + # in the package build. + BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf + BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.inf + + # The following is an example for used with StatusCodeHandler: +# MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf { +# <LibraryClasses> +# OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +# SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf +# BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf +# NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf +# } + +# MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf { +# <LibraryClasses> +# OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +# SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf +# BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf +# NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.inf +# } + + # Add components here that should be included in the package build. + +################################################################################################### +# +# BuildOptions Section - Define the module specific tool chain flags that should be used as +# the default flags for a module. These flags are appended to any +# standard flags that are defined by the build process. They can be +# applied for any modules or only those modules with the specific +# module style (EDK or EDKII) specified in [Components] section. +# +# For advanced features, it is recommended to enable [BuildOptions] in +# the applicable INF file so it does not affect the whole board package +# build when this DSC file is active. +# +################################################################################################### +[BuildOptions] diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLib.h b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLib.h new file mode 100644 index 0000000000..f768acc557 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLib.h @@ -0,0 +1,33 @@ +/** @file + Provides services to send progress/error codes to Beep device. + + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __BEEP_LIB_H__ +#define __BEEP_LIB_H__ + +/** + Sends a 32-bit value to Beep device. + + Sends the 32-bit value specified by Value to Beep device, and returns Value. + Some implementations of this library function may perform I/O operations + directly to Beep device. Other implementations may send Value to + ReportStatusCode(), and the status code reporting mechanism will eventually + display the 32-bit value on the status reporting device. + + Beep() must actively prevent recursion. If Beep() is called while + processing another Post Code Library function, then + Beep() must return Value immediately. + + @param Value Beep count. +**/ +VOID +EFIAPI +Beep ( + IN UINT32 Value + ); + +#endif diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepMapLib.h b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepMapLib.h new file mode 100644 index 0000000000..7600d72ecd --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepMapLib.h @@ -0,0 +1,32 @@ +/** @file + This library class provides Platform Beep Map. + + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __BEEP_MAP_LIB__ +#define __BEEP_MAP_LIB__ + +/** + Get BeepValue from status code type and value. + + @param CodeType Indicates the type of status code being reported. + @param 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. + + @return BeepValue + +**/ +UINT32 +EFIAPI +GetBeepValueFromStatusCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value + ); + +#endif diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.c b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.c new file mode 100644 index 0000000000..a0bd946b50 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.c @@ -0,0 +1,37 @@ +/** @file + BeepLib Null implementation. + + Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Base.h> +#include <Uefi.h> + +/** + NULL implemented of Beep() function, just return directly. + Normal Beep() function will do the following: + + Sends a 32-bit value to Beep device. + + Sends the 32-bit value specified by Value to Beep device, and returns Value. + Some implementations of this library function may perform I/O operations + directly to Beep device. Other implementations may send Value to + ReportStatusCode(), and the status code reporting mechanism will eventually + display the 32-bit value on the status reporting device. + + Beep() must actively prevent recursion. If Beep() is called while + processing another Post Code Library function, then + Beep() must return Value immediately. + + @param Value Beep count. +**/ +VOID +EFIAPI +Beep ( + IN UINT32 Value + ) +{ + return; +} diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf new file mode 100644 index 0000000000..7f84dad082 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf @@ -0,0 +1,26 @@ +## @file +# Instance of Platform Beep Null Library. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = BeepLib + FILE_GUID = 319F24D8-9F3E-4BEC-B1C4-C54BE51F3FC2 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = BeepLib +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Packages] + MdePkg/MdePkg.dec + +[Sources] + BeepLibNull.c diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.c b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.c new file mode 100644 index 0000000000..26c32dfd9b --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.c @@ -0,0 +1,116 @@ +/** @file + BeepMap implementation. + + Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Base.h> +#include <Uefi.h> + +#include "PlatformStatusCodesInternal.h" + +STATUS_CODE_TO_DATA_MAP mBeepProgressMap[] = { + // + // PEI + // + // Recovery + { PEI_RECOVERY_STARTED, 2 }, + + // + // DXE + // + + {0,0} +}; + +STATUS_CODE_TO_DATA_MAP mBeepErrorMap[] = { + // + // PEI + // + // Regular boot + { PEI_MEMORY_NOT_DETECTED, 1 }, + { PEI_MEMORY_INSTALLED_TWICE, 1 }, + { PEI_DXEIPL_NOT_FOUND, 3 }, + { PEI_DXE_CORE_NOT_FOUND, 3 }, + { PEI_RESET_NOT_AVAILABLE, 7 }, + // Recovery + { PEI_RECOVERY_FAILED, 4 }, + // S3 Resume + { PEI_S3_RESUME_FAILED, 4 }, + + // + // DXE + // + { DXE_ARCH_PROTOCOL_NOT_AVAILABLE, 4 }, + { DXE_NO_CON_OUT, 5 }, + { DXE_NO_CON_IN, 5 }, + { DXE_INVALID_PASSWORD, 1 }, + { DXE_FLASH_UPDATE_FAILED, 6 }, + { DXE_RESET_NOT_AVAILABLE, 7 }, + + {0,0} +}; + +STATUS_CODE_TO_DATA_MAP *mBeepStatusCodesMap[] = { + //#define EFI_PROGRESS_CODE 0x00000001 + mBeepProgressMap, + //#define EFI_ERROR_CODE 0x00000002 + mBeepErrorMap + //#define EFI_DEBUG_CODE 0x00000003 +}; + +/** + Find the beep data from status code value. + + @param Map The map used to find in. + @param Value The status code value. + + @return BeepValue 0 for not found. + +**/ +UINT32 +FindBeepData ( + IN STATUS_CODE_TO_DATA_MAP *Map, + IN EFI_STATUS_CODE_VALUE Value + ) +{ + while (Map->Value != 0) { + if (Map->Value == Value) { + return Map->Data; + } + Map++; + } + return 0; +} + +/** + Get BeepValue from status code type and value. + + @param CodeType Indicates the type of status code being reported. + @param 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. + + @return BeepValue +**/ +UINT32 +EFIAPI +GetBeepValueFromStatusCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value + ) +{ + UINT32 CodeTypeIndex; + + CodeTypeIndex = STATUS_CODE_TYPE (CodeType) - 1; + + if (CodeTypeIndex >= sizeof (mBeepStatusCodesMap) / sizeof(mBeepStatusCodesMap[0])) { + return 0; + } + + return FindBeepData (mBeepStatusCodesMap[CodeTypeIndex], Value); +} diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf new file mode 100644 index 0000000000..b957eee07b --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf @@ -0,0 +1,27 @@ +## @file +# Instance of Beep Map Library. +# +# Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = BeepMapLib + FILE_GUID = 8BAFA82F-DA9E-4cce-8FA2-9DA189D7246D + VERSION_STRING = 2.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = BeepMapLib +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Packages] + MdePkg/MdePkg.dec + +[Sources] + BeepMapLib.c + PlatformStatusCodesInternal.h diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/PlatformStatusCodesInternal.h b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/PlatformStatusCodesInternal.h new file mode 100644 index 0000000000..a36134c933 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/PlatformStatusCodesInternal.h @@ -0,0 +1,270 @@ +/** @file + Beep status code definition. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_STATUS_CODES_INTERNAL_H__ +#define __PLATFORM_STATUS_CODES_INTERNAL_H__ + +#include <Pi/PiStatusCode.h> + +typedef struct{ + EFI_STATUS_CODE_VALUE Value; + UINT32 Data; +} STATUS_CODE_TO_DATA_MAP; + +// +// Enable PEI/DXE status code +// +#define PEI_STATUS_CODE 1 +#define DXE_STATUS_CODE 1 + +#define STATUS_CODE_TYPE(Type) ((Type)&EFI_STATUS_CODE_TYPE_MASK) +#define STATUS_CODE_CLASS(Value) ((Value)&EFI_STATUS_CODE_CLASS_MASK) + +//Progress/Error codes +#define PEI_CORE_STARTED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_ENTRY_POINT) +#define PEI_RESET_NOT_AVAILABLE (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE) +#define PEI_DXEIPL_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND) +#define PEI_DXE_CORE_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_DXE_CORRUPT) +#define PEI_S3_RESUME_ERROR (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_EC_S3_RESUME_FAILED) +#define PEI_RECOVERY_FAILED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_EC_RECOVERY_FAILED) +#define DXE_CORE_STARTED (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT) + +//#define DXE_EXIT_BOOT_SERVICES_BEGIN 0xF8 +#define DXE_EXIT_BOOT_SERVICES_END (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) + +// Reported by CPU PEIM +#define PEI_CAR_CPU_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_POWER_ON_INIT) + +// Reported by NB PEIM +//#define PEI_CAR_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_CHIPSET_NORTH_INIT) + +// Reported by SB PEIM +//#define PEI_CAR_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_CHIPSET_PC_SOUTH_INIT) + +//Reported by Memory Detection PEIM +#define PEI_MEMORY_SPD_READ (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_SPD_READ) +#define PEI_MEMORY_PRESENCE_DETECT (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_PRESENCE_DETECT) +#define PEI_MEMORY_TIMING (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TIMING) +#define PEI_MEMORY_CONFIGURING (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_CONFIGURING) +#define PEI_MEMORY_OPTIMIZING (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_OPTIMIZING) +#define PEI_MEMORY_INIT (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_INIT) +#define PEI_MEMORY_TEST (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TEST) +#define PEI_MEMORY_INVALID_TYPE (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_TYPE) +#define PEI_MEMORY_INVALID_SPEED (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SPEED) +#define PEI_MEMORY_SPD_FAIL (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_SPD_FAIL) +#define PEI_MEMORY_INVALID_SIZE (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SIZE) +#define PEI_MEMORY_MISMATCH (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) +#define PEI_MEMORY_S3_RESUME_FAILED (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_S3_RESUME_FAIL) +#define PEI_MEMORY_NOT_DETECTED (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_DETECTED) +#define PEI_MEMORY_NONE_USEFUL (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_USEFUL) +#define PEI_MEMORY_ERROR (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NON_SPECIFIC) +#define PEI_MEMORY_INSTALLED (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PS_PC_INSTALL_PEI_MEMORY) +#define PEI_MEMORY_NOT_INSTALLED (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED) +#define PEI_MEMORY_INSTALLED_TWICE (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PS_EC_MEMORY_INSTALLED_TWICE) + +//Reported by CPU PEIM +#define PEI_CPU_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_PC_INIT_BEGIN) +#define PEI_CPU_CACHE_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACHE_INIT) +#define PEI_CPU_BSP_SELECT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT) +#define PEI_CPU_AP_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT) +#define PEI_CPU_SMM_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_SMM_INIT) +#define PEI_CPU_INVALID_TYPE (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INVALID_TYPE) +#define PEI_CPU_INVALID_SPEED (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INVALID_SPEED) +#define PEI_CPU_MISMATCH (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MISMATCH) +#define PEI_CPU_SELF_TEST_FAILED (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) +#define PEI_CPU_CACHE_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CACHE) +#define PEI_CPU_MICROCODE_UPDATE_FAILED (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MICROCODE_UPDATE) +#define PEI_CPU_NO_MICROCODE (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_NO_MICROCODE_UPDATE) +//If non of the errors above apply use this one +#define PEI_CPU_INTERNAL_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INTERNAL) +//Generic CPU error. It should only be used if non of the errors above apply +#define PEI_CPU_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NON_SPECIFIC) + +// Reported by NB PEIM +#define PEI_MEM_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_PEI_MEM_NB_INIT) +// Reported by SB PEIM +#define PEI_MEM_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_PEI_MEM_SB_INIT) + +//Reported by PEIM which detected forced or auto recovery condition +#define PEI_RECOVERY_AUTO (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_AUTO) +#define PEI_RECOVERY_USER (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_USER) + +//Reported by DXE IPL +#define PEI_RECOVERY_PPI_NOT_FOUND (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND) +#define PEI_S3_RESUME_PPI_NOT_FOUND (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND) +#define PEI_S3_RESUME_FAILED (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_FAILED) + +//Reported by Recovery PEIM +#define PEI_RECOVERY_STARTED (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_BEGIN) +#define PEI_RECOVERY_CAPSULE_FOUND (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_LOAD) +#define PEI_RECOVERY_NO_CAPSULE (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE) +#define PEI_RECOVERY_CAPSULE_LOADED (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START) +#define PEI_RECOVERY_INVALID_CAPSULE (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR) + +//Reported by S3 Resume PEIM +#define PEI_S3_BOOT_SCRIPT (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_S3_BOOT_SCRIPT) +#define PEI_S3_OS_WAKE (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE) +#define PEI_S3_BOOT_SCRIPT_ERROR (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_BOOT_SCRIPT_ERROR) +#define PEI_S3_OS_WAKE_ERROR (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_OS_WAKE_ERROR) + +#define PEI_PEIM_STARTED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN) +#define PEI_PEIM_ENDED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_END) + +//Reported by DXE IPL +#define PEI_DXE_IPL_STARTED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT) + +//Reported by PEIM which installs Reset PPI +#define PEI_RESET_SYSTEM (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PS_PC_RESET_SYSTEM) + +//Reported by the PEIM or DXE driver which detected the error +#define GENERIC_MEMORY_CORRECTABLE_ERROR (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_CORRECTABLE) +#define GENERIC_MEMORY_UNCORRECTABLE_ERROR (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE) + +//Reported by Flash Update DXE driver +#define DXE_FLASH_UPDATE_FAILED (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UPDATE_FAIL) + +//Reported by the PEIM or DXE driver which detected the error +#define GENERIC_CPU_THERMAL_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_THERMAL) +#define GENERIC_CPU_LOW_VOLTAGE (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_LOW_VOLTAGE) +#define GENERIC_CPU_HIGH_VOLTAGE (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_HIGH_VOLTAGE) +#define GENERIC_CPU_CORRECTABLE_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CORRECTABLE) +#define GENERIC_CPU_UNCORRECTABLE_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_UNCORRECTABLE) +#define GENERIC_BAD_DATE_TIME_ERROR (EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_BAD_DATE_TIME) +#define GENERIC_MEMORY_SIZE_DECREASE (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) + +//Reported by DXE Core +#define DXE_DRIVER_STARTED (EFI_SOFTWARE_EFI_DXE_SERVICE | EFI_SW_PC_INIT_BEGIN) +#define DXE_DRIVER_ENED (EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END) +#define DXE_ARCH_PROTOCOLS_AVAILABLE (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ARCH_READY) +#define DXE_DRIVER_CONNECTED (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_START_DRIVER) +#define DXE_ARCH_PROTOCOL_NOT_AVAILABLE (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH) + +//Reported by DXE CPU driver +#define DXE_CPU_SELF_TEST_FAILED (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) + +//Reported by PCI Host Bridge driver +#define DXE_NB_HB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_HB_INIT ) + +// Reported by NB Driver +#define DXE_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_NB_INIT ) +#define DXE_NB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_NB_SMM_INIT ) +#define DXE_NB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_EC_DXE_NB_ERROR ) + +// Reported by SB Driver(s) +#define DXE_SBRUN_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_SB_RT_INIT ) +#define DXE_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_SB_INIT ) +#define DXE_SB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_SB_SMM_INIT ) +#define DXE_SB_DEVICES_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_SB_DEVICES_INIT ) +#define DXE_SB_BAD_BATTERY (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_EC_BAD_BATTERY) +#define DXE_SB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_EC_DXE_SB_ERROR ) + +//Reported by DXE Core +#define DXE_BDS_STARTED (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT) + +//Reported by BDS +//#define DXE_BDS_CONNECT_DRIVERS (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS) + +//Reported by Boot Manager +#define DXE_READY_TO_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT) + +//Reported by DXE Core +#define DXE_EXIT_BOOT_SERVICES (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) +#define DXE_EXIT_BOOT_SERVICES_EVENT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_EXIT_BOOT_SERVICES_EVENT) + +//Reported by driver that installs Runtime AP +#define RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP) +#define RT_SET_VIRTUAL_ADDRESS_MAP_END (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT) + +//Reported by CSM +#define DXE_LEGACY_OPROM_INIT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_LEGACY_OPROM_INIT) +#define DXE_LEGACY_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT) +#define DXE_LEGACY_OPROM_NO_SPACE (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_LEGACY_OPROM_NO_SPACE) + +//Reported by SETUP +//#define DXE_SETUP_VERIFYING_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD) +#define DXE_SETUP_START (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP) +#define DXE_SETUP_INPUT_WAIT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT) +#define DXE_INVALID_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_INVALID_PASSWORD) +#define DXE_INVALID_IDE_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_INVALID_IDE_PASSWORD) +#define DXE_BOOT_OPTION_LOAD_ERROR (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) +#define DXE_BOOT_OPTION_FAILED (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED) + +//Reported by a Driver that installs Reset AP +#define DXE_RESET_SYSTEM (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM) +#define DXE_RESET_NOT_AVAILABLE (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE) + +// Reported by PCI bus driver +#define DXE_PCI_BUS_BEGIN (EFI_IO_BUS_PCI | EFI_IOB_PC_INIT) +#define DXE_PCI_BUS_ENUM (EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_BUS_ENUM) +#define DXE_PCI_BUS_HPC_INIT (EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_HPC_INIT) +#define DXE_PCI_BUS_REQUEST_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_RES_ALLOC) +#define DXE_PCI_BUS_ASSIGN_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_PC_ENABLE) +#define DXE_PCI_BUS_HOTPLUG (EFI_IO_BUS_PCI | EFI_IOB_PC_HOTPLUG) +#define DXE_PCI_BUS_OUT_OF_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT) + +// Reported by USB bus driver +#define DXE_USB_BEGIN (EFI_IO_BUS_USB | EFI_IOB_PC_INIT) +#define DXE_USB_RESET (EFI_IO_BUS_USB | EFI_IOB_PC_RESET) +#define DXE_USB_DETECT (EFI_IO_BUS_USB | EFI_IOB_PC_DETECT) +#define DXE_USB_ENABLE (EFI_IO_BUS_USB | EFI_IOB_PC_ENABLE) +#define DXE_USB_HOTPLUG (EFI_IO_BUS_USB | EFI_IOB_PC_HOTPLUG) + +//Reported by IDE bus driver +#define DXE_IDE_BEGIN (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_INIT) +#define DXE_IDE_RESET (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_RESET) +#define DXE_IDE_DETECT (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_DETECT) +#define DXE_IDE_ENABLE (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_ENABLE) +#define DXE_IDE_SMART_ERROR (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD) +#define DXE_IDE_CONTROLLER_ERROR (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_CONTROLLER_ERROR) +#define DXE_IDE_DEVICE_FAILURE (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_INTERFACE_ERROR) + +// Reported by SCSI bus driver +#define DXE_SCSI_BEGIN (EFI_IO_BUS_SCSI | EFI_IOB_PC_INIT) +#define DXE_SCSI_RESET (EFI_IO_BUS_SCSI | EFI_IOB_PC_RESET) +#define DXE_SCSI_DETECT (EFI_IO_BUS_SCSI | EFI_IOB_PC_DETECT) +#define DXE_SCSI_ENABLE (EFI_IO_BUS_SCSI | EFI_IOB_PC_ENABLE) + +// Reported by Super I/O driver +#define DXE_SIO_INIT (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT) + +// Reported by Keyboard driver +#define DXE_KEYBOARD_INIT (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_INIT) +#define DXE_KEYBOARD_RESET (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET) +#define DXE_KEYBOARD_DISABLE (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE) +#define DXE_KEYBOARD_DETECT (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT) +#define DXE_KEYBOARD_ENABLE (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE) +#define DXE_KEYBOARD_CLEAR_BUFFER (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER) +#define DXE_KEYBOARD_SELF_TEST (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST) + +// Reported by Mouse driver +#define DXE_MOUSE_INIT (EFI_PERIPHERAL_MOUSE | EFI_P_PC_INIT) +#define DXE_MOUSE_RESET (EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET) +#define DXE_MOUSE_DISABLE (EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE) +#define DXE_MOUSE_DETECT (EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT) +#define DXE_MOUSE_ENABLE (EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE) + +// Reported by Mass Storage drivers +#define DXE_FIXED_MEDIA_INIT (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_INIT) +#define DXE_FIXED_MEDIA_RESET (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_RESET) +#define DXE_FIXED_MEDIA_DISABLE (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_DISABLE) +#define DXE_FIXED_MEDIA_DETECT (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_PRESENCE_DETECT) +#define DXE_FIXED_MEDIA_ENABLE (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENABLE) +#define DXE_REMOVABLE_MEDIA_INIT (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_INIT) +#define DXE_REMOVABLE_MEDIA_RESET (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET) +#define DXE_REMOVABLE_MEDIA_DISABLE (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE) +#define DXE_REMOVABLE_MEDIA_DETECT (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_PRESENCE_DETECT) +#define DXE_REMOVABLE_MEDIA_ENABLE (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE) + + +// Reported by BDS +#define DXE_CON_OUT_CONNECT (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_INIT) +#define DXE_CON_IN_CONNECT (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_INIT) +#define DXE_NO_CON_OUT (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED) +#define DXE_NO_CON_IN (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED) + +#endif diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.c b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.c new file mode 100644 index 0000000000..a29d948951 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.c @@ -0,0 +1,101 @@ +/** @file + Beep status code implementation. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Library/PeiServicesLib.h> +#include <Library/PeimEntryPoint.h> +#include <Library/PcdLib.h> +#include <Library/DebugLib.h> +#include <Library/ReportStatusCodeLib.h> +#include <Ppi/ReportStatusCodeHandler.h> + +#include <Library/BeepMapLib.h> +#include <Library/BeepLib.h> + +/** + Convert status code value to the times of beep. + + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param CodeType Indicates the type of status code being reported. + @param 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 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 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 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 CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN CONST EFI_GUID *CallerId, + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL + ) +{ + UINT32 BeepValue; + + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); + if (BeepValue != 0) { + Beep (BeepValue); + } + + return EFI_SUCCESS; +} + +/** + Constructor function of PeiBeepStatusCodeHandlerLib. + + This function is the constructor function of this Beep Status Code Handler Library for PEI Phase. + It check whether need beep, and register it to gEfiPeiRscHandlerPpiGuid. + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully. + +**/ +RETURN_STATUS +EFIAPI +PeiBeepStatusCodeHandlerLibConstructor ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi; + + if (!PcdGetBool (PcdStatusCodeUseBeep)) { + return RETURN_SUCCESS; + } + + Status = PeiServicesLocatePpi ( + &gEfiPeiRscHandlerPpiGuid, + 0, + NULL, + (VOID **) &RscHandlerPpi + ); + ASSERT_EFI_ERROR (Status); + + Status = RscHandlerPpi->Register (BeepStatusCodeReportWorker); + ASSERT_EFI_ERROR (Status); + + return RETURN_SUCCESS; +} diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.inf b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.inf new file mode 100644 index 0000000000..421b246663 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.inf @@ -0,0 +1,49 @@ +## @file +# Beep status code implementation. +# +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# vendor. This file may not be modified, except as allowed by +# additional terms of your license agreement. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PeiBeepStatusCodeHandlerLib + FILE_GUID = C4210E71-0A38-4728-8D25-4876348AA380 + MODULE_TYPE = PEIM + CONSTRUCTOR = PeiBeepStatusCodeHandlerLibConstructor + LIBRARY_CLASS = StatusCodeHandlerLib|SEC PEIM PEI_COR + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) +# + +[Sources] + PeiBeepStatusCodeHandlerLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec + +[LibraryClasses] + PeiServicesLib + PcdLib + DebugLib + ReportStatusCodeLib + BeepMapLib + BeepLib + +[Pcd] + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep ## CONSUMES + +[Ppis] + gEfiPeiRscHandlerPpiGuid ## CONSUMES + +[Depex] + TRUE diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c new file mode 100644 index 0000000000..631e2eecae --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c @@ -0,0 +1,184 @@ +/** @file + Beep status code implementation. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Library/UefiDriverEntryPoint.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Guid/EventGroup.h> +#include <Library/PcdLib.h> +#include <Library/DebugLib.h> +#include <Library/ReportStatusCodeLib.h> +#include <Protocol/ReportStatusCodeHandler.h> + +#include <Library/BeepMapLib.h> +#include <Library/BeepLib.h> + +EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL; +EFI_EVENT mExitBootServicesEvent = NULL; +BOOLEAN mRegistered = FALSE; + +/** + Convert status code value to the times of beep. + + @param CodeType Indicates the type of status code being reported. + @param 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 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 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 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 + ) +{ + UINT32 BeepValue; + + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); + if (BeepValue != 0) { + Beep (BeepValue); + } + + return EFI_SUCCESS; +} + +/** + Unregister status code callback functions only available at boot time from + report status code router when exiting boot services. + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context, which is + always zero in current implementation. + +**/ +VOID +EFIAPI +UnregisterBeepBootTimeHandlers ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + if (mRegistered) { + mRscHandlerProtocol->Unregister (BeepStatusCodeReportWorker); + } +} + +/** + Register status code callback function only when Report Status Code protocol + is installed. + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context, which is + always zero in current implementation. + +**/ +VOID +EFIAPI +RegisterBeepBootTimeHandlers ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + Status = gBS->LocateProtocol ( + &gEfiRscHandlerProtocolGuid, + NULL, + (VOID **) &mRscHandlerProtocol + ); + ASSERT_EFI_ERROR (Status); + + mRscHandlerProtocol->Register (BeepStatusCodeReportWorker, TPL_HIGH_LEVEL); + ASSERT_EFI_ERROR (Status); + mRegistered = TRUE; + + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + UnregisterBeepBootTimeHandlers, + NULL, + &gEfiEventExitBootServicesGuid, + &mExitBootServicesEvent + ); + ASSERT_EFI_ERROR (Status); +} + +/** + Constructor function of RuntimeDxeBeepStatusCodeHandlerLib. + + This function allocates memory for extended status code data, caches + the report status code service, and registers events. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +RuntimeDxeBeepStatusCodeHandlerLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_EVENT RegisterStatusCodeHandlerEvent; + VOID *Registration; + + if (!PcdGetBool (PcdStatusCodeUseBeep)) { + return EFI_SUCCESS; + } + + Status = gBS->LocateProtocol ( + &gEfiRscHandlerProtocolGuid, + NULL, + (VOID **) &mRscHandlerProtocol + ); + + if (!EFI_ERROR (Status)) { + RegisterBeepBootTimeHandlers (NULL, NULL); + } else { + Status = gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + RegisterBeepBootTimeHandlers, + NULL, + &RegisterStatusCodeHandlerEvent + ); + ASSERT_EFI_ERROR (Status); + + // + // Register for protocol notifications on this event + // + Status = gBS->RegisterProtocolNotify ( + &gEfiRscHandlerProtocolGuid, + RegisterStatusCodeHandlerEvent, + &Registration + ); + ASSERT_EFI_ERROR (Status); + } + + return EFI_SUCCESS; +} diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf new file mode 100644 index 0000000000..b9aae39128 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf @@ -0,0 +1,51 @@ +## @file +# Beep status code implementation. +# +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# vendor. This file may not be modified, except as allowed by +# additional terms of your license agreement. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = RuntimeDxeBeepStatusCodeHandlerLib + FILE_GUID = D05F43CE-7C70-4663-848F-8265C311A8A5 + MODULE_TYPE = DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + CONSTRUCTOR = RuntimeDxeBeepStatusCodeHandlerLibConstructor + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_RUNTIME_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) +# + +[Sources] + RuntimeDxeBeepStatusCodeHandlerLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiRuntimeLib + PcdLib + DebugLib + ReportStatusCodeLib + BeepMapLib + BeepLib + +[Pcd] + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep ## CONSUMES + +[Protocols] + gEfiRscHandlerProtocolGuid ## CONSUMES + +[Depex] + TRUE diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.c b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.c new file mode 100644 index 0000000000..6b1125f4c2 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.c @@ -0,0 +1,138 @@ +/** @file + Beep status code implementation. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Library/UefiDriverEntryPoint.h> +#include <Library/SmmServicesTableLib.h> +#include <Library/PcdLib.h> +#include <Library/DebugLib.h> +#include <Library/ReportStatusCodeLib.h> +#include <Protocol/SmmReportStatusCodeHandler.h> + +#include <Library/BeepMapLib.h> +#include <Library/BeepLib.h> + +/** + Convert status code value to the times of beep. + + @param CodeType Indicates the type of status code being reported. + @param 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 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 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 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 + ) +{ + UINT32 BeepValue; + + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); + if (BeepValue != 0) { + Beep (BeepValue); + } + + return EFI_SUCCESS; +} + +/** + Register status code callback function only when Report Status Code protocol + is installed. + + @param Protocol Points to the protocol's unique identifier. + @param Interface Points to the interface instance. + @param Handle The handle on which the interface was installed. + + @retval EFI_SUCCESS Notification runs successfully. + +**/ +EFI_STATUS +EFIAPI +RegisterBeepBootTimeHandlers ( + IN CONST EFI_GUID *Protocol, + IN VOID *Interface, + IN EFI_HANDLE Handle + ) +{ + EFI_STATUS Status; + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; + + Status = gSmst->SmmLocateProtocol ( + &gEfiSmmRscHandlerProtocolGuid, + NULL, + (VOID **) &RscHandlerProtocol + ); + ASSERT_EFI_ERROR (Status); + + RscHandlerProtocol->Register (BeepStatusCodeReportWorker); + + return EFI_SUCCESS; +} + +/** + Constructor function of SmmBeepStatusCodeHandlerLib. + + This function allocates memory for extended status code data, caches + the report status code service, and registers events. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +SmmBeepStatusCodeHandlerLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *Registration; + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; + + if (!PcdGetBool (PcdStatusCodeUseBeep)) { + return EFI_SUCCESS; + } + + Status = gSmst->SmmLocateProtocol ( + &gEfiSmmRscHandlerProtocolGuid, + NULL, + (VOID **) &RscHandlerProtocol + ); + if (!EFI_ERROR (Status)) { + RegisterBeepBootTimeHandlers (NULL, NULL, NULL); + } else { + gSmst->SmmRegisterProtocolNotify ( + &gEfiSmmRscHandlerProtocolGuid, + RegisterBeepBootTimeHandlers, + &Registration + ); + } + + return EFI_SUCCESS; +} diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.inf b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.inf new file mode 100644 index 0000000000..caa82264ae --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.inf @@ -0,0 +1,50 @@ +## @file +# Beep status code implementation. +# +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# vendor. This file may not be modified, except as allowed by +# additional terms of your license agreement. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SmmBeepStatusCodeHandlerLib + FILE_GUID = 2E2BC2D4-572D-4663-9A1E-FB52FA30922A + MODULE_TYPE = DXE_SMM_DRIVER + VERSION_STRING = 1.0 + CONSTRUCTOR = SmmBeepStatusCodeHandlerLibConstructor + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_SMM_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) +# + +[Sources] + SmmBeepStatusCodeHandlerLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec + +[LibraryClasses] + SmmServicesTableLib + PcdLib + DebugLib + ReportStatusCodeLib + BeepMapLib + BeepLib + +[Pcd] + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep ## CONSUMES + +[Protocols] + gEfiSmmRscHandlerProtocolGuid ## CONSUMES + +[Depex] + TRUE diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md b/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md new file mode 100644 index 0000000000..ee254d0f99 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md @@ -0,0 +1,125 @@ +# Overview +* **Feature Name:** Beep Debug +* **PI Phase(s) Supported:** PEI, DXE, SMM +* **SMM Required?** Yes + +More Information: + +## Purpose +The BeepDebugFeaturePkg include some useful beep debug libraries, such as get beep value from status code and beep. +This is an important capability in firmware development to get and analyze the early error when there is not serial port. + + +# High-Level Theory of Operation +It provide a library BeepStatusCodeHandlerLib used by edk2 StatusCodeHandler.efi, used to do beep if needed. +It also provide a library of BeepMap lib, it map the status code to beep value. +A library of Beep lib is needed by platform, and this pkg has a Null implementation. + +In the library contstructor function, BeepStatusCodeHandlerLib register the call back function for ReportStatusCode. +When called, it call GetBeepFromStatusCode() in BeepMapLib to get beep value from status code, and call Beep() in BeepLib to beep. + +BeepStatusCodeHandlerLib include 3 libraries for PEI, RuntimeDxe, SMM: +* PeiBeepStatusCodeHandlerLib +* RuntimeDxeBeepStatusCodeHandlerLib +* SmmBeepStatusCodeHandlerLib + +## Firmware Volumes +Linked with StatusCodeHandler.efi, and make sure put the StatusCodeHandler.efi after the ReportStatusCodeRouter.efi. + +## Modules +* BeepStatusCodeHandlerLib +* BeepMapLib +* BeepLibNull + +## BeepStatusCodeHandlerLib +This library register the call back function for ReportStatusCode, and get beep valude from status code, and do beep. + +## BeepMapLib +This library provide a function to get beep value from status code. + +## Key Functions +* In PeiBeepStatusCodeHandlerLib: + EFI_STATUS + EFIAPI + BeepStatusCodeReportWorker ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN CONST EFI_GUID *CallerId, + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL + ) + +* In RuntimeDxeBeepStatusCodeHandlerLib: + 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 + ) + +* In SmmBeepStatusCodeHandlerLib: + 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 + ) + +* In BeepMapLib: + UINT32 + EFIAPI + GetBeepValueFromStatusCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value + ) + +* In BeepLib: + VOID + EFIAPI + Beep ( + IN UINT32 Value + ) + +## Configuration +* Link the library to StatusCodeHandler.efi. + Example: + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf { + <LibraryClasses> + NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf + } + Refer to BeepDebugFeature.dsc for other example. +* Config PCD gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep. + In platform .dsc file, need to config the type of gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep. + Use PcdsFixedAtBuild to save binary size, and use PcdsDynamic if want to enable/disable in runtime. +* Implemented platform's special BeepMapLib if needed. +* Provide the platform's special BeepLib. +* Make sure put the StatusCodeHandler.efi after the ReportStatusCodeRouter.efi. + +## Data Flows +Status Code (ReportStatusCode) -> Beep Value (GetBeepValueFromStatusCode). + +## Control Flows +ReportStatusCode() -> BeepStatusCodeReportWorker() -> GetBeepValueFromStatusCode() -> Beep() + +## Build Flows +There is not special build flows. + +## Test Point Results +Verify the post code shown is correct. + +## Functional Exit Criteria +N/A + +## Feature Enabling Checklist +* Set the PCD gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep to TRUE. +* Plug out all the memory, check can here the beep. + +## Common Optimizations +* Implemented platform's special BeepMapLib if needed. -- 2.24.0.windows.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v7 2/2] Features/Intel/PostCodeDebugFeaturePkg: add it. 2020-06-16 11:25 [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: add it Tan, Ming @ 2020-06-16 11:25 ` Tan, Ming 2020-06-18 0:46 ` [edk2-devel] " Dandan Bi 2020-06-17 8:25 ` [edk2-devel] [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: " Dandan Bi 1 sibling, 1 reply; 5+ messages in thread From: Tan, Ming @ 2020-06-16 11:25 UTC (permalink / raw) To: devel; +Cc: Eric Dong, Liming Gao REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2478 The PostCodeDebugFeaturePkg include some useful post code debug libraries, such as get post code from status code and show it. It provide a library PostCodeStatusCodeHandlerLib used by edk2 StatusCodeHandler.efi, used to show the post code. It also provide a library of PostCodeMap lib, it map the status code to post code. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Ming Tan <ming.tan@intel.com> --- V7: Add the dec files in AdvancedFeaturesPcd.dsc. Combine Beep and PostCode to 2/2 patchs. And change to same V7 of Beep. V4: In dec files, change the PcdStatusCodeUsePostCode default to FALSE. V3: Modify according Eric's comments. Modify some bugs about dsc file when it is included. Update Readme.md. V2: Delete the last empty line in PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf .../Include/AdvancedFeaturesPcd.dsc | 1 + .../Include/Library/PostCodeMapLib.h | 32 +++ .../Include/PostCodeDebugFeature.dsc | 200 +++++++++++++ .../PlatformStatusCodesInternal.h | 270 ++++++++++++++++++ .../Library/PostCodeMapLib/PostCodeMapLib.c | 207 ++++++++++++++ .../Library/PostCodeMapLib/PostCodeMapLib.inf | 27 ++ .../PeiPostCodeStatusCodeHandlerLib.c | 102 +++++++ .../PeiPostCodeStatusCodeHandlerLib.inf | 49 ++++ .../RuntimeDxePostCodeStatusCodeHandlerLib.c | 188 ++++++++++++ ...RuntimeDxePostCodeStatusCodeHandlerLib.inf | 51 ++++ .../SmmPostCodeStatusCodeHandlerLib.c | 141 +++++++++ .../SmmPostCodeStatusCodeHandlerLib.inf | 50 ++++ .../PostCodeDebugFeaturePkg.dec | 32 +++ .../PostCodeDebugFeaturePkg.dsc | 30 ++ .../PostCodeDebugFeaturePkg/Readme.md | 117 ++++++++ 15 files changed, 1497 insertions(+) create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/PostCodeMapLib.h create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCodeDebugFeature.dsc create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PlatformStatusCodesInternal.h create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.c create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dsc create mode 100644 Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md diff --git a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc index 366b551bd3..ad248de800 100644 --- a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc +++ b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc @@ -25,6 +25,7 @@ UserAuthFeaturePkg/UserAuthFeaturePkg.dec LogoFeaturePkg/LogoFeaturePkg.dec BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec # # The section below sets all PCDs to FALSE in this DSC file so the feature is not enabled by default. diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/PostCodeMapLib.h b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/PostCodeMapLib.h new file mode 100644 index 0000000000..834be623a1 --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/PostCodeMapLib.h @@ -0,0 +1,32 @@ +/** @file + This library class provides Platform PostCode Map. + + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __POST_CODE_MAP_LIB__ +#define __POST_CODE_MAP_LIB__ + +/** + Get PostCode from status code type and value. + + @param CodeType Indicates the type of status code being reported. + @param 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. + + @return PostCode + +**/ +UINT32 +EFIAPI +GetPostCodeFromStatusCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value + ); + +#endif diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCodeDebugFeature.dsc b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCodeDebugFeature.dsc new file mode 100644 index 0000000000..2852b9cf7c --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCodeDebugFeature.dsc @@ -0,0 +1,200 @@ +## @file +# This package provides PostCode Debug feature. +# This file should be included into another package DSC file to build this feature. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] +!ifndef $(PEI_ARCH) + !error "PEI_ARCH must be specified to build this feature!" +!endif +!ifndef $(DXE_ARCH) + !error "DXE_ARCH must be specified to build this feature!" +!endif + +################################################################################ +# +# PCD Section - list of PCD Entries modified by the feature. +# +################################################################################ + +# Unmark the following and StatusCodeHandler.efi to build the .dsc file directly +#[PcdsDynamicDefault] +# gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode|TRUE + +################################################################################ +# +# Library Class section - list of all Library Classes needed by this feature. +# +################################################################################ +[LibraryClasses] + ####################################### + # Edk2 Packages + ####################################### + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + +[LibraryClasses.common.PEIM] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf + +[LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE,LibraryClasses.IA32.SEC] + ####################################### + # Edk2 Packages + ####################################### + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf + +[LibraryClasses.common.DXE_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + +[LibraryClasses.X64.DXE_SMM_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf + MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf + SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf + +################################################################################ +# +# Component section - list of all components that need built for this feature. +# +# Note: The EDK II DSC file is not used to specify how compiled binary images get placed +# into firmware volume images. This section is just a list of modules to compile from +# source into UEFI-compliant binaries. +# It is the FDF file that contains information on combining binary files into firmware +# volume images, whose concept is beyond UEFI and is described in PI specification. +# There may also be modules listed in this section that are not required in the FDF file, +# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be +# generated for it, but the binary will not be put into any firmware volume. +# +################################################################################ +# +# Feature PEI Components +# + +# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308 +# is completed. +[Components.IA32] + ##################################### + # PostCode Debug Feature Package + ##################################### + + # Add library instances here that are not included in package components and should be tested + # in the package build. + PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf + + # The following is an example for used with StatusCodeHandler: +# MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf { +# <LibraryClasses> +# OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +# SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf +# PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf +# PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf +# NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf +# } + + # Add components here that should be included in the package build. + +# +# Feature DXE Components +# + +# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308 +# is completed. +[Components.X64] + ##################################### + # PostCode Debug Feature Package + ##################################### + + # Add library instances here that are not included in package components and should be tested + # in the package build. + PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf + PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf + + # The following is an example for used with StatusCodeHandler: +# MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf { +# <LibraryClasses> +# OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +# SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf +# PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf +# PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf +# NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf +# } + +# MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf { +# <LibraryClasses> +# OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf +# SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf +# PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf +# PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf +# NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf +# } + + # Add components here that should be included in the package build. + +################################################################################################### +# +# BuildOptions Section - Define the module specific tool chain flags that should be used as +# the default flags for a module. These flags are appended to any +# standard flags that are defined by the build process. They can be +# applied for any modules or only those modules with the specific +# module style (EDK or EDKII) specified in [Components] section. +# +# For advanced features, it is recommended to enable [BuildOptions] in +# the applicable INF file so it does not affect the whole board package +# build when this DSC file is active. +# +################################################################################################### +[BuildOptions] diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PlatformStatusCodesInternal.h b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PlatformStatusCodesInternal.h new file mode 100644 index 0000000000..7c8daf052d --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PlatformStatusCodesInternal.h @@ -0,0 +1,270 @@ +/** @file + PostCode status code definition. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_STATUS_CODES_INTERNAL_H__ +#define __PLATFORM_STATUS_CODES_INTERNAL_H__ + +#include <Pi/PiStatusCode.h> + +typedef struct{ + EFI_STATUS_CODE_VALUE Value; + UINT32 Data; +} STATUS_CODE_TO_DATA_MAP; + +// +// Enable PEI/DXE status code +// +#define PEI_STATUS_CODE 1 +#define DXE_STATUS_CODE 1 + +#define STATUS_CODE_TYPE(Type) ((Type)&EFI_STATUS_CODE_TYPE_MASK) +#define STATUS_CODE_CLASS(Value) ((Value)&EFI_STATUS_CODE_CLASS_MASK) + +//Progress/Error codes +#define PEI_CORE_STARTED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_ENTRY_POINT) +#define PEI_RESET_NOT_AVAILABLE (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE) +#define PEI_DXEIPL_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND) +#define PEI_DXE_CORE_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_DXE_CORRUPT) +#define PEI_S3_RESUME_ERROR (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_EC_S3_RESUME_FAILED) +#define PEI_RECOVERY_FAILED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_EC_RECOVERY_FAILED) +#define DXE_CORE_STARTED (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT) + +//#define DXE_EXIT_BOOT_SERVICES_BEGIN 0xF8 +#define DXE_EXIT_BOOT_SERVICES_END (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) + +// Reported by CPU PEIM +#define PEI_CAR_CPU_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_POWER_ON_INIT) + +// Reported by NB PEIM +//#define PEI_CAR_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_CHIPSET_NORTH_INIT) + +// Reported by SB PEIM +//#define PEI_CAR_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_CHIPSET_PC_SOUTH_INIT) + +//Reported by Memory Detection PEIM +#define PEI_MEMORY_SPD_READ (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_SPD_READ) +#define PEI_MEMORY_PRESENCE_DETECT (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_PRESENCE_DETECT) +#define PEI_MEMORY_TIMING (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TIMING) +#define PEI_MEMORY_CONFIGURING (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_CONFIGURING) +#define PEI_MEMORY_OPTIMIZING (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_OPTIMIZING) +#define PEI_MEMORY_INIT (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_INIT) +#define PEI_MEMORY_TEST (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TEST) +#define PEI_MEMORY_INVALID_TYPE (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_TYPE) +#define PEI_MEMORY_INVALID_SPEED (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SPEED) +#define PEI_MEMORY_SPD_FAIL (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_SPD_FAIL) +#define PEI_MEMORY_INVALID_SIZE (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SIZE) +#define PEI_MEMORY_MISMATCH (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) +#define PEI_MEMORY_S3_RESUME_FAILED (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_S3_RESUME_FAIL) +#define PEI_MEMORY_NOT_DETECTED (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_DETECTED) +#define PEI_MEMORY_NONE_USEFUL (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_USEFUL) +#define PEI_MEMORY_ERROR (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NON_SPECIFIC) +#define PEI_MEMORY_INSTALLED (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PS_PC_INSTALL_PEI_MEMORY) +#define PEI_MEMORY_NOT_INSTALLED (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED) +#define PEI_MEMORY_INSTALLED_TWICE (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PS_EC_MEMORY_INSTALLED_TWICE) + +//Reported by CPU PEIM +#define PEI_CPU_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_PC_INIT_BEGIN) +#define PEI_CPU_CACHE_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACHE_INIT) +#define PEI_CPU_BSP_SELECT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT) +#define PEI_CPU_AP_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT) +#define PEI_CPU_SMM_INIT (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_SMM_INIT) +#define PEI_CPU_INVALID_TYPE (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INVALID_TYPE) +#define PEI_CPU_INVALID_SPEED (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INVALID_SPEED) +#define PEI_CPU_MISMATCH (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MISMATCH) +#define PEI_CPU_SELF_TEST_FAILED (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) +#define PEI_CPU_CACHE_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CACHE) +#define PEI_CPU_MICROCODE_UPDATE_FAILED (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MICROCODE_UPDATE) +#define PEI_CPU_NO_MICROCODE (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_NO_MICROCODE_UPDATE) +//If non of the errors above apply use this one +#define PEI_CPU_INTERNAL_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INTERNAL) +//Generic CPU error. It should only be used if non of the errors above apply +#define PEI_CPU_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NON_SPECIFIC) + +// Reported by NB PEIM +#define PEI_MEM_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_PEI_MEM_NB_INIT) +// Reported by SB PEIM +#define PEI_MEM_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_PEI_MEM_SB_INIT) + +//Reported by PEIM which detected forced or auto recovery condition +#define PEI_RECOVERY_AUTO (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_AUTO) +#define PEI_RECOVERY_USER (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_USER) + +//Reported by DXE IPL +#define PEI_RECOVERY_PPI_NOT_FOUND (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND) +#define PEI_S3_RESUME_PPI_NOT_FOUND (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND) +#define PEI_S3_RESUME_FAILED (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_FAILED) + +//Reported by Recovery PEIM +#define PEI_RECOVERY_STARTED (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_BEGIN) +#define PEI_RECOVERY_CAPSULE_FOUND (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_LOAD) +#define PEI_RECOVERY_NO_CAPSULE (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE) +#define PEI_RECOVERY_CAPSULE_LOADED (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START) +#define PEI_RECOVERY_INVALID_CAPSULE (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR) + +//Reported by S3 Resume PEIM +#define PEI_S3_BOOT_SCRIPT (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_S3_BOOT_SCRIPT) +#define PEI_S3_OS_WAKE (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE) +#define PEI_S3_BOOT_SCRIPT_ERROR (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_BOOT_SCRIPT_ERROR) +#define PEI_S3_OS_WAKE_ERROR (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_OS_WAKE_ERROR) + +#define PEI_PEIM_STARTED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN) +#define PEI_PEIM_ENDED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_END) + +//Reported by DXE IPL +#define PEI_DXE_IPL_STARTED (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT) + +//Reported by PEIM which installs Reset PPI +#define PEI_RESET_SYSTEM (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PS_PC_RESET_SYSTEM) + +//Reported by the PEIM or DXE driver which detected the error +#define GENERIC_MEMORY_CORRECTABLE_ERROR (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_CORRECTABLE) +#define GENERIC_MEMORY_UNCORRECTABLE_ERROR (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE) + +//Reported by Flash Update DXE driver +#define DXE_FLASH_UPDATE_FAILED (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UPDATE_FAIL) + +//Reported by the PEIM or DXE driver which detected the error +#define GENERIC_CPU_THERMAL_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_THERMAL) +#define GENERIC_CPU_LOW_VOLTAGE (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_LOW_VOLTAGE) +#define GENERIC_CPU_HIGH_VOLTAGE (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_HIGH_VOLTAGE) +#define GENERIC_CPU_CORRECTABLE_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CORRECTABLE) +#define GENERIC_CPU_UNCORRECTABLE_ERROR (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_UNCORRECTABLE) +#define GENERIC_BAD_DATE_TIME_ERROR (EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_BAD_DATE_TIME) +#define GENERIC_MEMORY_SIZE_DECREASE (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) + +//Reported by DXE Core +#define DXE_DRIVER_STARTED (EFI_SOFTWARE_EFI_DXE_SERVICE | EFI_SW_PC_INIT_BEGIN) +#define DXE_DRIVER_ENED (EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END) +#define DXE_ARCH_PROTOCOLS_AVAILABLE (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ARCH_READY) +#define DXE_DRIVER_CONNECTED (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_START_DRIVER) +#define DXE_ARCH_PROTOCOL_NOT_AVAILABLE (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH) + +//Reported by DXE CPU driver +#define DXE_CPU_SELF_TEST_FAILED (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) + +//Reported by PCI Host Bridge driver +#define DXE_NB_HB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_HB_INIT ) + +// Reported by NB Driver +#define DXE_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_NB_INIT ) +#define DXE_NB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_NB_SMM_INIT ) +#define DXE_NB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_EC_DXE_NB_ERROR ) + +// Reported by SB Driver(s) +#define DXE_SBRUN_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_SB_RT_INIT ) +#define DXE_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_SB_INIT ) +#define DXE_SB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_SB_SMM_INIT ) +#define DXE_SB_DEVICES_INIT (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_SB_DEVICES_INIT ) +#define DXE_SB_BAD_BATTERY (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_EC_BAD_BATTERY) +#define DXE_SB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_EC_DXE_SB_ERROR ) + +//Reported by DXE Core +#define DXE_BDS_STARTED (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT) + +//Reported by BDS +//#define DXE_BDS_CONNECT_DRIVERS (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS) + +//Reported by Boot Manager +#define DXE_READY_TO_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT) + +//Reported by DXE Core +#define DXE_EXIT_BOOT_SERVICES (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) +#define DXE_EXIT_BOOT_SERVICES_EVENT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_EXIT_BOOT_SERVICES_EVENT) + +//Reported by driver that installs Runtime AP +#define RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP) +#define RT_SET_VIRTUAL_ADDRESS_MAP_END (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT) + +//Reported by CSM +#define DXE_LEGACY_OPROM_INIT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_LEGACY_OPROM_INIT) +#define DXE_LEGACY_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT) +#define DXE_LEGACY_OPROM_NO_SPACE (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_LEGACY_OPROM_NO_SPACE) + +//Reported by SETUP +//#define DXE_SETUP_VERIFYING_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD) +#define DXE_SETUP_START (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP) +#define DXE_SETUP_INPUT_WAIT (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT) +#define DXE_INVALID_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_INVALID_PASSWORD) +#define DXE_INVALID_IDE_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_INVALID_IDE_PASSWORD) +#define DXE_BOOT_OPTION_LOAD_ERROR (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) +#define DXE_BOOT_OPTION_FAILED (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED) + +//Reported by a Driver that installs Reset AP +#define DXE_RESET_SYSTEM (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM) +#define DXE_RESET_NOT_AVAILABLE (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE) + +// Reported by PCI bus driver +#define DXE_PCI_BUS_BEGIN (EFI_IO_BUS_PCI | EFI_IOB_PC_INIT) +#define DXE_PCI_BUS_ENUM (EFI_IO_BUS_PCI | EFI_IOB_PCI_BUS_ENUM) +#define DXE_PCI_BUS_HPC_INIT (EFI_IO_BUS_PCI | EFI_IOB_PCI_HPC_INIT) +#define DXE_PCI_BUS_REQUEST_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_PCI_RES_ALLOC) +#define DXE_PCI_BUS_ASSIGN_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_PC_ENABLE) +#define DXE_PCI_BUS_HOTPLUG (EFI_IO_BUS_PCI | EFI_IOB_PC_HOTPLUG) +#define DXE_PCI_BUS_OUT_OF_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT) + +// Reported by USB bus driver +#define DXE_USB_BEGIN (EFI_IO_BUS_USB | EFI_IOB_PC_INIT) +#define DXE_USB_RESET (EFI_IO_BUS_USB | EFI_IOB_PC_RESET) +#define DXE_USB_DETECT (EFI_IO_BUS_USB | EFI_IOB_PC_DETECT) +#define DXE_USB_ENABLE (EFI_IO_BUS_USB | EFI_IOB_PC_ENABLE) +#define DXE_USB_HOTPLUG (EFI_IO_BUS_USB | EFI_IOB_PC_HOTPLUG) + +//Reported by IDE bus driver +#define DXE_IDE_BEGIN (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_INIT) +#define DXE_IDE_RESET (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_RESET) +#define DXE_IDE_DETECT (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_DETECT) +#define DXE_IDE_ENABLE (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_ENABLE) +#define DXE_IDE_SMART_ERROR (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD) +#define DXE_IDE_CONTROLLER_ERROR (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_CONTROLLER_ERROR) +#define DXE_IDE_DEVICE_FAILURE (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_INTERFACE_ERROR) + +// Reported by SCSI bus driver +#define DXE_SCSI_BEGIN (EFI_IO_BUS_SCSI | EFI_IOB_PC_INIT) +#define DXE_SCSI_RESET (EFI_IO_BUS_SCSI | EFI_IOB_PC_RESET) +#define DXE_SCSI_DETECT (EFI_IO_BUS_SCSI | EFI_IOB_PC_DETECT) +#define DXE_SCSI_ENABLE (EFI_IO_BUS_SCSI | EFI_IOB_PC_ENABLE) + +// Reported by Super I/O driver +#define DXE_SIO_INIT (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT) + +// Reported by Keyboard driver +#define DXE_KEYBOARD_INIT (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_INIT) +#define DXE_KEYBOARD_RESET (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET) +#define DXE_KEYBOARD_DISABLE (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE) +#define DXE_KEYBOARD_DETECT (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT) +#define DXE_KEYBOARD_ENABLE (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE) +#define DXE_KEYBOARD_CLEAR_BUFFER (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER) +#define DXE_KEYBOARD_SELF_TEST (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST) + +// Reported by Mouse driver +#define DXE_MOUSE_INIT (EFI_PERIPHERAL_MOUSE | EFI_P_PC_INIT) +#define DXE_MOUSE_RESET (EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET) +#define DXE_MOUSE_DISABLE (EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE) +#define DXE_MOUSE_DETECT (EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT) +#define DXE_MOUSE_ENABLE (EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE) + +// Reported by Mass Storage drivers +#define DXE_FIXED_MEDIA_INIT (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_INIT) +#define DXE_FIXED_MEDIA_RESET (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_RESET) +#define DXE_FIXED_MEDIA_DISABLE (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_DISABLE) +#define DXE_FIXED_MEDIA_DETECT (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_PRESENCE_DETECT) +#define DXE_FIXED_MEDIA_ENABLE (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENABLE) +#define DXE_REMOVABLE_MEDIA_INIT (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_INIT) +#define DXE_REMOVABLE_MEDIA_RESET (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET) +#define DXE_REMOVABLE_MEDIA_DISABLE (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE) +#define DXE_REMOVABLE_MEDIA_DETECT (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_PRESENCE_DETECT) +#define DXE_REMOVABLE_MEDIA_ENABLE (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE) + + +// Reported by BDS +#define DXE_CON_OUT_CONNECT (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_INIT) +#define DXE_CON_IN_CONNECT (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_INIT) +#define DXE_NO_CON_OUT (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED) +#define DXE_NO_CON_IN (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED) + +#endif diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.c b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.c new file mode 100644 index 0000000000..2246e59f8b --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.c @@ -0,0 +1,207 @@ +/** @file + PostCodeMap implementation. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Base.h> +#include <Uefi.h> + +#include "PlatformStatusCodesInternal.h" + +STATUS_CODE_TO_DATA_MAP mPostCodeProgressMap[] = { + // + // PEI + // + //Regular boot + { PEI_CORE_STARTED, 0x10 }, + { PEI_CAR_CPU_INIT, 0x11 }, + { PEI_MEMORY_SPD_READ, 0x1D }, + { PEI_MEMORY_PRESENCE_DETECT, 0x1E }, + { PEI_MEMORY_TIMING, 0x1F}, + { PEI_MEMORY_CONFIGURING, 0x20 }, + { PEI_MEMORY_INIT, 0x21 }, + { PEI_MEMORY_INSTALLED, 0x31 }, + { PEI_CPU_INIT, 0x32 }, + { PEI_CPU_CACHE_INIT, 0x33 }, + { PEI_CPU_BSP_SELECT, 0x34 }, + { PEI_CPU_AP_INIT, 0x35 }, + { PEI_CPU_SMM_INIT, 0x36 }, + { PEI_MEM_NB_INIT, 0x37 }, + { PEI_MEM_SB_INIT, 0x3B }, + { PEI_DXE_IPL_STARTED, 0x4F }, + //Recovery + { PEI_RECOVERY_AUTO, 0xF0 }, + { PEI_RECOVERY_USER, 0xF1 }, + { PEI_RECOVERY_STARTED, 0xF2 }, + { PEI_RECOVERY_CAPSULE_FOUND, 0xF3 }, + { PEI_RECOVERY_CAPSULE_LOADED, 0xF4 }, + //S3 + //{ PEI_S3_STARTED, 0xE0 }, + { PEI_S3_BOOT_SCRIPT, 0xE1 }, + //{ PEI_S3_VIDEO_REPOST, 0xE2 }, + { PEI_S3_OS_WAKE, 0xE3 }, + + // + // DXE + // + { DXE_CORE_STARTED, 0x1060 }, + { DXE_SBRUN_INIT, 0x1062 }, + { DXE_NB_HB_INIT, 0x1068 }, + { DXE_NB_INIT, 0x1069 }, + { DXE_NB_SMM_INIT, 0x106A }, + { DXE_SB_INIT, 0x1070 }, + { DXE_SB_SMM_INIT, 0x1071 }, + { DXE_SB_DEVICES_INIT, 0x1072 }, + { DXE_BDS_STARTED, 0x1090 }, + { DXE_PCI_BUS_BEGIN, 0x1092 }, + { DXE_PCI_BUS_HPC_INIT, 0x1093 }, + { DXE_PCI_BUS_ENUM, 0x1094 }, + { DXE_PCI_BUS_REQUEST_RESOURCES, 0x1095 }, + { DXE_PCI_BUS_ASSIGN_RESOURCES, 0x1096 }, + { DXE_CON_OUT_CONNECT, 0x1097 }, + { DXE_CON_IN_CONNECT, 0x1098 }, + { DXE_SIO_INIT, 0x1099 }, + { DXE_USB_BEGIN, 0x109A }, + { DXE_USB_RESET, 0x109B }, + { DXE_USB_DETECT, 0x109C }, + { DXE_USB_ENABLE, 0x109D }, + { DXE_IDE_BEGIN, 0x10A1 }, + { DXE_IDE_RESET, 0x10A2 }, + { DXE_IDE_DETECT, 0x10A3 }, + { DXE_IDE_ENABLE, 0x10A4 }, + { DXE_SCSI_BEGIN, 0x10A5 }, + { DXE_SCSI_RESET, 0x10A6 }, + { DXE_SCSI_DETECT, 0x10A7 }, + { DXE_SCSI_ENABLE, 0x10A8 }, + { DXE_SETUP_START, 0x10AB }, + { DXE_SETUP_INPUT_WAIT, 0x10AC }, + { DXE_READY_TO_BOOT, 0x10AD }, + { DXE_LEGACY_BOOT, 0x10AE }, + { DXE_EXIT_BOOT_SERVICES, 0x10AF }, + { RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN, 0x10B0 }, + { RT_SET_VIRTUAL_ADDRESS_MAP_END, 0x10B1 }, + { DXE_LEGACY_OPROM_INIT, 0x10B2 }, + { DXE_RESET_SYSTEM, 0x10B3 }, + { DXE_USB_HOTPLUG, 0x10B4 }, + { DXE_PCI_BUS_HOTPLUG, 0x10B5 }, + {0,0} +}; + +STATUS_CODE_TO_DATA_MAP mPostCodeErrorMap[] = { + // + // PEI + // + //Regular boot + { PEI_MEMORY_INVALID_TYPE, 0x50 }, + { PEI_MEMORY_INVALID_SPEED, 0x50 }, + { PEI_MEMORY_SPD_FAIL, 0x51 }, + { PEI_MEMORY_INVALID_SIZE, 0x52 }, + { PEI_MEMORY_MISMATCH, 0x52 }, + { PEI_MEMORY_NOT_DETECTED, 0x53 }, + { PEI_MEMORY_NONE_USEFUL, 0x53 }, + { PEI_MEMORY_ERROR, 0x54 }, + { PEI_MEMORY_NOT_INSTALLED, 0x55 }, + { PEI_CPU_INVALID_TYPE, 0x56 }, + { PEI_CPU_INVALID_SPEED, 0x56 }, + { PEI_CPU_MISMATCH, 0x57 }, + { PEI_CPU_SELF_TEST_FAILED, 0x58 }, + { PEI_CPU_CACHE_ERROR, 0x58 }, + { PEI_CPU_MICROCODE_UPDATE_FAILED, 0x59 }, + { PEI_CPU_NO_MICROCODE, 0x59 }, + { PEI_CPU_INTERNAL_ERROR, 0x5A }, + { PEI_CPU_ERROR, 0x5A }, + { PEI_RESET_NOT_AVAILABLE,0x5B }, + //Recovery + { PEI_RECOVERY_PPI_NOT_FOUND, 0xF8 }, + { PEI_RECOVERY_NO_CAPSULE, 0xF9 }, + { PEI_RECOVERY_INVALID_CAPSULE, 0xFA }, + //S3 Resume + { PEI_MEMORY_S3_RESUME_FAILED, 0xE8 }, + { PEI_S3_RESUME_PPI_NOT_FOUND, 0xE9 }, + { PEI_S3_BOOT_SCRIPT_ERROR, 0xEA }, + { PEI_S3_OS_WAKE_ERROR, 0xEB }, + + // + // DXE + // + { DXE_CPU_SELF_TEST_FAILED, 0x1058 }, + { DXE_NB_ERROR, 0x10D1 }, + { DXE_SB_ERROR, 0x10D2 }, + { DXE_ARCH_PROTOCOL_NOT_AVAILABLE, 0x10D3 }, + { DXE_PCI_BUS_OUT_OF_RESOURCES, 0x10D4 }, + { DXE_LEGACY_OPROM_NO_SPACE, 0x10D5 }, + { DXE_NO_CON_OUT, 0x10D6 }, + { DXE_NO_CON_IN, 0x10D7 }, + { DXE_INVALID_PASSWORD, 0x10D8 }, + { DXE_BOOT_OPTION_LOAD_ERROR, 0x10D9 }, + { DXE_BOOT_OPTION_FAILED, 0x10DA }, + { DXE_FLASH_UPDATE_FAILED, 0x10DB }, + { DXE_RESET_NOT_AVAILABLE, 0x10DC }, + {0,0} +}; + +STATUS_CODE_TO_DATA_MAP *mPostCodeStatusCodesMap[] = { + //#define EFI_PROGRESS_CODE 0x00000001 + mPostCodeProgressMap, + //#define EFI_ERROR_CODE 0x00000002 + mPostCodeErrorMap + //#define EFI_DEBUG_CODE 0x00000003 +}; + +/** + Find the post code data from status code value. + + @param Map The map used to find in. + @param Value The status code value. + + @return PostCode 0 for not found. + +**/ +UINT32 +FindPostCodeData ( + IN STATUS_CODE_TO_DATA_MAP *Map, + IN EFI_STATUS_CODE_VALUE Value + ) +{ + while (Map->Value != 0) { + if (Map->Value == Value) { + return Map->Data; + } + Map++; + } + return 0; +} + +/** + Get PostCode from status code type and value. + + @param CodeType Indicates the type of status code being reported. + @param 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. + + @return PostCode + +**/ +UINT32 +EFIAPI +GetPostCodeFromStatusCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value + ) +{ + UINT32 CodeTypeIndex; + + CodeTypeIndex = STATUS_CODE_TYPE (CodeType) - 1; + + if (CodeTypeIndex >= sizeof (mPostCodeStatusCodesMap) / sizeof(mPostCodeStatusCodesMap[0])) { + return 0; + } + + return FindPostCodeData (mPostCodeStatusCodesMap[CodeTypeIndex], Value); +} diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf new file mode 100644 index 0000000000..18a8ac6116 --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf @@ -0,0 +1,27 @@ +## @file +# Instance of Platform Post Code Map Library. +# +# Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = PostCodeMapLib + FILE_GUID = 1C579857-5328-4304-8607-77B0BC978554 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = PostCodeMapLib +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Packages] + MdePkg/MdePkg.dec + +[Sources] + PostCodeMapLib.c + PlatformStatusCodesInternal.h diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c new file mode 100644 index 0000000000..85d7a3d9a8 --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c @@ -0,0 +1,102 @@ +/** @file + PostCode status code implementation. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Library/PeiServicesLib.h> +#include <Library/PeimEntryPoint.h> +#include <Library/PcdLib.h> +#include <Library/DebugLib.h> +#include <Library/ReportStatusCodeLib.h> +#include <Ppi/ReportStatusCodeHandler.h> + +#include <Library/PostCodeMapLib.h> +#include <Library/PostCodeLib.h> + +/** + Convert status code value and write data to post code. + + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. + @param CodeType Indicates the type of status code being reported. + @param 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 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 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 Data This optional parameter may be used to pass additional data. + + @retval EFI_SUCCESS Status code reported to post code successfully. + +**/ +EFI_STATUS +EFIAPI +PostCodeStatusCodeReportWorker ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN CONST EFI_GUID *CallerId, + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL + ) +{ + UINT32 PostCodeValue; + + PostCodeValue = GetPostCodeFromStatusCode (CodeType, Value); + if (PostCodeValue != 0) { + DEBUG ((EFI_D_INFO, "POSTCODE=<%02x>\n", PostCodeValue)); + PostCode (PostCodeValue); + } + + return EFI_SUCCESS; +} + +/** + Constructor function of PeiPostCodeStatusCodeHandlerLib. + + This function is the constructor function of this PostCode Status Code Handler Library for PEI Phase. + It check whether need post code, and register it to gEfiPeiRscHandlerPpiGuid. + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully. + +**/ +RETURN_STATUS +EFIAPI +PeiPostCodeStatusCodeHandlerLibConstructor ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi; + + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { + return RETURN_SUCCESS; + } + + Status = PeiServicesLocatePpi ( + &gEfiPeiRscHandlerPpiGuid, + 0, + NULL, + (VOID **) &RscHandlerPpi + ); + ASSERT_EFI_ERROR (Status); + + Status = RscHandlerPpi->Register (PostCodeStatusCodeReportWorker); + ASSERT_EFI_ERROR (Status); + + return RETURN_SUCCESS; +} diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf new file mode 100644 index 0000000000..c27578fe90 --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf @@ -0,0 +1,49 @@ +## @file +# PostCode status code implementation. +# +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# vendor. This file may not be modified, except as allowed by +# additional terms of your license agreement. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PeiPostCodeStatusCodeHandlerLib + FILE_GUID = FA32350A-63DB-4AC6-88D1-BC5327EE7ECE + MODULE_TYPE = PEIM + CONSTRUCTOR = PeiPostCodeStatusCodeHandlerLibConstructor + LIBRARY_CLASS = StatusCodeHandlerLib|SEC PEIM PEI_COR + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) +# + +[Sources] + PeiPostCodeStatusCodeHandlerLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec + +[LibraryClasses] + PeiServicesLib + DebugLib + PcdLib + ReportStatusCodeLib + PostCodeMapLib + PostCodeLib + +[Pcd] + gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode ## CONSUMES + +[Ppis] + gEfiPeiRscHandlerPpiGuid ## CONSUMES + +[Depex] + TRUE diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c new file mode 100644 index 0000000000..59b531fe7c --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c @@ -0,0 +1,188 @@ +/** @file + PostCode status code implementation. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Library/UefiDriverEntryPoint.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Guid/EventGroup.h> +#include <Library/HobLib.h> +#include <Library/PcdLib.h> +#include <Library/DebugLib.h> +#include <Library/ReportStatusCodeLib.h> +#include <Protocol/ReportStatusCodeHandler.h> + +#include <Library/PostCodeMapLib.h> +#include <Library/PostCodeLib.h> + +EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL; +EFI_EVENT mExitBootServicesEvent = NULL; +BOOLEAN mRegisted = FALSE; + +/** + Convert status code value and write data to post code. + + @param CodeType Indicates the type of status code being reported. + @param 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 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 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 Data This optional parameter may be used to pass additional data. + + @retval EFI_SUCCESS Status code reported to post 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 ((EFI_D_INFO, "POSTCODE=<%02x>\n", PostCodeValue)); + PostCode (PostCodeValue); + } + + return EFI_SUCCESS; +} + +/** + Unregister status code callback functions only available at boot time from + report status code router when exiting boot services. + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context, which is + always zero in current implementation. + +**/ +VOID +EFIAPI +UnregisterPostCodeBootTimeHandlers ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + if (mRegisted) { + mRscHandlerProtocol->Unregister (PostCodeStatusCodeReportWorker); + } +} + + + +/** + Register status code callback function only when Report Status Code protocol + is installed. + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context, which is + always zero in current implementation. + +**/ +VOID +EFIAPI +RegisterPostCodeBootTimeHandlers ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + Status = gBS->LocateProtocol ( + &gEfiRscHandlerProtocolGuid, + NULL, + (VOID **) &mRscHandlerProtocol + ); + ASSERT_EFI_ERROR (Status); + + mRscHandlerProtocol->Register (PostCodeStatusCodeReportWorker, TPL_HIGH_LEVEL); + ASSERT_EFI_ERROR (Status); + mRegisted = TRUE; + + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + UnregisterPostCodeBootTimeHandlers, + NULL, + &gEfiEventExitBootServicesGuid, + &mExitBootServicesEvent + ); + ASSERT_EFI_ERROR (Status); +} + +/** + Constructor function of RuntimeDxePostCodeStatusCodeHandlerLib. + + This function allocates memory for extended status code data, caches + the report status code service, and registers events. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +RuntimeDxePostCodeStatusCodeHandlerLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_EVENT RegisterStatusCodeHandlerEvent; + VOID *Registration; + + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { + return EFI_SUCCESS; + } + + Status = gBS->LocateProtocol ( + &gEfiRscHandlerProtocolGuid, + NULL, + (VOID **) &mRscHandlerProtocol + ); + + if (!EFI_ERROR (Status)) { + RegisterPostCodeBootTimeHandlers (NULL, NULL); + } else { + Status = gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + RegisterPostCodeBootTimeHandlers, + NULL, + &RegisterStatusCodeHandlerEvent + ); + ASSERT_EFI_ERROR (Status); + + // + // Register for protocol notifications on this event + // + Status = gBS->RegisterProtocolNotify ( + &gEfiRscHandlerProtocolGuid, + RegisterStatusCodeHandlerEvent, + &Registration + ); + ASSERT_EFI_ERROR (Status); + } + + return EFI_SUCCESS; +} diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf new file mode 100644 index 0000000000..21012980fe --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf @@ -0,0 +1,51 @@ +## @file +# PostCode status code implementation. +# +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# vendor. This file may not be modified, except as allowed by +# additional terms of your license agreement. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = RuntimeDxePostCodeStatusCodeHandlerLib + FILE_GUID = FC4F3901-3E9B-4CA3-AB6C-1B65E9AA6960 + MODULE_TYPE = DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + CONSTRUCTOR = RuntimeDxePostCodeStatusCodeHandlerLibConstructor + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_RUNTIME_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) +# + +[Sources] + RuntimeDxePostCodeStatusCodeHandlerLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiRuntimeLib + DebugLib + PcdLib + ReportStatusCodeLib + PostCodeMapLib + PostCodeLib + +[Pcd] + gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode ## CONSUMES + +[Protocols] + gEfiRscHandlerProtocolGuid ## CONSUMES + +[Depex] + TRUE diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c new file mode 100644 index 0000000000..efd3a7ee6f --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c @@ -0,0 +1,141 @@ +/** @file + PostCode status code implementation. + + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <Library/UefiDriverEntryPoint.h> +#include <Library/SmmServicesTableLib.h> +#include <Library/HobLib.h> +#include <Library/PcdLib.h> +#include <Library/DebugLib.h> +#include <Library/ReportStatusCodeLib.h> +#include <Protocol/SmmReportStatusCodeHandler.h> + +#include <Library/PostCodeLib.h> +#include <Library/PostCodeMapLib.h> + + +/** + Convert status code value and write data to post code. + + @param CodeType Indicates the type of status code being reported. + @param 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 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 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 Data This optional parameter may be used to pass additional data. + + @retval EFI_SUCCESS Status code reported to post 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 ((EFI_D_INFO, "POSTCODE=<%02x>\n", PostCodeValue)); + PostCode (PostCodeValue); + } + + return EFI_SUCCESS; +} + +/** + Register status code callback function only when Report Status Code protocol + is installed. + + @param Protocol Points to the protocol's unique identifier. + @param Interface Points to the interface instance. + @param Handle The handle on which the interface was installed. + + @retval EFI_SUCCESS Notification runs successfully. + +**/ +EFI_STATUS +EFIAPI +RegisterPostCodeBootTimeHandlers ( + IN CONST EFI_GUID *Protocol, + IN VOID *Interface, + IN EFI_HANDLE Handle + ) +{ + EFI_STATUS Status; + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; + + Status = gSmst->SmmLocateProtocol ( + &gEfiSmmRscHandlerProtocolGuid, + NULL, + (VOID **) &RscHandlerProtocol + ); + ASSERT_EFI_ERROR (Status); + + RscHandlerProtocol->Register (PostCodeStatusCodeReportWorker); + + return EFI_SUCCESS; +} + +/** + Constructor function of SmmPostCodeStatusCodeHandlerLib. + + This function allocates memory for extended status code data, caches + the report status code service, and registers events. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +SmmPostCodeStatusCodeHandlerLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *Registration; + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; + + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { + return EFI_SUCCESS; + } + + Status = gSmst->SmmLocateProtocol ( + &gEfiSmmRscHandlerProtocolGuid, + NULL, + (VOID **) &RscHandlerProtocol + ); + if (!EFI_ERROR (Status)) { + RegisterPostCodeBootTimeHandlers (NULL, NULL, NULL); + } else { + gSmst->SmmRegisterProtocolNotify ( + &gEfiSmmRscHandlerProtocolGuid, + RegisterPostCodeBootTimeHandlers, + &Registration + ); + } + + return EFI_SUCCESS; +} diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf new file mode 100644 index 0000000000..7cc357fd49 --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf @@ -0,0 +1,50 @@ +## @file +# PostCode status code implementation. +# +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# vendor. This file may not be modified, except as allowed by +# additional terms of your license agreement. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SmmPostCodeStatusCodeHandlerLib + FILE_GUID = AE5C0A80-309A-42F7-BFDD-80CDA1BA2D7E + MODULE_TYPE = DXE_SMM_DRIVER + VERSION_STRING = 1.0 + CONSTRUCTOR = SmmPostCodeStatusCodeHandlerLibConstructor + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_SMM_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) +# + +[Sources] + SmmPostCodeStatusCodeHandlerLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec + +[LibraryClasses] + SmmServicesTableLib + DebugLib + PcdLib + ReportStatusCodeLib + PostCodeMapLib + PostCodeLib + +[Pcd] + gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode ## CONSUMES + +[Protocols] + gEfiSmmRscHandlerProtocolGuid ## CONSUMES + +[Depex] + TRUE diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec new file mode 100644 index 0000000000..5ba7b30ab6 --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec @@ -0,0 +1,32 @@ +## @file +# This package provides PostCode Debug feature. +# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION = 0x00010017 + PACKAGE_NAME = PostCodeDebugFeaturePkg + PACKAGE_GUID = A579E0A8-0D27-4CA6-900E-D613003729DE + PACKAGE_VERSION = 0.1 + +[Includes] + Include + +[LibraryClasses] + ## @libraryclass Provide the function to map the status code to post code. + PostCodeMapLib|Include/Library/PostCodeMapLib.h + +[Guids] + gPostCodeDebugFeaturePkgTokenSpaceGuid = {0x68886ac8, 0x7a29, 0x4845, {0xa7, 0x02, 0xe9, 0x83, 0xc8, 0x7f, 0xfb, 0xab}} + +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] + gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode|FALSE|BOOLEAN|0x00000001 diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dsc b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dsc new file mode 100644 index 0000000000..4f0bec4a6f --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dsc @@ -0,0 +1,30 @@ +## @file +# This package provides PostCode Debug feature. +# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + PLATFORM_NAME = PostCodeFeaturePkg + PLATFORM_GUID = 4ADE0B1A-7929-495D-A221-6576C7884CAC + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES = IA32|X64 + BUILD_TARGETS = DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER = DEFAULT + PEI_ARCH = IA32 + DXE_ARCH = X64 + +# +# This package always builds the feature. +# +!include Include/PostCodeDebugFeature.dsc diff --git a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md new file mode 100644 index 0000000000..c49db35999 --- /dev/null +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md @@ -0,0 +1,117 @@ +# Overview +* **Feature Name:** Post Code Debug +* **PI Phase(s) Supported:** PEI, DXE, SMM +* **SMM Required?** Yes + +More Information: + +## Purpose +The PostCodeDebugFeaturePkg include some useful post code debug libraries, such as get post code from status code and show it. +This is an important capability in firmware development to get and analyze the post code. + + +# High-Level Theory of Operation +It provide a library PostCodeStatusCodeHandlerLib used by edk2 StatusCodeHandler.efi, used to show the post code. +It also provide a library of PostCodeMap lib, it map the status code to post code. +A library of PostCode lib is needed by platform. + +In the library contstructor function, PostCodeStatusCodeHandlerLib register the call back function for ReportStatusCode. +When called, it call GetPostCodeFromStatusCode() in PostCodeMapLib to get post code from status code, and call PostCode() in PostCodeLib to show the post code. + +PostCodeStatusCodeHandlerLib include 3 libraries for PEI, RuntimeDxe, SMM: +* PeiPostCodeStatusCodeHandlerLib +* RuntimeDxePostCodeStatusCodeHandlerLib +* SmmPostCodeStatusCodeHandlerLib + +## Firmware Volumes +Linked with StatusCodeHandler.efi, and make sure put the StatusCodeHandler.efi after the ReportStatusCodeRouter.efi. + +## Modules +* PostCodeStatusCodeHandlerLib +* PostCodeMapLib + +## PostCodeStatusCodeHandlerLib +This library register the call back function for ReportStatusCode, and get post code from status code, and show post code. + +## PostCodeMapLib +This library provide a function to get post code from status code. + +## Key Functions +* In PeiPostCodeStatusCodeHandlerLib: + EFI_STATUS + EFIAPI + PostCodeStatusCodeReportWorker ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN CONST EFI_GUID *CallerId, + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL + ) + +* In RuntimeDxePostCodeStatusCodeHandlerLib: + 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 + ) + +* In SmmPostCodeStatusCodeHandlerLib: + 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 + ) + +* In PostCodeMapLib: + UINT32 + EFIAPI + GetPostCodeFromStatusCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value + ) + +## Configuration +* Link the library to StatusCodeHandler.efi. + Example: + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf { + <LibraryClasses> + NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf + } + Refer to PostCodeDebugFeature.dsc for other example. +* Config PCD gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode. + In platform .dsc file, need to config the type of gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode. + Use PcdsFixedAtBuild to save binary size, and use PcdsDynamic if want to enable/disable in runtime. +* Implemented platform's special PostCodeMapLib if needed. +* Provide the platform's special PostCodeLib. +* Make sure put the StatusCodeHandler.efi after the ReportStatusCodeRouter.efi. + +## Data Flows +Status Code (ReportStatusCode) -> Post Code (GetPostCodeFromStatusCode). + +## Control Flows +ReportStatusCode() -> PostCodeStatusCodeReportWorker() -> GetPostCodeFromStatusCode() -> PostCode() + +## Build Flows +There is not special build flows. + +## Test Point Results +Verify the post code shown is correct. + +## Functional Exit Criteria +N/A + +## Feature Enabling Checklist +* Set the PCD gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode to TRUE. +* The post code can be shown. + +## Common Optimizations +* Implemented platform's special PostCodeMapLib if needed. -- 2.24.0.windows.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v7 2/2] Features/Intel/PostCodeDebugFeaturePkg: add it. 2020-06-16 11:25 ` [PATCH v7 2/2] Features/Intel/PostCodeDebugFeaturePkg: " Tan, Ming @ 2020-06-18 0:46 ` Dandan Bi 0 siblings, 0 replies; 5+ messages in thread From: Dandan Bi @ 2020-06-18 0:46 UTC (permalink / raw) To: devel@edk2.groups.io, Tan, Ming; +Cc: Dong, Eric, Gao, Liming Reviewed-by: Dandan Bi <dandan.bi@intel.com> Thanks, Dandan > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tan, > Ming > Sent: Tuesday, June 16, 2020 7:26 PM > To: devel@edk2.groups.io > Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com> > Subject: [edk2-devel] [PATCH v7 2/2] > Features/Intel/PostCodeDebugFeaturePkg: add it. > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2478 > > The PostCodeDebugFeaturePkg include some useful post code debug > libraries, such as get post code from status code and show it. > > It provide a library PostCodeStatusCodeHandlerLib used by edk2 > StatusCodeHandler.efi, used to show the post code. > It also provide a library of PostCodeMap lib, it map the status code > to post code. > > Cc: Eric Dong <eric.dong@intel.com> > Cc: Liming Gao <liming.gao@intel.com> > Signed-off-by: Ming Tan <ming.tan@intel.com> > --- > V7: Add the dec files in AdvancedFeaturesPcd.dsc. Combine Beep and > PostCode to 2/2 patchs. > And change to same V7 of Beep. > V4: In dec files, change the PcdStatusCodeUsePostCode default to FALSE. > V3: Modify according Eric's comments. > Modify some bugs about dsc file when it is included. > Update Readme.md. > V2: Delete the last empty line in > PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf > .../Include/AdvancedFeaturesPcd.dsc | 1 + > .../Include/Library/PostCodeMapLib.h | 32 +++ > .../Include/PostCodeDebugFeature.dsc | 200 +++++++++++++ > .../PlatformStatusCodesInternal.h | 270 ++++++++++++++++++ > .../Library/PostCodeMapLib/PostCodeMapLib.c | 207 ++++++++++++++ > .../Library/PostCodeMapLib/PostCodeMapLib.inf | 27 ++ > .../PeiPostCodeStatusCodeHandlerLib.c | 102 +++++++ > .../PeiPostCodeStatusCodeHandlerLib.inf | 49 ++++ > .../RuntimeDxePostCodeStatusCodeHandlerLib.c | 188 ++++++++++++ > ...RuntimeDxePostCodeStatusCodeHandlerLib.inf | 51 ++++ > .../SmmPostCodeStatusCodeHandlerLib.c | 141 +++++++++ > .../SmmPostCodeStatusCodeHandlerLib.inf | 50 ++++ > .../PostCodeDebugFeaturePkg.dec | 32 +++ > .../PostCodeDebugFeaturePkg.dsc | 30 ++ > .../PostCodeDebugFeaturePkg/Readme.md | 117 ++++++++ > 15 files changed, 1497 insertions(+) > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/Post > CodeMapLib.h > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCodeDe > bugFeature.dsc > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMa > pLib/PlatformStatusCodesInternal.h > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMa > pLib/PostCodeMapLib.c > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMa > pLib/PostCodeMapLib.inf > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeat > urePkg.dec > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeat > urePkg.dsc > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md > > diff --git > a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > index 366b551bd3..ad248de800 100644 > --- > a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > +++ > b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > @@ -25,6 +25,7 @@ > UserAuthFeaturePkg/UserAuthFeaturePkg.dec > > LogoFeaturePkg/LogoFeaturePkg.dec > > BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec > > > > # > > # The section below sets all PCDs to FALSE in this DSC file so the feature is > not enabled by default. > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/Po > stCodeMapLib.h > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/Po > stCodeMapLib.h > new file mode 100644 > index 0000000000..834be623a1 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/Po > stCodeMapLib.h > @@ -0,0 +1,32 @@ > +/** @file > > + This library class provides Platform PostCode Map. > > + > > + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef __POST_CODE_MAP_LIB__ > > +#define __POST_CODE_MAP_LIB__ > > + > > +/** > > + Get PostCode from status code type and value. > > + > > + @param CodeType Indicates the type of status code being reported. > > + @param 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. > > + > > + @return PostCode > > + > > +**/ > > +UINT32 > > +EFIAPI > > +GetPostCodeFromStatusCode ( > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value > > + ); > > + > > +#endif > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCode > DebugFeature.dsc > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCode > DebugFeature.dsc > new file mode 100644 > index 0000000000..2852b9cf7c > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCode > DebugFeature.dsc > @@ -0,0 +1,200 @@ > +## @file > > +# This package provides PostCode Debug feature. > > +# This file should be included into another package DSC file to build this > feature. > > +# > > +# The DEC files are used by the utilities that parse DSC and > > +# INF files to generate AutoGen.c and AutoGen.h files > > +# for the build infrastructure. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +######################################################### > ####################### > > +# > > +# Defines Section - statements that will be processed to create a Makefile. > > +# > > +######################################################### > ####################### > > +[Defines] > > +!ifndef $(PEI_ARCH) > > + !error "PEI_ARCH must be specified to build this feature!" > > +!endif > > +!ifndef $(DXE_ARCH) > > + !error "DXE_ARCH must be specified to build this feature!" > > +!endif > > + > > +######################################################### > ####################### > > +# > > +# PCD Section - list of PCD Entries modified by the feature. > > +# > > +######################################################### > ####################### > > + > > +# Unmark the following and StatusCodeHandler.efi to build the .dsc file > directly > > +#[PcdsDynamicDefault] > > +# > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode| > TRUE > > + > > +######################################################### > ####################### > > +# > > +# Library Class section - list of all Library Classes needed by this feature. > > +# > > +######################################################### > ####################### > > +[LibraryClasses] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf > > + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf > > + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf > > + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf > > + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf > > + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf > > + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf > > + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf > > + > TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTem > plate.inf > > + > UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo > otServicesTableLib.inf > > + > UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry > Point.inf > > + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf > > + > UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib > /UefiRuntimeServicesTableLib.inf > > + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf > > + > > +[LibraryClasses.common.PEIM] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf > > + > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemory > AllocationLib.inf > > + > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/P > eiServicesTablePointerLibIdt.inf > > + > > +[LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE,LibraryClasses.IA32 > .SEC] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + > ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiR > eportStatusCodeLib.inf > > + > > +[LibraryClasses.common.DXE_DRIVER] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf > > + > > +[LibraryClasses.common.DXE_RUNTIME_DRIVER] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf > > + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf > > + > ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCod > eLib/RuntimeDxeReportStatusCodeLib.inf > > + > > +[LibraryClasses.common.UEFI_DRIVER] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf > > + > > +[LibraryClasses.X64.DXE_SMM_DRIVER] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT > ableLib.inf > > + > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe > moryAllocationLib.inf > > + SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf > > + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf > > + > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/S > mmReportStatusCodeLib.inf > > + > > +######################################################### > ####################### > > +# > > +# Component section - list of all components that need built for this feature. > > +# > > +# Note: The EDK II DSC file is not used to specify how compiled binary > images get placed > > +# into firmware volume images. This section is just a list of modules to > compile from > > +# source into UEFI-compliant binaries. > > +# It is the FDF file that contains information on combining binary files into > firmware > > +# volume images, whose concept is beyond UEFI and is described in PI > specification. > > +# There may also be modules listed in this section that are not required > in the FDF file, > > +# When a module listed here is excluded from FDF file, then UEFI- > compliant binary will be > > +# generated for it, but the binary will not be put into any firmware > volume. > > +# > > +######################################################### > ####################### > > +# > > +# Feature PEI Components > > +# > > + > > +# @todo: Change below line to [Components.$(PEI_ARCH)] after > https://bugzilla.tianocore.org/show_bug.cgi?id=2308 > > +# is completed. > > +[Components.IA32] > > + ##################################### > > + # PostCode Debug Feature Package > > + ##################################### > > + > > + # Add library instances here that are not included in package components > and should be tested > > + # in the package build. > > + > PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPost > CodeStatusCodeHandlerLib.inf > > + > > + # The following is an example for used with StatusCodeHandler: > > +# > MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.in > f { > > +# <LibraryClasses> > > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf > > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > f > > +# > PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDeb > ug.inf > > +# > PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/Post > CodeMapLib.inf > > +# > NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/P > eiPostCodeStatusCodeHandlerLib.inf > > +# } > > + > > + # Add components here that should be included in the package build. > > + > > +# > > +# Feature DXE Components > > +# > > + > > +# @todo: Change below line to [Components.$(DXE_ARCH)] after > https://bugzilla.tianocore.org/show_bug.cgi?id=2308 > > +# is completed. > > +[Components.X64] > > + ##################################### > > + # PostCode Debug Feature Package > > + ##################################### > > + > > + # Add library instances here that are not included in package components > and should be tested > > + # in the package build. > > + > PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/Runtim > eDxePostCodeStatusCodeHandlerLib.inf > > + > PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPo > stCodeStatusCodeHandlerLib.inf > > + > > + # The following is an example for used with StatusCodeHandler: > > +# > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan > dlerRuntimeDxe.inf { > > +# <LibraryClasses> > > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf > > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > f > > +# > PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDeb > ug.inf > > +# > PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/Post > CodeMapLib.inf > > +# > NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/R > untimeDxePostCodeStatusCodeHandlerLib.inf > > +# } > > + > > +# > MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSm > m.inf { > > +# <LibraryClasses> > > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf > > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > f > > +# > PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDeb > ug.inf > > +# > PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/Post > CodeMapLib.inf > > +# > NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/S > mmPostCodeStatusCodeHandlerLib.inf > > +# } > > + > > + # Add components here that should be included in the package build. > > + > > +######################################################### > ########################################## > > +# > > +# BuildOptions Section - Define the module specific tool chain flags that > should be used as > > +# the default flags for a module. These flags are appended to > any > > +# standard flags that are defined by the build process. They can > be > > +# applied for any modules or only those modules with the > specific > > +# module style (EDK or EDKII) specified in [Components] section. > > +# > > +# For advanced features, it is recommended to enable > [BuildOptions] in > > +# the applicable INF file so it does not affect the whole board > package > > +# build when this DSC file is active. > > +# > > +######################################################### > ########################################## > > +[BuildOptions] > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PlatformStatusCodesInternal.h > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PlatformStatusCodesInternal.h > new file mode 100644 > index 0000000000..7c8daf052d > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PlatformStatusCodesInternal.h > @@ -0,0 +1,270 @@ > +/** @file > > + PostCode status code definition. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef __PLATFORM_STATUS_CODES_INTERNAL_H__ > > +#define __PLATFORM_STATUS_CODES_INTERNAL_H__ > > + > > +#include <Pi/PiStatusCode.h> > > + > > +typedef struct{ > > + EFI_STATUS_CODE_VALUE Value; > > + UINT32 Data; > > +} STATUS_CODE_TO_DATA_MAP; > > + > > +// > > +// Enable PEI/DXE status code > > +// > > +#define PEI_STATUS_CODE 1 > > +#define DXE_STATUS_CODE 1 > > + > > +#define STATUS_CODE_TYPE(Type) > ((Type)&EFI_STATUS_CODE_TYPE_MASK) > > +#define STATUS_CODE_CLASS(Value) > ((Value)&EFI_STATUS_CODE_CLASS_MASK) > > + > > +//Progress/Error codes > > +#define PEI_CORE_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_PC_ENTRY_POINT) > > +#define PEI_RESET_NOT_AVAILABLE (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PS_EC_RESET_NOT_AVAILABLE) > > +#define PEI_DXEIPL_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND) > > +#define PEI_DXE_CORE_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_EC_DXE_CORRUPT) > > +#define PEI_S3_RESUME_ERROR (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_EC_S3_RESUME_FAILED) > > +#define PEI_RECOVERY_FAILED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_EC_RECOVERY_FAILED) > > +#define DXE_CORE_STARTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_ENTRY_POINT) > > + > > +//#define DXE_EXIT_BOOT_SERVICES_BEGIN 0xF8 > > +#define DXE_EXIT_BOOT_SERVICES_END > (EFI_SOFTWARE_EFI_BOOT_SERVICE | > EFI_SW_BS_PC_EXIT_BOOT_SERVICES) > > + > > +// Reported by CPU PEIM > > +#define PEI_CAR_CPU_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_PC_POWER_ON_INIT) > > + > > +// Reported by NB PEIM > > +//#define PEI_CAR_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CU_CHIPSET_NORTH_INIT) > > + > > +// Reported by SB PEIM > > +//#define PEI_CAR_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CU_CHIPSET_PC_SOUTH_INIT) > > + > > +//Reported by Memory Detection PEIM > > +#define PEI_MEMORY_SPD_READ > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_SPD_READ) > > +#define PEI_MEMORY_PRESENCE_DETECT > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_PC_PRESENCE_DETECT) > > +#define PEI_MEMORY_TIMING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TIMING) > > +#define PEI_MEMORY_CONFIGURING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_CONFIGURING) > > +#define PEI_MEMORY_OPTIMIZING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_OPTIMIZING) > > +#define PEI_MEMORY_INIT (EFI_COMPUTING_UNIT_MEMORY > | EFI_CU_MEMORY_PC_INIT) > > +#define PEI_MEMORY_TEST (EFI_COMPUTING_UNIT_MEMORY > | EFI_CU_MEMORY_PC_TEST) > > +#define PEI_MEMORY_INVALID_TYPE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_TYPE) > > +#define PEI_MEMORY_INVALID_SPEED > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SPEED) > > +#define PEI_MEMORY_SPD_FAIL > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_SPD_FAIL) > > +#define PEI_MEMORY_INVALID_SIZE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SIZE) > > +#define PEI_MEMORY_MISMATCH > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) > > +#define PEI_MEMORY_S3_RESUME_FAILED > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_S3_RESUME_FAIL) > > +#define PEI_MEMORY_NOT_DETECTED > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_NONE_DETECTED) > > +#define PEI_MEMORY_NONE_USEFUL > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_USEFUL) > > +#define PEI_MEMORY_ERROR > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NON_SPECIFIC) > > +#define PEI_MEMORY_INSTALLED (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PS_PC_INSTALL_PEI_MEMORY) > > +#define PEI_MEMORY_NOT_INSTALLED > (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED) > > +#define PEI_MEMORY_INSTALLED_TWICE > (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PS_EC_MEMORY_INSTALLED_TWICE) > > + > > +//Reported by CPU PEIM > > +#define PEI_CPU_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_PC_INIT_BEGIN) > > +#define PEI_CPU_CACHE_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACHE_INIT) > > +#define PEI_CPU_BSP_SELECT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT) > > +#define PEI_CPU_AP_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT) > > +#define PEI_CPU_SMM_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_SMM_INIT) > > +#define PEI_CPU_INVALID_TYPE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_INVALID_TYPE) > > +#define PEI_CPU_INVALID_SPEED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_INVALID_SPEED) > > +#define PEI_CPU_MISMATCH > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MISMATCH) > > +#define PEI_CPU_SELF_TEST_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) > > +#define PEI_CPU_CACHE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CACHE) > > +#define PEI_CPU_MICROCODE_UPDATE_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_MICROCODE_UPDATE) > > +#define PEI_CPU_NO_MICROCODE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_NO_MICROCODE_UPDATE) > > +//If non of the errors above apply use this one > > +#define PEI_CPU_INTERNAL_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INTERNAL) > > +//Generic CPU error. It should only be used if non of the errors above apply > > +#define PEI_CPU_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NON_SPECIFIC) > > + > > +// Reported by NB PEIM > > +#define PEI_MEM_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_PEI_MEM_NB_INIT) > > +// Reported by SB PEIM > > +#define PEI_MEM_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_PEI_MEM_SB_INIT) > > + > > +//Reported by PEIM which detected forced or auto recovery condition > > +#define PEI_RECOVERY_AUTO (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_AUTO) > > +#define PEI_RECOVERY_USER (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_USER) > > + > > +//Reported by DXE IPL > > +#define PEI_RECOVERY_PPI_NOT_FOUND > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND) > > +#define PEI_S3_RESUME_PPI_NOT_FOUND > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND) > > +#define PEI_S3_RESUME_FAILED (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_S3_RESUME_FAILED) > > + > > +//Reported by Recovery PEIM > > +#define PEI_RECOVERY_STARTED (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_BEGIN) > > +#define PEI_RECOVERY_CAPSULE_FOUND > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_LOAD) > > +#define PEI_RECOVERY_NO_CAPSULE > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE) > > +#define PEI_RECOVERY_CAPSULE_LOADED > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START) > > +#define PEI_RECOVERY_INVALID_CAPSULE > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR) > > + > > +//Reported by S3 Resume PEIM > > +#define PEI_S3_BOOT_SCRIPT (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_S3_BOOT_SCRIPT) > > +#define PEI_S3_OS_WAKE (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_OS_WAKE) > > +#define PEI_S3_BOOT_SCRIPT_ERROR > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_BOOT_SCRIPT_ERROR) > > +#define PEI_S3_OS_WAKE_ERROR (EFI_SOFTWARE_PEI_MODULE > | EFI_SW_PEI_EC_S3_OS_WAKE_ERROR) > > + > > +#define PEI_PEIM_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PC_INIT_BEGIN) > > +#define PEI_PEIM_ENDED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PC_INIT_END) > > + > > +//Reported by DXE IPL > > +#define PEI_DXE_IPL_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT) > > + > > +//Reported by PEIM which installs Reset PPI > > +#define PEI_RESET_SYSTEM (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PS_PC_RESET_SYSTEM) > > + > > +//Reported by the PEIM or DXE driver which detected the error > > +#define GENERIC_MEMORY_CORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_CORRECTABLE) > > +#define GENERIC_MEMORY_UNCORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_UNCORRECTABLE) > > + > > +//Reported by Flash Update DXE driver > > +#define DXE_FLASH_UPDATE_FAILED > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UPDATE_FAIL) > > + > > +//Reported by the PEIM or DXE driver which detected the error > > +#define GENERIC_CPU_THERMAL_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_THERMAL) > > +#define GENERIC_CPU_LOW_VOLTAGE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_LOW_VOLTAGE) > > +#define GENERIC_CPU_HIGH_VOLTAGE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_HIGH_VOLTAGE) > > +#define GENERIC_CPU_CORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_CORRECTABLE) > > +#define GENERIC_CPU_UNCORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_UNCORRECTABLE) > > +#define GENERIC_BAD_DATE_TIME_ERROR > (EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_BAD_DATE_TIME) > > +#define GENERIC_MEMORY_SIZE_DECREASE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) > > + > > +//Reported by DXE Core > > +#define DXE_DRIVER_STARTED > (EFI_SOFTWARE_EFI_DXE_SERVICE | EFI_SW_PC_INIT_BEGIN) > > +#define DXE_DRIVER_ENED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_PC_INIT_END) > > +#define DXE_ARCH_PROTOCOLS_AVAILABLE > (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ARCH_READY) > > +#define DXE_DRIVER_CONNECTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_START_DRIVER) > > +#define DXE_ARCH_PROTOCOL_NOT_AVAILABLE > (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH) > > + > > +//Reported by DXE CPU driver > > +#define DXE_CPU_SELF_TEST_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) > > + > > +//Reported by PCI Host Bridge driver > > +#define DXE_NB_HB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_HB_INIT ) > > + > > +// Reported by NB Driver > > +#define DXE_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_NB_INIT ) > > +#define DXE_NB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_NB_SMM_INIT ) > > +#define DXE_NB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_EC_DXE_NB_ERROR ) > > + > > +// Reported by SB Driver(s) > > +#define DXE_SBRUN_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_SB_RT_INIT ) > > +#define DXE_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_SB_INIT ) > > +#define DXE_SB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_SB_SMM_INIT ) > > +#define DXE_SB_DEVICES_INIT (EFI_COMPUTING_UNIT_CHIPSET > | EFI_CHIPSET_PC_DXE_SB_DEVICES_INIT ) > > +#define DXE_SB_BAD_BATTERY (EFI_COMPUTING_UNIT_CHIPSET > | EFI_CHIPSET_EC_BAD_BATTERY) > > +#define DXE_SB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_EC_DXE_SB_ERROR ) > > + > > +//Reported by DXE Core > > +#define DXE_BDS_STARTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT) > > + > > +//Reported by BDS > > +//#define DXE_BDS_CONNECT_DRIVERS > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS) > > + > > +//Reported by Boot Manager > > +#define DXE_READY_TO_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER > | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT) > > + > > +//Reported by DXE Core > > +#define DXE_EXIT_BOOT_SERVICES > (EFI_SOFTWARE_EFI_BOOT_SERVICE | > EFI_SW_BS_PC_EXIT_BOOT_SERVICES) > > +#define DXE_EXIT_BOOT_SERVICES_EVENT > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_EXIT_BOOT_SERVICES_EVENT) > > + > > +//Reported by driver that installs Runtime AP > > +#define RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | > EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP) > > +#define RT_SET_VIRTUAL_ADDRESS_MAP_END > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT) > > + > > +//Reported by CSM > > +#define DXE_LEGACY_OPROM_INIT > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_LEGACY_OPROM_INIT) > > +#define DXE_LEGACY_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT) > > +#define DXE_LEGACY_OPROM_NO_SPACE > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_LEGACY_OPROM_NO_SPACE) > > + > > +//Reported by SETUP > > +//#define DXE_SETUP_VERIFYING_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD) > > +#define DXE_SETUP_START (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_PC_USER_SETUP) > > +#define DXE_SETUP_INPUT_WAIT > (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT) > > +#define DXE_INVALID_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_INVALID_PASSWORD) > > +#define DXE_INVALID_IDE_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_INVALID_IDE_PASSWORD) > > +#define DXE_BOOT_OPTION_LOAD_ERROR > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) > > +#define DXE_BOOT_OPTION_FAILED > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED) > > + > > +//Reported by a Driver that installs Reset AP > > +#define DXE_RESET_SYSTEM > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM) > > +#define DXE_RESET_NOT_AVAILABLE > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | > EFI_SW_PS_EC_RESET_NOT_AVAILABLE) > > + > > +// Reported by PCI bus driver > > +#define DXE_PCI_BUS_BEGIN (EFI_IO_BUS_PCI | > EFI_IOB_PC_INIT) > > +#define DXE_PCI_BUS_ENUM (EFI_IO_BUS_PCI | > EFI_IOB_PCI_BUS_ENUM) > > +#define DXE_PCI_BUS_HPC_INIT (EFI_IO_BUS_PCI | > EFI_IOB_PCI_HPC_INIT) > > +#define DXE_PCI_BUS_REQUEST_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_PCI_RES_ALLOC) > > +#define DXE_PCI_BUS_ASSIGN_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_PC_ENABLE) > > +#define DXE_PCI_BUS_HOTPLUG (EFI_IO_BUS_PCI | > EFI_IOB_PC_HOTPLUG) > > +#define DXE_PCI_BUS_OUT_OF_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_EC_RESOURCE_CONFLICT) > > + > > +// Reported by USB bus driver > > +#define DXE_USB_BEGIN (EFI_IO_BUS_USB | EFI_IOB_PC_INIT) > > +#define DXE_USB_RESET (EFI_IO_BUS_USB | > EFI_IOB_PC_RESET) > > +#define DXE_USB_DETECT (EFI_IO_BUS_USB | > EFI_IOB_PC_DETECT) > > +#define DXE_USB_ENABLE (EFI_IO_BUS_USB | > EFI_IOB_PC_ENABLE) > > +#define DXE_USB_HOTPLUG (EFI_IO_BUS_USB | > EFI_IOB_PC_HOTPLUG) > > + > > +//Reported by IDE bus driver > > +#define DXE_IDE_BEGIN (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_INIT) > > +#define DXE_IDE_RESET (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_RESET) > > +#define DXE_IDE_DETECT (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_DETECT) > > +#define DXE_IDE_ENABLE (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_ENABLE) > > +#define DXE_IDE_SMART_ERROR (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD) > > +#define DXE_IDE_CONTROLLER_ERROR (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_EC_CONTROLLER_ERROR) > > +#define DXE_IDE_DEVICE_FAILURE (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_EC_INTERFACE_ERROR) > > + > > +// Reported by SCSI bus driver > > +#define DXE_SCSI_BEGIN (EFI_IO_BUS_SCSI | EFI_IOB_PC_INIT) > > +#define DXE_SCSI_RESET (EFI_IO_BUS_SCSI | > EFI_IOB_PC_RESET) > > +#define DXE_SCSI_DETECT (EFI_IO_BUS_SCSI | > EFI_IOB_PC_DETECT) > > +#define DXE_SCSI_ENABLE (EFI_IO_BUS_SCSI | > EFI_IOB_PC_ENABLE) > > + > > +// Reported by Super I/O driver > > +#define DXE_SIO_INIT (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT) > > + > > +// Reported by Keyboard driver > > +#define DXE_KEYBOARD_INIT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_INIT) > > +#define DXE_KEYBOARD_RESET (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_RESET) > > +#define DXE_KEYBOARD_DISABLE (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_DISABLE) > > +#define DXE_KEYBOARD_DETECT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_PRESENCE_DETECT) > > +#define DXE_KEYBOARD_ENABLE (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_ENABLE) > > +#define DXE_KEYBOARD_CLEAR_BUFFER > (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER) > > +#define DXE_KEYBOARD_SELF_TEST (EFI_PERIPHERAL_KEYBOARD | > EFI_P_KEYBOARD_PC_SELF_TEST) > > + > > +// Reported by Mouse driver > > +#define DXE_MOUSE_INIT (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_INIT) > > +#define DXE_MOUSE_RESET (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_RESET) > > +#define DXE_MOUSE_DISABLE (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_DISABLE) > > +#define DXE_MOUSE_DETECT (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_PRESENCE_DETECT) > > +#define DXE_MOUSE_ENABLE (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_ENABLE) > > + > > +// Reported by Mass Storage drivers > > +#define DXE_FIXED_MEDIA_INIT (EFI_PERIPHERAL_FIXED_MEDIA > | EFI_P_PC_INIT) > > +#define DXE_FIXED_MEDIA_RESET (EFI_PERIPHERAL_FIXED_MEDIA > | EFI_P_PC_RESET) > > +#define DXE_FIXED_MEDIA_DISABLE > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_DISABLE) > > +#define DXE_FIXED_MEDIA_DETECT > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_PRESENCE_DETECT) > > +#define DXE_FIXED_MEDIA_ENABLE > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENABLE) > > +#define DXE_REMOVABLE_MEDIA_INIT > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_INIT) > > +#define DXE_REMOVABLE_MEDIA_RESET > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET) > > +#define DXE_REMOVABLE_MEDIA_DISABLE > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE) > > +#define DXE_REMOVABLE_MEDIA_DETECT > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_PRESENCE_DETECT) > > +#define DXE_REMOVABLE_MEDIA_ENABLE > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE) > > + > > + > > +// Reported by BDS > > +#define DXE_CON_OUT_CONNECT > (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_INIT) > > +#define DXE_CON_IN_CONNECT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_INIT) > > +#define DXE_NO_CON_OUT > (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED) > > +#define DXE_NO_CON_IN (EFI_PERIPHERAL_KEYBOARD | > EFI_P_EC_NOT_DETECTED) > > + > > +#endif > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.c > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.c > new file mode 100644 > index 0000000000..2246e59f8b > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.c > @@ -0,0 +1,207 @@ > +/** @file > > + PostCodeMap implementation. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Base.h> > > +#include <Uefi.h> > > + > > +#include "PlatformStatusCodesInternal.h" > > + > > +STATUS_CODE_TO_DATA_MAP mPostCodeProgressMap[] = { > > + // > > + // PEI > > + // > > + //Regular boot > > + { PEI_CORE_STARTED, 0x10 }, > > + { PEI_CAR_CPU_INIT, 0x11 }, > > + { PEI_MEMORY_SPD_READ, 0x1D }, > > + { PEI_MEMORY_PRESENCE_DETECT, 0x1E }, > > + { PEI_MEMORY_TIMING, 0x1F}, > > + { PEI_MEMORY_CONFIGURING, 0x20 }, > > + { PEI_MEMORY_INIT, 0x21 }, > > + { PEI_MEMORY_INSTALLED, 0x31 }, > > + { PEI_CPU_INIT, 0x32 }, > > + { PEI_CPU_CACHE_INIT, 0x33 }, > > + { PEI_CPU_BSP_SELECT, 0x34 }, > > + { PEI_CPU_AP_INIT, 0x35 }, > > + { PEI_CPU_SMM_INIT, 0x36 }, > > + { PEI_MEM_NB_INIT, 0x37 }, > > + { PEI_MEM_SB_INIT, 0x3B }, > > + { PEI_DXE_IPL_STARTED, 0x4F }, > > + //Recovery > > + { PEI_RECOVERY_AUTO, 0xF0 }, > > + { PEI_RECOVERY_USER, 0xF1 }, > > + { PEI_RECOVERY_STARTED, 0xF2 }, > > + { PEI_RECOVERY_CAPSULE_FOUND, 0xF3 }, > > + { PEI_RECOVERY_CAPSULE_LOADED, 0xF4 }, > > + //S3 > > + //{ PEI_S3_STARTED, 0xE0 }, > > + { PEI_S3_BOOT_SCRIPT, 0xE1 }, > > + //{ PEI_S3_VIDEO_REPOST, 0xE2 }, > > + { PEI_S3_OS_WAKE, 0xE3 }, > > + > > + // > > + // DXE > > + // > > + { DXE_CORE_STARTED, 0x1060 }, > > + { DXE_SBRUN_INIT, 0x1062 }, > > + { DXE_NB_HB_INIT, 0x1068 }, > > + { DXE_NB_INIT, 0x1069 }, > > + { DXE_NB_SMM_INIT, 0x106A }, > > + { DXE_SB_INIT, 0x1070 }, > > + { DXE_SB_SMM_INIT, 0x1071 }, > > + { DXE_SB_DEVICES_INIT, 0x1072 }, > > + { DXE_BDS_STARTED, 0x1090 }, > > + { DXE_PCI_BUS_BEGIN, 0x1092 }, > > + { DXE_PCI_BUS_HPC_INIT, 0x1093 }, > > + { DXE_PCI_BUS_ENUM, 0x1094 }, > > + { DXE_PCI_BUS_REQUEST_RESOURCES, 0x1095 }, > > + { DXE_PCI_BUS_ASSIGN_RESOURCES, 0x1096 }, > > + { DXE_CON_OUT_CONNECT, 0x1097 }, > > + { DXE_CON_IN_CONNECT, 0x1098 }, > > + { DXE_SIO_INIT, 0x1099 }, > > + { DXE_USB_BEGIN, 0x109A }, > > + { DXE_USB_RESET, 0x109B }, > > + { DXE_USB_DETECT, 0x109C }, > > + { DXE_USB_ENABLE, 0x109D }, > > + { DXE_IDE_BEGIN, 0x10A1 }, > > + { DXE_IDE_RESET, 0x10A2 }, > > + { DXE_IDE_DETECT, 0x10A3 }, > > + { DXE_IDE_ENABLE, 0x10A4 }, > > + { DXE_SCSI_BEGIN, 0x10A5 }, > > + { DXE_SCSI_RESET, 0x10A6 }, > > + { DXE_SCSI_DETECT, 0x10A7 }, > > + { DXE_SCSI_ENABLE, 0x10A8 }, > > + { DXE_SETUP_START, 0x10AB }, > > + { DXE_SETUP_INPUT_WAIT, 0x10AC }, > > + { DXE_READY_TO_BOOT, 0x10AD }, > > + { DXE_LEGACY_BOOT, 0x10AE }, > > + { DXE_EXIT_BOOT_SERVICES, 0x10AF }, > > + { RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN, 0x10B0 }, > > + { RT_SET_VIRTUAL_ADDRESS_MAP_END, 0x10B1 }, > > + { DXE_LEGACY_OPROM_INIT, 0x10B2 }, > > + { DXE_RESET_SYSTEM, 0x10B3 }, > > + { DXE_USB_HOTPLUG, 0x10B4 }, > > + { DXE_PCI_BUS_HOTPLUG, 0x10B5 }, > > + {0,0} > > +}; > > + > > +STATUS_CODE_TO_DATA_MAP mPostCodeErrorMap[] = { > > + // > > + // PEI > > + // > > + //Regular boot > > + { PEI_MEMORY_INVALID_TYPE, 0x50 }, > > + { PEI_MEMORY_INVALID_SPEED, 0x50 }, > > + { PEI_MEMORY_SPD_FAIL, 0x51 }, > > + { PEI_MEMORY_INVALID_SIZE, 0x52 }, > > + { PEI_MEMORY_MISMATCH, 0x52 }, > > + { PEI_MEMORY_NOT_DETECTED, 0x53 }, > > + { PEI_MEMORY_NONE_USEFUL, 0x53 }, > > + { PEI_MEMORY_ERROR, 0x54 }, > > + { PEI_MEMORY_NOT_INSTALLED, 0x55 }, > > + { PEI_CPU_INVALID_TYPE, 0x56 }, > > + { PEI_CPU_INVALID_SPEED, 0x56 }, > > + { PEI_CPU_MISMATCH, 0x57 }, > > + { PEI_CPU_SELF_TEST_FAILED, 0x58 }, > > + { PEI_CPU_CACHE_ERROR, 0x58 }, > > + { PEI_CPU_MICROCODE_UPDATE_FAILED, 0x59 }, > > + { PEI_CPU_NO_MICROCODE, 0x59 }, > > + { PEI_CPU_INTERNAL_ERROR, 0x5A }, > > + { PEI_CPU_ERROR, 0x5A }, > > + { PEI_RESET_NOT_AVAILABLE,0x5B }, > > + //Recovery > > + { PEI_RECOVERY_PPI_NOT_FOUND, 0xF8 }, > > + { PEI_RECOVERY_NO_CAPSULE, 0xF9 }, > > + { PEI_RECOVERY_INVALID_CAPSULE, 0xFA }, > > + //S3 Resume > > + { PEI_MEMORY_S3_RESUME_FAILED, 0xE8 }, > > + { PEI_S3_RESUME_PPI_NOT_FOUND, 0xE9 }, > > + { PEI_S3_BOOT_SCRIPT_ERROR, 0xEA }, > > + { PEI_S3_OS_WAKE_ERROR, 0xEB }, > > + > > + // > > + // DXE > > + // > > + { DXE_CPU_SELF_TEST_FAILED, 0x1058 }, > > + { DXE_NB_ERROR, 0x10D1 }, > > + { DXE_SB_ERROR, 0x10D2 }, > > + { DXE_ARCH_PROTOCOL_NOT_AVAILABLE, 0x10D3 }, > > + { DXE_PCI_BUS_OUT_OF_RESOURCES, 0x10D4 }, > > + { DXE_LEGACY_OPROM_NO_SPACE, 0x10D5 }, > > + { DXE_NO_CON_OUT, 0x10D6 }, > > + { DXE_NO_CON_IN, 0x10D7 }, > > + { DXE_INVALID_PASSWORD, 0x10D8 }, > > + { DXE_BOOT_OPTION_LOAD_ERROR, 0x10D9 }, > > + { DXE_BOOT_OPTION_FAILED, 0x10DA }, > > + { DXE_FLASH_UPDATE_FAILED, 0x10DB }, > > + { DXE_RESET_NOT_AVAILABLE, 0x10DC }, > > + {0,0} > > +}; > > + > > +STATUS_CODE_TO_DATA_MAP *mPostCodeStatusCodesMap[] = { > > + //#define EFI_PROGRESS_CODE 0x00000001 > > + mPostCodeProgressMap, > > + //#define EFI_ERROR_CODE 0x00000002 > > + mPostCodeErrorMap > > + //#define EFI_DEBUG_CODE 0x00000003 > > +}; > > + > > +/** > > + Find the post code data from status code value. > > + > > + @param Map The map used to find in. > > + @param Value The status code value. > > + > > + @return PostCode 0 for not found. > > + > > +**/ > > +UINT32 > > +FindPostCodeData ( > > + IN STATUS_CODE_TO_DATA_MAP *Map, > > + IN EFI_STATUS_CODE_VALUE Value > > + ) > > +{ > > + while (Map->Value != 0) { > > + if (Map->Value == Value) { > > + return Map->Data; > > + } > > + Map++; > > + } > > + return 0; > > +} > > + > > +/** > > + Get PostCode from status code type and value. > > + > > + @param CodeType Indicates the type of status code being reported. > > + @param 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. > > + > > + @return PostCode > > + > > +**/ > > +UINT32 > > +EFIAPI > > +GetPostCodeFromStatusCode ( > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value > > + ) > > +{ > > + UINT32 CodeTypeIndex; > > + > > + CodeTypeIndex = STATUS_CODE_TYPE (CodeType) - 1; > > + > > + if (CodeTypeIndex >= sizeof (mPostCodeStatusCodesMap) / > sizeof(mPostCodeStatusCodesMap[0])) { > > + return 0; > > + } > > + > > + return FindPostCodeData (mPostCodeStatusCodesMap[CodeTypeIndex], > Value); > > +} > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.inf > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.inf > new file mode 100644 > index 0000000000..18a8ac6116 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.inf > @@ -0,0 +1,27 @@ > +## @file > > +# Instance of Platform Post Code Map Library. > > +# > > +# Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010017 > > + BASE_NAME = PostCodeMapLib > > + FILE_GUID = 1C579857-5328-4304-8607-77B0BC978554 > > + VERSION_STRING = 1.0 > > + MODULE_TYPE = BASE > > + LIBRARY_CLASS = PostCodeMapLib > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC > > +# > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + > > +[Sources] > > + PostCodeMapLib.c > > + PlatformStatusCodesInternal.h > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..85d7a3d9a8 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c > @@ -0,0 +1,102 @@ > +/** @file > > + PostCode status code implementation. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Library/PeiServicesLib.h> > > +#include <Library/PeimEntryPoint.h> > > +#include <Library/PcdLib.h> > > +#include <Library/DebugLib.h> > > +#include <Library/ReportStatusCodeLib.h> > > +#include <Ppi/ReportStatusCodeHandler.h> > > + > > +#include <Library/PostCodeMapLib.h> > > +#include <Library/PostCodeLib.h> > > + > > +/** > > + Convert status code value and write data to post code. > > + > > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table > published by the PEI Foundation. > > + @param CodeType Indicates the type of status code being reported. > > + @param 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 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 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 Data This optional parameter may be used to pass > additional data. > > + > > + @retval EFI_SUCCESS Status code reported to post code successfully. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +PostCodeStatusCodeReportWorker ( > > + IN CONST EFI_PEI_SERVICES **PeiServices, > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value, > > + IN UINT32 Instance, > > + IN CONST EFI_GUID *CallerId, > > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL > > + ) > > +{ > > + UINT32 PostCodeValue; > > + > > + PostCodeValue = GetPostCodeFromStatusCode (CodeType, Value); > > + if (PostCodeValue != 0) { > > + DEBUG ((EFI_D_INFO, "POSTCODE=<%02x>\n", PostCodeValue)); > > + PostCode (PostCodeValue); > > + } > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Constructor function of PeiPostCodeStatusCodeHandlerLib. > > + > > + This function is the constructor function of this PostCode Status Code > Handler Library for PEI Phase. > > + It check whether need post code, and register it to > gEfiPeiRscHandlerPpiGuid. > > + > > + @param FileHandle Handle of the file being invoked. > > + @param PeiServices Describes the list of possible PEI Services. > > + > > + @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully. > > + > > +**/ > > +RETURN_STATUS > > +EFIAPI > > +PeiPostCodeStatusCodeHandlerLibConstructor ( > > + IN EFI_PEI_FILE_HANDLE FileHandle, > > + IN CONST EFI_PEI_SERVICES **PeiServices > > + ) > > +{ > > + EFI_STATUS Status; > > + EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi; > > + > > + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { > > + return RETURN_SUCCESS; > > + } > > + > > + Status = PeiServicesLocatePpi ( > > + &gEfiPeiRscHandlerPpiGuid, > > + 0, > > + NULL, > > + (VOID **) &RscHandlerPpi > > + ); > > + ASSERT_EFI_ERROR (Status); > > + > > + Status = RscHandlerPpi->Register (PostCodeStatusCodeReportWorker); > > + ASSERT_EFI_ERROR (Status); > > + > > + return RETURN_SUCCESS; > > +} > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..c27578fe90 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf > @@ -0,0 +1,49 @@ > +## @file > > +# PostCode status code implementation. > > +# > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +# vendor. This file may not be modified, except as allowed by > > +# additional terms of your license agreement. > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010005 > > + BASE_NAME = PeiPostCodeStatusCodeHandlerLib > > + FILE_GUID = FA32350A-63DB-4AC6-88D1-BC5327EE7ECE > > + MODULE_TYPE = PEIM > > + CONSTRUCTOR = PeiPostCodeStatusCodeHandlerLibConstructor > > + LIBRARY_CLASS = StatusCodeHandlerLib|SEC PEIM PEI_COR > > + > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > +# > > + > > +[Sources] > > + PeiPostCodeStatusCodeHandlerLib.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + MdeModulePkg/MdeModulePkg.dec > > + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec > > + > > +[LibraryClasses] > > + PeiServicesLib > > + DebugLib > > + PcdLib > > + ReportStatusCodeLib > > + PostCodeMapLib > > + PostCodeLib > > + > > +[Pcd] > > + > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode > ## CONSUMES > > + > > +[Ppis] > > + gEfiPeiRscHandlerPpiGuid ## CONSUMES > > + > > +[Depex] > > + TRUE > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..59b531fe7c > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c > @@ -0,0 +1,188 @@ > +/** @file > > + PostCode status code implementation. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Library/UefiDriverEntryPoint.h> > > +#include <Library/UefiBootServicesTableLib.h> > > +#include <Guid/EventGroup.h> > > +#include <Library/HobLib.h> > > +#include <Library/PcdLib.h> > > +#include <Library/DebugLib.h> > > +#include <Library/ReportStatusCodeLib.h> > > +#include <Protocol/ReportStatusCodeHandler.h> > > + > > +#include <Library/PostCodeMapLib.h> > > +#include <Library/PostCodeLib.h> > > + > > +EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL; > > +EFI_EVENT mExitBootServicesEvent = NULL; > > +BOOLEAN mRegisted = FALSE; > > + > > +/** > > + Convert status code value and write data to post code. > > + > > + @param CodeType Indicates the type of status code being reported. > > + @param 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 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 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 Data This optional parameter may be used to pass > additional data. > > + > > + @retval EFI_SUCCESS Status code reported to post 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 ((EFI_D_INFO, "POSTCODE=<%02x>\n", PostCodeValue)); > > + PostCode (PostCodeValue); > > + } > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Unregister status code callback functions only available at boot time from > > + report status code router when exiting boot services. > > + > > + @param Event Event whose notification function is being invoked. > > + @param Context Pointer to the notification function's context, which is > > + always zero in current implementation. > > + > > +**/ > > +VOID > > +EFIAPI > > +UnregisterPostCodeBootTimeHandlers ( > > + IN EFI_EVENT Event, > > + IN VOID *Context > > + ) > > +{ > > + if (mRegisted) { > > + mRscHandlerProtocol->Unregister (PostCodeStatusCodeReportWorker); > > + } > > +} > > + > > + > > + > > +/** > > + Register status code callback function only when Report Status Code > protocol > > + is installed. > > + > > + @param Event Event whose notification function is being invoked. > > + @param Context Pointer to the notification function's context, which is > > + always zero in current implementation. > > + > > +**/ > > +VOID > > +EFIAPI > > +RegisterPostCodeBootTimeHandlers ( > > + IN EFI_EVENT Event, > > + IN VOID *Context > > + ) > > +{ > > + EFI_STATUS Status; > > + > > + Status = gBS->LocateProtocol ( > > + &gEfiRscHandlerProtocolGuid, > > + NULL, > > + (VOID **) &mRscHandlerProtocol > > + ); > > + ASSERT_EFI_ERROR (Status); > > + > > + mRscHandlerProtocol->Register (PostCodeStatusCodeReportWorker, > TPL_HIGH_LEVEL); > > + ASSERT_EFI_ERROR (Status); > > + mRegisted = TRUE; > > + > > + Status = gBS->CreateEventEx ( > > + EVT_NOTIFY_SIGNAL, > > + TPL_NOTIFY, > > + UnregisterPostCodeBootTimeHandlers, > > + NULL, > > + &gEfiEventExitBootServicesGuid, > > + &mExitBootServicesEvent > > + ); > > + ASSERT_EFI_ERROR (Status); > > +} > > + > > +/** > > + Constructor function of RuntimeDxePostCodeStatusCodeHandlerLib. > > + > > + This function allocates memory for extended status code data, caches > > + the report status code service, and registers events. > > + > > + @param ImageHandle The firmware allocated handle for the EFI image. > > + @param SystemTable A pointer to the EFI System Table. > > + > > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RuntimeDxePostCodeStatusCodeHandlerLibConstructor ( > > + IN EFI_HANDLE ImageHandle, > > + IN EFI_SYSTEM_TABLE *SystemTable > > + ) > > +{ > > + EFI_STATUS Status; > > + EFI_EVENT RegisterStatusCodeHandlerEvent; > > + VOID *Registration; > > + > > + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { > > + return EFI_SUCCESS; > > + } > > + > > + Status = gBS->LocateProtocol ( > > + &gEfiRscHandlerProtocolGuid, > > + NULL, > > + (VOID **) &mRscHandlerProtocol > > + ); > > + > > + if (!EFI_ERROR (Status)) { > > + RegisterPostCodeBootTimeHandlers (NULL, NULL); > > + } else { > > + Status = gBS->CreateEvent ( > > + EVT_NOTIFY_SIGNAL, > > + TPL_NOTIFY, > > + RegisterPostCodeBootTimeHandlers, > > + NULL, > > + &RegisterStatusCodeHandlerEvent > > + ); > > + ASSERT_EFI_ERROR (Status); > > + > > + // > > + // Register for protocol notifications on this event > > + // > > + Status = gBS->RegisterProtocolNotify ( > > + &gEfiRscHandlerProtocolGuid, > > + RegisterStatusCodeHandlerEvent, > > + &Registration > > + ); > > + ASSERT_EFI_ERROR (Status); > > + } > > + > > + return EFI_SUCCESS; > > +} > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..21012980fe > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf > @@ -0,0 +1,51 @@ > +## @file > > +# PostCode status code implementation. > > +# > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +# vendor. This file may not be modified, except as allowed by > > +# additional terms of your license agreement. > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010005 > > + BASE_NAME = RuntimeDxePostCodeStatusCodeHandlerLib > > + FILE_GUID = FC4F3901-3E9B-4CA3-AB6C-1B65E9AA6960 > > + MODULE_TYPE = DXE_RUNTIME_DRIVER > > + VERSION_STRING = 1.0 > > + CONSTRUCTOR = > RuntimeDxePostCodeStatusCodeHandlerLibConstructor > > + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_RUNTIME_DRIVER > > + > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > +# > > + > > +[Sources] > > + RuntimeDxePostCodeStatusCodeHandlerLib.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + MdeModulePkg/MdeModulePkg.dec > > + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec > > + > > +[LibraryClasses] > > + UefiBootServicesTableLib > > + UefiRuntimeLib > > + DebugLib > > + PcdLib > > + ReportStatusCodeLib > > + PostCodeMapLib > > + PostCodeLib > > + > > +[Pcd] > > + > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode > ## CONSUMES > > + > > +[Protocols] > > + gEfiRscHandlerProtocolGuid ## CONSUMES > > + > > +[Depex] > > + TRUE > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..efd3a7ee6f > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c > @@ -0,0 +1,141 @@ > +/** @file > > + PostCode status code implementation. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Library/UefiDriverEntryPoint.h> > > +#include <Library/SmmServicesTableLib.h> > > +#include <Library/HobLib.h> > > +#include <Library/PcdLib.h> > > +#include <Library/DebugLib.h> > > +#include <Library/ReportStatusCodeLib.h> > > +#include <Protocol/SmmReportStatusCodeHandler.h> > > + > > +#include <Library/PostCodeLib.h> > > +#include <Library/PostCodeMapLib.h> > > + > > + > > +/** > > + Convert status code value and write data to post code. > > + > > + @param CodeType Indicates the type of status code being reported. > > + @param 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 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 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 Data This optional parameter may be used to pass > additional data. > > + > > + @retval EFI_SUCCESS Status code reported to post 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 ((EFI_D_INFO, "POSTCODE=<%02x>\n", PostCodeValue)); > > + PostCode (PostCodeValue); > > + } > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Register status code callback function only when Report Status Code > protocol > > + is installed. > > + > > + @param Protocol Points to the protocol's unique identifier. > > + @param Interface Points to the interface instance. > > + @param Handle The handle on which the interface was installed. > > + > > + @retval EFI_SUCCESS Notification runs successfully. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RegisterPostCodeBootTimeHandlers ( > > + IN CONST EFI_GUID *Protocol, > > + IN VOID *Interface, > > + IN EFI_HANDLE Handle > > + ) > > +{ > > + EFI_STATUS Status; > > + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; > > + > > + Status = gSmst->SmmLocateProtocol ( > > + &gEfiSmmRscHandlerProtocolGuid, > > + NULL, > > + (VOID **) &RscHandlerProtocol > > + ); > > + ASSERT_EFI_ERROR (Status); > > + > > + RscHandlerProtocol->Register (PostCodeStatusCodeReportWorker); > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Constructor function of SmmPostCodeStatusCodeHandlerLib. > > + > > + This function allocates memory for extended status code data, caches > > + the report status code service, and registers events. > > + > > + @param ImageHandle The firmware allocated handle for the EFI image. > > + @param SystemTable A pointer to the EFI System Table. > > + > > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +SmmPostCodeStatusCodeHandlerLibConstructor ( > > + IN EFI_HANDLE ImageHandle, > > + IN EFI_SYSTEM_TABLE *SystemTable > > + ) > > +{ > > + EFI_STATUS Status; > > + VOID *Registration; > > + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; > > + > > + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { > > + return EFI_SUCCESS; > > + } > > + > > + Status = gSmst->SmmLocateProtocol ( > > + &gEfiSmmRscHandlerProtocolGuid, > > + NULL, > > + (VOID **) &RscHandlerProtocol > > + ); > > + if (!EFI_ERROR (Status)) { > > + RegisterPostCodeBootTimeHandlers (NULL, NULL, NULL); > > + } else { > > + gSmst->SmmRegisterProtocolNotify ( > > + &gEfiSmmRscHandlerProtocolGuid, > > + RegisterPostCodeBootTimeHandlers, > > + &Registration > > + ); > > + } > > + > > + return EFI_SUCCESS; > > +} > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..7cc357fd49 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf > @@ -0,0 +1,50 @@ > +## @file > > +# PostCode status code implementation. > > +# > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +# vendor. This file may not be modified, except as allowed by > > +# additional terms of your license agreement. > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010005 > > + BASE_NAME = SmmPostCodeStatusCodeHandlerLib > > + FILE_GUID = AE5C0A80-309A-42F7-BFDD-80CDA1BA2D7E > > + MODULE_TYPE = DXE_SMM_DRIVER > > + VERSION_STRING = 1.0 > > + CONSTRUCTOR = > SmmPostCodeStatusCodeHandlerLibConstructor > > + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_SMM_DRIVER > > + > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > +# > > + > > +[Sources] > > + SmmPostCodeStatusCodeHandlerLib.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + MdeModulePkg/MdeModulePkg.dec > > + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec > > + > > +[LibraryClasses] > > + SmmServicesTableLib > > + DebugLib > > + PcdLib > > + ReportStatusCodeLib > > + PostCodeMapLib > > + PostCodeLib > > + > > +[Pcd] > > + > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode > ## CONSUMES > > + > > +[Protocols] > > + gEfiSmmRscHandlerProtocolGuid ## CONSUMES > > + > > +[Depex] > > + TRUE > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dec > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dec > new file mode 100644 > index 0000000000..5ba7b30ab6 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dec > @@ -0,0 +1,32 @@ > +## @file > > +# This package provides PostCode Debug feature. > > +# This package should only depend on EDK II Core packages, IntelSiliconPkg, > and MinPlatformPkg. > > +# > > +# The DEC files are used by the utilities that parse DSC and > > +# INF files to generate AutoGen.c and AutoGen.h files > > +# for the build infrastructure. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + DEC_SPECIFICATION = 0x00010017 > > + PACKAGE_NAME = PostCodeDebugFeaturePkg > > + PACKAGE_GUID = A579E0A8-0D27-4CA6-900E-D613003729DE > > + PACKAGE_VERSION = 0.1 > > + > > +[Includes] > > + Include > > + > > +[LibraryClasses] > > + ## @libraryclass Provide the function to map the status code to post > code. > > + PostCodeMapLib|Include/Library/PostCodeMapLib.h > > + > > +[Guids] > > + gPostCodeDebugFeaturePkgTokenSpaceGuid = {0x68886ac8, 0x7a29, > 0x4845, {0xa7, 0x02, 0xe9, 0x83, 0xc8, 0x7f, 0xfb, 0xab}} > > + > > +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] > > + > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode| > FALSE|BOOLEAN|0x00000001 > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dsc > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dsc > new file mode 100644 > index 0000000000..4f0bec4a6f > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dsc > @@ -0,0 +1,30 @@ > +## @file > > +# This package provides PostCode Debug feature. > > +# This package should only depend on EDK II Core packages, IntelSiliconPkg, > and MinPlatformPkg. > > +# > > +# The DEC files are used by the utilities that parse DSC and > > +# INF files to generate AutoGen.c and AutoGen.h files > > +# for the build infrastructure. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + PLATFORM_NAME = PostCodeFeaturePkg > > + PLATFORM_GUID = 4ADE0B1A-7929-495D-A221-6576C7884CAC > > + PLATFORM_VERSION = 0.1 > > + DSC_SPECIFICATION = 0x00010005 > > + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) > > + SUPPORTED_ARCHITECTURES = IA32|X64 > > + BUILD_TARGETS = DEBUG|RELEASE|NOOPT > > + SKUID_IDENTIFIER = DEFAULT > > + PEI_ARCH = IA32 > > + DXE_ARCH = X64 > > + > > +# > > +# This package always builds the feature. > > +# > > +!include Include/PostCodeDebugFeature.dsc > > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md > new file mode 100644 > index 0000000000..c49db35999 > --- /dev/null > +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md > @@ -0,0 +1,117 @@ > +# Overview > > +* **Feature Name:** Post Code Debug > > +* **PI Phase(s) Supported:** PEI, DXE, SMM > > +* **SMM Required?** Yes > > + > > +More Information: > > + > > +## Purpose > > +The PostCodeDebugFeaturePkg include some useful post code debug > libraries, such as get post code from status code and show it. > > +This is an important capability in firmware development to get and analyze > the post code. > > + > > + > > +# High-Level Theory of Operation > > +It provide a library PostCodeStatusCodeHandlerLib used by edk2 > StatusCodeHandler.efi, used to show the post code. > > +It also provide a library of PostCodeMap lib, it map the status code to post > code. > > +A library of PostCode lib is needed by platform. > > + > > +In the library contstructor function, PostCodeStatusCodeHandlerLib register > the call back function for ReportStatusCode. > > +When called, it call GetPostCodeFromStatusCode() in PostCodeMapLib to > get post code from status code, and call PostCode() in PostCodeLib to show > the post code. > > + > > +PostCodeStatusCodeHandlerLib include 3 libraries for PEI, RuntimeDxe, > SMM: > > +* PeiPostCodeStatusCodeHandlerLib > > +* RuntimeDxePostCodeStatusCodeHandlerLib > > +* SmmPostCodeStatusCodeHandlerLib > > + > > +## Firmware Volumes > > +Linked with StatusCodeHandler.efi, and make sure put the > StatusCodeHandler.efi after the ReportStatusCodeRouter.efi. > > + > > +## Modules > > +* PostCodeStatusCodeHandlerLib > > +* PostCodeMapLib > > + > > +## PostCodeStatusCodeHandlerLib > > +This library register the call back function for ReportStatusCode, and get > post code from status code, and show post code. > > + > > +## PostCodeMapLib > > +This library provide a function to get post code from status code. > > + > > +## Key Functions > > +* In PeiPostCodeStatusCodeHandlerLib: > > + EFI_STATUS > > + EFIAPI > > + PostCodeStatusCodeReportWorker ( > > + IN CONST EFI_PEI_SERVICES **PeiServices, > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value, > > + IN UINT32 Instance, > > + IN CONST EFI_GUID *CallerId, > > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL > > + ) > > + > > +* In RuntimeDxePostCodeStatusCodeHandlerLib: > > + 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 > > + ) > > + > > +* In SmmPostCodeStatusCodeHandlerLib: > > + 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 > > + ) > > + > > +* In PostCodeMapLib: > > + UINT32 > > + EFIAPI > > + GetPostCodeFromStatusCode ( > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value > > + ) > > + > > +## Configuration > > +* Link the library to StatusCodeHandler.efi. > > + Example: > > + > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan > dlerRuntimeDxe.inf { > > + <LibraryClasses> > > + > NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/R > untimeDxePostCodeStatusCodeHandlerLib.inf > > + } > > + Refer to PostCodeDebugFeature.dsc for other example. > > +* Config PCD > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode. > > + In platform .dsc file, need to config the type of > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode. > > + Use PcdsFixedAtBuild to save binary size, and use PcdsDynamic if want to > enable/disable in runtime. > > +* Implemented platform's special PostCodeMapLib if needed. > > +* Provide the platform's special PostCodeLib. > > +* Make sure put the StatusCodeHandler.efi after the > ReportStatusCodeRouter.efi. > > + > > +## Data Flows > > +Status Code (ReportStatusCode) -> Post Code > (GetPostCodeFromStatusCode). > > + > > +## Control Flows > > +ReportStatusCode() -> PostCodeStatusCodeReportWorker() -> > GetPostCodeFromStatusCode() -> PostCode() > > + > > +## Build Flows > > +There is not special build flows. > > + > > +## Test Point Results > > +Verify the post code shown is correct. > > + > > +## Functional Exit Criteria > > +N/A > > + > > +## Feature Enabling Checklist > > +* Set the PCD > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode > to TRUE. > > +* The post code can be shown. > > + > > +## Common Optimizations > > +* Implemented platform's special PostCodeMapLib if needed. > > -- > 2.24.0.windows.2 > > > -=-=-=-=-=-= > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#61334): https://edk2.groups.io/g/devel/message/61334 > Mute This Topic: https://groups.io/mt/74913972/1768738 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [dandan.bi@intel.com] > -=-=-=-=-=-= ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: add it. 2020-06-16 11:25 [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: add it Tan, Ming 2020-06-16 11:25 ` [PATCH v7 2/2] Features/Intel/PostCodeDebugFeaturePkg: " Tan, Ming @ 2020-06-17 8:25 ` Dandan Bi 2020-06-18 0:45 ` Dandan Bi 1 sibling, 1 reply; 5+ messages in thread From: Dandan Bi @ 2020-06-17 8:25 UTC (permalink / raw) To: devel@edk2.groups.io, Tan, Ming; +Cc: Dong, Eric, Gao, Liming Hi Min, I have one minor comment about the function name of RegisterBeepBootTimeHandlers. Since this is the notification function of installation of status code handler protocol, could you help update it to make it more readable? Same comment for the function RegisterPostCodeBootTimeHandlers in patch 2. Thanks, Dandan > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tan, > Ming > Sent: Tuesday, June 16, 2020 7:26 PM > To: devel@edk2.groups.io > Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com> > Subject: [edk2-devel] [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: > add it. > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2792 > > The BeepDebugFeaturePkg include some useful beep debug > libraries, such as get beep value from status code and beep. > > It provide a library BeepStatusCodeHandlerLib used by edk2 > StatusCodeHandler.efi, used to do beep if needed. > It also provide a library of BeepMap lib, it map the status code > to beep value. > A library of Beep lib is needed by platform, and this pkg has a > Null implementation. > > Cc: Eric Dong <eric.dong@intel.com> > Cc: Liming Gao <liming.gao@intel.com> > Signed-off-by: Ming Tan <ming.tan@intel.com> > --- > V7: Add the dec files in AdvancedFeaturesPcd.dsc. Combine Beep and > PostCode to 2/2 patchs. > V6: Modify some bug when include the platform dsc file. And modify > Readme.md. > V5: In .inf files, remove some useless library. > In RuntimeDxeBeepStatusCodeHandlerLib.c, add a variable to indicate > whether need unregister. > V4: Change Include/BeepDebugFeature.dsc, make it can be included in > platform dsc file. > V3: Modify according the Eric's review comments. > V2: Delete the last empty line in > BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf > .../Include/AdvancedFeaturesPcd.dsc | 83 +++--- > .../BeepDebugFeaturePkg.dec | 36 +++ > .../BeepDebugFeaturePkg.dsc | 30 ++ > .../Include/BeepDebugFeature.dsc | 201 +++++++++++++ > .../Include/Library/BeepLib.h | 33 +++ > .../Include/Library/BeepMapLib.h | 32 +++ > .../Library/BeepLib/BeepLibNull.c | 37 +++ > .../Library/BeepLib/BeepLibNull.inf | 26 ++ > .../Library/BeepMapLib/BeepMapLib.c | 116 ++++++++ > .../Library/BeepMapLib/BeepMapLib.inf | 27 ++ > .../BeepMapLib/PlatformStatusCodesInternal.h | 270 > ++++++++++++++++++ > .../PeiBeepStatusCodeHandlerLib.c | 101 +++++++ > .../PeiBeepStatusCodeHandlerLib.inf | 49 ++++ > .../RuntimeDxeBeepStatusCodeHandlerLib.c | 184 ++++++++++++ > .../RuntimeDxeBeepStatusCodeHandlerLib.inf | 51 ++++ > .../SmmBeepStatusCodeHandlerLib.c | 138 +++++++++ > .../SmmBeepStatusCodeHandlerLib.inf | 50 ++++ > .../Debugging/BeepDebugFeaturePkg/Readme.md | 125 ++++++++ > 18 files changed, 1548 insertions(+), 41 deletions(-) > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.d > ec > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.d > sc > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFeat > ure.dsc > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLib. > h > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepMa > pLib.h > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLib > Null.c > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLib > Null.inf > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Bee > pMapLib.c > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Bee > pMapLib.inf > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Plat > formStatusCodesInternal.h > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > HandlerLib/PeiBeepStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > HandlerLib/PeiBeepStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > HandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > HandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > HandlerLib/SmmBeepStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > HandlerLib/SmmBeepStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md > > diff --git > a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > index 836da7c944..366b551bd3 100644 > --- > a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > +++ > b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > @@ -1,41 +1,42 @@ > -## @file > > > -# DSC file for defining Pcd of advanced features. > > > -# > > > -# This file is intended to be included into another package so advanced > features > > > -# can be conditionally built by enabling the respective feature via its > FeaturePCD. > > > -# > > > -# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > > -# > > > -# SPDX-License-Identifier: BSD-2-Clause-Patent > > > -# > > > -## > > > - > > > -# > > > -# The section references the package DEC files, > > > -# it allow a FeaturePCD to be used in a conditional statement > > > -# > > > -[Packages] > > > - MdePkg/MdePkg.dec > > > - AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec > > > - Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec > > > - NetworkFeaturePkg/NetworkFeaturePkg.dec > > > - IpmiFeaturePkg/IpmiFeaturePkg.dec > > > - S3FeaturePkg/S3FeaturePkg.dec > > > - SmbiosFeaturePkg/SmbiosFeaturePkg.dec > > > - UserAuthFeaturePkg/UserAuthFeaturePkg.dec > > > - LogoFeaturePkg/LogoFeaturePkg.dec > > > - > > > -# > > > -# The section below sets all PCDs to FALSE in this DSC file so the feature is > not enabled by default. > > > -# Board can set PCDs to TRUE in its DSC file to enable a subset of advanced > features > > > -# > > > -[PcdsFeatureFlag] > > > - gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable > |FALSE > > > - gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable |FALSE > > > - gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable > |FALSE > > > - gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |FALSE > > > - gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable > |FALSE > > > - gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable > |FALSE > > > - > gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnabl > e |FALSE > > > - gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable > |FALSE > > > - gLogoFeaturePkgTokenSpaceGuid.PcdJpgEnable |FALSE > > > +## @file > > +# DSC file for defining Pcd of advanced features. > > +# > > +# This file is intended to be included into another package so advanced > features > > +# can be conditionally built by enabling the respective feature via its > FeaturePCD. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +# > > +# The section references the package DEC files, > > +# it allow a FeaturePCD to be used in a conditional statement > > +# > > +[Packages] > > + MdePkg/MdePkg.dec > > + AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec > > + Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec > > + NetworkFeaturePkg/NetworkFeaturePkg.dec > > + IpmiFeaturePkg/IpmiFeaturePkg.dec > > + S3FeaturePkg/S3FeaturePkg.dec > > + SmbiosFeaturePkg/SmbiosFeaturePkg.dec > > + UserAuthFeaturePkg/UserAuthFeaturePkg.dec > > + LogoFeaturePkg/LogoFeaturePkg.dec > > + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > + > > +# > > +# The section below sets all PCDs to FALSE in this DSC file so the feature is > not enabled by default. > > +# Board can set PCDs to TRUE in its DSC file to enable a subset of advanced > features > > +# > > +[PcdsFeatureFlag] > > + gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable > |FALSE > > + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable > |FALSE > > + gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable > |FALSE > > + gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |FALSE > > + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable > |FALSE > > + gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable > |FALSE > > + > gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnabl > e |FALSE > > + gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable > |FALSE > > + gLogoFeaturePkgTokenSpaceGuid.PcdJpgEnable |FALSE > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > .dec > b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > .dec > new file mode 100644 > index 0000000000..4f4b36b091 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > .dec > @@ -0,0 +1,36 @@ > +## @file > > +# This package provides Beep Debug feature. > > +# This package should only depend on EDK II Core packages, IntelSiliconPkg, > and MinPlatformPkg. > > +# > > +# The DEC files are used by the utilities that parse DSC and > > +# INF files to generate AutoGen.c and AutoGen.h files > > +# for the build infrastructure. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + DEC_SPECIFICATION = 0x00010017 > > + PACKAGE_NAME = BeepDebugFeaturePkg > > + PACKAGE_GUID = DD88CEBB-E68F-4155-B754-D11E4FDF008D > > + PACKAGE_VERSION = 0.1 > > + > > +[Includes] > > + Include > > + > > +[LibraryClasses] > > + ## @libraryclass Provide the function to map the status code to beep > value. > > + BeepMapLib|Include/Library/BeepMapLib.h > > + > > + ## @libraryclass Provide the function to do the real beep. > > + BeepLib|Include/Library/BeepLib.h > > + > > +[Guids] > > + gBeepDebugFeaturePkgTokenSpaceGuid = {0x54f56fb5, 0xea0e, 0x4518, > {0xa0, 0x3e, 0x1b, 0xeb, 0x56, 0x94, 0xd2, 0x16}} > > + > > +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] > > + # Beep is a legacy feature, disabled it by default > > + > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep|FALSE|B > OOLEAN|0x00000001 > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > .dsc > b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > .dsc > new file mode 100644 > index 0000000000..47254f9974 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > .dsc > @@ -0,0 +1,30 @@ > +## @file > > +# This package provides Beep Debug feature. > > +# This package should only depend on EDK II Core packages, IntelSiliconPkg, > and MinPlatformPkg. > > +# > > +# The DEC files are used by the utilities that parse DSC and > > +# INF files to generate AutoGen.c and AutoGen.h files > > +# for the build infrastructure. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + PLATFORM_NAME = BeepDebugFeaturePkg > > + PLATFORM_GUID = D716EDF2-77BB-4536-9C64-4D7EEF0F3896 > > + PLATFORM_VERSION = 0.1 > > + DSC_SPECIFICATION = 0x00010005 > > + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) > > + SUPPORTED_ARCHITECTURES = IA32|X64 > > + BUILD_TARGETS = DEBUG|RELEASE|NOOPT > > + SKUID_IDENTIFIER = DEFAULT > > + PEI_ARCH = IA32 > > + DXE_ARCH = X64 > > + > > +# > > +# This package always builds the feature. > > +# > > +!include Include/BeepDebugFeature.dsc > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFe > ature.dsc > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFe > ature.dsc > new file mode 100644 > index 0000000000..65e00b5979 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFe > ature.dsc > @@ -0,0 +1,201 @@ > +## @file > > +# This package provides Beep Debug feature. > > +# This file should be included into another package DSC file to build this > feature. > > +# > > +# The DEC files are used by the utilities that parse DSC and > > +# INF files to generate AutoGen.c and AutoGen.h files > > +# for the build infrastructure. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +######################################################### > ####################### > > +# > > +# Defines Section - statements that will be processed to create a Makefile. > > +# > > +######################################################### > ####################### > > +[Defines] > > +!ifndef $(PEI_ARCH) > > + !error "PEI_ARCH must be specified to build this feature!" > > +!endif > > +!ifndef $(DXE_ARCH) > > + !error "DXE_ARCH must be specified to build this feature!" > > +!endif > > + > > +######################################################### > ####################### > > +# > > +# PCD Section - list of PCD Entries modified by the feature. > > +# > > +######################################################### > ####################### > > + > > +# Unmark the following and StatusCodeHandler.efi to build the .dsc file > directly > > +#[PcdsDynamicDefault] > > +# gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep|TRUE > > + > > +######################################################### > ####################### > > +# > > +# Library Class section - list of all Library Classes needed by this feature. > > +# > > +######################################################### > ####################### > > +[LibraryClasses] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf > > + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf > > + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf > > + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf > > + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf > > + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > > + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf > > + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf > > + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf > > + > TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTem > plate.inf > > + > UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo > otServicesTableLib.inf > > + > UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry > Point.inf > > + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf > > + > UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib > /UefiRuntimeServicesTableLib.inf > > + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf > > + > > +[LibraryClasses.common.PEIM] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf > > + > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemory > AllocationLib.inf > > + > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/P > eiServicesTablePointerLibIdt.inf > > + > > +[LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE,LibraryClasses.IA32 > .SEC] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + > ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiR > eportStatusCodeLib.inf > > + > > +[LibraryClasses.common.DXE_DRIVER] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf > > + > > +[LibraryClasses.common.DXE_RUNTIME_DRIVER] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf > > + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf > > + > ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCod > eLib/RuntimeDxeReportStatusCodeLib.inf > > + > > +[LibraryClasses.common.UEFI_DRIVER] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf > > + > > +[LibraryClasses.X64.DXE_SMM_DRIVER] > > + ####################################### > > + # Edk2 Packages > > + ####################################### > > + > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT > ableLib.inf > > + > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe > moryAllocationLib.inf > > + SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf > > + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf > > + > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/S > mmReportStatusCodeLib.inf > > + > > +######################################################### > ####################### > > +# > > +# Component section - list of all components that need built for this feature. > > +# > > +# Note: The EDK II DSC file is not used to specify how compiled binary > images get placed > > +# into firmware volume images. This section is just a list of modules to > compile from > > +# source into UEFI-compliant binaries. > > +# It is the FDF file that contains information on combining binary files into > firmware > > +# volume images, whose concept is beyond UEFI and is described in PI > specification. > > +# There may also be modules listed in this section that are not required > in the FDF file, > > +# When a module listed here is excluded from FDF file, then UEFI- > compliant binary will be > > +# generated for it, but the binary will not be put into any firmware > volume. > > +# > > +######################################################### > ####################### > > +# > > +# Feature PEI Components > > +# > > + > > +# @todo: Change below line to [Components.$(PEI_ARCH)] after > https://bugzilla.tianocore.org/show_bug.cgi?id=2308 > > +# is completed. > > +[Components.IA32] > > + ##################################### > > + # Beep Debug Feature Package > > + ##################################### > > + > > + # Add library instances here that are not included in package components > and should be tested > > + # in the package build. > > + > BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusC > odeHandlerLib.inf > > + > > + # The following is an example for used with StatusCodeHandler: > > +# > MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.in > f { > > +# <LibraryClasses> > > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf > > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > f > > +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf > > +# > BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf > > +# > NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepSt > atusCodeHandlerLib.inf > > +# } > > + > > + # Add components here that should be included in the package build. > > + > > +# > > +# Feature DXE Components > > +# > > + > > +# @todo: Change below line to [Components.$(DXE_ARCH)] after > https://bugzilla.tianocore.org/show_bug.cgi?id=2308 > > +# is completed. > > +[Components.X64] > > + ##################################### > > + # Beep Debug Feature Package > > + ##################################### > > + > > + # Add library instances here that are not included in package components > and should be tested > > + # in the package build. > > + > BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBee > pStatusCodeHandlerLib.inf > > + > BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatus > CodeHandlerLib.inf > > + > > + # The following is an example for used with StatusCodeHandler: > > +# > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan > dlerRuntimeDxe.inf { > > +# <LibraryClasses> > > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf > > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > f > > +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf > > +# > BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf > > +# > NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeD > xeBeepStatusCodeHandlerLib.inf > > +# } > > + > > +# > MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSm > m.inf { > > +# <LibraryClasses> > > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf > > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > f > > +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf > > +# > BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf > > +# > NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeep > StatusCodeHandlerLib.inf > > +# } > > + > > + # Add components here that should be included in the package build. > > + > > +######################################################### > ########################################## > > +# > > +# BuildOptions Section - Define the module specific tool chain flags that > should be used as > > +# the default flags for a module. These flags are appended to > any > > +# standard flags that are defined by the build process. They can > be > > +# applied for any modules or only those modules with the > specific > > +# module style (EDK or EDKII) specified in [Components] section. > > +# > > +# For advanced features, it is recommended to enable > [BuildOptions] in > > +# the applicable INF file so it does not affect the whole board > package > > +# build when this DSC file is active. > > +# > > +######################################################### > ########################################## > > +[BuildOptions] > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLi > b.h > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLi > b.h > new file mode 100644 > index 0000000000..f768acc557 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLi > b.h > @@ -0,0 +1,33 @@ > +/** @file > > + Provides services to send progress/error codes to Beep device. > > + > > + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef __BEEP_LIB_H__ > > +#define __BEEP_LIB_H__ > > + > > +/** > > + Sends a 32-bit value to Beep device. > > + > > + Sends the 32-bit value specified by Value to Beep device, and returns > Value. > > + Some implementations of this library function may perform I/O operations > > + directly to Beep device. Other implementations may send Value to > > + ReportStatusCode(), and the status code reporting mechanism will > eventually > > + display the 32-bit value on the status reporting device. > > + > > + Beep() must actively prevent recursion. If Beep() is called while > > + processing another Post Code Library function, then > > + Beep() must return Value immediately. > > + > > + @param Value Beep count. > > +**/ > > +VOID > > +EFIAPI > > +Beep ( > > + IN UINT32 Value > > + ); > > + > > +#endif > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepM > apLib.h > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepM > apLib.h > new file mode 100644 > index 0000000000..7600d72ecd > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepM > apLib.h > @@ -0,0 +1,32 @@ > +/** @file > > + This library class provides Platform Beep Map. > > + > > + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef __BEEP_MAP_LIB__ > > +#define __BEEP_MAP_LIB__ > > + > > +/** > > + Get BeepValue from status code type and value. > > + > > + @param CodeType Indicates the type of status code being reported. > > + @param 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. > > + > > + @return BeepValue > > + > > +**/ > > +UINT32 > > +EFIAPI > > +GetBeepValueFromStatusCode ( > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value > > + ); > > + > > +#endif > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > bNull.c > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > bNull.c > new file mode 100644 > index 0000000000..a0bd946b50 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > bNull.c > @@ -0,0 +1,37 @@ > +/** @file > > + BeepLib Null implementation. > > + > > + Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Base.h> > > +#include <Uefi.h> > > + > > +/** > > + NULL implemented of Beep() function, just return directly. > > + Normal Beep() function will do the following: > > + > > + Sends a 32-bit value to Beep device. > > + > > + Sends the 32-bit value specified by Value to Beep device, and returns > Value. > > + Some implementations of this library function may perform I/O operations > > + directly to Beep device. Other implementations may send Value to > > + ReportStatusCode(), and the status code reporting mechanism will > eventually > > + display the 32-bit value on the status reporting device. > > + > > + Beep() must actively prevent recursion. If Beep() is called while > > + processing another Post Code Library function, then > > + Beep() must return Value immediately. > > + > > + @param Value Beep count. > > +**/ > > +VOID > > +EFIAPI > > +Beep ( > > + IN UINT32 Value > > + ) > > +{ > > + return; > > +} > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > bNull.inf > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > bNull.inf > new file mode 100644 > index 0000000000..7f84dad082 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > bNull.inf > @@ -0,0 +1,26 @@ > +## @file > > +# Instance of Platform Beep Null Library. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010017 > > + BASE_NAME = BeepLib > > + FILE_GUID = 319F24D8-9F3E-4BEC-B1C4-C54BE51F3FC2 > > + VERSION_STRING = 1.0 > > + MODULE_TYPE = BASE > > + LIBRARY_CLASS = BeepLib > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC > > +# > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + > > +[Sources] > > + BeepLibNull.c > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > eepMapLib.c > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > eepMapLib.c > new file mode 100644 > index 0000000000..26c32dfd9b > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > eepMapLib.c > @@ -0,0 +1,116 @@ > +/** @file > > + BeepMap implementation. > > + > > + Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Base.h> > > +#include <Uefi.h> > > + > > +#include "PlatformStatusCodesInternal.h" > > + > > +STATUS_CODE_TO_DATA_MAP mBeepProgressMap[] = { > > + // > > + // PEI > > + // > > + // Recovery > > + { PEI_RECOVERY_STARTED, 2 }, > > + > > + // > > + // DXE > > + // > > + > > + {0,0} > > +}; > > + > > +STATUS_CODE_TO_DATA_MAP mBeepErrorMap[] = { > > + // > > + // PEI > > + // > > + // Regular boot > > + { PEI_MEMORY_NOT_DETECTED, 1 }, > > + { PEI_MEMORY_INSTALLED_TWICE, 1 }, > > + { PEI_DXEIPL_NOT_FOUND, 3 }, > > + { PEI_DXE_CORE_NOT_FOUND, 3 }, > > + { PEI_RESET_NOT_AVAILABLE, 7 }, > > + // Recovery > > + { PEI_RECOVERY_FAILED, 4 }, > > + // S3 Resume > > + { PEI_S3_RESUME_FAILED, 4 }, > > + > > + // > > + // DXE > > + // > > + { DXE_ARCH_PROTOCOL_NOT_AVAILABLE, 4 }, > > + { DXE_NO_CON_OUT, 5 }, > > + { DXE_NO_CON_IN, 5 }, > > + { DXE_INVALID_PASSWORD, 1 }, > > + { DXE_FLASH_UPDATE_FAILED, 6 }, > > + { DXE_RESET_NOT_AVAILABLE, 7 }, > > + > > + {0,0} > > +}; > > + > > +STATUS_CODE_TO_DATA_MAP *mBeepStatusCodesMap[] = { > > + //#define EFI_PROGRESS_CODE 0x00000001 > > + mBeepProgressMap, > > + //#define EFI_ERROR_CODE 0x00000002 > > + mBeepErrorMap > > + //#define EFI_DEBUG_CODE 0x00000003 > > +}; > > + > > +/** > > + Find the beep data from status code value. > > + > > + @param Map The map used to find in. > > + @param Value The status code value. > > + > > + @return BeepValue 0 for not found. > > + > > +**/ > > +UINT32 > > +FindBeepData ( > > + IN STATUS_CODE_TO_DATA_MAP *Map, > > + IN EFI_STATUS_CODE_VALUE Value > > + ) > > +{ > > + while (Map->Value != 0) { > > + if (Map->Value == Value) { > > + return Map->Data; > > + } > > + Map++; > > + } > > + return 0; > > +} > > + > > +/** > > + Get BeepValue from status code type and value. > > + > > + @param CodeType Indicates the type of status code being reported. > > + @param 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. > > + > > + @return BeepValue > > +**/ > > +UINT32 > > +EFIAPI > > +GetBeepValueFromStatusCode ( > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value > > + ) > > +{ > > + UINT32 CodeTypeIndex; > > + > > + CodeTypeIndex = STATUS_CODE_TYPE (CodeType) - 1; > > + > > + if (CodeTypeIndex >= sizeof (mBeepStatusCodesMap) / > sizeof(mBeepStatusCodesMap[0])) { > > + return 0; > > + } > > + > > + return FindBeepData (mBeepStatusCodesMap[CodeTypeIndex], Value); > > +} > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > eepMapLib.inf > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > eepMapLib.inf > new file mode 100644 > index 0000000000..b957eee07b > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > eepMapLib.inf > @@ -0,0 +1,27 @@ > +## @file > > +# Instance of Beep Map Library. > > +# > > +# Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010017 > > + BASE_NAME = BeepMapLib > > + FILE_GUID = 8BAFA82F-DA9E-4cce-8FA2-9DA189D7246D > > + VERSION_STRING = 2.0 > > + MODULE_TYPE = BASE > > + LIBRARY_CLASS = BeepMapLib > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC > > +# > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + > > +[Sources] > > + BeepMapLib.c > > + PlatformStatusCodesInternal.h > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Pl > atformStatusCodesInternal.h > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Pl > atformStatusCodesInternal.h > new file mode 100644 > index 0000000000..a36134c933 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Pl > atformStatusCodesInternal.h > @@ -0,0 +1,270 @@ > +/** @file > > + Beep status code definition. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef __PLATFORM_STATUS_CODES_INTERNAL_H__ > > +#define __PLATFORM_STATUS_CODES_INTERNAL_H__ > > + > > +#include <Pi/PiStatusCode.h> > > + > > +typedef struct{ > > + EFI_STATUS_CODE_VALUE Value; > > + UINT32 Data; > > +} STATUS_CODE_TO_DATA_MAP; > > + > > +// > > +// Enable PEI/DXE status code > > +// > > +#define PEI_STATUS_CODE 1 > > +#define DXE_STATUS_CODE 1 > > + > > +#define STATUS_CODE_TYPE(Type) > ((Type)&EFI_STATUS_CODE_TYPE_MASK) > > +#define STATUS_CODE_CLASS(Value) > ((Value)&EFI_STATUS_CODE_CLASS_MASK) > > + > > +//Progress/Error codes > > +#define PEI_CORE_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_PC_ENTRY_POINT) > > +#define PEI_RESET_NOT_AVAILABLE (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PS_EC_RESET_NOT_AVAILABLE) > > +#define PEI_DXEIPL_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND) > > +#define PEI_DXE_CORE_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_EC_DXE_CORRUPT) > > +#define PEI_S3_RESUME_ERROR (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_EC_S3_RESUME_FAILED) > > +#define PEI_RECOVERY_FAILED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_EC_RECOVERY_FAILED) > > +#define DXE_CORE_STARTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_ENTRY_POINT) > > + > > +//#define DXE_EXIT_BOOT_SERVICES_BEGIN 0xF8 > > +#define DXE_EXIT_BOOT_SERVICES_END > (EFI_SOFTWARE_EFI_BOOT_SERVICE | > EFI_SW_BS_PC_EXIT_BOOT_SERVICES) > > + > > +// Reported by CPU PEIM > > +#define PEI_CAR_CPU_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_PC_POWER_ON_INIT) > > + > > +// Reported by NB PEIM > > +//#define PEI_CAR_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CU_CHIPSET_NORTH_INIT) > > + > > +// Reported by SB PEIM > > +//#define PEI_CAR_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CU_CHIPSET_PC_SOUTH_INIT) > > + > > +//Reported by Memory Detection PEIM > > +#define PEI_MEMORY_SPD_READ > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_SPD_READ) > > +#define PEI_MEMORY_PRESENCE_DETECT > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_PC_PRESENCE_DETECT) > > +#define PEI_MEMORY_TIMING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TIMING) > > +#define PEI_MEMORY_CONFIGURING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_CONFIGURING) > > +#define PEI_MEMORY_OPTIMIZING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_OPTIMIZING) > > +#define PEI_MEMORY_INIT (EFI_COMPUTING_UNIT_MEMORY > | EFI_CU_MEMORY_PC_INIT) > > +#define PEI_MEMORY_TEST (EFI_COMPUTING_UNIT_MEMORY > | EFI_CU_MEMORY_PC_TEST) > > +#define PEI_MEMORY_INVALID_TYPE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_TYPE) > > +#define PEI_MEMORY_INVALID_SPEED > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SPEED) > > +#define PEI_MEMORY_SPD_FAIL > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_SPD_FAIL) > > +#define PEI_MEMORY_INVALID_SIZE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SIZE) > > +#define PEI_MEMORY_MISMATCH > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) > > +#define PEI_MEMORY_S3_RESUME_FAILED > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_S3_RESUME_FAIL) > > +#define PEI_MEMORY_NOT_DETECTED > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_NONE_DETECTED) > > +#define PEI_MEMORY_NONE_USEFUL > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_USEFUL) > > +#define PEI_MEMORY_ERROR > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NON_SPECIFIC) > > +#define PEI_MEMORY_INSTALLED (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PS_PC_INSTALL_PEI_MEMORY) > > +#define PEI_MEMORY_NOT_INSTALLED > (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED) > > +#define PEI_MEMORY_INSTALLED_TWICE > (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PS_EC_MEMORY_INSTALLED_TWICE) > > + > > +//Reported by CPU PEIM > > +#define PEI_CPU_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_PC_INIT_BEGIN) > > +#define PEI_CPU_CACHE_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACHE_INIT) > > +#define PEI_CPU_BSP_SELECT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT) > > +#define PEI_CPU_AP_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT) > > +#define PEI_CPU_SMM_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_SMM_INIT) > > +#define PEI_CPU_INVALID_TYPE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_INVALID_TYPE) > > +#define PEI_CPU_INVALID_SPEED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_INVALID_SPEED) > > +#define PEI_CPU_MISMATCH > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MISMATCH) > > +#define PEI_CPU_SELF_TEST_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) > > +#define PEI_CPU_CACHE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CACHE) > > +#define PEI_CPU_MICROCODE_UPDATE_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_MICROCODE_UPDATE) > > +#define PEI_CPU_NO_MICROCODE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_NO_MICROCODE_UPDATE) > > +//If non of the errors above apply use this one > > +#define PEI_CPU_INTERNAL_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INTERNAL) > > +//Generic CPU error. It should only be used if non of the errors above apply > > +#define PEI_CPU_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NON_SPECIFIC) > > + > > +// Reported by NB PEIM > > +#define PEI_MEM_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_PEI_MEM_NB_INIT) > > +// Reported by SB PEIM > > +#define PEI_MEM_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_PEI_MEM_SB_INIT) > > + > > +//Reported by PEIM which detected forced or auto recovery condition > > +#define PEI_RECOVERY_AUTO (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_AUTO) > > +#define PEI_RECOVERY_USER (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_USER) > > + > > +//Reported by DXE IPL > > +#define PEI_RECOVERY_PPI_NOT_FOUND > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND) > > +#define PEI_S3_RESUME_PPI_NOT_FOUND > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND) > > +#define PEI_S3_RESUME_FAILED (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_S3_RESUME_FAILED) > > + > > +//Reported by Recovery PEIM > > +#define PEI_RECOVERY_STARTED (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_BEGIN) > > +#define PEI_RECOVERY_CAPSULE_FOUND > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_LOAD) > > +#define PEI_RECOVERY_NO_CAPSULE > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE) > > +#define PEI_RECOVERY_CAPSULE_LOADED > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START) > > +#define PEI_RECOVERY_INVALID_CAPSULE > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR) > > + > > +//Reported by S3 Resume PEIM > > +#define PEI_S3_BOOT_SCRIPT (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_S3_BOOT_SCRIPT) > > +#define PEI_S3_OS_WAKE (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_OS_WAKE) > > +#define PEI_S3_BOOT_SCRIPT_ERROR > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_BOOT_SCRIPT_ERROR) > > +#define PEI_S3_OS_WAKE_ERROR (EFI_SOFTWARE_PEI_MODULE > | EFI_SW_PEI_EC_S3_OS_WAKE_ERROR) > > + > > +#define PEI_PEIM_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PC_INIT_BEGIN) > > +#define PEI_PEIM_ENDED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PC_INIT_END) > > + > > +//Reported by DXE IPL > > +#define PEI_DXE_IPL_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT) > > + > > +//Reported by PEIM which installs Reset PPI > > +#define PEI_RESET_SYSTEM (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PS_PC_RESET_SYSTEM) > > + > > +//Reported by the PEIM or DXE driver which detected the error > > +#define GENERIC_MEMORY_CORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_CORRECTABLE) > > +#define GENERIC_MEMORY_UNCORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_UNCORRECTABLE) > > + > > +//Reported by Flash Update DXE driver > > +#define DXE_FLASH_UPDATE_FAILED > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UPDATE_FAIL) > > + > > +//Reported by the PEIM or DXE driver which detected the error > > +#define GENERIC_CPU_THERMAL_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_THERMAL) > > +#define GENERIC_CPU_LOW_VOLTAGE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_LOW_VOLTAGE) > > +#define GENERIC_CPU_HIGH_VOLTAGE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_HIGH_VOLTAGE) > > +#define GENERIC_CPU_CORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_CORRECTABLE) > > +#define GENERIC_CPU_UNCORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_UNCORRECTABLE) > > +#define GENERIC_BAD_DATE_TIME_ERROR > (EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_BAD_DATE_TIME) > > +#define GENERIC_MEMORY_SIZE_DECREASE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) > > + > > +//Reported by DXE Core > > +#define DXE_DRIVER_STARTED > (EFI_SOFTWARE_EFI_DXE_SERVICE | EFI_SW_PC_INIT_BEGIN) > > +#define DXE_DRIVER_ENED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_PC_INIT_END) > > +#define DXE_ARCH_PROTOCOLS_AVAILABLE > (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ARCH_READY) > > +#define DXE_DRIVER_CONNECTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_START_DRIVER) > > +#define DXE_ARCH_PROTOCOL_NOT_AVAILABLE > (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH) > > + > > +//Reported by DXE CPU driver > > +#define DXE_CPU_SELF_TEST_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) > > + > > +//Reported by PCI Host Bridge driver > > +#define DXE_NB_HB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_HB_INIT ) > > + > > +// Reported by NB Driver > > +#define DXE_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_NB_INIT ) > > +#define DXE_NB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_NB_SMM_INIT ) > > +#define DXE_NB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_EC_DXE_NB_ERROR ) > > + > > +// Reported by SB Driver(s) > > +#define DXE_SBRUN_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_SB_RT_INIT ) > > +#define DXE_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_SB_INIT ) > > +#define DXE_SB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_PC_DXE_SB_SMM_INIT ) > > +#define DXE_SB_DEVICES_INIT (EFI_COMPUTING_UNIT_CHIPSET > | EFI_CHIPSET_PC_DXE_SB_DEVICES_INIT ) > > +#define DXE_SB_BAD_BATTERY (EFI_COMPUTING_UNIT_CHIPSET > | EFI_CHIPSET_EC_BAD_BATTERY) > > +#define DXE_SB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | > EFI_CHIPSET_EC_DXE_SB_ERROR ) > > + > > +//Reported by DXE Core > > +#define DXE_BDS_STARTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT) > > + > > +//Reported by BDS > > +//#define DXE_BDS_CONNECT_DRIVERS > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS) > > + > > +//Reported by Boot Manager > > +#define DXE_READY_TO_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER > | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT) > > + > > +//Reported by DXE Core > > +#define DXE_EXIT_BOOT_SERVICES > (EFI_SOFTWARE_EFI_BOOT_SERVICE | > EFI_SW_BS_PC_EXIT_BOOT_SERVICES) > > +#define DXE_EXIT_BOOT_SERVICES_EVENT > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_EXIT_BOOT_SERVICES_EVENT) > > + > > +//Reported by driver that installs Runtime AP > > +#define RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | > EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP) > > +#define RT_SET_VIRTUAL_ADDRESS_MAP_END > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT) > > + > > +//Reported by CSM > > +#define DXE_LEGACY_OPROM_INIT > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_LEGACY_OPROM_INIT) > > +#define DXE_LEGACY_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT) > > +#define DXE_LEGACY_OPROM_NO_SPACE > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_LEGACY_OPROM_NO_SPACE) > > + > > +//Reported by SETUP > > +//#define DXE_SETUP_VERIFYING_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD) > > +#define DXE_SETUP_START (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_PC_USER_SETUP) > > +#define DXE_SETUP_INPUT_WAIT > (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT) > > +#define DXE_INVALID_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_INVALID_PASSWORD) > > +#define DXE_INVALID_IDE_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_INVALID_IDE_PASSWORD) > > +#define DXE_BOOT_OPTION_LOAD_ERROR > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) > > +#define DXE_BOOT_OPTION_FAILED > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED) > > + > > +//Reported by a Driver that installs Reset AP > > +#define DXE_RESET_SYSTEM > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM) > > +#define DXE_RESET_NOT_AVAILABLE > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | > EFI_SW_PS_EC_RESET_NOT_AVAILABLE) > > + > > +// Reported by PCI bus driver > > +#define DXE_PCI_BUS_BEGIN (EFI_IO_BUS_PCI | > EFI_IOB_PC_INIT) > > +#define DXE_PCI_BUS_ENUM (EFI_IO_BUS_PCI | > EFI_IOB_PCI_PC_BUS_ENUM) > > +#define DXE_PCI_BUS_HPC_INIT (EFI_IO_BUS_PCI | > EFI_IOB_PCI_PC_HPC_INIT) > > +#define DXE_PCI_BUS_REQUEST_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_PCI_PC_RES_ALLOC) > > +#define DXE_PCI_BUS_ASSIGN_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_PC_ENABLE) > > +#define DXE_PCI_BUS_HOTPLUG (EFI_IO_BUS_PCI | > EFI_IOB_PC_HOTPLUG) > > +#define DXE_PCI_BUS_OUT_OF_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_EC_RESOURCE_CONFLICT) > > + > > +// Reported by USB bus driver > > +#define DXE_USB_BEGIN (EFI_IO_BUS_USB | EFI_IOB_PC_INIT) > > +#define DXE_USB_RESET (EFI_IO_BUS_USB | > EFI_IOB_PC_RESET) > > +#define DXE_USB_DETECT (EFI_IO_BUS_USB | > EFI_IOB_PC_DETECT) > > +#define DXE_USB_ENABLE (EFI_IO_BUS_USB | > EFI_IOB_PC_ENABLE) > > +#define DXE_USB_HOTPLUG (EFI_IO_BUS_USB | > EFI_IOB_PC_HOTPLUG) > > + > > +//Reported by IDE bus driver > > +#define DXE_IDE_BEGIN (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_INIT) > > +#define DXE_IDE_RESET (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_RESET) > > +#define DXE_IDE_DETECT (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_DETECT) > > +#define DXE_IDE_ENABLE (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_ENABLE) > > +#define DXE_IDE_SMART_ERROR (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD) > > +#define DXE_IDE_CONTROLLER_ERROR (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_EC_CONTROLLER_ERROR) > > +#define DXE_IDE_DEVICE_FAILURE (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_EC_INTERFACE_ERROR) > > + > > +// Reported by SCSI bus driver > > +#define DXE_SCSI_BEGIN (EFI_IO_BUS_SCSI | EFI_IOB_PC_INIT) > > +#define DXE_SCSI_RESET (EFI_IO_BUS_SCSI | > EFI_IOB_PC_RESET) > > +#define DXE_SCSI_DETECT (EFI_IO_BUS_SCSI | > EFI_IOB_PC_DETECT) > > +#define DXE_SCSI_ENABLE (EFI_IO_BUS_SCSI | > EFI_IOB_PC_ENABLE) > > + > > +// Reported by Super I/O driver > > +#define DXE_SIO_INIT (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT) > > + > > +// Reported by Keyboard driver > > +#define DXE_KEYBOARD_INIT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_INIT) > > +#define DXE_KEYBOARD_RESET (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_RESET) > > +#define DXE_KEYBOARD_DISABLE (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_DISABLE) > > +#define DXE_KEYBOARD_DETECT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_PRESENCE_DETECT) > > +#define DXE_KEYBOARD_ENABLE (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_ENABLE) > > +#define DXE_KEYBOARD_CLEAR_BUFFER > (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER) > > +#define DXE_KEYBOARD_SELF_TEST (EFI_PERIPHERAL_KEYBOARD | > EFI_P_KEYBOARD_PC_SELF_TEST) > > + > > +// Reported by Mouse driver > > +#define DXE_MOUSE_INIT (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_INIT) > > +#define DXE_MOUSE_RESET (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_RESET) > > +#define DXE_MOUSE_DISABLE (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_DISABLE) > > +#define DXE_MOUSE_DETECT (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_PRESENCE_DETECT) > > +#define DXE_MOUSE_ENABLE (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_ENABLE) > > + > > +// Reported by Mass Storage drivers > > +#define DXE_FIXED_MEDIA_INIT (EFI_PERIPHERAL_FIXED_MEDIA > | EFI_P_PC_INIT) > > +#define DXE_FIXED_MEDIA_RESET (EFI_PERIPHERAL_FIXED_MEDIA > | EFI_P_PC_RESET) > > +#define DXE_FIXED_MEDIA_DISABLE > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_DISABLE) > > +#define DXE_FIXED_MEDIA_DETECT > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_PRESENCE_DETECT) > > +#define DXE_FIXED_MEDIA_ENABLE > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENABLE) > > +#define DXE_REMOVABLE_MEDIA_INIT > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_INIT) > > +#define DXE_REMOVABLE_MEDIA_RESET > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET) > > +#define DXE_REMOVABLE_MEDIA_DISABLE > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE) > > +#define DXE_REMOVABLE_MEDIA_DETECT > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_PRESENCE_DETECT) > > +#define DXE_REMOVABLE_MEDIA_ENABLE > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE) > > + > > + > > +// Reported by BDS > > +#define DXE_CON_OUT_CONNECT > (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_INIT) > > +#define DXE_CON_IN_CONNECT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_INIT) > > +#define DXE_NO_CON_OUT > (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED) > > +#define DXE_NO_CON_IN (EFI_PERIPHERAL_KEYBOARD | > EFI_P_EC_NOT_DETECTED) > > + > > +#endif > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/PeiBeepStatusCodeHandlerLib.c > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/PeiBeepStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..a29d948951 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/PeiBeepStatusCodeHandlerLib.c > @@ -0,0 +1,101 @@ > +/** @file > > + Beep status code implementation. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Library/PeiServicesLib.h> > > +#include <Library/PeimEntryPoint.h> > > +#include <Library/PcdLib.h> > > +#include <Library/DebugLib.h> > > +#include <Library/ReportStatusCodeLib.h> > > +#include <Ppi/ReportStatusCodeHandler.h> > > + > > +#include <Library/BeepMapLib.h> > > +#include <Library/BeepLib.h> > > + > > +/** > > + Convert status code value to the times of beep. > > + > > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table > published by the PEI Foundation. > > + @param CodeType Indicates the type of status code being reported. > > + @param 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 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 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 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 CONST EFI_PEI_SERVICES **PeiServices, > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value, > > + IN UINT32 Instance, > > + IN CONST EFI_GUID *CallerId, > > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL > > + ) > > +{ > > + UINT32 BeepValue; > > + > > + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); > > + if (BeepValue != 0) { > > + Beep (BeepValue); > > + } > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Constructor function of PeiBeepStatusCodeHandlerLib. > > + > > + This function is the constructor function of this Beep Status Code Handler > Library for PEI Phase. > > + It check whether need beep, and register it to gEfiPeiRscHandlerPpiGuid. > > + > > + @param FileHandle Handle of the file being invoked. > > + @param PeiServices Describes the list of possible PEI Services. > > + > > + @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfully. > > + > > +**/ > > +RETURN_STATUS > > +EFIAPI > > +PeiBeepStatusCodeHandlerLibConstructor ( > > + IN EFI_PEI_FILE_HANDLE FileHandle, > > + IN CONST EFI_PEI_SERVICES **PeiServices > > + ) > > +{ > > + EFI_STATUS Status; > > + EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi; > > + > > + if (!PcdGetBool (PcdStatusCodeUseBeep)) { > > + return RETURN_SUCCESS; > > + } > > + > > + Status = PeiServicesLocatePpi ( > > + &gEfiPeiRscHandlerPpiGuid, > > + 0, > > + NULL, > > + (VOID **) &RscHandlerPpi > > + ); > > + ASSERT_EFI_ERROR (Status); > > + > > + Status = RscHandlerPpi->Register (BeepStatusCodeReportWorker); > > + ASSERT_EFI_ERROR (Status); > > + > > + return RETURN_SUCCESS; > > +} > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/PeiBeepStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/PeiBeepStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..421b246663 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/PeiBeepStatusCodeHandlerLib.inf > @@ -0,0 +1,49 @@ > +## @file > > +# Beep status code implementation. > > +# > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +# vendor. This file may not be modified, except as allowed by > > +# additional terms of your license agreement. > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010005 > > + BASE_NAME = PeiBeepStatusCodeHandlerLib > > + FILE_GUID = C4210E71-0A38-4728-8D25-4876348AA380 > > + MODULE_TYPE = PEIM > > + CONSTRUCTOR = PeiBeepStatusCodeHandlerLibConstructor > > + LIBRARY_CLASS = StatusCodeHandlerLib|SEC PEIM PEI_COR > > + > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > +# > > + > > +[Sources] > > + PeiBeepStatusCodeHandlerLib.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + MdeModulePkg/MdeModulePkg.dec > > + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > + > > +[LibraryClasses] > > + PeiServicesLib > > + PcdLib > > + DebugLib > > + ReportStatusCodeLib > > + BeepMapLib > > + BeepLib > > + > > +[Pcd] > > + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep > ## CONSUMES > > + > > +[Ppis] > > + gEfiPeiRscHandlerPpiGuid ## CONSUMES > > + > > +[Depex] > > + TRUE > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..631e2eecae > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c > @@ -0,0 +1,184 @@ > +/** @file > > + Beep status code implementation. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Library/UefiDriverEntryPoint.h> > > +#include <Library/UefiBootServicesTableLib.h> > > +#include <Guid/EventGroup.h> > > +#include <Library/PcdLib.h> > > +#include <Library/DebugLib.h> > > +#include <Library/ReportStatusCodeLib.h> > > +#include <Protocol/ReportStatusCodeHandler.h> > > + > > +#include <Library/BeepMapLib.h> > > +#include <Library/BeepLib.h> > > + > > +EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL; > > +EFI_EVENT mExitBootServicesEvent = NULL; > > +BOOLEAN mRegistered = FALSE; > > + > > +/** > > + Convert status code value to the times of beep. > > + > > + @param CodeType Indicates the type of status code being reported. > > + @param 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 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 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 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 > > + ) > > +{ > > + UINT32 BeepValue; > > + > > + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); > > + if (BeepValue != 0) { > > + Beep (BeepValue); > > + } > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Unregister status code callback functions only available at boot time from > > + report status code router when exiting boot services. > > + > > + @param Event Event whose notification function is being invoked. > > + @param Context Pointer to the notification function's context, which is > > + always zero in current implementation. > > + > > +**/ > > +VOID > > +EFIAPI > > +UnregisterBeepBootTimeHandlers ( > > + IN EFI_EVENT Event, > > + IN VOID *Context > > + ) > > +{ > > + if (mRegistered) { > > + mRscHandlerProtocol->Unregister (BeepStatusCodeReportWorker); > > + } > > +} > > + > > +/** > > + Register status code callback function only when Report Status Code > protocol > > + is installed. > > + > > + @param Event Event whose notification function is being invoked. > > + @param Context Pointer to the notification function's context, which is > > + always zero in current implementation. > > + > > +**/ > > +VOID > > +EFIAPI > > +RegisterBeepBootTimeHandlers ( > > + IN EFI_EVENT Event, > > + IN VOID *Context > > + ) > > +{ > > + EFI_STATUS Status; > > + > > + Status = gBS->LocateProtocol ( > > + &gEfiRscHandlerProtocolGuid, > > + NULL, > > + (VOID **) &mRscHandlerProtocol > > + ); > > + ASSERT_EFI_ERROR (Status); > > + > > + mRscHandlerProtocol->Register (BeepStatusCodeReportWorker, > TPL_HIGH_LEVEL); > > + ASSERT_EFI_ERROR (Status); > > + mRegistered = TRUE; > > + > > + Status = gBS->CreateEventEx ( > > + EVT_NOTIFY_SIGNAL, > > + TPL_NOTIFY, > > + UnregisterBeepBootTimeHandlers, > > + NULL, > > + &gEfiEventExitBootServicesGuid, > > + &mExitBootServicesEvent > > + ); > > + ASSERT_EFI_ERROR (Status); > > +} > > + > > +/** > > + Constructor function of RuntimeDxeBeepStatusCodeHandlerLib. > > + > > + This function allocates memory for extended status code data, caches > > + the report status code service, and registers events. > > + > > + @param ImageHandle The firmware allocated handle for the EFI image. > > + @param SystemTable A pointer to the EFI System Table. > > + > > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RuntimeDxeBeepStatusCodeHandlerLibConstructor ( > > + IN EFI_HANDLE ImageHandle, > > + IN EFI_SYSTEM_TABLE *SystemTable > > + ) > > +{ > > + EFI_STATUS Status; > > + EFI_EVENT RegisterStatusCodeHandlerEvent; > > + VOID *Registration; > > + > > + if (!PcdGetBool (PcdStatusCodeUseBeep)) { > > + return EFI_SUCCESS; > > + } > > + > > + Status = gBS->LocateProtocol ( > > + &gEfiRscHandlerProtocolGuid, > > + NULL, > > + (VOID **) &mRscHandlerProtocol > > + ); > > + > > + if (!EFI_ERROR (Status)) { > > + RegisterBeepBootTimeHandlers (NULL, NULL); > > + } else { > > + Status = gBS->CreateEvent ( > > + EVT_NOTIFY_SIGNAL, > > + TPL_NOTIFY, > > + RegisterBeepBootTimeHandlers, > > + NULL, > > + &RegisterStatusCodeHandlerEvent > > + ); > > + ASSERT_EFI_ERROR (Status); > > + > > + // > > + // Register for protocol notifications on this event > > + // > > + Status = gBS->RegisterProtocolNotify ( > > + &gEfiRscHandlerProtocolGuid, > > + RegisterStatusCodeHandlerEvent, > > + &Registration > > + ); > > + ASSERT_EFI_ERROR (Status); > > + } > > + > > + return EFI_SUCCESS; > > +} > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..b9aae39128 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf > @@ -0,0 +1,51 @@ > +## @file > > +# Beep status code implementation. > > +# > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +# vendor. This file may not be modified, except as allowed by > > +# additional terms of your license agreement. > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010005 > > + BASE_NAME = RuntimeDxeBeepStatusCodeHandlerLib > > + FILE_GUID = D05F43CE-7C70-4663-848F-8265C311A8A5 > > + MODULE_TYPE = DXE_RUNTIME_DRIVER > > + VERSION_STRING = 1.0 > > + CONSTRUCTOR = > RuntimeDxeBeepStatusCodeHandlerLibConstructor > > + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_RUNTIME_DRIVER > > + > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > +# > > + > > +[Sources] > > + RuntimeDxeBeepStatusCodeHandlerLib.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + MdeModulePkg/MdeModulePkg.dec > > + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > + > > +[LibraryClasses] > > + UefiBootServicesTableLib > > + UefiRuntimeLib > > + PcdLib > > + DebugLib > > + ReportStatusCodeLib > > + BeepMapLib > > + BeepLib > > + > > +[Pcd] > > + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep > ## CONSUMES > > + > > +[Protocols] > > + gEfiRscHandlerProtocolGuid ## CONSUMES > > + > > +[Depex] > > + TRUE > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/SmmBeepStatusCodeHandlerLib.c > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/SmmBeepStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..6b1125f4c2 > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/SmmBeepStatusCodeHandlerLib.c > @@ -0,0 +1,138 @@ > +/** @file > > + Beep status code implementation. > > + > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include <Library/UefiDriverEntryPoint.h> > > +#include <Library/SmmServicesTableLib.h> > > +#include <Library/PcdLib.h> > > +#include <Library/DebugLib.h> > > +#include <Library/ReportStatusCodeLib.h> > > +#include <Protocol/SmmReportStatusCodeHandler.h> > > + > > +#include <Library/BeepMapLib.h> > > +#include <Library/BeepLib.h> > > + > > +/** > > + Convert status code value to the times of beep. > > + > > + @param CodeType Indicates the type of status code being reported. > > + @param 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 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 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 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 > > + ) > > +{ > > + UINT32 BeepValue; > > + > > + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); > > + if (BeepValue != 0) { > > + Beep (BeepValue); > > + } > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Register status code callback function only when Report Status Code > protocol > > + is installed. > > + > > + @param Protocol Points to the protocol's unique identifier. > > + @param Interface Points to the interface instance. > > + @param Handle The handle on which the interface was installed. > > + > > + @retval EFI_SUCCESS Notification runs successfully. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +RegisterBeepBootTimeHandlers ( > > + IN CONST EFI_GUID *Protocol, > > + IN VOID *Interface, > > + IN EFI_HANDLE Handle > > + ) > > +{ > > + EFI_STATUS Status; > > + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; > > + > > + Status = gSmst->SmmLocateProtocol ( > > + &gEfiSmmRscHandlerProtocolGuid, > > + NULL, > > + (VOID **) &RscHandlerProtocol > > + ); > > + ASSERT_EFI_ERROR (Status); > > + > > + RscHandlerProtocol->Register (BeepStatusCodeReportWorker); > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Constructor function of SmmBeepStatusCodeHandlerLib. > > + > > + This function allocates memory for extended status code data, caches > > + the report status code service, and registers events. > > + > > + @param ImageHandle The firmware allocated handle for the EFI image. > > + @param SystemTable A pointer to the EFI System Table. > > + > > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +SmmBeepStatusCodeHandlerLibConstructor ( > > + IN EFI_HANDLE ImageHandle, > > + IN EFI_SYSTEM_TABLE *SystemTable > > + ) > > +{ > > + EFI_STATUS Status; > > + VOID *Registration; > > + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; > > + > > + if (!PcdGetBool (PcdStatusCodeUseBeep)) { > > + return EFI_SUCCESS; > > + } > > + > > + Status = gSmst->SmmLocateProtocol ( > > + &gEfiSmmRscHandlerProtocolGuid, > > + NULL, > > + (VOID **) &RscHandlerProtocol > > + ); > > + if (!EFI_ERROR (Status)) { > > + RegisterBeepBootTimeHandlers (NULL, NULL, NULL); > > + } else { > > + gSmst->SmmRegisterProtocolNotify ( > > + &gEfiSmmRscHandlerProtocolGuid, > > + RegisterBeepBootTimeHandlers, > > + &Registration > > + ); > > + } > > + > > + return EFI_SUCCESS; > > +} > > diff --git > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/SmmBeepStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/SmmBeepStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..caa82264ae > --- /dev/null > +++ > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > eHandlerLib/SmmBeepStatusCodeHandlerLib.inf > @@ -0,0 +1,50 @@ > +## @file > > +# Beep status code implementation. > > +# > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +# vendor. This file may not be modified, except as allowed by > > +# additional terms of your license agreement. > > +# > > +## > > + > > +[Defines] > > + INF_VERSION = 0x00010005 > > + BASE_NAME = SmmBeepStatusCodeHandlerLib > > + FILE_GUID = 2E2BC2D4-572D-4663-9A1E-FB52FA30922A > > + MODULE_TYPE = DXE_SMM_DRIVER > > + VERSION_STRING = 1.0 > > + CONSTRUCTOR = SmmBeepStatusCodeHandlerLibConstructor > > + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_SMM_DRIVER > > + > > +# > > +# The following information is for reference only and not required by the > build tools. > > +# > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > +# > > + > > +[Sources] > > + SmmBeepStatusCodeHandlerLib.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + MdeModulePkg/MdeModulePkg.dec > > + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > + > > +[LibraryClasses] > > + SmmServicesTableLib > > + PcdLib > > + DebugLib > > + ReportStatusCodeLib > > + BeepMapLib > > + BeepLib > > + > > +[Pcd] > > + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep > ## CONSUMES > > + > > +[Protocols] > > + gEfiSmmRscHandlerProtocolGuid ## CONSUMES > > + > > +[Depex] > > + TRUE > > diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md > new file mode 100644 > index 0000000000..ee254d0f99 > --- /dev/null > +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md > @@ -0,0 +1,125 @@ > +# Overview > > +* **Feature Name:** Beep Debug > > +* **PI Phase(s) Supported:** PEI, DXE, SMM > > +* **SMM Required?** Yes > > + > > +More Information: > > + > > +## Purpose > > +The BeepDebugFeaturePkg include some useful beep debug libraries, such > as get beep value from status code and beep. > > +This is an important capability in firmware development to get and analyze > the early error when there is not serial port. > > + > > + > > +# High-Level Theory of Operation > > +It provide a library BeepStatusCodeHandlerLib used by edk2 > StatusCodeHandler.efi, used to do beep if needed. > > +It also provide a library of BeepMap lib, it map the status code to beep value. > > +A library of Beep lib is needed by platform, and this pkg has a Null > implementation. > > + > > +In the library contstructor function, BeepStatusCodeHandlerLib register the > call back function for ReportStatusCode. > > +When called, it call GetBeepFromStatusCode() in BeepMapLib to get beep > value from status code, and call Beep() in BeepLib to beep. > > + > > +BeepStatusCodeHandlerLib include 3 libraries for PEI, RuntimeDxe, SMM: > > +* PeiBeepStatusCodeHandlerLib > > +* RuntimeDxeBeepStatusCodeHandlerLib > > +* SmmBeepStatusCodeHandlerLib > > + > > +## Firmware Volumes > > +Linked with StatusCodeHandler.efi, and make sure put the > StatusCodeHandler.efi after the ReportStatusCodeRouter.efi. > > + > > +## Modules > > +* BeepStatusCodeHandlerLib > > +* BeepMapLib > > +* BeepLibNull > > + > > +## BeepStatusCodeHandlerLib > > +This library register the call back function for ReportStatusCode, and get > beep valude from status code, and do beep. > > + > > +## BeepMapLib > > +This library provide a function to get beep value from status code. > > + > > +## Key Functions > > +* In PeiBeepStatusCodeHandlerLib: > > + EFI_STATUS > > + EFIAPI > > + BeepStatusCodeReportWorker ( > > + IN CONST EFI_PEI_SERVICES **PeiServices, > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value, > > + IN UINT32 Instance, > > + IN CONST EFI_GUID *CallerId, > > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL > > + ) > > + > > +* In RuntimeDxeBeepStatusCodeHandlerLib: > > + 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 > > + ) > > + > > +* In SmmBeepStatusCodeHandlerLib: > > + 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 > > + ) > > + > > +* In BeepMapLib: > > + UINT32 > > + EFIAPI > > + GetBeepValueFromStatusCode ( > > + IN EFI_STATUS_CODE_TYPE CodeType, > > + IN EFI_STATUS_CODE_VALUE Value > > + ) > > + > > +* In BeepLib: > > + VOID > > + EFIAPI > > + Beep ( > > + IN UINT32 Value > > + ) > > + > > +## Configuration > > +* Link the library to StatusCodeHandler.efi. > > + Example: > > + > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan > dlerRuntimeDxe.inf { > > + <LibraryClasses> > > + > NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeD > xeBeepStatusCodeHandlerLib.inf > > + } > > + Refer to BeepDebugFeature.dsc for other example. > > +* Config PCD > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep. > > + In platform .dsc file, need to config the type of > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep. > > + Use PcdsFixedAtBuild to save binary size, and use PcdsDynamic if want to > enable/disable in runtime. > > +* Implemented platform's special BeepMapLib if needed. > > +* Provide the platform's special BeepLib. > > +* Make sure put the StatusCodeHandler.efi after the > ReportStatusCodeRouter.efi. > > + > > +## Data Flows > > +Status Code (ReportStatusCode) -> Beep Value > (GetBeepValueFromStatusCode). > > + > > +## Control Flows > > +ReportStatusCode() -> BeepStatusCodeReportWorker() -> > GetBeepValueFromStatusCode() -> Beep() > > + > > +## Build Flows > > +There is not special build flows. > > + > > +## Test Point Results > > +Verify the post code shown is correct. > > + > > +## Functional Exit Criteria > > +N/A > > + > > +## Feature Enabling Checklist > > +* Set the PCD > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep to TRUE. > > +* Plug out all the memory, check can here the beep. > > + > > +## Common Optimizations > > +* Implemented platform's special BeepMapLib if needed. > > -- > 2.24.0.windows.2 > > > -=-=-=-=-=-= > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#61333): https://edk2.groups.io/g/devel/message/61333 > Mute This Topic: https://groups.io/mt/74913971/1768738 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [dandan.bi@intel.com] > -=-=-=-=-=-= ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: add it. 2020-06-17 8:25 ` [edk2-devel] [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: " Dandan Bi @ 2020-06-18 0:45 ` Dandan Bi 0 siblings, 0 replies; 5+ messages in thread From: Dandan Bi @ 2020-06-18 0:45 UTC (permalink / raw) To: devel@edk2.groups.io, Tan, Ming; +Cc: Dong, Eric, Gao, Liming Please ignore my previous comments. Reviewed-by: Dandan Bi <dandan.bi@intel.com> Thanks, Dandan > -----Original Message----- > From: Bi, Dandan > Sent: Wednesday, June 17, 2020 4:25 PM > To: devel@edk2.groups.io; Tan, Ming <ming.tan@intel.com> > Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com> > Subject: RE: [edk2-devel] [PATCH v7 1/2] > Features/Intel/BeepDebugFeaturePkg: add it. > > Hi Min, > > I have one minor comment about the function name of > RegisterBeepBootTimeHandlers. > Since this is the notification function of installation of status code handler > protocol, could you help update it to make it more readable? > Same comment for the function RegisterPostCodeBootTimeHandlers in > patch 2. > > Thanks, > Dandan > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tan, > > Ming > > Sent: Tuesday, June 16, 2020 7:26 PM > > To: devel@edk2.groups.io > > Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com> > > Subject: [edk2-devel] [PATCH v7 1/2] > Features/Intel/BeepDebugFeaturePkg: > > add it. > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2792 > > > > The BeepDebugFeaturePkg include some useful beep debug > > libraries, such as get beep value from status code and beep. > > > > It provide a library BeepStatusCodeHandlerLib used by edk2 > > StatusCodeHandler.efi, used to do beep if needed. > > It also provide a library of BeepMap lib, it map the status code > > to beep value. > > A library of Beep lib is needed by platform, and this pkg has a > > Null implementation. > > > > Cc: Eric Dong <eric.dong@intel.com> > > Cc: Liming Gao <liming.gao@intel.com> > > Signed-off-by: Ming Tan <ming.tan@intel.com> > > --- > > V7: Add the dec files in AdvancedFeaturesPcd.dsc. Combine Beep and > > PostCode to 2/2 patchs. > > V6: Modify some bug when include the platform dsc file. And modify > > Readme.md. > > V5: In .inf files, remove some useless library. > > In RuntimeDxeBeepStatusCodeHandlerLib.c, add a variable to indicate > > whether need unregister. > > V4: Change Include/BeepDebugFeature.dsc, make it can be included in > > platform dsc file. > > V3: Modify according the Eric's review comments. > > V2: Delete the last empty line in > > BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf > > .../Include/AdvancedFeaturesPcd.dsc | 83 +++--- > > .../BeepDebugFeaturePkg.dec | 36 +++ > > .../BeepDebugFeaturePkg.dsc | 30 ++ > > .../Include/BeepDebugFeature.dsc | 201 +++++++++++++ > > .../Include/Library/BeepLib.h | 33 +++ > > .../Include/Library/BeepMapLib.h | 32 +++ > > .../Library/BeepLib/BeepLibNull.c | 37 +++ > > .../Library/BeepLib/BeepLibNull.inf | 26 ++ > > .../Library/BeepMapLib/BeepMapLib.c | 116 ++++++++ > > .../Library/BeepMapLib/BeepMapLib.inf | 27 ++ > > .../BeepMapLib/PlatformStatusCodesInternal.h | 270 > > ++++++++++++++++++ > > .../PeiBeepStatusCodeHandlerLib.c | 101 +++++++ > > .../PeiBeepStatusCodeHandlerLib.inf | 49 ++++ > > .../RuntimeDxeBeepStatusCodeHandlerLib.c | 184 ++++++++++++ > > .../RuntimeDxeBeepStatusCodeHandlerLib.inf | 51 ++++ > > .../SmmBeepStatusCodeHandlerLib.c | 138 +++++++++ > > .../SmmBeepStatusCodeHandlerLib.inf | 50 ++++ > > .../Debugging/BeepDebugFeaturePkg/Readme.md | 125 ++++++++ > > 18 files changed, 1548 insertions(+), 41 deletions(-) > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.d > > ec > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.d > > sc > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFeat > > ure.dsc > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLib. > > h > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepMa > > pLib.h > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLib > > Null.c > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLib > > Null.inf > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Bee > > pMapLib.c > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Bee > > pMapLib.inf > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Plat > > formStatusCodesInternal.h > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > > HandlerLib/PeiBeepStatusCodeHandlerLib.c > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > > HandlerLib/PeiBeepStatusCodeHandlerLib.inf > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > > HandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > > HandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > > HandlerLib/SmmBeepStatusCodeHandlerLib.c > > create mode 100644 > > > Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCode > > HandlerLib/SmmBeepStatusCodeHandlerLib.inf > > create mode 100644 > > Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md > > > > diff --git > > a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > > b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > > index 836da7c944..366b551bd3 100644 > > --- > > a/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > > +++ > > b/Features/Intel/AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc > > @@ -1,41 +1,42 @@ > > -## @file > > > > > > -# DSC file for defining Pcd of advanced features. > > > > > > -# > > > > > > -# This file is intended to be included into another package so advanced > > features > > > > > > -# can be conditionally built by enabling the respective feature via its > > FeaturePCD. > > > > > > -# > > > > > > -# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > > > > > -# > > > > > > -# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > -# > > > > > > -## > > > > > > - > > > > > > -# > > > > > > -# The section references the package DEC files, > > > > > > -# it allow a FeaturePCD to be used in a conditional statement > > > > > > -# > > > > > > -[Packages] > > > > > > - MdePkg/MdePkg.dec > > > > > > - AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec > > > > > > - Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec > > > > > > - NetworkFeaturePkg/NetworkFeaturePkg.dec > > > > > > - IpmiFeaturePkg/IpmiFeaturePkg.dec > > > > > > - S3FeaturePkg/S3FeaturePkg.dec > > > > > > - SmbiosFeaturePkg/SmbiosFeaturePkg.dec > > > > > > - UserAuthFeaturePkg/UserAuthFeaturePkg.dec > > > > > > - LogoFeaturePkg/LogoFeaturePkg.dec > > > > > > - > > > > > > -# > > > > > > -# The section below sets all PCDs to FALSE in this DSC file so the feature is > > not enabled by default. > > > > > > -# Board can set PCDs to TRUE in its DSC file to enable a subset of advanced > > features > > > > > > -# > > > > > > -[PcdsFeatureFlag] > > > > > > - gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable > > |FALSE > > > > > > - gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable > |FALSE > > > > > > - gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable > > |FALSE > > > > > > - gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |FALSE > > > > > > - gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable > > |FALSE > > > > > > - gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable > > |FALSE > > > > > > - > > > gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnabl > > e |FALSE > > > > > > - gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable > > |FALSE > > > > > > - gLogoFeaturePkgTokenSpaceGuid.PcdJpgEnable |FALSE > > > > > > +## @file > > > > +# DSC file for defining Pcd of advanced features. > > > > +# > > > > +# This file is intended to be included into another package so advanced > > features > > > > +# can be conditionally built by enabling the respective feature via its > > FeaturePCD. > > > > +# > > > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > > > +# > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +## > > > > + > > > > +# > > > > +# The section references the package DEC files, > > > > +# it allow a FeaturePCD to be used in a conditional statement > > > > +# > > > > +[Packages] > > > > + MdePkg/MdePkg.dec > > > > + AcpiDebugFeaturePkg/AcpiDebugFeaturePkg.dec > > > > + Usb3DebugFeaturePkg/Usb3DebugFeaturePkg.dec > > > > + NetworkFeaturePkg/NetworkFeaturePkg.dec > > > > + IpmiFeaturePkg/IpmiFeaturePkg.dec > > > > + S3FeaturePkg/S3FeaturePkg.dec > > > > + SmbiosFeaturePkg/SmbiosFeaturePkg.dec > > > > + UserAuthFeaturePkg/UserAuthFeaturePkg.dec > > > > + LogoFeaturePkg/LogoFeaturePkg.dec > > > > + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > > > + > > > > +# > > > > +# The section below sets all PCDs to FALSE in this DSC file so the feature is > > not enabled by default. > > > > +# Board can set PCDs to TRUE in its DSC file to enable a subset of advanced > > features > > > > +# > > > > +[PcdsFeatureFlag] > > > > + gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable > > |FALSE > > > > + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable > > |FALSE > > > > + gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable > > |FALSE > > > > + gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable |FALSE > > > > + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable > > |FALSE > > > > + gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable > > |FALSE > > > > + > > > gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnabl > > e |FALSE > > > > + gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable > > |FALSE > > > > + gLogoFeaturePkgTokenSpaceGuid.PcdJpgEnable |FALSE > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > > .dec > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > > .dec > > new file mode 100644 > > index 0000000000..4f4b36b091 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > > .dec > > @@ -0,0 +1,36 @@ > > +## @file > > > > +# This package provides Beep Debug feature. > > > > +# This package should only depend on EDK II Core packages, > IntelSiliconPkg, > > and MinPlatformPkg. > > > > +# > > > > +# The DEC files are used by the utilities that parse DSC and > > > > +# INF files to generate AutoGen.c and AutoGen.h files > > > > +# for the build infrastructure. > > > > +# > > > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > > > +# > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + DEC_SPECIFICATION = 0x00010017 > > > > + PACKAGE_NAME = BeepDebugFeaturePkg > > > > + PACKAGE_GUID = DD88CEBB-E68F-4155-B754-D11E4FDF008D > > > > + PACKAGE_VERSION = 0.1 > > > > + > > > > +[Includes] > > > > + Include > > > > + > > > > +[LibraryClasses] > > > > + ## @libraryclass Provide the function to map the status code to beep > > value. > > > > + BeepMapLib|Include/Library/BeepMapLib.h > > > > + > > > > + ## @libraryclass Provide the function to do the real beep. > > > > + BeepLib|Include/Library/BeepLib.h > > > > + > > > > +[Guids] > > > > + gBeepDebugFeaturePkgTokenSpaceGuid = {0x54f56fb5, 0xea0e, 0x4518, > > {0xa0, 0x3e, 0x1b, 0xeb, 0x56, 0x94, 0xd2, 0x16}} > > > > + > > > > +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, > PcdsDynamicEx] > > > > + # Beep is a legacy feature, disabled it by default > > > > + > > > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep|FALSE|B > > OOLEAN|0x00000001 > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > > .dsc > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > > .dsc > > new file mode 100644 > > index 0000000000..47254f9974 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg > > .dsc > > @@ -0,0 +1,30 @@ > > +## @file > > > > +# This package provides Beep Debug feature. > > > > +# This package should only depend on EDK II Core packages, > IntelSiliconPkg, > > and MinPlatformPkg. > > > > +# > > > > +# The DEC files are used by the utilities that parse DSC and > > > > +# INF files to generate AutoGen.c and AutoGen.h files > > > > +# for the build infrastructure. > > > > +# > > > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > > > +# > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + PLATFORM_NAME = BeepDebugFeaturePkg > > > > + PLATFORM_GUID = D716EDF2-77BB-4536-9C64-4D7EEF0F3896 > > > > + PLATFORM_VERSION = 0.1 > > > > + DSC_SPECIFICATION = 0x00010005 > > > > + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) > > > > + SUPPORTED_ARCHITECTURES = IA32|X64 > > > > + BUILD_TARGETS = DEBUG|RELEASE|NOOPT > > > > + SKUID_IDENTIFIER = DEFAULT > > > > + PEI_ARCH = IA32 > > > > + DXE_ARCH = X64 > > > > + > > > > +# > > > > +# This package always builds the feature. > > > > +# > > > > +!include Include/BeepDebugFeature.dsc > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFe > > ature.dsc > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFe > > ature.dsc > > new file mode 100644 > > index 0000000000..65e00b5979 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFe > > ature.dsc > > @@ -0,0 +1,201 @@ > > +## @file > > > > +# This package provides Beep Debug feature. > > > > +# This file should be included into another package DSC file to build this > > feature. > > > > +# > > > > +# The DEC files are used by the utilities that parse DSC and > > > > +# INF files to generate AutoGen.c and AutoGen.h files > > > > +# for the build infrastructure. > > > > +# > > > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > > > +# > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +## > > > > + > > > > > +######################################################### > > ####################### > > > > +# > > > > +# Defines Section - statements that will be processed to create a Makefile. > > > > +# > > > > > +######################################################### > > ####################### > > > > +[Defines] > > > > +!ifndef $(PEI_ARCH) > > > > + !error "PEI_ARCH must be specified to build this feature!" > > > > +!endif > > > > +!ifndef $(DXE_ARCH) > > > > + !error "DXE_ARCH must be specified to build this feature!" > > > > +!endif > > > > + > > > > > +######################################################### > > ####################### > > > > +# > > > > +# PCD Section - list of PCD Entries modified by the feature. > > > > +# > > > > > +######################################################### > > ####################### > > > > + > > > > +# Unmark the following and StatusCodeHandler.efi to build the .dsc file > > directly > > > > +#[PcdsDynamicDefault] > > > > +# > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep|TRUE > > > > + > > > > > +######################################################### > > ####################### > > > > +# > > > > +# Library Class section - list of all Library Classes needed by this feature. > > > > +# > > > > > +######################################################### > > ####################### > > > > +[LibraryClasses] > > > > + ####################################### > > > > + # Edk2 Packages > > > > + ####################################### > > > > + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf > > > > + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf > > > > + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf > > > > + > DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf > > > > + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf > > > > + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > > > > + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf > > > > + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf > > > > + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf > > > > + > > > TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTem > > plate.inf > > > > + > > > UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo > > otServicesTableLib.inf > > > > + > > > UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry > > Point.inf > > > > + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf > > > > + > > > UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib > > /UefiRuntimeServicesTableLib.inf > > > > + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf > > > > + > > > > +[LibraryClasses.common.PEIM] > > > > + ####################################### > > > > + # Edk2 Packages > > > > + ####################################### > > > > + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf > > > > + > > > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemory > > AllocationLib.inf > > > > + > > > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/P > > eiServicesTablePointerLibIdt.inf > > > > + > > > > > +[LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE,LibraryClasses.IA32 > > .SEC] > > > > + ####################################### > > > > + # Edk2 Packages > > > > + ####################################### > > > > + > > > ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiR > > eportStatusCodeLib.inf > > > > + > > > > +[LibraryClasses.common.DXE_DRIVER] > > > > + ####################################### > > > > + # Edk2 Packages > > > > + ####################################### > > > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > > > + > > > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > > ryAllocationLib.inf > > > > + > > > > +[LibraryClasses.common.DXE_RUNTIME_DRIVER] > > > > + ####################################### > > > > + # Edk2 Packages > > > > + ####################################### > > > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > > > + > > > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > > ryAllocationLib.inf > > > > + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf > > > > + > > > ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCod > > eLib/RuntimeDxeReportStatusCodeLib.inf > > > > + > > > > +[LibraryClasses.common.UEFI_DRIVER] > > > > + ####################################### > > > > + # Edk2 Packages > > > > + ####################################### > > > > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf > > > > + > > > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > > ryAllocationLib.inf > > > > + > > > > +[LibraryClasses.X64.DXE_SMM_DRIVER] > > > > + ####################################### > > > > + # Edk2 Packages > > > > + ####################################### > > > > + > > > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT > > ableLib.inf > > > > + > > > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe > > moryAllocationLib.inf > > > > + SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf > > > > + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf > > > > + > > > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/S > > mmReportStatusCodeLib.inf > > > > + > > > > > +######################################################### > > ####################### > > > > +# > > > > +# Component section - list of all components that need built for this > feature. > > > > +# > > > > +# Note: The EDK II DSC file is not used to specify how compiled binary > > images get placed > > > > +# into firmware volume images. This section is just a list of modules to > > compile from > > > > +# source into UEFI-compliant binaries. > > > > +# It is the FDF file that contains information on combining binary files > into > > firmware > > > > +# volume images, whose concept is beyond UEFI and is described in PI > > specification. > > > > +# There may also be modules listed in this section that are not required > > in the FDF file, > > > > +# When a module listed here is excluded from FDF file, then UEFI- > > compliant binary will be > > > > +# generated for it, but the binary will not be put into any firmware > > volume. > > > > +# > > > > > +######################################################### > > ####################### > > > > +# > > > > +# Feature PEI Components > > > > +# > > > > + > > > > +# @todo: Change below line to [Components.$(PEI_ARCH)] after > > https://bugzilla.tianocore.org/show_bug.cgi?id=2308 > > > > +# is completed. > > > > +[Components.IA32] > > > > + ##################################### > > > > + # Beep Debug Feature Package > > > > + ##################################### > > > > + > > > > + # Add library instances here that are not included in package > components > > and should be tested > > > > + # in the package build. > > > > + > > > BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusC > > odeHandlerLib.inf > > > > + > > > > + # The following is an example for used with StatusCodeHandler: > > > > +# > > > MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.in > > f { > > > > +# <LibraryClasses> > > > > +# > > > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > > ull/OemHookStatusCodeLibNull.inf > > > > +# > > > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > > f > > > > +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf > > > > +# > > BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf > > > > +# > > > NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepSt > > atusCodeHandlerLib.inf > > > > +# } > > > > + > > > > + # Add components here that should be included in the package build. > > > > + > > > > +# > > > > +# Feature DXE Components > > > > +# > > > > + > > > > +# @todo: Change below line to [Components.$(DXE_ARCH)] after > > https://bugzilla.tianocore.org/show_bug.cgi?id=2308 > > > > +# is completed. > > > > +[Components.X64] > > > > + ##################################### > > > > + # Beep Debug Feature Package > > > > + ##################################### > > > > + > > > > + # Add library instances here that are not included in package > components > > and should be tested > > > > + # in the package build. > > > > + > > > BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBee > > pStatusCodeHandlerLib.inf > > > > + > > > BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatus > > CodeHandlerLib.inf > > > > + > > > > + # The following is an example for used with StatusCodeHandler: > > > > +# > > > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan > > dlerRuntimeDxe.inf { > > > > +# <LibraryClasses> > > > > +# > > > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > > ull/OemHookStatusCodeLibNull.inf > > > > +# > > > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > > f > > > > +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf > > > > +# > > BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf > > > > +# > > > NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeD > > xeBeepStatusCodeHandlerLib.inf > > > > +# } > > > > + > > > > +# > > > MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSm > > m.inf { > > > > +# <LibraryClasses> > > > > +# > > > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > > ull/OemHookStatusCodeLibNull.inf > > > > +# > > > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in > > f > > > > +# BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf > > > > +# > > BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf > > > > +# > > > NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeep > > StatusCodeHandlerLib.inf > > > > +# } > > > > + > > > > + # Add components here that should be included in the package build. > > > > + > > > > > +######################################################### > > ########################################## > > > > +# > > > > +# BuildOptions Section - Define the module specific tool chain flags that > > should be used as > > > > +# the default flags for a module. These flags are appended to > > any > > > > +# standard flags that are defined by the build process. They > can > > be > > > > +# applied for any modules or only those modules with the > > specific > > > > +# module style (EDK or EDKII) specified in [Components] > section. > > > > +# > > > > +# For advanced features, it is recommended to enable > > [BuildOptions] in > > > > +# the applicable INF file so it does not affect the whole board > > package > > > > +# build when this DSC file is active. > > > > +# > > > > > +######################################################### > > ########################################## > > > > +[BuildOptions] > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLi > > b.h > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLi > > b.h > > new file mode 100644 > > index 0000000000..f768acc557 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLi > > b.h > > @@ -0,0 +1,33 @@ > > +/** @file > > > > + Provides services to send progress/error codes to Beep device. > > > > + > > > > + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#ifndef __BEEP_LIB_H__ > > > > +#define __BEEP_LIB_H__ > > > > + > > > > +/** > > > > + Sends a 32-bit value to Beep device. > > > > + > > > > + Sends the 32-bit value specified by Value to Beep device, and returns > > Value. > > > > + Some implementations of this library function may perform I/O > operations > > > > + directly to Beep device. Other implementations may send Value to > > > > + ReportStatusCode(), and the status code reporting mechanism will > > eventually > > > > + display the 32-bit value on the status reporting device. > > > > + > > > > + Beep() must actively prevent recursion. If Beep() is called while > > > > + processing another Post Code Library function, then > > > > + Beep() must return Value immediately. > > > > + > > > > + @param Value Beep count. > > > > +**/ > > > > +VOID > > > > +EFIAPI > > > > +Beep ( > > > > + IN UINT32 Value > > > > + ); > > > > + > > > > +#endif > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepM > > apLib.h > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepM > > apLib.h > > new file mode 100644 > > index 0000000000..7600d72ecd > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepM > > apLib.h > > @@ -0,0 +1,32 @@ > > +/** @file > > > > + This library class provides Platform Beep Map. > > > > + > > > > + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#ifndef __BEEP_MAP_LIB__ > > > > +#define __BEEP_MAP_LIB__ > > > > + > > > > +/** > > > > + Get BeepValue from status code type and value. > > > > + > > > > + @param CodeType Indicates the type of status code being reported. > > > > + @param 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. > > > > + > > > > + @return BeepValue > > > > + > > > > +**/ > > > > +UINT32 > > > > +EFIAPI > > > > +GetBeepValueFromStatusCode ( > > > > + IN EFI_STATUS_CODE_TYPE CodeType, > > > > + IN EFI_STATUS_CODE_VALUE Value > > > > + ); > > > > + > > > > +#endif > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > > bNull.c > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > > bNull.c > > new file mode 100644 > > index 0000000000..a0bd946b50 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > > bNull.c > > @@ -0,0 +1,37 @@ > > +/** @file > > > > + BeepLib Null implementation. > > > > + > > > > + Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#include <Base.h> > > > > +#include <Uefi.h> > > > > + > > > > +/** > > > > + NULL implemented of Beep() function, just return directly. > > > > + Normal Beep() function will do the following: > > > > + > > > > + Sends a 32-bit value to Beep device. > > > > + > > > > + Sends the 32-bit value specified by Value to Beep device, and returns > > Value. > > > > + Some implementations of this library function may perform I/O > operations > > > > + directly to Beep device. Other implementations may send Value to > > > > + ReportStatusCode(), and the status code reporting mechanism will > > eventually > > > > + display the 32-bit value on the status reporting device. > > > > + > > > > + Beep() must actively prevent recursion. If Beep() is called while > > > > + processing another Post Code Library function, then > > > > + Beep() must return Value immediately. > > > > + > > > > + @param Value Beep count. > > > > +**/ > > > > +VOID > > > > +EFIAPI > > > > +Beep ( > > > > + IN UINT32 Value > > > > + ) > > > > +{ > > > > + return; > > > > +} > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > > bNull.inf > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > > bNull.inf > > new file mode 100644 > > index 0000000000..7f84dad082 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLi > > bNull.inf > > @@ -0,0 +1,26 @@ > > +## @file > > > > +# Instance of Platform Beep Null Library. > > > > +# > > > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + INF_VERSION = 0x00010017 > > > > + BASE_NAME = BeepLib > > > > + FILE_GUID = 319F24D8-9F3E-4BEC-B1C4-C54BE51F3FC2 > > > > + VERSION_STRING = 1.0 > > > > + MODULE_TYPE = BASE > > > > + LIBRARY_CLASS = BeepLib > > > > +# > > > > +# The following information is for reference only and not required by the > > build tools. > > > > +# > > > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC > > > > +# > > > > + > > > > +[Packages] > > > > + MdePkg/MdePkg.dec > > > > + > > > > +[Sources] > > > > + BeepLibNull.c > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > > eepMapLib.c > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > > eepMapLib.c > > new file mode 100644 > > index 0000000000..26c32dfd9b > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > > eepMapLib.c > > @@ -0,0 +1,116 @@ > > +/** @file > > > > + BeepMap implementation. > > > > + > > > > + Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.<BR> > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#include <Base.h> > > > > +#include <Uefi.h> > > > > + > > > > +#include "PlatformStatusCodesInternal.h" > > > > + > > > > +STATUS_CODE_TO_DATA_MAP mBeepProgressMap[] = { > > > > + // > > > > + // PEI > > > > + // > > > > + // Recovery > > > > + { PEI_RECOVERY_STARTED, 2 }, > > > > + > > > > + // > > > > + // DXE > > > > + // > > > > + > > > > + {0,0} > > > > +}; > > > > + > > > > +STATUS_CODE_TO_DATA_MAP mBeepErrorMap[] = { > > > > + // > > > > + // PEI > > > > + // > > > > + // Regular boot > > > > + { PEI_MEMORY_NOT_DETECTED, 1 }, > > > > + { PEI_MEMORY_INSTALLED_TWICE, 1 }, > > > > + { PEI_DXEIPL_NOT_FOUND, 3 }, > > > > + { PEI_DXE_CORE_NOT_FOUND, 3 }, > > > > + { PEI_RESET_NOT_AVAILABLE, 7 }, > > > > + // Recovery > > > > + { PEI_RECOVERY_FAILED, 4 }, > > > > + // S3 Resume > > > > + { PEI_S3_RESUME_FAILED, 4 }, > > > > + > > > > + // > > > > + // DXE > > > > + // > > > > + { DXE_ARCH_PROTOCOL_NOT_AVAILABLE, 4 }, > > > > + { DXE_NO_CON_OUT, 5 }, > > > > + { DXE_NO_CON_IN, 5 }, > > > > + { DXE_INVALID_PASSWORD, 1 }, > > > > + { DXE_FLASH_UPDATE_FAILED, 6 }, > > > > + { DXE_RESET_NOT_AVAILABLE, 7 }, > > > > + > > > > + {0,0} > > > > +}; > > > > + > > > > +STATUS_CODE_TO_DATA_MAP *mBeepStatusCodesMap[] = { > > > > + //#define EFI_PROGRESS_CODE 0x00000001 > > > > + mBeepProgressMap, > > > > + //#define EFI_ERROR_CODE 0x00000002 > > > > + mBeepErrorMap > > > > + //#define EFI_DEBUG_CODE 0x00000003 > > > > +}; > > > > + > > > > +/** > > > > + Find the beep data from status code value. > > > > + > > > > + @param Map The map used to find in. > > > > + @param Value The status code value. > > > > + > > > > + @return BeepValue 0 for not found. > > > > + > > > > +**/ > > > > +UINT32 > > > > +FindBeepData ( > > > > + IN STATUS_CODE_TO_DATA_MAP *Map, > > > > + IN EFI_STATUS_CODE_VALUE Value > > > > + ) > > > > +{ > > > > + while (Map->Value != 0) { > > > > + if (Map->Value == Value) { > > > > + return Map->Data; > > > > + } > > > > + Map++; > > > > + } > > > > + return 0; > > > > +} > > > > + > > > > +/** > > > > + Get BeepValue from status code type and value. > > > > + > > > > + @param CodeType Indicates the type of status code being reported. > > > > + @param 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. > > > > + > > > > + @return BeepValue > > > > +**/ > > > > +UINT32 > > > > +EFIAPI > > > > +GetBeepValueFromStatusCode ( > > > > + IN EFI_STATUS_CODE_TYPE CodeType, > > > > + IN EFI_STATUS_CODE_VALUE Value > > > > + ) > > > > +{ > > > > + UINT32 CodeTypeIndex; > > > > + > > > > + CodeTypeIndex = STATUS_CODE_TYPE (CodeType) - 1; > > > > + > > > > + if (CodeTypeIndex >= sizeof (mBeepStatusCodesMap) / > > sizeof(mBeepStatusCodesMap[0])) { > > > > + return 0; > > > > + } > > > > + > > > > + return FindBeepData (mBeepStatusCodesMap[CodeTypeIndex], Value); > > > > +} > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > > eepMapLib.inf > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > > eepMapLib.inf > > new file mode 100644 > > index 0000000000..b957eee07b > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/B > > eepMapLib.inf > > @@ -0,0 +1,27 @@ > > +## @file > > > > +# Instance of Beep Map Library. > > > > +# > > > > +# Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR> > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + INF_VERSION = 0x00010017 > > > > + BASE_NAME = BeepMapLib > > > > + FILE_GUID = 8BAFA82F-DA9E-4cce-8FA2-9DA189D7246D > > > > + VERSION_STRING = 2.0 > > > > + MODULE_TYPE = BASE > > > > + LIBRARY_CLASS = BeepMapLib > > > > +# > > > > +# The following information is for reference only and not required by the > > build tools. > > > > +# > > > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC > > > > +# > > > > + > > > > +[Packages] > > > > + MdePkg/MdePkg.dec > > > > + > > > > +[Sources] > > > > + BeepMapLib.c > > > > + PlatformStatusCodesInternal.h > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Pl > > atformStatusCodesInternal.h > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Pl > > atformStatusCodesInternal.h > > new file mode 100644 > > index 0000000000..a36134c933 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Pl > > atformStatusCodesInternal.h > > @@ -0,0 +1,270 @@ > > +/** @file > > > > + Beep status code definition. > > > > + > > > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#ifndef __PLATFORM_STATUS_CODES_INTERNAL_H__ > > > > +#define __PLATFORM_STATUS_CODES_INTERNAL_H__ > > > > + > > > > +#include <Pi/PiStatusCode.h> > > > > + > > > > +typedef struct{ > > > > + EFI_STATUS_CODE_VALUE Value; > > > > + UINT32 Data; > > > > +} STATUS_CODE_TO_DATA_MAP; > > > > + > > > > +// > > > > +// Enable PEI/DXE status code > > > > +// > > > > +#define PEI_STATUS_CODE 1 > > > > +#define DXE_STATUS_CODE 1 > > > > + > > > > +#define STATUS_CODE_TYPE(Type) > > ((Type)&EFI_STATUS_CODE_TYPE_MASK) > > > > +#define STATUS_CODE_CLASS(Value) > > ((Value)&EFI_STATUS_CODE_CLASS_MASK) > > > > + > > > > +//Progress/Error codes > > > > +#define PEI_CORE_STARTED (EFI_SOFTWARE_PEI_CORE | > > EFI_SW_PEI_CORE_PC_ENTRY_POINT) > > > > +#define PEI_RESET_NOT_AVAILABLE (EFI_SOFTWARE_PEI_CORE | > > EFI_SW_PS_EC_RESET_NOT_AVAILABLE) > > > > +#define PEI_DXEIPL_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | > > EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND) > > > > +#define PEI_DXE_CORE_NOT_FOUND (EFI_SOFTWARE_PEI_CORE > | > > EFI_SW_PEI_CORE_EC_DXE_CORRUPT) > > > > +#define PEI_S3_RESUME_ERROR (EFI_SOFTWARE_PEI_CORE | > > EFI_SW_PEI_EC_S3_RESUME_FAILED) > > > > +#define PEI_RECOVERY_FAILED (EFI_SOFTWARE_PEI_CORE | > > EFI_SW_PEI_EC_RECOVERY_FAILED) > > > > +#define DXE_CORE_STARTED (EFI_SOFTWARE_DXE_CORE | > > EFI_SW_DXE_CORE_PC_ENTRY_POINT) > > > > + > > > > +//#define DXE_EXIT_BOOT_SERVICES_BEGIN 0xF8 > > > > +#define DXE_EXIT_BOOT_SERVICES_END > > (EFI_SOFTWARE_EFI_BOOT_SERVICE | > > EFI_SW_BS_PC_EXIT_BOOT_SERVICES) > > > > + > > > > +// Reported by CPU PEIM > > > > +#define PEI_CAR_CPU_INIT > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_PC_POWER_ON_INIT) > > > > + > > > > +// Reported by NB PEIM > > > > +//#define PEI_CAR_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET > | > > EFI_CU_CHIPSET_NORTH_INIT) > > > > + > > > > +// Reported by SB PEIM > > > > +//#define PEI_CAR_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET > | > > EFI_CU_CHIPSET_PC_SOUTH_INIT) > > > > + > > > > +//Reported by Memory Detection PEIM > > > > +#define PEI_MEMORY_SPD_READ > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_SPD_READ) > > > > +#define PEI_MEMORY_PRESENCE_DETECT > > (EFI_COMPUTING_UNIT_MEMORY | > > EFI_CU_MEMORY_PC_PRESENCE_DETECT) > > > > +#define PEI_MEMORY_TIMING > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TIMING) > > > > +#define PEI_MEMORY_CONFIGURING > > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_PC_CONFIGURING) > > > > +#define PEI_MEMORY_OPTIMIZING > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_OPTIMIZING) > > > > +#define PEI_MEMORY_INIT > (EFI_COMPUTING_UNIT_MEMORY > > | EFI_CU_MEMORY_PC_INIT) > > > > +#define PEI_MEMORY_TEST > (EFI_COMPUTING_UNIT_MEMORY > > | EFI_CU_MEMORY_PC_TEST) > > > > +#define PEI_MEMORY_INVALID_TYPE > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_TYPE) > > > > +#define PEI_MEMORY_INVALID_SPEED > > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_INVALID_SPEED) > > > > +#define PEI_MEMORY_SPD_FAIL > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_SPD_FAIL) > > > > +#define PEI_MEMORY_INVALID_SIZE > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SIZE) > > > > +#define PEI_MEMORY_MISMATCH > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) > > > > +#define PEI_MEMORY_S3_RESUME_FAILED > > (EFI_COMPUTING_UNIT_MEMORY | > > EFI_CU_MEMORY_EC_S3_RESUME_FAIL) > > > > +#define PEI_MEMORY_NOT_DETECTED > > (EFI_COMPUTING_UNIT_MEMORY | > > EFI_CU_MEMORY_EC_NONE_DETECTED) > > > > +#define PEI_MEMORY_NONE_USEFUL > > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_NONE_USEFUL) > > > > +#define PEI_MEMORY_ERROR > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NON_SPECIFIC) > > > > +#define PEI_MEMORY_INSTALLED (EFI_SOFTWARE_PEI_SERVICE > | > > EFI_SW_PS_PC_INSTALL_PEI_MEMORY) > > > > +#define PEI_MEMORY_NOT_INSTALLED > > (EFI_SOFTWARE_PEI_SERVICE | > > EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED) > > > > +#define PEI_MEMORY_INSTALLED_TWICE > > (EFI_SOFTWARE_PEI_SERVICE | > > EFI_SW_PS_EC_MEMORY_INSTALLED_TWICE) > > > > + > > > > +//Reported by CPU PEIM > > > > +#define PEI_CPU_INIT > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_PC_INIT_BEGIN) > > > > +#define PEI_CPU_CACHE_INIT > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_PC_CACHE_INIT) > > > > +#define PEI_CPU_BSP_SELECT > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT) > > > > +#define PEI_CPU_AP_INIT > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT) > > > > +#define PEI_CPU_SMM_INIT > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_SMM_INIT) > > > > +#define PEI_CPU_INVALID_TYPE > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_EC_INVALID_TYPE) > > > > +#define PEI_CPU_INVALID_SPEED > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_EC_INVALID_SPEED) > > > > +#define PEI_CPU_MISMATCH > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MISMATCH) > > > > +#define PEI_CPU_SELF_TEST_FAILED > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) > > > > +#define PEI_CPU_CACHE_ERROR > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CACHE) > > > > +#define PEI_CPU_MICROCODE_UPDATE_FAILED > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_EC_MICROCODE_UPDATE) > > > > +#define PEI_CPU_NO_MICROCODE > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_EC_NO_MICROCODE_UPDATE) > > > > +//If non of the errors above apply use this one > > > > +#define PEI_CPU_INTERNAL_ERROR > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INTERNAL) > > > > +//Generic CPU error. It should only be used if non of the errors above > apply > > > > +#define PEI_CPU_ERROR > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NON_SPECIFIC) > > > > + > > > > +// Reported by NB PEIM > > > > +#define PEI_MEM_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET > | > > EFI_CHIPSET_PC_PEI_MEM_NB_INIT) > > > > +// Reported by SB PEIM > > > > +#define PEI_MEM_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET > | > > EFI_CHIPSET_PC_PEI_MEM_SB_INIT) > > > > + > > > > +//Reported by PEIM which detected forced or auto recovery condition > > > > +#define PEI_RECOVERY_AUTO (EFI_SOFTWARE_PEI_MODULE | > > EFI_SW_PEI_PC_RECOVERY_AUTO) > > > > +#define PEI_RECOVERY_USER (EFI_SOFTWARE_PEI_MODULE | > > EFI_SW_PEI_PC_RECOVERY_USER) > > > > + > > > > +//Reported by DXE IPL > > > > +#define PEI_RECOVERY_PPI_NOT_FOUND > > (EFI_SOFTWARE_PEI_MODULE | > > EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND) > > > > +#define PEI_S3_RESUME_PPI_NOT_FOUND > > (EFI_SOFTWARE_PEI_MODULE | > > EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND) > > > > +#define PEI_S3_RESUME_FAILED (EFI_SOFTWARE_PEI_MODULE > | > > EFI_SW_PEI_EC_S3_RESUME_FAILED) > > > > + > > > > +//Reported by Recovery PEIM > > > > +#define PEI_RECOVERY_STARTED (EFI_SOFTWARE_PEI_MODULE > | > > EFI_SW_PEI_PC_RECOVERY_BEGIN) > > > > +#define PEI_RECOVERY_CAPSULE_FOUND > > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_LOAD) > > > > +#define PEI_RECOVERY_NO_CAPSULE > > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE) > > > > +#define PEI_RECOVERY_CAPSULE_LOADED > > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START) > > > > +#define PEI_RECOVERY_INVALID_CAPSULE > > (EFI_SOFTWARE_PEI_MODULE | > > EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR) > > > > + > > > > +//Reported by S3 Resume PEIM > > > > +#define PEI_S3_BOOT_SCRIPT (EFI_SOFTWARE_PEI_MODULE | > > EFI_SW_PEI_PC_S3_BOOT_SCRIPT) > > > > +#define PEI_S3_OS_WAKE (EFI_SOFTWARE_PEI_MODULE | > > EFI_SW_PEI_PC_OS_WAKE) > > > > +#define PEI_S3_BOOT_SCRIPT_ERROR > > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_S3_BOOT_SCRIPT_ERROR) > > > > +#define PEI_S3_OS_WAKE_ERROR > (EFI_SOFTWARE_PEI_MODULE > > | EFI_SW_PEI_EC_S3_OS_WAKE_ERROR) > > > > + > > > > +#define PEI_PEIM_STARTED (EFI_SOFTWARE_PEI_CORE | > > EFI_SW_PC_INIT_BEGIN) > > > > +#define PEI_PEIM_ENDED (EFI_SOFTWARE_PEI_CORE | > > EFI_SW_PC_INIT_END) > > > > + > > > > +//Reported by DXE IPL > > > > +#define PEI_DXE_IPL_STARTED (EFI_SOFTWARE_PEI_CORE | > > EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT) > > > > + > > > > +//Reported by PEIM which installs Reset PPI > > > > +#define PEI_RESET_SYSTEM (EFI_SOFTWARE_PEI_SERVICE | > > EFI_SW_PS_PC_RESET_SYSTEM) > > > > + > > > > +//Reported by the PEIM or DXE driver which detected the error > > > > +#define GENERIC_MEMORY_CORRECTABLE_ERROR > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_CORRECTABLE) > > > > +#define GENERIC_MEMORY_UNCORRECTABLE_ERROR > > (EFI_COMPUTING_UNIT_MEMORY | > > EFI_CU_MEMORY_EC_UNCORRECTABLE) > > > > + > > > > +//Reported by Flash Update DXE driver > > > > +#define DXE_FLASH_UPDATE_FAILED > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UPDATE_FAIL) > > > > + > > > > +//Reported by the PEIM or DXE driver which detected the error > > > > +#define GENERIC_CPU_THERMAL_ERROR > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_THERMAL) > > > > +#define GENERIC_CPU_LOW_VOLTAGE > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_EC_LOW_VOLTAGE) > > > > +#define GENERIC_CPU_HIGH_VOLTAGE > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_EC_HIGH_VOLTAGE) > > > > +#define GENERIC_CPU_CORRECTABLE_ERROR > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_EC_CORRECTABLE) > > > > +#define GENERIC_CPU_UNCORRECTABLE_ERROR > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > > EFI_CU_HP_EC_UNCORRECTABLE) > > > > +#define GENERIC_BAD_DATE_TIME_ERROR > > (EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_BAD_DATE_TIME) > > > > +#define GENERIC_MEMORY_SIZE_DECREASE > > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) > > > > + > > > > +//Reported by DXE Core > > > > +#define DXE_DRIVER_STARTED > > (EFI_SOFTWARE_EFI_DXE_SERVICE | EFI_SW_PC_INIT_BEGIN) > > > > +#define DXE_DRIVER_ENED (EFI_SOFTWARE_DXE_CORE | > > EFI_SW_PC_INIT_END) > > > > +#define DXE_ARCH_PROTOCOLS_AVAILABLE > > (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ARCH_READY) > > > > +#define DXE_DRIVER_CONNECTED (EFI_SOFTWARE_DXE_CORE | > > EFI_SW_DXE_CORE_PC_START_DRIVER) > > > > +#define DXE_ARCH_PROTOCOL_NOT_AVAILABLE > > (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH) > > > > + > > > > +//Reported by DXE CPU driver > > > > +#define DXE_CPU_SELF_TEST_FAILED > > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) > > > > + > > > > +//Reported by PCI Host Bridge driver > > > > +#define DXE_NB_HB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > > EFI_CHIPSET_PC_DXE_HB_INIT ) > > > > + > > > > +// Reported by NB Driver > > > > +#define DXE_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > > EFI_CHIPSET_PC_DXE_NB_INIT ) > > > > +#define DXE_NB_SMM_INIT > (EFI_COMPUTING_UNIT_CHIPSET | > > EFI_CHIPSET_PC_DXE_NB_SMM_INIT ) > > > > +#define DXE_NB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | > > EFI_CHIPSET_EC_DXE_NB_ERROR ) > > > > + > > > > +// Reported by SB Driver(s) > > > > +#define DXE_SBRUN_INIT (EFI_COMPUTING_UNIT_CHIPSET | > > EFI_CHIPSET_PC_DXE_SB_RT_INIT ) > > > > +#define DXE_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET | > > EFI_CHIPSET_PC_DXE_SB_INIT ) > > > > +#define DXE_SB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET > | > > EFI_CHIPSET_PC_DXE_SB_SMM_INIT ) > > > > +#define DXE_SB_DEVICES_INIT > (EFI_COMPUTING_UNIT_CHIPSET > > | EFI_CHIPSET_PC_DXE_SB_DEVICES_INIT ) > > > > +#define DXE_SB_BAD_BATTERY > (EFI_COMPUTING_UNIT_CHIPSET > > | EFI_CHIPSET_EC_BAD_BATTERY) > > > > +#define DXE_SB_ERROR (EFI_COMPUTING_UNIT_CHIPSET | > > EFI_CHIPSET_EC_DXE_SB_ERROR ) > > > > + > > > > +//Reported by DXE Core > > > > +#define DXE_BDS_STARTED (EFI_SOFTWARE_DXE_CORE | > > EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT) > > > > + > > > > +//Reported by BDS > > > > +//#define DXE_BDS_CONNECT_DRIVERS > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS) > > > > + > > > > +//Reported by Boot Manager > > > > +#define DXE_READY_TO_BOOT > (EFI_SOFTWARE_DXE_BS_DRIVER > > | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT) > > > > + > > > > +//Reported by DXE Core > > > > +#define DXE_EXIT_BOOT_SERVICES > > (EFI_SOFTWARE_EFI_BOOT_SERVICE | > > EFI_SW_BS_PC_EXIT_BOOT_SERVICES) > > > > +#define DXE_EXIT_BOOT_SERVICES_EVENT > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_PC_EXIT_BOOT_SERVICES_EVENT) > > > > + > > > > +//Reported by driver that installs Runtime AP > > > > +#define RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN > > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | > > EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP) > > > > +#define RT_SET_VIRTUAL_ADDRESS_MAP_END > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT) > > > > + > > > > +//Reported by CSM > > > > +#define DXE_LEGACY_OPROM_INIT > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_PC_LEGACY_OPROM_INIT) > > > > +#define DXE_LEGACY_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER > | > > EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT) > > > > +#define DXE_LEGACY_OPROM_NO_SPACE > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_EC_LEGACY_OPROM_NO_SPACE) > > > > + > > > > +//Reported by SETUP > > > > +//#define DXE_SETUP_VERIFYING_PASSWORD > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD) > > > > +#define DXE_SETUP_START (EFI_SOFTWARE_DXE_BS_DRIVER > | > > EFI_SW_PC_USER_SETUP) > > > > +#define DXE_SETUP_INPUT_WAIT > > (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT) > > > > +#define DXE_INVALID_PASSWORD > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_EC_INVALID_PASSWORD) > > > > +#define DXE_INVALID_IDE_PASSWORD > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_EC_INVALID_IDE_PASSWORD) > > > > +#define DXE_BOOT_OPTION_LOAD_ERROR > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) > > > > +#define DXE_BOOT_OPTION_FAILED > > (EFI_SOFTWARE_DXE_BS_DRIVER | > > EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED) > > > > + > > > > +//Reported by a Driver that installs Reset AP > > > > +#define DXE_RESET_SYSTEM > > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM) > > > > +#define DXE_RESET_NOT_AVAILABLE > > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | > > EFI_SW_PS_EC_RESET_NOT_AVAILABLE) > > > > + > > > > +// Reported by PCI bus driver > > > > +#define DXE_PCI_BUS_BEGIN (EFI_IO_BUS_PCI | > > EFI_IOB_PC_INIT) > > > > +#define DXE_PCI_BUS_ENUM (EFI_IO_BUS_PCI | > > EFI_IOB_PCI_PC_BUS_ENUM) > > > > +#define DXE_PCI_BUS_HPC_INIT (EFI_IO_BUS_PCI | > > EFI_IOB_PCI_PC_HPC_INIT) > > > > +#define DXE_PCI_BUS_REQUEST_RESOURCES (EFI_IO_BUS_PCI | > > EFI_IOB_PCI_PC_RES_ALLOC) > > > > +#define DXE_PCI_BUS_ASSIGN_RESOURCES (EFI_IO_BUS_PCI | > > EFI_IOB_PC_ENABLE) > > > > +#define DXE_PCI_BUS_HOTPLUG (EFI_IO_BUS_PCI | > > EFI_IOB_PC_HOTPLUG) > > > > +#define DXE_PCI_BUS_OUT_OF_RESOURCES (EFI_IO_BUS_PCI | > > EFI_IOB_EC_RESOURCE_CONFLICT) > > > > + > > > > +// Reported by USB bus driver > > > > +#define DXE_USB_BEGIN (EFI_IO_BUS_USB | > EFI_IOB_PC_INIT) > > > > +#define DXE_USB_RESET (EFI_IO_BUS_USB | > > EFI_IOB_PC_RESET) > > > > +#define DXE_USB_DETECT (EFI_IO_BUS_USB | > > EFI_IOB_PC_DETECT) > > > > +#define DXE_USB_ENABLE (EFI_IO_BUS_USB | > > EFI_IOB_PC_ENABLE) > > > > +#define DXE_USB_HOTPLUG (EFI_IO_BUS_USB | > > EFI_IOB_PC_HOTPLUG) > > > > + > > > > +//Reported by IDE bus driver > > > > +#define DXE_IDE_BEGIN (EFI_IO_BUS_ATA_ATAPI | > > EFI_IOB_PC_INIT) > > > > +#define DXE_IDE_RESET (EFI_IO_BUS_ATA_ATAPI | > > EFI_IOB_PC_RESET) > > > > +#define DXE_IDE_DETECT (EFI_IO_BUS_ATA_ATAPI | > > EFI_IOB_PC_DETECT) > > > > +#define DXE_IDE_ENABLE (EFI_IO_BUS_ATA_ATAPI | > > EFI_IOB_PC_ENABLE) > > > > +#define DXE_IDE_SMART_ERROR (EFI_IO_BUS_ATA_ATAPI | > > EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD) > > > > +#define DXE_IDE_CONTROLLER_ERROR (EFI_IO_BUS_ATA_ATAPI | > > EFI_IOB_EC_CONTROLLER_ERROR) > > > > +#define DXE_IDE_DEVICE_FAILURE (EFI_IO_BUS_ATA_ATAPI | > > EFI_IOB_EC_INTERFACE_ERROR) > > > > + > > > > +// Reported by SCSI bus driver > > > > +#define DXE_SCSI_BEGIN (EFI_IO_BUS_SCSI | > EFI_IOB_PC_INIT) > > > > +#define DXE_SCSI_RESET (EFI_IO_BUS_SCSI | > > EFI_IOB_PC_RESET) > > > > +#define DXE_SCSI_DETECT (EFI_IO_BUS_SCSI | > > EFI_IOB_PC_DETECT) > > > > +#define DXE_SCSI_ENABLE (EFI_IO_BUS_SCSI | > > EFI_IOB_PC_ENABLE) > > > > + > > > > +// Reported by Super I/O driver > > > > +#define DXE_SIO_INIT (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT) > > > > + > > > > +// Reported by Keyboard driver > > > > +#define DXE_KEYBOARD_INIT (EFI_PERIPHERAL_KEYBOARD | > > EFI_P_PC_INIT) > > > > +#define DXE_KEYBOARD_RESET (EFI_PERIPHERAL_KEYBOARD | > > EFI_P_PC_RESET) > > > > +#define DXE_KEYBOARD_DISABLE (EFI_PERIPHERAL_KEYBOARD | > > EFI_P_PC_DISABLE) > > > > +#define DXE_KEYBOARD_DETECT (EFI_PERIPHERAL_KEYBOARD | > > EFI_P_PC_PRESENCE_DETECT) > > > > +#define DXE_KEYBOARD_ENABLE (EFI_PERIPHERAL_KEYBOARD | > > EFI_P_PC_ENABLE) > > > > +#define DXE_KEYBOARD_CLEAR_BUFFER > > (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER) > > > > +#define DXE_KEYBOARD_SELF_TEST (EFI_PERIPHERAL_KEYBOARD > | > > EFI_P_KEYBOARD_PC_SELF_TEST) > > > > + > > > > +// Reported by Mouse driver > > > > +#define DXE_MOUSE_INIT (EFI_PERIPHERAL_MOUSE | > > EFI_P_PC_INIT) > > > > +#define DXE_MOUSE_RESET (EFI_PERIPHERAL_MOUSE | > > EFI_P_PC_RESET) > > > > +#define DXE_MOUSE_DISABLE (EFI_PERIPHERAL_MOUSE | > > EFI_P_PC_DISABLE) > > > > +#define DXE_MOUSE_DETECT (EFI_PERIPHERAL_MOUSE | > > EFI_P_PC_PRESENCE_DETECT) > > > > +#define DXE_MOUSE_ENABLE (EFI_PERIPHERAL_MOUSE | > > EFI_P_PC_ENABLE) > > > > + > > > > +// Reported by Mass Storage drivers > > > > +#define DXE_FIXED_MEDIA_INIT > (EFI_PERIPHERAL_FIXED_MEDIA > > | EFI_P_PC_INIT) > > > > +#define DXE_FIXED_MEDIA_RESET > (EFI_PERIPHERAL_FIXED_MEDIA > > | EFI_P_PC_RESET) > > > > +#define DXE_FIXED_MEDIA_DISABLE > > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_DISABLE) > > > > +#define DXE_FIXED_MEDIA_DETECT > > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_PRESENCE_DETECT) > > > > +#define DXE_FIXED_MEDIA_ENABLE > > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENABLE) > > > > +#define DXE_REMOVABLE_MEDIA_INIT > > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_INIT) > > > > +#define DXE_REMOVABLE_MEDIA_RESET > > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET) > > > > +#define DXE_REMOVABLE_MEDIA_DISABLE > > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE) > > > > +#define DXE_REMOVABLE_MEDIA_DETECT > > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_PRESENCE_DETECT) > > > > +#define DXE_REMOVABLE_MEDIA_ENABLE > > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE) > > > > + > > > > + > > > > +// Reported by BDS > > > > +#define DXE_CON_OUT_CONNECT > > (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_INIT) > > > > +#define DXE_CON_IN_CONNECT (EFI_PERIPHERAL_KEYBOARD | > > EFI_P_PC_INIT) > > > > +#define DXE_NO_CON_OUT > > (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED) > > > > +#define DXE_NO_CON_IN (EFI_PERIPHERAL_KEYBOARD | > > EFI_P_EC_NOT_DETECTED) > > > > + > > > > +#endif > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/PeiBeepStatusCodeHandlerLib.c > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/PeiBeepStatusCodeHandlerLib.c > > new file mode 100644 > > index 0000000000..a29d948951 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/PeiBeepStatusCodeHandlerLib.c > > @@ -0,0 +1,101 @@ > > +/** @file > > > > + Beep status code implementation. > > > > + > > > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#include <Library/PeiServicesLib.h> > > > > +#include <Library/PeimEntryPoint.h> > > > > +#include <Library/PcdLib.h> > > > > +#include <Library/DebugLib.h> > > > > +#include <Library/ReportStatusCodeLib.h> > > > > +#include <Ppi/ReportStatusCodeHandler.h> > > > > + > > > > +#include <Library/BeepMapLib.h> > > > > +#include <Library/BeepLib.h> > > > > + > > > > +/** > > > > + Convert status code value to the times of beep. > > > > + > > > > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES > table > > published by the PEI Foundation. > > > > + @param CodeType Indicates the type of status code being reported. > > > > + @param 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 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 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 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 CONST EFI_PEI_SERVICES **PeiServices, > > > > + IN EFI_STATUS_CODE_TYPE CodeType, > > > > + IN EFI_STATUS_CODE_VALUE Value, > > > > + IN UINT32 Instance, > > > > + IN CONST EFI_GUID *CallerId, > > > > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL > > > > + ) > > > > +{ > > > > + UINT32 BeepValue; > > > > + > > > > + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); > > > > + if (BeepValue != 0) { > > > > + Beep (BeepValue); > > > > + } > > > > + > > > > + return EFI_SUCCESS; > > > > +} > > > > + > > > > +/** > > > > + Constructor function of PeiBeepStatusCodeHandlerLib. > > > > + > > > > + This function is the constructor function of this Beep Status Code Handler > > Library for PEI Phase. > > > > + It check whether need beep, and register it to gEfiPeiRscHandlerPpiGuid. > > > > + > > > > + @param FileHandle Handle of the file being invoked. > > > > + @param PeiServices Describes the list of possible PEI Services. > > > > + > > > > + @retval EFI_SUCESS The entry point of DXE IPL PEIM executes > successfully. > > > > + > > > > +**/ > > > > +RETURN_STATUS > > > > +EFIAPI > > > > +PeiBeepStatusCodeHandlerLibConstructor ( > > > > + IN EFI_PEI_FILE_HANDLE FileHandle, > > > > + IN CONST EFI_PEI_SERVICES **PeiServices > > > > + ) > > > > +{ > > > > + EFI_STATUS Status; > > > > + EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi; > > > > + > > > > + if (!PcdGetBool (PcdStatusCodeUseBeep)) { > > > > + return RETURN_SUCCESS; > > > > + } > > > > + > > > > + Status = PeiServicesLocatePpi ( > > > > + &gEfiPeiRscHandlerPpiGuid, > > > > + 0, > > > > + NULL, > > > > + (VOID **) &RscHandlerPpi > > > > + ); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > + Status = RscHandlerPpi->Register (BeepStatusCodeReportWorker); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > + return RETURN_SUCCESS; > > > > +} > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/PeiBeepStatusCodeHandlerLib.inf > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/PeiBeepStatusCodeHandlerLib.inf > > new file mode 100644 > > index 0000000000..421b246663 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/PeiBeepStatusCodeHandlerLib.inf > > @@ -0,0 +1,49 @@ > > +## @file > > > > +# Beep status code implementation. > > > > +# > > > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +# vendor. This file may not be modified, except as allowed by > > > > +# additional terms of your license agreement. > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + INF_VERSION = 0x00010005 > > > > + BASE_NAME = PeiBeepStatusCodeHandlerLib > > > > + FILE_GUID = C4210E71-0A38-4728-8D25-4876348AA380 > > > > + MODULE_TYPE = PEIM > > > > + CONSTRUCTOR = PeiBeepStatusCodeHandlerLibConstructor > > > > + LIBRARY_CLASS = StatusCodeHandlerLib|SEC PEIM PEI_COR > > > > + > > > > +# > > > > +# The following information is for reference only and not required by the > > build tools. > > > > +# > > > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > > > +# > > > > + > > > > +[Sources] > > > > + PeiBeepStatusCodeHandlerLib.c > > > > + > > > > +[Packages] > > > > + MdePkg/MdePkg.dec > > > > + MdeModulePkg/MdeModulePkg.dec > > > > + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > > > + > > > > +[LibraryClasses] > > > > + PeiServicesLib > > > > + PcdLib > > > > + DebugLib > > > > + ReportStatusCodeLib > > > > + BeepMapLib > > > > + BeepLib > > > > + > > > > +[Pcd] > > > > + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep > > ## CONSUMES > > > > + > > > > +[Ppis] > > > > + gEfiPeiRscHandlerPpiGuid ## CONSUMES > > > > + > > > > +[Depex] > > > > + TRUE > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c > > new file mode 100644 > > index 0000000000..631e2eecae > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c > > @@ -0,0 +1,184 @@ > > +/** @file > > > > + Beep status code implementation. > > > > + > > > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#include <Library/UefiDriverEntryPoint.h> > > > > +#include <Library/UefiBootServicesTableLib.h> > > > > +#include <Guid/EventGroup.h> > > > > +#include <Library/PcdLib.h> > > > > +#include <Library/DebugLib.h> > > > > +#include <Library/ReportStatusCodeLib.h> > > > > +#include <Protocol/ReportStatusCodeHandler.h> > > > > + > > > > +#include <Library/BeepMapLib.h> > > > > +#include <Library/BeepLib.h> > > > > + > > > > +EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL; > > > > +EFI_EVENT mExitBootServicesEvent = NULL; > > > > +BOOLEAN mRegistered = FALSE; > > > > + > > > > +/** > > > > + Convert status code value to the times of beep. > > > > + > > > > + @param CodeType Indicates the type of status code being reported. > > > > + @param 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 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 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 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 > > > > + ) > > > > +{ > > > > + UINT32 BeepValue; > > > > + > > > > + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); > > > > + if (BeepValue != 0) { > > > > + Beep (BeepValue); > > > > + } > > > > + > > > > + return EFI_SUCCESS; > > > > +} > > > > + > > > > +/** > > > > + Unregister status code callback functions only available at boot time from > > > > + report status code router when exiting boot services. > > > > + > > > > + @param Event Event whose notification function is being invoked. > > > > + @param Context Pointer to the notification function's context, which > is > > > > + always zero in current implementation. > > > > + > > > > +**/ > > > > +VOID > > > > +EFIAPI > > > > +UnregisterBeepBootTimeHandlers ( > > > > + IN EFI_EVENT Event, > > > > + IN VOID *Context > > > > + ) > > > > +{ > > > > + if (mRegistered) { > > > > + mRscHandlerProtocol->Unregister (BeepStatusCodeReportWorker); > > > > + } > > > > +} > > > > + > > > > +/** > > > > + Register status code callback function only when Report Status Code > > protocol > > > > + is installed. > > > > + > > > > + @param Event Event whose notification function is being invoked. > > > > + @param Context Pointer to the notification function's context, which > is > > > > + always zero in current implementation. > > > > + > > > > +**/ > > > > +VOID > > > > +EFIAPI > > > > +RegisterBeepBootTimeHandlers ( > > > > + IN EFI_EVENT Event, > > > > + IN VOID *Context > > > > + ) > > > > +{ > > > > + EFI_STATUS Status; > > > > + > > > > + Status = gBS->LocateProtocol ( > > > > + &gEfiRscHandlerProtocolGuid, > > > > + NULL, > > > > + (VOID **) &mRscHandlerProtocol > > > > + ); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > + mRscHandlerProtocol->Register (BeepStatusCodeReportWorker, > > TPL_HIGH_LEVEL); > > > > + ASSERT_EFI_ERROR (Status); > > > > + mRegistered = TRUE; > > > > + > > > > + Status = gBS->CreateEventEx ( > > > > + EVT_NOTIFY_SIGNAL, > > > > + TPL_NOTIFY, > > > > + UnregisterBeepBootTimeHandlers, > > > > + NULL, > > > > + &gEfiEventExitBootServicesGuid, > > > > + &mExitBootServicesEvent > > > > + ); > > > > + ASSERT_EFI_ERROR (Status); > > > > +} > > > > + > > > > +/** > > > > + Constructor function of RuntimeDxeBeepStatusCodeHandlerLib. > > > > + > > > > + This function allocates memory for extended status code data, caches > > > > + the report status code service, and registers events. > > > > + > > > > + @param ImageHandle The firmware allocated handle for the EFI image. > > > > + @param SystemTable A pointer to the EFI System Table. > > > > + > > > > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > > > > + > > > > +**/ > > > > +EFI_STATUS > > > > +EFIAPI > > > > +RuntimeDxeBeepStatusCodeHandlerLibConstructor ( > > > > + IN EFI_HANDLE ImageHandle, > > > > + IN EFI_SYSTEM_TABLE *SystemTable > > > > + ) > > > > +{ > > > > + EFI_STATUS Status; > > > > + EFI_EVENT RegisterStatusCodeHandlerEvent; > > > > + VOID *Registration; > > > > + > > > > + if (!PcdGetBool (PcdStatusCodeUseBeep)) { > > > > + return EFI_SUCCESS; > > > > + } > > > > + > > > > + Status = gBS->LocateProtocol ( > > > > + &gEfiRscHandlerProtocolGuid, > > > > + NULL, > > > > + (VOID **) &mRscHandlerProtocol > > > > + ); > > > > + > > > > + if (!EFI_ERROR (Status)) { > > > > + RegisterBeepBootTimeHandlers (NULL, NULL); > > > > + } else { > > > > + Status = gBS->CreateEvent ( > > > > + EVT_NOTIFY_SIGNAL, > > > > + TPL_NOTIFY, > > > > + RegisterBeepBootTimeHandlers, > > > > + NULL, > > > > + &RegisterStatusCodeHandlerEvent > > > > + ); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > + // > > > > + // Register for protocol notifications on this event > > > > + // > > > > + Status = gBS->RegisterProtocolNotify ( > > > > + &gEfiRscHandlerProtocolGuid, > > > > + RegisterStatusCodeHandlerEvent, > > > > + &Registration > > > > + ); > > > > + ASSERT_EFI_ERROR (Status); > > > > + } > > > > + > > > > + return EFI_SUCCESS; > > > > +} > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf > > new file mode 100644 > > index 0000000000..b9aae39128 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf > > @@ -0,0 +1,51 @@ > > +## @file > > > > +# Beep status code implementation. > > > > +# > > > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +# vendor. This file may not be modified, except as allowed by > > > > +# additional terms of your license agreement. > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + INF_VERSION = 0x00010005 > > > > + BASE_NAME = RuntimeDxeBeepStatusCodeHandlerLib > > > > + FILE_GUID = D05F43CE-7C70-4663-848F-8265C311A8A5 > > > > + MODULE_TYPE = DXE_RUNTIME_DRIVER > > > > + VERSION_STRING = 1.0 > > > > + CONSTRUCTOR = > > RuntimeDxeBeepStatusCodeHandlerLibConstructor > > > > + LIBRARY_CLASS = > StatusCodeHandlerLib|DXE_RUNTIME_DRIVER > > > > + > > > > +# > > > > +# The following information is for reference only and not required by the > > build tools. > > > > +# > > > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > > > +# > > > > + > > > > +[Sources] > > > > + RuntimeDxeBeepStatusCodeHandlerLib.c > > > > + > > > > +[Packages] > > > > + MdePkg/MdePkg.dec > > > > + MdeModulePkg/MdeModulePkg.dec > > > > + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > > > + > > > > +[LibraryClasses] > > > > + UefiBootServicesTableLib > > > > + UefiRuntimeLib > > > > + PcdLib > > > > + DebugLib > > > > + ReportStatusCodeLib > > > > + BeepMapLib > > > > + BeepLib > > > > + > > > > +[Pcd] > > > > + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep > > ## CONSUMES > > > > + > > > > +[Protocols] > > > > + gEfiRscHandlerProtocolGuid ## CONSUMES > > > > + > > > > +[Depex] > > > > + TRUE > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/SmmBeepStatusCodeHandlerLib.c > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/SmmBeepStatusCodeHandlerLib.c > > new file mode 100644 > > index 0000000000..6b1125f4c2 > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/SmmBeepStatusCodeHandlerLib.c > > @@ -0,0 +1,138 @@ > > +/** @file > > > > + Beep status code implementation. > > > > + > > > > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > > + > > > > +**/ > > > > + > > > > +#include <Library/UefiDriverEntryPoint.h> > > > > +#include <Library/SmmServicesTableLib.h> > > > > +#include <Library/PcdLib.h> > > > > +#include <Library/DebugLib.h> > > > > +#include <Library/ReportStatusCodeLib.h> > > > > +#include <Protocol/SmmReportStatusCodeHandler.h> > > > > + > > > > +#include <Library/BeepMapLib.h> > > > > +#include <Library/BeepLib.h> > > > > + > > > > +/** > > > > + Convert status code value to the times of beep. > > > > + > > > > + @param CodeType Indicates the type of status code being reported. > > > > + @param 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 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 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 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 > > > > + ) > > > > +{ > > > > + UINT32 BeepValue; > > > > + > > > > + BeepValue = GetBeepValueFromStatusCode (CodeType, Value); > > > > + if (BeepValue != 0) { > > > > + Beep (BeepValue); > > > > + } > > > > + > > > > + return EFI_SUCCESS; > > > > +} > > > > + > > > > +/** > > > > + Register status code callback function only when Report Status Code > > protocol > > > > + is installed. > > > > + > > > > + @param Protocol Points to the protocol's unique identifier. > > > > + @param Interface Points to the interface instance. > > > > + @param Handle The handle on which the interface was installed. > > > > + > > > > + @retval EFI_SUCCESS Notification runs successfully. > > > > + > > > > +**/ > > > > +EFI_STATUS > > > > +EFIAPI > > > > +RegisterBeepBootTimeHandlers ( > > > > + IN CONST EFI_GUID *Protocol, > > > > + IN VOID *Interface, > > > > + IN EFI_HANDLE Handle > > > > + ) > > > > +{ > > > > + EFI_STATUS Status; > > > > + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; > > > > + > > > > + Status = gSmst->SmmLocateProtocol ( > > > > + &gEfiSmmRscHandlerProtocolGuid, > > > > + NULL, > > > > + (VOID **) &RscHandlerProtocol > > > > + ); > > > > + ASSERT_EFI_ERROR (Status); > > > > + > > > > + RscHandlerProtocol->Register (BeepStatusCodeReportWorker); > > > > + > > > > + return EFI_SUCCESS; > > > > +} > > > > + > > > > +/** > > > > + Constructor function of SmmBeepStatusCodeHandlerLib. > > > > + > > > > + This function allocates memory for extended status code data, caches > > > > + the report status code service, and registers events. > > > > + > > > > + @param ImageHandle The firmware allocated handle for the EFI image. > > > > + @param SystemTable A pointer to the EFI System Table. > > > > + > > > > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > > > > + > > > > +**/ > > > > +EFI_STATUS > > > > +EFIAPI > > > > +SmmBeepStatusCodeHandlerLibConstructor ( > > > > + IN EFI_HANDLE ImageHandle, > > > > + IN EFI_SYSTEM_TABLE *SystemTable > > > > + ) > > > > +{ > > > > + EFI_STATUS Status; > > > > + VOID *Registration; > > > > + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; > > > > + > > > > + if (!PcdGetBool (PcdStatusCodeUseBeep)) { > > > > + return EFI_SUCCESS; > > > > + } > > > > + > > > > + Status = gSmst->SmmLocateProtocol ( > > > > + &gEfiSmmRscHandlerProtocolGuid, > > > > + NULL, > > > > + (VOID **) &RscHandlerProtocol > > > > + ); > > > > + if (!EFI_ERROR (Status)) { > > > > + RegisterBeepBootTimeHandlers (NULL, NULL, NULL); > > > > + } else { > > > > + gSmst->SmmRegisterProtocolNotify ( > > > > + &gEfiSmmRscHandlerProtocolGuid, > > > > + RegisterBeepBootTimeHandlers, > > > > + &Registration > > > > + ); > > > > + } > > > > + > > > > + return EFI_SUCCESS; > > > > +} > > > > diff --git > > > a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/SmmBeepStatusCodeHandlerLib.inf > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/SmmBeepStatusCodeHandlerLib.inf > > new file mode 100644 > > index 0000000000..caa82264ae > > --- /dev/null > > +++ > > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCod > > eHandlerLib/SmmBeepStatusCodeHandlerLib.inf > > @@ -0,0 +1,50 @@ > > +## @file > > > > +# Beep status code implementation. > > > > +# > > > > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> > > > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > > > +# > > > > +# vendor. This file may not be modified, except as allowed by > > > > +# additional terms of your license agreement. > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + INF_VERSION = 0x00010005 > > > > + BASE_NAME = SmmBeepStatusCodeHandlerLib > > > > + FILE_GUID = 2E2BC2D4-572D-4663-9A1E-FB52FA30922A > > > > + MODULE_TYPE = DXE_SMM_DRIVER > > > > + VERSION_STRING = 1.0 > > > > + CONSTRUCTOR = SmmBeepStatusCodeHandlerLibConstructor > > > > + LIBRARY_CLASS = StatusCodeHandlerLib|DXE_SMM_DRIVER > > > > + > > > > +# > > > > +# The following information is for reference only and not required by the > > build tools. > > > > +# > > > > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is only for build) > > > > +# > > > > + > > > > +[Sources] > > > > + SmmBeepStatusCodeHandlerLib.c > > > > + > > > > +[Packages] > > > > + MdePkg/MdePkg.dec > > > > + MdeModulePkg/MdeModulePkg.dec > > > > + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec > > > > + > > > > +[LibraryClasses] > > > > + SmmServicesTableLib > > > > + PcdLib > > > > + DebugLib > > > > + ReportStatusCodeLib > > > > + BeepMapLib > > > > + BeepLib > > > > + > > > > +[Pcd] > > > > + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep > > ## CONSUMES > > > > + > > > > +[Protocols] > > > > + gEfiSmmRscHandlerProtocolGuid ## CONSUMES > > > > + > > > > +[Depex] > > > > + TRUE > > > > diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md > > b/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md > > new file mode 100644 > > index 0000000000..ee254d0f99 > > --- /dev/null > > +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md > > @@ -0,0 +1,125 @@ > > +# Overview > > > > +* **Feature Name:** Beep Debug > > > > +* **PI Phase(s) Supported:** PEI, DXE, SMM > > > > +* **SMM Required?** Yes > > > > + > > > > +More Information: > > > > + > > > > +## Purpose > > > > +The BeepDebugFeaturePkg include some useful beep debug libraries, > such > > as get beep value from status code and beep. > > > > +This is an important capability in firmware development to get and analyze > > the early error when there is not serial port. > > > > + > > > > + > > > > +# High-Level Theory of Operation > > > > +It provide a library BeepStatusCodeHandlerLib used by edk2 > > StatusCodeHandler.efi, used to do beep if needed. > > > > +It also provide a library of BeepMap lib, it map the status code to beep > value. > > > > +A library of Beep lib is needed by platform, and this pkg has a Null > > implementation. > > > > + > > > > +In the library contstructor function, BeepStatusCodeHandlerLib register > the > > call back function for ReportStatusCode. > > > > +When called, it call GetBeepFromStatusCode() in BeepMapLib to get beep > > value from status code, and call Beep() in BeepLib to beep. > > > > + > > > > +BeepStatusCodeHandlerLib include 3 libraries for PEI, RuntimeDxe, SMM: > > > > +* PeiBeepStatusCodeHandlerLib > > > > +* RuntimeDxeBeepStatusCodeHandlerLib > > > > +* SmmBeepStatusCodeHandlerLib > > > > + > > > > +## Firmware Volumes > > > > +Linked with StatusCodeHandler.efi, and make sure put the > > StatusCodeHandler.efi after the ReportStatusCodeRouter.efi. > > > > + > > > > +## Modules > > > > +* BeepStatusCodeHandlerLib > > > > +* BeepMapLib > > > > +* BeepLibNull > > > > + > > > > +## BeepStatusCodeHandlerLib > > > > +This library register the call back function for ReportStatusCode, and get > > beep valude from status code, and do beep. > > > > + > > > > +## BeepMapLib > > > > +This library provide a function to get beep value from status code. > > > > + > > > > +## Key Functions > > > > +* In PeiBeepStatusCodeHandlerLib: > > > > + EFI_STATUS > > > > + EFIAPI > > > > + BeepStatusCodeReportWorker ( > > > > + IN CONST EFI_PEI_SERVICES **PeiServices, > > > > + IN EFI_STATUS_CODE_TYPE CodeType, > > > > + IN EFI_STATUS_CODE_VALUE Value, > > > > + IN UINT32 Instance, > > > > + IN CONST EFI_GUID *CallerId, > > > > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL > > > > + ) > > > > + > > > > +* In RuntimeDxeBeepStatusCodeHandlerLib: > > > > + 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 > > > > + ) > > > > + > > > > +* In SmmBeepStatusCodeHandlerLib: > > > > + 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 > > > > + ) > > > > + > > > > +* In BeepMapLib: > > > > + UINT32 > > > > + EFIAPI > > > > + GetBeepValueFromStatusCode ( > > > > + IN EFI_STATUS_CODE_TYPE CodeType, > > > > + IN EFI_STATUS_CODE_VALUE Value > > > > + ) > > > > + > > > > +* In BeepLib: > > > > + VOID > > > > + EFIAPI > > > > + Beep ( > > > > + IN UINT32 Value > > > > + ) > > > > + > > > > +## Configuration > > > > +* Link the library to StatusCodeHandler.efi. > > > > + Example: > > > > + > > > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan > > dlerRuntimeDxe.inf { > > > > + <LibraryClasses> > > > > + > > > NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeD > > xeBeepStatusCodeHandlerLib.inf > > > > + } > > > > + Refer to BeepDebugFeature.dsc for other example. > > > > +* Config PCD > > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep. > > > > + In platform .dsc file, need to config the type of > > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep. > > > > + Use PcdsFixedAtBuild to save binary size, and use PcdsDynamic if want to > > enable/disable in runtime. > > > > +* Implemented platform's special BeepMapLib if needed. > > > > +* Provide the platform's special BeepLib. > > > > +* Make sure put the StatusCodeHandler.efi after the > > ReportStatusCodeRouter.efi. > > > > + > > > > +## Data Flows > > > > +Status Code (ReportStatusCode) -> Beep Value > > (GetBeepValueFromStatusCode). > > > > + > > > > +## Control Flows > > > > +ReportStatusCode() -> BeepStatusCodeReportWorker() -> > > GetBeepValueFromStatusCode() -> Beep() > > > > + > > > > +## Build Flows > > > > +There is not special build flows. > > > > + > > > > +## Test Point Results > > > > +Verify the post code shown is correct. > > > > + > > > > +## Functional Exit Criteria > > > > +N/A > > > > + > > > > +## Feature Enabling Checklist > > > > +* Set the PCD > > gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep to TRUE. > > > > +* Plug out all the memory, check can here the beep. > > > > + > > > > +## Common Optimizations > > > > +* Implemented platform's special BeepMapLib if needed. > > > > -- > > 2.24.0.windows.2 > > > > > > -=-=-=-=-=-= > > Groups.io Links: You receive all messages sent to this group. > > > > View/Reply Online (#61333): > https://edk2.groups.io/g/devel/message/61333 > > Mute This Topic: https://groups.io/mt/74913971/1768738 > > Group Owner: devel+owner@edk2.groups.io > > Unsubscribe: https://edk2.groups.io/g/devel/unsub > [dandan.bi@intel.com] > > -=-=-=-=-=-= ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-18 0:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-06-16 11:25 [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: add it Tan, Ming 2020-06-16 11:25 ` [PATCH v7 2/2] Features/Intel/PostCodeDebugFeaturePkg: " Tan, Ming 2020-06-18 0:46 ` [edk2-devel] " Dandan Bi 2020-06-17 8:25 ` [edk2-devel] [PATCH v7 1/2] Features/Intel/BeepDebugFeaturePkg: " Dandan Bi 2020-06-18 0:45 ` Dandan Bi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox