1 /*
2  * Copyright (C) 2006-2017 Oracle Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __HGSMI_CH_SETUP_H__
24 #define __HGSMI_CH_SETUP_H__
25 
26 /*
27  * Tell the host the location of hgsmi_host_flags structure, where the host
28  * can write information about pending buffers, etc, and which can be quickly
29  * polled by the guest without a need to port IO.
30  */
31 #define HGSMI_CC_HOST_FLAGS_LOCATION 0
32 
33 struct hgsmi_buffer_location {
34 	u32 buf_location;
35 	u32 buf_len;
36 } __packed;
37 
38 /* HGSMI setup and configuration data structures. */
39 /* host->guest commands pending, should be accessed under FIFO lock only */
40 #define HGSMIHOSTFLAGS_COMMANDS_PENDING    0x01u
41 /* IRQ is fired, should be accessed under VGAState::lock only  */
42 #define HGSMIHOSTFLAGS_IRQ                 0x02u
43 /* vsync interrupt flag, should be accessed under VGAState::lock only */
44 #define HGSMIHOSTFLAGS_VSYNC               0x10u
45 /** monitor hotplug flag, should be accessed under VGAState::lock only */
46 #define HGSMIHOSTFLAGS_HOTPLUG             0x20u
47 /**
48  * Cursor capability state change flag, should be accessed under
49  * VGAState::lock only. @see vbva_conf32.
50  */
51 #define HGSMIHOSTFLAGS_CURSOR_CAPABILITIES 0x40u
52 
53 struct hgsmi_host_flags {
54 	/*
55 	 * Host flags can be accessed and modified in multiple threads
56 	 * concurrently, e.g. CrOpenGL HGCM and GUI threads when completing
57 	 * HGSMI 3D and Video Accel respectively, EMT thread when dealing with
58 	 * HGSMI command processing, etc.
59 	 * Besides settings/cleaning flags atomically, some flags have their
60 	 * own special sync restrictions, see comments for flags above.
61 	 */
62 	u32 host_flags;
63 	u32 reserved[3];
64 } __packed;
65 
66 #endif
67