869f8e34 |
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 | WinNtThunk.c\r |
15 | \r |
16 | Abstract:\r |
17 | \r |
18 | Produce WinNtThunk protocol and it's associated device path and controller \r |
19 | state protocols. WinNtThunk is to the NT emulation environment as \r |
20 | PCI_ROOT_BRIGE is to real hardware. The WinNtBusDriver 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 WinNtThunk protocol\r |
25 | in the system, since the device path is hard coded.\r |
26 | \r |
27 | --*/\r |
28 | \r |
29 | //\r |
3747c59b |
30 | // The package level header files this module uses\r |
869f8e34 |
31 | //\r |
3747c59b |
32 | #include <PiDxe.h>\r |
33 | #include <WinNtDxe.h>\r |
34 | //\r |
35 | // The protocols, PPI and GUID defintions for this module\r |
36 | //\r |
37 | #include <Protocol/WinNtThunk.h>\r |
38 | #include <Protocol/DevicePath.h>\r |
39 | //\r |
40 | // The Library classes this module consumes\r |
41 | //\r |
42 | #include <Library/DebugLib.h>\r |
43 | #include <Library/UefiDriverEntryPoint.h>\r |
44 | #include <Library/WinNtLib.h>\r |
45 | #include <Library/UefiBootServicesTableLib.h>\r |
869f8e34 |
46 | \r |
47 | #include "WinNtThunk.h"\r |
48 | \r |
49 | //\r |
50 | // WinNtThunk Device Path Protocol Instance\r |
51 | //\r |
52 | static WIN_NT_THUNK_DEVICE_PATH mWinNtThunkDevicePath = {\r |
53 | {\r |
54 | HARDWARE_DEVICE_PATH,\r |
55 | HW_VENDOR_DP,\r |
56 | (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r |
57 | (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),\r |
58 | EFI_WIN_NT_THUNK_PROTOCOL_GUID,\r |
59 | },\r |
60 | {\r |
61 | END_DEVICE_PATH_TYPE,\r |
62 | END_ENTIRE_DEVICE_PATH_SUBTYPE,\r |
63 | END_DEVICE_PATH_LENGTH,\r |
64 | 0\r |
65 | }\r |
66 | };\r |
67 | \r |
68 | \r |
69 | EFI_STATUS\r |
70 | EFIAPI\r |
71 | InitializeWinNtThunk (\r |
72 | IN EFI_HANDLE ImageHandle,\r |
73 | IN EFI_SYSTEM_TABLE *SystemTable\r |
74 | )\r |
75 | /*++\r |
76 | \r |
77 | Routine Description:\r |
78 | Install WinNtThunk Protocol and it's associated Device Path protocol\r |
79 | \r |
80 | Arguments:\r |
81 | (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r |
82 | \r |
83 | Returns:\r |
84 | EFI_SUCEESS - WinNtThunk protocol is added or error status from \r |
85 | gBS->InstallMultiProtocolInterfaces().\r |
86 | \r |
87 | --*/\r |
88 | // TODO: ImageHandle - add argument and description to function comment\r |
89 | // TODO: SystemTable - add argument and description to function comment\r |
90 | {\r |
91 | EFI_STATUS Status;\r |
92 | EFI_HANDLE ControllerHandle;\r |
93 | \r |
94 | ControllerHandle = NULL;\r |
95 | Status = gBS->InstallMultipleProtocolInterfaces (\r |
96 | &ControllerHandle,\r |
97 | &gEfiWinNtThunkProtocolGuid,\r |
98 | gWinNt,\r |
99 | &gEfiDevicePathProtocolGuid,\r |
100 | &mWinNtThunkDevicePath,\r |
101 | NULL\r |
102 | );\r |
103 | \r |
104 | return Status;\r |
105 | }\r |