VirtualBox

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

Last change on this file since 88956 was 88626, checked in by vboxsync, 4 years ago

DrvHostAudioWasApi: Early WASAPI backend. bugref:9890

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.1 KB
Line 
1/* $Id: VBoxDD.cpp 88626 2021-04-21 09:58:08Z 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
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 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
303 if (RT_FAILURE(rc))
304 return rc;
305#ifdef VBOX_WITH_AUDIO_DEBUG
306 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDebugAudio);
307 if (RT_FAILURE(rc))
308 return rc;
309#endif
310#ifdef VBOX_WITH_AUDIO_VALIDATIONKIT
311 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostValidationKitAudio);
312 if (RT_FAILURE(rc))
313 return rc;
314#endif
315 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostNullAudio);
316 if (RT_FAILURE(rc))
317 return rc;
318#if defined(RT_OS_WINDOWS)
319 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDSound);
320 if (RT_FAILURE(rc))
321 return rc;
322 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostAudioWas);
323 if (RT_FAILURE(rc))
324 return rc;
325#endif
326#if defined(RT_OS_DARWIN)
327 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostCoreAudio);
328 if (RT_FAILURE(rc))
329 return rc;
330#endif
331#ifdef VBOX_WITH_AUDIO_ALSA
332 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostALSAAudio);
333 if (RT_FAILURE(rc))
334 return rc;
335#endif
336#ifdef VBOX_WITH_AUDIO_OSS
337 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
338 if (RT_FAILURE(rc))
339 return rc;
340#endif
341#ifdef VBOX_WITH_AUDIO_PULSE
342 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostPulseAudio);
343 if (RT_FAILURE(rc))
344 return rc;
345#endif
346 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
347 if (RT_FAILURE(rc))
348 return rc;
349 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
350 if (RT_FAILURE(rc))
351 return rc;
352#ifdef VBOX_WITH_VUSB
353 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
354 if (RT_FAILURE(rc))
355 return rc;
356#endif
357#ifdef VBOX_WITH_USB_VIDEO_IMPL
358 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostWebcam);
359 if (RT_FAILURE(rc))
360 return rc;
361#endif
362 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
363 if (RT_FAILURE(rc))
364 return rc;
365 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTCP);
366 if (RT_FAILURE(rc))
367 return rc;
368 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDP);
369 if (RT_FAILURE(rc))
370 return rc;
371 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
372 if (RT_FAILURE(rc))
373 return rc;
374 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
375 if (RT_FAILURE(rc))
376 return rc;
377#if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
378 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
379 if (RT_FAILURE(rc))
380 return rc;
381#endif
382#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
383 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
384 if (RT_FAILURE(rc))
385 return rc;
386#endif
387#ifdef VBOX_WITH_SCSI
388 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
389 if (RT_FAILURE(rc))
390 return rc;
391#endif
392#ifdef VBOX_WITH_DRV_DISK_INTEGRITY
393 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
394 if (RT_FAILURE(rc))
395 return rc;
396
397 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRamDisk);
398 if (RT_FAILURE(rc))
399 return rc;
400#endif
401#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
402 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvPciRaw);
403 if (RT_FAILURE(rc))
404 return rc;
405#endif
406 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIfTrace);
407 if (RT_FAILURE(rc))
408 return rc;
409
410 return VINF_SUCCESS;
411}
412
413
414/**
415 * Register builtin USB device.
416 *
417 * @returns VBox status code.
418 * @param pCallbacks Pointer to the callback table.
419 * @param u32Version VBox version number.
420 */
421extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
422{
423 int rc = VINF_SUCCESS;
424 RT_NOREF1(u32Version);
425
426#ifdef VBOX_WITH_USB
427 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
428 if (RT_FAILURE(rc))
429 return rc;
430# ifdef VBOX_WITH_SCSI
431 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
432 if (RT_FAILURE(rc))
433 return rc;
434# endif
435#endif
436#ifdef VBOX_WITH_VUSB
437 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
438 if (RT_FAILURE(rc))
439 return rc;
440 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
441 if (RT_FAILURE(rc))
442 return rc;
443#endif
444#ifdef VBOX_WITH_USB_VIDEO_IMPL
445 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevWebcam);
446 if (RT_FAILURE(rc))
447 return rc;
448#endif
449
450 return rc;
451}
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