1 /* lasi_82596.c -- driver for the intel 82596 ethernet controller, as
2 munged into HPPA boxen .
4 This driver is based upon 82596.c, original credits are below...
5 but there were too many hoops which HP wants jumped through to
6 keep this code in there in a sane manner.
8 3 primary sources of the mess --
9 1) hppa needs *lots* of cacheline flushing to keep this kind of
12 2) The 82596 needs to see all of its pointers as their physical
13 address. Thus virt_to_bus/bus_to_virt are *everywhere*.
15 3) The implementation HP is using seems to be significantly pickier
16 about when and how the command and RX units are started. some
17 command ordering was changed.
19 Examination of the mach driver leads one to believe that there
20 might be a saner way to pull this off... anyone who feels like a
21 full rewrite can be my guest.
23 Split 02/13/2000 Sam Creasey (sammy@oh.verio.com)
25 02/01/2000 Initial modifications for parisc by Helge Deller (deller@gmx.de)
26 03/02/2000 changes for better/correct(?) cache-flushing (deller)
29 /* 82596.c: A generic 82596 ethernet driver for linux. */
32 Written 1994 by Mark Evans.
33 This driver is for the Apricot 82596 bus-master interface
35 Modularised 12/94 Mark Evans
38 Modified to support the 82596 ethernet chips on 680x0 VME boards.
39 by Richard Hirst <richard@sleepie.demon.co.uk>
42 980825: Changed to receive directly in to sk_buffs which are
43 allocated at open() time. Eliminates copy on incoming frames
44 (small ones are still copied). Shared data now held in a
45 non-cached page, so we can run on 68060 in copyback mode.
48 * look at deferring rx frames rather than discarding (as per tulip)
49 * handle tx ring full as per tulip
50 * performance test to tune rx_copybreak
52 Most of my modifications relate to the braindead big-endian
53 implementation by Intel. When the i596 is operating in
54 'big-endian' mode, it thinks a 32 bit value of 0x12345678
55 should be stored as 0x56781234. This is a real pain, when
56 you have linked lists which are shared by the 680x0 and the
60 Written 1993 by Donald Becker.
61 Copyright 1993 United States Government as represented by the Director,
62 National Security Agency. This software may only be used and distributed
63 according to the terms of the GNU General Public License as modified by SRC,
64 incorporated herein by reference.
66 The author may be reached as becker@scyld.com, or C/O
67 Scyld Computing Corporation, 410 Severn Ave., Suite 210, Annapolis MD 21403
71 #include <linux/module.h>
72 #include <linux/kernel.h>
73 #include <linux/string.h>
74 #include <linux/errno.h>
75 #include <linux/ioport.h>
76 #include <linux/interrupt.h>
77 #include <linux/delay.h>
78 #include <linux/netdevice.h>
79 #include <linux/etherdevice.h>
80 #include <linux/skbuff.h>
81 #include <linux/types.h>
82 #include <linux/bitops.h>
83 #include <linux/dma-mapping.h>
85 #include <linux/irq.h>
86 #include <linux/gfp.h>
91 #define DEB_INIT 0x0001
92 #define DEB_PROBE 0x0002
93 #define DEB_SERIOUS 0x0004
94 #define DEB_ERRORS 0x0008
95 #define DEB_MULTI 0x0010
96 #define DEB_TDR 0x0020
97 #define DEB_OPEN 0x0040
98 #define DEB_RESET 0x0080
99 #define DEB_ADDCMD 0x0100
100 #define DEB_STATUS 0x0200
101 #define DEB_STARTTX 0x0400
102 #define DEB_RXADDR 0x0800
103 #define DEB_TXADDR 0x1000
104 #define DEB_RXFRAME 0x2000
105 #define DEB_INTS 0x4000
106 #define DEB_STRUCT 0x8000
107 #define DEB_ANY 0xffff
110 #define DEB(x, y) if (i596_debug & (x)) { y; }
114 * The MPU_PORT command allows direct access to the 82596. With PORT access
115 * the following commands are available (p5-18). The 32-bit port command
116 * must be word-swapped with the most significant word written first.
117 * This only applies to VME boards.
119 #define PORT_RESET 0x00 /* reset 82596 */
120 #define PORT_SELFTEST 0x01 /* selftest */
121 #define PORT_ALTSCP 0x02 /* alternate SCB address */
122 #define PORT_ALTDUMP 0x03 /* Alternate DUMP address */
124 static int i596_debug
= (DEB_SERIOUS
|DEB_PROBE
);
126 /* Copy frames shorter than rx_copybreak, otherwise pass on up in
127 * a full sized sk_buff. Value of 100 stolen from tulip.c (!alpha).
129 static int rx_copybreak
= 100;
131 #define PKT_BUF_SZ 1536
132 #define MAX_MC_CNT 64
134 #define ISCP_BUSY 0x0001
136 #define I596_NULL ((u32)0xffffffff)
138 #define CMD_EOL 0x8000 /* The last command of the list, stop. */
139 #define CMD_SUSP 0x4000 /* Suspend after doing cmd. */
140 #define CMD_INTR 0x2000 /* Interrupt after doing cmd. */
142 #define CMD_FLEX 0x0008 /* Enable flexible memory model */
145 CmdNOp
= 0, CmdSASetup
= 1, CmdConfigure
= 2, CmdMulticastList
= 3,
146 CmdTx
= 4, CmdTDR
= 5, CmdDump
= 6, CmdDiagnose
= 7
149 #define STAT_C 0x8000 /* Set to 0 after execution */
150 #define STAT_B 0x4000 /* Command being executed */
151 #define STAT_OK 0x2000 /* Command executed ok */
152 #define STAT_A 0x1000 /* Command aborted */
154 #define CUC_START 0x0100
155 #define CUC_RESUME 0x0200
156 #define CUC_SUSPEND 0x0300
157 #define CUC_ABORT 0x0400
158 #define RX_START 0x0010
159 #define RX_RESUME 0x0020
160 #define RX_SUSPEND 0x0030
161 #define RX_ABORT 0x0040
163 #define TX_TIMEOUT (HZ/20)
167 unsigned short porthi
;
168 unsigned short portlo
;
173 #define SIZE_MASK 0x3fff
180 u32 cache_pad
[5]; /* Total 32 bytes... */
183 /* The command structure has two 'next' pointers; v_next is the address of
184 * the next command as seen by the CPU, b_next is the address of the next
185 * command as seen by the 82596. The b_next pointer, as used by the 82596
186 * always references the status field of the next command, rather than the
187 * v_next field, because the 82596 is unaware of v_next. It may seem more
188 * logical to put v_next at the end of the structure, but we cannot do that
189 * because the 82596 expects other fields to be there, depending on command
194 struct i596_cmd
*v_next
; /* Address from CPUs viewpoint */
195 unsigned short status
;
196 unsigned short command
;
197 u32 b_next
; /* Address from i596 viewpoint */
205 struct sk_buff
*skb
; /* So we can free it after tx */
208 u32 cache_pad
[6]; /* Total 64 bytes... */
210 u32 cache_pad
[1]; /* Total 32 bytes... */
216 unsigned short status
;
223 char mc_addrs
[MAX_MC_CNT
*6];
233 char i596_config
[16];
239 u32 b_next
; /* Address from i596 viewpoint */
241 unsigned short count
;
243 struct i596_rfd
*v_next
; /* Address from CPUs viewpoint */
244 struct i596_rfd
*v_prev
;
246 u32 cache_pad
[2]; /* Total 32 bytes... */
252 unsigned short count
;
253 unsigned short zero1
;
255 u32 b_data
; /* Address from i596 viewpoint */
257 unsigned short zero2
;
260 struct i596_rbd
*v_next
;
261 u32 b_addr
; /* This rbd addr from i596 view */
262 unsigned char *v_data
; /* Address from CPUs viewpoint */
263 /* Total 32 bytes... */
269 /* These values as chosen so struct i596_dma fits in one page... */
271 #define TX_RING_SIZE 32
272 #define RX_RING_SIZE 16
275 unsigned short status
;
276 unsigned short command
;
286 unsigned short t_off
;
301 struct i596_scp scp
__attribute__((aligned(32)));
302 volatile struct i596_iscp iscp
__attribute__((aligned(32)));
303 volatile struct i596_scb scb
__attribute__((aligned(32)));
304 struct sa_cmd sa_cmd
__attribute__((aligned(32)));
305 struct cf_cmd cf_cmd
__attribute__((aligned(32)));
306 struct tdr_cmd tdr_cmd
__attribute__((aligned(32)));
307 struct mc_cmd mc_cmd
__attribute__((aligned(32)));
308 struct i596_rfd rfds
[RX_RING_SIZE
] __attribute__((aligned(32)));
309 struct i596_rbd rbds
[RX_RING_SIZE
] __attribute__((aligned(32)));
310 struct tx_cmd tx_cmds
[TX_RING_SIZE
] __attribute__((aligned(32)));
311 struct i596_tbd tbds
[TX_RING_SIZE
] __attribute__((aligned(32)));
314 struct i596_private
{
315 struct i596_dma
*dma
;
318 struct i596_rfd
*rfd_head
;
319 struct i596_rbd
*rbd_head
;
320 struct i596_cmd
*cmd_tail
;
321 struct i596_cmd
*cmd_head
;
326 spinlock_t lock
; /* serialize access to chip */
328 void __iomem
*mpu_port
;
332 static const char init_setup
[] =
334 0x8E, /* length, prefetch on */
335 0xC8, /* fifo to 8, monitor off */
336 0x80, /* don't save bad frames */
337 0x2E, /* No source address insertion, 8 byte preamble */
338 0x00, /* priority and backoff defaults */
339 0x60, /* interframe spacing */
340 0x00, /* slot time LSB */
341 0xf2, /* slot time and retries */
342 0x00, /* promiscuous mode */
343 0x00, /* collision detect */
344 0x40, /* minimum frame length */
347 0x7f /* *multi IA */ };
349 static int i596_open(struct net_device
*dev
);
350 static netdev_tx_t
i596_start_xmit(struct sk_buff
*skb
, struct net_device
*dev
);
351 static irqreturn_t
i596_interrupt(int irq
, void *dev_id
);
352 static int i596_close(struct net_device
*dev
);
353 static void i596_add_cmd(struct net_device
*dev
, struct i596_cmd
*cmd
);
354 static void i596_tx_timeout (struct net_device
*dev
, unsigned int txqueue
);
355 static void print_eth(unsigned char *buf
, char *str
);
356 static void set_multicast_list(struct net_device
*dev
);
357 static inline void ca(struct net_device
*dev
);
358 static void mpu_port(struct net_device
*dev
, int c
, dma_addr_t x
);
360 static int rx_ring_size
= RX_RING_SIZE
;
361 static int ticks_limit
= 100;
362 static int max_cmd_backlog
= TX_RING_SIZE
-1;
364 #ifdef CONFIG_NET_POLL_CONTROLLER
365 static void i596_poll_controller(struct net_device
*dev
);
369 static inline int wait_istat(struct net_device
*dev
, struct i596_dma
*dma
, int delcnt
, char *str
)
371 DMA_INV(dev
, &(dma
->iscp
), sizeof(struct i596_iscp
));
372 while (--delcnt
&& dma
->iscp
.stat
) {
374 DMA_INV(dev
, &(dma
->iscp
), sizeof(struct i596_iscp
));
377 printk(KERN_ERR
"%s: %s, iscp.stat %04x, didn't clear\n",
378 dev
->name
, str
, SWAP16(dma
->iscp
.stat
));
385 static inline int wait_cmd(struct net_device
*dev
, struct i596_dma
*dma
, int delcnt
, char *str
)
387 DMA_INV(dev
, &(dma
->scb
), sizeof(struct i596_scb
));
388 while (--delcnt
&& dma
->scb
.command
) {
390 DMA_INV(dev
, &(dma
->scb
), sizeof(struct i596_scb
));
393 printk(KERN_ERR
"%s: %s, status %4.4x, cmd %4.4x.\n",
395 SWAP16(dma
->scb
.status
),
396 SWAP16(dma
->scb
.command
));
403 static void i596_display_data(struct net_device
*dev
)
405 struct i596_private
*lp
= netdev_priv(dev
);
406 struct i596_dma
*dma
= lp
->dma
;
407 struct i596_cmd
*cmd
;
408 struct i596_rfd
*rfd
;
409 struct i596_rbd
*rbd
;
411 printk(KERN_DEBUG
"lp and scp at %p, .sysbus = %08x, .iscp = %08x\n",
412 &dma
->scp
, dma
->scp
.sysbus
, SWAP32(dma
->scp
.iscp
));
413 printk(KERN_DEBUG
"iscp at %p, iscp.stat = %08x, .scb = %08x\n",
414 &dma
->iscp
, SWAP32(dma
->iscp
.stat
), SWAP32(dma
->iscp
.scb
));
415 printk(KERN_DEBUG
"scb at %p, scb.status = %04x, .command = %04x,"
416 " .cmd = %08x, .rfd = %08x\n",
417 &dma
->scb
, SWAP16(dma
->scb
.status
), SWAP16(dma
->scb
.command
),
418 SWAP16(dma
->scb
.cmd
), SWAP32(dma
->scb
.rfd
));
419 printk(KERN_DEBUG
" errors: crc %x, align %x, resource %x,"
420 " over %x, rcvdt %x, short %x\n",
421 SWAP32(dma
->scb
.crc_err
), SWAP32(dma
->scb
.align_err
),
422 SWAP32(dma
->scb
.resource_err
), SWAP32(dma
->scb
.over_err
),
423 SWAP32(dma
->scb
.rcvdt_err
), SWAP32(dma
->scb
.short_err
));
425 while (cmd
!= NULL
) {
427 "cmd at %p, .status = %04x, .command = %04x,"
429 cmd
, SWAP16(cmd
->status
), SWAP16(cmd
->command
),
430 SWAP32(cmd
->b_next
));
434 printk(KERN_DEBUG
"rfd_head = %p\n", rfd
);
437 " %p .stat %04x, .cmd %04x, b_next %08x, rbd %08x,"
439 rfd
, SWAP16(rfd
->stat
), SWAP16(rfd
->cmd
),
440 SWAP32(rfd
->b_next
), SWAP32(rfd
->rbd
),
443 } while (rfd
!= lp
->rfd_head
);
445 printk(KERN_DEBUG
"rbd_head = %p\n", rbd
);
448 " %p .count %04x, b_next %08x, b_data %08x,"
450 rbd
, SWAP16(rbd
->count
), SWAP32(rbd
->b_next
),
451 SWAP32(rbd
->b_data
), SWAP16(rbd
->size
));
453 } while (rbd
!= lp
->rbd_head
);
454 DMA_INV(dev
, dma
, sizeof(struct i596_dma
));
458 #define virt_to_dma(lp, v) ((lp)->dma_addr + (dma_addr_t)((unsigned long)(v)-(unsigned long)((lp)->dma)))
460 static inline int init_rx_bufs(struct net_device
*dev
)
462 struct i596_private
*lp
= netdev_priv(dev
);
463 struct i596_dma
*dma
= lp
->dma
;
465 struct i596_rfd
*rfd
;
466 struct i596_rbd
*rbd
;
468 /* First build the Receive Buffer Descriptor List */
470 for (i
= 0, rbd
= dma
->rbds
; i
< rx_ring_size
; i
++, rbd
++) {
474 skb
= netdev_alloc_skb_ip_align(dev
, PKT_BUF_SZ
);
477 dma_addr
= dma_map_single(dev
->dev
.parent
, skb
->data
,
478 PKT_BUF_SZ
, DMA_FROM_DEVICE
);
480 rbd
->b_next
= SWAP32(virt_to_dma(lp
, rbd
+1));
481 rbd
->b_addr
= SWAP32(virt_to_dma(lp
, rbd
));
483 rbd
->v_data
= skb
->data
;
484 rbd
->b_data
= SWAP32(dma_addr
);
485 rbd
->size
= SWAP16(PKT_BUF_SZ
);
487 lp
->rbd_head
= dma
->rbds
;
488 rbd
= dma
->rbds
+ rx_ring_size
- 1;
489 rbd
->v_next
= dma
->rbds
;
490 rbd
->b_next
= SWAP32(virt_to_dma(lp
, dma
->rbds
));
492 /* Now build the Receive Frame Descriptor List */
494 for (i
= 0, rfd
= dma
->rfds
; i
< rx_ring_size
; i
++, rfd
++) {
495 rfd
->rbd
= I596_NULL
;
498 rfd
->b_next
= SWAP32(virt_to_dma(lp
, rfd
+1));
499 rfd
->cmd
= SWAP16(CMD_FLEX
);
501 lp
->rfd_head
= dma
->rfds
;
502 dma
->scb
.rfd
= SWAP32(virt_to_dma(lp
, dma
->rfds
));
504 rfd
->rbd
= SWAP32(virt_to_dma(lp
, lp
->rbd_head
));
505 rfd
->v_prev
= dma
->rfds
+ rx_ring_size
- 1;
506 rfd
= dma
->rfds
+ rx_ring_size
- 1;
507 rfd
->v_next
= dma
->rfds
;
508 rfd
->b_next
= SWAP32(virt_to_dma(lp
, dma
->rfds
));
509 rfd
->cmd
= SWAP16(CMD_EOL
|CMD_FLEX
);
511 DMA_WBACK_INV(dev
, dma
, sizeof(struct i596_dma
));
515 static inline void remove_rx_bufs(struct net_device
*dev
)
517 struct i596_private
*lp
= netdev_priv(dev
);
518 struct i596_rbd
*rbd
;
521 for (i
= 0, rbd
= lp
->dma
->rbds
; i
< rx_ring_size
; i
++, rbd
++) {
522 if (rbd
->skb
== NULL
)
524 dma_unmap_single(dev
->dev
.parent
,
525 (dma_addr_t
)SWAP32(rbd
->b_data
),
526 PKT_BUF_SZ
, DMA_FROM_DEVICE
);
527 dev_kfree_skb(rbd
->skb
);
532 static void rebuild_rx_bufs(struct net_device
*dev
)
534 struct i596_private
*lp
= netdev_priv(dev
);
535 struct i596_dma
*dma
= lp
->dma
;
538 /* Ensure rx frame/buffer descriptors are tidy */
540 for (i
= 0; i
< rx_ring_size
; i
++) {
541 dma
->rfds
[i
].rbd
= I596_NULL
;
542 dma
->rfds
[i
].cmd
= SWAP16(CMD_FLEX
);
544 dma
->rfds
[rx_ring_size
-1].cmd
= SWAP16(CMD_EOL
|CMD_FLEX
);
545 lp
->rfd_head
= dma
->rfds
;
546 dma
->scb
.rfd
= SWAP32(virt_to_dma(lp
, dma
->rfds
));
547 lp
->rbd_head
= dma
->rbds
;
548 dma
->rfds
[0].rbd
= SWAP32(virt_to_dma(lp
, dma
->rbds
));
550 DMA_WBACK_INV(dev
, dma
, sizeof(struct i596_dma
));
554 static int init_i596_mem(struct net_device
*dev
)
556 struct i596_private
*lp
= netdev_priv(dev
);
557 struct i596_dma
*dma
= lp
->dma
;
560 mpu_port(dev
, PORT_RESET
, 0);
561 udelay(100); /* Wait 100us - seems to help */
563 /* change the scp address */
565 lp
->last_cmd
= jiffies
;
567 dma
->scp
.sysbus
= SYSBUS
;
568 dma
->scp
.iscp
= SWAP32(virt_to_dma(lp
, &(dma
->iscp
)));
569 dma
->iscp
.scb
= SWAP32(virt_to_dma(lp
, &(dma
->scb
)));
570 dma
->iscp
.stat
= SWAP32(ISCP_BUSY
);
574 dma
->scb
.cmd
= I596_NULL
;
576 DEB(DEB_INIT
, printk(KERN_DEBUG
"%s: starting i82596.\n", dev
->name
));
578 DMA_WBACK(dev
, &(dma
->scp
), sizeof(struct i596_scp
));
579 DMA_WBACK(dev
, &(dma
->iscp
), sizeof(struct i596_iscp
));
580 DMA_WBACK(dev
, &(dma
->scb
), sizeof(struct i596_scb
));
582 mpu_port(dev
, PORT_ALTSCP
, virt_to_dma(lp
, &dma
->scp
));
584 if (wait_istat(dev
, dma
, 1000, "initialization timed out"))
586 DEB(DEB_INIT
, printk(KERN_DEBUG
587 "%s: i82596 initialization successful\n",
590 if (request_irq(dev
->irq
, i596_interrupt
, 0, "i82596", dev
)) {
591 printk(KERN_ERR
"%s: IRQ %d not free\n", dev
->name
, dev
->irq
);
595 /* Ensure rx frame/buffer descriptors are tidy */
596 rebuild_rx_bufs(dev
);
598 dma
->scb
.command
= 0;
599 DMA_WBACK(dev
, &(dma
->scb
), sizeof(struct i596_scb
));
601 DEB(DEB_INIT
, printk(KERN_DEBUG
602 "%s: queuing CmdConfigure\n", dev
->name
));
603 memcpy(dma
->cf_cmd
.i596_config
, init_setup
, 14);
604 dma
->cf_cmd
.cmd
.command
= SWAP16(CmdConfigure
);
605 DMA_WBACK(dev
, &(dma
->cf_cmd
), sizeof(struct cf_cmd
));
606 i596_add_cmd(dev
, &dma
->cf_cmd
.cmd
);
608 DEB(DEB_INIT
, printk(KERN_DEBUG
"%s: queuing CmdSASetup\n", dev
->name
));
609 memcpy(dma
->sa_cmd
.eth_addr
, dev
->dev_addr
, ETH_ALEN
);
610 dma
->sa_cmd
.cmd
.command
= SWAP16(CmdSASetup
);
611 DMA_WBACK(dev
, &(dma
->sa_cmd
), sizeof(struct sa_cmd
));
612 i596_add_cmd(dev
, &dma
->sa_cmd
.cmd
);
614 DEB(DEB_INIT
, printk(KERN_DEBUG
"%s: queuing CmdTDR\n", dev
->name
));
615 dma
->tdr_cmd
.cmd
.command
= SWAP16(CmdTDR
);
616 DMA_WBACK(dev
, &(dma
->tdr_cmd
), sizeof(struct tdr_cmd
));
617 i596_add_cmd(dev
, &dma
->tdr_cmd
.cmd
);
619 spin_lock_irqsave (&lp
->lock
, flags
);
621 if (wait_cmd(dev
, dma
, 1000, "timed out waiting to issue RX_START")) {
622 spin_unlock_irqrestore (&lp
->lock
, flags
);
623 goto failed_free_irq
;
625 DEB(DEB_INIT
, printk(KERN_DEBUG
"%s: Issuing RX_START\n", dev
->name
));
626 dma
->scb
.command
= SWAP16(RX_START
);
627 dma
->scb
.rfd
= SWAP32(virt_to_dma(lp
, dma
->rfds
));
628 DMA_WBACK(dev
, &(dma
->scb
), sizeof(struct i596_scb
));
632 spin_unlock_irqrestore (&lp
->lock
, flags
);
633 if (wait_cmd(dev
, dma
, 1000, "RX_START not processed"))
634 goto failed_free_irq
;
635 DEB(DEB_INIT
, printk(KERN_DEBUG
636 "%s: Receive unit started OK\n", dev
->name
));
640 free_irq(dev
->irq
, dev
);
642 printk(KERN_ERR
"%s: Failed to initialise 82596\n", dev
->name
);
643 mpu_port(dev
, PORT_RESET
, 0);
648 static inline int i596_rx(struct net_device
*dev
)
650 struct i596_private
*lp
= netdev_priv(dev
);
651 struct i596_rfd
*rfd
;
652 struct i596_rbd
*rbd
;
655 DEB(DEB_RXFRAME
, printk(KERN_DEBUG
656 "i596_rx(), rfd_head %p, rbd_head %p\n",
657 lp
->rfd_head
, lp
->rbd_head
));
660 rfd
= lp
->rfd_head
; /* Ref next frame to check */
662 DMA_INV(dev
, rfd
, sizeof(struct i596_rfd
));
663 while (rfd
->stat
& SWAP16(STAT_C
)) { /* Loop while complete frames */
664 if (rfd
->rbd
== I596_NULL
)
666 else if (rfd
->rbd
== lp
->rbd_head
->b_addr
) {
668 DMA_INV(dev
, rbd
, sizeof(struct i596_rbd
));
670 printk(KERN_ERR
"%s: rbd chain broken!\n", dev
->name
);
674 DEB(DEB_RXFRAME
, printk(KERN_DEBUG
675 " rfd %p, rfd.rbd %08x, rfd.stat %04x\n",
676 rfd
, rfd
->rbd
, rfd
->stat
));
678 if (rbd
!= NULL
&& (rfd
->stat
& SWAP16(STAT_OK
))) {
680 int pkt_len
= SWAP16(rbd
->count
) & 0x3fff;
681 struct sk_buff
*skb
= rbd
->skb
;
684 DEB(DEB_RXADDR
, print_eth(rbd
->v_data
, "received"));
687 /* Check if the packet is long enough to just accept
688 * without copying to a properly sized skbuff.
691 if (pkt_len
> rx_copybreak
) {
692 struct sk_buff
*newskb
;
695 dma_unmap_single(dev
->dev
.parent
,
696 (dma_addr_t
)SWAP32(rbd
->b_data
),
697 PKT_BUF_SZ
, DMA_FROM_DEVICE
);
698 /* Get fresh skbuff to replace filled one. */
699 newskb
= netdev_alloc_skb_ip_align(dev
,
701 if (newskb
== NULL
) {
702 skb
= NULL
; /* drop pkt */
706 /* Pass up the skb already on the Rx ring. */
707 skb_put(skb
, pkt_len
);
710 dma_addr
= dma_map_single(dev
->dev
.parent
,
714 rbd
->v_data
= newskb
->data
;
715 rbd
->b_data
= SWAP32(dma_addr
);
716 DMA_WBACK_INV(dev
, rbd
, sizeof(struct i596_rbd
));
718 skb
= netdev_alloc_skb_ip_align(dev
, pkt_len
);
722 /* XXX tulip.c can defer packets here!! */
723 dev
->stats
.rx_dropped
++;
726 /* 16 byte align the data fields */
727 dma_sync_single_for_cpu(dev
->dev
.parent
,
728 (dma_addr_t
)SWAP32(rbd
->b_data
),
729 PKT_BUF_SZ
, DMA_FROM_DEVICE
);
730 skb_put_data(skb
, rbd
->v_data
,
732 dma_sync_single_for_device(dev
->dev
.parent
,
733 (dma_addr_t
)SWAP32(rbd
->b_data
),
734 PKT_BUF_SZ
, DMA_FROM_DEVICE
);
737 skb
->protocol
= eth_type_trans(skb
, dev
);
739 dev
->stats
.rx_packets
++;
740 dev
->stats
.rx_bytes
+= pkt_len
;
743 DEB(DEB_ERRORS
, printk(KERN_DEBUG
744 "%s: Error, rfd.stat = 0x%04x\n",
745 dev
->name
, rfd
->stat
));
746 dev
->stats
.rx_errors
++;
747 if (rfd
->stat
& SWAP16(0x0100))
748 dev
->stats
.collisions
++;
749 if (rfd
->stat
& SWAP16(0x8000))
750 dev
->stats
.rx_length_errors
++;
751 if (rfd
->stat
& SWAP16(0x0001))
752 dev
->stats
.rx_over_errors
++;
753 if (rfd
->stat
& SWAP16(0x0002))
754 dev
->stats
.rx_fifo_errors
++;
755 if (rfd
->stat
& SWAP16(0x0004))
756 dev
->stats
.rx_frame_errors
++;
757 if (rfd
->stat
& SWAP16(0x0008))
758 dev
->stats
.rx_crc_errors
++;
759 if (rfd
->stat
& SWAP16(0x0010))
760 dev
->stats
.rx_length_errors
++;
763 /* Clear the buffer descriptor count and EOF + F flags */
765 if (rbd
!= NULL
&& (rbd
->count
& SWAP16(0x4000))) {
767 lp
->rbd_head
= rbd
->v_next
;
768 DMA_WBACK_INV(dev
, rbd
, sizeof(struct i596_rbd
));
771 /* Tidy the frame descriptor, marking it as end of list */
773 rfd
->rbd
= I596_NULL
;
775 rfd
->cmd
= SWAP16(CMD_EOL
|CMD_FLEX
);
778 /* Update record of next frame descriptor to process */
780 lp
->dma
->scb
.rfd
= rfd
->b_next
;
781 lp
->rfd_head
= rfd
->v_next
;
782 DMA_WBACK_INV(dev
, rfd
, sizeof(struct i596_rfd
));
784 /* Remove end-of-list from old end descriptor */
786 rfd
->v_prev
->cmd
= SWAP16(CMD_FLEX
);
787 DMA_WBACK_INV(dev
, rfd
->v_prev
, sizeof(struct i596_rfd
));
789 DMA_INV(dev
, rfd
, sizeof(struct i596_rfd
));
792 DEB(DEB_RXFRAME
, printk(KERN_DEBUG
"frames %d\n", frames
));
798 static inline void i596_cleanup_cmd(struct net_device
*dev
, struct i596_private
*lp
)
800 struct i596_cmd
*ptr
;
802 while (lp
->cmd_head
!= NULL
) {
804 lp
->cmd_head
= ptr
->v_next
;
807 switch (SWAP16(ptr
->command
) & 0x7) {
810 struct tx_cmd
*tx_cmd
= (struct tx_cmd
*) ptr
;
811 struct sk_buff
*skb
= tx_cmd
->skb
;
812 dma_unmap_single(dev
->dev
.parent
,
814 skb
->len
, DMA_TO_DEVICE
);
818 dev
->stats
.tx_errors
++;
819 dev
->stats
.tx_aborted_errors
++;
822 ptr
->b_next
= I596_NULL
;
823 tx_cmd
->cmd
.command
= 0; /* Mark as free */
828 ptr
->b_next
= I596_NULL
;
830 DMA_WBACK_INV(dev
, ptr
, sizeof(struct i596_cmd
));
833 wait_cmd(dev
, lp
->dma
, 100, "i596_cleanup_cmd timed out");
834 lp
->dma
->scb
.cmd
= I596_NULL
;
835 DMA_WBACK(dev
, &(lp
->dma
->scb
), sizeof(struct i596_scb
));
839 static inline void i596_reset(struct net_device
*dev
, struct i596_private
*lp
)
843 DEB(DEB_RESET
, printk(KERN_DEBUG
"i596_reset\n"));
845 spin_lock_irqsave (&lp
->lock
, flags
);
847 wait_cmd(dev
, lp
->dma
, 100, "i596_reset timed out");
849 netif_stop_queue(dev
);
851 /* FIXME: this command might cause an lpmc */
852 lp
->dma
->scb
.command
= SWAP16(CUC_ABORT
| RX_ABORT
);
853 DMA_WBACK(dev
, &(lp
->dma
->scb
), sizeof(struct i596_scb
));
856 /* wait for shutdown */
857 wait_cmd(dev
, lp
->dma
, 1000, "i596_reset 2 timed out");
858 spin_unlock_irqrestore (&lp
->lock
, flags
);
860 i596_cleanup_cmd(dev
, lp
);
863 netif_start_queue(dev
);
868 static void i596_add_cmd(struct net_device
*dev
, struct i596_cmd
*cmd
)
870 struct i596_private
*lp
= netdev_priv(dev
);
871 struct i596_dma
*dma
= lp
->dma
;
874 DEB(DEB_ADDCMD
, printk(KERN_DEBUG
"i596_add_cmd cmd_head %p\n",
878 cmd
->command
|= SWAP16(CMD_EOL
| CMD_INTR
);
880 cmd
->b_next
= I596_NULL
;
881 DMA_WBACK(dev
, cmd
, sizeof(struct i596_cmd
));
883 spin_lock_irqsave (&lp
->lock
, flags
);
885 if (lp
->cmd_head
!= NULL
) {
886 lp
->cmd_tail
->v_next
= cmd
;
887 lp
->cmd_tail
->b_next
= SWAP32(virt_to_dma(lp
, &cmd
->status
));
888 DMA_WBACK(dev
, lp
->cmd_tail
, sizeof(struct i596_cmd
));
891 wait_cmd(dev
, dma
, 100, "i596_add_cmd timed out");
892 dma
->scb
.cmd
= SWAP32(virt_to_dma(lp
, &cmd
->status
));
893 dma
->scb
.command
= SWAP16(CUC_START
);
894 DMA_WBACK(dev
, &(dma
->scb
), sizeof(struct i596_scb
));
900 spin_unlock_irqrestore (&lp
->lock
, flags
);
902 if (lp
->cmd_backlog
> max_cmd_backlog
) {
903 unsigned long tickssofar
= jiffies
- lp
->last_cmd
;
905 if (tickssofar
< ticks_limit
)
909 "%s: command unit timed out, status resetting.\n",
917 static int i596_open(struct net_device
*dev
)
919 DEB(DEB_OPEN
, printk(KERN_DEBUG
920 "%s: i596_open() irq %d.\n", dev
->name
, dev
->irq
));
922 if (init_rx_bufs(dev
)) {
923 printk(KERN_ERR
"%s: Failed to init rx bufs\n", dev
->name
);
926 if (init_i596_mem(dev
)) {
927 printk(KERN_ERR
"%s: Failed to init memory\n", dev
->name
);
928 goto out_remove_rx_bufs
;
930 netif_start_queue(dev
);
939 static void i596_tx_timeout (struct net_device
*dev
, unsigned int txqueue
)
941 struct i596_private
*lp
= netdev_priv(dev
);
943 /* Transmitter timeout, serious problems. */
944 DEB(DEB_ERRORS
, printk(KERN_DEBUG
945 "%s: transmit timed out, status resetting.\n",
948 dev
->stats
.tx_errors
++;
950 /* Try to restart the adaptor */
951 if (lp
->last_restart
== dev
->stats
.tx_packets
) {
952 DEB(DEB_ERRORS
, printk(KERN_DEBUG
"Resetting board.\n"));
953 /* Shutdown and restart */
954 i596_reset (dev
, lp
);
956 /* Issue a channel attention signal */
957 DEB(DEB_ERRORS
, printk(KERN_DEBUG
"Kicking board.\n"));
958 lp
->dma
->scb
.command
= SWAP16(CUC_START
| RX_START
);
959 DMA_WBACK_INV(dev
, &(lp
->dma
->scb
), sizeof(struct i596_scb
));
961 lp
->last_restart
= dev
->stats
.tx_packets
;
964 netif_trans_update(dev
); /* prevent tx timeout */
965 netif_wake_queue (dev
);
969 static netdev_tx_t
i596_start_xmit(struct sk_buff
*skb
, struct net_device
*dev
)
971 struct i596_private
*lp
= netdev_priv(dev
);
972 struct tx_cmd
*tx_cmd
;
973 struct i596_tbd
*tbd
;
974 short length
= skb
->len
;
976 DEB(DEB_STARTTX
, printk(KERN_DEBUG
977 "%s: i596_start_xmit(%x,%p) called\n",
978 dev
->name
, skb
->len
, skb
->data
));
980 if (length
< ETH_ZLEN
) {
981 if (skb_padto(skb
, ETH_ZLEN
))
986 netif_stop_queue(dev
);
988 tx_cmd
= lp
->dma
->tx_cmds
+ lp
->next_tx_cmd
;
989 tbd
= lp
->dma
->tbds
+ lp
->next_tx_cmd
;
991 if (tx_cmd
->cmd
.command
) {
992 DEB(DEB_ERRORS
, printk(KERN_DEBUG
993 "%s: xmit ring full, dropping packet.\n",
995 dev
->stats
.tx_dropped
++;
997 dev_kfree_skb_any(skb
);
999 if (++lp
->next_tx_cmd
== TX_RING_SIZE
)
1000 lp
->next_tx_cmd
= 0;
1001 tx_cmd
->tbd
= SWAP32(virt_to_dma(lp
, tbd
));
1002 tbd
->next
= I596_NULL
;
1004 tx_cmd
->cmd
.command
= SWAP16(CMD_FLEX
| CmdTx
);
1010 tbd
->size
= SWAP16(EOF
| length
);
1012 tx_cmd
->dma_addr
= dma_map_single(dev
->dev
.parent
, skb
->data
,
1013 skb
->len
, DMA_TO_DEVICE
);
1014 tbd
->data
= SWAP32(tx_cmd
->dma_addr
);
1016 DEB(DEB_TXADDR
, print_eth(skb
->data
, "tx-queued"));
1017 DMA_WBACK_INV(dev
, tx_cmd
, sizeof(struct tx_cmd
));
1018 DMA_WBACK_INV(dev
, tbd
, sizeof(struct i596_tbd
));
1019 i596_add_cmd(dev
, &tx_cmd
->cmd
);
1021 dev
->stats
.tx_packets
++;
1022 dev
->stats
.tx_bytes
+= length
;
1025 netif_start_queue(dev
);
1027 return NETDEV_TX_OK
;
1030 static void print_eth(unsigned char *add
, char *str
)
1032 printk(KERN_DEBUG
"i596 0x%p, %pM --> %pM %02X%02X, %s\n",
1033 add
, add
+ 6, add
, add
[12], add
[13], str
);
1035 static const struct net_device_ops i596_netdev_ops
= {
1036 .ndo_open
= i596_open
,
1037 .ndo_stop
= i596_close
,
1038 .ndo_start_xmit
= i596_start_xmit
,
1039 .ndo_set_rx_mode
= set_multicast_list
,
1040 .ndo_tx_timeout
= i596_tx_timeout
,
1041 .ndo_validate_addr
= eth_validate_addr
,
1042 .ndo_set_mac_address
= eth_mac_addr
,
1043 #ifdef CONFIG_NET_POLL_CONTROLLER
1044 .ndo_poll_controller
= i596_poll_controller
,
1048 static int i82596_probe(struct net_device
*dev
)
1051 struct i596_private
*lp
= netdev_priv(dev
);
1052 struct i596_dma
*dma
;
1054 /* This lot is ensure things have been cache line aligned. */
1055 BUILD_BUG_ON(sizeof(struct i596_rfd
) != 32);
1056 BUILD_BUG_ON(sizeof(struct i596_rbd
) & 31);
1057 BUILD_BUG_ON(sizeof(struct tx_cmd
) & 31);
1058 BUILD_BUG_ON(sizeof(struct i596_tbd
) != 32);
1060 BUILD_BUG_ON(sizeof(struct i596_dma
) > 4096);
1063 if (!dev
->base_addr
|| !dev
->irq
)
1066 dma
= dma_alloc_attrs(dev
->dev
.parent
, sizeof(struct i596_dma
),
1067 &lp
->dma_addr
, GFP_KERNEL
,
1070 printk(KERN_ERR
"%s: Couldn't get shared memory\n", __FILE__
);
1074 dev
->netdev_ops
= &i596_netdev_ops
;
1075 dev
->watchdog_timeo
= TX_TIMEOUT
;
1077 memset(dma
, 0, sizeof(struct i596_dma
));
1080 dma
->scb
.command
= 0;
1081 dma
->scb
.cmd
= I596_NULL
;
1082 dma
->scb
.rfd
= I596_NULL
;
1083 spin_lock_init(&lp
->lock
);
1085 DMA_WBACK_INV(dev
, dma
, sizeof(struct i596_dma
));
1087 i
= register_netdev(dev
);
1089 dma_free_attrs(dev
->dev
.parent
, sizeof(struct i596_dma
),
1090 dma
, lp
->dma_addr
, LIB82596_DMA_ATTR
);
1094 DEB(DEB_PROBE
, printk(KERN_INFO
"%s: 82596 at %#3lx, %pM IRQ %d.\n",
1095 dev
->name
, dev
->base_addr
, dev
->dev_addr
,
1097 DEB(DEB_INIT
, printk(KERN_INFO
1098 "%s: dma at 0x%p (%d bytes), lp->scb at 0x%p\n",
1099 dev
->name
, dma
, (int)sizeof(struct i596_dma
),
1105 #ifdef CONFIG_NET_POLL_CONTROLLER
1106 static void i596_poll_controller(struct net_device
*dev
)
1108 disable_irq(dev
->irq
);
1109 i596_interrupt(dev
->irq
, dev
);
1110 enable_irq(dev
->irq
);
1114 static irqreturn_t
i596_interrupt(int irq
, void *dev_id
)
1116 struct net_device
*dev
= dev_id
;
1117 struct i596_private
*lp
;
1118 struct i596_dma
*dma
;
1119 unsigned short status
, ack_cmd
= 0;
1121 lp
= netdev_priv(dev
);
1124 spin_lock (&lp
->lock
);
1126 wait_cmd(dev
, dma
, 100, "i596 interrupt, timeout");
1127 status
= SWAP16(dma
->scb
.status
);
1129 DEB(DEB_INTS
, printk(KERN_DEBUG
1130 "%s: i596 interrupt, IRQ %d, status %4.4x.\n",
1131 dev
->name
, dev
->irq
, status
));
1133 ack_cmd
= status
& 0xf000;
1136 DEB(DEB_ERRORS
, printk(KERN_DEBUG
1137 "%s: interrupt with no events\n",
1139 spin_unlock (&lp
->lock
);
1143 if ((status
& 0x8000) || (status
& 0x2000)) {
1144 struct i596_cmd
*ptr
;
1146 if ((status
& 0x8000))
1149 "%s: i596 interrupt completed command.\n",
1151 if ((status
& 0x2000))
1154 "%s: i596 interrupt command unit inactive %x.\n",
1155 dev
->name
, status
& 0x0700));
1157 while (lp
->cmd_head
!= NULL
) {
1158 DMA_INV(dev
, lp
->cmd_head
, sizeof(struct i596_cmd
));
1159 if (!(lp
->cmd_head
->status
& SWAP16(STAT_C
)))
1166 "cmd_head->status = %04x, ->command = %04x\n",
1167 SWAP16(lp
->cmd_head
->status
),
1168 SWAP16(lp
->cmd_head
->command
)));
1169 lp
->cmd_head
= ptr
->v_next
;
1172 switch (SWAP16(ptr
->command
) & 0x7) {
1175 struct tx_cmd
*tx_cmd
= (struct tx_cmd
*) ptr
;
1176 struct sk_buff
*skb
= tx_cmd
->skb
;
1178 if (ptr
->status
& SWAP16(STAT_OK
)) {
1180 print_eth(skb
->data
, "tx-done"));
1182 dev
->stats
.tx_errors
++;
1183 if (ptr
->status
& SWAP16(0x0020))
1184 dev
->stats
.collisions
++;
1185 if (!(ptr
->status
& SWAP16(0x0040)))
1186 dev
->stats
.tx_heartbeat_errors
++;
1187 if (ptr
->status
& SWAP16(0x0400))
1188 dev
->stats
.tx_carrier_errors
++;
1189 if (ptr
->status
& SWAP16(0x0800))
1190 dev
->stats
.collisions
++;
1191 if (ptr
->status
& SWAP16(0x1000))
1192 dev
->stats
.tx_aborted_errors
++;
1194 dma_unmap_single(dev
->dev
.parent
,
1196 skb
->len
, DMA_TO_DEVICE
);
1197 dev_consume_skb_irq(skb
);
1199 tx_cmd
->cmd
.command
= 0; /* Mark free */
1204 unsigned short status
= SWAP16(((struct tdr_cmd
*)ptr
)->status
);
1206 if (status
& 0x8000) {
1208 printk(KERN_DEBUG
"%s: link ok.\n",
1211 if (status
& 0x4000)
1213 "%s: Transceiver problem.\n",
1215 if (status
& 0x2000)
1217 "%s: Termination problem.\n",
1219 if (status
& 0x1000)
1221 "%s: Short circuit.\n",
1225 printk(KERN_DEBUG
"%s: Time %d.\n",
1226 dev
->name
, status
& 0x07ff));
1232 * Zap command so set_multicast_list() know
1239 ptr
->b_next
= I596_NULL
;
1240 DMA_WBACK(dev
, ptr
, sizeof(struct i596_cmd
));
1241 lp
->last_cmd
= jiffies
;
1244 /* This mess is arranging that only the last of any outstanding
1245 * commands has the interrupt bit set. Should probably really
1246 * only add to the cmd queue when the CU is stopped.
1249 while ((ptr
!= NULL
) && (ptr
!= lp
->cmd_tail
)) {
1250 struct i596_cmd
*prev
= ptr
;
1252 ptr
->command
&= SWAP16(0x1fff);
1254 DMA_WBACK_INV(dev
, prev
, sizeof(struct i596_cmd
));
1257 if (lp
->cmd_head
!= NULL
)
1258 ack_cmd
|= CUC_START
;
1259 dma
->scb
.cmd
= SWAP32(virt_to_dma(lp
, &lp
->cmd_head
->status
));
1260 DMA_WBACK_INV(dev
, &dma
->scb
, sizeof(struct i596_scb
));
1262 if ((status
& 0x1000) || (status
& 0x4000)) {
1263 if ((status
& 0x4000))
1266 "%s: i596 interrupt received a frame.\n",
1269 /* Only RX_START if stopped - RGH 07-07-96 */
1270 if (status
& 0x1000) {
1271 if (netif_running(dev
)) {
1274 "%s: i596 interrupt receive unit inactive, status 0x%x\n",
1275 dev
->name
, status
));
1276 ack_cmd
|= RX_START
;
1277 dev
->stats
.rx_errors
++;
1278 dev
->stats
.rx_fifo_errors
++;
1279 rebuild_rx_bufs(dev
);
1283 wait_cmd(dev
, dma
, 100, "i596 interrupt, timeout");
1284 dma
->scb
.command
= SWAP16(ack_cmd
);
1285 DMA_WBACK(dev
, &dma
->scb
, sizeof(struct i596_scb
));
1287 /* DANGER: I suspect that some kind of interrupt
1288 acknowledgement aside from acking the 82596 might be needed
1289 here... but it's running acceptably without */
1293 wait_cmd(dev
, dma
, 100, "i596 interrupt, exit timeout");
1294 DEB(DEB_INTS
, printk(KERN_DEBUG
"%s: exiting interrupt.\n", dev
->name
));
1296 spin_unlock (&lp
->lock
);
1300 static int i596_close(struct net_device
*dev
)
1302 struct i596_private
*lp
= netdev_priv(dev
);
1303 unsigned long flags
;
1305 netif_stop_queue(dev
);
1309 "%s: Shutting down ethercard, status was %4.4x.\n",
1310 dev
->name
, SWAP16(lp
->dma
->scb
.status
)));
1312 spin_lock_irqsave(&lp
->lock
, flags
);
1314 wait_cmd(dev
, lp
->dma
, 100, "close1 timed out");
1315 lp
->dma
->scb
.command
= SWAP16(CUC_ABORT
| RX_ABORT
);
1316 DMA_WBACK(dev
, &lp
->dma
->scb
, sizeof(struct i596_scb
));
1320 wait_cmd(dev
, lp
->dma
, 100, "close2 timed out");
1321 spin_unlock_irqrestore(&lp
->lock
, flags
);
1322 DEB(DEB_STRUCT
, i596_display_data(dev
));
1323 i596_cleanup_cmd(dev
, lp
);
1325 free_irq(dev
->irq
, dev
);
1326 remove_rx_bufs(dev
);
1332 * Set or clear the multicast filter for this adaptor.
1335 static void set_multicast_list(struct net_device
*dev
)
1337 struct i596_private
*lp
= netdev_priv(dev
);
1338 struct i596_dma
*dma
= lp
->dma
;
1339 int config
= 0, cnt
;
1343 "%s: set multicast list, %d entries, promisc %s, allmulti %s\n",
1344 dev
->name
, netdev_mc_count(dev
),
1345 dev
->flags
& IFF_PROMISC
? "ON" : "OFF",
1346 dev
->flags
& IFF_ALLMULTI
? "ON" : "OFF"));
1348 if ((dev
->flags
& IFF_PROMISC
) &&
1349 !(dma
->cf_cmd
.i596_config
[8] & 0x01)) {
1350 dma
->cf_cmd
.i596_config
[8] |= 0x01;
1353 if (!(dev
->flags
& IFF_PROMISC
) &&
1354 (dma
->cf_cmd
.i596_config
[8] & 0x01)) {
1355 dma
->cf_cmd
.i596_config
[8] &= ~0x01;
1358 if ((dev
->flags
& IFF_ALLMULTI
) &&
1359 (dma
->cf_cmd
.i596_config
[11] & 0x20)) {
1360 dma
->cf_cmd
.i596_config
[11] &= ~0x20;
1363 if (!(dev
->flags
& IFF_ALLMULTI
) &&
1364 !(dma
->cf_cmd
.i596_config
[11] & 0x20)) {
1365 dma
->cf_cmd
.i596_config
[11] |= 0x20;
1369 if (dma
->cf_cmd
.cmd
.command
)
1371 "%s: config change request already queued\n",
1374 dma
->cf_cmd
.cmd
.command
= SWAP16(CmdConfigure
);
1375 DMA_WBACK_INV(dev
, &dma
->cf_cmd
, sizeof(struct cf_cmd
));
1376 i596_add_cmd(dev
, &dma
->cf_cmd
.cmd
);
1380 cnt
= netdev_mc_count(dev
);
1381 if (cnt
> MAX_MC_CNT
) {
1383 printk(KERN_NOTICE
"%s: Only %d multicast addresses supported",
1387 if (!netdev_mc_empty(dev
)) {
1388 struct netdev_hw_addr
*ha
;
1393 cmd
->cmd
.command
= SWAP16(CmdMulticastList
);
1394 cmd
->mc_cnt
= SWAP16(netdev_mc_count(dev
) * 6);
1396 netdev_for_each_mc_addr(ha
, dev
) {
1399 memcpy(cp
, ha
->addr
, ETH_ALEN
);
1403 "%s: Adding address %pM\n",
1407 DMA_WBACK_INV(dev
, &dma
->mc_cmd
, sizeof(struct mc_cmd
));
1408 i596_add_cmd(dev
, &cmd
->cmd
);