VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h@ 97405

Last change on this file since 97405 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/* $Id: HGSMIHost.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * VBox Host Guest Shared Memory Interface (HGSMI), host part.
4 */
5
6/*
7 * Copyright (C) 2006-2022 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 VBOX_INCLUDED_SRC_Graphics_HGSMI_HGSMIHost_h
29#define VBOX_INCLUDED_SRC_Graphics_HGSMI_HGSMIHost_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <VBox/types.h>
35#include <HGSMI.h>
36#include <HGSMIChSetup.h>
37
38struct HGSMIINSTANCE;
39typedef struct HGSMIINSTANCE *PHGSMIINSTANCE;
40
41/** Callback for the guest notification about a new host buffer. */
42typedef DECLCALLBACKTYPE(void, FNHGSMINOTIFYGUEST,(void *pvCallback));
43typedef FNHGSMINOTIFYGUEST *PFNHGSMINOTIFYGUEST;
44
45/*
46 * Public Host API for virtual devices.
47 */
48
49int HGSMICreate(PHGSMIINSTANCE *ppIns,
50 PPDMDEVINS pDevIns,
51 const char *pszName,
52 HGSMIOFFSET offBase,
53 uint8_t *pu8MemBase,
54 HGSMISIZE cbMem,
55 PFNHGSMINOTIFYGUEST pfnNotifyGuest,
56 void *pvNotifyGuest,
57 size_t cbContext);
58void HGSMIDestroy(PHGSMIINSTANCE pIns);
59void *HGSMIContext(PHGSMIINSTANCE pIns);
60
61void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIOffsetToPointerHost(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
62HGSMIOFFSET HGSMIPointerToOffsetHost(PHGSMIINSTANCE pIns, const void RT_UNTRUSTED_VOLATILE_GUEST *pv);
63bool HGSMIIsOffsetValid(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
64HGSMIOFFSET HGSMIGetAreaOffset(PHGSMIINSTANCE pIns);
65HGSMIOFFSET HGSMIGetAreaSize(PHGSMIINSTANCE pIns);
66
67
68int HGSMIHostChannelRegister(PHGSMIINSTANCE pIns, uint8_t u8Channel,
69 PFNHGSMICHANNELHANDLER pfnChannelHandler, void *pvChannelHandler);
70#if 0 /* unused */
71int HGSMIChannelRegisterName (PHGSMIINSTANCE pIns,
72 const char *pszChannel,
73 PFNHGSMICHANNELHANDLER pfnChannelHandler,
74 void *pvChannelHandler,
75 uint8_t *pu8Channel);
76#endif
77
78int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns, HGSMIOFFSET RT_UNTRUSTED_GUEST offHeap, HGSMISIZE RT_UNTRUSTED_GUEST cbHeap);
79
80/*
81 * Virtual hardware IO handlers.
82 */
83
84/* Guests passes a new command buffer to the host. */
85void HGSMIGuestWrite(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
86
87/* Guest reads information about guest buffers. */
88HGSMIOFFSET HGSMIGuestRead(PHGSMIINSTANCE pIns);
89
90/* Guest reads the host FIFO to get a command. */
91HGSMIOFFSET HGSMIHostRead(PHGSMIINSTANCE pIns);
92
93/* Guest reports that the command at this offset has been processed. */
94void HGSMIHostWrite(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
95
96void HGSMISetHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
97uint32_t HGSMIGetHostGuestFlags(HGSMIINSTANCE *pIns);
98
99void HGSMIClearHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
100
101/*
102 * Low level interface for submitting buffers to the guest.
103 *
104 * These functions are not directly available for anyone but the
105 * virtual hardware device.
106 */
107
108/* Allocate a buffer in the host heap. */
109int HGSMIHostCommandAlloc(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST **ppvData, HGSMISIZE cbData,
110 uint8_t u8Channel, uint16_t u16ChannelInfo);
111int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData, bool fDoIrq);
112int HGSMIHostCommandFree(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData);
113
114int HGSMIHostLoadStateExec(const struct PDMDEVHLPR3 *pHlp, PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version);
115int HGSMIHostSaveStateExec(const struct PDMDEVHLPR3 *pHlp, PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
116
117#ifdef VBOX_WITH_WDDM
118int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvMem, bool fDoIrq);
119#endif
120
121#endif /* !VBOX_INCLUDED_SRC_Graphics_HGSMI_HGSMIHost_h */
122
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