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-2015 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 | #include <VBox/sup.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | RT_C_DECLS_BEGIN
|
---|
38 |
|
---|
39 | /** @defgroup grp_pdm The Pluggable Device Manager API
|
---|
40 | * @ingroup grp_vmm
|
---|
41 | * @{
|
---|
42 | */
|
---|
43 |
|
---|
44 | VMMDECL(int) PDMGetInterrupt(PVMCPU pVCpu, uint8_t *pu8Interrupt);
|
---|
45 | VMMDECL(int) PDMIsaSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
|
---|
46 | VMM_INT_DECL(bool) PDMHasIoApic(PVM pVM);
|
---|
47 | VMM_INT_DECL(int) PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
|
---|
48 | VMM_INT_DECL(int) PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue, uint32_t uTagSrc);
|
---|
49 | VMM_INT_DECL(bool) PDMHasApic(PVM pVM);
|
---|
50 | VMM_INT_DECL(int) PDMApicHasPendingIrq(PVM pVM, bool *pfPending);
|
---|
51 | VMMDECL(int) PDMApicSetBase(PVMCPU pVCpu, uint64_t u64Base);
|
---|
52 | VMMDECL(int) PDMApicGetBase(PVMCPU pVCpu, uint64_t *pu64Base);
|
---|
53 | VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR);
|
---|
54 | VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending, uint8_t *pu8PendingIrq);
|
---|
55 | VMM_INT_DECL(int) PDMApicWriteMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t u64Value);
|
---|
56 | VMM_INT_DECL(int) PDMApicReadMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t *pu64Value);
|
---|
57 | VMM_INT_DECL(int) PDMApicGetTimerFreq(PVM pVM, uint64_t *pu64Value);
|
---|
58 | VMM_INT_DECL(int) PDMVmmDevHeapR3ToGCPhys(PVM pVM, RTR3PTR pv, RTGCPHYS *pGCPhys);
|
---|
59 | VMM_INT_DECL(bool) PDMVmmDevHeapIsEnabled(PVM pVM);
|
---|
60 |
|
---|
61 |
|
---|
62 | /** @defgroup grp_pdm_r3 The PDM Host Context Ring-3 API
|
---|
63 | * @{
|
---|
64 | */
|
---|
65 |
|
---|
66 | VMMR3_INT_DECL(int) PDMR3InitUVM(PUVM pUVM);
|
---|
67 | VMMR3_INT_DECL(int) PDMR3LdrLoadVMMR0U(PUVM pUVM);
|
---|
68 | VMMR3_INT_DECL(int) PDMR3Init(PVM pVM);
|
---|
69 | VMMR3DECL(void) PDMR3PowerOn(PVM pVM);
|
---|
70 | VMMR3_INT_DECL(void) PDMR3ResetCpu(PVMCPU pVCpu);
|
---|
71 | VMMR3_INT_DECL(void) PDMR3Reset(PVM pVM);
|
---|
72 | VMMR3_INT_DECL(void) PDMR3MemSetup(PVM pVM, bool fAtReset);
|
---|
73 | VMMR3_INT_DECL(void) PDMR3Suspend(PVM pVM);
|
---|
74 | VMMR3_INT_DECL(void) PDMR3Resume(PVM pVM);
|
---|
75 | VMMR3DECL(void) PDMR3PowerOff(PVM pVM);
|
---|
76 | VMMR3_INT_DECL(void) PDMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
77 | VMMR3_INT_DECL(int) PDMR3Term(PVM pVM);
|
---|
78 | VMMR3_INT_DECL(void) PDMR3TermUVM(PUVM pUVM);
|
---|
79 |
|
---|
80 | /** PDM loader context indicator. */
|
---|
81 | typedef enum PDMLDRCTX
|
---|
82 | {
|
---|
83 | /** Invalid zero value. */
|
---|
84 | PDMLDRCTX_INVALID = 0,
|
---|
85 | /** Ring-0 context. */
|
---|
86 | PDMLDRCTX_RING_0,
|
---|
87 | /** Ring-3 context. */
|
---|
88 | PDMLDRCTX_RING_3,
|
---|
89 | /** Raw-mode context. */
|
---|
90 | PDMLDRCTX_RAW_MODE,
|
---|
91 | /** End of valid context values. */
|
---|
92 | PDMLDRCTX_END,
|
---|
93 | /** 32-bit type hack. */
|
---|
94 | PDMLDRCTX_32BIT_HACK = 0x7fffffff
|
---|
95 | } PDMLDRCTX;
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Module enumeration callback function.
|
---|
99 | *
|
---|
100 | * @returns VBox status.
|
---|
101 | * Failure will stop the search and return the return code.
|
---|
102 | * Warnings will be ignored and not returned.
|
---|
103 | * @param pVM VM Handle.
|
---|
104 | * @param pszFilename Module filename.
|
---|
105 | * @param pszName Module name. (short and unique)
|
---|
106 | * @param ImageBase Address where to executable image is loaded.
|
---|
107 | * @param cbImage Size of the executable image.
|
---|
108 | * @param enmCtx The context the module is loaded into.
|
---|
109 | * @param pvArg User argument.
|
---|
110 | */
|
---|
111 | typedef DECLCALLBACK(int) FNPDMR3ENUM(PVM pVM, const char *pszFilename, const char *pszName,
|
---|
112 | RTUINTPTR ImageBase, size_t cbImage, PDMLDRCTX enmCtx, void *pvArg);
|
---|
113 | /** Pointer to a FNPDMR3ENUM() function. */
|
---|
114 | typedef FNPDMR3ENUM *PFNPDMR3ENUM;
|
---|
115 | VMMR3DECL(int) PDMR3LdrEnumModules(PVM pVM, PFNPDMR3ENUM pfnCallback, void *pvArg);
|
---|
116 | VMMR3_INT_DECL(void) PDMR3LdrRelocateU(PUVM pUVM, RTGCINTPTR offDelta);
|
---|
117 | VMMR3_INT_DECL(int) PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol, void **ppvValue);
|
---|
118 | VMMR3DECL(int) PDMR3LdrGetSymbolR0(PVM pVM, const char *pszModule, const char *pszSymbol, PRTR0PTR ppvValue);
|
---|
119 | VMMR3DECL(int) PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol, PRTR0PTR ppvValue);
|
---|
120 | VMMR3DECL(int) PDMR3LdrLoadRC(PVM pVM, const char *pszFilename, const char *pszName);
|
---|
121 | VMMR3DECL(int) PDMR3LdrGetSymbolRC(PVM pVM, const char *pszModule, const char *pszSymbol, PRTRCPTR pRCPtrValue);
|
---|
122 | VMMR3DECL(int) PDMR3LdrGetSymbolRCLazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol,
|
---|
123 | PRTRCPTR pRCPtrValue);
|
---|
124 | VMMR3_INT_DECL(int) PDMR3LdrQueryRCModFromPC(PVM pVM, RTRCPTR uPC,
|
---|
125 | char *pszModName, size_t cchModName, PRTRCPTR pMod,
|
---|
126 | char *pszNearSym1, size_t cchNearSym1, PRTRCPTR pNearSym1,
|
---|
127 | char *pszNearSym2, size_t cchNearSym2, PRTRCPTR pNearSym2);
|
---|
128 | VMMR3_INT_DECL(int) PDMR3LdrQueryR0ModFromPC(PVM pVM, RTR0PTR uPC,
|
---|
129 | char *pszModName, size_t cchModName, PRTR0PTR pMod,
|
---|
130 | char *pszNearSym1, size_t cchNearSym1, PRTR0PTR pNearSym1,
|
---|
131 | char *pszNearSym2, size_t cchNearSym2, PRTR0PTR pNearSym2);
|
---|
132 | VMMR3_INT_DECL(int) PDMR3LdrGetInterfaceSymbols(PVM pVM, void *pvInterface, size_t cbInterface,
|
---|
133 | const char *pszModule, const char *pszSearchPath,
|
---|
134 | const char *pszSymPrefix, const char *pszSymList,
|
---|
135 | bool fRing0OrRC);
|
---|
136 |
|
---|
137 | VMMR3DECL(int) PDMR3QueryDevice(PUVM pUVM, const char *pszDevice, unsigned iInstance, PPPDMIBASE ppBase);
|
---|
138 | VMMR3DECL(int) PDMR3QueryDeviceLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
|
---|
139 | VMMR3DECL(int) PDMR3QueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
|
---|
140 | VMMR3DECL(int) PDMR3QueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
|
---|
141 | const char *pszDriver, PPPDMIBASE ppBase);
|
---|
142 | VMMR3DECL(int) PDMR3DeviceAttach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags,
|
---|
143 | PPDMIBASE *ppBase);
|
---|
144 | VMMR3DECL(int) PDMR3DeviceDetach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags);
|
---|
145 | VMMR3_INT_DECL(PPDMCRITSECT) PDMR3DevGetCritSect(PVM pVM, PPDMDEVINS pDevIns);
|
---|
146 | VMMR3DECL(int) PDMR3DriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
|
---|
147 | PPPDMIBASE ppBase);
|
---|
148 | VMMR3DECL(int) PDMR3DriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
|
---|
149 | const char *pszDriver, unsigned iOccurance, uint32_t fFlags);
|
---|
150 | VMMR3DECL(int) PDMR3DriverReattach(PUVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
|
---|
151 | const char *pszDriver, unsigned iOccurance, uint32_t fFlags, PCFGMNODE pCfg,
|
---|
152 | PPPDMIBASE ppBase);
|
---|
153 | VMMR3DECL(void) PDMR3DmaRun(PVM pVM);
|
---|
154 | VMMR3_INT_DECL(int) PDMR3LockCall(PVM pVM);
|
---|
155 | VMMR3_INT_DECL(int) PDMR3VmmDevHeapRegister(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize);
|
---|
156 | VMMR3_INT_DECL(int) PDMR3VmmDevHeapUnregister(PVM pVM, RTGCPHYS GCPhys);
|
---|
157 | VMMR3_INT_DECL(int) PDMR3VmmDevHeapAlloc(PVM pVM, size_t cbSize, RTR3PTR *ppv);
|
---|
158 | VMMR3_INT_DECL(int) PDMR3VmmDevHeapFree(PVM pVM, RTR3PTR pv);
|
---|
159 | VMMR3_INT_DECL(int) PDMR3TracingConfig(PVM pVM, const char *pszName, size_t cchName, bool fEnable, bool fApply);
|
---|
160 | VMMR3_INT_DECL(bool) PDMR3TracingAreAll(PVM pVM, bool fEnabled);
|
---|
161 | VMMR3_INT_DECL(int) PDMR3TracingQueryConfig(PVM pVM, char *pszConfig, size_t cbConfig);
|
---|
162 | /** @} */
|
---|
163 |
|
---|
164 |
|
---|
165 |
|
---|
166 | /** @defgroup grp_pdm_rc The PDM Raw-Mode Context API
|
---|
167 | * @{
|
---|
168 | */
|
---|
169 | /** @} */
|
---|
170 |
|
---|
171 |
|
---|
172 |
|
---|
173 | /** @defgroup grp_pdm_r0 The PDM Ring-0 Context API
|
---|
174 | * @{
|
---|
175 | */
|
---|
176 |
|
---|
177 | /**
|
---|
178 | * Request buffer for PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER.
|
---|
179 | * @see PDMR0DriverCallReqHandler.
|
---|
180 | */
|
---|
181 | typedef struct PDMDRIVERCALLREQHANDLERREQ
|
---|
182 | {
|
---|
183 | /** The header. */
|
---|
184 | SUPVMMR0REQHDR Hdr;
|
---|
185 | /** The driver instance. */
|
---|
186 | PPDMDRVINSR0 pDrvInsR0;
|
---|
187 | /** The operation. */
|
---|
188 | uint32_t uOperation;
|
---|
189 | /** Explicit alignment padding. */
|
---|
190 | uint32_t u32Alignment;
|
---|
191 | /** Optional 64-bit integer argument. */
|
---|
192 | uint64_t u64Arg;
|
---|
193 | } PDMDRIVERCALLREQHANDLERREQ;
|
---|
194 | /** Pointer to a PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER
|
---|
195 | * request buffer. */
|
---|
196 | typedef PDMDRIVERCALLREQHANDLERREQ *PPDMDRIVERCALLREQHANDLERREQ;
|
---|
197 |
|
---|
198 | VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PVM pVM, PPDMDRIVERCALLREQHANDLERREQ pReq);
|
---|
199 |
|
---|
200 | /**
|
---|
201 | * Request buffer for PDMR0DeviceCallReqHandler / VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER.
|
---|
202 | * @see PDMR0DeviceCallReqHandler.
|
---|
203 | */
|
---|
204 | typedef struct PDMDEVICECALLREQHANDLERREQ
|
---|
205 | {
|
---|
206 | /** The header. */
|
---|
207 | SUPVMMR0REQHDR Hdr;
|
---|
208 | /** The device instance. */
|
---|
209 | PPDMDEVINSR0 pDevInsR0;
|
---|
210 | /** The request handler for the device. */
|
---|
211 | PFNPDMDEVREQHANDLERR0 pfnReqHandlerR0;
|
---|
212 | /** The operation. */
|
---|
213 | uint32_t uOperation;
|
---|
214 | /** Explicit alignment padding. */
|
---|
215 | uint32_t u32Alignment;
|
---|
216 | /** Optional 64-bit integer argument. */
|
---|
217 | uint64_t u64Arg;
|
---|
218 | } PDMDEVICECALLREQHANDLERREQ;
|
---|
219 | /** Pointer to a PDMR0DeviceCallReqHandler /
|
---|
220 | * VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER request buffer. */
|
---|
221 | typedef PDMDEVICECALLREQHANDLERREQ *PPDMDEVICECALLREQHANDLERREQ;
|
---|
222 |
|
---|
223 | VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PVM pVM, PPDMDEVICECALLREQHANDLERREQ pReq);
|
---|
224 |
|
---|
225 | /** @} */
|
---|
226 |
|
---|
227 | RT_C_DECLS_END
|
---|
228 |
|
---|
229 | /** @} */
|
---|
230 |
|
---|
231 | #endif
|
---|