VirtualBox

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

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

Serial: Split out the generic UART functionality into a separate module so it can be reused.

Add a PCI Express 16 port UART controller emulation based on the Oxford Semiconductor OXPCIe958
PCI Express to octa UART controller (supports chaining two of those together in a single device
to get up to 16 UARTs). This somewhat revives the incomplete and never enabled PCI UART controller
in the old code. Linux detects the device and apparently configures all 16 UARTs but data transfers
were not tested and the code is pretty incomplete still.

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