1 /* mac8390.c: New driver for 8390-based Nubus (or Nubus-alike)
2 Ethernet cards on Linux */
3 /* Based on the former daynaport.c driver, by Alan Cox. Some code
4 taken from or inspired by skeleton.c by Donald Becker, acenic.c by
5 Jes Sorensen, and ne2k-pci.c by Donald Becker and Paul Gortmaker.
7 This software may be used and distributed according to the terms of
8 the GNU Public License, incorporated herein by reference. */
10 /* 2000-02-28: support added for Dayna and Kinetics cards by
11 A.G.deWijn@phys.uu.nl */
12 /* 2000-04-04: support added for Dayna2 by bart@etpmod.phys.tue.nl */
13 /* 2001-04-18: support for DaynaPort E/LC-M by rayk@knightsmanor.org */
14 /* 2001-05-15: support for Cabletron ported from old daynaport driver
15 * and fixed access to Sonic Sys card which masquerades as a Farallon
16 * by rayk@knightsmanor.org */
17 /* 2002-12-30: Try to support more cards, some clues from NetBSD driver */
18 /* 2003-12-26: Make sure Asante cards always work. */
20 #include <linux/module.h>
21 #include <linux/kernel.h>
22 #include <linux/types.h>
23 #include <linux/fcntl.h>
24 #include <linux/interrupt.h>
25 #include <linux/ptrace.h>
26 #include <linux/ioport.h>
27 #include <linux/nubus.h>
29 #include <linux/slab.h>
30 #include <linux/string.h>
31 #include <linux/errno.h>
32 #include <linux/init.h>
33 #include <linux/netdevice.h>
34 #include <linux/etherdevice.h>
35 #include <linux/skbuff.h>
36 #include <linux/bitops.h>
38 #include <asm/system.h>
41 #include <asm/hwtest.h>
42 #include <asm/macints.h>
44 static char version
[] =
45 "mac8390.c: v0.4 2001-05-15 David Huggins-Daines <dhd@debian.org> and others\n";
47 #define EI_SHIFT(x) (ei_local->reg_offset[x])
48 #define ei_inb(port) in_8(port)
49 #define ei_outb(val,port) out_8(port,val)
50 #define ei_inb_p(port) in_8(port)
51 #define ei_outb_p(val,port) out_8(port,val)
55 #define WD_START_PG 0x00 /* First page of TX buffer */
56 #define CABLETRON_RX_START_PG 0x00 /* First page of RX buffer */
57 #define CABLETRON_RX_STOP_PG 0x30 /* Last page +1 of RX ring */
58 #define CABLETRON_TX_START_PG CABLETRON_RX_STOP_PG /* First page of TX buffer */
60 /* Unfortunately it seems we have to hardcode these for the moment */
61 /* Shouldn't the card know about this? Does anyone know where to read it off the card? Do we trust the data provided by the card? */
63 #define DAYNA_8390_BASE 0x80000
64 #define DAYNA_8390_MEM 0x00000
66 #define CABLETRON_8390_BASE 0x90000
67 #define CABLETRON_8390_MEM 0x00000
69 #define INTERLAN_8390_BASE 0xE0000
70 #define INTERLAN_8390_MEM 0xD0000
83 static const char * cardname
[] = {
93 static int word16
[] = {
103 /* on which cards do we use NuBus resources? */
104 static int useresources
[] = {
114 enum mac8390_access
{
120 extern enum mac8390_type
mac8390_ident(struct nubus_dev
* dev
);
121 extern int mac8390_memsize(unsigned long membase
);
122 extern int mac8390_memtest(struct net_device
* dev
);
123 static int mac8390_initdev(struct net_device
* dev
, struct nubus_dev
* ndev
,
124 enum mac8390_type type
);
126 static int mac8390_open(struct net_device
* dev
);
127 static int mac8390_close(struct net_device
* dev
);
128 static void mac8390_no_reset(struct net_device
*dev
);
129 static void interlan_reset(struct net_device
*dev
);
131 /* Sane (32-bit chunk memory read/write) - Some Farallon and Apple do this*/
132 static void sane_get_8390_hdr(struct net_device
*dev
,
133 struct e8390_pkt_hdr
*hdr
, int ring_page
);
134 static void sane_block_input(struct net_device
* dev
, int count
,
135 struct sk_buff
* skb
, int ring_offset
);
136 static void sane_block_output(struct net_device
* dev
, int count
,
137 const unsigned char * buf
, const int start_page
);
139 /* dayna_memcpy to and from card */
140 static void dayna_memcpy_fromcard(struct net_device
*dev
, void *to
,
141 int from
, int count
);
142 static void dayna_memcpy_tocard(struct net_device
*dev
, int to
,
143 const void *from
, int count
);
145 /* Dayna - Dayna/Kinetics use this */
146 static void dayna_get_8390_hdr(struct net_device
*dev
,
147 struct e8390_pkt_hdr
*hdr
, int ring_page
);
148 static void dayna_block_input(struct net_device
*dev
, int count
,
149 struct sk_buff
*skb
, int ring_offset
);
150 static void dayna_block_output(struct net_device
*dev
, int count
,
151 const unsigned char *buf
, int start_page
);
153 #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
154 #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
156 /* Slow Sane (16-bit chunk memory read/write) Cabletron uses this */
157 static void slow_sane_get_8390_hdr(struct net_device
*dev
,
158 struct e8390_pkt_hdr
*hdr
, int ring_page
);
159 static void slow_sane_block_input(struct net_device
*dev
, int count
,
160 struct sk_buff
*skb
, int ring_offset
);
161 static void slow_sane_block_output(struct net_device
*dev
, int count
,
162 const unsigned char *buf
, int start_page
);
163 static void word_memcpy_tocard(void *tp
, const void *fp
, int count
);
164 static void word_memcpy_fromcard(void *tp
, const void *fp
, int count
);
166 enum mac8390_type __init
mac8390_ident(struct nubus_dev
* dev
)
168 switch (dev
->dr_sw
) {
169 case NUBUS_DRSW_3COM
:
170 switch (dev
->dr_hw
) {
171 case NUBUS_DRHW_APPLE_SONIC_NB
:
172 case NUBUS_DRHW_APPLE_SONIC_LC
:
173 case NUBUS_DRHW_SONNET
:
177 return MAC8390_APPLE
;
182 case NUBUS_DRSW_APPLE
:
183 switch (dev
->dr_hw
) {
184 case NUBUS_DRHW_ASANTE_LC
:
187 case NUBUS_DRHW_CABLETRON
:
188 return MAC8390_CABLETRON
;
191 return MAC8390_APPLE
;
196 case NUBUS_DRSW_ASANTE
:
197 return MAC8390_ASANTE
;
200 case NUBUS_DRSW_TECHWORKS
:
201 case NUBUS_DRSW_DAYNA2
:
202 case NUBUS_DRSW_DAYNA_LC
:
203 if (dev
->dr_hw
== NUBUS_DRHW_CABLETRON
)
204 return MAC8390_CABLETRON
;
206 return MAC8390_APPLE
;
209 case NUBUS_DRSW_FARALLON
:
210 return MAC8390_FARALLON
;
213 case NUBUS_DRSW_KINETICS
:
214 switch (dev
->dr_hw
) {
215 case NUBUS_DRHW_INTERLAN
:
216 return MAC8390_INTERLAN
;
219 return MAC8390_KINETICS
;
224 case NUBUS_DRSW_DAYNA
:
225 // These correspond to Dayna Sonic cards
226 // which use the macsonic driver
227 if (dev
->dr_hw
== NUBUS_DRHW_SMC9194
||
228 dev
->dr_hw
== NUBUS_DRHW_INTERLAN
)
231 return MAC8390_DAYNA
;
237 enum mac8390_access __init
mac8390_testio(volatile unsigned long membase
)
239 unsigned long outdata
= 0xA5A0B5B0;
240 unsigned long indata
= 0x00000000;
241 /* Try writing 32 bits */
242 memcpy((char *)membase
, (char *)&outdata
, 4);
243 /* Now compare them */
244 if (memcmp((char *)&outdata
, (char *)membase
, 4) == 0)
246 /* Write 16 bit output */
247 word_memcpy_tocard((char *)membase
, (char *)&outdata
, 4);
248 /* Now read it back */
249 word_memcpy_fromcard((char *)&indata
, (char *)membase
, 4);
250 if (outdata
== indata
)
252 return ACCESS_UNKNOWN
;
255 int __init
mac8390_memsize(unsigned long membase
)
260 local_irq_save(flags
);
261 /* Check up to 32K in 4K increments */
262 for (i
= 0; i
< 8; i
++) {
263 volatile unsigned short *m
= (unsigned short *) (membase
+ (i
* 0x1000));
265 /* Unwriteable - we have a fully decoded card and the
267 if (hwreg_present(m
) == 0)
270 /* write a distinctive byte */
272 /* check that we read back what we wrote */
273 if (*m
!= (0xA5A0 | i
))
276 /* check for partial decode and wrap */
277 for (j
= 0; j
< i
; j
++) {
278 volatile unsigned short *p
= (unsigned short *) (membase
+ (j
* 0x1000));
279 if (*p
!= (0xA5A0 | j
))
283 local_irq_restore(flags
);
284 /* in any case, we stopped once we tried one block too many,
285 or once we reached 32K */
289 struct net_device
* __init
mac8390_probe(int unit
)
291 struct net_device
*dev
;
292 volatile unsigned short *i
;
293 int version_disp
= 0;
294 struct nubus_dev
* ndev
= NULL
;
297 struct nubus_dir dir
;
298 struct nubus_dirent ent
;
300 static unsigned int slots
;
302 enum mac8390_type cardtype
;
304 /* probably should check for Nubus instead */
307 return ERR_PTR(-ENODEV
);
309 dev
= ____alloc_ei_netdev(0);
311 return ERR_PTR(-ENOMEM
);
314 sprintf(dev
->name
, "eth%d", unit
);
316 while ((ndev
= nubus_find_type(NUBUS_CAT_NETWORK
, NUBUS_TYPE_ETHERNET
, ndev
))) {
317 /* Have we seen it already? */
318 if (slots
& (1<<ndev
->board
->slot
))
320 slots
|= 1<<ndev
->board
->slot
;
322 if ((cardtype
= mac8390_ident(ndev
)) == MAC8390_NONE
)
325 if (version_disp
== 0) {
330 dev
->irq
= SLOT2IRQ(ndev
->board
->slot
);
331 /* This is getting to be a habit */
332 dev
->base_addr
= ndev
->board
->slot_addr
| ((ndev
->board
->slot
&0xf) << 20);
334 /* Get some Nubus info - we will trust the card's idea
335 of where its memory and registers are. */
337 if (nubus_get_func_dir(ndev
, &dir
) == -1) {
338 printk(KERN_ERR
"%s: Unable to get Nubus functional"
339 " directory for slot %X!\n",
340 dev
->name
, ndev
->board
->slot
);
344 /* Get the MAC address */
345 if ((nubus_find_rsrc(&dir
, NUBUS_RESID_MAC_ADDRESS
, &ent
)) == -1) {
346 printk(KERN_INFO
"%s: Couldn't get MAC address!\n",
350 nubus_get_rsrc_mem(dev
->dev_addr
, &ent
, 6);
353 if (useresources
[cardtype
] == 1) {
354 nubus_rewinddir(&dir
);
355 if (nubus_find_rsrc(&dir
, NUBUS_RESID_MINOR_BASEOS
, &ent
) == -1) {
356 printk(KERN_ERR
"%s: Memory offset resource"
357 " for slot %X not found!\n",
358 dev
->name
, ndev
->board
->slot
);
361 nubus_get_rsrc_mem(&offset
, &ent
, 4);
362 dev
->mem_start
= dev
->base_addr
+ offset
;
363 /* yes, this is how the Apple driver does it */
364 dev
->base_addr
= dev
->mem_start
+ 0x10000;
365 nubus_rewinddir(&dir
);
366 if (nubus_find_rsrc(&dir
, NUBUS_RESID_MINOR_LENGTH
, &ent
) == -1) {
367 printk(KERN_INFO
"%s: Memory length resource"
368 " for slot %X not found"
370 dev
->name
, ndev
->board
->slot
);
371 offset
= mac8390_memsize(dev
->mem_start
);
373 nubus_get_rsrc_mem(&offset
, &ent
, 4);
375 dev
->mem_end
= dev
->mem_start
+ offset
;
378 case MAC8390_KINETICS
:
379 case MAC8390_DAYNA
: /* it's the same */
381 (int)(ndev
->board
->slot_addr
+
384 (int)(ndev
->board
->slot_addr
+
388 mac8390_memsize(dev
->mem_start
);
390 case MAC8390_INTERLAN
:
392 (int)(ndev
->board
->slot_addr
+
395 (int)(ndev
->board
->slot_addr
+
399 mac8390_memsize(dev
->mem_start
);
401 case MAC8390_CABLETRON
:
403 (int)(ndev
->board
->slot_addr
+
404 CABLETRON_8390_BASE
);
406 (int)(ndev
->board
->slot_addr
+
408 /* The base address is unreadable if 0x00
409 * has been written to the command register
410 * Reset the chip by writing E8390_NODMA +
411 * E8390_PAGE0 + E8390_STOP just to be
414 i
= (void *)dev
->base_addr
;
418 mac8390_memsize(dev
->mem_start
);
422 printk(KERN_ERR
"Card type %s is"
423 " unsupported, sorry\n",
429 /* Do the nasty 8390 stuff */
430 if (!mac8390_initdev(dev
, ndev
, cardtype
))
436 err
= register_netdev(dev
);
447 MODULE_AUTHOR("David Huggins-Daines <dhd@debian.org> and others");
448 MODULE_DESCRIPTION("Macintosh NS8390-based Nubus Ethernet driver");
449 MODULE_LICENSE("GPL");
451 /* overkill, of course */
452 static struct net_device
*dev_mac8390
[15];
453 int init_module(void)
456 for (i
= 0; i
< 15; i
++) {
457 struct net_device
*dev
= mac8390_probe(-1);
463 printk(KERN_NOTICE
"mac8390.c: No useable cards found, driver NOT installed.\n");
469 void cleanup_module(void)
472 for (i
= 0; i
< 15; i
++) {
473 struct net_device
*dev
= dev_mac890
[i
];
475 unregister_netdev(dev
);
483 static int __init
mac8390_initdev(struct net_device
* dev
, struct nubus_dev
* ndev
,
484 enum mac8390_type type
)
486 static u32 fwrd4_offsets
[16]={
492 static u32 back4_offsets
[16]={
498 static u32 fwrd2_offsets
[16]={
505 int access_bitmode
= 0;
507 /* Now fill in our stuff */
508 dev
->open
= &mac8390_open
;
509 dev
->stop
= &mac8390_close
;
510 #ifdef CONFIG_NET_POLL_CONTROLLER
511 dev
->poll_controller
= __ei_poll
;
514 /* GAR, ei_status is actually a macro even though it looks global */
515 ei_status
.name
= cardname
[type
];
516 ei_status
.word16
= word16
[type
];
518 /* Cabletron's TX/RX buffers are backwards */
519 if (type
== MAC8390_CABLETRON
) {
520 ei_status
.tx_start_page
= CABLETRON_TX_START_PG
;
521 ei_status
.rx_start_page
= CABLETRON_RX_START_PG
;
522 ei_status
.stop_page
= CABLETRON_RX_STOP_PG
;
523 ei_status
.rmem_start
= dev
->mem_start
;
524 ei_status
.rmem_end
= dev
->mem_start
+ CABLETRON_RX_STOP_PG
*256;
526 ei_status
.tx_start_page
= WD_START_PG
;
527 ei_status
.rx_start_page
= WD_START_PG
+ TX_PAGES
;
528 ei_status
.stop_page
= (dev
->mem_end
- dev
->mem_start
)/256;
529 ei_status
.rmem_start
= dev
->mem_start
+ TX_PAGES
*256;
530 ei_status
.rmem_end
= dev
->mem_end
;
533 /* Fill in model-specific information and functions */
535 case MAC8390_FARALLON
:
537 switch(mac8390_testio(dev
->mem_start
)) {
539 printk("Don't know how to access card memory!\n");
544 /* 16 bit card, register map is reversed */
545 ei_status
.reset_8390
= &mac8390_no_reset
;
546 ei_status
.block_input
= &slow_sane_block_input
;
547 ei_status
.block_output
= &slow_sane_block_output
;
548 ei_status
.get_8390_hdr
= &slow_sane_get_8390_hdr
;
549 ei_status
.reg_offset
= back4_offsets
;
553 /* 32 bit card, register map is reversed */
554 ei_status
.reset_8390
= &mac8390_no_reset
;
555 ei_status
.block_input
= &sane_block_input
;
556 ei_status
.block_output
= &sane_block_output
;
557 ei_status
.get_8390_hdr
= &sane_get_8390_hdr
;
558 ei_status
.reg_offset
= back4_offsets
;
565 /* Some Asante cards pass the 32 bit test
566 * but overwrite system memory when run at 32 bit.
567 * so we run them all at 16 bit.
569 ei_status
.reset_8390
= &mac8390_no_reset
;
570 ei_status
.block_input
= &slow_sane_block_input
;
571 ei_status
.block_output
= &slow_sane_block_output
;
572 ei_status
.get_8390_hdr
= &slow_sane_get_8390_hdr
;
573 ei_status
.reg_offset
= back4_offsets
;
576 case MAC8390_CABLETRON
:
577 /* 16 bit card, register map is short forward */
578 ei_status
.reset_8390
= &mac8390_no_reset
;
579 ei_status
.block_input
= &slow_sane_block_input
;
580 ei_status
.block_output
= &slow_sane_block_output
;
581 ei_status
.get_8390_hdr
= &slow_sane_get_8390_hdr
;
582 ei_status
.reg_offset
= fwrd2_offsets
;
586 case MAC8390_KINETICS
:
587 /* 16 bit memory, register map is forward */
588 /* dayna and similar */
589 ei_status
.reset_8390
= &mac8390_no_reset
;
590 ei_status
.block_input
= &dayna_block_input
;
591 ei_status
.block_output
= &dayna_block_output
;
592 ei_status
.get_8390_hdr
= &dayna_get_8390_hdr
;
593 ei_status
.reg_offset
= fwrd4_offsets
;
596 case MAC8390_INTERLAN
:
597 /* 16 bit memory, register map is forward */
598 ei_status
.reset_8390
= &interlan_reset
;
599 ei_status
.block_input
= &slow_sane_block_input
;
600 ei_status
.block_output
= &slow_sane_block_output
;
601 ei_status
.get_8390_hdr
= &slow_sane_get_8390_hdr
;
602 ei_status
.reg_offset
= fwrd4_offsets
;
606 printk(KERN_ERR
"Card type %s is unsupported, sorry\n", ndev
->board
->name
);
610 __NS8390_init(dev
, 0);
612 /* Good, done, now spit out some messages */
613 printk(KERN_INFO
"%s: %s in slot %X (type %s)\n",
614 dev
->name
, ndev
->board
->name
, ndev
->board
->slot
, cardname
[type
]);
615 printk(KERN_INFO
"MAC ");
618 for (i
= 0; i
< 6; i
++) {
619 printk("%2.2x", dev
->dev_addr
[i
]);
624 printk(" IRQ %d, %d KB shared memory at %#lx, %d-bit access.\n",
625 dev
->irq
, (int)((dev
->mem_end
- dev
->mem_start
)/0x1000) * 4,
626 dev
->mem_start
, access_bitmode
?32:16);
630 static int mac8390_open(struct net_device
*dev
)
633 if (request_irq(dev
->irq
, __ei_interrupt
, 0, "8390 Ethernet", dev
)) {
634 printk ("%s: unable to get IRQ %d.\n", dev
->name
, dev
->irq
);
640 static int mac8390_close(struct net_device
*dev
)
642 free_irq(dev
->irq
, dev
);
647 static void mac8390_no_reset(struct net_device
*dev
)
651 printk("reset not supported\n");
655 static void interlan_reset(struct net_device
*dev
)
657 unsigned char *target
=nubus_slot_addr(IRQ2SLOT(dev
->irq
));
659 printk("Need to reset the NS8390 t=%lu...", jiffies
);
663 printk("reset complete\n");
667 /* dayna_memcpy_fromio/dayna_memcpy_toio */
668 /* directly from daynaport.c by Alan Cox */
669 static void dayna_memcpy_fromcard(struct net_device
*dev
, void *to
, int from
, int count
)
671 volatile unsigned char *ptr
;
672 unsigned char *target
=to
;
673 from
<<=1; /* word, skip overhead */
674 ptr
=(unsigned char *)(dev
->mem_start
+from
);
683 *(unsigned short *)target
= *(unsigned short volatile *)ptr
;
684 ptr
+= 4; /* skip cruft */
693 static void dayna_memcpy_tocard(struct net_device
*dev
, int to
, const void *from
, int count
)
695 volatile unsigned short *ptr
;
696 const unsigned char *src
=from
;
697 to
<<=1; /* word, skip overhead */
698 ptr
=(unsigned short *)(dev
->mem_start
+to
);
700 if (to
&2) { /* avoid a byte write (stomps on other data) */
701 ptr
[-1] = (ptr
[-1]&0xFF00)|*src
++;
707 *ptr
++=*(unsigned short *)src
; /* Copy and */
708 ptr
++; /* skip cruft */
715 /* card doesn't like byte writes */
716 *ptr
=(*ptr
&0x00FF)|(*src
<< 8);
720 /* sane block input/output */
721 static void sane_get_8390_hdr(struct net_device
*dev
,
722 struct e8390_pkt_hdr
*hdr
, int ring_page
)
724 unsigned long hdr_start
= (ring_page
- WD_START_PG
)<<8;
725 memcpy_fromio((void *)hdr
, (char *)dev
->mem_start
+ hdr_start
, 4);
727 hdr
->count
= swab16(hdr
->count
);
730 static void sane_block_input(struct net_device
*dev
, int count
,
731 struct sk_buff
*skb
, int ring_offset
)
733 unsigned long xfer_base
= ring_offset
- (WD_START_PG
<<8);
734 unsigned long xfer_start
= xfer_base
+ dev
->mem_start
;
736 if (xfer_start
+ count
> ei_status
.rmem_end
) {
737 /* We must wrap the input move. */
738 int semi_count
= ei_status
.rmem_end
- xfer_start
;
739 memcpy_fromio(skb
->data
, (char *)dev
->mem_start
+ xfer_base
, semi_count
);
741 memcpy_toio(skb
->data
+ semi_count
, (char *)ei_status
.rmem_start
, count
);
743 memcpy_fromio(skb
->data
, (char *)dev
->mem_start
+ xfer_base
, count
);
747 static void sane_block_output(struct net_device
*dev
, int count
,
748 const unsigned char *buf
, int start_page
)
750 long shmem
= (start_page
- WD_START_PG
)<<8;
752 memcpy_toio((char *)dev
->mem_start
+ shmem
, buf
, count
);
755 /* dayna block input/output */
756 static void dayna_get_8390_hdr(struct net_device
*dev
, struct e8390_pkt_hdr
*hdr
, int ring_page
)
758 unsigned long hdr_start
= (ring_page
- WD_START_PG
)<<8;
760 dayna_memcpy_fromcard(dev
, (void *)hdr
, hdr_start
, 4);
762 hdr
->count
=(hdr
->count
&0xFF)<<8|(hdr
->count
>>8);
765 static void dayna_block_input(struct net_device
*dev
, int count
, struct sk_buff
*skb
, int ring_offset
)
767 unsigned long xfer_base
= ring_offset
- (WD_START_PG
<<8);
768 unsigned long xfer_start
= xfer_base
+dev
->mem_start
;
770 /* Note the offset math is done in card memory space which is word
771 per long onto our space. */
773 if (xfer_start
+ count
> ei_status
.rmem_end
)
775 /* We must wrap the input move. */
776 int semi_count
= ei_status
.rmem_end
- xfer_start
;
777 dayna_memcpy_fromcard(dev
, skb
->data
, xfer_base
, semi_count
);
779 dayna_memcpy_fromcard(dev
, skb
->data
+ semi_count
,
780 ei_status
.rmem_start
- dev
->mem_start
,
785 dayna_memcpy_fromcard(dev
, skb
->data
, xfer_base
, count
);
789 static void dayna_block_output(struct net_device
*dev
, int count
, const unsigned char *buf
,
792 long shmem
= (start_page
- WD_START_PG
)<<8;
794 dayna_memcpy_tocard(dev
, shmem
, buf
, count
);
797 /* Cabletron block I/O */
798 static void slow_sane_get_8390_hdr(struct net_device
*dev
, struct e8390_pkt_hdr
*hdr
,
801 unsigned long hdr_start
= (ring_page
- WD_START_PG
)<<8;
802 word_memcpy_fromcard((void *)hdr
, (char *)dev
->mem_start
+hdr_start
, 4);
803 /* Register endianism - fix here rather than 8390.c */
804 hdr
->count
= (hdr
->count
&0xFF)<<8|(hdr
->count
>>8);
807 static void slow_sane_block_input(struct net_device
*dev
, int count
, struct sk_buff
*skb
,
810 unsigned long xfer_base
= ring_offset
- (WD_START_PG
<<8);
811 unsigned long xfer_start
= xfer_base
+dev
->mem_start
;
813 if (xfer_start
+ count
> ei_status
.rmem_end
)
815 /* We must wrap the input move. */
816 int semi_count
= ei_status
.rmem_end
- xfer_start
;
817 word_memcpy_fromcard(skb
->data
, (char *)dev
->mem_start
+
818 xfer_base
, semi_count
);
820 word_memcpy_fromcard(skb
->data
+ semi_count
,
821 (char *)ei_status
.rmem_start
, count
);
825 word_memcpy_fromcard(skb
->data
, (char *)dev
->mem_start
+
830 static void slow_sane_block_output(struct net_device
*dev
, int count
, const unsigned char *buf
,
833 long shmem
= (start_page
- WD_START_PG
)<<8;
835 word_memcpy_tocard((char *)dev
->mem_start
+ shmem
, buf
, count
);
838 static void word_memcpy_tocard(void *tp
, const void *fp
, int count
)
840 volatile unsigned short *to
= tp
;
841 const unsigned short *from
= fp
;
850 static void word_memcpy_fromcard(void *tp
, const void *fp
, int count
)
852 unsigned short *to
= tp
;
853 const volatile unsigned short *from
= fp
;