]>
Commit | Line | Data |
---|---|---|
804405e7 | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | UnixThunk.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Produce UnixThunk protocol and it's associated device path and controller \r | |
19 | state protocols. UnixThunk is to the emulation environment as \r | |
20 | PCI_ROOT_BRIGE is to real hardware. The UnixBusDriver is the child of this\r | |
21 | driver.\r | |
22 | \r | |
23 | Since we are a root hardware abstraction we do not install a Driver Binding\r | |
24 | protocol on this handle. This driver can only support one one UnixThunk protocol\r | |
25 | in the system, since the device path is hard coded.\r | |
26 | \r | |
27 | --*/\r | |
28 | #include "PiDxe.h"\r | |
29 | #include "UnixDxe.h"\r | |
30 | #include "UnixThunk.h"\r | |
31 | #include <Protocol/DevicePath.h>\r | |
32 | \r | |
33 | #include <Library/DebugLib.h>\r | |
34 | #include <Library/UefiLib.h>\r | |
35 | #include <Library/UefiDriverEntryPoint.h>\r | |
36 | #include <Library/UnixLib.h>\r | |
37 | #include <Library/MemoryAllocationLib.h>\r | |
ccd55824 | 38 | #include <Library/UefiBootServicesTableLib.h>\r |
3c043881 | 39 | #include <Library/DevicePathLib.h>\r |
804405e7 | 40 | \r |
41 | //\r | |
42 | // WinNtThunk Device Path Protocol Instance\r | |
43 | //\r | |
7492c63d | 44 | UNIX_THUNK_DEVICE_PATH mUnixThunkDevicePath = {\r |
804405e7 | 45 | {\r |
46 | {\r | |
47 | HARDWARE_DEVICE_PATH,\r | |
48 | HW_VENDOR_DP,\r | |
49 | {\r | |
50 | (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r | |
51 | (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r | |
52 | }\r | |
53 | },\r | |
54 | EFI_UNIX_THUNK_PROTOCOL_GUID,\r | |
55 | },\r | |
56 | {\r | |
57 | END_DEVICE_PATH_TYPE,\r | |
58 | END_ENTIRE_DEVICE_PATH_SUBTYPE,\r | |
59 | {\r | |
60 | END_DEVICE_PATH_LENGTH,\r | |
61 | 0\r | |
62 | }\r | |
63 | }\r | |
64 | };\r | |
65 | \r | |
66 | \r | |
67 | EFI_STATUS\r | |
68 | EFIAPI\r | |
69 | InitializeUnixThunk (\r | |
70 | IN EFI_HANDLE ImageHandle,\r | |
71 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
72 | )\r | |
73 | /*++\r | |
74 | \r | |
75 | Routine Description:\r | |
76 | Install UnixThunk Protocol and it's associated Device Path protocol\r | |
77 | \r | |
78 | Arguments:\r | |
79 | (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r | |
80 | \r | |
81 | Returns:\r | |
82 | EFI_SUCEESS - UnixThunk protocol is added or error status from \r | |
83 | gBS->InstallMultiProtocolInterfaces().\r | |
84 | \r | |
85 | --*/\r | |
86 | // TODO: ImageHandle - add argument and description to function comment\r | |
87 | // TODO: SystemTable - add argument and description to function comment\r | |
88 | {\r | |
89 | EFI_STATUS Status;\r | |
90 | EFI_HANDLE ControllerHandle;\r | |
91 | \r | |
92 | ControllerHandle = NULL;\r | |
93 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
94 | &ControllerHandle,\r | |
95 | &gEfiUnixThunkProtocolGuid,\r | |
96 | gUnix,\r | |
97 | &gEfiDevicePathProtocolGuid,\r | |
98 | &mUnixThunkDevicePath,\r | |
99 | NULL\r | |
100 | );\r | |
101 | \r | |
102 | return Status;\r | |
103 | }\r |