X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelFspPkg%2FLibrary%2FBaseFspPlatformLib%2FFspPlatformNotify.c;h=9005ef25a33b5f3efed144fcdbb274a9dabecf50;hp=ef4406bec5373ce0fbb15436e2455d7b89199e29;hb=16a16ea6e39a92971cd60fdbd642c3c6f2b4be6f;hpb=a81fcd30c1aff139f0007c277c49c52bf55c303c diff --git a/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c b/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c index ef4406bec5..9005ef25a3 100644 --- a/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c +++ b/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c @@ -1,13 +1,7 @@ /** @file - Copyright (c) 2014, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -38,7 +32,7 @@ EFI_PEI_PPI_DESCRIPTOR mPeiReadyToBootPpi = { }; -UINT32 mFspNotfifySequence[] = { +UINT32 mFspNotifySequence[] = { EnumInitPhaseAfterPciEnumeration, EnumInitPhaseReadyToBoot }; @@ -46,23 +40,23 @@ UINT32 mFspNotfifySequence[] = { /** Install FSP notification. - @param[in] NotificatonCode FSP notification code + @param[in] NotificationCode FSP notification code @retval EFI_SUCCESS Notify FSP successfully - @retval EFI_INVALID_PARAMETER NotificatonCode is invalid + @retval EFI_INVALID_PARAMETER NotificationCode is invalid **/ EFI_STATUS EFIAPI FspNotificationHandler ( - IN UINT32 NotificatonCode + IN UINT32 NotificationCode ) { EFI_STATUS Status; Status = EFI_SUCCESS; - switch (NotificatonCode) { + switch (NotificationCode) { case EnumInitPhaseAfterPciEnumeration: // // Do POST PCI initialization if needed @@ -89,7 +83,7 @@ FspNotificationHandler ( /** This function transfer control to the ContinuationFunc passed in by the - bootloader. + BootLoader. **/ VOID @@ -98,32 +92,49 @@ FspInitDone ( VOID ) { - FSP_INIT_PARAMS *FspInitParams; - - FspInitParams = (FSP_INIT_PARAMS *)GetFspApiParameter (); + FSP_INIT_PARAMS *FspInitParams; - // - // Modify the parameters for ContinuationFunc - // - SetFspContinuationFuncParameter(EFI_SUCCESS, 0); - SetFspContinuationFuncParameter((UINT32)GetHobList(), 1); + if (GetFspApiCallingMode() == 0) { + // + // FspInit API is used, so jump into the ContinuationFunc + // + FspInitParams = (FSP_INIT_PARAMS *)GetFspApiParameter (); + + // + // Modify the parameters for ContinuationFunc + // + SetFspContinuationFuncParameter(EFI_SUCCESS, 0); + SetFspContinuationFuncParameter((UINT32)GetHobList(), 1); + + // + // Modify the return address to ContinuationFunc + // + SetFspApiReturnAddress((UINT32)FspInitParams->ContinuationFunc); + + // + // Give control back to the boot loader framework caller after FspInit is done + // It is done throught the continuation function + // + SetFspMeasurePoint (FSP_PERF_ID_API_FSPINIT_EXIT); + } else { + // + // FspMemoryInit API is used, so return directly + // - // - // Modify the return address to ContinuationFunc - // - SetFspApiReturnAddress((UINT32)FspInitParams->ContinuationFunc); + // + // This is the end of the FspSiliconInit API + // Give control back to the boot loader + // + DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspSiliconInitApi() - End\n")); + SetFspApiReturnStatus (EFI_SUCCESS); + } - // - // Give control back to the boot loader framework caller after FspInit is done - // It is done throught the continuation function - // - SetFspMeasurePoint (FSP_PERF_ID_API_FSPINIT_EXIT); Pei2LoaderSwitchStack(); } /** - This function handle NotifyPhase API call from the bootloader. - It gives control back to the bootloader after it is handled. If the + This function handle NotifyPhase API call from the BootLoader. + It gives control back to the BootLoader after it is handled. If the Notification code is a ReadyToBoot event, this function will return and FSP continues the remaining execution until it reaches the DxeIpl. @@ -134,34 +145,36 @@ FspWaitForNotify ( ) { EFI_STATUS Status; - UINT32 NotificatonValue; - UINT32 NotificatonCount; + UINT32 NotificationValue; + UINT32 NotificationCount; UINT8 Count; - NotificatonCount = 0; - while (NotificatonCount < sizeof(mFspNotfifySequence) / sizeof(UINT32)) { + NotificationCount = 0; + while (NotificationCount < sizeof(mFspNotifySequence) / sizeof(UINT32)) { - Count = (UINT8)((NotificatonCount << 1) & 0x07); + Count = (UINT8)((NotificationCount << 1) & 0x07); SetFspMeasurePoint (FSP_PERF_ID_API_NOTIFY_POSTPCI_ENTRY + Count); - NotificatonValue = ((NOTIFY_PHASE_PARAMS *)(UINTN)GetFspApiParameter ())->Phase; - DEBUG ((DEBUG_INFO, "FSP Got Notification. Notification Value : 0x%08X\n", NotificatonValue)); + NotificationValue = ((NOTIFY_PHASE_PARAMS *)(UINTN)GetFspApiParameter ())->Phase; + DEBUG ((DEBUG_INFO, "FSP Got Notification. Notification Value : 0x%08X\n", NotificationValue)); - if (mFspNotfifySequence[NotificatonCount] != NotificatonValue) { + if (mFspNotifySequence[NotificationCount] != NotificationValue) { // // Notify code does not follow the predefined order // + DEBUG ((DEBUG_INFO, "Unsupported FSP Notification Value\n")); SetFspApiReturnStatus(EFI_UNSUPPORTED); } else { // // Process Notification and Give control back to the boot loader framework caller // - Status = FspNotificationHandler (NotificatonValue); + Status = FspNotificationHandler (NotificationValue); + DEBUG ((DEBUG_INFO, "FSP Notification Handler Returns : 0x%08X\n", Status)); SetFspApiReturnStatus(Status); if (!EFI_ERROR(Status)) { - NotificatonCount++; + NotificationCount++; SetFspApiReturnStatus(EFI_SUCCESS); - if (NotificatonValue == EnumInitPhaseReadyToBoot) { + if (NotificationValue == EnumInitPhaseReadyToBoot) { break; } }