~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/include/ipxe/xsigo.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _IPXE_XSIGO_H
 
2
#define _IPXE_XSIGO_H
 
3
 
 
4
/** @file
 
5
 *
 
6
 * Xsigo virtual Ethernet devices
 
7
 *
 
8
 */
 
9
 
 
10
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 
11
 
 
12
#include <stdint.h>
 
13
#include <ipxe/infiniband.h>
 
14
#include <ipxe/eoib.h>
 
15
 
 
16
/** Xsigo directory service record name */
 
17
#define XDS_SERVICE_NAME "XSIGOXDS"
 
18
 
 
19
/** Xsigo configuration manager service ID */
 
20
#define XCM_SERVICE_ID { 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x97, 0x01 }
 
21
 
 
22
/** Xsigo management class */
 
23
#define XSIGO_MGMT_CLASS 0x0b
 
24
 
 
25
/** Xsigo management class version */
 
26
#define XSIGO_MGMT_CLASS_VERSION 2
 
27
 
 
28
/** Xsigo configuration manager request MAD */
 
29
#define XSIGO_ATTR_XCM_REQUEST 0xb002
 
30
 
 
31
/** Generic operating system type */
 
32
#define XSIGO_OS_TYPE_GENERIC 0x40
 
33
 
 
34
/** Xsigo virtual Ethernet broadcast GID prefix */
 
35
#define XVE_PREFIX 0xff15101cUL
 
36
 
 
37
/** Xsigo resource types */
 
38
enum xsigo_resource_type {
 
39
        /** Virtual Ethernet resource type */
 
40
        XSIGO_RESOURCE_XVE = ( 1 << 6 ),
 
41
        /** Absence-of-high-availability "resource" type */
 
42
        XSIGO_RESOURCE_NO_HA = ( 1 << 4 ),
 
43
};
 
44
 
 
45
/** A Xsigo server identifier */
 
46
struct xsigo_server_id {
 
47
        /** Virtual machine ID */
 
48
        uint32_t vm;
 
49
        /** Port GUID */
 
50
        union ib_guid guid;
 
51
} __attribute__ (( packed ));
 
52
 
 
53
/** A Xsigo configuration manager identifier */
 
54
struct xsigo_manager_id {
 
55
        /** Port GUID */
 
56
        union ib_guid guid;
 
57
        /** LID */
 
58
        uint16_t lid;
 
59
        /** Reserved */
 
60
        uint8_t reserved[10];
 
61
} __attribute__ (( packed ));
 
62
 
 
63
/** A Xsigo configuration manager request MAD */
 
64
struct xsigo_managers_request {
 
65
        /** MAD header */
 
66
        struct ib_mad_hdr mad_hdr;
 
67
        /** Reserved */
 
68
        uint8_t reserved0[32];
 
69
        /** Server ID */
 
70
        struct xsigo_server_id server;
 
71
        /** Hostname */
 
72
        char hostname[ 65 /* Seriously, guys? */ ];
 
73
        /** OS version */
 
74
        char os_version[32];
 
75
        /** CPU architecture */
 
76
        char arch[16];
 
77
        /** OS type */
 
78
        uint8_t os_type;
 
79
        /** Reserved */
 
80
        uint8_t reserved1[3];
 
81
        /** Firmware version */
 
82
        uint64_t firmware_version;
 
83
        /** Hardware version */
 
84
        uint32_t hardware_version;
 
85
        /** Driver version */
 
86
        uint32_t driver_version;
 
87
        /** System ID */
 
88
        union ib_gid system_id;
 
89
        /** Resource types */
 
90
        uint16_t resources;
 
91
        /** Reserved */
 
92
        uint8_t reserved2[2];
 
93
        /** Build version */
 
94
        char build[16];
 
95
        /** Reserved */
 
96
        uint8_t reserved3[19];
 
97
} __attribute__ (( packed ));
 
98
 
 
99
/** Resource types are present */
 
100
#define XSIGO_RESOURCES_PRESENT 0x8000
 
101
 
 
102
/** A Xsigo configuration manager reply MAD */
 
