This repository has been archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VBoxFsDxe.c
211 lines (182 loc) · 7.11 KB
/
VBoxFsDxe.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/* $Id: VBoxFsDxe.c $ */
/** @file
* VBoxFsDxe.c - VirtualBox FS wrapper
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <Protocol/ComponentName.h>
#include <Protocol/ComponentName2.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/PciIo.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <IndustryStandard/Pci22.h>
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
static EFI_STATUS EFIAPI
VBoxFsDB_Supported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL);
static EFI_STATUS EFIAPI
VBoxFsDB_Start(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL);
static EFI_STATUS EFIAPI
VBoxFsDB_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL);
static EFI_STATUS EFIAPI
VBoxFsCN_GetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language, OUT CHAR16 **DriverName);
static EFI_STATUS EFIAPI
VBoxFsCN_GetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, OUT CHAR16 **ControllerName);
static EFI_STATUS EFIAPI
VBoxFsCN2_GetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
IN CHAR8 *Language, OUT CHAR16 **DriverName);
static EFI_STATUS EFIAPI
VBoxFsCN2_GetControllerName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, OUT CHAR16 **ControllerName);
/** EFI Driver Binding Protocol. */
static EFI_DRIVER_BINDING_PROTOCOL g_VBoxFsDB =
{
VBoxFsDB_Supported,
VBoxFsDB_Start,
VBoxFsDB_Stop,
/* .Version = */ 1,
/* .ImageHandle = */ NULL,
/* .DriverBindingHandle = */ NULL
};
/** EFI Component Name Protocol. */
static const EFI_COMPONENT_NAME_PROTOCOL g_VBoxFsCN =
{
VBoxFsCN_GetDriverName,
VBoxFsCN_GetControllerName,
"eng"
};
/** EFI Component Name 2 Protocol. */
static const EFI_COMPONENT_NAME2_PROTOCOL g_VBoxFsCN2 =
{
VBoxFsCN2_GetDriverName,
VBoxFsCN2_GetControllerName,
"en"
};
/** Driver name translation table. */
static CONST EFI_UNICODE_STRING_TABLE g_aVBoxFsDriverLangAndNames[] =
{
{ "eng;en", L"VBox Universal FS Wrapper Driver" },
{ NULL, NULL }
};
/**
* VBoxFsDxe entry point.
*
* @returns EFI status code.
*
* @param ImageHandle The image handle.
* @param SystemTable The system table pointer.
*/
EFI_STATUS EFIAPI
DxeInitializeVBoxFs(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{
EFI_STATUS rc;
DEBUG((DEBUG_INFO, "DxeInitializeVBoxFsDxe\n"));
rc = EfiLibInstallDriverBindingComponentName2(ImageHandle, SystemTable,
&g_VBoxFsDB, ImageHandle,
&g_VBoxFsCN, &g_VBoxFsCN2);
ASSERT_EFI_ERROR(rc);
return rc;
}
EFI_STATUS EFIAPI
DxeUninitializeVBoxFs(IN EFI_HANDLE ImageHandle)
{
return EFI_SUCCESS;
}
/**
* @copydoc EFI_DRIVER_BINDING_SUPPORTED
*/
static EFI_STATUS EFIAPI
VBoxFsDB_Supported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
{
EFI_STATUS rcRet = EFI_UNSUPPORTED;
/* EFI_STATUS rc; */
return rcRet;
}
/**
* @copydoc EFI_DRIVER_BINDING_START
*/
static EFI_STATUS EFIAPI
VBoxFsDB_Start(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
{
/* EFI_STATUS rc; */
return EFI_UNSUPPORTED;
}
/**
* @copydoc EFI_DRIVER_BINDING_STOP
*/
static EFI_STATUS EFIAPI
VBoxFsDB_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
{
/* EFI_STATUS rc; */
return EFI_UNSUPPORTED;
}
/** @copydoc EFI_COMPONENT_NAME_GET_DRIVER_NAME */
static EFI_STATUS EFIAPI
VBoxFsCN_GetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language, OUT CHAR16 **DriverName)
{
return LookupUnicodeString2(Language,
This->SupportedLanguages,
&g_aVBoxFsDriverLangAndNames[0],
DriverName,
TRUE);
}
/** @copydoc EFI_COMPONENT_NAME_GET_CONTROLLER_NAME */
static EFI_STATUS EFIAPI
VBoxFsCN_GetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, OUT CHAR16 **ControllerName)
{
/** @todo try query the protocol from the controller and forward the query. */
return EFI_UNSUPPORTED;
}
/** @copydoc EFI_COMPONENT_NAME2_GET_DRIVER_NAME */
static EFI_STATUS EFIAPI
VBoxFsCN2_GetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
IN CHAR8 *Language, OUT CHAR16 **DriverName)
{
return LookupUnicodeString2(Language,
This->SupportedLanguages,
&g_aVBoxFsDriverLangAndNames[0],
DriverName,
FALSE);
}
/** @copydoc EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME */
static EFI_STATUS EFIAPI
VBoxFsCN2_GetControllerName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, OUT CHAR16 **ControllerName)
{
/** @todo try query the protocol from the controller and forward the query. */
return EFI_UNSUPPORTED;
}