1 | /* $Id: Builtins.cpp 25817 2010-01-13 22:08:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Built-in drivers & devices (part 1)
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2008 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 |
|
---|
23 | /*******************************************************************************
|
---|
24 | * Header Files *
|
---|
25 | *******************************************************************************/
|
---|
26 | #define LOG_GROUP LOG_GROUP_DEV
|
---|
27 | #include <VBox/pdm.h>
|
---|
28 | #include <VBox/version.h>
|
---|
29 | #include <VBox/err.h>
|
---|
30 | #include <VBox/usb.h>
|
---|
31 |
|
---|
32 | #include <VBox/log.h>
|
---|
33 | #include <iprt/assert.h>
|
---|
34 |
|
---|
35 | #include "Builtins.h"
|
---|
36 |
|
---|
37 |
|
---|
38 | /*******************************************************************************
|
---|
39 | * Global Variables *
|
---|
40 | *******************************************************************************/
|
---|
41 | const void *g_apvVBoxDDDependencies[] =
|
---|
42 | {
|
---|
43 | #ifdef VBOX_WITH_EFI
|
---|
44 | &g_abEfiThunkBinary[0],
|
---|
45 | #endif
|
---|
46 | NULL,
|
---|
47 | };
|
---|
48 |
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Register builtin devices.
|
---|
52 | *
|
---|
53 | * @returns VBox status code.
|
---|
54 | * @param pCallbacks Pointer to the callback table.
|
---|
55 | * @param u32Version VBox version number.
|
---|
56 | */
|
---|
57 | extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
---|
58 | {
|
---|
59 | LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
|
---|
60 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
61 | int rc;
|
---|
62 |
|
---|
63 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
|
---|
64 | if (RT_FAILURE(rc))
|
---|
65 | return rc;
|
---|
66 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch);
|
---|
67 | if (RT_FAILURE(rc))
|
---|
68 | return rc;
|
---|
69 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios);
|
---|
70 | if (RT_FAILURE(rc))
|
---|
71 | return rc;
|
---|
72 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse);
|
---|
73 | if (RT_FAILURE(rc))
|
---|
74 | return rc;
|
---|
75 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
|
---|
76 | if (RT_FAILURE(rc))
|
---|
77 | return rc;
|
---|
78 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
|
---|
79 | if (RT_FAILURE(rc))
|
---|
80 | return rc;
|
---|
81 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
|
---|
82 | if (RT_FAILURE(rc))
|
---|
83 | return rc;
|
---|
84 | #ifdef VBOX_WITH_HPET
|
---|
85 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHPET);
|
---|
86 | if (RT_FAILURE(rc))
|
---|
87 | return rc;
|
---|
88 | #endif
|
---|
89 | #ifdef VBOX_WITH_SMC
|
---|
90 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSMC);
|
---|
91 | if (RT_FAILURE(rc))
|
---|
92 | return rc;
|
---|
93 | #endif
|
---|
94 | #ifdef VBOX_WITH_LPC
|
---|
95 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLPC);
|
---|
96 | if (RT_FAILURE(rc))
|
---|
97 | return rc;
|
---|
98 | #endif
|
---|
99 | #ifdef VBOX_WITH_EFI
|
---|
100 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEFI);
|
---|
101 | if (RT_FAILURE(rc))
|
---|
102 | return rc;
|
---|
103 | #endif
|
---|
104 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
|
---|
105 | if (RT_FAILURE(rc))
|
---|
106 | return rc;
|
---|
107 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
|
---|
108 | if (RT_FAILURE(rc))
|
---|
109 | return rc;
|
---|
110 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
|
---|
111 | if (RT_FAILURE(rc))
|
---|
112 | return rc;
|
---|
113 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
|
---|
114 | if (RT_FAILURE(rc))
|
---|
115 | return rc;
|
---|
116 | #ifdef VBOX_WITH_E1000
|
---|
117 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000);
|
---|
118 | if (RT_FAILURE(rc))
|
---|
119 | return rc;
|
---|
120 | #endif
|
---|
121 | #ifdef VBOX_WITH_VIRTIO
|
---|
122 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioNet);
|
---|
123 | if (RT_FAILURE(rc))
|
---|
124 | return rc;
|
---|
125 | #endif
|
---|
126 | #ifdef VBOX_WITH_INIP
|
---|
127 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
|
---|
128 | if (RT_FAILURE(rc))
|
---|
129 | return rc;
|
---|
130 | #endif
|
---|
131 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
132 | if (RT_FAILURE(rc))
|
---|
133 | return rc;
|
---|
134 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
|
---|
135 | if (RT_FAILURE(rc))
|
---|
136 | return rc;
|
---|
137 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
138 | if (RT_FAILURE(rc))
|
---|
139 | return rc;
|
---|
140 | #ifdef VBOX_WITH_USB
|
---|
141 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
142 | if (RT_FAILURE(rc))
|
---|
143 | return rc;
|
---|
144 | #endif
|
---|
145 | #ifdef VBOX_WITH_EHCI
|
---|
146 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
|
---|
147 | if (RT_FAILURE(rc))
|
---|
148 | return rc;
|
---|
149 | #endif
|
---|
150 | #ifdef VBOX_ACPI
|
---|
151 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
152 | if (RT_FAILURE(rc))
|
---|
153 | return rc;
|
---|
154 | #endif
|
---|
155 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
156 | if (RT_FAILURE(rc))
|
---|
157 | return rc;
|
---|
158 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
159 | if (RT_FAILURE(rc))
|
---|
160 | return rc;
|
---|
161 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
162 | if (RT_FAILURE(rc))
|
---|
163 | return rc;
|
---|
164 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
|
---|
165 | if (RT_FAILURE(rc))
|
---|
166 | return rc;
|
---|
167 | #ifdef VBOX_WITH_AHCI
|
---|
168 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
|
---|
169 | if (RT_FAILURE(rc))
|
---|
170 | return rc;
|
---|
171 | #endif
|
---|
172 | #ifdef VBOX_WITH_BUSLOGIC
|
---|
173 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
|
---|
174 | if (RT_FAILURE(rc))
|
---|
175 | return rc;
|
---|
176 | #endif
|
---|
177 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
|
---|
178 | if (RT_FAILURE(rc))
|
---|
179 | return rc;
|
---|
180 | #ifdef VBOX_WITH_LSILOGIC
|
---|
181 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
|
---|
182 | if (VBOX_FAILURE(rc))
|
---|
183 | return rc;
|
---|
184 | #endif
|
---|
185 |
|
---|
186 | return VINF_SUCCESS;
|
---|
187 | }
|
---|
188 |
|
---|
189 |
|
---|
190 | /**
|
---|
191 | * Register builtin drivers.
|
---|
192 | *
|
---|
193 | * @returns VBox status code.
|
---|
194 | * @param pCallbacks Pointer to the callback table.
|
---|
195 | * @param u32Version VBox version number.
|
---|
196 | */
|
---|
197 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
198 | {
|
---|
199 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
200 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
201 |
|
---|
202 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
203 | if (RT_FAILURE(rc))
|
---|
204 | return rc;
|
---|
205 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
206 | if (RT_FAILURE(rc))
|
---|
207 | return rc;
|
---|
208 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
209 | if (RT_FAILURE(rc))
|
---|
210 | return rc;
|
---|
211 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
212 | if (RT_FAILURE(rc))
|
---|
213 | return rc;
|
---|
214 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
215 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
216 | if (RT_FAILURE(rc))
|
---|
217 | return rc;
|
---|
218 | #endif
|
---|
219 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
220 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
221 | if (RT_FAILURE(rc))
|
---|
222 | return rc;
|
---|
223 | #endif
|
---|
224 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
225 | if (RT_FAILURE(rc))
|
---|
226 | return rc;
|
---|
227 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
228 | if (RT_FAILURE(rc))
|
---|
229 | return rc;
|
---|
230 | #ifndef RT_OS_L4
|
---|
231 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
232 | if (RT_FAILURE(rc))
|
---|
233 | return rc;
|
---|
234 | #endif
|
---|
235 | #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
|
---|
236 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
237 | if (RT_FAILURE(rc))
|
---|
238 | return rc;
|
---|
239 | #endif
|
---|
240 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
241 | if (RT_FAILURE(rc))
|
---|
242 | return rc;
|
---|
243 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
244 | if (RT_FAILURE(rc))
|
---|
245 | return rc;
|
---|
246 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
247 | if (RT_FAILURE(rc))
|
---|
248 | return rc;
|
---|
249 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
250 | if (RT_FAILURE(rc))
|
---|
251 | return rc;
|
---|
252 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
|
---|
253 | if (RT_FAILURE(rc))
|
---|
254 | return rc;
|
---|
255 |
|
---|
256 | #ifdef VBOX_WITH_USB
|
---|
257 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
258 | if (RT_FAILURE(rc))
|
---|
259 | return rc;
|
---|
260 | #endif
|
---|
261 |
|
---|
262 | #if !defined(RT_OS_L4)
|
---|
263 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
|
---|
264 | if (RT_FAILURE(rc))
|
---|
265 | return rc;
|
---|
266 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
|
---|
267 | if (RT_FAILURE(rc))
|
---|
268 | return rc;
|
---|
269 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
|
---|
270 | if (RT_FAILURE(rc))
|
---|
271 | return rc;
|
---|
272 | #endif
|
---|
273 |
|
---|
274 | #if defined(RT_OS_LINUX)
|
---|
275 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
|
---|
276 | if (RT_FAILURE(rc))
|
---|
277 | return rc;
|
---|
278 | #endif
|
---|
279 |
|
---|
280 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
281 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
|
---|
282 | if (RT_FAILURE(rc))
|
---|
283 | return rc;
|
---|
284 | #endif
|
---|
285 |
|
---|
286 | #ifdef VBOX_WITH_SCSI
|
---|
287 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
|
---|
288 | if (RT_FAILURE(rc))
|
---|
289 | return rc;
|
---|
290 |
|
---|
291 | #if defined(RT_OS_LINUX)
|
---|
292 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
|
---|
293 | if (RT_FAILURE(rc))
|
---|
294 | return rc;
|
---|
295 | #endif
|
---|
296 | #endif
|
---|
297 |
|
---|
298 | return VINF_SUCCESS;
|
---|
299 | }
|
---|
300 |
|
---|
301 |
|
---|
302 | #ifdef VBOX_WITH_USB
|
---|
303 | /**
|
---|
304 | * Register builtin USB device.
|
---|
305 | *
|
---|
306 | * @returns VBox status code.
|
---|
307 | * @param pCallbacks Pointer to the callback table.
|
---|
308 | * @param u32Version VBox version number.
|
---|
309 | */
|
---|
310 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
311 | {
|
---|
312 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
313 | if (RT_FAILURE(rc))
|
---|
314 | return rc;
|
---|
315 |
|
---|
316 | return VINF_SUCCESS;
|
---|
317 | }
|
---|
318 | #endif
|
---|