VirtualBox

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

Last change on this file since 90802 was 90530, checked in by vboxsync, 3 years ago

Devices/Security: Start implementation of a TPM driver talking to the software TPM emulator (swtpm) over TCP, bugref:10075

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