Merge tag 'v3.0.0-rc2'
[qemu/ar7.git] / slirp / ncsi-pkt.h
blobea07d1cd0f97395068d7a3ecab4a1a7d1895d21a
1 /*
2 * Copyright Gavin Shan, IBM Corporation 2016.
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
7 * (at your option) any later version.
8 */
10 #ifndef NCSI_PKT_H
11 #define NCSI_PKT_H
13 /* from linux/net/ncsi/ncsi-pkt.h */
14 #define __be32 uint32_t
15 #define __be16 uint16_t
17 struct ncsi_pkt_hdr {
18 unsigned char mc_id; /* Management controller ID */
19 unsigned char revision; /* NCSI version - 0x01 */
20 unsigned char reserved; /* Reserved */
21 unsigned char id; /* Packet sequence number */
22 unsigned char type; /* Packet type */
23 unsigned char channel; /* Network controller ID */
24 __be16 length; /* Payload length */
25 __be32 reserved1[2]; /* Reserved */
28 struct ncsi_cmd_pkt_hdr {
29 struct ncsi_pkt_hdr common; /* Common NCSI packet header */
32 struct ncsi_rsp_pkt_hdr {
33 struct ncsi_pkt_hdr common; /* Common NCSI packet header */
34 __be16 code; /* Response code */
35 __be16 reason; /* Response reason */
38 struct ncsi_aen_pkt_hdr {
39 struct ncsi_pkt_hdr common; /* Common NCSI packet header */
40 unsigned char reserved2[3]; /* Reserved */
41 unsigned char type; /* AEN packet type */
44 /* NCSI common command packet */
45 struct ncsi_cmd_pkt {
46 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
47 __be32 checksum; /* Checksum */
48 unsigned char pad[26];
51 struct ncsi_rsp_pkt {
52 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
53 __be32 checksum; /* Checksum */
54 unsigned char pad[22];
57 /* Select Package */
58 struct ncsi_cmd_sp_pkt {
59 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
60 unsigned char reserved[3]; /* Reserved */
61 unsigned char hw_arbitration; /* HW arbitration */
62 __be32 checksum; /* Checksum */
63 unsigned char pad[22];
66 /* Disable Channel */
67 struct ncsi_cmd_dc_pkt {
68 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
69 unsigned char reserved[3]; /* Reserved */
70 unsigned char ald; /* Allow link down */
71 __be32 checksum; /* Checksum */
72 unsigned char pad[22];
75 /* Reset Channel */
76 struct ncsi_cmd_rc_pkt {
77 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
78 __be32 reserved; /* Reserved */
79 __be32 checksum; /* Checksum */
80 unsigned char pad[22];
83 /* AEN Enable */
84 struct ncsi_cmd_ae_pkt {
85 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
86 unsigned char reserved[3]; /* Reserved */
87 unsigned char mc_id; /* MC ID */
88 __be32 mode; /* AEN working mode */
89 __be32 checksum; /* Checksum */
90 unsigned char pad[18];
93 /* Set Link */
94 struct ncsi_cmd_sl_pkt {
95 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
96 __be32 mode; /* Link working mode */
97 __be32 oem_mode; /* OEM link mode */
98 __be32 checksum; /* Checksum */
99 unsigned char pad[18];
102 /* Set VLAN Filter */
103 struct ncsi_cmd_svf_pkt {
104 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
105 __be16 reserved; /* Reserved */
106 __be16 vlan; /* VLAN ID */
107 __be16 reserved1; /* Reserved */
108 unsigned char index; /* VLAN table index */
109 unsigned char enable; /* Enable or disable */
110 __be32 checksum; /* Checksum */
111 unsigned char pad[14];
114 /* Enable VLAN */
115 struct ncsi_cmd_ev_pkt {
116 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
117 unsigned char reserved[3]; /* Reserved */
118 unsigned char mode; /* VLAN filter mode */
119 __be32 checksum; /* Checksum */
120 unsigned char pad[22];
123 /* Set MAC Address */
124 struct ncsi_cmd_sma_pkt {
125 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
126 unsigned char mac[6]; /* MAC address */
127 unsigned char index; /* MAC table index */
128 unsigned char at_e; /* Addr type and operation */
129 __be32 checksum; /* Checksum */
130 unsigned char pad[18];
133 /* Enable Broadcast Filter */
134 struct ncsi_cmd_ebf_pkt {
135 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
136 __be32 mode; /* Filter mode */
137 __be32 checksum; /* Checksum */
138 unsigned char pad[22];
141 /* Enable Global Multicast Filter */
142 struct ncsi_cmd_egmf_pkt {
143 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
144 __be32 mode; /* Global MC mode */
145 __be32 checksum; /* Checksum */
146 unsigned char pad[22];
149 /* Set NCSI Flow Control */
150 struct ncsi_cmd_snfc_pkt {
151 struct ncsi_cmd_pkt_hdr cmd; /* Command header */
152 unsigned char reserved[3]; /* Reserved */
153 unsigned char mode; /* Flow control mode */
154 __be32 checksum; /* Checksum */
155 unsigned char pad[22];
158 /* Get Link Status */
159 struct ncsi_rsp_gls_pkt {
160 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
161 __be32 status; /* Link status */
162 __be32 other; /* Other indications */
163 __be32 oem_status; /* OEM link status */
164 __be32 checksum;
165 unsigned char pad[10];
168 /* Get Version ID */
169 struct ncsi_rsp_gvi_pkt {
170 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
171 __be32 ncsi_version; /* NCSI version */
172 unsigned char reserved[3]; /* Reserved */
173 unsigned char alpha2; /* NCSI version */
174 unsigned char fw_name[12]; /* f/w name string */
175 __be32 fw_version; /* f/w version */
176 __be16 pci_ids[4]; /* PCI IDs */
177 __be32 mf_id; /* Manufacture ID */
178 __be32 checksum;
181 /* Get Capabilities */
182 struct ncsi_rsp_gc_pkt {
183 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
184 __be32 cap; /* Capabilities */
185 __be32 bc_cap; /* Broadcast cap */
186 __be32 mc_cap; /* Multicast cap */
187 __be32 buf_cap; /* Buffering cap */
188 __be32 aen_cap; /* AEN cap */
189 unsigned char vlan_cnt; /* VLAN filter count */
190 unsigned char mixed_cnt; /* Mix filter count */
191 unsigned char mc_cnt; /* MC filter count */
192 unsigned char uc_cnt; /* UC filter count */
193 unsigned char reserved[2]; /* Reserved */
194 unsigned char vlan_mode; /* VLAN mode */
195 unsigned char channel_cnt; /* Channel count */
196 __be32 checksum; /* Checksum */
199 /* Get Parameters */
200 struct ncsi_rsp_gp_pkt {
201 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
202 unsigned char mac_cnt; /* Number of MAC addr */
203 unsigned char reserved[2]; /* Reserved */
204 unsigned char mac_enable; /* MAC addr enable flags */
205 unsigned char vlan_cnt; /* VLAN tag count */
206 unsigned char reserved1; /* Reserved */
207 __be16 vlan_enable; /* VLAN tag enable flags */
208 __be32 link_mode; /* Link setting */
209 __be32 bc_mode; /* BC filter mode */
210 __be32 valid_modes; /* Valid mode parameters */
211 unsigned char vlan_mode; /* VLAN mode */
212 unsigned char fc_mode; /* Flow control mode */
213 unsigned char reserved2[2]; /* Reserved */
214 __be32 aen_mode; /* AEN mode */
215 unsigned char mac[6]; /* Supported MAC addr */
216 __be16 vlan; /* Supported VLAN tags */
217 __be32 checksum; /* Checksum */
220 /* Get Controller Packet Statistics */
221 struct ncsi_rsp_gcps_pkt {
222 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
223 __be32 cnt_hi; /* Counter cleared */
224 __be32 cnt_lo; /* Counter cleared */
225 __be32 rx_bytes; /* Rx bytes */
226 __be32 tx_bytes; /* Tx bytes */
227 __be32 rx_uc_pkts; /* Rx UC packets */
228 __be32 rx_mc_pkts; /* Rx MC packets */
229 __be32 rx_bc_pkts; /* Rx BC packets */
230 __be32 tx_uc_pkts; /* Tx UC packets */
231 __be32 tx_mc_pkts; /* Tx MC packets */
232 __be32 tx_bc_pkts; /* Tx BC packets */
233 __be32 fcs_err; /* FCS errors */
234 __be32 align_err; /* Alignment errors */
235 __be32 false_carrier; /* False carrier detection */
236 __be32 runt_pkts; /* Rx runt packets */
237 __be32 jabber_pkts; /* Rx jabber packets */
238 __be32 rx_pause_xon; /* Rx pause XON frames */
239 __be32 rx_pause_xoff; /* Rx XOFF frames */
240 __be32 tx_pause_xon; /* Tx XON frames */
241 __be32 tx_pause_xoff; /* Tx XOFF frames */
242 __be32 tx_s_collision; /* Single collision frames */
243 __be32 tx_m_collision; /* Multiple collision frames */
244 __be32 l_collision; /* Late collision frames */
245 __be32 e_collision; /* Excessive collision frames */
246 __be32 rx_ctl_frames; /* Rx control frames */
247 __be32 rx_64_frames; /* Rx 64-bytes frames */
248 __be32 rx_127_frames; /* Rx 65-127 bytes frames */
249 __be32 rx_255_frames; /* Rx 128-255 bytes frames */
250 __be32 rx_511_frames; /* Rx 256-511 bytes frames */
251 __be32 rx_1023_frames; /* Rx 512-1023 bytes frames */
252 __be32 rx_1522_frames; /* Rx 1024-1522 bytes frames */
253 __be32 rx_9022_frames; /* Rx 1523-9022 bytes frames */
254 __be32 tx_64_frames; /* Tx 64-bytes frames */
255 __be32 tx_127_frames; /* Tx 65-127 bytes frames */
256 __be32 tx_255_frames; /* Tx 128-255 bytes frames */
257 __be32 tx_511_frames; /* Tx 256-511 bytes frames */
258 __be32 tx_1023_frames; /* Tx 512-1023 bytes frames */
259 __be32 tx_1522_frames; /* Tx 1024-1522 bytes frames */
260 __be32 tx_9022_frames; /* Tx 1523-9022 bytes frames */
261 __be32 rx_valid_bytes; /* Rx valid bytes */
262 __be32 rx_runt_pkts; /* Rx error runt packets */
263 __be32 rx_jabber_pkts; /* Rx error jabber packets */
264 __be32 checksum; /* Checksum */
267 /* Get NCSI Statistics */
268 struct ncsi_rsp_gns_pkt {
269 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
270 __be32 rx_cmds; /* Rx NCSI commands */
271 __be32 dropped_cmds; /* Dropped commands */
272 __be32 cmd_type_errs; /* Command type errors */
273 __be32 cmd_csum_errs; /* Command checksum errors */
274 __be32 rx_pkts; /* Rx NCSI packets */
275 __be32 tx_pkts; /* Tx NCSI packets */
276 __be32 tx_aen_pkts; /* Tx AEN packets */
277 __be32 checksum; /* Checksum */
280 /* Get NCSI Pass-through Statistics */
281 struct ncsi_rsp_gnpts_pkt {
282 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
283 __be32 tx_pkts; /* Tx packets */
284 __be32 tx_dropped; /* Tx dropped packets */
285 __be32 tx_channel_err; /* Tx channel errors */
286 __be32 tx_us_err; /* Tx undersize errors */
287 __be32 rx_pkts; /* Rx packets */
288 __be32 rx_dropped; /* Rx dropped packets */
289 __be32 rx_channel_err; /* Rx channel errors */
290 __be32 rx_us_err; /* Rx undersize errors */
291 __be32 rx_os_err; /* Rx oversize errors */
292 __be32 checksum; /* Checksum */
295 /* Get package status */
296 struct ncsi_rsp_gps_pkt {
297 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
298 __be32 status; /* Hardware arbitration status */
299 __be32 checksum;
302 /* Get package UUID */
303 struct ncsi_rsp_gpuuid_pkt {
304 struct ncsi_rsp_pkt_hdr rsp; /* Response header */
305 unsigned char uuid[16]; /* UUID */
306 __be32 checksum;
309 /* AEN: Link State Change */
310 struct ncsi_aen_lsc_pkt {
311 struct ncsi_aen_pkt_hdr aen; /* AEN header */
312 __be32 status; /* Link status */
313 __be32 oem_status; /* OEM link status */
314 __be32 checksum; /* Checksum */
315 unsigned char pad[14];
318 /* AEN: Configuration Required */
319 struct ncsi_aen_cr_pkt {
320 struct ncsi_aen_pkt_hdr aen; /* AEN header */
321 __be32 checksum; /* Checksum */
322 unsigned char pad[22];
325 /* AEN: Host Network Controller Driver Status Change */
326 struct ncsi_aen_hncdsc_pkt {
327 struct ncsi_aen_pkt_hdr aen; /* AEN header */
328 __be32 status; /* Status */
329 __be32 checksum; /* Checksum */
330 unsigned char pad[18];
333 /* NCSI packet revision */
334 #define NCSI_PKT_REVISION 0x01
336 /* NCSI packet commands */
337 #define NCSI_PKT_CMD_CIS 0x00 /* Clear Initial State */
338 #define NCSI_PKT_CMD_SP 0x01 /* Select Package */
339 #define NCSI_PKT_CMD_DP 0x02 /* Deselect Package */
340 #define NCSI_PKT_CMD_EC 0x03 /* Enable Channel */
341 #define NCSI_PKT_CMD_DC 0x04 /* Disable Channel */
342 #define NCSI_PKT_CMD_RC 0x05 /* Reset Channel */
343 #define NCSI_PKT_CMD_ECNT 0x06 /* Enable Channel Network Tx */
344 #define NCSI_PKT_CMD_DCNT 0x07 /* Disable Channel Network Tx */
345 #define NCSI_PKT_CMD_AE 0x08 /* AEN Enable */
346 #define NCSI_PKT_CMD_SL 0x09 /* Set Link */
347 #define NCSI_PKT_CMD_GLS 0x0a /* Get Link */
348 #define NCSI_PKT_CMD_SVF 0x0b /* Set VLAN Filter */
349 #define NCSI_PKT_CMD_EV 0x0c /* Enable VLAN */
350 #define NCSI_PKT_CMD_DV 0x0d /* Disable VLAN */
351 #define NCSI_PKT_CMD_SMA 0x0e /* Set MAC address */
352 #define NCSI_PKT_CMD_EBF 0x10 /* Enable Broadcast Filter */
353 #define NCSI_PKT_CMD_DBF 0x11 /* Disable Broadcast Filter */
354 #define NCSI_PKT_CMD_EGMF 0x12 /* Enable Global Multicast Filter */
355 #define NCSI_PKT_CMD_DGMF 0x13 /* Disable Global Multicast Filter */
356 #define NCSI_PKT_CMD_SNFC 0x14 /* Set NCSI Flow Control */
357 #define NCSI_PKT_CMD_GVI 0x15 /* Get Version ID */
358 #define NCSI_PKT_CMD_GC 0x16 /* Get Capabilities */
359 #define NCSI_PKT_CMD_GP 0x17 /* Get Parameters */
360 #define NCSI_PKT_CMD_GCPS 0x18 /* Get Controller Packet Statistics */
361 #define NCSI_PKT_CMD_GNS 0x19 /* Get NCSI Statistics */
362 #define NCSI_PKT_CMD_GNPTS 0x1a /* Get NCSI Pass-throu Statistics */
363 #define NCSI_PKT_CMD_GPS 0x1b /* Get package status */
364 #define NCSI_PKT_CMD_OEM 0x50 /* OEM */
365 #define NCSI_PKT_CMD_PLDM 0x51 /* PLDM request over NCSI over RBT */
366 #define NCSI_PKT_CMD_GPUUID 0x52 /* Get package UUID */
368 /* NCSI packet responses */
369 #define NCSI_PKT_RSP_CIS (NCSI_PKT_CMD_CIS + 0x80)
370 #define NCSI_PKT_RSP_SP (NCSI_PKT_CMD_SP + 0x80)
371 #define NCSI_PKT_RSP_DP (NCSI_PKT_CMD_DP + 0x80)
372 #define NCSI_PKT_RSP_EC (NCSI_PKT_CMD_EC + 0x80)
373 #define NCSI_PKT_RSP_DC (NCSI_PKT_CMD_DC + 0x80)
374 #define NCSI_PKT_RSP_RC (NCSI_PKT_CMD_RC + 0x80)
375 #define NCSI_PKT_RSP_ECNT (NCSI_PKT_CMD_ECNT + 0x80)
376 #define NCSI_PKT_RSP_DCNT (NCSI_PKT_CMD_DCNT + 0x80)
377 #define NCSI_PKT_RSP_AE (NCSI_PKT_CMD_AE + 0x80)
378 #define NCSI_PKT_RSP_SL (NCSI_PKT_CMD_SL + 0x80)
379 #define NCSI_PKT_RSP_GLS (NCSI_PKT_CMD_GLS + 0x80)
380 #define NCSI_PKT_RSP_SVF (NCSI_PKT_CMD_SVF + 0x80)
381 #define NCSI_PKT_RSP_EV (NCSI_PKT_CMD_EV + 0x80)
382 #define NCSI_PKT_RSP_DV (NCSI_PKT_CMD_DV + 0x80)
383 #define NCSI_PKT_RSP_SMA (NCSI_PKT_CMD_SMA + 0x80)
384 #define NCSI_PKT_RSP_EBF (NCSI_PKT_CMD_EBF + 0x80)
385 #define NCSI_PKT_RSP_DBF (NCSI_PKT_CMD_DBF + 0x80)
386 #define NCSI_PKT_RSP_EGMF (NCSI_PKT_CMD_EGMF + 0x80)
387 #define NCSI_PKT_RSP_DGMF (NCSI_PKT_CMD_DGMF + 0x80)
388 #define NCSI_PKT_RSP_SNFC (NCSI_PKT_CMD_SNFC + 0x80)
389 #define NCSI_PKT_RSP_GVI (NCSI_PKT_CMD_GVI + 0x80)
390 #define NCSI_PKT_RSP_GC (NCSI_PKT_CMD_GC + 0x80)
391 #define NCSI_PKT_RSP_GP (NCSI_PKT_CMD_GP + 0x80)
392 #define NCSI_PKT_RSP_GCPS (NCSI_PKT_CMD_GCPS + 0x80)
393 #define NCSI_PKT_RSP_GNS (NCSI_PKT_CMD_GNS + 0x80)
394 #define NCSI_PKT_RSP_GNPTS (NCSI_PKT_CMD_GNPTS + 0x80)
395 #define NCSI_PKT_RSP_GPS (NCSI_PKT_CMD_GPS + 0x80)
396 #define NCSI_PKT_RSP_OEM (NCSI_PKT_CMD_OEM + 0x80)
397 #define NCSI_PKT_RSP_PLDM (NCSI_PKT_CMD_PLDM + 0x80)
398 #define NCSI_PKT_RSP_GPUUID (NCSI_PKT_CMD_GPUUID + 0x80)
400 /* NCSI response code/reason */
401 #define NCSI_PKT_RSP_C_COMPLETED 0x0000 /* Command Completed */
402 #define NCSI_PKT_RSP_C_FAILED 0x0001 /* Command Failed */
403 #define NCSI_PKT_RSP_C_UNAVAILABLE 0x0002 /* Command Unavailable */
404 #define NCSI_PKT_RSP_C_UNSUPPORTED 0x0003 /* Command Unsupported */
405 #define NCSI_PKT_RSP_R_NO_ERROR 0x0000 /* No Error */
406 #define NCSI_PKT_RSP_R_INTERFACE 0x0001 /* Interface not ready */
407 #define NCSI_PKT_RSP_R_PARAM 0x0002 /* Invalid Parameter */
408 #define NCSI_PKT_RSP_R_CHANNEL 0x0003 /* Channel not Ready */
409 #define NCSI_PKT_RSP_R_PACKAGE 0x0004 /* Package not Ready */
410 #define NCSI_PKT_RSP_R_LENGTH 0x0005 /* Invalid payload length */
411 #define NCSI_PKT_RSP_R_UNKNOWN 0x7fff /* Command type unsupported */
413 /* NCSI AEN packet type */
414 #define NCSI_PKT_AEN 0xFF /* AEN Packet */
415 #define NCSI_PKT_AEN_LSC 0x00 /* Link status change */
416 #define NCSI_PKT_AEN_CR 0x01 /* Configuration required */
417 #define NCSI_PKT_AEN_HNCDSC 0x02 /* HNC driver status change */
419 #endif /* NCSI_PKT_H */