VirtualBox

source: vbox/trunk/src/VBox/Devices/Builtins.cpp@ 16296

Last change on this file since 16296 was 16170, checked in by vboxsync, 16 years ago

More device work

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette