Lines Matching refs:dev
28 __FBSDID("$FreeBSD: releng/11.0/sys/dev/aic/aic_isa.c 298432 2016-04-21 19:48:28Z pfg $");
43 #include <dev/aic/aic6360reg.h>
44 #include <dev/aic/aicvar.h>
71 aic_isa_alloc_resources(device_t dev)
73 struct aic_isa_softc *sc = device_get_softc(dev);
79 sc->sc_port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
82 device_printf(dev, "I/O port allocation failed\n");
86 if (isa_get_irq(dev) != -1) {
88 sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
91 device_printf(dev, "IRQ allocation failed\n");
92 aic_isa_release_resources(dev);
97 if (isa_get_drq(dev) != -1) {
99 sc->sc_drq = bus_alloc_resource_any(dev, SYS_RES_DRQ, &rid,
102 device_printf(dev, "DRQ allocation failed\n");
103 aic_isa_release_resources(dev);
108 sc->sc_aic.dev = dev;
115 aic_isa_release_resources(device_t dev)
117 struct aic_isa_softc *sc = device_get_softc(dev);
120 bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->sc_port);
122 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq);
124 bus_release_resource(dev, SYS_RES_DRQ, 0, sc->sc_drq);
130 aic_isa_probe(device_t dev)
132 struct aic_isa_softc *sc = device_get_softc(dev);
138 if (ISA_PNP_PROBE(device_get_parent(dev), dev, aic_ids) == ENXIO)
141 port = isa_get_port(dev);
151 if (bus_set_resource(dev, SYS_RES_IOPORT, 0, ports[i],
154 if (aic_isa_alloc_resources(dev))
158 aic_isa_release_resources(dev);
165 aic_isa_release_resources(dev);
166 if (isa_get_irq(dev) == -1)
167 bus_set_resource(dev, SYS_RES_IRQ, 0, PORTA_IRQ(porta), 1);
168 if ((aic->flags & AIC_DMA_ENABLE) && isa_get_drq(dev) == -1)
169 bus_set_resource(dev, SYS_RES_DRQ, 0, PORTA_DRQ(porta), 1);
170 device_set_desc(dev, "Adaptec 6260/6360 SCSI controller");
175 aic_isa_attach(device_t dev)
177 struct aic_isa_softc *sc = device_get_softc(dev);
181 error = aic_isa_alloc_resources(dev);
183 device_printf(dev, "resource allocation failed\n");
189 device_printf(dev, "attach failed\n");
190 aic_isa_release_resources(dev);
194 error = bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_CAM | INTR_ENTROPY |
197 device_printf(dev, "failed to register interrupt handler\n");
198 aic_isa_release_resources(dev);
205 aic_isa_detach(device_t dev)
207 struct aic_isa_softc *sc = device_get_softc(dev);
213 device_printf(dev, "detach failed\n");
217 error = bus_teardown_intr(dev, sc->sc_irq, sc->sc_ih);
219 device_printf(dev, "failed to unregister interrupt handler\n");
222 aic_isa_release_resources(dev);