VirtualBox

source: vbox/trunk/src/VBox/Devices/Builtins.cpp@ 28406

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

Devices, Main, FE/Qt: re-committed support for VDE virtual network switches for Linux and FreeBSD hosts. Contributed by Renzo Davoli, VirtualSquare, University of Bologna

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.2 KB
Line 
1/* $Id: Builtins.cpp 28406 2010-04-16 10:45:18Z vboxsync $ */
2/** @file
3 * Built-in drivers & devices (part 1)
4 */
5
6/*
7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#define LOG_GROUP LOG_GROUP_DEV
27#include <VBox/pdm.h>
28#include <VBox/version.h>
29#include <VBox/err.h>
30#include <VBox/usb.h>
31
32#include <VBox/log.h>
33#include <iprt/assert.h>
34
35#include "Builtins.h"
36
37
38/*******************************************************************************
39* Global Variables *
40*******************************************************************************/
41const void *g_apvVBoxDDDependencies[] =
42{
43#ifdef VBOX_WITH_EFI
44 &g_abEfiThunkBinary[0],
45#endif
46 NULL,
47};
48
49
50/**
51 * Register builtin devices.
52 *
53 * @returns VBox status code.
54 * @param pCallbacks Pointer to the callback table.
55 * @param u32Version VBox version number.
56 */
57extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
58{
59 LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
60 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
61 int rc;
62
63 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
64 if (RT_FAILURE(rc))
65 return rc;
66 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch);
67 if (RT_FAILURE(rc))
68 return rc;
69 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios);
70 if (RT_FAILURE(rc))
71 return rc;
72 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse);
73 if (RT_FAILURE(rc))
74 return rc;
75 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
76 if (RT_FAILURE(rc))
77 return rc;
78 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
79 if (RT_FAILURE(rc))
80 return rc;
81 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
82 if (RT_FAILURE(rc))
83 return rc;
84#ifdef VBOX_WITH_HPET
85 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHPET);
86 if (RT_FAILURE(rc))
87 return rc;
88#endif
89#ifdef VBOX_WITH_SMC
90 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSMC);
91 if (RT_FAILURE(rc))
92 return rc;
93#endif
94#ifdef VBOX_WITH_LPC
95 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLPC);
96 if (RT_FAILURE(rc))
97 return rc;
98#endif
99#ifdef VBOX_WITH_EFI
100 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEFI);
101 if (RT_FAILURE(rc))
102 return rc;
103#endif
104 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
105 if (RT_FAILURE(rc))
106 return rc;
107 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
108 if (RT_FAILURE(rc))
109 return rc;
110 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
111 if (RT_FAILURE(rc))
112 return rc;
113 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
114 if (RT_FAILURE(rc))
115 return rc;
116#ifdef VBOX_WITH_E1000
117 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000);
118 if (RT_FAILURE(rc))
119 return rc;
120#endif
121#ifdef VBOX_WITH_VIRTIO
122 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioNet);
123 if (RT_FAILURE(rc))
124 return rc;
125#endif
126#ifdef VBOX_WITH_INIP
127 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
128 if (RT_FAILURE(rc))
129 return rc;
130#endif
131 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
132 if (RT_FAILURE(rc))
133 return rc;
134 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
135 if (RT_FAILURE(rc))
136 return rc;
137 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
138 if (RT_FAILURE(rc))
139 return rc;
140#ifdef VBOX_WITH_VUSB
141 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
142 if (RT_FAILURE(rc))
143 return rc;
144#endif
145#ifdef VBOX_WITH_EHCI
146 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
147 if (RT_FAILURE(rc))
148 return rc;
149#endif
150#ifdef VBOX_ACPI
151 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
152 if (RT_FAILURE(rc))
153 return rc;
154#endif
155 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
156 if (RT_FAILURE(rc))
157 return rc;
158 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
159 if (RT_FAILURE(rc))
160 return rc;
161 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
162 if (RT_FAILURE(rc))
163 return rc;
164 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
165 if (RT_FAILURE(rc))
166 return rc;
167#ifdef VBOX_WITH_AHCI
168 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
169 if (RT_FAILURE(rc))
170 return rc;
171#endif
172#ifdef VBOX_WITH_BUSLOGIC
173 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
174 if (RT_FAILURE(rc))
175 return rc;
176#endif
177 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
178 if (RT_FAILURE(rc))
179 return rc;
180#ifdef VBOX_WITH_LSILOGIC
181 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
182 if (RT_FAILURE(rc))
183 return rc;
184#endif
185
186 return VINF_SUCCESS;
187}
188
189
190/**
191 * Register builtin drivers.
192 *
193 * @returns VBox status code.
194 * @param pCallbacks Pointer to the callback table.
195 * @param u32Version VBox version number.
196 */
197extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
198{
199 LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
200 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
201
202 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
203 if (RT_FAILURE(rc))
204 return rc;
205 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
206 if (RT_FAILURE(rc))
207 return rc;
208 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
209 if (RT_FAILURE(rc))
210 return rc;
211 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
212 if (RT_FAILURE(rc))
213 return rc;
214#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
215 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
216 if (RT_FAILURE(rc))
217 return rc;
218#endif
219#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
220 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
221 if (RT_FAILURE(rc))
222 return rc;
223#endif
224 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
225 if (RT_FAILURE(rc))
226 return rc;
227 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
228 if (RT_FAILURE(rc))
229 return rc;
230#ifndef RT_OS_L4
231 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
232 if (RT_FAILURE(rc))
233 return rc;
234#endif
235#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
236 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
237 if (RT_FAILURE(rc))
238 return rc;
239#endif
240#ifdef VBOX_WITH_VDE
241 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
242 if (RT_FAILURE(rc))
243 return rc;
244#endif
245 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
246 if (RT_FAILURE(rc))
247 return rc;
248 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
249 if (RT_FAILURE(rc))
250 return rc;
251 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
252 if (RT_FAILURE(rc))
253 return rc;
254 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
255 if (RT_FAILURE(rc))
256 return rc;
257 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
258 if (RT_FAILURE(rc))
259 return rc;
260
261#ifdef VBOX_WITH_VUSB
262 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
263 if (RT_FAILURE(rc))
264 return rc;
265#endif
266
267#if !defined(RT_OS_L4)
268 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
269 if (RT_FAILURE(rc))
270 return rc;
271 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
272 if (RT_FAILURE(rc))
273 return rc;
274 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
275 if (RT_FAILURE(rc))
276 return rc;
277#endif
278
279#if defined(RT_OS_LINUX)
280 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
281 if (RT_FAILURE(rc))
282 return rc;
283#endif
284
285#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
286 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
287 if (RT_FAILURE(rc))
288 return rc;
289#endif
290
291#ifdef VBOX_WITH_SCSI
292 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
293 if (RT_FAILURE(rc))
294 return rc;
295
296# if defined(RT_OS_LINUX)
297 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
298 if (RT_FAILURE(rc))
299 return rc;
300# endif
301
302#endif
303
304#ifdef VBOX_WITH_DRV_DISK_INTEGRITY
305 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
306 if (RT_FAILURE(rc))
307 return rc;
308#endif
309
310 return VINF_SUCCESS;
311}
312
313
314/**
315 * Register builtin USB device.
316 *
317 * @returns VBox status code.
318 * @param pCallbacks Pointer to the callback table.
319 * @param u32Version VBox version number.
320 */
321extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
322{
323 int rc = VINF_SUCCESS;
324
325#ifdef VBOX_WITH_USB
326 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
327 if (RT_FAILURE(rc))
328 return rc;
329
330# ifdef VBOX_WITH_SCSI
331 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
332 if (RT_FAILURE(rc))
333 return rc;
334# endif
335#endif
336
337#ifdef VBOX_WITH_VUSB
338 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
339 if (RT_FAILURE(rc))
340 return rc;
341
342 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
343 if (RT_FAILURE(rc))
344 return rc;
345#endif
346
347 return rc;
348}
349
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