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 SET_MODULE_OWNER(dev
);
318 while ((ndev
= nubus_find_type(NUBUS_CAT_NETWORK
, NUBUS_TYPE_ETHERNET
, ndev
))) {
319 /* Have we seen it already? */
320 if (slots
& (1<<ndev
->board
->slot
))
322 slots
|= 1<<ndev
->board
->slot
;
324 if ((cardtype
= mac8390_ident(ndev
)) == MAC8390_NONE
)
327 if (version_disp
== 0) {
332 dev
->irq
= SLOT2IRQ(ndev
->board
->slot
);
333 /* This is getting to be a habit */
334 dev
->base_addr
= ndev
->board
->slot_addr
| ((ndev
->board
->slot
&0xf) << 20);
336 /* Get some Nubus info - we will trust the card's idea
337 of where its memory and registers are. */
339 if (nubus_get_func_dir(ndev
, &dir
) == -1) {
340 printk(KERN_ERR
"%s: Unable to get Nubus functional"
341 " directory for slot %X!\n",
342 dev
->name
, ndev
->board
->slot
);
346 /* Get the MAC address */
347 if ((nubus_find_rsrc(&dir
, NUBUS_RESID_MAC_ADDRESS
, &ent
)) == -1) {
348 printk(KERN_INFO
"%s: Couldn't get MAC address!\n",
352 nubus_get_rsrc_mem(dev
->dev_addr
, &ent
, 6);
355 if (useresources
[cardtype
] == 1) {
356 nubus_rewinddir(&dir
);
357 if (nubus_find_rsrc(&dir
, NUBUS_RESID_MINOR_BASEOS
, &ent
) == -1) {
358 printk(KERN_ERR
"%s: Memory offset resource"
359 " for slot %X not found!\n",
360 dev
->name
, ndev
->board
->slot
);
363 nubus_get_rsrc_mem(&offset
, &ent
, 4);
364 dev
->mem_start
= dev
->base_addr
+ offset
;
365 /* yes, this is how the Apple driver does it */
366 dev
->base_addr
= dev
->mem_start
+ 0x10000;
367 nubus_rewinddir(&dir
);
368 if (nubus_find_rsrc(&dir
, NUBUS_RESID_MINOR_LENGTH
, &ent
) == -1) {
369 printk(KERN_INFO
"%s: Memory length resource"
370 " for slot %X not found"
372 dev
->name
, ndev
->board
->slot
);
373 offset
= mac8390_memsize(dev
->mem_start
);
375 nubus_get_rsrc_mem(&offset
, &ent
, 4);
377 dev
->mem_end
= dev
->mem_start
+ offset
;
380 case MAC8390_KINETICS
:
381 case MAC8390_DAYNA
: /* it's the same */
383 (int)(ndev
->board
->slot_addr
+
386 (int)(ndev
->board
->slot_addr
+
390 mac8390_memsize(dev
->mem_start
);
392 case MAC8390_INTERLAN
:
394 (int)(ndev
->board
->slot_addr
+
397 (int)(ndev
->board
->slot_addr
+
401 mac8390_memsize(dev
->mem_start
);
403 case MAC8390_CABLETRON
:
405 (int)(ndev
->board
->slot_addr
+
406 CABLETRON_8390_BASE
);
408 (int)(ndev
->board
->slot_addr
+
410 /* The base address is unreadable if 0x00
411 * has been written to the command register
412 * Reset the chip by writing E8390_NODMA +
413 * E8390_PAGE0 + E8390_STOP just to be
416 i
= (void *)dev
->base_addr
;
420 mac8390_memsize(dev
->mem_start
);
424 printk(KERN_ERR
"Card type %s is"
425 " unsupported, sorry\n",
431 /* Do the nasty 8390 stuff */
432 if (!mac8390_initdev(dev
, ndev
, cardtype
))
438 err
= register_netdev(dev
);
449 MODULE_AUTHOR("David Huggins-Daines <dhd@debian.org> and others");
450 MODULE_DESCRIPTION("Macintosh NS8390-based Nubus Ethernet driver");
451 MODULE_LICENSE("GPL");
453 /* overkill, of course */
454 static struct net_device
*dev_mac8390
[15];
455 int init_module(void)
458 for (i
= 0; i
< 15; i
++) {
459 struct net_device
*dev
= mac8390_probe(-1);
465 printk(KERN_NOTICE
"mac8390.c: No useable cards found, driver NOT installed.\n");
471 void cleanup_module(void)
474 for (i
= 0; i
< 15; i
++) {
475 struct net_device
*dev
= dev_mac890
[i
];
477 unregister_netdev(dev
);
485 static int __init
mac8390_initdev(struct net_device
* dev
, struct nubus_dev
* ndev
,
486 enum mac8390_type type
)
488 static u32 fwrd4_offsets
[16]={
494 static u32 back4_offsets
[16]={
500 static u32 fwrd2_offsets
[16]={
507 int access_bitmode
= 0;
509 /* Now fill in our stuff */
510 dev
->open
= &mac8390_open
;
511 dev
->stop
= &mac8390_close
;
512 #ifdef CONFIG_NET_POLL_CONTROLLER
513 dev
->poll_controller
= __ei_poll
;
516 /* GAR, ei_status is actually a macro even though it looks global */
517 ei_status
.name
= cardname
[type
];
518 ei_status
.word16
= word16
[type
];
520 /* Cabletron's TX/RX buffers are backwards */
521 if (type
== MAC8390_CABLETRON
) {
522 ei_status
.tx_start_page
= CABLETRON_TX_START_PG
;
523 ei_status
.rx_start_page
= CABLETRON_RX_START_PG
;
524 ei_status
.stop_page
= CABLETRON_RX_STOP_PG
;
525 ei_status
.rmem_start
= dev
->mem_start
;
526 ei_status
.rmem_end
= dev
->mem_start
+ CABLETRON_RX_STOP_PG
*256;
528 ei_status
.tx_start_page
= WD_START_PG
;
529 ei_status
.rx_start_page
= WD_START_PG
+ TX_PAGES
;
530 ei_status
.stop_page
= (dev
->mem_end
- dev
->mem_start
)/256;
531 ei_status
.rmem_start
= dev
->mem_start
+ TX_PAGES
*256;
532 ei_status
.rmem_end
= dev
->mem_end
;
535 /* Fill in model-specific information and functions */
537 case MAC8390_FARALLON
:
539 switch(mac8390_testio(dev
->mem_start
)) {
541 printk("Don't know how to access card memory!\n");
546 /* 16 bit card, register map is reversed */
547 ei_status
.reset_8390
= &mac8390_no_reset
;
548 ei_status
.block_input
= &slow_sane_block_input
;
549 ei_status
.block_output
= &slow_sane_block_output
;
550 ei_status
.get_8390_hdr
= &slow_sane_get_8390_hdr
;
551 ei_status
.reg_offset
= back4_offsets
;
555 /* 32 bit card, register map is reversed */
556 ei_status
.reset_8390
= &mac8390_no_reset
;
557 ei_status
.block_input
= &sane_block_input
;
558 ei_status
.block_output
= &sane_block_output
;
559 ei_status
.get_8390_hdr
= &sane_get_8390_hdr
;
560 ei_status
.reg_offset
= back4_offsets
;
567 /* Some Asante cards pass the 32 bit test
568 * but overwrite system memory when run at 32 bit.
569 * so we run them all at 16 bit.
571 ei_status
.reset_8390
= &mac8390_no_reset
;
572 ei_status
.block_input
= &slow_sane_block_input
;
573 ei_status
.block_output
= &slow_sane_block_output
;
574 ei_status
.get_8390_hdr
= &slow_sane_get_8390_hdr
;
575 ei_status
.reg_offset
= back4_offsets
;
578 case MAC8390_CABLETRON
:
579 /* 16 bit card, register map is short forward */
580 ei_status
.reset_8390
= &mac8390_no_reset
;
581 ei_status
.block_input
= &slow_sane_block_input
;
582 ei_status
.block_output
= &slow_sane_block_output
;
583 ei_status
.get_8390_hdr
= &slow_sane_get_8390_hdr
;
584 ei_status
.reg_offset
= fwrd2_offsets
;
588 case MAC8390_KINETICS
:
589 /* 16 bit memory, register map is forward */
590 /* dayna and similar */
591 ei_status
.reset_8390
= &mac8390_no_reset
;
592 ei_status
.block_input
= &dayna_block_input
;
593 ei_status
.block_output
= &dayna_block_output
;
594 ei_status
.get_8390_hdr
= &dayna_get_8390_hdr
;
595 ei_status
.reg_offset
= fwrd4_offsets
;
598 case MAC8390_INTERLAN
:
599 /* 16 bit memory, register map is forward */
600 ei_status
.reset_8390
= &interlan_reset
;
601 ei_status
.block_input
= &slow_sane_block_input
;
602 ei_status
.block_output
= &slow_sane_block_output
;
603 ei_status
.get_8390_hdr
= &slow_sane_get_8390_hdr
;
604 ei_status
.reg_offset
= fwrd4_offsets
;
608 printk(KERN_ERR
"Card type %s is unsupported, sorry\n", ndev
->board
->name
);
612 __NS8390_init(dev
, 0);
614 /* Good, done, now spit out some messages */
615 printk(KERN_INFO
"%s: %s in slot %X (type %s)\n",
616 dev
->name
, ndev
->board
->name
, ndev
->board
->slot
, cardname
[type
]);
617 printk(KERN_INFO
"MAC ");
620 for (i
= 0; i
< 6; i
++) {
621 printk("%2.2x", dev
->dev_addr
[i
]);
626 printk(" IRQ %d, %d KB shared memory at %#lx, %d-bit access.\n",
627 dev
->irq
, (int)((dev
->mem_end
- dev
->mem_start
)/0x1000) * 4,
628 dev
->mem_start
, access_bitmode
?32:16);
632 static int mac8390_open(struct net_device
*dev
)
635 if (request_irq(dev
->irq
, __ei_interrupt
, 0, "8390 Ethernet", dev
)) {
636 printk ("%s: unable to get IRQ %d.\n", dev
->name
, dev
->irq
);
642 static int mac8390_close(struct net_device
*dev
)
644 free_irq(dev
->irq
, dev
);
649 static void mac8390_no_reset(struct net_device
*dev
)
653 printk("reset not supported\n");
657 static void interlan_reset(struct net_device
*dev
)
659 unsigned char *target
=nubus_slot_addr(IRQ2SLOT(dev
->irq
));
661 printk("Need to reset the NS8390 t=%lu...", jiffies
);
665 printk("reset complete\n");
669 /* dayna_memcpy_fromio/dayna_memcpy_toio */
670 /* directly from daynaport.c by Alan Cox */
671 static void dayna_memcpy_fromcard(struct net_device
*dev
, void *to
, int from
, int count
)
673 volatile unsigned char *ptr
;
674 unsigned char *target
=to
;
675 from
<<=1; /* word, skip overhead */
676 ptr
=(unsigned char *)(dev
->mem_start
+from
);
685 *(unsigned short *)target
= *(unsigned short volatile *)ptr
;
686 ptr
+= 4; /* skip cruft */
695 static void dayna_memcpy_tocard(struct net_device
*dev
, int to
, const void *from
, int count
)
697 volatile unsigned short *ptr
;
698 const unsigned char *src
=from
;
699 to
<<=1; /* word, skip overhead */
700 ptr
=(unsigned short *)(dev
->mem_start
+to
);
702 if (to
&2) { /* avoid a byte write (stomps on other data) */
703 ptr
[-1] = (ptr
[-1]&0xFF00)|*src
++;
709 *ptr
++=*(unsigned short *)src
; /* Copy and */
710 ptr
++; /* skip cruft */
717 /* card doesn't like byte writes */
718 *ptr
=(*ptr
&0x00FF)|(*src
<< 8);
722 /* sane block input/output */
723 static void sane_get_8390_hdr(struct net_device
*dev
,
724 struct e8390_pkt_hdr
*hdr
, int ring_page
)
726 unsigned long hdr_start
= (ring_page
- WD_START_PG
)<<8;
727 memcpy_fromio((void *)hdr
, (char *)dev
->mem_start
+ hdr_start
, 4);
729 hdr
->count
= swab16(hdr
->count
);
732 static void sane_block_input(struct net_device
*dev
, int count
,
733 struct sk_buff
*skb
, int ring_offset
)
735 unsigned long xfer_base
= ring_offset
- (WD_START_PG
<<8);
736 unsigned long xfer_start
= xfer_base
+ dev
->mem_start
;
738 if (xfer_start
+ count
> ei_status
.rmem_end
) {
739 /* We must wrap the input move. */
740 int semi_count
= ei_status
.rmem_end
- xfer_start
;
741 memcpy_fromio(skb
->data
, (char *)dev
->mem_start
+ xfer_base
, semi_count
);
743 memcpy_toio(skb
->data
+ semi_count
, (char *)ei_status
.rmem_start
, count
);
745 memcpy_fromio(skb
->data
, (char *)dev
->mem_start
+ xfer_base
, count
);
749 static void sane_block_output(struct net_device
*dev
, int count
,
750 const unsigned char *buf
, int start_page
)
752 long shmem
= (start_page
- WD_START_PG
)<<8;
754 memcpy_toio((char *)dev
->mem_start
+ shmem
, buf
, count
);
757 /* dayna block input/output */
758 static void dayna_get_8390_hdr(struct net_device
*dev
, struct e8390_pkt_hdr
*hdr
, int ring_page
)
760 unsigned long hdr_start
= (ring_page
- WD_START_PG
)<<8;
762 dayna_memcpy_fromcard(dev
, (void *)hdr
, hdr_start
, 4);
764 hdr
->count
=(hdr
->count
&0xFF)<<8|(hdr
->count
>>8);
767 static void dayna_block_input(struct net_device
*dev
, int count
, struct sk_buff
*skb
, int ring_offset
)
769 unsigned long xfer_base
= ring_offset
- (WD_START_PG
<<8);
770 unsigned long xfer_start
= xfer_base
+dev
->mem_start
;
772 /* Note the offset math is done in card memory space which is word
773 per long onto our space. */
775 if (xfer_start
+ count
> ei_status
.rmem_end
)
777 /* We must wrap the input move. */
778 int semi_count
= ei_status
.rmem_end
- xfer_start
;
779 dayna_memcpy_fromcard(dev
, skb
->data
, xfer_base
, semi_count
);
781 dayna_memcpy_fromcard(dev
, skb
->data
+ semi_count
,
782 ei_status
.rmem_start
- dev
->mem_start
,
787 dayna_memcpy_fromcard(dev
, skb
->data
, xfer_base
, count
);
791 static void dayna_block_output(struct net_device
*dev
, int count
, const unsigned char *buf
,
794 long shmem
= (start_page
- WD_START_PG
)<<8;
796 dayna_memcpy_tocard(dev
, shmem
, buf
, count
);
799 /* Cabletron block I/O */
800 static void slow_sane_get_8390_hdr(struct net_device
*dev
, struct e8390_pkt_hdr
*hdr
,
803 unsigned long hdr_start
= (ring_page
- WD_START_PG
)<<8;
804 word_memcpy_fromcard((void *)hdr
, (char *)dev
->mem_start
+hdr_start
, 4);
805 /* Register endianism - fix here rather than 8390.c */
806 hdr
->count
= (hdr
->count
&0xFF)<<8|(hdr
->count
>>8);
809 static void slow_sane_block_input(struct net_device
*dev
, int count
, struct sk_buff
*skb
,
812 unsigned long xfer_base
= ring_offset
- (WD_START_PG
<<8);
813 unsigned long xfer_start
= xfer_base
+dev
->mem_start
;
815 if (xfer_start
+ count
> ei_status
.rmem_end
)
817 /* We must wrap the input move. */
818 int semi_count
= ei_status
.rmem_end
- xfer_start
;
819 word_memcpy_fromcard(skb
->data
, (char *)dev
->mem_start
+
820 xfer_base
, semi_count
);
822 word_memcpy_fromcard(skb
->data
+ semi_count
,
823 (char *)ei_status
.rmem_start
, count
);
827 word_memcpy_fromcard(skb
->data
, (char *)dev
->mem_start
+
832 static void slow_sane_block_output(struct net_device
*dev
, int count
, const unsigned char *buf
,
835 long shmem
= (start_page
- WD_START_PG
)<<8;
837 word_memcpy_tocard((char *)dev
->mem_start
+ shmem
, buf
, count
);
840 static void word_memcpy_tocard(void *tp
, const void *fp
, int count
)
842 volatile unsigned short *to
= tp
;
843 const unsigned short *from
= fp
;
852 static void word_memcpy_fromcard(void *tp
, const void *fp
, int count
)
854 unsigned short *to
= tp
;
855 const volatile unsigned short *from
= fp
;