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>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Eric Dong 2017-10-12 16:31:58 +08:00
parent d76c2da8d5
commit 152e8d7670
1 changed files with 10 additions and 13 deletions

View File

@ -465,7 +465,7 @@ SignalEndOfS3Resume (
SMM_COMMUNICATE_HEADER_64 Header64; SMM_COMMUNICATE_HEADER_64 Header64;
VOID *CommBuffer; 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. // This buffer consumed in DXE phase, so base on DXE mode to prepare communicate buffer.
@ -484,29 +484,27 @@ SignalEndOfS3Resume (
} }
CopyGuid (CommBuffer, &gEdkiiSmmEndOfS3ResumeProtocolGuid); CopyGuid (CommBuffer, &gEdkiiSmmEndOfS3ResumeProtocolGuid);
//
// Get needed resource
//
Status = PeiServicesLocatePpi ( Status = PeiServicesLocatePpi (
&gEfiPeiSmmCommunicationPpiGuid, &gEfiPeiSmmCommunicationPpiGuid,
0, 0,
NULL, NULL,
(VOID **)&SmmCommunicationPpi (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 ( Status = SmmCommunicationPpi->Communicate (
SmmCommunicationPpi, SmmCommunicationPpi,
(VOID *)CommBuffer, (VOID *)CommBuffer,
&CommSize &CommSize
); );
ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "SmmCommunicationPpi->Communicate return failure (%r)!\n", Status));
DEBUG ((EFI_D_INFO, "SignalEndOfS3Resume - Exit (%r)\n", Status)); }
DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Exit (%r)\n", Status));
return Status; return Status;
} }
@ -587,8 +585,7 @@ S3ResumeBootOs (
// //
// Signal EndOfS3Resume event. // Signal EndOfS3Resume event.
// //
Status = SignalEndOfS3Resume (); SignalEndOfS3Resume ();
ASSERT_EFI_ERROR (Status);
// //
// report status code on S3 resume // report status code on S3 resume