fwohci_pci.c (168099) | fwohci_pci.c (170374) |
---|---|
1/*- 2 * Copyright (c) 2003 Hidetoshi Shimokawa 3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 17 unchanged lines hidden (view full) --- 26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 * POSSIBILITY OF SUCH DAMAGE. 33 * | 1/*- 2 * Copyright (c) 2003 Hidetoshi Shimokawa 3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 17 unchanged lines hidden (view full) --- 26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 * POSSIBILITY OF SUCH DAMAGE. 33 * |
34 * $FreeBSD: head/sys/dev/firewire/fwohci_pci.c 168099 2007-03-30 22:25:26Z simokawa $ | 34 * $FreeBSD: head/sys/dev/firewire/fwohci_pci.c 170374 2007-06-06 14:31:36Z simokawa $ |
35 */ 36 37#define BOUNCE_BUFFER_TEST 0 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/module.h> --- 254 unchanged lines hidden (view full) --- 297 } 298#endif 299 300#if 0 301 if (bootverbose) 302 firewire_debug = bootverbose; 303#endif 304 | 35 */ 36 37#define BOUNCE_BUFFER_TEST 0 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/module.h> --- 254 unchanged lines hidden (view full) --- 297 } 298#endif 299 300#if 0 301 if (bootverbose) 302 firewire_debug = bootverbose; 303#endif 304 |
305 mtx_init(FW_GMTX(&sc->fc), "firewire", NULL, MTX_DEF); |
|
305 fwohci_pci_init(self); 306 307 rid = PCI_CBMEM; 308#if __FreeBSD_version >= 502109 309 sc->bsr = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); 310#else 311 sc->bsr = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, 312 0, ~0, 1, RF_ACTIVE); --- 17 unchanged lines hidden (view full) --- 330 if (sc->irq_res == NULL) { 331 device_printf(self, "Could not allocate irq\n"); 332 fwohci_pci_detach(self); 333 return ENXIO; 334 } 335 336 337 err = bus_setup_intr(self, sc->irq_res, | 306 fwohci_pci_init(self); 307 308 rid = PCI_CBMEM; 309#if __FreeBSD_version >= 502109 310 sc->bsr = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); 311#else 312 sc->bsr = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, 313 0, ~0, 1, RF_ACTIVE); --- 17 unchanged lines hidden (view full) --- 331 if (sc->irq_res == NULL) { 332 device_printf(self, "Could not allocate irq\n"); 333 fwohci_pci_detach(self); 334 return ENXIO; 335 } 336 337 338 err = bus_setup_intr(self, sc->irq_res, |
338#if FWOHCI_TASKQUEUE | |
339 INTR_TYPE_NET | INTR_MPSAFE, | 339 INTR_TYPE_NET | INTR_MPSAFE, |
340#if FWOHCI_INTFILT 341 fwohci_filt, NULL, sc, &sc->ih); |
|
340#else | 342#else |
341 INTR_TYPE_NET, 342#endif | |
343 NULL, (driver_intr_t *) fwohci_intr, sc, &sc->ih); | 343 NULL, (driver_intr_t *) fwohci_intr, sc, &sc->ih); |
344#endif |
|
344#if defined(__DragonFly__) || __FreeBSD_version < 500000 345 /* XXX splcam() should mask this irq for sbp.c*/ 346 err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_CAM, 347 (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_cam); 348 /* XXX splbio() should mask this irq for physio()/fwmem_strategy() */ 349 err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO, 350 (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_bio); 351#endif --- 19 unchanged lines hidden (view full) --- 371 /*highaddr*/BUS_SPACE_MAXADDR, 372 /*filter*/NULL, /*filterarg*/NULL, 373 /*maxsize*/0x100000, 374 /*nsegments*/0x20, 375 /*maxsegsz*/0x8000, 376 /*flags*/BUS_DMA_ALLOCNOW, 377#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 378 /*lockfunc*/busdma_lock_mutex, | 345#if defined(__DragonFly__) || __FreeBSD_version < 500000 346 /* XXX splcam() should mask this irq for sbp.c*/ 347 err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_CAM, 348 (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_cam); 349 /* XXX splbio() should mask this irq for physio()/fwmem_strategy() */ 350 err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO, 351 (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_bio); 352#endif --- 19 unchanged lines hidden (view full) --- 372 /*highaddr*/BUS_SPACE_MAXADDR, 373 /*filter*/NULL, /*filterarg*/NULL, 374 /*maxsize*/0x100000, 375 /*nsegments*/0x20, 376 /*maxsegsz*/0x8000, 377 /*flags*/BUS_DMA_ALLOCNOW, 378#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 379 /*lockfunc*/busdma_lock_mutex, |
379 /*lockarg*/&Giant, | 380 /*lockarg*/FW_GMTX(&sc->fc), |
380#endif 381 &sc->fc.dmat); 382 if (err != 0) { 383 printf("fwohci_pci_attach: Could not allocate DMA tag " 384 "- error %d\n", err); 385 return (ENOMEM); 386 } 387 --- 55 unchanged lines hidden (view full) --- 443 if (sc->bsr) { 444 bus_release_resource(self, SYS_RES_MEMORY,PCI_CBMEM,sc->bsr); 445 sc->bsr = NULL; 446 sc->bst = 0; 447 sc->bsh = 0; 448 } 449 450 fwohci_detach(sc, self); | 381#endif 382 &sc->fc.dmat); 383 if (err != 0) { 384 printf("fwohci_pci_attach: Could not allocate DMA tag " 385 "- error %d\n", err); 386 return (ENOMEM); 387 } 388 --- 55 unchanged lines hidden (view full) --- 444 if (sc->bsr) { 445 bus_release_resource(self, SYS_RES_MEMORY,PCI_CBMEM,sc->bsr); 446 sc->bsr = NULL; 447 sc->bst = 0; 448 sc->bsh = 0; 449 } 450 451 fwohci_detach(sc, self); |
452 mtx_destroy(FW_GMTX(&sc->fc)); |
|
451 splx(s); 452 453 return 0; 454} 455 456static int 457fwohci_pci_suspend(device_t dev) 458{ --- 28 unchanged lines hidden (view full) --- 487 return 0; 488} 489 490static device_t 491fwohci_pci_add_child(device_t dev, int order, const char *name, int unit) 492{ 493 struct fwohci_softc *sc; 494 device_t child; | 453 splx(s); 454 455 return 0; 456} 457 458static int 459fwohci_pci_suspend(device_t dev) 460{ --- 28 unchanged lines hidden (view full) --- 489 return 0; 490} 491 492static device_t 493fwohci_pci_add_child(device_t dev, int order, const char *name, int unit) 494{ 495 struct fwohci_softc *sc; 496 device_t child; |
495 int s, err = 0; | 497 int err = 0; |
496 497 sc = (struct fwohci_softc *)device_get_softc(dev); 498 child = device_add_child(dev, name, unit); 499 if (child == NULL) 500 return (child); 501 502 sc->fc.bdev = child; 503 device_set_ivars(child, (void *)&sc->fc); --- 7 unchanged lines hidden (view full) --- 511 return NULL; 512 } 513 514 /* XXX 515 * Clear the bus reset event flag to start transactions even when 516 * interrupt is disabled during the boot process. 517 */ 518 if (cold) { | 498 499 sc = (struct fwohci_softc *)device_get_softc(dev); 500 child = device_add_child(dev, name, unit); 501 if (child == NULL) 502 return (child); 503 504 sc->fc.bdev = child; 505 device_set_ivars(child, (void *)&sc->fc); --- 7 unchanged lines hidden (view full) --- 513 return NULL; 514 } 515 516 /* XXX 517 * Clear the bus reset event flag to start transactions even when 518 * interrupt is disabled during the boot process. 519 */ 520 if (cold) { |
521 int s; |
|
519 DELAY(250); /* 2 cycles */ 520 s = splfw(); 521 fwohci_poll((void *)sc, 0, -1); 522 splx(s); 523 } 524 525 return (child); 526} --- 30 unchanged lines hidden --- | 522 DELAY(250); /* 2 cycles */ 523 s = splfw(); 524 fwohci_poll((void *)sc, 0, -1); 525 splx(s); 526 } 527 528 return (child); 529} --- 30 unchanged lines hidden --- |