Deleted Added
full compact
tw_osl_freebsd.c (169452) tw_osl_freebsd.c (172496)
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 *
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 169452 2007-05-10 15:36:58Z scottl $
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
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
37 */
38
39
40/*
41 * FreeBSD specific functions not related to CAM, and other
42 * miscellaneous functions.
43 */
44

--- 231 unchanged lines hidden (view full) ---

276 sc->bus_dev = dev;
277 sc->device_id = pci_get_device(dev);
278
279 /* Initialize the mutexes right here. */
280 sc->io_lock = &(sc->io_lock_handle);
281 mtx_init(sc->io_lock, "tw_osl_io_lock", NULL, MTX_SPIN);
282 sc->q_lock = &(sc->q_lock_handle);
283 mtx_init(sc->q_lock, "tw_osl_q_lock", NULL, MTX_SPIN);
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);
284
285 sysctl_ctx_init(&sc->sysctl_ctxt);
286 sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctxt,
287 SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
288 device_get_nameunit(dev), CTLFLAG_RD, 0, "");
289 if (sc->sysctl_tree == NULL) {
290 tw_osli_printf(sc, "error = %d",
291 TW_CL_SEVERITY_ERROR_STRING,

--- 62 unchanged lines hidden (view full) ---

354 TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
355 0x2003,
356 "Can't allocate interrupt",
357 ENXIO);
358 tw_osli_free_resources(sc);
359 return(ENXIO);
360 }
361 if ((error = bus_setup_intr(sc->bus_dev, sc->irq_res,
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,
362 INTR_TYPE_CAM,
363#ifdef TW_OSLI_DEFERRED_INTR_USED
365#ifdef TW_OSLI_DEFERRED_INTR_USED
366 INTR_TYPE_CAM | INTR_FAST,
364 twa_pci_intr_fast, NULL,
365#else
367 twa_pci_intr_fast, NULL,
368#else
369 INTR_TYPE_CAM | INTR_MPSAFE,
366 NULL, twa_pci_intr,
367#endif
368 sc, &sc->intr_handle))) {
369 tw_osli_printf(sc, "error = %d",
370 TW_CL_SEVERITY_ERROR_STRING,
371 TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
372 0x2004,
373 "Can't set up interrupt",

--- 498 unchanged lines hidden (view full) ---

872 */
873static int
874twa_pci_intr_fast(TW_VOID *arg)
875{
876 struct twa_softc *sc = (struct twa_softc *)arg;
877
878 tw_osli_dbg_dprintf(10, sc, "entered");
879 if (tw_cl_interrupt(&(sc->ctlr_handle))) {
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))) {
880 tw_cl_deferred_interrupt(&(sc->ctlr_handle));
884 taskqueue_enqueue_fast(taskqueue_fast,
885 &(sc->deferred_intr_callback));
881 return(FILTER_HANDLED);
882 }
883 return(FILTER_STRAY);
884}
885#else
886/*
887 * Function name: twa_pci_intr
888 * Description: Interrupt handler. Wrapper for twa_interrupt.

--- 157 unchanged lines hidden (view full) ---

1046 * Should I check here if the timeout happened
1047 * because of yet another reset, and not do a
1048 * second reset?
1049 */
1050 tw_cl_reset_ctlr(&sc->ctlr_handle);
1051 /*
1052 * Don't touch req after a reset. It (and any
1053 * associated data) will already have been
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
1054 * freed by the callback. Just return.
1059 * unmapped by the callback.
1055 */
1056 user_buf->driver_pkt.os_status = error;
1060 */
1061 user_buf->driver_pkt.os_status = error;
1057 return(ETIMEDOUT);
1062 error = ETIMEDOUT;
1063 goto fw_passthru_err;
1058 }
1059 /*
1060 * Either the request got completed, or we were woken up by a
1061 * signal. Calculate the new timeout, in case it was the latter.
1062 */
1063 timeout = (end_time - tw_osl_get_local_time());
1064 }
1065

--- 592 unchanged lines hidden ---
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 ---