VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxFsDxe/VBoxFsDxe.c@ 69500

Last change on this file since 69500 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette