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