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