1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox Host Guest Shared Memory Interface (HGSMI).
|
---|
4 | * Host part.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2008 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 |
|
---|
24 | #ifndef ___HGSMIHost_h
|
---|
25 | #define ___HGSMIHost_h
|
---|
26 |
|
---|
27 | #include <VBox/vm.h>
|
---|
28 |
|
---|
29 | #include <VBox/HGSMI/HGSMI.h>
|
---|
30 | #include <VBox/HGSMI/HGSMIChSetup.h>
|
---|
31 |
|
---|
32 | struct _HGSMIINSTANCE;
|
---|
33 | typedef struct _HGSMIINSTANCE *PHGSMIINSTANCE;
|
---|
34 |
|
---|
35 | /* Callback for the guest notifiation about a new host buffer. */
|
---|
36 | typedef DECLCALLBACK(void) FNHGSMINOTIFYGUEST(void *pvCallback);
|
---|
37 | typedef FNHGSMINOTIFYGUEST *PFNHGSMINOTIFYGUEST;
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * Public Host API for virtual devices.
|
---|
41 | */
|
---|
42 |
|
---|
43 | int HGSMICreate (PHGSMIINSTANCE *ppIns,
|
---|
44 | PVM pVM,
|
---|
45 | const char *pszName,
|
---|
46 | HGSMIOFFSET offBase,
|
---|
47 | uint8_t *pu8MemBase,
|
---|
48 | HGSMISIZE cbMem,
|
---|
49 | PFNHGSMINOTIFYGUEST pfnNotifyGuest,
|
---|
50 | void *pvNotifyGuest,
|
---|
51 | size_t cbContext);
|
---|
52 |
|
---|
53 | void HGSMIDestroy (PHGSMIINSTANCE pIns);
|
---|
54 |
|
---|
55 | void *HGSMIContext (PHGSMIINSTANCE pIns);
|
---|
56 |
|
---|
57 | void *HGSMIOffsetToPointerHost (PHGSMIINSTANCE pIns,
|
---|
58 | HGSMIOFFSET offBuffer);
|
---|
59 |
|
---|
60 | HGSMIOFFSET HGSMIPointerToOffsetHost (PHGSMIINSTANCE pIns,
|
---|
61 | const void *pv);
|
---|
62 |
|
---|
63 | int HGSMIHostChannelRegister (PHGSMIINSTANCE pIns,
|
---|
64 | uint8_t u8Channel,
|
---|
65 | PFNHGSMICHANNELHANDLER pfnChannelHandler,
|
---|
66 | void *pvChannelHandler,
|
---|
67 | HGSMICHANNELHANDLER *pOldHandler);
|
---|
68 |
|
---|
69 | int HGSMIChannelRegisterName (PHGSMIINSTANCE pIns,
|
---|
70 | const char *pszChannel,
|
---|
71 | PFNHGSMICHANNELHANDLER pfnChannelHandler,
|
---|
72 | void *pvChannelHandler,
|
---|
73 | uint8_t *pu8Channel,
|
---|
74 | HGSMICHANNELHANDLER *pOldHandler);
|
---|
75 |
|
---|
76 | int HGSMIChannelHandlerCall (PHGSMIINSTANCE pIns,
|
---|
77 | const HGSMICHANNELHANDLER *pHandler,
|
---|
78 | const HGSMIBUFFERHEADER *pHeader);
|
---|
79 |
|
---|
80 |
|
---|
81 | int HGSMISetupHostHeap (PHGSMIINSTANCE pIns,
|
---|
82 | HGSMIOFFSET offHeap,
|
---|
83 | HGSMISIZE cbHeap);
|
---|
84 |
|
---|
85 | int HGSMISaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
|
---|
86 | int HGSMILoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
|
---|
87 |
|
---|
88 | /*
|
---|
89 | * Virtual hardware IO handlers.
|
---|
90 | */
|
---|
91 |
|
---|
92 | /* Guests passes a new command buffer to the host. */
|
---|
93 | void HGSMIGuestWrite (PHGSMIINSTANCE pIns,
|
---|
94 | HGSMIOFFSET offBuffer);
|
---|
95 |
|
---|
96 | /* Guest reads information about guest buffers. */
|
---|
97 | HGSMIOFFSET HGSMIGuestRead (PHGSMIINSTANCE pIns);
|
---|
98 |
|
---|
99 | /* Guest reads the host FIFO to get a command. */
|
---|
100 | HGSMIOFFSET HGSMIHostRead (PHGSMIINSTANCE pIns);
|
---|
101 |
|
---|
102 | /* Guest reports that the command at this offset has been processed. */
|
---|
103 | void HGSMIHostWrite (PHGSMIINSTANCE pIns,
|
---|
104 | HGSMIOFFSET offBuffer);
|
---|
105 |
|
---|
106 | void HGSMISetHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
|
---|
107 |
|
---|
108 | void HGSMIClearHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
|
---|
109 |
|
---|
110 | /*
|
---|
111 | * Low level interface for submitting buffers to the guest.
|
---|
112 | *
|
---|
113 | * These functions are not directly available for anyone but the
|
---|
114 | * virtual hardware device.
|
---|
115 | */
|
---|
116 |
|
---|
117 | /* Allocate a buffer in the host heap. */
|
---|
118 | int HGSMIHostCommandAlloc (PHGSMIINSTANCE pIns,
|
---|
119 | void **ppvMem,
|
---|
120 | HGSMISIZE cbMem,
|
---|
121 | uint8_t u8Channel,
|
---|
122 | uint16_t u16ChannelInfo);
|
---|
123 |
|
---|
124 | int HGSMIHostCommandProcess (PHGSMIINSTANCE pIns,
|
---|
125 | void *pvMem);
|
---|
126 |
|
---|
127 | int HGSMIHostCommandProcessAndFreeAsynch (PHGSMIINSTANCE pIns,
|
---|
128 | void *pvMem,
|
---|
129 | bool bDoIrq);
|
---|
130 |
|
---|
131 | int HGSMIHostCommandFree (PHGSMIINSTANCE pIns,
|
---|
132 | void *pvMem);
|
---|
133 |
|
---|
134 | int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version);
|
---|
135 |
|
---|
136 | int HGSMIHostSaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
|
---|
137 |
|
---|
138 | #if 0
|
---|
139 | /* Submit this buffer to the guest asynchronously. */
|
---|
140 | int HGSMIHostBufferProcessAsync (PHGSMIINSTANCE pIns,
|
---|
141 | void *pvMem,
|
---|
142 | PFNHGSMIBUFFERPROCESSED);
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | #endif /* !___HGSMIHost_h*/
|
---|
146 |
|
---|