1/* 2 * Copyright (c) 2004-07 Applied Micro Circuits Corporation. 3 * Copyright (c) 2004-05 Vinod Kashyap. 4 * Copyright (c) 2000 Michael Smith 5 * Copyright (c) 2000 BSDi 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/sys/dev/twa/tw_osl_freebsd.c 172496 2007-10-09 17:43:57Z scottl $ |
30 */ 31 32/* 33 * AMCC'S 3ware driver for 9000 series storage controllers. 34 * 35 * Author: Vinod Kashyap 36 * Modifications by: Adam Radford |
37 * Modifications by: Manjunath Ranganathaiah |
38 */ 39 40 41/* 42 * FreeBSD specific functions not related to CAM, and other 43 * miscellaneous functions. 44 */ 45 --- 231 unchanged lines hidden (view full) --- 277 sc->bus_dev = dev; 278 sc->device_id = pci_get_device(dev); 279 280 /* Initialize the mutexes right here. */ 281 sc->io_lock = &(sc->io_lock_handle); 282 mtx_init(sc->io_lock, "tw_osl_io_lock", NULL, MTX_SPIN); 283 sc->q_lock = &(sc->q_lock_handle); 284 mtx_init(sc->q_lock, "tw_osl_q_lock", NULL, MTX_SPIN); |
285 sc->sim_lock = &(sc->sim_lock_handle); 286 mtx_init(sc->sim_lock, "tw_osl_sim_lock", NULL, MTX_DEF | MTX_RECURSE); |
287 288 sysctl_ctx_init(&sc->sysctl_ctxt); 289 sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctxt, 290 SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO, 291 device_get_nameunit(dev), CTLFLAG_RD, 0, ""); 292 if (sc->sysctl_tree == NULL) { 293 tw_osli_printf(sc, "error = %d", 294 TW_CL_SEVERITY_ERROR_STRING, --- 62 unchanged lines hidden (view full) --- 357 TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, 358 0x2003, 359 "Can't allocate interrupt", 360 ENXIO); 361 tw_osli_free_resources(sc); 362 return(ENXIO); 363 } 364 if ((error = bus_setup_intr(sc->bus_dev, sc->irq_res, |
365#ifdef TW_OSLI_DEFERRED_INTR_USED |
366 INTR_TYPE_CAM | INTR_FAST, |
367 twa_pci_intr_fast, NULL, 368#else |
369 INTR_TYPE_CAM | INTR_MPSAFE, |
370 NULL, twa_pci_intr, 371#endif 372 sc, &sc->intr_handle))) { 373 tw_osli_printf(sc, "error = %d", 374 TW_CL_SEVERITY_ERROR_STRING, 375 TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, 376 0x2004, 377 "Can't set up interrupt", --- 498 unchanged lines hidden (view full) --- 876 */ 877static int 878twa_pci_intr_fast(TW_VOID *arg) 879{ 880 struct twa_softc *sc = (struct twa_softc *)arg; 881 882 tw_osli_dbg_dprintf(10, sc, "entered"); 883 if (tw_cl_interrupt(&(sc->ctlr_handle))) { |
884 taskqueue_enqueue_fast(taskqueue_fast, 885 &(sc->deferred_intr_callback)); |
886 return(FILTER_HANDLED); 887 } 888 return(FILTER_STRAY); 889} 890#else 891/* 892 * Function name: twa_pci_intr 893 * Description: Interrupt handler. Wrapper for twa_interrupt. --- 157 unchanged lines hidden (view full) --- 1051 * Should I check here if the timeout happened 1052 * because of yet another reset, and not do a 1053 * second reset? 1054 */ 1055 tw_cl_reset_ctlr(&sc->ctlr_handle); 1056 /* 1057 * Don't touch req after a reset. It (and any 1058 * associated data) will already have been |
1059 * unmapped by the callback. |
1060 */ 1061 user_buf->driver_pkt.os_status = error; |
1062 error = ETIMEDOUT; 1063 goto fw_passthru_err; |
1064 } 1065 /* 1066 * Either the request got completed, or we were woken up by a 1067 * signal. Calculate the new timeout, in case it was the latter. 1068 */ 1069 timeout = (end_time - tw_osl_get_local_time()); 1070 } 1071 --- 592 unchanged lines hidden --- |