VirtualBox

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

Last change on this file since 93466 was 93312, checked in by vboxsync, 3 years ago

CloudNet: ​bugref:9469 Replace local gateway with DrvCloudTunnel. Build 25519 encryption support in libssh. Add missing version bump in machine settings to 1.18 if cloud attachment is used.

  • 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 93312 2022-01-18 13:15:12Z vboxsync $ */
2/** @file
3 * VBoxDD - Built-in drivers & devices (part 1).
4 */
5
6/*
7 * Copyright (C) 2006-2022 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_INIP
120 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
121 if (RT_FAILURE(rc))
122 return rc;
123#endif
124 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
125 if (RT_FAILURE(rc))
126 return rc;
127 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
128 if (RT_FAILURE(rc))
129 return rc;
130 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHDA);
131 if (RT_FAILURE(rc))
132 return rc;
133#ifdef VBOX_WITH_VUSB
134 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
135 if (RT_FAILURE(rc))
136 return rc;
137#endif
138#ifdef VBOX_WITH_EHCI_IMPL
139 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
140 if (RT_FAILURE(rc))
141 return rc;
142#endif
143#ifdef VBOX_WITH_XHCI_IMPL
144 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceXHCI);
145 if (RT_FAILURE(rc))
146 return rc;
147#endif
148 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
149 if (RT_FAILURE(rc))
150 return rc;
151 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
152 if (RT_FAILURE(rc))
153 return rc;
154 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
155 if (RT_FAILURE(rc))
156 return rc;
157 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
158 if (RT_FAILURE(rc))
159 return rc;
160 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOxPcie958);
161 if (RT_FAILURE(rc))
162 return rc;
163 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
164 if (RT_FAILURE(rc))
165 return rc;
166#ifdef VBOX_WITH_AHCI
167 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
168 if (RT_FAILURE(rc))
169 return rc;
170#endif
171#ifdef VBOX_WITH_BUSLOGIC
172 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
173 if (RT_FAILURE(rc))
174 return rc;
175#endif
176 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
177 if (RT_FAILURE(rc))
178 return rc;
179 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciIch9Bridge);
180 if (RT_FAILURE(rc))
181 return rc;
182#ifdef VBOX_WITH_LSILOGIC
183 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
184 if (RT_FAILURE(rc))
185 return rc;
186 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSAS);
187 if (RT_FAILURE(rc))
188 return rc;
189#endif
190#ifdef VBOX_WITH_NVME_IMPL
191 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceNVMe);
192 if (RT_FAILURE(rc))
193 return rc;
194#endif
195#ifdef VBOX_WITH_VIRTIO_SCSI
196 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioSCSI);
197 if (RT_FAILURE(rc))
198 return rc;
199#endif
200#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
201 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciRaw);
202 if (RT_FAILURE(rc))
203 return rc;
204#endif
205 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceGIMDev);
206 if (RT_FAILURE(rc))
207 return rc;
208 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLPC);
209 if (RT_FAILURE(rc))
210 return rc;
211#ifdef VBOX_WITH_VIRTUALKD
212 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtualKD);
213 if (RT_FAILURE(rc))
214 return rc;
215#endif
216#ifdef VBOX_WITH_IOMMU_AMD
217 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceIommuAmd);
218 if (RT_FAILURE(rc))
219 return rc;
220#endif
221#ifdef VBOX_WITH_IOMMU_INTEL
222 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceIommuIntel);
223 if (RT_FAILURE(rc))
224 return rc;
225#endif
226 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceQemuFwCfg);
227 if (RT_FAILURE(rc))
228 return rc;
229#ifdef VBOX_WITH_TPM
230 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceTpm);
231 if (RT_FAILURE(rc))
232 return rc;
233#endif
234
235 return VINF_SUCCESS;
236}
237
238
239/**
240 * Register builtin drivers.
241 *
242 * @returns VBox status code.
243 * @param pCallbacks Pointer to the callback table.
244 * @param u32Version VBox version number.
245 */
246extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
247{
248 LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
249 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
250
251 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
252 if (RT_FAILURE(rc))
253 return rc;
254 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
255 if (RT_FAILURE(rc))
256 return rc;
257 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
258 if (RT_FAILURE(rc))
259 return rc;
260#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
261 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
262 if (RT_FAILURE(rc))
263 return rc;
264#endif
265#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
266 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
267 if (RT_FAILURE(rc))
268 return rc;
269#endif
270 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
271 if (RT_FAILURE(rc))
272 return rc;
273#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
274 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
275 if (RT_FAILURE(rc))
276 return rc;
277#endif
278#ifdef VBOX_WITH_UDPTUNNEL
279 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDPTunnel);
280 if (RT_FAILURE(rc))
281 return rc;
282#endif
283#ifdef VBOX_WITH_VDE
284 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
285 if (RT_FAILURE(rc))
286 return rc;
287#endif
288 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
289 if (RT_FAILURE(rc))
290 return rc;
291 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
292 if (RT_FAILURE(rc))
293 return rc;
294 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
295 if (RT_FAILURE(rc))
296 return rc;
297#ifdef VBOX_WITH_NETSHAPER
298 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetShaper);
299 if (RT_FAILURE(rc))
300 return rc;
301#endif
302#ifdef VBOX_WITH_VMNET
303 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVMNet);
304 if (RT_FAILURE(rc))
305 return rc;
306#endif /* VBOX_WITH_VMNET */
307 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
308 if (RT_FAILURE(rc))
309 return rc;
310#ifdef VBOX_WITH_AUDIO_DEBUG
311 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDebugAudio);
312 if (RT_FAILURE(rc))
313 return rc;
314#endif
315#ifdef VBOX_WITH_AUDIO_VALIDATIONKIT
316 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostValidationKitAudio);
317 if (RT_FAILURE(rc))
318 return rc;
319#endif
320 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostNullAudio);
321 if (RT_FAILURE(rc))
322 return rc;
323#if defined(RT_OS_WINDOWS)
324 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDSound);
325 if (RT_FAILURE(rc))
326 return rc;
327 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostAudioWas);
328 if (RT_FAILURE(rc))
329 return rc;
330#endif
331#if defined(RT_OS_DARWIN)
332 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostCoreAudio);
333 if (RT_FAILURE(rc))
334 return rc;
335#endif
336#ifdef VBOX_WITH_AUDIO_ALSA
337 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostALSAAudio);
338 if (RT_FAILURE(rc))
339 return rc;
340#endif
341#ifdef VBOX_WITH_AUDIO_OSS
342 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
343 if (RT_FAILURE(rc))
344 return rc;
345#endif
346#ifdef VBOX_WITH_AUDIO_PULSE
347 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostPulseAudio);
348 if (RT_FAILURE(rc))
349 return rc;
350#endif
351 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
352 if (RT_FAILURE(rc))
353 return rc;
354 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
355 if (RT_FAILURE(rc))
356 return rc;
357#ifdef VBOX_WITH_VUSB
358 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
359 if (RT_FAILURE(rc))
360 return rc;
361#endif
362#ifdef VBOX_WITH_USB_VIDEO_IMPL
363 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostWebcam);
364 if (RT_FAILURE(rc))
365 return rc;
366#endif
367 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
368 if (RT_FAILURE(rc))
369 return rc;
370 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTCP);
371 if (RT_FAILURE(rc))
372 return rc;
373 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDP);
374 if (RT_FAILURE(rc))
375 return rc;
376 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
377 if (RT_FAILURE(rc))
378 return rc;
379 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
380 if (RT_FAILURE(rc))
381 return rc;
382#if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
383 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
384 if (RT_FAILURE(rc))
385 return rc;
386#endif
387#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
388 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
389 if (RT_FAILURE(rc))
390 return rc;
391#endif
392#ifdef VBOX_WITH_SCSI
393 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
394 if (RT_FAILURE(rc))
395 return rc;
396#endif
397#ifdef VBOX_WITH_DRV_DISK_INTEGRITY
398 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
399 if (RT_FAILURE(rc))
400 return rc;
401
402 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRamDisk);
403 if (RT_FAILURE(rc))
404 return rc;
405#endif
406#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
407 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvPciRaw);
408 if (RT_FAILURE(rc))
409 return rc;
410#endif
411 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIfTrace);
412 if (RT_FAILURE(rc))
413 return rc;
414#ifdef VBOX_WITH_TPM
415 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTpmEmu);
416 if (RT_FAILURE(rc))
417 return rc;
418
419# ifdef RT_OS_LINUX
420 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTpmHost);
421 if (RT_FAILURE(rc))
422 return rc;
423# endif
424
425# ifdef VBOX_WITH_LIBTPMS
426 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTpmEmuTpms);
427 if (RT_FAILURE(rc))
428 return rc;
429# endif
430
431# ifdef VBOX_WITH_CLOUD_NET
432 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvCloudTunnel);
433 if (RT_FAILURE(rc))
434 return rc;
435# endif
436#endif
437
438 return VINF_SUCCESS;
439}
440
441
442/**
443 * Register builtin USB device.
444 *
445 * @returns VBox status code.
446 * @param pCallbacks Pointer to the callback table.
447 * @param u32Version VBox version number.
448 */
449extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
450{
451 int rc = VINF_SUCCESS;
452 RT_NOREF1(u32Version);
453
454#ifdef VBOX_WITH_USB
455 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
456 if (RT_FAILURE(rc))
457 return rc;
458# ifdef VBOX_WITH_SCSI
459 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
460 if (RT_FAILURE(rc))
461 return rc;
462# endif
463#endif
464#ifdef VBOX_WITH_VUSB
465 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
466 if (RT_FAILURE(rc))
467 return rc;
468 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
469 if (RT_FAILURE(rc))
470 return rc;
471#endif
472#ifdef VBOX_WITH_USB_VIDEO_IMPL
473 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevWebcam);
474 if (RT_FAILURE(rc))
475 return rc;
476#endif
477
478 return rc;
479}
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