VirtualBox

source: vbox/trunk/include/VBox/vmm/iom.h@ 82842

Last change on this file since 82842 was 82313, checked in by vboxsync, 5 years ago

IOM,PDMDevHlp: Kicked out the old MMIO code. bugref:9218

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.7 KB
Line 
1/** @file
2 * IOM - Input / Output Monitor.
3 */
4
5/*
6 * Copyright (C) 2006-2019 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_INCLUDED_vmm_iom_h
27#define VBOX_INCLUDED_vmm_iom_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <VBox/types.h>
33#include <VBox/dis.h>
34#include <VBox/vmm/dbgf.h>
35
36RT_C_DECLS_BEGIN
37
38
39/** @defgroup grp_iom The Input / Ouput Monitor API
40 * @ingroup grp_vmm
41 * @{
42 */
43
44/** @def IOM_NO_PDMINS_CHECKS
45 * Until all devices have been fully adjusted to PDM style, the pPdmIns
46 * parameter is not checked by IOM.
47 * @todo Check this again, now.
48 */
49#define IOM_NO_PDMINS_CHECKS
50
51/**
52 * Macro for checking if an I/O or MMIO emulation call succeeded.
53 *
54 * This macro shall only be used with the IOM APIs where it's mentioned
55 * in the return value description. And there it must be used to correctly
56 * determine if the call succeeded and things like the RIP needs updating.
57 *
58 *
59 * @returns Success indicator (true/false).
60 *
61 * @param rc The status code. This may be evaluated
62 * more than once!
63 *
64 * @remarks To avoid making assumptions about the layout of the
65 * VINF_EM_FIRST...VINF_EM_LAST range we're checking explicitly for
66 * each exact exception. However, for efficiency we ASSUME that the
67 * VINF_EM_LAST is smaller than most of the relevant status codes. We
68 * also ASSUME that the VINF_EM_RESCHEDULE_REM status code is the
69 * most frequent status code we'll enounter in this range.
70 *
71 * @todo Will have to add VINF_EM_DBG_HYPER_BREAKPOINT if the
72 * I/O port and MMIO breakpoints should trigger before
73 * the I/O is done. Currently, we don't implement these
74 * kind of breakpoints.
75 */
76#ifdef IN_RING3
77# define IOM_SUCCESS(rc) ( (rc) == VINF_SUCCESS \
78 || ( (rc) <= VINF_EM_LAST \
79 && (rc) != VINF_EM_RESCHEDULE_REM \
80 && (rc) >= VINF_EM_FIRST \
81 && (rc) != VINF_EM_RESCHEDULE_RAW \
82 && (rc) != VINF_EM_RESCHEDULE_HM \
83 ) \
84 )
85#else
86# define IOM_SUCCESS(rc) ( (rc) == VINF_SUCCESS \
87 || ( (rc) <= VINF_EM_LAST \
88 && (rc) != VINF_EM_RESCHEDULE_REM \
89 && (rc) >= VINF_EM_FIRST \
90 && (rc) != VINF_EM_RESCHEDULE_RAW \
91 && (rc) != VINF_EM_RESCHEDULE_HM \
92 ) \
93 || (rc) == VINF_IOM_R3_IOPORT_COMMIT_WRITE \
94 || (rc) == VINF_IOM_R3_MMIO_COMMIT_WRITE \
95 )
96#endif
97
98/** @name IOMMMIO_FLAGS_XXX
99 * @{ */
100/** Pass all reads thru unmodified. */
101#define IOMMMIO_FLAGS_READ_PASSTHRU UINT32_C(0x00000000)
102/** All read accesses are DWORD sized (32-bit). */
103#define IOMMMIO_FLAGS_READ_DWORD UINT32_C(0x00000001)
104/** All read accesses are DWORD (32-bit) or QWORD (64-bit) sized.
105 * Only accesses that are both QWORD sized and aligned are performed as QWORD.
106 * All other access will be done DWORD fashion (because it is way simpler). */
107#define IOMMMIO_FLAGS_READ_DWORD_QWORD UINT32_C(0x00000002)
108/** The read access mode mask. */
109#define IOMMMIO_FLAGS_READ_MODE UINT32_C(0x00000003)
110
111/** Pass all writes thru unmodified. */
112#define IOMMMIO_FLAGS_WRITE_PASSTHRU UINT32_C(0x00000000)
113/** All write accesses are DWORD (32-bit) sized and unspecified bytes are
114 * written as zero. */
115#define IOMMMIO_FLAGS_WRITE_DWORD_ZEROED UINT32_C(0x00000010)
116/** All write accesses are either DWORD (32-bit) or QWORD (64-bit) sized,
117 * missing bytes will be written as zero. Only accesses that are both QWORD
118 * sized and aligned are performed as QWORD, all other accesses will be done
119 * DWORD fashion (because it's way simpler). */
120#define IOMMMIO_FLAGS_WRITE_DWORD_QWORD_ZEROED UINT32_C(0x00000020)
121/** All write accesses are DWORD (32-bit) sized and unspecified bytes are
122 * read from the device first as DWORDs.
123 * @remarks This isn't how it happens on real hardware, but it allows
124 * simplifications of devices where reads doesn't change the device
125 * state in any way. */
126#define IOMMMIO_FLAGS_WRITE_DWORD_READ_MISSING UINT32_C(0x00000030)
127/** All write accesses are DWORD (32-bit) or QWORD (64-bit) sized and
128 * unspecified bytes are read from the device first as DWORDs. Only accesses
129 * that are both QWORD sized and aligned are performed as QWORD, all other
130 * accesses will be done DWORD fashion (because it's way simpler).
131 * @remarks This isn't how it happens on real hardware, but it allows
132 * simplifications of devices where reads doesn't change the device
133 * state in any way. */
134#define IOMMMIO_FLAGS_WRITE_DWORD_QWORD_READ_MISSING UINT32_C(0x00000040)
135/** All write accesses are DWORD (32-bit) sized and aligned, attempts at other
136 * accesses are ignored.
137 * @remarks E1000, APIC */
138#define IOMMMIO_FLAGS_WRITE_ONLY_DWORD UINT32_C(0x00000050)
139/** All write accesses are DWORD (32-bit) or QWORD (64-bit) sized and aligned,
140 * attempts at other accesses are ignored.
141 * @remarks Seemingly required by AHCI (although I doubt it's _really_
142 * required as EM/REM doesn't do the right thing in ring-3 anyway,
143 * esp. not in raw-mode). */
144#define IOMMMIO_FLAGS_WRITE_ONLY_DWORD_QWORD UINT32_C(0x00000060)
145/** The read access mode mask. */
146#define IOMMMIO_FLAGS_WRITE_MODE UINT32_C(0x00000070)
147
148/** Whether to do a DBGSTOP on complicated reads.
149 * What this includes depends on the read mode, but generally all misaligned
150 * reads as well as word and byte reads and maybe qword reads. */
151#define IOMMMIO_FLAGS_DBGSTOP_ON_COMPLICATED_READ UINT32_C(0x00000100)
152/** Whether to do a DBGSTOP on complicated writes.
153 * This depends on the write mode, but generally all writes where we have to
154 * supply bytes (zero them or read them). */
155#define IOMMMIO_FLAGS_DBGSTOP_ON_COMPLICATED_WRITE UINT32_C(0x00000200)
156
157/** Pass the absolute physical address (GC) to the callback rather than the
158 * relative one.
159 * @note New-style only, is implicit in old-style interface. */
160#define IOMMMIO_FLAGS_ABS UINT32_C(0x00001000)
161
162/** Mask of valid flags. */
163#define IOMMMIO_FLAGS_VALID_MASK UINT32_C(0x00001373)
164/** @} */
165
166/**
167 * Checks whether the write mode allows aligned QWORD accesses to be passed
168 * thru to the device handler.
169 * @param a_fFlags The MMIO handler flags.
170 */
171#define IOMMMIO_DOES_WRITE_MODE_ALLOW_QWORD(a_fFlags) \
172 ( ((a_fFlags) & IOMMMIO_FLAGS_WRITE_MODE) == IOMMMIO_FLAGS_WRITE_DWORD_QWORD_ZEROED \
173 || ((a_fFlags) & IOMMMIO_FLAGS_WRITE_MODE) == IOMMMIO_FLAGS_WRITE_DWORD_QWORD_READ_MISSING \
174 || ((a_fFlags) & IOMMMIO_FLAGS_WRITE_MODE) == IOMMMIO_FLAGS_WRITE_ONLY_DWORD_QWORD )
175
176
177/**
178 * Port I/O Handler for IN operations.
179 *
180 * @returns VINF_SUCCESS or VINF_EM_*.
181 * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
182 *
183 * @param pDevIns The device instance.
184 * @param pvUser User argument.
185 * @param uPort Port number used for the IN operation.
186 * @param pu32 Where to store the result. This is always a 32-bit
187 * variable regardless of what @a cb might say.
188 * @param cb Number of bytes read.
189 * @remarks Caller enters the device critical section.
190 */
191typedef DECLCALLBACK(int) FNIOMIOPORTIN(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t *pu32, unsigned cb);
192/** Pointer to a FNIOMIOPORTIN(). */
193typedef FNIOMIOPORTIN *PFNIOMIOPORTIN;
194
195/**
196 * Port I/O Handler for string IN operations.
197 *
198 * @returns VINF_SUCCESS or VINF_EM_*.
199 * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
200 *
201 * @param pDevIns The device instance.
202 * @param pvUser User argument.
203 * @param uPort Port number used for the IN operation.
204 * @param pbDst Pointer to the destination buffer.
205 * @param pcTransfers Pointer to the number of transfer units to read, on
206 * return remaining transfer units.
207 * @param cb Size of the transfer unit (1, 2 or 4 bytes).
208 * @remarks Caller enters the device critical section.
209 */
210typedef DECLCALLBACK(int) FNIOMIOPORTINSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint8_t *pbDst,
211 uint32_t *pcTransfers, unsigned cb);
212/** Pointer to a FNIOMIOPORTINSTRING(). */
213typedef FNIOMIOPORTINSTRING *PFNIOMIOPORTINSTRING;
214
215/**
216 * Port I/O Handler for OUT operations.
217 *
218 * @returns VINF_SUCCESS or VINF_EM_*.
219 *
220 * @param pDevIns The device instance.
221 * @param pvUser User argument.
222 * @param uPort Port number used for the OUT operation.
223 * @param u32 The value to output.
224 * @param cb The value size in bytes.
225 * @remarks Caller enters the device critical section.
226 */
227typedef DECLCALLBACK(int) FNIOMIOPORTOUT(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, uint32_t u32, unsigned cb);
228/** Pointer to a FNIOMIOPORTOUT(). */
229typedef FNIOMIOPORTOUT *PFNIOMIOPORTOUT;
230
231/**
232 * Port I/O Handler for string OUT operations.
233 *
234 * @returns VINF_SUCCESS or VINF_EM_*.
235 *
236 * @param pDevIns The device instance.
237 * @param pvUser User argument.
238 * @param uPort Port number used for the OUT operation.
239 * @param pbSrc Pointer to the source buffer.
240 * @param pcTransfers Pointer to the number of transfer units to write, on
241 * return remaining transfer units.
242 * @param cb Size of the transfer unit (1, 2 or 4 bytes).
243 * @remarks Caller enters the device critical section.
244 */
245typedef DECLCALLBACK(int) FNIOMIOPORTOUTSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT uPort, const uint8_t *pbSrc,
246 uint32_t *pcTransfers, unsigned cb);
247/** Pointer to a FNIOMIOPORTOUTSTRING(). */
248typedef FNIOMIOPORTOUTSTRING *PFNIOMIOPORTOUTSTRING;
249
250
251/**
252 * Port I/O Handler for IN operations.
253 *
254 * @returns VINF_SUCCESS or VINF_EM_*.
255 * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
256 *
257 * @param pDevIns The device instance.
258 * @param pvUser User argument.
259 * @param offPort The port number if IOM_IOPORT_F_ABS is used, otherwise
260 * relative to the mapping base.
261 * @param pu32 Where to store the result. This is always a 32-bit
262 * variable regardless of what @a cb might say.
263 * @param cb Number of bytes read.
264 * @remarks Caller enters the device critical section.
265 */
266typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMIOPORTNEWIN(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb);
267/** Pointer to a FNIOMIOPORTNEWIN(). */
268typedef FNIOMIOPORTNEWIN *PFNIOMIOPORTNEWIN;
269
270/**
271 * Port I/O Handler for string IN operations.
272 *
273 * @returns VINF_SUCCESS or VINF_EM_*.
274 * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
275 *
276 * @param pDevIns The device instance.
277 * @param pvUser User argument.
278 * @param offPort The port number if IOM_IOPORT_F_ABS is used, otherwise
279 * relative to the mapping base.
280 * @param pbDst Pointer to the destination buffer.
281 * @param pcTransfers Pointer to the number of transfer units to read, on
282 * return remaining transfer units.
283 * @param cb Size of the transfer unit (1, 2 or 4 bytes).
284 * @remarks Caller enters the device critical section.
285 */
286typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMIOPORTNEWINSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint8_t *pbDst,
287 uint32_t *pcTransfers, unsigned cb);
288/** Pointer to a FNIOMIOPORTNEWINSTRING(). */
289typedef FNIOMIOPORTNEWINSTRING *PFNIOMIOPORTNEWINSTRING;
290
291/**
292 * Port I/O Handler for OUT operations.
293 *
294 * @returns VINF_SUCCESS or VINF_EM_*.
295 *
296 * @param pDevIns The device instance.
297 * @param pvUser User argument.
298 * @param offPort The port number if IOM_IOPORT_F_ABS is used, otherwise
299 * relative to the mapping base.
300 * @param u32 The value to output.
301 * @param cb The value size in bytes.
302 * @remarks Caller enters the device critical section.
303 */
304typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMIOPORTNEWOUT(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb);
305/** Pointer to a FNIOMIOPORTNEWOUT(). */
306typedef FNIOMIOPORTNEWOUT *PFNIOMIOPORTNEWOUT;
307
308/**
309 * Port I/O Handler for string OUT operations.
310 *
311 * @returns VINF_SUCCESS or VINF_EM_*.
312 *
313 * @param pDevIns The device instance.
314 * @param pvUser User argument.
315 * @param offPort The port number if IOM_IOPORT_F_ABS is used, otherwise
316 * relative to the mapping base.
317 * @param pbSrc Pointer to the source buffer.
318 * @param pcTransfers Pointer to the number of transfer units to write, on
319 * return remaining transfer units.
320 * @param cb Size of the transfer unit (1, 2 or 4 bytes).
321 * @remarks Caller enters the device critical section.
322 */
323typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMIOPORTNEWOUTSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, const uint8_t *pbSrc,
324 uint32_t *pcTransfers, unsigned cb);
325/** Pointer to a FNIOMIOPORTNEWOUTSTRING(). */
326typedef FNIOMIOPORTNEWOUTSTRING *PFNIOMIOPORTNEWOUTSTRING;
327
328/**
329 * I/O port description.
330 *
331 * If both pszIn and pszOut are NULL, the entry is considered a terminator.
332 */
333typedef struct IOMIOPORTDESC
334{
335 /** Brief description / name of the IN port. */
336 const char *pszIn;
337 /** Brief description / name of the OUT port. */
338 const char *pszOut;
339 /** Detailed description of the IN port, optional. */
340 const char *pszInDetail;
341 /** Detialed description of the OUT port, optional. */
342 const char *pszOutDetail;
343} IOMIOPORTDESC;
344/** Pointer to an I/O port description. */
345typedef IOMIOPORTDESC const *PCIOMIOPORTDESC;
346
347
348/**
349 * Memory mapped I/O Handler for read operations.
350 *
351 * @returns VBox status code.
352 *
353 * @param pDevIns The device instance.
354 * @param pvUser User argument.
355 * @param GCPhysAddr Physical address (in GC) where the read starts.
356 * @param pv Where to store the result.
357 * @param cb Number of bytes read.
358 * @remarks Caller enters the device critical section.
359 */
360typedef DECLCALLBACK(int) FNIOMMMIOREAD(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb);
361/** Pointer to a FNIOMMMIOREAD(). */
362typedef FNIOMMMIOREAD *PFNIOMMMIOREAD;
363
364/**
365 * Memory mapped I/O Handler for write operations.
366 *
367 * @returns VBox status code.
368 *
369 * @param pDevIns The device instance.
370 * @param pvUser User argument.
371 * @param GCPhysAddr Physical address (in GC) where the read starts.
372 * @param pv Where to fetch the result.
373 * @param cb Number of bytes to write.
374 * @remarks Caller enters the device critical section.
375 */
376typedef DECLCALLBACK(int) FNIOMMMIOWRITE(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb);
377/** Pointer to a FNIOMMMIOWRITE(). */
378typedef FNIOMMMIOWRITE *PFNIOMMMIOWRITE;
379
380/**
381 * Memory mapped I/O Handler for memset operations, actually for REP STOS* instructions handling.
382 *
383 * @returns VBox status code.
384 *
385 * @param pDevIns The device instance.
386 * @param pvUser User argument.
387 * @param GCPhysAddr Physical address (in GC) where the write starts.
388 * @param u32Item Byte/Word/Dword data to fill.
389 * @param cbItem Size of data in u32Item parameter, restricted to 1/2/4 bytes.
390 * @param cItems Number of iterations.
391 * @remarks Caller enters the device critical section.
392 */
393typedef DECLCALLBACK(int) FNIOMMMIOFILL(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, uint32_t u32Item, unsigned cbItem, unsigned cItems);
394/** Pointer to a FNIOMMMIOFILL(). */
395typedef FNIOMMMIOFILL *PFNIOMMMIOFILL;
396
397
398/**
399 * Memory mapped I/O Handler for read operations.
400 *
401 * @returns Strict VBox status code.
402 *
403 * @param pDevIns The device instance.
404 * @param pvUser User argument.
405 * @param off Offset into the mapping of the read,
406 * or the physical address if IOMMMIO_FLAGS_ABS is active.
407 * @param pv Where to store the result.
408 * @param cb Number of bytes read.
409 * @remarks Caller enters the device critical section.
410 */
411typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMMMIONEWREAD(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, uint32_t cb);
412/** Pointer to a FNIOMMMIONEWREAD(). */
413typedef FNIOMMMIONEWREAD *PFNIOMMMIONEWREAD;
414
415/**
416 * Memory mapped I/O Handler for write operations.
417 *
418 * @returns Strict VBox status code.
419 *
420 * @param pDevIns The device instance.
421 * @param pvUser User argument.
422 * @param off Offset into the mapping of the write,
423 * or the physical address if IOMMMIO_FLAGS_ABS is active.
424 * @param pv Where to fetch the result.
425 * @param cb Number of bytes to write.
426 * @remarks Caller enters the device critical section.
427 */
428typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMMMIONEWWRITE(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, uint32_t cb);
429/** Pointer to a FNIOMMMIONEWWRITE(). */
430typedef FNIOMMMIONEWWRITE *PFNIOMMMIONEWWRITE;
431
432/**
433 * Memory mapped I/O Handler for memset operations, actually for REP STOS* instructions handling.
434 *
435 * @returns Strict VBox status code.
436 *
437 * @param pDevIns The device instance.
438 * @param pvUser User argument.
439 * @param off Offset into the mapping of the fill,
440 * or the physical address if IOMMMIO_FLAGS_ABS is active.
441 * @param u32Item Byte/Word/Dword data to fill.
442 * @param cbItem Size of data in u32Item parameter, restricted to 1/2/4 bytes.
443 * @param cItems Number of iterations.
444 * @remarks Caller enters the device critical section.
445 */
446typedef DECLCALLBACK(VBOXSTRICTRC) FNIOMMMIONEWFILL(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off,
447 uint32_t u32Item, uint32_t cbItem, uint32_t cItems);
448/** Pointer to a FNIOMMMIONEWFILL(). */
449typedef FNIOMMMIONEWFILL *PFNIOMMMIONEWFILL;
450
451VMMDECL(VBOXSTRICTRC) IOMIOPortRead(PVMCC pVM, PVMCPU pVCpu, RTIOPORT Port, uint32_t *pu32Value, size_t cbValue);
452VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVMCC pVM, PVMCPU pVCpu, RTIOPORT Port, uint32_t u32Value, size_t cbValue);
453VMM_INT_DECL(VBOXSTRICTRC) IOMIOPortReadString(PVMCC pVM, PVMCPU pVCpu, RTIOPORT Port, void *pvDst,
454 uint32_t *pcTransfers, unsigned cb);
455VMM_INT_DECL(VBOXSTRICTRC) IOMIOPortWriteString(PVMCC pVM, PVMCPU pVCpu, RTIOPORT uPort, void const *pvSrc,
456 uint32_t *pcTransfers, unsigned cb);
457VMMDECL(VBOXSTRICTRC) IOMMMIORead(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint32_t *pu32Value, size_t cbValue);
458VMMDECL(VBOXSTRICTRC) IOMMMIOWrite(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue);
459VMM_INT_DECL(VBOXSTRICTRC) IOMR0MmioPhysHandler(PVMCC pVM, PVMCPUCC pVCpu, uint32_t uErrorCode, RTGCPHYS GCPhysFault);
460VMMDECL(int) IOMMmioMapMmio2Page(PVMCC pVM, PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, RTGCPHYS offRegion,
461 uint64_t hMmio2, RTGCPHYS offMmio2, uint64_t fPageFlags);
462VMMR0_INT_DECL(int) IOMR0MmioMapMmioHCPage(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint64_t fPageFlags);
463VMMDECL(int) IOMMmioResetRegion(PVMCC pVM, PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion);
464
465
466/** @name IOM_IOPORT_F_XXX - Flags for IOMR3IoPortCreate() and PDMDevHlpIoPortCreateEx().
467 * @{ */
468/** Pass the absolute I/O port to the callback rather than the relative one. */
469#define IOM_IOPORT_F_ABS RT_BIT_32(0)
470/** Valid flags for IOMR3IoPortCreate(). */
471#define IOM_IOPORT_F_VALID_MASK UINT32_C(0x00000001)
472/** @} */
473
474#ifdef IN_RING3
475/** @defgroup grp_iom_r3 The IOM Host Context Ring-3 API
476 * @{
477 */
478VMMR3_INT_DECL(int) IOMR3Init(PVM pVM);
479VMMR3_INT_DECL(int) IOMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
480VMMR3_INT_DECL(void) IOMR3Reset(PVM pVM);
481VMMR3_INT_DECL(void) IOMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
482VMMR3_INT_DECL(int) IOMR3Term(PVM pVM);
483
484VMMR3_INT_DECL(int) IOMR3IoPortCreate(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT cPorts, uint32_t fFlags, PPDMPCIDEV pPciDev,
485 uint32_t iPciRegion, PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
486 PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr, RTR3PTR pvUser,
487 const char *pszDesc, PCIOMIOPORTDESC paExtDescs, PIOMIOPORTHANDLE phIoPorts);
488VMMR3_INT_DECL(int) IOMR3IoPortMap(PVM pVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts, RTIOPORT Port);
489VMMR3_INT_DECL(int) IOMR3IoPortUnmap(PVM pVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts);
490VMMR3_INT_DECL(int) IOMR3IoPortValidateHandle(PVM pVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts);
491VMMR3_INT_DECL(uint32_t) IOMR3IoPortGetMappingAddress(PVM pVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts);
492
493VMMR3_INT_DECL(int) IOMR3MmioCreate(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS cbRegion, uint32_t fFlags, PPDMPCIDEV pPciDev,
494 uint32_t iPciRegion, PFNIOMMMIONEWWRITE pfnWrite, PFNIOMMMIONEWREAD pfnRead,
495 PFNIOMMMIONEWFILL pfnFill, void *pvUser, const char *pszDesc, PIOMMMIOHANDLE phRegion);
496VMMR3_INT_DECL(int) IOMR3MmioMap(PVM pVM, PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, RTGCPHYS GCPhys);
497VMMR3_INT_DECL(int) IOMR3MmioUnmap(PVM pVM, PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion);
498VMMR3_INT_DECL(int) IOMR3MmioReduce(PVM pVM, PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, RTGCPHYS cbRegion);
499VMMR3_INT_DECL(int) IOMR3MmioValidateHandle(PVM pVM, PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion);
500VMMR3_INT_DECL(RTGCPHYS) IOMR3MmioGetMappingAddress(PVM pVM, PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion);
501
502VMMR3_INT_DECL(VBOXSTRICTRC) IOMR3ProcessForceFlag(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rcStrict);
503
504VMMR3_INT_DECL(void) IOMR3NotifyBreakpointCountChange(PVM pVM, bool fPortIo, bool fMmio);
505VMMR3_INT_DECL(void) IOMR3NotifyDebugEventChange(PVM pVM, DBGFEVENT enmEvent, bool fEnabled);
506/** @} */
507#endif /* IN_RING3 */
508
509
510#if defined(IN_RING0) || defined(DOXYGEN_RUNNING)
511/** @defgroup grpm_iom_r0 The IOM Host Context Ring-0 API
512 * @{ */
513VMMR0_INT_DECL(void) IOMR0InitPerVMData(PGVM pGVM);
514VMMR0_INT_DECL(void) IOMR0CleanupVM(PGVM pGVM);
515
516VMMR0_INT_DECL(int) IOMR0IoPortSetUpContext(PGVM pGVM, PPDMDEVINS pDevIns, IOMIOPORTHANDLE hIoPorts,
517 PFNIOMIOPORTNEWOUT pfnOut, PFNIOMIOPORTNEWIN pfnIn,
518 PFNIOMIOPORTNEWOUTSTRING pfnOutStr, PFNIOMIOPORTNEWINSTRING pfnInStr, void *pvUser);
519VMMR0_INT_DECL(int) IOMR0IoPortGrowRegistrationTables(PGVM pGVM, uint64_t cMinEntries);
520VMMR0_INT_DECL(int) IOMR0IoPortGrowStatisticsTable(PGVM pGVM, uint64_t cMinEntries);
521VMMR0_INT_DECL(int) IOMR0IoPortSyncStatisticsIndices(PGVM pGVM);
522
523VMMR0_INT_DECL(int) IOMR0MmioSetUpContext(PGVM pGVM, PPDMDEVINS pDevIns, IOMMMIOHANDLE hRegion, PFNIOMMMIONEWWRITE pfnWrite,
524 PFNIOMMMIONEWREAD pfnRead, PFNIOMMMIONEWFILL pfnFill, void *pvUser);
525VMMR0_INT_DECL(int) IOMR0MmioGrowRegistrationTables(PGVM pGVM, uint64_t cMinEntries);
526VMMR0_INT_DECL(int) IOMR0MmioGrowStatisticsTable(PGVM pGVM, uint64_t cMinEntries);
527VMMR0_INT_DECL(int) IOMR0MmioSyncStatisticsIndices(PGVM pGVM);
528
529/** @} */
530#endif /* IN_RING0 || DOXYGEN_RUNNING */
531
532/** @} */
533
534RT_C_DECLS_END
535
536#endif /* !VBOX_INCLUDED_vmm_iom_h */
537
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette