Lines Matching refs:dev
28 __FBSDID("$FreeBSD: releng/11.0/sys/dev/ata/ata-cbus.c 296137 2016-02-27 03:38:01Z jhibbits $");
45 #include <dev/ata/ata-all.h>
66 ata_cbus_probe(device_t dev)
73 if (isa_get_vendorid(dev))
78 if (!(io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
84 if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) {
85 bus_set_resource(dev, SYS_RES_IOPORT, rid,
91 if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) {
92 bus_set_resource(dev, SYS_RES_IOPORT, rid,
96 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
101 ata_cbus_attach(device_t dev)
103 struct ata_cbus_controller *ctlr = device_get_softc(dev);
109 if (!(ctlr->io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
115 bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
118 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
123 if (!(ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
126 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
127 bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio);
132 if (!(ctlr->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
134 device_printf(dev, "unable to alloc interrupt\n");
135 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
136 bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio);
137 bus_release_resource(dev, SYS_RES_IOPORT,
142 if ((bus_setup_intr(dev, ctlr->irq, ATA_INTR_FLAGS,
144 device_printf(dev, "unable to setup interrupt\n");
145 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
146 bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio);
147 bus_release_resource(dev, SYS_RES_IOPORT,
149 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IRQ_RID, ctlr->irq);
155 device_printf(dev, "second channel ignored\n");
158 child = device_add_child(dev, "ata", unit);
160 device_printf(dev, "failed to add ata child device\n");
165 bus_generic_attach(dev);
170 ata_cbus_alloc_resource(device_t dev, device_t child, int type, int *rid,
174 struct ata_cbus_controller *ctlr = device_get_softc(dev);
190 ata_cbus_setup_intr(device_t dev, device_t child, struct resource *irq,
194 struct ata_cbus_controller *controller = device_get_softc(dev);
209 ata_cbus_print_child(device_t dev, device_t child)
214 retval += bus_print_child_header(dev, child);
216 retval += bus_print_child_footer(dev, child);
259 ata_cbuschannel_probe(device_t dev)
263 sprintf(buffer, "ATA channel %d", (int)(intptr_t)device_get_ivars(dev));
264 device_set_desc_copy(dev, buffer);
266 return ata_probe(dev);
270 ata_cbuschannel_attach(device_t dev)
272 struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(dev));
273 struct ata_channel *ch = device_get_softc(dev);
280 ch->unit = (intptr_t)device_get_ivars(dev);
289 ata_default_registers(dev);
293 ata_generic_hw(dev);
295 return ata_attach(dev);
299 ata_cbuschannel_detach(device_t dev)
301 struct ata_channel *ch = device_get_softc(dev);
307 return ata_detach(dev);
311 ata_cbuschannel_suspend(device_t dev)
313 struct ata_channel *ch = device_get_softc(dev);
318 return ata_suspend(dev);
322 ata_cbuschannel_resume(device_t dev)
324 struct ata_channel *ch = device_get_softc(dev);
329 return ata_resume(dev);