]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/BaseCryptLib/Hash/CryptDispatchApPei.c
9ddd23d32048c9f2b0bc1bd12ab7882a3a0c1ed6
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Hash / CryptDispatchApPei.c
1 /** @file
2 Dispatch Block to Aps in Pei phase for parallelhash algorithm.
3
4 Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "CryptParallelHash.h"
10 #include <Library/PeiServicesTablePointerLib.h>
11 #include <PiPei.h>
12 #include <Ppi/MpServices.h>
13 #include <Library/PeiServicesLib.h>
14
15 /**
16 Dispatch the block task to each AP in PEI phase.
17
18 **/
19 VOID
20 EFIAPI
21 DispatchBlockToAp (
22 VOID
23 )
24 {
25 EFI_STATUS Status;
26 CONST EFI_PEI_SERVICES **PeiServices;
27 EFI_PEI_MP_SERVICES_PPI *MpServicesPpi;
28
29 PeiServices = GetPeiServicesTablePointer ();
30 Status = (*PeiServices)->LocatePpi (
31 PeiServices,
32 &gEfiPeiMpServicesPpiGuid,
33 0,
34 NULL,
35 (VOID **)&MpServicesPpi
36 );
37 if (EFI_ERROR (Status)) {
38 //
39 // Failed to locate MpServices Ppi, do parallel hash by one core.
40 //
41 DEBUG ((DEBUG_ERROR, "[DispatchBlockToApPei] Failed to locate MpServices Ppi. Status = %r\n", Status));
42 return;
43 }
44
45 Status = MpServicesPpi->StartupAllAPs (
46 (CONST EFI_PEI_SERVICES **)PeiServices,
47 MpServicesPpi,
48 ParallelHashApExecute,
49 FALSE,
50 0,
51 NULL
52 );
53 return;
54 }