You've already forked edk2-platforms
mirror of
https://github.com/Dasharo/edk2-platforms.git
synced 2026-03-06 14:51:43 -08:00
The BeepDebugFeaturePkg was malformed and did not build anything and thus wasn't testable in standalone build. Added gBeepDebugFeaturePkgTokenSpaceGuid.PcdBeepDebugFeatureEnable to properly control the advanced feature inclusion. Use the standard MinPlatform includes for core libraries. This increases the build time, but reduces complexity when integrating into a board build. Board build optimization is more valuable than standalone build optimization. Enable standalone build to test the library build and the component builds using edk2 StatusCodeHandler drivers. Add unique file names for the StatusCodeHandler components to avoid collisions with any existing board handlers when incorporated in board DSC and FDF files. Add PreMemory.fdf and PostMemory.fdf content for including in board FDF or AdvancedFeaturePkg in the future. Removed unused sections in DSC and FDF to reduce file clutter. Removed stale file header content from prior proprietary licensing. Moved feature customization and common include into the package DSC file to reduce board complexity when BeepDebugFeature.dsc is included. Removed the FixedAtBuild build control for beep feature as it would be redundant with the FeatureFlag control of the whole feature. Build control is via PcdBeepDebugFeatureEnable and dynamic control is via PcdStatusCodeUseBeep. Improved Readme content, format, and coding style use. Cc: Sai Chaganty <rangasai.v.chaganty@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Eric Dong <eric.dong@intel.com> Cc: Ming Tan <ming.tan@intel.com> Signed-off-by: Isaac Oram <isaac.w.oram@intel.com> Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
155 lines
5.6 KiB
Markdown
155 lines
5.6 KiB
Markdown
# Overview
|
|
* **Feature Name:** Beep Debug
|
|
* **PI Phase(s) Supported:** PEI, DXE, SMM
|
|
* **SMM Required?** Yes
|
|
|
|
More Information:
|
|
|
|
## Purpose
|
|
Very often it is necessary to debug very close to the reset vector or in production systems that lack serial ports, seven segment displays, or useful LED that are typically used to output useful debug messages.
|
|
|
|
The BeepDebugFeaturePkg includes some useful beep focused debug libraries.
|
|
|
|
This isn't intended for production use.
|
|
|
|
There is not currently seamless integration into the SecCore component that handles the reset vector. In order to debug that early, it will be necessary to use the BeepLib directly in SEC code.
|
|
|
|
# High-Level Theory of Operation
|
|
It provides a library, BeepStatusCodeHandlerLib, used by edk2 StatusCodeHandler.efi, used to do beep if needed.
|
|
It also provide a library of BeepMap lib which maps the status code to a beep value.
|
|
A library of Beep lib is needed by platform, and this pkg has a Null implementation.
|
|
|
|
In the library contstructor function, BeepStatusCodeHandlerLib registers the call back function for ReportStatusCode. When called, it calls GetBeepFromStatusCode (); in BeepMapLib to get beep value from status code, and calls Beep () in BeepLib to beep a speaker.
|
|
|
|
BeepStatusCodeHandlerLib includes three libraries for PEI, RuntimeDxe, and SMM:
|
|
* PeiBeepStatusCodeHandlerLib
|
|
* RuntimeDxeBeepStatusCodeHandlerLib
|
|
* SmmBeepStatusCodeHandlerLib
|
|
|
|
## Firmware Volumes
|
|
These libraries need to be linked into StatusCodeHandler components.
|
|
Make sure one puts the StatusCodeHandler.efi after the ReportStatusCodeRouter.efi.
|
|
|
|
## Modules
|
|
* BeepStatusCodeHandlerLib
|
|
* BeepMapLib
|
|
* BeepLibNull
|
|
|
|
## BeepStatusCodeHandlerLib
|
|
This library registers the callback function for ReportStatusCode, gets beep value from status code, and does the beep.
|
|
|
|
## BeepMapLib
|
|
This library provides a function to get a beep value for a status code.
|
|
|
|
## BeepLibNull
|
|
This library provide a function to perform the beep.
|
|
|
|
## 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
|
|
* Configure PCD gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep.
|
|
In board DSC file, the board developer needs to configure the type of gBeepDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUseBeep control desired.
|
|
[PcdsFixedAtBuild] is the feature default value as this has lowest size.
|
|
[PcdsDynamicExDefault] is the most common configuration as it provides dynamic control during debugging.
|
|
* Implemented board specific BeepMapLib if custom status code to beep code mapping as needed.
|
|
* Provide the board specific BeepLib to perform beeps on the board specific hardware.
|
|
```The default library does not cause any hardware to beep```
|
|
|
|
## Data Flows
|
|
Status Code (ReportStatusCode) -> Beep Value (GetBeepValueFromStatusCode).
|
|
|
|
## Control Flows
|
|
ReportStatusCode () -> BeepStatusCodeReportWorker () -> GetBeepValueFromStatusCode () -> Beep ()
|
|
|
|
## Build Flows
|
|
Standalone build
|
|
* build -a IA32 -a X64 -p Debugging\BeepDebugFeaturePkg\BeepDebugFeaturePkg.dsc
|
|
|
|
AdvanceFeaturePkg build
|
|
* build -a IA32 -a X64 -p AdvancedFeaturePkg/AdvancedFeaturePkg.dsc
|
|
## Test Point Results
|
|
None
|
|
|
|
## Functional Exit Criteria
|
|
N/A
|
|
|
|
## Feature Enabling Checklist
|
|
* Verify in board DSC file that gBeepDebugFeaturePkgTokenSpaceGuid.PcdBeepDebugFeatureEnable set to TRUE
|
|
* Verify board specific BeepLib implemented and included in board DSC file.
|
|
* Verify that the board has a PlatformHookLib instance. There is a null library implementation if needed
|
|
```
|
|
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
|
|
```
|
|
* Verify that your board has the StatusCodeHandler components (PEIM or driver) desired.
|
|
```
|
|
Example:
|
|
MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf {
|
|
<LibraryClasses>
|
|
NULL|BeepDebugFeaturePkg/Library/BeepStatusCodeHandlerLib/RuntimeDxeBeepStatusCodeHandlerLib.inf
|
|
}
|
|
There are default StatusCodeHandlers for PEI, RT, and SMM in BeepDebugFeaturePkg/Include in PreMemory.fdf and PostMemory.fdf for use. But most boards will already have these components and you will just want to add the appropriate *StatusCodeHandlerLib.inf to each component.
|
|
```
|
|
* Build
|
|
* Remove all the memory from the system and verify audible beep is heard when attempting to boot.
|
|
|
|
## Common Optimizations
|
|
N/A
|