VirtualBox

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

Last change on this file since 82463 was 80531, checked in by vboxsync, 5 years ago

VMM,Devices: Some PDM device model refactoring. bugref:9218

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.4 KB
Line 
1/* $Id: VBoxDD.cpp 80531 2019-09-01 23:03:34Z vboxsync $ */
2/** @file
3 * VBoxDD - Built-in drivers & devices (part 1).
4 */
5
6/*
7 * Copyright (C) 2006-2019 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#ifdef VBOX_WITH_NEW_LPC_DEVICE
209 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLPC);
210 if (RT_FAILURE(rc))
211 return rc;
212#endif
213#ifdef VBOX_WITH_VIRTUALKD
214 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtualKD);
215 if (RT_FAILURE(rc))
216 return rc;
217#endif
218
219 return VINF_SUCCESS;
220}
221
222
223/**
224 * Register builtin drivers.
225 *
226 * @returns VBox status code.
227 * @param pCallbacks Pointer to the callback table.
228 * @param u32Version VBox version number.
229 */
230extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
231{
232 LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
233 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
234
235 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
236 if (RT_FAILURE(rc))
237 return rc;
238 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
239 if (RT_FAILURE(rc))
240 return rc;
241 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
242 if (RT_FAILURE(rc))
243 return rc;
244#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
245 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
246 if (RT_FAILURE(rc))
247 return rc;
248#endif
249#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
250 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
251 if (RT_FAILURE(rc))
252 return rc;
253#endif
254 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
255 if (RT_FAILURE(rc))
256 return rc;
257#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
258 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
259 if (RT_FAILURE(rc))
260 return rc;
261#endif
262#ifdef VBOX_WITH_UDPTUNNEL
263 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDPTunnel);
264 if (RT_FAILURE(rc))
265 return rc;
266#endif
267#ifdef VBOX_WITH_VDE
268 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
269 if (RT_FAILURE(rc))
270 return rc;
271#endif
272 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
273 if (RT_FAILURE(rc))
274 return rc;
275 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
276 if (RT_FAILURE(rc))
277 return rc;
278 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
279 if (RT_FAILURE(rc))
280 return rc;
281#ifdef VBOX_WITH_NETSHAPER
282 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetShaper);
283 if (RT_FAILURE(rc))
284 return rc;
285#endif
286 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
287 if (RT_FAILURE(rc))
288 return rc;
289#ifdef VBOX_WITH_AUDIO_DEBUG
290 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDebugAudio);
291 if (RT_FAILURE(rc))
292 return rc;
293#endif
294#ifdef VBOX_WITH_AUDIO_VALIDATIONKIT
295 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostValidationKitAudio);
296 if (RT_FAILURE(rc))
297 return rc;
298#endif
299 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostNullAudio);
300 if (RT_FAILURE(rc))
301 return rc;
302#if defined(RT_OS_WINDOWS)
303 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDSound);
304 if (RT_FAILURE(rc))
305 return rc;
306#endif
307#if defined(RT_OS_DARWIN)
308 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostCoreAudio);
309 if (RT_FAILURE(rc))
310 return rc;
311#endif
312#ifdef VBOX_WITH_AUDIO_ALSA
313 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostALSAAudio);
314 if (RT_FAILURE(rc))
315 return rc;
316#endif
317#ifdef VBOX_WITH_AUDIO_OSS
318 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
319 if (RT_FAILURE(rc))
320 return rc;
321#endif
322#ifdef VBOX_WITH_AUDIO_PULSE
323 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostPulseAudio);
324 if (RT_FAILURE(rc))
325 return rc;
326#endif
327 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
328 if (RT_FAILURE(rc))
329 return rc;
330 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
331 if (RT_FAILURE(rc))
332 return rc;
333#ifdef VBOX_WITH_VUSB
334 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
335 if (RT_FAILURE(rc))
336 return rc;
337#endif
338#ifdef VBOX_WITH_USB_VIDEO_IMPL
339 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostWebcam);
340 if (RT_FAILURE(rc))
341 return rc;
342#endif
343 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
344 if (RT_FAILURE(rc))
345 return rc;
346 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTCP);
347 if (RT_FAILURE(rc))
348 return rc;
349 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDP);
350 if (RT_FAILURE(rc))
351 return rc;
352 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
353 if (RT_FAILURE(rc))
354 return rc;
355 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
356 if (RT_FAILURE(rc))
357 return rc;
358#if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
359 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
360 if (RT_FAILURE(rc))
361 return rc;
362#endif
363#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
364 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
365 if (RT_FAILURE(rc))
366 return rc;
367#endif
368#ifdef VBOX_WITH_SCSI
369 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
370 if (RT_FAILURE(rc))
371 return rc;
372#endif
373#ifdef VBOX_WITH_DRV_DISK_INTEGRITY
374 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
375 if (RT_FAILURE(rc))
376 return rc;
377
378 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRamDisk);
379 if (RT_FAILURE(rc))
380 return rc;
381#endif
382#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
383 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvPciRaw);
384 if (RT_FAILURE(rc))
385 return rc;
386#endif
387
388 return VINF_SUCCESS;
389}
390
391
392/**
393 * Register builtin USB device.
394 *
395 * @returns VBox status code.
396 * @param pCallbacks Pointer to the callback table.
397 * @param u32Version VBox version number.
398 */
399extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
400{
401 int rc = VINF_SUCCESS;
402 RT_NOREF1(u32Version);
403
404#ifdef VBOX_WITH_USB
405 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
406 if (RT_FAILURE(rc))
407 return rc;
408# ifdef VBOX_WITH_SCSI
409 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
410 if (RT_FAILURE(rc))
411 return rc;
412# endif
413#endif
414#ifdef VBOX_WITH_VUSB
415 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
416 if (RT_FAILURE(rc))
417 return rc;
418 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
419 if (RT_FAILURE(rc))
420 return rc;
421#endif
422#ifdef VBOX_WITH_USB_VIDEO_IMPL
423 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevWebcam);
424 if (RT_FAILURE(rc))
425 return rc;
426#endif
427
428 return rc;
429}
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