1 | /* $Id: VMMDev.h 93444 2022-01-26 18:01:15Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Driver interface to VMM device
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2022 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef MAIN_INCLUDED_VMMDev_h
|
---|
19 | #define MAIN_INCLUDED_VMMDev_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "VirtualBoxBase.h"
|
---|
25 | #include <VBox/vmm/pdmdrv.h>
|
---|
26 | #include <VBox/hgcmsvc.h>
|
---|
27 | #include <iprt/asm.h>
|
---|
28 |
|
---|
29 | class Console;
|
---|
30 |
|
---|
31 | class VMMDevMouseInterface
|
---|
32 | {
|
---|
33 | public:
|
---|
34 | virtual ~VMMDevMouseInterface() { /* Make VC++ 19.2 happy. */ }
|
---|
35 | virtual PPDMIVMMDEVPORT getVMMDevPort() = 0;
|
---|
36 | };
|
---|
37 |
|
---|
38 | class VMMDev : public VMMDevMouseInterface
|
---|
39 | {
|
---|
40 | public:
|
---|
41 | VMMDev(Console *console);
|
---|
42 | virtual ~VMMDev();
|
---|
43 | static const PDMDRVREG DrvReg;
|
---|
44 | /** Pointer to the associated VMMDev driver. */
|
---|
45 | struct DRVMAINVMMDEV *mpDrv;
|
---|
46 |
|
---|
47 | bool fSharedFolderActive;
|
---|
48 | bool isShFlActive()
|
---|
49 | {
|
---|
50 | return fSharedFolderActive;
|
---|
51 | }
|
---|
52 |
|
---|
53 | Console *getParent()
|
---|
54 | {
|
---|
55 | return mParent;
|
---|
56 | }
|
---|
57 |
|
---|
58 | int WaitCredentialsJudgement (uint32_t u32Timeout, uint32_t *pu32GuestFlags);
|
---|
59 | int SetCredentialsJudgementResult (uint32_t u32Flags);
|
---|
60 |
|
---|
61 | PPDMIVMMDEVPORT getVMMDevPort();
|
---|
62 |
|
---|
63 | #ifdef VBOX_WITH_HGCM
|
---|
64 | int hgcmLoadService (const char *pszServiceLibrary, const char *pszServiceName);
|
---|
65 | int hgcmHostCall (const char *pszServiceName, uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms);
|
---|
66 | void hgcmShutdown(bool fUvmIsInvalid = false);
|
---|
67 |
|
---|
68 | bool hgcmIsActive (void) { return ASMAtomicReadBool(&m_fHGCMActive); }
|
---|
69 | #endif /* VBOX_WITH_HGCM */
|
---|
70 |
|
---|
71 | private:
|
---|
72 | #ifdef VBOX_WITH_HGCM
|
---|
73 | # ifdef VBOX_WITH_GUEST_PROPS
|
---|
74 | void i_guestPropSetMultiple(void *names, void *values, void *timestamps, void *flags);
|
---|
75 | void i_guestPropSet(const char *pszName, const char *pszValue, const char *pszFlags);
|
---|
76 | int i_guestPropSetGlobalPropertyFlags(uint32_t fFlags);
|
---|
77 | int i_guestPropLoadAndConfigure();
|
---|
78 | # endif
|
---|
79 | #endif
|
---|
80 | static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
|
---|
81 | static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
|
---|
82 | static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
|
---|
83 | static DECLCALLBACK(void) drvReset(PPDMDRVINS pDrvIns);
|
---|
84 | static DECLCALLBACK(void) drvPowerOn(PPDMDRVINS pDrvIns);
|
---|
85 | static DECLCALLBACK(void) drvPowerOff(PPDMDRVINS pDrvIns);
|
---|
86 | static DECLCALLBACK(void) drvSuspend(PPDMDRVINS pDrvIns);
|
---|
87 | static DECLCALLBACK(void) drvResume(PPDMDRVINS pDrvIns);
|
---|
88 | static DECLCALLBACK(int) hgcmSave(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
|
---|
89 | static DECLCALLBACK(int) hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
|
---|
90 |
|
---|
91 | Console * const mParent;
|
---|
92 |
|
---|
93 | RTSEMEVENT mCredentialsEvent;
|
---|
94 | uint32_t mu32CredentialsFlags;
|
---|
95 |
|
---|
96 | #ifdef VBOX_WITH_HGCM
|
---|
97 | bool volatile m_fHGCMActive;
|
---|
98 | #endif /* VBOX_WITH_HGCM */
|
---|
99 | };
|
---|
100 |
|
---|
101 | /** VMMDev object ID used by Console::i_vmm2User_QueryGenericObject and VMMDev::drvConstruct. */
|
---|
102 | #define VMMDEV_OID "e2ff0c7b-c02b-46d0-aa90-b9caf0f60561"
|
---|
103 |
|
---|
104 | #endif /* !MAIN_INCLUDED_VMMDev_h */
|
---|
105 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|