1 /* Copyright (C) 2010 - 2013 UNISYS CORPORATION
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or (at
7 * your option) any later version.
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
16 #ifndef __VBUSCHANNEL_H__
17 #define __VBUSCHANNEL_H__
19 /* The vbus channel is the channel area provided via the BUS_CREATE controlvm
20 * message for each virtual bus. This channel area is provided to both server
21 * and client ends of the bus. The channel header area is initialized by
22 * the server, and the remaining information is filled in by the client.
23 * We currently use this for the client to provide various information about
24 * the client devices and client drivers for the server end to see.
26 #include <linux/uuid.h>
27 #include "vbusdeviceinfo.h"
30 /* {193b331b-c58f-11da-95a9-00e08161165f} */
31 #define SPAR_VBUS_CHANNEL_PROTOCOL_UUID \
32 UUID_LE(0x193b331b, 0xc58f, 0x11da, \
33 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
34 static const uuid_le spar_vbus_channel_protocol_uuid =
35 SPAR_VBUS_CHANNEL_PROTOCOL_UUID;
37 #define SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
39 /* Must increment this whenever you insert or delete fields within this channel
40 * struct. Also increment whenever you change the meaning of fields within this
41 * channel struct so as to break pre-existing software. Note that you can
42 * usually add fields to the END of the channel struct withOUT needing to
44 #define SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID 1
46 #define SPAR_VBUS_CHANNEL_OK_CLIENT(ch) \
47 spar_check_channel_client(ch, \
48 spar_vbus_channel_protocol_uuid, \
50 sizeof(struct spar_vbus_channel_protocol),\
51 SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID, \
52 SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE)
54 #define SPAR_VBUS_CHANNEL_OK_SERVER(actual_bytes) \
55 (spar_check_channel_server(spar_vbus_channel_protocol_uuid, \
57 sizeof(struct ultra_vbus_channel_protocol),\
60 #pragma pack(push, 1) /* both GCC and VC now allow this pragma */
61 struct spar_vbus_headerinfo {
62 u32 struct_bytes; /* size of this struct in bytes */
63 u32 device_info_struct_bytes; /* sizeof(ULTRA_VBUS_DEVICEINFO) */
64 u32 dev_info_count; /* num of items in DevInfo member */
65 /* (this is the allocated size) */
66 u32 chp_info_offset; /* byte offset from beginning of this struct */
67 /* to the ChpInfo struct (below) */
68 u32 bus_info_offset; /* byte offset from beginning of this struct */
69 /* to the BusInfo struct (below) */
70 u32 dev_info_offset; /* byte offset from beginning of this struct */
71 /* to the DevInfo array (below) */
75 struct spar_vbus_channel_protocol {
76 struct channel_header channel_header; /* initialized by server */
77 struct spar_vbus_headerinfo hdr_info; /* initialized by server */
78 /* the remainder of this channel is filled in by the client */
79 struct ultra_vbus_deviceinfo chp_info;
80 /* describes client chipset device and driver */
81 struct ultra_vbus_deviceinfo bus_info;
82 /* describes client bus device and driver */
83 struct ultra_vbus_deviceinfo dev_info[0];
84 /* describes client device and driver for each device on the bus */
87 #define VBUS_CH_SIZE_EXACT(MAXDEVICES) \
88 (sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL) + ((MAXDEVICES) * \
89 sizeof(ULTRA_VBUS_DEVICEINFO)))
90 #define VBUS_CH_SIZE(MAXDEVICES) COVER(VBUS_CH_SIZE_EXACT(MAXDEVICES), 4096)