| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: auxio.c,v 1.25 2015/10/06 16:40:36 martin Exp $ */ | | 1 | /* $NetBSD: auxio.c,v 1.26 2016/10/14 11:33:08 mlelstv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2000, 2001, 2015 Matthew R. Green | | 4 | * Copyright (c) 2000, 2001, 2015 Matthew R. Green |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -22,27 +22,27 @@ | | | @@ -22,27 +22,27 @@ |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * AUXIO registers support on the sbus & ebus2, used for the floppy driver | | 30 | * AUXIO registers support on the sbus & ebus2, used for the floppy driver |
31 | * and to control the system LED, for the BLINK option. | | 31 | * and to control the system LED, for the BLINK option. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | __KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.25 2015/10/06 16:40:36 martin Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.26 2016/10/14 11:33:08 mlelstv Exp $"); |
36 | | | 36 | |
37 | #include "opt_auxio.h" | | 37 | #include "opt_auxio.h" |
38 | | | 38 | |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/kernel.h> | | 41 | #include <sys/kernel.h> |
42 | #include <sys/callout.h> | | 42 | #include <sys/callout.h> |
43 | #include <sys/errno.h> | | 43 | #include <sys/errno.h> |
44 | #include <sys/device.h> | | 44 | #include <sys/device.h> |
45 | #include <sys/malloc.h> | | 45 | #include <sys/malloc.h> |
46 | | | 46 | |
47 | #include <machine/autoconf.h> | | 47 | #include <machine/autoconf.h> |
48 | #include <machine/cpu.h> | | 48 | #include <machine/cpu.h> |
| @@ -110,37 +110,37 @@ auxio_blink(void *x) | | | @@ -110,37 +110,37 @@ auxio_blink(void *x) |
110 | * full cycle every second if completely idle (loadav = 0) | | 110 | * full cycle every second if completely idle (loadav = 0) |
111 | * full cycle every 2 seconds if loadav = 1 | | 111 | * full cycle every 2 seconds if loadav = 1 |
112 | * full cycle every 3 seconds if loadav = 2 | | 112 | * full cycle every 3 seconds if loadav = 2 |
113 | * etc. | | 113 | * etc. |
114 | */ | | 114 | */ |
115 | s = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1)); | | 115 | s = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1)); |
116 | callout_reset(&blink_ch, s, auxio_blink, sc); | | 116 | callout_reset(&blink_ch, s, auxio_blink, sc); |
117 | } | | 117 | } |
118 | #endif | | 118 | #endif |
119 | | | 119 | |
120 | void | | 120 | void |
121 | auxio_attach_common(struct auxio_softc *sc) | | 121 | auxio_attach_common(struct auxio_softc *sc) |
122 | { | | 122 | { |
123 | #ifdef BLINK | | | |
124 | static int do_once = 1; | | 123 | static int do_once = 1; |
125 | | | 124 | |
126 | /* only start one blinker */ | | 125 | /* only start one blinker */ |
127 | if (do_once) { | | 126 | if (do_once) { |
128 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH); | | 127 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH); |
| | | 128 | #ifdef BLINK |
129 | callout_init(&blink_ch, CALLOUT_MPSAFE); | | 129 | callout_init(&blink_ch, CALLOUT_MPSAFE); |
130 | auxio_blink(sc); | | 130 | auxio_blink(sc); |
| | | 131 | #endif |
131 | do_once = 0; | | 132 | do_once = 0; |
132 | } | | 133 | } |
133 | #endif | | | |
134 | printf("\n"); | | 134 | printf("\n"); |
135 | } | | 135 | } |
136 | | | 136 | |
137 | int | | 137 | int |
138 | auxio_fd_control(u_int32_t bits) | | 138 | auxio_fd_control(u_int32_t bits) |
139 | { | | 139 | { |
140 | struct auxio_softc *sc; | | 140 | struct auxio_softc *sc; |
141 | u_int32_t led; | | 141 | u_int32_t led; |
142 | | | 142 | |
143 | if (auxio_cd.cd_ndevs == 0) { | | 143 | if (auxio_cd.cd_ndevs == 0) { |
144 | return ENXIO; | | 144 | return ENXIO; |
145 | } | | 145 | } |
146 | | | 146 | |