1/* Copyright (C) 2010 - 2013 UNISYS CORPORATION 2 * All rights reserved. 3 * 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. 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/* 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. 25 */ 26#include <linux/uuid.h> 27#include "vbusdeviceinfo.h" 28#include "channel.h" 29 30/* {193b331b-c58f-11da-95a9-00e08161165f} */ 31#define ULTRA_VBUS_CHANNEL_PROTOCOL_GUID \ 32 UUID_LE(0x193b331b, 0xc58f, 0x11da, \ 33 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) 34static const uuid_le UltraVbusChannelProtocolGuid = 35 ULTRA_VBUS_CHANNEL_PROTOCOL_GUID; 36 37#define ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE 38 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 43* increment this. */ 44#define ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID 1 45 46#define ULTRA_VBUS_CHANNEL_OK_CLIENT(pChannel, logCtx) \ 47 (ULTRA_check_channel_client(pChannel, \ 48 UltraVbusChannelProtocolGuid, \ 49 "vbus", \ 50 sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL), \ 51 ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID, \ 52 ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE, \ 53 __FILE__, __LINE__, logCtx)) 54 55#define ULTRA_VBUS_CHANNEL_OK_SERVER(actualBytes, logCtx) \ 56 (ULTRA_check_channel_server(UltraVbusChannelProtocolGuid, \ 57 "vbus", \ 58 sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL), \ 59 actualBytes, \ 60 __FILE__, __LINE__, logCtx)) 61 62 63#pragma pack(push, 1) /* both GCC and VC now allow this pragma */ 64typedef struct _ULTRA_VBUS_HEADERINFO { 65 u32 structBytes; /* size of this struct in bytes */ 66 u32 deviceInfoStructBytes; /* sizeof(ULTRA_VBUS_DEVICEINFO) */ 67 u32 devInfoCount; /* num of items in DevInfo member */ 68 /* (this is the allocated size) */ 69 u32 chpInfoByteOffset; /* byte offset from beginning of this struct */ 70 /* to the the ChpInfo struct (below) */ 71 u32 busInfoByteOffset; /* byte offset from beginning of this struct */ 72 /* to the the BusInfo struct (below) */ 73 u32 devInfoByteOffset; /* byte offset from beginning of this struct */ 74 /* to the the DevInfo array (below) */ 75 u8 reserved[104]; 76} ULTRA_VBUS_HEADERINFO; 77 78typedef struct _ULTRA_VBUS_CHANNEL_PROTOCOL { 79 ULTRA_CHANNEL_PROTOCOL ChannelHeader; /* initialized by server */ 80 ULTRA_VBUS_HEADERINFO HdrInfo; /* initialized by server */ 81 /* the remainder of this channel is filled in by the client */ 82 ULTRA_VBUS_DEVICEINFO ChpInfo; /* describes client chipset device and 83 * driver */ 84 ULTRA_VBUS_DEVICEINFO BusInfo; /* describes client bus device and 85 * driver */ 86 ULTRA_VBUS_DEVICEINFO DevInfo[0]; /* describes client device and 87 * driver for */ 88 /* each device on the bus */ 89} ULTRA_VBUS_CHANNEL_PROTOCOL; 90 91#define VBUS_CH_SIZE_EXACT(MAXDEVICES) \ 92 (sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL) + ((MAXDEVICES) * \ 93 sizeof(ULTRA_VBUS_DEVICEINFO))) 94#define VBUS_CH_SIZE(MAXDEVICES) COVER(VBUS_CH_SIZE_EXACT(MAXDEVICES), 4096) 95 96#pragma pack(pop) 97 98#endif 99