iPXE
aqc1xx.c
Go to the documentation of this file.
1/** @file
2 *
3 * Marvell AQtion family network card driver.
4 *
5 * Copyright(C) 2017-2024 Marvell
6 *
7 * SPDX-License-Identifier: BSD-2-Clause
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR HOLDER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 */
31FILE_LICENCE ( BSD2 );
32
33#include <stdint.h>
34#include <stdio.h>
35#include <string.h>
36#include <unistd.h>
37#include <errno.h>
38#include <byteswap.h>
39#include <ipxe/netdevice.h>
40#include <ipxe/ethernet.h>
41#include <ipxe/if_ether.h>
42#include <ipxe/iobuf.h>
43#include <ipxe/malloc.h>
44#include <ipxe/pci.h>
45#include <ipxe/profile.h>
46
47#include "aqc1xx.h"
48
49extern struct atl_hw_ops atl_hw;
50extern struct atl_hw_ops atl2_hw;
51
52/** @file
53*
54* Marvell AQC network card driver
55*
56*/
57
58static int atl_ring_alloc ( const struct atl_nic *nic, struct atl_ring *ring,
59 uint32_t desc_size, uint32_t reg_base ) {
60 physaddr_t phy_addr;
61
62 /* Allocate ring buffer.*/
63 ring->length = ATL_RING_SIZE * desc_size;
64 ring->ring = dma_alloc ( nic->dma, &ring->map, ring->length,
65 ring->length );
66
67 if ( !ring->ring )
68 return -ENOMEM;
69
70 /* Initialize the descriptor ring */
71 memset ( ring->ring, 0, ring->length );
72
73 /* Program ring address */
74 phy_addr = dma ( &ring->map, ring->ring );
75
76 /* Write ring address (hi & low parts).*/
77 ATL_WRITE_REG ( ( uint32_t )phy_addr, reg_base );
78 ATL_WRITE_REG ( ( uint32_t ) ( ( ( uint64_t )phy_addr ) >> 32 ), reg_base + 4 );
79
80 /* Write ring length.*/
81 ATL_WRITE_REG ( ATL_RING_SIZE, reg_base + 8 );
82
83 ring->sw_head = ring->sw_tail = 0;
84
85 DBGC ( nic, "AQUANTIA: %p ring is at [%08llx,%08llx), reg base %#x\n",
86 nic, ( ( unsigned long long )phy_addr ),
87 ( ( unsigned long long ) phy_addr + ring->length ), reg_base );
88
89 return 0;
90}
91
92static void atl_ring_free ( struct atl_ring *ring ) {
93 dma_free ( &ring->map, ring->ring, ring->length );
94 ring->ring = NULL;
95 ring->length = 0;
96}
97
98static void atl_ring_next_dx ( unsigned int *val ) {
99 ++( *val );
100 if ( *val == ATL_RING_SIZE )
101 *val = 0;
102}
103
104int atl_ring_full ( const struct atl_ring *ring ) {
105 unsigned int tail = ring->sw_tail;
106 atl_ring_next_dx ( &tail );
107 return tail == ring->sw_head;
108}
109
110void atl_rx_ring_fill ( struct atl_nic *nic ) {
111 struct atl_desc_rx *rx;
112 struct io_buffer *iobuf;
114 unsigned int refilled = 0;
115
116 /* Refill ring */
117 while ( !atl_ring_full ( &nic->rx_ring ) ) {
118
119 /* Allocate I/O buffer */
120 iobuf = alloc_rx_iob ( ATL_RX_MAX_LEN, nic->dma );
121 if ( !iobuf ) {
122 /* Wait for next refill */
123 break;
124 }
125
126 /* Get next receive descriptor */
127 rx = ( struct atl_desc_rx * )nic->rx_ring.ring +
128 nic->rx_ring.sw_tail;
129
130 /* Populate receive descriptor */
131 address = iob_dma ( iobuf );
132 rx->data_addr = address;
133 rx->hdr_addr = 0;
134
135 /* Record I/O buffer */
136 assert ( nic->iobufs[nic->rx_ring.sw_tail] == NULL );
137 nic->iobufs[nic->rx_ring.sw_tail] = iobuf;
138
139 DBGC( nic, "AQUANTIA: RX[%d] is [%llx,%llx)\n",
140 nic->rx_ring.sw_tail,
141 ( ( unsigned long long )address ),
142 ( ( unsigned long long )address + ATL_RX_MAX_LEN ) );
143
144 atl_ring_next_dx ( &nic->rx_ring.sw_tail );
145 refilled++;
146 }
147
148 /* Push descriptors to card, if applicable */
149 if ( refilled ) {
150 wmb();
151 ATL_WRITE_REG ( nic->rx_ring.sw_tail, ATL_RING_TAIL_PTR );
152 }
153}
154
155/**
156* Open network device
157*
158* @v netdev Network device
159* @ret rc Return status code
160*/
161static int atl_open ( struct net_device *netdev ) {
162 struct atl_nic *nic = netdev->priv;
163 uint32_t ctrl = 0;
164
165 /* Tx ring */
166 if ( atl_ring_alloc ( nic, &nic->tx_ring, sizeof ( struct atl_desc_tx ),
167 ATL_TX_DMA_DESC_ADDR ) != 0 )
168 goto err_tx_alloc;
169
170 /* Rx ring */
171 if ( atl_ring_alloc ( nic, &nic->rx_ring, sizeof ( struct atl_desc_rx ),
172 ATL_RX_DMA_DESC_ADDR ) != 0 )
173 goto err_rx_alloc;
174
175 /* Allocate interrupt vectors */
177 ATL_IRQ_CTRL );
178
179 /*TX & RX Interruprt Mapping*/
183
184 /*TX interrupt ctrl reg*/
186
187 /*RX interrupt ctrl reg*/
189
190 /*RX data path*/
192 /* itr mask */
196
197 /*filter global ctrl */
201
202 /* vlan promisc */
204 /* enable rpf2 */
206
207 /* RX Packet Buffer 0 Register 1 */
209
210 /*RX Packet Buffer 0 Register 2 */
214
215 /*RPB global ctrl*/
219
220 /*TX data path*/
221 /* enable tpo2 */
223 /* tpb global ctrl *** */
225
227 /* tpb global ctrl *** */
229
232 /* tpb global ctrl */
234
235 /*Enable rings*/
240
241 if ( nic->flags == ATL_FLAG_A2 ) {
243 }
244
246
247 nic->hw_ops->start ( nic );
248
249 return 0;
250
251err_rx_alloc:
252 atl_ring_free ( &nic->tx_ring );
253
254err_tx_alloc:
255 return -ENOMEM;
256}
257
258/**
259* Close network device
260*
261* @v netdev Network device
262*/
263static void atl_close ( struct net_device *netdev ) {
264 struct atl_nic *nic = netdev->priv;
265
266 nic->hw_ops->stop ( nic );
267 /* rpb global ctrl */
269 /* tgb global ctrl */
271
276
277 /* clear itr mask */
279
280 /* Reset the NIC */
281 nic->hw_ops->reset ( nic );
282
283 atl_ring_free ( &nic->tx_ring );
284 atl_ring_free ( &nic->rx_ring );
285}
286
287/**
288* Transmit packet
289*
290* @v netdev Network device
291* @v iobuf I/O buffer
292* @ret rc Return status code
293*/
294int atl_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) {
295 struct atl_nic *nic = netdev->priv;
296 struct atl_desc_tx *tx;
299
300 /* Get next transmit descriptor */
301 if ( atl_ring_full ( &nic->tx_ring ) ) {
302 DBGC ( nic, "AQUANTIA: %p out of transmit descriptors\n", nic );
303 return -ENOBUFS;
304 }
305
306 tx = ( struct atl_desc_tx * )nic->tx_ring.ring + nic->tx_ring.sw_tail;
307
308 /* Populate transmit descriptor */
309 memset ( tx, 0, sizeof ( *tx ) );
310 address = iob_dma ( iobuf );
311 tx->address = address;
312 len = iob_len ( iobuf );
313
314 tx->status = 0x1;
315 tx->status = ( (tx->status) & ~ATL_DESC_TX_BUF_LEN_MASK) |
318 tx->status = ((tx->status) & ~ATL_DESC_TX_EOP_MASK) |
321 tx->status = ( (tx->status) & ~ATL_DESC_TX_CMD_MASK) |
324 tx->flag = ( (tx->flag) & ~ATL_DESC_TX_PAY_LEN_MASK) |
327 wmb();
328
329 DBGC2 ( nic, "AQUANTIA: %p TX[%d] is [%llx, %llx]\n",
330 nic, nic->tx_ring.sw_tail,
331 ( ( unsigned long long ) address ),
332 ( ( unsigned long long ) address + len ) );
333
334 atl_ring_next_dx ( &nic->tx_ring.sw_tail );
335 ATL_WRITE_REG ( nic->tx_ring.sw_tail, ATL_RING_TAIL );
336
337 return 0;
338}
339
341 struct atl_nic *nic = netdev->priv;
343
344 /* Read link status */
345 link_state = nic->hw_ops->get_link ( nic );
346
347 DBGC ( nic, "AQUANTIA: %p link status is %08x\n", nic, link_state );
348
349 if ( link_state != nic->link_state ) {
350 if ( link_state ) {
351 DBGC ( nic, "AQUANTIA: link up\n");
353 } else {
354 DBGC ( nic, "AQUANTIA: link lost\n");
356 }
357 nic->link_state = link_state;
358 }
359}
360
361/**
362* Poll for completed packets
363*
364* @v netdev Network device
365*/
366void atl_poll_tx ( struct net_device *netdev ) {
367 struct atl_nic *nic = netdev->priv;
368 struct atl_desc_tx_wb *tx;
369
370 /* Check for completed packets */
371 while ( nic->tx_ring.sw_head != nic->tx_ring.sw_tail ) {
372
373 /* Get next transmit descriptor */
374 tx = ( struct atl_desc_tx_wb * )nic->tx_ring.ring +
375 nic->tx_ring.sw_head;
376
377 /* Stop if descriptor is still in use */
378 if ( !( tx->status & cpu_to_le32 ( ATL_TX_DESC_STATUS_DD ) ) )
379 return;
380
381 DBGC2 ( nic, "AQUANTIA: %p TX[%d] complete\n",
382 nic, nic->tx_ring.sw_head );
383
384 /* Complete TX descriptor */
385 atl_ring_next_dx ( &nic->tx_ring.sw_head );
387 }
388}
389
390/**
391* Poll for received packets
392*
393* @v netdev Network device
394*/
395void atl_poll_rx ( struct net_device *netdev ) {
396 struct atl_nic *nic = netdev->priv;
397 struct atl_desc_rx_wb *rx;
398 struct io_buffer *iobuf;
399 size_t len;
400
401 /* Check for received packets */
402 while ( nic->rx_ring.sw_head != nic->rx_ring.sw_tail ) {
403
404 /* Get next receive descriptor */
405 rx = ( struct atl_desc_rx_wb * )nic->rx_ring.ring +
406 nic->rx_ring.sw_head;
407
408 /* Stop if descriptor is still in use */
409 if ( !( rx->status & cpu_to_le16( ATL_RX_DESC_STATUS_DD ) ) )
410 return;
411
412 /* Populate I/O buffer */
413 iobuf = nic->iobufs[nic->rx_ring.sw_head];
414 nic->iobufs[nic->rx_ring.sw_head] = NULL;
415 len = le16_to_cpu ( rx->pkt_len );
416 iob_put ( iobuf, len );
417
418 /* Hand off to network stack */
419 DBGC ( nic, "AQUANTIA: %p RX[%d] complete (length %zd)\n",
420 nic, nic->rx_ring.sw_head, len );
421
422 netdev_rx ( netdev, iobuf );
423
424 atl_ring_next_dx ( &nic->rx_ring.sw_head );
425 }
426}
427
428/**
429* Poll for completed and received packets
430*
431* @v netdev Network device
432*/
433static void atl_poll ( struct net_device *netdev ) {
434 struct atl_nic *nic = netdev->priv;
435
436 /* Check link state */
438
439 /* Poll for TX completions */
441
442 /* Poll for RX completions */
444
445 /* Refill RX ring */
447}
448
449/**
450* Enable or disable interrupts
451*
452* @v netdev Network device
453* @v enable Interrupts should be enabled
454*/
455static void atl_irq ( struct net_device *netdev, int enable ) {
456 struct atl_nic *nic = netdev->priv;
457 uint32_t mask;
458
459 mask = ( ATL_IRQ_TX | ATL_IRQ_RX );
460 if ( enable )
461 ATL_WRITE_REG ( mask, ATL_ITR_MSKS );
462 else
463 ATL_WRITE_REG ( mask, ATL_ITR_MSKC );
464}
465
466/** Marvell network device operations */
468 .open = atl_open,
469 .close = atl_close,
470 .transmit = atl_transmit,
471 .poll = atl_poll,
472 .irq = atl_irq,
473};
474
475/******************************************************************************
476*
477* PCI interface
478*
479*******************************************************************************
480*/
481
482/**
483* Probe PCI device
484*
485* @v pci PCI device
486* @ret rc Return status code
487*/
488static int atl_probe ( struct pci_device *pci ) {
489 struct net_device *netdev;
490 struct atl_nic *nic;
491 int rc = ENOERR;
492 uint32_t io_size = 0;
493
494 /* Allocate and initialise net device */
495 netdev = alloc_etherdev ( sizeof( *nic ) );
496 if ( !netdev ) {
497 rc = -ENOMEM;
498 goto err_alloc;
499 }
501 nic = netdev->priv;
502 pci_set_drvdata ( pci, netdev );
503 netdev->dev = &pci->dev;
504 memset( nic, 0, sizeof ( *nic ) );
505 nic->flags = pci->id->driver_data;
506
507 /* Fix up PCI device */
508 adjust_pci_device ( pci );
509
510 switch ( nic->flags ) {
511 case ATL_FLAG_A1:
512 nic->hw_ops = &atl_hw;
513 io_size = ATL_BAR_SIZE;
514 break;
515 case ATL_FLAG_A2:
516 nic->hw_ops = &atl2_hw;
517 io_size = ATL2_BAR_SIZE;
518 break;
519 default:
520 goto err_unsupported;
521 break;
522 }
523
524 /* Map registers */
525 nic->regs = pci_ioremap ( pci, pci->membase, io_size );
526 if ( !nic->regs ) {
527 rc = -ENODEV;
528 goto err_ioremap;
529 }
530
531 /* Configure DMA */
532 nic->dma = &pci->dma;
533
534 /* Reset the NIC */
535 if ( ( rc = nic->hw_ops->reset ( nic ) ) != 0 )
536 goto err_reset;
537
538 /* Get MAC Address */
539 if ( ( rc = nic->hw_ops->get_mac ( nic, netdev->hw_addr ) ) != 0 )
540 goto err_mac;
541
542 /* Register network device */
543 if ( ( rc = register_netdev ( netdev ) ) != 0 )
544 goto err_register_netdev;
545
546 /* Set initial link state */
548
549 return 0;
550
551err_register_netdev:
552err_mac:
553 nic->hw_ops->reset ( nic );
554err_reset:
555 iounmap ( nic->regs );
556err_ioremap:
558 netdev_put ( netdev );
559err_unsupported:
560err_alloc:
561 return rc;
562}
563
564/**
565* Remove PCI device
566*
567* @v pci PCI device
568*/
569static void atl_remove ( struct pci_device *pci ) {
570 struct net_device *netdev = pci_get_drvdata ( pci );
571 struct atl_nic *nic = netdev->priv;
572
573 /* Unregister network device */
575
576 /* Reset the NIC */
577 nic->hw_ops->reset ( nic );
578
579 /* Free network device */
580 iounmap ( nic->regs );
582 netdev_put ( netdev );
583}
584
585/** Marvell PCI device IDs */
586static struct pci_device_id atl_nics[] = {
587 /* Atlantic 1 */
588 /* 10G */
589 PCI_ROM ( 0x1D6A, 0x0001, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ),
590 PCI_ROM ( 0x1D6A, 0xD107, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ),
591 PCI_ROM ( 0x1D6A, 0x07B1, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ),
592 PCI_ROM ( 0x1D6A, 0x87B1, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ),
593
594 /* SFP */
595 PCI_ROM ( 0x1D6A, 0xD100, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ),
596 PCI_ROM ( 0x1D6A, 0x00B1, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ),
597 PCI_ROM ( 0x1D6A, 0x80B1, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ),
598
599 /* 5G */
600 PCI_ROM ( 0x1D6A, 0xD108, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
601 PCI_ROM ( 0x1D6A, 0x08B1, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
602 PCI_ROM ( 0x1D6A, 0x88B1, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
603 PCI_ROM ( 0x1D6A, 0x11B1, "AQC11", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
604 PCI_ROM ( 0x1D6A, 0x91B1, "AQC11", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
605
606 /* 2.5G */
607 PCI_ROM ( 0x1D6A, 0xD109, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
608 PCI_ROM ( 0x1D6A, 0x09B1, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
609 PCI_ROM ( 0x1D6A, 0x89B1, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
610 PCI_ROM ( 0x1D6A, 0x12B1, "AQC12", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
611 PCI_ROM ( 0x1D6A, 0x92B1, "AQC12", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
612
613 /* Atlantic 2 */
614 PCI_ROM ( 0x1D6A, 0x00C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
615 PCI_ROM ( 0x1D6A, 0x94C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
616 PCI_ROM ( 0x1D6A, 0x93C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
617 PCI_ROM ( 0x1D6A, 0x04C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
618 PCI_ROM ( 0x1D6A, 0x14C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
619 PCI_ROM ( 0x1D6A, 0x12C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
620 PCI_ROM ( 0x1D6A, 0x03C0, "AQC14", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A2 ),
621};
622
623/** Marvell PCI driver */
624struct pci_driver atl_driver __pci_driver = {
625 .ids = atl_nics,
626 .id_count = ( sizeof( atl_nics ) / sizeof ( atl_nics[0] ) ),
627 .probe = atl_probe,
629};
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
static void atl_poll(struct net_device *netdev)
Poll for completed and received packets.
Definition aqc1xx.c:433
int atl_ring_full(const struct atl_ring *ring)
Definition aqc1xx.c:104
static void atl_remove(struct pci_device *pci)
Remove PCI device.
Definition aqc1xx.c:569
void atl_poll_tx(struct net_device *netdev)
Poll for completed packets.
Definition aqc1xx.c:366
int atl_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition aqc1xx.c:294
void atl_rx_ring_fill(struct atl_nic *nic)
Definition aqc1xx.c:110
static void atl_close(struct net_device *netdev)
Close network device.
Definition aqc1xx.c:263
struct atl_hw_ops atl2_hw
Definition atl2_hw.c:220
void atl_poll_rx(struct net_device *netdev)
Poll for received packets.
Definition aqc1xx.c:395
static void atl_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
Definition aqc1xx.c:455
void atl_check_link(struct net_device *netdev)
Definition aqc1xx.c:340
static struct net_device_operations atl_operations
Marvell network device operations.
Definition aqc1xx.c:467
static int atl_ring_alloc(const struct atl_nic *nic, struct atl_ring *ring, uint32_t desc_size, uint32_t reg_base)
Definition aqc1xx.c:58
static int atl_open(struct net_device *netdev)
Open network device.
Definition aqc1xx.c:161
static void atl_ring_next_dx(unsigned int *val)
Definition aqc1xx.c:98
static int atl_probe(struct pci_device *pci)
Probe PCI device.
Definition aqc1xx.c:488
struct atl_hw_ops atl_hw
Definition atl_hw.c:308
static void atl_ring_free(struct atl_ring *ring)
Definition aqc1xx.c:92
static struct pci_device_id atl_nics[]
Marvell PCI device IDs.
Definition aqc1xx.c:586
Marvell AQtion family network card driver definitions.
#define ATL_RING_SIZE
Definition aqc1xx.h:42
#define ATL_IRQ_MAP_REG1_RX0_EN
Definition aqc1xx.h:60
#define ATL_RING_TAIL
Definition aqc1xx.h:147
#define ATL_TPB_CTRL
Definition aqc1xx.h:124
#define ATL_DESC_TX_PAY_LEN_MASK
Definition aqc1xx.h:202
#define ATL_ITR_MSKS_DIS
Definition aqc1xx.h:151
#define ATL_RING_TX_CTRL
Definition aqc1xx.h:141
#define ATL_RPB0_CTRL2_FC_EN
Definition aqc1xx.h:114
#define ATL_DESC_TX_EOP_OFFSET
Definition aqc1xx.h:193
#define ATL_RPF_CTRL1_ACTION
Definition aqc1xx.h:93
#define ATL_TPB0_CTRL2_LOW_TSH
Definition aqc1xx.h:134
#define ATL_BAR_SIZE
Definition aqc1xx.h:40
#define ATL_ITR_MSKS
Definition aqc1xx.h:152
#define ATL_RPB0_CTRL1_SIZE
Definition aqc1xx.h:106
#define ATL_IRQ_MAP_REG1_TX0
Definition aqc1xx.h:64
#define ATL_IRQ_TX
Definition aqc1xx.h:46
#define ATL_TPB0_CTRL2_HIGH_TSH
Definition aqc1xx.h:136
#define ATL_TX_IRQ_CTRL
Definition aqc1xx.h:67
#define ATL_TPB0_CTRL1
Definition aqc1xx.h:129
#define ATL_TPB0_CTRL2
Definition aqc1xx.h:132
#define ATL_RX_IRQ_CTRL_WB_EN
Definition aqc1xx.h:72
#define ATL_DESC_TX_PAY_LEN_OFFSET
Definition aqc1xx.h:203
#define ATL_IRQ_MAP_REG1_TX0_EN
Definition aqc1xx.h:63
#define ATL_FLAG_A2
Definition aqc1xx.h:177
#define ATL_RPB0_CTRL2_LOW_TSH
Definition aqc1xx.h:111
#define ATL_IRQ_CTRL_REG_RST_DIS
Definition aqc1xx.h:55
#define ATL_RPB0_CTRL2_HIGH_TSH
Definition aqc1xx.h:113
#define ATL_RX_MAX_LEN
Definition aqc1xx.h:44
#define ATL_DESC_TX_CMD_VALUE
Definition aqc1xx.h:197
#define ATL_ITR_MSKC
Definition aqc1xx.h:154
#define ATL_TPB_CTRL_DIS
Definition aqc1xx.h:123
#define ATL_TX_IRQ_CTRL_WB_EN
Definition aqc1xx.h:68
#define ATL_RPB_CTRL_DIS
Definition aqc1xx.h:99
#define ATL_RX_DESC_STATUS_DD
Definition aqc1xx.h:226
#define ATL_FLAG_A1
Definition aqc1xx.h:176
#define ATL_TX_DESC_STATUS_DD
Definition aqc1xx.h:211
#define ATL_RPB0_CTRL1
Definition aqc1xx.h:105
#define ATL_RPF_CTRL2
Definition aqc1xx.h:96
#define ATL_TX_DMA_DESC_ADDR
Definition aqc1xx.h:138
#define ATL_RPB0_CTRL2
Definition aqc1xx.h:108
#define ATL2_RPF_NEW_EN_ADR_EN
Definition aqc1xx.h:87
#define ATL_READ_REG(REG)
Definition aqc1xx.h:181
#define ATL_DESC_TX_BUF_LEN_MASK
Definition aqc1xx.h:199
#define ATL_DESC_TX_EOP_MASK
Definition aqc1xx.h:192
#define ATL_TPO2_CTRL
Definition aqc1xx.h:120
#define ATL_IRQ_MAP_REG1
Definition aqc1xx.h:58
#define ATL_RPB_CTRL_FC
Definition aqc1xx.h:102
#define ATL_TPB_CTRL_PAD_EN
Definition aqc1xx.h:126
#define ATL_IRQ_CTRL_COR_EN
Definition aqc1xx.h:54
#define ATL_RPF2_CTRL_EN
Definition aqc1xx.h:86
#define ATL_RING_TAIL_PTR
Definition aqc1xx.h:148
#define ATL_DESC_TX_BUF_LEN_OFFSET
Definition aqc1xx.h:200
#define ATL_RX_DMA_DESC_BUF_SIZE
Definition aqc1xx.h:116
#define ATL_IRQ_RX
Definition aqc1xx.h:47
#define ATL_RPB_CTRL
Definition aqc1xx.h:100
#define ATL_RPB_CTRL_EN
Definition aqc1xx.h:101
#define ATL2_RPF_NEW_EN_ADR
Definition aqc1xx.h:88
#define ATL_DESC_TX_CMD_OFFSET
Definition aqc1xx.h:196
#define ATL_IRQ_CTRL
Definition aqc1xx.h:53
#define ATL_RING_RX_CTRL_EN
Definition aqc1xx.h:145
#define ATL2_BAR_SIZE
Definition aqc1xx.h:41
#define ATL_WRITE_REG(VAL, REG)
Definition aqc1xx.h:180
#define ATL_RX_DMA_DESC_ADDR
Definition aqc1xx.h:117
#define ATL_DESC_TX_DX_EOP_VALUE
Definition aqc1xx.h:191
#define ATL_RPF2_CTRL
Definition aqc1xx.h:85
#define ATL_IRQ_MAP_REG1_RX0
Definition aqc1xx.h:61
#define ATL_RPF_CTRL2_VLAN_PROMISC
Definition aqc1xx.h:97
#define ATL_RPF_CTRL1_BRC_TSH
Definition aqc1xx.h:94
#define ATL_TPB0_CTRL1_SIZE
Definition aqc1xx.h:130
#define ATL_RPF_CTRL1_L2_PROMISC
Definition aqc1xx.h:92
#define ATL_DESC_TX_CMD_MASK
Definition aqc1xx.h:195
#define ATL_RING_TX_CTRL_EN
Definition aqc1xx.h:142
#define ATL_TPO2_EN
Definition aqc1xx.h:121
#define ATL_RPF_CTRL1_BRC_EN
Definition aqc1xx.h:91
#define ATL_RING_RX_CTRL
Definition aqc1xx.h:144
#define ATL_TPB_CTRL_EN
Definition aqc1xx.h:125
#define ATL_RPF_CTRL1
Definition aqc1xx.h:90
#define ATL_RX_IRQ_CTRL
Definition aqc1xx.h:71
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
unsigned int uint32_t
Definition stdint.h:12
unsigned long physaddr_t
Definition stdint.h:20
unsigned long long uint64_t
Definition stdint.h:13
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
uint8_t ctrl
Ring control.
Definition dwmac.h:7
ring len
Length.
Definition dwmac.h:226
uint64_t address
Base address.
Definition ena.h:13
Error codes.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition ethernet.c:265
Ethernet protocol.
static struct net_device * netdev
Definition gdbudp.c:53
#define DBGC2(...)
Definition compiler.h:522
#define DBGC(...)
Definition compiler.h:505
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define ENOERR
Operation completed successfully.
Definition errno.h:289
#define ENOMEM
Not enough space.
Definition errno.h:535
#define ENOBUFS
No buffer space available.
Definition errno.h:499
#define ENODEV
No such device.
Definition errno.h:510
#define le16_to_cpu(value)
Definition byteswap.h:113
#define cpu_to_le32(value)
Definition byteswap.h:108
#define cpu_to_le16(value)
Definition byteswap.h:107
#define wmb()
Definition io.h:546
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
Profiling.
void __asmcall int val
Definition setjmp.h:12
String functions.
void * memset(void *dest, int character, size_t len) __nonnull
struct io_buffer * alloc_rx_iob(size_t len, struct dma_device *dma)
Allocate and map I/O buffer for receive DMA.
Definition iobuf.c:188
I/O buffers.
#define iob_put(iobuf, len)
Definition iobuf.h:125
static __always_inline physaddr_t iob_dma(struct io_buffer *iobuf)
Get I/O buffer DMA address.
Definition iobuf.h:268
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition iobuf.h:160
void dma_free(struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer.
void * dma_alloc(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer.
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
Dynamic memory allocation.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition netdevice.c:231
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition netdevice.c:549
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition netdevice.c:942
int register_netdev(struct net_device *netdev)
Register network device.
Definition netdevice.c:760
Network device management.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition netdevice.h:789
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition netdevice.h:519
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition netdevice.h:532
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition netdevice.h:576
static void netdev_tx_complete_next(struct net_device *netdev)
Complete network transmission.
Definition netdevice.h:779
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:241
PCI bus.
#define __pci_driver
Declare a PCI driver.
Definition pci.h:278
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition pci.h:366
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:308
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition pci.h:376
An aQuanita network card.
Definition aqc1xx.h:248
uint32_t link_state
Definition aqc1xx.h:260
unsigned int sw_head
Definition aqc1xx.h:230
unsigned int sw_tail
Definition aqc1xx.h:229
unsigned int length
Definition aqc1xx.h:234
struct dma_mapping map
Descriptor ring DMA mapping.
Definition aqc1xx.h:233
void * ring
Definition aqc1xx.h:231
A persistent I/O buffer.
Definition iobuf.h:38
Network device operations.
Definition netdevice.h:214
A network device.
Definition netdevice.h:353
Definition nic.h:49
int flags
Definition nic.h:51
A PCI device ID list entry.
Definition pci.h:175
unsigned long driver_data
Arbitrary driver data.
Definition pci.h:183
A PCI device.
Definition pci.h:211
unsigned long membase
Memory base.
Definition pci.h:220
struct device dev
Generic device.
Definition pci.h:213
struct pci_device_id * id
Driver device ID.
Definition pci.h:248
struct dma_device dma
DMA device.
Definition pci.h:215
A PCI driver.
Definition pci.h:252
int(* probe)(struct pci_device *pci)
Probe device.
Definition pci.h:265
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
Definition wpa.h:4
u8 rx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets from the AP.
Definition wpa.h:1
static struct xen_remove_from_physmap * remove
Definition xenmem.h:40