VirtualBox

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

Last change on this file since 92973 was 91416, checked in by vboxsync, 3 years ago

Devices: bugref:9932 DrvVMNet and host-only network initial implementation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.8 KB
Line 
1/* $Id: VBoxDD.cpp 91416 2021-09-28 06:15:49Z 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 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLPC);
214 if (RT_FAILURE(rc))
215 return rc;
216#ifdef VBOX_WITH_VIRTUALKD
217 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtualKD);
218 if (RT_FAILURE(rc))
219 return rc;
220#endif
221#ifdef VBOX_WITH_IOMMU_AMD
222 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceIommuAmd);
223 if (RT_FAILURE(rc))
224 return rc;
225#endif
226#ifdef VBOX_WITH_IOMMU_INTEL
227 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceIommuIntel);
228 if (RT_FAILURE(rc))
229 return rc;
230#endif
231 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceQemuFwCfg);
232 if (RT_FAILURE(rc))
233 return rc;
234#ifdef VBOX_WITH_TPM
235 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceTpm);
236 if (RT_FAILURE(rc))
237 return rc;
238#endif
239
240 return VINF_SUCCESS;
241}
242
243
244/**
245 * Register builtin drivers.
246 *
247 * @returns VBox status code.
248 * @param pCallbacks Pointer to the callback table.
249 * @param u32Version VBox version number.
250 */
251extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
252{
253 LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
254 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
255
256 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
257 if (RT_FAILURE(rc))
258 return rc;
259 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
260 if (RT_FAILURE(rc))
261 return rc;
262 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
263 if (RT_FAILURE(rc))
264 return rc;
265#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
266 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
267 if (RT_FAILURE(rc))
268 return rc;
269#endif
270#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
271 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
272 if (RT_FAILURE(rc))
273 return rc;
274#endif
275 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
276 if (RT_FAILURE(rc))
277 return rc;
278#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
279 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
280 if (RT_FAILURE(rc))
281 return rc;
282#endif
283#ifdef VBOX_WITH_UDPTUNNEL
284 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDPTunnel);
285 if (RT_FAILURE(rc))
286 return rc;
287#endif
288#ifdef VBOX_WITH_VDE
289 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
290 if (RT_FAILURE(rc))
291 return rc;
292#endif
293 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
294 if (RT_FAILURE(rc))
295 return rc;
296 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
297 if (RT_FAILURE(rc))
298 return rc;
299 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
300 if (RT_FAILURE(rc))
301 return rc;
302#ifdef VBOX_WITH_NETSHAPER
303 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetShaper);
304 if (RT_FAILURE(rc))
305 return rc;
306#endif
307#ifdef VBOX_WITH_VMNET
308 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVMNet);
309 if (RT_FAILURE(rc))
310 return rc;
311#endif /* VBOX_WITH_VMNET */
312 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
313 if (RT_FAILURE(rc))
314 return rc;
315#ifdef VBOX_WITH_AUDIO_DEBUG
316 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDebugAudio);
317 if (RT_FAILURE(rc))
318 return rc;
319#endif
320#ifdef VBOX_WITH_AUDIO_VALIDATIONKIT
321 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostValidationKitAudio);
322 if (RT_FAILURE(rc))
323 return rc;
324#endif
325 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostNullAudio);
326 if (RT_FAILURE(rc))
327 return rc;
328#if defined(RT_OS_WINDOWS)
329 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDSound);
330 if (RT_FAILURE(rc))
331 return rc;
332 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostAudioWas);
333 if (RT_FAILURE(rc))
334 return rc;
335#endif
336#if defined(RT_OS_DARWIN)
337 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostCoreAudio);
338 if (RT_FAILURE(rc))
339 return rc;
340#endif
341#ifdef VBOX_WITH_AUDIO_ALSA
342 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostALSAAudio);
343 if (RT_FAILURE(rc))
344 return rc;
345#endif
346#ifdef VBOX_WITH_AUDIO_OSS
347 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
348 if (RT_FAILURE(rc))
349 return rc;
350#endif
351#ifdef VBOX_WITH_AUDIO_PULSE
352 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostPulseAudio);
353 if (RT_FAILURE(rc))
354 return rc;
355#endif
356 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
357 if (RT_FAILURE(rc))
358 return rc;
359 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
360 if (RT_FAILURE(rc))
361 return rc;
362#ifdef VBOX_WITH_VUSB
363 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
364 if (RT_FAILURE(rc))
365 return rc;
366#endif
367#ifdef VBOX_WITH_USB_VIDEO_IMPL
368 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostWebcam);
369 if (RT_FAILURE(rc))
370 return rc;
371#endif
372 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
373 if (RT_FAILURE(rc))
374 return rc;
375 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTCP);
376 if (RT_FAILURE(rc))
377 return rc;
378 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDP);
379 if (RT_FAILURE(rc))
380 return rc;
381 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
382 if (RT_FAILURE(rc))
383 return rc;
384 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
385 if (RT_FAILURE(rc))
386 return rc;
387#if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
388 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
389 if (RT_FAILURE(rc))
390 return rc;
391#endif
392#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
393 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
394 if (RT_FAILURE(rc))
395 return rc;
396#endif
397#ifdef VBOX_WITH_SCSI
398 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
399 if (RT_FAILURE(rc))
400 return rc;
401#endif
402#ifdef VBOX_WITH_DRV_DISK_INTEGRITY
403 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
404 if (RT_FAILURE(rc))
405 return rc;
406
407 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRamDisk);
408 if (RT_FAILURE(rc))
409 return rc;
410#endif
411#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
412 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvPciRaw);
413 if (RT_FAILURE(rc))
414 return rc;
415#endif
416 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIfTrace);
417 if (RT_FAILURE(rc))
418 return rc;
419#ifdef VBOX_WITH_TPM
420 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTpmEmu);
421 if (RT_FAILURE(rc))
422 return rc;
423
424# ifdef RT_OS_LINUX
425 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTpmHost);
426 if (RT_FAILURE(rc))
427 return rc;
428# endif
429
430# ifdef VBOX_WITH_LIBTPMS
431 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTpmEmuTpms);
432 if (RT_FAILURE(rc))
433 return rc;
434# endif
435#endif
436
437 return VINF_SUCCESS;
438}
439
440
441/**
442 * Register builtin USB device.
443 *
444 * @returns VBox status code.
445 * @param pCallbacks Pointer to the callback table.
446 * @param u32Version VBox version number.
447 */
448extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
449{
450 int rc = VINF_SUCCESS;
451 RT_NOREF1(u32Version);
452
453#ifdef VBOX_WITH_USB
454 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
455 if (RT_FAILURE(rc))
456 return rc;
457# ifdef VBOX_WITH_SCSI
458 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
459 if (RT_FAILURE(rc))
460 return rc;
461# endif
462#endif
463#ifdef VBOX_WITH_VUSB
464 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
465 if (RT_FAILURE(rc))
466 return rc;
467 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
468 if (RT_FAILURE(rc))
469 return rc;
470#endif
471#ifdef VBOX_WITH_USB_VIDEO_IMPL
472 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevWebcam);
473 if (RT_FAILURE(rc))
474 return rc;
475#endif
476
477 return rc;
478}
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