From 7072a185d06d247f53b6f9b874ba0646cfdf0eef Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Fri, 1 Sep 2017 00:31:03 -0700 Subject: [PATCH] MdeModulePkg/PeiMain: Always attempt to use Reset2 PPI first Update PEI Service ResetSystem() to always attempt to use the Reset2 PPI before looking for the Reset PPI. Cc: Liming Gao Reviewed-by: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney Reviewed-by: Star Zeng --- MdeModulePkg/Core/Pei/Reset/Reset.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Core/Pei/Reset/Reset.c b/MdeModulePkg/Core/Pei/Reset/Reset.c index 7440eefd78..cd36c526b5 100644 --- a/MdeModulePkg/Core/Pei/Reset/Reset.c +++ b/MdeModulePkg/Core/Pei/Reset/Reset.c @@ -35,16 +35,21 @@ PeiResetSystem ( EFI_STATUS Status; EFI_PEI_RESET_PPI *ResetPpi; - Status = PeiServicesLocatePpi ( - &gEfiPeiResetPpiGuid, - 0, - NULL, - (VOID **)&ResetPpi - ); + // + // Attempt to use newer ResetSystem2(). If this returns, then ResetSystem2() + // is not available. + // + PeiResetSystem2 (EfiResetCold, EFI_SUCCESS, 0, NULL); // - // LocatePpi returns EFI_NOT_FOUND on error + // Look for PEI Reset System PPI // + Status = PeiServicesLocatePpi ( + &gEfiPeiResetPpiGuid, + 0, + NULL, + (VOID **)&ResetPpi + ); if (!EFI_ERROR (Status)) { return ResetPpi->ResetSystem (PeiServices); } @@ -55,6 +60,10 @@ PeiResetSystem ( EFI_ERROR_CODE | EFI_ERROR_MINOR, (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE) ); + + // + // No reset PPIs are available yet. + // return EFI_NOT_AVAILABLE_YET; } @@ -85,6 +94,9 @@ PeiResetSystem2 ( EFI_STATUS Status; EFI_PEI_RESET2_PPI *Reset2Ppi; + // + // Look for PEI Reset System 2 PPI + // Status = PeiServicesLocatePpi ( &gEfiPeiReset2PpiGuid, 0,