From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 16A8920945BA6 for ; Thu, 12 Oct 2017 01:29:56 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2017 01:33:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,365,1503385200"; d="scan'208";a="159651268" Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.57]) by orsmga005.jf.intel.com with ESMTP; 12 Oct 2017 01:33:25 -0700 From: Eric Dong To: edk2-devel@lists.01.org Cc: Ruiyu Ni , Jiewen Yao , Laszlo Ersek Date: Thu, 12 Oct 2017 16:33:20 +0800 Message-Id: <1507797200-7652-1-git-send-email-eric.dong@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [Patch] UefiCpuPkg/S3Resume2Pei: Handle Communicate Ppi not exist issue. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Oct 2017 08:29:57 -0000 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 --- 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