VirtualBox

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

Last change on this file since 20038 was 19968, checked in by vboxsync, 16 years ago

HostDVD: Add basic support for FreeBSD. Passthrough is working quite well so far.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.7 KB
Line 
1/* $Id: Builtins.cpp 19968 2009-05-24 12:14:19Z vboxsync $ */
2/** @file
3 * Built-in drivers & devices (part 1)
4 */
5
6/*
7 * Copyright (C) 2006-2008 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_INIP
122 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
123 if (RT_FAILURE(rc))
124 return rc;
125#endif
126 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
127 if (RT_FAILURE(rc))
128 return rc;
129 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
130 if (RT_FAILURE(rc))
131 return rc;
132 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
133 if (RT_FAILURE(rc))
134 return rc;
135#ifdef VBOX_WITH_USB
136 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
137 if (RT_FAILURE(rc))
138 return rc;
139#endif
140#ifdef VBOX_WITH_EHCI
141 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
142 if (RT_FAILURE(rc))
143 return rc;
144#endif
145#ifdef VBOX_ACPI
146 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
147 if (RT_FAILURE(rc))
148 return rc;
149#endif
150 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
151 if (RT_FAILURE(rc))
152 return rc;
153 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
154 if (RT_FAILURE(rc))
155 return rc;
156 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
157 if (RT_FAILURE(rc))
158 return rc;
159 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
160 if (RT_FAILURE(rc))
161 return rc;
162#ifdef VBOX_WITH_AHCI
163 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
164 if (RT_FAILURE(rc))
165 return rc;
166#endif
167#ifdef VBOX_WITH_BUSLOGIC
168 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
169 if (RT_FAILURE(rc))
170 return rc;
171#endif
172 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
173 if (RT_FAILURE(rc))
174 return rc;
175#ifdef VBOX_WITH_LSILOGIC
176 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
177 if (VBOX_FAILURE(rc))
178 return rc;
179#endif
180
181 return VINF_SUCCESS;
182}
183
184
185/**
186 * Register builtin drivers.
187 *
188 * @returns VBox status code.
189 * @param pCallbacks Pointer to the callback table.
190 * @param u32Version VBox version number.
191 */
192extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
193{
194 LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
195 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
196
197 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
198 if (RT_FAILURE(rc))
199 return rc;
200 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
201 if (RT_FAILURE(rc))
202 return rc;
203 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
204 if (RT_FAILURE(rc))
205 return rc;
206 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
207 if (RT_FAILURE(rc))
208 return rc;
209#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
210 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
211 if (RT_FAILURE(rc))
212 return rc;
213#endif
214#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
215 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
216 if (RT_FAILURE(rc))
217 return rc;
218#endif
219 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
220 if (RT_FAILURE(rc))
221 return rc;
222 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
223 if (RT_FAILURE(rc))
224 return rc;
225#ifndef RT_OS_L4
226 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
227 if (RT_FAILURE(rc))
228 return rc;
229#endif
230#if defined(RT_OS_LINUX)
231 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
232 if (RT_FAILURE(rc))
233 return rc;
234#endif
235 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
236 if (RT_FAILURE(rc))
237 return rc;
238 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
239 if (RT_FAILURE(rc))
240 return rc;
241 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
242 if (RT_FAILURE(rc))
243 return rc;
244 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
245 if (RT_FAILURE(rc))
246 return rc;
247
248#ifdef VBOX_WITH_USB
249 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
250 if (RT_FAILURE(rc))
251 return rc;
252#endif
253
254#if !defined(RT_OS_L4)
255 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
256 if (RT_FAILURE(rc))
257 return rc;
258 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
259 if (RT_FAILURE(rc))
260 return rc;
261 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
262 if (RT_FAILURE(rc))
263 return rc;
264#endif
265
266#if defined(RT_OS_LINUX)
267 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
268 if (RT_FAILURE(rc))
269 return rc;
270#endif
271
272#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
273 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
274 if (RT_FAILURE(rc))
275 return rc;
276#endif
277
278#if defined(VBOX_WITH_PDM_ASYNC_COMPLETION)
279 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImageAsync);
280 if (RT_FAILURE(rc))
281 return rc;
282
283 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTransportAsync);
284 if (RT_FAILURE(rc))
285 return rc;
286#endif
287#ifdef VBOX_WITH_SCSI
288 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
289 if (RT_FAILURE(rc))
290 return rc;
291
292#if defined(RT_OS_LINUX)
293 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
294 if (RT_FAILURE(rc))
295 return rc;
296#endif
297#endif
298
299#ifdef VBOX_WITH_FAULT_INJECTION
300 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvFaultInject);
301 if (RT_FAILURE(rc))
302 return rc;
303#endif
304
305 return VINF_SUCCESS;
306}
307
308
309#ifdef VBOX_WITH_USB
310/**
311 * Register builtin USB device.
312 *
313 * @returns VBox status code.
314 * @param pCallbacks Pointer to the callback table.
315 * @param u32Version VBox version number.
316 */
317extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
318{
319 int rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
320 if (RT_FAILURE(rc))
321 return rc;
322
323 return VINF_SUCCESS;
324}
325#endif
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