| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: iop.c,v 1.83 2013/09/14 13:08:31 joerg Exp $ */ | | 1 | /* $NetBSD: iop.c,v 1.84 2013/10/17 21:16:12 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2000, 2001, 2002, 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2000, 2001, 2002, 2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * Support for I2O IOPs (intelligent I/O processors). | | 33 | * Support for I2O IOPs (intelligent I/O processors). |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | __KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.83 2013/09/14 13:08:31 joerg Exp $"); | | 37 | __KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.84 2013/10/17 21:16:12 christos Exp $"); |
38 | | | 38 | |
39 | #include "iop.h" | | 39 | #include "iop.h" |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/kernel.h> | | 43 | #include <sys/kernel.h> |
44 | #include <sys/device.h> | | 44 | #include <sys/device.h> |
45 | #include <sys/queue.h> | | 45 | #include <sys/queue.h> |
46 | #include <sys/proc.h> | | 46 | #include <sys/proc.h> |
47 | #include <sys/malloc.h> | | 47 | #include <sys/malloc.h> |
48 | #include <sys/ioctl.h> | | 48 | #include <sys/ioctl.h> |
49 | #include <sys/endian.h> | | 49 | #include <sys/endian.h> |
50 | #include <sys/conf.h> | | 50 | #include <sys/conf.h> |
| @@ -597,34 +597,32 @@ iop_config_interrupts(device_t self) | | | @@ -597,34 +597,32 @@ iop_config_interrupts(device_t self) |
597 | aprint_error_dev(sc->sc_dev, "unable to create reconfiguration thread (%d)", rv); | | 597 | aprint_error_dev(sc->sc_dev, "unable to create reconfiguration thread (%d)", rv); |
598 | return; | | 598 | return; |
599 | } | | 599 | } |
600 | } | | 600 | } |
601 | | | 601 | |
602 | /* | | 602 | /* |
603 | * Reconfiguration thread; listens for LCT change notification, and | | 603 | * Reconfiguration thread; listens for LCT change notification, and |
604 | * initiates re-configuration if received. | | 604 | * initiates re-configuration if received. |
605 | */ | | 605 | */ |
606 | static void | | 606 | static void |
607 | iop_reconf_thread(void *cookie) | | 607 | iop_reconf_thread(void *cookie) |
608 | { | | 608 | { |
609 | struct iop_softc *sc; | | 609 | struct iop_softc *sc; |
610 | struct lwp *l; | | | |
611 | struct i2o_lct lct; | | 610 | struct i2o_lct lct; |
612 | u_int32_t chgind; | | 611 | u_int32_t chgind; |
613 | int rv; | | 612 | int rv; |
614 | | | 613 | |
615 | sc = cookie; | | 614 | sc = cookie; |
616 | chgind = sc->sc_chgind + 1; | | 615 | chgind = sc->sc_chgind + 1; |
617 | l = curlwp; | | | |
618 | | | 616 | |
619 | for (;;) { | | 617 | for (;;) { |
620 | DPRINTF(("%s: async reconfig: requested 0x%08x\n", | | 618 | DPRINTF(("%s: async reconfig: requested 0x%08x\n", |
621 | device_xname(sc->sc_dev), chgind)); | | 619 | device_xname(sc->sc_dev), chgind)); |
622 | | | 620 | |
623 | rv = iop_lct_get0(sc, &lct, sizeof(lct), chgind); | | 621 | rv = iop_lct_get0(sc, &lct, sizeof(lct), chgind); |
624 | | | 622 | |
625 | DPRINTF(("%s: async reconfig: notified (0x%08x, %d)\n", | | 623 | DPRINTF(("%s: async reconfig: notified (0x%08x, %d)\n", |
626 | device_xname(sc->sc_dev), le32toh(lct.changeindicator), rv)); | | 624 | device_xname(sc->sc_dev), le32toh(lct.changeindicator), rv)); |
627 | | | 625 | |
628 | mutex_enter(&sc->sc_conflock); | | 626 | mutex_enter(&sc->sc_conflock); |
629 | if (rv == 0) { | | 627 | if (rv == 0) { |
630 | iop_reconfigure(sc, le32toh(lct.changeindicator)); | | 628 | iop_reconfigure(sc, le32toh(lct.changeindicator)); |
| @@ -2229,31 +2227,33 @@ iop_msg_wait(struct iop_softc *sc, struc | | | @@ -2229,31 +2227,33 @@ iop_msg_wait(struct iop_softc *sc, struc |
2229 | | | 2227 | |
2230 | mutex_spin_enter(&sc->sc_intrlock); | | 2228 | mutex_spin_enter(&sc->sc_intrlock); |
2231 | if ((im->im_flags & IM_REPLIED) != 0) { | | 2229 | if ((im->im_flags & IM_REPLIED) != 0) { |
2232 | mutex_spin_exit(&sc->sc_intrlock); | | 2230 | mutex_spin_exit(&sc->sc_intrlock); |
2233 | return; | | 2231 | return; |
2234 | } | | 2232 | } |
2235 | rv = cv_timedwait(&im->im_cv, &sc->sc_intrlock, mstohz(timo)); | | 2233 | rv = cv_timedwait(&im->im_cv, &sc->sc_intrlock, mstohz(timo)); |
2236 | mutex_spin_exit(&sc->sc_intrlock); | | 2234 | mutex_spin_exit(&sc->sc_intrlock); |
2237 | | | 2235 | |
2238 | #ifdef I2ODEBUG | | 2236 | #ifdef I2ODEBUG |
2239 | if (rv != 0) { | | 2237 | if (rv != 0) { |
2240 | printf("iop_msg_wait: tsleep() == %d\n", rv); | | 2238 | printf("iop_msg_wait: tsleep() == %d\n", rv); |
2241 | if (iop_status_get(sc, 0) != 0) | | 2239 | if (iop_status_get(sc, 0) != 0) |
2242 | printf("iop_msg_wait: unable to retrieve status\n"); | | 2240 | printf("%s: unable to retrieve status\n", __func__); |
2243 | else | | 2241 | else |
2244 | printf("iop_msg_wait: IOP state = %d\n", | | 2242 | printf("%s: IOP state = %d\n", __func__, |
2245 | (le32toh(sc->sc_status.segnumber) >> 16) & 0xff); | | 2243 | (le32toh(sc->sc_status.segnumber) >> 16) & 0xff); |
2246 | } | | 2244 | } |
| | | 2245 | #else |
| | | 2246 | __USE(rv); |
2247 | #endif | | 2247 | #endif |
2248 | } | | 2248 | } |
2249 | | | 2249 | |
2250 | /* | | 2250 | /* |
2251 | * Release an unused message frame back to the IOP's inbound fifo. | | 2251 | * Release an unused message frame back to the IOP's inbound fifo. |
2252 | */ | | 2252 | */ |
2253 | static void | | 2253 | static void |
2254 | iop_release_mfa(struct iop_softc *sc, u_int32_t mfa) | | 2254 | iop_release_mfa(struct iop_softc *sc, u_int32_t mfa) |
2255 | { | | 2255 | { |
2256 | | | 2256 | |
2257 | /* Use the frame to issue a no-op. */ | | 2257 | /* Use the frame to issue a no-op. */ |
2258 | iop_outl_msg(sc, mfa, I2O_VERSION_11 | (4 << 16)); | | 2258 | iop_outl_msg(sc, mfa, I2O_VERSION_11 | (4 << 16)); |
2259 | iop_outl_msg(sc, mfa + 4, I2O_MSGFUNC(I2O_TID_IOP, I2O_UTIL_NOP)); | | 2259 | iop_outl_msg(sc, mfa + 4, I2O_MSGFUNC(I2O_TID_IOP, I2O_UTIL_NOP)); |