xref: /OK3568_Linux_fs/kernel/drivers/visorbus/vbuschannel.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (C) 2010 - 2015 UNISYS CORPORATION
4*4882a593Smuzhiyun  * All rights reserved.
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #ifndef __VBUSCHANNEL_H__
8*4882a593Smuzhiyun #define __VBUSCHANNEL_H__
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun /*
11*4882a593Smuzhiyun  * The vbus channel is the channel area provided via the BUS_CREATE controlvm
12*4882a593Smuzhiyun  * message for each virtual bus.  This channel area is provided to both server
13*4882a593Smuzhiyun  * and client ends of the bus.  The channel header area is initialized by
14*4882a593Smuzhiyun  * the server, and the remaining information is filled in by the client.
15*4882a593Smuzhiyun  * We currently use this for the client to provide various information about
16*4882a593Smuzhiyun  * the client devices and client drivers for the server end to see.
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #include <linux/uuid.h>
20*4882a593Smuzhiyun #include <linux/visorbus.h>
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun /* {193b331b-c58f-11da-95a9-00e08161165f} */
23*4882a593Smuzhiyun #define VISOR_VBUS_CHANNEL_GUID						\
24*4882a593Smuzhiyun 	GUID_INIT(0x193b331b, 0xc58f, 0x11da,				\
25*4882a593Smuzhiyun 		  0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun /*
28*4882a593Smuzhiyun  * Must increment this whenever you insert or delete fields within this channel
29*4882a593Smuzhiyun  * struct.  Also increment whenever you change the meaning of fields within this
30*4882a593Smuzhiyun  * channel struct so as to break pre-existing software.  Note that you can
31*4882a593Smuzhiyun  * usually add fields to the END of the channel struct withOUT needing to
32*4882a593Smuzhiyun  * increment this.
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun #define VISOR_VBUS_CHANNEL_VERSIONID 1
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun /*
37*4882a593Smuzhiyun  * struct visor_vbus_deviceinfo
38*4882a593Smuzhiyun  * @devtype:  Short string identifying the device type.
39*4882a593Smuzhiyun  * @drvname:  Driver .sys file name.
40*4882a593Smuzhiyun  * @infostrs: Kernel vversion.
41*4882a593Smuzhiyun  * @reserved: Pad size to 256 bytes.
42*4882a593Smuzhiyun  *
43*4882a593Smuzhiyun  * An array of this struct is present in the channel area for each vbus. It is
44*4882a593Smuzhiyun  * filled in by the client side to provide info about the device and driver from
45*4882a593Smuzhiyun  * the client's perspective.
46*4882a593Smuzhiyun  */
47*4882a593Smuzhiyun struct visor_vbus_deviceinfo {
48*4882a593Smuzhiyun 	u8 devtype[16];
49*4882a593Smuzhiyun 	u8 drvname[16];
50*4882a593Smuzhiyun 	u8 infostrs[96];
51*4882a593Smuzhiyun 	u8 reserved[128];
52*4882a593Smuzhiyun } __packed;
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun /*
55*4882a593Smuzhiyun  * struct visor_vbus_headerinfo
56*4882a593Smuzhiyun  * @struct_bytes:	      Size of this struct in bytes.
57*4882a593Smuzhiyun  * @device_info_struct_bytes: Size of VISOR_VBUS_DEVICEINFO.
58*4882a593Smuzhiyun  * @dev_info_count:	      Num of items in DevInfo member. This is the
59*4882a593Smuzhiyun  *			      allocated size.
60*4882a593Smuzhiyun  * @chp_info_offset:	      Byte offset from beginning of this struct to the
61*4882a593Smuzhiyun  *			      ChpInfo struct.
62*4882a593Smuzhiyun  * @bus_info_offset:	      Byte offset from beginning of this struct to the
63*4882a593Smuzhiyun  *			      BusInfo struct.
64*4882a593Smuzhiyun  * @dev_info_offset:	      Byte offset from beginning of this struct to the
65*4882a593Smuzhiyun  *			      DevInfo array.
66*4882a593Smuzhiyun  * @reserved:		      Natural alignment.
67*4882a593Smuzhiyun  */
68*4882a593Smuzhiyun struct visor_vbus_headerinfo {
69*4882a593Smuzhiyun 	u32 struct_bytes;
70*4882a593Smuzhiyun 	u32 device_info_struct_bytes;
71*4882a593Smuzhiyun 	u32 dev_info_count;
72*4882a593Smuzhiyun 	u32 chp_info_offset;
73*4882a593Smuzhiyun 	u32 bus_info_offset;
74*4882a593Smuzhiyun 	u32 dev_info_offset;
75*4882a593Smuzhiyun 	u8 reserved[104];
76*4882a593Smuzhiyun } __packed;
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun /*
79*4882a593Smuzhiyun  * struct visor_vbus_channel
80*4882a593Smuzhiyun  * @channel_header: Initialized by server.
81*4882a593Smuzhiyun  * @hdr_info:	    Initialized by server.
82*4882a593Smuzhiyun  * @chp_info:	    Describes client chipset device and driver.
83*4882a593Smuzhiyun  * @bus_info:	    Describes client bus device and driver.
84*4882a593Smuzhiyun  * @dev_info:	    Describes client device and driver for each device on the
85*4882a593Smuzhiyun  *		    bus.
86*4882a593Smuzhiyun  */
87*4882a593Smuzhiyun struct visor_vbus_channel {
88*4882a593Smuzhiyun 	struct channel_header channel_header;
89*4882a593Smuzhiyun 	struct visor_vbus_headerinfo hdr_info;
90*4882a593Smuzhiyun 	struct visor_vbus_deviceinfo chp_info;
91*4882a593Smuzhiyun 	struct visor_vbus_deviceinfo bus_info;
92*4882a593Smuzhiyun 	struct visor_vbus_deviceinfo dev_info[0];
93*4882a593Smuzhiyun } __packed;
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun #endif
96