From 740a82fb7a180ff38db1b91924d49ef08f91da4c Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Thu, 8 Mar 2018 15:30:07 -0800 Subject: MinPlatformPkg/StallServicePei: Install PEI Stall Service in StallServicePei Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kubacki Reviewed-by: Jiewen Yao --- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 10 ++- .../Services/StallServicePei/StallServicePei.c | 93 ++++++++++++++++++++++ .../Services/StallServicePei/StallServicePei.inf | 41 ++++++++++ 3 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 Platform/Intel/MinPlatformPkg/Services/StallServicePei/StallServicePei.c create mode 100644 Platform/Intel/MinPlatformPkg/Services/StallServicePei/StallServicePei.inf diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc index c97f0e1017..9e151be5ec 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc @@ -42,7 +42,7 @@ # Pcd Section - list of all EDK II PCD Entries defined by this Platform # ################################################################################ - + [PcdsFeatureFlag] # configuration gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly|FALSE @@ -70,7 +70,7 @@ PciSegmentInfoLib|MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.inf PlatformBootManagerLib|MinPlatformPkg/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf AslUpdateLib|MinPlatformPkg/Acpi/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf - + # # Misc # @@ -88,7 +88,7 @@ SiliconPolicyUpdateLib|MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf - + [LibraryClasses.common.SEC] TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/SecTestPointCheckLib.inf @@ -156,7 +156,7 @@ MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf MinPlatformPkg/FspWrapper/Library/DxeFspWrapperPlatformLib/DxeFspWrapperPlatformLib.inf - + MinPlatformPkg/Hsti/HstiIbvPlatformDxe/HstiIbvPlatformDxe.inf MinPlatformPkg/Pci/Library/PciHostBridgeLibSimple/PciHostBridgeLibSimple.inf @@ -175,6 +175,8 @@ MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf + MinPlatformPkg/Services/StallServicePei/StallServicePei.inf + MinPlatformPkg/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf MinPlatformPkg/Test/Library/TestPointCheckLib/SecTestPointCheckLib.inf MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf diff --git a/Platform/Intel/MinPlatformPkg/Services/StallServicePei/StallServicePei.c b/Platform/Intel/MinPlatformPkg/Services/StallServicePei/StallServicePei.c new file mode 100644 index 0000000000..8b0f5027b4 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/Services/StallServicePei/StallServicePei.c @@ -0,0 +1,93 @@ +/** @file + +Copyright (c) 2018, 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 that 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. + +**/ + +#include +#include +#include +#include +#include +#include + +#define PEI_STALL_RESOLUTION 1 + +/** + The Stall() function provides a blocking stall for at least the number + of microseconds stipulated in the final argument of the API. + + @param PeiServices An indirect pointer to the PEI Services Table + published by the PEI Foundation. + @param This Pointer to the local data for the interface. + @param Microseconds Number of microseconds for which to stall. + + @retval EFI_SUCCESS The service provided at least the required delay. + +**/ +EFI_STATUS +EFIAPI +Stall ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_STALL_PPI *This, + IN UINTN Microseconds + ); + +EFI_PEI_STALL_PPI mStallPpi = { + PEI_STALL_RESOLUTION, + Stall +}; + +EFI_PEI_PPI_DESCRIPTOR mPeiInstallStallPpi = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiStallPpiGuid, + &mStallPpi +}; + +EFI_STATUS +EFIAPI +Stall ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_STALL_PPI *This, + IN UINTN Microseconds + ) +{ + MicroSecondDelay (Microseconds); + + return EFI_SUCCESS; +} + +/** + This function will install the EFI_PEI_STALL_PPI. + + @param FileHandle Handle of the file being invoked. + @param PeiServices Pointer to PEI Services table. + + @retval EFI_SUCCESS The EFI_PEI_STALL_PPI was installed successfully. + @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL. + @retval EFI_INVALID_PARAMETER The PEI PPI descriptor in the list does not have the + EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field. + @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database. + +**/ +EFI_STATUS +EFIAPI +StallServiceEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + + Status = PeiServicesInstallPpi (&mPeiInstallStallPpi); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Platform/Intel/MinPlatformPkg/Services/StallServicePei/StallServicePei.inf b/Platform/Intel/MinPlatformPkg/Services/StallServicePei/StallServicePei.inf new file mode 100644 index 0000000000..522902e8f7 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/Services/StallServicePei/StallServicePei.inf @@ -0,0 +1,41 @@ +### @file +# Component information file for the Stall Service PEI module. +# +# Copyright (c) 2018, 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. +# +### + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = StallServicePei + FILE_GUID = 75862FE4-4FC6-4188-804B-29DC7733178B + VERSION_STRING = 1.0 + MODULE_TYPE = PEIM + ENTRY_POINT = StallServiceEntryPoint + +[Sources] + StallServicePei.c + +[LibraryClasses] + BaseLib + DebugLib + PeimEntryPoint + PeiServicesLib + TimerLib + +[Packages] + MdePkg/MdePkg.dec + +[Ppis] + gEfiPeiStallPpiGuid ## PRODUCES + +[Depex] + TRUE -- cgit v1.2.3