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