VirtualBox

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

最後變更 在這個檔案從64596是 64596,由 vboxsync 提交於 8 年 前

VMM/APIC, PDM: Clean up PDM APIC helper interface, call VMM directly instead.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 11.9 KB
 
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-2016 Oracle Corporation
11 *
12 * This file is part of VirtualBox Open Source Edition (OSE), as
13 * available from http://www.alldomusa.eu.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(int) PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
51VMM_INT_DECL(int) PDMIoApicBroadcastEoi(PVM pVM, uint8_t uVector);
52VMM_INT_DECL(int) PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue, uint32_t uTagSrc);
53VMM_INT_DECL(bool) PDMHasApic(PVM pVM);
54VMMDECL(VBOXSTRICTRC) PDMApicSetBaseMsr(PVMCPU pVCpu, uint64_t u64Base);
55VMMDECL(VBOXSTRICTRC) PDMApicGetBaseMsr(PVMCPU pVCpu, uint64_t *pu64Base, bool fIgnoreErrors);
56VMMDECL(void) PDMApicUpdateInterrupts(PVMCPU pVCpu);
57VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR);
58VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending, uint8_t *pu8PendingIntr);
59VMM_INT_DECL(VBOXSTRICTRC) PDMApicWriteMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value);
60VMM_INT_DECL(VBOXSTRICTRC) PDMApicReadMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value);
61VMM_INT_DECL(int) PDMApicGetTimerFreq(PVM pVM, uint64_t *pu64Value);
62VMM_INT_DECL(int) PDMVmmDevHeapR3ToGCPhys(PVM pVM, RTR3PTR pv, RTGCPHYS *pGCPhys);
63VMM_INT_DECL(bool) PDMVmmDevHeapIsEnabled(PVM pVM);
64
65/**
66 * Mapping/unmapping callback for an VMMDev heap allocation.
67 *
68 * @param pVM The cross context VM structure.
69 * @param pvAllocation The allocation address (ring-3).
70 * @param GCPhysAllocation The guest physical address of the mapping if
71 * it's being mapped, NIL_RTGCPHYS if it's being
72 * unmapped.
73 */
74typedef DECLCALLBACK(void) FNPDMVMMDEVHEAPNOTIFY(PVM pVM, void *pvAllocation, RTGCPHYS GCPhysAllocation);
75/** Pointer (ring-3) to a FNPDMVMMDEVHEAPNOTIFY function. */
76typedef R3PTRTYPE(FNPDMVMMDEVHEAPNOTIFY *) PFNPDMVMMDEVHEAPNOTIFY;
77
78
79#if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
80/** @defgroup grp_pdm_r3 The PDM Host Context Ring-3 API
81 * @{
82 */
83VMMR3_INT_DECL(int) PDMR3InitUVM(PUVM pUVM);
84VMMR3_INT_DECL(int) PDMR3LdrLoadVMMR0U(PUVM pUVM);
85VMMR3_INT_DECL(int) PDMR3Init(PVM pVM);
86VMMR3_INT_DECL(int) PDMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
87VMMR3DECL(void) PDMR3PowerOn(PVM pVM);
88VMMR3_INT_DECL(bool) PDMR3GetResetInfo(PVM pVM, uint32_t fOverride, uint32_t *pfResetFlags);
89VMMR3_INT_DECL(void) PDMR3ResetCpu(PVMCPU pVCpu);
90VMMR3_INT_DECL(void) PDMR3Reset(PVM pVM);
91VMMR3_INT_DECL(void) PDMR3MemSetup(PVM pVM, bool fAtReset);
92VMMR3_INT_DECL(void) PDMR3SoftReset(PVM pVM, uint32_t fResetFlags);
93VMMR3_INT_DECL(void) PDMR3Suspend(PVM pVM);
94VMMR3_INT_DECL(void) PDMR3Resume(PVM pVM);
95VMMR3DECL(void) PDMR3PowerOff(PVM pVM);
96VMMR3_INT_DECL(void) PDMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
97VMMR3_INT_DECL(int) PDMR3Term(PVM pVM);
98VMMR3_INT_DECL(void) PDMR3TermUVM(PUVM pUVM);
99
100/** PDM loader context indicator. */
101typedef enum PDMLDRCTX
102{
103 /** Invalid zero value. */
104 PDMLDRCTX_INVALID = 0,
105 /** Ring-0 context. */
106 PDMLDRCTX_RING_0,
107 /** Ring-3 context. */
108 PDMLDRCTX_RING_3,
109 /** Raw-mode context. */
110 PDMLDRCTX_RAW_MODE,
111 /** End of valid context values. */
112 PDMLDRCTX_END,
113 /** 32-bit type hack. */
114 PDMLDRCTX_32BIT_HACK = 0x7fffffff
115} PDMLDRCTX;
116
117/**
118 * Module enumeration callback function.
119 *
120 * @returns VBox status.
121 * Failure will stop the search and return the return code.
122 * Warnings will be ignored and not returned.
123 * @param pVM The cross context VM structure.
124 * @param pszFilename Module filename.
125 * @param pszName Module name. (short and unique)
126 * @param ImageBase Address where to executable image is loaded.
127 * @param cbImage Size of the executable image.
128 * @param enmCtx The context the module is loaded into.
129 * @param pvArg User argument.
130 */
131typedef DECLCALLBACK(int) FNPDMR3ENUM(PVM pVM, const char *pszFilename, const char *pszName,
132 RTUINTPTR ImageBase, size_t cbImage, PDMLDRCTX enmCtx, void *pvArg);
133/** Pointer to a FNPDMR3ENUM() function. */
134typedef FNPDMR3ENUM *PFNPDMR3ENUM;
135VMMR3DECL(int) PDMR3LdrEnumModules(PVM pVM, PFNPDMR3ENUM pfnCallback, void *pvArg);
136VMMR3_INT_DECL(void) PDMR3LdrRelocateU(PUVM pUVM, RTGCINTPTR offDelta);
137VMMR3_INT_DECL(int) PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol, void **ppvValue);
138VMMR3DECL(int) PDMR3LdrGetSymbolR0(PVM pVM, const char *pszModule, const char *pszSymbol, PRTR0PTR ppvValue);
139VMMR3DECL(int) PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol, PRTR0PTR ppvValue);
140VMMR3DECL(int) PDMR3LdrLoadRC(PVM pVM, const char *pszFilename, const char *pszName);
141VMMR3DECL(int) PDMR3LdrGetSymbolRC(PVM pVM, const char *pszModule, const char *pszSymbol, PRTRCPTR pRCPtrValue);
142VMMR3DECL(int) PDMR3LdrGetSymbolRCLazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol,
143 PRTRCPTR pRCPtrValue);
144VMMR3_INT_DECL(int) PDMR3LdrQueryRCModFromPC(PVM pVM, RTRCPTR uPC,
145 char *pszModName, size_t cchModName, PRTRCPTR pMod,
146 char *pszNearSym1, size_t cchNearSym1, PRTRCPTR pNearSym1,
147 char *pszNearSym2, size_t cchNearSym2, PRTRCPTR pNearSym2);
148VMMR3_INT_DECL(int) PDMR3LdrQueryR0ModFromPC(PVM pVM, RTR0PTR uPC,
149 char *pszModName, size_t cchModName, PRTR0PTR pMod,
150 char *pszNearSym1, size_t cchNearSym1, PRTR0PTR pNearSym1,
151 char *pszNearSym2, size_t cchNearSym2, PRTR0PTR pNearSym2);
152VMMR3_INT_DECL(int) PDMR3LdrGetInterfaceSymbols(PVM pVM, void *pvInterface, size_t cbInterface,
153 const char *pszModule, const char *pszSearchPath,
154 const char *pszSymPrefix, const char *pszSymList,
155 bool fRing0OrRC);
156
157VMMR3DECL(int) PDMR3QueryDevice(PUVM pUVM, const char *pszDevice, unsigned iInstance, PPPDMIBASE ppBase);
158VMMR3DECL(int) PDMR3QueryDeviceLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
159VMMR3DECL(int) PDMR3QueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
160VMMR3DECL(int) PDMR3QueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
161 const char *pszDriver, PPPDMIBASE ppBase);
162VMMR3DECL(int) PDMR3DeviceAttach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags,
163 PPDMIBASE *ppBase);
164VMMR3DECL(int) PDMR3DeviceDetach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags);
165VMMR3_INT_DECL(PPDMCRITSECT) PDMR3DevGetCritSect(PVM pVM, PPDMDEVINS pDevIns);
166VMMR3DECL(int) PDMR3DriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
167 PPPDMIBASE ppBase);
168VMMR3DECL(int) PDMR3DriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
169 const char *pszDriver, unsigned iOccurance, uint32_t fFlags);
170VMMR3DECL(int) PDMR3DriverReattach(PUVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
171 const char *pszDriver, unsigned iOccurance, uint32_t fFlags, PCFGMNODE pCfg,
172 PPPDMIBASE ppBase);
173VMMR3DECL(void) PDMR3DmaRun(PVM pVM);
174VMMR3_INT_DECL(int) PDMR3LockCall(PVM pVM);
175
176VMMR3_INT_DECL(int) PDMR3VmmDevHeapAlloc(PVM pVM, size_t cbSize, PFNPDMVMMDEVHEAPNOTIFY pfnNotify, RTR3PTR *ppv);
177VMMR3_INT_DECL(int) PDMR3VmmDevHeapFree(PVM pVM, RTR3PTR pv);
178VMMR3_INT_DECL(int) PDMR3TracingConfig(PVM pVM, const char *pszName, size_t cchName, bool fEnable, bool fApply);
179VMMR3_INT_DECL(bool) PDMR3TracingAreAll(PVM pVM, bool fEnabled);
180VMMR3_INT_DECL(int) PDMR3TracingQueryConfig(PVM pVM, char *pszConfig, size_t cbConfig);
181/** @} */
182#endif /* IN_RING3 */
183
184
185
186/** @defgroup grp_pdm_rc The PDM Raw-Mode Context API
187 * @{
188 */
189/** @} */
190
191
192
193/** @defgroup grp_pdm_r0 The PDM Ring-0 Context API
194 * @{
195 */
196
197/**
198 * Request buffer for PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER.
199 * @see PDMR0DriverCallReqHandler.
200 */
201typedef struct PDMDRIVERCALLREQHANDLERREQ
202{
203 /** The header. */
204 SUPVMMR0REQHDR Hdr;
205 /** The driver instance. */
206 PPDMDRVINSR0 pDrvInsR0;
207 /** The operation. */
208 uint32_t uOperation;
209 /** Explicit alignment padding. */
210 uint32_t u32Alignment;
211 /** Optional 64-bit integer argument. */
212 uint64_t u64Arg;
213} PDMDRIVERCALLREQHANDLERREQ;
214/** Pointer to a PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER
215 * request buffer. */
216typedef PDMDRIVERCALLREQHANDLERREQ *PPDMDRIVERCALLREQHANDLERREQ;
217
218VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PVM pVM, PPDMDRIVERCALLREQHANDLERREQ pReq);
219
220/**
221 * Request buffer for PDMR0DeviceCallReqHandler / VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER.
222 * @see PDMR0DeviceCallReqHandler.
223 */
224typedef struct PDMDEVICECALLREQHANDLERREQ
225{
226 /** The header. */
227 SUPVMMR0REQHDR Hdr;
228 /** The device instance. */
229 PPDMDEVINSR0 pDevInsR0;
230 /** The request handler for the device. */
231 PFNPDMDEVREQHANDLERR0 pfnReqHandlerR0;
232 /** The operation. */
233 uint32_t uOperation;
234 /** Explicit alignment padding. */
235 uint32_t u32Alignment;
236 /** Optional 64-bit integer argument. */
237 uint64_t u64Arg;
238} PDMDEVICECALLREQHANDLERREQ;
239/** Pointer to a PDMR0DeviceCallReqHandler /
240 * VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER request buffer. */
241typedef PDMDEVICECALLREQHANDLERREQ *PPDMDEVICECALLREQHANDLERREQ;
242
243VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PVM pVM, PPDMDEVICECALLREQHANDLERREQ pReq);
244
245/** @} */
246
247RT_C_DECLS_END
248
249/** @} */
250
251#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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