1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Devices.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2016 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_pdmdev_h
|
---|
27 | #define ___VBox_vmm_pdmdev_h
|
---|
28 |
|
---|
29 | #include <VBox/vmm/pdmqueue.h>
|
---|
30 | #include <VBox/vmm/pdmcritsect.h>
|
---|
31 | #include <VBox/vmm/pdmthread.h>
|
---|
32 | #include <VBox/vmm/pdmifs.h>
|
---|
33 | #include <VBox/vmm/pdmins.h>
|
---|
34 | #include <VBox/vmm/pdmcommon.h>
|
---|
35 | #include <VBox/vmm/pdmpcidev.h>
|
---|
36 | #include <VBox/vmm/iom.h>
|
---|
37 | #include <VBox/vmm/tm.h>
|
---|
38 | #include <VBox/vmm/ssm.h>
|
---|
39 | #include <VBox/vmm/cfgm.h>
|
---|
40 | #include <VBox/vmm/dbgf.h>
|
---|
41 | #include <VBox/err.h>
|
---|
42 | #include <VBox/pci.h>
|
---|
43 | #include <VBox/sup.h>
|
---|
44 | #include <iprt/stdarg.h>
|
---|
45 |
|
---|
46 |
|
---|
47 | RT_C_DECLS_BEGIN
|
---|
48 |
|
---|
49 | /** @defgroup grp_pdm_device The PDM Devices API
|
---|
50 | * @ingroup grp_pdm
|
---|
51 | * @{
|
---|
52 | */
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Construct a device instance for a VM.
|
---|
56 | *
|
---|
57 | * @returns VBox status.
|
---|
58 | * @param pDevIns The device instance data. If the registration structure
|
---|
59 | * is needed, it can be accessed thru pDevIns->pReg.
|
---|
60 | * @param iInstance Instance number. Use this to figure out which registers
|
---|
61 | * and such to use. The instance number is also found in
|
---|
62 | * pDevIns->iInstance, but since it's likely to be
|
---|
63 | * frequently used PDM passes it as parameter.
|
---|
64 | * @param pCfg Configuration node handle for the driver. This is
|
---|
65 | * expected to be in high demand in the constructor and is
|
---|
66 | * therefore passed as an argument. When using it at other
|
---|
67 | * times, it can be found in pDevIns->pCfg.
|
---|
68 | */
|
---|
69 | typedef DECLCALLBACK(int) FNPDMDEVCONSTRUCT(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg);
|
---|
70 | /** Pointer to a FNPDMDEVCONSTRUCT() function. */
|
---|
71 | typedef FNPDMDEVCONSTRUCT *PFNPDMDEVCONSTRUCT;
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Destruct a device instance.
|
---|
75 | *
|
---|
76 | * Most VM resources are freed by the VM. This callback is provided so that any non-VM
|
---|
77 | * resources can be freed correctly.
|
---|
78 | *
|
---|
79 | * @returns VBox status.
|
---|
80 | * @param pDevIns The device instance data.
|
---|
81 | *
|
---|
82 | * @remarks The device critical section is not entered. The routine may delete
|
---|
83 | * the critical section, so the caller cannot exit it.
|
---|
84 | */
|
---|
85 | typedef DECLCALLBACK(int) FNPDMDEVDESTRUCT(PPDMDEVINS pDevIns);
|
---|
86 | /** Pointer to a FNPDMDEVDESTRUCT() function. */
|
---|
87 | typedef FNPDMDEVDESTRUCT *PFNPDMDEVDESTRUCT;
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Device relocation callback.
|
---|
91 | *
|
---|
92 | * This is called when the instance data has been relocated in raw-mode context
|
---|
93 | * (RC). It is also called when the RC hypervisor selects changes. The device
|
---|
94 | * must fixup all necessary pointers and re-query all interfaces to other RC
|
---|
95 | * devices and drivers.
|
---|
96 | *
|
---|
97 | * Before the RC code is executed the first time, this function will be called
|
---|
98 | * with a 0 delta so RC pointer calculations can be one in one place.
|
---|
99 | *
|
---|
100 | * @param pDevIns Pointer to the device instance.
|
---|
101 | * @param offDelta The relocation delta relative to the old location.
|
---|
102 | *
|
---|
103 | * @remarks A relocation CANNOT fail.
|
---|
104 | *
|
---|
105 | * @remarks The device critical section is not entered. The relocations should
|
---|
106 | * not normally require any locking.
|
---|
107 | */
|
---|
108 | typedef DECLCALLBACK(void) FNPDMDEVRELOCATE(PPDMDEVINS pDevIns, RTGCINTPTR offDelta);
|
---|
109 | /** Pointer to a FNPDMDEVRELOCATE() function. */
|
---|
110 | typedef FNPDMDEVRELOCATE *PFNPDMDEVRELOCATE;
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Power On notification.
|
---|
114 | *
|
---|
115 | * @returns VBox status.
|
---|
116 | * @param pDevIns The device instance data.
|
---|
117 | *
|
---|
118 | * @remarks Caller enters the device critical section.
|
---|
119 | */
|
---|
120 | typedef DECLCALLBACK(void) FNPDMDEVPOWERON(PPDMDEVINS pDevIns);
|
---|
121 | /** Pointer to a FNPDMDEVPOWERON() function. */
|
---|
122 | typedef FNPDMDEVPOWERON *PFNPDMDEVPOWERON;
|
---|
123 |
|
---|
124 | /**
|
---|
125 | * Reset notification.
|
---|
126 | *
|
---|
127 | * @returns VBox status.
|
---|
128 | * @param pDevIns The device instance data.
|
---|
129 | *
|
---|
130 | * @remarks Caller enters the device critical section.
|
---|
131 | */
|
---|
132 | typedef DECLCALLBACK(void) FNPDMDEVRESET(PPDMDEVINS pDevIns);
|
---|
133 | /** Pointer to a FNPDMDEVRESET() function. */
|
---|
134 | typedef FNPDMDEVRESET *PFNPDMDEVRESET;
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * Soft reset notification.
|
---|
138 | *
|
---|
139 | * This is mainly for emulating the 286 style protected mode exits, in which
|
---|
140 | * most devices should remain in their current state.
|
---|
141 | *
|
---|
142 | * @returns VBox status.
|
---|
143 | * @param pDevIns The device instance data.
|
---|
144 | * @param fFlags PDMVMRESET_F_XXX (only bits relevant to soft resets).
|
---|
145 | *
|
---|
146 | * @remarks Caller enters the device critical section.
|
---|
147 | */
|
---|
148 | typedef DECLCALLBACK(void) FNPDMDEVSOFTRESET(PPDMDEVINS pDevIns, uint32_t fFlags);
|
---|
149 | /** Pointer to a FNPDMDEVSOFTRESET() function. */
|
---|
150 | typedef FNPDMDEVSOFTRESET *PFNPDMDEVSOFTRESET;
|
---|
151 |
|
---|
152 | /** @name PDMVMRESET_F_XXX - VM reset flags.
|
---|
153 | * These flags are used both for FNPDMDEVSOFTRESET and for hardware signalling
|
---|
154 | * reset via PDMDevHlpVMReset.
|
---|
155 | * @{ */
|
---|
156 | /** Unknown reason. */
|
---|
157 | #define PDMVMRESET_F_UNKNOWN UINT32_C(0x00000000)
|
---|
158 | /** GIM triggered reset. */
|
---|
159 | #define PDMVMRESET_F_GIM UINT32_C(0x00000001)
|
---|
160 | /** The last source always causing hard resets. */
|
---|
161 | #define PDMVMRESET_F_LAST_ALWAYS_HARD PDMVMRESET_F_GIM
|
---|
162 | /** ACPI triggered reset. */
|
---|
163 | #define PDMVMRESET_F_ACPI UINT32_C(0x0000000c)
|
---|
164 | /** PS/2 system port A (92h) reset. */
|
---|
165 | #define PDMVMRESET_F_PORT_A UINT32_C(0x0000000d)
|
---|
166 | /** Keyboard reset. */
|
---|
167 | #define PDMVMRESET_F_KBD UINT32_C(0x0000000e)
|
---|
168 | /** Tripple fault. */
|
---|
169 | #define PDMVMRESET_F_TRIPLE_FAULT UINT32_C(0x0000000f)
|
---|
170 | /** Reset source mask. */
|
---|
171 | #define PDMVMRESET_F_SRC_MASK UINT32_C(0x0000000f)
|
---|
172 | /** @} */
|
---|
173 |
|
---|
174 | /**
|
---|
175 | * Suspend notification.
|
---|
176 | *
|
---|
177 | * @returns VBox status.
|
---|
178 | * @param pDevIns The device instance data.
|
---|
179 | * @thread EMT(0)
|
---|
180 | *
|
---|
181 | * @remarks Caller enters the device critical section.
|
---|
182 | */
|
---|
183 | typedef DECLCALLBACK(void) FNPDMDEVSUSPEND(PPDMDEVINS pDevIns);
|
---|
184 | /** Pointer to a FNPDMDEVSUSPEND() function. */
|
---|
185 | typedef FNPDMDEVSUSPEND *PFNPDMDEVSUSPEND;
|
---|
186 |
|
---|
187 | /**
|
---|
188 | * Resume notification.
|
---|
189 | *
|
---|
190 | * @returns VBox status.
|
---|
191 | * @param pDevIns The device instance data.
|
---|
192 | *
|
---|
193 | * @remarks Caller enters the device critical section.
|
---|
194 | */
|
---|
195 | typedef DECLCALLBACK(void) FNPDMDEVRESUME(PPDMDEVINS pDevIns);
|
---|
196 | /** Pointer to a FNPDMDEVRESUME() function. */
|
---|
197 | typedef FNPDMDEVRESUME *PFNPDMDEVRESUME;
|
---|
198 |
|
---|
199 | /**
|
---|
200 | * Power Off notification.
|
---|
201 | *
|
---|
202 | * This is always called when VMR3PowerOff is called.
|
---|
203 | * There will be no callback when hot plugging devices.
|
---|
204 | *
|
---|
205 | * @param pDevIns The device instance data.
|
---|
206 | * @thread EMT(0)
|
---|
207 | *
|
---|
208 | * @remarks Caller enters the device critical section.
|
---|
209 | */
|
---|
210 | typedef DECLCALLBACK(void) FNPDMDEVPOWEROFF(PPDMDEVINS pDevIns);
|
---|
211 | /** Pointer to a FNPDMDEVPOWEROFF() function. */
|
---|
212 | typedef FNPDMDEVPOWEROFF *PFNPDMDEVPOWEROFF;
|
---|
213 |
|
---|
214 | /**
|
---|
215 | * Attach command.
|
---|
216 | *
|
---|
217 | * This is called to let the device attach to a driver for a specified LUN
|
---|
218 | * at runtime. This is not called during VM construction, the device
|
---|
219 | * constructor has to attach to all the available drivers.
|
---|
220 | *
|
---|
221 | * This is like plugging in the keyboard or mouse after turning on the PC.
|
---|
222 | *
|
---|
223 | * @returns VBox status code.
|
---|
224 | * @param pDevIns The device instance.
|
---|
225 | * @param iLUN The logical unit which is being attached.
|
---|
226 | * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines.
|
---|
227 | *
|
---|
228 | * @remarks Caller enters the device critical section.
|
---|
229 | */
|
---|
230 | typedef DECLCALLBACK(int) FNPDMDEVATTACH(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags);
|
---|
231 | /** Pointer to a FNPDMDEVATTACH() function. */
|
---|
232 | typedef FNPDMDEVATTACH *PFNPDMDEVATTACH;
|
---|
233 |
|
---|
234 | /**
|
---|
235 | * Detach notification.
|
---|
236 | *
|
---|
237 | * This is called when a driver is detaching itself from a LUN of the device.
|
---|
238 | * The device should adjust its state to reflect this.
|
---|
239 | *
|
---|
240 | * This is like unplugging the network cable to use it for the laptop or
|
---|
241 | * something while the PC is still running.
|
---|
242 | *
|
---|
243 | * @param pDevIns The device instance.
|
---|
244 | * @param iLUN The logical unit which is being detached.
|
---|
245 | * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
|
---|
246 | *
|
---|
247 | * @remarks Caller enters the device critical section.
|
---|
248 | */
|
---|
249 | typedef DECLCALLBACK(void) FNPDMDEVDETACH(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags);
|
---|
250 | /** Pointer to a FNPDMDEVDETACH() function. */
|
---|
251 | typedef FNPDMDEVDETACH *PFNPDMDEVDETACH;
|
---|
252 |
|
---|
253 | /**
|
---|
254 | * Query the base interface of a logical unit.
|
---|
255 | *
|
---|
256 | * @returns VBOX status code.
|
---|
257 | * @param pDevIns The device instance.
|
---|
258 | * @param iLUN The logicial unit to query.
|
---|
259 | * @param ppBase Where to store the pointer to the base interface of the LUN.
|
---|
260 | *
|
---|
261 | * @remarks The device critical section is not entered.
|
---|
262 | */
|
---|
263 | typedef DECLCALLBACK(int) FNPDMDEVQUERYINTERFACE(PPDMDEVINS pDevIns, unsigned iLUN, PPDMIBASE *ppBase);
|
---|
264 | /** Pointer to a FNPDMDEVQUERYINTERFACE() function. */
|
---|
265 | typedef FNPDMDEVQUERYINTERFACE *PFNPDMDEVQUERYINTERFACE;
|
---|
266 |
|
---|
267 | /**
|
---|
268 | * Init complete notification (after ring-0 & RC init since 5.1).
|
---|
269 | *
|
---|
270 | * This can be done to do communication with other devices and other
|
---|
271 | * initialization which requires everything to be in place.
|
---|
272 | *
|
---|
273 | * @returns VBOX status code.
|
---|
274 | * @param pDevIns The device instance.
|
---|
275 | *
|
---|
276 | * @remarks Caller enters the device critical section.
|
---|
277 | */
|
---|
278 | typedef DECLCALLBACK(int) FNPDMDEVINITCOMPLETE(PPDMDEVINS pDevIns);
|
---|
279 | /** Pointer to a FNPDMDEVINITCOMPLETE() function. */
|
---|
280 | typedef FNPDMDEVINITCOMPLETE *PFNPDMDEVINITCOMPLETE;
|
---|
281 |
|
---|
282 |
|
---|
283 | /**
|
---|
284 | * The context of a pfnMemSetup call.
|
---|
285 | */
|
---|
286 | typedef enum PDMDEVMEMSETUPCTX
|
---|
287 | {
|
---|
288 | /** Invalid zero value. */
|
---|
289 | PDMDEVMEMSETUPCTX_INVALID = 0,
|
---|
290 | /** After construction. */
|
---|
291 | PDMDEVMEMSETUPCTX_AFTER_CONSTRUCTION,
|
---|
292 | /** After reset. */
|
---|
293 | PDMDEVMEMSETUPCTX_AFTER_RESET,
|
---|
294 | /** Type size hack. */
|
---|
295 | PDMDEVMEMSETUPCTX_32BIT_HACK = 0x7fffffff
|
---|
296 | } PDMDEVMEMSETUPCTX;
|
---|
297 |
|
---|
298 |
|
---|
299 | /**
|
---|
300 | * PDM Device Registration Structure.
|
---|
301 | *
|
---|
302 | * This structure is used when registering a device from VBoxInitDevices() in HC
|
---|
303 | * Ring-3. PDM will continue use till the VM is terminated.
|
---|
304 | */
|
---|
305 | typedef struct PDMDEVREG
|
---|
306 | {
|
---|
307 | /** Structure version. PDM_DEVREG_VERSION defines the current version. */
|
---|
308 | uint32_t u32Version;
|
---|
309 | /** Device name. */
|
---|
310 | char szName[32];
|
---|
311 | /** Name of the raw-mode context module (no path).
|
---|
312 | * Only evalutated if PDM_DEVREG_FLAGS_RC is set. */
|
---|
313 | char szRCMod[32];
|
---|
314 | /** Name of the ring-0 module (no path).
|
---|
315 | * Only evalutated if PDM_DEVREG_FLAGS_R0 is set. */
|
---|
316 | char szR0Mod[32];
|
---|
317 | /** The description of the device. The UTF-8 string pointed to shall, like this structure,
|
---|
318 | * remain unchanged from registration till VM destruction. */
|
---|
319 | const char *pszDescription;
|
---|
320 |
|
---|
321 | /** Flags, combination of the PDM_DEVREG_FLAGS_* \#defines. */
|
---|
322 | uint32_t fFlags;
|
---|
323 | /** Device class(es), combination of the PDM_DEVREG_CLASS_* \#defines. */
|
---|
324 | uint32_t fClass;
|
---|
325 | /** Maximum number of instances (per VM). */
|
---|
326 | uint32_t cMaxInstances;
|
---|
327 | /** Size of the instance data. */
|
---|
328 | uint32_t cbInstance;
|
---|
329 |
|
---|
330 | /** Construct instance - required. */
|
---|
331 | PFNPDMDEVCONSTRUCT pfnConstruct;
|
---|
332 | /** Destruct instance - optional.
|
---|
333 | * Critical section NOT entered (will be destroyed). */
|
---|
334 | PFNPDMDEVDESTRUCT pfnDestruct;
|
---|
335 | /** Relocation command - optional.
|
---|
336 | * Critical section NOT entered. */
|
---|
337 | PFNPDMDEVRELOCATE pfnRelocate;
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * Memory setup callback.
|
---|
341 | *
|
---|
342 | * @param pDevIns The device instance data.
|
---|
343 | * @param enmCtx Indicates the context of the call.
|
---|
344 | * @remarks The critical section is entered prior to calling this method.
|
---|
345 | */
|
---|
346 | DECLR3CALLBACKMEMBER(void, pfnMemSetup, (PPDMDEVINS pDevIns, PDMDEVMEMSETUPCTX enmCtx));
|
---|
347 |
|
---|
348 | /** Power on notification - optional.
|
---|
349 | * Critical section is entered. */
|
---|
350 | PFNPDMDEVPOWERON pfnPowerOn;
|
---|
351 | /** Reset notification - optional.
|
---|
352 | * Critical section is entered. */
|
---|
353 | PFNPDMDEVRESET pfnReset;
|
---|
354 | /** Suspend notification - optional.
|
---|
355 | * Critical section is entered. */
|
---|
356 | PFNPDMDEVSUSPEND pfnSuspend;
|
---|
357 | /** Resume notification - optional.
|
---|
358 | * Critical section is entered. */
|
---|
359 | PFNPDMDEVRESUME pfnResume;
|
---|
360 | /** Attach command - optional.
|
---|
361 | * Critical section is entered. */
|
---|
362 | PFNPDMDEVATTACH pfnAttach;
|
---|
363 | /** Detach notification - optional.
|
---|
364 | * Critical section is entered. */
|
---|
365 | PFNPDMDEVDETACH pfnDetach;
|
---|
366 | /** Query a LUN base interface - optional.
|
---|
367 | * Critical section is NOT entered. */
|
---|
368 | PFNPDMDEVQUERYINTERFACE pfnQueryInterface;
|
---|
369 | /** Init complete notification - optional.
|
---|
370 | * Critical section is entered. */
|
---|
371 | PFNPDMDEVINITCOMPLETE pfnInitComplete;
|
---|
372 | /** Power off notification - optional.
|
---|
373 | * Critical section is entered. */
|
---|
374 | PFNPDMDEVPOWEROFF pfnPowerOff;
|
---|
375 | /** Software system reset notification - optional.
|
---|
376 | * Critical section is entered. */
|
---|
377 | PFNPDMDEVSOFTRESET pfnSoftReset;
|
---|
378 | /** Initialization safty marker. */
|
---|
379 | uint32_t u32VersionEnd;
|
---|
380 | } PDMDEVREG;
|
---|
381 | /** Pointer to a PDM Device Structure. */
|
---|
382 | typedef PDMDEVREG *PPDMDEVREG;
|
---|
383 | /** Const pointer to a PDM Device Structure. */
|
---|
384 | typedef PDMDEVREG const *PCPDMDEVREG;
|
---|
385 |
|
---|
386 | /** Current DEVREG version number. */
|
---|
387 | #define PDM_DEVREG_VERSION PDM_VERSION_MAKE(0xffff, 2, 1)
|
---|
388 |
|
---|
389 | /** PDM Device Flags.
|
---|
390 | * @{ */
|
---|
391 | /** This flag is used to indicate that the device has a RC component. */
|
---|
392 | #define PDM_DEVREG_FLAGS_RC 0x00000001
|
---|
393 | /** This flag is used to indicate that the device has a R0 component. */
|
---|
394 | #define PDM_DEVREG_FLAGS_R0 0x00000002
|
---|
395 |
|
---|
396 | /** @def PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT
|
---|
397 | * The bit count for the current host. */
|
---|
398 | #if HC_ARCH_BITS == 32
|
---|
399 | # define PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT 0x00000010
|
---|
400 | #elif HC_ARCH_BITS == 64
|
---|
401 | # define PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT 0x00000020
|
---|
402 | #else
|
---|
403 | # error Unsupported HC_ARCH_BITS value.
|
---|
404 | #endif
|
---|
405 | /** The host bit count mask. */
|
---|
406 | #define PDM_DEVREG_FLAGS_HOST_BITS_MASK 0x00000030
|
---|
407 |
|
---|
408 | /** The device support only 32-bit guests. */
|
---|
409 | #define PDM_DEVREG_FLAGS_GUEST_BITS_32 0x00000100
|
---|
410 | /** The device support only 64-bit guests. */
|
---|
411 | #define PDM_DEVREG_FLAGS_GUEST_BITS_64 0x00000200
|
---|
412 | /** The device support both 32-bit & 64-bit guests. */
|
---|
413 | #define PDM_DEVREG_FLAGS_GUEST_BITS_32_64 0x00000300
|
---|
414 | /** @def PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT
|
---|
415 | * The guest bit count for the current compilation. */
|
---|
416 | #if GC_ARCH_BITS == 32
|
---|
417 | # define PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT PDM_DEVREG_FLAGS_GUEST_BITS_32
|
---|
418 | #elif GC_ARCH_BITS == 64
|
---|
419 | # define PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT PDM_DEVREG_FLAGS_GUEST_BITS_32_64
|
---|
420 | #else
|
---|
421 | # error Unsupported GC_ARCH_BITS value.
|
---|
422 | #endif
|
---|
423 | /** The guest bit count mask. */
|
---|
424 | #define PDM_DEVREG_FLAGS_GUEST_BITS_MASK 0x00000300
|
---|
425 |
|
---|
426 | /** A convenience. */
|
---|
427 | #define PDM_DEVREG_FLAGS_DEFAULT_BITS (PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT | PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT)
|
---|
428 |
|
---|
429 | /** Indicates that the devices support PAE36 on a 32-bit guest. */
|
---|
430 | #define PDM_DEVREG_FLAGS_PAE36 0x00001000
|
---|
431 |
|
---|
432 | /** Indicates that the device needs to be notified before the drivers when suspending. */
|
---|
433 | #define PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION 0x00002000
|
---|
434 |
|
---|
435 | /** Indicates that the device needs to be notified before the drivers when powering off. */
|
---|
436 | #define PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION 0x00004000
|
---|
437 |
|
---|
438 | /** Indicates that the device needs to be notified before the drivers when resetting. */
|
---|
439 | #define PDM_DEVREG_FLAGS_FIRST_RESET_NOTIFICATION 0x00008000
|
---|
440 | /** @} */
|
---|
441 |
|
---|
442 |
|
---|
443 | /** PDM Device Classes.
|
---|
444 | * The order is important, lower bit earlier instantiation.
|
---|
445 | * @{ */
|
---|
446 | /** Architecture device. */
|
---|
447 | #define PDM_DEVREG_CLASS_ARCH RT_BIT(0)
|
---|
448 | /** Architecture BIOS device. */
|
---|
449 | #define PDM_DEVREG_CLASS_ARCH_BIOS RT_BIT(1)
|
---|
450 | /** PCI bus brigde. */
|
---|
451 | #define PDM_DEVREG_CLASS_BUS_PCI RT_BIT(2)
|
---|
452 | /** ISA bus brigde. */
|
---|
453 | #define PDM_DEVREG_CLASS_BUS_ISA RT_BIT(3)
|
---|
454 | /** Input device (mouse, keyboard, joystick, HID, ...). */
|
---|
455 | #define PDM_DEVREG_CLASS_INPUT RT_BIT(4)
|
---|
456 | /** Interrupt controller (PIC). */
|
---|
457 | #define PDM_DEVREG_CLASS_PIC RT_BIT(5)
|
---|
458 | /** Interval controoler (PIT). */
|
---|
459 | #define PDM_DEVREG_CLASS_PIT RT_BIT(6)
|
---|
460 | /** RTC/CMOS. */
|
---|
461 | #define PDM_DEVREG_CLASS_RTC RT_BIT(7)
|
---|
462 | /** DMA controller. */
|
---|
463 | #define PDM_DEVREG_CLASS_DMA RT_BIT(8)
|
---|
464 | /** VMM Device. */
|
---|
465 | #define PDM_DEVREG_CLASS_VMM_DEV RT_BIT(9)
|
---|
466 | /** Graphics device, like VGA. */
|
---|
467 | #define PDM_DEVREG_CLASS_GRAPHICS RT_BIT(10)
|
---|
468 | /** Storage controller device. */
|
---|
469 | #define PDM_DEVREG_CLASS_STORAGE RT_BIT(11)
|
---|
470 | /** Network interface controller. */
|
---|
471 | #define PDM_DEVREG_CLASS_NETWORK RT_BIT(12)
|
---|
472 | /** Audio. */
|
---|
473 | #define PDM_DEVREG_CLASS_AUDIO RT_BIT(13)
|
---|
474 | /** USB HIC. */
|
---|
475 | #define PDM_DEVREG_CLASS_BUS_USB RT_BIT(14)
|
---|
476 | /** ACPI. */
|
---|
477 | #define PDM_DEVREG_CLASS_ACPI RT_BIT(15)
|
---|
478 | /** Serial controller device. */
|
---|
479 | #define PDM_DEVREG_CLASS_SERIAL RT_BIT(16)
|
---|
480 | /** Parallel controller device */
|
---|
481 | #define PDM_DEVREG_CLASS_PARALLEL RT_BIT(17)
|
---|
482 | /** Host PCI pass-through device */
|
---|
483 | #define PDM_DEVREG_CLASS_HOST_DEV RT_BIT(18)
|
---|
484 | /** Misc devices (always last). */
|
---|
485 | #define PDM_DEVREG_CLASS_MISC RT_BIT(31)
|
---|
486 | /** @} */
|
---|
487 |
|
---|
488 |
|
---|
489 | /** @name IRQ Level for use with the *SetIrq APIs.
|
---|
490 | * @{
|
---|
491 | */
|
---|
492 | /** Assert the IRQ (can assume value 1). */
|
---|
493 | #define PDM_IRQ_LEVEL_HIGH RT_BIT(0)
|
---|
494 | /** Deassert the IRQ (can assume value 0). */
|
---|
495 | #define PDM_IRQ_LEVEL_LOW 0
|
---|
496 | /** flip-flop - deassert and then assert the IRQ again immediately. */
|
---|
497 | #define PDM_IRQ_LEVEL_FLIP_FLOP (RT_BIT(1) | PDM_IRQ_LEVEL_HIGH)
|
---|
498 | /** @} */
|
---|
499 |
|
---|
500 | /**
|
---|
501 | * Registration record for MSI.
|
---|
502 | */
|
---|
503 | typedef struct PDMMSIREG
|
---|
504 | {
|
---|
505 | /** Number of MSI interrupt vectors, 0 if MSI not supported */
|
---|
506 | uint16_t cMsiVectors;
|
---|
507 | /** Offset of MSI capability */
|
---|
508 | uint8_t iMsiCapOffset;
|
---|
509 | /** Offset of next capability to MSI */
|
---|
510 | uint8_t iMsiNextOffset;
|
---|
511 | /** If we support 64-bit MSI addressing */
|
---|
512 | bool fMsi64bit;
|
---|
513 | /** If we do not support per-vector masking */
|
---|
514 | bool fMsiNoMasking;
|
---|
515 |
|
---|
516 | /** Number of MSI-X interrupt vectors, 0 if MSI-X not supported */
|
---|
517 | uint16_t cMsixVectors;
|
---|
518 | /** Offset of MSI-X capability */
|
---|
519 | uint8_t iMsixCapOffset;
|
---|
520 | /** Offset of next capability to MSI-X */
|
---|
521 | uint8_t iMsixNextOffset;
|
---|
522 | /** Value of PCI BAR (base addresss register) assigned by device for MSI-X page access */
|
---|
523 | uint8_t iMsixBar;
|
---|
524 | } PDMMSIREG;
|
---|
525 | typedef PDMMSIREG *PPDMMSIREG;
|
---|
526 |
|
---|
527 | /**
|
---|
528 | * PCI Bus registration structure.
|
---|
529 | * All the callbacks, except the PCIBIOS hack, are working on PCI devices.
|
---|
530 | */
|
---|
531 | typedef struct PDMPCIBUSREG
|
---|
532 | {
|
---|
533 | /** Structure version number. PDM_PCIBUSREG_VERSION defines the current version. */
|
---|
534 | uint32_t u32Version;
|
---|
535 |
|
---|
536 | /**
|
---|
537 | * Registers the device with the default PCI bus.
|
---|
538 | *
|
---|
539 | * @returns VBox status code.
|
---|
540 | * @param pDevIns Device instance of the PCI Bus.
|
---|
541 | * @param pPciDev The PCI device structure.
|
---|
542 | * @param fFlags Reserved for future use, PDMPCIDEVREG_F_MBZ.
|
---|
543 | * @param uPciDevNo PDMPCIDEVREG_DEV_NO_FIRST_UNUSED, or a specific
|
---|
544 | * device number (0-31).
|
---|
545 | * @param uPciFunNo PDMPCIDEVREG_FUN_NO_FIRST_UNUSED, or a specific
|
---|
546 | * function number (0-7).
|
---|
547 | * @param pszName Device name (static but not unique).
|
---|
548 | *
|
---|
549 | * @remarks Caller enters the PDM critical section.
|
---|
550 | */
|
---|
551 | DECLR3CALLBACKMEMBER(int, pfnRegisterR3,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t fFlags,
|
---|
552 | uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName));
|
---|
553 |
|
---|
554 | /**
|
---|
555 | * Initialize MSI support in a PCI device.
|
---|
556 | *
|
---|
557 | * @returns VBox status code.
|
---|
558 | * @param pDevIns Device instance of the PCI Bus.
|
---|
559 | * @param pPciDev The PCI device structure.
|
---|
560 | * @param pMsiReg MSI registration structure
|
---|
561 | * @remarks Caller enters the PDM critical section.
|
---|
562 | */
|
---|
563 | DECLR3CALLBACKMEMBER(int, pfnRegisterMsiR3,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PPDMMSIREG pMsiReg));
|
---|
564 |
|
---|
565 | /**
|
---|
566 | * Registers a I/O region (memory mapped or I/O ports) for a PCI device.
|
---|
567 | *
|
---|
568 | * @returns VBox status code.
|
---|
569 | * @param pDevIns Device instance of the PCI Bus.
|
---|
570 | * @param pPciDev The PCI device structure.
|
---|
571 | * @param iRegion The region number.
|
---|
572 | * @param cbRegion Size of the region.
|
---|
573 | * @param enmType PCI_ADDRESS_SPACE_MEM, PCI_ADDRESS_SPACE_IO or PCI_ADDRESS_SPACE_MEM_PREFETCH.
|
---|
574 | * @param pfnCallback Callback for doing the mapping.
|
---|
575 | * @remarks Caller enters the PDM critical section.
|
---|
576 | */
|
---|
577 | DECLR3CALLBACKMEMBER(int, pfnIORegionRegisterR3,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iRegion, RTGCPHYS cbRegion,
|
---|
578 | PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback));
|
---|
579 |
|
---|
580 | /**
|
---|
581 | * Register PCI configuration space read/write callbacks.
|
---|
582 | *
|
---|
583 | * @param pDevIns Device instance of the PCI Bus.
|
---|
584 | * @param pPciDev The PCI device structure.
|
---|
585 | * @param pfnRead Pointer to the user defined PCI config read function.
|
---|
586 | * @param ppfnReadOld Pointer to function pointer which will receive the old (default)
|
---|
587 | * PCI config read function. This way, user can decide when (and if)
|
---|
588 | * to call default PCI config read function. Can be NULL.
|
---|
589 | * @param pfnWrite Pointer to the user defined PCI config write function.
|
---|
590 | * @param ppfnWriteOld Pointer to function pointer which will receive the old (default)
|
---|
591 | * PCI config write function. This way, user can decide when (and if)
|
---|
592 | * to call default PCI config write function. Can be NULL.
|
---|
593 | * @remarks Caller enters the PDM critical section.
|
---|
594 | * @thread EMT
|
---|
595 | */
|
---|
596 | DECLR3CALLBACKMEMBER(void, pfnSetConfigCallbacksR3,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev,
|
---|
597 | PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
|
---|
598 | PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld));
|
---|
599 |
|
---|
600 | /**
|
---|
601 | * Set the IRQ for a PCI device.
|
---|
602 | *
|
---|
603 | * @param pDevIns Device instance of the PCI Bus.
|
---|
604 | * @param pPciDev The PCI device structure.
|
---|
605 | * @param iIrq IRQ number to set.
|
---|
606 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
607 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
608 | * @remarks Caller enters the PDM critical section.
|
---|
609 | */
|
---|
610 | DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
611 |
|
---|
612 | /** The name of the SetIrq RC entry point. */
|
---|
613 | const char *pszSetIrqRC;
|
---|
614 |
|
---|
615 | /** The name of the SetIrq R0 entry point. */
|
---|
616 | const char *pszSetIrqR0;
|
---|
617 |
|
---|
618 | } PDMPCIBUSREG;
|
---|
619 | /** Pointer to a PCI bus registration structure. */
|
---|
620 | typedef PDMPCIBUSREG *PPDMPCIBUSREG;
|
---|
621 |
|
---|
622 | /** Current PDMPCIBUSREG version number. */
|
---|
623 | #define PDM_PCIBUSREG_VERSION PDM_VERSION_MAKE(0xfffe, 7, 0)
|
---|
624 |
|
---|
625 | /**
|
---|
626 | * PCI Bus RC helpers.
|
---|
627 | */
|
---|
628 | typedef struct PDMPCIHLPRC
|
---|
629 | {
|
---|
630 | /** Structure version. PDM_PCIHLPRC_VERSION defines the current version. */
|
---|
631 | uint32_t u32Version;
|
---|
632 |
|
---|
633 | /**
|
---|
634 | * Set an ISA IRQ.
|
---|
635 | *
|
---|
636 | * @param pDevIns PCI device instance.
|
---|
637 | * @param iIrq IRQ number to set.
|
---|
638 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
639 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
640 | * @thread EMT only.
|
---|
641 | */
|
---|
642 | DECLRCCALLBACKMEMBER(void, pfnIsaSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
643 |
|
---|
644 | /**
|
---|
645 | * Set an I/O-APIC IRQ.
|
---|
646 | *
|
---|
647 | * @param pDevIns PCI device instance.
|
---|
648 | * @param iIrq IRQ number to set.
|
---|
649 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
650 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
651 | * @thread EMT only.
|
---|
652 | */
|
---|
653 | DECLRCCALLBACKMEMBER(void, pfnIoApicSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
654 |
|
---|
655 | /**
|
---|
656 | * Send an MSI.
|
---|
657 | *
|
---|
658 | * @param pDevIns PCI device instance.
|
---|
659 | * @param GCPhys Physical address MSI request was written.
|
---|
660 | * @param uValue Value written.
|
---|
661 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
662 | * @thread EMT only.
|
---|
663 | */
|
---|
664 | DECLRCCALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue, uint32_t uTagSrc));
|
---|
665 |
|
---|
666 |
|
---|
667 | /**
|
---|
668 | * Acquires the PDM lock.
|
---|
669 | *
|
---|
670 | * @returns VINF_SUCCESS on success.
|
---|
671 | * @returns rc if we failed to acquire the lock.
|
---|
672 | * @param pDevIns The PCI device instance.
|
---|
673 | * @param rc What to return if we fail to acquire the lock.
|
---|
674 | */
|
---|
675 | DECLRCCALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
676 |
|
---|
677 | /**
|
---|
678 | * Releases the PDM lock.
|
---|
679 | *
|
---|
680 | * @param pDevIns The PCI device instance.
|
---|
681 | */
|
---|
682 | DECLRCCALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
683 |
|
---|
684 | /** Just a safety precaution. */
|
---|
685 | uint32_t u32TheEnd;
|
---|
686 | } PDMPCIHLPRC;
|
---|
687 | /** Pointer to PCI helpers. */
|
---|
688 | typedef RCPTRTYPE(PDMPCIHLPRC *) PPDMPCIHLPRC;
|
---|
689 | /** Pointer to const PCI helpers. */
|
---|
690 | typedef RCPTRTYPE(const PDMPCIHLPRC *) PCPDMPCIHLPRC;
|
---|
691 |
|
---|
692 | /** Current PDMPCIHLPRC version number. */
|
---|
693 | #define PDM_PCIHLPRC_VERSION PDM_VERSION_MAKE(0xfffd, 3, 0)
|
---|
694 |
|
---|
695 |
|
---|
696 | /**
|
---|
697 | * PCI Bus R0 helpers.
|
---|
698 | */
|
---|
699 | typedef struct PDMPCIHLPR0
|
---|
700 | {
|
---|
701 | /** Structure version. PDM_PCIHLPR0_VERSION defines the current version. */
|
---|
702 | uint32_t u32Version;
|
---|
703 |
|
---|
704 | /**
|
---|
705 | * Set an ISA IRQ.
|
---|
706 | *
|
---|
707 | * @param pDevIns PCI device instance.
|
---|
708 | * @param iIrq IRQ number to set.
|
---|
709 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
710 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
711 | * @thread EMT only.
|
---|
712 | */
|
---|
713 | DECLR0CALLBACKMEMBER(void, pfnIsaSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
714 |
|
---|
715 | /**
|
---|
716 | * Set an I/O-APIC IRQ.
|
---|
717 | *
|
---|
718 | * @param pDevIns PCI device instance.
|
---|
719 | * @param iIrq IRQ number to set.
|
---|
720 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
721 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
722 | * @thread EMT only.
|
---|
723 | */
|
---|
724 | DECLR0CALLBACKMEMBER(void, pfnIoApicSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
725 |
|
---|
726 | /**
|
---|
727 | * Send an MSI.
|
---|
728 | *
|
---|
729 | * @param pDevIns PCI device instance.
|
---|
730 | * @param GCPhys Physical address MSI request was written.
|
---|
731 | * @param uValue Value written.
|
---|
732 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
733 | * @thread EMT only.
|
---|
734 | */
|
---|
735 | DECLR0CALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue, uint32_t uTagSrc));
|
---|
736 |
|
---|
737 |
|
---|
738 | /**
|
---|
739 | * Acquires the PDM lock.
|
---|
740 | *
|
---|
741 | * @returns VINF_SUCCESS on success.
|
---|
742 | * @returns rc if we failed to acquire the lock.
|
---|
743 | * @param pDevIns The PCI device instance.
|
---|
744 | * @param rc What to return if we fail to acquire the lock.
|
---|
745 | */
|
---|
746 | DECLR0CALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
747 |
|
---|
748 | /**
|
---|
749 | * Releases the PDM lock.
|
---|
750 | *
|
---|
751 | * @param pDevIns The PCI device instance.
|
---|
752 | */
|
---|
753 | DECLR0CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
754 |
|
---|
755 | /** Just a safety precaution. */
|
---|
756 | uint32_t u32TheEnd;
|
---|
757 | } PDMPCIHLPR0;
|
---|
758 | /** Pointer to PCI helpers. */
|
---|
759 | typedef R0PTRTYPE(PDMPCIHLPR0 *) PPDMPCIHLPR0;
|
---|
760 | /** Pointer to const PCI helpers. */
|
---|
761 | typedef R0PTRTYPE(const PDMPCIHLPR0 *) PCPDMPCIHLPR0;
|
---|
762 |
|
---|
763 | /** Current PDMPCIHLPR0 version number. */
|
---|
764 | #define PDM_PCIHLPR0_VERSION PDM_VERSION_MAKE(0xfffc, 3, 0)
|
---|
765 |
|
---|
766 | /**
|
---|
767 | * PCI device helpers.
|
---|
768 | */
|
---|
769 | typedef struct PDMPCIHLPR3
|
---|
770 | {
|
---|
771 | /** Structure version. PDM_PCIHLPR3_VERSION defines the current version. */
|
---|
772 | uint32_t u32Version;
|
---|
773 |
|
---|
774 | /**
|
---|
775 | * Set an ISA IRQ.
|
---|
776 | *
|
---|
777 | * @param pDevIns The PCI device instance.
|
---|
778 | * @param iIrq IRQ number to set.
|
---|
779 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
780 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
781 | */
|
---|
782 | DECLR3CALLBACKMEMBER(void, pfnIsaSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
783 |
|
---|
784 | /**
|
---|
785 | * Set an I/O-APIC IRQ.
|
---|
786 | *
|
---|
787 | * @param pDevIns The PCI device instance.
|
---|
788 | * @param iIrq IRQ number to set.
|
---|
789 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
790 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
791 | */
|
---|
792 | DECLR3CALLBACKMEMBER(void, pfnIoApicSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
793 |
|
---|
794 | /**
|
---|
795 | * Send an MSI.
|
---|
796 | *
|
---|
797 | * @param pDevIns PCI device instance.
|
---|
798 | * @param GCPhys Physical address MSI request was written.
|
---|
799 | * @param uValue Value written.
|
---|
800 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
801 | */
|
---|
802 | DECLR3CALLBACKMEMBER(void, pfnIoApicSendMsi,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue, uint32_t uTagSrc));
|
---|
803 |
|
---|
804 | /**
|
---|
805 | * Checks if the given address is an MMIO2 or pre-registered MMIO base address.
|
---|
806 | *
|
---|
807 | * @returns true/false accordingly.
|
---|
808 | * @param pDevIns The PCI device instance.
|
---|
809 | * @param pOwner The owner of the memory, optional.
|
---|
810 | * @param GCPhys The address to check.
|
---|
811 | * @sa PGMR3PhysMMIOExIsBase
|
---|
812 | */
|
---|
813 | DECLR3CALLBACKMEMBER(bool, pfnIsMMIOExBase,(PPDMDEVINS pDevIns, PPDMDEVINS pOwner, RTGCPHYS GCPhys));
|
---|
814 |
|
---|
815 | /**
|
---|
816 | * Gets the address of the RC PCI Bus helpers.
|
---|
817 | *
|
---|
818 | * This should be called at both construction and relocation time
|
---|
819 | * to obtain the correct address of the RC helpers.
|
---|
820 | *
|
---|
821 | * @returns RC pointer to the PCI Bus helpers.
|
---|
822 | * @param pDevIns Device instance of the PCI Bus.
|
---|
823 | * @thread EMT only.
|
---|
824 | */
|
---|
825 | DECLR3CALLBACKMEMBER(PCPDMPCIHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
|
---|
826 |
|
---|
827 | /**
|
---|
828 | * Gets the address of the R0 PCI Bus helpers.
|
---|
829 | *
|
---|
830 | * This should be called at both construction and relocation time
|
---|
831 | * to obtain the correct address of the R0 helpers.
|
---|
832 | *
|
---|
833 | * @returns R0 pointer to the PCI Bus helpers.
|
---|
834 | * @param pDevIns Device instance of the PCI Bus.
|
---|
835 | * @thread EMT only.
|
---|
836 | */
|
---|
837 | DECLR3CALLBACKMEMBER(PCPDMPCIHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
|
---|
838 |
|
---|
839 | /**
|
---|
840 | * Acquires the PDM lock.
|
---|
841 | *
|
---|
842 | * @returns VINF_SUCCESS on success.
|
---|
843 | * @returns Fatal error on failure.
|
---|
844 | * @param pDevIns The PCI device instance.
|
---|
845 | * @param rc Dummy for making the interface identical to the RC and R0 versions.
|
---|
846 | */
|
---|
847 | DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
848 |
|
---|
849 | /**
|
---|
850 | * Releases the PDM lock.
|
---|
851 | *
|
---|
852 | * @param pDevIns The PCI device instance.
|
---|
853 | */
|
---|
854 | DECLR3CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
855 |
|
---|
856 | /** Just a safety precaution. */
|
---|
857 | uint32_t u32TheEnd;
|
---|
858 | } PDMPCIHLPR3;
|
---|
859 | /** Pointer to PCI helpers. */
|
---|
860 | typedef R3PTRTYPE(PDMPCIHLPR3 *) PPDMPCIHLPR3;
|
---|
861 | /** Pointer to const PCI helpers. */
|
---|
862 | typedef R3PTRTYPE(const PDMPCIHLPR3 *) PCPDMPCIHLPR3;
|
---|
863 |
|
---|
864 | /** Current PDMPCIHLPR3 version number. */
|
---|
865 | #define PDM_PCIHLPR3_VERSION PDM_VERSION_MAKE(0xfffb, 3, 1)
|
---|
866 |
|
---|
867 |
|
---|
868 | /**
|
---|
869 | * Programmable Interrupt Controller registration structure.
|
---|
870 | */
|
---|
871 | typedef struct PDMPICREG
|
---|
872 | {
|
---|
873 | /** Structure version number. PDM_PICREG_VERSION defines the current version. */
|
---|
874 | uint32_t u32Version;
|
---|
875 |
|
---|
876 | /**
|
---|
877 | * Set the an IRQ.
|
---|
878 | *
|
---|
879 | * @param pDevIns Device instance of the PIC.
|
---|
880 | * @param iIrq IRQ number to set.
|
---|
881 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
882 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
883 | * @remarks Caller enters the PDM critical section.
|
---|
884 | */
|
---|
885 | DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
886 |
|
---|
887 | /**
|
---|
888 | * Get a pending interrupt.
|
---|
889 | *
|
---|
890 | * @returns Pending interrupt number.
|
---|
891 | * @param pDevIns Device instance of the PIC.
|
---|
892 | * @param puTagSrc Where to return the IRQ tag and source.
|
---|
893 | * @remarks Caller enters the PDM critical section.
|
---|
894 | */
|
---|
895 | DECLR3CALLBACKMEMBER(int, pfnGetInterruptR3,(PPDMDEVINS pDevIns, uint32_t *puTagSrc));
|
---|
896 |
|
---|
897 | /** The name of the RC SetIrq entry point. */
|
---|
898 | const char *pszSetIrqRC;
|
---|
899 | /** The name of the RC GetInterrupt entry point. */
|
---|
900 | const char *pszGetInterruptRC;
|
---|
901 |
|
---|
902 | /** The name of the R0 SetIrq entry point. */
|
---|
903 | const char *pszSetIrqR0;
|
---|
904 | /** The name of the R0 GetInterrupt entry point. */
|
---|
905 | const char *pszGetInterruptR0;
|
---|
906 | } PDMPICREG;
|
---|
907 | /** Pointer to a PIC registration structure. */
|
---|
908 | typedef PDMPICREG *PPDMPICREG;
|
---|
909 |
|
---|
910 | /** Current PDMPICREG version number. */
|
---|
911 | #define PDM_PICREG_VERSION PDM_VERSION_MAKE(0xfffa, 2, 0)
|
---|
912 |
|
---|
913 | /**
|
---|
914 | * PIC RC helpers.
|
---|
915 | */
|
---|
916 | typedef struct PDMPICHLPRC
|
---|
917 | {
|
---|
918 | /** Structure version. PDM_PICHLPRC_VERSION defines the current version. */
|
---|
919 | uint32_t u32Version;
|
---|
920 |
|
---|
921 | /**
|
---|
922 | * Set the interrupt force action flag.
|
---|
923 | *
|
---|
924 | * @param pDevIns Device instance of the PIC.
|
---|
925 | */
|
---|
926 | DECLRCCALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns));
|
---|
927 |
|
---|
928 | /**
|
---|
929 | * Clear the interrupt force action flag.
|
---|
930 | *
|
---|
931 | * @param pDevIns Device instance of the PIC.
|
---|
932 | */
|
---|
933 | DECLRCCALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns));
|
---|
934 |
|
---|
935 | /**
|
---|
936 | * Acquires the PDM lock.
|
---|
937 | *
|
---|
938 | * @returns VINF_SUCCESS on success.
|
---|
939 | * @returns rc if we failed to acquire the lock.
|
---|
940 | * @param pDevIns The PIC device instance.
|
---|
941 | * @param rc What to return if we fail to acquire the lock.
|
---|
942 | */
|
---|
943 | DECLRCCALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
944 |
|
---|
945 | /**
|
---|
946 | * Releases the PDM lock.
|
---|
947 | *
|
---|
948 | * @param pDevIns The PIC device instance.
|
---|
949 | */
|
---|
950 | DECLRCCALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
951 |
|
---|
952 | /** Just a safety precaution. */
|
---|
953 | uint32_t u32TheEnd;
|
---|
954 | } PDMPICHLPRC;
|
---|
955 |
|
---|
956 | /** Pointer to PIC RC helpers. */
|
---|
957 | typedef RCPTRTYPE(PDMPICHLPRC *) PPDMPICHLPRC;
|
---|
958 | /** Pointer to const PIC RC helpers. */
|
---|
959 | typedef RCPTRTYPE(const PDMPICHLPRC *) PCPDMPICHLPRC;
|
---|
960 |
|
---|
961 | /** Current PDMPICHLPRC version number. */
|
---|
962 | #define PDM_PICHLPRC_VERSION PDM_VERSION_MAKE(0xfff9, 2, 0)
|
---|
963 |
|
---|
964 |
|
---|
965 | /**
|
---|
966 | * PIC R0 helpers.
|
---|
967 | */
|
---|
968 | typedef struct PDMPICHLPR0
|
---|
969 | {
|
---|
970 | /** Structure version. PDM_PICHLPR0_VERSION defines the current version. */
|
---|
971 | uint32_t u32Version;
|
---|
972 |
|
---|
973 | /**
|
---|
974 | * Set the interrupt force action flag.
|
---|
975 | *
|
---|
976 | * @param pDevIns Device instance of the PIC.
|
---|
977 | */
|
---|
978 | DECLR0CALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns));
|
---|
979 |
|
---|
980 | /**
|
---|
981 | * Clear the interrupt force action flag.
|
---|
982 | *
|
---|
983 | * @param pDevIns Device instance of the PIC.
|
---|
984 | */
|
---|
985 | DECLR0CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns));
|
---|
986 |
|
---|
987 | /**
|
---|
988 | * Acquires the PDM lock.
|
---|
989 | *
|
---|
990 | * @returns VINF_SUCCESS on success.
|
---|
991 | * @returns rc if we failed to acquire the lock.
|
---|
992 | * @param pDevIns The PIC device instance.
|
---|
993 | * @param rc What to return if we fail to acquire the lock.
|
---|
994 | */
|
---|
995 | DECLR0CALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
996 |
|
---|
997 | /**
|
---|
998 | * Releases the PDM lock.
|
---|
999 | *
|
---|
1000 | * @param pDevIns The PCI device instance.
|
---|
1001 | */
|
---|
1002 | DECLR0CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
1003 |
|
---|
1004 | /** Just a safety precaution. */
|
---|
1005 | uint32_t u32TheEnd;
|
---|
1006 | } PDMPICHLPR0;
|
---|
1007 |
|
---|
1008 | /** Pointer to PIC R0 helpers. */
|
---|
1009 | typedef R0PTRTYPE(PDMPICHLPR0 *) PPDMPICHLPR0;
|
---|
1010 | /** Pointer to const PIC R0 helpers. */
|
---|
1011 | typedef R0PTRTYPE(const PDMPICHLPR0 *) PCPDMPICHLPR0;
|
---|
1012 |
|
---|
1013 | /** Current PDMPICHLPR0 version number. */
|
---|
1014 | #define PDM_PICHLPR0_VERSION PDM_VERSION_MAKE(0xfff8, 1, 0)
|
---|
1015 |
|
---|
1016 | /**
|
---|
1017 | * PIC R3 helpers.
|
---|
1018 | */
|
---|
1019 | typedef struct PDMPICHLPR3
|
---|
1020 | {
|
---|
1021 | /** Structure version. PDM_PICHLP_VERSION defines the current version. */
|
---|
1022 | uint32_t u32Version;
|
---|
1023 |
|
---|
1024 | /**
|
---|
1025 | * Set the interrupt force action flag.
|
---|
1026 | *
|
---|
1027 | * @param pDevIns Device instance of the PIC.
|
---|
1028 | */
|
---|
1029 | DECLR3CALLBACKMEMBER(void, pfnSetInterruptFF,(PPDMDEVINS pDevIns));
|
---|
1030 |
|
---|
1031 | /**
|
---|
1032 | * Clear the interrupt force action flag.
|
---|
1033 | *
|
---|
1034 | * @param pDevIns Device instance of the PIC.
|
---|
1035 | */
|
---|
1036 | DECLR3CALLBACKMEMBER(void, pfnClearInterruptFF,(PPDMDEVINS pDevIns));
|
---|
1037 |
|
---|
1038 | /**
|
---|
1039 | * Acquires the PDM lock.
|
---|
1040 | *
|
---|
1041 | * @returns VINF_SUCCESS on success.
|
---|
1042 | * @returns Fatal error on failure.
|
---|
1043 | * @param pDevIns The PIC device instance.
|
---|
1044 | * @param rc Dummy for making the interface identical to the RC and R0 versions.
|
---|
1045 | */
|
---|
1046 | DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
1047 |
|
---|
1048 | /**
|
---|
1049 | * Releases the PDM lock.
|
---|
1050 | *
|
---|
1051 | * @param pDevIns The PIC device instance.
|
---|
1052 | */
|
---|
1053 | DECLR3CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
1054 |
|
---|
1055 | /**
|
---|
1056 | * Gets the address of the RC PIC helpers.
|
---|
1057 | *
|
---|
1058 | * This should be called at both construction and relocation time
|
---|
1059 | * to obtain the correct address of the RC helpers.
|
---|
1060 | *
|
---|
1061 | * @returns RC pointer to the PIC helpers.
|
---|
1062 | * @param pDevIns Device instance of the PIC.
|
---|
1063 | */
|
---|
1064 | DECLR3CALLBACKMEMBER(PCPDMPICHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
|
---|
1065 |
|
---|
1066 | /**
|
---|
1067 | * Gets the address of the R0 PIC helpers.
|
---|
1068 | *
|
---|
1069 | * This should be called at both construction and relocation time
|
---|
1070 | * to obtain the correct address of the R0 helpers.
|
---|
1071 | *
|
---|
1072 | * @returns R0 pointer to the PIC helpers.
|
---|
1073 | * @param pDevIns Device instance of the PIC.
|
---|
1074 | */
|
---|
1075 | DECLR3CALLBACKMEMBER(PCPDMPICHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
|
---|
1076 |
|
---|
1077 | /** Just a safety precaution. */
|
---|
1078 | uint32_t u32TheEnd;
|
---|
1079 | } PDMPICHLPR3;
|
---|
1080 |
|
---|
1081 | /** Pointer to PIC R3 helpers. */
|
---|
1082 | typedef R3PTRTYPE(PDMPICHLPR3 *) PPDMPICHLPR3;
|
---|
1083 | /** Pointer to const PIC R3 helpers. */
|
---|
1084 | typedef R3PTRTYPE(const PDMPICHLPR3 *) PCPDMPICHLPR3;
|
---|
1085 |
|
---|
1086 | /** Current PDMPICHLPR3 version number. */
|
---|
1087 | #define PDM_PICHLPR3_VERSION PDM_VERSION_MAKE(0xfff7, 1, 0)
|
---|
1088 |
|
---|
1089 |
|
---|
1090 |
|
---|
1091 | /**
|
---|
1092 | * Firmware registration structure.
|
---|
1093 | */
|
---|
1094 | typedef struct PDMFWREG
|
---|
1095 | {
|
---|
1096 | /** Struct version+magic number (PDM_FWREG_VERSION). */
|
---|
1097 | uint32_t u32Version;
|
---|
1098 |
|
---|
1099 | /**
|
---|
1100 | * Checks whether this is a hard or soft reset.
|
---|
1101 | *
|
---|
1102 | * The current definition of soft reset is what the PC BIOS does when CMOS[0xF]
|
---|
1103 | * is 5, 9 or 0xA.
|
---|
1104 | *
|
---|
1105 | * @returns true if hard reset, false if soft.
|
---|
1106 | * @param pDevIns Device instance of the firmware.
|
---|
1107 | * @param fFlags PDMRESET_F_XXX passed to the PDMDevHlpVMReset API.
|
---|
1108 | */
|
---|
1109 | DECLR3CALLBACKMEMBER(bool, pfnIsHardReset,(PPDMDEVINS pDevIns, uint32_t fFlags));
|
---|
1110 |
|
---|
1111 | /** Just a safety precaution. */
|
---|
1112 | uint32_t u32TheEnd;
|
---|
1113 | } PDMFWREG;
|
---|
1114 | /** Pointer to a FW registration structure. */
|
---|
1115 | typedef PDMFWREG *PPDMFWREG;
|
---|
1116 | /** Pointer to a const FW registration structure. */
|
---|
1117 | typedef PDMFWREG const *PCPDMFWREG;
|
---|
1118 |
|
---|
1119 | /** Current PDMFWREG version number. */
|
---|
1120 | #define PDM_FWREG_VERSION PDM_VERSION_MAKE(0xffdd, 1, 0)
|
---|
1121 |
|
---|
1122 | /**
|
---|
1123 | * Firmware R3 helpers.
|
---|
1124 | */
|
---|
1125 | typedef struct PDMFWHLPR3
|
---|
1126 | {
|
---|
1127 | /** Structure version. PDM_FWHLP_VERSION defines the current version. */
|
---|
1128 | uint32_t u32Version;
|
---|
1129 |
|
---|
1130 | /** Just a safety precaution. */
|
---|
1131 | uint32_t u32TheEnd;
|
---|
1132 | } PDMFWHLPR3;
|
---|
1133 |
|
---|
1134 | /** Pointer to FW R3 helpers. */
|
---|
1135 | typedef R3PTRTYPE(PDMFWHLPR3 *) PPDMFWHLPR3;
|
---|
1136 | /** Pointer to const FW R3 helpers. */
|
---|
1137 | typedef R3PTRTYPE(const PDMFWHLPR3 *) PCPDMFWHLPR3;
|
---|
1138 |
|
---|
1139 | /** Current PDMFWHLPR3 version number. */
|
---|
1140 | #define PDM_FWHLPR3_VERSION PDM_VERSION_MAKE(0xffdb, 1, 0)
|
---|
1141 |
|
---|
1142 |
|
---|
1143 | /**
|
---|
1144 | * APIC mode argument for apicR3SetCpuIdFeatureLevel.
|
---|
1145 | *
|
---|
1146 | * Also used in saved-states, CFGM don't change existing values.
|
---|
1147 | */
|
---|
1148 | typedef enum PDMAPICMODE
|
---|
1149 | {
|
---|
1150 | /** Invalid 0 entry. */
|
---|
1151 | PDMAPICMODE_INVALID = 0,
|
---|
1152 | /** No APIC. */
|
---|
1153 | PDMAPICMODE_NONE,
|
---|
1154 | /** Standard APIC (X86_CPUID_FEATURE_EDX_APIC). */
|
---|
1155 | PDMAPICMODE_APIC,
|
---|
1156 | /** Intel X2APIC (X86_CPUID_FEATURE_ECX_X2APIC). */
|
---|
1157 | PDMAPICMODE_X2APIC,
|
---|
1158 | /** The usual 32-bit paranoia. */
|
---|
1159 | PDMAPICMODE_32BIT_HACK = 0x7fffffff
|
---|
1160 | } PDMAPICMODE;
|
---|
1161 |
|
---|
1162 | /**
|
---|
1163 | * APIC irq argument for pfnSetInterruptFF and pfnClearInterruptFF.
|
---|
1164 | */
|
---|
1165 | typedef enum PDMAPICIRQ
|
---|
1166 | {
|
---|
1167 | /** Invalid 0 entry. */
|
---|
1168 | PDMAPICIRQ_INVALID = 0,
|
---|
1169 | /** Normal hardware interrupt. */
|
---|
1170 | PDMAPICIRQ_HARDWARE,
|
---|
1171 | /** NMI. */
|
---|
1172 | PDMAPICIRQ_NMI,
|
---|
1173 | /** SMI. */
|
---|
1174 | PDMAPICIRQ_SMI,
|
---|
1175 | /** ExtINT (HW interrupt via PIC). */
|
---|
1176 | PDMAPICIRQ_EXTINT,
|
---|
1177 | /** Interrupt arrived, needs to be updated to the IRR. */
|
---|
1178 | PDMAPICIRQ_UPDATE_PENDING,
|
---|
1179 | /** The usual 32-bit paranoia. */
|
---|
1180 | PDMAPICIRQ_32BIT_HACK = 0x7fffffff
|
---|
1181 | } PDMAPICIRQ;
|
---|
1182 |
|
---|
1183 |
|
---|
1184 | /**
|
---|
1185 | * I/O APIC registration structure.
|
---|
1186 | */
|
---|
1187 | typedef struct PDMIOAPICREG
|
---|
1188 | {
|
---|
1189 | /** Struct version+magic number (PDM_IOAPICREG_VERSION). */
|
---|
1190 | uint32_t u32Version;
|
---|
1191 |
|
---|
1192 | /**
|
---|
1193 | * Set an IRQ.
|
---|
1194 | *
|
---|
1195 | * @param pDevIns Device instance of the I/O APIC.
|
---|
1196 | * @param iIrq IRQ number to set.
|
---|
1197 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
1198 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
1199 | * @remarks Caller enters the PDM critical section
|
---|
1200 | */
|
---|
1201 | DECLR3CALLBACKMEMBER(void, pfnSetIrqR3,(PPDMDEVINS pDevIns, int iIrq, int iLevel, uint32_t uTagSrc));
|
---|
1202 |
|
---|
1203 | /** The name of the RC SetIrq entry point. */
|
---|
1204 | const char *pszSetIrqRC;
|
---|
1205 |
|
---|
1206 | /** The name of the R0 SetIrq entry point. */
|
---|
1207 | const char *pszSetIrqR0;
|
---|
1208 |
|
---|
1209 | /**
|
---|
1210 | * Send a MSI.
|
---|
1211 | *
|
---|
1212 | * @param pDevIns Device instance of the I/O APIC.
|
---|
1213 | * @param GCPhys Request address.
|
---|
1214 | * @param uValue Request value.
|
---|
1215 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
1216 | * @remarks Caller enters the PDM critical section
|
---|
1217 | */
|
---|
1218 | DECLR3CALLBACKMEMBER(void, pfnSendMsiR3,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue, uint32_t uTagSrc));
|
---|
1219 |
|
---|
1220 | /** The name of the RC SendMsi entry point. */
|
---|
1221 | const char *pszSendMsiRC;
|
---|
1222 |
|
---|
1223 | /** The name of the R0 SendMsi entry point. */
|
---|
1224 | const char *pszSendMsiR0;
|
---|
1225 |
|
---|
1226 | /**
|
---|
1227 | * Set the EOI for an interrupt vector.
|
---|
1228 | *
|
---|
1229 | * @returns VBox status code.
|
---|
1230 | * @param pDevIns Device instance of the I/O APIC.
|
---|
1231 | * @param u8Vector The vector.
|
---|
1232 | * @remarks Caller enters the PDM critical section
|
---|
1233 | */
|
---|
1234 | DECLR3CALLBACKMEMBER(int, pfnSetEoiR3,(PPDMDEVINS pDevIns, uint8_t u8Vector));
|
---|
1235 |
|
---|
1236 | /** The name of the RC SetEoi entry point. */
|
---|
1237 | const char *pszSetEoiRC;
|
---|
1238 |
|
---|
1239 | /** The name of the R0 SetEoi entry point. */
|
---|
1240 | const char *pszSetEoiR0;
|
---|
1241 | } PDMIOAPICREG;
|
---|
1242 | /** Pointer to an APIC registration structure. */
|
---|
1243 | typedef PDMIOAPICREG *PPDMIOAPICREG;
|
---|
1244 |
|
---|
1245 | /** Current PDMAPICREG version number. */
|
---|
1246 | #define PDM_IOAPICREG_VERSION PDM_VERSION_MAKE(0xfff2, 5, 0)
|
---|
1247 |
|
---|
1248 |
|
---|
1249 | /**
|
---|
1250 | * IOAPIC RC helpers.
|
---|
1251 | */
|
---|
1252 | typedef struct PDMIOAPICHLPRC
|
---|
1253 | {
|
---|
1254 | /** Structure version. PDM_IOAPICHLPRC_VERSION defines the current version. */
|
---|
1255 | uint32_t u32Version;
|
---|
1256 |
|
---|
1257 | /**
|
---|
1258 | * Private interface between the IOAPIC and APIC.
|
---|
1259 | *
|
---|
1260 | * See comments about this hack on PDMAPICREG::pfnBusDeliverR3.
|
---|
1261 | *
|
---|
1262 | * @returns status code.
|
---|
1263 | * @param pDevIns Device instance of the IOAPIC.
|
---|
1264 | * @param u8Dest See APIC implementation.
|
---|
1265 | * @param u8DestMode See APIC implementation.
|
---|
1266 | * @param u8DeliveryMode See APIC implementation.
|
---|
1267 | * @param uVector See APIC implementation.
|
---|
1268 | * @param u8Polarity See APIC implementation.
|
---|
1269 | * @param u8TriggerMode See APIC implementation.
|
---|
1270 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
1271 | */
|
---|
1272 | DECLRCCALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
|
---|
1273 | uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
|
---|
1274 |
|
---|
1275 | /**
|
---|
1276 | * Acquires the PDM lock.
|
---|
1277 | *
|
---|
1278 | * @returns VINF_SUCCESS on success.
|
---|
1279 | * @returns rc if we failed to acquire the lock.
|
---|
1280 | * @param pDevIns The IOAPIC device instance.
|
---|
1281 | * @param rc What to return if we fail to acquire the lock.
|
---|
1282 | */
|
---|
1283 | DECLRCCALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
1284 |
|
---|
1285 | /**
|
---|
1286 | * Releases the PDM lock.
|
---|
1287 | *
|
---|
1288 | * @param pDevIns The IOAPIC device instance.
|
---|
1289 | */
|
---|
1290 | DECLRCCALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
1291 |
|
---|
1292 | /** Just a safety precaution. */
|
---|
1293 | uint32_t u32TheEnd;
|
---|
1294 | } PDMIOAPICHLPRC;
|
---|
1295 | /** Pointer to IOAPIC RC helpers. */
|
---|
1296 | typedef RCPTRTYPE(PDMIOAPICHLPRC *) PPDMIOAPICHLPRC;
|
---|
1297 | /** Pointer to const IOAPIC helpers. */
|
---|
1298 | typedef RCPTRTYPE(const PDMIOAPICHLPRC *) PCPDMIOAPICHLPRC;
|
---|
1299 |
|
---|
1300 | /** Current PDMIOAPICHLPRC version number. */
|
---|
1301 | #define PDM_IOAPICHLPRC_VERSION PDM_VERSION_MAKE(0xfff1, 2, 0)
|
---|
1302 |
|
---|
1303 |
|
---|
1304 | /**
|
---|
1305 | * IOAPIC R0 helpers.
|
---|
1306 | */
|
---|
1307 | typedef struct PDMIOAPICHLPR0
|
---|
1308 | {
|
---|
1309 | /** Structure version. PDM_IOAPICHLPR0_VERSION defines the current version. */
|
---|
1310 | uint32_t u32Version;
|
---|
1311 |
|
---|
1312 | /**
|
---|
1313 | * Private interface between the IOAPIC and APIC.
|
---|
1314 | *
|
---|
1315 | * See comments about this hack on PDMAPICREG::pfnBusDeliverR3.
|
---|
1316 | *
|
---|
1317 | * @returns status code.
|
---|
1318 | * @param pDevIns Device instance of the IOAPIC.
|
---|
1319 | * @param u8Dest See APIC implementation.
|
---|
1320 | * @param u8DestMode See APIC implementation.
|
---|
1321 | * @param u8DeliveryMode See APIC implementation.
|
---|
1322 | * @param uVector See APIC implementation.
|
---|
1323 | * @param u8Polarity See APIC implementation.
|
---|
1324 | * @param u8TriggerMode See APIC implementation.
|
---|
1325 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
1326 | */
|
---|
1327 | DECLR0CALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
|
---|
1328 | uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
|
---|
1329 |
|
---|
1330 | /**
|
---|
1331 | * Acquires the PDM lock.
|
---|
1332 | *
|
---|
1333 | * @returns VINF_SUCCESS on success.
|
---|
1334 | * @returns rc if we failed to acquire the lock.
|
---|
1335 | * @param pDevIns The IOAPIC device instance.
|
---|
1336 | * @param rc What to return if we fail to acquire the lock.
|
---|
1337 | */
|
---|
1338 | DECLR0CALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
1339 |
|
---|
1340 | /**
|
---|
1341 | * Releases the PDM lock.
|
---|
1342 | *
|
---|
1343 | * @param pDevIns The IOAPIC device instance.
|
---|
1344 | */
|
---|
1345 | DECLR0CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
1346 |
|
---|
1347 | /** Just a safety precaution. */
|
---|
1348 | uint32_t u32TheEnd;
|
---|
1349 | } PDMIOAPICHLPR0;
|
---|
1350 | /** Pointer to IOAPIC R0 helpers. */
|
---|
1351 | typedef R0PTRTYPE(PDMIOAPICHLPR0 *) PPDMIOAPICHLPR0;
|
---|
1352 | /** Pointer to const IOAPIC helpers. */
|
---|
1353 | typedef R0PTRTYPE(const PDMIOAPICHLPR0 *) PCPDMIOAPICHLPR0;
|
---|
1354 |
|
---|
1355 | /** Current PDMIOAPICHLPR0 version number. */
|
---|
1356 | #define PDM_IOAPICHLPR0_VERSION PDM_VERSION_MAKE(0xfff0, 2, 0)
|
---|
1357 |
|
---|
1358 | /**
|
---|
1359 | * IOAPIC R3 helpers.
|
---|
1360 | */
|
---|
1361 | typedef struct PDMIOAPICHLPR3
|
---|
1362 | {
|
---|
1363 | /** Structure version. PDM_IOAPICHLPR3_VERSION defines the current version. */
|
---|
1364 | uint32_t u32Version;
|
---|
1365 |
|
---|
1366 | /**
|
---|
1367 | * Private interface between the IOAPIC and APIC.
|
---|
1368 | *
|
---|
1369 | * See comments about this hack on PDMAPICREG::pfnBusDeliverR3.
|
---|
1370 | *
|
---|
1371 | * @returns status code
|
---|
1372 | * @param pDevIns Device instance of the IOAPIC.
|
---|
1373 | * @param u8Dest See APIC implementation.
|
---|
1374 | * @param u8DestMode See APIC implementation.
|
---|
1375 | * @param u8DeliveryMode See APIC implementation.
|
---|
1376 | * @param uVector See APIC implementation.
|
---|
1377 | * @param u8Polarity See APIC implementation.
|
---|
1378 | * @param u8TriggerMode See APIC implementation.
|
---|
1379 | * @param uTagSrc The IRQ tag and source (for tracing).
|
---|
1380 | */
|
---|
1381 | DECLR3CALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode,
|
---|
1382 | uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
|
---|
1383 |
|
---|
1384 | /**
|
---|
1385 | * Acquires the PDM lock.
|
---|
1386 | *
|
---|
1387 | * @returns VINF_SUCCESS on success.
|
---|
1388 | * @returns Fatal error on failure.
|
---|
1389 | * @param pDevIns The IOAPIC device instance.
|
---|
1390 | * @param rc Dummy for making the interface identical to the GC and R0 versions.
|
---|
1391 | */
|
---|
1392 | DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMDEVINS pDevIns, int rc));
|
---|
1393 |
|
---|
1394 | /**
|
---|
1395 | * Releases the PDM lock.
|
---|
1396 | *
|
---|
1397 | * @param pDevIns The IOAPIC device instance.
|
---|
1398 | */
|
---|
1399 | DECLR3CALLBACKMEMBER(void, pfnUnlock,(PPDMDEVINS pDevIns));
|
---|
1400 |
|
---|
1401 | /**
|
---|
1402 | * Gets the address of the RC IOAPIC helpers.
|
---|
1403 | *
|
---|
1404 | * This should be called at both construction and relocation time
|
---|
1405 | * to obtain the correct address of the RC helpers.
|
---|
1406 | *
|
---|
1407 | * @returns RC pointer to the IOAPIC helpers.
|
---|
1408 | * @param pDevIns Device instance of the IOAPIC.
|
---|
1409 | */
|
---|
1410 | DECLR3CALLBACKMEMBER(PCPDMIOAPICHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
|
---|
1411 |
|
---|
1412 | /**
|
---|
1413 | * Gets the address of the R0 IOAPIC helpers.
|
---|
1414 | *
|
---|
1415 | * This should be called at both construction and relocation time
|
---|
1416 | * to obtain the correct address of the R0 helpers.
|
---|
1417 | *
|
---|
1418 | * @returns R0 pointer to the IOAPIC helpers.
|
---|
1419 | * @param pDevIns Device instance of the IOAPIC.
|
---|
1420 | */
|
---|
1421 | DECLR3CALLBACKMEMBER(PCPDMIOAPICHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
|
---|
1422 |
|
---|
1423 | /** Just a safety precaution. */
|
---|
1424 | uint32_t u32TheEnd;
|
---|
1425 | } PDMIOAPICHLPR3;
|
---|
1426 | /** Pointer to IOAPIC R3 helpers. */
|
---|
1427 | typedef R3PTRTYPE(PDMIOAPICHLPR3 *) PPDMIOAPICHLPR3;
|
---|
1428 | /** Pointer to const IOAPIC helpers. */
|
---|
1429 | typedef R3PTRTYPE(const PDMIOAPICHLPR3 *) PCPDMIOAPICHLPR3;
|
---|
1430 |
|
---|
1431 | /** Current PDMIOAPICHLPR3 version number. */
|
---|
1432 | #define PDM_IOAPICHLPR3_VERSION PDM_VERSION_MAKE(0xffef, 2, 0)
|
---|
1433 |
|
---|
1434 |
|
---|
1435 | /**
|
---|
1436 | * HPET registration structure.
|
---|
1437 | */
|
---|
1438 | typedef struct PDMHPETREG
|
---|
1439 | {
|
---|
1440 | /** Struct version+magic number (PDM_HPETREG_VERSION). */
|
---|
1441 | uint32_t u32Version;
|
---|
1442 |
|
---|
1443 | } PDMHPETREG;
|
---|
1444 | /** Pointer to an HPET registration structure. */
|
---|
1445 | typedef PDMHPETREG *PPDMHPETREG;
|
---|
1446 |
|
---|
1447 | /** Current PDMHPETREG version number. */
|
---|
1448 | #define PDM_HPETREG_VERSION PDM_VERSION_MAKE(0xffe2, 1, 0)
|
---|
1449 |
|
---|
1450 | /**
|
---|
1451 | * HPET RC helpers.
|
---|
1452 | *
|
---|
1453 | * @remarks Keep this around in case HPET will need PDM interaction in again RC
|
---|
1454 | * at some later point.
|
---|
1455 | */
|
---|
1456 | typedef struct PDMHPETHLPRC
|
---|
1457 | {
|
---|
1458 | /** Structure version. PDM_HPETHLPRC_VERSION defines the current version. */
|
---|
1459 | uint32_t u32Version;
|
---|
1460 |
|
---|
1461 | /** Just a safety precaution. */
|
---|
1462 | uint32_t u32TheEnd;
|
---|
1463 | } PDMHPETHLPRC;
|
---|
1464 |
|
---|
1465 | /** Pointer to HPET RC helpers. */
|
---|
1466 | typedef RCPTRTYPE(PDMHPETHLPRC *) PPDMHPETHLPRC;
|
---|
1467 | /** Pointer to const HPET RC helpers. */
|
---|
1468 | typedef RCPTRTYPE(const PDMHPETHLPRC *) PCPDMHPETHLPRC;
|
---|
1469 |
|
---|
1470 | /** Current PDMHPETHLPRC version number. */
|
---|
1471 | #define PDM_HPETHLPRC_VERSION PDM_VERSION_MAKE(0xffee, 2, 0)
|
---|
1472 |
|
---|
1473 |
|
---|
1474 | /**
|
---|
1475 | * HPET R0 helpers.
|
---|
1476 | *
|
---|
1477 | * @remarks Keep this around in case HPET will need PDM interaction in again R0
|
---|
1478 | * at some later point.
|
---|
1479 | */
|
---|
1480 | typedef struct PDMHPETHLPR0
|
---|
1481 | {
|
---|
1482 | /** Structure version. PDM_HPETHLPR0_VERSION defines the current version. */
|
---|
1483 | uint32_t u32Version;
|
---|
1484 |
|
---|
1485 | /** Just a safety precaution. */
|
---|
1486 | uint32_t u32TheEnd;
|
---|
1487 | } PDMHPETHLPR0;
|
---|
1488 |
|
---|
1489 | /** Pointer to HPET R0 helpers. */
|
---|
1490 | typedef R0PTRTYPE(PDMHPETHLPR0 *) PPDMHPETHLPR0;
|
---|
1491 | /** Pointer to const HPET R0 helpers. */
|
---|
1492 | typedef R0PTRTYPE(const PDMHPETHLPR0 *) PCPDMHPETHLPR0;
|
---|
1493 |
|
---|
1494 | /** Current PDMHPETHLPR0 version number. */
|
---|
1495 | #define PDM_HPETHLPR0_VERSION PDM_VERSION_MAKE(0xffed, 2, 0)
|
---|
1496 |
|
---|
1497 | /**
|
---|
1498 | * HPET R3 helpers.
|
---|
1499 | */
|
---|
1500 | typedef struct PDMHPETHLPR3
|
---|
1501 | {
|
---|
1502 | /** Structure version. PDM_HPETHLP_VERSION defines the current version. */
|
---|
1503 | uint32_t u32Version;
|
---|
1504 |
|
---|
1505 | /**
|
---|
1506 | * Gets the address of the RC HPET helpers.
|
---|
1507 | *
|
---|
1508 | * This should be called at both construction and relocation time
|
---|
1509 | * to obtain the correct address of the RC helpers.
|
---|
1510 | *
|
---|
1511 | * @returns RC pointer to the HPET helpers.
|
---|
1512 | * @param pDevIns Device instance of the HPET.
|
---|
1513 | */
|
---|
1514 | DECLR3CALLBACKMEMBER(PCPDMHPETHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
|
---|
1515 |
|
---|
1516 | /**
|
---|
1517 | * Gets the address of the R0 HPET helpers.
|
---|
1518 | *
|
---|
1519 | * This should be called at both construction and relocation time
|
---|
1520 | * to obtain the correct address of the R0 helpers.
|
---|
1521 | *
|
---|
1522 | * @returns R0 pointer to the HPET helpers.
|
---|
1523 | * @param pDevIns Device instance of the HPET.
|
---|
1524 | */
|
---|
1525 | DECLR3CALLBACKMEMBER(PCPDMHPETHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
|
---|
1526 |
|
---|
1527 | /**
|
---|
1528 | * Set legacy mode on PIT and RTC.
|
---|
1529 | *
|
---|
1530 | * @returns VINF_SUCCESS on success.
|
---|
1531 | * @returns rc if we failed to set legacy mode.
|
---|
1532 | * @param pDevIns Device instance of the HPET.
|
---|
1533 | * @param fActivated Whether legacy mode is activated or deactivated.
|
---|
1534 | */
|
---|
1535 | DECLR3CALLBACKMEMBER(int, pfnSetLegacyMode,(PPDMDEVINS pDevIns, bool fActivated));
|
---|
1536 |
|
---|
1537 |
|
---|
1538 | /**
|
---|
1539 | * Set IRQ, bypassing ISA bus override rules.
|
---|
1540 | *
|
---|
1541 | * @returns VINF_SUCCESS on success.
|
---|
1542 | * @returns rc if we failed to set legacy mode.
|
---|
1543 | * @param pDevIns Device instance of the HPET.
|
---|
1544 | * @param iIrq IRQ number to set.
|
---|
1545 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
1546 | */
|
---|
1547 | DECLR3CALLBACKMEMBER(int, pfnSetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
1548 |
|
---|
1549 | /** Just a safety precaution. */
|
---|
1550 | uint32_t u32TheEnd;
|
---|
1551 | } PDMHPETHLPR3;
|
---|
1552 |
|
---|
1553 | /** Pointer to HPET R3 helpers. */
|
---|
1554 | typedef R3PTRTYPE(PDMHPETHLPR3 *) PPDMHPETHLPR3;
|
---|
1555 | /** Pointer to const HPET R3 helpers. */
|
---|
1556 | typedef R3PTRTYPE(const PDMHPETHLPR3 *) PCPDMHPETHLPR3;
|
---|
1557 |
|
---|
1558 | /** Current PDMHPETHLPR3 version number. */
|
---|
1559 | #define PDM_HPETHLPR3_VERSION PDM_VERSION_MAKE(0xffec, 2, 0)
|
---|
1560 |
|
---|
1561 |
|
---|
1562 | /**
|
---|
1563 | * Raw PCI device registration structure.
|
---|
1564 | */
|
---|
1565 | typedef struct PDMPCIRAWREG
|
---|
1566 | {
|
---|
1567 | /** Struct version+magic number (PDM_PCIRAWREG_VERSION). */
|
---|
1568 | uint32_t u32Version;
|
---|
1569 | /** Just a safety precaution. */
|
---|
1570 | uint32_t u32TheEnd;
|
---|
1571 | } PDMPCIRAWREG;
|
---|
1572 | /** Pointer to a raw PCI registration structure. */
|
---|
1573 | typedef PDMPCIRAWREG *PPDMPCIRAWREG;
|
---|
1574 |
|
---|
1575 | /** Current PDMPCIRAWREG version number. */
|
---|
1576 | #define PDM_PCIRAWREG_VERSION PDM_VERSION_MAKE(0xffe1, 1, 0)
|
---|
1577 |
|
---|
1578 | /**
|
---|
1579 | * Raw PCI device raw-mode context helpers.
|
---|
1580 | */
|
---|
1581 | typedef struct PDMPCIRAWHLPRC
|
---|
1582 | {
|
---|
1583 | /** Structure version and magic number (PDM_PCIRAWHLPRC_VERSION). */
|
---|
1584 | uint32_t u32Version;
|
---|
1585 | /** Just a safety precaution. */
|
---|
1586 | uint32_t u32TheEnd;
|
---|
1587 | } PDMPCIRAWHLPRC;
|
---|
1588 | /** Pointer to a raw PCI deviec raw-mode context helper structure. */
|
---|
1589 | typedef RCPTRTYPE(PDMPCIRAWHLPRC *) PPDMPCIRAWHLPRC;
|
---|
1590 | /** Pointer to a const raw PCI deviec raw-mode context helper structure. */
|
---|
1591 | typedef RCPTRTYPE(const PDMPCIRAWHLPRC *) PCPDMPCIRAWHLPRC;
|
---|
1592 |
|
---|
1593 | /** Current PDMPCIRAWHLPRC version number. */
|
---|
1594 | #define PDM_PCIRAWHLPRC_VERSION PDM_VERSION_MAKE(0xffe0, 1, 0)
|
---|
1595 |
|
---|
1596 | /**
|
---|
1597 | * Raw PCI device ring-0 context helpers.
|
---|
1598 | */
|
---|
1599 | typedef struct PDMPCIRAWHLPR0
|
---|
1600 | {
|
---|
1601 | /** Structure version and magic number (PDM_PCIRAWHLPR0_VERSION). */
|
---|
1602 | uint32_t u32Version;
|
---|
1603 | /** Just a safety precaution. */
|
---|
1604 | uint32_t u32TheEnd;
|
---|
1605 | } PDMPCIRAWHLPR0;
|
---|
1606 | /** Pointer to a raw PCI deviec ring-0 context helper structure. */
|
---|
1607 | typedef R0PTRTYPE(PDMPCIRAWHLPR0 *) PPDMPCIRAWHLPR0;
|
---|
1608 | /** Pointer to a const raw PCI deviec ring-0 context helper structure. */
|
---|
1609 | typedef R0PTRTYPE(const PDMPCIRAWHLPR0 *) PCPDMPCIRAWHLPR0;
|
---|
1610 |
|
---|
1611 | /** Current PDMPCIRAWHLPR0 version number. */
|
---|
1612 | #define PDM_PCIRAWHLPR0_VERSION PDM_VERSION_MAKE(0xffdf, 1, 0)
|
---|
1613 |
|
---|
1614 |
|
---|
1615 | /**
|
---|
1616 | * Raw PCI device ring-3 context helpers.
|
---|
1617 | */
|
---|
1618 | typedef struct PDMPCIRAWHLPR3
|
---|
1619 | {
|
---|
1620 | /** Undefined structure version and magic number. */
|
---|
1621 | uint32_t u32Version;
|
---|
1622 |
|
---|
1623 | /**
|
---|
1624 | * Gets the address of the RC raw PCI device helpers.
|
---|
1625 | *
|
---|
1626 | * This should be called at both construction and relocation time to obtain
|
---|
1627 | * the correct address of the RC helpers.
|
---|
1628 | *
|
---|
1629 | * @returns RC pointer to the raw PCI device helpers.
|
---|
1630 | * @param pDevIns Device instance of the raw PCI device.
|
---|
1631 | */
|
---|
1632 | DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPRC, pfnGetRCHelpers,(PPDMDEVINS pDevIns));
|
---|
1633 |
|
---|
1634 | /**
|
---|
1635 | * Gets the address of the R0 raw PCI device helpers.
|
---|
1636 | *
|
---|
1637 | * This should be called at both construction and relocation time to obtain
|
---|
1638 | * the correct address of the R0 helpers.
|
---|
1639 | *
|
---|
1640 | * @returns R0 pointer to the raw PCI device helpers.
|
---|
1641 | * @param pDevIns Device instance of the raw PCI device.
|
---|
1642 | */
|
---|
1643 | DECLR3CALLBACKMEMBER(PCPDMPCIRAWHLPR0, pfnGetR0Helpers,(PPDMDEVINS pDevIns));
|
---|
1644 |
|
---|
1645 | /** Just a safety precaution. */
|
---|
1646 | uint32_t u32TheEnd;
|
---|
1647 | } PDMPCIRAWHLPR3;
|
---|
1648 | /** Pointer to raw PCI R3 helpers. */
|
---|
1649 | typedef R3PTRTYPE(PDMPCIRAWHLPR3 *) PPDMPCIRAWHLPR3;
|
---|
1650 | /** Pointer to const raw PCI R3 helpers. */
|
---|
1651 | typedef R3PTRTYPE(const PDMPCIRAWHLPR3 *) PCPDMPCIRAWHLPR3;
|
---|
1652 |
|
---|
1653 | /** Current PDMPCIRAWHLPR3 version number. */
|
---|
1654 | #define PDM_PCIRAWHLPR3_VERSION PDM_VERSION_MAKE(0xffde, 1, 0)
|
---|
1655 |
|
---|
1656 |
|
---|
1657 | #ifdef IN_RING3
|
---|
1658 |
|
---|
1659 | /**
|
---|
1660 | * DMA Transfer Handler.
|
---|
1661 | *
|
---|
1662 | * @returns Number of bytes transferred.
|
---|
1663 | * @param pDevIns Device instance of the DMA.
|
---|
1664 | * @param pvUser User pointer.
|
---|
1665 | * @param uChannel Channel number.
|
---|
1666 | * @param off DMA position.
|
---|
1667 | * @param cb Block size.
|
---|
1668 | * @remarks The device lock is not taken, however, the DMA device lock is held.
|
---|
1669 | */
|
---|
1670 | typedef DECLCALLBACK(uint32_t) FNDMATRANSFERHANDLER(PPDMDEVINS pDevIns, void *pvUser, unsigned uChannel, uint32_t off, uint32_t cb);
|
---|
1671 | /** Pointer to a FNDMATRANSFERHANDLER(). */
|
---|
1672 | typedef FNDMATRANSFERHANDLER *PFNDMATRANSFERHANDLER;
|
---|
1673 |
|
---|
1674 | /**
|
---|
1675 | * DMA Controller registration structure.
|
---|
1676 | */
|
---|
1677 | typedef struct PDMDMAREG
|
---|
1678 | {
|
---|
1679 | /** Structure version number. PDM_DMACREG_VERSION defines the current version. */
|
---|
1680 | uint32_t u32Version;
|
---|
1681 |
|
---|
1682 | /**
|
---|
1683 | * Execute pending transfers.
|
---|
1684 | *
|
---|
1685 | * @returns A more work indiciator. I.e. 'true' if there is more to be done, and 'false' if all is done.
|
---|
1686 | * @param pDevIns Device instance of the DMAC.
|
---|
1687 | * @remarks No locks held, called on EMT(0) as a form of serialization.
|
---|
1688 | */
|
---|
1689 | DECLR3CALLBACKMEMBER(bool, pfnRun,(PPDMDEVINS pDevIns));
|
---|
1690 |
|
---|
1691 | /**
|
---|
1692 | * Register transfer function for DMA channel.
|
---|
1693 | *
|
---|
1694 | * @param pDevIns Device instance of the DMAC.
|
---|
1695 | * @param uChannel Channel number.
|
---|
1696 | * @param pfnTransferHandler Device specific transfer function.
|
---|
1697 | * @param pvUser User pointer to be passed to the callback.
|
---|
1698 | * @remarks No locks held, called on an EMT.
|
---|
1699 | */
|
---|
1700 | DECLR3CALLBACKMEMBER(void, pfnRegister,(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser));
|
---|
1701 |
|
---|
1702 | /**
|
---|
1703 | * Read memory
|
---|
1704 | *
|
---|
1705 | * @returns Number of bytes read.
|
---|
1706 | * @param pDevIns Device instance of the DMAC.
|
---|
1707 | * @param uChannel Channel number.
|
---|
1708 | * @param pvBuffer Pointer to target buffer.
|
---|
1709 | * @param off DMA position.
|
---|
1710 | * @param cbBlock Block size.
|
---|
1711 | * @remarks No locks held, called on an EMT.
|
---|
1712 | */
|
---|
1713 | DECLR3CALLBACKMEMBER(uint32_t, pfnReadMemory,(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock));
|
---|
1714 |
|
---|
1715 | /**
|
---|
1716 | * Write memory
|
---|
1717 | *
|
---|
1718 | * @returns Number of bytes written.
|
---|
1719 | * @param pDevIns Device instance of the DMAC.
|
---|
1720 | * @param uChannel Channel number.
|
---|
1721 | * @param pvBuffer Memory to write.
|
---|
1722 | * @param off DMA position.
|
---|
1723 | * @param cbBlock Block size.
|
---|
1724 | * @remarks No locks held, called on an EMT.
|
---|
1725 | */
|
---|
1726 | DECLR3CALLBACKMEMBER(uint32_t, pfnWriteMemory,(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock));
|
---|
1727 |
|
---|
1728 | /**
|
---|
1729 | * Set the DREQ line.
|
---|
1730 | *
|
---|
1731 | * @param pDevIns Device instance of the DMAC.
|
---|
1732 | * @param uChannel Channel number.
|
---|
1733 | * @param uLevel Level of the line.
|
---|
1734 | * @remarks No locks held, called on an EMT.
|
---|
1735 | */
|
---|
1736 | DECLR3CALLBACKMEMBER(void, pfnSetDREQ,(PPDMDEVINS pDevIns, unsigned uChannel, unsigned uLevel));
|
---|
1737 |
|
---|
1738 | /**
|
---|
1739 | * Get channel mode
|
---|
1740 | *
|
---|
1741 | * @returns Channel mode.
|
---|
1742 | * @param pDevIns Device instance of the DMAC.
|
---|
1743 | * @param uChannel Channel number.
|
---|
1744 | * @remarks No locks held, called on an EMT.
|
---|
1745 | */
|
---|
1746 | DECLR3CALLBACKMEMBER(uint8_t, pfnGetChannelMode,(PPDMDEVINS pDevIns, unsigned uChannel));
|
---|
1747 |
|
---|
1748 | } PDMDMACREG;
|
---|
1749 | /** Pointer to a DMAC registration structure. */
|
---|
1750 | typedef PDMDMACREG *PPDMDMACREG;
|
---|
1751 |
|
---|
1752 | /** Current PDMDMACREG version number. */
|
---|
1753 | #define PDM_DMACREG_VERSION PDM_VERSION_MAKE(0xffeb, 1, 0)
|
---|
1754 |
|
---|
1755 |
|
---|
1756 | /**
|
---|
1757 | * DMA Controller device helpers.
|
---|
1758 | */
|
---|
1759 | typedef struct PDMDMACHLP
|
---|
1760 | {
|
---|
1761 | /** Structure version. PDM_DMACHLP_VERSION defines the current version. */
|
---|
1762 | uint32_t u32Version;
|
---|
1763 |
|
---|
1764 | /* to-be-defined */
|
---|
1765 |
|
---|
1766 | } PDMDMACHLP;
|
---|
1767 | /** Pointer to DMAC helpers. */
|
---|
1768 | typedef PDMDMACHLP *PPDMDMACHLP;
|
---|
1769 | /** Pointer to const DMAC helpers. */
|
---|
1770 | typedef const PDMDMACHLP *PCPDMDMACHLP;
|
---|
1771 |
|
---|
1772 | /** Current PDMDMACHLP version number. */
|
---|
1773 | #define PDM_DMACHLP_VERSION PDM_VERSION_MAKE(0xffea, 1, 0)
|
---|
1774 |
|
---|
1775 | #endif /* IN_RING3 */
|
---|
1776 |
|
---|
1777 |
|
---|
1778 |
|
---|
1779 | /**
|
---|
1780 | * RTC registration structure.
|
---|
1781 | */
|
---|
1782 | typedef struct PDMRTCREG
|
---|
1783 | {
|
---|
1784 | /** Structure version number. PDM_RTCREG_VERSION defines the current version. */
|
---|
1785 | uint32_t u32Version;
|
---|
1786 | uint32_t u32Alignment; /**< structure size alignment. */
|
---|
1787 |
|
---|
1788 | /**
|
---|
1789 | * Write to a CMOS register and update the checksum if necessary.
|
---|
1790 | *
|
---|
1791 | * @returns VBox status code.
|
---|
1792 | * @param pDevIns Device instance of the RTC.
|
---|
1793 | * @param iReg The CMOS register index.
|
---|
1794 | * @param u8Value The CMOS register value.
|
---|
1795 | * @remarks Caller enters the device critical section.
|
---|
1796 | */
|
---|
1797 | DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value));
|
---|
1798 |
|
---|
1799 | /**
|
---|
1800 | * Read a CMOS register.
|
---|
1801 | *
|
---|
1802 | * @returns VBox status code.
|
---|
1803 | * @param pDevIns Device instance of the RTC.
|
---|
1804 | * @param iReg The CMOS register index.
|
---|
1805 | * @param pu8Value Where to store the CMOS register value.
|
---|
1806 | * @remarks Caller enters the device critical section.
|
---|
1807 | */
|
---|
1808 | DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value));
|
---|
1809 |
|
---|
1810 | } PDMRTCREG;
|
---|
1811 | /** Pointer to a RTC registration structure. */
|
---|
1812 | typedef PDMRTCREG *PPDMRTCREG;
|
---|
1813 | /** Pointer to a const RTC registration structure. */
|
---|
1814 | typedef const PDMRTCREG *PCPDMRTCREG;
|
---|
1815 |
|
---|
1816 | /** Current PDMRTCREG version number. */
|
---|
1817 | #define PDM_RTCREG_VERSION PDM_VERSION_MAKE(0xffe9, 2, 0)
|
---|
1818 |
|
---|
1819 |
|
---|
1820 | /**
|
---|
1821 | * RTC device helpers.
|
---|
1822 | */
|
---|
1823 | typedef struct PDMRTCHLP
|
---|
1824 | {
|
---|
1825 | /** Structure version. PDM_RTCHLP_VERSION defines the current version. */
|
---|
1826 | uint32_t u32Version;
|
---|
1827 |
|
---|
1828 | /* to-be-defined */
|
---|
1829 |
|
---|
1830 | } PDMRTCHLP;
|
---|
1831 | /** Pointer to RTC helpers. */
|
---|
1832 | typedef PDMRTCHLP *PPDMRTCHLP;
|
---|
1833 | /** Pointer to const RTC helpers. */
|
---|
1834 | typedef const PDMRTCHLP *PCPDMRTCHLP;
|
---|
1835 |
|
---|
1836 | /** Current PDMRTCHLP version number. */
|
---|
1837 | #define PDM_RTCHLP_VERSION PDM_VERSION_MAKE(0xffe8, 1, 0)
|
---|
1838 |
|
---|
1839 |
|
---|
1840 |
|
---|
1841 | #ifdef IN_RING3
|
---|
1842 |
|
---|
1843 | /** @name Special values for PDMDEVHLPR3::pfnPCIRegister parameters.
|
---|
1844 | * @{ */
|
---|
1845 | /** Use the primary device configruation (0). */
|
---|
1846 | # define PDMPCIDEVREG_CFG_PRIMARY 0
|
---|
1847 | /** Use the next device configuration number in the sequence (max + 1). */
|
---|
1848 | # define PDMPCIDEVREG_CFG_NEXT UINT32_MAX
|
---|
1849 | /** Same device number (and bus) as the previous PCI device registered with the PDM device.
|
---|
1850 | * This is handy when registering multiple PCI device functions and the device number
|
---|
1851 | * is left up to the PCI bus. In order to facilitate on PDM device instance for each
|
---|
1852 | * PCI function, this searches earlier PDM device instances as well. */
|
---|
1853 | # define PDMPCIDEVREG_DEV_NO_SAME_AS_PREV UINT8_C(0xfd)
|
---|
1854 | /** Use the first unused device number (all functions must be unused). */
|
---|
1855 | # define PDMPCIDEVREG_DEV_NO_FIRST_UNUSED UINT8_C(0xfe)
|
---|
1856 | /** Use the first unused device function. */
|
---|
1857 | # define PDMPCIDEVREG_FUN_NO_FIRST_UNUSED UINT8_C(0xff)
|
---|
1858 |
|
---|
1859 | /** The device and function numbers are not mandatory, just suggestions. */
|
---|
1860 | # define PDMPCIDEVREG_F_NOT_MANDATORY_NO RT_BIT_32(0)
|
---|
1861 | /** Registering a PCI bridge device. */
|
---|
1862 | # define PDMPCIDEVREG_F_PCI_BRIDGE RT_BIT_32(1)
|
---|
1863 | /** Valid flag mask. */
|
---|
1864 | # define PDMPCIDEVREG_F_VALID_MASK UINT32_C(0x00000003)
|
---|
1865 | /** @} */
|
---|
1866 |
|
---|
1867 | /** Current PDMDEVHLPR3 version number.
|
---|
1868 | * @todo Next major revision should add piBus to pfnPCIBusRegister, and move
|
---|
1869 | * pfnMMIOExReduce up to after pfnMMIOExUnmap. */
|
---|
1870 | #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 19, 2)
|
---|
1871 | //#define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 20, 0)
|
---|
1872 |
|
---|
1873 | /**
|
---|
1874 | * PDM Device API.
|
---|
1875 | */
|
---|
1876 | typedef struct PDMDEVHLPR3
|
---|
1877 | {
|
---|
1878 | /** Structure version. PDM_DEVHLPR3_VERSION defines the current version. */
|
---|
1879 | uint32_t u32Version;
|
---|
1880 |
|
---|
1881 | /**
|
---|
1882 | * Register a number of I/O ports with a device.
|
---|
1883 | *
|
---|
1884 | * These callbacks are of course for the host context (HC).
|
---|
1885 | * Register HC handlers before guest context (GC) handlers! There must be a
|
---|
1886 | * HC handler for every GC handler!
|
---|
1887 | *
|
---|
1888 | * @returns VBox status.
|
---|
1889 | * @param pDevIns The device instance to register the ports with.
|
---|
1890 | * @param Port First port number in the range.
|
---|
1891 | * @param cPorts Number of ports to register.
|
---|
1892 | * @param pvUser User argument.
|
---|
1893 | * @param pfnOut Pointer to function which is gonna handle OUT operations.
|
---|
1894 | * @param pfnIn Pointer to function which is gonna handle IN operations.
|
---|
1895 | * @param pfnOutStr Pointer to function which is gonna handle string OUT operations.
|
---|
1896 | * @param pfnInStr Pointer to function which is gonna handle string IN operations.
|
---|
1897 | * @param pszDesc Pointer to description string. This must not be freed.
|
---|
1898 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
1899 | * registered callback methods.
|
---|
1900 | */
|
---|
1901 | DECLR3CALLBACKMEMBER(int, pfnIOPortRegister,(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTHCPTR pvUser,
|
---|
1902 | PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
|
---|
1903 | PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, const char *pszDesc));
|
---|
1904 |
|
---|
1905 | /**
|
---|
1906 | * Register a number of I/O ports with a device for RC.
|
---|
1907 | *
|
---|
1908 | * These callbacks are for the raw-mode context (RC). Register ring-3 context
|
---|
1909 | * (R3) handlers before raw-mode context handlers! There must be a R3 handler
|
---|
1910 | * for every RC handler!
|
---|
1911 | *
|
---|
1912 | * @returns VBox status.
|
---|
1913 | * @param pDevIns The device instance to register the ports with
|
---|
1914 | * and which RC module to resolve the names
|
---|
1915 | * against.
|
---|
1916 | * @param Port First port number in the range.
|
---|
1917 | * @param cPorts Number of ports to register.
|
---|
1918 | * @param pvUser User argument.
|
---|
1919 | * @param pszOut Name of the RC function which is gonna handle OUT operations.
|
---|
1920 | * @param pszIn Name of the RC function which is gonna handle IN operations.
|
---|
1921 | * @param pszOutStr Name of the RC function which is gonna handle string OUT operations.
|
---|
1922 | * @param pszInStr Name of the RC function which is gonna handle string IN operations.
|
---|
1923 | * @param pszDesc Pointer to description string. This must not be freed.
|
---|
1924 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
1925 | * registered callback methods.
|
---|
1926 | */
|
---|
1927 | DECLR3CALLBACKMEMBER(int, pfnIOPortRegisterRC,(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTRCPTR pvUser,
|
---|
1928 | const char *pszOut, const char *pszIn,
|
---|
1929 | const char *pszOutStr, const char *pszInStr, const char *pszDesc));
|
---|
1930 |
|
---|
1931 | /**
|
---|
1932 | * Register a number of I/O ports with a device.
|
---|
1933 | *
|
---|
1934 | * These callbacks are of course for the ring-0 host context (R0).
|
---|
1935 | * Register R3 (HC) handlers before R0 (R0) handlers! There must be a R3 (HC) handler for every R0 handler!
|
---|
1936 | *
|
---|
1937 | * @returns VBox status.
|
---|
1938 | * @param pDevIns The device instance to register the ports with.
|
---|
1939 | * @param Port First port number in the range.
|
---|
1940 | * @param cPorts Number of ports to register.
|
---|
1941 | * @param pvUser User argument. (if pointer, then it must be in locked memory!)
|
---|
1942 | * @param pszOut Name of the R0 function which is gonna handle OUT operations.
|
---|
1943 | * @param pszIn Name of the R0 function which is gonna handle IN operations.
|
---|
1944 | * @param pszOutStr Name of the R0 function which is gonna handle string OUT operations.
|
---|
1945 | * @param pszInStr Name of the R0 function which is gonna handle string IN operations.
|
---|
1946 | * @param pszDesc Pointer to description string. This must not be freed.
|
---|
1947 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
1948 | * registered callback methods.
|
---|
1949 | */
|
---|
1950 | DECLR3CALLBACKMEMBER(int, pfnIOPortRegisterR0,(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTR0PTR pvUser,
|
---|
1951 | const char *pszOut, const char *pszIn,
|
---|
1952 | const char *pszOutStr, const char *pszInStr, const char *pszDesc));
|
---|
1953 |
|
---|
1954 | /**
|
---|
1955 | * Deregister I/O ports.
|
---|
1956 | *
|
---|
1957 | * This naturally affects both guest context (GC), ring-0 (R0) and ring-3 (R3/HC) handlers.
|
---|
1958 | *
|
---|
1959 | * @returns VBox status.
|
---|
1960 | * @param pDevIns The device instance owning the ports.
|
---|
1961 | * @param Port First port number in the range.
|
---|
1962 | * @param cPorts Number of ports to deregister.
|
---|
1963 | */
|
---|
1964 | DECLR3CALLBACKMEMBER(int, pfnIOPortDeregister,(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts));
|
---|
1965 |
|
---|
1966 | /**
|
---|
1967 | * Register a Memory Mapped I/O (MMIO) region.
|
---|
1968 | *
|
---|
1969 | * These callbacks are of course for the ring-3 context (R3). Register HC
|
---|
1970 | * handlers before raw-mode context (RC) and ring-0 context (R0) handlers! There
|
---|
1971 | * must be a R3 handler for every RC and R0 handler!
|
---|
1972 | *
|
---|
1973 | * @returns VBox status.
|
---|
1974 | * @param pDevIns The device instance to register the MMIO with.
|
---|
1975 | * @param GCPhysStart First physical address in the range.
|
---|
1976 | * @param cbRange The size of the range (in bytes).
|
---|
1977 | * @param pvUser User argument.
|
---|
1978 | * @param pfnWrite Pointer to function which is gonna handle Write operations.
|
---|
1979 | * @param pfnRead Pointer to function which is gonna handle Read operations.
|
---|
1980 | * @param pfnFill Pointer to function which is gonna handle Fill/memset operations. (optional)
|
---|
1981 | * @param fFlags Flags, IOMMMIO_FLAGS_XXX.
|
---|
1982 | * @param pszDesc Pointer to description string. This must not be freed.
|
---|
1983 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
1984 | * registered callback methods.
|
---|
1985 | */
|
---|
1986 | DECLR3CALLBACKMEMBER(int, pfnMMIORegister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTHCPTR pvUser,
|
---|
1987 | PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead, PFNIOMMMIOFILL pfnFill,
|
---|
1988 | uint32_t fFlags, const char *pszDesc));
|
---|
1989 |
|
---|
1990 | /**
|
---|
1991 | * Register a Memory Mapped I/O (MMIO) region for RC.
|
---|
1992 | *
|
---|
1993 | * These callbacks are for the raw-mode context (RC). Register ring-3 context
|
---|
1994 | * (R3) handlers before guest context handlers! There must be a R3 handler for
|
---|
1995 | * every RC handler!
|
---|
1996 | *
|
---|
1997 | * @returns VBox status.
|
---|
1998 | * @param pDevIns The device instance to register the MMIO with.
|
---|
1999 | * @param GCPhysStart First physical address in the range.
|
---|
2000 | * @param cbRange The size of the range (in bytes).
|
---|
2001 | * @param pvUser User argument.
|
---|
2002 | * @param pszWrite Name of the RC function which is gonna handle Write operations.
|
---|
2003 | * @param pszRead Name of the RC function which is gonna handle Read operations.
|
---|
2004 | * @param pszFill Name of the RC function which is gonna handle Fill/memset operations. (optional)
|
---|
2005 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
2006 | * registered callback methods.
|
---|
2007 | */
|
---|
2008 | DECLR3CALLBACKMEMBER(int, pfnMMIORegisterRC,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTRCPTR pvUser,
|
---|
2009 | const char *pszWrite, const char *pszRead, const char *pszFill));
|
---|
2010 |
|
---|
2011 | /**
|
---|
2012 | * Register a Memory Mapped I/O (MMIO) region for R0.
|
---|
2013 | *
|
---|
2014 | * These callbacks are for the ring-0 host context (R0). Register ring-3
|
---|
2015 | * constext (R3) handlers before R0 handlers! There must be a R3 handler for
|
---|
2016 | * every R0 handler!
|
---|
2017 | *
|
---|
2018 | * @returns VBox status.
|
---|
2019 | * @param pDevIns The device instance to register the MMIO with.
|
---|
2020 | * @param GCPhysStart First physical address in the range.
|
---|
2021 | * @param cbRange The size of the range (in bytes).
|
---|
2022 | * @param pvUser User argument. (if pointer, then it must be in locked memory!)
|
---|
2023 | * @param pszWrite Name of the RC function which is gonna handle Write operations.
|
---|
2024 | * @param pszRead Name of the RC function which is gonna handle Read operations.
|
---|
2025 | * @param pszFill Name of the RC function which is gonna handle Fill/memset operations. (optional)
|
---|
2026 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
2027 | * registered callback methods.
|
---|
2028 | */
|
---|
2029 | DECLR3CALLBACKMEMBER(int, pfnMMIORegisterR0,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTR0PTR pvUser,
|
---|
2030 | const char *pszWrite, const char *pszRead, const char *pszFill));
|
---|
2031 |
|
---|
2032 | /**
|
---|
2033 | * Deregister a Memory Mapped I/O (MMIO) region.
|
---|
2034 | *
|
---|
2035 | * This naturally affects both guest context (GC), ring-0 (R0) and ring-3 (R3/HC) handlers.
|
---|
2036 | *
|
---|
2037 | * @returns VBox status.
|
---|
2038 | * @param pDevIns The device instance owning the MMIO region(s).
|
---|
2039 | * @param GCPhysStart First physical address in the range.
|
---|
2040 | * @param cbRange The size of the range (in bytes).
|
---|
2041 | */
|
---|
2042 | DECLR3CALLBACKMEMBER(int, pfnMMIODeregister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange));
|
---|
2043 |
|
---|
2044 | /**
|
---|
2045 | * Allocate and register a MMIO2 region.
|
---|
2046 | *
|
---|
2047 | * As mentioned elsewhere, MMIO2 is just RAM spelled differently. It's
|
---|
2048 | * RAM associated with a device. It is also non-shared memory with a
|
---|
2049 | * permanent ring-3 mapping and page backing (presently).
|
---|
2050 | *
|
---|
2051 | * @returns VBox status.
|
---|
2052 | * @param pDevIns The device instance.
|
---|
2053 | * @param pPciDev The PCI device the region is associated with, or
|
---|
2054 | * NULL if no PCI device association.
|
---|
2055 | * @param iRegion The region number. Use the PCI region number as
|
---|
2056 | * this must be known to the PCI bus device too. If
|
---|
2057 | * it's not associated with the PCI device, then
|
---|
2058 | * any number up to UINT8_MAX is fine.
|
---|
2059 | * @param cb The size (in bytes) of the region.
|
---|
2060 | * @param fFlags Reserved for future use, must be zero.
|
---|
2061 | * @param ppv Where to store the address of the ring-3 mapping
|
---|
2062 | * of the memory.
|
---|
2063 | * @param pszDesc Pointer to description string. This must not be
|
---|
2064 | * freed.
|
---|
2065 | * @thread EMT.
|
---|
2066 | */
|
---|
2067 | DECLR3CALLBACKMEMBER(int, pfnMMIO2Register,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cb,
|
---|
2068 | uint32_t fFlags, void **ppv, const char *pszDesc));
|
---|
2069 |
|
---|
2070 | /**
|
---|
2071 | * Pre-register a Memory Mapped I/O (MMIO) region.
|
---|
2072 | *
|
---|
2073 | * This API must be used for large PCI MMIO regions, as it handles these much
|
---|
2074 | * more efficiently and with greater flexibility when it comes to heap usage.
|
---|
2075 | * It is only available during device construction.
|
---|
2076 | *
|
---|
2077 | * To map and unmap the pre-registered region into and our of guest address
|
---|
2078 | * space, use the PDMDevHlpMMIOExMap and PDMDevHlpMMIOExUnmap helpers.
|
---|
2079 | *
|
---|
2080 | * You may call PDMDevHlpMMIOExDeregister from the destructor to free the region
|
---|
2081 | * for reasons of symmetry, but it will be automatically deregistered by PDM
|
---|
2082 | * once the destructor returns.
|
---|
2083 | *
|
---|
2084 | * @returns VBox status.
|
---|
2085 | * @param pDevIns The device instance to register the MMIO with.
|
---|
2086 | * @param pPciDev The PCI device to associate the region with, use
|
---|
2087 | * NULL to not associate it with any device.
|
---|
2088 | * @param iRegion The PCI region number. When @a pPciDev is NULL,
|
---|
2089 | * this is a unique number between 0 and UINT8_MAX.
|
---|
2090 | * @param cbRegion The size of the range (in bytes).
|
---|
2091 | * @param fFlags Flags, IOMMMIO_FLAGS_XXX.
|
---|
2092 | * @param pszDesc Pointer to description string. This must not be freed.
|
---|
2093 | * @param pvUser Ring-3 user argument.
|
---|
2094 | * @param pfnWrite Pointer to function which is gonna handle Write operations.
|
---|
2095 | * @param pfnRead Pointer to function which is gonna handle Read operations.
|
---|
2096 | * @param pfnFill Pointer to function which is gonna handle Fill/memset operations. (optional)
|
---|
2097 | * @param pvUserR0 Ring-0 user argument. Optional.
|
---|
2098 | * @param pszWriteR0 The name of the ring-0 write handler method. Optional.
|
---|
2099 | * @param pszReadR0 The name of the ring-0 read handler method. Optional.
|
---|
2100 | * @param pszFillR0 The name of the ring-0 fill/memset handler method. Optional.
|
---|
2101 | * @param pvUserRC Raw-mode context user argument. Optional. If
|
---|
2102 | * unsigned value is 0x10000 or higher, it will be
|
---|
2103 | * automatically relocated with the hypervisor
|
---|
2104 | * guest mapping.
|
---|
2105 | * @param pszWriteRC The name of the raw-mode context write handler method. Optional.
|
---|
2106 | * @param pszReadRC The name of the raw-mode context read handler method. Optional.
|
---|
2107 | * @param pszFillRC The name of the raw-mode context fill/memset handler method. Optional.
|
---|
2108 | * @thread EMT
|
---|
2109 | *
|
---|
2110 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
2111 | * registered callback methods.
|
---|
2112 | * @sa PDMDevHlpMMIOExMap, PDMDevHlpMMIOExUnmap, PDMDevHlpMMIOExDeregister,
|
---|
2113 | * PDMDevHlpMMIORegisterEx
|
---|
2114 | */
|
---|
2115 | DECLR3CALLBACKMEMBER(int, pfnMMIOExPreRegister,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion,
|
---|
2116 | uint32_t fFlags, const char *pszDesc, RTHCPTR pvUser,
|
---|
2117 | PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead, PFNIOMMMIOFILL pfnFill,
|
---|
2118 | RTR0PTR pvUserR0, const char *pszWriteR0, const char *pszReadR0, const char *pszFillR0,
|
---|
2119 | RTRCPTR pvUserRC, const char *pszWriteRC, const char *pszReadRC, const char *pszFillRC));
|
---|
2120 |
|
---|
2121 | /**
|
---|
2122 | * Deregisters and frees a MMIO or MMIO2 region.
|
---|
2123 | *
|
---|
2124 | * Any physical (and virtual) access handlers registered for the region must
|
---|
2125 | * be deregistered before calling this function (MMIO2 only).
|
---|
2126 | *
|
---|
2127 | * @returns VBox status code.
|
---|
2128 | * @param pDevIns The device instance.
|
---|
2129 | * @param pPciDev The PCI device the region is associated with, or
|
---|
2130 | * NULL if not associated with any.
|
---|
2131 | * @param iRegion The region number used during registration.
|
---|
2132 | * @thread EMT.
|
---|
2133 | */
|
---|
2134 | DECLR3CALLBACKMEMBER(int, pfnMMIOExDeregister,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion));
|
---|
2135 |
|
---|
2136 | /**
|
---|
2137 | * Maps a MMIO or MMIO2 region into the physical memory space.
|
---|
2138 | *
|
---|
2139 | * A MMIO2 range or a pre-registered MMIO range may overlap with base memory if
|
---|
2140 | * a lot of RAM is configured for the VM, in which case we'll drop the base
|
---|
2141 | * memory pages. Presently we will make no attempt to preserve anything that
|
---|
2142 | * happens to be present in the base memory that is replaced, this is of course
|
---|
2143 | * incorrect but it's too much effort.
|
---|
2144 | *
|
---|
2145 | * @returns VBox status code.
|
---|
2146 | * @param pDevIns The device instance.
|
---|
2147 | * @param pPciDev The PCI device the region is associated with, or
|
---|
2148 | * NULL if not associated with any.
|
---|
2149 | * @param iRegion The region number used during registration.
|
---|
2150 | * @param GCPhys The physical address to map it at.
|
---|
2151 | * @thread EMT.
|
---|
2152 | */
|
---|
2153 | DECLR3CALLBACKMEMBER(int, pfnMMIOExMap,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys));
|
---|
2154 |
|
---|
2155 | /**
|
---|
2156 | * Unmaps a MMIO or MMIO2 region previously mapped using pfnMMIOExMap.
|
---|
2157 | *
|
---|
2158 | * @returns VBox status code.
|
---|
2159 | * @param pDevIns The device instance.
|
---|
2160 | * @param pPciDev The PCI device the region is associated with, or
|
---|
2161 | * NULL if not associated with any.
|
---|
2162 | * @param iRegion The region number used during registration.
|
---|
2163 | * @param GCPhys The physical address it's currently mapped at.
|
---|
2164 | * @thread EMT.
|
---|
2165 | */
|
---|
2166 | DECLR3CALLBACKMEMBER(int, pfnMMIOExUnmap,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys));
|
---|
2167 |
|
---|
2168 | /**
|
---|
2169 | * Maps a portion of an MMIO2 region into the hypervisor region.
|
---|
2170 | *
|
---|
2171 | * Callers of this API must never deregister the MMIO2 region before the
|
---|
2172 | * VM is powered off.
|
---|
2173 | *
|
---|
2174 | * @return VBox status code.
|
---|
2175 | * @param pDevIns The device owning the MMIO2 memory.
|
---|
2176 | * @param pPciDev The PCI device the region is associated with, or
|
---|
2177 | * NULL if not associated with any.
|
---|
2178 | * @param iRegion The region.
|
---|
2179 | * @param off The offset into the region. Will be rounded down
|
---|
2180 | * to closest page boundary.
|
---|
2181 | * @param cb The number of bytes to map. Will be rounded up
|
---|
2182 | * to the closest page boundary.
|
---|
2183 | * @param pszDesc Mapping description.
|
---|
2184 | * @param pRCPtr Where to store the RC address.
|
---|
2185 | */
|
---|
2186 | DECLR3CALLBACKMEMBER(int, pfnMMHyperMapMMIO2,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off,
|
---|
2187 | RTGCPHYS cb, const char *pszDesc, PRTRCPTR pRCPtr));
|
---|
2188 |
|
---|
2189 | /**
|
---|
2190 | * Maps a portion of an MMIO2 region into kernel space (host).
|
---|
2191 | *
|
---|
2192 | * The kernel mapping will become invalid when the MMIO2 memory is deregistered
|
---|
2193 | * or the VM is terminated.
|
---|
2194 | *
|
---|
2195 | * @return VBox status code.
|
---|
2196 | * @param pDevIns The device owning the MMIO2 memory.
|
---|
2197 | * @param pPciDev The PCI device the region is associated with, or
|
---|
2198 | * NULL if not associated with any.
|
---|
2199 | * @param iRegion The region.
|
---|
2200 | * @param off The offset into the region. Must be page
|
---|
2201 | * aligned.
|
---|
2202 | * @param cb The number of bytes to map. Must be page
|
---|
2203 | * aligned.
|
---|
2204 | * @param pszDesc Mapping description.
|
---|
2205 | * @param pR0Ptr Where to store the R0 address.
|
---|
2206 | */
|
---|
2207 | DECLR3CALLBACKMEMBER(int, pfnMMIO2MapKernel,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off,
|
---|
2208 | RTGCPHYS cb, const char *pszDesc, PRTR0PTR pR0Ptr));
|
---|
2209 |
|
---|
2210 | /**
|
---|
2211 | * Register a ROM (BIOS) region.
|
---|
2212 | *
|
---|
2213 | * It goes without saying that this is read-only memory. The memory region must be
|
---|
2214 | * in unassigned memory. I.e. from the top of the address space or on the PC in
|
---|
2215 | * the 0xa0000-0xfffff range.
|
---|
2216 | *
|
---|
2217 | * @returns VBox status.
|
---|
2218 | * @param pDevIns The device instance owning the ROM region.
|
---|
2219 | * @param GCPhysStart First physical address in the range.
|
---|
2220 | * Must be page aligned!
|
---|
2221 | * @param cbRange The size of the range (in bytes).
|
---|
2222 | * Must be page aligned!
|
---|
2223 | * @param pvBinary Pointer to the binary data backing the ROM image.
|
---|
2224 | * @param cbBinary The size of the binary pointer. This must
|
---|
2225 | * be equal or smaller than @a cbRange.
|
---|
2226 | * @param fFlags Shadow ROM flags, PGMPHYS_ROM_FLAGS_* in pgm.h.
|
---|
2227 | * @param pszDesc Pointer to description string. This must not be freed.
|
---|
2228 | *
|
---|
2229 | * @remark There is no way to remove the rom, automatically on device cleanup or
|
---|
2230 | * manually from the device yet. At present I doubt we need such features...
|
---|
2231 | */
|
---|
2232 | DECLR3CALLBACKMEMBER(int, pfnROMRegister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange,
|
---|
2233 | const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc));
|
---|
2234 |
|
---|
2235 | /**
|
---|
2236 | * Changes the protection of shadowed ROM mapping.
|
---|
2237 | *
|
---|
2238 | * This is intented for use by the system BIOS, chipset or device in question to
|
---|
2239 | * change the protection of shadowed ROM code after init and on reset.
|
---|
2240 | *
|
---|
2241 | * @param pDevIns The device instance.
|
---|
2242 | * @param GCPhysStart Where the mapping starts.
|
---|
2243 | * @param cbRange The size of the mapping.
|
---|
2244 | * @param enmProt The new protection type.
|
---|
2245 | */
|
---|
2246 | DECLR3CALLBACKMEMBER(int, pfnROMProtectShadow,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, PGMROMPROT enmProt));
|
---|
2247 |
|
---|
2248 | /**
|
---|
2249 | * Register a save state data unit.
|
---|
2250 | *
|
---|
2251 | * @returns VBox status.
|
---|
2252 | * @param pDevIns The device instance.
|
---|
2253 | * @param uVersion Data layout version number.
|
---|
2254 | * @param cbGuess The approximate amount of data in the unit.
|
---|
2255 | * Only for progress indicators.
|
---|
2256 | * @param pszBefore Name of data unit which we should be put in
|
---|
2257 | * front of. Optional (NULL).
|
---|
2258 | *
|
---|
2259 | * @param pfnLivePrep Prepare live save callback, optional.
|
---|
2260 | * @param pfnLiveExec Execute live save callback, optional.
|
---|
2261 | * @param pfnLiveVote Vote live save callback, optional.
|
---|
2262 | *
|
---|
2263 | * @param pfnSavePrep Prepare save callback, optional.
|
---|
2264 | * @param pfnSaveExec Execute save callback, optional.
|
---|
2265 | * @param pfnSaveDone Done save callback, optional.
|
---|
2266 | *
|
---|
2267 | * @param pfnLoadPrep Prepare load callback, optional.
|
---|
2268 | * @param pfnLoadExec Execute load callback, optional.
|
---|
2269 | * @param pfnLoadDone Done load callback, optional.
|
---|
2270 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
2271 | * registered callback methods.
|
---|
2272 | */
|
---|
2273 | DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
|
---|
2274 | PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
|
---|
2275 | PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
|
---|
2276 | PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone));
|
---|
2277 |
|
---|
2278 | /**
|
---|
2279 | * Creates a timer.
|
---|
2280 | *
|
---|
2281 | * @returns VBox status.
|
---|
2282 | * @param pDevIns The device instance.
|
---|
2283 | * @param enmClock The clock to use on this timer.
|
---|
2284 | * @param pfnCallback Callback function.
|
---|
2285 | * @param pvUser User argument for the callback.
|
---|
2286 | * @param fFlags Flags, see TMTIMER_FLAGS_*.
|
---|
2287 | * @param pszDesc Pointer to description string which must stay around
|
---|
2288 | * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
|
---|
2289 | * @param ppTimer Where to store the timer on success.
|
---|
2290 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
2291 | * callback.
|
---|
2292 | */
|
---|
2293 | DECLR3CALLBACKMEMBER(int, pfnTMTimerCreate,(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback,
|
---|
2294 | void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer));
|
---|
2295 |
|
---|
2296 | /**
|
---|
2297 | * Get the real world UTC time adjusted for VM lag, user offset and warpdrive.
|
---|
2298 | *
|
---|
2299 | * @returns pTime.
|
---|
2300 | * @param pDevIns The device instance.
|
---|
2301 | * @param pTime Where to store the time.
|
---|
2302 | */
|
---|
2303 | DECLR3CALLBACKMEMBER(PRTTIMESPEC, pfnTMUtcNow,(PPDMDEVINS pDevIns, PRTTIMESPEC pTime));
|
---|
2304 |
|
---|
2305 | /**
|
---|
2306 | * Read physical memory.
|
---|
2307 | *
|
---|
2308 | * @returns VINF_SUCCESS (for now).
|
---|
2309 | * @param pDevIns The device instance.
|
---|
2310 | * @param GCPhys Physical address start reading from.
|
---|
2311 | * @param pvBuf Where to put the read bits.
|
---|
2312 | * @param cbRead How many bytes to read.
|
---|
2313 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
2314 | */
|
---|
2315 | DECLR3CALLBACKMEMBER(int, pfnPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
|
---|
2316 |
|
---|
2317 | /**
|
---|
2318 | * Write to physical memory.
|
---|
2319 | *
|
---|
2320 | * @returns VINF_SUCCESS for now, and later maybe VERR_EM_MEMORY.
|
---|
2321 | * @param pDevIns The device instance.
|
---|
2322 | * @param GCPhys Physical address to write to.
|
---|
2323 | * @param pvBuf What to write.
|
---|
2324 | * @param cbWrite How many bytes to write.
|
---|
2325 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
2326 | */
|
---|
2327 | DECLR3CALLBACKMEMBER(int, pfnPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
|
---|
2328 |
|
---|
2329 | /**
|
---|
2330 | * Requests the mapping of a guest page into ring-3.
|
---|
2331 | *
|
---|
2332 | * When you're done with the page, call pfnPhysReleasePageMappingLock() ASAP to
|
---|
2333 | * release it.
|
---|
2334 | *
|
---|
2335 | * This API will assume your intention is to write to the page, and will
|
---|
2336 | * therefore replace shared and zero pages. If you do not intend to modify the
|
---|
2337 | * page, use the pfnPhysGCPhys2CCPtrReadOnly() API.
|
---|
2338 | *
|
---|
2339 | * @returns VBox status code.
|
---|
2340 | * @retval VINF_SUCCESS on success.
|
---|
2341 | * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical
|
---|
2342 | * backing or if the page has any active access handlers. The caller
|
---|
2343 | * must fall back on using PGMR3PhysWriteExternal.
|
---|
2344 | * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address.
|
---|
2345 | *
|
---|
2346 | * @param pDevIns The device instance.
|
---|
2347 | * @param GCPhys The guest physical address of the page that
|
---|
2348 | * should be mapped.
|
---|
2349 | * @param fFlags Flags reserved for future use, MBZ.
|
---|
2350 | * @param ppv Where to store the address corresponding to
|
---|
2351 | * GCPhys.
|
---|
2352 | * @param pLock Where to store the lock information that
|
---|
2353 | * pfnPhysReleasePageMappingLock needs.
|
---|
2354 | *
|
---|
2355 | * @remark Avoid calling this API from within critical sections (other than the
|
---|
2356 | * PGM one) because of the deadlock risk when we have to delegating the
|
---|
2357 | * task to an EMT.
|
---|
2358 | * @thread Any.
|
---|
2359 | */
|
---|
2360 | DECLR3CALLBACKMEMBER(int, pfnPhysGCPhys2CCPtr,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv,
|
---|
2361 | PPGMPAGEMAPLOCK pLock));
|
---|
2362 |
|
---|
2363 | /**
|
---|
2364 | * Requests the mapping of a guest page into ring-3, external threads.
|
---|
2365 | *
|
---|
2366 | * When you're done with the page, call pfnPhysReleasePageMappingLock() ASAP to
|
---|
2367 | * release it.
|
---|
2368 | *
|
---|
2369 | * @returns VBox status code.
|
---|
2370 | * @retval VINF_SUCCESS on success.
|
---|
2371 | * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical
|
---|
2372 | * backing or if the page as an active ALL access handler. The caller
|
---|
2373 | * must fall back on using PGMPhysRead.
|
---|
2374 | * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address.
|
---|
2375 | *
|
---|
2376 | * @param pDevIns The device instance.
|
---|
2377 | * @param GCPhys The guest physical address of the page that
|
---|
2378 | * should be mapped.
|
---|
2379 | * @param fFlags Flags reserved for future use, MBZ.
|
---|
2380 | * @param ppv Where to store the address corresponding to
|
---|
2381 | * GCPhys.
|
---|
2382 | * @param pLock Where to store the lock information that
|
---|
2383 | * pfnPhysReleasePageMappingLock needs.
|
---|
2384 | *
|
---|
2385 | * @remark Avoid calling this API from within critical sections.
|
---|
2386 | * @thread Any.
|
---|
2387 | */
|
---|
2388 | DECLR3CALLBACKMEMBER(int, pfnPhysGCPhys2CCPtrReadOnly,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags,
|
---|
2389 | void const **ppv, PPGMPAGEMAPLOCK pLock));
|
---|
2390 |
|
---|
2391 | /**
|
---|
2392 | * Release the mapping of a guest page.
|
---|
2393 | *
|
---|
2394 | * This is the counter part of pfnPhysGCPhys2CCPtr and
|
---|
2395 | * pfnPhysGCPhys2CCPtrReadOnly.
|
---|
2396 | *
|
---|
2397 | * @param pDevIns The device instance.
|
---|
2398 | * @param pLock The lock structure initialized by the mapping
|
---|
2399 | * function.
|
---|
2400 | */
|
---|
2401 | DECLR3CALLBACKMEMBER(void, pfnPhysReleasePageMappingLock,(PPDMDEVINS pDevIns, PPGMPAGEMAPLOCK pLock));
|
---|
2402 |
|
---|
2403 | /**
|
---|
2404 | * Read guest physical memory by virtual address.
|
---|
2405 | *
|
---|
2406 | * @param pDevIns The device instance.
|
---|
2407 | * @param pvDst Where to put the read bits.
|
---|
2408 | * @param GCVirtSrc Guest virtual address to start reading from.
|
---|
2409 | * @param cb How many bytes to read.
|
---|
2410 | * @thread The emulation thread.
|
---|
2411 | */
|
---|
2412 | DECLR3CALLBACKMEMBER(int, pfnPhysReadGCVirt,(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb));
|
---|
2413 |
|
---|
2414 | /**
|
---|
2415 | * Write to guest physical memory by virtual address.
|
---|
2416 | *
|
---|
2417 | * @param pDevIns The device instance.
|
---|
2418 | * @param GCVirtDst Guest virtual address to write to.
|
---|
2419 | * @param pvSrc What to write.
|
---|
2420 | * @param cb How many bytes to write.
|
---|
2421 | * @thread The emulation thread.
|
---|
2422 | */
|
---|
2423 | DECLR3CALLBACKMEMBER(int, pfnPhysWriteGCVirt,(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb));
|
---|
2424 |
|
---|
2425 | /**
|
---|
2426 | * Convert a guest virtual address to a guest physical address.
|
---|
2427 | *
|
---|
2428 | * @returns VBox status code.
|
---|
2429 | * @param pDevIns The device instance.
|
---|
2430 | * @param GCPtr Guest virtual address.
|
---|
2431 | * @param pGCPhys Where to store the GC physical address
|
---|
2432 | * corresponding to GCPtr.
|
---|
2433 | * @thread The emulation thread.
|
---|
2434 | * @remark Careful with page boundaries.
|
---|
2435 | */
|
---|
2436 | DECLR3CALLBACKMEMBER(int, pfnPhysGCPtr2GCPhys, (PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys));
|
---|
2437 |
|
---|
2438 | /**
|
---|
2439 | * Allocate memory which is associated with current VM instance
|
---|
2440 | * and automatically freed on it's destruction.
|
---|
2441 | *
|
---|
2442 | * @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
|
---|
2443 | * @param pDevIns The device instance.
|
---|
2444 | * @param cb Number of bytes to allocate.
|
---|
2445 | */
|
---|
2446 | DECLR3CALLBACKMEMBER(void *, pfnMMHeapAlloc,(PPDMDEVINS pDevIns, size_t cb));
|
---|
2447 |
|
---|
2448 | /**
|
---|
2449 | * Allocate memory which is associated with current VM instance
|
---|
2450 | * and automatically freed on it's destruction. The memory is ZEROed.
|
---|
2451 | *
|
---|
2452 | * @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
|
---|
2453 | * @param pDevIns The device instance.
|
---|
2454 | * @param cb Number of bytes to allocate.
|
---|
2455 | */
|
---|
2456 | DECLR3CALLBACKMEMBER(void *, pfnMMHeapAllocZ,(PPDMDEVINS pDevIns, size_t cb));
|
---|
2457 |
|
---|
2458 | /**
|
---|
2459 | * Free memory allocated with pfnMMHeapAlloc() and pfnMMHeapAllocZ().
|
---|
2460 | *
|
---|
2461 | * @param pDevIns The device instance.
|
---|
2462 | * @param pv Pointer to the memory to free.
|
---|
2463 | */
|
---|
2464 | DECLR3CALLBACKMEMBER(void, pfnMMHeapFree,(PPDMDEVINS pDevIns, void *pv));
|
---|
2465 |
|
---|
2466 | /**
|
---|
2467 | * Gets the VM state.
|
---|
2468 | *
|
---|
2469 | * @returns VM state.
|
---|
2470 | * @param pDevIns The device instance.
|
---|
2471 | * @thread Any thread (just keep in mind that it's volatile info).
|
---|
2472 | */
|
---|
2473 | DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMDEVINS pDevIns));
|
---|
2474 |
|
---|
2475 | /**
|
---|
2476 | * Checks if the VM was teleported and hasn't been fully resumed yet.
|
---|
2477 | *
|
---|
2478 | * @returns true / false.
|
---|
2479 | * @param pDevIns The device instance.
|
---|
2480 | * @thread Any thread.
|
---|
2481 | */
|
---|
2482 | DECLR3CALLBACKMEMBER(bool, pfnVMTeleportedAndNotFullyResumedYet,(PPDMDEVINS pDevIns));
|
---|
2483 |
|
---|
2484 | /**
|
---|
2485 | * Set the VM error message
|
---|
2486 | *
|
---|
2487 | * @returns rc.
|
---|
2488 | * @param pDevIns The device instance.
|
---|
2489 | * @param rc VBox status code.
|
---|
2490 | * @param SRC_POS Use RT_SRC_POS.
|
---|
2491 | * @param pszFormat Error message format string.
|
---|
2492 | * @param ... Error message arguments.
|
---|
2493 | */
|
---|
2494 | DECLR3CALLBACKMEMBER(int, pfnVMSetError,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL,
|
---|
2495 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7));
|
---|
2496 |
|
---|
2497 | /**
|
---|
2498 | * Set the VM error message
|
---|
2499 | *
|
---|
2500 | * @returns rc.
|
---|
2501 | * @param pDevIns The device instance.
|
---|
2502 | * @param rc VBox status code.
|
---|
2503 | * @param SRC_POS Use RT_SRC_POS.
|
---|
2504 | * @param pszFormat Error message format string.
|
---|
2505 | * @param va Error message arguments.
|
---|
2506 | */
|
---|
2507 | DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL,
|
---|
2508 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
2509 |
|
---|
2510 | /**
|
---|
2511 | * Set the VM runtime error message
|
---|
2512 | *
|
---|
2513 | * @returns VBox status code.
|
---|
2514 | * @param pDevIns The device instance.
|
---|
2515 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
2516 | * @param pszErrorId Error ID string.
|
---|
2517 | * @param pszFormat Error message format string.
|
---|
2518 | * @param ... Error message arguments.
|
---|
2519 | */
|
---|
2520 | DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId,
|
---|
2521 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5));
|
---|
2522 |
|
---|
2523 | /**
|
---|
2524 | * Set the VM runtime error message
|
---|
2525 | *
|
---|
2526 | * @returns VBox status code.
|
---|
2527 | * @param pDevIns The device instance.
|
---|
2528 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
2529 | * @param pszErrorId Error ID string.
|
---|
2530 | * @param pszFormat Error message format string.
|
---|
2531 | * @param va Error message arguments.
|
---|
2532 | */
|
---|
2533 | DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId,
|
---|
2534 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
|
---|
2535 |
|
---|
2536 | /**
|
---|
2537 | * Stops the VM and enters the debugger to look at the guest state.
|
---|
2538 | *
|
---|
2539 | * Use the PDMDeviceDBGFStop() inline function with the RT_SRC_POS macro instead of
|
---|
2540 | * invoking this function directly.
|
---|
2541 | *
|
---|
2542 | * @returns VBox status code which must be passed up to the VMM.
|
---|
2543 | * @param pDevIns The device instance.
|
---|
2544 | * @param pszFile Filename of the assertion location.
|
---|
2545 | * @param iLine The linenumber of the assertion location.
|
---|
2546 | * @param pszFunction Function of the assertion location.
|
---|
2547 | * @param pszFormat Message. (optional)
|
---|
2548 | * @param args Message parameters.
|
---|
2549 | */
|
---|
2550 | DECLR3CALLBACKMEMBER(int, pfnDBGFStopV,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction,
|
---|
2551 | const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(5, 0));
|
---|
2552 |
|
---|
2553 | /**
|
---|
2554 | * Register a info handler with DBGF,
|
---|
2555 | *
|
---|
2556 | * @returns VBox status code.
|
---|
2557 | * @param pDevIns The device instance.
|
---|
2558 | * @param pszName The identifier of the info.
|
---|
2559 | * @param pszDesc The description of the info and any arguments
|
---|
2560 | * the handler may take.
|
---|
2561 | * @param pfnHandler The handler function to be called to display the
|
---|
2562 | * info.
|
---|
2563 | */
|
---|
2564 | DECLR3CALLBACKMEMBER(int, pfnDBGFInfoRegister,(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler));
|
---|
2565 |
|
---|
2566 | /**
|
---|
2567 | * Registers a set of registers for a device.
|
---|
2568 | *
|
---|
2569 | * The @a pvUser argument of the getter and setter callbacks will be
|
---|
2570 | * @a pDevIns. The register names will be prefixed by the device name followed
|
---|
2571 | * immediately by the instance number.
|
---|
2572 | *
|
---|
2573 | * @returns VBox status code.
|
---|
2574 | * @param pDevIns The device instance.
|
---|
2575 | * @param paRegisters The register descriptors.
|
---|
2576 | *
|
---|
2577 | * @remarks The device critical section is NOT entered prior to working the
|
---|
2578 | * callbacks registered via this helper!
|
---|
2579 | */
|
---|
2580 | DECLR3CALLBACKMEMBER(int, pfnDBGFRegRegister,(PPDMDEVINS pDevIns, PCDBGFREGDESC paRegisters));
|
---|
2581 |
|
---|
2582 | /**
|
---|
2583 | * Gets the trace buffer handle.
|
---|
2584 | *
|
---|
2585 | * This is used by the macros found in VBox/vmm/dbgftrace.h and is not
|
---|
2586 | * really inteded for direct usage, thus no inline wrapper function.
|
---|
2587 | *
|
---|
2588 | * @returns Trace buffer handle or NIL_RTTRACEBUF.
|
---|
2589 | * @param pDevIns The device instance.
|
---|
2590 | */
|
---|
2591 | DECLR3CALLBACKMEMBER(RTTRACEBUF, pfnDBGFTraceBuf,(PPDMDEVINS pDevIns));
|
---|
2592 |
|
---|
2593 | /**
|
---|
2594 | * Registers a statistics sample if statistics are enabled.
|
---|
2595 | *
|
---|
2596 | * @param pDevIns Device instance of the DMA.
|
---|
2597 | * @param pvSample Pointer to the sample.
|
---|
2598 | * @param enmType Sample type. This indicates what pvSample is
|
---|
2599 | * pointing at.
|
---|
2600 | * @param pszName Sample name. The name is on this form
|
---|
2601 | * "/<component>/<sample>". Further nesting is
|
---|
2602 | * possible.
|
---|
2603 | * @param enmUnit Sample unit.
|
---|
2604 | * @param pszDesc Sample description.
|
---|
2605 | */
|
---|
2606 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegister,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc));
|
---|
2607 |
|
---|
2608 | /**
|
---|
2609 | * Same as pfnSTAMRegister except that the name is specified in a
|
---|
2610 | * RTStrPrintf like fashion.
|
---|
2611 | *
|
---|
2612 | * @returns VBox status.
|
---|
2613 | * @param pDevIns Device instance of the DMA.
|
---|
2614 | * @param pvSample Pointer to the sample.
|
---|
2615 | * @param enmType Sample type. This indicates what pvSample is
|
---|
2616 | * pointing at.
|
---|
2617 | * @param enmVisibility Visibility type specifying whether unused
|
---|
2618 | * statistics should be visible or not.
|
---|
2619 | * @param enmUnit Sample unit.
|
---|
2620 | * @param pszDesc Sample description.
|
---|
2621 | * @param pszName The sample name format string.
|
---|
2622 | * @param ... Arguments to the format string.
|
---|
2623 | */
|
---|
2624 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterF,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType,
|
---|
2625 | STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc,
|
---|
2626 | const char *pszName, ...) RT_IPRT_FORMAT_ATTR(7, 8));
|
---|
2627 |
|
---|
2628 | /**
|
---|
2629 | * Same as pfnSTAMRegister except that the name is specified in a
|
---|
2630 | * RTStrPrintfV like fashion.
|
---|
2631 | *
|
---|
2632 | * @returns VBox status.
|
---|
2633 | * @param pDevIns Device instance of the DMA.
|
---|
2634 | * @param pvSample Pointer to the sample.
|
---|
2635 | * @param enmType Sample type. This indicates what pvSample is
|
---|
2636 | * pointing at.
|
---|
2637 | * @param enmVisibility Visibility type specifying whether unused
|
---|
2638 | * statistics should be visible or not.
|
---|
2639 | * @param enmUnit Sample unit.
|
---|
2640 | * @param pszDesc Sample description.
|
---|
2641 | * @param pszName The sample name format string.
|
---|
2642 | * @param args Arguments to the format string.
|
---|
2643 | */
|
---|
2644 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType,
|
---|
2645 | STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc,
|
---|
2646 | const char *pszName, va_list args) RT_IPRT_FORMAT_ATTR(7, 0));
|
---|
2647 |
|
---|
2648 | /**
|
---|
2649 | * Registers a PCI device with the default PCI bus.
|
---|
2650 | *
|
---|
2651 | * @returns VBox status code.
|
---|
2652 | * @param pDevIns The device instance.
|
---|
2653 | * @param pPciDev The PCI device structure.
|
---|
2654 | * This must be kept in the instance data.
|
---|
2655 | * The PCI configuration must be initialized before registration.
|
---|
2656 | * @param idxDevCfg The CFGM configuration index to use for this
|
---|
2657 | * device.
|
---|
2658 | * Zero indicates the default configuration
|
---|
2659 | * (PDMPCIDEVREG_CFG_PRIMARY), whereas 1 to 255
|
---|
2660 | * references subkeys "PciDev1" thru "PciDev255".
|
---|
2661 | * Pass PDMPCIDEVREG_CFG_NEXT to use the next
|
---|
2662 | * number in the sequence (last + 1).
|
---|
2663 | * @param fFlags Reserved for future use, PDMPCIDEVREG_F_MBZ.
|
---|
2664 | * @param uPciDevNo PDMPCIDEVREG_DEV_NO_FIRST_UNUSED,
|
---|
2665 | * PDMPCIDEVREG_DEV_NO_SAME_AS_PREV, or a specific
|
---|
2666 | * device number (0-31). This will be ignored if
|
---|
2667 | * the CFGM configuration contains a PCIDeviceNo
|
---|
2668 | * value.
|
---|
2669 | * @param uPciFunNo PDMPCIDEVREG_FUN_NO_FIRST_UNUSED, or a specific
|
---|
2670 | * function number (0-7). This will be ignored if
|
---|
2671 | * the CFGM configuration contains a PCIFunctionNo
|
---|
2672 | * value.
|
---|
2673 | * @param pszName Device name, if NULL PDMDEVREG::szName is used.
|
---|
2674 | * The pointer is saved, so don't free or changed.
|
---|
2675 | */
|
---|
2676 | DECLR3CALLBACKMEMBER(int, pfnPCIRegister,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t idxDevCfg, uint32_t fFlags,
|
---|
2677 | uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName));
|
---|
2678 |
|
---|
2679 | /**
|
---|
2680 | * Initialize MSI support for the given PCI device.
|
---|
2681 | *
|
---|
2682 | * @returns VBox status code.
|
---|
2683 | * @param pDevIns The device instance.
|
---|
2684 | * @param pPciDev The PCI device. NULL is an alias for the first
|
---|
2685 | * one registered.
|
---|
2686 | * @param pMsiReg MSI registartion structure.
|
---|
2687 | */
|
---|
2688 | DECLR3CALLBACKMEMBER(int, pfnPCIRegisterMsi,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PPDMMSIREG pMsiReg));
|
---|
2689 |
|
---|
2690 | /**
|
---|
2691 | * Registers a I/O region (memory mapped or I/O ports) for a PCI device.
|
---|
2692 | *
|
---|
2693 | * @returns VBox status code.
|
---|
2694 | * @param pDevIns The device instance.
|
---|
2695 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
2696 | * PCI device for this device instance is used.
|
---|
2697 | * @param iRegion The region number.
|
---|
2698 | * @param cbRegion Size of the region.
|
---|
2699 | * @param enmType PCI_ADDRESS_SPACE_MEM, PCI_ADDRESS_SPACE_IO or PCI_ADDRESS_SPACE_MEM_PREFETCH.
|
---|
2700 | * @param pfnCallback Callback for doing the mapping.
|
---|
2701 | * @remarks The callback will be invoked holding the PDM lock. The device lock
|
---|
2702 | * is NOT take because that is very likely be a lock order violation.
|
---|
2703 | */
|
---|
2704 | DECLR3CALLBACKMEMBER(int, pfnPCIIORegionRegister,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion,
|
---|
2705 | PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback));
|
---|
2706 |
|
---|
2707 | /**
|
---|
2708 | * Register PCI configuration space read/write callbacks.
|
---|
2709 | *
|
---|
2710 | * @param pDevIns The device instance.
|
---|
2711 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
2712 | * PCI device for this device instance is used.
|
---|
2713 | * @param pfnRead Pointer to the user defined PCI config read function.
|
---|
2714 | * @param ppfnReadOld Pointer to function pointer which will receive the old (default)
|
---|
2715 | * PCI config read function. This way, user can decide when (and if)
|
---|
2716 | * to call default PCI config read function. Can be NULL.
|
---|
2717 | * @param pfnWrite Pointer to the user defined PCI config write function.
|
---|
2718 | * @param ppfnWriteOld Pointer to function pointer which will receive
|
---|
2719 | * the old (default) PCI config write function.
|
---|
2720 | * This way, user can decide when (and if) to call
|
---|
2721 | * default PCI config write function. Can be NULL.
|
---|
2722 | * @remarks The callbacks will be invoked holding the PDM lock. The device lock
|
---|
2723 | * is NOT take because that is very likely be a lock order violation.
|
---|
2724 | * @thread EMT
|
---|
2725 | */
|
---|
2726 | DECLR3CALLBACKMEMBER(void, pfnPCISetConfigCallbacks,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev,
|
---|
2727 | PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
|
---|
2728 | PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld));
|
---|
2729 |
|
---|
2730 | /**
|
---|
2731 | * Bus master physical memory read.
|
---|
2732 | *
|
---|
2733 | * @returns VINF_SUCCESS or VERR_PGM_PCI_PHYS_READ_BM_DISABLED, later maybe
|
---|
2734 | * VERR_EM_MEMORY. The informational status shall NOT be propagated!
|
---|
2735 | * @param pDevIns The device instance.
|
---|
2736 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
2737 | * PCI device for this device instance is used.
|
---|
2738 | * @param GCPhys Physical address start reading from.
|
---|
2739 | * @param pvBuf Where to put the read bits.
|
---|
2740 | * @param cbRead How many bytes to read.
|
---|
2741 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
2742 | */
|
---|
2743 | DECLR3CALLBACKMEMBER(int, pfnPCIPhysRead,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
|
---|
2744 |
|
---|
2745 | /**
|
---|
2746 | * Bus master physical memory write.
|
---|
2747 | *
|
---|
2748 | * @returns VINF_SUCCESS or VERR_PGM_PCI_PHYS_WRITE_BM_DISABLED, later maybe
|
---|
2749 | * VERR_EM_MEMORY. The informational status shall NOT be propagated!
|
---|
2750 | * @param pDevIns The device instance.
|
---|
2751 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
2752 | * PCI device for this device instance is used.
|
---|
2753 | * @param GCPhys Physical address to write to.
|
---|
2754 | * @param pvBuf What to write.
|
---|
2755 | * @param cbWrite How many bytes to write.
|
---|
2756 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
2757 | */
|
---|
2758 | DECLR3CALLBACKMEMBER(int, pfnPCIPhysWrite,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
|
---|
2759 |
|
---|
2760 | /**
|
---|
2761 | * Sets the IRQ for the given PCI device.
|
---|
2762 | *
|
---|
2763 | * @param pDevIns The device instance.
|
---|
2764 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
2765 | * PCI device for this device instance is used.
|
---|
2766 | * @param iIrq IRQ number to set.
|
---|
2767 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
2768 | * @thread Any thread, but will involve the emulation thread.
|
---|
2769 | */
|
---|
2770 | DECLR3CALLBACKMEMBER(void, pfnPCISetIrq,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel));
|
---|
2771 |
|
---|
2772 | /**
|
---|
2773 | * Sets the IRQ for the given PCI device, but doesn't wait for EMT to process
|
---|
2774 | * the request when not called from EMT.
|
---|
2775 | *
|
---|
2776 | * @param pDevIns The device instance.
|
---|
2777 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
2778 | * PCI device for this device instance is used.
|
---|
2779 | * @param iIrq IRQ number to set.
|
---|
2780 | * @param iLevel IRQ level.
|
---|
2781 | * @thread Any thread, but will involve the emulation thread.
|
---|
2782 | */
|
---|
2783 | DECLR3CALLBACKMEMBER(void, pfnPCISetIrqNoWait,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel));
|
---|
2784 |
|
---|
2785 | /**
|
---|
2786 | * Set ISA IRQ for a device.
|
---|
2787 | *
|
---|
2788 | * @param pDevIns The device instance.
|
---|
2789 | * @param iIrq IRQ number to set.
|
---|
2790 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
2791 | * @thread Any thread, but will involve the emulation thread.
|
---|
2792 | */
|
---|
2793 | DECLR3CALLBACKMEMBER(void, pfnISASetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
2794 |
|
---|
2795 | /**
|
---|
2796 | * Set the ISA IRQ for a device, but don't wait for EMT to process
|
---|
2797 | * the request when not called from EMT.
|
---|
2798 | *
|
---|
2799 | * @param pDevIns The device instance.
|
---|
2800 | * @param iIrq IRQ number to set.
|
---|
2801 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
2802 | * @thread Any thread, but will involve the emulation thread.
|
---|
2803 | */
|
---|
2804 | DECLR3CALLBACKMEMBER(void, pfnISASetIrqNoWait,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
2805 |
|
---|
2806 | /**
|
---|
2807 | * Attaches a driver (chain) to the device.
|
---|
2808 | *
|
---|
2809 | * The first call for a LUN this will serve as a registartion of the LUN. The pBaseInterface and
|
---|
2810 | * the pszDesc string will be registered with that LUN and kept around for PDMR3QueryDeviceLun().
|
---|
2811 | *
|
---|
2812 | * @returns VBox status code.
|
---|
2813 | * @param pDevIns The device instance.
|
---|
2814 | * @param iLun The logical unit to attach.
|
---|
2815 | * @param pBaseInterface Pointer to the base interface for that LUN. (device side / down)
|
---|
2816 | * @param ppBaseInterface Where to store the pointer to the base interface. (driver side / up)
|
---|
2817 | * @param pszDesc Pointer to a string describing the LUN. This string must remain valid
|
---|
2818 | * for the live of the device instance.
|
---|
2819 | */
|
---|
2820 | DECLR3CALLBACKMEMBER(int, pfnDriverAttach,(PPDMDEVINS pDevIns, uint32_t iLun, PPDMIBASE pBaseInterface,
|
---|
2821 | PPDMIBASE *ppBaseInterface, const char *pszDesc));
|
---|
2822 |
|
---|
2823 | /**
|
---|
2824 | * Detaches an attached driver (chain) from the device again.
|
---|
2825 | *
|
---|
2826 | * @returns VBox status code.
|
---|
2827 | * @param pDevIns The device instance.
|
---|
2828 | * @param pDrvIns The driver instance to detach.
|
---|
2829 | * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
|
---|
2830 | */
|
---|
2831 | DECLR3CALLBACKMEMBER(int, pfnDriverDetach,(PPDMDEVINS pDevIns, PPDMDRVINS pDrvIns, uint32_t fFlags));
|
---|
2832 |
|
---|
2833 | /**
|
---|
2834 | * Create a queue.
|
---|
2835 | *
|
---|
2836 | * @returns VBox status code.
|
---|
2837 | * @param pDevIns The device instance.
|
---|
2838 | * @param cbItem The size of a queue item.
|
---|
2839 | * @param cItems The number of items in the queue.
|
---|
2840 | * @param cMilliesInterval The number of milliseconds between polling the queue.
|
---|
2841 | * If 0 then the emulation thread will be notified whenever an item arrives.
|
---|
2842 | * @param pfnCallback The consumer function.
|
---|
2843 | * @param fRZEnabled Set if the queue should work in RC and R0.
|
---|
2844 | * @param pszName The queue base name. The instance number will be
|
---|
2845 | * appended automatically.
|
---|
2846 | * @param ppQueue Where to store the queue handle on success.
|
---|
2847 | * @thread The emulation thread.
|
---|
2848 | * @remarks The device critical section will NOT be entered before calling the
|
---|
2849 | * callback. No locks will be held, but for now it's safe to assume
|
---|
2850 | * that only one EMT will do queue callbacks at any one time.
|
---|
2851 | */
|
---|
2852 | DECLR3CALLBACKMEMBER(int, pfnQueueCreate,(PPDMDEVINS pDevIns, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
|
---|
2853 | PFNPDMQUEUEDEV pfnCallback, bool fRZEnabled, const char *pszName, PPDMQUEUE *ppQueue));
|
---|
2854 |
|
---|
2855 | /**
|
---|
2856 | * Initializes a PDM critical section.
|
---|
2857 | *
|
---|
2858 | * The PDM critical sections are derived from the IPRT critical sections, but
|
---|
2859 | * works in RC and R0 as well.
|
---|
2860 | *
|
---|
2861 | * @returns VBox status code.
|
---|
2862 | * @param pDevIns The device instance.
|
---|
2863 | * @param pCritSect Pointer to the critical section.
|
---|
2864 | * @param SRC_POS Use RT_SRC_POS.
|
---|
2865 | * @param pszNameFmt Format string for naming the critical section.
|
---|
2866 | * For statistics and lock validation.
|
---|
2867 | * @param va Arguments for the format string.
|
---|
2868 | */
|
---|
2869 | DECLR3CALLBACKMEMBER(int, pfnCritSectInit,(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL,
|
---|
2870 | const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
2871 |
|
---|
2872 | /**
|
---|
2873 | * Gets the NOP critical section.
|
---|
2874 | *
|
---|
2875 | * @returns The ring-3 address of the NOP critical section.
|
---|
2876 | * @param pDevIns The device instance.
|
---|
2877 | */
|
---|
2878 | DECLR3CALLBACKMEMBER(PPDMCRITSECT, pfnCritSectGetNop,(PPDMDEVINS pDevIns));
|
---|
2879 |
|
---|
2880 | /**
|
---|
2881 | * Gets the NOP critical section.
|
---|
2882 | *
|
---|
2883 | * @returns The ring-0 address of the NOP critical section.
|
---|
2884 | * @param pDevIns The device instance.
|
---|
2885 | */
|
---|
2886 | DECLR3CALLBACKMEMBER(R0PTRTYPE(PPDMCRITSECT), pfnCritSectGetNopR0,(PPDMDEVINS pDevIns));
|
---|
2887 |
|
---|
2888 | /**
|
---|
2889 | * Gets the NOP critical section.
|
---|
2890 | *
|
---|
2891 | * @returns The raw-mode context address of the NOP critical section.
|
---|
2892 | * @param pDevIns The device instance.
|
---|
2893 | */
|
---|
2894 | DECLR3CALLBACKMEMBER(RCPTRTYPE(PPDMCRITSECT), pfnCritSectGetNopRC,(PPDMDEVINS pDevIns));
|
---|
2895 |
|
---|
2896 | /**
|
---|
2897 | * Changes the device level critical section from the automatically created
|
---|
2898 | * default to one desired by the device constructor.
|
---|
2899 | *
|
---|
2900 | * @returns VBox status code.
|
---|
2901 | * @param pDevIns The device instance.
|
---|
2902 | * @param pCritSect The critical section to use. NULL is not
|
---|
2903 | * valid, instead use the NOP critical
|
---|
2904 | * section.
|
---|
2905 | */
|
---|
2906 | DECLR3CALLBACKMEMBER(int, pfnSetDeviceCritSect,(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect));
|
---|
2907 |
|
---|
2908 | /**
|
---|
2909 | * Creates a PDM thread.
|
---|
2910 | *
|
---|
2911 | * This differs from the RTThreadCreate() API in that PDM takes care of suspending,
|
---|
2912 | * resuming, and destroying the thread as the VM state changes.
|
---|
2913 | *
|
---|
2914 | * @returns VBox status code.
|
---|
2915 | * @param pDevIns The device instance.
|
---|
2916 | * @param ppThread Where to store the thread 'handle'.
|
---|
2917 | * @param pvUser The user argument to the thread function.
|
---|
2918 | * @param pfnThread The thread function.
|
---|
2919 | * @param pfnWakeup The wakup callback. This is called on the EMT
|
---|
2920 | * thread when a state change is pending.
|
---|
2921 | * @param cbStack See RTThreadCreate.
|
---|
2922 | * @param enmType See RTThreadCreate.
|
---|
2923 | * @param pszName See RTThreadCreate.
|
---|
2924 | * @remarks The device critical section will NOT be entered prior to invoking
|
---|
2925 | * the function pointers.
|
---|
2926 | */
|
---|
2927 | DECLR3CALLBACKMEMBER(int, pfnThreadCreate,(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
|
---|
2928 | PFNPDMTHREADWAKEUPDEV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
|
---|
2929 |
|
---|
2930 | /**
|
---|
2931 | * Set up asynchronous handling of a suspend, reset or power off notification.
|
---|
2932 | *
|
---|
2933 | * This shall only be called when getting the notification. It must be called
|
---|
2934 | * for each one.
|
---|
2935 | *
|
---|
2936 | * @returns VBox status code.
|
---|
2937 | * @param pDevIns The device instance.
|
---|
2938 | * @param pfnAsyncNotify The callback.
|
---|
2939 | * @thread EMT(0)
|
---|
2940 | * @remarks The caller will enter the device critical section prior to invoking
|
---|
2941 | * the callback.
|
---|
2942 | */
|
---|
2943 | DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMDEVINS pDevIns, PFNPDMDEVASYNCNOTIFY pfnAsyncNotify));
|
---|
2944 |
|
---|
2945 | /**
|
---|
2946 | * Notify EMT(0) that the device has completed the asynchronous notification
|
---|
2947 | * handling.
|
---|
2948 | *
|
---|
2949 | * This can be called at any time, spurious calls will simply be ignored.
|
---|
2950 | *
|
---|
2951 | * @param pDevIns The device instance.
|
---|
2952 | * @thread Any
|
---|
2953 | */
|
---|
2954 | DECLR3CALLBACKMEMBER(void, pfnAsyncNotificationCompleted, (PPDMDEVINS pDevIns));
|
---|
2955 |
|
---|
2956 | /**
|
---|
2957 | * Register the RTC device.
|
---|
2958 | *
|
---|
2959 | * @returns VBox status code.
|
---|
2960 | * @param pDevIns The device instance.
|
---|
2961 | * @param pRtcReg Pointer to a RTC registration structure.
|
---|
2962 | * @param ppRtcHlp Where to store the pointer to the helper
|
---|
2963 | * functions.
|
---|
2964 | */
|
---|
2965 | DECLR3CALLBACKMEMBER(int, pfnRTCRegister,(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp));
|
---|
2966 |
|
---|
2967 | #if PDM_DEVHLPR3_VERSION >= PDM_VERSION_MAKE_PP(0xffe7, 20, 0)
|
---|
2968 | /**
|
---|
2969 | * Register a PCI Bus.
|
---|
2970 | *
|
---|
2971 | * @returns VBox status code, but the positive values 0..31 are used to indicate
|
---|
2972 | * bus number rather than informational status codes.
|
---|
2973 | * @param pDevIns The device instance.
|
---|
2974 | * @param pPciBusReg Pointer to PCI bus registration structure.
|
---|
2975 | * @param ppPciHlpR3 Where to store the pointer to the PCI Bus
|
---|
2976 | * helpers.
|
---|
2977 | * @param piBus Where to return the PDM bus number. Optional.
|
---|
2978 | */
|
---|
2979 | DECLR3CALLBACKMEMBER(int, pfnPCIBusRegister,(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg,
|
---|
2980 | PCPDMPCIHLPR3 *ppPciHlpR3, uint32_t *piBus));
|
---|
2981 | #else
|
---|
2982 | /**
|
---|
2983 | * Register a PCI Bus.
|
---|
2984 | *
|
---|
2985 | * @returns VBox status code, but the positive values 0..31 are used to indicate
|
---|
2986 | * bus number rather than informational status codes.
|
---|
2987 | * @param pDevIns The device instance.
|
---|
2988 | * @param pPciBusReg Pointer to PCI bus registration structure.
|
---|
2989 | * @param ppPciHlpR3 Where to store the pointer to the PCI Bus
|
---|
2990 | * helpers.
|
---|
2991 | */
|
---|
2992 | DECLR3CALLBACKMEMBER(int, pfnPCIBusRegister,(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3));
|
---|
2993 | #endif
|
---|
2994 |
|
---|
2995 | /**
|
---|
2996 | * Register the PIC device.
|
---|
2997 | *
|
---|
2998 | * @returns VBox status code.
|
---|
2999 | * @param pDevIns The device instance.
|
---|
3000 | * @param pPicReg Pointer to a PIC registration structure.
|
---|
3001 | * @param ppPicHlpR3 Where to store the pointer to the PIC HC
|
---|
3002 | * helpers.
|
---|
3003 | */
|
---|
3004 | DECLR3CALLBACKMEMBER(int, pfnPICRegister,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3));
|
---|
3005 |
|
---|
3006 | /**
|
---|
3007 | * Register the APIC device.
|
---|
3008 | *
|
---|
3009 | * @returns VBox status code.
|
---|
3010 | * @param pDevIns The device instance.
|
---|
3011 | */
|
---|
3012 | DECLR3CALLBACKMEMBER(int, pfnAPICRegister,(PPDMDEVINS pDevIns));
|
---|
3013 |
|
---|
3014 | /**
|
---|
3015 | * Register the I/O APIC device.
|
---|
3016 | *
|
---|
3017 | * @returns VBox status code.
|
---|
3018 | * @param pDevIns The device instance.
|
---|
3019 | * @param pIoApicReg Pointer to a I/O APIC registration structure.
|
---|
3020 | * @param ppIoApicHlpR3 Where to store the pointer to the IOAPIC
|
---|
3021 | * helpers.
|
---|
3022 | */
|
---|
3023 | DECLR3CALLBACKMEMBER(int, pfnIOAPICRegister,(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3));
|
---|
3024 |
|
---|
3025 | /**
|
---|
3026 | * Register the HPET device.
|
---|
3027 | *
|
---|
3028 | * @returns VBox status code.
|
---|
3029 | * @param pDevIns The device instance.
|
---|
3030 | * @param pHpetReg Pointer to a HPET registration structure.
|
---|
3031 | * @param ppHpetHlpR3 Where to store the pointer to the HPET
|
---|
3032 | * helpers.
|
---|
3033 | */
|
---|
3034 | DECLR3CALLBACKMEMBER(int, pfnHPETRegister,(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3));
|
---|
3035 |
|
---|
3036 | /**
|
---|
3037 | * Register a raw PCI device.
|
---|
3038 | *
|
---|
3039 | * @returns VBox status code.
|
---|
3040 | * @param pDevIns The device instance.
|
---|
3041 | * @param pPciRawReg Pointer to a raw PCI registration structure.
|
---|
3042 | * @param ppPciRawHlpR3 Where to store the pointer to the raw PCI
|
---|
3043 | * device helpers.
|
---|
3044 | */
|
---|
3045 | DECLR3CALLBACKMEMBER(int, pfnPciRawRegister,(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3));
|
---|
3046 |
|
---|
3047 | /**
|
---|
3048 | * Register the DMA device.
|
---|
3049 | *
|
---|
3050 | * @returns VBox status code.
|
---|
3051 | * @param pDevIns The device instance.
|
---|
3052 | * @param pDmacReg Pointer to a DMAC registration structure.
|
---|
3053 | * @param ppDmacHlp Where to store the pointer to the DMA helpers.
|
---|
3054 | */
|
---|
3055 | DECLR3CALLBACKMEMBER(int, pfnDMACRegister,(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp));
|
---|
3056 |
|
---|
3057 | /**
|
---|
3058 | * Register transfer function for DMA channel.
|
---|
3059 | *
|
---|
3060 | * @returns VBox status code.
|
---|
3061 | * @param pDevIns The device instance.
|
---|
3062 | * @param uChannel Channel number.
|
---|
3063 | * @param pfnTransferHandler Device specific transfer callback function.
|
---|
3064 | * @param pvUser User pointer to pass to the callback.
|
---|
3065 | * @thread EMT
|
---|
3066 | */
|
---|
3067 | DECLR3CALLBACKMEMBER(int, pfnDMARegister,(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser));
|
---|
3068 |
|
---|
3069 | /**
|
---|
3070 | * Read memory.
|
---|
3071 | *
|
---|
3072 | * @returns VBox status code.
|
---|
3073 | * @param pDevIns The device instance.
|
---|
3074 | * @param uChannel Channel number.
|
---|
3075 | * @param pvBuffer Pointer to target buffer.
|
---|
3076 | * @param off DMA position.
|
---|
3077 | * @param cbBlock Block size.
|
---|
3078 | * @param pcbRead Where to store the number of bytes which was
|
---|
3079 | * read. optional.
|
---|
3080 | * @thread EMT
|
---|
3081 | */
|
---|
3082 | DECLR3CALLBACKMEMBER(int, pfnDMAReadMemory,(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead));
|
---|
3083 |
|
---|
3084 | /**
|
---|
3085 | * Write memory.
|
---|
3086 | *
|
---|
3087 | * @returns VBox status code.
|
---|
3088 | * @param pDevIns The device instance.
|
---|
3089 | * @param uChannel Channel number.
|
---|
3090 | * @param pvBuffer Memory to write.
|
---|
3091 | * @param off DMA position.
|
---|
3092 | * @param cbBlock Block size.
|
---|
3093 | * @param pcbWritten Where to store the number of bytes which was
|
---|
3094 | * written. optional.
|
---|
3095 | * @thread EMT
|
---|
3096 | */
|
---|
3097 | DECLR3CALLBACKMEMBER(int, pfnDMAWriteMemory,(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten));
|
---|
3098 |
|
---|
3099 | /**
|
---|
3100 | * Set the DREQ line.
|
---|
3101 | *
|
---|
3102 | * @returns VBox status code.
|
---|
3103 | * @param pDevIns Device instance.
|
---|
3104 | * @param uChannel Channel number.
|
---|
3105 | * @param uLevel Level of the line.
|
---|
3106 | * @thread EMT
|
---|
3107 | */
|
---|
3108 | DECLR3CALLBACKMEMBER(int, pfnDMASetDREQ,(PPDMDEVINS pDevIns, unsigned uChannel, unsigned uLevel));
|
---|
3109 |
|
---|
3110 | /**
|
---|
3111 | * Get channel mode.
|
---|
3112 | *
|
---|
3113 | * @returns Channel mode. See specs.
|
---|
3114 | * @param pDevIns The device instance.
|
---|
3115 | * @param uChannel Channel number.
|
---|
3116 | * @thread EMT
|
---|
3117 | */
|
---|
3118 | DECLR3CALLBACKMEMBER(uint8_t, pfnDMAGetChannelMode,(PPDMDEVINS pDevIns, unsigned uChannel));
|
---|
3119 |
|
---|
3120 | /**
|
---|
3121 | * Schedule DMA execution.
|
---|
3122 | *
|
---|
3123 | * @param pDevIns The device instance.
|
---|
3124 | * @thread Any thread.
|
---|
3125 | */
|
---|
3126 | DECLR3CALLBACKMEMBER(void, pfnDMASchedule,(PPDMDEVINS pDevIns));
|
---|
3127 |
|
---|
3128 | /**
|
---|
3129 | * Write CMOS value and update the checksum(s).
|
---|
3130 | *
|
---|
3131 | * @returns VBox status code.
|
---|
3132 | * @param pDevIns The device instance.
|
---|
3133 | * @param iReg The CMOS register index.
|
---|
3134 | * @param u8Value The CMOS register value.
|
---|
3135 | * @thread EMT
|
---|
3136 | */
|
---|
3137 | DECLR3CALLBACKMEMBER(int, pfnCMOSWrite,(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value));
|
---|
3138 |
|
---|
3139 | /**
|
---|
3140 | * Read CMOS value.
|
---|
3141 | *
|
---|
3142 | * @returns VBox status code.
|
---|
3143 | * @param pDevIns The device instance.
|
---|
3144 | * @param iReg The CMOS register index.
|
---|
3145 | * @param pu8Value Where to store the CMOS register value.
|
---|
3146 | * @thread EMT
|
---|
3147 | */
|
---|
3148 | DECLR3CALLBACKMEMBER(int, pfnCMOSRead,(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value));
|
---|
3149 |
|
---|
3150 | /**
|
---|
3151 | * Assert that the current thread is the emulation thread.
|
---|
3152 | *
|
---|
3153 | * @returns True if correct.
|
---|
3154 | * @returns False if wrong.
|
---|
3155 | * @param pDevIns The device instance.
|
---|
3156 | * @param pszFile Filename of the assertion location.
|
---|
3157 | * @param iLine The linenumber of the assertion location.
|
---|
3158 | * @param pszFunction Function of the assertion location.
|
---|
3159 | */
|
---|
3160 | DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
3161 |
|
---|
3162 | /**
|
---|
3163 | * Assert that the current thread is NOT the emulation thread.
|
---|
3164 | *
|
---|
3165 | * @returns True if correct.
|
---|
3166 | * @returns False if wrong.
|
---|
3167 | * @param pDevIns The device instance.
|
---|
3168 | * @param pszFile Filename of the assertion location.
|
---|
3169 | * @param iLine The linenumber of the assertion location.
|
---|
3170 | * @param pszFunction Function of the assertion location.
|
---|
3171 | */
|
---|
3172 | DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
3173 |
|
---|
3174 | /**
|
---|
3175 | * Resolves the symbol for a raw-mode context interface.
|
---|
3176 | *
|
---|
3177 | * @returns VBox status code.
|
---|
3178 | * @param pDevIns The device instance.
|
---|
3179 | * @param pvInterface The interface structure.
|
---|
3180 | * @param cbInterface The size of the interface structure.
|
---|
3181 | * @param pszSymPrefix What to prefix the symbols in the list with
|
---|
3182 | * before resolving them. This must start with
|
---|
3183 | * 'dev' and contain the driver name.
|
---|
3184 | * @param pszSymList List of symbols corresponding to the interface.
|
---|
3185 | * There is generally a there is generally a define
|
---|
3186 | * holding this list associated with the interface
|
---|
3187 | * definition (INTERFACE_SYM_LIST). For more
|
---|
3188 | * details see PDMR3LdrGetInterfaceSymbols.
|
---|
3189 | * @thread EMT
|
---|
3190 | */
|
---|
3191 | DECLR3CALLBACKMEMBER(int, pfnLdrGetRCInterfaceSymbols,(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
|
---|
3192 | const char *pszSymPrefix, const char *pszSymList));
|
---|
3193 |
|
---|
3194 | /**
|
---|
3195 | * Resolves the symbol for a ring-0 context interface.
|
---|
3196 | *
|
---|
3197 | * @returns VBox status code.
|
---|
3198 | * @param pDevIns The device instance.
|
---|
3199 | * @param pvInterface The interface structure.
|
---|
3200 | * @param cbInterface The size of the interface structure.
|
---|
3201 | * @param pszSymPrefix What to prefix the symbols in the list with
|
---|
3202 | * before resolving them. This must start with
|
---|
3203 | * 'dev' and contain the driver name.
|
---|
3204 | * @param pszSymList List of symbols corresponding to the interface.
|
---|
3205 | * There is generally a there is generally a define
|
---|
3206 | * holding this list associated with the interface
|
---|
3207 | * definition (INTERFACE_SYM_LIST). For more
|
---|
3208 | * details see PDMR3LdrGetInterfaceSymbols.
|
---|
3209 | * @thread EMT
|
---|
3210 | */
|
---|
3211 | DECLR3CALLBACKMEMBER(int, pfnLdrGetR0InterfaceSymbols,(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
|
---|
3212 | const char *pszSymPrefix, const char *pszSymList));
|
---|
3213 |
|
---|
3214 | /**
|
---|
3215 | * Call the ring-0 request handler routine of the device.
|
---|
3216 | *
|
---|
3217 | * For this to work, the device must be ring-0 enabled and export a request
|
---|
3218 | * handler function. The name of the function must be the device name in
|
---|
3219 | * the PDMDRVREG struct prefixed with 'drvR0' and suffixed with
|
---|
3220 | * 'ReqHandler'. The device name will be captialized. It shall take the
|
---|
3221 | * exact same arguments as this function and be declared using
|
---|
3222 | * PDMBOTHCBDECL. See FNPDMDEVREQHANDLERR0.
|
---|
3223 | *
|
---|
3224 | * Unlike PDMDrvHlpCallR0, this is current unsuitable for more than a call
|
---|
3225 | * or two as the handler address will be resolved on each invocation. This
|
---|
3226 | * is the reason for the EMT only restriction as well.
|
---|
3227 | *
|
---|
3228 | * @returns VBox status code.
|
---|
3229 | * @retval VERR_SYMBOL_NOT_FOUND if the device doesn't export the required
|
---|
3230 | * handler function.
|
---|
3231 | * @retval VERR_ACCESS_DENIED if the device isn't ring-0 capable.
|
---|
3232 | *
|
---|
3233 | * @param pDevIns The device instance.
|
---|
3234 | * @param uOperation The operation to perform.
|
---|
3235 | * @param u64Arg 64-bit integer argument.
|
---|
3236 | * @thread EMT
|
---|
3237 | */
|
---|
3238 | DECLR3CALLBACKMEMBER(int, pfnCallR0,(PPDMDEVINS pDevIns, uint32_t uOperation, uint64_t u64Arg));
|
---|
3239 |
|
---|
3240 | /**
|
---|
3241 | * Gets the reason for the most recent VM suspend.
|
---|
3242 | *
|
---|
3243 | * @returns The suspend reason. VMSUSPENDREASON_INVALID is returned if no
|
---|
3244 | * suspend has been made or if the pDevIns is invalid.
|
---|
3245 | * @param pDevIns The device instance.
|
---|
3246 | */
|
---|
3247 | DECLR3CALLBACKMEMBER(VMSUSPENDREASON, pfnVMGetSuspendReason,(PPDMDEVINS pDevIns));
|
---|
3248 |
|
---|
3249 | /**
|
---|
3250 | * Gets the reason for the most recent VM resume.
|
---|
3251 | *
|
---|
3252 | * @returns The resume reason. VMRESUMEREASON_INVALID is returned if no
|
---|
3253 | * resume has been made or if the pDevIns is invalid.
|
---|
3254 | * @param pDevIns The device instance.
|
---|
3255 | */
|
---|
3256 | DECLR3CALLBACKMEMBER(VMRESUMEREASON, pfnVMGetResumeReason,(PPDMDEVINS pDevIns));
|
---|
3257 |
|
---|
3258 | /**
|
---|
3259 | * Reduces the length of a MMIO2 or pre-registered MMIO range.
|
---|
3260 | *
|
---|
3261 | * This is for implementations of PDMPCIDEV::pfnRegionLoadChangeHookR3 and will
|
---|
3262 | * only work during saved state restore. It will not call the PCI bus code, as
|
---|
3263 | * that is expected to restore the saved resource configuration.
|
---|
3264 | *
|
---|
3265 | * It just adjusts the mapping length of the region so that when pfnMMIOExMap is
|
---|
3266 | * called it will only map @a cbRegion bytes and not the value set during
|
---|
3267 | * registration.
|
---|
3268 | *
|
---|
3269 | * @return VBox status code.
|
---|
3270 | * @param pDevIns The device owning the range.
|
---|
3271 | * @param pPciDev The PCI device the region is associated with, or
|
---|
3272 | * NULL if not associated with any.
|
---|
3273 | * @param iRegion The region.
|
---|
3274 | * @param cbRegion The new size, must be smaller.
|
---|
3275 | */
|
---|
3276 | DECLR3CALLBACKMEMBER(int, pfnMMIOExReduce,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion));
|
---|
3277 |
|
---|
3278 | /** Space reserved for future members.
|
---|
3279 | * @{ */
|
---|
3280 | DECLR3CALLBACKMEMBER(void, pfnReserved2,(void));
|
---|
3281 | DECLR3CALLBACKMEMBER(void, pfnReserved3,(void));
|
---|
3282 | DECLR3CALLBACKMEMBER(void, pfnReserved4,(void));
|
---|
3283 | DECLR3CALLBACKMEMBER(void, pfnReserved5,(void));
|
---|
3284 | DECLR3CALLBACKMEMBER(void, pfnReserved6,(void));
|
---|
3285 | DECLR3CALLBACKMEMBER(void, pfnReserved7,(void));
|
---|
3286 | DECLR3CALLBACKMEMBER(void, pfnReserved8,(void));
|
---|
3287 | DECLR3CALLBACKMEMBER(void, pfnReserved9,(void));
|
---|
3288 | DECLR3CALLBACKMEMBER(void, pfnReserved10,(void));
|
---|
3289 | /** @} */
|
---|
3290 |
|
---|
3291 |
|
---|
3292 | /** API available to trusted devices only.
|
---|
3293 | *
|
---|
3294 | * These APIs are providing unrestricted access to the guest and the VM,
|
---|
3295 | * or they are interacting intimately with PDM.
|
---|
3296 | *
|
---|
3297 | * @{
|
---|
3298 | */
|
---|
3299 |
|
---|
3300 | /**
|
---|
3301 | * Gets the user mode VM handle. Restricted API.
|
---|
3302 | *
|
---|
3303 | * @returns User mode VM Handle.
|
---|
3304 | * @param pDevIns The device instance.
|
---|
3305 | */
|
---|
3306 | DECLR3CALLBACKMEMBER(PUVM, pfnGetUVM,(PPDMDEVINS pDevIns));
|
---|
3307 |
|
---|
3308 | /**
|
---|
3309 | * Gets the global VM handle. Restricted API.
|
---|
3310 | *
|
---|
3311 | * @returns VM Handle.
|
---|
3312 | * @param pDevIns The device instance.
|
---|
3313 | */
|
---|
3314 | DECLR3CALLBACKMEMBER(PVM, pfnGetVM,(PPDMDEVINS pDevIns));
|
---|
3315 |
|
---|
3316 | /**
|
---|
3317 | * Gets the VMCPU handle. Restricted API.
|
---|
3318 | *
|
---|
3319 | * @returns VMCPU Handle.
|
---|
3320 | * @param pDevIns The device instance.
|
---|
3321 | */
|
---|
3322 | DECLR3CALLBACKMEMBER(PVMCPU, pfnGetVMCPU,(PPDMDEVINS pDevIns));
|
---|
3323 |
|
---|
3324 | /**
|
---|
3325 | * The the VM CPU ID of the current thread (restricted API).
|
---|
3326 | *
|
---|
3327 | * @returns The VMCPUID of the calling thread, NIL_CPUID if not EMT.
|
---|
3328 | * @param pDevIns The device instance.
|
---|
3329 | */
|
---|
3330 | DECLR3CALLBACKMEMBER(VMCPUID, pfnGetCurrentCpuId,(PPDMDEVINS pDevIns));
|
---|
3331 |
|
---|
3332 | /**
|
---|
3333 | * Registers the VMM device heap or notifies about mapping/unmapping.
|
---|
3334 | *
|
---|
3335 | * This interface serves three purposes:
|
---|
3336 | *
|
---|
3337 | * -# Register the VMM device heap during device construction
|
---|
3338 | * for the HM to use.
|
---|
3339 | * -# Notify PDM/HM that it's mapped into guest address
|
---|
3340 | * space (i.e. usable).
|
---|
3341 | * -# Notify PDM/HM that it is being unmapped from the guest
|
---|
3342 | * address space (i.e. not usable).
|
---|
3343 | *
|
---|
3344 | * @returns VBox status code.
|
---|
3345 | * @param pDevIns The device instance.
|
---|
3346 | * @param GCPhys The physical address if mapped, NIL_RTGCPHYS if
|
---|
3347 | * not mapped.
|
---|
3348 | * @param pvHeap Ring 3 heap pointer.
|
---|
3349 | * @param cbHeap Size of the heap.
|
---|
3350 | * @thread EMT.
|
---|
3351 | */
|
---|
3352 | DECLR3CALLBACKMEMBER(int, pfnRegisterVMMDevHeap,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbHeap));
|
---|
3353 |
|
---|
3354 | /**
|
---|
3355 | * Registers the firmware (BIOS, EFI) device with PDM.
|
---|
3356 | *
|
---|
3357 | * The firmware provides a callback table and gets a special PDM helper table.
|
---|
3358 | * There can only be one firmware device for a VM.
|
---|
3359 | *
|
---|
3360 | * @returns VBox status code.
|
---|
3361 | * @param pDevIns The device instance.
|
---|
3362 | * @param pFwReg Firmware registration structure.
|
---|
3363 | * @param ppFwHlp Where to return the firmware helper structure.
|
---|
3364 | * @remarks Only valid during device construction.
|
---|
3365 | * @thread EMT(0)
|
---|
3366 | */
|
---|
3367 | DECLR3CALLBACKMEMBER(int, pfnFirmwareRegister,(PPDMDEVINS pDevIns, PCPDMFWREG pFwReg, PCPDMFWHLPR3 *ppFwHlp));
|
---|
3368 |
|
---|
3369 | /**
|
---|
3370 | * Resets the VM.
|
---|
3371 | *
|
---|
3372 | * @returns The appropriate VBox status code to pass around on reset.
|
---|
3373 | * @param pDevIns The device instance.
|
---|
3374 | * @param fFlags PDMVMRESET_F_XXX flags.
|
---|
3375 | * @thread The emulation thread.
|
---|
3376 | */
|
---|
3377 | DECLR3CALLBACKMEMBER(int, pfnVMReset,(PPDMDEVINS pDevIns, uint32_t fFlags));
|
---|
3378 |
|
---|
3379 | /**
|
---|
3380 | * Suspends the VM.
|
---|
3381 | *
|
---|
3382 | * @returns The appropriate VBox status code to pass around on suspend.
|
---|
3383 | * @param pDevIns The device instance.
|
---|
3384 | * @thread The emulation thread.
|
---|
3385 | */
|
---|
3386 | DECLR3CALLBACKMEMBER(int, pfnVMSuspend,(PPDMDEVINS pDevIns));
|
---|
3387 |
|
---|
3388 | /**
|
---|
3389 | * Suspends, saves and powers off the VM.
|
---|
3390 | *
|
---|
3391 | * @returns The appropriate VBox status code to pass around.
|
---|
3392 | * @param pDevIns The device instance.
|
---|
3393 | * @thread An emulation thread.
|
---|
3394 | */
|
---|
3395 | DECLR3CALLBACKMEMBER(int, pfnVMSuspendSaveAndPowerOff,(PPDMDEVINS pDevIns));
|
---|
3396 |
|
---|
3397 | /**
|
---|
3398 | * Power off the VM.
|
---|
3399 | *
|
---|
3400 | * @returns The appropriate VBox status code to pass around on power off.
|
---|
3401 | * @param pDevIns The device instance.
|
---|
3402 | * @thread The emulation thread.
|
---|
3403 | */
|
---|
3404 | DECLR3CALLBACKMEMBER(int, pfnVMPowerOff,(PPDMDEVINS pDevIns));
|
---|
3405 |
|
---|
3406 | /**
|
---|
3407 | * Checks if the Gate A20 is enabled or not.
|
---|
3408 | *
|
---|
3409 | * @returns true if A20 is enabled.
|
---|
3410 | * @returns false if A20 is disabled.
|
---|
3411 | * @param pDevIns The device instance.
|
---|
3412 | * @thread The emulation thread.
|
---|
3413 | */
|
---|
3414 | DECLR3CALLBACKMEMBER(bool, pfnA20IsEnabled,(PPDMDEVINS pDevIns));
|
---|
3415 |
|
---|
3416 | /**
|
---|
3417 | * Enables or disables the Gate A20.
|
---|
3418 | *
|
---|
3419 | * @param pDevIns The device instance.
|
---|
3420 | * @param fEnable Set this flag to enable the Gate A20; clear it
|
---|
3421 | * to disable.
|
---|
3422 | * @thread The emulation thread.
|
---|
3423 | */
|
---|
3424 | DECLR3CALLBACKMEMBER(void, pfnA20Set,(PPDMDEVINS pDevIns, bool fEnable));
|
---|
3425 |
|
---|
3426 | /**
|
---|
3427 | * Get the specified CPUID leaf for the virtual CPU associated with the calling
|
---|
3428 | * thread.
|
---|
3429 | *
|
---|
3430 | * @param pDevIns The device instance.
|
---|
3431 | * @param iLeaf The CPUID leaf to get.
|
---|
3432 | * @param pEax Where to store the EAX value.
|
---|
3433 | * @param pEbx Where to store the EBX value.
|
---|
3434 | * @param pEcx Where to store the ECX value.
|
---|
3435 | * @param pEdx Where to store the EDX value.
|
---|
3436 | * @thread EMT.
|
---|
3437 | */
|
---|
3438 | DECLR3CALLBACKMEMBER(void, pfnGetCpuId,(PPDMDEVINS pDevIns, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx));
|
---|
3439 |
|
---|
3440 | /**
|
---|
3441 | * Get the current virtual clock time in a VM. The clock frequency must be
|
---|
3442 | * queried separately.
|
---|
3443 | *
|
---|
3444 | * @returns Current clock time.
|
---|
3445 | * @param pDevIns The device instance.
|
---|
3446 | */
|
---|
3447 | DECLR3CALLBACKMEMBER(uint64_t, pfnTMTimeVirtGet,(PPDMDEVINS pDevIns));
|
---|
3448 |
|
---|
3449 | /**
|
---|
3450 | * Get the frequency of the virtual clock.
|
---|
3451 | *
|
---|
3452 | * @returns The clock frequency (not variable at run-time).
|
---|
3453 | * @param pDevIns The device instance.
|
---|
3454 | */
|
---|
3455 | DECLR3CALLBACKMEMBER(uint64_t, pfnTMTimeVirtGetFreq,(PPDMDEVINS pDevIns));
|
---|
3456 |
|
---|
3457 | /**
|
---|
3458 | * Get the current virtual clock time in a VM, in nanoseconds.
|
---|
3459 | *
|
---|
3460 | * @returns Current clock time (in ns).
|
---|
3461 | * @param pDevIns The device instance.
|
---|
3462 | */
|
---|
3463 | DECLR3CALLBACKMEMBER(uint64_t, pfnTMTimeVirtGetNano,(PPDMDEVINS pDevIns));
|
---|
3464 |
|
---|
3465 | /**
|
---|
3466 | * Gets the support driver session.
|
---|
3467 | *
|
---|
3468 | * This is intended for working with the semaphore API.
|
---|
3469 | *
|
---|
3470 | * @returns Support driver session handle.
|
---|
3471 | * @param pDevIns The device instance.
|
---|
3472 | */
|
---|
3473 | DECLR3CALLBACKMEMBER(PSUPDRVSESSION, pfnGetSupDrvSession,(PPDMDEVINS pDevIns));
|
---|
3474 |
|
---|
3475 | /** @} */
|
---|
3476 |
|
---|
3477 | /** Just a safety precaution. (PDM_DEVHLPR3_VERSION) */
|
---|
3478 | uint32_t u32TheEnd;
|
---|
3479 | } PDMDEVHLPR3;
|
---|
3480 | #endif /* !IN_RING3 */
|
---|
3481 | /** Pointer to the R3 PDM Device API. */
|
---|
3482 | typedef R3PTRTYPE(struct PDMDEVHLPR3 *) PPDMDEVHLPR3;
|
---|
3483 | /** Pointer to the R3 PDM Device API, const variant. */
|
---|
3484 | typedef R3PTRTYPE(const struct PDMDEVHLPR3 *) PCPDMDEVHLPR3;
|
---|
3485 |
|
---|
3486 |
|
---|
3487 | /**
|
---|
3488 | * PDM Device API - RC Variant.
|
---|
3489 | */
|
---|
3490 | typedef struct PDMDEVHLPRC
|
---|
3491 | {
|
---|
3492 | /** Structure version. PDM_DEVHLPRC_VERSION defines the current version. */
|
---|
3493 | uint32_t u32Version;
|
---|
3494 |
|
---|
3495 | /**
|
---|
3496 | * Bus master physical memory read from the given PCI device.
|
---|
3497 | *
|
---|
3498 | * @returns VINF_SUCCESS or VERR_PGM_PCI_PHYS_READ_BM_DISABLED, later maybe
|
---|
3499 | * VERR_EM_MEMORY. The informational status shall NOT be propagated!
|
---|
3500 | * @param pDevIns The device instance.
|
---|
3501 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
3502 | * PCI device for this device instance is used.
|
---|
3503 | * @param GCPhys Physical address start reading from.
|
---|
3504 | * @param pvBuf Where to put the read bits.
|
---|
3505 | * @param cbRead How many bytes to read.
|
---|
3506 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
3507 | */
|
---|
3508 | DECLRCCALLBACKMEMBER(int, pfnPCIPhysRead,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys,
|
---|
3509 | void *pvBuf, size_t cbRead));
|
---|
3510 |
|
---|
3511 | /**
|
---|
3512 | * Bus master physical memory write from the given PCI device.
|
---|
3513 | *
|
---|
3514 | * @returns VINF_SUCCESS or VERR_PGM_PCI_PHYS_WRITE_BM_DISABLED, later maybe
|
---|
3515 | * VERR_EM_MEMORY. The informational status shall NOT be propagated!
|
---|
3516 | * @param pDevIns The device instance.
|
---|
3517 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
3518 | * PCI device for this device instance is used.
|
---|
3519 | * @param GCPhys Physical address to write to.
|
---|
3520 | * @param pvBuf What to write.
|
---|
3521 | * @param cbWrite How many bytes to write.
|
---|
3522 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
3523 | */
|
---|
3524 | DECLRCCALLBACKMEMBER(int, pfnPCIPhysWrite,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys,
|
---|
3525 | const void *pvBuf, size_t cbWrite));
|
---|
3526 |
|
---|
3527 | /**
|
---|
3528 | * Set the IRQ for the given PCI device.
|
---|
3529 | *
|
---|
3530 | * @param pDevIns Device instance.
|
---|
3531 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
3532 | * PCI device for this device instance is used.
|
---|
3533 | * @param iIrq IRQ number to set.
|
---|
3534 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
3535 | * @thread Any thread, but will involve the emulation thread.
|
---|
3536 | */
|
---|
3537 | DECLRCCALLBACKMEMBER(void, pfnPCISetIrq,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel));
|
---|
3538 |
|
---|
3539 | /**
|
---|
3540 | * Set ISA IRQ for a device.
|
---|
3541 | *
|
---|
3542 | * @param pDevIns Device instance.
|
---|
3543 | * @param iIrq IRQ number to set.
|
---|
3544 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
3545 | * @thread Any thread, but will involve the emulation thread.
|
---|
3546 | */
|
---|
3547 | DECLRCCALLBACKMEMBER(void, pfnISASetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
3548 |
|
---|
3549 | /**
|
---|
3550 | * Read physical memory.
|
---|
3551 | *
|
---|
3552 | * @returns VINF_SUCCESS (for now).
|
---|
3553 | * @param pDevIns Device instance.
|
---|
3554 | * @param GCPhys Physical address start reading from.
|
---|
3555 | * @param pvBuf Where to put the read bits.
|
---|
3556 | * @param cbRead How many bytes to read.
|
---|
3557 | */
|
---|
3558 | DECLRCCALLBACKMEMBER(int, pfnPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
|
---|
3559 |
|
---|
3560 | /**
|
---|
3561 | * Write to physical memory.
|
---|
3562 | *
|
---|
3563 | * @returns VINF_SUCCESS for now, and later maybe VERR_EM_MEMORY.
|
---|
3564 | * @param pDevIns Device instance.
|
---|
3565 | * @param GCPhys Physical address to write to.
|
---|
3566 | * @param pvBuf What to write.
|
---|
3567 | * @param cbWrite How many bytes to write.
|
---|
3568 | */
|
---|
3569 | DECLRCCALLBACKMEMBER(int, pfnPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
|
---|
3570 |
|
---|
3571 | /**
|
---|
3572 | * Checks if the Gate A20 is enabled or not.
|
---|
3573 | *
|
---|
3574 | * @returns true if A20 is enabled.
|
---|
3575 | * @returns false if A20 is disabled.
|
---|
3576 | * @param pDevIns Device instance.
|
---|
3577 | * @thread The emulation thread.
|
---|
3578 | */
|
---|
3579 | DECLRCCALLBACKMEMBER(bool, pfnA20IsEnabled,(PPDMDEVINS pDevIns));
|
---|
3580 |
|
---|
3581 | /**
|
---|
3582 | * Gets the VM state.
|
---|
3583 | *
|
---|
3584 | * @returns VM state.
|
---|
3585 | * @param pDevIns The device instance.
|
---|
3586 | * @thread Any thread (just keep in mind that it's volatile info).
|
---|
3587 | */
|
---|
3588 | DECLRCCALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMDEVINS pDevIns));
|
---|
3589 |
|
---|
3590 | /**
|
---|
3591 | * Set the VM error message
|
---|
3592 | *
|
---|
3593 | * @returns rc.
|
---|
3594 | * @param pDevIns Driver instance.
|
---|
3595 | * @param rc VBox status code.
|
---|
3596 | * @param SRC_POS Use RT_SRC_POS.
|
---|
3597 | * @param pszFormat Error message format string.
|
---|
3598 | * @param ... Error message arguments.
|
---|
3599 | */
|
---|
3600 | DECLRCCALLBACKMEMBER(int, pfnVMSetError,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL,
|
---|
3601 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7));
|
---|
3602 |
|
---|
3603 | /**
|
---|
3604 | * Set the VM error message
|
---|
3605 | *
|
---|
3606 | * @returns rc.
|
---|
3607 | * @param pDevIns Driver instance.
|
---|
3608 | * @param rc VBox status code.
|
---|
3609 | * @param SRC_POS Use RT_SRC_POS.
|
---|
3610 | * @param pszFormat Error message format string.
|
---|
3611 | * @param va Error message arguments.
|
---|
3612 | */
|
---|
3613 | DECLRCCALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL,
|
---|
3614 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
3615 |
|
---|
3616 | /**
|
---|
3617 | * Set the VM runtime error message
|
---|
3618 | *
|
---|
3619 | * @returns VBox status code.
|
---|
3620 | * @param pDevIns Device instance.
|
---|
3621 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
3622 | * @param pszErrorId Error ID string.
|
---|
3623 | * @param pszFormat Error message format string.
|
---|
3624 | * @param ... Error message arguments.
|
---|
3625 | */
|
---|
3626 | DECLRCCALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId,
|
---|
3627 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5));
|
---|
3628 |
|
---|
3629 | /**
|
---|
3630 | * Set the VM runtime error message
|
---|
3631 | *
|
---|
3632 | * @returns VBox status code.
|
---|
3633 | * @param pDevIns Device instance.
|
---|
3634 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
3635 | * @param pszErrorId Error ID string.
|
---|
3636 | * @param pszFormat Error message format string.
|
---|
3637 | * @param va Error message arguments.
|
---|
3638 | */
|
---|
3639 | DECLRCCALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId,
|
---|
3640 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
|
---|
3641 |
|
---|
3642 | /**
|
---|
3643 | * Set parameters for pending MMIO patch operation
|
---|
3644 | *
|
---|
3645 | * @returns VBox status code.
|
---|
3646 | * @param pDevIns Device instance.
|
---|
3647 | * @param GCPhys MMIO physical address
|
---|
3648 | * @param pCachedData GC pointer to cached data
|
---|
3649 | */
|
---|
3650 | DECLRCCALLBACKMEMBER(int, pfnPATMSetMMIOPatchInfo,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData));
|
---|
3651 |
|
---|
3652 | /**
|
---|
3653 | * Gets the VM handle. Restricted API.
|
---|
3654 | *
|
---|
3655 | * @returns VM Handle.
|
---|
3656 | * @param pDevIns Device instance.
|
---|
3657 | */
|
---|
3658 | DECLRCCALLBACKMEMBER(PVM, pfnGetVM,(PPDMDEVINS pDevIns));
|
---|
3659 |
|
---|
3660 | /**
|
---|
3661 | * Gets the VMCPU handle. Restricted API.
|
---|
3662 | *
|
---|
3663 | * @returns VMCPU Handle.
|
---|
3664 | * @param pDevIns The device instance.
|
---|
3665 | */
|
---|
3666 | DECLRCCALLBACKMEMBER(PVMCPU, pfnGetVMCPU,(PPDMDEVINS pDevIns));
|
---|
3667 |
|
---|
3668 | /**
|
---|
3669 | * The the VM CPU ID of the current thread (restricted API).
|
---|
3670 | *
|
---|
3671 | * @returns The VMCPUID of the calling thread, NIL_CPUID if not EMT.
|
---|
3672 | * @param pDevIns The device instance.
|
---|
3673 | */
|
---|
3674 | DECLRCCALLBACKMEMBER(VMCPUID, pfnGetCurrentCpuId,(PPDMDEVINS pDevIns));
|
---|
3675 |
|
---|
3676 | /**
|
---|
3677 | * Get the current virtual clock time in a VM. The clock frequency must be
|
---|
3678 | * queried separately.
|
---|
3679 | *
|
---|
3680 | * @returns Current clock time.
|
---|
3681 | * @param pDevIns The device instance.
|
---|
3682 | */
|
---|
3683 | DECLRCCALLBACKMEMBER(uint64_t, pfnTMTimeVirtGet,(PPDMDEVINS pDevIns));
|
---|
3684 |
|
---|
3685 | /**
|
---|
3686 | * Get the frequency of the virtual clock.
|
---|
3687 | *
|
---|
3688 | * @returns The clock frequency (not variable at run-time).
|
---|
3689 | * @param pDevIns The device instance.
|
---|
3690 | */
|
---|
3691 | DECLRCCALLBACKMEMBER(uint64_t, pfnTMTimeVirtGetFreq,(PPDMDEVINS pDevIns));
|
---|
3692 |
|
---|
3693 | /**
|
---|
3694 | * Get the current virtual clock time in a VM, in nanoseconds.
|
---|
3695 | *
|
---|
3696 | * @returns Current clock time (in ns).
|
---|
3697 | * @param pDevIns The device instance.
|
---|
3698 | */
|
---|
3699 | DECLRCCALLBACKMEMBER(uint64_t, pfnTMTimeVirtGetNano,(PPDMDEVINS pDevIns));
|
---|
3700 |
|
---|
3701 | /**
|
---|
3702 | * Gets the trace buffer handle.
|
---|
3703 | *
|
---|
3704 | * This is used by the macros found in VBox/vmm/dbgftrace.h and is not
|
---|
3705 | * really inteded for direct usage, thus no inline wrapper function.
|
---|
3706 | *
|
---|
3707 | * @returns Trace buffer handle or NIL_RTTRACEBUF.
|
---|
3708 | * @param pDevIns The device instance.
|
---|
3709 | */
|
---|
3710 | DECLRCCALLBACKMEMBER(RTTRACEBUF, pfnDBGFTraceBuf,(PPDMDEVINS pDevIns));
|
---|
3711 |
|
---|
3712 | /** Space reserved for future members.
|
---|
3713 | * @{ */
|
---|
3714 | DECLRCCALLBACKMEMBER(void, pfnReserved1,(void));
|
---|
3715 | DECLRCCALLBACKMEMBER(void, pfnReserved2,(void));
|
---|
3716 | DECLRCCALLBACKMEMBER(void, pfnReserved3,(void));
|
---|
3717 | DECLRCCALLBACKMEMBER(void, pfnReserved4,(void));
|
---|
3718 | DECLRCCALLBACKMEMBER(void, pfnReserved5,(void));
|
---|
3719 | DECLRCCALLBACKMEMBER(void, pfnReserved6,(void));
|
---|
3720 | DECLRCCALLBACKMEMBER(void, pfnReserved7,(void));
|
---|
3721 | DECLRCCALLBACKMEMBER(void, pfnReserved8,(void));
|
---|
3722 | DECLRCCALLBACKMEMBER(void, pfnReserved9,(void));
|
---|
3723 | DECLRCCALLBACKMEMBER(void, pfnReserved10,(void));
|
---|
3724 | /** @} */
|
---|
3725 |
|
---|
3726 | /** Just a safety precaution. */
|
---|
3727 | uint32_t u32TheEnd;
|
---|
3728 | } PDMDEVHLPRC;
|
---|
3729 | /** Pointer PDM Device RC API. */
|
---|
3730 | typedef RCPTRTYPE(struct PDMDEVHLPRC *) PPDMDEVHLPRC;
|
---|
3731 | /** Pointer PDM Device RC API. */
|
---|
3732 | typedef RCPTRTYPE(const struct PDMDEVHLPRC *) PCPDMDEVHLPRC;
|
---|
3733 |
|
---|
3734 | /** Current PDMDEVHLP version number. */
|
---|
3735 | #define PDM_DEVHLPRC_VERSION PDM_VERSION_MAKE(0xffe6, 5, 0)
|
---|
3736 |
|
---|
3737 |
|
---|
3738 | /**
|
---|
3739 | * PDM Device API - R0 Variant.
|
---|
3740 | */
|
---|
3741 | typedef struct PDMDEVHLPR0
|
---|
3742 | {
|
---|
3743 | /** Structure version. PDM_DEVHLPR0_VERSION defines the current version. */
|
---|
3744 | uint32_t u32Version;
|
---|
3745 |
|
---|
3746 | /**
|
---|
3747 | * Bus master physical memory read from the given PCI device.
|
---|
3748 | *
|
---|
3749 | * @returns VINF_SUCCESS or VERR_PDM_NOT_PCI_BUS_MASTER, later maybe
|
---|
3750 | * VERR_EM_MEMORY.
|
---|
3751 | * @param pDevIns The device instance.
|
---|
3752 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
3753 | * PCI device for this device instance is used.
|
---|
3754 | * @param GCPhys Physical address start reading from.
|
---|
3755 | * @param pvBuf Where to put the read bits.
|
---|
3756 | * @param cbRead How many bytes to read.
|
---|
3757 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
3758 | */
|
---|
3759 | DECLR0CALLBACKMEMBER(int, pfnPCIPhysRead,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys,
|
---|
3760 | void *pvBuf, size_t cbRead));
|
---|
3761 |
|
---|
3762 | /**
|
---|
3763 | * Bus master physical memory write from the given PCI device.
|
---|
3764 | *
|
---|
3765 | * @returns VINF_SUCCESS or VERR_PDM_NOT_PCI_BUS_MASTER, later maybe
|
---|
3766 | * VERR_EM_MEMORY.
|
---|
3767 | * @param pDevIns The device instance.
|
---|
3768 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
3769 | * PCI device for this device instance is used.
|
---|
3770 | * @param GCPhys Physical address to write to.
|
---|
3771 | * @param pvBuf What to write.
|
---|
3772 | * @param cbWrite How many bytes to write.
|
---|
3773 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
3774 | */
|
---|
3775 | DECLR0CALLBACKMEMBER(int, pfnPCIPhysWrite,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys,
|
---|
3776 | const void *pvBuf, size_t cbWrite));
|
---|
3777 |
|
---|
3778 | /**
|
---|
3779 | * Set the IRQ for the given PCI device.
|
---|
3780 | *
|
---|
3781 | * @param pDevIns Device instance.
|
---|
3782 | * @param pPciDev The PCI device structure. If NULL the default
|
---|
3783 | * PCI device for this device instance is used.
|
---|
3784 | * @param iIrq IRQ number to set.
|
---|
3785 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
3786 | * @thread Any thread, but will involve the emulation thread.
|
---|
3787 | */
|
---|
3788 | DECLR0CALLBACKMEMBER(void, pfnPCISetIrq,(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel));
|
---|
3789 |
|
---|
3790 | /**
|
---|
3791 | * Set ISA IRQ for a device.
|
---|
3792 | *
|
---|
3793 | * @param pDevIns Device instance.
|
---|
3794 | * @param iIrq IRQ number to set.
|
---|
3795 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
3796 | * @thread Any thread, but will involve the emulation thread.
|
---|
3797 | */
|
---|
3798 | DECLR0CALLBACKMEMBER(void, pfnISASetIrq,(PPDMDEVINS pDevIns, int iIrq, int iLevel));
|
---|
3799 |
|
---|
3800 | /**
|
---|
3801 | * Read physical memory.
|
---|
3802 | *
|
---|
3803 | * @returns VINF_SUCCESS (for now).
|
---|
3804 | * @param pDevIns Device instance.
|
---|
3805 | * @param GCPhys Physical address start reading from.
|
---|
3806 | * @param pvBuf Where to put the read bits.
|
---|
3807 | * @param cbRead How many bytes to read.
|
---|
3808 | */
|
---|
3809 | DECLR0CALLBACKMEMBER(int, pfnPhysRead,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead));
|
---|
3810 |
|
---|
3811 | /**
|
---|
3812 | * Write to physical memory.
|
---|
3813 | *
|
---|
3814 | * @returns VINF_SUCCESS for now, and later maybe VERR_EM_MEMORY.
|
---|
3815 | * @param pDevIns Device instance.
|
---|
3816 | * @param GCPhys Physical address to write to.
|
---|
3817 | * @param pvBuf What to write.
|
---|
3818 | * @param cbWrite How many bytes to write.
|
---|
3819 | */
|
---|
3820 | DECLR0CALLBACKMEMBER(int, pfnPhysWrite,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite));
|
---|
3821 |
|
---|
3822 | /**
|
---|
3823 | * Checks if the Gate A20 is enabled or not.
|
---|
3824 | *
|
---|
3825 | * @returns true if A20 is enabled.
|
---|
3826 | * @returns false if A20 is disabled.
|
---|
3827 | * @param pDevIns Device instance.
|
---|
3828 | * @thread The emulation thread.
|
---|
3829 | */
|
---|
3830 | DECLR0CALLBACKMEMBER(bool, pfnA20IsEnabled,(PPDMDEVINS pDevIns));
|
---|
3831 |
|
---|
3832 | /**
|
---|
3833 | * Gets the VM state.
|
---|
3834 | *
|
---|
3835 | * @returns VM state.
|
---|
3836 | * @param pDevIns The device instance.
|
---|
3837 | * @thread Any thread (just keep in mind that it's volatile info).
|
---|
3838 | */
|
---|
3839 | DECLR0CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMDEVINS pDevIns));
|
---|
3840 |
|
---|
3841 | /**
|
---|
3842 | * Set the VM error message
|
---|
3843 | *
|
---|
3844 | * @returns rc.
|
---|
3845 | * @param pDevIns Driver instance.
|
---|
3846 | * @param rc VBox status code.
|
---|
3847 | * @param SRC_POS Use RT_SRC_POS.
|
---|
3848 | * @param pszFormat Error message format string.
|
---|
3849 | * @param ... Error message arguments.
|
---|
3850 | */
|
---|
3851 | DECLR0CALLBACKMEMBER(int, pfnVMSetError,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL,
|
---|
3852 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7));
|
---|
3853 |
|
---|
3854 | /**
|
---|
3855 | * Set the VM error message
|
---|
3856 | *
|
---|
3857 | * @returns rc.
|
---|
3858 | * @param pDevIns Driver instance.
|
---|
3859 | * @param rc VBox status code.
|
---|
3860 | * @param SRC_POS Use RT_SRC_POS.
|
---|
3861 | * @param pszFormat Error message format string.
|
---|
3862 | * @param va Error message arguments.
|
---|
3863 | */
|
---|
3864 | DECLR0CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL,
|
---|
3865 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
3866 |
|
---|
3867 | /**
|
---|
3868 | * Set the VM runtime error message
|
---|
3869 | *
|
---|
3870 | * @returns VBox status code.
|
---|
3871 | * @param pDevIns Device instance.
|
---|
3872 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
3873 | * @param pszErrorId Error ID string.
|
---|
3874 | * @param pszFormat Error message format string.
|
---|
3875 | * @param ... Error message arguments.
|
---|
3876 | */
|
---|
3877 | DECLR0CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId,
|
---|
3878 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5));
|
---|
3879 |
|
---|
3880 | /**
|
---|
3881 | * Set the VM runtime error message
|
---|
3882 | *
|
---|
3883 | * @returns VBox status code.
|
---|
3884 | * @param pDevIns Device instance.
|
---|
3885 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
3886 | * @param pszErrorId Error ID string.
|
---|
3887 | * @param pszFormat Error message format string.
|
---|
3888 | * @param va Error message arguments.
|
---|
3889 | */
|
---|
3890 | DECLR0CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId,
|
---|
3891 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
|
---|
3892 |
|
---|
3893 | /**
|
---|
3894 | * Set parameters for pending MMIO patch operation
|
---|
3895 | *
|
---|
3896 | * @returns rc.
|
---|
3897 | * @param pDevIns Device instance.
|
---|
3898 | * @param GCPhys MMIO physical address
|
---|
3899 | * @param pCachedData GC pointer to cached data
|
---|
3900 | */
|
---|
3901 | DECLR0CALLBACKMEMBER(int, pfnPATMSetMMIOPatchInfo,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPTR pCachedData));
|
---|
3902 |
|
---|
3903 | /**
|
---|
3904 | * Gets the VM handle. Restricted API.
|
---|
3905 | *
|
---|
3906 | * @returns VM Handle.
|
---|
3907 | * @param pDevIns Device instance.
|
---|
3908 | */
|
---|
3909 | DECLR0CALLBACKMEMBER(PVM, pfnGetVM,(PPDMDEVINS pDevIns));
|
---|
3910 |
|
---|
3911 | /**
|
---|
3912 | * Checks if our current CPU state allows for IO block emulation fallback to the recompiler
|
---|
3913 | *
|
---|
3914 | * @returns true = yes, false = no
|
---|
3915 | * @param pDevIns Device instance.
|
---|
3916 | */
|
---|
3917 | DECLR0CALLBACKMEMBER(bool, pfnCanEmulateIoBlock,(PPDMDEVINS pDevIns));
|
---|
3918 |
|
---|
3919 | /**
|
---|
3920 | * Gets the VMCPU handle. Restricted API.
|
---|
3921 | *
|
---|
3922 | * @returns VMCPU Handle.
|
---|
3923 | * @param pDevIns The device instance.
|
---|
3924 | */
|
---|
3925 | DECLR0CALLBACKMEMBER(PVMCPU, pfnGetVMCPU,(PPDMDEVINS pDevIns));
|
---|
3926 |
|
---|
3927 | /**
|
---|
3928 | * The the VM CPU ID of the current thread (restricted API).
|
---|
3929 | *
|
---|
3930 | * @returns The VMCPUID of the calling thread, NIL_CPUID if not EMT.
|
---|
3931 | * @param pDevIns The device instance.
|
---|
3932 | */
|
---|
3933 | DECLR0CALLBACKMEMBER(VMCPUID, pfnGetCurrentCpuId,(PPDMDEVINS pDevIns));
|
---|
3934 |
|
---|
3935 | /**
|
---|
3936 | * Get the current virtual clock time in a VM. The clock frequency must be
|
---|
3937 | * queried separately.
|
---|
3938 | *
|
---|
3939 | * @returns Current clock time.
|
---|
3940 | * @param pDevIns The device instance.
|
---|
3941 | */
|
---|
3942 | DECLR0CALLBACKMEMBER(uint64_t, pfnTMTimeVirtGet,(PPDMDEVINS pDevIns));
|
---|
3943 |
|
---|
3944 | /**
|
---|
3945 | * Get the frequency of the virtual clock.
|
---|
3946 | *
|
---|
3947 | * @returns The clock frequency (not variable at run-time).
|
---|
3948 | * @param pDevIns The device instance.
|
---|
3949 | */
|
---|
3950 | DECLR0CALLBACKMEMBER(uint64_t, pfnTMTimeVirtGetFreq,(PPDMDEVINS pDevIns));
|
---|
3951 |
|
---|
3952 | /**
|
---|
3953 | * Get the current virtual clock time in a VM, in nanoseconds.
|
---|
3954 | *
|
---|
3955 | * @returns Current clock time (in ns).
|
---|
3956 | * @param pDevIns The device instance.
|
---|
3957 | */
|
---|
3958 | DECLR0CALLBACKMEMBER(uint64_t, pfnTMTimeVirtGetNano,(PPDMDEVINS pDevIns));
|
---|
3959 |
|
---|
3960 | /**
|
---|
3961 | * Gets the trace buffer handle.
|
---|
3962 | *
|
---|
3963 | * This is used by the macros found in VBox/vmm/dbgftrace.h and is not
|
---|
3964 | * really inteded for direct usage, thus no inline wrapper function.
|
---|
3965 | *
|
---|
3966 | * @returns Trace buffer handle or NIL_RTTRACEBUF.
|
---|
3967 | * @param pDevIns The device instance.
|
---|
3968 | */
|
---|
3969 | DECLR0CALLBACKMEMBER(RTTRACEBUF, pfnDBGFTraceBuf,(PPDMDEVINS pDevIns));
|
---|
3970 |
|
---|
3971 | /** Space reserved for future members.
|
---|
3972 | * @{ */
|
---|
3973 | DECLR0CALLBACKMEMBER(void, pfnReserved1,(void));
|
---|
3974 | DECLR0CALLBACKMEMBER(void, pfnReserved2,(void));
|
---|
3975 | DECLR0CALLBACKMEMBER(void, pfnReserved3,(void));
|
---|
3976 | DECLR0CALLBACKMEMBER(void, pfnReserved4,(void));
|
---|
3977 | DECLR0CALLBACKMEMBER(void, pfnReserved5,(void));
|
---|
3978 | DECLR0CALLBACKMEMBER(void, pfnReserved6,(void));
|
---|
3979 | DECLR0CALLBACKMEMBER(void, pfnReserved7,(void));
|
---|
3980 | DECLR0CALLBACKMEMBER(void, pfnReserved8,(void));
|
---|
3981 | DECLR0CALLBACKMEMBER(void, pfnReserved9,(void));
|
---|
3982 | DECLR0CALLBACKMEMBER(void, pfnReserved10,(void));
|
---|
3983 | /** @} */
|
---|
3984 |
|
---|
3985 | /** Just a safety precaution. */
|
---|
3986 | uint32_t u32TheEnd;
|
---|
3987 | } PDMDEVHLPR0;
|
---|
3988 | /** Pointer PDM Device R0 API. */
|
---|
3989 | typedef R0PTRTYPE(struct PDMDEVHLPR0 *) PPDMDEVHLPR0;
|
---|
3990 | /** Pointer PDM Device GC API. */
|
---|
3991 | typedef R0PTRTYPE(const struct PDMDEVHLPR0 *) PCPDMDEVHLPR0;
|
---|
3992 |
|
---|
3993 | /** Current PDMDEVHLP version number. */
|
---|
3994 | #define PDM_DEVHLPR0_VERSION PDM_VERSION_MAKE(0xffe5, 5, 0)
|
---|
3995 |
|
---|
3996 |
|
---|
3997 |
|
---|
3998 | /**
|
---|
3999 | * PDM Device Instance.
|
---|
4000 | */
|
---|
4001 | typedef struct PDMDEVINS
|
---|
4002 | {
|
---|
4003 | /** Structure version. PDM_DEVINS_VERSION defines the current version. */
|
---|
4004 | uint32_t u32Version;
|
---|
4005 | /** Device instance number. */
|
---|
4006 | uint32_t iInstance;
|
---|
4007 |
|
---|
4008 | /** Pointer the GC PDM Device API. */
|
---|
4009 | PCPDMDEVHLPRC pHlpRC;
|
---|
4010 | /** Pointer to device instance data. */
|
---|
4011 | RTRCPTR pvInstanceDataRC;
|
---|
4012 | /** The critical section for the device, see pCritSectXR3. */
|
---|
4013 | RCPTRTYPE(PPDMCRITSECT) pCritSectRoRC;
|
---|
4014 | /** Alignment padding. */
|
---|
4015 | RTRCPTR pAlignmentRC;
|
---|
4016 |
|
---|
4017 | /** Pointer the R0 PDM Device API. */
|
---|
4018 | PCPDMDEVHLPR0 pHlpR0;
|
---|
4019 | /** Pointer to device instance data (R0). */
|
---|
4020 | RTR0PTR pvInstanceDataR0;
|
---|
4021 | /** The critical section for the device, see pCritSectXR3. */
|
---|
4022 | R0PTRTYPE(PPDMCRITSECT) pCritSectRoR0;
|
---|
4023 |
|
---|
4024 | /** Pointer the HC PDM Device API. */
|
---|
4025 | PCPDMDEVHLPR3 pHlpR3;
|
---|
4026 | /** Pointer to device instance data. */
|
---|
4027 | RTR3PTR pvInstanceDataR3;
|
---|
4028 | /** The critical section for the device.
|
---|
4029 | *
|
---|
4030 | * TM and IOM will enter this critical section before calling into the device
|
---|
4031 | * code. PDM will when doing power on, power off, reset, suspend and resume
|
---|
4032 | * notifications. SSM will currently not, but this will be changed later on.
|
---|
4033 | *
|
---|
4034 | * The device gets a critical section automatically assigned to it before
|
---|
4035 | * the constructor is called. If the constructor wishes to use a different
|
---|
4036 | * critical section, it calls PDMDevHlpSetDeviceCritSect() to change it
|
---|
4037 | * very early on.
|
---|
4038 | */
|
---|
4039 | R3PTRTYPE(PPDMCRITSECT) pCritSectRoR3;
|
---|
4040 |
|
---|
4041 | /** Pointer to device registration structure. */
|
---|
4042 | R3PTRTYPE(PCPDMDEVREG) pReg;
|
---|
4043 | /** Configuration handle. */
|
---|
4044 | R3PTRTYPE(PCFGMNODE) pCfg;
|
---|
4045 |
|
---|
4046 | /** The base interface of the device.
|
---|
4047 | *
|
---|
4048 | * The device constructor initializes this if it has any
|
---|
4049 | * device level interfaces to export. To obtain this interface
|
---|
4050 | * call PDMR3QueryDevice(). */
|
---|
4051 | PDMIBASE IBase;
|
---|
4052 |
|
---|
4053 | /** Tracing indicator. */
|
---|
4054 | uint32_t fTracing;
|
---|
4055 | /** The tracing ID of this device. */
|
---|
4056 | uint32_t idTracing;
|
---|
4057 | #if HC_ARCH_BITS == 32
|
---|
4058 | /** Align the internal data more naturally. */
|
---|
4059 | uint32_t au32Padding[HC_ARCH_BITS == 32 ? 13 : 0];
|
---|
4060 | #endif
|
---|
4061 |
|
---|
4062 | /** Internal data. */
|
---|
4063 | union
|
---|
4064 | {
|
---|
4065 | #ifdef PDMDEVINSINT_DECLARED
|
---|
4066 | PDMDEVINSINT s;
|
---|
4067 | #endif
|
---|
4068 | uint8_t padding[HC_ARCH_BITS == 32 ? 72 : 112 + 0x28];
|
---|
4069 | } Internal;
|
---|
4070 |
|
---|
4071 | /** Device instance data. The size of this area is defined
|
---|
4072 | * in the PDMDEVREG::cbInstanceData field. */
|
---|
4073 | char achInstanceData[8];
|
---|
4074 | } PDMDEVINS;
|
---|
4075 |
|
---|
4076 | /** Current PDMDEVINS version number. */
|
---|
4077 | #define PDM_DEVINS_VERSION PDM_VERSION_MAKE(0xffe4, 3, 0)
|
---|
4078 |
|
---|
4079 | /** Converts a pointer to the PDMDEVINS::IBase to a pointer to PDMDEVINS. */
|
---|
4080 | #define PDMIBASE_2_PDMDEV(pInterface) ( (PPDMDEVINS)((char *)(pInterface) - RT_OFFSETOF(PDMDEVINS, IBase)) )
|
---|
4081 |
|
---|
4082 | /**
|
---|
4083 | * Checks the structure versions of the device instance and device helpers,
|
---|
4084 | * returning if they are incompatible.
|
---|
4085 | *
|
---|
4086 | * This is for use in the constructor.
|
---|
4087 | *
|
---|
4088 | * @param pDevIns The device instance pointer.
|
---|
4089 | */
|
---|
4090 | #define PDMDEV_CHECK_VERSIONS_RETURN(pDevIns) \
|
---|
4091 | do \
|
---|
4092 | { \
|
---|
4093 | PPDMDEVINS pDevInsTypeCheck = (pDevIns); NOREF(pDevInsTypeCheck); \
|
---|
4094 | AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDevIns)->u32Version, PDM_DEVINS_VERSION), \
|
---|
4095 | ("DevIns=%#x mine=%#x\n", (pDevIns)->u32Version, PDM_DEVINS_VERSION), \
|
---|
4096 | VERR_PDM_DEVINS_VERSION_MISMATCH); \
|
---|
4097 | AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDevIns)->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION), \
|
---|
4098 | ("DevHlp=%#x mine=%#x\n", (pDevIns)->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION), \
|
---|
4099 | VERR_PDM_DEVHLPR3_VERSION_MISMATCH); \
|
---|
4100 | } while (0)
|
---|
4101 |
|
---|
4102 | /**
|
---|
4103 | * Quietly checks the structure versions of the device instance and device
|
---|
4104 | * helpers, returning if they are incompatible.
|
---|
4105 | *
|
---|
4106 | * This is for use in the destructor.
|
---|
4107 | *
|
---|
4108 | * @param pDevIns The device instance pointer.
|
---|
4109 | */
|
---|
4110 | #define PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns) \
|
---|
4111 | do \
|
---|
4112 | { \
|
---|
4113 | PPDMDEVINS pDevInsTypeCheck = (pDevIns); NOREF(pDevInsTypeCheck); \
|
---|
4114 | if (RT_LIKELY(PDM_VERSION_ARE_COMPATIBLE((pDevIns)->u32Version, PDM_DEVINS_VERSION) )) \
|
---|
4115 | { /* likely */ } else return VERR_PDM_DEVINS_VERSION_MISMATCH; \
|
---|
4116 | if (RT_LIKELY(PDM_VERSION_ARE_COMPATIBLE((pDevIns)->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION) )) \
|
---|
4117 | { /* likely */ } else return VERR_PDM_DEVHLPR3_VERSION_MISMATCH; \
|
---|
4118 | } while (0)
|
---|
4119 |
|
---|
4120 | /**
|
---|
4121 | * Wrapper around CFGMR3ValidateConfig for the root config for use in the
|
---|
4122 | * constructor - returns on failure.
|
---|
4123 | *
|
---|
4124 | * This should be invoked after having initialized the instance data
|
---|
4125 | * sufficiently for the correct operation of the destructor. The destructor is
|
---|
4126 | * always called!
|
---|
4127 | *
|
---|
4128 | * @param pDevIns Pointer to the PDM device instance.
|
---|
4129 | * @param pszValidValues Patterns describing the valid value names. See
|
---|
4130 | * RTStrSimplePatternMultiMatch for details on the
|
---|
4131 | * pattern syntax.
|
---|
4132 | * @param pszValidNodes Patterns describing the valid node (key) names.
|
---|
4133 | * Pass empty string if no valid nodes.
|
---|
4134 | */
|
---|
4135 | #define PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, pszValidValues, pszValidNodes) \
|
---|
4136 | do \
|
---|
4137 | { \
|
---|
4138 | int rcValCfg = CFGMR3ValidateConfig((pDevIns)->pCfg, "/", pszValidValues, pszValidNodes, \
|
---|
4139 | (pDevIns)->pReg->szName, (pDevIns)->iInstance); \
|
---|
4140 | if (RT_SUCCESS(rcValCfg)) \
|
---|
4141 | { /* likely */ } else return rcValCfg; \
|
---|
4142 | } while (0)
|
---|
4143 |
|
---|
4144 | /** @def PDMDEV_ASSERT_EMT
|
---|
4145 | * Assert that the current thread is the emulation thread.
|
---|
4146 | */
|
---|
4147 | #ifdef VBOX_STRICT
|
---|
4148 | # define PDMDEV_ASSERT_EMT(pDevIns) pDevIns->pHlpR3->pfnAssertEMT(pDevIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
4149 | #else
|
---|
4150 | # define PDMDEV_ASSERT_EMT(pDevIns) do { } while (0)
|
---|
4151 | #endif
|
---|
4152 |
|
---|
4153 | /** @def PDMDEV_ASSERT_OTHER
|
---|
4154 | * Assert that the current thread is NOT the emulation thread.
|
---|
4155 | */
|
---|
4156 | #ifdef VBOX_STRICT
|
---|
4157 | # define PDMDEV_ASSERT_OTHER(pDevIns) pDevIns->pHlpR3->pfnAssertOther(pDevIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
4158 | #else
|
---|
4159 | # define PDMDEV_ASSERT_OTHER(pDevIns) do { } while (0)
|
---|
4160 | #endif
|
---|
4161 |
|
---|
4162 | /** @def PDMDEV_ASSERT_VMLOCK_OWNER
|
---|
4163 | * Assert that the current thread is owner of the VM lock.
|
---|
4164 | */
|
---|
4165 | #ifdef VBOX_STRICT
|
---|
4166 | # define PDMDEV_ASSERT_VMLOCK_OWNER(pDevIns) pDevIns->pHlpR3->pfnAssertVMLock(pDevIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
4167 | #else
|
---|
4168 | # define PDMDEV_ASSERT_VMLOCK_OWNER(pDevIns) do { } while (0)
|
---|
4169 | #endif
|
---|
4170 |
|
---|
4171 | /** @def PDMDEV_SET_ERROR
|
---|
4172 | * Set the VM error. See PDMDevHlpVMSetError() for printf like message formatting.
|
---|
4173 | */
|
---|
4174 | #define PDMDEV_SET_ERROR(pDevIns, rc, pszError) \
|
---|
4175 | PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, "%s", pszError)
|
---|
4176 |
|
---|
4177 | /** @def PDMDEV_SET_RUNTIME_ERROR
|
---|
4178 | * Set the VM runtime error. See PDMDevHlpVMSetRuntimeError() for printf like message formatting.
|
---|
4179 | */
|
---|
4180 | #define PDMDEV_SET_RUNTIME_ERROR(pDevIns, fFlags, pszErrorId, pszError) \
|
---|
4181 | PDMDevHlpVMSetRuntimeError(pDevIns, fFlags, pszErrorId, "%s", pszError)
|
---|
4182 |
|
---|
4183 | /** @def PDMDEVINS_2_RCPTR
|
---|
4184 | * Converts a PDM Device instance pointer a RC PDM Device instance pointer.
|
---|
4185 | */
|
---|
4186 | #define PDMDEVINS_2_RCPTR(pDevIns) ( (RCPTRTYPE(PPDMDEVINS))((RTGCUINTPTR)(pDevIns)->pvInstanceDataRC - RT_OFFSETOF(PDMDEVINS, achInstanceData)) )
|
---|
4187 |
|
---|
4188 | /** @def PDMDEVINS_2_R3PTR
|
---|
4189 | * Converts a PDM Device instance pointer a R3 PDM Device instance pointer.
|
---|
4190 | */
|
---|
4191 | #define PDMDEVINS_2_R3PTR(pDevIns) ( (R3PTRTYPE(PPDMDEVINS))((RTHCUINTPTR)(pDevIns)->pvInstanceDataR3 - RT_OFFSETOF(PDMDEVINS, achInstanceData)) )
|
---|
4192 |
|
---|
4193 | /** @def PDMDEVINS_2_R0PTR
|
---|
4194 | * Converts a PDM Device instance pointer a R0 PDM Device instance pointer.
|
---|
4195 | */
|
---|
4196 | #define PDMDEVINS_2_R0PTR(pDevIns) ( (R0PTRTYPE(PPDMDEVINS))((RTR0UINTPTR)(pDevIns)->pvInstanceDataR0 - RT_OFFSETOF(PDMDEVINS, achInstanceData)) )
|
---|
4197 |
|
---|
4198 |
|
---|
4199 | #ifdef IN_RING3
|
---|
4200 |
|
---|
4201 | /**
|
---|
4202 | * @copydoc PDMDEVHLPR3::pfnIOPortRegister
|
---|
4203 | */
|
---|
4204 | DECLINLINE(int) PDMDevHlpIOPortRegister(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTHCPTR pvUser,
|
---|
4205 | PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn,
|
---|
4206 | PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, const char *pszDesc)
|
---|
4207 | {
|
---|
4208 | return pDevIns->pHlpR3->pfnIOPortRegister(pDevIns, Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc);
|
---|
4209 | }
|
---|
4210 |
|
---|
4211 | /**
|
---|
4212 | * @copydoc PDMDEVHLPR3::pfnIOPortRegisterRC
|
---|
4213 | */
|
---|
4214 | DECLINLINE(int) PDMDevHlpIOPortRegisterRC(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTRCPTR pvUser,
|
---|
4215 | const char *pszOut, const char *pszIn, const char *pszOutStr,
|
---|
4216 | const char *pszInStr, const char *pszDesc)
|
---|
4217 | {
|
---|
4218 | return pDevIns->pHlpR3->pfnIOPortRegisterRC(pDevIns, Port, cPorts, pvUser, pszOut, pszIn, pszOutStr, pszInStr, pszDesc);
|
---|
4219 | }
|
---|
4220 |
|
---|
4221 | /**
|
---|
4222 | * @copydoc PDMDEVHLPR3::pfnIOPortRegisterR0
|
---|
4223 | */
|
---|
4224 | DECLINLINE(int) PDMDevHlpIOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTR0PTR pvUser,
|
---|
4225 | const char *pszOut, const char *pszIn, const char *pszOutStr,
|
---|
4226 | const char *pszInStr, const char *pszDesc)
|
---|
4227 | {
|
---|
4228 | return pDevIns->pHlpR3->pfnIOPortRegisterR0(pDevIns, Port, cPorts, pvUser, pszOut, pszIn, pszOutStr, pszInStr, pszDesc);
|
---|
4229 | }
|
---|
4230 |
|
---|
4231 | /**
|
---|
4232 | * @copydoc PDMDEVHLPR3::pfnIOPortDeregister
|
---|
4233 | */
|
---|
4234 | DECLINLINE(int) PDMDevHlpIOPortDeregister(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts)
|
---|
4235 | {
|
---|
4236 | return pDevIns->pHlpR3->pfnIOPortDeregister(pDevIns, Port, cPorts);
|
---|
4237 | }
|
---|
4238 |
|
---|
4239 | /**
|
---|
4240 | * Register a Memory Mapped I/O (MMIO) region.
|
---|
4241 | *
|
---|
4242 | * These callbacks are of course for the ring-3 context (R3). Register HC
|
---|
4243 | * handlers before raw-mode context (RC) and ring-0 context (R0) handlers! There
|
---|
4244 | * must be a R3 handler for every RC and R0 handler!
|
---|
4245 | *
|
---|
4246 | * @returns VBox status.
|
---|
4247 | * @param pDevIns The device instance to register the MMIO with.
|
---|
4248 | * @param GCPhysStart First physical address in the range.
|
---|
4249 | * @param cbRange The size of the range (in bytes).
|
---|
4250 | * @param pvUser User argument.
|
---|
4251 | * @param fFlags Flags, IOMMMIO_FLAGS_XXX.
|
---|
4252 | * @param pfnWrite Pointer to function which is gonna handle Write operations.
|
---|
4253 | * @param pfnRead Pointer to function which is gonna handle Read operations.
|
---|
4254 | * @param pszDesc Pointer to description string. This must not be freed.
|
---|
4255 | */
|
---|
4256 | DECLINLINE(int) PDMDevHlpMMIORegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTHCPTR pvUser,
|
---|
4257 | uint32_t fFlags, PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead, const char *pszDesc)
|
---|
4258 | {
|
---|
4259 | return pDevIns->pHlpR3->pfnMMIORegister(pDevIns, GCPhysStart, cbRange, pvUser, pfnWrite, pfnRead, NULL /*pfnFill*/,
|
---|
4260 | fFlags, pszDesc);
|
---|
4261 | }
|
---|
4262 |
|
---|
4263 | /**
|
---|
4264 | * Register a Memory Mapped I/O (MMIO) region for RC.
|
---|
4265 | *
|
---|
4266 | * These callbacks are for the raw-mode context (RC). Register ring-3 context
|
---|
4267 | * (R3) handlers before guest context handlers! There must be a R3 handler for
|
---|
4268 | * every RC handler!
|
---|
4269 | *
|
---|
4270 | * @returns VBox status.
|
---|
4271 | * @param pDevIns The device instance to register the MMIO with.
|
---|
4272 | * @param GCPhysStart First physical address in the range.
|
---|
4273 | * @param cbRange The size of the range (in bytes).
|
---|
4274 | * @param pvUser User argument.
|
---|
4275 | * @param pszWrite Name of the RC function which is gonna handle Write operations.
|
---|
4276 | * @param pszRead Name of the RC function which is gonna handle Read operations.
|
---|
4277 | */
|
---|
4278 | DECLINLINE(int) PDMDevHlpMMIORegisterRC(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTRCPTR pvUser,
|
---|
4279 | const char *pszWrite, const char *pszRead)
|
---|
4280 | {
|
---|
4281 | return pDevIns->pHlpR3->pfnMMIORegisterRC(pDevIns, GCPhysStart, cbRange, pvUser, pszWrite, pszRead, NULL /*pszFill*/);
|
---|
4282 | }
|
---|
4283 |
|
---|
4284 | /**
|
---|
4285 | * Register a Memory Mapped I/O (MMIO) region for R0.
|
---|
4286 | *
|
---|
4287 | * These callbacks are for the ring-0 host context (R0). Register ring-3
|
---|
4288 | * constext (R3) handlers before R0 handlers! There must be a R3 handler for
|
---|
4289 | * every R0 handler!
|
---|
4290 | *
|
---|
4291 | * @returns VBox status.
|
---|
4292 | * @param pDevIns The device instance to register the MMIO with.
|
---|
4293 | * @param GCPhysStart First physical address in the range.
|
---|
4294 | * @param cbRange The size of the range (in bytes).
|
---|
4295 | * @param pvUser User argument. (if pointer, then it must be in locked memory!)
|
---|
4296 | * @param pszWrite Name of the RC function which is gonna handle Write operations.
|
---|
4297 | * @param pszRead Name of the RC function which is gonna handle Read operations.
|
---|
4298 | * @remarks Caller enters the device critical section prior to invoking the
|
---|
4299 | * registered callback methods.
|
---|
4300 | */
|
---|
4301 | DECLINLINE(int) PDMDevHlpMMIORegisterR0(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTR0PTR pvUser,
|
---|
4302 | const char *pszWrite, const char *pszRead)
|
---|
4303 | {
|
---|
4304 | return pDevIns->pHlpR3->pfnMMIORegisterR0(pDevIns, GCPhysStart, cbRange, pvUser, pszWrite, pszRead, NULL /*pszFill*/);
|
---|
4305 | }
|
---|
4306 |
|
---|
4307 | /**
|
---|
4308 | * @copydoc PDMDEVHLPR3::pfnMMIORegister
|
---|
4309 | */
|
---|
4310 | DECLINLINE(int) PDMDevHlpMMIORegisterEx(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTHCPTR pvUser,
|
---|
4311 | uint32_t fFlags, PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead,
|
---|
4312 | PFNIOMMMIOFILL pfnFill, const char *pszDesc)
|
---|
4313 | {
|
---|
4314 | return pDevIns->pHlpR3->pfnMMIORegister(pDevIns, GCPhysStart, cbRange, pvUser, pfnWrite, pfnRead, pfnFill,
|
---|
4315 | fFlags, pszDesc);
|
---|
4316 | }
|
---|
4317 |
|
---|
4318 | /**
|
---|
4319 | * @copydoc PDMDEVHLPR3::pfnMMIORegisterRC
|
---|
4320 | */
|
---|
4321 | DECLINLINE(int) PDMDevHlpMMIORegisterRCEx(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTRCPTR pvUser,
|
---|
4322 | const char *pszWrite, const char *pszRead, const char *pszFill)
|
---|
4323 | {
|
---|
4324 | return pDevIns->pHlpR3->pfnMMIORegisterRC(pDevIns, GCPhysStart, cbRange, pvUser, pszWrite, pszRead, pszFill);
|
---|
4325 | }
|
---|
4326 |
|
---|
4327 | /**
|
---|
4328 | * @copydoc PDMDEVHLPR3::pfnMMIORegisterR0
|
---|
4329 | */
|
---|
4330 | DECLINLINE(int) PDMDevHlpMMIORegisterR0Ex(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTR0PTR pvUser,
|
---|
4331 | const char *pszWrite, const char *pszRead, const char *pszFill)
|
---|
4332 | {
|
---|
4333 | return pDevIns->pHlpR3->pfnMMIORegisterR0(pDevIns, GCPhysStart, cbRange, pvUser, pszWrite, pszRead, pszFill);
|
---|
4334 | }
|
---|
4335 |
|
---|
4336 | /**
|
---|
4337 | * @copydoc PDMDEVHLPR3::pfnMMIODeregister
|
---|
4338 | */
|
---|
4339 | DECLINLINE(int) PDMDevHlpMMIODeregister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange)
|
---|
4340 | {
|
---|
4341 | return pDevIns->pHlpR3->pfnMMIODeregister(pDevIns, GCPhysStart, cbRange);
|
---|
4342 | }
|
---|
4343 |
|
---|
4344 | /**
|
---|
4345 | * @copydoc PDMDEVHLPR3::pfnMMIO2Register
|
---|
4346 | */
|
---|
4347 | DECLINLINE(int) PDMDevHlpMMIO2Register(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cb,
|
---|
4348 | uint32_t fFlags, void **ppv, const char *pszDesc)
|
---|
4349 | {
|
---|
4350 | return pDevIns->pHlpR3->pfnMMIO2Register(pDevIns, pPciDev, iRegion, cb, fFlags, ppv, pszDesc);
|
---|
4351 | }
|
---|
4352 |
|
---|
4353 | /**
|
---|
4354 | * @copydoc PDMDEVHLPR3::pfnMMIOExPreRegister
|
---|
4355 | */
|
---|
4356 | DECLINLINE(int) PDMDevHlpMMIOExPreRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion,
|
---|
4357 | uint32_t fFlags, const char *pszDesc, RTHCPTR pvUser,
|
---|
4358 | PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead, PFNIOMMMIOFILL pfnFill,
|
---|
4359 | RTR0PTR pvUserR0, const char *pszWriteR0, const char *pszReadR0, const char *pszFillR0,
|
---|
4360 | RTRCPTR pvUserRC, const char *pszWriteRC, const char *pszReadRC, const char *pszFillRC)
|
---|
4361 | {
|
---|
4362 | return pDevIns->pHlpR3->pfnMMIOExPreRegister(pDevIns, pPciDev, iRegion, cbRegion, fFlags, pszDesc,
|
---|
4363 | pvUser, pfnWrite, pfnRead, pfnFill,
|
---|
4364 | pvUserR0, pszWriteR0, pszReadR0, pszFillR0,
|
---|
4365 | pvUserRC, pszWriteRC, pszReadRC, pszFillRC);
|
---|
4366 | }
|
---|
4367 |
|
---|
4368 | /**
|
---|
4369 | * @copydoc PDMDEVHLPR3::pfnMMIOExDeregister
|
---|
4370 | * @param pPciDev The PCI device the region is associated with, use
|
---|
4371 | * NULL to indicate it is not associated with a device.
|
---|
4372 | */
|
---|
4373 | DECLINLINE(int) PDMDevHlpMMIOExDeregister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion)
|
---|
4374 | {
|
---|
4375 | return pDevIns->pHlpR3->pfnMMIOExDeregister(pDevIns, pPciDev, iRegion);
|
---|
4376 | }
|
---|
4377 |
|
---|
4378 | /**
|
---|
4379 | * @copydoc PDMDEVHLPR3::pfnMMIOExMap
|
---|
4380 | * @param pPciDev The PCI device the region is associated with, use
|
---|
4381 | * NULL to indicate it is not associated with a device.
|
---|
4382 | */
|
---|
4383 | DECLINLINE(int) PDMDevHlpMMIOExMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys)
|
---|
4384 | {
|
---|
4385 | return pDevIns->pHlpR3->pfnMMIOExMap(pDevIns, pPciDev, iRegion, GCPhys);
|
---|
4386 | }
|
---|
4387 |
|
---|
4388 | /**
|
---|
4389 | * @copydoc PDMDEVHLPR3::pfnMMIOExUnmap
|
---|
4390 | * @param pPciDev The PCI device the region is associated with, use
|
---|
4391 | * NULL to indicate it is not associated with a device.
|
---|
4392 | */
|
---|
4393 | DECLINLINE(int) PDMDevHlpMMIOExUnmap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys)
|
---|
4394 | {
|
---|
4395 | return pDevIns->pHlpR3->pfnMMIOExUnmap(pDevIns, pPciDev, iRegion, GCPhys);
|
---|
4396 | }
|
---|
4397 |
|
---|
4398 | /**
|
---|
4399 | * @copydoc PDMDEVHLPR3::pfnMMIOExReduce
|
---|
4400 | */
|
---|
4401 | DECLINLINE(int) PDMDevHlpMMIOExReduce(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion)
|
---|
4402 | {
|
---|
4403 | return pDevIns->pHlpR3->pfnMMIOExReduce(pDevIns, pPciDev, iRegion, cbRegion);
|
---|
4404 | }
|
---|
4405 |
|
---|
4406 | /**
|
---|
4407 | * @copydoc PDMDEVHLPR3::pfnMMHyperMapMMIO2
|
---|
4408 | */
|
---|
4409 | DECLINLINE(int) PDMDevHlpMMHyperMapMMIO2(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
|
---|
4410 | const char *pszDesc, PRTRCPTR pRCPtr)
|
---|
4411 | {
|
---|
4412 | return pDevIns->pHlpR3->pfnMMHyperMapMMIO2(pDevIns, pPciDev, iRegion, off, cb, pszDesc, pRCPtr);
|
---|
4413 | }
|
---|
4414 |
|
---|
4415 | /**
|
---|
4416 | * @copydoc PDMDEVHLPR3::pfnMMIO2MapKernel
|
---|
4417 | */
|
---|
4418 | DECLINLINE(int) PDMDevHlpMMIO2MapKernel(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
|
---|
4419 | const char *pszDesc, PRTR0PTR pR0Ptr)
|
---|
4420 | {
|
---|
4421 | return pDevIns->pHlpR3->pfnMMIO2MapKernel(pDevIns, pPciDev, iRegion, off, cb, pszDesc, pR0Ptr);
|
---|
4422 | }
|
---|
4423 |
|
---|
4424 | /**
|
---|
4425 | * @copydoc PDMDEVHLPR3::pfnROMRegister
|
---|
4426 | */
|
---|
4427 | DECLINLINE(int) PDMDevHlpROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange,
|
---|
4428 | const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc)
|
---|
4429 | {
|
---|
4430 | return pDevIns->pHlpR3->pfnROMRegister(pDevIns, GCPhysStart, cbRange, pvBinary, cbBinary, fFlags, pszDesc);
|
---|
4431 | }
|
---|
4432 |
|
---|
4433 | /**
|
---|
4434 | * @copydoc PDMDEVHLPR3::pfnROMProtectShadow
|
---|
4435 | */
|
---|
4436 | DECLINLINE(int) PDMDevHlpROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, PGMROMPROT enmProt)
|
---|
4437 | {
|
---|
4438 | return pDevIns->pHlpR3->pfnROMProtectShadow(pDevIns, GCPhysStart, cbRange, enmProt);
|
---|
4439 | }
|
---|
4440 |
|
---|
4441 | /**
|
---|
4442 | * Register a save state data unit.
|
---|
4443 | *
|
---|
4444 | * @returns VBox status.
|
---|
4445 | * @param pDevIns The device instance.
|
---|
4446 | * @param uVersion Data layout version number.
|
---|
4447 | * @param cbGuess The approximate amount of data in the unit.
|
---|
4448 | * Only for progress indicators.
|
---|
4449 | * @param pfnSaveExec Execute save callback, optional.
|
---|
4450 | * @param pfnLoadExec Execute load callback, optional.
|
---|
4451 | */
|
---|
4452 | DECLINLINE(int) PDMDevHlpSSMRegister(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess,
|
---|
4453 | PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVLOADEXEC pfnLoadExec)
|
---|
4454 | {
|
---|
4455 | return pDevIns->pHlpR3->pfnSSMRegister(pDevIns, uVersion, cbGuess, NULL /*pszBefore*/,
|
---|
4456 | NULL /*pfnLivePrep*/, NULL /*pfnLiveExec*/, NULL /*pfnLiveDone*/,
|
---|
4457 | NULL /*pfnSavePrep*/, pfnSaveExec, NULL /*pfnSaveDone*/,
|
---|
4458 | NULL /*pfnLoadPrep*/, pfnLoadExec, NULL /*pfnLoadDone*/);
|
---|
4459 | }
|
---|
4460 |
|
---|
4461 | /**
|
---|
4462 | * Register a save state data unit with a live save callback as well.
|
---|
4463 | *
|
---|
4464 | * @returns VBox status.
|
---|
4465 | * @param pDevIns The device instance.
|
---|
4466 | * @param uVersion Data layout version number.
|
---|
4467 | * @param cbGuess The approximate amount of data in the unit.
|
---|
4468 | * Only for progress indicators.
|
---|
4469 | * @param pfnLiveExec Execute live callback, optional.
|
---|
4470 | * @param pfnSaveExec Execute save callback, optional.
|
---|
4471 | * @param pfnLoadExec Execute load callback, optional.
|
---|
4472 | */
|
---|
4473 | DECLINLINE(int) PDMDevHlpSSMRegister3(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess,
|
---|
4474 | FNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVLOADEXEC pfnLoadExec)
|
---|
4475 | {
|
---|
4476 | return pDevIns->pHlpR3->pfnSSMRegister(pDevIns, uVersion, cbGuess, NULL /*pszBefore*/,
|
---|
4477 | NULL /*pfnLivePrep*/, pfnLiveExec, NULL /*pfnLiveDone*/,
|
---|
4478 | NULL /*pfnSavePrep*/, pfnSaveExec, NULL /*pfnSaveDone*/,
|
---|
4479 | NULL /*pfnLoadPrep*/, pfnLoadExec, NULL /*pfnLoadDone*/);
|
---|
4480 | }
|
---|
4481 |
|
---|
4482 | /**
|
---|
4483 | * @copydoc PDMDEVHLPR3::pfnSSMRegister
|
---|
4484 | */
|
---|
4485 | DECLINLINE(int) PDMDevHlpSSMRegisterEx(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore,
|
---|
4486 | PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote,
|
---|
4487 | PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
|
---|
4488 | PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone)
|
---|
4489 | {
|
---|
4490 | return pDevIns->pHlpR3->pfnSSMRegister(pDevIns, uVersion, cbGuess, pszBefore,
|
---|
4491 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
4492 | pfnSavePrep, pfnSaveExec, pfnSaveDone,
|
---|
4493 | pfnLoadPrep, pfnLoadExec, pfnLoadDone);
|
---|
4494 | }
|
---|
4495 |
|
---|
4496 | /**
|
---|
4497 | * @copydoc PDMDEVHLPR3::pfnTMTimerCreate
|
---|
4498 | */
|
---|
4499 | DECLINLINE(int) PDMDevHlpTMTimerCreate(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, void *pvUser, uint32_t fFlags,
|
---|
4500 | const char *pszDesc, PPTMTIMERR3 ppTimer)
|
---|
4501 | {
|
---|
4502 | return pDevIns->pHlpR3->pfnTMTimerCreate(pDevIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
|
---|
4503 | }
|
---|
4504 |
|
---|
4505 | /**
|
---|
4506 | * @copydoc PDMDEVHLPR3::pfnTMUtcNow
|
---|
4507 | */
|
---|
4508 | DECLINLINE(PRTTIMESPEC) PDMDevHlpTMUtcNow(PPDMDEVINS pDevIns, PRTTIMESPEC pTime)
|
---|
4509 | {
|
---|
4510 | return pDevIns->pHlpR3->pfnTMUtcNow(pDevIns, pTime);
|
---|
4511 | }
|
---|
4512 |
|
---|
4513 | #endif /* IN_RING3 */
|
---|
4514 |
|
---|
4515 | /**
|
---|
4516 | * @copydoc PDMDEVHLPR3::pfnPhysRead
|
---|
4517 | */
|
---|
4518 | DECLINLINE(int) PDMDevHlpPhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
|
---|
4519 | {
|
---|
4520 | return pDevIns->CTX_SUFF(pHlp)->pfnPhysRead(pDevIns, GCPhys, pvBuf, cbRead);
|
---|
4521 | }
|
---|
4522 |
|
---|
4523 | /**
|
---|
4524 | * @copydoc PDMDEVHLPR3::pfnPhysWrite
|
---|
4525 | */
|
---|
4526 | DECLINLINE(int) PDMDevHlpPhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
|
---|
4527 | {
|
---|
4528 | return pDevIns->CTX_SUFF(pHlp)->pfnPhysWrite(pDevIns, GCPhys, pvBuf, cbWrite);
|
---|
4529 | }
|
---|
4530 |
|
---|
4531 | #ifdef IN_RING3
|
---|
4532 |
|
---|
4533 | /**
|
---|
4534 | * @copydoc PDMDEVHLPR3::pfnPhysGCPhys2CCPtr
|
---|
4535 | */
|
---|
4536 | DECLINLINE(int) PDMDevHlpPhysGCPhys2CCPtr(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv, PPGMPAGEMAPLOCK pLock)
|
---|
4537 | {
|
---|
4538 | return pDevIns->CTX_SUFF(pHlp)->pfnPhysGCPhys2CCPtr(pDevIns, GCPhys, fFlags, ppv, pLock);
|
---|
4539 | }
|
---|
4540 |
|
---|
4541 | /**
|
---|
4542 | * @copydoc PDMDEVHLPR3::pfnPhysGCPhys2CCPtrReadOnly
|
---|
4543 | */
|
---|
4544 | DECLINLINE(int) PDMDevHlpPhysGCPhys2CCPtrReadOnly(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void const **ppv,
|
---|
4545 | PPGMPAGEMAPLOCK pLock)
|
---|
4546 | {
|
---|
4547 | return pDevIns->CTX_SUFF(pHlp)->pfnPhysGCPhys2CCPtrReadOnly(pDevIns, GCPhys, fFlags, ppv, pLock);
|
---|
4548 | }
|
---|
4549 |
|
---|
4550 | /**
|
---|
4551 | * @copydoc PDMDEVHLPR3::pfnPhysReleasePageMappingLock
|
---|
4552 | */
|
---|
4553 | DECLINLINE(void) PDMDevHlpPhysReleasePageMappingLock(PPDMDEVINS pDevIns, PPGMPAGEMAPLOCK pLock)
|
---|
4554 | {
|
---|
4555 | pDevIns->CTX_SUFF(pHlp)->pfnPhysReleasePageMappingLock(pDevIns, pLock);
|
---|
4556 | }
|
---|
4557 |
|
---|
4558 | /**
|
---|
4559 | * @copydoc PDMDEVHLPR3::pfnPhysReadGCVirt
|
---|
4560 | */
|
---|
4561 | DECLINLINE(int) PDMDevHlpPhysReadGCVirt(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb)
|
---|
4562 | {
|
---|
4563 | return pDevIns->pHlpR3->pfnPhysReadGCVirt(pDevIns, pvDst, GCVirtSrc, cb);
|
---|
4564 | }
|
---|
4565 |
|
---|
4566 | /**
|
---|
4567 | * @copydoc PDMDEVHLPR3::pfnPhysWriteGCVirt
|
---|
4568 | */
|
---|
4569 | DECLINLINE(int) PDMDevHlpPhysWriteGCVirt(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb)
|
---|
4570 | {
|
---|
4571 | return pDevIns->pHlpR3->pfnPhysWriteGCVirt(pDevIns, GCVirtDst, pvSrc, cb);
|
---|
4572 | }
|
---|
4573 |
|
---|
4574 | /**
|
---|
4575 | * @copydoc PDMDEVHLPR3::pfnPhysGCPtr2GCPhys
|
---|
4576 | */
|
---|
4577 | DECLINLINE(int) PDMDevHlpPhysGCPtr2GCPhys(PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys)
|
---|
4578 | {
|
---|
4579 | return pDevIns->pHlpR3->pfnPhysGCPtr2GCPhys(pDevIns, GCPtr, pGCPhys);
|
---|
4580 | }
|
---|
4581 |
|
---|
4582 | /**
|
---|
4583 | * @copydoc PDMDEVHLPR3::pfnMMHeapAlloc
|
---|
4584 | */
|
---|
4585 | DECLINLINE(void *) PDMDevHlpMMHeapAlloc(PPDMDEVINS pDevIns, size_t cb)
|
---|
4586 | {
|
---|
4587 | return pDevIns->pHlpR3->pfnMMHeapAlloc(pDevIns, cb);
|
---|
4588 | }
|
---|
4589 |
|
---|
4590 | /**
|
---|
4591 | * @copydoc PDMDEVHLPR3::pfnMMHeapAllocZ
|
---|
4592 | */
|
---|
4593 | DECLINLINE(void *) PDMDevHlpMMHeapAllocZ(PPDMDEVINS pDevIns, size_t cb)
|
---|
4594 | {
|
---|
4595 | return pDevIns->pHlpR3->pfnMMHeapAllocZ(pDevIns, cb);
|
---|
4596 | }
|
---|
4597 |
|
---|
4598 | /**
|
---|
4599 | * @copydoc PDMDEVHLPR3::pfnMMHeapFree
|
---|
4600 | */
|
---|
4601 | DECLINLINE(void) PDMDevHlpMMHeapFree(PPDMDEVINS pDevIns, void *pv)
|
---|
4602 | {
|
---|
4603 | pDevIns->pHlpR3->pfnMMHeapFree(pDevIns, pv);
|
---|
4604 | }
|
---|
4605 | #endif /* IN_RING3 */
|
---|
4606 |
|
---|
4607 | /**
|
---|
4608 | * @copydoc PDMDEVHLPR3::pfnVMState
|
---|
4609 | */
|
---|
4610 | DECLINLINE(VMSTATE) PDMDevHlpVMState(PPDMDEVINS pDevIns)
|
---|
4611 | {
|
---|
4612 | return pDevIns->CTX_SUFF(pHlp)->pfnVMState(pDevIns);
|
---|
4613 | }
|
---|
4614 |
|
---|
4615 | #ifdef IN_RING3
|
---|
4616 | /**
|
---|
4617 | * @copydoc PDMDEVHLPR3::pfnVMTeleportedAndNotFullyResumedYet
|
---|
4618 | */
|
---|
4619 | DECLINLINE(bool) PDMDevHlpVMTeleportedAndNotFullyResumedYet(PPDMDEVINS pDevIns)
|
---|
4620 | {
|
---|
4621 | return pDevIns->pHlpR3->pfnVMTeleportedAndNotFullyResumedYet(pDevIns);
|
---|
4622 | }
|
---|
4623 | #endif /* IN_RING3 */
|
---|
4624 |
|
---|
4625 | /**
|
---|
4626 | * @copydoc PDMDEVHLPR3::pfnVMSetError
|
---|
4627 | */
|
---|
4628 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(6, 7) PDMDevHlpVMSetError(PPDMDEVINS pDevIns, const int rc, RT_SRC_POS_DECL,
|
---|
4629 | const char *pszFormat, ...)
|
---|
4630 | {
|
---|
4631 | va_list va;
|
---|
4632 | va_start(va, pszFormat);
|
---|
4633 | pDevIns->CTX_SUFF(pHlp)->pfnVMSetErrorV(pDevIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
4634 | va_end(va);
|
---|
4635 | return rc;
|
---|
4636 | }
|
---|
4637 |
|
---|
4638 | /**
|
---|
4639 | * @copydoc PDMDEVHLPR3::pfnVMSetRuntimeError
|
---|
4640 | */
|
---|
4641 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(4, 5) PDMDevHlpVMSetRuntimeError(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId,
|
---|
4642 | const char *pszFormat, ...)
|
---|
4643 | {
|
---|
4644 | va_list va;
|
---|
4645 | int rc;
|
---|
4646 | va_start(va, pszFormat);
|
---|
4647 | rc = pDevIns->CTX_SUFF(pHlp)->pfnVMSetRuntimeErrorV(pDevIns, fFlags, pszErrorId, pszFormat, va);
|
---|
4648 | va_end(va);
|
---|
4649 | return rc;
|
---|
4650 | }
|
---|
4651 |
|
---|
4652 | /**
|
---|
4653 | * VBOX_STRICT wrapper for pHlp->pfnDBGFStopV.
|
---|
4654 | *
|
---|
4655 | * @returns VBox status code which must be passed up to the VMM. This will be
|
---|
4656 | * VINF_SUCCESS in non-strict builds.
|
---|
4657 | * @param pDevIns The device instance.
|
---|
4658 | * @param SRC_POS Use RT_SRC_POS.
|
---|
4659 | * @param pszFormat Message. (optional)
|
---|
4660 | * @param ... Message parameters.
|
---|
4661 | */
|
---|
4662 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(5, 6) PDMDevHlpDBGFStop(PPDMDEVINS pDevIns, RT_SRC_POS_DECL, const char *pszFormat, ...)
|
---|
4663 | {
|
---|
4664 | #ifdef VBOX_STRICT
|
---|
4665 | # ifdef IN_RING3
|
---|
4666 | int rc;
|
---|
4667 | va_list args;
|
---|
4668 | va_start(args, pszFormat);
|
---|
4669 | rc = pDevIns->pHlpR3->pfnDBGFStopV(pDevIns, RT_SRC_POS_ARGS, pszFormat, args);
|
---|
4670 | va_end(args);
|
---|
4671 | return rc;
|
---|
4672 | # else
|
---|
4673 | NOREF(pDevIns);
|
---|
4674 | NOREF(pszFile);
|
---|
4675 | NOREF(iLine);
|
---|
4676 | NOREF(pszFunction);
|
---|
4677 | NOREF(pszFormat);
|
---|
4678 | return VINF_EM_DBG_STOP;
|
---|
4679 | # endif
|
---|
4680 | #else
|
---|
4681 | NOREF(pDevIns);
|
---|
4682 | NOREF(pszFile);
|
---|
4683 | NOREF(iLine);
|
---|
4684 | NOREF(pszFunction);
|
---|
4685 | NOREF(pszFormat);
|
---|
4686 | return VINF_SUCCESS;
|
---|
4687 | #endif
|
---|
4688 | }
|
---|
4689 |
|
---|
4690 | #ifdef IN_RING3
|
---|
4691 |
|
---|
4692 | /**
|
---|
4693 | * @copydoc PDMDEVHLPR3::pfnDBGFInfoRegister
|
---|
4694 | */
|
---|
4695 | DECLINLINE(int) PDMDevHlpDBGFInfoRegister(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler)
|
---|
4696 | {
|
---|
4697 | return pDevIns->pHlpR3->pfnDBGFInfoRegister(pDevIns, pszName, pszDesc, pfnHandler);
|
---|
4698 | }
|
---|
4699 |
|
---|
4700 | /**
|
---|
4701 | * @copydoc PDMDEVHLPR3::pfnDBGFRegRegister
|
---|
4702 | */
|
---|
4703 | DECLINLINE(int) PDMDevHlpDBGFRegRegister(PPDMDEVINS pDevIns, PCDBGFREGDESC paRegisters)
|
---|
4704 | {
|
---|
4705 | return pDevIns->pHlpR3->pfnDBGFRegRegister(pDevIns, paRegisters);
|
---|
4706 | }
|
---|
4707 |
|
---|
4708 | /**
|
---|
4709 | * @copydoc PDMDEVHLPR3::pfnSTAMRegister
|
---|
4710 | */
|
---|
4711 | DECLINLINE(void) PDMDevHlpSTAMRegister(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
|
---|
4712 | {
|
---|
4713 | pDevIns->pHlpR3->pfnSTAMRegister(pDevIns, pvSample, enmType, pszName, enmUnit, pszDesc);
|
---|
4714 | }
|
---|
4715 |
|
---|
4716 | /**
|
---|
4717 | * @copydoc PDMDEVHLPR3::pfnSTAMRegisterF
|
---|
4718 | */
|
---|
4719 | DECLINLINE(void) RT_IPRT_FORMAT_ATTR(7, 8) PDMDevHlpSTAMRegisterF(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType,
|
---|
4720 | STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
4721 | const char *pszDesc, const char *pszName, ...)
|
---|
4722 | {
|
---|
4723 | va_list va;
|
---|
4724 | va_start(va, pszName);
|
---|
4725 | pDevIns->pHlpR3->pfnSTAMRegisterV(pDevIns, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va);
|
---|
4726 | va_end(va);
|
---|
4727 | }
|
---|
4728 |
|
---|
4729 | /*
|
---|
4730 | * Registers the device with the default PCI bus.
|
---|
4731 | *
|
---|
4732 | * @returns VBox status code.
|
---|
4733 | * @param pDevIns The device instance.
|
---|
4734 | * @param pPciDev The PCI device structure.
|
---|
4735 | * This must be kept in the instance data.
|
---|
4736 | * The PCI configuration must be initialized before registration.
|
---|
4737 | */
|
---|
4738 | DECLINLINE(int) PDMDevHlpPCIRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev)
|
---|
4739 | {
|
---|
4740 | return pDevIns->pHlpR3->pfnPCIRegister(pDevIns, pPciDev, PDMPCIDEVREG_CFG_NEXT, 0 /*fFlags*/,
|
---|
4741 | PDMPCIDEVREG_DEV_NO_FIRST_UNUSED, PDMPCIDEVREG_FUN_NO_FIRST_UNUSED, NULL);
|
---|
4742 | }
|
---|
4743 |
|
---|
4744 | /**
|
---|
4745 | * @copydoc PDMDEVHLPR3::pfnPCIRegister
|
---|
4746 | */
|
---|
4747 | DECLINLINE(int) PDMDevHlpPCIRegisterEx(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t idxDevCfg, uint32_t fFlags,
|
---|
4748 | uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName)
|
---|
4749 | {
|
---|
4750 | return pDevIns->pHlpR3->pfnPCIRegister(pDevIns, pPciDev, idxDevCfg, fFlags, uPciDevNo, uPciFunNo, pszName);
|
---|
4751 | }
|
---|
4752 |
|
---|
4753 | /**
|
---|
4754 | * Registers a I/O region (memory mapped or I/O ports) for the default PCI
|
---|
4755 | * device.
|
---|
4756 | *
|
---|
4757 | * @returns VBox status code.
|
---|
4758 | * @param pDevIns The device instance.
|
---|
4759 | * @param iRegion The region number.
|
---|
4760 | * @param cbRegion Size of the region.
|
---|
4761 | * @param enmType PCI_ADDRESS_SPACE_MEM, PCI_ADDRESS_SPACE_IO or PCI_ADDRESS_SPACE_MEM_PREFETCH.
|
---|
4762 | * @param pfnCallback Callback for doing the mapping.
|
---|
4763 | * @remarks The callback will be invoked holding the PDM lock. The device lock
|
---|
4764 | * is NOT take because that is very likely be a lock order violation.
|
---|
4765 | */
|
---|
4766 | DECLINLINE(int) PDMDevHlpPCIIORegionRegister(PPDMDEVINS pDevIns, int iRegion, RTGCPHYS cbRegion,
|
---|
4767 | PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
|
---|
4768 | {
|
---|
4769 | return pDevIns->pHlpR3->pfnPCIIORegionRegister(pDevIns, NULL, iRegion, cbRegion, enmType, pfnCallback);
|
---|
4770 | }
|
---|
4771 |
|
---|
4772 | /**
|
---|
4773 | * @copydoc PDMDEVHLPR3::pfnPCIIORegionRegister
|
---|
4774 | */
|
---|
4775 | DECLINLINE(int) PDMDevHlpPCIIORegionRegisterEx(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iRegion, RTGCPHYS cbRegion,
|
---|
4776 | PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback)
|
---|
4777 | {
|
---|
4778 | return pDevIns->pHlpR3->pfnPCIIORegionRegister(pDevIns, pPciDev, iRegion, cbRegion, enmType, pfnCallback);
|
---|
4779 | }
|
---|
4780 |
|
---|
4781 | /**
|
---|
4782 | * Initialize MSI support for the first PCI device.
|
---|
4783 | *
|
---|
4784 | * @returns VBox status code.
|
---|
4785 | * @param pDevIns The device instance.
|
---|
4786 | * @param pMsiReg MSI registartion structure.
|
---|
4787 | */
|
---|
4788 | DECLINLINE(int) PDMDevHlpPCIRegisterMsi(PPDMDEVINS pDevIns, PPDMMSIREG pMsiReg)
|
---|
4789 | {
|
---|
4790 | return pDevIns->pHlpR3->pfnPCIRegisterMsi(pDevIns, NULL, pMsiReg);
|
---|
4791 | }
|
---|
4792 |
|
---|
4793 | /**
|
---|
4794 | * @copydoc PDMDEVHLPR3::pfnPCIRegisterMsi
|
---|
4795 | */
|
---|
4796 | DECLINLINE(int) PDMDevHlpPCIRegisterMsiEx(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PPDMMSIREG pMsiReg)
|
---|
4797 | {
|
---|
4798 | return pDevIns->pHlpR3->pfnPCIRegisterMsi(pDevIns, pPciDev, pMsiReg);
|
---|
4799 | }
|
---|
4800 |
|
---|
4801 | /**
|
---|
4802 | * @copydoc PDMDEVHLPR3::pfnPCISetConfigCallbacks
|
---|
4803 | */
|
---|
4804 | DECLINLINE(void) PDMDevHlpPCISetConfigCallbacks(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev,
|
---|
4805 | PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld,
|
---|
4806 | PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld)
|
---|
4807 | {
|
---|
4808 | pDevIns->pHlpR3->pfnPCISetConfigCallbacks(pDevIns, pPciDev, pfnRead, ppfnReadOld, pfnWrite, ppfnWriteOld);
|
---|
4809 | }
|
---|
4810 |
|
---|
4811 | #endif /* IN_RING3 */
|
---|
4812 |
|
---|
4813 | /**
|
---|
4814 | * Bus master physical memory read from the default PCI device.
|
---|
4815 | *
|
---|
4816 | * @returns VINF_SUCCESS or VERR_PGM_PCI_PHYS_READ_BM_DISABLED, later maybe
|
---|
4817 | * VERR_EM_MEMORY. The informational status shall NOT be propagated!
|
---|
4818 | * @param pDevIns The device instance.
|
---|
4819 | * @param GCPhys Physical address start reading from.
|
---|
4820 | * @param pvBuf Where to put the read bits.
|
---|
4821 | * @param cbRead How many bytes to read.
|
---|
4822 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
4823 | */
|
---|
4824 | DECLINLINE(int) PDMDevHlpPCIPhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
|
---|
4825 | {
|
---|
4826 | return pDevIns->CTX_SUFF(pHlp)->pfnPCIPhysRead(pDevIns, NULL, GCPhys, pvBuf, cbRead);
|
---|
4827 | }
|
---|
4828 |
|
---|
4829 | /**
|
---|
4830 | * @copydoc PDMDEVHLPR3::pfnPCIPhysRead
|
---|
4831 | */
|
---|
4832 | DECLINLINE(int) PDMDevHlpPCIPhysReadEx(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
|
---|
4833 | {
|
---|
4834 | return pDevIns->CTX_SUFF(pHlp)->pfnPCIPhysRead(pDevIns, pPciDev, GCPhys, pvBuf, cbRead);
|
---|
4835 | }
|
---|
4836 |
|
---|
4837 | /**
|
---|
4838 | * Bus master physical memory write from the default PCI device.
|
---|
4839 | *
|
---|
4840 | * @returns VINF_SUCCESS or VERR_PGM_PCI_PHYS_WRITE_BM_DISABLED, later maybe
|
---|
4841 | * VERR_EM_MEMORY. The informational status shall NOT be propagated!
|
---|
4842 | * @param pDevIns The device instance.
|
---|
4843 | * @param GCPhys Physical address to write to.
|
---|
4844 | * @param pvBuf What to write.
|
---|
4845 | * @param cbWrite How many bytes to write.
|
---|
4846 | * @thread Any thread, but the call may involve the emulation thread.
|
---|
4847 | */
|
---|
4848 | DECLINLINE(int) PDMDevHlpPCIPhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
|
---|
4849 | {
|
---|
4850 | return pDevIns->CTX_SUFF(pHlp)->pfnPCIPhysWrite(pDevIns, NULL, GCPhys, pvBuf, cbWrite);
|
---|
4851 | }
|
---|
4852 |
|
---|
4853 | /**
|
---|
4854 | * @copydoc PDMDEVHLPR3::pfnPCIPhysWrite
|
---|
4855 | */
|
---|
4856 | DECLINLINE(int) PDMDevHlpPCIPhysWriteEx(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
|
---|
4857 | {
|
---|
4858 | return pDevIns->CTX_SUFF(pHlp)->pfnPCIPhysWrite(pDevIns, pPciDev, GCPhys, pvBuf, cbWrite);
|
---|
4859 | }
|
---|
4860 |
|
---|
4861 | /**
|
---|
4862 | * Sets the IRQ for the default PCI device.
|
---|
4863 | *
|
---|
4864 | * @param pDevIns The device instance.
|
---|
4865 | * @param iIrq IRQ number to set.
|
---|
4866 | * @param iLevel IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
|
---|
4867 | * @thread Any thread, but will involve the emulation thread.
|
---|
4868 | */
|
---|
4869 | DECLINLINE(void) PDMDevHlpPCISetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
|
---|
4870 | {
|
---|
4871 | pDevIns->CTX_SUFF(pHlp)->pfnPCISetIrq(pDevIns, NULL, iIrq, iLevel);
|
---|
4872 | }
|
---|
4873 |
|
---|
4874 | /**
|
---|
4875 | * @copydoc PDMDEVHLPR3::pfnPCISetIrq
|
---|
4876 | */
|
---|
4877 | DECLINLINE(void) PDMDevHlpPCISetIrqEx(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel)
|
---|
4878 | {
|
---|
4879 | pDevIns->CTX_SUFF(pHlp)->pfnPCISetIrq(pDevIns, pPciDev, iIrq, iLevel);
|
---|
4880 | }
|
---|
4881 |
|
---|
4882 | /**
|
---|
4883 | * Sets the IRQ for the given PCI device, but doesn't wait for EMT to process
|
---|
4884 | * the request when not called from EMT.
|
---|
4885 | *
|
---|
4886 | * @param pDevIns The device instance.
|
---|
4887 | * @param iIrq IRQ number to set.
|
---|
4888 | * @param iLevel IRQ level.
|
---|
4889 | * @thread Any thread, but will involve the emulation thread.
|
---|
4890 | */
|
---|
4891 | DECLINLINE(void) PDMDevHlpPCISetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel)
|
---|
4892 | {
|
---|
4893 | pDevIns->CTX_SUFF(pHlp)->pfnPCISetIrq(pDevIns, NULL, iIrq, iLevel);
|
---|
4894 | }
|
---|
4895 |
|
---|
4896 | /**
|
---|
4897 | * @copydoc PDMDEVHLPR3::pfnPCISetIrqNoWait
|
---|
4898 | */
|
---|
4899 | DECLINLINE(void) PDMDevHlpPCISetIrqNoWaitEx(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel)
|
---|
4900 | {
|
---|
4901 | pDevIns->CTX_SUFF(pHlp)->pfnPCISetIrq(pDevIns, pPciDev, iIrq, iLevel);
|
---|
4902 | }
|
---|
4903 |
|
---|
4904 | /**
|
---|
4905 | * @copydoc PDMDEVHLPR3::pfnISASetIrq
|
---|
4906 | */
|
---|
4907 | DECLINLINE(void) PDMDevHlpISASetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
|
---|
4908 | {
|
---|
4909 | pDevIns->CTX_SUFF(pHlp)->pfnISASetIrq(pDevIns, iIrq, iLevel);
|
---|
4910 | }
|
---|
4911 |
|
---|
4912 | /**
|
---|
4913 | * @copydoc PDMDEVHLPR3::pfnISASetIrqNoWait
|
---|
4914 | */
|
---|
4915 | DECLINLINE(void) PDMDevHlpISASetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel)
|
---|
4916 | {
|
---|
4917 | pDevIns->CTX_SUFF(pHlp)->pfnISASetIrq(pDevIns, iIrq, iLevel);
|
---|
4918 | }
|
---|
4919 |
|
---|
4920 | #ifdef IN_RING3
|
---|
4921 |
|
---|
4922 | /**
|
---|
4923 | * @copydoc PDMDEVHLPR3::pfnDriverAttach
|
---|
4924 | */
|
---|
4925 | DECLINLINE(int) PDMDevHlpDriverAttach(PPDMDEVINS pDevIns, uint32_t iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc)
|
---|
4926 | {
|
---|
4927 | return pDevIns->pHlpR3->pfnDriverAttach(pDevIns, iLun, pBaseInterface, ppBaseInterface, pszDesc);
|
---|
4928 | }
|
---|
4929 |
|
---|
4930 | /**
|
---|
4931 | * @copydoc PDMDEVHLPR3::pfnDriverDetach
|
---|
4932 | */
|
---|
4933 | DECLINLINE(int) PDMDevHlpDriverDetach(PPDMDEVINS pDevIns, PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
4934 | {
|
---|
4935 | return pDevIns->pHlpR3->pfnDriverDetach(pDevIns, pDrvIns, fFlags);
|
---|
4936 | }
|
---|
4937 |
|
---|
4938 | /**
|
---|
4939 | * @copydoc PDMDEVHLPR3::pfnQueueCreate
|
---|
4940 | */
|
---|
4941 | DECLINLINE(int) PDMDevHlpQueueCreate(PPDMDEVINS pDevIns, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
|
---|
4942 | PFNPDMQUEUEDEV pfnCallback, bool fRZEnabled, const char *pszName, PPDMQUEUE *ppQueue)
|
---|
4943 | {
|
---|
4944 | return pDevIns->pHlpR3->pfnQueueCreate(pDevIns, cbItem, cItems, cMilliesInterval, pfnCallback, fRZEnabled, pszName, ppQueue);
|
---|
4945 | }
|
---|
4946 |
|
---|
4947 | /**
|
---|
4948 | * Initializes a PDM critical section.
|
---|
4949 | *
|
---|
4950 | * The PDM critical sections are derived from the IPRT critical sections, but
|
---|
4951 | * works in RC and R0 as well.
|
---|
4952 | *
|
---|
4953 | * @returns VBox status code.
|
---|
4954 | * @param pDevIns The device instance.
|
---|
4955 | * @param pCritSect Pointer to the critical section.
|
---|
4956 | * @param SRC_POS Use RT_SRC_POS.
|
---|
4957 | * @param pszNameFmt Format string for naming the critical section.
|
---|
4958 | * For statistics and lock validation.
|
---|
4959 | * @param ... Arguments for the format string.
|
---|
4960 | */
|
---|
4961 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(6, 7) PDMDevHlpCritSectInit(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL,
|
---|
4962 | const char *pszNameFmt, ...)
|
---|
4963 | {
|
---|
4964 | int rc;
|
---|
4965 | va_list va;
|
---|
4966 | va_start(va, pszNameFmt);
|
---|
4967 | rc = pDevIns->pHlpR3->pfnCritSectInit(pDevIns, pCritSect, RT_SRC_POS_ARGS, pszNameFmt, va);
|
---|
4968 | va_end(va);
|
---|
4969 | return rc;
|
---|
4970 | }
|
---|
4971 |
|
---|
4972 | /**
|
---|
4973 | * @copydoc PDMDEVHLPR3::pfnCritSectGetNop
|
---|
4974 | */
|
---|
4975 | DECLINLINE(PPDMCRITSECT) PDMDevHlpCritSectGetNop(PPDMDEVINS pDevIns)
|
---|
4976 | {
|
---|
4977 | return pDevIns->pHlpR3->pfnCritSectGetNop(pDevIns);
|
---|
4978 | }
|
---|
4979 |
|
---|
4980 | /**
|
---|
4981 | * @copydoc PDMDEVHLPR3::pfnCritSectGetNopR0
|
---|
4982 | */
|
---|
4983 | DECLINLINE(R0PTRTYPE(PPDMCRITSECT)) PDMDevHlpCritSectGetNopR0(PPDMDEVINS pDevIns)
|
---|
4984 | {
|
---|
4985 | return pDevIns->pHlpR3->pfnCritSectGetNopR0(pDevIns);
|
---|
4986 | }
|
---|
4987 |
|
---|
4988 | /**
|
---|
4989 | * @copydoc PDMDEVHLPR3::pfnCritSectGetNopRC
|
---|
4990 | */
|
---|
4991 | DECLINLINE(RCPTRTYPE(PPDMCRITSECT)) PDMDevHlpCritSectGetNopRC(PPDMDEVINS pDevIns)
|
---|
4992 | {
|
---|
4993 | return pDevIns->pHlpR3->pfnCritSectGetNopRC(pDevIns);
|
---|
4994 | }
|
---|
4995 |
|
---|
4996 | /**
|
---|
4997 | * @copydoc PDMDEVHLPR3::pfnSetDeviceCritSect
|
---|
4998 | */
|
---|
4999 | DECLINLINE(int) PDMDevHlpSetDeviceCritSect(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
|
---|
5000 | {
|
---|
5001 | return pDevIns->pHlpR3->pfnSetDeviceCritSect(pDevIns, pCritSect);
|
---|
5002 | }
|
---|
5003 |
|
---|
5004 | /**
|
---|
5005 | * @copydoc PDMDEVHLPR3::pfnThreadCreate
|
---|
5006 | */
|
---|
5007 | DECLINLINE(int) PDMDevHlpThreadCreate(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
|
---|
5008 | PFNPDMTHREADWAKEUPDEV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
|
---|
5009 | {
|
---|
5010 | return pDevIns->pHlpR3->pfnThreadCreate(pDevIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
|
---|
5011 | }
|
---|
5012 |
|
---|
5013 | /**
|
---|
5014 | * @copydoc PDMDEVHLPR3::pfnSetAsyncNotification
|
---|
5015 | */
|
---|
5016 | DECLINLINE(int) PDMDevHlpSetAsyncNotification(PPDMDEVINS pDevIns, PFNPDMDEVASYNCNOTIFY pfnAsyncNotify)
|
---|
5017 | {
|
---|
5018 | return pDevIns->pHlpR3->pfnSetAsyncNotification(pDevIns, pfnAsyncNotify);
|
---|
5019 | }
|
---|
5020 |
|
---|
5021 | /**
|
---|
5022 | * @copydoc PDMDEVHLPR3::pfnAsyncNotificationCompleted
|
---|
5023 | */
|
---|
5024 | DECLINLINE(void) PDMDevHlpAsyncNotificationCompleted(PPDMDEVINS pDevIns)
|
---|
5025 | {
|
---|
5026 | pDevIns->pHlpR3->pfnAsyncNotificationCompleted(pDevIns);
|
---|
5027 | }
|
---|
5028 |
|
---|
5029 | /**
|
---|
5030 | * @copydoc PDMDEVHLPR3::pfnA20Set
|
---|
5031 | */
|
---|
5032 | DECLINLINE(void) PDMDevHlpA20Set(PPDMDEVINS pDevIns, bool fEnable)
|
---|
5033 | {
|
---|
5034 | pDevIns->pHlpR3->pfnA20Set(pDevIns, fEnable);
|
---|
5035 | }
|
---|
5036 |
|
---|
5037 | /**
|
---|
5038 | * @copydoc PDMDEVHLPR3::pfnRTCRegister
|
---|
5039 | */
|
---|
5040 | DECLINLINE(int) PDMDevHlpRTCRegister(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp)
|
---|
5041 | {
|
---|
5042 | return pDevIns->pHlpR3->pfnRTCRegister(pDevIns, pRtcReg, ppRtcHlp);
|
---|
5043 | }
|
---|
5044 |
|
---|
5045 | /**
|
---|
5046 | * @copydoc PDMDEVHLPR3::pfnPCIBusRegister
|
---|
5047 | */
|
---|
5048 | #if PDM_DEVHLPR3_VERSION >= PDM_VERSION_MAKE_PP(0xffe7, 20, 0)
|
---|
5049 | DECLINLINE(int) PDMDevHlpPCIBusRegister(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3, uint32_t *piBus)
|
---|
5050 | {
|
---|
5051 | return pDevIns->pHlpR3->pfnPCIBusRegister(pDevIns, pPciBusReg, ppPciHlpR3, piBus);
|
---|
5052 | }
|
---|
5053 | #else
|
---|
5054 | DECLINLINE(int) PDMDevHlpPCIBusRegister(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3)
|
---|
5055 | {
|
---|
5056 | return pDevIns->pHlpR3->pfnPCIBusRegister(pDevIns, pPciBusReg, ppPciHlpR3);
|
---|
5057 | }
|
---|
5058 | #endif
|
---|
5059 |
|
---|
5060 | /**
|
---|
5061 | * @copydoc PDMDEVHLPR3::pfnPICRegister
|
---|
5062 | */
|
---|
5063 | DECLINLINE(int) PDMDevHlpPICRegister(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3)
|
---|
5064 | {
|
---|
5065 | return pDevIns->pHlpR3->pfnPICRegister(pDevIns, pPicReg, ppPicHlpR3);
|
---|
5066 | }
|
---|
5067 |
|
---|
5068 | /**
|
---|
5069 | * @copydoc PDMDEVHLPR3::pfnAPICRegister
|
---|
5070 | */
|
---|
5071 | DECLINLINE(int) PDMDevHlpAPICRegister(PPDMDEVINS pDevIns)
|
---|
5072 | {
|
---|
5073 | return pDevIns->pHlpR3->pfnAPICRegister(pDevIns);
|
---|
5074 | }
|
---|
5075 |
|
---|
5076 | /**
|
---|
5077 | * @copydoc PDMDEVHLPR3::pfnIOAPICRegister
|
---|
5078 | */
|
---|
5079 | DECLINLINE(int) PDMDevHlpIOAPICRegister(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3)
|
---|
5080 | {
|
---|
5081 | return pDevIns->pHlpR3->pfnIOAPICRegister(pDevIns, pIoApicReg, ppIoApicHlpR3);
|
---|
5082 | }
|
---|
5083 |
|
---|
5084 | /**
|
---|
5085 | * @copydoc PDMDEVHLPR3::pfnHPETRegister
|
---|
5086 | */
|
---|
5087 | DECLINLINE(int) PDMDevHlpHPETRegister(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3)
|
---|
5088 | {
|
---|
5089 | return pDevIns->pHlpR3->pfnHPETRegister(pDevIns, pHpetReg, ppHpetHlpR3);
|
---|
5090 | }
|
---|
5091 |
|
---|
5092 | /**
|
---|
5093 | * @copydoc PDMDEVHLPR3::pfnPciRawRegister
|
---|
5094 | */
|
---|
5095 | DECLINLINE(int) PDMDevHlpPciRawRegister(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3)
|
---|
5096 | {
|
---|
5097 | return pDevIns->pHlpR3->pfnPciRawRegister(pDevIns, pPciRawReg, ppPciRawHlpR3);
|
---|
5098 | }
|
---|
5099 |
|
---|
5100 | /**
|
---|
5101 | * @copydoc PDMDEVHLPR3::pfnDMACRegister
|
---|
5102 | */
|
---|
5103 | DECLINLINE(int) PDMDevHlpDMACRegister(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp)
|
---|
5104 | {
|
---|
5105 | return pDevIns->pHlpR3->pfnDMACRegister(pDevIns, pDmacReg, ppDmacHlp);
|
---|
5106 | }
|
---|
5107 |
|
---|
5108 | /**
|
---|
5109 | * @copydoc PDMDEVHLPR3::pfnDMARegister
|
---|
5110 | */
|
---|
5111 | DECLINLINE(int) PDMDevHlpDMARegister(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser)
|
---|
5112 | {
|
---|
5113 | return pDevIns->pHlpR3->pfnDMARegister(pDevIns, uChannel, pfnTransferHandler, pvUser);
|
---|
5114 | }
|
---|
5115 |
|
---|
5116 | /**
|
---|
5117 | * @copydoc PDMDEVHLPR3::pfnDMAReadMemory
|
---|
5118 | */
|
---|
5119 | DECLINLINE(int) PDMDevHlpDMAReadMemory(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead)
|
---|
5120 | {
|
---|
5121 | return pDevIns->pHlpR3->pfnDMAReadMemory(pDevIns, uChannel, pvBuffer, off, cbBlock, pcbRead);
|
---|
5122 | }
|
---|
5123 |
|
---|
5124 | /**
|
---|
5125 | * @copydoc PDMDEVHLPR3::pfnDMAWriteMemory
|
---|
5126 | */
|
---|
5127 | DECLINLINE(int) PDMDevHlpDMAWriteMemory(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten)
|
---|
5128 | {
|
---|
5129 | return pDevIns->pHlpR3->pfnDMAWriteMemory(pDevIns, uChannel, pvBuffer, off, cbBlock, pcbWritten);
|
---|
5130 | }
|
---|
5131 |
|
---|
5132 | /**
|
---|
5133 | * @copydoc PDMDEVHLPR3::pfnDMASetDREQ
|
---|
5134 | */
|
---|
5135 | DECLINLINE(int) PDMDevHlpDMASetDREQ(PPDMDEVINS pDevIns, unsigned uChannel, unsigned uLevel)
|
---|
5136 | {
|
---|
5137 | return pDevIns->pHlpR3->pfnDMASetDREQ(pDevIns, uChannel, uLevel);
|
---|
5138 | }
|
---|
5139 |
|
---|
5140 | /**
|
---|
5141 | * @copydoc PDMDEVHLPR3::pfnDMAGetChannelMode
|
---|
5142 | */
|
---|
5143 | DECLINLINE(uint8_t) PDMDevHlpDMAGetChannelMode(PPDMDEVINS pDevIns, unsigned uChannel)
|
---|
5144 | {
|
---|
5145 | return pDevIns->pHlpR3->pfnDMAGetChannelMode(pDevIns, uChannel);
|
---|
5146 | }
|
---|
5147 |
|
---|
5148 | /**
|
---|
5149 | * @copydoc PDMDEVHLPR3::pfnDMASchedule
|
---|
5150 | */
|
---|
5151 | DECLINLINE(void) PDMDevHlpDMASchedule(PPDMDEVINS pDevIns)
|
---|
5152 | {
|
---|
5153 | pDevIns->pHlpR3->pfnDMASchedule(pDevIns);
|
---|
5154 | }
|
---|
5155 |
|
---|
5156 | /**
|
---|
5157 | * @copydoc PDMDEVHLPR3::pfnCMOSWrite
|
---|
5158 | */
|
---|
5159 | DECLINLINE(int) PDMDevHlpCMOSWrite(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value)
|
---|
5160 | {
|
---|
5161 | return pDevIns->pHlpR3->pfnCMOSWrite(pDevIns, iReg, u8Value);
|
---|
5162 | }
|
---|
5163 |
|
---|
5164 | /**
|
---|
5165 | * @copydoc PDMDEVHLPR3::pfnCMOSRead
|
---|
5166 | */
|
---|
5167 | DECLINLINE(int) PDMDevHlpCMOSRead(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value)
|
---|
5168 | {
|
---|
5169 | return pDevIns->pHlpR3->pfnCMOSRead(pDevIns, iReg, pu8Value);
|
---|
5170 | }
|
---|
5171 |
|
---|
5172 | /**
|
---|
5173 | * @copydoc PDMDEVHLPR3::pfnCallR0
|
---|
5174 | */
|
---|
5175 | DECLINLINE(int) PDMDevHlpCallR0(PPDMDEVINS pDevIns, uint32_t uOperation, uint64_t u64Arg)
|
---|
5176 | {
|
---|
5177 | return pDevIns->pHlpR3->pfnCallR0(pDevIns, uOperation, u64Arg);
|
---|
5178 | }
|
---|
5179 |
|
---|
5180 | /**
|
---|
5181 | * @copydoc PDMDEVHLPR3::pfnVMGetSuspendReason
|
---|
5182 | */
|
---|
5183 | DECLINLINE(VMSUSPENDREASON) PDMDevHlpVMGetSuspendReason(PPDMDEVINS pDevIns)
|
---|
5184 | {
|
---|
5185 | return pDevIns->pHlpR3->pfnVMGetSuspendReason(pDevIns);
|
---|
5186 | }
|
---|
5187 |
|
---|
5188 | /**
|
---|
5189 | * @copydoc PDMDEVHLPR3::pfnVMGetResumeReason
|
---|
5190 | */
|
---|
5191 | DECLINLINE(VMRESUMEREASON) PDMDevHlpVMGetResumeReason(PPDMDEVINS pDevIns)
|
---|
5192 | {
|
---|
5193 | return pDevIns->pHlpR3->pfnVMGetResumeReason(pDevIns);
|
---|
5194 | }
|
---|
5195 |
|
---|
5196 | /**
|
---|
5197 | * @copydoc PDMDEVHLPR3::pfnGetUVM
|
---|
5198 | */
|
---|
5199 | DECLINLINE(PUVM) PDMDevHlpGetUVM(PPDMDEVINS pDevIns)
|
---|
5200 | {
|
---|
5201 | return pDevIns->CTX_SUFF(pHlp)->pfnGetUVM(pDevIns);
|
---|
5202 | }
|
---|
5203 |
|
---|
5204 | #endif /* IN_RING3 */
|
---|
5205 |
|
---|
5206 | /**
|
---|
5207 | * @copydoc PDMDEVHLPR3::pfnGetVM
|
---|
5208 | */
|
---|
5209 | DECLINLINE(PVM) PDMDevHlpGetVM(PPDMDEVINS pDevIns)
|
---|
5210 | {
|
---|
5211 | return pDevIns->CTX_SUFF(pHlp)->pfnGetVM(pDevIns);
|
---|
5212 | }
|
---|
5213 |
|
---|
5214 | /**
|
---|
5215 | * @copydoc PDMDEVHLPR3::pfnGetVMCPU
|
---|
5216 | */
|
---|
5217 | DECLINLINE(PVMCPU) PDMDevHlpGetVMCPU(PPDMDEVINS pDevIns)
|
---|
5218 | {
|
---|
5219 | return pDevIns->CTX_SUFF(pHlp)->pfnGetVMCPU(pDevIns);
|
---|
5220 | }
|
---|
5221 |
|
---|
5222 | /**
|
---|
5223 | * @copydoc PDMDEVHLPR3::pfnGetCurrentCpuId
|
---|
5224 | */
|
---|
5225 | DECLINLINE(VMCPUID) PDMDevHlpGetCurrentCpuId(PPDMDEVINS pDevIns)
|
---|
5226 | {
|
---|
5227 | return pDevIns->CTX_SUFF(pHlp)->pfnGetCurrentCpuId(pDevIns);
|
---|
5228 | }
|
---|
5229 |
|
---|
5230 | /**
|
---|
5231 | * @copydoc PDMDEVHLPR3::pfnTMTimeVirtGet
|
---|
5232 | */
|
---|
5233 | DECLINLINE(uint64_t) PDMDevHlpTMTimeVirtGet(PPDMDEVINS pDevIns)
|
---|
5234 | {
|
---|
5235 | return pDevIns->CTX_SUFF(pHlp)->pfnTMTimeVirtGet(pDevIns);
|
---|
5236 | }
|
---|
5237 |
|
---|
5238 | /**
|
---|
5239 | * @copydoc PDMDEVHLPR3::pfnTMTimeVirtGetFreq
|
---|
5240 | */
|
---|
5241 | DECLINLINE(uint64_t) PDMDevHlpTMTimeVirtGetFreq(PPDMDEVINS pDevIns)
|
---|
5242 | {
|
---|
5243 | return pDevIns->CTX_SUFF(pHlp)->pfnTMTimeVirtGetFreq(pDevIns);
|
---|
5244 | }
|
---|
5245 |
|
---|
5246 | /**
|
---|
5247 | * @copydoc PDMDEVHLPR3::pfnTMTimeVirtGetFreq
|
---|
5248 | */
|
---|
5249 | DECLINLINE(uint64_t) PDMDevHlpTMTimeVirtGetNano(PPDMDEVINS pDevIns)
|
---|
5250 | {
|
---|
5251 | return pDevIns->CTX_SUFF(pHlp)->pfnTMTimeVirtGetNano(pDevIns);
|
---|
5252 | }
|
---|
5253 |
|
---|
5254 | #ifdef IN_RING3
|
---|
5255 |
|
---|
5256 | /**
|
---|
5257 | * @copydoc PDMDEVHLPR3::pfnRegisterVMMDevHeap
|
---|
5258 | */
|
---|
5259 | DECLINLINE(int) PDMDevHlpRegisterVMMDevHeap(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbHeap)
|
---|
5260 | {
|
---|
5261 | return pDevIns->pHlpR3->pfnRegisterVMMDevHeap(pDevIns, GCPhys, pvHeap, cbHeap);
|
---|
5262 | }
|
---|
5263 |
|
---|
5264 | /**
|
---|
5265 | * @copydoc PDMDEVHLPR3::pfnFirmwareRegister
|
---|
5266 | */
|
---|
5267 | DECLINLINE(int) PDMDevHlpFirmwareRegister(PPDMDEVINS pDevIns, PCPDMFWREG pFwReg, PCPDMFWHLPR3 *ppFwHlp)
|
---|
5268 | {
|
---|
5269 | return pDevIns->pHlpR3->pfnFirmwareRegister(pDevIns, pFwReg, ppFwHlp);
|
---|
5270 | }
|
---|
5271 |
|
---|
5272 | /**
|
---|
5273 | * @copydoc PDMDEVHLPR3::pfnVMReset
|
---|
5274 | */
|
---|
5275 | DECLINLINE(int) PDMDevHlpVMReset(PPDMDEVINS pDevIns, uint32_t fFlags)
|
---|
5276 | {
|
---|
5277 | return pDevIns->pHlpR3->pfnVMReset(pDevIns, fFlags);
|
---|
5278 | }
|
---|
5279 |
|
---|
5280 | /**
|
---|
5281 | * @copydoc PDMDEVHLPR3::pfnVMSuspend
|
---|
5282 | */
|
---|
5283 | DECLINLINE(int) PDMDevHlpVMSuspend(PPDMDEVINS pDevIns)
|
---|
5284 | {
|
---|
5285 | return pDevIns->pHlpR3->pfnVMSuspend(pDevIns);
|
---|
5286 | }
|
---|
5287 |
|
---|
5288 | /**
|
---|
5289 | * @copydoc PDMDEVHLPR3::pfnVMSuspendSaveAndPowerOff
|
---|
5290 | */
|
---|
5291 | DECLINLINE(int) PDMDevHlpVMSuspendSaveAndPowerOff(PPDMDEVINS pDevIns)
|
---|
5292 | {
|
---|
5293 | return pDevIns->pHlpR3->pfnVMSuspendSaveAndPowerOff(pDevIns);
|
---|
5294 | }
|
---|
5295 |
|
---|
5296 | /**
|
---|
5297 | * @copydoc PDMDEVHLPR3::pfnVMPowerOff
|
---|
5298 | */
|
---|
5299 | DECLINLINE(int) PDMDevHlpVMPowerOff(PPDMDEVINS pDevIns)
|
---|
5300 | {
|
---|
5301 | return pDevIns->pHlpR3->pfnVMPowerOff(pDevIns);
|
---|
5302 | }
|
---|
5303 |
|
---|
5304 | #endif /* IN_RING3 */
|
---|
5305 |
|
---|
5306 | /**
|
---|
5307 | * @copydoc PDMDEVHLPR3::pfnA20IsEnabled
|
---|
5308 | */
|
---|
5309 | DECLINLINE(bool) PDMDevHlpA20IsEnabled(PPDMDEVINS pDevIns)
|
---|
5310 | {
|
---|
5311 | return pDevIns->CTX_SUFF(pHlp)->pfnA20IsEnabled(pDevIns);
|
---|
5312 | }
|
---|
5313 |
|
---|
5314 | #ifdef IN_RING3
|
---|
5315 |
|
---|
5316 | /**
|
---|
5317 | * @copydoc PDMDEVHLPR3::pfnGetCpuId
|
---|
5318 | */
|
---|
5319 | DECLINLINE(void) PDMDevHlpGetCpuId(PPDMDEVINS pDevIns, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
|
---|
5320 | {
|
---|
5321 | pDevIns->pHlpR3->pfnGetCpuId(pDevIns, iLeaf, pEax, pEbx, pEcx, pEdx);
|
---|
5322 | }
|
---|
5323 |
|
---|
5324 | /**
|
---|
5325 | * @copydoc PDMDEVHLPR3::pfnGetSupDrvSession
|
---|
5326 | */
|
---|
5327 | DECLINLINE(PSUPDRVSESSION) PDMDevHlpGetSupDrvSession(PPDMDEVINS pDevIns)
|
---|
5328 | {
|
---|
5329 | return pDevIns->pHlpR3->pfnGetSupDrvSession(pDevIns);
|
---|
5330 | }
|
---|
5331 |
|
---|
5332 | #endif /* IN_RING3 */
|
---|
5333 | #ifdef IN_RING0
|
---|
5334 |
|
---|
5335 | /**
|
---|
5336 | * @copydoc PDMDEVHLPR0::pfnCanEmulateIoBlock
|
---|
5337 | */
|
---|
5338 | DECLINLINE(bool) PDMDevHlpCanEmulateIoBlock(PPDMDEVINS pDevIns)
|
---|
5339 | {
|
---|
5340 | return pDevIns->CTX_SUFF(pHlp)->pfnCanEmulateIoBlock(pDevIns);
|
---|
5341 | }
|
---|
5342 |
|
---|
5343 | #endif /* IN_RING0 */
|
---|
5344 |
|
---|
5345 |
|
---|
5346 |
|
---|
5347 |
|
---|
5348 | /** Pointer to callbacks provided to the VBoxDeviceRegister() call. */
|
---|
5349 | typedef struct PDMDEVREGCB *PPDMDEVREGCB;
|
---|
5350 |
|
---|
5351 | /**
|
---|
5352 | * Callbacks for VBoxDeviceRegister().
|
---|
5353 | */
|
---|
5354 | typedef struct PDMDEVREGCB
|
---|
5355 | {
|
---|
5356 | /** Interface version.
|
---|
5357 | * This is set to PDM_DEVREG_CB_VERSION. */
|
---|
5358 | uint32_t u32Version;
|
---|
5359 |
|
---|
5360 | /**
|
---|
5361 | * Registers a device with the current VM instance.
|
---|
5362 | *
|
---|
5363 | * @returns VBox status code.
|
---|
5364 | * @param pCallbacks Pointer to the callback table.
|
---|
5365 | * @param pReg Pointer to the device registration record.
|
---|
5366 | * This data must be permanent and readonly.
|
---|
5367 | */
|
---|
5368 | DECLR3CALLBACKMEMBER(int, pfnRegister,(PPDMDEVREGCB pCallbacks, PCPDMDEVREG pReg));
|
---|
5369 | } PDMDEVREGCB;
|
---|
5370 |
|
---|
5371 | /** Current version of the PDMDEVREGCB structure. */
|
---|
5372 | #define PDM_DEVREG_CB_VERSION PDM_VERSION_MAKE(0xffe3, 1, 0)
|
---|
5373 |
|
---|
5374 |
|
---|
5375 | /**
|
---|
5376 | * The VBoxDevicesRegister callback function.
|
---|
5377 | *
|
---|
5378 | * PDM will invoke this function after loading a device module and letting
|
---|
5379 | * the module decide which devices to register and how to handle conflicts.
|
---|
5380 | *
|
---|
5381 | * @returns VBox status code.
|
---|
5382 | * @param pCallbacks Pointer to the callback table.
|
---|
5383 | * @param u32Version VBox version number.
|
---|
5384 | */
|
---|
5385 | typedef DECLCALLBACK(int) FNPDMVBOXDEVICESREGISTER(PPDMDEVREGCB pCallbacks, uint32_t u32Version);
|
---|
5386 |
|
---|
5387 | /** @} */
|
---|
5388 |
|
---|
5389 | RT_C_DECLS_END
|
---|
5390 |
|
---|
5391 | #endif
|
---|