[edk2] [PATCH 02/10] MdeModulePkg/PeiMain: Always attempt to use Reset2 PPI first

Ruiyu Ni posted 10 patches 6 years, 10 months ago
There is a newer version of this series
[edk2] [PATCH 02/10] MdeModulePkg/PeiMain: Always attempt to use Reset2 PPI first
Posted by Ruiyu Ni 6 years, 10 months ago
From: Michael D Kinney <michael.d.kinney@intel.com>

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>
---
 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,
-- 
2.15.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 02/10] MdeModulePkg/PeiMain: Always attempt to use Reset2 PPI first
Posted by Zeng, Star 6 years, 10 months ago
On 2018/2/2 14:45, Ruiyu Ni wrote:
> From: Michael D Kinney <michael.d.kinney@intel.com>
> 
> 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>

Thanks,
Star
> ---
>   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,
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel