1 |
1626 |
jcastillo |
/* smc-ultra32.c: An SMC Ultra32 EISA ethernet driver for linux.
|
2 |
|
|
|
3 |
|
|
Sources:
|
4 |
|
|
|
5 |
|
|
This driver is based on (cloned from) the ISA SMC Ultra driver
|
6 |
|
|
written by Donald Becker. Modifications to support the EISA
|
7 |
|
|
version of the card by Paul Gortmaker and Leonard N. Zubkoff.
|
8 |
|
|
|
9 |
|
|
This software may be used and distributed according to the terms
|
10 |
|
|
of the GNU Public License, incorporated herein by reference.
|
11 |
|
|
|
12 |
|
|
Theory of Operation:
|
13 |
|
|
|
14 |
|
|
The SMC Ultra32C card uses the SMC 83c790 chip which is also
|
15 |
|
|
found on the ISA SMC Ultra cards. It has a shared memory mode of
|
16 |
|
|
operation that makes it similar to the ISA version of the card.
|
17 |
|
|
The main difference is that the EISA card has 32KB of RAM, but
|
18 |
|
|
only an 8KB window into that memory. The EISA card also can be
|
19 |
|
|
set for a bus-mastering mode of operation via the ECU, but that
|
20 |
|
|
is not (and probably will never be) supported by this driver.
|
21 |
|
|
The ECU should be run to enable shared memory and to disable the
|
22 |
|
|
bus-mastering feature for use with linux.
|
23 |
|
|
|
24 |
|
|
By programming the 8390 to use only 8KB RAM, the modifications
|
25 |
|
|
to the ISA driver can be limited to the probe and initialization
|
26 |
|
|
code. This allows easy integration of EISA support into the ISA
|
27 |
|
|
driver. However, the driver development kit from SMC provided the
|
28 |
|
|
register information for sliding the 8KB window, and hence the 8390
|
29 |
|
|
is programmed to use the full 32KB RAM.
|
30 |
|
|
|
31 |
|
|
Unfortunately this required code changes outside the probe/init
|
32 |
|
|
routines, and thus we decided to separate the EISA driver from
|
33 |
|
|
the ISA one. In this way, ISA users don't end up with a larger
|
34 |
|
|
driver due to the EISA code, and EISA users don't end up with a
|
35 |
|
|
larger driver due to the ISA EtherEZ PIO code. The driver is
|
36 |
|
|
similar to the 3c503/16 driver, in that the window must be set
|
37 |
|
|
back to the 1st 8KB of space for access to the two 8390 Tx slots.
|
38 |
|
|
|
39 |
|
|
In testing, using only 8KB RAM (3 Tx / 5 Rx) didn't appear to
|
40 |
|
|
be a limiting factor, since the EISA bus could get packets off
|
41 |
|
|
the card fast enough, but having the use of lots of RAM as Rx
|
42 |
|
|
space is extra insurance if interrupt latencies become excessive.
|
43 |
|
|
|
44 |
|
|
*/
|
45 |
|
|
|
46 |
|
|
static const char *version = "smc-ultra32.c: 06/97 v1.00\n";
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
#include <linux/module.h>
|
50 |
|
|
#include <linux/kernel.h>
|
51 |
|
|
#include <linux/sched.h>
|
52 |
|
|
#include <linux/errno.h>
|
53 |
|
|
#include <linux/string.h>
|
54 |
|
|
|
55 |
|
|
#include <asm/io.h>
|
56 |
|
|
#include <asm/system.h>
|
57 |
|
|
|
58 |
|
|
#include <linux/netdevice.h>
|
59 |
|
|
#include <linux/etherdevice.h>
|
60 |
|
|
#include "8390.h"
|
61 |
|
|
|
62 |
|
|
int ultra32_probe(struct device *dev);
|
63 |
|
|
int ultra32_probe1(struct device *dev, int ioaddr);
|
64 |
|
|
static int ultra32_open(struct device *dev);
|
65 |
|
|
static void ultra32_reset_8390(struct device *dev);
|
66 |
|
|
static void ultra32_get_8390_hdr(struct device *dev, struct e8390_pkt_hdr *hdr,
|
67 |
|
|
int ring_page);
|
68 |
|
|
static void ultra32_block_input(struct device *dev, int count,
|
69 |
|
|
struct sk_buff *skb, int ring_offset);
|
70 |
|
|
static void ultra32_block_output(struct device *dev, int count,
|
71 |
|
|
const unsigned char *buf, const int start_page);
|
72 |
|
|
static int ultra32_close(struct device *dev);
|
73 |
|
|
|
74 |
|
|
#define ULTRA32_CMDREG 0 /* Offset to ASIC command register. */
|
75 |
|
|
#define ULTRA32_RESET 0x80 /* Board reset, in ULTRA32_CMDREG. */
|
76 |
|
|
#define ULTRA32_MEMENB 0x40 /* Enable the shared memory. */
|
77 |
|
|
#define ULTRA32_NIC_OFFSET 16 /* NIC register offset from the base_addr. */
|
78 |
|
|
#define ULTRA32_IO_EXTENT 32
|
79 |
|
|
#define EN0_ERWCNT 0x08 /* Early receive warning count. */
|
80 |
|
|
|
81 |
|
|
/*
|
82 |
|
|
* Defines that apply only to the Ultra32 EISA card. Note that
|
83 |
|
|
* "smc" = 10011 01101 00011 = 0x4da3, and hence !smc8010.cfg translates
|
84 |
|
|
* into an EISA ID of 0x1080A34D
|
85 |
|
|
*/
|
86 |
|
|
#define ULTRA32_BASE 0xca0
|
87 |
|
|
#define ULTRA32_ID 0x1080a34d
|
88 |
|
|
#define ULTRA32_IDPORT (-0x20) /* 0xc80 */
|
89 |
|
|
/* Config regs 1->7 from the EISA !SMC8010.CFG file. */
|
90 |
|
|
#define ULTRA32_CFG1 0x04 /* 0xca4 */
|
91 |
|
|
#define ULTRA32_CFG2 0x05 /* 0xca5 */
|
92 |
|
|
#define ULTRA32_CFG3 (-0x18) /* 0xc88 */
|
93 |
|
|
#define ULTRA32_CFG4 (-0x17) /* 0xc89 */
|
94 |
|
|
#define ULTRA32_CFG5 (-0x16) /* 0xc8a */
|
95 |
|
|
#define ULTRA32_CFG6 (-0x15) /* 0xc8b */
|
96 |
|
|
#define ULTRA32_CFG7 0x0d /* 0xcad */
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
/* Probe for the Ultra32. This looks like a 8013 with the station
|
100 |
|
|
address PROM at I/O ports <base>+8 to <base>+13, with a checksum
|
101 |
|
|
following.
|
102 |
|
|
*/
|
103 |
|
|
|
104 |
|
|
int ultra32_probe(struct device *dev)
|
105 |
|
|
{
|
106 |
|
|
const char *ifmap[] = {"UTP No Link", "", "UTP/AUI", "UTP/BNC"};
|
107 |
|
|
int ioaddr, edge, media;
|
108 |
|
|
|
109 |
|
|
if (!EISA_bus) return ENODEV;
|
110 |
|
|
|
111 |
|
|
/* EISA spec allows for up to 16 slots, but 8 is typical. */
|
112 |
|
|
for (ioaddr = 0x1000 + ULTRA32_BASE; ioaddr < 0x9000; ioaddr += 0x1000)
|
113 |
|
|
if (check_region(ioaddr, ULTRA32_IO_EXTENT) == 0 &&
|
114 |
|
|
inb(ioaddr + ULTRA32_IDPORT) != 0xff &&
|
115 |
|
|
inl(ioaddr + ULTRA32_IDPORT) == ULTRA32_ID) {
|
116 |
|
|
media = inb(ioaddr + ULTRA32_CFG7) & 0x03;
|
117 |
|
|
edge = inb(ioaddr + ULTRA32_CFG5) & 0x08;
|
118 |
|
|
printk("SMC Ultra32 in EISA Slot %d, Media: %s, %s IRQs.\n",
|
119 |
|
|
ioaddr >> 12, ifmap[media],
|
120 |
|
|
(edge ? "Edge Triggered" : "Level Sensitive"));
|
121 |
|
|
if (ultra32_probe1(dev, ioaddr) == 0)
|
122 |
|
|
return 0;
|
123 |
|
|
}
|
124 |
|
|
return ENODEV;
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
int ultra32_probe1(struct device *dev, int ioaddr)
|
128 |
|
|
{
|
129 |
|
|
int i;
|
130 |
|
|
int checksum = 0;
|
131 |
|
|
const char *model_name;
|
132 |
|
|
static unsigned version_printed = 0;
|
133 |
|
|
/* Values from various config regs. */
|
134 |
|
|
unsigned char idreg = inb(ioaddr + 7);
|
135 |
|
|
unsigned char reg4 = inb(ioaddr + 4) & 0x7f;
|
136 |
|
|
|
137 |
|
|
/* Check the ID nibble. */
|
138 |
|
|
if ((idreg & 0xf0) != 0x20) /* SMC Ultra */
|
139 |
|
|
return ENODEV;
|
140 |
|
|
|
141 |
|
|
/* Select the station address register set. */
|
142 |
|
|
outb(reg4, ioaddr + 4);
|
143 |
|
|
|
144 |
|
|
for (i = 0; i < 8; i++)
|
145 |
|
|
checksum += inb(ioaddr + 8 + i);
|
146 |
|
|
if ((checksum & 0xff) != 0xff)
|
147 |
|
|
return ENODEV;
|
148 |
|
|
|
149 |
|
|
/* We should have a "dev" from Space.c or the static module table. */
|
150 |
|
|
if (dev == NULL) {
|
151 |
|
|
printk("smc-ultra32.c: Passed a NULL device.\n");
|
152 |
|
|
dev = init_etherdev(0, 0);
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
if (ei_debug && version_printed++ == 0)
|
156 |
|
|
printk(version);
|
157 |
|
|
|
158 |
|
|
model_name = "SMC Ultra32";
|
159 |
|
|
|
160 |
|
|
printk("%s: %s at 0x%X,", dev->name, model_name, ioaddr);
|
161 |
|
|
|
162 |
|
|
for (i = 0; i < 6; i++)
|
163 |
|
|
printk(" %2.2X", dev->dev_addr[i] = inb(ioaddr + 8 + i));
|
164 |
|
|
|
165 |
|
|
/* Switch from the station address to the alternate register set and
|
166 |
|
|
read the useful registers there. */
|
167 |
|
|
outb(0x80 | reg4, ioaddr + 4);
|
168 |
|
|
|
169 |
|
|
/* Enable FINE16 mode to avoid BIOS ROM width mismatches @ reboot. */
|
170 |
|
|
outb(0x80 | inb(ioaddr + 0x0c), ioaddr + 0x0c);
|
171 |
|
|
|
172 |
|
|
/* Reset RAM addr. */
|
173 |
|
|
outb(0x00, ioaddr + 0x0b);
|
174 |
|
|
|
175 |
|
|
/* Switch back to the station address register set so that the
|
176 |
|
|
MS-DOS driver can find the card after a warm boot. */
|
177 |
|
|
outb(reg4, ioaddr + 4);
|
178 |
|
|
|
179 |
|
|
if ((inb(ioaddr + ULTRA32_CFG5) & 0x40) == 0) {
|
180 |
|
|
printk("\nsmc-ultra32: Card RAM is disabled! "
|
181 |
|
|
"Run EISA config utility.\n");
|
182 |
|
|
return ENODEV;
|
183 |
|
|
}
|
184 |
|
|
if ((inb(ioaddr + ULTRA32_CFG2) & 0x04) == 0)
|
185 |
|
|
printk("\nsmc-ultra32: Ignoring Bus-Master enable bit. "
|
186 |
|
|
"Run EISA config utility.\n");
|
187 |
|
|
|
188 |
|
|
if (dev->irq < 2) {
|
189 |
|
|
unsigned char irqmap[] = {0, 9, 3, 5, 7, 10, 11, 15};
|
190 |
|
|
int irq = irqmap[inb(ioaddr + ULTRA32_CFG5) & 0x07];
|
191 |
|
|
if (irq == 0) {
|
192 |
|
|
printk(", failed to detect IRQ line.\n");
|
193 |
|
|
return -EAGAIN;
|
194 |
|
|
}
|
195 |
|
|
dev->irq = irq;
|
196 |
|
|
}
|
197 |
|
|
|
198 |
|
|
/* Allocate dev->priv and fill in 8390 specific dev fields. */
|
199 |
|
|
if (ethdev_init(dev)) {
|
200 |
|
|
printk (", no memory for dev->priv.\n");
|
201 |
|
|
return -ENOMEM;
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
/* OK, we are certain this is going to work. Setup the device. */
|
205 |
|
|
request_region(ioaddr, ULTRA32_IO_EXTENT, model_name);
|
206 |
|
|
|
207 |
|
|
/* The 8390 isn't at the base address, so fake the offset */
|
208 |
|
|
dev->base_addr = ioaddr + ULTRA32_NIC_OFFSET;
|
209 |
|
|
|
210 |
|
|
/* Save RAM address in the unused reg0 to avoid excess inb's. */
|
211 |
|
|
ei_status.reg0 = inb(ioaddr + ULTRA32_CFG3) & 0xfc;
|
212 |
|
|
|
213 |
|
|
dev->mem_start = 0xc0000 + ((ei_status.reg0 & 0x7c) << 11);
|
214 |
|
|
|
215 |
|
|
ei_status.name = model_name;
|
216 |
|
|
ei_status.word16 = 1;
|
217 |
|
|
ei_status.tx_start_page = 0;
|
218 |
|
|
ei_status.rx_start_page = TX_PAGES;
|
219 |
|
|
/* All Ultra32 cards have 32KB memory with an 8KB window. */
|
220 |
|
|
ei_status.stop_page = 128;
|
221 |
|
|
|
222 |
|
|
dev->rmem_start = dev->mem_start + TX_PAGES*256;
|
223 |
|
|
dev->mem_end = dev->rmem_end = dev->mem_start + 0x1fff;
|
224 |
|
|
|
225 |
|
|
printk(", IRQ %d, 32KB memory, 8KB window at 0x%lx-0x%lx.\n",
|
226 |
|
|
dev->irq, dev->mem_start, dev->mem_end);
|
227 |
|
|
ei_status.block_input = &ultra32_block_input;
|
228 |
|
|
ei_status.block_output = &ultra32_block_output;
|
229 |
|
|
ei_status.get_8390_hdr = &ultra32_get_8390_hdr;
|
230 |
|
|
ei_status.reset_8390 = &ultra32_reset_8390;
|
231 |
|
|
dev->open = &ultra32_open;
|
232 |
|
|
dev->stop = &ultra32_close;
|
233 |
|
|
NS8390_init(dev, 0);
|
234 |
|
|
|
235 |
|
|
return 0;
|
236 |
|
|
}
|
237 |
|
|
|
238 |
|
|
static int ultra32_open(struct device *dev)
|
239 |
|
|
{
|
240 |
|
|
int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET; /* ASIC addr */
|
241 |
|
|
|
242 |
|
|
if (request_irq(dev->irq, ei_interrupt, 0, ei_status.name, dev))
|
243 |
|
|
return -EAGAIN;
|
244 |
|
|
|
245 |
|
|
outb(ULTRA32_MEMENB, ioaddr); /* Enable Shared Memory. */
|
246 |
|
|
outb(0x80, ioaddr + ULTRA32_CFG6); /* Enable Interrupts. */
|
247 |
|
|
outb(0x84, ioaddr + 5); /* Enable MEM16 & Disable Bus Master. */
|
248 |
|
|
outb(0x01, ioaddr + 6); /* Enable Interrupts. */
|
249 |
|
|
/* Set the early receive warning level in window 0 high enough not
|
250 |
|
|
to receive ERW interrupts. */
|
251 |
|
|
outb_p(E8390_NODMA+E8390_PAGE0, dev->base_addr);
|
252 |
|
|
outb(0xff, dev->base_addr + EN0_ERWCNT);
|
253 |
|
|
ei_open(dev);
|
254 |
|
|
MOD_INC_USE_COUNT;
|
255 |
|
|
return 0;
|
256 |
|
|
}
|
257 |
|
|
|
258 |
|
|
static int ultra32_close(struct device *dev)
|
259 |
|
|
{
|
260 |
|
|
int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET; /* CMDREG */
|
261 |
|
|
|
262 |
|
|
dev->start = 0;
|
263 |
|
|
dev->tbusy = 1;
|
264 |
|
|
|
265 |
|
|
if (ei_debug > 1)
|
266 |
|
|
printk("%s: Shutting down ethercard.\n", dev->name);
|
267 |
|
|
|
268 |
|
|
outb(0x00, ioaddr + ULTRA32_CFG6); /* Disable Interrupts. */
|
269 |
|
|
outb(0x00, ioaddr + 6); /* Disable interrupts. */
|
270 |
|
|
free_irq(dev->irq, dev);
|
271 |
|
|
irq2dev_map[dev->irq] = 0;
|
272 |
|
|
|
273 |
|
|
NS8390_init(dev, 0);
|
274 |
|
|
|
275 |
|
|
MOD_DEC_USE_COUNT;
|
276 |
|
|
|
277 |
|
|
return 0;
|
278 |
|
|
}
|
279 |
|
|
|
280 |
|
|
static void ultra32_reset_8390(struct device *dev)
|
281 |
|
|
{
|
282 |
|
|
int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET; /* ASIC base addr */
|
283 |
|
|
|
284 |
|
|
outb(ULTRA32_RESET, ioaddr);
|
285 |
|
|
if (ei_debug > 1) printk("resetting Ultra32, t=%ld...", jiffies);
|
286 |
|
|
ei_status.txing = 0;
|
287 |
|
|
|
288 |
|
|
outb(ULTRA32_MEMENB, ioaddr); /* Enable Shared Memory. */
|
289 |
|
|
outb(0x80, ioaddr + ULTRA32_CFG6); /* Enable Interrupts. */
|
290 |
|
|
outb(0x84, ioaddr + 5); /* Enable MEM16 & Disable Bus Master. */
|
291 |
|
|
outb(0x01, ioaddr + 6); /* Enable Interrupts. */
|
292 |
|
|
if (ei_debug > 1) printk("reset done\n");
|
293 |
|
|
return;
|
294 |
|
|
}
|
295 |
|
|
|
296 |
|
|
/* Grab the 8390 specific header. Similar to the block_input routine, but
|
297 |
|
|
we don't need to be concerned with ring wrap as the header will be at
|
298 |
|
|
the start of a page, so we optimize accordingly. */
|
299 |
|
|
|
300 |
|
|
static void ultra32_get_8390_hdr(struct device *dev,
|
301 |
|
|
struct e8390_pkt_hdr *hdr,
|
302 |
|
|
int ring_page)
|
303 |
|
|
{
|
304 |
|
|
unsigned long hdr_start = dev->mem_start + ((ring_page & 0x1f) << 8);
|
305 |
|
|
unsigned int RamReg = dev->base_addr - ULTRA32_NIC_OFFSET + ULTRA32_CFG3;
|
306 |
|
|
|
307 |
|
|
/* Select correct 8KB Window. */
|
308 |
|
|
outb(ei_status.reg0 | ((ring_page & 0x60) >> 5), RamReg);
|
309 |
|
|
|
310 |
|
|
#ifdef notdef
|
311 |
|
|
/* Officially this is what we are doing, but the readl() is faster */
|
312 |
|
|
memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
|
313 |
|
|
#else
|
314 |
|
|
((unsigned int*)hdr)[0] = readl(hdr_start);
|
315 |
|
|
#endif
|
316 |
|
|
}
|
317 |
|
|
|
318 |
|
|
/* Block input and output are easy on shared memory ethercards, the only
|
319 |
|
|
complication is when the ring buffer wraps, or in this case, when a
|
320 |
|
|
packet spans an 8KB boundary. Note that the current 8KB segment is
|
321 |
|
|
already set by the get_8390_hdr routine. */
|
322 |
|
|
|
323 |
|
|
static void ultra32_block_input(struct device *dev,
|
324 |
|
|
int count,
|
325 |
|
|
struct sk_buff *skb,
|
326 |
|
|
int ring_offset)
|
327 |
|
|
{
|
328 |
|
|
unsigned long xfer_start = dev->mem_start + (ring_offset & 0x1fff);
|
329 |
|
|
unsigned int RamReg = dev->base_addr - ULTRA32_NIC_OFFSET + ULTRA32_CFG3;
|
330 |
|
|
|
331 |
|
|
if ((ring_offset & ~0x1fff) != ((ring_offset + count - 1) & ~0x1fff)) {
|
332 |
|
|
int semi_count = 8192 - (ring_offset & 0x1FFF);
|
333 |
|
|
memcpy_fromio(skb->data, xfer_start, semi_count);
|
334 |
|
|
count -= semi_count;
|
335 |
|
|
if (ring_offset < 96*256) {
|
336 |
|
|
/* Select next 8KB Window. */
|
337 |
|
|
ring_offset += semi_count;
|
338 |
|
|
outb(ei_status.reg0 | ((ring_offset & 0x6000) >> 13), RamReg);
|
339 |
|
|
memcpy_fromio(skb->data + semi_count, dev->mem_start, count);
|
340 |
|
|
} else {
|
341 |
|
|
/* Select first 8KB Window. */
|
342 |
|
|
outb(ei_status.reg0, RamReg);
|
343 |
|
|
memcpy_fromio(skb->data + semi_count, dev->rmem_start, count);
|
344 |
|
|
}
|
345 |
|
|
} else {
|
346 |
|
|
/* Packet is in one chunk -- we can copy + cksum. */
|
347 |
|
|
eth_io_copy_and_sum(skb, xfer_start, count, 0);
|
348 |
|
|
}
|
349 |
|
|
}
|
350 |
|
|
|
351 |
|
|
static void ultra32_block_output(struct device *dev,
|
352 |
|
|
int count,
|
353 |
|
|
const unsigned char *buf,
|
354 |
|
|
int start_page)
|
355 |
|
|
{
|
356 |
|
|
unsigned long xfer_start = dev->mem_start + (start_page<<8);
|
357 |
|
|
unsigned int RamReg = dev->base_addr - ULTRA32_NIC_OFFSET + ULTRA32_CFG3;
|
358 |
|
|
|
359 |
|
|
/* Select first 8KB Window. */
|
360 |
|
|
outb(ei_status.reg0, RamReg);
|
361 |
|
|
|
362 |
|
|
memcpy_toio(xfer_start, buf, count);
|
363 |
|
|
}
|
364 |
|
|
|
365 |
|
|
#ifdef MODULE
|
366 |
|
|
#define MAX_ULTRA32_CARDS 4 /* Max number of Ultra cards per module */
|
367 |
|
|
#define NAMELEN 8 /* # of chars for storing dev->name */
|
368 |
|
|
static char namelist[NAMELEN * MAX_ULTRA32_CARDS] = { 0, };
|
369 |
|
|
static struct device dev_ultra[MAX_ULTRA32_CARDS] = {
|
370 |
|
|
{
|
371 |
|
|
NULL, /* assign a chunk of namelist[] below */
|
372 |
|
|
0, 0, 0, 0,
|
373 |
|
|
0, 0,
|
374 |
|
|
0, 0, 0, NULL, NULL
|
375 |
|
|
},
|
376 |
|
|
};
|
377 |
|
|
|
378 |
|
|
int init_module(void)
|
379 |
|
|
{
|
380 |
|
|
int this_dev, found = 0;
|
381 |
|
|
|
382 |
|
|
for (this_dev = 0; this_dev < MAX_ULTRA32_CARDS; this_dev++) {
|
383 |
|
|
struct device *dev = &dev_ultra[this_dev];
|
384 |
|
|
dev->name = namelist+(NAMELEN*this_dev);
|
385 |
|
|
dev->init = ultra32_probe;
|
386 |
|
|
if (register_netdev(dev) != 0) {
|
387 |
|
|
if (found > 0) return 0; /* Got at least one. */
|
388 |
|
|
printk(KERN_WARNING "smc-ultra32.c: No SMC Ultra32 found.\n");
|
389 |
|
|
return -ENXIO;
|
390 |
|
|
}
|
391 |
|
|
found++;
|
392 |
|
|
}
|
393 |
|
|
|
394 |
|
|
return 0;
|
395 |
|
|
}
|
396 |
|
|
|
397 |
|
|
void cleanup_module(void)
|
398 |
|
|
{
|
399 |
|
|
int this_dev;
|
400 |
|
|
|
401 |
|
|
for (this_dev = 0; this_dev < MAX_ULTRA32_CARDS; this_dev++) {
|
402 |
|
|
struct device *dev = &dev_ultra[this_dev];
|
403 |
|
|
if (dev->priv != NULL) {
|
404 |
|
|
/* NB: ultra32_close_card() does free_irq + irq2dev */
|
405 |
|
|
int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET;
|
406 |
|
|
kfree(dev->priv);
|
407 |
|
|
dev->priv = NULL;
|
408 |
|
|
release_region(ioaddr, ULTRA32_IO_EXTENT);
|
409 |
|
|
unregister_netdev(dev);
|
410 |
|
|
}
|
411 |
|
|
}
|
412 |
|
|
}
|
413 |
|
|
#endif /* MODULE */
|