VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/VBoxFsDxe.c@ 31903

Last change on this file since 31903 was 29125, checked in by vboxsync, 15 years ago

export more EFI files to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.1 KB
Line 
1/* $Id: VBoxFsDxe.c 29125 2010-05-06 09:43:05Z vboxsync $ */
2/** @file
3 * VBoxFsDxe.c - VirtualBox FS wrapper
4 */
5
6/*
7 * Copyright (C) 2010 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
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#include <Protocol/ComponentName.h>
22#include <Protocol/ComponentName2.h>
23#include <Protocol/DriverBinding.h>
24#include <Protocol/PciIo.h>
25#include <Library/BaseMemoryLib.h>
26#include <Library/DebugLib.h>
27#include <Library/UefiBootServicesTableLib.h>
28#include <Library/UefiLib.h>
29#include <IndustryStandard/Pci22.h>
30
31/*******************************************************************************
32* Internal Functions *
33*******************************************************************************/
34static EFI_STATUS EFIAPI
35VBoxFsDB_Supported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
36 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL);
37static EFI_STATUS EFIAPI
38VBoxFsDB_Start(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
39 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL);
40static EFI_STATUS EFIAPI
41VBoxFsDB_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
42 IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL);
43
44static EFI_STATUS EFIAPI
45VBoxFsCN_GetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
46 IN CHAR8 *Language, OUT CHAR16 **DriverName);
47static EFI_STATUS EFIAPI
48VBoxFsCN_GetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
49 IN EFI_HANDLE ControllerHandle,
50 IN EFI_HANDLE ChildHandle OPTIONAL,
51 IN CHAR8 *Language, OUT CHAR16 **ControllerName);
52
53static EFI_STATUS EFIAPI
54VBoxFsCN2_GetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
55 IN CHAR8 *Language, OUT CHAR16 **DriverName);
56static EFI_STATUS EFIAPI
57VBoxFsCN2_GetControllerName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
58 IN EFI_HANDLE ControllerHandle,
59 IN EFI_HANDLE ChildHandle OPTIONAL,
60 IN CHAR8 *Language, OUT CHAR16 **ControllerName);
61
62
63/** EFI Driver Binding Protocol. */
64static EFI_DRIVER_BINDING_PROTOCOL g_VBoxFsDB =
65{
66 VBoxFsDB_Supported,
67 VBoxFsDB_Start,
68 VBoxFsDB_Stop,
69 /* .Version = */ 1,
70 /* .ImageHandle = */ NULL,
71 /* .DriverBindingHandle = */ NULL
72};
73
74/** EFI Component Name Protocol. */
75static const EFI_COMPONENT_NAME_PROTOCOL g_VBoxFsCN =
76{
77 VBoxFsCN_GetDriverName,
78 VBoxFsCN_GetControllerName,
79 "eng"
80};
81
82/** EFI Component Name 2 Protocol. */
83static const EFI_COMPONENT_NAME2_PROTOCOL g_VBoxFsCN2 =
84{
85 VBoxFsCN2_GetDriverName,
86 VBoxFsCN2_GetControllerName,
87 "en"
88};
89
90/** Driver name translation table. */
91static CONST EFI_UNICODE_STRING_TABLE g_aVBoxFsDriverLangAndNames[] =
92{
93 { "eng;en", L"VBox Universal FS Wrapper Driver" },
94 { NULL, NULL }
95};
96
97
98
99/**
100 * VBoxFsDxe entry point.
101 *
102 * @returns EFI status code.
103 *
104 * @param ImageHandle The image handle.
105 * @param SystemTable The system table pointer.
106 */
107EFI_STATUS EFIAPI
108DxeInitializeVBoxFs(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
109{
110 EFI_STATUS rc;
111 DEBUG((DEBUG_INFO, "DxeInitializeVBoxFsDxe\n"));
112
113 rc = EfiLibInstallDriverBindingComponentName2(ImageHandle, SystemTable,
114 &g_VBoxFsDB, ImageHandle,
115 &g_VBoxFsCN, &g_VBoxFsCN2);
116 ASSERT_EFI_ERROR(rc);
117 return rc;
118}
119
120EFI_STATUS EFIAPI
121DxeUninitializeVBoxFs(IN EFI_HANDLE ImageHandle)
122{
123 return EFI_SUCCESS;
124}
125
126
127/**
128 * @copydoc EFI_DRIVER_BINDING_SUPPORTED
129 */
130static EFI_STATUS EFIAPI
131VBoxFsDB_Supported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
132 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
133{
134 EFI_STATUS rcRet = EFI_UNSUPPORTED;
135 /* EFI_STATUS rc; */
136
137 return rcRet;
138}
139
140
141/**
142 * @copydoc EFI_DRIVER_BINDING_START
143 */
144static EFI_STATUS EFIAPI
145VBoxFsDB_Start(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
146 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
147{
148 /* EFI_STATUS rc; */
149
150 return EFI_UNSUPPORTED;
151}
152
153
154/**
155 * @copydoc EFI_DRIVER_BINDING_STOP
156 */
157static EFI_STATUS EFIAPI
158VBoxFsDB_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
159 IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
160{
161 /* EFI_STATUS rc; */
162
163 return EFI_UNSUPPORTED;
164}
165
166
167/** @copydoc EFI_COMPONENT_NAME_GET_DRIVER_NAME */
168static EFI_STATUS EFIAPI
169VBoxFsCN_GetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
170 IN CHAR8 *Language, OUT CHAR16 **DriverName)
171{
172 return LookupUnicodeString2(Language,
173 This->SupportedLanguages,
174 &g_aVBoxFsDriverLangAndNames[0],
175 DriverName,
176 TRUE);
177}
178
179/** @copydoc EFI_COMPONENT_NAME_GET_CONTROLLER_NAME */
180static EFI_STATUS EFIAPI
181VBoxFsCN_GetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
182 IN EFI_HANDLE ControllerHandle,
183 IN EFI_HANDLE ChildHandle OPTIONAL,
184 IN CHAR8 *Language, OUT CHAR16 **ControllerName)
185{
186 /** @todo try query the protocol from the controller and forward the query. */
187 return EFI_UNSUPPORTED;
188}
189
190/** @copydoc EFI_COMPONENT_NAME2_GET_DRIVER_NAME */
191static EFI_STATUS EFIAPI
192VBoxFsCN2_GetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
193 IN CHAR8 *Language, OUT CHAR16 **DriverName)
194{
195 return LookupUnicodeString2(Language,
196 This->SupportedLanguages,
197 &g_aVBoxFsDriverLangAndNames[0],
198 DriverName,
199 FALSE);
200}
201
202/** @copydoc EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME */
203static EFI_STATUS EFIAPI
204VBoxFsCN2_GetControllerName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
205 IN EFI_HANDLE ControllerHandle,
206 IN EFI_HANDLE ChildHandle OPTIONAL,
207 IN CHAR8 *Language, OUT CHAR16 **ControllerName)
208{
209 /** @todo try query the protocol from the controller and forward the query. */
210 return EFI_UNSUPPORTED;
211}
Note: See TracBrowser for help on using the repository browser.

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