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