]> git.proxmox.com Git - mirror_edk2.git/blob - UnixPkg/UnixThunkDxe/UnixThunk.c
Patch to remove STATIC modifier. This is on longer recommended by EFI Framework codin...
[mirror_edk2.git] / UnixPkg / UnixThunkDxe / UnixThunk.c
1 /*++
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 UnixThunk.c
15
16 Abstract:
17
18 Produce UnixThunk protocol and it's associated device path and controller
19 state protocols. UnixThunk is to the emulation environment as
20 PCI_ROOT_BRIGE is to real hardware. The UnixBusDriver 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 UnixThunk protocol
25 in the system, since the device path is hard coded.
26
27 --*/
28 #include "PiDxe.h"
29 #include "UnixDxe.h"
30 #include "UnixThunk.h"
31 #include <Protocol/DevicePath.h>
32
33 #include <Library/DebugLib.h>
34 #include <Library/UefiLib.h>
35 #include <Library/UefiDriverEntryPoint.h>
36 #include <Library/UnixLib.h>
37 #include <Library/MemoryAllocationLib.h>
38 #include <Library/UefiBootServicesTableLib.h>
39
40 //
41 // WinNtThunk Device Path Protocol Instance
42 //
43 UNIX_THUNK_DEVICE_PATH mUnixThunkDevicePath = {
44 {
45 {
46 HARDWARE_DEVICE_PATH,
47 HW_VENDOR_DP,
48 {
49 (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
50 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
51 }
52 },
53 EFI_UNIX_THUNK_PROTOCOL_GUID,
54 },
55 {
56 END_DEVICE_PATH_TYPE,
57 END_ENTIRE_DEVICE_PATH_SUBTYPE,
58 {
59 END_DEVICE_PATH_LENGTH,
60 0
61 }
62 }
63 };
64
65
66 EFI_STATUS
67 EFIAPI
68 InitializeUnixThunk (
69 IN EFI_HANDLE ImageHandle,
70 IN EFI_SYSTEM_TABLE *SystemTable
71 )
72 /*++
73
74 Routine Description:
75 Install UnixThunk Protocol and it's associated Device Path protocol
76
77 Arguments:
78 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
79
80 Returns:
81 EFI_SUCEESS - UnixThunk protocol is added or error status from
82 gBS->InstallMultiProtocolInterfaces().
83
84 --*/
85 // TODO: ImageHandle - add argument and description to function comment
86 // TODO: SystemTable - add argument and description to function comment
87 {
88 EFI_STATUS Status;
89 EFI_HANDLE ControllerHandle;
90
91 ControllerHandle = NULL;
92 Status = gBS->InstallMultipleProtocolInterfaces (
93 &ControllerHandle,
94 &gEfiUnixThunkProtocolGuid,
95 gUnix,
96 &gEfiDevicePathProtocolGuid,
97 &mUnixThunkDevicePath,
98 NULL
99 );
100
101 return Status;
102 }