]>
Commit | Line | Data |
---|---|---|
6d209b23 SF |
1 | /* |
2 | * Copyright (C) 2006-2017 Oracle Corporation | |
3 | * | |
26894aac SF |
4 | * Permission is hereby granted, free of charge, to any person |
5 | * obtaining a copy of this software and associated documentation | |
6 | * files (the "Software"), to deal in the Software without | |
7 | * restriction, including without limitation the rights to use, | |
8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell | |
9 | * copies of the Software, and to permit persons to whom the | |
10 | * Software is furnished to do so, subject to the following | |
11 | * conditions: | |
6d209b23 | 12 | * |
26894aac SF |
13 | * The above copyright notice and this permission notice shall be |
14 | * included in all copies or substantial portions of the Software. | |
6d209b23 | 15 | * |
26894aac SF |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
23 | * OTHER DEALINGS IN THE SOFTWARE. | |
6d209b23 SF |
24 | */ |
25 | ||
26 | ||
27 | #ifndef ___VBox_Graphics_HGSMIContext_h___ | |
28 | #define ___VBox_Graphics_HGSMIContext_h___ | |
29 | ||
30 | #include "HGSMI.h" | |
31 | #include "hgsmi_ch_setup.h" | |
32 | #include "vbox_err.h" | |
33 | ||
34 | #ifdef VBOX_WDDM_MINIPORT | |
35 | # include "wddm/VBoxMPShgsmi.h" | |
36 | typedef VBOXSHGSMI HGSMIGUESTCMDHEAP; | |
37 | # define HGSMIGUESTCMDHEAP_GET(_p) (&(_p)->Heap) | |
38 | #else | |
39 | typedef HGSMIHEAP HGSMIGUESTCMDHEAP; | |
40 | # define HGSMIGUESTCMDHEAP_GET(_p) (_p) | |
41 | #endif | |
42 | ||
43 | ||
44 | /** | |
45 | * Structure grouping the context needed for submitting commands to the host | |
46 | * via HGSMI | |
47 | */ | |
48 | typedef struct HGSMIGUESTCOMMANDCONTEXT { | |
49 | /** Information about the memory heap located in VRAM from which data | |
50 | * structures to be sent to the host are allocated. */ | |
51 | HGSMIGUESTCMDHEAP heapCtx; | |
52 | /** The I/O port used for submitting commands to the host by writing their | |
53 | * offsets into the heap. */ | |
54 | RTIOPORT port; | |
55 | } HGSMIGUESTCOMMANDCONTEXT, *PHGSMIGUESTCOMMANDCONTEXT; | |
56 | ||
57 | ||
58 | /** | |
59 | * Structure grouping the context needed for receiving commands from the host | |
60 | * via HGSMI | |
61 | */ | |
62 | typedef struct HGSMIHOSTCOMMANDCONTEXT { | |
63 | /** Information about the memory area located in VRAM in which the host | |
64 | * places data structures to be read by the guest. */ | |
65 | HGSMIAREA areaCtx; | |
66 | /** Convenience structure used for matching host commands to handlers. */ | |
67 | /** @todo handlers are registered individually in code rather than just | |
68 | * passing a static structure in order to gain extra flexibility. There is | |
69 | * currently no expected usage case for this though. Is the additional | |
70 | * complexity really justified? */ | |
71 | HGSMICHANNELINFO channels; | |
72 | /** Flag to indicate that one thread is currently processing the command | |
73 | * queue. */ | |
74 | volatile bool fHostCmdProcessing; | |
75 | /* Pointer to the VRAM location where the HGSMI host flags are kept. */ | |
76 | volatile struct hgsmi_host_flags *pfHostFlags; | |
77 | /** The I/O port used for receiving commands from the host as offsets into | |
78 | * the memory area and sending back confirmations (command completion, | |
79 | * IRQ acknowlegement). */ | |
80 | RTIOPORT port; | |
81 | } HGSMIHOSTCOMMANDCONTEXT, *PHGSMIHOSTCOMMANDCONTEXT; | |
82 | ||
83 | /** @name HGSMI context initialisation APIs. | |
84 | * @{ */ | |
85 | ||
86 | /** @todo we should provide a cleanup function too as part of the API */ | |
87 | int VBoxHGSMISetupGuestContext(struct gen_pool * ctx, | |
88 | void *pvGuestHeapMemory, | |
89 | u32 cbGuestHeapMemory, | |
90 | u32 offVRAMGuestHeapMemory, | |
91 | const HGSMIENV *pEnv); | |
92 | void VBoxHGSMISetupHostContext(PHGSMIHOSTCOMMANDCONTEXT ctx, | |
93 | void *pvBaseMapping, | |
94 | u32 offHostFlags, | |
95 | void *pvHostAreaMapping, | |
96 | u32 offVRAMHostArea, | |
97 | u32 cbHostArea); | |
98 | ||
99 | /** @} */ | |
100 | ||
101 | ||
102 | #endif | |
103 |