1 | /* $Id: PDMInternal.h 3857 2007-07-25 22:02:21Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * PDM - Internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek 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 | #ifndef ___PDMInternal_h
|
---|
23 | #define ___PDMInternal_h
|
---|
24 |
|
---|
25 | #include <VBox/cdefs.h>
|
---|
26 | #include <VBox/types.h>
|
---|
27 | #include <VBox/param.h>
|
---|
28 | #include <VBox/cfgm.h>
|
---|
29 | #include <VBox/stam.h>
|
---|
30 | #include <iprt/critsect.h>
|
---|
31 |
|
---|
32 | __BEGIN_DECLS
|
---|
33 |
|
---|
34 |
|
---|
35 | /** @defgroup grp_pdm_int Internal
|
---|
36 | * @ingroup grp_pdm
|
---|
37 | * @internal
|
---|
38 | * @{
|
---|
39 | */
|
---|
40 |
|
---|
41 | /*******************************************************************************
|
---|
42 | * Structures and Typedefs *
|
---|
43 | *******************************************************************************/
|
---|
44 |
|
---|
45 | /** Pointer to a PDM Device. */
|
---|
46 | typedef struct PDMDEV *PPDMDEV;
|
---|
47 | /** Pointer to a pointer to a PDM Device. */
|
---|
48 | typedef PPDMDEV *PPPDMDEV;
|
---|
49 |
|
---|
50 | /** Pointer to a PDM USB Device. */
|
---|
51 | typedef struct PDMUSB *PPDMUSB;
|
---|
52 | /** Pointer to a pointer to a PDM USB Device. */
|
---|
53 | typedef PPDMUSB *PPPDMUSB;
|
---|
54 |
|
---|
55 | /** Pointer to a PDM Driver. */
|
---|
56 | typedef struct PDMDRV *PPDMDRV;
|
---|
57 | /** Pointer to a pointer to a PDM Driver. */
|
---|
58 | typedef PPDMDRV *PPPDMDRV;
|
---|
59 |
|
---|
60 | /** Pointer to a PDM Logical Unit. */
|
---|
61 | typedef struct PDMLUN *PPDMLUN;
|
---|
62 | /** Pointer to a pointer to a PDM Logical Unit. */
|
---|
63 | typedef PPDMLUN *PPPDMLUN;
|
---|
64 |
|
---|
65 | /** Pointer to a PDM PCI Bus instance. */
|
---|
66 | typedef struct PDMPCIBUS *PPDMPCIBUS;
|
---|
67 | /** Pointer to a DMAC instance. */
|
---|
68 | typedef struct PDMDMAC *PPDMDMAC;
|
---|
69 | /** Pointer to a RTC instance. */
|
---|
70 | typedef struct PDMRTC *PPDMRTC;
|
---|
71 |
|
---|
72 | /** Pointer to an USB HUB registration record. */
|
---|
73 | typedef struct PDMUSBHUB *PPDMUSBHUB;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Private device instance data.
|
---|
77 | */
|
---|
78 | typedef struct PDMDEVINSINT
|
---|
79 | {
|
---|
80 | /** Pointer to the next instance (HC Ptr).
|
---|
81 | * (Head is pointed to by PDM::pDevInstances.) */
|
---|
82 | HCPTRTYPE(PPDMDEVINS) pNextHC;
|
---|
83 | /** Pointer to the next per device instance (HC Ptr).
|
---|
84 | * (Head is pointed to by PDMDEV::pInstances.) */
|
---|
85 | HCPTRTYPE(PPDMDEVINS) pPerDeviceNextHC;
|
---|
86 |
|
---|
87 | /** Pointer to device structure - HC Ptr. */
|
---|
88 | HCPTRTYPE(PPDMDEV) pDevHC;
|
---|
89 |
|
---|
90 | /** Pointer to the VM this instance was created for - HC Ptr. */
|
---|
91 | HCPTRTYPE(PVM) pVMHC;
|
---|
92 | /** Pointer to the list of logical units associated with the device. (FIFO) */
|
---|
93 | HCPTRTYPE(PPDMLUN) pLunsHC;
|
---|
94 | /** Configuration handle to the instance node. */
|
---|
95 | HCPTRTYPE(PCFGMNODE) pCfgHandle;
|
---|
96 | /** HC pointer to associated PCI device structure. */
|
---|
97 | HCPTRTYPE(struct PCIDevice *) pPciDeviceHC;
|
---|
98 | /** HC pointer to associated PCI bus structure. */
|
---|
99 | HCPTRTYPE(PPDMPCIBUS) pPciBusHC;
|
---|
100 |
|
---|
101 | /** GC pointer to associated PCI device structure. */
|
---|
102 | GCPTRTYPE(struct PCIDevice *) pPciDeviceGC;
|
---|
103 | /** Pointer to the VM this instance was created for - GC Ptr. */
|
---|
104 | GCPTRTYPE(PVM) pVMGC;
|
---|
105 | /** GC pointer to associated PCI bus structure. */
|
---|
106 | GCPTRTYPE(PPDMPCIBUS) pPciBusGC;
|
---|
107 | #if GC_ARCH_BITS == 32
|
---|
108 | uint32_t Alignment0;
|
---|
109 | #endif
|
---|
110 | } PDMDEVINSINT;
|
---|
111 |
|
---|
112 |
|
---|
113 | /**
|
---|
114 | * Private USB device instance data.
|
---|
115 | */
|
---|
116 | typedef struct PDMUSBINSINT
|
---|
117 | {
|
---|
118 | /** Pointer to the next instance.
|
---|
119 | * (Head is pointed to by PDM::pUsbInstances.) */
|
---|
120 | R3PTRTYPE(PPDMUSBINS) pNext;
|
---|
121 | /** Pointer to the next per USB device instance.
|
---|
122 | * (Head is pointed to by PDMUSB::pInstances.) */
|
---|
123 | R3PTRTYPE(PPDMUSBINS) pPerDeviceNext;
|
---|
124 |
|
---|
125 | /** Pointer to device structure. */
|
---|
126 | R3PTRTYPE(PPDMUSB) pUsb;
|
---|
127 |
|
---|
128 | /** Pointer to the VM this instance was created for. */
|
---|
129 | PVMR3 pVM;
|
---|
130 | /** Pointer to the list of logical units associated with the device. (FIFO) */
|
---|
131 | R3PTRTYPE(PPDMLUN) pLuns;
|
---|
132 | /** The per instance device configuration. */
|
---|
133 | R3PTRTYPE(PCFGMNODE) pCfg;
|
---|
134 | /** The global device configuration. */
|
---|
135 | R3PTRTYPE(PCFGMNODE) pCfgGlobal;
|
---|
136 |
|
---|
137 | /** Pointer to the USB hub this device is connected to. */
|
---|
138 | R3PTRTYPE(PPDMUSBHUB) pHub;
|
---|
139 | /** The port number that we're connected to. */
|
---|
140 | uint32_t iPort;
|
---|
141 | #if HC_ARCH_BITS == 64
|
---|
142 | uint32_t Alignment0;
|
---|
143 | #endif
|
---|
144 | } PDMUSBINSINT;
|
---|
145 |
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * Private driver instance data.
|
---|
149 | */
|
---|
150 | typedef struct PDMDRVINSINT
|
---|
151 | {
|
---|
152 | /** Pointer to the driver instance above.
|
---|
153 | * This is NULL for the topmost drive. */
|
---|
154 | PPDMDRVINS pUp;
|
---|
155 | /** Pointer to the driver instance below.
|
---|
156 | * This is NULL for the bottommost driver. */
|
---|
157 | PPDMDRVINS pDown;
|
---|
158 | /** Pointer to the logical unit this driver chained on. */
|
---|
159 | PPDMLUN pLun;
|
---|
160 | /** Pointer to driver structure from which this was instantiated. */
|
---|
161 | PPDMDRV pDrv;
|
---|
162 | /** Pointer to the VM this instance was created for. */
|
---|
163 | PVM pVM;
|
---|
164 | /** Flag indicating that the driver is being detached and destroyed.
|
---|
165 | * (Helps detect potential recursive detaching.) */
|
---|
166 | bool fDetaching;
|
---|
167 | /** Configuration handle to the instance node. */
|
---|
168 | PCFGMNODE pCfgHandle;
|
---|
169 |
|
---|
170 | } PDMDRVINSINT;
|
---|
171 |
|
---|
172 |
|
---|
173 | /**
|
---|
174 | * Private critical section data.
|
---|
175 | */
|
---|
176 | typedef struct PDMCRITSECTINT
|
---|
177 | {
|
---|
178 | /** The critical section core which is shared with IPRT. */
|
---|
179 | RTCRITSECT Core;
|
---|
180 | /** Pointer to the next critical section.
|
---|
181 | * This chain is used for relocating pVMGC and device cleanup. */
|
---|
182 | R3PTRTYPE(struct PDMCRITSECTINT *) pNext;
|
---|
183 | /** Owner identifier.
|
---|
184 | * This is pDevIns if the owner is a device. Similarily for a driver or service.
|
---|
185 | * PDMR3CritSectInit() sets this to point to the critsect itself. */
|
---|
186 | RTR3PTR pvKey;
|
---|
187 | /** Pointer to the VM - R3Ptr. */
|
---|
188 | R3PTRTYPE(PVM) pVMR3;
|
---|
189 | /** Pointer to the VM - R0Ptr. */
|
---|
190 | R0PTRTYPE(PVM) pVMR0;
|
---|
191 | /** Pointer to the VM - GCPtr. */
|
---|
192 | GCPTRTYPE(PVM) pVMGC;
|
---|
193 | #if HC_ARCH_BITS == 64 && GC_ARCH_BITS == 32
|
---|
194 | uint32_t padding;
|
---|
195 | #endif
|
---|
196 | /** Event semaphore that is scheduled to be signaled upon leaving the
|
---|
197 | * critical section. This is Ring-3 only of course. */
|
---|
198 | RTSEMEVENT EventToSignal;
|
---|
199 | /** R0/GC lock contention. */
|
---|
200 | STAMCOUNTER StatContentionR0GCLock;
|
---|
201 | /** R0/GC unlock contention. */
|
---|
202 | STAMCOUNTER StatContentionR0GCUnlock;
|
---|
203 | /** R3 lock contention. */
|
---|
204 | STAMCOUNTER StatContentionR3;
|
---|
205 | /** Profiling the time the section is locked. */
|
---|
206 | STAMPROFILEADV StatLocked;
|
---|
207 | } PDMCRITSECTINT, *PPDMCRITSECTINT;
|
---|
208 |
|
---|
209 |
|
---|
210 | /**
|
---|
211 | * The usual device/driver/internal/external stuff.
|
---|
212 | */
|
---|
213 | typedef enum
|
---|
214 | {
|
---|
215 | /** The usual invalid entry. */
|
---|
216 | PDMTHREADTYPE_INVALID = 0,
|
---|
217 | /** Device type. */
|
---|
218 | PDMTHREADTYPE_DEVICE,
|
---|
219 | /** Driver type. */
|
---|
220 | PDMTHREADTYPE_DRIVER,
|
---|
221 | /** Internal type. */
|
---|
222 | PDMTHREADTYPE_INTERNAL,
|
---|
223 | /** External type. */
|
---|
224 | PDMTHREADTYPE_EXTERNAL,
|
---|
225 | /** The usual 32-bit hack. */
|
---|
226 | PDMTHREADTYPE_32BIT_HACK = 0x7fffffff
|
---|
227 | } PDMTHREADTYPE;
|
---|
228 |
|
---|
229 |
|
---|
230 | /**
|
---|
231 | * The internal structure for the thread.
|
---|
232 | */
|
---|
233 | typedef struct PDMTHREADINT
|
---|
234 | {
|
---|
235 | /** The VM pointer. */
|
---|
236 | PVMR3 pVM;
|
---|
237 | /** The event semaphore the thread blocks on. */
|
---|
238 | RTSEMEVENTMULTI BlockEvent;
|
---|
239 | /** Pointer to the next thread. */
|
---|
240 | R3PTRTYPE(struct PDMTHREAD *) pNext;
|
---|
241 | /** The thread type. */
|
---|
242 | PDMTHREADTYPE enmType;
|
---|
243 | } PDMTHREADINT;
|
---|
244 |
|
---|
245 |
|
---|
246 |
|
---|
247 | /* Must be included after PDMDEVINSINT is defined. */
|
---|
248 | #define PDMDEVINSINT_DECLARED
|
---|
249 | #define PDMUSBINSINT_DECLARED
|
---|
250 | #define PDMDRVINSINT_DECLARED
|
---|
251 | #define PDMCRITSECTINT_DECLARED
|
---|
252 | #define PDMTHREADINT_DECLARED
|
---|
253 | #ifdef ___VBox_pdm_h
|
---|
254 | # error "Invalid header PDM order. Include PDMInternal.h before VBox/pdm.h!"
|
---|
255 | #endif
|
---|
256 | #include <VBox/pdm.h>
|
---|
257 |
|
---|
258 |
|
---|
259 | /**
|
---|
260 | * PDM Logical Unit.
|
---|
261 | *
|
---|
262 | * This typically the representation of a physical port on a
|
---|
263 | * device, like for instance the PS/2 keyboard port on the
|
---|
264 | * keyboard controller device. The LUNs are chained on the
|
---|
265 | * device the belong to (PDMDEVINSINT::pLunsHC).
|
---|
266 | */
|
---|
267 | typedef struct PDMLUN
|
---|
268 | {
|
---|
269 | /** The LUN - The Logical Unit Number. */
|
---|
270 | RTUINT iLun;
|
---|
271 | /** Pointer to the next LUN. */
|
---|
272 | PPDMLUN pNext;
|
---|
273 | /** Pointer to the top driver in the driver chain. */
|
---|
274 | PPDMDRVINS pTop;
|
---|
275 | /** Pointer to the device instance which the LUN belongs to.
|
---|
276 | * Either this is set or pUsbIns is set. Both is never set at the same time. */
|
---|
277 | PPDMDEVINS pDevIns;
|
---|
278 | /** Pointer to the USB device instance which the LUN belongs to. */
|
---|
279 | PPDMUSBINS pUsbIns;
|
---|
280 | /** Pointer to the device base interface. */
|
---|
281 | PPDMIBASE pBase;
|
---|
282 | /** Description of this LUN. */
|
---|
283 | const char *pszDesc;
|
---|
284 | } PDMLUN;
|
---|
285 |
|
---|
286 |
|
---|
287 | /**
|
---|
288 | * PDM Device.
|
---|
289 | */
|
---|
290 | typedef struct PDMDEV
|
---|
291 | {
|
---|
292 | /** Pointer to the next device (HC Ptr). */
|
---|
293 | HCPTRTYPE(PPDMDEV) pNext;
|
---|
294 | /** Device name length. (search optimization) */
|
---|
295 | RTUINT cchName;
|
---|
296 | /** Registration structure. */
|
---|
297 | HCPTRTYPE(const struct PDMDEVREG *) pDevReg;
|
---|
298 | /** Number of instances. */
|
---|
299 | RTUINT cInstances;
|
---|
300 | /** Pointer to chain of instances (HC Ptr). */
|
---|
301 | HCPTRTYPE(PPDMDEVINS) pInstances;
|
---|
302 | } PDMDEV;
|
---|
303 |
|
---|
304 |
|
---|
305 | /**
|
---|
306 | * PDM USB Device.
|
---|
307 | */
|
---|
308 | typedef struct PDMUSB
|
---|
309 | {
|
---|
310 | /** Pointer to the next device (R3 Ptr). */
|
---|
311 | R3PTRTYPE(PPDMUSB) pNext;
|
---|
312 | /** Device name length. (search optimization) */
|
---|
313 | RTUINT cchName;
|
---|
314 | /** Registration structure. */
|
---|
315 | R3PTRTYPE(const struct PDMUSBREG *) pUsbReg;
|
---|
316 | /** Next instance number. */
|
---|
317 | RTUINT iNextInstance;
|
---|
318 | /** Pointer to chain of instances (R3 Ptr). */
|
---|
319 | R3PTRTYPE(PPDMUSBINS) pInstances;
|
---|
320 | } PDMUSB;
|
---|
321 |
|
---|
322 |
|
---|
323 | /**
|
---|
324 | * PDM Driver.
|
---|
325 | */
|
---|
326 | typedef struct PDMDRV
|
---|
327 | {
|
---|
328 | /** Pointer to the next device. */
|
---|
329 | PPDMDRV pNext;
|
---|
330 | /** Registration structure. */
|
---|
331 | const struct PDMDRVREG * pDrvReg;
|
---|
332 | /** Number of instances. */
|
---|
333 | RTUINT cInstances;
|
---|
334 | } PDMDRV;
|
---|
335 |
|
---|
336 |
|
---|
337 | /**
|
---|
338 | * PDM registered PIC device.
|
---|
339 | */
|
---|
340 | typedef struct PDMPIC
|
---|
341 | {
|
---|
342 | /** Pointer to the PIC device instance - HC. */
|
---|
343 | HCPTRTYPE(PPDMDEVINS) pDevInsR3;
|
---|
344 | /** @copydoc PDMPICREG::pfnSetIrqHC */
|
---|
345 | DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
346 | /** @copydoc PDMPICREG::pfnGetInterruptHC */
|
---|
347 | DECLR3CALLBACKMEMBER(int, pfnGetInterruptR3,(PPDMDEVINS pDevIns));
|
---|
348 |
|
---|
349 | /** Pointer to the PIC device instance - R0. */
|
---|
350 | R0PTRTYPE(PPDMDEVINS) pDevInsR0;
|
---|
351 | /** @copydoc PDMPICREG::pfnSetIrqHC */
|
---|
352 | DECLR0CALLBACKMEMBER(void, pfnSetIrqR0,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
353 | /** @copydoc PDMPICREG::pfnGetInterruptHC */
|
---|
354 | DECLR0CALLBACKMEMBER(int, pfnGetInterruptR0,(PPDMDEVINS pDevIns));
|
---|
355 |
|
---|
356 | /** Pointer to the PIC device instance - GC. */
|
---|
357 | GCPTRTYPE(PPDMDEVINS) pDevInsGC;
|
---|
358 | /** @copydoc PDMPICREG::pfnSetIrqHC */
|
---|
359 | DECLGCCALLBACKMEMBER(void, pfnSetIrqGC,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
360 | /** @copydoc PDMPICREG::pfnGetInterruptHC */
|
---|
361 | DECLGCCALLBACKMEMBER(int, pfnGetInterruptGC,(PPDMDEVINS pDevIns));
|
---|
362 | #if GC_ARCH_BITS == 32
|
---|
363 | RTGCPTR GCPtrPadding; /**< Alignment padding. */
|
---|
364 | #endif
|
---|
365 | } PDMPIC;
|
---|
366 |
|
---|
367 |
|
---|
368 | /**
|
---|
369 | * PDM registered APIC device.
|
---|
370 | */
|
---|
371 | typedef struct PDMAPIC
|
---|
372 | {
|
---|
373 | /** Pointer to the APIC device instance - HC Ptr. */
|
---|
374 | PPDMDEVINSHC pDevInsR3;
|
---|
375 | /** @copydoc PDMAPICREG::pfnGetInterruptHC */
|
---|
376 | DECLR3CALLBACKMEMBER(int, pfnGetInterruptR3,(PPDMDEVINS pDevIns));
|
---|
377 | /** @copydoc PDMAPICREG::pfnSetBaseHC */
|
---|
378 | DECLR3CALLBACKMEMBER(void, pfnSetBaseR3,(PPDMDEVINS pDevIns, uint64_t u64Base));
|
---|
379 | /** @copydoc PDMAPICREG::pfnGetBaseHC */
|
---|
380 | DECLR3CALLBACKMEMBER(uint64_t, pfnGetBaseR3,(PPDMDEVINS pDevIns));
|
---|
381 | /** @copydoc PDMAPICREG::pfnSetTPRHC */
|
---|
382 | DECLR3CALLBACKMEMBER(void, pfnSetTPRR3,(PPDMDEVINS pDevIns, uint8_t u8TPR));
|
---|
383 | /** @copydoc PDMAPICREG::pfnGetTPRHC */
|
---|
384 | DECLR3CALLBACKMEMBER(uint8_t, pfnGetTPRR3,(PPDMDEVINS pDevIns));
|
---|
385 | /** @copydoc PDMAPICREG::pfnBusDeliverHC */
|
---|
386 | DECLR3CALLBACKMEMBER(void, pfnBusDeliverR3,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
|
---|
387 | uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode));
|
---|
388 |
|
---|
389 | /** Pointer to the PIC device instance - R0. */
|
---|
390 | R0PTRTYPE(PPDMDEVINS) pDevInsR0;
|
---|
391 | /** @copydoc PDMAPICREG::pfnGetInterruptHC */
|
---|
392 | DECLR0CALLBACKMEMBER(int, pfnGetInterruptR0,(PPDMDEVINS pDevIns));
|
---|
393 | /** @copydoc PDMAPICREG::pfnSetBaseHC */
|
---|
394 | DECLR0CALLBACKMEMBER(void, pfnSetBaseR0,(PPDMDEVINS pDevIns, uint64_t u64Base));
|
---|
395 | /** @copydoc PDMAPICREG::pfnGetBaseHC */
|
---|
396 | DECLR0CALLBACKMEMBER(uint64_t, pfnGetBaseR0,(PPDMDEVINS pDevIns));
|
---|
397 | /** @copydoc PDMAPICREG::pfnSetTPRHC */
|
---|
398 | DECLR0CALLBACKMEMBER(void, pfnSetTPRR0,(PPDMDEVINS pDevIns, uint8_t u8TPR));
|
---|
399 | /** @copydoc PDMAPICREG::pfnGetTPRHC */
|
---|
400 | DECLR0CALLBACKMEMBER(uint8_t, pfnGetTPRR0,(PPDMDEVINS pDevIns));
|
---|
401 | /** @copydoc PDMAPICREG::pfnBusDeliverHC */
|
---|
402 | DECLR0CALLBACKMEMBER(void, pfnBusDeliverR0,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
|
---|
403 | uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode));
|
---|
404 |
|
---|
405 | /** Pointer to the APIC device instance - GC Ptr. */
|
---|
406 | PPDMDEVINSGC pDevInsGC;
|
---|
407 | /** @copydoc PDMAPICREG::pfnGetInterruptHC */
|
---|
408 | DECLGCCALLBACKMEMBER(int, pfnGetInterruptGC,(PPDMDEVINS pDevIns));
|
---|
409 | /** @copydoc PDMAPICREG::pfnSetBaseHC */
|
---|
410 | DECLGCCALLBACKMEMBER(void, pfnSetBaseGC,(PPDMDEVINS pDevIns, uint64_t u64Base));
|
---|
411 | /** @copydoc PDMAPICREG::pfnGetBaseHC */
|
---|
412 | DECLGCCALLBACKMEMBER(uint64_t, pfnGetBaseGC,(PPDMDEVINS pDevIns));
|
---|
413 | /** @copydoc PDMAPICREG::pfnSetTPRHC */
|
---|
414 | DECLGCCALLBACKMEMBER(void, pfnSetTPRGC,(PPDMDEVINS pDevIns, uint8_t u8TPR));
|
---|
415 | /** @copydoc PDMAPICREG::pfnGetTPRHC */
|
---|
416 | DECLGCCALLBACKMEMBER(uint8_t, pfnGetTPRGC,(PPDMDEVINS pDevIns));
|
---|
417 | /** @copydoc PDMAPICREG::pfnBusDeliverHC */
|
---|
418 | DECLGCCALLBACKMEMBER(void, pfnBusDeliverGC,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
|
---|
419 | uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode));
|
---|
420 | #if GC_ARCH_BITS == 32
|
---|
421 | RTGCPTR GCPtrPadding; /**< Alignment padding. */
|
---|
422 | #endif
|
---|
423 | } PDMAPIC;
|
---|
424 |
|
---|
425 |
|
---|
426 | /**
|
---|
427 | * PDM registered I/O APIC device.
|
---|
428 | */
|
---|
429 | typedef struct PDMIOAPIC
|
---|
430 | {
|
---|
431 | /** Pointer to the APIC device instance - HC Ptr. */
|
---|
432 | PPDMDEVINSHC pDevInsR3;
|
---|
433 | /** @copydoc PDMIOAPICREG::pfnSetIrqHC */
|
---|
434 | DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
435 |
|
---|
436 | /** Pointer to the PIC device instance - R0. */
|
---|
437 | R0PTRTYPE(PPDMDEVINS) pDevInsR0;
|
---|
438 | /** @copydoc PDMIOAPICREG::pfnSetIrqHC */
|
---|
439 | DECLR0CALLBACKMEMBER(void, pfnSetIrqR0,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
440 |
|
---|
441 | /** Pointer to the APIC device instance - GC Ptr. */
|
---|
442 | PPDMDEVINSGC pDevInsGC;
|
---|
443 | /** @copydoc PDMIOAPICREG::pfnSetIrqHC */
|
---|
444 | DECLGCCALLBACKMEMBER(void, pfnSetIrqGC,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
445 | } PDMIOAPIC;
|
---|
446 |
|
---|
447 |
|
---|
448 | /**
|
---|
449 | * PDM PCI Bus instance.
|
---|
450 | */
|
---|
451 | typedef struct PDMPCIBUS
|
---|
452 | {
|
---|
453 | /** PCI bus number. */
|
---|
454 | RTUINT iBus;
|
---|
455 | RTUINT uPadding0; /**< Alignment padding.*/
|
---|
456 |
|
---|
457 | /** Pointer to PCI Bus device instance. */
|
---|
458 | PPDMDEVINSHC pDevInsR3;
|
---|
459 | /** @copydoc PDMPCIBUSREG::pfnSetIrqHC */
|
---|
460 | DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel));
|
---|
461 | /** @copydoc PDMPCIBUSREG::pfnRegisterHC */
|
---|
462 | DECLR3CALLBACKMEMBER(int, pfnRegisterR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, const char *pszName, int iDev));
|
---|
463 | /** @copydoc PDMPCIBUSREG::pfnIORegionRegisterHC */
|
---|
464 | DECLR3CALLBACKMEMBER(int, pfnIORegionRegisterR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iRegion, uint32_t cbRegion,
|
---|
465 | PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback));
|
---|
466 | /** @copydoc PDMPCIBUSREG::pfnSetConfigCallbacksHC */
|
---|
467 | DECLR3CALLBACKMEMBER(void, pfnSetConfigCallbacksR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PFNPCICONFIGREAD pfnRead,
|
---|
468 | PPFNPCICONFIGREAD ppfnReadOld, PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld));
|
---|
469 | /** @copydoc PDMPCIBUSREG::pfnSaveExecHC */
|
---|
470 | DECLR3CALLBACKMEMBER(int, pfnSaveExecR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle));
|
---|
471 | /** @copydoc PDMPCIBUSREG::pfnLoadExecHC */
|
---|
472 | DECLR3CALLBACKMEMBER(int, pfnLoadExecR3,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSMHandle));
|
---|
473 | /** @copydoc PDMPCIBUSREG::pfnFakePCIBIOSHC */
|
---|
474 | DECLR3CALLBACKMEMBER(int, pfnFakePCIBIOSR3,(PPDMDEVINS pDevIns));
|
---|
475 |
|
---|
476 | /** Pointer to the PIC device instance - R0. */
|
---|
477 | R0PTRTYPE(PPDMDEVINS) pDevInsR0;
|
---|
478 | /** @copydoc PDMPCIBUSREG::pfnSetIrqHC */
|
---|
479 | DECLR0CALLBACKMEMBER(void, pfnSetIrqR0,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel));
|
---|
480 |
|
---|
481 | /** Pointer to PCI Bus device instance. */
|
---|
482 | PPDMDEVINSGC pDevInsGC;
|
---|
483 | /** @copydoc PDMPCIBUSREG::pfnSetIrqHC */
|
---|
484 | DECLGCCALLBACKMEMBER(void, pfnSetIrqGC,(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, int iIrq, int iLevel));
|
---|
485 | } PDMPCIBUS;
|
---|
486 |
|
---|
487 |
|
---|
488 | #ifdef IN_RING3
|
---|
489 | /**
|
---|
490 | * PDM registered DMAC (DMA Controller) device.
|
---|
491 | */
|
---|
492 | typedef struct PDMDMAC
|
---|
493 | {
|
---|
494 | /** Pointer to the DMAC device instance. */
|
---|
495 | PPDMDEVINS pDevIns;
|
---|
496 | /** Copy of the registration structure. */
|
---|
497 | PDMDMACREG Reg;
|
---|
498 | } PDMDMAC;
|
---|
499 |
|
---|
500 |
|
---|
501 | /**
|
---|
502 | * PDM registered RTC (Real Time Clock) device.
|
---|
503 | */
|
---|
504 | typedef struct PDMRTC
|
---|
505 | {
|
---|
506 | /** Pointer to the RTC device instance. */
|
---|
507 | PPDMDEVINS pDevIns;
|
---|
508 | /** Copy of the registration structure. */
|
---|
509 | PDMRTCREG Reg;
|
---|
510 | } PDMRTC;
|
---|
511 |
|
---|
512 | #endif /* IN_RING3 */
|
---|
513 |
|
---|
514 | /**
|
---|
515 | * Module type.
|
---|
516 | */
|
---|
517 | typedef enum PDMMODTYPE
|
---|
518 | {
|
---|
519 | /** Guest context module. */
|
---|
520 | PDMMOD_TYPE_GC,
|
---|
521 | /** Ring-0 (host) context module. */
|
---|
522 | PDMMOD_TYPE_R0,
|
---|
523 | /** Ring-3 (host) context module. */
|
---|
524 | PDMMOD_TYPE_R3
|
---|
525 | } PDMMODTYPE, *PPDMMODTYPE;
|
---|
526 |
|
---|
527 |
|
---|
528 | /** The module name length including the terminator. */
|
---|
529 | #define PDMMOD_NAME_LEN 32
|
---|
530 |
|
---|
531 | /**
|
---|
532 | * Loaded module instance.
|
---|
533 | */
|
---|
534 | typedef struct PDMMOD
|
---|
535 | {
|
---|
536 | /** Module name. This is used for refering to
|
---|
537 | * the module internally, sort of like a handle. */
|
---|
538 | char szName[PDMMOD_NAME_LEN];
|
---|
539 | /** Module type. */
|
---|
540 | PDMMODTYPE eType;
|
---|
541 | /** Loader module handle. Not used for R0 modules. */
|
---|
542 | RTLDRMOD hLdrMod;
|
---|
543 | /** Loaded address.
|
---|
544 | * This is the 'handle' for R0 modules. */
|
---|
545 | RTUINTPTR ImageBase;
|
---|
546 | /** Old loaded address.
|
---|
547 | * This is used during relocation of GC modules. Not used for R0 modules. */
|
---|
548 | RTUINTPTR OldImageBase;
|
---|
549 | /** Where the R3 HC bits are stored.
|
---|
550 | * This can be equal to ImageBase but doesn't have to. Not used for R0 modules. */
|
---|
551 | void *pvBits;
|
---|
552 |
|
---|
553 | /** Pointer to next module. */
|
---|
554 | struct PDMMOD *pNext;
|
---|
555 | /** Module filename. */
|
---|
556 | char szFilename[1];
|
---|
557 | } PDMMOD;
|
---|
558 | /** Pointer to loaded module instance. */
|
---|
559 | typedef PDMMOD *PPDMMOD;
|
---|
560 |
|
---|
561 |
|
---|
562 |
|
---|
563 | /** Extra space in the free array. */
|
---|
564 | #define PDMQUEUE_FREE_SLACK 16
|
---|
565 |
|
---|
566 | /**
|
---|
567 | * Queue type.
|
---|
568 | */
|
---|
569 | typedef enum PDMQUEUETYPE
|
---|
570 | {
|
---|
571 | /** Device consumer. */
|
---|
572 | PDMQUEUETYPE_DEV = 1,
|
---|
573 | /** Driver consumer. */
|
---|
574 | PDMQUEUETYPE_DRV,
|
---|
575 | /** Internal consumer. */
|
---|
576 | PDMQUEUETYPE_INTERNAL,
|
---|
577 | /** External consumer. */
|
---|
578 | PDMQUEUETYPE_EXTERNAL
|
---|
579 | } PDMQUEUETYPE;
|
---|
580 |
|
---|
581 | /** Pointer to a PDM Queue. */
|
---|
582 | typedef struct PDMQUEUE *PPDMQUEUE;
|
---|
583 |
|
---|
584 | /**
|
---|
585 | * PDM Queue.
|
---|
586 | */
|
---|
587 | typedef struct PDMQUEUE
|
---|
588 | {
|
---|
589 | /** Pointer to the next queue in the list. */
|
---|
590 | HCPTRTYPE(PPDMQUEUE) pNext;
|
---|
591 | /** Type specific data. */
|
---|
592 | union
|
---|
593 | {
|
---|
594 | /** PDMQUEUETYPE_DEV */
|
---|
595 | struct
|
---|
596 | {
|
---|
597 | /** Pointer to consumer function. */
|
---|
598 | HCPTRTYPE(PFNPDMQUEUEDEV) pfnCallback;
|
---|
599 | /** Pointer to the device instance owning the queue. */
|
---|
600 | HCPTRTYPE(PPDMDEVINS) pDevIns;
|
---|
601 | } Dev;
|
---|
602 | /** PDMQUEUETYPE_DRV */
|
---|
603 | struct
|
---|
604 | {
|
---|
605 | /** Pointer to consumer function. */
|
---|
606 | HCPTRTYPE(PFNPDMQUEUEDRV) pfnCallback;
|
---|
607 | /** Pointer to the driver instance owning the queue. */
|
---|
608 | HCPTRTYPE(PPDMDRVINS) pDrvIns;
|
---|
609 | } Drv;
|
---|
610 | /** PDMQUEUETYPE_INTERNAL */
|
---|
611 | struct
|
---|
612 | {
|
---|
613 | /** Pointer to consumer function. */
|
---|
614 | HCPTRTYPE(PFNPDMQUEUEINT) pfnCallback;
|
---|
615 | } Int;
|
---|
616 | /** PDMQUEUETYPE_EXTERNAL */
|
---|
617 | struct
|
---|
618 | {
|
---|
619 | /** Pointer to consumer function. */
|
---|
620 | HCPTRTYPE(PFNPDMQUEUEEXT) pfnCallback;
|
---|
621 | /** Pointer to user argument. */
|
---|
622 | HCPTRTYPE(void *) pvUser;
|
---|
623 | } Ext;
|
---|
624 | } u;
|
---|
625 | /** Queue type. */
|
---|
626 | PDMQUEUETYPE enmType;
|
---|
627 | /** The interval between checking the queue for events.
|
---|
628 | * The realtime timer below is used to do the waiting.
|
---|
629 | * If 0, the queue will use the VM_FF_PDM_QUEUE forced action. */
|
---|
630 | uint32_t cMilliesInterval;
|
---|
631 | /** Interval timer. Only used if cMilliesInterval is non-zero. */
|
---|
632 | PTMTIMERHC pTimer;
|
---|
633 | /** Pointer to the VM. */
|
---|
634 | HCPTRTYPE(PVM) pVMHC;
|
---|
635 | /** LIFO of pending items - HC. */
|
---|
636 | HCPTRTYPE(PPDMQUEUEITEMCORE) volatile pPendingHC;
|
---|
637 | /** Pointer to the GC VM and indicator for GC enabled queue.
|
---|
638 | * If this is NULL, the queue cannot be used in GC.
|
---|
639 | */
|
---|
640 | GCPTRTYPE(PVM) pVMGC;
|
---|
641 | /** LIFO of pending items - GC. */
|
---|
642 | GCPTRTYPE(PPDMQUEUEITEMCORE) pPendingGC;
|
---|
643 | /** Item size (bytes). */
|
---|
644 | RTUINT cbItem;
|
---|
645 | /** Number of items in the queue. */
|
---|
646 | RTUINT cItems;
|
---|
647 | /** Index to the free head (where we insert). */
|
---|
648 | uint32_t volatile iFreeHead;
|
---|
649 | /** Index to the free tail (where we remove). */
|
---|
650 | uint32_t volatile iFreeTail;
|
---|
651 | /** Array of pointers to free items. Variable size. */
|
---|
652 | struct PDMQUEUEFREEITEM
|
---|
653 | {
|
---|
654 | /** Pointer to the free item - HC Ptr. */
|
---|
655 | HCPTRTYPE(PPDMQUEUEITEMCORE) volatile pItemHC;
|
---|
656 | /** Pointer to the free item - GC Ptr. */
|
---|
657 | GCPTRTYPE(PPDMQUEUEITEMCORE) volatile pItemGC;
|
---|
658 | #if HC_ARCH_BITS == 64 && GC_ARCH_BITS == 32
|
---|
659 | uint32_t Alignment0;
|
---|
660 | #endif
|
---|
661 | } aFreeItems[1];
|
---|
662 | } PDMQUEUE;
|
---|
663 |
|
---|
664 |
|
---|
665 | /**
|
---|
666 | * Queue device helper task operation.
|
---|
667 | */
|
---|
668 | typedef enum PDMDEVHLPTASKOP
|
---|
669 | {
|
---|
670 | /** The usual invalid 0 entry. */
|
---|
671 | PDMDEVHLPTASKOP_INVALID = 0,
|
---|
672 | /** ISASetIrq */
|
---|
673 | PDMDEVHLPTASKOP_ISA_SET_IRQ,
|
---|
674 | /** PCISetIrq */
|
---|
675 | PDMDEVHLPTASKOP_PCI_SET_IRQ,
|
---|
676 | /** PCISetIrq */
|
---|
677 | PDMDEVHLPTASKOP_IOAPIC_SET_IRQ,
|
---|
678 | /** The usual 32-bit hack. */
|
---|
679 | PDMDEVHLPTASKOP_32BIT_HACK = 0x7fffffff
|
---|
680 | } PDMDEVHLPTASKOP;
|
---|
681 |
|
---|
682 | /**
|
---|
683 | * Queued Device Helper Task.
|
---|
684 | */
|
---|
685 | typedef struct PDMDEVHLPTASK
|
---|
686 | {
|
---|
687 | /** The queue item core (don't touch). */
|
---|
688 | PDMQUEUEITEMCORE Core;
|
---|
689 | /** Pointer to the device instance (HC Ptr). */
|
---|
690 | HCPTRTYPE(PPDMDEVINS) pDevInsHC;
|
---|
691 | /** This operation to perform. */
|
---|
692 | PDMDEVHLPTASKOP enmOp;
|
---|
693 | #if HC_ARCH_BITS == 64
|
---|
694 | uint32_t Alignment0;
|
---|
695 | #endif
|
---|
696 | /** Parameters to the operation. */
|
---|
697 | union PDMDEVHLPTASKPARAMS
|
---|
698 | {
|
---|
699 | /**
|
---|
700 | * PDMDEVHLPTASKOP_ISA_SET_IRQ and PDMDEVHLPTASKOP_PCI_SET_IRQ.
|
---|
701 | */
|
---|
702 | struct PDMDEVHLPTASKSETIRQ
|
---|
703 | {
|
---|
704 | /** The IRQ */
|
---|
705 | int iIrq;
|
---|
706 | /** The new level. */
|
---|
707 | int iLevel;
|
---|
708 | } SetIRQ;
|
---|
709 | } u;
|
---|
710 | } PDMDEVHLPTASK;
|
---|
711 | /** Pointer to a queued Device Helper Task. */
|
---|
712 | typedef PDMDEVHLPTASK *PPDMDEVHLPTASK;
|
---|
713 | /** Pointer to a const queued Device Helper Task. */
|
---|
714 | typedef const PDMDEVHLPTASK *PCPDMDEVHLPTASK;
|
---|
715 |
|
---|
716 |
|
---|
717 |
|
---|
718 | /**
|
---|
719 | * An USB hub registration record.
|
---|
720 | */
|
---|
721 | typedef struct PDMUSBHUB
|
---|
722 | {
|
---|
723 | /** The USB versions this hub support.
|
---|
724 | * Note that 1.1 hubs can take on 2.0 devices. */
|
---|
725 | uint32_t fVersions;
|
---|
726 | /** The number of occupied ports. */
|
---|
727 | uint32_t cAvailablePorts;
|
---|
728 | /** Pointer to the next hub in the list. */
|
---|
729 | struct PDMUSBHUB *pNext;
|
---|
730 | /** The driver instance of the hub.. */
|
---|
731 | PPDMDRVINS pDrvIns;
|
---|
732 |
|
---|
733 | } PDMUSBHUB;
|
---|
734 |
|
---|
735 | /** Pointer to a const USB HUB registration record. */
|
---|
736 | typedef const PDMUSBHUB *PCPDMUSBHUB;
|
---|
737 |
|
---|
738 |
|
---|
739 | /**
|
---|
740 | * Converts a PDM pointer into a VM pointer.
|
---|
741 | * @returns Pointer to the VM structure the PDM is part of.
|
---|
742 | * @param pPDM Pointer to PDM instance data.
|
---|
743 | */
|
---|
744 | #define PDM2VM(pPDM) ( (PVM)((char*)pPDM - pPDM->offVM) )
|
---|
745 |
|
---|
746 |
|
---|
747 | /**
|
---|
748 | * PDM VM Instance data.
|
---|
749 | * Changes to this must checked against the padding of the cfgm union in VM!
|
---|
750 | */
|
---|
751 | typedef struct PDM
|
---|
752 | {
|
---|
753 | /** Offset to the VM structure.
|
---|
754 | * See PDM2VM(). */
|
---|
755 | RTUINT offVM;
|
---|
756 | RTUINT uPadding0; /**< Alignment padding.*/
|
---|
757 |
|
---|
758 | /** Pointer to list of loaded modules. This is HC only! */
|
---|
759 | HCPTRTYPE(PPDMMOD) pModules;
|
---|
760 |
|
---|
761 | /** List of registered devices. (FIFO) */
|
---|
762 | HCPTRTYPE(PPDMDEV) pDevs;
|
---|
763 | /** List of devices instances. (FIFO) */
|
---|
764 | HCPTRTYPE(PPDMDEVINS) pDevInstances;
|
---|
765 | /** List of registered USB devices. (FIFO) */
|
---|
766 | R3PTRTYPE(PPDMUSB) pUsbDevs;
|
---|
767 | /** List of USB devices instances. (FIFO) */
|
---|
768 | R3PTRTYPE(PPDMUSBINS) pUsbInstances;
|
---|
769 | /** List of registered drivers. (FIFO) */
|
---|
770 | HCPTRTYPE(PPDMDRV) pDrvs;
|
---|
771 | /** List of initialized critical sections. (LIFO) */
|
---|
772 | HCPTRTYPE(PPDMCRITSECTINT) pCritSects;
|
---|
773 | /** PCI Buses. */
|
---|
774 | PDMPCIBUS aPciBuses[1];
|
---|
775 | /** The register PIC device. */
|
---|
776 | PDMPIC Pic;
|
---|
777 | /** The registerd APIC device. */
|
---|
778 | PDMAPIC Apic;
|
---|
779 | /** The registerd I/O APIC device. */
|
---|
780 | PDMIOAPIC IoApic;
|
---|
781 | /** The registered DMAC device. */
|
---|
782 | HCPTRTYPE(PPDMDMAC) pDmac;
|
---|
783 | /** The registered RTC device. */
|
---|
784 | HCPTRTYPE(PPDMRTC) pRtc;
|
---|
785 | /** The registered USB HUBs. (FIFO) */
|
---|
786 | R3PTRTYPE(PPDMUSBHUB) pUsbHubs;
|
---|
787 |
|
---|
788 | /** Queue in which devhlp tasks are queued for R3 execution - HC Ptr. */
|
---|
789 | HCPTRTYPE(PPDMQUEUE) pDevHlpQueueHC;
|
---|
790 | /** Queue in which devhlp tasks are queued for R3 execution - GC Ptr. */
|
---|
791 | GCPTRTYPE(PPDMQUEUE) pDevHlpQueueGC;
|
---|
792 |
|
---|
793 | /** The number of entries in the apQueuedCritSectsLeaves table that's currnetly in use. */
|
---|
794 | RTUINT cQueuedCritSectLeaves;
|
---|
795 | /** Critical sections queued in GC/R0 because of contention preventing leave to complete. (R3 Ptrs)
|
---|
796 | * We will return to Ring-3 ASAP, so this queue doesn't has to be very long. */
|
---|
797 | R3PTRTYPE(PPDMCRITSECT) apQueuedCritSectsLeaves[8];
|
---|
798 |
|
---|
799 | /** Linked list of timer driven PDM queues. */
|
---|
800 | HCPTRTYPE(struct PDMQUEUE *) pQueuesTimer;
|
---|
801 | /** Linked list of force action driven PDM queues. */
|
---|
802 | HCPTRTYPE(struct PDMQUEUE *) pQueuesForced;
|
---|
803 | /** Pointer to the queue which should be manually flushed - HCPtr.
|
---|
804 | * Only touched by EMT. */
|
---|
805 | HCPTRTYPE(struct PDMQUEUE *) pQueueFlushHC;
|
---|
806 | /** Pointer to the queue which should be manually flushed - GCPtr. */
|
---|
807 | GCPTRTYPE(struct PDMQUEUE *) pQueueFlushGC;
|
---|
808 | #if HC_ARCH_BITS == 64
|
---|
809 | uint32_t padding0;
|
---|
810 | #endif
|
---|
811 |
|
---|
812 | /** Head of the PDM Thread list. (singly linked) */
|
---|
813 | R3PTRTYPE(PPDMTHREAD) pThreads;
|
---|
814 | /** Tail of the PDM Thread list. (singly linked) */
|
---|
815 | R3PTRTYPE(PPDMTHREAD) pThreadsTail;
|
---|
816 |
|
---|
817 | /** TEMPORARY HACKS FOR NETWORK POLLING.
|
---|
818 | * @todo fix NAT and kill this!
|
---|
819 | * @{ */
|
---|
820 | RTUINT cPollers;
|
---|
821 | #if HC_ARCH_BITS == 64
|
---|
822 | RTUINT padding1;
|
---|
823 | #endif
|
---|
824 | HCPTRTYPE(PFNPDMDRVPOLLER) apfnPollers[16];
|
---|
825 | HCPTRTYPE(PPDMDRVINS) aDrvInsPollers[16];
|
---|
826 | PTMTIMERHC pTimerPollers;
|
---|
827 | /** @} */
|
---|
828 |
|
---|
829 | #ifdef VBOX_WITH_PDM_LOCK
|
---|
830 | /** The PDM lock.
|
---|
831 | * This is used to protect everything that deals with interrupts, i.e.
|
---|
832 | * the PIC, APIC, IOAPIC and PCI devices pluss some PDM functions. */
|
---|
833 | PDMCRITSECT CritSect;
|
---|
834 | #endif
|
---|
835 |
|
---|
836 |
|
---|
837 | /** Number of times a critical section leave requesed needed to be queued for ring-3 execution. */
|
---|
838 | STAMCOUNTER StatQueuedCritSectLeaves;
|
---|
839 | } PDM;
|
---|
840 | /** Pointer to PDM VM instance data. */
|
---|
841 | typedef PDM *PPDM;
|
---|
842 |
|
---|
843 |
|
---|
844 |
|
---|
845 | /*******************************************************************************
|
---|
846 | * Global Variables *
|
---|
847 | *******************************************************************************/
|
---|
848 | #ifdef IN_RING3
|
---|
849 | extern const PDMDRVHLP g_pdmR3DrvHlp;
|
---|
850 | #endif
|
---|
851 |
|
---|
852 |
|
---|
853 | /*******************************************************************************
|
---|
854 | * Internal Functions *
|
---|
855 | *******************************************************************************/
|
---|
856 | int pdmR3CritSectInit(PVM pVM);
|
---|
857 | int pdmR3CritSectTerm(PVM pVM);
|
---|
858 | void pdmR3CritSectRelocate(PVM pVM);
|
---|
859 | int pdmR3CritSectInitDevice(PVM pVM, PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, const char *pszName);
|
---|
860 | int pdmR3CritSectDeleteDevice(PVM pVM, PPDMDEVINS pDevIns);
|
---|
861 |
|
---|
862 | int pdmR3DevInit(PVM pVM);
|
---|
863 | PPDMDEV pdmR3DevLookup(PVM pVM, const char *pszName);
|
---|
864 | int pdmR3DevFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMLUN *ppLun);
|
---|
865 |
|
---|
866 | int pdmR3UsbLoadModules(PVM pVM);
|
---|
867 | int pdmR3UsbInstantiateDevices(PVM pVM);
|
---|
868 | int pdmR3UsbInitComplete(PVM pVM);
|
---|
869 | PPDMUSB pdmR3UsbLookup(PVM pVM, const char *pszName);
|
---|
870 | int pdmR3UsbFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMLUN *ppLun);
|
---|
871 |
|
---|
872 | int pdmR3DrvInit(PVM pVM);
|
---|
873 | int pdmR3DrvDetach(PPDMDRVINS pDrvIns);
|
---|
874 | PPDMDRV pdmR3DrvLookup(PVM pVM, const char *pszName);
|
---|
875 |
|
---|
876 | int pdmR3LdrInit(PVM pVM);
|
---|
877 | void pdmR3LdrTerm(PVM pVM);
|
---|
878 | char * pdmR3FileR3(const char *pszFile, bool fShared = false);
|
---|
879 | int pdmR3LoadR3(PVM pVM, const char *pszFilename, const char *pszName);
|
---|
880 |
|
---|
881 | void pdmR3QueueRelocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
882 |
|
---|
883 | void pdmR3ThreadDestroyDevice(PVM pVM, PPDMDEVINS pDevIns);
|
---|
884 | void pdmR3ThreadDestroyUsb(PVM pVM, PPDMUSBINS pUsbIns);
|
---|
885 | void pdmR3ThreadDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns);
|
---|
886 | void pdmR3ThreadDestroyAll(PVM pVM);
|
---|
887 | int pdmR3ThreadResumeAll(PVM pVM);
|
---|
888 | int pdmR3ThreadSuspendAll(PVM pVM);
|
---|
889 |
|
---|
890 | #ifdef VBOX_WITH_PDM_LOCK
|
---|
891 | void pdmLock(PVM pVM);
|
---|
892 | int pdmLockEx(PVM pVM, int rc);
|
---|
893 | void pdmUnlock(PVM pVM);
|
---|
894 | #else
|
---|
895 | # define pdmLock(pVM) do {} while (0)
|
---|
896 | # define pdmLockEx(pVM, rc) (VINF_SUCCESS)
|
---|
897 | # define pdmUnlock(pVM) do {} while (0)
|
---|
898 | #endif
|
---|
899 |
|
---|
900 | /** @} */
|
---|
901 |
|
---|
902 | __END_DECLS
|
---|
903 |
|
---|
904 | #endif
|
---|