]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - EmulatorPkg/EmuThunkDxe/EmuThunk.c
ShellPkg/DynamicCommand: Fix bug that cannot start in boot
[mirror_edk2.git] / EmulatorPkg / EmuThunkDxe / EmuThunk.c
... / ...
CommitLineData
1/*++ @file\r
2\r
3Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4Portions copyright (c) 2011, Apple Inc. All rights reserved.\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13\r
14**/\r
15#include <PiDxe.h>\r
16\r
17#include <Protocol/DevicePath.h>\r
18#include <Protocol/EmuThunk.h>\r
19\r
20#include <Library/DebugLib.h>\r
21#include <Library/UefiLib.h>\r
22#include <Library/UefiDriverEntryPoint.h>\r
23#include <Library/EmuThunkLib.h>\r
24#include <Library/MemoryAllocationLib.h>\r
25#include <Library/UefiBootServicesTableLib.h>\r
26#include <Library/DevicePathLib.h>\r
27\r
28//\r
29// EmuThunk Device Path Protocol Instance\r
30//\r
31EMU_THUNK_DEVICE_PATH mEmuThunkDevicePath = {\r
32 {\r
33 {\r
34 {\r
35 HARDWARE_DEVICE_PATH,\r
36 HW_VENDOR_DP,\r
37 {\r
38 (UINT8) (sizeof (EMU_VENDOR_DEVICE_PATH_NODE)),\r
39 (UINT8) ((sizeof (EMU_VENDOR_DEVICE_PATH_NODE)) >> 8)\r
40 }\r
41 },\r
42 EMU_THUNK_PROTOCOL_GUID\r
43 },\r
44 0\r
45 },\r
46 {\r
47 END_DEVICE_PATH_TYPE,\r
48 END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
49 {\r
50 END_DEVICE_PATH_LENGTH,\r
51 0\r
52 }\r
53 }\r
54};\r
55\r
56\r
57EFI_STATUS\r
58EFIAPI\r
59InitializeEmuThunk (\r
60 IN EFI_HANDLE ImageHandle,\r
61 IN EFI_SYSTEM_TABLE *SystemTable\r
62 )\r
63/*++\r
64\r
65Routine Description:\r
66 Install UnixThunk Protocol and it's associated Device Path protocol\r
67\r
68Arguments:\r
69 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
70\r
71Returns:\r
72 EFI_SUCEESS - UnixThunk protocol is added or error status from\r
73 gBS->InstallMultiProtocolInterfaces().\r
74\r
75**/\r
76{\r
77 EFI_STATUS Status;\r
78 EFI_HANDLE Handle;\r
79\r
80 Handle = NULL;\r
81 Status = gBS->InstallMultipleProtocolInterfaces (\r
82 &Handle,\r
83 &gEmuThunkProtocolGuid, gEmuThunk,\r
84 &gEfiDevicePathProtocolGuid, &mEmuThunkDevicePath,\r
85 NULL\r
86 );\r
87\r
88 return Status;\r
89}\r