--- /dev/null
+/** @file\r
+ Dispatch Block to Aps in Dxe phase for parallelhash algorithm.\r
+\r
+Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include "CryptParallelHash.h"\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Protocol/MpService.h>\r
+\r
+/**\r
+ Dispatch the block task to each AP in PEI phase.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DispatchBlockToAp (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_MP_SERVICES_PROTOCOL *MpServices;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiMpServiceProtocolGuid,\r
+ NULL,\r
+ (VOID **)&MpServices\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // Failed to locate MpServices Protocol, do parallel hash by one core.\r
+ //\r
+ DEBUG ((DEBUG_ERROR, "[DispatchBlockToApDxe] Failed to locate MpServices Protocol. Status = %r\n", Status));\r
+ return;\r
+ }\r
+\r
+ Status = MpServices->StartupAllAPs (\r
+ MpServices,\r
+ ParallelHashApExecute,\r
+ FALSE,\r
+ NULL,\r
+ 0,\r
+ NULL,\r
+ NULL\r
+ );\r
+ return;\r
+}\r