Lines Matching +full:self +full:- +full:advertising

1 /*-
2 * SPDX-License-Identifier: BSD-4-Clause
5 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
16 * 3. All advertising materials mentioning features or use of this software
63 static int fwohci_pci_attach(device_t self);
64 static int fwohci_pci_detach(device_t self);
125 device_set_desc(dev, "Texas Instruments TSB43AB21/A/AI/A-EP"); in fwohci_pci_probe()
185 device_set_desc(dev, "Adaptec AHA-894x/AIC-5800"); in fwohci_pci_probe()
202 fwohci_pci_init(device_t self) in fwohci_pci_init() argument
207 cmd = pci_read_config(self, PCIR_COMMAND, 2); in fwohci_pci_init()
212 pci_write_config(self, PCIR_COMMAND, cmd, 2); in fwohci_pci_init()
214 latency = olatency = pci_read_config(self, PCIR_LATTIMER, 1); in fwohci_pci_init()
218 pci_write_config(self, PCIR_LATTIMER, latency, 1); in fwohci_pci_init()
221 cache_line = ocache_line = pci_read_config(self, PCIR_CACHELNSZ, 1); in fwohci_pci_init()
225 pci_write_config(self, PCIR_CACHELNSZ, cache_line, 1); in fwohci_pci_init()
229 device_printf(self, "latency timer %d -> %d.\n", in fwohci_pci_init()
231 device_printf(self, "cache size %d -> %d.\n", in fwohci_pci_init()
239 fwohci_pci_attach(device_t self) in fwohci_pci_attach() argument
241 fwohci_softc_t *sc = device_get_softc(self); in fwohci_pci_attach()
250 mtx_init(FW_GMTX(&sc->fc), "firewire", NULL, MTX_DEF); in fwohci_pci_attach()
251 fwohci_pci_init(self); in fwohci_pci_attach()
254 sc->bsr = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); in fwohci_pci_attach()
255 if (!sc->bsr) { in fwohci_pci_attach()
256 device_printf(self, "Could not map memory\n"); in fwohci_pci_attach()
260 sc->bst = rman_get_bustag(sc->bsr); in fwohci_pci_attach()
261 sc->bsh = rman_get_bushandle(sc->bsr); in fwohci_pci_attach()
264 sc->irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, in fwohci_pci_attach()
266 if (sc->irq_res == NULL) { in fwohci_pci_attach()
267 device_printf(self, "Could not allocate irq\n"); in fwohci_pci_attach()
268 fwohci_pci_detach(self); in fwohci_pci_attach()
272 err = bus_setup_intr(self, sc->irq_res, in fwohci_pci_attach()
275 sc, &sc->ih); in fwohci_pci_attach()
278 device_printf(self, "Could not setup irq, %d\n", err); in fwohci_pci_attach()
279 fwohci_pci_detach(self); in fwohci_pci_attach()
284 /*parent*/bus_get_dma_tag(self), in fwohci_pci_attach()
299 /*lockarg*/FW_GMTX(&sc->fc), in fwohci_pci_attach()
300 &sc->fc.dmat); in fwohci_pci_attach()
302 device_printf(self, "fwohci_pci_attach: Could not allocate DMA " in fwohci_pci_attach()
303 "tag - error %d\n", err); in fwohci_pci_attach()
304 fwohci_pci_detach(self); in fwohci_pci_attach()
308 err = fwohci_init(sc, self); in fwohci_pci_attach()
311 device_printf(self, "fwohci_init failed with err=%d\n", err); in fwohci_pci_attach()
312 fwohci_pci_detach(self); in fwohci_pci_attach()
317 bus_identify_children(self); in fwohci_pci_attach()
318 bus_attach_children(self); in fwohci_pci_attach()
324 fwohci_pci_detach(device_t self) in fwohci_pci_detach() argument
326 fwohci_softc_t *sc = device_get_softc(self); in fwohci_pci_detach()
331 if (sc->bsr) in fwohci_pci_detach()
332 fwohci_stop(sc, self); in fwohci_pci_detach()
334 bus_generic_detach(self); in fwohci_pci_detach()
337 if (sc->bst && sc->bsh) in fwohci_pci_detach()
338 bus_space_write_4(sc->bst, sc->bsh, in fwohci_pci_detach()
341 if (sc->irq_res) { in fwohci_pci_detach()
343 if (sc->ih) { in fwohci_pci_detach()
344 err = bus_teardown_intr(self, sc->irq_res, sc->ih); in fwohci_pci_detach()
346 device_printf(self, in fwohci_pci_detach()
348 sc->ih = NULL; in fwohci_pci_detach()
350 bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res); in fwohci_pci_detach()
351 sc->irq_res = NULL; in fwohci_pci_detach()
354 if (sc->bsr) { in fwohci_pci_detach()
355 bus_release_resource(self, SYS_RES_MEMORY, PCI_CBMEM, sc->bsr); in fwohci_pci_detach()
356 sc->bsr = NULL; in fwohci_pci_detach()
357 sc->bst = 0; in fwohci_pci_detach()
358 sc->bsh = 0; in fwohci_pci_detach()
361 fwohci_detach(sc, self); in fwohci_pci_detach()
362 mtx_destroy(FW_GMTX(&sc->fc)); in fwohci_pci_detach()
414 sc->fc.bdev = child; in fwohci_pci_add_child()
415 device_set_ivars(child, &sc->fc); in fwohci_pci_add_child()
434 fwohci_poll(&sc->fc, 0, -1); in fwohci_pci_add_child()