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