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 unsigned int i;
266
267 nic->hw_ops->stop ( nic );
268 /* rpb global ctrl */
270 /* tgb global ctrl */
272
277
278 /* clear itr mask */
280
281 /* Reset the NIC */
282 nic->hw_ops->reset ( nic );
283
284 atl_ring_free ( &nic->tx_ring );
285 atl_ring_free ( &nic->rx_ring );
286
287 /* Discard any outstanding receive I/O buffers */
288 for ( i = 0 ; i < ATL_RING_SIZE ; i++ ) {
289 if ( nic->iobufs[i] )
290 free_rx_iob ( nic->iobufs[i] );
291 nic->iobufs[i] = NULL;
292 }
293}
294
295/**
296* Transmit packet
297*
298* @v netdev Network device
299* @v iobuf I/O buffer
300* @ret rc Return status code
301*/
302int atl_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) {
303 struct atl_nic *nic = netdev->priv;
304 struct atl_desc_tx *tx;
307
308 /* Get next transmit descriptor */
309 if ( atl_ring_full ( &nic->tx_ring ) ) {
310 DBGC ( nic, "AQUANTIA: %p out of transmit descriptors\n", nic );
311 return -ENOBUFS;
312 }
313
314 tx = ( struct atl_desc_tx * )nic->tx_ring.ring + nic->tx_ring.sw_tail;
315
316 /* Populate transmit descriptor */
317 memset ( tx, 0, sizeof ( *tx ) );
318 address = iob_dma ( iobuf );
319 tx->address = address;
320 len = iob_len ( iobuf );
321
322 tx->status = 0x1;
323 tx->status = ( (tx->status) & ~ATL_DESC_TX_BUF_LEN_MASK) |
326 tx->status = ((tx->status) & ~ATL_DESC_TX_EOP_MASK) |
329 tx->status = ( (tx->status) & ~ATL_DESC_TX_CMD_MASK) |
332 tx->flag = ( (tx->flag) & ~ATL_DESC_TX_PAY_LEN_MASK) |
335 wmb();
336
337 DBGC2 ( nic, "AQUANTIA: %p TX[%d] is [%llx, %llx]\n",
338 nic, nic->tx_ring.sw_tail,
339 ( ( unsigned long long ) address ),
340 ( ( unsigned long long ) address + len ) );
341
342 atl_ring_next_dx ( &nic->tx_ring.sw_tail );
343 ATL_WRITE_REG ( nic->tx_ring.sw_tail, ATL_RING_TAIL );
344
345 return 0;
346}
347
349 struct atl_nic *nic = netdev->priv;
351
352 /* Read link status */
353 link_state = nic->hw_ops->get_link ( nic );
354
355 DBGC ( nic, "AQUANTIA: %p link status is %08x\n", nic, link_state );
356
357 if ( link_state != nic->link_state ) {
358 if ( link_state ) {
359 DBGC ( nic, "AQUANTIA: link up\n");
361 } else {
362 DBGC ( nic, "AQUANTIA: link lost\n");
364 }
365 nic->link_state = link_state;
366 }
367}
368
369/**
370* Poll for completed packets
371*
372* @v netdev Network device
373*/
374void atl_poll_tx ( struct net_device *netdev ) {
375 struct atl_nic *nic = netdev->priv;
376 struct atl_desc_tx_wb *tx;
377
378 /* Check for completed packets */
379 while ( nic->tx_ring.sw_head != nic->tx_ring.sw_tail ) {
380
381 /* Get next transmit descriptor */
382 tx = ( struct atl_desc_tx_wb * )nic->tx_ring.ring +
383 nic->tx_ring.sw_head;
384
385 /* Stop if descriptor is still in use */
386 if ( !( tx->status & cpu_to_le32 ( ATL_TX_DESC_STATUS_DD ) ) )
387 return;
388
389 DBGC2 ( nic, "AQUANTIA: %p TX[%d] complete\n",
390 nic, nic->tx_ring.sw_head );
391
392 /* Complete TX descriptor */
393 atl_ring_next_dx ( &nic->tx_ring.sw_head );
395 }
396}
397
398/**
399* Poll for received packets
400*
401* @v netdev Network device
402*/
403void atl_poll_rx ( struct net_device *netdev ) {
404 struct atl_nic *nic = netdev->priv;
405 struct atl_desc_rx_wb *rx;
406 struct io_buffer *iobuf;
407 size_t len;
408
409 /* Check for received packets */
410 while ( nic->rx_ring.sw_head != nic->rx_ring.sw_tail ) {
411
412 /* Get next receive descriptor */
413 rx = ( struct atl_desc_rx_wb * )nic->rx_ring.ring +
414 nic->rx_ring.sw_head;
415
416 /* Stop if descriptor is still in use */
417 if ( !( rx->status & cpu_to_le16( ATL_RX_DESC_STATUS_DD ) ) )
418 return;
419
420 /* Populate I/O buffer */
421 iobuf = nic->iobufs[nic->rx_ring.sw_head];
422 nic->iobufs[nic->rx_ring.sw_head] = NULL;
423 len = le16_to_cpu ( rx->pkt_len );
424 iob_put ( iobuf, len );
425
426 /* Hand off to network stack */
427 DBGC ( nic, "AQUANTIA: %p RX[%d] complete (length %zd)\n",
428 nic, nic->rx_ring.sw_head, len );
429
430 netdev_rx ( netdev, iobuf );
431
432 atl_ring_next_dx ( &nic->rx_ring.sw_head );
433 }
434}
435
436/**
437* Poll for completed and received packets
438*
439* @v netdev Network device
440*/
441static void atl_poll ( struct net_device *netdev ) {
442 struct atl_nic *nic = netdev->priv;
443
444 /* Check link state */
446
447 /* Poll for TX completions */
449
450 /* Poll for RX completions */
452
453 /* Refill RX ring */
455}
456
457/**
458* Enable or disable interrupts
459*
460* @v netdev Network device
461* @v enable Interrupts should be enabled
462*/
463static void atl_irq ( struct net_device *netdev, int enable ) {
464 struct atl_nic *nic = netdev->priv;
465 uint32_t mask;
466
467 mask = ( ATL_IRQ_TX | ATL_IRQ_RX );
468 if ( enable )
469 ATL_WRITE_REG ( mask, ATL_ITR_MSKS );
470 else
471 ATL_WRITE_REG ( mask, ATL_ITR_MSKC );
472}
473
474/** Marvell network device operations */
476 .open = atl_open,
477 .close = atl_close,
478 .transmit = atl_transmit,
479 .poll = atl_poll,
480 .irq = atl_irq,
481};
482
483/******************************************************************************
484*
485* PCI interface
486*
487*******************************************************************************
488*/
489
490/**
491* Probe PCI device
492*
493* @v pci PCI device
494* @ret rc Return status code
495*/
496static int atl_probe ( struct pci_device *pci ) {
497 struct net_device *netdev;
498 struct atl_nic *nic;
499 int rc = ENOERR;
500 uint32_t io_size = 0;
501
502 /* Allocate and initialise net device */
503 netdev = alloc_etherdev ( sizeof( *nic ) );
504 if ( !netdev ) {
505 rc = -ENOMEM;
506 goto err_alloc;
507 }
509 nic = netdev->priv;
510 pci_set_drvdata ( pci, netdev );
511 netdev->dev = &pci->dev;
512 memset( nic, 0, sizeof ( *nic ) );
513 nic->flags = pci->id->driver_data;
514
515 /* Fix up PCI device */
516 adjust_pci_device ( pci );
517
518 switch ( nic->flags ) {
519 case ATL_FLAG_A1:
520 nic->hw_ops = &atl_hw;
521 io_size = ATL_BAR_SIZE;
522 break;
523 case ATL_FLAG_A2:
524 nic->hw_ops = &atl2_hw;
525 io_size = ATL2_BAR_SIZE;
526 break;
527 default:
528 goto err_unsupported;
529 break;
530 }
531
532 /* Map registers */
533 nic->regs = pci_ioremap ( pci, pci->membase, io_size );
534 if ( !nic->regs ) {
535 rc = -ENODEV;
536 goto err_ioremap;
537 }
538
539 /* Configure DMA */
540 nic->dma = &pci->dma;
541 dma_set_mask_64bit ( nic->dma );
542 netdev->dma = nic->dma;
543
544 /* Reset the NIC */
545 if ( ( rc = nic->hw_ops->reset ( nic ) ) != 0 )
546 goto err_reset;
547
548 /* Get MAC Address */
549 if ( ( rc = nic->hw_ops->get_mac ( nic, netdev->hw_addr ) ) != 0 )
550 goto err_mac;
551
552 /* Register network device */
553 if ( ( rc = register_netdev ( netdev ) ) != 0 )
554 goto err_register_netdev;
555
556 /* Set initial link state */
558
559 return 0;
560
561err_register_netdev:
562err_mac:
563 nic->hw_ops->reset ( nic );
564err_reset:
565 iounmap ( nic->regs );
566err_ioremap:
568 netdev_put ( netdev );
569err_unsupported:
570err_alloc:
571 return rc;
572}
573
574/**
575* Remove PCI device
576*
577* @v pci PCI device
578*/
579static void atl_remove ( struct pci_device *pci ) {
580 struct net_device *netdev = pci_get_drvdata ( pci );
581 struct atl_nic *nic = netdev->priv;
582
583 /* Unregister network device */
585
586 /* Reset the NIC */
587 nic->hw_ops->reset ( nic );
588
589 /* Free network device */
590 iounmap ( nic->regs );
592 netdev_put ( netdev );
593}
594
595/** Marvell PCI device IDs */
596static struct pci_device_id atl_nics[] = {
597 /* Atlantic 1 */
598 /* 10G */
599 PCI_ROM ( 0x1D6A, 0x0001, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ),
600 PCI_ROM ( 0x1D6A, 0xD107, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ),
601 PCI_ROM ( 0x1D6A, 0x07B1, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ),
602 PCI_ROM ( 0x1D6A, 0x87B1, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ),
603
604 /* SFP */
605 PCI_ROM ( 0x1D6A, 0xD100, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ),
606 PCI_ROM ( 0x1D6A, 0x00B1, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ),
607 PCI_ROM ( 0x1D6A, 0x80B1, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ),
608
609 /* 5G */
610 PCI_ROM ( 0x1D6A, 0xD108, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
611 PCI_ROM ( 0x1D6A, 0x08B1, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
612 PCI_ROM ( 0x1D6A, 0x88B1, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
613 PCI_ROM ( 0x1D6A, 0x11B1, "AQC11", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
614 PCI_ROM ( 0x1D6A, 0x91B1, "AQC11", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ),
615
616 /* 2.5G */
617 PCI_ROM ( 0x1D6A, 0xD109, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
618 PCI_ROM ( 0x1D6A, 0x09B1, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
619 PCI_ROM ( 0x1D6A, 0x89B1, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
620 PCI_ROM ( 0x1D6A, 0x12B1, "AQC12", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
621 PCI_ROM ( 0x1D6A, 0x92B1, "AQC12", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ),
622
623 /* Atlantic 2 */
624 PCI_ROM ( 0x1D6A, 0x00C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
625 PCI_ROM ( 0x1D6A, 0x94C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
626 PCI_ROM ( 0x1D6A, 0x93C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
627 PCI_ROM ( 0x1D6A, 0x04C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
628 PCI_ROM ( 0x1D6A, 0x14C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
629 PCI_ROM ( 0x1D6A, 0x12C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ),
630 PCI_ROM ( 0x1D6A, 0x03C0, "AQC14", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A2 ),
631};
632
633/** Marvell PCI driver */
634struct pci_driver atl_driver __pci_driver = {
635 .ids = atl_nics,
636 .id_count = ( sizeof( atl_nics ) / sizeof ( atl_nics[0] ) ),
637 .probe = atl_probe,
639};
#define NULL
NULL pointer (VOID *).
Definition Base.h:321
static void atl_poll(struct net_device *netdev)
Poll for completed and received packets.
Definition aqc1xx.c:441
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:579
void atl_poll_tx(struct net_device *netdev)
Poll for completed packets.
Definition aqc1xx.c:374
int atl_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition aqc1xx.c:302
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:403
static void atl_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
Definition aqc1xx.c:463
void atl_check_link(struct net_device *netdev)
Definition aqc1xx.c:348
static struct net_device_operations atl_operations
Marvell network device operations.
Definition aqc1xx.c:475
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:496
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:596
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:547
#define DBGC(...)
Definition compiler.h:530
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:921
#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
void free_rx_iob(struct io_buffer *iobuf)
Unmap and free I/O buffer for receive DMA.
Definition iobuf.c:215
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
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
Definition dma.h:467
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:946
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:792
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition netdevice.h:522
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition netdevice.h:535
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition netdevice.h:579
static void netdev_tx_complete_next(struct net_device *netdev)
Complete network transmission.
Definition netdevice.h:782
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:255
PCI bus.
#define __pci_driver
Declare a PCI driver.
Definition pci.h:281
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition pci.h:370
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:311
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition pci.h:380
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:178
unsigned long driver_data
Arbitrary driver data.
Definition pci.h:186
A PCI device.
Definition pci.h:214
unsigned long membase
Memory base.
Definition pci.h:223
struct device dev
Generic device.
Definition pci.h:216
struct pci_device_id * id
Driver device ID.
Definition pci.h:251
struct dma_device dma
DMA device.
Definition pci.h:218
A PCI driver.
Definition pci.h:255
int(* probe)(struct pci_device *pci)
Probe device.
Definition pci.h:268
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