1 | /** $Id: Builtins.cpp 1345 2007-03-08 21:21:41Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Built-in drivers & devices (part 1)
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
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 <VBox/config.h>
|
---|
34 | #include <iprt/assert.h>
|
---|
35 |
|
---|
36 | #include "Builtins.h"
|
---|
37 |
|
---|
38 |
|
---|
39 | /*******************************************************************************
|
---|
40 | * Global Variables *
|
---|
41 | *******************************************************************************/
|
---|
42 | const void *g_apvVBoxDDDependencies[] =
|
---|
43 | {
|
---|
44 | NULL,
|
---|
45 | };
|
---|
46 |
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Register builtin devices.
|
---|
50 | *
|
---|
51 | * @returns VBox status code.
|
---|
52 | * @param pCallbacks Pointer to the callback table.
|
---|
53 | * @param u32Version VBox version number.
|
---|
54 | */
|
---|
55 | extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
---|
56 | {
|
---|
57 | LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
|
---|
58 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
59 | int rc;
|
---|
60 |
|
---|
61 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
|
---|
62 | if (VBOX_FAILURE(rc))
|
---|
63 | return rc;
|
---|
64 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch);
|
---|
65 | if (VBOX_FAILURE(rc))
|
---|
66 | return rc;
|
---|
67 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios);
|
---|
68 | if (VBOX_FAILURE(rc))
|
---|
69 | return rc;
|
---|
70 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse);
|
---|
71 | if (VBOX_FAILURE(rc))
|
---|
72 | return rc;
|
---|
73 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
|
---|
74 | if (VBOX_FAILURE(rc))
|
---|
75 | return rc;
|
---|
76 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
|
---|
77 | if (VBOX_FAILURE(rc))
|
---|
78 | return rc;
|
---|
79 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
|
---|
80 | if (VBOX_FAILURE(rc))
|
---|
81 | return rc;
|
---|
82 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
|
---|
83 | if (VBOX_FAILURE(rc))
|
---|
84 | return rc;
|
---|
85 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
|
---|
86 | if (VBOX_FAILURE(rc))
|
---|
87 | return rc;
|
---|
88 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
|
---|
89 | if (VBOX_FAILURE(rc))
|
---|
90 | return rc;
|
---|
91 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
|
---|
92 | if (VBOX_FAILURE(rc))
|
---|
93 | return rc;
|
---|
94 | #if 0
|
---|
95 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceNE2000);
|
---|
96 | if (VBOX_FAILURE(rc))
|
---|
97 | return rc;
|
---|
98 | #endif
|
---|
99 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
100 | if (VBOX_FAILURE(rc))
|
---|
101 | return rc;
|
---|
102 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
103 | if (VBOX_FAILURE(rc))
|
---|
104 | return rc;
|
---|
105 | #if defined(VBOX_WITH_USB) && (defined(__WIN__) || defined(__LINUX__) || defined(__L4ENV__))
|
---|
106 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
107 | if (VBOX_FAILURE(rc))
|
---|
108 | return rc;
|
---|
109 | #endif
|
---|
110 | #ifdef VBOX_ACPI
|
---|
111 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
112 | if (VBOX_FAILURE(rc))
|
---|
113 | return rc;
|
---|
114 | #endif
|
---|
115 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
116 | if (VBOX_FAILURE(rc))
|
---|
117 | return rc;
|
---|
118 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
119 | if (VBOX_FAILURE(rc))
|
---|
120 | return rc;
|
---|
121 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
122 | if (VBOX_FAILURE(rc))
|
---|
123 | return rc;
|
---|
124 |
|
---|
125 | return VINF_SUCCESS;
|
---|
126 | }
|
---|
127 |
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * Register builtin drivers.
|
---|
131 | *
|
---|
132 | * @returns VBox status code.
|
---|
133 | * @param pCallbacks Pointer to the callback table.
|
---|
134 | * @param u32Version VBox version number.
|
---|
135 | */
|
---|
136 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
137 | {
|
---|
138 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
139 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
140 |
|
---|
141 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
142 | if (VBOX_FAILURE(rc))
|
---|
143 | return rc;
|
---|
144 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
145 | if (VBOX_FAILURE(rc))
|
---|
146 | return rc;
|
---|
147 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
148 | if (VBOX_FAILURE(rc))
|
---|
149 | return rc;
|
---|
150 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVBoxHDD);
|
---|
151 | if (VBOX_FAILURE(rc))
|
---|
152 | return rc;
|
---|
153 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVmdkHDD);
|
---|
154 | if (VBOX_FAILURE(rc))
|
---|
155 | return rc;
|
---|
156 | #if !defined(__L4ENV__) && !defined(__DARWIN__) && !defined(__OS2__)
|
---|
157 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
158 | if (VBOX_FAILURE(rc))
|
---|
159 | return rc;
|
---|
160 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
161 | if (VBOX_FAILURE(rc))
|
---|
162 | return rc;
|
---|
163 | #endif
|
---|
164 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
165 | if (VBOX_FAILURE(rc))
|
---|
166 | return rc;
|
---|
167 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
168 | if (VBOX_FAILURE(rc))
|
---|
169 | return rc;
|
---|
170 | #ifdef VBOX_WITH_ISCSI
|
---|
171 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSI);
|
---|
172 | if (VBOX_FAILURE(rc))
|
---|
173 | return rc;
|
---|
174 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSITransportTcp);
|
---|
175 | if (VBOX_FAILURE(rc))
|
---|
176 | return rc;
|
---|
177 | #endif
|
---|
178 | #ifndef __L4ENV__
|
---|
179 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
180 | if (VBOX_FAILURE(rc))
|
---|
181 | return rc;
|
---|
182 | #endif
|
---|
183 | #ifdef VBOX_WITH_INTERNAL_NETWORKING
|
---|
184 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
185 | if (VBOX_FAILURE(rc))
|
---|
186 | return rc;
|
---|
187 | #endif
|
---|
188 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
189 | if (VBOX_FAILURE(rc))
|
---|
190 | return rc;
|
---|
191 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
192 | if (VBOX_FAILURE(rc))
|
---|
193 | return rc;
|
---|
194 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
195 | if (VBOX_FAILURE(rc))
|
---|
196 | return rc;
|
---|
197 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
198 | if (VBOX_FAILURE(rc))
|
---|
199 | return rc;
|
---|
200 |
|
---|
201 | #if defined(VBOX_WITH_USB) && (defined(__WIN__) || defined(__LINUX__) || defined(__L4ENV__))
|
---|
202 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
203 | if (VBOX_FAILURE(rc))
|
---|
204 | return rc;
|
---|
205 | #endif
|
---|
206 |
|
---|
207 | return VINF_SUCCESS;
|
---|
208 | }
|
---|
209 |
|
---|