2 * Copyright (c) 1999 M. Warner Losh <imp@village.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * $FreeBSD: src/sys/dev/sn/if_sn_pccard.c,v 1.3.2.2 2001/01/25 19:40:27 imp Exp $
26 * $DragonFly: src/sys/dev/netif/sn/if_sn_pccard.c,v 1.2 2003/06/17 04:28:29 dillon Exp $
30 * Modifications for Megahertz X-Jack Ethernet Card (XJ-10BT)
32 * Copyright (c) 1996 by Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org>
33 * BSD-nomads, Tokyo, Japan.
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/kernel.h>
39 #include <sys/socket.h>
41 #include <sys/module.h>
44 #include <machine/bus.h>
45 #include <machine/resource.h>
48 #include <net/ethernet.h>
50 #include <net/if_arp.h>
51 #include <net/if_media.h>
53 #include <machine/clock.h>
55 #include <dev/sn/if_snreg.h>
56 #include <dev/sn/if_snvar.h>
57 #include <dev/pccard/pccardvar.h>
60 * Initialize the device - called from Slot manager.
63 sn_pccard_probe(device_t dev)
65 return (sn_probe(dev, 1));
69 sn_pccard_attach(device_t dev)
71 struct sn_softc *sc = device_get_softc(dev);
74 u_char ether_addr[ETHER_ADDR_LEN];
76 sc->pccard_enaddr = 0;
77 pccard_get_ether(dev, ether_addr);
78 for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++)
81 sc->pccard_enaddr = 1;
82 bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
85 return (sn_attach(dev));
89 sn_pccard_detach(device_t dev)
91 struct sn_softc *sc = device_get_softc(dev);
93 sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
94 ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
99 static device_method_t sn_pccard_methods[] = {
100 /* Device interface */
101 DEVMETHOD(device_probe, sn_pccard_probe),
102 DEVMETHOD(device_attach, sn_pccard_attach),
103 DEVMETHOD(device_detach, sn_pccard_detach),
108 static driver_t sn_pccard_driver = {
111 sizeof(struct sn_softc),
114 extern devclass_t sn_devclass;
116 DRIVER_MODULE(if_sn, pccard, sn_pccard_driver, sn_devclass, 0, 0);