103
struct xsigo_managers_reply {
 
104
        /** MAD header */
 
105
        struct ib_mad_hdr mad_hdr;
 
106
        /** Reserved */
 
107
        uint8_t reserved0[32];
 
108
        /** Server ID */
 
109
        struct xsigo_server_id server;
 
110
        /** Number of XCM records */
 
111
        uint8_t count;
 
112
        /** Version */
 
113
        uint8_t version;
 
114
        /** Reserved */
 
115
        uint8_t reserved1[2];
 
116
        /** Managers */
 
117
        struct xsigo_manager_id manager[8];
 
118
        /** Reserved */
 
119
        uint8_t reserved2[24];
 
120
} __attribute__ (( packed ));
 
121
 
 
122
/** A Xsigo MAD */
 
123
union xsigo_mad {
 
124
        /** Generic MAD */
 
125
        union ib_mad mad;
 
126
        /** Configuration manager request */
 
127
        struct xsigo_managers_request request;
 
128
        /** Configuration manager reply */
 
129
        struct xsigo_managers_reply reply;
 
130
} __attribute__ (( packed ));
 
131
 
 
132
/** An XSMP node identifier */
 
133
struct xsmp_node_id {
 
134
        /** Auxiliary ID (never used) */
 
135
        uint32_t aux;
 
136
        /** Port GUID */
 
137
        union ib_guid guid;
 
138
} __attribute__ (( packed ));
 
139
 
 
140
/** An XSMP message header */
 
141
struct xsmp_message_header {
 
142
        /** Message type */
 
143
        uint8_t type;
 
144
        /** Reason code */
 
145
        uint8_t code;
 
146
        /** Length */
 
147
        uint16_t len;
 
148
        /** Sequence number */
 
149
        uint32_t seq;
 
150
        /** Source node ID */
 
151
        struct xsmp_node_id src;
 
152
        /** Destination node ID */
 
153
        struct xsmp_node_id dst;
 
154
} __attribute__ (( packed ));
 
155
 
 
156
/** XSMP message types */
 
157
enum xsmp_message_type {
 
158
        /** Session message type */
 
159
        XSMP_TYPE_SESSION = 1,
 
160
        /** Virtual Ethernet message type */
 
161
        XSMP_TYPE_XVE = 6,
 
162
};
 
163
 
 
164
/** An XSMP session message */
 
165
struct xsmp_session_message {
 
166
        /** Message header */
 
167
        struct xsmp_message_header hdr;
 
168
        /** Message type */
 
169
        uint8_t type;
 
170
        /** Reason code */
 
171
        uint8_t code;
 
172
        /** Length (excluding message header) */
 
173
        uint16_t len;
 
174
        /** Operating system type */
 
175
        uint8_t os_type;
 
176
        /** Reserved */
 
177
        uint8_t reserved0;
 
178
        /** Resource types */
 
179
        uint16_t resources;
 
180
        /** Driver version */
 
181
        uint32_t driver_version;
 
182
        /** Required chassis version */
 
183
        uint32_t chassis_version;
 
184
        /** Boot flags */
 
185
        uint32_t boot;
 
186
        /** Firmware version */
 
187
        uint64_t firmware_version;
 
188
        /** Hardware version */
 
189
        uint32_t hardware_version;
 
190
        /** Vendor part ID */
 
191
        uint32_t vendor;
 
192
        /** Protocol version */
 
193
        uint32_t xsmp_version;
 
194
        /** Chassis name */
 
195
        char chassis[32];
 
196
        /** Session name */
 
197
        char session[32];
 
198
        /** Reserved */
 
199
        uint8_t reserved1[120];
 
200
} __attribute__ (( packed ));
 
201
 
 
202
/** XSMP session message types */
 
203
enum xsmp_session_type {
 
204
        /** Keepalive message */
 
205
        XSMP_SESSION_TYPE_HELLO = 1,
 
206
        /** Initial registration message */
 
207
        XSMP_SESSION_TYPE_REGISTER = 2,
 
208
        /** Registration confirmation message */
 
209
        XSMP_SESSION_TYPE_CONFIRM = 3,
 
210
        /** Registration rejection message */
 
211
        XSMP_SESSION_TYPE_REJECT = 4,
 
212
        /** Shutdown message */
 
213
        XSMP_SESSION_TYPE_SHUTDOWN = 5,
 
214
};
 
