Lines Matching refs:dev

66 ata_pci_probe(device_t dev)  in ata_pci_probe()  argument
68 if (resource_disabled("atapci", device_get_unit(dev))) in ata_pci_probe()
71 if (pci_get_class(dev) != PCIC_STORAGE) in ata_pci_probe()
75 if (pci_get_subclass(dev) == PCIS_STORAGE_SATA) { in ata_pci_probe()
76 if (!ata_ahci_ident(dev)) in ata_pci_probe()
81 switch (pci_get_vendor(dev)) { in ata_pci_probe()
83 if (!ata_acard_ident(dev)) in ata_pci_probe()
87 if (!ata_ali_ident(dev)) in ata_pci_probe()
91 if (!ata_adaptec_ident(dev)) in ata_pci_probe()
95 if (!ata_amd_ident(dev)) in ata_pci_probe()
99 if (!ata_ati_ident(dev)) in ata_pci_probe()
103 if (!ata_cyrix_ident(dev)) in ata_pci_probe()
107 if (!ata_cypress_ident(dev)) in ata_pci_probe()
111 if (!ata_highpoint_ident(dev)) in ata_pci_probe()
115 if (!ata_intel_ident(dev)) in ata_pci_probe()
119 if (!ata_ite_ident(dev)) in ata_pci_probe()
123 if (!ata_jmicron_ident(dev)) in ata_pci_probe()
127 if (!ata_marvell_ident(dev)) in ata_pci_probe()
131 if (!ata_national_ident(dev)) in ata_pci_probe()
135 if (!ata_netcell_ident(dev)) in ata_pci_probe()
139 if (!ata_nvidia_ident(dev)) in ata_pci_probe()
143 if (!ata_promise_ident(dev)) in ata_pci_probe()
147 if (!ata_serverworks_ident(dev)) in ata_pci_probe()
151 if (!ata_sii_ident(dev)) in ata_pci_probe()
155 if (!ata_sis_ident(dev)) in ata_pci_probe()
159 if (!ata_via_ident(dev)) in ata_pci_probe()
163 if (!ata_cenatek_ident(dev)) in ata_pci_probe()
167 if (!ata_micron_ident(dev)) in ata_pci_probe()
173 if (pci_get_subclass(dev) == PCIS_STORAGE_IDE) { in ata_pci_probe()
177 vendor = pci_get_vendor(dev); in ata_pci_probe()
178 device = pci_get_device(dev); in ata_pci_probe()
179 subvendor = pci_get_subvendor(dev); in ata_pci_probe()
180 subdevice = pci_get_subdevice(dev); in ata_pci_probe()
187 if (!ata_generic_ident(dev)) in ata_pci_probe()
194 ata_pci_attach(device_t dev) in ata_pci_attach() argument
196 struct ata_pci_controller *ctlr = device_get_softc(dev); in ata_pci_attach()
201 ctlr->legacy = ata_legacy(dev); in ata_pci_attach()
202 if (ctlr->legacy || pci_read_config(dev, PCIR_BAR(2), 4) & IOMASK) in ata_pci_attach()
207 ctlr->dev = dev; in ata_pci_attach()
210 cmd = pci_read_config(dev, PCIR_COMMAND, 2); in ata_pci_attach()
212 pci_write_config(dev, PCIR_COMMAND, cmd | PCIM_CMD_BUSMASTEREN, 2); in ata_pci_attach()
213 cmd = pci_read_config(dev, PCIR_COMMAND, 2); in ata_pci_attach()
220 ctlr->r_res1 = bus_alloc_resource_any(dev, ctlr->r_type1, &ctlr->r_rid1, in ata_pci_attach()
226 if (ctlr->chipinit(dev)) in ata_pci_attach()
233 device_add_child(dev, "ata", unit); in ata_pci_attach()
242 device_add_child(dev, "ata", freeunit); in ata_pci_attach()
244 bus_generic_attach(dev); in ata_pci_attach()
249 ata_pci_detach(device_t dev) in ata_pci_detach() argument
251 struct ata_pci_controller *ctlr = device_get_softc(dev); in ata_pci_detach()
256 if (!device_get_children(dev, &children, &nchildren)) { in ata_pci_detach()
258 device_delete_child(dev, children[i]); in ata_pci_detach()
263 bus_teardown_intr(dev, ctlr->r_irq, ctlr->handle); in ata_pci_detach()
264 bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ctlr->r_irq); in ata_pci_detach()
268 bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2); in ata_pci_detach()
272 bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1); in ata_pci_detach()
280 ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, in ata_pci_alloc_resource() argument
283 struct ata_pci_controller *controller = device_get_softc(dev); in ata_pci_alloc_resource()
297 res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, in ata_pci_alloc_resource()
309 res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, in ata_pci_alloc_resource()
320 res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, in ata_pci_alloc_resource()
331 ata_pci_release_resource(device_t dev, device_t child, int type, int rid, in ata_pci_release_resource() argument
334 struct ata_pci_controller *controller = device_get_softc(dev); in ata_pci_release_resource()
340 return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, in ata_pci_release_resource()
346 return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, in ata_pci_release_resource()
359 return BUS_RELEASE_RESOURCE(device_get_parent(dev), child, in ata_pci_release_resource()
369 ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, in ata_pci_setup_intr() argument
373 struct ata_pci_controller *controller = device_get_softc(dev); in ata_pci_setup_intr()
376 return BUS_SETUP_INTR(device_get_parent(dev), child, irq, in ata_pci_setup_intr()
380 struct ata_pci_controller *controller = device_get_softc(dev); in ata_pci_setup_intr()
391 ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, in ata_pci_teardown_intr() argument
394 struct ata_pci_controller *controller = device_get_softc(dev); in ata_pci_teardown_intr()
397 return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie); in ata_pci_teardown_intr()
400 struct ata_pci_controller *controller = device_get_softc(dev); in ata_pci_teardown_intr()
410 ata_pci_allocate(device_t dev) in ata_pci_allocate() argument
412 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_pci_allocate()
413 struct ata_channel *ch = device_get_softc(dev); in ata_pci_allocate()
418 if (!(io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE))) in ata_pci_allocate()
422 if (!(ctlio = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,RF_ACTIVE))){ in ata_pci_allocate()
423 bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); in ata_pci_allocate()
434 ata_default_registers(dev); in ata_pci_allocate()
442 ata_pci_hw(dev); in ata_pci_allocate()
447 ata_pci_status(device_t dev) in ata_pci_status() argument
450 device_get_softc(device_get_parent(dev)); in ata_pci_status()
451 struct ata_channel *ch = device_get_softc(dev); in ata_pci_status()
487 ata_pci_hw(device_t dev) in ata_pci_hw() argument
489 struct ata_channel *ch = device_get_softc(dev); in ata_pci_hw()
491 ata_generic_hw(dev); in ata_pci_hw()
496 ata_pci_dmastart(device_t dev) in ata_pci_dmastart() argument
498 struct ata_channel *ch = device_get_softc(device_get_parent(dev)); in ata_pci_dmastart()
522 ata_pci_dmastop(device_t dev) in ata_pci_dmastop() argument
524 struct ata_channel *ch = device_get_softc(device_get_parent(dev)); in ata_pci_dmastop()
536 ata_pci_dmareset(device_t dev) in ata_pci_dmareset() argument
538 struct ata_channel *ch = device_get_softc(dev); in ata_pci_dmareset()
544 ch->dma->unload(dev); in ata_pci_dmareset()
548 ata_pci_dmainit(device_t dev) in ata_pci_dmainit() argument
550 struct ata_channel *ch = device_get_softc(dev); in ata_pci_dmainit()
552 ata_dmainit(dev); in ata_pci_dmainit()
564 ata_legacy(device_t dev) in ata_legacy() argument
566 return (((pci_read_config(dev, PCIR_PROGIF, 1)&PCIP_STORAGE_IDE_MASTERDEV)&& in ata_legacy()
567 ((pci_read_config(dev, PCIR_PROGIF, 1) & in ata_legacy()
570 (!pci_read_config(dev, PCIR_BAR(0), 4) && in ata_legacy()
571 !pci_read_config(dev, PCIR_BAR(1), 4) && in ata_legacy()
572 !pci_read_config(dev, PCIR_BAR(2), 4) && in ata_legacy()
573 !pci_read_config(dev, PCIR_BAR(3), 4) && in ata_legacy()
574 !pci_read_config(dev, PCIR_BAR(5), 4))); in ata_legacy()
591 ata_setup_interrupt(device_t dev, void *intr_func) in ata_setup_interrupt() argument
593 struct ata_pci_controller *ctlr = device_get_softc(dev); in ata_setup_interrupt()
597 if (!(ctlr->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in ata_setup_interrupt()
599 device_printf(dev, "unable to map interrupt\n"); in ata_setup_interrupt()
602 if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS, in ata_setup_interrupt()
604 device_printf(dev, "unable to setup interrupt\n"); in ata_setup_interrupt()
605 bus_release_resource(dev, SYS_RES_IRQ, rid, ctlr->r_irq); in ata_setup_interrupt()
614 ata_teardown_interrupt(device_t dev) in ata_teardown_interrupt() argument
616 struct ata_pci_controller *ctlr = device_get_softc(dev); in ata_teardown_interrupt()
620 bus_teardown_intr(dev, ctlr->r_irq, ctlr->handle); in ata_teardown_interrupt()
621 bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ctlr->r_irq); in ata_teardown_interrupt()
628 ata_set_desc(device_t dev) in ata_set_desc() argument
630 struct ata_pci_controller *ctlr = device_get_softc(dev); in ata_set_desc()
634 ata_pcivendor2str(dev), ctlr->chip->text, in ata_set_desc()
636 device_set_desc_copy(dev, buffer); in ata_set_desc()
640 ata_match_chip(device_t dev, const struct ata_chip_id *index) in ata_match_chip() argument
643 if (pci_get_devid(dev) == index->chipid && in ata_match_chip()
644 pci_get_revid(dev) >= index->chiprev) in ata_match_chip()
652 ata_find_chip(device_t dev, const struct ata_chip_id *index, int slot) in ata_find_chip() argument
657 if (device_get_children(device_get_parent(dev), &children, &nchildren)) in ata_find_chip()
677 ata_check_80pin(device_t dev, int mode) in ata_check_80pin() argument
679 struct ata_device *atadev = device_get_softc(dev); in ata_check_80pin()
682 ata_print_cable(dev, "device"); in ata_check_80pin()
689 ata_pcivendor2str(device_t dev) in ata_pcivendor2str() argument
691 switch (pci_get_vendor(dev)) { in ata_pcivendor2str()
762 ata_pcichannel_probe(device_t dev) in ata_pcichannel_probe() argument
764 struct ata_channel *ch = device_get_softc(dev); in ata_pcichannel_probe()
773 device_get_children(device_get_parent(dev), &children, &count); in ata_pcichannel_probe()
775 if (children[i] == dev) in ata_pcichannel_probe()
781 device_set_desc_copy(dev, buffer); in ata_pcichannel_probe()
783 return ata_probe(dev); in ata_pcichannel_probe()
787 ata_pcichannel_attach(device_t dev) in ata_pcichannel_attach() argument
789 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_pcichannel_attach()
790 struct ata_channel *ch = device_get_softc(dev); in ata_pcichannel_attach()
794 ctlr->dmainit(dev); in ata_pcichannel_attach()
796 ch->dma->alloc(dev); in ata_pcichannel_attach()
798 if ((error = ctlr->allocate(dev))) { in ata_pcichannel_attach()
800 ch->dma->free(dev); in ata_pcichannel_attach()
804 return ata_attach(dev); in ata_pcichannel_attach()
808 ata_pcichannel_detach(device_t dev) in ata_pcichannel_detach() argument
810 struct ata_channel *ch = device_get_softc(dev); in ata_pcichannel_detach()
813 if ((error = ata_detach(dev))) in ata_pcichannel_detach()
817 ch->dma->free(dev); in ata_pcichannel_detach()
825 ata_pcichannel_locking(device_t dev, int mode) in ata_pcichannel_locking() argument
827 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_pcichannel_locking()
828 struct ata_channel *ch = device_get_softc(dev); in ata_pcichannel_locking()
831 return ctlr->locking(dev, mode); in ata_pcichannel_locking()
837 ata_pcichannel_reset(device_t dev) in ata_pcichannel_reset() argument
839 struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); in ata_pcichannel_reset()
840 struct ata_channel *ch = device_get_softc(dev); in ata_pcichannel_reset()
845 ch->dma->reset(dev); in ata_pcichannel_reset()
846 ch->dma->unload(dev); in ata_pcichannel_reset()
851 ctlr->reset(dev); in ata_pcichannel_reset()
853 ata_generic_reset(dev); in ata_pcichannel_reset()
857 ata_pcichannel_setmode(device_t parent, device_t dev) in ata_pcichannel_setmode() argument
859 struct ata_pci_controller *ctlr = device_get_softc(GRANDPARENT(dev)); in ata_pcichannel_setmode()
860 struct ata_device *atadev = device_get_softc(dev); in ata_pcichannel_setmode()
863 ctlr->setmode(dev, ATA_PIO_MAX); in ata_pcichannel_setmode()
865 ctlr->setmode(dev, mode); in ata_pcichannel_setmode()