Deleted Added
full compact
if_ep_isa.c (112794) if_ep_isa.c (112824)
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * $FreeBSD: head/sys/dev/ep/if_ep_isa.c 112794 2003-03-29 13:45:17Z mdodd $
30 * $FreeBSD: head/sys/dev/ep/if_ep_isa.c 112824 2003-03-29 21:57:32Z mdodd $
31 */
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/socket.h>
37
38#include <sys/module.h>

--- 17 unchanged lines hidden (view full) ---

56#endif
57
58#ifdef __i386__
59static u_int16_t get_eeprom_data (int, int);
60static void ep_isa_identify (driver_t *, device_t);
61#endif
62static int ep_isa_probe (device_t);
63static int ep_isa_attach (device_t);
31 */
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/socket.h>
37
38#include <sys/module.h>

--- 17 unchanged lines hidden (view full) ---

56#endif
57
58#ifdef __i386__
59static u_int16_t get_eeprom_data (int, int);
60static void ep_isa_identify (driver_t *, device_t);
61#endif
62static int ep_isa_probe (device_t);
63static int ep_isa_attach (device_t);
64static int ep_eeprom_cksum (struct ep_softc *);
64
65struct isa_ident {
66 u_int32_t id;
67 char * name;
68};
69const char * ep_isa_match_id (u_int32_t, struct isa_ident *);
70
71#define ISA_ID_3C509_XXX 0x0506d509

--- 266 unchanged lines hidden (view full) ---

338 GO_WINDOW(0);
339 SET_IRQ(BASE, rman_get_start(sc->irq));
340
341 if ((error = ep_attach(sc))) {
342 device_printf(dev, "ep_attach() failed! (%d)\n", error);
343 goto bad;
344 }
345
65
66struct isa_ident {
67 u_int32_t id;
68 char * name;
69};
70const char * ep_isa_match_id (u_int32_t, struct isa_ident *);
71
72#define ISA_ID_3C509_XXX 0x0506d509

--- 266 unchanged lines hidden (view full) ---

339 GO_WINDOW(0);
340 SET_IRQ(BASE, rman_get_start(sc->irq));
341
342 if ((error = ep_attach(sc))) {
343 device_printf(dev, "ep_attach() failed! (%d)\n", error);
344 goto bad;
345 }
346
347 error = ep_eeprom_cksum(sc);
348 if (error) {
349 device_printf(sc->dev, "Invalid EEPROM checksum!\n");
350 goto bad;
351 }
352
346 if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, ep_intr,
347 sc, &sc->ep_intrhand))) {
348 device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
349 goto bad;
350 }
351
352 return (0);
353bad:
354 ep_free(dev);
355 return (error);
356}
357
353 if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, ep_intr,
354 sc, &sc->ep_intrhand))) {
355 device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
356 goto bad;
357 }
358
359 return (0);
360bad:
361 ep_free(dev);
362 return (error);
363}
364
365static int
366ep_eeprom_cksum (sc)
367 struct ep_softc * sc;
368{
369 int i;
370 int error;
371 u_int16_t val;
372 u_int16_t cksum;
373 u_int8_t cksum_high = 0;
374 u_int8_t cksum_low = 0;
375
376 error = get_e(sc, 0x0f, &val);
377 if (error)
378 return (ENXIO);
379 cksum = val;
380
381 for (i = 0; i < 0x0f; i++) {
382 error = get_e(sc, i, &val);
383 if (error)
384 return (ENXIO);
385 switch (i) {
386 case 0x08:
387 case 0x09:
388 case 0x0d:
389 cksum_low ^= (u_int8_t)(val & 0x00ff) ^
390 (u_int8_t)((val & 0xff00) >> 8);
391 break;
392 default:
393 cksum_high ^= (u_int8_t)(val & 0x00ff) ^
394 (u_int8_t)((val & 0xff00) >> 8);
395 break;
396 }
397 }
398 return (cksum != ((u_int16_t)cksum_low | (u_int16_t)(cksum_high << 8)));
399}
400
358static device_method_t ep_isa_methods[] = {
359 /* Device interface */
360#ifdef __i386__
361 DEVMETHOD(device_identify, ep_isa_identify),
362#endif
363 DEVMETHOD(device_probe, ep_isa_probe),
364 DEVMETHOD(device_attach, ep_isa_attach),
365

--- 15 unchanged lines hidden ---
401static device_method_t ep_isa_methods[] = {
402 /* Device interface */
403#ifdef __i386__
404 DEVMETHOD(device_identify, ep_isa_identify),
405#endif
406 DEVMETHOD(device_probe, ep_isa_probe),
407 DEVMETHOD(device_attach, ep_isa_attach),
408

--- 15 unchanged lines hidden ---