1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox Host Guest Shared Memory Interface (HGSMI).
|
---|
4 | * Host part.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2015 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 |
|
---|
20 | #ifndef ___HGSMIHost_h
|
---|
21 | #define ___HGSMIHost_h
|
---|
22 |
|
---|
23 | #include <VBox/vmm/vm.h>
|
---|
24 |
|
---|
25 | #include <VBox/HGSMI/HGSMI.h>
|
---|
26 | #include <VBox/HGSMI/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 DECLCALLBACK(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 | PVM pVM,
|
---|
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 |
|
---|
49 | void HGSMIDestroy (PHGSMIINSTANCE pIns);
|
---|
50 |
|
---|
51 | void *HGSMIContext (PHGSMIINSTANCE pIns);
|
---|
52 |
|
---|
53 | void *HGSMIOffsetToPointerHost (PHGSMIINSTANCE pIns,
|
---|
54 | HGSMIOFFSET offBuffer);
|
---|
55 |
|
---|
56 | HGSMIOFFSET HGSMIPointerToOffsetHost (PHGSMIINSTANCE pIns,
|
---|
57 | const void *pv);
|
---|
58 |
|
---|
59 | int HGSMIHostChannelRegister (PHGSMIINSTANCE pIns,
|
---|
60 | uint8_t u8Channel,
|
---|
61 | PFNHGSMICHANNELHANDLER pfnChannelHandler,
|
---|
62 | void *pvChannelHandler);
|
---|
63 |
|
---|
64 | int HGSMIChannelRegisterName (PHGSMIINSTANCE pIns,
|
---|
65 | const char *pszChannel,
|
---|
66 | PFNHGSMICHANNELHANDLER pfnChannelHandler,
|
---|
67 | void *pvChannelHandler,
|
---|
68 | uint8_t *pu8Channel);
|
---|
69 |
|
---|
70 | int HGSMISetupHostHeap (PHGSMIINSTANCE pIns,
|
---|
71 | HGSMIOFFSET offHeap,
|
---|
72 | HGSMISIZE cbHeap);
|
---|
73 |
|
---|
74 | int HGSMISaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
|
---|
75 | int HGSMILoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
|
---|
76 |
|
---|
77 | /*
|
---|
78 | * Virtual hardware IO handlers.
|
---|
79 | */
|
---|
80 |
|
---|
81 | /* Guests passes a new command buffer to the host. */
|
---|
82 | void HGSMIGuestWrite (PHGSMIINSTANCE pIns,
|
---|
83 | HGSMIOFFSET offBuffer);
|
---|
84 |
|
---|
85 | /* Guest reads information about guest buffers. */
|
---|
86 | HGSMIOFFSET HGSMIGuestRead (PHGSMIINSTANCE pIns);
|
---|
87 |
|
---|
88 | /* Guest reads the host FIFO to get a command. */
|
---|
89 | HGSMIOFFSET HGSMIHostRead (PHGSMIINSTANCE pIns);
|
---|
90 |
|
---|
91 | /* Guest reports that the command at this offset has been processed. */
|
---|
92 | void HGSMIHostWrite (PHGSMIINSTANCE pIns,
|
---|
93 | HGSMIOFFSET offBuffer);
|
---|
94 |
|
---|
95 | void HGSMISetHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
|
---|
96 |
|
---|
97 | void HGSMIClearHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
|
---|
98 |
|
---|
99 | /*
|
---|
100 | * Low level interface for submitting buffers to the guest.
|
---|
101 | *
|
---|
102 | * These functions are not directly available for anyone but the
|
---|
103 | * virtual hardware device.
|
---|
104 | */
|
---|
105 |
|
---|
106 | /* Allocate a buffer in the host heap. */
|
---|
107 | int HGSMIHostCommandAlloc (PHGSMIINSTANCE pIns,
|
---|
108 | void **ppvMem,
|
---|
109 | HGSMISIZE cbMem,
|
---|
110 | uint8_t u8Channel,
|
---|
111 | uint16_t u16ChannelInfo);
|
---|
112 |
|
---|
113 | int HGSMIHostCommandProcess (PHGSMIINSTANCE pIns,
|
---|
114 | void *pvMem);
|
---|
115 |
|
---|
116 | int HGSMIHostCommandProcessAndFreeAsynch (PHGSMIINSTANCE pIns,
|
---|
117 | void *pvMem,
|
---|
118 | bool bDoIrq);
|
---|
119 |
|
---|
120 | int HGSMIHostCommandFree (PHGSMIINSTANCE pIns,
|
---|
121 | void *pvMem);
|
---|
122 |
|
---|
123 | int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version);
|
---|
124 |
|
---|
125 | int HGSMIHostSaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
|
---|
126 |
|
---|
127 | #ifdef VBOX_WITH_WDDM
|
---|
128 | int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void *pvMem, bool bDoIrq);
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | #endif /* !___HGSMIHost_h*/
|
---|
132 |
|
---|