From 152e8d7670d5e6d2f9e5ca936eaf1568a7a53c4d Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Thu, 12 Oct 2017 16:31:58 +0800 Subject: [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 Cc: Jiewen Yao Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong Tested-by: Laszlo Ersek Reviewed-by: Laszlo Ersek --- .../Universal/Acpi/S3Resume2Pei/S3Resume.c | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c index c2171cbd46..e0c2d366cd 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; } @@ -587,8 +585,7 @@ S3ResumeBootOs ( // // Signal EndOfS3Resume event. // - Status = SignalEndOfS3Resume (); - ASSERT_EFI_ERROR (Status); + SignalEndOfS3Resume (); // // report status code on S3 resume