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