[edk2] [Patch] UefiCpuPkg/S3Resume2Pei: Handle Communicate Ppi not exist issue.

Eric Dong posted 1 patch 7 years, 2 months ago
Failed in applying to current master (apply log)
UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
[edk2] [Patch] UefiCpuPkg/S3Resume2Pei: Handle Communicate Ppi not exist issue.
Posted by Eric Dong 7 years, 2 months ago
Current code assume Communicate Ppi always existed, so it adds
ASSERT to confirm it. Ovmf platform happened not has this Ppi, so
the ASSERT been trig. This patch handle Ppi not existed case.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
index c2171cb..975bb6f 100644
--- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
+++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
@@ -465,7 +465,7 @@ SignalEndOfS3Resume (
   SMM_COMMUNICATE_HEADER_64          Header64;
   VOID                               *CommBuffer;
 
-  DEBUG ((EFI_D_INFO, "SignalEndOfS3Resume - Enter\n"));
+  DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Enter\n"));
 
   //
   // This buffer consumed in DXE phase, so base on DXE mode to prepare communicate buffer.
@@ -484,29 +484,27 @@ SignalEndOfS3Resume (
   }
   CopyGuid (CommBuffer, &gEdkiiSmmEndOfS3ResumeProtocolGuid);
 
-  //
-  // Get needed resource
-  //
   Status = PeiServicesLocatePpi (
              &gEfiPeiSmmCommunicationPpiGuid,
              0,
              NULL,
              (VOID **)&SmmCommunicationPpi
              );
-  ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Locate Smm Communicate Ppi failed (%r)!\n", Status));
+    return Status;
+  }
 
-  //
-  // Send command
-  //
   Status = SmmCommunicationPpi->Communicate (
                                   SmmCommunicationPpi,
                                   (VOID *)CommBuffer,
                                   &CommSize
                                   );
-  ASSERT_EFI_ERROR (Status);
-
-  DEBUG ((EFI_D_INFO, "SignalEndOfS3Resume - Exit (%r)\n", Status));
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "SmmCommunicationPpi->Communicate return failure (%r)!\n", Status));
+  }
 
+  DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Exit (%r)\n", Status));
   return Status;
 }
 
-- 
2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] UefiCpuPkg/S3Resume2Pei: Handle Communicate Ppi not exist issue.
Posted by Dong, Eric 7 years, 2 months ago
Hi all,

please ignore this patch, please this is not a full fix. Will send a new one soon.

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Eric Dong
Sent: Thursday, October 12, 2017 4:33 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: [edk2] [Patch] UefiCpuPkg/S3Resume2Pei: Handle Communicate Ppi not exist issue.

Current code assume Communicate Ppi always existed, so it adds ASSERT to confirm it. Ovmf platform happened not has this Ppi, so the ASSERT been trig. This patch handle Ppi not existed case.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
index c2171cb..975bb6f 100644
--- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
+++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
@@ -465,7 +465,7 @@ SignalEndOfS3Resume (
   SMM_COMMUNICATE_HEADER_64          Header64;
   VOID                               *CommBuffer;
 
-  DEBUG ((EFI_D_INFO, "SignalEndOfS3Resume - Enter\n"));
+  DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Enter\n"));
 
   //
   // This buffer consumed in DXE phase, so base on DXE mode to prepare communicate buffer.
@@ -484,29 +484,27 @@ SignalEndOfS3Resume (
   }
   CopyGuid (CommBuffer, &gEdkiiSmmEndOfS3ResumeProtocolGuid);
 
-  //
-  // Get needed resource
-  //
   Status = PeiServicesLocatePpi (
              &gEfiPeiSmmCommunicationPpiGuid,
              0,
              NULL,
              (VOID **)&SmmCommunicationPpi
              );
-  ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Locate Smm Communicate Ppi failed (%r)!\n", Status));
+    return Status;
+  }
 
-  //
-  // Send command
-  //
   Status = SmmCommunicationPpi->Communicate (
                                   SmmCommunicationPpi,
                                   (VOID *)CommBuffer,
                                   &CommSize
                                   );
-  ASSERT_EFI_ERROR (Status);
-
-  DEBUG ((EFI_D_INFO, "SignalEndOfS3Resume - Exit (%r)\n", Status));
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "SmmCommunicationPpi->Communicate return 
+ failure (%r)!\n", Status));  }
 
+  DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Exit (%r)\n", Status));
   return Status;
 }
 
--
2.7.0.windows.1

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