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