46 static const char *
version =
"smc-ultra32.c: 06/97 v1.00\n";
49 #include <linux/module.h>
51 #include <linux/kernel.h>
52 #include <linux/errno.h>
53 #include <linux/string.h>
56 #include <linux/netdevice.h>
63 #define DRV_NAME "smc-ultra32"
65 static int ultra32_probe1(
struct net_device *
dev,
int ioaddr);
73 const unsigned char *
buf,
74 const int start_page);
77 #define ULTRA32_CMDREG 0
78 #define ULTRA32_RESET 0x80
79 #define ULTRA32_MEMENB 0x40
80 #define ULTRA32_NIC_OFFSET 16
81 #define ULTRA32_IO_EXTENT 32
82 #define EN0_ERWCNT 0x08
89 #define ULTRA32_BASE 0xca0
90 #define ULTRA32_ID 0x1080a34d
91 #define ULTRA32_IDPORT (-0x20)
93 #define ULTRA32_CFG1 0x04
94 #define ULTRA32_CFG2 0x05
95 #define ULTRA32_CFG3 (-0x18)
96 #define ULTRA32_CFG4 (-0x17)
97 #define ULTRA32_CFG5 (-0x16)
98 #define ULTRA32_CFG6 (-0x15)
99 #define ULTRA32_CFG7 0x0d
124 dev = alloc_ei_netdev();
137 for (base = 0x1000 +
ULTRA32_BASE; base < 0x9000; base += 0x1000) {
138 if (ultra32_probe1(dev, base) == 0)
157 .ndo_open = ultra32_open,
158 .ndo_stop = ultra32_close,
166 #ifdef CONFIG_NET_POLL_CONTROLLER
167 .ndo_poll_controller = ei_poll,
175 const char *model_name;
176 static unsigned version_printed;
180 const char *
ifmap[] = {
"UTP No Link",
"",
"UTP/AUI",
"UTP/BNC"};
193 printk(
"SMC Ultra32 in EISA Slot %d, Media: %s, %s IRQs.\n",
194 ioaddr >> 12, ifmap[media],
195 (edge ?
"Edge Triggered" :
"Level Sensitive"));
197 idreg =
inb(ioaddr + 7);
198 reg4 =
inb(ioaddr + 4) & 0x7f;
201 if ((idreg & 0xf0) != 0x20) {
207 outb(reg4, ioaddr + 4);
209 for (i = 0; i < 8; i++)
210 checksum +=
inb(ioaddr + 8 + i);
211 if ((checksum & 0xff) != 0xff) {
216 if (
ei_debug && version_printed++ == 0)
219 model_name =
"SMC Ultra32";
221 for (i = 0; i < 6; i++)
224 printk(
"%s: %s at 0x%X, %pM",
229 outb(0x80 | reg4, ioaddr + 4);
232 outb(0x80 |
inb(ioaddr + 0x0c), ioaddr + 0x0c);
235 outb(0x00, ioaddr + 0x0b);
239 outb(reg4, ioaddr + 4);
242 printk(
"\nsmc-ultra32: Card RAM is disabled! "
243 "Run EISA config utility.\n");
248 printk(
"\nsmc-ultra32: Ignoring Bus-Master enable bit. "
249 "Run EISA config utility.\n");
252 unsigned char irqmap[] = {0, 9, 3, 5, 7, 10, 11, 15};
255 printk(
", failed to detect IRQ line.\n");
279 printk(
", failed to ioremap.\n");
285 printk(
", IRQ %d, 32KB memory, 8KB window at 0x%lx-0x%lx.\n",
287 ei_status.block_input = &ultra32_block_input;
288 ei_status.block_output = &ultra32_block_output;
289 ei_status.get_8390_hdr = &ultra32_get_8390_hdr;
290 ei_status.reset_8390 = &ultra32_reset_8390;
301 static int ultra32_open(
struct net_device *dev)
313 outb(0x84, ioaddr + 5);
314 outb(0x01, ioaddr + 6);
323 static int ultra32_close(
struct net_device *dev)
327 netif_stop_queue(dev);
330 printk(
"%s: Shutting down ethercard.\n", dev->
name);
333 outb(0x00, ioaddr + 6);
341 static void ultra32_reset_8390(
struct net_device *dev)
351 outb(0x84, ioaddr + 5);
352 outb(0x01, ioaddr + 6);
360 static void ultra32_get_8390_hdr(
struct net_device *dev,
376 ((
unsigned int*)hdr)[0] =
readl(hdr_start);
385 static void ultra32_block_input(
struct net_device *dev,
393 if ((ring_offset & ~0x1fff) != ((ring_offset + count - 1) & ~0x1fff)) {
394 int semi_count = 8192 - (ring_offset & 0x1FFF);
397 if (ring_offset < 96*256) {
399 ring_offset += semi_count;
400 outb(
ei_status.reg0 | ((ring_offset & 0x6000) >> 13), RamReg);
412 static void ultra32_block_output(
struct net_device *dev,
414 const unsigned char *
buf,
427 #define MAX_ULTRA32_CARDS 4
428 static struct net_device *dev_ultra[MAX_ULTRA32_CARDS];
435 int this_dev, found = 0;
437 for (this_dev = 0; this_dev < MAX_ULTRA32_CARDS; this_dev++) {
441 dev_ultra[found++] =
dev;
453 for (this_dev = 0; this_dev < MAX_ULTRA32_CARDS; this_dev++) {