VirtualBox

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

Last change on this file since 85938 was 85816, checked in by vboxsync, 4 years ago

AMD IOMMU: bugref:9654 PDM device registration.

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