Deleted Added
full compact
if_snc_pccard.c (166901) if_snc_pccard.c (181298)
1/*-
2 * Copyright (c) 1995, David Greenman
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 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1995, David Greenman
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 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/snc/if_snc_pccard.c 166901 2007-02-23 12:19:07Z piso $");
30__FBSDID("$FreeBSD: head/sys/dev/snc/if_snc_pccard.c 181298 2008-08-04 19:19:18Z jhb $");
31
32/*
33 * National Semiconductor DP8393X SONIC Driver
34 *
35 * This is the PC Card attachment on FreeBSD
36 * written by Motomichi Matsuzaki <mzaki@e-mail.ne.jp> and
37 * Hiroshi Yamashita <bluemoon@msj.biglobe.ne.jp>
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/socket.h>
43#include <sys/kernel.h>
44
45#include <sys/module.h>
46#include <sys/bus.h>
47#include <machine/bus.h>
48
31
32/*
33 * National Semiconductor DP8393X SONIC Driver
34 *
35 * This is the PC Card attachment on FreeBSD
36 * written by Motomichi Matsuzaki <mzaki@e-mail.ne.jp> and
37 * Hiroshi Yamashita <bluemoon@msj.biglobe.ne.jp>
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/socket.h>
43#include <sys/kernel.h>
44
45#include <sys/module.h>
46#include <sys/bus.h>
47#include <machine/bus.h>
48
49#include <net/ethernet.h>
49#include <net/if.h>
50#include <net/if_arp.h>
51#include <net/if_media.h>
52
50#include <net/if.h>
51#include <net/if_arp.h>
52#include <net/if_media.h>
53
53
54#include <dev/snc/dp83932var.h>
55#include <dev/snc/if_sncvar.h>
56#include <dev/snc/if_sncreg.h>
57
58/*
59 * PC Card (PCMCIA) specific code.
60 */
61static int snc_pccard_probe(device_t);

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

89{
90 struct snc_softc *sc = device_get_softc(dev);
91 struct ifnet *ifp = sc->sc_ifp;
92
93 if (sc->gone) {
94 device_printf(dev, "already unloaded\n");
95 return (0);
96 }
54#include <dev/snc/dp83932var.h>
55#include <dev/snc/if_sncvar.h>
56#include <dev/snc/if_sncreg.h>
57
58/*
59 * PC Card (PCMCIA) specific code.
60 */
61static int snc_pccard_probe(device_t);

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

89{
90 struct snc_softc *sc = device_get_softc(dev);
91 struct ifnet *ifp = sc->sc_ifp;
92
93 if (sc->gone) {
94 device_printf(dev, "already unloaded\n");
95 return (0);
96 }
97 SNC_LOCK(sc);
97 sncshutdown(sc);
98 sncshutdown(sc);
98 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
99 if_detach(ifp);
99 SNC_UNLOCK(sc);
100 callout_drain(&sc->sc_timer);
101 ether_ifdetach(ifp);
100 sc->gone = 1;
101 bus_teardown_intr(dev, sc->irq, sc->irq_handle);
102 snc_release_resources(dev);
102 sc->gone = 1;
103 bus_teardown_intr(dev, sc->irq, sc->irq_handle);
104 snc_release_resources(dev);
105 mtx_destroy(&sc->sc_lock);
103 return (0);
104}
105
106/*
107 * Probe the pccard.
108 */
109static int
110snc_pccard_probe(device_t dev)

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

121 snc_release_resources(dev);
122 return (error);
123}
124
125static int
126snc_pccard_attach(device_t dev)
127{
128 struct snc_softc *sc = device_get_softc(dev);
106 return (0);
107}
108
109/*
110 * Probe the pccard.
111 */
112static int
113snc_pccard_probe(device_t dev)

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

124 snc_release_resources(dev);
125 return (error);
126}
127
128static int
129snc_pccard_attach(device_t dev)
130{
131 struct snc_softc *sc = device_get_softc(dev);
129 int error;
130
131 bzero(sc, sizeof(struct snc_softc));
132
133 snc_alloc_port(dev, 0);
134 snc_alloc_memory(dev, 0);
135 snc_alloc_irq(dev, 0, 0);
136
132
133 bzero(sc, sizeof(struct snc_softc));
134
135 snc_alloc_port(dev, 0);
136 snc_alloc_memory(dev, 0);
137 snc_alloc_irq(dev, 0, 0);
138
137 error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET,
138 NULL, sncintr, sc, &sc->irq_handle);
139 if (error) {
140 printf("snc_isa_attach: bus_setup_intr() failed\n");
141 snc_release_resources(dev);
142 return (error);
143 }
144
145 /* This interface is always enabled. */
146 sc->sc_enabled = 1;
147
148 /* pccard_get_ether(dev, ether_addr); */
149
150 return snc_attach(dev);
151}
139 /* This interface is always enabled. */
140 sc->sc_enabled = 1;
141
142 /* pccard_get_ether(dev, ether_addr); */
143
144 return snc_attach(dev);
145}