1 /* Copyright (C) 2010 - 2015 UNISYS CORPORATION
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for more
15 #ifndef __VBUSCHANNEL_H__
16 #define __VBUSCHANNEL_H__
18 /* The vbus channel is the channel area provided via the BUS_CREATE controlvm
19 * message for each virtual bus. This channel area is provided to both server
20 * and client ends of the bus. The channel header area is initialized by
21 * the server, and the remaining information is filled in by the client.
22 * We currently use this for the client to provide various information about
23 * the client devices and client drivers for the server end to see.
25 #include <linux/uuid.h>
26 #include "vbusdeviceinfo.h"
29 /* {193b331b-c58f-11da-95a9-00e08161165f} */
30 #define SPAR_VBUS_CHANNEL_PROTOCOL_UUID \
31 UUID_LE(0x193b331b, 0xc58f, 0x11da, \
32 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
33 static const uuid_le spar_vbus_channel_protocol_uuid =
34 SPAR_VBUS_CHANNEL_PROTOCOL_UUID;
36 #define SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
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
43 #define SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID 1
45 #define SPAR_VBUS_CHANNEL_OK_CLIENT(ch) \
46 spar_check_channel_client(ch, \
47 spar_vbus_channel_protocol_uuid, \
49 sizeof(struct spar_vbus_channel_protocol),\
50 SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID, \
51 SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE)
53 #define SPAR_VBUS_CHANNEL_OK_SERVER(actual_bytes) \
54 (spar_check_channel_server(spar_vbus_channel_protocol_uuid, \
56 sizeof(struct spar_vbus_channel_protocol),\
59 #pragma pack(push, 1) /* both GCC and VC now allow this pragma */
60 struct spar_vbus_headerinfo {
61 u32 struct_bytes; /* size of this struct in bytes */
62 u32 device_info_struct_bytes; /* sizeof(ULTRA_VBUS_DEVICEINFO) */
63 u32 dev_info_count; /* num of items in DevInfo member */
64 /* (this is the allocated size) */
65 u32 chp_info_offset; /* byte offset from beginning of this struct */
66 /* to the ChpInfo struct (below) */
67 u32 bus_info_offset; /* byte offset from beginning of this struct */
68 /* to the BusInfo struct (below) */
69 u32 dev_info_offset; /* byte offset from beginning of this struct */
70 /* to the DevInfo array (below) */
74 struct spar_vbus_channel_protocol {
75 struct channel_header channel_header; /* initialized by server */
76 struct spar_vbus_headerinfo hdr_info; /* initialized by server */
77 /* the remainder of this channel is filled in by the client */
78 struct ultra_vbus_deviceinfo chp_info;
79 /* describes client chipset device and driver */
80 struct ultra_vbus_deviceinfo bus_info;
81 /* describes client bus device and driver */
82 struct ultra_vbus_deviceinfo dev_info[0];
83 /* describes client device and driver for each device on the bus */
86 #define VBUS_CH_SIZE_EXACT(MAXDEVICES) \
87 (sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL) + ((MAXDEVICES) * \
88 sizeof(ULTRA_VBUS_DEVICEINFO)))
89 #define VBUS_CH_SIZE(MAXDEVICES) COVER(VBUS_CH_SIZE_EXACT(MAXDEVICES), 4096)