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