Benjamin Romer | 6f14cc1 | 2015-07-16 12:40:48 -0400 | [diff] [blame] | 1 | /* Copyright (C) 2010 - 2015 UNISYS CORPORATION |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 2 | * All rights reserved. |
| 3 | * |
Benjamin Romer | 6f14cc1 | 2015-07-16 12:40:48 -0400 | [diff] [blame] | 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. |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 7 | * |
| 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 Romer | 90addb0 | 2014-05-06 09:58:23 -0400 | [diff] [blame] | 25 | #include <linux/uuid.h> |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 26 | #include "vbusdeviceinfo.h" |
| 27 | #include "channel.h" |
| 28 | |
| 29 | /* {193b331b-c58f-11da-95a9-00e08161165f} */ |
Benjamin Romer | 8bde404 | 2014-10-23 14:31:06 -0400 | [diff] [blame] | 30 | #define SPAR_VBUS_CHANNEL_PROTOCOL_UUID \ |
Benjamin Romer | 90addb0 | 2014-05-06 09:58:23 -0400 | [diff] [blame] | 31 | UUID_LE(0x193b331b, 0xc58f, 0x11da, \ |
| 32 | 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) |
Benjamin Romer | 8bde404 | 2014-10-23 14:31:06 -0400 | [diff] [blame] | 33 | static const uuid_le spar_vbus_channel_protocol_uuid = |
| 34 | SPAR_VBUS_CHANNEL_PROTOCOL_UUID; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 35 | |
Benjamin Romer | 8bde404 | 2014-10-23 14:31:06 -0400 | [diff] [blame] | 36 | #define SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 37 | |
| 38 | /* Must increment this whenever you insert or delete fields within this channel |
Erik Arfvidson | e3f8f77 | 2015-11-17 13:35:00 -0500 | [diff] [blame] | 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 | */ |
Benjamin Romer | 8bde404 | 2014-10-23 14:31:06 -0400 | [diff] [blame] | 44 | #define SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID 1 |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 45 | |
Benjamin Romer | 1aa46ce | 2014-10-23 14:31:07 -0400 | [diff] [blame] | 46 | #define SPAR_VBUS_CHANNEL_OK_CLIENT(ch) \ |
| 47 | spar_check_channel_client(ch, \ |
Benjamin Romer | a02fd66 | 2014-10-23 14:31:10 -0400 | [diff] [blame] | 48 | 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 Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 53 | |
Benjamin Romer | 9b8a8a9 | 2014-10-23 14:31:08 -0400 | [diff] [blame] | 54 | #define SPAR_VBUS_CHANNEL_OK_SERVER(actual_bytes) \ |
Benjamin Romer | 8bde404 | 2014-10-23 14:31:06 -0400 | [diff] [blame] | 55 | (spar_check_channel_server(spar_vbus_channel_protocol_uuid, \ |
| 56 | "vbus", \ |
Erik Arfvidson | 3703987 | 2015-05-05 18:36:00 -0400 | [diff] [blame] | 57 | sizeof(struct spar_vbus_channel_protocol),\ |
Benjamin Romer | 9b8a8a9 | 2014-10-23 14:31:08 -0400 | [diff] [blame] | 58 | actual_bytes)) |
Benjamin Romer | 10c5ef6 | 2014-10-23 14:30:11 -0400 | [diff] [blame] | 59 | |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 60 | #pragma pack(push, 1) /* both GCC and VC now allow this pragma */ |
Benjamin Romer | 1cb3b9d | 2014-10-23 14:31:09 -0400 | [diff] [blame] | 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 */ |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 65 | /* (this is the allocated size) */ |
Benjamin Romer | 1cb3b9d | 2014-10-23 14:31:09 -0400 | [diff] [blame] | 66 | u32 chp_info_offset; /* byte offset from beginning of this struct */ |
Tapasweni Pathak | 682adec | 2014-10-06 11:27:39 +0530 | [diff] [blame] | 67 | /* to the ChpInfo struct (below) */ |
Benjamin Romer | 1cb3b9d | 2014-10-23 14:31:09 -0400 | [diff] [blame] | 68 | u32 bus_info_offset; /* byte offset from beginning of this struct */ |
Tapasweni Pathak | 682adec | 2014-10-06 11:27:39 +0530 | [diff] [blame] | 69 | /* to the BusInfo struct (below) */ |
Benjamin Romer | 1cb3b9d | 2014-10-23 14:31:09 -0400 | [diff] [blame] | 70 | u32 dev_info_offset; /* byte offset from beginning of this struct */ |
Tapasweni Pathak | 682adec | 2014-10-06 11:27:39 +0530 | [diff] [blame] | 71 | /* to the DevInfo array (below) */ |
Benjamin Romer | c242233 | 2014-07-29 15:09:40 -0400 | [diff] [blame] | 72 | u8 reserved[104]; |
Benjamin Romer | 1cb3b9d | 2014-10-23 14:31:09 -0400 | [diff] [blame] | 73 | }; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 74 | |
Benjamin Romer | a02fd66 | 2014-10-23 14:31:10 -0400 | [diff] [blame] | 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 */ |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 78 | /* the remainder of this channel is filled in by the client */ |
Benjamin Romer | a02fd66 | 2014-10-23 14:31:10 -0400 | [diff] [blame] | 79 | struct ultra_vbus_deviceinfo chp_info; |
Benjamin Romer | 32b6b29 | 2014-10-03 14:09:18 -0400 | [diff] [blame] | 80 | /* describes client chipset device and driver */ |
Benjamin Romer | a02fd66 | 2014-10-23 14:31:10 -0400 | [diff] [blame] | 81 | struct ultra_vbus_deviceinfo bus_info; |
Benjamin Romer | 32b6b29 | 2014-10-03 14:09:18 -0400 | [diff] [blame] | 82 | /* describes client bus device and driver */ |
Benjamin Romer | a02fd66 | 2014-10-23 14:31:10 -0400 | [diff] [blame] | 83 | struct ultra_vbus_deviceinfo dev_info[0]; |
Benjamin Romer | 32b6b29 | 2014-10-03 14:09:18 -0400 | [diff] [blame] | 84 | /* describes client device and driver for each device on the bus */ |
Benjamin Romer | 51121ff | 2014-10-03 14:09:12 -0400 | [diff] [blame] | 85 | }; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 86 | |
| 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 Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 92 | #pragma pack(pop) |
| 93 | |
| 94 | #endif |