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