1 | /* $Id: Builtins.cpp 15963 2009-01-15 12:47:03Z 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 | NULL,
|
---|
44 | };
|
---|
45 |
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Register builtin devices.
|
---|
49 | *
|
---|
50 | * @returns VBox status code.
|
---|
51 | * @param pCallbacks Pointer to the callback table.
|
---|
52 | * @param u32Version VBox version number.
|
---|
53 | */
|
---|
54 | extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
---|
55 | {
|
---|
56 | LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
|
---|
57 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
58 | int rc;
|
---|
59 |
|
---|
60 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
|
---|
61 | if (RT_FAILURE(rc))
|
---|
62 | return rc;
|
---|
63 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch);
|
---|
64 | if (RT_FAILURE(rc))
|
---|
65 | return rc;
|
---|
66 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios);
|
---|
67 | if (RT_FAILURE(rc))
|
---|
68 | return rc;
|
---|
69 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse);
|
---|
70 | if (RT_FAILURE(rc))
|
---|
71 | return rc;
|
---|
72 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
|
---|
73 | if (RT_FAILURE(rc))
|
---|
74 | return rc;
|
---|
75 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
|
---|
76 | if (RT_FAILURE(rc))
|
---|
77 | return rc;
|
---|
78 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
|
---|
79 | if (RT_FAILURE(rc))
|
---|
80 | return rc;
|
---|
81 | #ifdef VBOX_WITH_HPET
|
---|
82 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHPET);
|
---|
83 | if (RT_FAILURE(rc))
|
---|
84 | return rc;
|
---|
85 | #endif
|
---|
86 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
|
---|
87 | if (RT_FAILURE(rc))
|
---|
88 | return rc;
|
---|
89 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
|
---|
90 | if (RT_FAILURE(rc))
|
---|
91 | return rc;
|
---|
92 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
|
---|
93 | if (RT_FAILURE(rc))
|
---|
94 | return rc;
|
---|
95 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
|
---|
96 | if (RT_FAILURE(rc))
|
---|
97 | return rc;
|
---|
98 | #ifdef VBOX_WITH_E1000
|
---|
99 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000);
|
---|
100 | if (RT_FAILURE(rc))
|
---|
101 | return rc;
|
---|
102 | #endif
|
---|
103 | #ifdef VBOX_WITH_INIP
|
---|
104 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
|
---|
105 | if (RT_FAILURE(rc))
|
---|
106 | return rc;
|
---|
107 | #endif
|
---|
108 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
109 | if (RT_FAILURE(rc))
|
---|
110 | return rc;
|
---|
111 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
|
---|
112 | if (RT_FAILURE(rc))
|
---|
113 | return rc;
|
---|
114 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
115 | if (RT_FAILURE(rc))
|
---|
116 | return rc;
|
---|
117 | #ifdef VBOX_WITH_USB
|
---|
118 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
119 | if (RT_FAILURE(rc))
|
---|
120 | return rc;
|
---|
121 | #endif
|
---|
122 | #ifdef VBOX_WITH_EHCI
|
---|
123 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
|
---|
124 | if (RT_FAILURE(rc))
|
---|
125 | return rc;
|
---|
126 | #endif
|
---|
127 | #ifdef VBOX_ACPI
|
---|
128 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
129 | if (RT_FAILURE(rc))
|
---|
130 | return rc;
|
---|
131 | #endif
|
---|
132 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
133 | if (RT_FAILURE(rc))
|
---|
134 | return rc;
|
---|
135 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
136 | if (RT_FAILURE(rc))
|
---|
137 | return rc;
|
---|
138 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
139 | if (RT_FAILURE(rc))
|
---|
140 | return rc;
|
---|
141 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
|
---|
142 | if (RT_FAILURE(rc))
|
---|
143 | return rc;
|
---|
144 | #ifdef VBOX_WITH_AHCI
|
---|
145 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
|
---|
146 | if (RT_FAILURE(rc))
|
---|
147 | return rc;
|
---|
148 | #endif
|
---|
149 | #ifdef VBOX_WITH_BUSLOGIC
|
---|
150 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
|
---|
151 | if (RT_FAILURE(rc))
|
---|
152 | return rc;
|
---|
153 | #endif
|
---|
154 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
|
---|
155 | if (RT_FAILURE(rc))
|
---|
156 | return rc;
|
---|
157 | #ifdef VBOX_WITH_LSILOGIC
|
---|
158 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
|
---|
159 | if (VBOX_FAILURE(rc))
|
---|
160 | return rc;
|
---|
161 | #endif
|
---|
162 |
|
---|
163 | return VINF_SUCCESS;
|
---|
164 | }
|
---|
165 |
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * Register builtin drivers.
|
---|
169 | *
|
---|
170 | * @returns VBox status code.
|
---|
171 | * @param pCallbacks Pointer to the callback table.
|
---|
172 | * @param u32Version VBox version number.
|
---|
173 | */
|
---|
174 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
175 | {
|
---|
176 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
177 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
178 |
|
---|
179 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
180 | if (RT_FAILURE(rc))
|
---|
181 | return rc;
|
---|
182 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
183 | if (RT_FAILURE(rc))
|
---|
184 | return rc;
|
---|
185 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
186 | if (RT_FAILURE(rc))
|
---|
187 | return rc;
|
---|
188 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
189 | if (RT_FAILURE(rc))
|
---|
190 | return rc;
|
---|
191 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
192 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
193 | if (RT_FAILURE(rc))
|
---|
194 | return rc;
|
---|
195 | #endif
|
---|
196 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
197 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
198 | if (RT_FAILURE(rc))
|
---|
199 | return rc;
|
---|
200 | #endif
|
---|
201 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
202 | if (RT_FAILURE(rc))
|
---|
203 | return rc;
|
---|
204 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
205 | if (RT_FAILURE(rc))
|
---|
206 | return rc;
|
---|
207 | #ifndef RT_OS_L4
|
---|
208 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
209 | if (RT_FAILURE(rc))
|
---|
210 | return rc;
|
---|
211 | #endif
|
---|
212 | #if defined(RT_OS_L4) || defined(RT_OS_LINUX) || defined(RT_OS_OS2) || (defined(RT_OS_SOLARIS) && !defined(RT_OS_SOLARIS_10)) || defined(RT_OS_WINDOWS)
|
---|
213 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
214 | if (RT_FAILURE(rc))
|
---|
215 | return rc;
|
---|
216 | #endif
|
---|
217 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
218 | if (RT_FAILURE(rc))
|
---|
219 | return rc;
|
---|
220 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
221 | if (RT_FAILURE(rc))
|
---|
222 | return rc;
|
---|
223 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
224 | if (RT_FAILURE(rc))
|
---|
225 | return rc;
|
---|
226 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
227 | if (RT_FAILURE(rc))
|
---|
228 | return rc;
|
---|
229 |
|
---|
230 | #ifdef VBOX_WITH_USB
|
---|
231 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
232 | if (RT_FAILURE(rc))
|
---|
233 | return rc;
|
---|
234 | #endif
|
---|
235 |
|
---|
236 | #if !defined(RT_OS_L4)
|
---|
237 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
|
---|
238 | if (RT_FAILURE(rc))
|
---|
239 | return rc;
|
---|
240 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
|
---|
241 | if (RT_FAILURE(rc))
|
---|
242 | return rc;
|
---|
243 | #endif
|
---|
244 |
|
---|
245 | #if defined(RT_OS_LINUX)
|
---|
246 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
|
---|
247 | if (RT_FAILURE(rc))
|
---|
248 | return rc;
|
---|
249 | #endif
|
---|
250 |
|
---|
251 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
252 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
|
---|
253 | if (RT_FAILURE(rc))
|
---|
254 | return rc;
|
---|
255 | #endif
|
---|
256 |
|
---|
257 | #if defined(VBOX_WITH_PDM_ASYNC_COMPLETION)
|
---|
258 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImageAsync);
|
---|
259 | if (RT_FAILURE(rc))
|
---|
260 | return rc;
|
---|
261 |
|
---|
262 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTransportAsync);
|
---|
263 | if (RT_FAILURE(rc))
|
---|
264 | return rc;
|
---|
265 | #endif
|
---|
266 | #ifdef VBOX_WITH_SCSI
|
---|
267 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
|
---|
268 | if (RT_FAILURE(rc))
|
---|
269 | return rc;
|
---|
270 |
|
---|
271 | #if defined(RT_OS_LINUX)
|
---|
272 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
|
---|
273 | if (RT_FAILURE(rc))
|
---|
274 | return rc;
|
---|
275 | #endif
|
---|
276 | #endif
|
---|
277 |
|
---|
278 | #ifdef VBOX_WITH_FAULT_INJECTION
|
---|
279 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvFaultInject);
|
---|
280 | if (RT_FAILURE(rc))
|
---|
281 | return rc;
|
---|
282 | #endif
|
---|
283 |
|
---|
284 | return VINF_SUCCESS;
|
---|
285 | }
|
---|
286 |
|
---|
287 |
|
---|
288 | #ifdef VBOX_WITH_USB
|
---|
289 | /**
|
---|
290 | * Register builtin USB device.
|
---|
291 | *
|
---|
292 | * @returns VBox status code.
|
---|
293 | * @param pCallbacks Pointer to the callback table.
|
---|
294 | * @param u32Version VBox version number.
|
---|
295 | */
|
---|
296 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
297 | {
|
---|
298 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
299 | if (RT_FAILURE(rc))
|
---|
300 | return rc;
|
---|
301 |
|
---|
302 | return VINF_SUCCESS;
|
---|
303 | }
|
---|
304 | #endif
|
---|
305 |
|
---|