• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 - 2015 UNISYS CORPORATION
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12  * NON INFRINGEMENT.  See the GNU General Public License for more
13  * details.
14  */
15 
16 #ifndef __VBUSCHANNEL_H__
17 #define __VBUSCHANNEL_H__
18 
19 /*
20  * The vbus channel is the channel area provided via the BUS_CREATE controlvm
21  * message for each virtual bus.  This channel area is provided to both server
22  * and client ends of the bus.  The channel header area is initialized by
23  * the server, and the remaining information is filled in by the client.
24  * We currently use this for the client to provide various information about
25  * the client devices and client drivers for the server end to see.
26  */
27 
28 #include <linux/uuid.h>
29 #include <linux/ctype.h>
30 #include "channel.h"
31 
32 /* {193b331b-c58f-11da-95a9-00e08161165f} */
33 #define VISOR_VBUS_CHANNEL_GUID						\
34 	GUID_INIT(0x193b331b, 0xc58f, 0x11da,				\
35 		  0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
36 
37 /*
38  * Must increment this whenever you insert or delete fields within this channel
39  * struct.  Also increment whenever you change the meaning of fields within this
40  * channel struct so as to break pre-existing software.  Note that you can
41  * usually add fields to the END of the channel struct withOUT needing to
42  * increment this.
43  */
44 #define VISOR_VBUS_CHANNEL_VERSIONID 1
45 
46 /*
47  * struct visor_vbus_deviceinfo
48  * @devtype:  Short string identifying the device type.
49  * @drvname:  Driver .sys file name.
50  * @infostrs: Kernel vversion.
51  * @reserved: Pad size to 256 bytes.
52  *
53  * An array of this struct is present in the channel area for each vbus.
54  * (See vbuschannel.h.). It is filled in by the client side to provide info
55  * about the device and driver from the client's perspective.
56  */
57 struct visor_vbus_deviceinfo {
58 	u8 devtype[16];
59 	u8 drvname[16];
60 	u8 infostrs[96];
61 	u8 reserved[128];
62 } __packed;
63 
64 /*
65  * struct visor_vbus_headerinfo
66  * @struct_bytes:	      Size of this struct in bytes.
67  * @device_info_struct_bytes: Size of VISOR_VBUS_DEVICEINFO.
68  * @dev_info_count:	      Num of items in DevInfo member. This is the
69  *			      allocated size.
70  * @chp_info_offset:	      Byte offset from beginning of this struct to the
71  *			      ChpInfo struct.
72  * @bus_info_offset:	      Byte offset from beginning of this struct to the
73  *			      BusInfo struct.
74  * @dev_info_offset:	      Byte offset from beginning of this struct to the
75  *			      DevInfo array.
76  * @reserved:		      Natural Alignment
77  */
78 struct visor_vbus_headerinfo {
79 	u32 struct_bytes;
80 	u32 device_info_struct_bytes;
81 	u32 dev_info_count;
82 	u32 chp_info_offset;
83 	u32 bus_info_offset;
84 	u32 dev_info_offset;
85 	u8 reserved[104];
86 } __packed;
87 
88 /*
89  * struct visor_vbus_channel
90  * @channel_header: Initialized by server.
91  * @hdr_info:	    Initialized by server.
92  * @chp_info:	    Describes client chipset device and driver.
93  * @bus_info:	    Describes client bus device and driver.
94  * @dev_info:	    Describes client device and driver for each device on the
95  *		    bus.
96  */
97 struct visor_vbus_channel {
98 	struct channel_header channel_header;
99 	struct visor_vbus_headerinfo hdr_info;
100 	/* The remainder of this channel is filled in by the client */
101 	struct visor_vbus_deviceinfo chp_info;
102 	struct visor_vbus_deviceinfo bus_info;
103 	struct visor_vbus_deviceinfo dev_info[0];
104 } __packed;
105 
106 #endif
107