VirtualBox

source: vbox/trunk/src/VBox/Devices/build/VBoxDD.cpp@ 84909

Last change on this file since 84909 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.7 KB
Line 
1/* $Id: VBoxDD.cpp 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * VBoxDD - Built-in drivers & devices (part 1).
4 */
5
6/*
7 * Copyright (C) 2006-2020 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/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22#define LOG_GROUP LOG_GROUP_DEV
23#include <VBox/vmm/pdm.h>
24#include <VBox/version.h>
25#include <iprt/errcore.h>
26#include <VBox/usb.h>
27
28#include <VBox/log.h>
29#include <iprt/assert.h>
30
31#include "VBoxDD.h"
32
33
34/*********************************************************************************************************************************
35* Global Variables *
36*********************************************************************************************************************************/
37const void *g_apvVBoxDDDependencies[] =
38{
39 NULL,
40};
41
42
43/**
44 * Register builtin devices.
45 *
46 * @returns VBox status code.
47 * @param pCallbacks Pointer to the callback table.
48 * @param u32Version VBox version number.
49 */
50extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
51{
52 LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
53 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
54 int rc;
55
56 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
57 if (RT_FAILURE(rc))
58 return rc;
59 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciIch9);
60 if (RT_FAILURE(rc))
61 return rc;
62 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch);
63 if (RT_FAILURE(rc))
64 return rc;
65 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios);
66 if (RT_FAILURE(rc))
67 return rc;
68 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceIOAPIC);
69 if (RT_FAILURE(rc))
70 return rc;
71 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse);
72 if (RT_FAILURE(rc))
73 return rc;
74 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
75 if (RT_FAILURE(rc))
76 return rc;
77 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
78 if (RT_FAILURE(rc))
79 return rc;
80 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
81 if (RT_FAILURE(rc))
82 return rc;
83 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHPET);
84 if (RT_FAILURE(rc))
85 return rc;
86 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSmc);
87 if (RT_FAILURE(rc))
88 return rc;
89 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFlash);
90 if (RT_FAILURE(rc))
91 return rc;
92#ifdef VBOX_WITH_EFI
93 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEFI);
94 if (RT_FAILURE(rc))
95 return rc;
96#endif
97 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
98 if (RT_FAILURE(rc))
99 return rc;
100 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
101 if (RT_FAILURE(rc))
102 return rc;
103 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
104 if (RT_FAILURE(rc))
105 return rc;
106 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
107 if (RT_FAILURE(rc))
108 return rc;
109#ifdef VBOX_WITH_E1000
110 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000);
111 if (RT_FAILURE(rc))
112 return rc;
113#endif
114#ifdef VBOX_WITH_VIRTIO
115 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioNet);
116 if (RT_FAILURE(rc))
117 return rc;
118#endif
119#ifdef VBOX_WITH_VIRTIO_NET_1_0
120 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioNet_1_0);
121 if (RT_FAILURE(rc))
122 return rc;
123#endif
124#ifdef VBOX_WITH_INIP
125 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
126 if (RT_FAILURE(rc))
127 return rc;
128#endif
129 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
130 if (RT_FAILURE(rc))
131 return rc;
132 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
133 if (RT_FAILURE(rc))
134 return rc;
135 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHDA);
136 if (RT_FAILURE(rc))
137 return rc;
138#ifdef VBOX_WITH_VUSB
139 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
140 if (RT_FAILURE(rc))
141 return rc;
142#endif
143#ifdef VBOX_WITH_EHCI_IMPL
144 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
145 if (RT_FAILURE(rc))
146 return rc;
147#endif
148#ifdef VBOX_WITH_XHCI_IMPL
149 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceXHCI);
150 if (RT_FAILURE(rc))
151 return rc;
152#endif
153 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
154 if (RT_FAILURE(rc))
155 return rc;
156 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
157 if (RT_FAILURE(rc))
158 return rc;
159 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
160 if (RT_FAILURE(rc))
161 return rc;
162 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
163 if (RT_FAILURE(rc))
164 return rc;
165 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOxPcie958);
166 if (RT_FAILURE(rc))
167 return rc;
168 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
169 if (RT_FAILURE(rc))
170 return rc;
171#ifdef VBOX_WITH_AHCI
172 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
173 if (RT_FAILURE(rc))
174 return rc;
175#endif
176#ifdef VBOX_WITH_BUSLOGIC
177 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
178 if (RT_FAILURE(rc))
179 return rc;
180#endif
181 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
182 if (RT_FAILURE(rc))
183 return rc;
184 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciIch9Bridge);
185 if (RT_FAILURE(rc))
186 return rc;
187#ifdef VBOX_WITH_LSILOGIC
188 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
189 if (RT_FAILURE(rc))
190 return rc;
191 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSAS);
192 if (RT_FAILURE(rc))
193 return rc;
194#endif
195#ifdef VBOX_WITH_NVME_IMPL
196 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceNVMe);
197 if (RT_FAILURE(rc))
198 return rc;
199#endif
200#ifdef VBOX_WITH_VIRTIO_SCSI
201 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioSCSI);
202 if (RT_FAILURE(rc))
203 return rc;
204#endif
205#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
206 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciRaw);
207 if (RT_FAILURE(rc))
208 return rc;
209#endif
210 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceGIMDev);
211 if (RT_FAILURE(rc))
212 return rc;
213#ifdef VBOX_WITH_NEW_LPC_DEVICE
214 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLPC);
215 if (RT_FAILURE(rc))
216 return rc;
217#endif
218#ifdef VBOX_WITH_VIRTUALKD
219 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtualKD);
220 if (RT_FAILURE(rc))
221 return rc;
222#endif
223
224 return VINF_SUCCESS;
225}
226
227
228/**
229 * Register builtin drivers.
230 *
231 * @returns VBox status code.
232 * @param pCallbacks Pointer to the callback table.
233 * @param u32Version VBox version number.
234 */
235extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
236{
237 LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
238 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
239
240 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
241 if (RT_FAILURE(rc))
242 return rc;
243 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
244 if (RT_FAILURE(rc))
245 return rc;
246 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
247 if (RT_FAILURE(rc))
248 return rc;
249#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
250 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
251 if (RT_FAILURE(rc))
252 return rc;
253#endif
254#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
255 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
256 if (RT_FAILURE(rc))
257 return rc;
258#endif
259 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
260 if (RT_FAILURE(rc))
261 return rc;
262#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
263 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
264 if (RT_FAILURE(rc))
265 return rc;
266#endif
267#ifdef VBOX_WITH_UDPTUNNEL
268 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDPTunnel);
269 if (RT_FAILURE(rc))
270 return rc;
271#endif
272#ifdef VBOX_WITH_VDE
273 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
274 if (RT_FAILURE(rc))
275 return rc;
276#endif
277 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
278 if (RT_FAILURE(rc))
279 return rc;
280 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
281 if (RT_FAILURE(rc))
282 return rc;
283 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
284 if (RT_FAILURE(rc))
285 return rc;
286#ifdef VBOX_WITH_NETSHAPER
287 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetShaper);
288 if (RT_FAILURE(rc))
289 return rc;
290#endif
291 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
292 if (RT_FAILURE(rc))
293 return rc;
294#ifdef VBOX_WITH_AUDIO_DEBUG
295 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDebugAudio);
296 if (RT_FAILURE(rc))
297 return rc;
298#endif
299#ifdef VBOX_WITH_AUDIO_VALIDATIONKIT
300 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostValidationKitAudio);
301 if (RT_FAILURE(rc))
302 return rc;
303#endif
304 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostNullAudio);
305 if (RT_FAILURE(rc))
306 return rc;
307#if defined(RT_OS_WINDOWS)
308 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDSound);
309 if (RT_FAILURE(rc))
310 return rc;
311#endif
312#if defined(RT_OS_DARWIN)
313 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostCoreAudio);
314 if (RT_FAILURE(rc))
315 return rc;
316#endif
317#ifdef VBOX_WITH_AUDIO_ALSA
318 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostALSAAudio);
319 if (RT_FAILURE(rc))
320 return rc;
321#endif
322#ifdef VBOX_WITH_AUDIO_OSS
323 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
324 if (RT_FAILURE(rc))
325 return rc;
326#endif
327#ifdef VBOX_WITH_AUDIO_PULSE
328 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostPulseAudio);
329 if (RT_FAILURE(rc))
330 return rc;
331#endif
332 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
333 if (RT_FAILURE(rc))
334 return rc;
335 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
336 if (RT_FAILURE(rc))
337 return rc;
338#ifdef VBOX_WITH_VUSB
339 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
340 if (RT_FAILURE(rc))
341 return rc;
342#endif
343#ifdef VBOX_WITH_USB_VIDEO_IMPL
344 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostWebcam);
345 if (RT_FAILURE(rc))
346 return rc;
347#endif
348 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
349 if (RT_FAILURE(rc))
350 return rc;
351 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTCP);
352 if (RT_FAILURE(rc))
353 return rc;
354 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDP);
355 if (RT_FAILURE(rc))
356 return rc;
357 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
358 if (RT_FAILURE(rc))
359 return rc;
360 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
361 if (RT_FAILURE(rc))
362 return rc;
363#if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
364 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
365 if (RT_FAILURE(rc))
366 return rc;
367#endif
368#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
369 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
370 if (RT_FAILURE(rc))
371 return rc;
372#endif
373#ifdef VBOX_WITH_SCSI
374 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
375 if (RT_FAILURE(rc))
376 return rc;
377#endif
378#ifdef VBOX_WITH_DRV_DISK_INTEGRITY
379 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
380 if (RT_FAILURE(rc))
381 return rc;
382
383 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRamDisk);
384 if (RT_FAILURE(rc))
385 return rc;
386#endif
387#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
388 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvPciRaw);
389 if (RT_FAILURE(rc))
390 return rc;
391#endif
392 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIfTrace);
393 if (RT_FAILURE(rc))
394 return rc;
395
396 return VINF_SUCCESS;
397}
398
399
400/**
401 * Register builtin USB device.
402 *
403 * @returns VBox status code.
404 * @param pCallbacks Pointer to the callback table.
405 * @param u32Version VBox version number.
406 */
407extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
408{
409 int rc = VINF_SUCCESS;
410 RT_NOREF1(u32Version);
411
412#ifdef VBOX_WITH_USB
413 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
414 if (RT_FAILURE(rc))
415 return rc;
416# ifdef VBOX_WITH_SCSI
417 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
418 if (RT_FAILURE(rc))
419 return rc;
420# endif
421#endif
422#ifdef VBOX_WITH_VUSB
423 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
424 if (RT_FAILURE(rc))
425 return rc;
426 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
427 if (RT_FAILURE(rc))
428 return rc;
429#endif
430#ifdef VBOX_WITH_USB_VIDEO_IMPL
431 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevWebcam);
432 if (RT_FAILURE(rc))
433 return rc;
434#endif
435
436 return rc;
437}
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