VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmapi.h@ 73768

Last change on this file since 73768 was 70039, checked in by vboxsync, 6 years ago

Fixed typo: Occurance -> Occurrence.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 11.2 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Core API.
3 *
4 * The 'Core API' has been put in a different header because everyone
5 * is currently including pdm.h. So, pdm.h is for including all of the
6 * PDM stuff, while pdmapi.h is for the core stuff.
7 */
8
9/*
10 * Copyright (C) 2006-2017 Oracle Corporation
11 *
12 * This file is part of VirtualBox Open Source Edition (OSE), as
13 * available from http://www.virtualbox.org. This file is free software;
14 * you can redistribute it and/or modify it under the terms of the GNU
15 * General Public License (GPL) as published by the Free Software
16 * Foundation, in version 2 as it comes in the "COPYING" file of the
17 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19 *
20 * The contents of this file may alternatively be used under the terms
21 * of the Common Development and Distribution License Version 1.0
22 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
23 * VirtualBox OSE distribution, in which case the provisions of the
24 * CDDL are applicable instead of those of the GPL.
25 *
26 * You may elect to license modified versions of this file under the
27 * terms and conditions of either the GPL or the CDDL or both.
28 */
29
30#ifndef ___VBox_vmm_pdmapi_h
31#define ___VBox_vmm_pdmapi_h
32
33#include <VBox/vmm/pdmcommon.h>
34#ifdef IN_RING3
35# include <VBox/vmm/vmapi.h>
36#endif
37#include <VBox/sup.h>
38
39
40RT_C_DECLS_BEGIN
41
42/** @defgroup grp_pdm The Pluggable Device Manager API
43 * @ingroup grp_vmm
44 * @{
45 */
46
47VMMDECL(int) PDMGetInterrupt(PVMCPU pVCpu, uint8_t *pu8Interrupt);
48VMMDECL(int) PDMIsaSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
49VMM_INT_DECL(bool) PDMHasIoApic(PVM pVM);
50VMM_INT_DECL(bool) PDMHasApic(PVM pVM);
51VMM_INT_DECL(int) PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
52VMM_INT_DECL(int) PDMIoApicBroadcastEoi(PVM pVM, uint8_t uVector);
53VMM_INT_DECL(int) PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue, uint32_t uTagSrc);
54VMM_INT_DECL(int) PDMVmmDevHeapR3ToGCPhys(PVM pVM, RTR3PTR pv, RTGCPHYS *pGCPhys);
55VMM_INT_DECL(bool) PDMVmmDevHeapIsEnabled(PVM pVM);
56
57/**
58 * Mapping/unmapping callback for an VMMDev heap allocation.
59 *
60 * @param pVM The cross context VM structure.
61 * @param pvAllocation The allocation address (ring-3).
62 * @param GCPhysAllocation The guest physical address of the mapping if
63 * it's being mapped, NIL_RTGCPHYS if it's being
64 * unmapped.
65 */
66typedef DECLCALLBACK(void) FNPDMVMMDEVHEAPNOTIFY(PVM pVM, void *pvAllocation, RTGCPHYS GCPhysAllocation);
67/** Pointer (ring-3) to a FNPDMVMMDEVHEAPNOTIFY function. */
68typedef R3PTRTYPE(FNPDMVMMDEVHEAPNOTIFY *) PFNPDMVMMDEVHEAPNOTIFY;
69
70
71#if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
72/** @defgroup grp_pdm_r3 The PDM Host Context Ring-3 API
73 * @{
74 */
75VMMR3_INT_DECL(int) PDMR3InitUVM(PUVM pUVM);
76VMMR3_INT_DECL(int) PDMR3LdrLoadVMMR0U(PUVM pUVM);
77VMMR3_INT_DECL(int) PDMR3Init(PVM pVM);
78VMMR3_INT_DECL(int) PDMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
79VMMR3DECL(void) PDMR3PowerOn(PVM pVM);
80VMMR3_INT_DECL(bool) PDMR3GetResetInfo(PVM pVM, uint32_t fOverride, uint32_t *pfResetFlags);
81VMMR3_INT_DECL(void) PDMR3ResetCpu(PVMCPU pVCpu);
82VMMR3_INT_DECL(void) PDMR3Reset(PVM pVM);
83VMMR3_INT_DECL(void) PDMR3MemSetup(PVM pVM, bool fAtReset);
84VMMR3_INT_DECL(void) PDMR3SoftReset(PVM pVM, uint32_t fResetFlags);
85VMMR3_INT_DECL(void) PDMR3Suspend(PVM pVM);
86VMMR3_INT_DECL(void) PDMR3Resume(PVM pVM);
87VMMR3DECL(void) PDMR3PowerOff(PVM pVM);
88VMMR3_INT_DECL(void) PDMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
89VMMR3_INT_DECL(int) PDMR3Term(PVM pVM);
90VMMR3_INT_DECL(void) PDMR3TermUVM(PUVM pUVM);
91
92/** PDM loader context indicator. */
93typedef enum PDMLDRCTX
94{
95 /** Invalid zero value. */
96 PDMLDRCTX_INVALID = 0,
97 /** Ring-0 context. */
98 PDMLDRCTX_RING_0,
99 /** Ring-3 context. */
100 PDMLDRCTX_RING_3,
101 /** Raw-mode context. */
102 PDMLDRCTX_RAW_MODE,
103 /** End of valid context values. */
104 PDMLDRCTX_END,
105 /** 32-bit type hack. */
106 PDMLDRCTX_32BIT_HACK = 0x7fffffff
107} PDMLDRCTX;
108
109/**
110 * Module enumeration callback function.
111 *
112 * @returns VBox status.
113 * Failure will stop the search and return the return code.
114 * Warnings will be ignored and not returned.
115 * @param pVM The cross context VM structure.
116 * @param pszFilename Module filename.
117 * @param pszName Module name. (short and unique)
118 * @param ImageBase Address where to executable image is loaded.
119 * @param cbImage Size of the executable image.
120 * @param enmCtx The context the module is loaded into.
121 * @param pvArg User argument.
122 */
123typedef DECLCALLBACK(int) FNPDMR3ENUM(PVM pVM, const char *pszFilename, const char *pszName,
124 RTUINTPTR ImageBase, size_t cbImage, PDMLDRCTX enmCtx, void *pvArg);
125/** Pointer to a FNPDMR3ENUM() function. */
126typedef FNPDMR3ENUM *PFNPDMR3ENUM;
127VMMR3DECL(int) PDMR3LdrEnumModules(PVM pVM, PFNPDMR3ENUM pfnCallback, void *pvArg);
128VMMR3_INT_DECL(void) PDMR3LdrRelocateU(PUVM pUVM, RTGCINTPTR offDelta);
129VMMR3_INT_DECL(int) PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol, void **ppvValue);
130VMMR3DECL(int) PDMR3LdrGetSymbolR0(PVM pVM, const char *pszModule, const char *pszSymbol, PRTR0PTR ppvValue);
131VMMR3DECL(int) PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol, PRTR0PTR ppvValue);
132VMMR3DECL(int) PDMR3LdrLoadRC(PVM pVM, const char *pszFilename, const char *pszName);
133VMMR3DECL(int) PDMR3LdrGetSymbolRC(PVM pVM, const char *pszModule, const char *pszSymbol, PRTRCPTR pRCPtrValue);
134VMMR3DECL(int) PDMR3LdrGetSymbolRCLazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol,
135 PRTRCPTR pRCPtrValue);
136VMMR3_INT_DECL(int) PDMR3LdrQueryRCModFromPC(PVM pVM, RTRCPTR uPC,
137 char *pszModName, size_t cchModName, PRTRCPTR pMod,
138 char *pszNearSym1, size_t cchNearSym1, PRTRCPTR pNearSym1,
139 char *pszNearSym2, size_t cchNearSym2, PRTRCPTR pNearSym2);
140VMMR3_INT_DECL(int) PDMR3LdrQueryR0ModFromPC(PVM pVM, RTR0PTR uPC,
141 char *pszModName, size_t cchModName, PRTR0PTR pMod,
142 char *pszNearSym1, size_t cchNearSym1, PRTR0PTR pNearSym1,
143 char *pszNearSym2, size_t cchNearSym2, PRTR0PTR pNearSym2);
144VMMR3_INT_DECL(int) PDMR3LdrGetInterfaceSymbols(PVM pVM, void *pvInterface, size_t cbInterface,
145 const char *pszModule, const char *pszSearchPath,
146 const char *pszSymPrefix, const char *pszSymList,
147 bool fRing0OrRC);
148
149VMMR3DECL(int) PDMR3QueryDevice(PUVM pUVM, const char *pszDevice, unsigned iInstance, PPPDMIBASE ppBase);
150VMMR3DECL(int) PDMR3QueryDeviceLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
151VMMR3DECL(int) PDMR3QueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
152VMMR3DECL(int) PDMR3QueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
153 const char *pszDriver, PPPDMIBASE ppBase);
154VMMR3DECL(int) PDMR3DeviceAttach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags,
155 PPDMIBASE *ppBase);
156VMMR3DECL(int) PDMR3DeviceDetach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags);
157VMMR3_INT_DECL(PPDMCRITSECT) PDMR3DevGetCritSect(PVM pVM, PPDMDEVINS pDevIns);
158VMMR3DECL(int) PDMR3DriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
159 PPPDMIBASE ppBase);
160VMMR3DECL(int) PDMR3DriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
161 const char *pszDriver, unsigned iOccurrence, uint32_t fFlags);
162VMMR3DECL(int) PDMR3DriverReattach(PUVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
163 const char *pszDriver, unsigned iOccurrence, uint32_t fFlags, PCFGMNODE pCfg,
164 PPPDMIBASE ppBase);
165VMMR3DECL(void) PDMR3DmaRun(PVM pVM);
166VMMR3_INT_DECL(int) PDMR3LockCall(PVM pVM);
167
168VMMR3_INT_DECL(int) PDMR3VmmDevHeapAlloc(PVM pVM, size_t cbSize, PFNPDMVMMDEVHEAPNOTIFY pfnNotify, RTR3PTR *ppv);
169VMMR3_INT_DECL(int) PDMR3VmmDevHeapFree(PVM pVM, RTR3PTR pv);
170VMMR3_INT_DECL(int) PDMR3TracingConfig(PVM pVM, const char *pszName, size_t cchName, bool fEnable, bool fApply);
171VMMR3_INT_DECL(bool) PDMR3TracingAreAll(PVM pVM, bool fEnabled);
172VMMR3_INT_DECL(int) PDMR3TracingQueryConfig(PVM pVM, char *pszConfig, size_t cbConfig);
173/** @} */
174#endif /* IN_RING3 */
175
176
177
178/** @defgroup grp_pdm_rc The PDM Raw-Mode Context API
179 * @{
180 */
181/** @} */
182
183
184
185/** @defgroup grp_pdm_r0 The PDM Ring-0 Context API
186 * @{
187 */
188
189/**
190 * Request buffer for PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER.
191 * @see PDMR0DriverCallReqHandler.
192 */
193typedef struct PDMDRIVERCALLREQHANDLERREQ
194{
195 /** The header. */
196 SUPVMMR0REQHDR Hdr;
197 /** The driver instance. */
198 PPDMDRVINSR0 pDrvInsR0;
199 /** The operation. */
200 uint32_t uOperation;
201 /** Explicit alignment padding. */
202 uint32_t u32Alignment;
203 /** Optional 64-bit integer argument. */
204 uint64_t u64Arg;
205} PDMDRIVERCALLREQHANDLERREQ;
206/** Pointer to a PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER
207 * request buffer. */
208typedef PDMDRIVERCALLREQHANDLERREQ *PPDMDRIVERCALLREQHANDLERREQ;
209
210VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PGVM pGVM, PVM pVM, PPDMDRIVERCALLREQHANDLERREQ pReq);
211
212/**
213 * Request buffer for PDMR0DeviceCallReqHandler / VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER.
214 * @see PDMR0DeviceCallReqHandler.
215 */
216typedef struct PDMDEVICECALLREQHANDLERREQ
217{
218 /** The header. */
219 SUPVMMR0REQHDR Hdr;
220 /** The device instance. */
221 PPDMDEVINSR0 pDevInsR0;
222 /** The request handler for the device. */
223 PFNPDMDEVREQHANDLERR0 pfnReqHandlerR0;
224 /** The operation. */
225 uint32_t uOperation;
226 /** Explicit alignment padding. */
227 uint32_t u32Alignment;
228 /** Optional 64-bit integer argument. */
229 uint64_t u64Arg;
230} PDMDEVICECALLREQHANDLERREQ;
231/** Pointer to a PDMR0DeviceCallReqHandler /
232 * VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER request buffer. */
233typedef PDMDEVICECALLREQHANDLERREQ *PPDMDEVICECALLREQHANDLERREQ;
234
235VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PGVM pGVM, PVM pVM, PPDMDEVICECALLREQHANDLERREQ pReq);
236
237/** @} */
238
239RT_C_DECLS_END
240
241/** @} */
242
243#endif
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use