TianoCore EDK2 master
Loading...
Searching...
No Matches
EmuThunk.c
1/*++ @file
2
3Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4Portions copyright (c) 2011, Apple Inc. All rights reserved.
5SPDX-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>
17#include <Library/EmuThunkLib.h>
21
22//
23// EmuThunk Device Path Protocol Instance
24//
25EMU_THUNK_DEVICE_PATH mEmuThunkDevicePath = {
26 {
27 {
28 {
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
51EFIAPI
52InitializeEmuThunk (
53 IN EFI_HANDLE ImageHandle,
54 IN EFI_SYSTEM_TABLE *SystemTable
55 )
56
57/*++
58
59Routine Description:
60 Install UnixThunk Protocol and it's associated Device Path protocol
61
62Arguments:
63 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
64
65Returns:
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}
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_BOOT_SERVICES * gBS