]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.c
OvmfPkg/IntelTdx: Add SecTdxHelperLib
[mirror_edk2.git] / EmulatorPkg / ThunkPpiToProtocolPei / ThunkPpiToProtocolPei.c
1 /*++ @file
2 UEFI/PI PEIM to abstract construction of firmware volume in a Unix environment.
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include <PiPei.h>
11
12 #include <Library/DebugLib.h>
13 #include <Library/PeimEntryPoint.h>
14 #include <Library/HobLib.h>
15 #include <Library/PeiServicesLib.h>
16 #include <Library/PeiServicesTablePointerLib.h>
17
18 #include <Ppi/EmuThunk.h>
19 #include <Protocol/EmuThunk.h>
20
21 EFI_STATUS
22 EFIAPI
23 PeiInitialzeThunkPpiToProtocolPei (
24 IN EFI_PEI_FILE_HANDLE FileHandle,
25 IN CONST EFI_PEI_SERVICES **PeiServices
26 )
27
28 /*++
29
30 Routine Description:
31
32 Perform a call-back into the SEC simulator to get Unix Stuff
33
34 Arguments:
35
36 PeiServices - General purpose services available to every PEIM.
37
38 Returns:
39
40 None
41
42 **/
43 {
44 EFI_STATUS Status;
45 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
46 EMU_THUNK_PPI *Thunk;
47 VOID *Ptr;
48
49 DEBUG ((DEBUG_ERROR, "Emu Thunk PEIM Loaded\n"));
50
51 Status = PeiServicesLocatePpi (
52 &gEmuThunkPpiGuid, // GUID
53 0, // INSTANCE
54 &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
55 (VOID **)&Thunk // PPI
56 );
57 ASSERT_EFI_ERROR (Status);
58
59 Ptr = Thunk->Thunk ();
60
61 BuildGuidDataHob (
62 &gEmuThunkProtocolGuid, // Guid
63 &Ptr, // Buffer
64 sizeof (VOID *) // Sizeof Buffer
65 );
66 return Status;
67 }