X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=CryptoPkg%2FLibrary%2FBaseCryptLib%2FHash%2FCryptDispatchApPei.c;fp=CryptoPkg%2FLibrary%2FBaseCryptLib%2FHash%2FCryptDispatchApPei.c;h=9ddd23d32048c9f2b0bc1bd12ab7882a3a0c1ed6;hp=0000000000000000000000000000000000000000;hb=5d5be45bd11117c1e479863125e7d772e54772c9;hpb=47d988387efc8b45561f542f7a8e5b6a43979a8c diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptDispatchApPei.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptDispatchApPei.c new file mode 100644 index 0000000000..9ddd23d320 --- /dev/null +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptDispatchApPei.c @@ -0,0 +1,54 @@ +/** @file + Dispatch Block to Aps in Pei phase for parallelhash algorithm. + +Copyright (c) 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "CryptParallelHash.h" +#include +#include +#include +#include + +/** + Dispatch the block task to each AP in PEI phase. + +**/ +VOID +EFIAPI +DispatchBlockToAp ( + VOID + ) +{ + EFI_STATUS Status; + CONST EFI_PEI_SERVICES **PeiServices; + EFI_PEI_MP_SERVICES_PPI *MpServicesPpi; + + PeiServices = GetPeiServicesTablePointer (); + Status = (*PeiServices)->LocatePpi ( + PeiServices, + &gEfiPeiMpServicesPpiGuid, + 0, + NULL, + (VOID **)&MpServicesPpi + ); + if (EFI_ERROR (Status)) { + // + // Failed to locate MpServices Ppi, do parallel hash by one core. + // + DEBUG ((DEBUG_ERROR, "[DispatchBlockToApPei] Failed to locate MpServices Ppi. Status = %r\n", Status)); + return; + } + + Status = MpServicesPpi->StartupAllAPs ( + (CONST EFI_PEI_SERVICES **)PeiServices, + MpServicesPpi, + ParallelHashApExecute, + FALSE, + 0, + NULL + ); + return; +}