iPXE
ice.h
Go to the documentation of this file.
1 #ifndef _ICE_H
2 #define _ICE_H
3 
4 /** @file
5  *
6  * Intel 100 Gigabit Ethernet network card driver
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <ipxe/if_ether.h>
13 #include "intelxl.h"
14 
15 /** BAR size */
16 #define ICE_BAR_SIZE 0x800000
17 
18 /******************************************************************************
19  *
20  * Transmit and receive datapaths
21  *
22  ******************************************************************************
23  */
24 
25 /** Transmit queue context */
27  /** Base address */
29  /** PF number and queue type */
31  /** Source VSI */
33  /** Reserved */
35  /** Queue length */
37  /** Flags */
39  /** Reserved */
41 } __attribute__ (( packed ));
42 
43 /** Transmit scheduler configuration */
45  /** Node type */
47  /** Valid sections */
49  /** Generic information */
50  uint8_t generic;
51  /** Flags */
53  /** Committed bandwidth profile ID */
55  /** Committeed bandwidth weight */
57  /** Excess bandwidth profile ID */
59  /** Excess bandwidth weight */
61  /** Shared rate limit profile ID */
63  /** Reserved */
65 } __attribute__ (( packed ));
66 
67 /** Global Receive Queue Control Register */
68 #define ICE_QRX_CTRL 0x120000
69 
70 /** Receive Queue Context Registers */
71 #define ICE_QRX_CONTEXT(x) ( 0x280000 + ( 0x2000 * (x) ) )
72 
73 /** Receive Queue Tail Register */
74 #define ICE_QRX_TAIL 0x290000
75 
76 /** Transmit Comm Scheduler Queue Doorbell Register */
77 #define ICE_QTX_COMM_DBELL 0x2c0000
78 
79 /** Transmit Comm Scheduler Queue Context Data Registers */
80 #define ICE_GLCOMM_QTX_CNTX_DATA(x) ( 0x2d2d40 + ( 0x4 * (x) ) )
81 
82 /** Transmit Comm Scheduler Queue Context Control Register */
83 #define ICE_GLCOMM_QTX_CNTX_CTL 0x2d2dc8
84 #define ICE_GLCOMM_QTX_CNTX_CTL_CMD(x) ( (x) << 16 ) /**< Command */
85 #define ICE_GLCOMM_QTX_CNTX_CTL_CMD_READ \
86  ICE_GLCOMM_QTX_CNTX_CTL_CMD ( 0 ) /**< Read context */
87 #define ICE_GLCOMM_QTX_CNTX_CTL_EXEC 0x00080000UL /**< Execute */
88 
89 /** Transmit Comm Scheduler Queue Context Status Register */
90 #define ICE_GLCOMM_QTX_CNTX_STAT 0x2d2dcc
91 #define ICE_GLCOMM_QTX_CNTX_BUSY 0x00000001UL /**< In progress */
92 
93 /** Queue Context Flex Extension Register */
94 #define ICE_QRX_FLXP_CNTXT 0x480000
95 #define ICE_QRX_FLXP_CNTXT_RXDID_IDX(x) ( (x) << 0 ) /**< RX profile */
96 #define ICE_QRX_FLXP_CNTXT_RXDID_IDX_LEGACY_32 \
97  ICE_QRX_FLXP_CNTXT_RXDID_IDX ( 1 ) /**< 32-byte legacy */
98 #define ICE_QRX_FLXP_CNTXT_RXDID_PRIO(x) ( (x) << 8 ) /**< Priority */
99 #define ICE_QRX_FLXP_CNTXT_RXDID_PRIO_MAX \
100  ICE_QRX_FLXP_CNTXT_RXDID_PRIO ( 7 ) /**< Maximum priority */
101 
102 /******************************************************************************
103  *
104  * Admin queue
105  *
106  ******************************************************************************
107  */
108 
109 /** Admin queue version number */
111  /** Branch identifier */
113  /** Major version number */
115  /** Minor version number */
117  /** Patch level */
119 } __attribute__ (( packed ));
120 
121 /** Admin queue Get Version command parameters */
123  /** ROM version */
125  /** Firmware build ID */
127  /** Firmware version */
128  struct ice_admin_version firmware;
129  /** API version */
130  struct ice_admin_version api;
131 } __attribute__ (( packed ));
132 
133 /** Admin queue Manage MAC Address Read command parameters */
135  /** Valid addresses */
137  /** Reserved */
139  /** Number of addresses in response */
141  /** Reserved */
143 } __attribute__ (( packed ));
144 
145 /** MAC Address description */
147  /** Port number */
149  /** Address type */
151  /** MAC address */
153 } __attribute__ (( packed ));
154 
155 /** LAN MAC address type */
156 #define ICE_ADMIN_MAC_READ_TYPE_LAN 0
157 
158 /** Admin queue Manage MAC Address Read data buffer */
160  /** MAC addresses */
162 } __attribute__ (( packed ));
163 
164 /** Admin queue Manage MAC Address Write command parameters */
166  /** Reserved */
168  /** Write type */
170  /** MAC address */
172  /** Reserved */
174 } __attribute__ (( packed ));
175 
176 /** Admin queue Get Switch Configuration command parameters */
178  /** Reserved */
180  /** Starting switching element identifier */
182  /** Reserved */
184  /** Data buffer address */
186 } __attribute__ (( packed ));
187 
188 /** Switching element configuration */
190  /** Switching element ID and flags */
192  /** Uplink switching element ID */
194  /** PF/VF number */
196 } __attribute__ (( packed ));
197 
198 /** Switching element ID type mask */
199 #define ICE_ADMIN_SWITCH_TYPE_MASK 0xc000
200 
201 /** Virtual Station Interface element type */
202 #define ICE_ADMIN_SWITCH_TYPE_VSI 0x8000
203 
204 /** Admin queue Get Switch Configuration data buffer */
206  /** Switch configuration */
208 };
209 
210 /** Admin queue Add Switch Rules command */
211 #define ICE_ADMIN_ADD_RULES 0x02a0
212 
213 /** Admin queue Add Switch Rules command parameters */
215  /** Number of rules */
217  /** Reserved */
219 } __attribute__ (( packed ));
220 
221 /** Admin queue Add Switch Rules data buffer */
223  /** Type */
225  /** Return status */
227  /** Receipt ID */
229  /** Source port */
231  /** Action */
233  /** Lookup table index */
235  /** Header length */
237  /** Header data */
238  union {
239  /** Ethernet header */
240  struct ethhdr eth;
241  /** Raw data */
243  } __attribute__ (( packed )) hdr;
244 } __attribute__ (( packed ));
245 
246 /** Switch rule promiscuous recipe ID */
247 #define ICE_ADMIN_RULES_RECIPE_PROMISC 0x0003
248 
249 /** Switch rule action valid */
250 #define ICE_ADMIN_RULES_ACTION_VALID 0x00020000UL
251 
252 /** Switch rule VSI number */
253 #define ICE_ADMIN_RULES_ACTION_VSI(x) ( (x) << 4 )
254 
255 /** Admin queue Query Default Scheduling Tree Topology command */
256 #define ICE_ADMIN_SCHEDULE 0x0400
257 
258 /** Admin queue Query Default Scheduling Tree Topology command parameters */
260  /** Reserved */
262  /** Total branches */
264  /** Reserved */
266 } __attribute__ (( packed ));
267 
268 /** Transmit scheduler configuration generic section is valid */
269 #define ICE_SCHEDULE_GENERIC 0x01
270 
271 /** Transmit scheduler configuration committed bandwidth section is valid */
272 #define ICE_SCHEDULE_COMMIT 0x02
273 
274 /** Transmit scheduler configuration excess bandwidth section is valid */
275 #define ICE_SCHEDULE_EXCESS 0x04
276 
277 /** Transmit scheduler configuration default weight */
278 #define ICE_SCHEDULE_WEIGHT 0x0004
279 
280 /** Admin queue Query Default Scheduling Tree Topology node */
282  /** Parent TEID */
284  /** Node TEID */
286  /** Scheduler configuration */
287  struct ice_schedule_tx config;
288 } __attribute__ (( packed ));
289 
290 /** Admin queue Query Default Scheduling Tree Topology branch */
292  /** Reserved */
294  /** Number of nodes */
296  /** Reserved */
298  /** Nodes */
300 } __attribute__ (( packed ));
301 
302 /** Admin queue Query Default Scheduling Tree Topology data buffer */
304  /** Branches */
305  struct ice_admin_schedule_branch branch[0];
306  /** Padding */
308 } __attribute__ (( packed ));
309 
310 /** Admin queue Restart Autonegotiation command parameters */
312  /** Reserved */
314  /** Flags */
316  /** Reserved */
318 } __attribute__ (( packed ));
319 
320 /** Admin queue Get Link Status command parameters */
322  /** Logical port number */
324  /** Reserved */
326  /** Link status notification */
328  /** Reserved */
330 } __attribute__ (( packed ));
331 
332 /** Admin queue Get Link Status data buffer */
334  /** Topology conflicts */
336  /** Configuration errors */
338  /** Link status */
340  /** Reserved */
342  /** Link speed */
344  /** Reserved */
346 } __attribute__ (( packed ));
347 
348 /** Admin queue Add Transmit Queues command */
349 #define ICE_ADMIN_ADD_TXQ 0x0c30
350 
351 /** Admin queue Add Transmit Queues command parameters */
353  /** Number of queue groups */
355  /** Reserved */
357 } __attribute__ (( packed ));
358 
359 /** Admin queue Add Transmit Queues data buffer */
361  /** Parent TEID */
363  /** Number of queues */
365  /** Reserved */
367  /** Transmit queue ID */
369  /** Reserved */
371  /** Queue TEID */
373  /** Transmit queue context */
375  /** Scheduler configuration */
376  struct ice_schedule_tx sched;
377 } __attribute__ (( packed ));
378 
379 /** Transmit queue base address and port number */
380 #define ICE_TXQ_BASE_PORT( addr, port ) \
381  ( ( (addr) >> 7 ) | ( ( ( uint64_t ) (port) ) << 57 ) )
382 
383 /** Transmit queue PF number */
384 #define ICE_TXQ_PF_TYPE( pf ) ( ( (pf) << 1 ) | ( 0x2 << 14 ) )
385 
386 /** Transmit queue length */
387 #define ICE_TXQ_LEN( count ) ( (count) >> 1 )
388 
389 /** Transmit queue uses TSO */
390 #define ICE_TXQ_FL_TSO 0x0001
391 
392 /** Transmit queue uses legacy mode*/
393 #define ICE_TXQ_FL_LEGACY 0x1000
394 
395 /** Admin queue Disable Transmit Queues command */
396 #define ICE_ADMIN_DISABLE_TXQ 0x0c31
397 
398 /** Admin queue Disable Transmit Queues command parameters */
400  /** Flags */
402  /** Number of queue groups */
404  /** Reserved */
406  /** Timeout */
408  /** Reserved */
410 } __attribute__ (( packed ));
411 
412 /** Disable queue and flush pipe */
413 #define ICE_TXQ_FL_FLUSH 0x08
414 
415 /** Disable queue timeout */
416 #define ICE_TXQ_TIMEOUT 0xc8
417 
418 /** Admin queue Disable Transmit Queues data buffer */
420  /** Parent TEID */
422  /** Number of queues */
424  /** Reserved */
426  /** Transmit queue ID */
428 } __attribute__ (( packed ));
429 
430 /** Admin queue command parameters */
432  /** Additional data buffer command parameters */
434  /** Get Version command parameters */
436  /** Manage MAC Address Read command parameters */
437  struct ice_admin_mac_read_params mac_read;
438  /** Manage MAC Address Write command parameters */
439  struct ice_admin_mac_write_params mac_write;
440  /** Get Switch Configuration command parameters */
442  /** Add Switch Rules command parameters */
444  /** Query Default Scheduling Tree Topology command parameters */
446  /** Restart Autonegotiation command parameters */
447  struct ice_admin_autoneg_params autoneg;
448  /** Get Link Status command parameters */
450  /** Add Transmit Queue command parameters */
451  struct ice_admin_add_txq_params add_txq;
452  /** Disable Transmit Queue command parameters */
453  struct ice_admin_disable_txq_params disable_txq;
454 } __attribute__ (( packed ));
455 
456 
457 /** Admin queue data buffer */
459  /** Original 40 Gigabit Ethernet data buffer */
461  /** Manage MAC Address Read data buffer */
462  struct ice_admin_mac_read_buffer mac_read;
463  /** Get Switch Configuration data buffer */
465  /** Add Switch Rules data buffer */
467  /** Query Default Scheduling Tree Topology data buffer */
469  /** Get Link Status data buffer */
471  /** Add Transmit Queue data buffer */
472  struct ice_admin_add_txq_buffer add_txq;
473  /** Disable Transmit Queue data buffer */
474  struct ice_admin_disable_txq_buffer disable_txq;
475 } __attribute__ (( packed ));
476 
477 /** Admin queue descriptor */
479  /** Transparent union */
480  union {
481  /** Original 40 Gigabit Ethernet descriptor */
483  /** Transparent struct */
484  struct {
485  /** Flags */
487  /** Opcode */
489  /** Data length */
491  /** Return value */
493  /** Opaque cookie */
495  /** Reserved */
497  /** Parameters */
498  union ice_admin_params params;
499  } __attribute__ (( packed ));
500  } __attribute__ (( packed ));
501 } __attribute__ (( packed ));
502 
503 /**
504  * Get next admin command queue descriptor
505  *
506  * @v intelxl Intel device
507  * @ret cmd Command descriptor
508  */
509 struct ice_admin_descriptor *
511  struct intelxl_admin_descriptor *xlcmd =
513 
514  return container_of ( xlcmd, struct ice_admin_descriptor, xl );
515 }
516 
517 /**
518  * Get next admin command queue data buffer
519  *
520  * @v intelxl Intel device
521  * @ret buf Data buffer
522  */
523 static inline __attribute__ (( always_inline )) union ice_admin_buffer *
525  union intelxl_admin_buffer *xlbuf =
526  intelxl_admin_command_buffer ( intelxl );
527 
528  return container_of ( xlbuf, union ice_admin_buffer, xl );
529 }
530 
531 /******************************************************************************
532  *
533  * Top level
534  *
535  ******************************************************************************
536  */
537 
538 /** Function Requester ID Information Register */
539 #define ICE_PFFUNC_RID 0x09e880
540 #define ICE_PFFUNC_RID_FUNC_NUM(x) \
541  ( ( (x) >> 0 ) & 0x7 ) /**< Function number */
542 
543 /** PF LAN Port Number Register */
544 #define ICE_PFGEN_PORTNUM 0x1d2400
545 #define ICE_PFGEN_PORTNUM_PORT_NUM(x) \
546  ( ( (x) >> 0 ) & 0x7 ) /**< Port number */
547 
548 /** Transmit Queue Interrupt Cause Control Register */
549 #define ICE_QINT_TQCTL 0x140000
550 #define ICE_QINT_TQCTL_ITR_INDX(x) ( (x) << 11 ) /**< Throttling */
551 #define ICE_QINT_TQCTL_ITR_INDX_NONE \
552  ICE_QINT_TQCTL_ITR_INDX ( 0x3 ) /**< No throttling */
553 #define ICE_QINT_TQCTL_CAUSE_ENA 0x40000000UL /**< Enable */
554 
555 /** Receive Queue Interrupt Cause Control Register */
556 #define ICE_QINT_RQCTL 0x150000
557 #define ICE_QINT_RQCTL_ITR_INDX(x) ( (x) << 11 ) /**< Throttling */
558 #define ICE_QINT_RQCTL_ITR_INDX_NONE \
559  ICE_QINT_RQCTL_ITR_INDX ( 0x3 ) /**< No throttling */
560 #define ICE_QINT_RQCTL_CAUSE_ENA 0x40000000UL /**< Enable */
561 
562 /** Global Interrupt Dynamic Control Register */
563 #define ICE_GLINT_DYN_CTL 0x160000
564 
565 #endif /* _ICE_H */
struct intelxl_admin_descriptor * intelxl_admin_command_descriptor(struct intelxl_nic *intelxl)
Get next admin command queue descriptor.
Definition: intelxl.c:239
Admin queue data buffer.
Definition: ice.h:458
uint8_t count
Number of queue groups.
Definition: ice.h:403
#define __attribute__(x)
Definition: compiler.h:10
uint16_t len
Header length.
Definition: ice.h:236
Admin queue Get Version command parameters.
Definition: ice.h:122
unsigned short uint16_t
Definition: stdint.h:11
MAC Address description.
Definition: ice.h:146
uint8_t valid
Valid addresses.
Definition: ice.h:136
uint16_t commit_id
Committed bandwidth profile ID.
Definition: ice.h:54
Admin queue data buffer command parameters.
Definition: intelxl.h:77
Admin queue command parameters.
Definition: ice.h:431
uint8_t flags
Flags.
Definition: ice.h:315
uint8_t branches
Total branches.
Definition: ice.h:263
uint8_t count
Number of queues.
Definition: ice.h:364
uint16_t count
Number of nodes.
Definition: ice.h:295
struct golan_inbox_hdr hdr
Message header.
Definition: CIB_PRM.h:28
uint16_t ret
Return value.
Definition: ice.h:492
uint32_t parent
Parent TEID.
Definition: ice.h:421
Admin queue Add Transmit Queues command parameters.
Definition: ice.h:352
uint16_t uplink
Uplink switching element ID.
Definition: ice.h:193
uint32_t cookie
Opaque cookie.
Definition: ice.h:494
union intelxl_admin_buffer * intelxl_admin_command_buffer(struct intelxl_nic *intelxl)
Get next admin command queue data buffer.
Definition: intelxl.c:256
uint32_t teid
Node TEID.
Definition: ice.h:285
unsigned long long uint64_t
Definition: stdint.h:13
uint8_t reserved
Reserved.
Definition: ice.h:425
struct ice_admin_descriptor * ice_admin_command_descriptor(struct intelxl_nic *intelxl)
Get next admin command queue descriptor.
Definition: ice.h:510
uint8_t sections
Valid sections.
Definition: ice.h:48
uint16_t port
Source port.
Definition: ice.h:230
uint8_t reserved_d[3]
Reserved.
Definition: ice.h:40
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
u32 pad[9]
Padding.
Definition: ar9003_mac.h:90
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
Admin queue Get Switch Configuration data buffer.
Definition: ice.h:205
Admin queue Query Default Scheduling Tree Topology node.
Definition: ice.h:281
uint16_t count
Number of rules.
Definition: ice.h:216
Admin queue Add Switch Rules data buffer.
Definition: ice.h:222
uint16_t func
PF/VF number.
Definition: ice.h:195
uint8_t flags
Flags.
Definition: ice.h:52
Admin queue Query Default Scheduling Tree Topology command parameters.
Definition: ice.h:259
#define INTELXL_ADMIN_BUFFER_SIZE
Maximum size of a data buffer.
Definition: intelxl.h:398
uint8_t major
Major version number.
Definition: ice.h:114
Intel 40 Gigabit Ethernet network card driver.
uint8_t branch
Branch identifier.
Definition: ice.h:112
Admin queue Add Switch Rules command parameters.
Definition: ice.h:214
uint16_t opcode
Opcode.
Definition: ice.h:488
uint8_t count
Number of queue groups.
Definition: ice.h:354
uint16_t id
Transmit queue ID.
Definition: ice.h:368
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
Admin queue version number.
Definition: ice.h:110
Admin queue Add Transmit Queues data buffer.
Definition: ice.h:360
uint16_t seid
Switching element ID and flags.
Definition: ice.h:191
uint16_t excess_weight
Excess bandwidth weight.
Definition: ice.h:60
Admin queue Get Switch Configuration command parameters.
Definition: ice.h:177
u32 link
Link to next descriptor.
Definition: ar9003_mac.h:68
uint16_t excess_id
Excess bandwidth profile ID.
Definition: ice.h:58
Admin queue Manage MAC Address Read command parameters.
Definition: ice.h:134
uint16_t index
Lookup table index.
Definition: ice.h:234
uint8_t count
Number of addresses in response.
Definition: ice.h:140
uint16_t len
Queue length.
Definition: ice.h:36
uint8_t reserved_c[5]
Reserved.
Definition: ice.h:34
uint16_t type
Type.
Definition: ice.h:224
Admin queue Query Default Scheduling Tree Topology branch.
Definition: ice.h:291
uint8_t reserved_a[4]
Reserved.
Definition: ena.h:18
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
Admin queue Manage MAC Address Write command parameters.
Definition: ice.h:165
Admin queue Disable Transmit Queues data buffer.
Definition: ice.h:419
unsigned char uint8_t
Definition: stdint.h:10
uint32_t rom
ROM version.
Definition: ice.h:124
uint16_t len
Data length.
Definition: ice.h:490
An Intel 40 Gigabit network card.
Definition: intelxl.h:919
uint16_t vsi
Source VSI.
Definition: ice.h:32
uint8_t reserved_a
Reserved.
Definition: ice.h:261
#define ETH_ALEN
Definition: if_ether.h:8
uint8_t timeout
Timeout.
Definition: ice.h:407
uint16_t shared
Shared rate limit profile ID.
Definition: ice.h:62
unsigned int uint32_t
Definition: stdint.h:12
uint32_t node
NUMA node register offset.
Definition: ena.h:18
Transmit queue context.
Definition: ice.h:26
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
u32 version
Driver version.
Definition: ath9k_hw.c:1983
Admin queue descriptor.
Definition: ice.h:478
uint16_t next
Starting switching element identifier.
Definition: ice.h:181
static union ice_admin_buffer * ice_admin_command_buffer(struct intelxl_nic *intelxl)
Get next admin command queue data buffer.
Definition: ice.h:524
uint32_t action
Action.
Definition: ice.h:232
Admin queue Manage MAC Address Read data buffer.
Definition: ice.h:159
Definition: sis900.h:23
Admin queue descriptor.
Definition: intelxl.h:415
uint64_t address
Data buffer address.
Definition: ice.h:185
Admin queue Query Default Scheduling Tree Topology data buffer.
Definition: ice.h:303
Transmit scheduler configuration.
Definition: ice.h:44
uint8_t port
Port number.
Definition: ice.h:148
Admin queue Restart Autonegotiation command parameters.
Definition: ice.h:311
Switching element configuration.
Definition: ice.h:189
uint8_t flags
Flags.
Definition: ice.h:401
uint8_t type
Write type.
Definition: ice.h:169
uint8_t reserved
Reserved.
Definition: ena.h:14
uint8_t type
Address type.
Definition: ice.h:150
__be32 raw[7]
Definition: CIB_PRM.h:28
uint8_t reserved_a
Reserved.
Definition: ice.h:405
uint32_t teid
Queue TEID.
Definition: ice.h:372
uint64_t base_port
Base address.
Definition: ice.h:28
uint8_t reserved_b[2]
Reserved.
Definition: ena.h:26
uint16_t status
Return status.
Definition: ice.h:226
uint16_t pf_type
PF number and queue type.
Definition: ice.h:30
uint16_t commit_weight
Committeed bandwidth weight.
Definition: ice.h:56
uint8_t type
Node type.
Definition: ice.h:46
uint32_t build
Firmware build ID.
Definition: ice.h:126
uint8_t patch
Patch level.
Definition: ice.h:118
An Ethernet link-layer header.
Definition: if_ether.h:31
uint16_t reserved
Reserved.
Definition: ice.h:64
uint16_t flags
Flags.
Definition: ice.h:486
Admin queue Disable Transmit Queues command parameters.
Definition: ice.h:399
uint16_t id
Transmit queue ID.
Definition: ice.h:427
uint32_t parent
Parent TEID.
Definition: ice.h:283
Admin queue data buffer.
Definition: intelxl.h:401
uint16_t flags
Flags.
Definition: ice.h:38
uint16_t recipe
Receipt ID.
Definition: ice.h:228
uint32_t parent
Parent TEID.
Definition: ice.h:362
uint8_t count
Number of queues.
Definition: ice.h:423
uint8_t minor
Minor version number.
Definition: ice.h:116