1 | /* $Id: Builtins.cpp 29522 2010-05-17 10:15:48Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Built-in drivers & devices (part 1)
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 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/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 "Builtins.h"
|
---|
32 |
|
---|
33 |
|
---|
34 | /*******************************************************************************
|
---|
35 | * Global Variables *
|
---|
36 | *******************************************************************************/
|
---|
37 | const void *g_apvVBoxDDDependencies[] =
|
---|
38 | {
|
---|
39 | #ifdef VBOX_WITH_EFI
|
---|
40 | &g_abEfiThunkBinary[0],
|
---|
41 | #endif
|
---|
42 | NULL,
|
---|
43 | };
|
---|
44 |
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Register builtin devices.
|
---|
48 | *
|
---|
49 | * @returns VBox status code.
|
---|
50 | * @param pCallbacks Pointer to the callback table.
|
---|
51 | * @param u32Version VBox version number.
|
---|
52 | */
|
---|
53 | extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
---|
54 | {
|
---|
55 | LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
|
---|
56 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
57 | int rc;
|
---|
58 |
|
---|
59 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
|
---|
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 | #ifdef VBOX_WITH_HPET
|
---|
81 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHPET);
|
---|
82 | if (RT_FAILURE(rc))
|
---|
83 | return rc;
|
---|
84 | #endif
|
---|
85 | #ifdef VBOX_WITH_EFI
|
---|
86 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEFI);
|
---|
87 | if (RT_FAILURE(rc))
|
---|
88 | return rc;
|
---|
89 | #endif
|
---|
90 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
|
---|
91 | if (RT_FAILURE(rc))
|
---|
92 | return rc;
|
---|
93 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
|
---|
94 | if (RT_FAILURE(rc))
|
---|
95 | return rc;
|
---|
96 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
|
---|
97 | if (RT_FAILURE(rc))
|
---|
98 | return rc;
|
---|
99 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
|
---|
100 | if (RT_FAILURE(rc))
|
---|
101 | return rc;
|
---|
102 | #ifdef VBOX_WITH_E1000
|
---|
103 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000);
|
---|
104 | if (RT_FAILURE(rc))
|
---|
105 | return rc;
|
---|
106 | #endif
|
---|
107 | #ifdef VBOX_WITH_VIRTIO
|
---|
108 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioNet);
|
---|
109 | if (RT_FAILURE(rc))
|
---|
110 | return rc;
|
---|
111 | #endif
|
---|
112 | #ifdef VBOX_WITH_INIP
|
---|
113 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
|
---|
114 | if (RT_FAILURE(rc))
|
---|
115 | return rc;
|
---|
116 | #endif
|
---|
117 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
118 | if (RT_FAILURE(rc))
|
---|
119 | return rc;
|
---|
120 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
|
---|
121 | if (RT_FAILURE(rc))
|
---|
122 | return rc;
|
---|
123 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
124 | if (RT_FAILURE(rc))
|
---|
125 | return rc;
|
---|
126 | #ifdef VBOX_WITH_VUSB
|
---|
127 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
128 | if (RT_FAILURE(rc))
|
---|
129 | return rc;
|
---|
130 | #endif
|
---|
131 | #ifdef VBOX_WITH_EHCI
|
---|
132 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
|
---|
133 | if (RT_FAILURE(rc))
|
---|
134 | return rc;
|
---|
135 | #endif
|
---|
136 | #ifdef VBOX_ACPI
|
---|
137 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
138 | if (RT_FAILURE(rc))
|
---|
139 | return rc;
|
---|
140 | #endif
|
---|
141 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
142 | if (RT_FAILURE(rc))
|
---|
143 | return rc;
|
---|
144 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
145 | if (RT_FAILURE(rc))
|
---|
146 | return rc;
|
---|
147 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
148 | if (RT_FAILURE(rc))
|
---|
149 | return rc;
|
---|
150 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
|
---|
151 | if (RT_FAILURE(rc))
|
---|
152 | return rc;
|
---|
153 | #ifdef VBOX_WITH_AHCI
|
---|
154 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
|
---|
155 | if (RT_FAILURE(rc))
|
---|
156 | return rc;
|
---|
157 | #endif
|
---|
158 | #ifdef VBOX_WITH_BUSLOGIC
|
---|
159 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
|
---|
160 | if (RT_FAILURE(rc))
|
---|
161 | return rc;
|
---|
162 | #endif
|
---|
163 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
|
---|
164 | if (RT_FAILURE(rc))
|
---|
165 | return rc;
|
---|
166 | #ifdef VBOX_WITH_LSILOGIC
|
---|
167 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
|
---|
168 | if (RT_FAILURE(rc))
|
---|
169 | return rc;
|
---|
170 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSAS);
|
---|
171 | if (RT_FAILURE(rc))
|
---|
172 | return rc;
|
---|
173 | #endif
|
---|
174 |
|
---|
175 | return VINF_SUCCESS;
|
---|
176 | }
|
---|
177 |
|
---|
178 |
|
---|
179 | /**
|
---|
180 | * Register builtin drivers.
|
---|
181 | *
|
---|
182 | * @returns VBox status code.
|
---|
183 | * @param pCallbacks Pointer to the callback table.
|
---|
184 | * @param u32Version VBox version number.
|
---|
185 | */
|
---|
186 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
187 | {
|
---|
188 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
189 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
190 |
|
---|
191 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
192 | if (RT_FAILURE(rc))
|
---|
193 | return rc;
|
---|
194 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
195 | if (RT_FAILURE(rc))
|
---|
196 | return rc;
|
---|
197 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
198 | if (RT_FAILURE(rc))
|
---|
199 | return rc;
|
---|
200 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
201 | if (RT_FAILURE(rc))
|
---|
202 | return rc;
|
---|
203 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
204 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
205 | if (RT_FAILURE(rc))
|
---|
206 | return rc;
|
---|
207 | #endif
|
---|
208 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
209 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
210 | if (RT_FAILURE(rc))
|
---|
211 | return rc;
|
---|
212 | #endif
|
---|
213 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
214 | if (RT_FAILURE(rc))
|
---|
215 | return rc;
|
---|
216 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
217 | if (RT_FAILURE(rc))
|
---|
218 | return rc;
|
---|
219 | #ifndef RT_OS_L4
|
---|
220 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
221 | if (RT_FAILURE(rc))
|
---|
222 | return rc;
|
---|
223 | #endif
|
---|
224 | #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
|
---|
225 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
226 | if (RT_FAILURE(rc))
|
---|
227 | return rc;
|
---|
228 | #endif
|
---|
229 | #ifdef VBOX_WITH_VDE
|
---|
230 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
|
---|
231 | if (RT_FAILURE(rc))
|
---|
232 | return rc;
|
---|
233 | #endif
|
---|
234 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
235 | if (RT_FAILURE(rc))
|
---|
236 | return rc;
|
---|
237 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
|
---|
238 | if (RT_FAILURE(rc))
|
---|
239 | return rc;
|
---|
240 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
241 | if (RT_FAILURE(rc))
|
---|
242 | return rc;
|
---|
243 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
244 | if (RT_FAILURE(rc))
|
---|
245 | return rc;
|
---|
246 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
247 | if (RT_FAILURE(rc))
|
---|
248 | return rc;
|
---|
249 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
|
---|
250 | if (RT_FAILURE(rc))
|
---|
251 | return rc;
|
---|
252 |
|
---|
253 | #ifdef VBOX_WITH_VUSB
|
---|
254 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
255 | if (RT_FAILURE(rc))
|
---|
256 | return rc;
|
---|
257 | #endif
|
---|
258 |
|
---|
259 | #if !defined(RT_OS_L4)
|
---|
260 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
|
---|
261 | if (RT_FAILURE(rc))
|
---|
262 | return rc;
|
---|
263 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
|
---|
264 | if (RT_FAILURE(rc))
|
---|
265 | return rc;
|
---|
266 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
|
---|
267 | if (RT_FAILURE(rc))
|
---|
268 | return rc;
|
---|
269 | #endif
|
---|
270 |
|
---|
271 | #if defined(RT_OS_LINUX)
|
---|
272 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
|
---|
273 | if (RT_FAILURE(rc))
|
---|
274 | return rc;
|
---|
275 | #endif
|
---|
276 |
|
---|
277 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
278 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
|
---|
279 | if (RT_FAILURE(rc))
|
---|
280 | return rc;
|
---|
281 | #endif
|
---|
282 |
|
---|
283 | #ifdef VBOX_WITH_SCSI
|
---|
284 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
|
---|
285 | if (RT_FAILURE(rc))
|
---|
286 | return rc;
|
---|
287 |
|
---|
288 | # if defined(RT_OS_LINUX)
|
---|
289 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
|
---|
290 | if (RT_FAILURE(rc))
|
---|
291 | return rc;
|
---|
292 | # endif
|
---|
293 |
|
---|
294 | #endif
|
---|
295 |
|
---|
296 | #ifdef VBOX_WITH_DRV_DISK_INTEGRITY
|
---|
297 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
|
---|
298 | if (RT_FAILURE(rc))
|
---|
299 | return rc;
|
---|
300 | #endif
|
---|
301 |
|
---|
302 | return VINF_SUCCESS;
|
---|
303 | }
|
---|
304 |
|
---|
305 |
|
---|
306 | /**
|
---|
307 | * Register builtin USB device.
|
---|
308 | *
|
---|
309 | * @returns VBox status code.
|
---|
310 | * @param pCallbacks Pointer to the callback table.
|
---|
311 | * @param u32Version VBox version number.
|
---|
312 | */
|
---|
313 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
314 | {
|
---|
315 | int rc = VINF_SUCCESS;
|
---|
316 |
|
---|
317 | #ifdef VBOX_WITH_USB
|
---|
318 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
319 | if (RT_FAILURE(rc))
|
---|
320 | return rc;
|
---|
321 |
|
---|
322 | # ifdef VBOX_WITH_SCSI
|
---|
323 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
|
---|
324 | if (RT_FAILURE(rc))
|
---|
325 | return rc;
|
---|
326 | # endif
|
---|
327 | #endif
|
---|
328 |
|
---|
329 | #ifdef VBOX_WITH_VUSB
|
---|
330 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
|
---|
331 | if (RT_FAILURE(rc))
|
---|
332 | return rc;
|
---|
333 |
|
---|
334 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
|
---|
335 | if (RT_FAILURE(rc))
|
---|
336 | return rc;
|
---|
337 | #endif
|
---|
338 |
|
---|
339 | return rc;
|
---|
340 | }
|
---|
341 |
|
---|