VirtualBox

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

Last change on this file since 86147 was 86032, checked in by vboxsync, 4 years ago

Devices/DevQemuFwCfg: Add device emulation implementing QEMUs firmware configuration interface to load a Linux

kernel into the guest from the host and boot it when EFI is enabled for a VM without
requiring a guest OS installation. See Doxygen documentation on how to configure it.

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