Deleted Added
sdiff udiff text old ( 69960 ) new ( 70782 )
full compact
1/*-
2 * Copyright (c) 1999 Luoqi Chen.
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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/aic/aic_pccard.c 69960 2000-12-13 05:46:23Z imp $
27 */
28
29#include <sys/param.h>
30#include <sys/kernel.h>
31#include <sys/module.h>
32#include <sys/bus.h>
33
34#include <machine/bus_pio.h>
35#include <machine/bus.h>
36#include <machine/resource.h>
37#include <sys/rman.h>
38
39#include <dev/aic/aicvar.h>
40
41struct aic_pccard_softc {
42 struct aic_softc sc_aic;
43 struct resource *sc_port;
44 struct resource *sc_irq;
45 void *sc_ih;
46};
47
48static int aic_pccard_alloc_resources __P((device_t));
49static void aic_pccard_release_resources __P((device_t));
50static int aic_pccard_probe __P((device_t));
51static int aic_pccard_attach __P((device_t));
52
53#define AIC_PCCARD_PORTSIZE 0x20
54
55static int
56aic_pccard_alloc_resources(device_t dev)
57{
58 struct aic_pccard_softc *sc = device_get_softc(dev);
59 int rid;
60

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

88 if (sc->sc_port)
89 bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->sc_port);
90 if (sc->sc_irq)
91 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq);
92 sc->sc_port = sc->sc_irq = 0;
93}
94
95static int
96aic_pccard_probe(device_t dev)
97{
98 struct aic_pccard_softc *sc = device_get_softc(dev);
99 struct aic_softc *aic = &sc->sc_aic;
100
101 if (aic_pccard_alloc_resources(dev))
102 return (ENXIO);
103 if (aic_probe(aic)) {

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

159 }
160
161 aic_pccard_release_resources(dev);
162 return (0);
163}
164
165static device_method_t aic_pccard_methods[] = {
166 /* Device interface */
167 DEVMETHOD(device_probe, aic_pccard_probe),
168 DEVMETHOD(device_attach, aic_pccard_attach),
169 DEVMETHOD(device_detach, aic_pccard_detach),
170 { 0, 0 }
171};
172
173static driver_t aic_pccard_driver = {
174 "aic",
175 aic_pccard_methods, sizeof(struct aic_pccard_softc),
176};
177
178extern devclass_t aic_devclass;
179
180MODULE_DEPEND(aic, cam, 1,1,1);
181DRIVER_MODULE(aic, pccard, aic_pccard_driver, aic_devclass, 0, 0);