1 | /* $Id: VBoxDD.cpp 48435 2013-09-11 15:18:22Z 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 |
|
---|
184 | #ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
|
---|
185 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciRaw);
|
---|
186 | if (RT_FAILURE(rc))
|
---|
187 | return rc;
|
---|
188 | #endif
|
---|
189 |
|
---|
190 | return VINF_SUCCESS;
|
---|
191 | }
|
---|
192 |
|
---|
193 |
|
---|
194 | /**
|
---|
195 | * Register builtin drivers.
|
---|
196 | *
|
---|
197 | * @returns VBox status code.
|
---|
198 | * @param pCallbacks Pointer to the callback table.
|
---|
199 | * @param u32Version VBox version number.
|
---|
200 | */
|
---|
201 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
202 | {
|
---|
203 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
204 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
205 |
|
---|
206 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
207 | if (RT_FAILURE(rc))
|
---|
208 | return rc;
|
---|
209 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
210 | if (RT_FAILURE(rc))
|
---|
211 | return rc;
|
---|
212 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
213 | if (RT_FAILURE(rc))
|
---|
214 | return rc;
|
---|
215 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
216 | if (RT_FAILURE(rc))
|
---|
217 | return rc;
|
---|
218 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
219 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
220 | if (RT_FAILURE(rc))
|
---|
221 | return rc;
|
---|
222 | #endif
|
---|
223 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
224 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
225 | if (RT_FAILURE(rc))
|
---|
226 | return rc;
|
---|
227 | #endif
|
---|
228 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
229 | if (RT_FAILURE(rc))
|
---|
230 | return rc;
|
---|
231 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
232 | if (RT_FAILURE(rc))
|
---|
233 | return rc;
|
---|
234 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
235 | if (RT_FAILURE(rc))
|
---|
236 | return rc;
|
---|
237 | #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
|
---|
238 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
239 | if (RT_FAILURE(rc))
|
---|
240 | return rc;
|
---|
241 | #endif
|
---|
242 | #ifdef VBOX_WITH_UDPTUNNEL
|
---|
243 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvUDPTunnel);
|
---|
244 | if (RT_FAILURE(rc))
|
---|
245 | return rc;
|
---|
246 | #endif
|
---|
247 | #ifdef VBOX_WITH_VDE
|
---|
248 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
|
---|
249 | if (RT_FAILURE(rc))
|
---|
250 | return rc;
|
---|
251 | #endif
|
---|
252 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
253 | if (RT_FAILURE(rc))
|
---|
254 | return rc;
|
---|
255 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
|
---|
256 | if (RT_FAILURE(rc))
|
---|
257 | return rc;
|
---|
258 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
259 | if (RT_FAILURE(rc))
|
---|
260 | return rc;
|
---|
261 | #ifdef VBOX_WITH_NETSHAPER
|
---|
262 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetShaper);
|
---|
263 | if (RT_FAILURE(rc))
|
---|
264 | return rc;
|
---|
265 | #endif /* VBOX_WITH_NETSHAPER */
|
---|
266 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
267 | if (RT_FAILURE(rc))
|
---|
268 | return rc;
|
---|
269 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
270 | if (RT_FAILURE(rc))
|
---|
271 | return rc;
|
---|
272 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
|
---|
273 | if (RT_FAILURE(rc))
|
---|
274 | return rc;
|
---|
275 |
|
---|
276 | #ifdef VBOX_WITH_VUSB
|
---|
277 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
278 | if (RT_FAILURE(rc))
|
---|
279 | return rc;
|
---|
280 | #endif
|
---|
281 |
|
---|
282 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
|
---|
283 | if (RT_FAILURE(rc))
|
---|
284 | return rc;
|
---|
285 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
|
---|
286 | if (RT_FAILURE(rc))
|
---|
287 | return rc;
|
---|
288 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
|
---|
289 | if (RT_FAILURE(rc))
|
---|
290 | return rc;
|
---|
291 |
|
---|
292 | #if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
|
---|
293 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
|
---|
294 | if (RT_FAILURE(rc))
|
---|
295 | return rc;
|
---|
296 | #endif
|
---|
297 |
|
---|
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 |
|
---|
304 | #ifdef VBOX_WITH_SCSI
|
---|
305 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
|
---|
306 | if (RT_FAILURE(rc))
|
---|
307 | return rc;
|
---|
308 |
|
---|
309 | # if defined(RT_OS_LINUX)
|
---|
310 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
|
---|
311 | if (RT_FAILURE(rc))
|
---|
312 | return rc;
|
---|
313 | # endif
|
---|
314 |
|
---|
315 | #endif
|
---|
316 |
|
---|
317 | #ifdef VBOX_WITH_DRV_DISK_INTEGRITY
|
---|
318 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
|
---|
319 | if (RT_FAILURE(rc))
|
---|
320 | return rc;
|
---|
321 | #endif
|
---|
322 |
|
---|
323 | #ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL
|
---|
324 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvPciRaw);
|
---|
325 | if (RT_FAILURE(rc))
|
---|
326 | return rc;
|
---|
327 | #endif
|
---|
328 |
|
---|
329 | return VINF_SUCCESS;
|
---|
330 | }
|
---|
331 |
|
---|
332 |
|
---|
333 | /**
|
---|
334 | * Register builtin USB device.
|
---|
335 | *
|
---|
336 | * @returns VBox status code.
|
---|
337 | * @param pCallbacks Pointer to the callback table.
|
---|
338 | * @param u32Version VBox version number.
|
---|
339 | */
|
---|
340 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
341 | {
|
---|
342 | int rc = VINF_SUCCESS;
|
---|
343 |
|
---|
344 | #ifdef VBOX_WITH_USB
|
---|
345 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
346 | if (RT_FAILURE(rc))
|
---|
347 | return rc;
|
---|
348 |
|
---|
349 | # ifdef VBOX_WITH_SCSI
|
---|
350 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
|
---|
351 | if (RT_FAILURE(rc))
|
---|
352 | return rc;
|
---|
353 | # endif
|
---|
354 | #endif
|
---|
355 |
|
---|
356 | #ifdef VBOX_WITH_VUSB
|
---|
357 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
|
---|
358 | if (RT_FAILURE(rc))
|
---|
359 | return rc;
|
---|
360 |
|
---|
361 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
|
---|
362 | if (RT_FAILURE(rc))
|
---|
363 | return rc;
|
---|
364 | #endif
|
---|
365 |
|
---|
366 | return rc;
|
---|
367 | }
|
---|