]>
Commit | Line | Data |
---|---|---|
6ae81428 | 1 | /**@file\r |
869f8e34 | 2 | \r |
8f2a5f80 | 3 | Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r |
9d2eedba | 4 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
869f8e34 | 5 | \r |
6 | Module Name:\r | |
7 | \r | |
8 | WinNtThunk.c\r | |
9 | \r | |
10 | Abstract:\r | |
11 | \r | |
12 | Produce WinNtThunk protocol and it's associated device path and controller \r | |
13 | state protocols. WinNtThunk is to the NT emulation environment as \r | |
14 | PCI_ROOT_BRIGE is to real hardware. The WinNtBusDriver is the child of this\r | |
15 | driver.\r | |
16 | \r | |
17 | Since we are a root hardware abstraction we do not install a Driver Binding\r | |
18 | protocol on this handle. This driver can only support one one WinNtThunk protocol\r | |
19 | in the system, since the device path is hard coded.\r | |
20 | \r | |
6ae81428 | 21 | **/\r |
869f8e34 | 22 | \r |
23 | //\r | |
3747c59b | 24 | // The package level header files this module uses\r |
869f8e34 | 25 | //\r |
60c93673 | 26 | #include <Uefi.h>\r |
3747c59b | 27 | #include <WinNtDxe.h>\r |
28 | //\r | |
29 | // The protocols, PPI and GUID defintions for this module\r | |
30 | //\r | |
31 | #include <Protocol/WinNtThunk.h>\r | |
32 | #include <Protocol/DevicePath.h>\r | |
33 | //\r | |
34 | // The Library classes this module consumes\r | |
35 | //\r | |
3747c59b | 36 | #include <Library/UefiDriverEntryPoint.h>\r |
37 | #include <Library/WinNtLib.h>\r | |
38 | #include <Library/UefiBootServicesTableLib.h>\r | |
008698ab | 39 | #include <Library/DevicePathLib.h>\r |
869f8e34 | 40 | \r |
41 | #include "WinNtThunk.h"\r | |
42 | \r | |
43 | //\r | |
44 | // WinNtThunk Device Path Protocol Instance\r | |
45 | //\r | |
78e570b6 | 46 | WIN_NT_THUNK_DEVICE_PATH mWinNtThunkDevicePath = {\r |
869f8e34 | 47 | {\r |
48 | HARDWARE_DEVICE_PATH,\r | |
49 | HW_VENDOR_DP,\r | |
50 | (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r | |
51 | (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),\r | |
52 | EFI_WIN_NT_THUNK_PROTOCOL_GUID,\r | |
53 | },\r | |
54 | {\r | |
55 | END_DEVICE_PATH_TYPE,\r | |
56 | END_ENTIRE_DEVICE_PATH_SUBTYPE,\r | |
57 | END_DEVICE_PATH_LENGTH,\r | |
58 | 0\r | |
59 | }\r | |
60 | };\r | |
61 | \r | |
62 | \r | |
63 | EFI_STATUS\r | |
64 | EFIAPI\r | |
65 | InitializeWinNtThunk (\r | |
66 | IN EFI_HANDLE ImageHandle,\r | |
67 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
68 | )\r | |
69 | /*++\r | |
70 | \r | |
71 | Routine Description:\r | |
72 | Install WinNtThunk Protocol and it's associated Device Path protocol\r | |
73 | \r | |
74 | Arguments:\r | |
75 | (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r | |
76 | \r | |
77 | Returns:\r | |
78 | EFI_SUCEESS - WinNtThunk protocol is added or error status from \r | |
79 | gBS->InstallMultiProtocolInterfaces().\r | |
80 | \r | |
81 | --*/\r | |
82 | // TODO: ImageHandle - add argument and description to function comment\r | |
83 | // TODO: SystemTable - add argument and description to function comment\r | |
84 | {\r | |
85 | EFI_STATUS Status;\r | |
86 | EFI_HANDLE ControllerHandle;\r | |
87 | \r | |
88 | ControllerHandle = NULL;\r | |
89 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
90 | &ControllerHandle,\r | |
91 | &gEfiWinNtThunkProtocolGuid,\r | |
92 | gWinNt,\r | |
93 | &gEfiDevicePathProtocolGuid,\r | |
94 | &mWinNtThunkDevicePath,\r | |
95 | NULL\r | |
96 | );\r | |
97 | \r | |
98 | return Status;\r | |
99 | }\r |