]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/EmuThunkDxe/EmuThunk.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / EmulatorPkg / EmuThunkDxe / EmuThunk.c
1 /*++ @file
2
3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 Portions copyright (c) 2011, Apple Inc. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7
8 **/
9 #include <PiDxe.h>
10
11 #include <Protocol/DevicePath.h>
12 #include <Protocol/EmuThunk.h>
13
14 #include <Library/DebugLib.h>
15 #include <Library/UefiLib.h>
16 #include <Library/UefiDriverEntryPoint.h>
17 #include <Library/EmuThunkLib.h>
18 #include <Library/MemoryAllocationLib.h>
19 #include <Library/UefiBootServicesTableLib.h>
20 #include <Library/DevicePathLib.h>
21
22 //
23 // EmuThunk Device Path Protocol Instance
24 //
25 EMU_THUNK_DEVICE_PATH mEmuThunkDevicePath = {
26 {
27 {
28 {
29 HARDWARE_DEVICE_PATH,
30 HW_VENDOR_DP,
31 {
32 (UINT8)(sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),
33 (UINT8)((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)
34 }
35 },
36 EMU_THUNK_PROTOCOL_GUID
37 },
38 0
39 },
40 {
41 END_DEVICE_PATH_TYPE,
42 END_ENTIRE_DEVICE_PATH_SUBTYPE,
43 {
44 END_DEVICE_PATH_LENGTH,
45 0
46 }
47 }
48 };
49
50 EFI_STATUS
51 EFIAPI
52 InitializeEmuThunk (
53 IN EFI_HANDLE ImageHandle,
54 IN EFI_SYSTEM_TABLE *SystemTable
55 )
56
57 /*++
58
59 Routine Description:
60 Install UnixThunk Protocol and it's associated Device Path protocol
61
62 Arguments:
63 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
64
65 Returns:
66 EFI_SUCEESS - UnixThunk protocol is added or error status from
67 gBS->InstallMultiProtocolInterfaces().
68
69 **/
70 {
71 EFI_STATUS Status;
72 EFI_HANDLE Handle;
73
74 Handle = NULL;
75 Status = gBS->InstallMultipleProtocolInterfaces (
76 &Handle,
77 &gEmuThunkProtocolGuid,
78 gEmuThunk,
79 &gEfiDevicePathProtocolGuid,
80 &mEmuThunkDevicePath,
81 NULL
82 );
83
84 return Status;
85 }