VirtualBox

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

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

Template virtio SCSI driver builds. Controller configurable in GUI.

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