]>
Commit | Line | Data |
---|---|---|
f6d0c1e6 | 1 | /* Copyright (C) 2010 - 2013 UNISYS CORPORATION |
12e364b9 KC |
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 | */ | |
90addb02 | 26 | #include <linux/uuid.h> |
12e364b9 KC |
27 | #include "commontypes.h" |
28 | #include "vbusdeviceinfo.h" | |
29 | #include "channel.h" | |
30 | ||
31 | /* {193b331b-c58f-11da-95a9-00e08161165f} */ | |
32 | #define ULTRA_VBUS_CHANNEL_PROTOCOL_GUID \ | |
90addb02 BR |
33 | UUID_LE(0x193b331b, 0xc58f, 0x11da, \ |
34 | 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f) | |
35 | static const uuid_le UltraVbusChannelProtocolGuid = | |
12e364b9 KC |
36 | ULTRA_VBUS_CHANNEL_PROTOCOL_GUID; |
37 | ||
38 | #define ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE | |
39 | ||
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 | |
44 | * increment this. */ | |
45 | #define ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID 1 | |
46 | ||
47 | #define ULTRA_VBUS_CHANNEL_OK_CLIENT(pChannel, logCtx) \ | |
48 | (ULTRA_check_channel_client(pChannel, \ | |
49 | UltraVbusChannelProtocolGuid, \ | |
50 | "vbus", \ | |
51 | sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL), \ | |
52 | ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID, \ | |
53 | ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE, \ | |
54 | __FILE__, __LINE__, logCtx)) | |
55 | ||
56 | #define ULTRA_VBUS_CHANNEL_OK_SERVER(actualBytes, logCtx) \ | |
57 | (ULTRA_check_channel_server(UltraVbusChannelProtocolGuid, \ | |
58 | "vbus", \ | |
59 | sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL), \ | |
60 | actualBytes, \ | |
61 | __FILE__, __LINE__, logCtx)) | |
62 | ||
63 | ||
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) */ | |
76 | U8 reserved[104]; | |
77 | } ULTRA_VBUS_HEADERINFO; | |
78 | ||
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 | |
84 | * driver */ | |
85 | ULTRA_VBUS_DEVICEINFO BusInfo; /* describes client bus device and | |
86 | * driver */ | |
87 | ULTRA_VBUS_DEVICEINFO DevInfo[0]; /* describes client device and | |
88 | * driver for */ | |
89 | /* each device on the bus */ | |
90 | } ULTRA_VBUS_CHANNEL_PROTOCOL; | |
91 | ||
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) | |
96 | ||
12e364b9 KC |
97 | #pragma pack(pop) |
98 | ||
99 | #endif |