blob: 90fa12e62f26c88e3ff29b5faa9abd82706ad810 [file] [log] [blame]
Benjamin Romer6f14cc12015-07-16 12:40:48 -04001/* Copyright (C) 2010 - 2015 UNISYS CORPORATION
Ken Cox12e364b2014-03-04 07:58:07 -06002 * All rights reserved.
3 *
Benjamin Romer6f14cc12015-07-16 12:40:48 -04004 * 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.
Ken Cox12e364b2014-03-04 07:58:07 -06007 *
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
12 * details.
13 */
14
15#ifndef __VBUSCHANNEL_H__
16#define __VBUSCHANNEL_H__
17
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.
24 */
Benjamin Romer90addb02014-05-06 09:58:23 -040025#include <linux/uuid.h>
Ken Cox12e364b2014-03-04 07:58:07 -060026#include "vbusdeviceinfo.h"
27#include "channel.h"
28
29/* {193b331b-c58f-11da-95a9-00e08161165f} */
Benjamin Romer8bde4042014-10-23 14:31:06 -040030#define SPAR_VBUS_CHANNEL_PROTOCOL_UUID \
Benjamin Romer90addb02014-05-06 09:58:23 -040031 UUID_LE(0x193b331b, 0xc58f, 0x11da, \
32 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
Benjamin Romer8bde4042014-10-23 14:31:06 -040033static const uuid_le spar_vbus_channel_protocol_uuid =
34 SPAR_VBUS_CHANNEL_PROTOCOL_UUID;
Ken Cox12e364b2014-03-04 07:58:07 -060035
Benjamin Romer8bde4042014-10-23 14:31:06 -040036#define SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
Ken Cox12e364b2014-03-04 07:58:07 -060037
38/* Must increment this whenever you insert or delete fields within this channel
Erik Arfvidsone3f8f772015-11-17 13:35:00 -050039 * 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 */
Benjamin Romer8bde4042014-10-23 14:31:06 -040044#define SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID 1
Ken Cox12e364b2014-03-04 07:58:07 -060045
Benjamin Romer1aa46ce2014-10-23 14:31:07 -040046#define SPAR_VBUS_CHANNEL_OK_CLIENT(ch) \
47 spar_check_channel_client(ch, \
Benjamin Romera02fd662014-10-23 14:31:10 -040048 spar_vbus_channel_protocol_uuid, \
49 "vbus", \
50 sizeof(struct spar_vbus_channel_protocol),\
51 SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID, \
52 SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE)
Ken Cox12e364b2014-03-04 07:58:07 -060053
Benjamin Romer9b8a8a92014-10-23 14:31:08 -040054#define SPAR_VBUS_CHANNEL_OK_SERVER(actual_bytes) \
Benjamin Romer8bde4042014-10-23 14:31:06 -040055 (spar_check_channel_server(spar_vbus_channel_protocol_uuid, \
56 "vbus", \
Erik Arfvidson37039872015-05-05 18:36:00 -040057 sizeof(struct spar_vbus_channel_protocol),\
Benjamin Romer9b8a8a92014-10-23 14:31:08 -040058 actual_bytes))
Benjamin Romer10c5ef62014-10-23 14:30:11 -040059
Ken Cox12e364b2014-03-04 07:58:07 -060060#pragma pack(push, 1) /* both GCC and VC now allow this pragma */
Benjamin Romer1cb3b9d2014-10-23 14:31:09 -040061struct 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 */
Ken Cox12e364b2014-03-04 07:58:07 -060065 /* (this is the allocated size) */
Benjamin Romer1cb3b9d2014-10-23 14:31:09 -040066 u32 chp_info_offset; /* byte offset from beginning of this struct */
Tapasweni Pathak682adec2014-10-06 11:27:39 +053067 /* to the ChpInfo struct (below) */
Benjamin Romer1cb3b9d2014-10-23 14:31:09 -040068 u32 bus_info_offset; /* byte offset from beginning of this struct */
Tapasweni Pathak682adec2014-10-06 11:27:39 +053069 /* to the BusInfo struct (below) */
Benjamin Romer1cb3b9d2014-10-23 14:31:09 -040070 u32 dev_info_offset; /* byte offset from beginning of this struct */
Tapasweni Pathak682adec2014-10-06 11:27:39 +053071 /* to the DevInfo array (below) */
Benjamin Romerc2422332014-07-29 15:09:40 -040072 u8 reserved[104];
Benjamin Romer1cb3b9d2014-10-23 14:31:09 -040073};
Ken Cox12e364b2014-03-04 07:58:07 -060074
Benjamin Romera02fd662014-10-23 14:31:10 -040075struct spar_vbus_channel_protocol {
76 struct channel_header channel_header; /* initialized by server */
77 struct spar_vbus_headerinfo hdr_info; /* initialized by server */
Ken Cox12e364b2014-03-04 07:58:07 -060078 /* the remainder of this channel is filled in by the client */
Benjamin Romera02fd662014-10-23 14:31:10 -040079 struct ultra_vbus_deviceinfo chp_info;
Benjamin Romer32b6b292014-10-03 14:09:18 -040080 /* describes client chipset device and driver */
Benjamin Romera02fd662014-10-23 14:31:10 -040081 struct ultra_vbus_deviceinfo bus_info;
Benjamin Romer32b6b292014-10-03 14:09:18 -040082 /* describes client bus device and driver */
Benjamin Romera02fd662014-10-23 14:31:10 -040083 struct ultra_vbus_deviceinfo dev_info[0];
Benjamin Romer32b6b292014-10-03 14:09:18 -040084 /* describes client device and driver for each device on the bus */
Benjamin Romer51121ff2014-10-03 14:09:12 -040085};
Ken Cox12e364b2014-03-04 07:58:07 -060086
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)
91
Ken Cox12e364b2014-03-04 07:58:07 -060092#pragma pack(pop)
93
94#endif