VirtualBox

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

Last change on this file since 53420 was 52670, checked in by vboxsync, 10 years ago

VMM, Devices: Add interface to query the APIC frequency from the APIC device.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.0 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-2013 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
37RT_C_DECLS_BEGIN
38
39/** @defgroup grp_pdm The Pluggable Device Manager API
40 * @{
41 */
42
43VMMDECL(int) PDMGetInterrupt(PVMCPU pVCpu, uint8_t *pu8Interrupt);
44VMMDECL(int) PDMIsaSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
45VMM_INT_DECL(bool) PDMHasIoApic(PVM pVM);
46VMM_INT_DECL(int) PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
47VMM_INT_DECL(int) PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue, uint32_t uTagSrc);
48VMM_INT_DECL(bool) PDMHasApic(PVM pVM);
49VMM_INT_DECL(int) PDMApicHasPendingIrq(PVM pVM, bool *pfPending);
50VMMDECL(int) PDMApicSetBase(PVMCPU pVCpu, uint64_t u64Base);
51VMMDECL(int) PDMApicGetBase(PVMCPU pVCpu, uint64_t *pu64Base);
52VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR);
53VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending, uint8_t *pu8PendingIrq);
54VMM_INT_DECL(int) PDMApicWriteMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t u64Value);
55VMM_INT_DECL(int) PDMApicReadMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t *pu64Value);
56VMM_INT_DECL(int) PDMApicGetTimerFreq(PVM pVM, uint64_t *pu64Value);
57VMM_INT_DECL(int) PDMVmmDevHeapR3ToGCPhys(PVM pVM, RTR3PTR pv, RTGCPHYS *pGCPhys);
58VMM_INT_DECL(bool) PDMVmmDevHeapIsEnabled(PVM pVM);
59
60
61/** @defgroup grp_pdm_r3 The PDM Host Context Ring-3 API
62 * @ingroup grp_pdm
63 * @{
64 */
65
66VMMR3_INT_DECL(int) PDMR3InitUVM(PUVM pUVM);
67VMMR3_INT_DECL(int) PDMR3LdrLoadVMMR0U(PUVM pUVM);
68VMMR3_INT_DECL(int) PDMR3Init(PVM pVM);
69VMMR3DECL(void) PDMR3PowerOn(PVM pVM);
70VMMR3_INT_DECL(void) PDMR3ResetCpu(PVMCPU pVCpu);
71VMMR3_INT_DECL(void) PDMR3Reset(PVM pVM);
72VMMR3_INT_DECL(void) PDMR3MemSetup(PVM pVM, bool fAtReset);
73VMMR3_INT_DECL(void) PDMR3Suspend(PVM pVM);
74VMMR3_INT_DECL(void) PDMR3Resume(PVM pVM);
75VMMR3DECL(void) PDMR3PowerOff(PVM pVM);
76VMMR3_INT_DECL(void) PDMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
77VMMR3_INT_DECL(int) PDMR3Term(PVM pVM);
78VMMR3_INT_DECL(void) PDMR3TermUVM(PUVM pUVM);
79
80/** PDM loader context indicator. */
81typedef 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 */
111typedef 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. */
114typedef FNPDMR3ENUM *PFNPDMR3ENUM;
115VMMR3DECL(int) PDMR3LdrEnumModules(PVM pVM, PFNPDMR3ENUM pfnCallback, void *pvArg);
116VMMR3_INT_DECL(void) PDMR3LdrRelocateU(PUVM pUVM, RTGCINTPTR offDelta);
117VMMR3_INT_DECL(int) PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol, void **ppvValue);
118VMMR3DECL(int) PDMR3LdrGetSymbolR0(PVM pVM, const char *pszModule, const char *pszSymbol, PRTR0PTR ppvValue);
119VMMR3DECL(int) PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol, PRTR0PTR ppvValue);
120VMMR3DECL(int) PDMR3LdrLoadRC(PVM pVM, const char *pszFilename, const char *pszName);
121VMMR3DECL(int) PDMR3LdrGetSymbolRC(PVM pVM, const char *pszModule, const char *pszSymbol, PRTRCPTR pRCPtrValue);
122VMMR3DECL(int) PDMR3LdrGetSymbolRCLazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol,
123 PRTRCPTR pRCPtrValue);
124VMMR3_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);
128VMMR3_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);
132VMMR3_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
137VMMR3DECL(int) PDMR3QueryDevice(PUVM pUVM, const char *pszDevice, unsigned iInstance, PPPDMIBASE ppBase);
138VMMR3DECL(int) PDMR3QueryDeviceLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
139VMMR3DECL(int) PDMR3QueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
140VMMR3DECL(int) PDMR3QueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
141 const char *pszDriver, PPPDMIBASE ppBase);
142VMMR3DECL(int) PDMR3DeviceAttach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags,
143 PPDMIBASE *ppBase);
144VMMR3DECL(int) PDMR3DeviceDetach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags);
145VMMR3_INT_DECL(PPDMCRITSECT) PDMR3DevGetCritSect(PVM pVM, PPDMDEVINS pDevIns);
146VMMR3DECL(int) PDMR3DriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
147 PPPDMIBASE ppBase);
148VMMR3DECL(int) PDMR3DriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
149 const char *pszDriver, unsigned iOccurance, uint32_t fFlags);
150VMMR3DECL(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);
153VMMR3DECL(void) PDMR3DmaRun(PVM pVM);
154VMMR3_INT_DECL(int) PDMR3LockCall(PVM pVM);
155VMMR3_INT_DECL(int) PDMR3VmmDevHeapRegister(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize);
156VMMR3_INT_DECL(int) PDMR3VmmDevHeapUnregister(PVM pVM, RTGCPHYS GCPhys);
157VMMR3_INT_DECL(int) PDMR3VmmDevHeapAlloc(PVM pVM, size_t cbSize, RTR3PTR *ppv);
158VMMR3_INT_DECL(int) PDMR3VmmDevHeapFree(PVM pVM, RTR3PTR pv);
159VMMR3_INT_DECL(int) PDMR3TracingConfig(PVM pVM, const char *pszName, size_t cchName, bool fEnable, bool fApply);
160VMMR3_INT_DECL(bool) PDMR3TracingAreAll(PVM pVM, bool fEnabled);
161VMMR3_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 * @ingroup grp_pdm
168 * @{
169 */
170/** @} */
171
172
173
174/** @defgroup grp_pdm_r0 The PDM Ring-0 Context API
175 * @ingroup grp_pdm
176 * @{
177 */
178
179/**
180 * Request buffer for PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER.
181 * @see PDMR0DriverCallReqHandler.
182 */
183typedef struct PDMDRIVERCALLREQHANDLERREQ
184{
185 /** The header. */
186 SUPVMMR0REQHDR Hdr;
187 /** The driver instance. */
188 PPDMDRVINSR0 pDrvInsR0;
189 /** The operation. */
190 uint32_t uOperation;
191 /** Explicit alignment padding. */
192 uint32_t u32Alignment;
193 /** Optional 64-bit integer argument. */
194 uint64_t u64Arg;
195} PDMDRIVERCALLREQHANDLERREQ;
196/** Pointer to a PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER
197 * request buffer. */
198typedef PDMDRIVERCALLREQHANDLERREQ *PPDMDRIVERCALLREQHANDLERREQ;
199
200VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PVM pVM, PPDMDRIVERCALLREQHANDLERREQ pReq);
201
202/**
203 * Request buffer for PDMR0DeviceCallReqHandler / VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER.
204 * @see PDMR0DeviceCallReqHandler.
205 */
206typedef struct PDMDEVICECALLREQHANDLERREQ
207{
208 /** The header. */
209 SUPVMMR0REQHDR Hdr;
210 /** The device instance. */
211 PPDMDEVINSR0 pDevInsR0;
212 /** The request handler for the device. */
213 PFNPDMDEVREQHANDLERR0 pfnReqHandlerR0;
214 /** The operation. */
215 uint32_t uOperation;
216 /** Explicit alignment padding. */
217 uint32_t u32Alignment;
218 /** Optional 64-bit integer argument. */
219 uint64_t u64Arg;
220} PDMDEVICECALLREQHANDLERREQ;
221/** Pointer to a PDMR0DeviceCallReqHandler /
222 * VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER request buffer. */
223typedef PDMDEVICECALLREQHANDLERREQ *PPDMDEVICECALLREQHANDLERREQ;
224
225VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PVM pVM, PPDMDEVICECALLREQHANDLERREQ pReq);
226
227/** @} */
228
229RT_C_DECLS_END
230
231/** @} */
232
233#endif
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