iPXE
amd8111e.c
Go to the documentation of this file.
1/* Advanced Micro Devices Inc. AMD8111E Linux Network Driver
2 * Copyright (C) 2004 Advanced Micro Devices
3 * Copyright (C) 2005 Liu Tao <liutao1980@gmail.com> [etherboot port]
4 *
5 * Copyright 2001,2002 Jeff Garzik <jgarzik@mandrakesoft.com> [ 8139cp.c,tg3.c ]
6 * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com)[ tg3.c]
7 * Copyright 1996-1999 Thomas Bogendoerfer [ pcnet32.c ]
8 * Derived from the lance driver written 1993,1994,1995 by Donald Becker.
9 * Copyright 1993 United States Government as represented by the
10 * Director, National Security Agency.[ pcnet32.c ]
11 * Carsten Langgaard, carstenl@mips.com [ pcnet32.c ]
12 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
13 *
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 * 02110-1301, USA.
29 * USA
30 */
31
32FILE_LICENCE ( GPL2_OR_LATER );
33
34#include "etherboot.h"
35#include "nic.h"
36#include "mii.h"
37#include <ipxe/pci.h>
38#include <ipxe/ethernet.h>
39#include "string.h"
40#include "stdint.h"
41#include "amd8111e.h"
42
43
44/* driver definitions */
45#define NUM_TX_SLOTS 2
46#define NUM_RX_SLOTS 4
47#define TX_SLOTS_MASK 1
48#define RX_SLOTS_MASK 3
49
50#define TX_BUF_LEN 1536
51#define RX_BUF_LEN 1536
52
53#define TX_PKT_LEN_MAX (ETH_FRAME_LEN - ETH_HLEN)
54#define RX_PKT_LEN_MIN 60
55#define RX_PKT_LEN_MAX ETH_FRAME_LEN
56
57#define TX_TIMEOUT 3000
58#define TX_PROCESS_TIME 10
59#define TX_RETRY (TX_TIMEOUT / TX_PROCESS_TIME)
60
61#define PHY_RW_RETRY 10
62
63
72
81
88
108#define amd8111e NIC_FAKE_BSS ( struct amd8111e_priv )
109
110
111/********************************************************
112 * locale functions *
113 ********************************************************/
114static void amd8111e_init_hw_default(struct amd8111e_priv *lp);
115static int amd8111e_start(struct amd8111e_priv *lp);
116static int amd8111e_read_phy(struct amd8111e_priv *lp, int phy_addr, int reg, u32 *val);
117#if 0
118static int amd8111e_write_phy(struct amd8111e_priv *lp, int phy_addr, int reg, u32 val);
119#endif
120static void amd8111e_probe_ext_phy(struct amd8111e_priv *lp);
121static void amd8111e_disable_interrupt(struct amd8111e_priv *lp);
122static void amd8111e_enable_interrupt(struct amd8111e_priv *lp);
123static void amd8111e_force_interrupt(struct amd8111e_priv *lp);
124static int amd8111e_get_mac_address(struct amd8111e_priv *lp);
125static int amd8111e_init_rx_ring(struct amd8111e_priv *lp);
126static int amd8111e_init_tx_ring(struct amd8111e_priv *lp);
127static int amd8111e_wait_tx_ring(struct amd8111e_priv *lp, unsigned int index);
128static void amd8111e_wait_link(struct amd8111e_priv *lp);
129static void amd8111e_poll_link(struct amd8111e_priv *lp);
130static void amd8111e_restart(struct amd8111e_priv *lp);
131
132
133/*
134 * This function clears necessary the device registers.
135 */
137{
138 unsigned int reg_val;
139 void *mmio = lp->mmio;
140
141 /* stop the chip */
142 writel(RUN, mmio + CMD0);
143
144 /* Clear RCV_RING_BASE_ADDR */
145 writel(0, mmio + RCV_RING_BASE_ADDR0);
146
147 /* Clear XMT_RING_BASE_ADDR */
148 writel(0, mmio + XMT_RING_BASE_ADDR0);
149 writel(0, mmio + XMT_RING_BASE_ADDR1);
150 writel(0, mmio + XMT_RING_BASE_ADDR2);
151 writel(0, mmio + XMT_RING_BASE_ADDR3);
152
153 /* Clear CMD0 */
154 writel(CMD0_CLEAR, mmio + CMD0);
155
156 /* Clear CMD2 */
157 writel(CMD2_CLEAR, mmio + CMD2);
158
159 /* Clear CMD7 */
160 writel(CMD7_CLEAR, mmio + CMD7);
161
162 /* Clear DLY_INT_A and DLY_INT_B */
163 writel(0x0, mmio + DLY_INT_A);
164 writel(0x0, mmio + DLY_INT_B);
165
166 /* Clear FLOW_CONTROL */
167 writel(0x0, mmio + FLOW_CONTROL);
168
169 /* Clear INT0 write 1 to clear register */
170 reg_val = readl(mmio + INT0);
171 writel(reg_val, mmio + INT0);
172
173 /* Clear STVAL */
174 writel(0x0, mmio + STVAL);
175
176 /* Clear INTEN0 */
177 writel(INTEN0_CLEAR, mmio + INTEN0);
178
179 /* Clear LADRF */
180 writel(0x0, mmio + LADRF);
181
182 /* Set SRAM_SIZE & SRAM_BOUNDARY registers */
183 writel(0x80010, mmio + SRAM_SIZE);
184
185 /* Clear RCV_RING0_LEN */
186 writel(0x0, mmio + RCV_RING_LEN0);
187
188 /* Clear XMT_RING0/1/2/3_LEN */
189 writel(0x0, mmio + XMT_RING_LEN0);
190 writel(0x0, mmio + XMT_RING_LEN1);
191 writel(0x0, mmio + XMT_RING_LEN2);
192 writel(0x0, mmio + XMT_RING_LEN3);
193
194 /* Clear XMT_RING_LIMIT */
195 writel(0x0, mmio + XMT_RING_LIMIT);
196
197 /* Clear MIB */
198 writew(MIB_CLEAR, mmio + MIB_ADDR);
199
200 /* Clear LARF */
201 writel( 0, mmio + LADRF);
202 writel( 0, mmio + LADRF + 4);
203
204 /* SRAM_SIZE register */
205 reg_val = readl(mmio + SRAM_SIZE);
206
207 /* Set default value to CTRL1 Register */
208 writel(CTRL1_DEFAULT, mmio + CTRL1);
209
210 /* To avoid PCI posting bug */
211 readl(mmio + CMD2);
212}
213
214/*
215 * This function initializes the device registers and starts the device.
216 */
217static int amd8111e_start(struct amd8111e_priv *lp)
218{
219 struct nic *nic = lp->nic;
220 void *mmio = lp->mmio;
221 int i, reg_val;
222
223 /* stop the chip */
224 writel(RUN, mmio + CMD0);
225
226 /* AUTOPOLL0 Register *//*TBD default value is 8100 in FPS */
227 writew(0x8100 | lp->ext_phy_addr, mmio + AUTOPOLL0);
228
229 /* enable the port manager and set auto negotiation always */
230 writel(VAL1 | EN_PMGR, mmio + CMD3 );
231 writel(XPHYANE | XPHYRST, mmio + CTRL2);
232
233 /* set control registers */
234 reg_val = readl(mmio + CTRL1);
235 reg_val &= ~XMTSP_MASK;
236 writel(reg_val | XMTSP_128 | CACHE_ALIGN, mmio + CTRL1);
237
238 /* initialize tx and rx ring base addresses */
245
246 /* set default IPG to 96 */
247 writew(DEFAULT_IPG, mmio + IPG);
248 writew(DEFAULT_IPG - IFS1_DELTA, mmio + IFS1);
249
250 /* AutoPAD transmit, Retransmit on Underflow */
251 writel(VAL0 | APAD_XMT | REX_RTRY | REX_UFLO, mmio + CMD2);
252
253 /* JUMBO disabled */
254 writel(JUMBO, mmio + CMD3);
255
256 /* Setting the MAC address to the device */
257 for(i = 0; i < ETH_ALEN; i++)
258 writeb(nic->node_addr[i], mmio + PADR + i);
259
260 /* set RUN bit to start the chip, interrupt not enabled */
261 writel(VAL2 | RDMD0 | VAL0 | RUN, mmio + CMD0);
262
263 /* To avoid PCI posting bug */
264 readl(mmio + CMD0);
265 return 0;
266}
267
268/*
269This function will read the PHY registers.
270*/
271static int amd8111e_read_phy(struct amd8111e_priv *lp, int phy_addr, int reg, u32 *val)
272{
273 void *mmio = lp->mmio;
274 unsigned int reg_val;
275 unsigned int retry = PHY_RW_RETRY;
276
277 reg_val = readl(mmio + PHY_ACCESS);
278 while (reg_val & PHY_CMD_ACTIVE)
279 reg_val = readl(mmio + PHY_ACCESS);
280
281 writel(PHY_RD_CMD | ((phy_addr & 0x1f) << 21) | ((reg & 0x1f) << 16),
282 mmio + PHY_ACCESS);
283 do {
284 reg_val = readl(mmio + PHY_ACCESS);
285 udelay(30); /* It takes 30 us to read/write data */
286 } while (--retry && (reg_val & PHY_CMD_ACTIVE));
287
288 if (reg_val & PHY_RD_ERR) {
289 *val = 0;
290 return -1;
291 }
292
293 *val = reg_val & 0xffff;
294 return 0;
295}
296
297/*
298This function will write into PHY registers.
299*/
300#if 0
301static int amd8111e_write_phy(struct amd8111e_priv *lp, int phy_addr, int reg, u32 val)
302{
303 void *mmio = lp->mmio;
304 unsigned int reg_val;
305 unsigned int retry = PHY_RW_RETRY;
306
307 reg_val = readl(mmio + PHY_ACCESS);
308 while (reg_val & PHY_CMD_ACTIVE)
309 reg_val = readl(mmio + PHY_ACCESS);
310
311 writel(PHY_WR_CMD | ((phy_addr & 0x1f) << 21) | ((reg & 0x1f) << 16) | val,
312 mmio + PHY_ACCESS);
313 do {
314 reg_val = readl(mmio + PHY_ACCESS);
315 udelay(30); /* It takes 30 us to read/write the data */
316 } while (--retry && (reg_val & PHY_CMD_ACTIVE));
317
318 if(reg_val & PHY_RD_ERR)
319 return -1;
320
321 return 0;
322}
323#endif
324
326{
327 int i;
328
329 lp->ext_phy_id = 0;
330 lp->ext_phy_addr = 1;
331
332 for (i = 0x1e; i >= 0; i--) {
333 u32 id1, id2;
334
335 if (amd8111e_read_phy(lp, i, MII_PHYSID1, &id1))
336 continue;
337 if (amd8111e_read_phy(lp, i, MII_PHYSID2, &id2))
338 continue;
339 lp->ext_phy_id = (id1 << 16) | id2;
340 lp->ext_phy_addr = i;
341 break;
342 }
343
344 if (lp->ext_phy_id)
345 printf("Found MII PHY ID 0x%08x at address 0x%02x\n",
346 (unsigned int) lp->ext_phy_id, lp->ext_phy_addr);
347 else
348 printf("Couldn't detect MII PHY, assuming address 0x01\n");
349}
350
352{
353 void *mmio = lp->mmio;
354 unsigned int int0;
355
356 writel(INTREN, mmio + CMD0);
357 writel(INTEN0_CLEAR, mmio + INTEN0);
358 int0 = readl(mmio + INT0);
359 writel(int0, mmio + INT0);
360 readl(mmio + INT0);
361}
362
364{
365 void *mmio = lp->mmio;
366
367 writel(VAL3 | LCINTEN | VAL1 | TINTEN0 | VAL0 | RINTEN0, mmio + INTEN0);
368 writel(VAL0 | INTREN, mmio + CMD0);
369 readl(mmio + CMD0);
370}
371
373{
374 void *mmio = lp->mmio;
375
376 writel(VAL0 | UINTCMD, mmio + CMD0);
377 readl(mmio + CMD0);
378}
379
381{
382 struct nic *nic = lp->nic;
383 void *mmio = lp->mmio;
384 int i;
385
386 /* BIOS should have set mac address to PADR register,
387 * so we read PADR to get it.
388 */
389 for (i = 0; i < ETH_ALEN; i++)
390 nic->node_addr[i] = readb(mmio + PADR + i);
391
392 DBG ( "Ethernet addr: %s\n", eth_ntoa ( nic->node_addr ) );
393
394 return 0;
395}
396
398{
399 int i;
400
401 lp->rx_idx = 0;
402
403 /* Initilaizing receive descriptors */
404 for (i = 0; i < NUM_RX_SLOTS; i++) {
407 wmb();
409 }
410
411 return 0;
412}
413
415{
416 int i;
417
418 lp->tx_idx = 0;
419 lp->tx_consistent = 1;
420
421 /* Initializing transmit descriptors */
422 for (i = 0; i < NUM_TX_SLOTS; i++) {
423 lp->tx_ring[i].tx_flags = 0;
424 lp->tx_ring[i].buf_phy_addr = 0;
425 lp->tx_ring[i].buf_len = 0;
426 }
427
428 return 0;
429}
430
431static int amd8111e_wait_tx_ring(struct amd8111e_priv *lp, unsigned int index)
432{
433 volatile u16 status;
434 int retry = TX_RETRY;
435
437 while (--retry && (status & OWN_BIT)) {
440 }
441 if (status & OWN_BIT) {
442 printf("Error: tx slot %d timeout, stat = 0x%x\n", index, status);
444 return -1;
445 }
446
447 return 0;
448}
449
450static void amd8111e_wait_link(struct amd8111e_priv *lp)
451{
452 unsigned int status;
453 u32 reg_val;
454
455 do {
456 /* read phy to update STAT0 register */
457 amd8111e_read_phy(lp, lp->ext_phy_addr, MII_BMCR, &reg_val);
458 amd8111e_read_phy(lp, lp->ext_phy_addr, MII_BMSR, &reg_val);
459 amd8111e_read_phy(lp, lp->ext_phy_addr, MII_ADVERTISE, &reg_val);
460 amd8111e_read_phy(lp, lp->ext_phy_addr, MII_LPA, &reg_val);
461 status = readl(lp->mmio + STAT0);
462 } while (!(status & AUTONEG_COMPLETE) || !(status & LINK_STATS));
463}
464
465static void amd8111e_poll_link(struct amd8111e_priv *lp)
466{
467 unsigned int status, speed;
468 u32 reg_val;
469
470 if (!lp->link) {
471 /* read phy to update STAT0 register */
472 amd8111e_read_phy(lp, lp->ext_phy_addr, MII_BMCR, &reg_val);
473 amd8111e_read_phy(lp, lp->ext_phy_addr, MII_BMSR, &reg_val);
474 amd8111e_read_phy(lp, lp->ext_phy_addr, MII_ADVERTISE, &reg_val);
475 amd8111e_read_phy(lp, lp->ext_phy_addr, MII_LPA, &reg_val);
476 status = readl(lp->mmio + STAT0);
477
478 if (status & LINK_STATS) {
479 lp->link = 1;
480 speed = (status & SPEED_MASK) >> 7;
481 if (speed == PHY_SPEED_100)
482 lp->speed = 1;
483 else
484 lp->speed = 0;
485 if (status & FULL_DPLX)
486 lp->duplex = 1;
487 else
488 lp->duplex = 0;
489
490 printf("Link is up: %s Mbps %s duplex\n",
491 lp->speed ? "100" : "10", lp->duplex ? "full" : "half");
492 }
493 } else {
494 status = readl(lp->mmio + STAT0);
495 if (!(status & LINK_STATS)) {
496 lp->link = 0;
497 printf("Link is down\n");
498 }
499 }
500}
501
502static void amd8111e_restart(struct amd8111e_priv *lp)
503{
504 printf("\nStarting nic...\n");
509 amd8111e_start(lp);
510
511 printf("Waiting link up...\n");
512 lp->link = 0;
515}
516
517
518/********************************************************
519 * Interface Functions *
520 ********************************************************/
521
522static void amd8111e_transmit(struct nic *nic, const char *dst_addr,
523 unsigned int type, unsigned int size, const char *packet)
524{
525 struct amd8111e_priv *lp = nic->priv_data;
526 struct eth_frame *frame;
527 unsigned int index;
528
529 /* check packet size */
530 if (size > TX_PKT_LEN_MAX) {
531 printf("amd8111e_transmit(): too large packet, drop\n");
532 return;
533 }
534
535 /* get tx slot */
536 index = lp->tx_idx;
538 return;
539
540 /* fill frame */
541 frame = (struct eth_frame *)lp->tx_buf[index];
542 memset(frame->data, 0, TX_PKT_LEN_MAX);
543 memcpy(frame->dst_addr, dst_addr, ETH_ALEN);
544 memcpy(frame->src_addr, nic->node_addr, ETH_ALEN);
545 frame->type = htons(type);
546 memcpy(frame->data, packet, size);
547
548 /* start xmit */
551 wmb();
552 lp->tx_ring[index].tx_flags =
554 writel(VAL1 | TDMD0, lp->mmio + CMD0);
555 readl(lp->mmio + CMD0);
556
557 /* update slot pointer */
558 lp->tx_idx = (lp->tx_idx + 1) & TX_SLOTS_MASK;
559}
560
561static int amd8111e_poll(struct nic *nic, int retrieve)
562{
563 /* return true if there's an ethernet packet ready to read */
564 /* nic->packet should contain data on return */
565 /* nic->packetlen should contain length of data */
566
567 struct amd8111e_priv *lp = nic->priv_data;
569 unsigned int index, pkt_ok;
570
572
573 index = lp->rx_idx;
575 pkt_len = le16_to_cpu(lp->rx_ring[index].msg_len) - 4; /* remove 4bytes FCS */
576
577 if (status & OWN_BIT)
578 return 0;
579
580 if (status & ERR_BIT)
581 pkt_ok = 0;
582 else if (!(status & STP_BIT))
583 pkt_ok = 0;
584 else if (!(status & ENP_BIT))
585 pkt_ok = 0;
586 else if (pkt_len < RX_PKT_LEN_MIN)
587 pkt_ok = 0;
588 else if (pkt_len > RX_PKT_LEN_MAX)
589 pkt_ok = 0;
590 else
591 pkt_ok = 1;
592
593 if (pkt_ok) {
594 if (!retrieve)
595 return 1;
598 }
599
602 wmb();
604 writel(VAL2 | RDMD0, lp->mmio + CMD0);
605 readl(lp->mmio + CMD0);
606
607 lp->rx_idx = (lp->rx_idx + 1) & RX_SLOTS_MASK;
608 return pkt_ok;
609}
610
611static void amd8111e_disable(struct nic *nic, void *hwdev __unused)
612{
613 struct amd8111e_priv *lp = nic->priv_data;
614
615 /* disable interrupt */
617
618 /* stop chip */
620
621 /* unmap mmio */
622 iounmap(lp->mmio);
623
624 /* update status */
625 lp->opened = 0;
626}
627
628static void amd8111e_irq(struct nic *nic, irq_action_t action)
629{
630 struct amd8111e_priv *lp = nic->priv_data;
631
632 switch (action) {
633 case DISABLE:
635 break;
636 case ENABLE:
638 break;
639 case FORCE:
641 break;
642 }
643}
644
646 .connect = dummy_connect,
647 .poll = amd8111e_poll,
648 .transmit = amd8111e_transmit,
649 .irq = amd8111e_irq,
650};
651
652static int amd8111e_probe(struct nic *nic, struct pci_device *pdev)
653{
654 struct amd8111e_priv *lp = &amd8111e;
655 unsigned long mmio_start, mmio_len;
656
657 nic->ioaddr = pdev->ioaddr;
658 nic->irqno = pdev->irq;
659
662
663 memset(lp, 0, sizeof(*lp));
664 lp->pdev = pdev;
665 lp->nic = nic;
666 lp->mmio = pci_ioremap(pdev, mmio_start, mmio_len);
667 lp->opened = 1;
669
670 nic->priv_data = lp;
671
673
675 return 1;
676}
677
678static struct pci_device_id amd8111e_nics[] = {
679 PCI_ROM(0x1022, 0x7462, "amd8111e", "AMD8111E", 0),
680};
681
682PCI_DRIVER ( amd8111e_driver, amd8111e_nics, PCI_NO_CLASS );
683
684DRIVER ( "AMD8111E", nic_driver, pci_driver, amd8111e_driver,
686
687/*
688 * Local variables:
689 * c-basic-offset: 8
690 * c-indent-level: 8
691 * tab-width: 8
692 * End:
693 */
#define TX_PKT_LEN_MAX
Definition amd8111e.c:53
static void amd8111e_disable(struct nic *nic, void *hwdev __unused)
Definition amd8111e.c:611
#define TX_RETRY
Definition amd8111e.c:59
static void amd8111e_init_hw_default(struct amd8111e_priv *lp)
Definition amd8111e.c:136
#define RX_BUF_LEN
Definition amd8111e.c:51
static int amd8111e_get_mac_address(struct amd8111e_priv *lp)
Definition amd8111e.c:380
#define PHY_RW_RETRY
Definition amd8111e.c:61
#define TX_SLOTS_MASK
Definition amd8111e.c:47
static void amd8111e_enable_interrupt(struct amd8111e_priv *lp)
Definition amd8111e.c:363
static struct nic_operations amd8111e_operations
Definition amd8111e.c:645
static void amd8111e_force_interrupt(struct amd8111e_priv *lp)
Definition amd8111e.c:372
static struct pci_device_id amd8111e_nics[]
Definition amd8111e.c:678
#define NUM_RX_SLOTS
Definition amd8111e.c:46
static int amd8111e_poll(struct nic *nic, int retrieve)
Definition amd8111e.c:561
static void amd8111e_transmit(struct nic *nic, const char *dst_addr, unsigned int type, unsigned int size, const char *packet)
Definition amd8111e.c:522
static void amd8111e_probe_ext_phy(struct amd8111e_priv *lp)
Definition amd8111e.c:325
static void amd8111e_wait_link(struct amd8111e_priv *lp)
Definition amd8111e.c:450
static int amd8111e_start(struct amd8111e_priv *lp)
Definition amd8111e.c:217
#define amd8111e
Definition amd8111e.c:108
static void amd8111e_disable_interrupt(struct amd8111e_priv *lp)
Definition amd8111e.c:351
static void amd8111e_restart(struct amd8111e_priv *lp)
Definition amd8111e.c:502
#define RX_SLOTS_MASK
Definition amd8111e.c:48
#define RX_PKT_LEN_MIN
Definition amd8111e.c:54
static void amd8111e_irq(struct nic *nic, irq_action_t action)
Definition amd8111e.c:628
static int amd8111e_wait_tx_ring(struct amd8111e_priv *lp, unsigned int index)
Definition amd8111e.c:431
#define TX_BUF_LEN
Definition amd8111e.c:50
#define NUM_TX_SLOTS
Definition amd8111e.c:45
static int amd8111e_init_tx_ring(struct amd8111e_priv *lp)
Definition amd8111e.c:414
static int amd8111e_probe(struct nic *nic, struct pci_device *pdev)
Definition amd8111e.c:652
static void amd8111e_poll_link(struct amd8111e_priv *lp)
Definition amd8111e.c:465
#define TX_PROCESS_TIME
Definition amd8111e.c:58
static int amd8111e_init_rx_ring(struct amd8111e_priv *lp)
Definition amd8111e.c:397
static int amd8111e_read_phy(struct amd8111e_priv *lp, int phy_addr, int reg, u32 *val)
Definition amd8111e.c:271
#define RX_PKT_LEN_MAX
Definition amd8111e.c:55
#define SRAM_SIZE
Definition amd8111e.h:111
#define CMD3
Definition amd8111e.h:68
@ INTEN0_CLEAR
Definition amd8111e.h:229
@ TINTEN0
Definition amd8111e.h:224
@ LCINTEN
Definition amd8111e.h:205
@ RINTEN0
Definition amd8111e.h:227
#define XMT_RING_LEN1
Definition amd8111e.h:105
#define XMT_RING_LEN3
Definition amd8111e.h:107
@ EN_PMGR
Definition amd8111e.h:293
@ JUMBO
Definition amd8111e.h:288
#define IPG
Definition amd8111e.h:120
@ VAL2
Definition amd8111e.h:196
@ VAL3
Definition amd8111e.h:195
@ VAL1
Definition amd8111e.h:197
@ VAL0
Definition amd8111e.h:198
@ ENP_BIT
Definition amd8111e.h:588
@ OWN_BIT
Definition amd8111e.h:584
@ LTINT_BIT
Definition amd8111e.h:586
@ ADD_FCS_BIT
Definition amd8111e.h:585
@ STP_BIT
Definition amd8111e.h:587
#define CTRL1
Definition amd8111e.h:71
#define IFS1
Definition amd8111e.h:118
#define XMT_RING_LIMIT
Definition amd8111e.h:74
#define INTEN0
Definition amd8111e.h:65
#define XMT_RING_BASE_ADDR1
Definition amd8111e.h:93
#define CTRL2
Definition amd8111e.h:72
#define XMT_RING_BASE_ADDR0
Definition amd8111e.h:92
#define XMT_RING_LEN0
Definition amd8111e.h:104
@ ERR_BIT
Definition amd8111e.h:596
#define DLY_INT_B
Definition amd8111e.h:85
#define INT0
Definition amd8111e.h:64
#define STAT0
Definition amd8111e.h:63
#define AUTOPOLL0
Definition amd8111e.h:76
#define XMT_RING_LEN2
Definition amd8111e.h:106
#define RCV_RING_LEN0
Definition amd8111e.h:109
@ CMD7_CLEAR
Definition amd8111e.h:315
@ INTREN
Definition amd8111e.h:247
@ RUN
Definition amd8111e.h:248
@ RDMD0
Definition amd8111e.h:235
@ TDMD0
Definition amd8111e.h:240
@ UINTCMD
Definition amd8111e.h:242
@ CMD0_CLEAR
Definition amd8111e.h:250
#define LADRF
Definition amd8111e.h:123
#define CMD7
Definition amd8111e.h:69
#define STVAL
Definition amd8111e.h:90
#define DLY_INT_A
Definition amd8111e.h:84
#define CMD0
Definition amd8111e.h:66
@ XPHYRST
Definition amd8111e.h:335
@ XPHYANE
Definition amd8111e.h:336
#define RCV_RING_BASE_ADDR0
Definition amd8111e.h:97
#define DEFAULT_IPG
Definition amd8111e.h:571
@ MIB_CLEAR
Definition amd8111e.h:138
@ CTRL1_DEFAULT
Definition amd8111e.h:328
@ XMTSP_128
Definition amd8111e.h:324
@ XMTSP_MASK
Definition amd8111e.h:323
@ CACHE_ALIGN
Definition amd8111e.h:326
#define MIB_ADDR
Definition amd8111e.h:62
#define PHY_ACCESS
Definition amd8111e.h:88
#define PHY_SPEED_100
Definition amd8111e.h:161
@ FULL_DPLX
Definition amd8111e.h:150
@ LINK_STATS
Definition amd8111e.h:151
@ SPEED_MASK
Definition amd8111e.h:149
@ AUTONEG_COMPLETE
Definition amd8111e.h:152
@ PHY_RD_CMD
Definition amd8111e.h:479
@ PHY_CMD_ACTIVE
Definition amd8111e.h:477
@ PHY_RD_ERR
Definition amd8111e.h:480
@ PHY_WR_CMD
Definition amd8111e.h:478
#define FLOW_CONTROL
Definition amd8111e.h:87
#define IFS1_DELTA
Definition amd8111e.h:572
#define XMT_RING_BASE_ADDR2
Definition amd8111e.h:94
@ REX_RTRY
Definition amd8111e.h:275
@ REX_UFLO
Definition amd8111e.h:276
@ CMD2_CLEAR
Definition amd8111e.h:279
@ APAD_XMT
Definition amd8111e.h:271
#define PADR
Definition amd8111e.h:116
#define XMT_RING_BASE_ADDR3
Definition amd8111e.h:95
#define CMD2
Definition amd8111e.h:67
uint16_t pkt_len
Definition aqc1xx.h:2
long index
Definition bigint.h:65
#define MII_ADVERTISE
Definition atl1e.h:875
#define MII_BMCR
Definition atl1e.h:871
#define MII_BMSR
Definition atl1e.h:872
#define MII_PHYSID2
Definition atl1e.h:874
#define MII_LPA
Definition atl1e.h:876
#define MII_PHYSID1
Definition atl1e.h:873
uint32_t type
Operating system type.
Definition ena.h:1
uint8_t status
Status.
Definition ena.h:5
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition ethernet.c:176
Ethernet protocol.
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
uint16_t size
Buffer size.
Definition dwmac.h:3
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define ETH_FRAME_LEN
Definition if_ether.h:12
#define ETH_ALEN
Definition if_ether.h:9
#define ETH_HLEN
Definition if_ether.h:10
#define u8
Definition igbvf_osdep.h:40
#define le16_to_cpu(value)
Definition byteswap.h:113
#define cpu_to_le32(value)
Definition byteswap.h:108
#define htons(value)
Definition byteswap.h:136
#define cpu_to_le16(value)
Definition byteswap.h:107
#define __attribute__(x)
Definition compiler.h:10
#define wmb()
Definition io.h:546
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
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.
void __asmcall int val
Definition setjmp.h:12
String functions.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
int dummy_connect(struct nic *nic __unused)
Definition legacy.c:175
Media Independent Interface constants.
static unsigned int unsigned int reg
Definition myson.h:162
#define DRIVER(_name_text, _unused2, _unused3, _name, _probe, _disable, _fake_bss)
Definition nic.h:220
irq_action_t
Definition nic.h:34
@ FORCE
Definition nic.h:37
@ ENABLE
Definition nic.h:36
@ DISABLE
Definition nic.h:35
#define PCI_DRIVER(_name, _ids, _class)
Definition nic.h:105
unsigned long pci_bar_size(struct pci_device *pci, unsigned int reg)
Get the size of a PCI BAR.
Definition pci.c:164
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:241
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
Definition pci.c:97
PCI bus.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:308
#define PCI_BASE_ADDRESS_0
Definition pci.h:63
struct pci_device * pdev
Definition amd8111e.c:104
unsigned char rx_buf[NUM_RX_SLOTS][RX_BUF_LEN]
Definition amd8111e.c:93
unsigned long tx_idx
Definition amd8111e.c:94
unsigned long rx_idx
Definition amd8111e.c:94
int tx_consistent
Definition amd8111e.c:95
unsigned char tx_buf[NUM_TX_SLOTS][TX_BUF_LEN]
Definition amd8111e.c:92
void * mmio
Definition amd8111e.c:106
struct amd8111e_tx_desc tx_ring[NUM_TX_SLOTS]
Definition amd8111e.c:90
struct nic * nic
Definition amd8111e.c:105
struct amd8111e_rx_desc rx_ring[NUM_RX_SLOTS]
Definition amd8111e.c:91
u16 type
Definition amd8111e.c:85
u8 data[ETH_FRAME_LEN - ETH_HLEN]
Definition amd8111e.c:86
u8 dst_addr[ETH_ALEN]
Definition amd8111e.c:83
u8 src_addr[ETH_ALEN]
Definition amd8111e.c:84
Definition nic.h:49
unsigned char * packet
Definition nic.h:53
void * priv_data
Definition nic.h:59
unsigned char * node_addr
Definition nic.h:52
unsigned int packetlen
Definition nic.h:54
unsigned char irqno
Definition nic.h:56
unsigned int ioaddr
Definition nic.h:55
struct nic_operations * nic_op
Definition nic.h:50
A PCI device ID list entry.
Definition pci.h:175
A PCI device.
Definition pci.h:211
unsigned long ioaddr
I/O address.
Definition pci.h:226
uint8_t irq
Interrupt number.
Definition pci.h:234
A PCI driver.
Definition pci.h:252
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition timer.c:79
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition vsprintf.c:465
#define readl
Definition w89c840.c:157
#define writel
Definition w89c840.c:160
#define writew
Definition w89c840.c:159
#define readb
Definition w89c840.c:155
#define writeb
Definition w89c840.c:158
unsigned long frame
Definition xengrant.h:180