PEI 阶段用法
是PeiServices中的一个组成。
code: Edk2\MdeModulePkg\Universal\ReportStatusCodeRouter\Pei\ReportStatusCodeRouterPei.c
整体逻辑:
- 调用ReportStatusCode
- 挂在gEfiPeiRscHandlerPpiGuid上的handler都会跑一便
- 执行对应的callback
gEfiPeiRscHandlerPpiGuid 用于注册和卸载handler
gEfiPeiStatusCodePpiGuid 用于当有人调用ReportStatusCode的时候,搜寻并执行gEfiPeiRscHandlerPpiGuid 注册的所有handler
Ppi
EFI_PEI_RSC_HANDLER_PPI mRscHandlerPpi = {
Register,
Unregister
};
EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {
ReportDispatcher
};
EFI_PEI_PPI_DESCRIPTOR mRscHandlerPpiList[] = {
{
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gEfiPeiRscHandlerPpiGuid,
&mRscHandlerPpi
}
};
EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiList[] = {
{
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gEfiPeiStatusCodePpiGuid,
&mStatusCodePpi
}
};
Runtime,DXE阶段
Protocol
EFI_STATUS_CODE_PROTOCOL mStatusCodeProtocol = {
ReportDispatcher
};
EFI_RSC_HANDLER_PROTOCOL mRscHandlerProtocol = {
Register,
Unregister
};
SMM 阶段
Protocol
EFI_MM_STATUS_CODE_PROTOCOL mSmmStatusCodeProtocol = {
ReportDispatcher
};
EFI_MM_RSC_HANDLER_PROTOCOL mSmmRscHandlerProtocol = {
Register,
Unregister
};