Deleted Added
full compact
if_sn_pccard.c (63090) if_sn_pccard.c (66058)
1/*
2 * Copyright (c) 1999 M. Warner Losh <imp@village.org>
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

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

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.
24 *
1/*
2 * Copyright (c) 1999 M. Warner Losh <imp@village.org>
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

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

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.
24 *
25 * $FreeBSD: head/sys/dev/sn/if_sn_pccard.c 63090 2000-07-13 22:54:34Z archie $
25 * $FreeBSD: head/sys/dev/sn/if_sn_pccard.c 66058 2000-09-19 04:39:20Z imp $
26 */
27
28/*
29 * Modifications for Megahertz X-Jack Ethernet Card (XJ-10BT)
30 *
31 * Copyright (c) 1996 by Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org>
32 * BSD-nomads, Tokyo, Japan.
33 */

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

50#include <net/if_media.h>
51
52#include <machine/clock.h>
53
54#include <dev/sn/if_snreg.h>
55#include <dev/sn/if_snvar.h>
56#include <dev/pccard/pccardvar.h>
57
26 */
27
28/*
29 * Modifications for Megahertz X-Jack Ethernet Card (XJ-10BT)
30 *
31 * Copyright (c) 1996 by Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org>
32 * BSD-nomads, Tokyo, Japan.
33 */

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

50#include <net/if_media.h>
51
52#include <machine/clock.h>
53
54#include <dev/sn/if_snreg.h>
55#include <dev/sn/if_snvar.h>
56#include <dev/pccard/pccardvar.h>
57
58#include <dev/pccard/pccarddevs.h>
59
60#include "card_if.h"
61
58/*
59 * Initialize the device - called from Slot manager.
60 */
61static int
62sn_pccard_probe(device_t dev)
63{
62/*
63 * Initialize the device - called from Slot manager.
64 */
65static int
66sn_pccard_probe(device_t dev)
67{
64 return (sn_probe(dev, 1));
68 int err;
69
70 printf ("Probing sn driver\n");
71 err = sn_probe(dev, 1);
72 printf("sn_probe says %d\n", err);
73 return (err);
65}
66
67static int
68sn_pccard_attach(device_t dev)
69{
70 struct sn_softc *sc = device_get_softc(dev);
71 int i;
72 u_char sum;
73 u_char ether_addr[ETHER_ADDR_LEN];
74
75 sc->pccard_enaddr = 0;
76 pccard_get_ether(dev, ether_addr);
77 for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++)
78 sum |= ether_addr[i];
79 if (sum) {
80 sc->pccard_enaddr = 1;
81 bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
82 }
74}
75
76static int
77sn_pccard_attach(device_t dev)
78{
79 struct sn_softc *sc = device_get_softc(dev);
80 int i;
81 u_char sum;
82 u_char ether_addr[ETHER_ADDR_LEN];
83
84 sc->pccard_enaddr = 0;
85 pccard_get_ether(dev, ether_addr);
86 for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++)
87 sum |= ether_addr[i];
88 if (sum) {
89 sc->pccard_enaddr = 1;
90 bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
91 }
83
84 return (sn_attach(dev));
85}
86
87static int
88sn_pccard_detach(device_t dev)
89{
90 struct sn_softc *sc = device_get_softc(dev);
91
92 sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
93 ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
94 sn_deactivate(dev);
95 return 0;
96}
97
92 return (sn_attach(dev));
93}
94
95static int
96sn_pccard_detach(device_t dev)
97{
98 struct sn_softc *sc = device_get_softc(dev);
99
100 sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
101 ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED);
102 sn_deactivate(dev);
103 return 0;
104}
105
106static int
107sn_pccard_match(device_t dev)
108{
109 return EIO;
110}
111
98static device_method_t sn_pccard_methods[] = {
99 /* Device interface */
112static device_method_t sn_pccard_methods[] = {
113 /* Device interface */
100 DEVMETHOD(device_probe, sn_pccard_probe),
101 DEVMETHOD(device_attach, sn_pccard_attach),
114 DEVMETHOD(device_probe, pccard_compat_probe),
115 DEVMETHOD(device_attach, pccard_compat_attach),
102 DEVMETHOD(device_detach, sn_pccard_detach),
103
116 DEVMETHOD(device_detach, sn_pccard_detach),
117
118 /* Card interface */
119 DEVMETHOD(card_compat_match, sn_pccard_match),
120 DEVMETHOD(card_compat_probe, sn_pccard_probe),
121 DEVMETHOD(card_compat_attach, sn_pccard_attach),
122
104 { 0, 0 }
105};
106
107static driver_t sn_pccard_driver = {
108 "sn",
109 sn_pccard_methods,
110 sizeof(struct sn_softc),
111};
112
113extern devclass_t sn_devclass;
114
123 { 0, 0 }
124};
125
126static driver_t sn_pccard_driver = {
127 "sn",
128 sn_pccard_methods,
129 sizeof(struct sn_softc),
130};
131
132extern devclass_t sn_devclass;
133
115DRIVER_MODULE(sn, pccard, sn_pccard_driver, sn_devclass, 0, 0);
134DRIVER_MODULE(if_sn, pccard, sn_pccard_driver, sn_devclass, 0, 0);
135MODULE_DEPEND(if_sn, pccard, 1, 1, 1);
136MODULE_DEPEND(if_sn, pcic, 1, 1, 1); /* XXX */