From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 2AD8D1A1E72 for ; Fri, 21 Oct 2016 00:23:49 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 21 Oct 2016 00:23:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,375,1473145200"; d="scan'208";a="21985547" Received: from sprasa6-mobl.gar.corp.intel.com ([10.223.177.131]) by fmsmga006.fm.intel.com with ESMTP; 21 Oct 2016 00:23:47 -0700 From: Satya Yarlagadda To: edk2-devel@lists.01.org Cc: Maurice Ma , Jiewen Yao , Giri P Mudusuru Date: Fri, 21 Oct 2016 12:53:41 +0530 Message-Id: <20161021072341.2188-1-satya.p.yarlagadda@intel.com> X-Mailer: git-send-email 2.10.0.windows.1 Subject: [PATCH] IntelFsp2Pkg: Changes to return FSP API error return status X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 07:23:49 -0000 Changed the FSPMemoryInitDone, FspSiliconInitDone and FspTempRamInitDone functions to return FSP API error status instead of always returning success. Cc: Maurice Ma Cc: Jiewen Yao Cc: Giri P Mudusuru Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Satya Yarlagadda --- IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c | 2 +- IntelFsp2Pkg/Include/Library/FspPlatformLib.h | 12 +-- .../Library/BaseFspPlatformLib/FspPlatformNotify.c | 108 ++++++++++++++++----- 3 files changed, 93 insertions(+), 29 deletions(-) diff --git a/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c b/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c index 6acdeb3..113b819 100644 --- a/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c +++ b/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c @@ -81,7 +81,7 @@ WaitForNotify ( // Give control back to BootLoader after FspSiliconInit // DEBUG ((DEBUG_INFO | DEBUG_INIT, "FSP is waiting for NOTIFY\n")); - FspSiliconInitDone (); + FspSiliconInitDone (EFI_SUCCESS); // // BootLoader called FSP again through NotifyPhase diff --git a/IntelFsp2Pkg/Include/Library/FspPlatformLib.h b/IntelFsp2Pkg/Include/Library/FspPlatformLib.h index 61e77bd..90222a2 100644 --- a/IntelFsp2Pkg/Include/Library/FspPlatformLib.h +++ b/IntelFsp2Pkg/Include/Library/FspPlatformLib.h @@ -51,33 +51,33 @@ FspSetNewStackFrame ( /** This function transfer control back to BootLoader after FspSiliconInit. - + @param[in] Status return status for the FspSiliconInit. **/ VOID EFIAPI FspSiliconInitDone ( - VOID + IN EFI_STATUS Status ); /** This function returns control to BootLoader after MemoryInitApi. - @param[in,out] HobListPtr The address of HobList pointer. + @param[in] Status return status for the MemoryInitApi. **/ VOID EFIAPI FspMemoryInitDone ( - IN OUT VOID **HobListPtr + IN EFI_STATUS Status ); /** This function returns control to BootLoader after TempRamExitApi. - + @param[in] Status return status for the TempRamExitApi. **/ VOID EFIAPI FspTempRamExitDone ( - VOID + IN EFI_STATUS Status ); /** diff --git a/IntelFsp2Pkg/Library/BaseFspPlatformLib/FspPlatformNotify.c b/IntelFsp2Pkg/Library/BaseFspPlatformLib/FspPlatformNotify.c index 66b6cdb..f1ff52e 100644 --- a/IntelFsp2Pkg/Library/BaseFspPlatformLib/FspPlatformNotify.c +++ b/IntelFsp2Pkg/Library/BaseFspPlatformLib/FspPlatformNotify.c @@ -108,58 +108,99 @@ FspNotificationHandler ( /** This function transfer control back to BootLoader after FspSiliconInit. + @param[in] Status return status for the FspSiliconInit. + **/ VOID EFIAPI FspSiliconInitDone ( - VOID + IN EFI_STATUS Status ) { // + // Convert to FSP EAS defined API return codes + // + switch (Status) { + case EFI_SUCCESS: + case EFI_INVALID_PARAMETER: + case EFI_UNSUPPORTED: + case EFI_DEVICE_ERROR: + break; + default: + DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspSiliconInitApi() Invalid Error - [Status: 0x%08X]\n", Status)); + Status = EFI_DEVICE_ERROR; // Force to known error. + break; + } + // // This is the end of the FspSiliconInit API // Give control back to the boot loader // SetFspMeasurePoint (FSP_PERF_ID_API_FSP_SILICON_INIT_EXIT); - DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspSiliconInitApi() - End\n")); + DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspSiliconInitApi() - [Status: 0x%08X] - End\n", Status)); PERF_END_EX (&gFspPerformanceDataGuid, "EventRec", NULL, 0, 0x907F); REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT); - SetFspApiReturnStatus (EFI_SUCCESS); - - Pei2LoaderSwitchStack(); - - PERF_START_EX (&gFspPerformanceDataGuid, "EventRec", NULL, 0, 0x6000); + do { + SetFspApiReturnStatus (Status); + Pei2LoaderSwitchStack (); + if (Status != EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "!!!ERROR: FspSiliconInitApi() - [Status: 0x%08X] - Error encountered during previous API and cannot proceed further\n", Status)); + } + } while (Status != EFI_SUCCESS); } /** This function returns control to BootLoader after MemoryInitApi. - @param[in,out] HobListPtr The address of HobList pointer. + @param[in] Status return status for the MemoryInitApi. + **/ VOID EFIAPI FspMemoryInitDone ( - IN OUT VOID **HobListPtr + IN EFI_STATUS Status ) { + VOID **HobListPtr; + // // Calling use FspMemoryInit API // Update HOB and return the control directly // + HobListPtr = (VOID **)GetFspApiParameter2 (); if (HobListPtr != NULL) { *HobListPtr = (VOID *) GetHobList (); } - + // + // Convert to FSP EAS defined API return codes + // + switch (Status) { + case EFI_SUCCESS: + case EFI_INVALID_PARAMETER: + case EFI_UNSUPPORTED: + case EFI_DEVICE_ERROR: + case EFI_OUT_OF_RESOURCES: + break; + default: + DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspMemoryInitApi() Invalid Error [Status: 0x%08X]\n", Status)); + Status = EFI_DEVICE_ERROR; // Force to known error. + break; + } // // This is the end of the FspMemoryInit API // Give control back to the boot loader // SetFspMeasurePoint (FSP_PERF_ID_API_FSP_MEMORY_INIT_EXIT); - DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspMemoryInitApi() - End\n")); + DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspMemoryInitApi() - [Status: 0x%08X] - End\n", Status)); REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT); - SetFspApiReturnStatus (EFI_SUCCESS); - Pei2LoaderSwitchStack (); + do { + SetFspApiReturnStatus (Status); + Pei2LoaderSwitchStack (); + if (Status != EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "!!!ERROR: FspMemoryInitApi() - [Status: 0x%08X] - Error encountered during previous API and cannot proceed further\n", Status)); + } + } while (Status != EFI_SUCCESS); // // The TempRamExitApi is called @@ -180,24 +221,43 @@ FspMemoryInitDone ( /** This function returns control to BootLoader after TempRamExitApi. + @param[in] Status return status for the TempRamExitApi. + **/ VOID EFIAPI FspTempRamExitDone ( - VOID + IN EFI_STATUS Status ) { - + // + // Convert to FSP EAS defined API return codes + // + switch (Status) { + case EFI_SUCCESS: + case EFI_INVALID_PARAMETER: + case EFI_UNSUPPORTED: + case EFI_DEVICE_ERROR: + break; + default: + DEBUG ((DEBUG_INFO | DEBUG_INIT, "TempRamExitApi() Invalid Error - [Status: 0x%08X]\n", Status)); + Status = EFI_DEVICE_ERROR; // Force to known error. + break; + } // // This is the end of the TempRamExit API // Give control back to the boot loader // SetFspMeasurePoint (FSP_PERF_ID_API_TEMP_RAM_EXIT_EXIT); - DEBUG ((DEBUG_INFO | DEBUG_INIT, "TempRamExitApi() - End\n")); + DEBUG ((DEBUG_INFO | DEBUG_INIT, "TempRamExitApi() - [Status: 0x%08X] - End\n", Status)); REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_TEMP_RAM_EXIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT); - SetFspApiReturnStatus (EFI_SUCCESS); - Pei2LoaderSwitchStack (); - + do { + SetFspApiReturnStatus (Status); + Pei2LoaderSwitchStack (); + if (Status != EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "!!!ERROR: TempRamExitApi() - [Status: 0x%08X] - Error encountered during previous API and cannot proceed further\n", Status)); + } + } while (Status != EFI_SUCCESS); SetPhaseStatusCode (FSP_STATUS_CODE_SILICON_INIT); SetFspMeasurePoint (FSP_PERF_ID_API_FSP_SILICON_INIT_ENTRY); DEBUG ((DEBUG_INFO | DEBUG_INIT, "SiliconInitApi() - Begin\n")); @@ -256,9 +316,7 @@ FspWaitForNotify ( } } - SetFspApiReturnStatus(Status); DEBUG ((DEBUG_INFO | DEBUG_INIT, "NotifyPhaseApi() - End [Status: 0x%08X]\n", Status)); - SetFspMeasurePoint (FSP_PERF_ID_API_NOTIFY_POST_PCI_EXIT + Count); if ((NotificationCount - 1) == 0) { @@ -268,7 +326,13 @@ FspWaitForNotify ( } else if ((NotificationCount - 1) == 2) { REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT); } - Pei2LoaderSwitchStack(); + do { + SetFspApiReturnStatus(Status); + Pei2LoaderSwitchStack(); + if (Status != EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "!!!ERROR: NotifyPhaseApi() [Phase: %08X] - Failed - [Status: 0x%08X]\n", NotificationValue, Status)); + } + } while (Status != EFI_SUCCESS); } // -- 2.10.0.windows.1