VirtualBox

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

Last change on this file since 94991 was 93560, checked in by vboxsync, 3 years ago

Added emulation of several classic Ethernet adapters.

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