VirtualBox

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

Last change on this file since 97342 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

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