215
 
 
216
/** XSMP boot flags */
 
217
enum xsmp_session_boot {
 
218
        /** PXE boot */
 
219
        XSMP_BOOT_PXE = ( 1 << 0 ),
 
220
};
 
221
 
 
222
/** XSMP virtual Ethernet channel adapter parameters */
 
223
struct xsmp_xve_ca {
 
224
        /** Subnet prefix (little-endian) */
 
225
        union ib_guid prefix_le;
 
226
        /** Control queue pair number */
 
227
        uint32_t ctrl;
 
228
        /** Data queue pair number */
 
229
        uint32_t data;
 
230
        /** Partition key */
 
231
        uint16_t pkey;
 
232
        /** Queue key */
 
233
        uint16_t qkey;
 
234
} __attribute__ (( packed ));
 
235
 
 
236
/** XSMP virtual Ethernet MAC address */
 
237
struct xsmp_xve_mac {
 
238
        /** High 16 bits */
 
239
        uint16_t high;
 
240
        /** Low 32 bits */
 
241
        uint32_t low;
 
242
} __attribute__ (( packed ));
 
243
 
 
244
/** An XSMP virtual Ethernet message */
 
245
struct xsmp_xve_message {
 
246
        /** Message header */
 
247
        struct xsmp_message_header hdr;
 
248
        /** Message type */
 
249
        uint8_t type;
 
250
        /** Reason code */
 
251
        uint8_t code;
 
252
        /** Length (excluding message header) */
 
253
        uint16_t len;
 
254
        /** Update bitmask */
 
255
        uint32_t update;
 
256
        /** Resource identifier */
 
257
        union ib_guid resource;
 
258
        /** TCA GUID (little-endian) */
 
259
        union ib_guid guid_le;
 
260
        /** TCA LID */
 
261
        uint16_t lid;
 
262
        /** MAC address (little-endian) */
 
263
        struct xsmp_xve_mac mac_le;
 
264
        /** Rate */
 
265
        uint16_t rate;
 
266
        /** Administrative state (non-zero = "up") */
 
267
        uint16_t state;
 
268
        /** Encapsulation (apparently obsolete and unused) */
 
269
        uint16_t encap;
 
270
        /** MTU */
 
271
        uint16_t mtu;
 
272
        /** Installation flags (apparently obsolete and unused) */
 
273
        uint32_t install;
 
274
        /** Interface name */
 
275
        char name[16];
 
276
        /** Service level */
 
277
        uint16_t sl;
 
278
        /** Flow control enabled (apparently obsolete and unused) */
 
279
        uint16_t flow;
 
280
        /** Committed rate (in Mbps) */
 
281
        uint16_t committed_mbps;
 
282
        /** Peak rate (in Mbps) */
 
283
        uint16_t peak_mbps;
 
284
        /** Committed burst size (in bytes) */
 
285
        uint32_t committed_burst;
 
286
        /** Peak burst size (in bytes) */
 
287
        uint32_t peak_burst;
 
288
        /** VMware index */
 
289
        uint8_t vmware;
 
290
        /** Reserved */
 
291
        uint8_t reserved0;
 
292
        /** Multipath flags */
 
293
        uint16_t multipath;
 
294
        /** Multipath group name */
 
295
        char group[48];
 
296
        /** Link aggregation flag */
 
297
        uint8_t agg;
 
298
        /** Link aggregation policy */
 
299
        uint8_t policy;
 
300
        /** Network ID */
 
301
        uint32_t network;
 
302
        /** Mode */
 
303
        uint8_t mode;
 
304
        /** Uplink type */
 
305
        uint8_t uplink;
 
306
        /** Target channel adapter parameters */
 
307
        struct xsmp_xve_ca tca;
 
308
        /** Host channel adapter parameters */
 
309
        struct xsmp_xve_ca hca;
 
310
        /** Reserved */
 
311
        uint8_t reserved1[336];
 
312
} __attribute__ (( packed ));
 
313
 
 
314
/** XSMP virtual Ethernet message types */
 
