]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.c
33188d5e95bc738788d1e4e6c9354ed38d3dd292
[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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #include <PiPei.h>
17
18 #include <Library/DebugLib.h>
19 #include <Library/PeimEntryPoint.h>
20 #include <Library/HobLib.h>
21 #include <Library/PeiServicesLib.h>
22 #include <Library/PeiServicesTablePointerLib.h>
23
24 #include <Ppi/EmuThunk.h>
25 #include <Protocol/EmuThunk.h>
26
27
28
29 EFI_STATUS
30 EFIAPI
31 PeiInitialzeThunkPpiToProtocolPei (
32 IN EFI_PEI_FILE_HANDLE FileHandle,
33 IN CONST EFI_PEI_SERVICES **PeiServices
34 )
35 /*++
36
37 Routine Description:
38
39 Perform a call-back into the SEC simulator to get Unix Stuff
40
41 Arguments:
42
43 PeiServices - General purpose services available to every PEIM.
44
45 Returns:
46
47 None
48
49 **/
50 {
51 EFI_STATUS Status;
52 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
53 EMU_THUNK_PPI *Thunk;
54 VOID *Ptr;
55
56 DEBUG ((EFI_D_ERROR, "Emu Thunk PEIM Loaded\n"));
57
58 Status = PeiServicesLocatePpi (
59 &gEmuThunkPpiGuid, // GUID
60 0, // INSTANCE
61 &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
62 (VOID **)&Thunk // PPI
63 );
64 ASSERT_EFI_ERROR (Status);
65
66 Ptr = Thunk->Thunk ();
67
68 BuildGuidDataHob (
69 &gEmuThunkProtocolGuid, // Guid
70 &Ptr, // Buffer
71 sizeof (VOID *) // Sizeof Buffer
72 );
73 return Status;
74 }