VirtualBox

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

Last change on this file since 104807 was 104767, checked in by vboxsync, 7 months ago

VMM/PGM,IOM,PDM: MMIO cleanups. bugref:10687

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