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