1 | /* $Id: VBoxDD.cpp 49316 2013-10-29 08:30:37Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxDD - Built-in drivers & devices (part 1).
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2012 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 | *******************************************************************************/
|
---|
37 | const 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 | */
|
---|
50 | extern "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_DevicePS2KeyboardMouse);
|
---|
69 | if (RT_FAILURE(rc))
|
---|
70 | return rc;
|
---|
71 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
|
---|
72 | if (RT_FAILURE(rc))
|
---|
73 | return rc;
|
---|
74 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
|
---|
75 | if (RT_FAILURE(rc))
|
---|
76 | return rc;
|
---|
77 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
|
---|
78 | if (RT_FAILURE(rc))
|
---|
79 | return rc;
|
---|
80 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHPET);
|
---|
81 | if (RT_FAILURE(rc))
|
---|
82 | return rc;
|
---|
83 | #ifdef VBOX_WITH_SMC_NEW
|
---|
84 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSmc);
|
---|
85 | if (RT_FAILURE(rc))
|
---|
86 | return rc;
|
---|
87 | #endif
|
---|
88 | #ifdef VBOX_WITH_EFI
|
---|
89 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEFI);
|
---|
90 | if (RT_FAILURE(rc))
|
---|
91 | return rc;
|
---|
92 | #endif
|
---|
93 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
|
---|
94 | if (RT_FAILURE(rc))
|
---|
95 | return rc;
|
---|
96 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
|
---|
97 | if (RT_FAILURE(rc))
|
---|
98 | return rc;
|
---|
99 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
|
---|
100 | if (RT_FAILURE(rc))
|
---|
101 | return rc;
|
---|
102 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
|
---|
103 | if (RT_FAILURE(rc))
|
---|
104 | return rc;
|
---|
105 | #ifdef VBOX_WITH_E1000
|
---|
106 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000);
|
---|
107 | if (RT_FAILURE(rc))
|
---|
108 | return rc;
|
---|
109 | #endif
|
---|
110 | #ifdef VBOX_WITH_VIRTIO
|
---|
111 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioNet);
|
---|
112 | if (RT_FAILURE(rc))
|
---|
113 | return rc;
|
---|
114 | #endif
|
---|
115 | #ifdef VBOX_WITH_INIP
|
---|
116 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
|
---|
117 | if (RT_FAILURE(rc))
|
---|
118 | return rc;
|
---|
119 | #endif
|
---|
120 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
121 | if (RT_FAILURE(rc))
|
---|
122 | return rc;
|
---|
123 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
|
---|
124 | if (RT_FAILURE(rc))
|
---|
125 | return rc;
|
---|
126 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICH6_HDA);
|
---|
127 | if (RT_FAILURE(rc))
|
---|
128 | return rc;
|
---|
129 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
130 | if (RT_FAILURE(rc))
|
---|
131 | return rc;
|
---|
132 | #ifdef VBOX_WITH_VUSB
|
---|
133 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
134 | if (RT_FAILURE(rc))
|
---|
135 | return rc;
|
---|
136 | #endif
|
---|
137 | #ifdef VBOX_WITH_EHCI_IMPL
|
---|
138 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
|
---|
139 | if (RT_FAILURE(rc))
|
---|
140 | return rc;
|
---|
141 | #endif
|
---|
142 | #ifdef VBOX_ACPI
|
---|
143 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
144 | if (RT_FAILURE(rc))
|
---|
145 | return rc;
|
---|
146 | #endif
|
---|
147 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
148 | if (RT_FAILURE(rc))
|
---|
149 | return rc;
|
---|
150 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
151 | if (RT_FAILURE(rc))
|
---|
152 | return rc;
|
---|
153 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
154 | if (RT_FAILURE(rc))
|
---|
155 | return rc;
|
---|
156 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
|
---|
157 | if (RT_FAILURE(rc))
|
---|
158 | return rc;
|
---|
159 | #ifdef VBOX_WITH_AHCI
|
---|
160 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
|
---|
161 | if (RT_FAILURE(rc))
|
---|
162 | return rc;
|
---|
163 | #endif
|
---|
164 | #ifdef VBOX_WITH_BUSLOGIC
|
---|
165 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
|
---|
166 | if (RT_FAILURE(rc))
|
---|
167 | return rc;
|
---|
168 | #endif
|
---|
169 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
|
---|
170 | if (RT_FAILURE(rc))
|
---|
171 | return rc;
|
---|
172 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciIch9Bridge);
|
---|
173 | if (RT_FAILURE(rc))
|
---|
174 | return rc;
|
---|
175 | #ifdef VBOX_WITH_LSILOGIC
|
---|
176 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
|
---|
177 | if (RT_FAILURE(rc))
|
---|
178 | return rc;
|
---|
179 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSAS);
|
---|
180 | if (RT_FAILURE(rc))
|
---|
181 | return rc;
|
---|
182 | #endif
|
---|
183 | #ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
|
---|
184 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciRaw);
|
---|
185 | if (RT_FAILURE(rc))
|
---|
186 | return rc;
|
---|
187 | #endif
|
---|
188 |
|
---|
189 | return VINF_SUCCESS;
|
---|
190 | }
|
---|
191 |
|
---|
192 |
|
---|
193 | /**
|
---|
194 | * Register builtin drivers.
|
---|
195 | *
|
---|
196 | * @returns VBox status code.
|
---|
197 | * @param pCallbacks Pointer to the callback table.
|
---|
198 | * @param u32Version VBox version number.
|
---|
199 | */
|
---|
200 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
201 | {
|
---|
202 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
203 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
204 |
|
---|
205 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
206 | if (RT_FAILURE(rc))
|
---|
207 | return rc;
|
---|
208 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
209 | if (RT_FAILURE(rc))
|
---|
210 | return rc;
|
---|
211 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
212 | if (RT_FAILURE(rc))
|
---|
213 | return rc;
|
---|
214 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
215 | if (RT_FAILURE(rc))
|
---|
216 | return rc;
|
---|
217 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
218 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
219 | if (RT_FAILURE(rc))
|
---|
220 | return rc;
|
---|
221 | #endif
|
---|
222 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
223 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
224 | if (RT_FAILURE(rc))
|
---|
225 | return rc;
|
---|
226 | #endif
|
---|
227 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
228 | if (RT_FAILURE(rc))
|
---|
229 | return rc;
|
---|
230 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
231 | if (RT_FAILURE(rc))
|
---|
232 | return rc;
|
---|
233 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
234 | if (RT_FAILURE(rc))
|
---|
235 | return rc;
|
---|
236 | #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
|
---|
237 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
238 | if (RT_FAILURE(rc))
|
---|
239 | return rc;
|
---|
240 | #endif
|
---|
241 | #ifdef VBOX_WITH_UDPTUNNEL
|
---|
242 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDPTunnel);
|
---|
243 | if (RT_FAILURE(rc))
|
---|
244 | return rc;
|
---|
245 | #endif
|
---|
246 | #ifdef VBOX_WITH_VDE
|
---|
247 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
|
---|
248 | if (RT_FAILURE(rc))
|
---|
249 | return rc;
|
---|
250 | #endif
|
---|
251 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
252 | if (RT_FAILURE(rc))
|
---|
253 | return rc;
|
---|
254 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
|
---|
255 | if (RT_FAILURE(rc))
|
---|
256 | return rc;
|
---|
257 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
258 | if (RT_FAILURE(rc))
|
---|
259 | return rc;
|
---|
260 | #ifdef VBOX_WITH_NETSHAPER
|
---|
261 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetShaper);
|
---|
262 | if (RT_FAILURE(rc))
|
---|
263 | return rc;
|
---|
264 | #endif
|
---|
265 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
266 | if (RT_FAILURE(rc))
|
---|
267 | return rc;
|
---|
268 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
269 | if (RT_FAILURE(rc))
|
---|
270 | return rc;
|
---|
271 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
|
---|
272 | if (RT_FAILURE(rc))
|
---|
273 | return rc;
|
---|
274 | #ifdef VBOX_WITH_VUSB
|
---|
275 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
276 | if (RT_FAILURE(rc))
|
---|
277 | return rc;
|
---|
278 | #endif
|
---|
279 | #ifdef VBOX_WITH_USB_VIDEO_IMPL
|
---|
280 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostWebcam);
|
---|
281 | if (RT_FAILURE(rc))
|
---|
282 | return rc;
|
---|
283 | #endif
|
---|
284 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
|
---|
285 | if (RT_FAILURE(rc))
|
---|
286 | return rc;
|
---|
287 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
|
---|
288 | if (RT_FAILURE(rc))
|
---|
289 | return rc;
|
---|
290 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
|
---|
291 | if (RT_FAILURE(rc))
|
---|
292 | return rc;
|
---|
293 | #if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
|
---|
294 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
|
---|
295 | if (RT_FAILURE(rc))
|
---|
296 | return rc;
|
---|
297 | #endif
|
---|
298 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
299 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
|
---|
300 | if (RT_FAILURE(rc))
|
---|
301 | return rc;
|
---|
302 | #endif
|
---|
303 | #ifdef VBOX_WITH_SCSI
|
---|
304 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
|
---|
305 | if (RT_FAILURE(rc))
|
---|
306 | return rc;
|
---|
307 | # if defined(RT_OS_LINUX)
|
---|
308 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
|
---|
309 | if (RT_FAILURE(rc))
|
---|
310 | return rc;
|
---|
311 | # endif
|
---|
312 | #endif
|
---|
313 | #ifdef VBOX_WITH_DRV_DISK_INTEGRITY
|
---|
314 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
|
---|
315 | if (RT_FAILURE(rc))
|
---|
316 | return rc;
|
---|
317 | #endif
|
---|
318 | #ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
|
---|
319 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvPciRaw);
|
---|
320 | if (RT_FAILURE(rc))
|
---|
321 | return rc;
|
---|
322 | #endif
|
---|
323 |
|
---|
324 | return VINF_SUCCESS;
|
---|
325 | }
|
---|
326 |
|
---|
327 |
|
---|
328 | /**
|
---|
329 | * Register builtin USB device.
|
---|
330 | *
|
---|
331 | * @returns VBox status code.
|
---|
332 | * @param pCallbacks Pointer to the callback table.
|
---|
333 | * @param u32Version VBox version number.
|
---|
334 | */
|
---|
335 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
336 | {
|
---|
337 | int rc = VINF_SUCCESS;
|
---|
338 |
|
---|
339 | #ifdef VBOX_WITH_USB
|
---|
340 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
341 | if (RT_FAILURE(rc))
|
---|
342 | return rc;
|
---|
343 | # ifdef VBOX_WITH_SCSI
|
---|
344 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
|
---|
345 | if (RT_FAILURE(rc))
|
---|
346 | return rc;
|
---|
347 | # endif
|
---|
348 | #endif
|
---|
349 | #ifdef VBOX_WITH_VUSB
|
---|
350 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
|
---|
351 | if (RT_FAILURE(rc))
|
---|
352 | return rc;
|
---|
353 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
|
---|
354 | if (RT_FAILURE(rc))
|
---|
355 | return rc;
|
---|
356 | #endif
|
---|
357 | #ifdef VBOX_WITH_USB_VIDEO_IMPL
|
---|
358 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevWebcam);
|
---|
359 | if (RT_FAILURE(rc))
|
---|
360 | return rc;
|
---|
361 | #endif
|
---|
362 |
|
---|
363 | return rc;
|
---|
364 | }
|
---|