VirtualBox

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

Last change on this file since 78331 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.3 KB
Line 
1/* $Id: VBoxDD.cpp 76553 2019-01-01 01:45:53Z 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#ifdef VBOX_ACPI
149 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
150 if (RT_FAILURE(rc))
151 return rc;
152#endif
153 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
154 if (RT_FAILURE(rc))
155 return rc;
156 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
157 if (RT_FAILURE(rc))
158 return rc;
159 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
160 if (RT_FAILURE(rc))
161 return rc;
162 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOxPcie958);
163 if (RT_FAILURE(rc))
164 return rc;
165 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
166 if (RT_FAILURE(rc))
167 return rc;
168#ifdef VBOX_WITH_AHCI
169 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
170 if (RT_FAILURE(rc))
171 return rc;
172#endif
173#ifdef VBOX_WITH_BUSLOGIC
174 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
175 if (RT_FAILURE(rc))
176 return rc;
177#endif
178 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
179 if (RT_FAILURE(rc))
180 return rc;
181 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciIch9Bridge);
182 if (RT_FAILURE(rc))
183 return rc;
184#ifdef VBOX_WITH_LSILOGIC
185 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
186 if (RT_FAILURE(rc))
187 return rc;
188 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSAS);
189 if (RT_FAILURE(rc))
190 return rc;
191#endif
192#ifdef VBOX_WITH_NVME_IMPL
193 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceNVMe);
194 if (RT_FAILURE(rc))
195 return rc;
196#endif
197#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
198 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciRaw);
199 if (RT_FAILURE(rc))
200 return rc;
201#endif
202 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceGIMDev);
203 if (RT_FAILURE(rc))
204 return rc;
205#ifdef VBOX_WITH_NEW_LPC_DEVICE
206 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLPC);
207 if (RT_FAILURE(rc))
208 return rc;
209#endif
210#ifdef VBOX_WITH_VIRTUALKD
211 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtualKD);
212 if (RT_FAILURE(rc))
213 return rc;
214#endif
215
216 return VINF_SUCCESS;
217}
218
219
220/**
221 * Register builtin drivers.
222 *
223 * @returns VBox status code.
224 * @param pCallbacks Pointer to the callback table.
225 * @param u32Version VBox version number.
226 */
227extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
228{
229 LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
230 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
231
232 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
233 if (RT_FAILURE(rc))
234 return rc;
235 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
236 if (RT_FAILURE(rc))
237 return rc;
238 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
239 if (RT_FAILURE(rc))
240 return rc;
241#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
242 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
243 if (RT_FAILURE(rc))
244 return rc;
245#endif
246#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
247 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
248 if (RT_FAILURE(rc))
249 return rc;
250#endif
251 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
252 if (RT_FAILURE(rc))
253 return rc;
254#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
255 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
256 if (RT_FAILURE(rc))
257 return rc;
258#endif
259#ifdef VBOX_WITH_UDPTUNNEL
260 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDPTunnel);
261 if (RT_FAILURE(rc))
262 return rc;
263#endif
264#ifdef VBOX_WITH_VDE
265 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
266 if (RT_FAILURE(rc))
267 return rc;
268#endif
269 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
270 if (RT_FAILURE(rc))
271 return rc;
272 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
273 if (RT_FAILURE(rc))
274 return rc;
275 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
276 if (RT_FAILURE(rc))
277 return rc;
278#ifdef VBOX_WITH_NETSHAPER
279 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetShaper);
280 if (RT_FAILURE(rc))
281 return rc;
282#endif
283 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
284 if (RT_FAILURE(rc))
285 return rc;
286#ifdef VBOX_WITH_AUDIO_DEBUG
287 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDebugAudio);
288 if (RT_FAILURE(rc))
289 return rc;
290#endif
291#ifdef VBOX_WITH_AUDIO_VALIDATIONKIT
292 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostValidationKitAudio);
293 if (RT_FAILURE(rc))
294 return rc;
295#endif
296 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostNullAudio);
297 if (RT_FAILURE(rc))
298 return rc;
299#if defined(RT_OS_WINDOWS)
300 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDSound);
301 if (RT_FAILURE(rc))
302 return rc;
303#endif
304#if defined(RT_OS_DARWIN)
305 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostCoreAudio);
306 if (RT_FAILURE(rc))
307 return rc;
308#endif
309#ifdef VBOX_WITH_AUDIO_ALSA
310 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostALSAAudio);
311 if (RT_FAILURE(rc))
312 return rc;
313#endif
314#ifdef VBOX_WITH_AUDIO_OSS
315 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
316 if (RT_FAILURE(rc))
317 return rc;
318#endif
319#ifdef VBOX_WITH_AUDIO_PULSE
320 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostPulseAudio);
321 if (RT_FAILURE(rc))
322 return rc;
323#endif
324 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
325 if (RT_FAILURE(rc))
326 return rc;
327 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
328 if (RT_FAILURE(rc))
329 return rc;
330#ifdef VBOX_WITH_VUSB
331 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
332 if (RT_FAILURE(rc))
333 return rc;
334#endif
335#ifdef VBOX_WITH_USB_VIDEO_IMPL
336 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostWebcam);
337 if (RT_FAILURE(rc))
338 return rc;
339#endif
340 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
341 if (RT_FAILURE(rc))
342 return rc;
343 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTCP);
344 if (RT_FAILURE(rc))
345 return rc;
346 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDP);
347 if (RT_FAILURE(rc))
348 return rc;
349 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
350 if (RT_FAILURE(rc))
351 return rc;
352 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
353 if (RT_FAILURE(rc))
354 return rc;
355#if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
356 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
357 if (RT_FAILURE(rc))
358 return rc;
359#endif
360#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
361 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
362 if (RT_FAILURE(rc))
363 return rc;
364#endif
365#ifdef VBOX_WITH_SCSI
366 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
367 if (RT_FAILURE(rc))
368 return rc;
369#endif
370#ifdef VBOX_WITH_DRV_DISK_INTEGRITY
371 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
372 if (RT_FAILURE(rc))
373 return rc;
374
375 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRamDisk);
376 if (RT_FAILURE(rc))
377 return rc;
378#endif
379#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
380 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvPciRaw);
381 if (RT_FAILURE(rc))
382 return rc;
383#endif
384
385 return VINF_SUCCESS;
386}
387
388
389/**
390 * Register builtin USB device.
391 *
392 * @returns VBox status code.
393 * @param pCallbacks Pointer to the callback table.
394 * @param u32Version VBox version number.
395 */
396extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
397{
398 int rc = VINF_SUCCESS;
399 RT_NOREF1(u32Version);
400
401#ifdef VBOX_WITH_USB
402 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
403 if (RT_FAILURE(rc))
404 return rc;
405# ifdef VBOX_WITH_SCSI
406 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
407 if (RT_FAILURE(rc))
408 return rc;
409# endif
410#endif
411#ifdef VBOX_WITH_VUSB
412 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
413 if (RT_FAILURE(rc))
414 return rc;
415 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
416 if (RT_FAILURE(rc))
417 return rc;
418#endif
419#ifdef VBOX_WITH_USB_VIDEO_IMPL
420 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevWebcam);
421 if (RT_FAILURE(rc))
422 return rc;
423#endif
424
425 return rc;
426}
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