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 <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Michael D Kinney 2017-09-01 00:31:03 -07:00 committed by Ruiyu Ni
parent dacf87e885
commit 7072a185d0
1 changed files with 19 additions and 7 deletions

View File

@ -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,