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 "commontypes.h"
28 #include "vbusdeviceinfo.h"
31 /* {193b331b-c58f-11da-95a9-00e08161165f} */
32 #define ULTRA_VBUS_CHANNEL_PROTOCOL_GUID \
33 UUID_LE(0x193b331b, 0xc58f, 0x11da, \
34 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
35 static const uuid_le UltraVbusChannelProtocolGuid
=
36 ULTRA_VBUS_CHANNEL_PROTOCOL_GUID
;
38 #define ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
40 /* Must increment this whenever you insert or delete fields within this channel
41 * struct. Also increment whenever you change the meaning of fields within this
42 * channel struct so as to break pre-existing software. Note that you can
43 * usually add fields to the END of the channel struct withOUT needing to
45 #define ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID 1
47 #define ULTRA_VBUS_CHANNEL_OK_CLIENT(pChannel, logCtx) \
48 (ULTRA_check_channel_client(pChannel, \
49 UltraVbusChannelProtocolGuid, \
51 sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL), \
52 ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID, \
53 ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE, \
54 __FILE__, __LINE__, logCtx))
56 #define ULTRA_VBUS_CHANNEL_OK_SERVER(actualBytes, logCtx) \
57 (ULTRA_check_channel_server(UltraVbusChannelProtocolGuid, \
59 sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL), \
61 __FILE__, __LINE__, logCtx))
64 #pragma pack(push, 1) /* both GCC and VC now allow this pragma */
65 typedef struct _ULTRA_VBUS_HEADERINFO
{
66 U32 structBytes
; /* size of this struct in bytes */
67 U32 deviceInfoStructBytes
; /* sizeof(ULTRA_VBUS_DEVICEINFO) */
68 U32 devInfoCount
; /* num of items in DevInfo member */
69 /* (this is the allocated size) */
70 U32 chpInfoByteOffset
; /* byte offset from beginning of this struct */
71 /* to the the ChpInfo struct (below) */
72 U32 busInfoByteOffset
; /* byte offset from beginning of this struct */
73 /* to the the BusInfo struct (below) */
74 U32 devInfoByteOffset
; /* byte offset from beginning of this struct */
75 /* to the the DevInfo array (below) */
77 } ULTRA_VBUS_HEADERINFO
;
79 typedef struct _ULTRA_VBUS_CHANNEL_PROTOCOL
{
80 ULTRA_CHANNEL_PROTOCOL ChannelHeader
; /* initialized by server */
81 ULTRA_VBUS_HEADERINFO HdrInfo
; /* initialized by server */
82 /* the remainder of this channel is filled in by the client */
83 ULTRA_VBUS_DEVICEINFO ChpInfo
; /* describes client chipset device and
85 ULTRA_VBUS_DEVICEINFO BusInfo
; /* describes client bus device and
87 ULTRA_VBUS_DEVICEINFO DevInfo
[0]; /* describes client device and
89 /* each device on the bus */
90 } ULTRA_VBUS_CHANNEL_PROTOCOL
;
92 #define VBUS_CH_SIZE_EXACT(MAXDEVICES) \
93 (sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL) + ((MAXDEVICES) * \
94 sizeof(ULTRA_VBUS_DEVICEINFO)))
95 #define VBUS_CH_SIZE(MAXDEVICES) COVER(VBUS_CH_SIZE_EXACT(MAXDEVICES), 4096)