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