315
enum xsmp_xve_type {
 
316
        /** Install virtual NIC */
 
317
        XSMP_XVE_TYPE_INSTALL = 1,
 
318
        /** Delete virtual NIC */
 
319
        XSMP_XVE_TYPE_DELETE = 2,
 
320
        /** Update virtual NIC */
 
321
        XSMP_XVE_TYPE_UPDATE = 3,
 
322
        /** Set operational state up */
 
323
        XSMP_XVE_TYPE_OPER_UP = 6,
 
324
        /** Set operational state down */
 
325
        XSMP_XVE_TYPE_OPER_DOWN = 7,
 
326
        /** Get operational state */
 
327
        XSMP_XVE_TYPE_OPER_REQ = 15,
 
328
        /** Virtual NIC is ready */
 
329
        XSMP_XVE_TYPE_READY = 20,
 
330
};
 
331
 
 
332
/** XSMP virtual Ethernet message codes */
 
333
enum xsmp_xve_code {
 
334
        /* Something went wrong */
 
335
        XSMP_XVE_CODE_ERROR = 0x84,
 
336
};
 
337
 
 
338
/** XSMP virtual Ethernet update bitmask */
 
339
enum xsmp_xve_update {
 
340
        /** Update MTU */
 
341
        XSMP_XVE_UPDATE_MTU = ( 1 << 2 ),
 
342
        /** Update administrative state */
 
343
        XSMP_XVE_UPDATE_STATE = ( 1 << 6 ),
 
344
        /** Update gateway to mark as down */
 
345
        XSMP_XVE_UPDATE_GW_DOWN = ( 1 << 30 ),
 
346
        /** Update gateway information */
 
347
        XSMP_XVE_UPDATE_GW_CHANGE = ( 1 << 31 ),
 
348
};
 
349
 
 
350
/** XSMP virtual Ethernet modes */
 
351
enum xsmp_xve_mode {
 
352
        /** Reliable Connected */
 
353
        XSMP_XVE_MODE_RC = 1,
 
354
        /** Unreliable Datagram */
 
355
        XSMP_XVE_MODE_UD = 2,
 
356
};
 
357
 
 
358
/** XSMP virtual Ethernet uplink types */
 
359
enum xsmp_xve_uplink {
 
360
        /** No uplink */
 
361
        XSMP_XVE_NO_UPLINK = 1,
 
362
        /** Has uplink */
 
363
        XSMP_XVE_UPLINK = 2,
 
364
};
 
365
 
 
366
/** An XSMP message */
 
367
union xsmp_message {
 
368
        /** Message header */
 
369
        struct xsmp_message_header hdr;
 
370
        /** Session message */
 
371
        struct xsmp_session_message sess;
 
372
        /** Virtual Ethernet message */
 
373
        struct xsmp_xve_message xve;
 
374
};
 
375
 
 
376
/** Delay between attempts to open the Infiniband device
 
377
 *
 
378
 * This is a policy decision.
 
379
 */
 
380
#define XSIGO_OPEN_RETRY_DELAY ( 2 * TICKS_PER_SEC )
 
381
 
 
382
/** Delay between unsuccessful discovery attempts
 
383
 *
 
384
 * This is a policy decision.
 
385
 */
 
386
#define XSIGO_DISCOVERY_FAILURE_DELAY ( 10 * TICKS_PER_SEC )
 
387
 
 
388
/** Delay between successful discovery attempts
 
389
 *
 
390
 * This is a policy decision.
 
391
 */
 
392
#define XSIGO_DISCOVERY_SUCCESS_DELAY ( 20 * TICKS_PER_SEC )
 
393
 
 
394
/** Delay between keepalive requests
 
395
 *
 
396
 * This is a policy decision.
 
397
 */
 
398
#define XSIGO_KEEPALIVE_INTERVAL ( 10 * TICKS_PER_SEC )
 
399
 
 
400
/** Maximum time to wait for a keepalive response
 
401
 *
 
402
 * This is a policy decision.
 
403
 */
 
404
#define XSIGO_KEEPALIVE_MAX_WAIT ( 2 * TICKS_PER_SEC )
 
405
 
 
406
#endif /* _IPXE_XSIGO_H */