VirtualBox

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

Last change on this file since 30866 was 30866, checked in by vboxsync, 14 years ago

Audio: Inital HDA commit. Not fully workable, compilable on Mac (Linux, Windows haven't been tested).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.1 KB
Line 
1/* $Id: Builtins.cpp 30866 2010-07-16 05:37:14Z 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*******************************************************************************/
37const 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 */
53extern "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#ifdef VBOX_WITH_AUDIO_INTELHD
124 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHINTELHD);
125 if (RT_FAILURE(rc))
126 return rc;
127#endif
128 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
129 if (RT_FAILURE(rc))
130 return rc;
131#ifdef VBOX_WITH_VUSB
132 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
133 if (RT_FAILURE(rc))
134 return rc;
135#endif
136#ifdef VBOX_WITH_EHCI
137 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
138 if (RT_FAILURE(rc))
139 return rc;
140#endif
141#ifdef VBOX_ACPI
142 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
143 if (RT_FAILURE(rc))
144 return rc;
145#endif
146 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
147 if (RT_FAILURE(rc))
148 return rc;
149 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
150 if (RT_FAILURE(rc))
151 return rc;
152 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
153 if (RT_FAILURE(rc))
154 return rc;
155 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
156 if (RT_FAILURE(rc))
157 return rc;
158#ifdef VBOX_WITH_AHCI
159 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
160 if (RT_FAILURE(rc))
161 return rc;
162#endif
163#ifdef VBOX_WITH_BUSLOGIC
164 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
165 if (RT_FAILURE(rc))
166 return rc;
167#endif
168 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
169 if (RT_FAILURE(rc))
170 return rc;
171#ifdef VBOX_WITH_LSILOGIC
172 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
173 if (RT_FAILURE(rc))
174 return rc;
175 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSAS);
176 if (RT_FAILURE(rc))
177 return rc;
178#endif
179
180 return VINF_SUCCESS;
181}
182
183
184/**
185 * Register builtin drivers.
186 *
187 * @returns VBox status code.
188 * @param pCallbacks Pointer to the callback table.
189 * @param u32Version VBox version number.
190 */
191extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
192{
193 LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
194 AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
195
196 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
197 if (RT_FAILURE(rc))
198 return rc;
199 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
200 if (RT_FAILURE(rc))
201 return rc;
202 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
203 if (RT_FAILURE(rc))
204 return rc;
205 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
206 if (RT_FAILURE(rc))
207 return rc;
208#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
209 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
210 if (RT_FAILURE(rc))
211 return rc;
212#endif
213#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
214 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
215 if (RT_FAILURE(rc))
216 return rc;
217#endif
218 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
219 if (RT_FAILURE(rc))
220 return rc;
221 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
222 if (RT_FAILURE(rc))
223 return rc;
224#ifndef RT_OS_L4
225 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
226 if (RT_FAILURE(rc))
227 return rc;
228#endif
229#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
230 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
231 if (RT_FAILURE(rc))
232 return rc;
233#endif
234#ifdef VBOX_WITH_VDE
235 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
236 if (RT_FAILURE(rc))
237 return rc;
238#endif
239 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
240 if (RT_FAILURE(rc))
241 return rc;
242 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
243 if (RT_FAILURE(rc))
244 return rc;
245 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
246 if (RT_FAILURE(rc))
247 return rc;
248 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
249 if (RT_FAILURE(rc))
250 return rc;
251 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
252 if (RT_FAILURE(rc))
253 return rc;
254 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
255 if (RT_FAILURE(rc))
256 return rc;
257
258#ifdef VBOX_WITH_VUSB
259 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
260 if (RT_FAILURE(rc))
261 return rc;
262#endif
263
264#if !defined(RT_OS_L4)
265 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
266 if (RT_FAILURE(rc))
267 return rc;
268 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
269 if (RT_FAILURE(rc))
270 return rc;
271 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
272 if (RT_FAILURE(rc))
273 return rc;
274#endif
275
276#if defined(RT_OS_LINUX)
277 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
278 if (RT_FAILURE(rc))
279 return rc;
280#endif
281
282#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
283 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
284 if (RT_FAILURE(rc))
285 return rc;
286#endif
287
288#ifdef VBOX_WITH_SCSI
289 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
290 if (RT_FAILURE(rc))
291 return rc;
292
293# if defined(RT_OS_LINUX)
294 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
295 if (RT_FAILURE(rc))
296 return rc;
297# endif
298
299#endif
300
301#ifdef VBOX_WITH_DRV_DISK_INTEGRITY
302 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
303 if (RT_FAILURE(rc))
304 return rc;
305#endif
306
307 return VINF_SUCCESS;
308}
309
310
311/**
312 * Register builtin USB device.
313 *
314 * @returns VBox status code.
315 * @param pCallbacks Pointer to the callback table.
316 * @param u32Version VBox version number.
317 */
318extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
319{
320 int rc = VINF_SUCCESS;
321
322#ifdef VBOX_WITH_USB
323 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
324 if (RT_FAILURE(rc))
325 return rc;
326
327# ifdef VBOX_WITH_SCSI
328 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
329 if (RT_FAILURE(rc))
330 return rc;
331# endif
332#endif
333
334#ifdef VBOX_WITH_VUSB
335 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
336 if (RT_FAILURE(rc))
337 return rc;
338
339 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
340 if (RT_FAILURE(rc))
341 return rc;
342#endif
343
344 return rc;
345}
346
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