]> git.proxmox.com Git - mirror_edk2.git/blob - EdkUnixPkg/Dxe/UnixThunk/UnixThunk/UnixThunk.c
Fix component name bugs when input Controller Name is invalid
[mirror_edk2.git] / EdkUnixPkg / Dxe / UnixThunk / UnixThunk / 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
29 #include "UnixThunk.h"
30
31 //
32 // WinNtThunk Device Path Protocol Instance
33 //
34 static UNIX_THUNK_DEVICE_PATH mUnixThunkDevicePath = {
35 {
36 {
37 HARDWARE_DEVICE_PATH,
38 HW_VENDOR_DP,
39 {
40 (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
41 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
42 }
43 },
44 EFI_UNIX_THUNK_PROTOCOL_GUID,
45 },
46 {
47 END_DEVICE_PATH_TYPE,
48 END_ENTIRE_DEVICE_PATH_SUBTYPE,
49 {
50 END_DEVICE_PATH_LENGTH,
51 0
52 }
53 }
54 };
55
56
57 EFI_STATUS
58 EFIAPI
59 InitializeUnixThunk (
60 IN EFI_HANDLE ImageHandle,
61 IN EFI_SYSTEM_TABLE *SystemTable
62 )
63 /*++
64
65 Routine Description:
66 Install UnixThunk Protocol and it's associated Device Path protocol
67
68 Arguments:
69 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
70
71 Returns:
72 EFI_SUCEESS - UnixThunk protocol is added or error status from
73 gBS->InstallMultiProtocolInterfaces().
74
75 --*/
76 // TODO: ImageHandle - add argument and description to function comment
77 // TODO: SystemTable - add argument and description to function comment
78 {
79 EFI_STATUS Status;
80 EFI_HANDLE ControllerHandle;
81
82 ControllerHandle = NULL;
83 Status = gBS->InstallMultipleProtocolInterfaces (
84 &ControllerHandle,
85 &gEfiUnixThunkProtocolGuid,
86 gUnix,
87 &gEfiDevicePathProtocolGuid,
88 &mUnixThunkDevicePath,
89 NULL
90 );
91
92 return Status;
93 }