From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.2045.1591837484693759000 for ; Wed, 10 Jun 2020 18:04:44 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: ming.tan@intel.com) IronPort-SDR: 3/zof4NG1u4xzwjFjM0jEGumk4BViyL2M7kib93KvuZsmfltQvG3Rho6ldphfJSWSvBDYIij/M BvUF1oCoxcAg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2020 18:04:43 -0700 IronPort-SDR: 6ZZGAAQtDb0YhvIvKiVZPQjJRIPsv5PxolYYjAKXHCuMrS2tnBb5i9kzoTu+wp3lyanMcJyFlI mTjsGN97a6zg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,497,1583222400"; d="scan'208";a="418939383" Received: from shwdejointlab96.ccr.corp.intel.com ([10.239.134.144]) by orsmga004.jf.intel.com with ESMTP; 10 Jun 2020 18:04:40 -0700 From: "Tan, Ming" To: devel@edk2.groups.io Cc: Eric Dong , Liming Gao Subject: [PATCH v2] Features/Intel/BeepDebugFeaturePkg: add it. Date: Thu, 11 Jun 2020 09:04:34 +0800 Message-Id: <20200611010434.27119-1-ming.tan@intel.com> X-Mailer: git-send-email 2.24.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2792 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 Cc: Liming Gao Signed-off-by: Ming Tan --- V2: Delete the last empty line in BeepDebugFeaturePkg/Library/BeepMapLib/Be= epMapLib.inf .../BeepDebugFeaturePkg.dec | 31 ++ .../BeepDebugFeaturePkg.dsc | 30 ++ .../Include/BeepDebugFeature.dsc | 182 ++++++++++++ .../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 | 102 +++++++ .../PeiBeepStatusCodeHandlerLib.inf | 55 ++++ .../RuntimeDxeBeepStatusCodeHandlerLib.c | 183 ++++++++++++ .../RuntimeDxeBeepStatusCodeHandlerLib.inf | 57 ++++ .../SmmBeepStatusCodeHandlerLib.c | 138 +++++++++ .../SmmBeepStatusCodeHandlerLib.inf | 55 ++++ .../Debugging/BeepDebugFeaturePkg/Readme.md | 126 ++++++++ 17 files changed, 1500 insertions(+) create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugF= eaturePkg.dec create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugF= eaturePkg.dsc create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Be= epDebugFeature.dsc create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Li= brary/BeepLib.h create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Li= brary/BeepMapLib.h create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epLib/BeepLibNull.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epLib/BeepLibNull.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epMapLib/BeepMapLib.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epMapLib/BeepMapLib.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epMapLib/PlatformStatusCodesInternal.h create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epStatusCodeHandlerLib/PeiBeepStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.c create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Be= epStatusCodeHandlerLib/SmmBeepStatusCodeHandlerLib.inf create mode 100644 Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeatureP= kg.dec b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.d= ec new file mode 100644 index 0000000000..e80ce2f661 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec @@ -0,0 +1,31 @@ +## @file=0D +# This package provides Beep Debug feature.=0D +# This package should only depend on EDK II Core packages, IntelSiliconPkg= , and MinPlatformPkg.=0D +#=0D +# The DEC files are used by the utilities that parse DSC and=0D +# INF files to generate AutoGen.c and AutoGen.h files=0D +# for the build infrastructure.=0D +#=0D +# Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + DEC_SPECIFICATION =3D 0x00010017=0D + PACKAGE_NAME =3D BeepDebugFeaturePkg=0D + PACKAGE_GUID =3D DD88CEBB-E68F-4155-B754-D11E4FDF008D=0D + PACKAGE_VERSION =3D 0.1=0D +=0D +[Includes]=0D + Include=0D +=0D +[LibraryClasses]=0D +=0D +[Guids]=0D + gBeepDebugFeaturePkgTokenSpaceGuid =3D {0x54f56fb5, 0xea0e, 0x4518, {0= xa0, 0x3e, 0x1b, 0xeb, 0x56, 0x94, 0xd2, 0x16}}=0D +=0D +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]=0D + # Beep is a legacy feature, disabled it by default=0D + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep|FALSE|BOOLEAN|0x= 00000001=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeatureP= kg.dsc b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.d= sc new file mode 100644 index 0000000000..47254f9974 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/BeepDebugFeaturePkg.dsc @@ -0,0 +1,30 @@ +## @file=0D +# This package provides Beep Debug feature.=0D +# This package should only depend on EDK II Core packages, IntelSiliconPkg= , and MinPlatformPkg.=0D +#=0D +# The DEC files are used by the utilities that parse DSC and=0D +# INF files to generate AutoGen.c and AutoGen.h files=0D +# for the build infrastructure.=0D +#=0D +# Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + PLATFORM_NAME =3D BeepDebugFeaturePkg=0D + PLATFORM_GUID =3D D716EDF2-77BB-4536-9C64-4D7EEF0F3896= =0D + PLATFORM_VERSION =3D 0.1=0D + DSC_SPECIFICATION =3D 0x00010005=0D + OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME)=0D + SUPPORTED_ARCHITECTURES =3D IA32|X64=0D + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT=0D + SKUID_IDENTIFIER =3D DEFAULT=0D + PEI_ARCH =3D IA32=0D + DXE_ARCH =3D X64=0D +=0D +#=0D +# This package always builds the feature.=0D +#=0D +!include Include/BeepDebugFeature.dsc=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebug= Feature.dsc b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebu= gFeature.dsc new file mode 100644 index 0000000000..2ede28ca25 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/BeepDebugFeature= .dsc @@ -0,0 +1,182 @@ +## @file=0D +# This package provides Beep Debug feature.=0D +# This file should be included into another package DSC file to build this= feature.=0D +#=0D +# The DEC files are used by the utilities that parse DSC and=0D +# INF files to generate AutoGen.c and AutoGen.h files=0D +# for the build infrastructure.=0D +#=0D +# Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +##########################################################################= ######=0D +#=0D +# Defines Section - statements that will be processed to create a Makefile= .=0D +#=0D +##########################################################################= ######=0D +[Defines]=0D +!ifndef $(PEI_ARCH)=0D + !error "PEI_ARCH must be specified to build this feature!"=0D +!endif=0D +!ifndef $(DXE_ARCH)=0D + !error "DXE_ARCH must be specified to build this feature!"=0D +!endif=0D +=0D +##########################################################################= ######=0D +#=0D +# PCD Section - list of PCD Entries modified by the feature.=0D +#=0D +##########################################################################= ######=0D +[PcdsDynamicDefault]=0D + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep|TRUE=0D +=0D +##########################################################################= ######=0D +#=0D +# Library Class section - list of all Library Classes needed by this featu= re.=0D +#=0D +##########################################################################= ######=0D +[LibraryClasses]=0D + #######################################=0D + # Edk2 Packages=0D + #######################################=0D + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf=0D + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf=0D + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf=0D + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf=0D + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf=0D + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf=0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf=0D + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf=0D + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplat= e.inf=0D + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf=0D + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf=0D + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf=0D + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf=0D + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf=0D + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf=0D + SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull= .inf=0D +=0D + BeepLib|BeepDebugFeaturePkg/Library/BeepLib/BeepLibNull.inf=0D +=0D + #####################################=0D + # Beep Debug Feature Package=0D + #####################################=0D + BeepMapLib|BeepDebugFeaturePkg/Library/BeepMapLib/BeepMapLib.inf=0D +=0D +[LibraryClasses.common.PEIM]=0D + #######################################=0D + # Edk2 Packages=0D + #######################################=0D + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf=0D + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf=0D + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf=0D +=0D +[LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE,LibraryClasses.IA32= .SEC]=0D + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf=0D +=0D +[LibraryClasses.common.DXE_DRIVER]=0D + #######################################=0D + # Edk2 Packages=0D + #######################################=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D +=0D +[LibraryClasses.common.DXE_RUNTIME_DRIVER]=0D + #######################################=0D + # Edk2 Packages=0D + #######################################=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf=0D +=0D +[LibraryClasses.common.UEFI_DRIVER]=0D + #######################################=0D + # Edk2 Packages=0D + #######################################=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D +=0D +[LibraryClasses.X64.DXE_SMM_DRIVER]=0D + #######################################=0D + # Edk2 Packages=0D + #######################################=0D + SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableL= ib.inf=0D + MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAlloc= ationLib.inf=0D + SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf=0D + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmRepor= tStatusCodeLib.inf=0D +=0D +##########################################################################= ######=0D +#=0D +# Component section - list of all components that need built for this feat= ure.=0D +#=0D +# Note: The EDK II DSC file is not used to specify how compiled binary ima= ges get placed=0D +# into firmware volume images. This section is just a list of module= s to compile from=0D +# source into UEFI-compliant binaries.=0D +# It is the FDF file that contains information on combining binary f= iles into firmware=0D +# volume images, whose concept is beyond UEFI and is described in PI= specification.=0D +# There may also be modules listed in this section that are not requ= ired in the FDF file,=0D +# When a module listed here is excluded from FDF file, then UEFI-com= pliant binary will be=0D +# generated for it, but the binary will not be put into any firmware= volume.=0D +#=0D +##########################################################################= ######=0D +#=0D +# Feature PEI Components=0D +#=0D +=0D +# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzi= lla.tianocore.org/show_bug.cgi?id=3D2308=0D +# is completed.=0D +[Components.IA32]=0D + #####################################=0D + # Beep Debug Feature Package=0D + #####################################=0D +=0D + MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf {= =0D + =0D + NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepSta= tusCodeHandlerLib.inf=0D + }=0D +=0D + # Add components here that should be included in the package build.=0D +=0D +#=0D +# Feature DXE Components=0D +#=0D +=0D +# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzi= lla.tianocore.org/show_bug.cgi?id=3D2308=0D +# is completed.=0D +[Components.X64]=0D + #####################################=0D + # Beep Debug Feature Package=0D + #####################################=0D +=0D + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRun= timeDxe.inf {=0D + =0D + NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxe= BeepStatusCodeHandlerLib.inf=0D + }=0D +=0D + MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf {= =0D + =0D + NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepSta= tusCodeHandlerLib.inf=0D + }=0D +=0D + # Add components here that should be included in the package build.=0D +=0D +##########################################################################= #########################=0D +#=0D +# BuildOptions Section - Define the module specific tool chain flags that = should be used as=0D +# the default flags for a module. These flags are a= ppended to any=0D +# standard flags that are defined by the build proc= ess. They can be=0D +# applied for any modules or only those modules wit= h the specific=0D +# module style (EDK or EDKII) specified in [Compone= nts] section.=0D +#=0D +# For advanced features, it is recommended to enabl= e [BuildOptions] in=0D +# the applicable INF file so it does not affect the= whole board package=0D +# build when this DSC file is active.=0D +#=0D +##########################################################################= #########################=0D +[BuildOptions]=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/B= eepLib.h b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/Bee= pLib.h new file mode 100644 index 0000000000..f768acc557 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/BeepLib.h @@ -0,0 +1,33 @@ +/** @file=0D + Provides services to send progress/error codes to Beep device.=0D +=0D + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef __BEEP_LIB_H__=0D +#define __BEEP_LIB_H__=0D +=0D +/**=0D + Sends a 32-bit value to Beep device.=0D +=0D + Sends the 32-bit value specified by Value to Beep device, and returns Va= lue.=0D + Some implementations of this library function may perform I/O operations= =0D + directly to Beep device. Other implementations may send Value to=0D + ReportStatusCode(), and the status code reporting mechanism will eventua= lly=0D + display the 32-bit value on the status reporting device.=0D +=0D + Beep() must actively prevent recursion. If Beep() is called while=0D + processing another Post Code Library function, then=0D + Beep() must return Value immediately.=0D +=0D + @param Value Beep count.=0D +**/=0D +VOID=0D +EFIAPI=0D +Beep (=0D + IN UINT32 Value=0D + );=0D +=0D +#endif=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Include/Library/B= eepMapLib.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/BeepMapL= ib.h @@ -0,0 +1,32 @@ +/** @file=0D + This library class provides Platform Beep Map.=0D +=0D + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef __BEEP_MAP_LIB__=0D +#define __BEEP_MAP_LIB__=0D +=0D +/**=0D + Get BeepValue from status code type and value.=0D +=0D + @param CodeType Indicates the type of status code being reporte= d.=0D + @param Value Describes the current status of a hardware or=0D + software entity. This includes information abou= t the class and=0D + subclass that is used to classify the entity as= well as an operation.=0D + For progress codes, the operation is the curren= t activity.=0D + For error codes, it is the exception.For debug = codes,it is not defined at this time.=0D +=0D + @return BeepValue=0D +=0D +**/=0D +UINT32=0D +EFIAPI=0D +GetBeepValueFromStatusCode (=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value=0D + );=0D +=0D +#endif=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/B= eepLibNull.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/BeepLibN= ull.c @@ -0,0 +1,37 @@ +/** @file=0D + BeepLib Null implementation.=0D +=0D + Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +=0D +/**=0D + NULL implemented of Beep() function, just return directly.=0D + Normal Beep() function will do the following:=0D +=0D + Sends a 32-bit value to Beep device.=0D +=0D + Sends the 32-bit value specified by Value to Beep device, and returns Va= lue.=0D + Some implementations of this library function may perform I/O operations= =0D + directly to Beep device. Other implementations may send Value to=0D + ReportStatusCode(), and the status code reporting mechanism will eventua= lly=0D + display the 32-bit value on the status reporting device.=0D +=0D + Beep() must actively prevent recursion. If Beep() is called while=0D + processing another Post Code Library function, then=0D + Beep() must return Value immediately.=0D +=0D + @param Value Beep count.=0D +**/=0D +VOID=0D +EFIAPI=0D +Beep (=0D + IN UINT32 Value=0D + )=0D +{=0D + return;=0D +}=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/B= eepLibNull.inf b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepL= ib/BeepLibNull.inf new file mode 100644 index 0000000000..7f84dad082 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepLib/BeepLibN= ull.inf @@ -0,0 +1,26 @@ +## @file=0D +# Instance of Platform Beep Null Library.=0D +#=0D +# Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010017=0D + BASE_NAME =3D BeepLib=0D + FILE_GUID =3D 319F24D8-9F3E-4BEC-B1C4-C54BE51F3FC2= =0D + VERSION_STRING =3D 1.0=0D + MODULE_TYPE =3D BASE=0D + LIBRARY_CLASS =3D BeepLib=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC=0D +#=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D +=0D +[Sources]=0D + BeepLibNull.c=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLi= b/BeepMapLib.c b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepM= apLib/BeepMapLib.c new file mode 100644 index 0000000000..26c32dfd9b --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepM= apLib.c @@ -0,0 +1,116 @@ +/** @file=0D + BeepMap implementation.=0D +=0D + Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +=0D +#include "PlatformStatusCodesInternal.h"=0D +=0D +STATUS_CODE_TO_DATA_MAP mBeepProgressMap[] =3D {=0D + //=0D + // PEI=0D + //=0D + // Recovery=0D + { PEI_RECOVERY_STARTED, 2 },=0D +=0D + //=0D + // DXE=0D + //=0D +=0D + {0,0}=0D +};=0D +=0D +STATUS_CODE_TO_DATA_MAP mBeepErrorMap[] =3D {=0D + //=0D + // PEI=0D + //=0D + // Regular boot=0D + { PEI_MEMORY_NOT_DETECTED, 1 },=0D + { PEI_MEMORY_INSTALLED_TWICE, 1 },=0D + { PEI_DXEIPL_NOT_FOUND, 3 },=0D + { PEI_DXE_CORE_NOT_FOUND, 3 },=0D + { PEI_RESET_NOT_AVAILABLE, 7 },=0D + // Recovery=0D + { PEI_RECOVERY_FAILED, 4 },=0D + // S3 Resume=0D + { PEI_S3_RESUME_FAILED, 4 },=0D +=0D + //=0D + // DXE=0D + //=0D + { DXE_ARCH_PROTOCOL_NOT_AVAILABLE, 4 },=0D + { DXE_NO_CON_OUT, 5 },=0D + { DXE_NO_CON_IN, 5 },=0D + { DXE_INVALID_PASSWORD, 1 },=0D + { DXE_FLASH_UPDATE_FAILED, 6 },=0D + { DXE_RESET_NOT_AVAILABLE, 7 },=0D +=0D + {0,0}=0D +};=0D +=0D +STATUS_CODE_TO_DATA_MAP *mBeepStatusCodesMap[] =3D {=0D + //#define EFI_PROGRESS_CODE 0x00000001=0D + mBeepProgressMap,=0D + //#define EFI_ERROR_CODE 0x00000002=0D + mBeepErrorMap=0D + //#define EFI_DEBUG_CODE 0x00000003=0D +};=0D +=0D +/**=0D + Find the beep data from status code value.=0D +=0D + @param Map The map used to find in.=0D + @param Value The status code value.=0D +=0D + @return BeepValue 0 for not found.=0D +=0D +**/=0D +UINT32=0D +FindBeepData (=0D + IN STATUS_CODE_TO_DATA_MAP *Map,=0D + IN EFI_STATUS_CODE_VALUE Value=0D + )=0D +{=0D + while (Map->Value !=3D 0) {=0D + if (Map->Value =3D=3D Value) {=0D + return Map->Data;=0D + }=0D + Map++;=0D + }=0D + return 0;=0D +}=0D +=0D +/**=0D + Get BeepValue from status code type and value.=0D +=0D + @param CodeType Indicates the type of status code being reporte= d.=0D + @param Value Describes the current status of a hardware or=0D + software entity. This includes information abou= t the class and=0D + subclass that is used to classify the entity as= well as an operation.=0D + For progress codes, the operation is the curren= t activity.=0D + For error codes, it is the exception.For debug = codes,it is not defined at this time.=0D +=0D + @return BeepValue=0D +**/=0D +UINT32=0D +EFIAPI=0D +GetBeepValueFromStatusCode (=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value=0D + )=0D +{=0D + UINT32 CodeTypeIndex;=0D +=0D + CodeTypeIndex =3D STATUS_CODE_TYPE (CodeType) - 1;=0D +=0D + if (CodeTypeIndex >=3D sizeof (mBeepStatusCodesMap) / sizeof(mBeepStatus= CodesMap[0])) {=0D + return 0;=0D + }=0D +=0D + return FindBeepData (mBeepStatusCodesMap[CodeTypeIndex], Value);=0D +}=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLi= b/BeepMapLib.inf b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/Bee= pMapLib/BeepMapLib.inf new file mode 100644 index 0000000000..b957eee07b --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/BeepM= apLib.inf @@ -0,0 +1,27 @@ +## @file=0D +# Instance of Beep Map Library.=0D +#=0D +# Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010017=0D + BASE_NAME =3D BeepMapLib=0D + FILE_GUID =3D 8BAFA82F-DA9E-4cce-8FA2-9DA189D7246D= =0D + VERSION_STRING =3D 2.0=0D + MODULE_TYPE =3D BASE=0D + LIBRARY_CLASS =3D BeepMapLib=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC=0D +#=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D +=0D +[Sources]=0D + BeepMapLib.c=0D + PlatformStatusCodesInternal.h=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLi= b/PlatformStatusCodesInternal.h b/Features/Intel/Debugging/BeepDebugFeature= Pkg/Library/BeepMapLib/PlatformStatusCodesInternal.h new file mode 100644 index 0000000000..a36134c933 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepMapLib/Platf= ormStatusCodesInternal.h @@ -0,0 +1,270 @@ +/** @file=0D + Beep status code definition.=0D +=0D + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef __PLATFORM_STATUS_CODES_INTERNAL_H__=0D +#define __PLATFORM_STATUS_CODES_INTERNAL_H__=0D +=0D +#include =0D +=0D +typedef struct{=0D + EFI_STATUS_CODE_VALUE Value;=0D + UINT32 Data;=0D +} STATUS_CODE_TO_DATA_MAP;=0D +=0D +//=0D +// Enable PEI/DXE status code=0D +//=0D +#define PEI_STATUS_CODE 1=0D +#define DXE_STATUS_CODE 1=0D +=0D +#define STATUS_CODE_TYPE(Type) ((Type)&EFI_STATUS_CODE_TYPE= _MASK)=0D +#define STATUS_CODE_CLASS(Value) ((Value)&EFI_STATUS_CODE_CLA= SS_MASK)=0D +=0D +//Progress/Error codes=0D +#define PEI_CORE_STARTED (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PEI_CORE_PC_ENTRY_POINT)=0D +#define PEI_RESET_NOT_AVAILABLE (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PS_EC_RESET_NOT_AVAILABLE)=0D +#define PEI_DXEIPL_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PEI_CORE_EC_DXEIPL_NOT_FOUND)=0D +#define PEI_DXE_CORE_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PEI_CORE_EC_DXE_CORRUPT)=0D +#define PEI_S3_RESUME_ERROR (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PEI_EC_S3_RESUME_FAILED)=0D +#define PEI_RECOVERY_FAILED (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PEI_EC_RECOVERY_FAILED)=0D +#define DXE_CORE_STARTED (EFI_SOFTWARE_DXE_CORE | EFI= _SW_DXE_CORE_PC_ENTRY_POINT)=0D +=0D +//#define DXE_EXIT_BOOT_SERVICES_BEGIN 0xF8=0D +#define DXE_EXIT_BOOT_SERVICES_END (EFI_SOFTWARE_EFI_BOOT_SERVI= CE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)=0D +=0D +// Reported by CPU PEIM=0D +#define PEI_CAR_CPU_INIT (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_PC_POWER_ON_INIT)=0D +=0D +// Reported by NB PEIM=0D +//#define PEI_CAR_NB_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | EFI_CU_CHIPSET_NORTH_INIT)=0D +=0D +// Reported by SB PEIM=0D +//#define PEI_CAR_SB_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | EFI_CU_CHIPSET_PC_SOUTH_INIT)=0D +=0D +//Reported by Memory Detection PEIM=0D +#define PEI_MEMORY_SPD_READ (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_PC_SPD_READ)=0D +#define PEI_MEMORY_PRESENCE_DETECT (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_PC_PRESENCE_DETECT)=0D +#define PEI_MEMORY_TIMING (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_PC_TIMING)=0D +#define PEI_MEMORY_CONFIGURING (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_PC_CONFIGURING)=0D +#define PEI_MEMORY_OPTIMIZING (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_PC_OPTIMIZING)=0D +#define PEI_MEMORY_INIT (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_PC_INIT)=0D +#define PEI_MEMORY_TEST (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_PC_TEST)=0D +#define PEI_MEMORY_INVALID_TYPE (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_INVALID_TYPE)=0D +#define PEI_MEMORY_INVALID_SPEED (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_INVALID_SPEED)=0D +#define PEI_MEMORY_SPD_FAIL (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_SPD_FAIL)=0D +#define PEI_MEMORY_INVALID_SIZE (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_INVALID_SIZE)=0D +#define PEI_MEMORY_MISMATCH (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_MISMATCH)=0D +#define PEI_MEMORY_S3_RESUME_FAILED (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_S3_RESUME_FAIL)=0D +#define PEI_MEMORY_NOT_DETECTED (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_NONE_DETECTED)=0D +#define PEI_MEMORY_NONE_USEFUL (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_NONE_USEFUL)=0D +#define PEI_MEMORY_ERROR (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_EC_NON_SPECIFIC)=0D +#define PEI_MEMORY_INSTALLED (EFI_SOFTWARE_PEI_SERVICE |= EFI_SW_PS_PC_INSTALL_PEI_MEMORY)=0D +#define PEI_MEMORY_NOT_INSTALLED (EFI_SOFTWARE_PEI_SERVICE |= EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED)=0D +#define PEI_MEMORY_INSTALLED_TWICE (EFI_SOFTWARE_PEI_SERVICE |= EFI_SW_PS_EC_MEMORY_INSTALLED_TWICE)=0D +=0D +//Reported by CPU PEIM=0D +#define PEI_CPU_INIT (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_PC_INIT_BEGIN)=0D +#define PEI_CPU_CACHE_INIT (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_PC_CACHE_INIT)=0D +#define PEI_CPU_BSP_SELECT (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_PC_BSP_SELECT)=0D +#define PEI_CPU_AP_INIT (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_PC_AP_INIT)=0D +#define PEI_CPU_SMM_INIT (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_PC_SMM_INIT)=0D +#define PEI_CPU_INVALID_TYPE (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_INVALID_TYPE)=0D +#define PEI_CPU_INVALID_SPEED (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_INVALID_SPEED)=0D +#define PEI_CPU_MISMATCH (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_MISMATCH)=0D +#define PEI_CPU_SELF_TEST_FAILED (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_SELF_TEST)=0D +#define PEI_CPU_CACHE_ERROR (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_CACHE)=0D +#define PEI_CPU_MICROCODE_UPDATE_FAILED (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_MICROCODE_UPDATE)=0D +#define PEI_CPU_NO_MICROCODE (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_NO_MICROCODE_UPDATE)=0D +//If non of the errors above apply use this one=0D +#define PEI_CPU_INTERNAL_ERROR (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_INTERNAL)=0D +//Generic CPU error. It should only be used if non of the errors above app= ly=0D +#define PEI_CPU_ERROR (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_EC_NON_SPECIFIC)=0D +=0D +// Reported by NB PEIM=0D +#define PEI_MEM_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_PEI_MEM_NB_INIT)=0D +// Reported by SB PEIM=0D +#define PEI_MEM_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_PEI_MEM_SB_INIT)=0D +=0D +//Reported by PEIM which detected forced or auto recovery condition=0D +#define PEI_RECOVERY_AUTO (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_PC_RECOVERY_AUTO)=0D +#define PEI_RECOVERY_USER (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_PC_RECOVERY_USER)=0D +=0D +//Reported by DXE IPL=0D +#define PEI_RECOVERY_PPI_NOT_FOUND (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND)=0D +#define PEI_S3_RESUME_PPI_NOT_FOUND (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND)=0D +#define PEI_S3_RESUME_FAILED (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_EC_S3_RESUME_FAILED)=0D +=0D +//Reported by Recovery PEIM=0D +#define PEI_RECOVERY_STARTED (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_PC_RECOVERY_BEGIN)=0D +#define PEI_RECOVERY_CAPSULE_FOUND (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_PC_CAPSULE_LOAD)=0D +#define PEI_RECOVERY_NO_CAPSULE (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_EC_NO_RECOVERY_CAPSULE)=0D +#define PEI_RECOVERY_CAPSULE_LOADED (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_PC_CAPSULE_START)=0D +#define PEI_RECOVERY_INVALID_CAPSULE (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR)=0D +=0D +//Reported by S3 Resume PEIM=0D +#define PEI_S3_BOOT_SCRIPT (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_PC_S3_BOOT_SCRIPT)=0D +#define PEI_S3_OS_WAKE (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_PC_OS_WAKE)=0D +#define PEI_S3_BOOT_SCRIPT_ERROR (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_EC_S3_BOOT_SCRIPT_ERROR)=0D +#define PEI_S3_OS_WAKE_ERROR (EFI_SOFTWARE_PEI_MODULE | E= FI_SW_PEI_EC_S3_OS_WAKE_ERROR)=0D +=0D +#define PEI_PEIM_STARTED (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PC_INIT_BEGIN)=0D +#define PEI_PEIM_ENDED (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PC_INIT_END)=0D +=0D +//Reported by DXE IPL=0D +#define PEI_DXE_IPL_STARTED (EFI_SOFTWARE_PEI_CORE | EFI= _SW_PEI_CORE_PC_HANDOFF_TO_NEXT)=0D +=0D +//Reported by PEIM which installs Reset PPI=0D +#define PEI_RESET_SYSTEM (EFI_SOFTWARE_PEI_SERVICE | = EFI_SW_PS_PC_RESET_SYSTEM)=0D +=0D +//Reported by the PEIM or DXE driver which detected the error=0D +#define GENERIC_MEMORY_CORRECTABLE_ERROR (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_CORRECTABLE)=0D +#define GENERIC_MEMORY_UNCORRECTABLE_ERROR (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_UNCORRECTABLE)=0D +=0D +//Reported by Flash Update DXE driver=0D +#define DXE_FLASH_UPDATE_FAILED (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_UPDATE_FAIL)=0D +=0D +//Reported by the PEIM or DXE driver which detected the error=0D +#define GENERIC_CPU_THERMAL_ERROR (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_THERMAL)=0D +#define GENERIC_CPU_LOW_VOLTAGE (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_LOW_VOLTAGE)=0D +#define GENERIC_CPU_HIGH_VOLTAGE (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_HIGH_VOLTAGE)=0D +#define GENERIC_CPU_CORRECTABLE_ERROR (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_CORRECTABLE)=0D +#define GENERIC_CPU_UNCORRECTABLE_ERROR (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_UNCORRECTABLE)=0D +#define GENERIC_BAD_DATE_TIME_ERROR (EFI_SOFTWARE_UNSPECIFIED | = EFI_SW_EC_BAD_DATE_TIME)=0D +#define GENERIC_MEMORY_SIZE_DECREASE (EFI_COMPUTING_UNIT_MEMORY |= EFI_CU_MEMORY_EC_MISMATCH)=0D +=0D +//Reported by DXE Core=0D +#define DXE_DRIVER_STARTED (EFI_SOFTWARE_EFI_DXE_SERVIC= E | EFI_SW_PC_INIT_BEGIN)=0D +#define DXE_DRIVER_ENED (EFI_SOFTWARE_DXE_CORE | EFI= _SW_PC_INIT_END)=0D +#define DXE_ARCH_PROTOCOLS_AVAILABLE (EFI_SOFTWARE_DXE_CORE | EFI= _SW_DXE_CORE_PC_ARCH_READY)=0D +#define DXE_DRIVER_CONNECTED (EFI_SOFTWARE_DXE_CORE | EFI= _SW_DXE_CORE_PC_START_DRIVER)=0D +#define DXE_ARCH_PROTOCOL_NOT_AVAILABLE (EFI_SOFTWARE_DXE_CORE | EFI= _SW_DXE_CORE_EC_NO_ARCH)=0D +=0D +//Reported by DXE CPU driver=0D +#define DXE_CPU_SELF_TEST_FAILED (EFI_COMPUTING_UNIT_HOST_PRO= CESSOR | EFI_CU_HP_EC_SELF_TEST)=0D +=0D +//Reported by PCI Host Bridge driver=0D +#define DXE_NB_HB_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_DXE_HB_INIT )=0D +=0D +// Reported by NB Driver=0D +#define DXE_NB_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_DXE_NB_INIT )=0D +#define DXE_NB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_DXE_NB_SMM_INIT )=0D +#define DXE_NB_ERROR (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_EC_DXE_NB_ERROR )=0D +=0D +// Reported by SB Driver(s)=0D +#define DXE_SBRUN_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_DXE_SB_RT_INIT )=0D +#define DXE_SB_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_DXE_SB_INIT )=0D +#define DXE_SB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_DXE_SB_SMM_INIT )=0D +#define DXE_SB_DEVICES_INIT (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_PC_DXE_SB_DEVICES_INIT )=0D +#define DXE_SB_BAD_BATTERY (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_EC_BAD_BATTERY)=0D +#define DXE_SB_ERROR (EFI_COMPUTING_UNIT_CHIPSET = | EFI_CHIPSET_EC_DXE_SB_ERROR )=0D +=0D +//Reported by DXE Core=0D +#define DXE_BDS_STARTED (EFI_SOFTWARE_DXE_CORE | EFI= _SW_DXE_CORE_PC_HANDOFF_TO_NEXT)=0D +=0D +//Reported by BDS=0D +//#define DXE_BDS_CONNECT_DRIVERS (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS)=0D +=0D +//Reported by Boot Manager=0D +#define DXE_READY_TO_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)=0D +=0D +//Reported by DXE Core=0D +#define DXE_EXIT_BOOT_SERVICES (EFI_SOFTWARE_EFI_BOOT_SERVI= CE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)=0D +#define DXE_EXIT_BOOT_SERVICES_EVENT (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_PC_EXIT_BOOT_SERVICES_EVENT)=0D +=0D +//Reported by driver that installs Runtime AP=0D +#define RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN (EFI_SOFTWARE_EFI_RUNTIME_SE= RVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP)=0D +#define RT_SET_VIRTUAL_ADDRESS_MAP_END (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT)=0D +=0D +//Reported by CSM=0D +#define DXE_LEGACY_OPROM_INIT (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_PC_LEGACY_OPROM_INIT)=0D +#define DXE_LEGACY_BOOT (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT)=0D +#define DXE_LEGACY_OPROM_NO_SPACE (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_EC_LEGACY_OPROM_NO_SPACE)=0D +=0D +//Reported by SETUP=0D +//#define DXE_SETUP_VERIFYING_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD)=0D +#define DXE_SETUP_START (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_PC_USER_SETUP)=0D +#define DXE_SETUP_INPUT_WAIT (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_PC_INPUT_WAIT)=0D +#define DXE_INVALID_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_EC_INVALID_PASSWORD)=0D +#define DXE_INVALID_IDE_PASSWORD (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_EC_INVALID_IDE_PASSWORD)=0D +#define DXE_BOOT_OPTION_LOAD_ERROR (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR)=0D +#define DXE_BOOT_OPTION_FAILED (EFI_SOFTWARE_DXE_BS_DRIVER = | EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED)=0D +=0D +//Reported by a Driver that installs Reset AP=0D +#define DXE_RESET_SYSTEM (EFI_SOFTWARE_EFI_RUNTIME_SE= RVICE | EFI_SW_RS_PC_RESET_SYSTEM)=0D +#define DXE_RESET_NOT_AVAILABLE (EFI_SOFTWARE_EFI_RUNTIME_SE= RVICE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)=0D +=0D +// Reported by PCI bus driver=0D +#define DXE_PCI_BUS_BEGIN (EFI_IO_BUS_PCI | EFI_IOB_PC= _INIT)=0D +#define DXE_PCI_BUS_ENUM (EFI_IO_BUS_PCI | EFI_IOB_PC= I_PC_BUS_ENUM)=0D +#define DXE_PCI_BUS_HPC_INIT (EFI_IO_BUS_PCI | EFI_IOB_PC= I_PC_HPC_INIT)=0D +#define DXE_PCI_BUS_REQUEST_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_PC= I_PC_RES_ALLOC)=0D +#define DXE_PCI_BUS_ASSIGN_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_PC= _ENABLE)=0D +#define DXE_PCI_BUS_HOTPLUG (EFI_IO_BUS_PCI | EFI_IOB_PC= _HOTPLUG)=0D +#define DXE_PCI_BUS_OUT_OF_RESOURCES (EFI_IO_BUS_PCI | EFI_IOB_EC= _RESOURCE_CONFLICT)=0D +=0D +// Reported by USB bus driver=0D +#define DXE_USB_BEGIN (EFI_IO_BUS_USB | EFI_IOB_PC= _INIT)=0D +#define DXE_USB_RESET (EFI_IO_BUS_USB | EFI_IOB_PC= _RESET)=0D +#define DXE_USB_DETECT (EFI_IO_BUS_USB | EFI_IOB_PC= _DETECT)=0D +#define DXE_USB_ENABLE (EFI_IO_BUS_USB | EFI_IOB_PC= _ENABLE)=0D +#define DXE_USB_HOTPLUG (EFI_IO_BUS_USB | EFI_IOB_PC= _HOTPLUG)=0D +=0D +//Reported by IDE bus driver=0D +#define DXE_IDE_BEGIN (EFI_IO_BUS_ATA_ATAPI | EFI_= IOB_PC_INIT)=0D +#define DXE_IDE_RESET (EFI_IO_BUS_ATA_ATAPI | EFI_= IOB_PC_RESET)=0D +#define DXE_IDE_DETECT (EFI_IO_BUS_ATA_ATAPI | EFI_= IOB_PC_DETECT)=0D +#define DXE_IDE_ENABLE (EFI_IO_BUS_ATA_ATAPI | EFI_= IOB_PC_ENABLE)=0D +#define DXE_IDE_SMART_ERROR (EFI_IO_BUS_ATA_ATAPI | EFI_= IOB_ATA_BUS_SMART_OVERTHRESHOLD)=0D +#define DXE_IDE_CONTROLLER_ERROR (EFI_IO_BUS_ATA_ATAPI | EFI_= IOB_EC_CONTROLLER_ERROR)=0D +#define DXE_IDE_DEVICE_FAILURE (EFI_IO_BUS_ATA_ATAPI | EFI_= IOB_EC_INTERFACE_ERROR)=0D +=0D +// Reported by SCSI bus driver=0D +#define DXE_SCSI_BEGIN (EFI_IO_BUS_SCSI | EFI_IOB_P= C_INIT)=0D +#define DXE_SCSI_RESET (EFI_IO_BUS_SCSI | EFI_IOB_P= C_RESET)=0D +#define DXE_SCSI_DETECT (EFI_IO_BUS_SCSI | EFI_IOB_P= C_DETECT)=0D +#define DXE_SCSI_ENABLE (EFI_IO_BUS_SCSI | EFI_IOB_P= C_ENABLE)=0D +=0D +// Reported by Super I/O driver=0D +#define DXE_SIO_INIT (EFI_IO_BUS_LPC | EFI_IOB_PC= _INIT)=0D +=0D +// Reported by Keyboard driver=0D +#define DXE_KEYBOARD_INIT (EFI_PERIPHERAL_KEYBOARD | E= FI_P_PC_INIT)=0D +#define DXE_KEYBOARD_RESET (EFI_PERIPHERAL_KEYBOARD | E= FI_P_PC_RESET)=0D +#define DXE_KEYBOARD_DISABLE (EFI_PERIPHERAL_KEYBOARD | E= FI_P_PC_DISABLE)=0D +#define DXE_KEYBOARD_DETECT (EFI_PERIPHERAL_KEYBOARD | E= FI_P_PC_PRESENCE_DETECT)=0D +#define DXE_KEYBOARD_ENABLE (EFI_PERIPHERAL_KEYBOARD | E= FI_P_PC_ENABLE)=0D +#define DXE_KEYBOARD_CLEAR_BUFFER (EFI_PERIPHERAL_KEYBOARD | E= FI_P_KEYBOARD_PC_CLEAR_BUFFER)=0D +#define DXE_KEYBOARD_SELF_TEST (EFI_PERIPHERAL_KEYBOARD | E= FI_P_KEYBOARD_PC_SELF_TEST)=0D +=0D +// Reported by Mouse driver=0D +#define DXE_MOUSE_INIT (EFI_PERIPHERAL_MOUSE | EFI_= P_PC_INIT)=0D +#define DXE_MOUSE_RESET (EFI_PERIPHERAL_MOUSE | EFI_= P_PC_RESET)=0D +#define DXE_MOUSE_DISABLE (EFI_PERIPHERAL_MOUSE | EFI_= P_PC_DISABLE)=0D +#define DXE_MOUSE_DETECT (EFI_PERIPHERAL_MOUSE | EFI_= P_PC_PRESENCE_DETECT)=0D +#define DXE_MOUSE_ENABLE (EFI_PERIPHERAL_MOUSE | EFI_= P_PC_ENABLE)=0D +=0D +// Reported by Mass Storage drivers=0D +#define DXE_FIXED_MEDIA_INIT (EFI_PERIPHERAL_FIXED_MEDIA = | EFI_P_PC_INIT)=0D +#define DXE_FIXED_MEDIA_RESET (EFI_PERIPHERAL_FIXED_MEDIA = | EFI_P_PC_RESET)=0D +#define DXE_FIXED_MEDIA_DISABLE (EFI_PERIPHERAL_FIXED_MEDIA = | EFI_P_PC_DISABLE)=0D +#define DXE_FIXED_MEDIA_DETECT (EFI_PERIPHERAL_FIXED_MEDIA = | EFI_P_PC_PRESENCE_DETECT)=0D +#define DXE_FIXED_MEDIA_ENABLE (EFI_PERIPHERAL_FIXED_MEDIA = | EFI_P_PC_ENABLE)=0D +#define DXE_REMOVABLE_MEDIA_INIT (EFI_PERIPHERAL_REMOVABLE_ME= DIA | EFI_P_PC_INIT)=0D +#define DXE_REMOVABLE_MEDIA_RESET (EFI_PERIPHERAL_REMOVABLE_ME= DIA | EFI_P_PC_RESET)=0D +#define DXE_REMOVABLE_MEDIA_DISABLE (EFI_PERIPHERAL_REMOVABLE_ME= DIA | EFI_P_PC_DISABLE)=0D +#define DXE_REMOVABLE_MEDIA_DETECT (EFI_PERIPHERAL_REMOVABLE_ME= DIA | EFI_P_PC_PRESENCE_DETECT)=0D +#define DXE_REMOVABLE_MEDIA_ENABLE (EFI_PERIPHERAL_REMOVABLE_ME= DIA | EFI_P_PC_ENABLE)=0D +=0D +=0D +// Reported by BDS=0D +#define DXE_CON_OUT_CONNECT (EFI_PERIPHERAL_LOCAL_CONSOL= E | EFI_P_PC_INIT)=0D +#define DXE_CON_IN_CONNECT (EFI_PERIPHERAL_KEYBOARD | E= FI_P_PC_INIT)=0D +#define DXE_NO_CON_OUT (EFI_PERIPHERAL_LOCAL_CONSOL= E | EFI_P_EC_NOT_DETECTED)=0D +#define DXE_NO_CON_IN (EFI_PERIPHERAL_KEYBOARD | E= FI_P_EC_NOT_DETECTED)=0D +=0D +#endif=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatu= sCodeHandlerLib/PeiBeepStatusCodeHandlerLib.c b/Features/Intel/Debugging/Be= epDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandler= Lib.c new file mode 100644 index 0000000000..78cde0c118 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHa= ndlerLib/PeiBeepStatusCodeHandlerLib.c @@ -0,0 +1,102 @@ +/** @file=0D + Beep status code implementation.=0D +=0D + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +#include =0D +=0D +/**=0D + Convert status code value to the times of beep.=0D +=0D + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le published by the PEI Foundation.=0D + @param CodeType Indicates the type of status code being reporte= d.=0D + @param Value Describes the current status of a hardware or=0D + software entity. This includes information abou= t the class and=0D + subclass that is used to classify the entity as= well as an operation.=0D + For progress codes, the operation is the curren= t activity.=0D + For error codes, it is the exception.For debug = codes,it is not defined at this time.=0D + @param Instance The enumeration of a hardware or software entit= y within=0D + the system. A system may contain multiple entit= ies that match a class/subclass=0D + pairing. The instance differentiates between th= em. An instance of 0 indicates=0D + that instance information is unavailable, not m= eaningful, or not relevant.=0D + Valid instance numbers start with 1.=0D + @param CallerId This optional parameter may be used to identify= the caller.=0D + This parameter allows the status code driver to= apply different rules to=0D + different callers.=0D + @param Data This optional parameter may be used to pass add= itional data.=0D +=0D + @retval EFI_SUCCESS Status code reported to beep successfully.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +BeepStatusCodeReportWorker (=0D + IN CONST EFI_PEI_SERVICES **PeiServices,=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value,=0D + IN UINT32 Instance,=0D + IN CONST EFI_GUID *CallerId,=0D + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL=0D + )=0D +{=0D + UINT32 BeepValue;=0D +=0D + BeepValue =3D GetBeepValueFromStatusCode (CodeType, Value);=0D + if (BeepValue !=3D 0) {=0D + DEBUG ((DEBUG_INFO, "Beep: %d \n", BeepValue));=0D + Beep (BeepValue);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Constructor function of PeiBeepStatusCodeHandlerLib.=0D +=0D + This function is the constructor function of this Beep Status Code Handl= er Library for PEI Phase.=0D + It check whether need beep, and register it to gEfiPeiRscHandlerPpiGuid.= =0D +=0D + @param FileHandle Handle of the file being invoked.=0D + @param PeiServices Describes the list of possible PEI Services.=0D +=0D + @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfull= y.=0D +=0D +**/=0D +RETURN_STATUS=0D +EFIAPI=0D +PeiBeepStatusCodeHandlerLibConstructor (=0D + IN EFI_PEI_FILE_HANDLE FileHandle,=0D + IN CONST EFI_PEI_SERVICES **PeiServices=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi;=0D +=0D + if (!PcdGetBool (PcdStatusCodeUseBeep)) {=0D + return RETURN_SUCCESS;=0D + }=0D +=0D + Status =3D PeiServicesLocatePpi (=0D + &gEfiPeiRscHandlerPpiGuid,=0D + 0,=0D + NULL,=0D + (VOID **) &RscHandlerPpi=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + Status =3D RscHandlerPpi->Register (BeepStatusCodeReportWorker);=0D + ASSERT (!EFI_ERROR (Status) || Status =3D=3D EFI_ALREADY_STARTED);=0D +=0D + return RETURN_SUCCESS;=0D +}=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatu= sCodeHandlerLib/PeiBeepStatusCodeHandlerLib.inf b/Features/Intel/Debugging/= BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/PeiBeepStatusCodeHandl= erLib.inf new file mode 100644 index 0000000000..f8200d9921 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHa= ndlerLib/PeiBeepStatusCodeHandlerLib.inf @@ -0,0 +1,55 @@ +## @file=0D +# Beep status code implementation.=0D +#=0D +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +# vendor. This file may not be modified, except as allowed by=0D +# additional terms of your license agreement.=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D PeiBeepStatusCodeHandlerLib=0D + FILE_GUID =3D C4210E71-0A38-4728-8D25-4876348AA380= =0D + MODULE_TYPE =3D PEIM=0D + CONSTRUCTOR =3D PeiBeepStatusCodeHandlerLibConstructo= r=0D + LIBRARY_CLASS =3D StatusCodeHandlerLib|SEC PEIM PEI_COR= =0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC (EBC is only for bui= ld)=0D +#=0D +=0D +[Sources]=0D + PeiBeepStatusCodeHandlerLib.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec=0D +=0D +[LibraryClasses]=0D + PeiServicesLib=0D + PcdLib=0D + HobLib=0D + ReportStatusCodeLib=0D + PrintLib=0D + DebugLib=0D + BaseMemoryLib=0D + BeepMapLib=0D + BeepLib=0D +=0D +[Guids]=0D + gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## G= UID=0D +=0D +[Pcd]=0D + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep ##= CONSUMES=0D +=0D +[Ppis]=0D + gEfiPeiRscHandlerPpiGuid ## CONSUMES=0D +=0D +[Depex]=0D + TRUE=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatu= sCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c b/Features/Intel/Debug= ging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepSta= tusCodeHandlerLib.c new file mode 100644 index 0000000000..0f24dbdf02 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHa= ndlerLib/RuntimeDxeBeepStatusCodeHandlerLib.c @@ -0,0 +1,183 @@ +/** @file=0D + Beep status code implementation.=0D +=0D + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +#include =0D +=0D +EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL;=0D +EFI_EVENT mExitBootServicesEvent =3D NULL;=0D +=0D +/**=0D + Convert status code value to the times of beep.=0D +=0D + @param CodeType Indicates the type of status code being reporte= d.=0D + @param Value Describes the current status of a hardware or=0D + software entity. This includes information abou= t the class and=0D + subclass that is used to classify the entity as= well as an operation.=0D + For progress codes, the operation is the curren= t activity.=0D + For error codes, it is the exception.For debug = codes,it is not defined at this time.=0D + @param Instance The enumeration of a hardware or software entit= y within=0D + the system. A system may contain multiple entit= ies that match a class/subclass=0D + pairing. The instance differentiates between th= em. An instance of 0 indicates=0D + that instance information is unavailable, not m= eaningful, or not relevant.=0D + Valid instance numbers start with 1.=0D + @param CallerId This optional parameter may be used to identify= the caller.=0D + This parameter allows the status code driver to= apply different rules to=0D + different callers.=0D + @param Data This optional parameter may be used to pass add= itional data.=0D +=0D + @retval EFI_SUCCESS Status code reported to beep successfully.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +BeepStatusCodeReportWorker (=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value,=0D + IN UINT32 Instance,=0D + IN EFI_GUID *CallerId,=0D + IN EFI_STATUS_CODE_DATA *Data OPTIONAL=0D + )=0D +{=0D + UINT32 BeepValue;=0D +=0D + BeepValue =3D GetBeepValueFromStatusCode (CodeType, Value);=0D + if (BeepValue !=3D 0) {=0D + DEBUG ((DEBUG_INFO, "Beep: %d \n", BeepValue));=0D + Beep (BeepValue);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Unregister status code callback functions only available at boot time fr= om=0D + report status code router when exiting boot services.=0D +=0D + @param Event Event whose notification function is being invoked= .=0D + @param Context Pointer to the notification function's context, wh= ich is=0D + always zero in current implementation.=0D +=0D +**/=0D +VOID=0D +EFIAPI=0D +UnregisterBeepBootTimeHandlers (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D + )=0D +{=0D + if (PcdGetBool (PcdStatusCodeUseBeep)) {=0D + mRscHandlerProtocol->Unregister (BeepStatusCodeReportWorker);=0D + }=0D +}=0D +=0D +=0D +=0D +/**=0D + Register status code callback function only when Report Status Code prot= ocol=0D + is installed.=0D +=0D + @param Event Event whose notification function is being invoked= .=0D + @param Context Pointer to the notification function's context, wh= ich is=0D + always zero in current implementation.=0D +=0D +**/=0D +VOID=0D +EFIAPI=0D +RegisterBeepBootTimeHandlers (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D +)=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D gBS->LocateProtocol (=0D + &gEfiRscHandlerProtocolGuid,=0D + NULL,=0D + (VOID **) &mRscHandlerProtocol=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + if (PcdGetBool (PcdStatusCodeUseBeep)) {=0D + mRscHandlerProtocol->Register (BeepStatusCodeReportWorker, TPL_HIGH_LE= VEL);=0D + }=0D +=0D + Status =3D gBS->CreateEventEx (=0D + EVT_NOTIFY_SIGNAL,=0D + TPL_NOTIFY,=0D + UnregisterBeepBootTimeHandlers,=0D + NULL,=0D + &gEfiEventExitBootServicesGuid,=0D + &mExitBootServicesEvent=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +}=0D +=0D +/**=0D + Constructor function of RuntimeDxeBeepStatusCodeHandlerLib.=0D +=0D + This function allocates memory for extended status code data, caches=0D + the report status code service, and registers events.=0D +=0D + @param ImageHandle The firmware allocated handle for the EFI image.=0D + @param SystemTable A pointer to the EFI System Table.=0D +=0D + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RuntimeDxeBeepStatusCodeHandlerLibConstructor (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_EVENT RegisterStatusCodeHandlerEvent;=0D + VOID *Registration;=0D +=0D + Status =3D gBS->LocateProtocol (=0D + &gEfiRscHandlerProtocolGuid,=0D + NULL,=0D + (VOID **) &mRscHandlerProtocol=0D + );=0D +=0D + if (!EFI_ERROR (Status)) {=0D + RegisterBeepBootTimeHandlers (NULL, NULL);=0D + } else {=0D + Status =3D gBS->CreateEvent (=0D + EVT_NOTIFY_SIGNAL,=0D + TPL_NOTIFY,=0D + RegisterBeepBootTimeHandlers,=0D + NULL,=0D + &RegisterStatusCodeHandlerEvent=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + //=0D + // Register for protocol notifications on this event=0D + //=0D + Status =3D gBS->RegisterProtocolNotify (=0D + &gEfiRscHandlerProtocolGuid,=0D + RegisterStatusCodeHandlerEvent,=0D + &Registration=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatu= sCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf b/Features/Intel/Deb= ugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepS= tatusCodeHandlerLib.inf new file mode 100644 index 0000000000..f612a6d367 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHa= ndlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf @@ -0,0 +1,57 @@ +## @file=0D +# Beep status code implementation.=0D +#=0D +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +# vendor. This file may not be modified, except as allowed by=0D +# additional terms of your license agreement.=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D RuntimeDxeBeepStatusCodeHandlerLib=0D + FILE_GUID =3D D05F43CE-7C70-4663-848F-8265C311A8A5= =0D + MODULE_TYPE =3D DXE_RUNTIME_DRIVER=0D + VERSION_STRING =3D 1.0=0D + CONSTRUCTOR =3D RuntimeDxeBeepStatusCodeHandlerLibCon= structor=0D + LIBRARY_CLASS =3D StatusCodeHandlerLib|DXE_RUNTIME_DRIV= ER=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC (EBC is only for bui= ld)=0D +#=0D +=0D +[Sources]=0D + RuntimeDxeBeepStatusCodeHandlerLib.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + DebugLib=0D + UefiBootServicesTableLib=0D + BaseMemoryLib=0D + PcdLib=0D + DevicePathLib=0D + UefiRuntimeLib=0D + ReportStatusCodeLib=0D + BeepMapLib=0D + BeepLib=0D +=0D +[Guids]=0D + gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## G= UID=0D +=0D +[Pcd]=0D + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep ##= CONSUMES=0D +=0D +[Protocols]=0D + gEfiRscHandlerProtocolGuid ## CONSUMES=0D +=0D +[Depex]=0D + TRUE=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatu= sCodeHandlerLib/SmmBeepStatusCodeHandlerLib.c b/Features/Intel/Debugging/Be= epDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandler= Lib.c new file mode 100644 index 0000000000..65f17dc7d4 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHa= ndlerLib/SmmBeepStatusCodeHandlerLib.c @@ -0,0 +1,138 @@ +/** @file=0D + Beep status code implementation.=0D +=0D + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +#include =0D +=0D +EFI_SMM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL;=0D +=0D +=0D +/**=0D + Convert status code value to the times of beep.=0D +=0D + @param CodeType Indicates the type of status code being reporte= d.=0D + @param Value Describes the current status of a hardware or=0D + software entity. This includes information abou= t the class and=0D + subclass that is used to classify the entity as= well as an operation.=0D + For progress codes, the operation is the curren= t activity.=0D + For error codes, it is the exception.For debug = codes,it is not defined at this time.=0D + @param Instance The enumeration of a hardware or software entit= y within=0D + the system. A system may contain multiple entit= ies that match a class/subclass=0D + pairing. The instance differentiates between th= em. An instance of 0 indicates=0D + that instance information is unavailable, not m= eaningful, or not relevant.=0D + Valid instance numbers start with 1.=0D + @param CallerId This optional parameter may be used to identify= the caller.=0D + This parameter allows the status code driver to= apply different rules to=0D + different callers.=0D + @param Data This optional parameter may be used to pass add= itional data.=0D +=0D + @retval EFI_SUCCESS Status code reported to beep successfully.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +BeepStatusCodeReportWorker (=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value,=0D + IN UINT32 Instance,=0D + IN EFI_GUID *CallerId,=0D + IN EFI_STATUS_CODE_DATA *Data OPTIONAL=0D + )=0D +{=0D + UINT32 BeepValue;=0D +=0D + BeepValue =3D GetBeepValueFromStatusCode (CodeType, Value);=0D + if (BeepValue !=3D 0) {=0D + Beep (BeepValue);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Register status code callback function only when Report Status Code prot= ocol=0D + is installed.=0D +=0D + @param Protocol Points to the protocol's unique identifier.=0D + @param Interface Points to the interface instance.=0D + @param Handle The handle on which the interface was installed.=0D +=0D + @retval EFI_SUCCESS Notification runs successfully.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RegisterBeepBootTimeHandlers (=0D + IN CONST EFI_GUID *Protocol,=0D + IN VOID *Interface,=0D + IN EFI_HANDLE Handle=0D +)=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D gSmst->SmmLocateProtocol (=0D + &gEfiSmmRscHandlerProtocolGuid,=0D + NULL,=0D + (VOID **) &mRscHandlerProtocol=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + if (PcdGetBool (PcdStatusCodeUseBeep)) {=0D + mRscHandlerProtocol->Register (BeepStatusCodeReportWorker);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Constructor function of SmmBeepStatusCodeHandlerLib.=0D +=0D + This function allocates memory for extended status code data, caches=0D + the report status code service, and registers events.=0D +=0D + @param ImageHandle The firmware allocated handle for the EFI image.=0D + @param SystemTable A pointer to the EFI System Table.=0D +=0D + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +SmmBeepStatusCodeHandlerLibConstructor (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + EFI_STATUS Status;=0D + VOID *Registration;=0D +=0D + Status =3D gSmst->SmmLocateProtocol (=0D + &gEfiSmmRscHandlerProtocolGuid,=0D + NULL,=0D + (VOID **) &mRscHandlerProtocol=0D + );=0D + if (!EFI_ERROR (Status)) {=0D + RegisterBeepBootTimeHandlers (NULL, NULL, NULL);=0D + } else {=0D + gSmst->SmmRegisterProtocolNotify (=0D + &gEfiSmmRscHandlerProtocolGuid,=0D + RegisterBeepBootTimeHandlers,=0D + &Registration=0D + );=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatu= sCodeHandlerLib/SmmBeepStatusCodeHandlerLib.inf b/Features/Intel/Debugging/= BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/SmmBeepStatusCodeHandl= erLib.inf new file mode 100644 index 0000000000..1a01794e11 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Library/BeepStatusCodeHa= ndlerLib/SmmBeepStatusCodeHandlerLib.inf @@ -0,0 +1,55 @@ +## @file=0D +# Beep status code implementation.=0D +#=0D +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +# vendor. This file may not be modified, except as allowed by=0D +# additional terms of your license agreement.=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D SmmBeepStatusCodeHandlerLib=0D + FILE_GUID =3D 2E2BC2D4-572D-4663-9A1E-FB52FA30922A= =0D + MODULE_TYPE =3D DXE_SMM_DRIVER=0D + VERSION_STRING =3D 1.0=0D + CONSTRUCTOR =3D SmmBeepStatusCodeHandlerLibConstructo= r=0D + LIBRARY_CLASS =3D StatusCodeHandlerLib|DXE_SMM_DRIVER=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC (EBC is only for bui= ld)=0D +#=0D +=0D +[Sources]=0D + SmmBeepStatusCodeHandlerLib.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + BeepDebugFeaturePkg/BeepDebugFeaturePkg.dec=0D +=0D +[LibraryClasses]=0D + PcdLib=0D + BaseMemoryLib=0D + SmmServicesTableLib=0D + DebugLib=0D + MemoryAllocationLib=0D + ReportStatusCodeLib=0D + BeepMapLib=0D + BeepLib=0D +=0D +[Guids]=0D + gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## G= UID=0D +=0D +[Pcd]=0D + gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep ##= CONSUMES=0D +=0D +[Protocols]=0D + gEfiSmmRscHandlerProtocolGuid ## CONSUMES=0D +=0D +[Depex]=0D + TRUE=0D diff --git a/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md b/Featu= res/Intel/Debugging/BeepDebugFeaturePkg/Readme.md new file mode 100644 index 0000000000..12ae2c1582 --- /dev/null +++ b/Features/Intel/Debugging/BeepDebugFeaturePkg/Readme.md @@ -0,0 +1,126 @@ +# Overview=0D +* **Feature Name:** Beep Debug=0D +* **PI Phase(s) Supported:** PEI, DXE, SMM=0D +* **SMM Required?** Yes=0D +=0D +More Information:=0D +=0D +## Purpose=0D +The BeepDebugFeaturePkg include some useful beep debug libraries, such as = get beep value from status code and beep.=0D +This is an important capability in firmware development to get and analyze= the early error when there is not serial port.=0D +=0D +=0D +# High-Level Theory of Operation=0D +It provide a library BeepStatusCodeHandlerLib used by edk2 StatusCodeHandl= er.efi, used to do beep if needed.=0D +It also provide a library of BeepMap lib, it map the status code to beep v= alue.=0D +A library of Beep lib is needed by platform, and this pkg has a Null imple= mentation.=0D +=0D +In the library contstructor function, BeepStatusCodeHandlerLib register th= e call back function for ReportStatusCode.=0D +When called, it call GetBeepFromStatusCode() in BeepMapLib to get beep val= ue from status code, and call Beep() in BeepLib to beep.=0D +=0D +BeepStatusCodeHandlerLib include 3 libraries for PEI, RuntimeDxe, SMM:=0D +* PeiBeepStatusCodeHandlerLib=0D +* RuntimeDxeBeepStatusCodeHandlerLib=0D +* SmmBeepStatusCodeHandlerLib=0D +=0D +## Firmware Volumes=0D +Linked with StatusCodeHandler.efi, and make sure put the StatusCodeHandler= .efi after the ReportStatusCodeRouter.efi.=0D +=0D +## Modules=0D +* BeepStatusCodeHandlerLib=0D +* BeepMapLib=0D +* BeepLibNull=0D +=0D +## BeepStatusCodeHandlerLib=0D +This library register the call back function for ReportStatusCode, and get= =0D +beep valude from status code, and do beep.=0D +=0D +## BeepMapLib=0D +This library provide a function to get beep value from status code.=0D +=0D +## Key Functions=0D +* In PeiBeepStatusCodeHandlerLib:=0D + EFI_STATUS=0D + EFIAPI=0D + BeepStatusCodeReportWorker (=0D + IN CONST EFI_PEI_SERVICES **PeiServices,=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value,=0D + IN UINT32 Instance,=0D + IN CONST EFI_GUID *CallerId,=0D + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL=0D + )=0D +=0D +* In RuntimeDxeBeepStatusCodeHandlerLib:=0D + EFI_STATUS=0D + EFIAPI=0D + BeepStatusCodeReportWorker (=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value,=0D + IN UINT32 Instance,=0D + IN EFI_GUID *CallerId,=0D + IN EFI_STATUS_CODE_DATA *Data OPTIONAL=0D + )=0D +=0D +* In SmmBeepStatusCodeHandlerLib:=0D + EFI_STATUS=0D + EFIAPI=0D + BeepStatusCodeReportWorker (=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value,=0D + IN UINT32 Instance,=0D + IN EFI_GUID *CallerId,=0D + IN EFI_STATUS_CODE_DATA *Data OPTIONAL=0D + )=0D +=0D +* In BeepMapLib:=0D + UINT32=0D + EFIAPI=0D + GetBeepValueFromStatusCode (=0D + IN EFI_STATUS_CODE_TYPE CodeType,=0D + IN EFI_STATUS_CODE_VALUE Value=0D + )=0D +=0D +* In BeepLib:=0D + VOID=0D + EFIAPI=0D + Beep (=0D + IN UINT32 Value=0D + )=0D +=0D +## Configuration=0D +* Link the library to StatusCodeHandler.efi.=0D + Example:=0D + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerR= untimeDxe.inf {=0D + =0D + BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepS= tatusCodeHandlerLib.inf=0D + }=0D + Refer to BeepDebugFeaturePkg.dsc for other example.=0D +* Config pcd gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep=0D + In platform .dsc file, need to config the type of gBeepDebugFeaturePkgTo= kenSpaceGuid.PcdStatusCodeUseBeep.=0D + Use PcdsFixedAtBuild to save binary size, and use PcdsDynamic if want to= enable/disable in runtime.=0D +* Implemented platform's special BeepMapLib if needed.=0D +* Provide the platform's special BeepLib.=0D +* Make sure put the StatusCodeHandler.efi after the ReportStatusCodeRouter= .efi.=0D +=0D +## Data Flows=0D +Status Code (ReportStatusCode) -> Beep Value (GetBeepValueFromStatusCode).= =0D +=0D +## Control Flows=0D +ReportStatusCode() -> BeepStatusCodeReportWorker() -> GetBeepValueFromStat= usCode() -> Beep()=0D +=0D +## Build Flows=0D +There is not special build flows.=0D +=0D +## Test Point Results=0D +Verify the post code shown is correct.=0D +=0D +## Functional Exit Criteria=0D +N/A=0D +=0D +## Feature Enabling Checklist=0D +* Set the PCD gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep to T= RUE.=0D +* Plug out all the memory, check can here the beep.=0D +=0D +## Common Optimizations=0D +* Implemented platform's special BeepMapLib if needed.=0D --=20 2.24.0.windows.2