sys: Fix various abuse of struct device internals. Will help to make struct device opaque later.diff -r1.22 -r1.23 src/share/man/man4/iop.4
(riastradh)
--- src/share/man/man4/iop.4 2017/07/03 21:30:58 1.22
+++ src/share/man/man4/iop.4 2022/02/12 03:24:34 1.23
--- src/sys/arch/arm/ep93xx/epcom.c 2021/11/21 08:44:28 1.34
+++ src/sys/arch/arm/ep93xx/epcom.c 2022/02/12 03:24:34 1.35
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: epcom.c,v 1.34 2021/11/21 08:44:28 skrll Exp $ */ | 1 | /* $NetBSD: epcom.c,v 1.35 2022/02/12 03:24:34 riastradh Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 1998, 1999, 2001, 2002, 2004 The NetBSD Foundation, Inc. | 3 | * Copyright (c) 1998, 1999, 2001, 2002, 2004 The NetBSD Foundation, Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * This code is derived from software contributed to The NetBSD Foundation | 6 | * This code is derived from software contributed to The NetBSD Foundation | |
7 | * by Jesse Off | 7 | * by Jesse Off | |
8 | * | 8 | * | |
9 | * This code is derived from software contributed to The NetBSD Foundation | 9 | * This code is derived from software contributed to The NetBSD Foundation | |
10 | * by Ichiro FUKUHARA and Naoto Shimazaki. | 10 | * by Ichiro FUKUHARA and Naoto Shimazaki. | |
11 | * | 11 | * | |
12 | * This code is derived from software contributed to The NetBSD Foundation | 12 | * This code is derived from software contributed to The NetBSD Foundation | |
13 | * by IWAMOTO Toshihiro. | 13 | * by IWAMOTO Toshihiro. | |
14 | * | 14 | * | |
@@ -63,27 +63,27 @@ | @@ -63,27 +63,27 @@ | |||
63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
64 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 64 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
65 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 65 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
66 | * SUCH DAMAGE. | 66 | * SUCH DAMAGE. | |
67 | * | 67 | * | |
68 | * @(#)com.c 7.5 (Berkeley) 5/16/91 | 68 | * @(#)com.c 7.5 (Berkeley) 5/16/91 | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | /* | 71 | /* | |
72 | * TODO: hardware flow control | 72 | * TODO: hardware flow control | |
73 | */ | 73 | */ | |
74 | 74 | |||
75 | #include <sys/cdefs.h> | 75 | #include <sys/cdefs.h> | |
76 | __KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.34 2021/11/21 08:44:28 skrll Exp $"); | 76 | __KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.35 2022/02/12 03:24:34 riastradh Exp $"); | |
77 | 77 | |||
78 | #include "opt_ddb.h" | 78 | #include "opt_ddb.h" | |
79 | #include "opt_kgdb.h" | 79 | #include "opt_kgdb.h" | |
80 | #include "epcom.h" | 80 | #include "epcom.h" | |
81 | 81 | |||
82 | #ifdef RND_COM | 82 | #ifdef RND_COM | |
83 | #include <sys/rndsource.h> | 83 | #include <sys/rndsource.h> | |
84 | #endif | 84 | #endif | |
85 | 85 | |||
86 | /* | 86 | /* | |
87 | * Override cnmagic(9) macro before including <sys/systm.h>. | 87 | * Override cnmagic(9) macro before including <sys/systm.h>. | |
88 | * We need to know if cn_check_magic triggered debugger, so set a flag. | 88 | * We need to know if cn_check_magic triggered debugger, so set a flag. | |
89 | * Callers of cn_check_magic must declare int cn_trapped = 0; | 89 | * Callers of cn_check_magic must declare int cn_trapped = 0; | |
@@ -250,27 +250,27 @@ epcom_attach_subr(struct epcom_softc *sc | @@ -250,27 +250,27 @@ epcom_attach_subr(struct epcom_softc *sc | |||
250 | cn_tab->cn_dev = makedev(maj, device_unit(sc->sc_dev)); | 250 | cn_tab->cn_dev = makedev(maj, device_unit(sc->sc_dev)); | |
251 | 251 | |||
252 | aprint_normal("%s: console\n", device_xname(sc->sc_dev)); | 252 | aprint_normal("%s: console\n", device_xname(sc->sc_dev)); | |
253 | } | 253 | } | |
254 | 254 | |||
255 | #ifdef KGDB | 255 | #ifdef KGDB | |
256 | /* | 256 | /* | |
257 | * Allow kgdb to "take over" this port. If this is | 257 | * Allow kgdb to "take over" this port. If this is | |
258 | * the kgdb device, it has exclusive use. | 258 | * the kgdb device, it has exclusive use. | |
259 | */ | 259 | */ | |
260 | if (sc->sc_iot == kgdb_sc.sc_iot && | 260 | if (sc->sc_iot == kgdb_sc.sc_iot && | |
261 | sc->sc_hwbase == kgdb_sc.sc_hwbase) { | 261 | sc->sc_hwbase == kgdb_sc.sc_hwbase) { | |
262 | SET(sc->sc_hwflags, COM_HW_KGDB); | 262 | SET(sc->sc_hwflags, COM_HW_KGDB); | |
263 | printf("%s: kgdb\n", sc->sc_dev.dv_xname); | 263 | device_printf(sc->sc_dev, "kgdb\n"); | |
264 | } | 264 | } | |
265 | #endif | 265 | #endif | |
266 | 266 | |||
267 | sc->sc_si = softint_establish(SOFTINT_SERIAL, epcomsoft, sc); | 267 | sc->sc_si = softint_establish(SOFTINT_SERIAL, epcomsoft, sc); | |
268 | 268 | |||
269 | #ifdef RND_COM | 269 | #ifdef RND_COM | |
270 | rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), | 270 | rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), | |
271 | RND_TYPE_TTY, RND_FLAG_DEFAULT); | 271 | RND_TYPE_TTY, RND_FLAG_DEFAULT); | |
272 | #endif | 272 | #endif | |
273 | 273 | |||
274 | /* if there are no enable/disable functions, assume the device | 274 | /* if there are no enable/disable functions, assume the device | |
275 | is always enabled */ | 275 | is always enabled */ | |
276 | if (!sc->enable) | 276 | if (!sc->enable) |
--- src/sys/arch/arm/imx/imx31_icu.c 2012/10/27 17:17:39 1.7
+++ src/sys/arch/arm/imx/imx31_icu.c 2022/02/12 03:24:34 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: imx31_icu.c,v 1.7 2012/10/27 17:17:39 chs Exp $ */ | 1 | /* $NetBSD: imx31_icu.c,v 1.8 2022/02/12 03:24:34 riastradh Exp $ */ | |
2 | /*- | 2 | /*- | |
3 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | 3 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * This code is derived from software contributed to The NetBSD Foundation | 6 | * This code is derived from software contributed to The NetBSD Foundation | |
7 | * by Matt Thomas. | 7 | * by Matt Thomas. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -18,27 +18,27 @@ | @@ -18,27 +18,27 @@ | |||
18 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 18 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
19 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 19 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
20 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 20 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
28 | * POSSIBILITY OF SUCH DAMAGE. | 28 | * POSSIBILITY OF SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | #include <sys/cdefs.h> | 30 | #include <sys/cdefs.h> | |
31 | __KERNEL_RCSID(0, "$NetBSD: imx31_icu.c,v 1.7 2012/10/27 17:17:39 chs Exp $"); | 31 | __KERNEL_RCSID(0, "$NetBSD: imx31_icu.c,v 1.8 2022/02/12 03:24:34 riastradh Exp $"); | |
32 | 32 | |||
33 | #define _INTR_PRIVATE | 33 | #define _INTR_PRIVATE | |
34 | 34 | |||
35 | #include "locators.h" | 35 | #include "locators.h" | |
36 | 36 | |||
37 | #include <sys/param.h> | 37 | #include <sys/param.h> | |
38 | #include <sys/evcnt.h> | 38 | #include <sys/evcnt.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | #include <sys/atomic.h> | 40 | #include <sys/atomic.h> | |
41 | 41 | |||
42 | #include <uvm/uvm_extern.h> | 42 | #include <uvm/uvm_extern.h> | |
43 | 43 | |||
44 | #include <machine/intr.h> | 44 | #include <machine/intr.h> | |
@@ -215,27 +215,27 @@ avic_match(device_t parent, cfdata_t sel | @@ -215,27 +215,27 @@ avic_match(device_t parent, cfdata_t sel | |||
215 | return 0; | 215 | return 0; | |
216 | 216 | |||
217 | return 1; | 217 | return 1; | |
218 | } | 218 | } | |
219 | 219 | |||
220 | void | 220 | void | |
221 | avic_attach(device_t parent, device_t self, void *aux) | 221 | avic_attach(device_t parent, device_t self, void *aux) | |
222 | { | 222 | { | |
223 | struct avic_softc * const avic = device_private(self); | 223 | struct avic_softc * const avic = device_private(self); | |
224 | struct ahb_attach_args * const ahba = aux; | 224 | struct ahb_attach_args * const ahba = aux; | |
225 | int error; | 225 | int error; | |
226 | 226 | |||
227 | KASSERT(ahba->ahba_irqbase != AHBCF_IRQBASE_DEFAULT); | 227 | KASSERT(ahba->ahba_irqbase != AHBCF_IRQBASE_DEFAULT); | |
228 | KASSERT(self->dv_unit == 0); | 228 | KASSERT(device_unit(self) == 0); | |
229 | 229 | |||
230 | if (ahba->ahba_size == AHBCF_SIZE_DEFAULT) | 230 | if (ahba->ahba_size == AHBCF_SIZE_DEFAULT) | |
231 | ahba->ahba_size = INTC_SIZE; | 231 | ahba->ahba_size = INTC_SIZE; | |
232 | 232 | |||
233 | avic->avic_memt = ahba->ahba_memt; | 233 | avic->avic_memt = ahba->ahba_memt; | |
234 | error = bus_space_map(avic->avic_memt, ahba->ahba_addr, ahba->ahba_size, | 234 | error = bus_space_map(avic->avic_memt, ahba->ahba_addr, ahba->ahba_size, | |
235 | 0, &avic->avic_memh); | 235 | 0, &avic->avic_memh); | |
236 | if (error) | 236 | if (error) | |
237 | panic("avic_attach: failed to map register %#lx-%#lx: %d", | 237 | panic("avic_attach: failed to map register %#lx-%#lx: %d", | |
238 | ahba->ahba_addr, ahba->ahba_addr + ahba->ahba_size - 1, | 238 | ahba->ahba_addr, ahba->ahba_addr + ahba->ahba_size - 1, | |
239 | error); | 239 | error); | |
240 | 240 | |||
241 | avic->avic_pic.pic_ops = &avic_pic_ops; | 241 | avic->avic_pic.pic_ops = &avic_pic_ops; |
--- src/sys/arch/arm/imx/imx51_tzic.c 2014/07/25 07:49:56 1.7
+++ src/sys/arch/arm/imx/imx51_tzic.c 2022/02/12 03:24:34 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: imx51_tzic.c,v 1.7 2014/07/25 07:49:56 hkenken Exp $ */ | 1 | /* $NetBSD: imx51_tzic.c,v 1.8 2022/02/12 03:24:34 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2010 SHIMIZU Ryo <ryo@nerv.org> | 4 | * Copyright (c) 2010 SHIMIZU Ryo <ryo@nerv.org> | |
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. | |
@@ -16,27 +16,27 @@ | @@ -16,27 +16,27 @@ | |||
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | #include <sys/cdefs.h> | 28 | #include <sys/cdefs.h> | |
29 | __KERNEL_RCSID(0, "$NetBSD: imx51_tzic.c,v 1.7 2014/07/25 07:49:56 hkenken Exp $"); | 29 | __KERNEL_RCSID(0, "$NetBSD: imx51_tzic.c,v 1.8 2022/02/12 03:24:34 riastradh Exp $"); | |
30 | 30 | |||
31 | #define _INTR_PRIVATE /* for arm/pic/picvar.h */ | 31 | #define _INTR_PRIVATE /* for arm/pic/picvar.h */ | |
32 | 32 | |||
33 | #include "opt_imx.h" | 33 | #include "opt_imx.h" | |
34 | #include "locators.h" | 34 | #include "locators.h" | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/evcnt.h> | 37 | #include <sys/evcnt.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | #include <sys/atomic.h> | 39 | #include <sys/atomic.h> | |
40 | 40 | |||
41 | #include <machine/intr.h> | 41 | #include <machine/intr.h> | |
42 | #include <sys/bus.h> | 42 | #include <sys/bus.h> | |
@@ -114,27 +114,27 @@ tzic_match(device_t parent, cfdata_t sel | @@ -114,27 +114,27 @@ tzic_match(device_t parent, cfdata_t sel | |||
114 | return 0; | 114 | return 0; | |
115 | 115 | |||
116 | return 1; | 116 | return 1; | |
117 | } | 117 | } | |
118 | 118 | |||
119 | void | 119 | void | |
120 | tzic_attach(device_t parent, device_t self, void *aux) | 120 | tzic_attach(device_t parent, device_t self, void *aux) | |
121 | { | 121 | { | |
122 | struct tzic_softc *tzic = device_private(self); | 122 | struct tzic_softc *tzic = device_private(self); | |
123 | struct axi_attach_args * const aa = aux; | 123 | struct axi_attach_args * const aa = aux; | |
124 | int error; | 124 | int error; | |
125 | 125 | |||
126 | KASSERT(aa->aa_irqbase != AXICF_IRQBASE_DEFAULT); | 126 | KASSERT(aa->aa_irqbase != AXICF_IRQBASE_DEFAULT); | |
127 | KASSERT(self->dv_unit == 0); | 127 | KASSERT(device_unit(self) == 0); | |
128 | 128 | |||
129 | aprint_normal(": TrustZone Interrupt Controller\n"); | 129 | aprint_normal(": TrustZone Interrupt Controller\n"); | |
130 | aprint_naive("\n"); | 130 | aprint_naive("\n"); | |
131 | 131 | |||
132 | tzic->sc_dev = self; | 132 | tzic->sc_dev = self; | |
133 | tzic->sc_iot = aa->aa_iot; | 133 | tzic->sc_iot = aa->aa_iot; | |
134 | 134 | |||
135 | tzic_softc = tzic; | 135 | tzic_softc = tzic; | |
136 | 136 | |||
137 | if (aa->aa_size == AXICF_SIZE_DEFAULT) | 137 | if (aa->aa_size == AXICF_SIZE_DEFAULT) | |
138 | aa->aa_size = TZIC_SIZE; | 138 | aa->aa_size = TZIC_SIZE; | |
139 | 139 | |||
140 | error = bus_space_map(tzic->sc_iot, aa->aa_addr, aa->aa_size, 0, &tzic->sc_ioh); | 140 | error = bus_space_map(tzic->sc_iot, aa->aa_addr, aa->aa_size, 0, &tzic->sc_ioh); |
--- src/sys/arch/arm/omap/Attic/omapl1x_psc.c 2013/10/02 16:48:26 1.1
+++ src/sys/arch/arm/omap/Attic/omapl1x_psc.c 2022/02/12 03:24:34 1.2
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
20 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 20 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
22 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 22 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
23 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 | */ | 24 | */ | |
25 | 25 | |||
26 | #include "opt_omapl1x.h" | 26 | #include "opt_omapl1x.h" | |
27 | 27 | |||
28 | #include <sys/cdefs.h> | 28 | #include <sys/cdefs.h> | |
29 | 29 | |||
30 | __KERNEL_RCSID(0, "$NetBSD: omapl1x_psc.c,v 1.1 2013/10/02 16:48:26 matt Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: omapl1x_psc.c,v 1.2 2022/02/12 03:24:34 riastradh Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/systm.h> | 33 | #include <sys/systm.h> | |
34 | #include <sys/device.h> | 34 | #include <sys/device.h> | |
35 | #include <sys/kernel.h> | 35 | #include <sys/kernel.h> | |
36 | #include <sys/bus.h> | 36 | #include <sys/bus.h> | |
37 | 37 | |||
38 | #include <arm/omap/omap_tipb.h> | 38 | #include <arm/omap/omap_tipb.h> | |
39 | #include <arm/omap/omapl1x_reg.h> | 39 | #include <arm/omap/omapl1x_reg.h> | |
40 | #include <arm/omap/omapl1x_misc.h> | 40 | #include <arm/omap/omapl1x_misc.h> | |
41 | 41 | |||
42 | typedef struct omapl1xpsc_softc { | 42 | typedef struct omapl1xpsc_softc { | |
43 | bus_space_tag_t sc_iot; /* Bus tag */ | 43 | bus_space_tag_t sc_iot; /* Bus tag */ | |
@@ -110,25 +110,25 @@ static int | @@ -110,25 +110,25 @@ static int | |||
110 | omapl1xpsc_match(struct device *parent, struct cfdata *cf, void *aux) | 110 | omapl1xpsc_match(struct device *parent, struct cfdata *cf, void *aux) | |
111 | { | 111 | { | |
112 | return 1; /* XXX */ | 112 | return 1; /* XXX */ | |
113 | } | 113 | } | |
114 | 114 | |||
115 | static void | 115 | static void | |
116 | omapl1xpsc_attach(device_t parent, device_t self, void *aux) | 116 | omapl1xpsc_attach(device_t parent, device_t self, void *aux) | |
117 | { | 117 | { | |
118 | struct tipb_attach_args *tipb = aux; | 118 | struct tipb_attach_args *tipb = aux; | |
119 | 119 | |||
120 | sc = device_private(self); | 120 | sc = device_private(self); | |
121 | 121 | |||
122 | sc->sc_iot = tipb->tipb_iot; | 122 | sc->sc_iot = tipb->tipb_iot; | |
123 | sc->sc_unit = self->dv_unit; | 123 | sc->sc_unit = device_unit(self); | |
124 | sc->sc_addr = tipb->tipb_addr; | 124 | sc->sc_addr = tipb->tipb_addr; | |
125 | sc->sc_size = tipb->tipb_size; | 125 | sc->sc_size = tipb->tipb_size; | |
126 | 126 | |||
127 | /* Map PSC registers */ | 127 | /* Map PSC registers */ | |
128 | if (bus_space_map(sc->sc_iot, sc->sc_addr, sc->sc_size, | 128 | if (bus_space_map(sc->sc_iot, sc->sc_addr, sc->sc_size, | |
129 | 0, &sc->sc_ioh)) { | 129 | 0, &sc->sc_ioh)) { | |
130 | aprint_error_dev(self, "can't map psc%d mem space\n", | 130 | aprint_error_dev(self, "can't map psc%d mem space\n", | |
131 | sc->sc_unit); | 131 | sc->sc_unit); | |
132 | return; | 132 | return; | |
133 | } | 133 | } | |
134 | } | 134 | } |
--- src/sys/arch/arm/omap/Attic/omapl1x_timer.c 2020/07/22 01:24:39 1.2
+++ src/sys/arch/arm/omap/Attic/omapl1x_timer.c 2022/02/12 03:24:34 1.3
@@ -15,27 +15,27 @@ | @@ -15,27 +15,27 @@ | |||
15 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | 15 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
16 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY | 16 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY | |
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
20 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 20 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
22 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 22 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
23 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 | */ | 24 | */ | |
25 | 25 | |||
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | 27 | |||
28 | __KERNEL_RCSID(0, "$NetBSD: omapl1x_timer.c,v 1.2 2020/07/22 01:24:39 msaitoh Exp $"); | 28 | __KERNEL_RCSID(0, "$NetBSD: omapl1x_timer.c,v 1.3 2022/02/12 03:24:34 riastradh Exp $"); | |
29 | 29 | |||
30 | #include "opt_timer.h" | 30 | #include "opt_timer.h" | |
31 | 31 | |||
32 | #include <sys/types.h> | 32 | #include <sys/types.h> | |
33 | #include <sys/param.h> | 33 | #include <sys/param.h> | |
34 | #include <sys/systm.h> | 34 | #include <sys/systm.h> | |
35 | #include <sys/kernel.h> | 35 | #include <sys/kernel.h> | |
36 | #include <sys/time.h> | 36 | #include <sys/time.h> | |
37 | #include <sys/timetc.h> | 37 | #include <sys/timetc.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | #include <sys/bus.h> | 39 | #include <sys/bus.h> | |
40 | 40 | |||
41 | #include <dev/clock_subr.h> | 41 | #include <dev/clock_subr.h> | |
@@ -426,27 +426,27 @@ tfprint (uint n, timer_factors_t *tfp) | @@ -426,27 +426,27 @@ tfprint (uint n, timer_factors_t *tfp) | |||
426 | 426 | |||
427 | static int | 427 | static int | |
428 | omapl1xtimer_match (device_t parent, struct cfdata *match, void *aux) | 428 | omapl1xtimer_match (device_t parent, struct cfdata *match, void *aux) | |
429 | { | 429 | { | |
430 | return 1; | 430 | return 1; | |
431 | } | 431 | } | |
432 | 432 | |||
433 | void | 433 | void | |
434 | omapl1xtimer_attach (device_t parent, device_t self, void *aux) | 434 | omapl1xtimer_attach (device_t parent, device_t self, void *aux) | |
435 | { | 435 | { | |
436 | struct omapl1xtmr_softc *sc = device_private(self); | 436 | struct omapl1xtmr_softc *sc = device_private(self); | |
437 | struct tipb_attach_args *tipb = aux; | 437 | struct tipb_attach_args *tipb = aux; | |
438 | 438 | |||
439 | sc->sc_timerno = self->dv_unit; | 439 | sc->sc_timerno = device_unit(self); | |
440 | sc->sc_iot = tipb->tipb_iot; | 440 | sc->sc_iot = tipb->tipb_iot; | |
441 | sc->sc_intr = tipb->tipb_intr; | 441 | sc->sc_intr = tipb->tipb_intr; | |
442 | sc->sc_addr = tipb->tipb_addr; | 442 | sc->sc_addr = tipb->tipb_addr; | |
443 | sc->sc_bot = 1; /* use the bottom timer in all cases */ | 443 | sc->sc_bot = 1; /* use the bottom timer in all cases */ | |
444 | sc->sc_size = OMAPL1X_TIMER_SIZE; | 444 | sc->sc_size = OMAPL1X_TIMER_SIZE; | |
445 | 445 | |||
446 | if (bus_space_map(sc->sc_iot, sc->sc_addr, sc->sc_size, 0, &sc->sc_ioh)) | 446 | if (bus_space_map(sc->sc_iot, sc->sc_addr, sc->sc_size, 0, &sc->sc_ioh)) | |
447 | panic("%s: Cannot map registers", device_xname(self)); | 447 | panic("%s: Cannot map registers", device_xname(self)); | |
448 | 448 | |||
449 | aprint_normal("\n"); | 449 | aprint_normal("\n"); | |
450 | aprint_naive("\n"); | 450 | aprint_naive("\n"); | |
451 | 451 | |||
452 | switch (sc->sc_timerno) { | 452 | switch (sc->sc_timerno) { |
--- src/sys/arch/evbmips/cavium/autoconf.c 2020/08/17 06:23:01 1.9
+++ src/sys/arch/evbmips/cavium/autoconf.c 2022/02/12 03:24:34 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: autoconf.c,v 1.9 2020/08/17 06:23:01 simonb Exp $ */ | 1 | /* $NetBSD: autoconf.c,v 1.10 2022/02/12 03:24:34 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2002 Wasabi Systems, Inc. | 4 | * Copyright 2002 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Simon Burge for Wasabi Systems, Inc. | 7 | * Written by Simon Burge for Wasabi Systems, Inc. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -26,27 +26,27 @@ | @@ -26,27 +26,27 @@ | |||
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | 28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | |
29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
35 | * POSSIBILITY OF SUCH DAMAGE. | 35 | * POSSIBILITY OF SUCH DAMAGE. | |
36 | */ | 36 | */ | |
37 | 37 | |||
38 | #include <sys/cdefs.h> | 38 | #include <sys/cdefs.h> | |
39 | __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2020/08/17 06:23:01 simonb Exp $"); | 39 | __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.10 2022/02/12 03:24:34 riastradh Exp $"); | |
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/buf.h> | 43 | #include <sys/buf.h> | |
44 | #include <sys/conf.h> | 44 | #include <sys/conf.h> | |
45 | #include <sys/device.h> | 45 | #include <sys/device.h> | |
46 | 46 | |||
47 | #include <net/if_ether.h> | 47 | #include <net/if_ether.h> | |
48 | 48 | |||
49 | #include <mips/cpu.h> | 49 | #include <mips/cpu.h> | |
50 | #include <mips/locore.h> | 50 | #include <mips/locore.h> | |
51 | 51 | |||
52 | #include <evbmips/cavium/octeon_uboot.h> | 52 | #include <evbmips/cavium/octeon_uboot.h> | |
@@ -162,27 +162,27 @@ prop_set_cnmac(device_t dev) | @@ -162,27 +162,27 @@ prop_set_cnmac(device_t dev) | |||
162 | enaddr[4] = (mac_lo >> 8) & 0xff; | 162 | enaddr[4] = (mac_lo >> 8) & 0xff; | |
163 | enaddr[5] = mac_lo & 0xff; | 163 | enaddr[5] = mac_lo & 0xff; | |
164 | pd = prop_data_create_copy(enaddr, ETHER_ADDR_LEN); | 164 | pd = prop_data_create_copy(enaddr, ETHER_ADDR_LEN); | |
165 | KASSERT(pd != NULL); | 165 | KASSERT(pd != NULL); | |
166 | prop_dictionary_set_and_rel(dict, "mac-address", pd); | 166 | prop_dictionary_set_and_rel(dict, "mac-address", pd); | |
167 | 167 | |||
168 | /* ethernet phy address */ | 168 | /* ethernet phy address */ | |
169 | switch (octeon_btinfo.obt_board_type) { | 169 | switch (octeon_btinfo.obt_board_type) { | |
170 | case BOARD_TYPE_UBIQUITI_E100: | 170 | case BOARD_TYPE_UBIQUITI_E100: | |
171 | case BOARD_TYPE_UBIQUITI_E120: | 171 | case BOARD_TYPE_UBIQUITI_E120: | |
172 | pn = prop_number_create_signed(7 - unit); | 172 | pn = prop_number_create_signed(7 - unit); | |
173 | break; | 173 | break; | |
174 | case BOARD_TYPE_UBIQUITI_E300: | 174 | case BOARD_TYPE_UBIQUITI_E300: | |
175 | pn = prop_number_create_signed(4 + dev->dv_unit); | 175 | pn = prop_number_create_signed(4 + device_unit(dev)); | |
176 | break; | 176 | break; | |
177 | default: | 177 | default: | |
178 | pn = prop_number_create_signed(-1); | 178 | pn = prop_number_create_signed(-1); | |
179 | break; | 179 | break; | |
180 | } | 180 | } | |
181 | KASSERT(pn != NULL); | 181 | KASSERT(pn != NULL); | |
182 | prop_dictionary_set_and_rel(dict, "phy-addr", pn); | 182 | prop_dictionary_set_and_rel(dict, "phy-addr", pn); | |
183 | } | 183 | } | |
184 | 184 | |||
185 | static void | 185 | static void | |
186 | prop_set_octeon_gmx(device_t dev) | 186 | prop_set_octeon_gmx(device_t dev) | |
187 | { | 187 | { | |
188 | prop_dictionary_t dict = device_properties(dev); | 188 | prop_dictionary_t dict = device_properties(dev); |
--- src/sys/arch/sgimips/ioc/if_le_oioc.c 2015/06/11 08:22:09 1.5
+++ src/sys/arch/sgimips/ioc/if_le_oioc.c 2022/02/12 03:24:34 1.6
@@ -1,41 +1,41 @@ | @@ -1,41 +1,41 @@ | |||
1 | /* $NetBSD: if_le_oioc.c,v 1.5 2015/06/11 08:22:09 matt Exp $ */ | 1 | /* $NetBSD: if_le_oioc.c,v 1.6 2022/02/12 03:24:34 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2009 Stephen M. Rumble | 4 | * Copyright (c) 2009 Stephen M. Rumble | |
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. The name of the author may not be used to endorse or promote products | 12 | * 2. The name of the author may not be used to endorse or promote products | |
13 | * derived from this software without specific prior written permission. | 13 | * derived from this software without specific prior written permission. | |
14 | * | 14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | */ | 25 | */ | |
26 | 26 | |||
27 | #include <sys/cdefs.h> | 27 | #include <sys/cdefs.h> | |
28 | __KERNEL_RCSID(0, "$NetBSD: if_le_oioc.c,v 1.5 2015/06/11 08:22:09 matt Exp $"); | 28 | __KERNEL_RCSID(0, "$NetBSD: if_le_oioc.c,v 1.6 2022/02/12 03:24:34 riastradh Exp $"); | |
29 | 29 | |||
30 | #include "opt_inet.h" | 30 | #include "opt_inet.h" | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/systm.h> | 33 | #include <sys/systm.h> | |
34 | #include <sys/mbuf.h> | 34 | #include <sys/mbuf.h> | |
35 | #include <sys/syslog.h> | 35 | #include <sys/syslog.h> | |
36 | #include <sys/socket.h> | 36 | #include <sys/socket.h> | |
37 | #include <sys/device.h> | 37 | #include <sys/device.h> | |
38 | 38 | |||
39 | #include <uvm/uvm.h> // for uvm_pglistalloc | 39 | #include <uvm/uvm.h> // for uvm_pglistalloc | |
40 | 40 | |||
41 | #include <net/if.h> | 41 | #include <net/if.h> | |
@@ -78,29 +78,29 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_oioc.c | @@ -78,29 +78,29 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_oioc.c | |||
78 | * | 78 | * | |
79 | * Lance is somewhat nasty MI code. We basically get: | 79 | * Lance is somewhat nasty MI code. We basically get: | |
80 | * struct le_softc { | 80 | * struct le_softc { | |
81 | * struct am7990_softc { | 81 | * struct am7990_softc { | |
82 | * struct lance_softc { | 82 | * struct lance_softc { | |
83 | * device_t sc_dev; | 83 | * device_t sc_dev; | |
84 | * ... | 84 | * ... | |
85 | * } | 85 | * } | |
86 | * } | 86 | * } | |
87 | * | 87 | * | |
88 | * bus_space_tag ... | 88 | * bus_space_tag ... | |
89 | * } | 89 | * } | |
90 | * | 90 | * | |
91 | * So, we can cast any three to any other three, plus sc_dev->dv_private points | 91 | * So, we can cast any three to any other three, plus | |
92 | * back at the top (i.e. to le_softc, am7990_softc and lance_softc). Bloody | 92 | * device_private(sc_dev) points back at the top (i.e. to le_softc, | |
93 | * hell! | 93 | * am7990_softc and lance_softc). Bloody hell! | |
94 | */ | 94 | */ | |
95 | struct le_softc { | 95 | struct le_softc { | |
96 | struct am7990_softc sc_am7990; /* glue to MI code */ | 96 | struct am7990_softc sc_am7990; /* glue to MI code */ | |
97 | 97 | |||
98 | bus_space_tag_t sc_st; | 98 | bus_space_tag_t sc_st; | |
99 | bus_space_handle_t sc_maph; /* ioc<->lance page map regs */ | 99 | bus_space_handle_t sc_maph; /* ioc<->lance page map regs */ | |
100 | bus_space_handle_t sc_rdph; /* lance rdp */ | 100 | bus_space_handle_t sc_rdph; /* lance rdp */ | |
101 | bus_space_handle_t sc_raph; /* lance rap */ | 101 | bus_space_handle_t sc_raph; /* lance rap */ | |
102 | }; | 102 | }; | |
103 | 103 | |||
104 | static int le_match(device_t, cfdata_t, void *); | 104 | static int le_match(device_t, cfdata_t, void *); | |
105 | static void le_attach(device_t, device_t, void *); | 105 | static void le_attach(device_t, device_t, void *); | |
106 | 106 |
--- src/sys/arch/sun3/dev/fbvar.h 2008/06/28 12:13:38 1.13
+++ src/sys/arch/sun3/dev/fbvar.h 2022/02/12 03:24:35 1.14
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: fbvar.h,v 1.13 2008/06/28 12:13:38 tsutsui Exp $ */ | 1 | /* $NetBSD: fbvar.h,v 1.14 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1992, 1993 | 4 | * Copyright (c) 1992, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This software was developed by the Computer Systems Engineering group | 7 | * This software was developed by the Computer Systems Engineering group | |
8 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and | 8 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and | |
9 | * contributed to Berkeley. | 9 | * contributed to Berkeley. | |
10 | * | 10 | * | |
11 | * All advertising materials mentioning features or use of this software | 11 | * All advertising materials mentioning features or use of this software | |
12 | * must display the following acknowledgement: | 12 | * must display the following acknowledgement: | |
13 | * This product includes software developed by the University of | 13 | * This product includes software developed by the University of | |
14 | * California, Lawrence Berkeley Laboratory. | 14 | * California, Lawrence Berkeley Laboratory. | |
@@ -43,27 +43,27 @@ | @@ -43,27 +43,27 @@ | |||
43 | #include <sys/event.h> /* for struct knote */ | 43 | #include <sys/event.h> /* for struct knote */ | |
44 | 44 | |||
45 | /* | 45 | /* | |
46 | * Frame buffer variables. All frame buffer drivers must provide the | 46 | * Frame buffer variables. All frame buffer drivers must provide the | |
47 | * following in order to participate. | 47 | * following in order to participate. | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | struct fbcmap; | 50 | struct fbcmap; | |
51 | 51 | |||
52 | struct fbdevice { | 52 | struct fbdevice { | |
53 | struct fbtype fb_fbtype; /* see fbio.h */ | 53 | struct fbtype fb_fbtype; /* see fbio.h */ | |
54 | struct fbdriver *fb_driver; /* pointer to driver */ | 54 | struct fbdriver *fb_driver; /* pointer to driver */ | |
55 | void *fb_private; /* for fb driver use */ | 55 | void *fb_private; /* for fb driver use */ | |
56 | const char *fb_name; /* i.e. sc_dev->dv_xname */ | 56 | const char *fb_name; /* i.e. device_xname(sc_dev) */ | |
57 | 57 | |||
58 | void * fb_pixels; /* display RAM */ | 58 | void * fb_pixels; /* display RAM */ | |
59 | int fb_linebytes; /* bytes per display line */ | 59 | int fb_linebytes; /* bytes per display line */ | |
60 | 60 | |||
61 | int fb_flags; /* copy of cf_flags */ | 61 | int fb_flags; /* copy of cf_flags */ | |
62 | 62 | |||
63 | /* This points to the P4 register if the FB has one. */ | 63 | /* This points to the P4 register if the FB has one. */ | |
64 | volatile uint32_t *fb_pfour; | 64 | volatile uint32_t *fb_pfour; | |
65 | 65 | |||
66 | /* | 66 | /* | |
67 | * XXX - The "Raster console" stuff could be stored | 67 | * XXX - The "Raster console" stuff could be stored | |
68 | * in the driver specific structure at fb_private | 68 | * in the driver specific structure at fb_private | |
69 | * if needed. | 69 | * if needed. |
--- src/sys/arch/vax/vsa/lcg.c 2021/08/07 16:19:07 1.7
+++ src/sys/arch/vax/vsa/lcg.c 2022/02/12 03:24:35 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lcg.c,v 1.7 2021/08/07 16:19:07 thorpej Exp $ */ | 1 | /* $NetBSD: lcg.c,v 1.8 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | /* | 2 | /* | |
3 | * LCG accelerated framebuffer driver | 3 | * LCG accelerated framebuffer driver | |
4 | * Copyright (c) 2003, 2004 Blaz Antonic | 4 | * Copyright (c) 2003, 2004 Blaz Antonic | |
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. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | /* | 31 | /* | |
32 | * Resurrection and dumb framebuffer mode by Björn Johannesson | 32 | * Resurrection and dumb framebuffer mode by Björn Johannesson | |
33 | * rherdware@yahoo.com in December 2014 | 33 | * rherdware@yahoo.com in December 2014 | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.7 2021/08/07 16:19:07 thorpej Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.8 2022/02/12 03:24:35 riastradh Exp $"); | |
38 | 38 | |||
39 | #define LCG_NO_ACCEL | 39 | #define LCG_NO_ACCEL | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/device.h> | 42 | #include <sys/device.h> | |
43 | #include <sys/systm.h> | 43 | #include <sys/systm.h> | |
44 | #include <sys/callout.h> | 44 | #include <sys/callout.h> | |
45 | #include <sys/time.h> | 45 | #include <sys/time.h> | |
46 | #include <sys/kmem.h> | 46 | #include <sys/kmem.h> | |
47 | #include <sys/conf.h> | 47 | #include <sys/conf.h> | |
48 | #include <sys/kernel.h> | 48 | #include <sys/kernel.h> | |
49 | #include <sys/systm.h> | 49 | #include <sys/systm.h> | |
50 | 50 | |||
@@ -981,27 +981,28 @@ lcg_init_common(struct device *self, str | @@ -981,27 +981,28 @@ lcg_init_common(struct device *self, str | |||
981 | void *fifo_mem_vaddr; | 981 | void *fifo_mem_vaddr; | |
982 | #ifndef LCG_NO_ACCEL | 982 | #ifndef LCG_NO_ACCEL | |
983 | u_char line; | 983 | u_char line; | |
984 | u_int ch, temp; | 984 | u_int ch, temp; | |
985 | #endif | 985 | #endif | |
986 | 986 | |||
987 | if (regaddr != NULL) | 987 | if (regaddr != NULL) | |
988 | return; | 988 | return; | |
989 | 989 | |||
990 | /* map LCG registers first */ | 990 | /* map LCG registers first */ | |
991 | if (self != NULL) { | 991 | if (self != NULL) { | |
992 | regaddr = (long*)vax_map_physmem(LCG_REG_ADDR, (LCG_REG_SIZE/VAX_NBPG)); | 992 | regaddr = (long*)vax_map_physmem(LCG_REG_ADDR, (LCG_REG_SIZE/VAX_NBPG)); | |
993 | if (regaddr == 0) { | 993 | if (regaddr == 0) { | |
994 | printf("%s: Couldn't allocate register memory.\n", self->dv_xname); | 994 | device_printf(self, | |
995 | "Couldn't allocate register memory.\n"); | |||
995 | return; | 996 | return; | |
996 | } | 997 | } | |
997 | } else { | 998 | } else { | |
998 | regaddr = (long*)virtual_avail; | 999 | regaddr = (long*)virtual_avail; | |
999 | virtual_avail += LCG_REG_SIZE; | 1000 | virtual_avail += LCG_REG_SIZE; | |
1000 | ioaccess((vaddr_t)regaddr, LCG_REG_ADDR, (LCG_REG_SIZE/VAX_NBPG)); | 1001 | ioaccess((vaddr_t)regaddr, LCG_REG_ADDR, (LCG_REG_SIZE/VAX_NBPG)); | |
1001 | } | 1002 | } | |
1002 | 1003 | |||
1003 | /* | 1004 | /* | |
1004 | * v = *0x200f0010 & VLC ? 0x07 : 0xf0; | 1005 | * v = *0x200f0010 & VLC ? 0x07 : 0xf0; | |
1005 | * switch(v) { | 1006 | * switch(v) { | |
1006 | * 0x05: 1280x1024 | 1007 | * 0x05: 1280x1024 | |
1007 | * 0x06: conf & 0x80 ? 1024x768 : 640x480 | 1008 | * 0x06: conf & 0x80 ? 1024x768 : 640x480 | |
@@ -1051,125 +1052,135 @@ lcg_init_common(struct device *self, str | @@ -1051,125 +1052,135 @@ lcg_init_common(struct device *self, str | |||
1051 | case 0x20: /* KA46 1024x864 */ | 1052 | case 0x20: /* KA46 1024x864 */ | |
1052 | case 0x60: /* KA46 1024x864 */ | 1053 | case 0x60: /* KA46 1024x864 */ | |
1053 | lcg_xsize = 1024; | 1054 | lcg_xsize = 1024; | |
1054 | lcg_ysize = 864; | 1055 | lcg_ysize = 864; | |
1055 | break; | 1056 | break; | |
1056 | case 0x40: /* KA46 1024x768 */ | 1057 | case 0x40: /* KA46 1024x768 */ | |
1057 | lcg_xsize = 1024; | 1058 | lcg_xsize = 1024; | |
1058 | lcg_ysize = 768; | 1059 | lcg_ysize = 768; | |
1059 | break; | 1060 | break; | |
1060 | default: | 1061 | default: | |
1061 | panic("LCG model not supported"); | 1062 | panic("LCG model not supported"); | |
1062 | } | 1063 | } | |
1063 | if (self != NULL) | 1064 | if (self != NULL) | |
1064 | aprint_normal("%s: framebuffer size %dx%d, depth %d (magic 0x%x)\n", | 1065 | aprint_normal_dev(self, | |
1065 | self->dv_xname, lcg_xsize, lcg_ysize, lcg_depth, magic); | 1066 | "framebuffer size %dx%d, depth %d (magic 0x%x)\n", | |
1067 | lcg_xsize, lcg_ysize, lcg_depth, magic); | |||
1066 | 1068 | |||
1067 | wsfont_init(); | 1069 | wsfont_init(); | |
1068 | cookie = wsfont_find(NULL, 12, 22, 0, WSDISPLAY_FONTORDER_R2L, | 1070 | cookie = wsfont_find(NULL, 12, 22, 0, WSDISPLAY_FONTORDER_R2L, | |
1069 | WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); | 1071 | WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); | |
1070 | if (cookie == -1) | 1072 | if (cookie == -1) | |
1071 | cookie = wsfont_find(NULL, 8, 0, 0, WSDISPLAY_FONTORDER_R2L, 0, | 1073 | cookie = wsfont_find(NULL, 8, 0, 0, WSDISPLAY_FONTORDER_R2L, 0, | |
1072 | WSFONT_FIND_BITMAP); | 1074 | WSFONT_FIND_BITMAP); | |
1073 | if (cookie == -1) | 1075 | if (cookie == -1) | |
1074 | cookie = wsfont_find(NULL, 0, 0, 0, WSDISPLAY_FONTORDER_R2L, | 1076 | cookie = wsfont_find(NULL, 0, 0, 0, WSDISPLAY_FONTORDER_R2L, | |
1075 | WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); | 1077 | WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); | |
1076 | if (cookie == -1 || wsfont_lock(cookie, &wf)) | 1078 | if (cookie == -1 || wsfont_lock(cookie, &wf)) | |
1077 | panic("lcg_common_init: can't load console font"); | 1079 | panic("lcg_common_init: can't load console font"); | |
1078 | lcg_font = *wf; | 1080 | lcg_font = *wf; | |
1079 | lcg_cols = lcg_xsize / lcg_font.fontwidth; | 1081 | lcg_cols = lcg_xsize / lcg_font.fontwidth; | |
1080 | lcg_rows = lcg_ysize / lcg_font.fontheight; | 1082 | lcg_rows = lcg_ysize / lcg_font.fontheight; | |
1081 | if (self != NULL) { | 1083 | if (self != NULL) { | |
1082 | aprint_normal("%s: using font %s (%dx%d), ", self->dv_xname, lcg_font.name, | 1084 | aprint_normal_dev(self, "using font %s (%dx%d), ", | |
1083 | lcg_font.fontwidth, lcg_font.fontheight); | 1085 | lcg_font.name, | |
1086 | lcg_font.fontwidth, lcg_font.fontheight); | |||
1084 | aprint_normal("console size: %dx%d\n", lcg_cols, lcg_rows); | 1087 | aprint_normal("console size: %dx%d\n", lcg_cols, lcg_rows); | |
1085 | } | 1088 | } | |
1086 | lcg_onerow = lcg_xsize * lcg_font.fontheight; | 1089 | lcg_onerow = lcg_xsize * lcg_font.fontheight; | |
1087 | lcg_fb_size = lcg_xsize * lcg_ysize; | 1090 | lcg_fb_size = lcg_xsize * lcg_ysize; | |
1088 | lcg_stdscreen.ncols = lcg_cols; | 1091 | lcg_stdscreen.ncols = lcg_cols; | |
1089 | lcg_stdscreen.nrows = lcg_rows; | 1092 | lcg_stdscreen.nrows = lcg_rows; | |
1090 | lcg_stdscreen.fontwidth = lcg_font.fontwidth; | 1093 | lcg_stdscreen.fontwidth = lcg_font.fontwidth; | |
1091 | lcg_stdscreen.fontheight = lcg_font.fontheight; | 1094 | lcg_stdscreen.fontheight = lcg_font.fontheight; | |
1092 | lcg_glyph_size = lcg_font.stride * lcg_font.fontheight; | 1095 | lcg_glyph_size = lcg_font.stride * lcg_font.fontheight; | |
1093 | snprintf(lcg_stdscreen_name, sizeof(lcg_stdscreen_name), "%dx%d", lcg_cols, lcg_rows); | 1096 | snprintf(lcg_stdscreen_name, sizeof(lcg_stdscreen_name), "%dx%d", lcg_cols, lcg_rows); | |
1094 | qf = lcg_font.data; | 1097 | qf = lcg_font.data; | |
1095 | qf2 = (u_short *)lcg_font.data; | 1098 | qf2 = (u_short *)lcg_font.data; | |
1096 | 1099 | |||
1097 | if (self != NULL) { | 1100 | if (self != NULL) { | |
1098 | lcgaddr = (void *)vax_map_physmem(va->va_paddr, | 1101 | lcgaddr = (void *)vax_map_physmem(va->va_paddr, | |
1099 | ((lcg_fb_size + LCG_FONT_STORAGE_SIZE)/VAX_NBPG)); | 1102 | ((lcg_fb_size + LCG_FONT_STORAGE_SIZE)/VAX_NBPG)); | |
1100 | if (lcgaddr == 0) { | 1103 | if (lcgaddr == 0) { | |
1101 | printf("%s: unable to allocate framebuffer memory.\n", self->dv_xname); | 1104 | device_printf(self, | |
1105 | "unable to allocate framebuffer memory.\n"); | |||
1102 | return; | 1106 | return; | |
1103 | } | 1107 | } | |
1104 | #ifndef LCG_NO_ACCEL | 1108 | #ifndef LCG_NO_ACCEL | |
1105 | fontaddr = lcgaddr + lcg_fb_size; | 1109 | fontaddr = lcgaddr + lcg_fb_size; | |
1106 | 1110 | |||
1107 | /* copy font bitmaps */ | 1111 | /* copy font bitmaps */ | |
1108 | for (ch = 0; ch < 256; ch++) | 1112 | for (ch = 0; ch < 256; ch++) | |
1109 | for (line = 0; line < lcg_font.fontheight; line++) { | 1113 | for (line = 0; line < lcg_font.fontheight; line++) { | |
1110 | temp = QFONT(ch, line); | 1114 | temp = QFONT(ch, line); | |
1111 | if (lcg_font.stride == 1) | 1115 | if (lcg_font.stride == 1) | |
1112 | fontaddr[(ch * lcg_font.fontheight) + line] = temp; | 1116 | fontaddr[(ch * lcg_font.fontheight) + line] = temp; | |
1113 | else { | 1117 | else { | |
1114 | /* stride == 2 */ | 1118 | /* stride == 2 */ | |
1115 | fontaddr[(ch * lcg_font.stride * lcg_font.fontheight) + line] = temp & 0xff; | 1119 | fontaddr[(ch * lcg_font.stride * lcg_font.fontheight) + line] = temp & 0xff; | |
1116 | fontaddr[(ch * lcg_font.stride * lcg_font.fontheight) + line + 1] = (temp >> 16) & 0xff; | 1120 | fontaddr[(ch * lcg_font.stride * lcg_font.fontheight) + line + 1] = (temp >> 16) & 0xff; | |
1117 | } | 1121 | } | |
1118 | } | 1122 | } | |
1119 | #endif | 1123 | #endif | |
1120 | 1124 | |||
1121 | lutaddr = (void *)vax_map_physmem(LCG_LUT_ADDR, (LCG_LUT_SIZE/VAX_NBPG)); | 1125 | lutaddr = (void *)vax_map_physmem(LCG_LUT_ADDR, (LCG_LUT_SIZE/VAX_NBPG)); | |
1122 | if (lutaddr == 0) { | 1126 | if (lutaddr == 0) { | |
1123 | printf("%s: unable to allocate LUT memory.\n", self->dv_xname); | 1127 | device_printf(self, | |
1128 | "unable to allocate LUT memory.\n"); | |||
1124 | return; | 1129 | return; | |
1125 | } | 1130 | } | |
1126 | fifoaddr = (long*)vax_map_physmem(LCG_FIFO_WIN_ADDR, (LCG_FIFO_WIN_SIZE/VAX_NBPG)); | 1131 | fifoaddr = (long*)vax_map_physmem(LCG_FIFO_WIN_ADDR, (LCG_FIFO_WIN_SIZE/VAX_NBPG)); | |
1127 | if (regaddr == 0) { | 1132 | if (regaddr == 0) { | |
1128 | printf("%s: unable to map FIFO window\n", self->dv_xname); | 1133 | device_printf(self, "unable to map FIFO window\n"); | |
1129 | return; | 1134 | return; | |
1130 | } | 1135 | } | |
1131 | 1136 | |||
1132 | /* allocate contiguous physical memory block for FIFO */ | 1137 | /* allocate contiguous physical memory block for FIFO */ | |
1133 | err = bus_dmamem_alloc(va->va_dmat, LCG_FIFO_SIZE, | 1138 | err = bus_dmamem_alloc(va->va_dmat, LCG_FIFO_SIZE, | |
1134 | LCG_FIFO_ALIGN, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT); | 1139 | LCG_FIFO_ALIGN, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT); | |
1135 | if (err) { | 1140 | if (err) { | |
1136 | printf("%s: unable to allocate FIFO memory block, err = %d\n", | 1141 | device_printf(self, | |
1137 | self->dv_xname, err); | 1142 | "unable to allocate FIFO memory block, err = %d\n", | |
1143 | err); | |||
1138 | return; | 1144 | return; | |
1139 | } | 1145 | } | |
1140 | 1146 | |||
1141 | err = bus_dmamem_map(va->va_dmat, &seg, rseg, LCG_FIFO_SIZE, | 1147 | err = bus_dmamem_map(va->va_dmat, &seg, rseg, LCG_FIFO_SIZE, | |
1142 | &fifo_mem_vaddr, BUS_DMA_NOWAIT); | 1148 | &fifo_mem_vaddr, BUS_DMA_NOWAIT); | |
1143 | if (err) { | 1149 | if (err) { | |
1144 | printf("%s: unable to map FIFO memory block, err = %d\n", | 1150 | device_printf(self, | |
1145 | self->dv_xname, err); | 1151 | "unable to map FIFO memory block, err = %d\n", | |
1152 | err); | |||
1146 | bus_dmamem_free(va->va_dmat, &seg, rseg); | 1153 | bus_dmamem_free(va->va_dmat, &seg, rseg); | |
1147 | return; | 1154 | return; | |
1148 | } | 1155 | } | |
1149 | 1156 | |||
1150 | err = bus_dmamap_create(va->va_dmat, LCG_FIFO_SIZE, rseg, | 1157 | err = bus_dmamap_create(va->va_dmat, LCG_FIFO_SIZE, rseg, | |
1151 | LCG_FIFO_SIZE, 0, BUS_DMA_NOWAIT, &sc->sc_dm); | 1158 | LCG_FIFO_SIZE, 0, BUS_DMA_NOWAIT, &sc->sc_dm); | |
1152 | if (err) { | 1159 | if (err) { | |
1153 | printf("%s: unable to create DMA map, err = %d\n", self->dv_xname, err); | 1160 | device_printf(self, | |
1161 | "unable to create DMA map, err = %d\n", | |||
1162 | err); | |||
1154 | bus_dmamem_unmap(va->va_dmat, fifo_mem_vaddr, LCG_FIFO_SIZE); | 1163 | bus_dmamem_unmap(va->va_dmat, fifo_mem_vaddr, LCG_FIFO_SIZE); | |
1155 | bus_dmamem_free(va->va_dmat, &seg, rseg); | 1164 | bus_dmamem_free(va->va_dmat, &seg, rseg); | |
1156 | return; | 1165 | return; | |
1157 | } | 1166 | } | |
1158 | 1167 | |||
1159 | err = bus_dmamap_load(va->va_dmat, sc->sc_dm, fifo_mem_vaddr, | 1168 | err = bus_dmamap_load(va->va_dmat, sc->sc_dm, fifo_mem_vaddr, | |
1160 | LCG_FIFO_SIZE, NULL, BUS_DMA_NOWAIT); | 1169 | LCG_FIFO_SIZE, NULL, BUS_DMA_NOWAIT); | |
1161 | if (err) { | 1170 | if (err) { | |
1162 | printf("%s: unable to load DMA map, err = %d\n", self->dv_xname, err); | 1171 | device_printf(self, | |
1172 | "unable to load DMA map, err = %d\n", | |||
1173 | err); | |||
1163 | bus_dmamap_destroy(va->va_dmat, sc->sc_dm); | 1174 | bus_dmamap_destroy(va->va_dmat, sc->sc_dm); | |
1164 | bus_dmamem_unmap(va->va_dmat, fifo_mem_vaddr, LCG_FIFO_SIZE); | 1175 | bus_dmamem_unmap(va->va_dmat, fifo_mem_vaddr, LCG_FIFO_SIZE); | |
1165 | bus_dmamem_free(va->va_dmat, &seg, rseg); | 1176 | bus_dmamem_free(va->va_dmat, &seg, rseg); | |
1166 | return; | 1177 | return; | |
1167 | } | 1178 | } | |
1168 | 1179 | |||
1169 | /* initialize LCG hardware */ | 1180 | /* initialize LCG hardware */ | |
1170 | LCG_REG(LCG_REG_GRAPHICS_CONTROL) = 0xd8000000; /* gfx reset, FIFO and AG enable */ | 1181 | LCG_REG(LCG_REG_GRAPHICS_CONTROL) = 0xd8000000; /* gfx reset, FIFO and AG enable */ | |
1171 | // LCG_REG(LCG_REG_WRITE_PROTECT_LOW_HIGH) = (((LCG_FB_ADDR + lcg_fb_size) & 0xffff0000) | (LCG_FB_ADDR >> 16)); | 1182 | // LCG_REG(LCG_REG_WRITE_PROTECT_LOW_HIGH) = (((LCG_FB_ADDR + lcg_fb_size) & 0xffff0000) | (LCG_FB_ADDR >> 16)); | |
1172 | LCG_REG(LCG_REG_WRITE_PROTECT_LOW_HIGH) = 0xffff0000; | 1183 | LCG_REG(LCG_REG_WRITE_PROTECT_LOW_HIGH) = 0xffff0000; | |
1173 | LCG_REG(LCG_REG_FIFO_BASE) = sc->sc_dm->dm_segs[0].ds_addr; | 1184 | LCG_REG(LCG_REG_FIFO_BASE) = sc->sc_dm->dm_segs[0].ds_addr; | |
1174 | LCG_REG(LCG_REG_FIFO_BASE2) = sc->sc_dm->dm_segs[0].ds_addr; | 1185 | LCG_REG(LCG_REG_FIFO_BASE2) = sc->sc_dm->dm_segs[0].ds_addr; | |
1175 | LCG_REG(LCG_REG_FIFO_MASKS) = 0xffff; | 1186 | LCG_REG(LCG_REG_FIFO_MASKS) = 0xffff; | |
@@ -1278,16 +1289,17 @@ lcg_init_common(struct device *self, str | @@ -1278,16 +1289,17 @@ lcg_init_common(struct device *self, str | |||
1278 | video_conf |= (1 << 5); /* split shift register load */ | 1289 | video_conf |= (1 << 5); /* split shift register load */ | |
1279 | } | 1290 | } | |
1280 | 1291 | |||
1281 | LCG_REG(LCG_REG_VIDEO_CONFIG) = video_conf; | 1292 | LCG_REG(LCG_REG_VIDEO_CONFIG) = video_conf; | |
1282 | /* vital !!! */ | 1293 | /* vital !!! */ | |
1283 | LCG_REG(LCG_REG_LUT_CONSOLE_SEL) = 1; | 1294 | LCG_REG(LCG_REG_LUT_CONSOLE_SEL) = 1; | |
1284 | LCG_REG(LCG_REG_LUT_COLOR_BASE_W) = LCG_LUT_OFFSET; | 1295 | LCG_REG(LCG_REG_LUT_COLOR_BASE_W) = LCG_LUT_OFFSET; | |
1285 | 1296 | |||
1286 | delay(1000); | 1297 | delay(1000); | |
1287 | LCG_REG(LCG_REG_LUT_CONSOLE_SEL) = 0; | 1298 | LCG_REG(LCG_REG_LUT_CONSOLE_SEL) = 0; | |
1288 | 1299 | |||
1289 | #ifdef LCG_DEBUG | 1300 | #ifdef LCG_DEBUG | |
1290 | if (self != NULL) | 1301 | if (self != NULL) | |
1291 | printf("%s: video config register set 0x%08lx\n", video_conf, self->dv_xname); | 1302 | device_printf(self, "video config register set 0x%08lx\n", | |
1303 | video_conf); | |||
1292 | #endif | 1304 | #endif | |
1293 | } | 1305 | } |
--- src/sys/arch/x86/x86/x86_autoconf.c 2021/10/07 12:52:27 1.85
+++ src/sys/arch/x86/x86/x86_autoconf.c 2022/02/12 03:24:35 1.86
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: x86_autoconf.c,v 1.85 2021/10/07 12:52:27 msaitoh Exp $ */ | 1 | /* $NetBSD: x86_autoconf.c,v 1.86 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1990 The Regents of the University of California. | 4 | * Copyright (c) 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * William Jolitz. | 8 | * William Jolitz. | |
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. | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
32 | * SUCH DAMAGE. | 32 | * SUCH DAMAGE. | |
33 | * | 33 | * | |
34 | * @(#)autoconf.c 7.1 (Berkeley) 5/9/91 | 34 | * @(#)autoconf.c 7.1 (Berkeley) 5/9/91 | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.85 2021/10/07 12:52:27 msaitoh Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.86 2022/02/12 03:24:35 riastradh Exp $"); | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/device.h> | 42 | #include <sys/device.h> | |
43 | #include <sys/disklabel.h> | 43 | #include <sys/disklabel.h> | |
44 | #include <sys/conf.h> | 44 | #include <sys/conf.h> | |
45 | #include <sys/malloc.h> | 45 | #include <sys/malloc.h> | |
46 | #include <sys/vnode.h> | 46 | #include <sys/vnode.h> | |
47 | #include <sys/fcntl.h> | 47 | #include <sys/fcntl.h> | |
48 | #include <sys/disk.h> | 48 | #include <sys/disk.h> | |
49 | #include <sys/proc.h> | 49 | #include <sys/proc.h> | |
50 | #include <sys/md5.h> | 50 | #include <sys/md5.h> | |
51 | #include <sys/kauth.h> | 51 | #include <sys/kauth.h> | |
@@ -558,27 +558,27 @@ cpu_rootconf(void) | @@ -558,27 +558,27 @@ cpu_rootconf(void) | |||
558 | } | 558 | } | |
559 | 559 | |||
560 | void | 560 | void | |
561 | device_register(device_t dev, void *aux) | 561 | device_register(device_t dev, void *aux) | |
562 | { | 562 | { | |
563 | device_t isaboot, pciboot; | 563 | device_t isaboot, pciboot; | |
564 | 564 | |||
565 | /* | 565 | /* | |
566 | * The Intel Integrated Memory Controller has a built-in i2c | 566 | * The Intel Integrated Memory Controller has a built-in i2c | |
567 | * controller that's rather limited in capability; it is intended | 567 | * controller that's rather limited in capability; it is intended | |
568 | * only for reading memory module EERPOMs and sensors. | 568 | * only for reading memory module EERPOMs and sensors. | |
569 | */ | 569 | */ | |
570 | if (device_is_a(dev, "iic") && | 570 | if (device_is_a(dev, "iic") && | |
571 | device_is_a(dev->dv_parent, "imcsmb")) { | 571 | device_is_a(device_parent(dev), "imcsmb")) { | |
572 | static const char *imcsmb_device_permitlist[] = { | 572 | static const char *imcsmb_device_permitlist[] = { | |
573 | "spdmem", | 573 | "spdmem", | |
574 | "sdtemp", | 574 | "sdtemp", | |
575 | NULL, | 575 | NULL, | |
576 | }; | 576 | }; | |
577 | prop_array_t permitlist = prop_array_create(); | 577 | prop_array_t permitlist = prop_array_create(); | |
578 | prop_dictionary_t props = device_properties(dev); | 578 | prop_dictionary_t props = device_properties(dev); | |
579 | int i; | 579 | int i; | |
580 | 580 | |||
581 | for (i = 0; imcsmb_device_permitlist[i] != NULL; i++) { | 581 | for (i = 0; imcsmb_device_permitlist[i] != NULL; i++) { | |
582 | prop_string_t pstr = prop_string_create_nocopy( | 582 | prop_string_t pstr = prop_string_create_nocopy( | |
583 | imcsmb_device_permitlist[i]); | 583 | imcsmb_device_permitlist[i]); | |
584 | (void) prop_array_add(permitlist, pstr); | 584 | (void) prop_array_add(permitlist, pstr); |
--- src/sys/arch/zaurus/zaurus/autoconf.c 2021/06/21 03:05:24 1.14
+++ src/sys/arch/zaurus/zaurus/autoconf.c 2022/02/12 03:24:35 1.15
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: autoconf.c,v 1.14 2021/06/21 03:05:24 christos Exp $ */ | 1 | /* $NetBSD: autoconf.c,v 1.15 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | |
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. | |
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.14 2021/06/21 03:05:24 christos Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.15 2022/02/12 03:24:35 riastradh Exp $"); | |
31 | 31 | |||
32 | #include "opt_md.h" | 32 | #include "opt_md.h" | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/disklabel.h> | 37 | #include <sys/disklabel.h> | |
38 | #include <sys/conf.h> | 38 | #include <sys/conf.h> | |
39 | #include <sys/malloc.h> | 39 | #include <sys/malloc.h> | |
40 | #include <sys/vnode.h> | 40 | #include <sys/vnode.h> | |
41 | #include <sys/fcntl.h> | 41 | #include <sys/fcntl.h> | |
42 | #include <sys/proc.h> | 42 | #include <sys/proc.h> | |
43 | #include <sys/disk.h> | 43 | #include <sys/disk.h> | |
@@ -216,18 +216,18 @@ cpu_rootconf(void) | @@ -216,18 +216,18 @@ cpu_rootconf(void) | |||
216 | booted_device ? device_xname(booted_device) : "<unknown>"); | 216 | booted_device ? device_xname(booted_device) : "<unknown>"); | |
217 | rootconf(); | 217 | rootconf(); | |
218 | } | 218 | } | |
219 | 219 | |||
220 | void | 220 | void | |
221 | device_register(device_t dev, void *aux) | 221 | device_register(device_t dev, void *aux) | |
222 | { | 222 | { | |
223 | 223 | |||
224 | /* | 224 | /* | |
225 | * I2C bus conntected to pxaiic(4) for zaudio(4) devices has | 225 | * I2C bus conntected to pxaiic(4) for zaudio(4) devices has | |
226 | * limited capabilities. | 226 | * limited capabilities. | |
227 | */ | 227 | */ | |
228 | if (device_is_a(dev, "iic") && | 228 | if (device_is_a(dev, "iic") && | |
229 | device_is_a(dev->dv_parent, "ziic")) { | 229 | device_is_a(device_parent(dev), "ziic")) { | |
230 | (void)prop_dictionary_set_string_nocopy(device_properties(dev), | 230 | (void)prop_dictionary_set_string_nocopy(device_properties(dev), | |
231 | I2C_PROP_INDIRECT_PROBE_STRATEGY, I2C_PROBE_STRATEGY_NONE); | 231 | I2C_PROP_INDIRECT_PROBE_STRATEGY, I2C_PROBE_STRATEGY_NONE); | |
232 | } | 232 | } | |
233 | } | 233 | } |
--- src/sys/dev/spkr.c 2021/08/07 16:19:08 1.21
+++ src/sys/dev/spkr.c 2022/02/12 03:24:36 1.22
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: spkr.c,v 1.21 2021/08/07 16:19:08 thorpej Exp $ */ | 1 | /* $NetBSD: spkr.c,v 1.22 2022/02/12 03:24:36 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1990 Eric S. Raymond (esr@snark.thyrsus.com) | 4 | * Copyright (c) 1990 Eric S. Raymond (esr@snark.thyrsus.com) | |
5 | * Copyright (c) 1990 Andrew A. Chernov (ache@astral.msk.su) | 5 | * Copyright (c) 1990 Andrew A. Chernov (ache@astral.msk.su) | |
6 | * Copyright (c) 1990 Lennart Augustsson (lennart@augustsson.net) | 6 | * Copyright (c) 1990 Lennart Augustsson (lennart@augustsson.net) | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -33,27 +33,27 @@ | @@ -33,27 +33,27 @@ | |||
33 | * POSSIBILITY OF SUCH DAMAGE. | 33 | * POSSIBILITY OF SUCH DAMAGE. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | /* | 36 | /* | |
37 | * spkr.c -- device driver for console speaker on 80386 | 37 | * spkr.c -- device driver for console speaker on 80386 | |
38 | * | 38 | * | |
39 | * v1.1 by Eric S. Raymond (esr@snark.thyrsus.com) Feb 1990 | 39 | * v1.1 by Eric S. Raymond (esr@snark.thyrsus.com) Feb 1990 | |
40 | * modified for 386bsd by Andrew A. Chernov <ache@astral.msk.su> | 40 | * modified for 386bsd by Andrew A. Chernov <ache@astral.msk.su> | |
41 | * 386bsd only clean version, all SYSV stuff removed | 41 | * 386bsd only clean version, all SYSV stuff removed | |
42 | * use hz value from param.c | 42 | * use hz value from param.c | |
43 | */ | 43 | */ | |
44 | 44 | |||
45 | #include <sys/cdefs.h> | 45 | #include <sys/cdefs.h> | |
46 | __KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.21 2021/08/07 16:19:08 thorpej Exp $"); | 46 | __KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.22 2022/02/12 03:24:36 riastradh Exp $"); | |
47 | 47 | |||
48 | #if defined(_KERNEL_OPT) | 48 | #if defined(_KERNEL_OPT) | |
49 | #include "wsmux.h" | 49 | #include "wsmux.h" | |
50 | #endif | 50 | #endif | |
51 | 51 | |||
52 | #include <sys/param.h> | 52 | #include <sys/param.h> | |
53 | #include <sys/systm.h> | 53 | #include <sys/systm.h> | |
54 | #include <sys/kernel.h> | 54 | #include <sys/kernel.h> | |
55 | #include <sys/errno.h> | 55 | #include <sys/errno.h> | |
56 | #include <sys/device.h> | 56 | #include <sys/device.h> | |
57 | #include <sys/malloc.h> | 57 | #include <sys/malloc.h> | |
58 | #include <sys/module.h> | 58 | #include <sys/module.h> | |
59 | #include <sys/uio.h> | 59 | #include <sys/uio.h> | |
@@ -406,44 +406,46 @@ playstring(struct spkr_softc *sc, const | @@ -406,44 +406,46 @@ playstring(struct spkr_softc *sc, const | |||
406 | * to finish playing the beep and then halts it. | 406 | * to finish playing the beep and then halts it. | |
407 | * If the pitch is zero, it halts all sound if any (for compatibility | 407 | * If the pitch is zero, it halts all sound if any (for compatibility | |
408 | * with the past confused specifications, but there should be no sound at | 408 | * with the past confused specifications, but there should be no sound at | |
409 | * this point). And it returns immediately, without waiting ticks. So | 409 | * this point). And it returns immediately, without waiting ticks. So | |
410 | * you cannot use this as a rest. | 410 | * you cannot use this as a rest. | |
411 | * If the tick is zero, it returns immediately. | 411 | * If the tick is zero, it returns immediately. | |
412 | */ | 412 | */ | |
413 | void | 413 | void | |
414 | spkr_attach(device_t self, void (*tone)(device_t, u_int, u_int)) | 414 | spkr_attach(device_t self, void (*tone)(device_t, u_int, u_int)) | |
415 | { | 415 | { | |
416 | struct spkr_softc *sc = device_private(self); | 416 | struct spkr_softc *sc = device_private(self); | |
417 | 417 | |||
418 | #ifdef SPKRDEBUG | 418 | #ifdef SPKRDEBUG | |
419 | aprint_debug("%s: entering for unit %d\n", __func__, self->dv_unit); | 419 | aprint_debug("%s: entering for unit %d\n", __func__, | |
420 | device_unit(self)); | |||
420 | #endif /* SPKRDEBUG */ | 421 | #endif /* SPKRDEBUG */ | |
421 | sc->sc_dev = self; | 422 | sc->sc_dev = self; | |
422 | sc->sc_tone = tone; | 423 | sc->sc_tone = tone; | |
423 | sc->sc_inbuf = NULL; | 424 | sc->sc_inbuf = NULL; | |
424 | sc->sc_wsbelldev = NULL; | 425 | sc->sc_wsbelldev = NULL; | |
425 | 426 | |||
426 | spkr_rescan(self, NULL, NULL); | 427 | spkr_rescan(self, NULL, NULL); | |
427 | } | 428 | } | |
428 | 429 | |||
429 | int | 430 | int | |
430 | spkr_detach(device_t self, int flags) | 431 | spkr_detach(device_t self, int flags) | |
431 | { | 432 | { | |
432 | struct spkr_softc *sc = device_private(self); | 433 | struct spkr_softc *sc = device_private(self); | |
433 | int rc; | 434 | int rc; | |
434 | 435 | |||
435 | #ifdef SPKRDEBUG | 436 | #ifdef SPKRDEBUG | |
436 | aprint_debug("%s: entering for unit %d\n", __func__, self->dv_unit); | 437 | aprint_debug("%s: entering for unit %d\n", __func__, | |
438 | device_unit(self)); | |||
437 | #endif /* SPKRDEBUG */ | 439 | #endif /* SPKRDEBUG */ | |
438 | if (sc == NULL) | 440 | if (sc == NULL) | |
439 | return ENXIO; | 441 | return ENXIO; | |
440 | 442 | |||
441 | /* XXXNS If speaker never closes, we cannot complete the detach. */ | 443 | /* XXXNS If speaker never closes, we cannot complete the detach. */ | |
442 | while ((flags & DETACH_FORCE) != 0 && sc->sc_inbuf != NULL) | 444 | while ((flags & DETACH_FORCE) != 0 && sc->sc_inbuf != NULL) | |
443 | kpause("spkrwait", TRUE, 1, NULL); | 445 | kpause("spkrwait", TRUE, 1, NULL); | |
444 | if (sc->sc_inbuf != NULL) | 446 | if (sc->sc_inbuf != NULL) | |
445 | return EBUSY; | 447 | return EBUSY; | |
446 | 448 | |||
447 | rc = config_detach_children(self, flags); | 449 | rc = config_detach_children(self, flags); | |
448 | 450 | |||
449 | return rc; | 451 | return rc; |
--- src/sys/dev/i2c/ihidev.c 2022/01/15 06:22:30 1.27
+++ src/sys/dev/i2c/ihidev.c 2022/02/12 03:24:35 1.28
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ihidev.c,v 1.27 2022/01/15 06:22:30 skrll Exp $ */ | 1 | /* $NetBSD: ihidev.c,v 1.28 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | /* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */ | 2 | /* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 2017 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 2017 The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Manuel Bouyer. | 9 | * by Manuel Bouyer. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -44,27 +44,27 @@ | @@ -44,27 +44,27 @@ | |||
44 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 44 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
45 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 45 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
46 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 46 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
47 | */ | 47 | */ | |
48 | 48 | |||
49 | /* | 49 | /* | |
50 | * HID-over-i2c driver | 50 | * HID-over-i2c driver | |
51 | * | 51 | * | |
52 | * https://msdn.microsoft.com/en-us/library/windows/hardware/dn642101%28v=vs.85%29.aspx | 52 | * https://msdn.microsoft.com/en-us/library/windows/hardware/dn642101%28v=vs.85%29.aspx | |
53 | * | 53 | * | |
54 | */ | 54 | */ | |
55 | 55 | |||
56 | #include <sys/cdefs.h> | 56 | #include <sys/cdefs.h> | |
57 | __KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.27 2022/01/15 06:22:30 skrll Exp $"); | 57 | __KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.28 2022/02/12 03:24:35 riastradh Exp $"); | |
58 | 58 | |||
59 | #include <sys/param.h> | 59 | #include <sys/param.h> | |
60 | #include <sys/systm.h> | 60 | #include <sys/systm.h> | |
61 | #include <sys/device.h> | 61 | #include <sys/device.h> | |
62 | #include <sys/kmem.h> | 62 | #include <sys/kmem.h> | |
63 | #include <sys/workqueue.h> | 63 | #include <sys/workqueue.h> | |
64 | 64 | |||
65 | #include <dev/i2c/i2cvar.h> | 65 | #include <dev/i2c/i2cvar.h> | |
66 | #include <dev/i2c/ihidev.h> | 66 | #include <dev/i2c/ihidev.h> | |
67 | 67 | |||
68 | #include <dev/hid/hid.h> | 68 | #include <dev/hid/hid.h> | |
69 | 69 | |||
70 | #if defined(__i386__) || defined(__amd64__) | 70 | #if defined(__i386__) || defined(__amd64__) | |
@@ -194,28 +194,28 @@ ihidev_attach(device_t parent, device_t | @@ -194,28 +194,28 @@ ihidev_attach(device_t parent, device_t | |||
194 | KM_SLEEP); | 194 | KM_SLEEP); | |
195 | 195 | |||
196 | /* find largest report size and allocate memory for input buffer */ | 196 | /* find largest report size and allocate memory for input buffer */ | |
197 | sc->sc_isize = le16toh(sc->hid_desc.wMaxInputLength); | 197 | sc->sc_isize = le16toh(sc->hid_desc.wMaxInputLength); | |
198 | for (repid = 0; repid < sc->sc_nrepid; repid++) { | 198 | for (repid = 0; repid < sc->sc_nrepid; repid++) { | |
199 | repsz = hid_report_size(sc->sc_report, sc->sc_reportlen, | 199 | repsz = hid_report_size(sc->sc_report, sc->sc_reportlen, | |
200 | hid_input, repid); | 200 | hid_input, repid); | |
201 | 201 | |||
202 | isize = repsz + 2; /* two bytes for the length */ | 202 | isize = repsz + 2; /* two bytes for the length */ | |
203 | isize += (sc->sc_nrepid != 1); /* one byte for the report ID */ | 203 | isize += (sc->sc_nrepid != 1); /* one byte for the report ID */ | |
204 | if (isize > sc->sc_isize) | 204 | if (isize > sc->sc_isize) | |
205 | sc->sc_isize = isize; | 205 | sc->sc_isize = isize; | |
206 | 206 | |||
207 | DPRINTF(("%s: repid %d size %d\n", sc->sc_dev.dv_xname, repid, | 207 | DPRINTF(("%s: repid %d size %d\n", | |
208 | repsz)); | 208 | device_xname(sc->sc_dev), repid, repsz)); | |
209 | } | 209 | } | |
210 | sc->sc_ibuf = kmem_zalloc(sc->sc_isize, KM_SLEEP); | 210 | sc->sc_ibuf = kmem_zalloc(sc->sc_isize, KM_SLEEP); | |
211 | if (!ihidev_intr_init(sc)) { | 211 | if (!ihidev_intr_init(sc)) { | |
212 | return; | 212 | return; | |
213 | } | 213 | } | |
214 | 214 | |||
215 | iha.iaa = ia; | 215 | iha.iaa = ia; | |
216 | iha.parent = sc; | 216 | iha.parent = sc; | |
217 | 217 | |||
218 | /* Look for a driver claiming all report IDs first. */ | 218 | /* Look for a driver claiming all report IDs first. */ | |
219 | iha.reportid = IHIDEV_CLAIM_ALLREPORTID; | 219 | iha.reportid = IHIDEV_CLAIM_ALLREPORTID; | |
220 | locs[IHIDBUSCF_REPORTID] = IHIDEV_CLAIM_ALLREPORTID; | 220 | locs[IHIDBUSCF_REPORTID] = IHIDEV_CLAIM_ALLREPORTID; | |
221 | dev = config_found(self, &iha, ihidev_print, | 221 | dev = config_found(self, &iha, ihidev_print, | |
@@ -324,50 +324,50 @@ ihidev_hid_command(struct ihidev_softc * | @@ -324,50 +324,50 @@ ihidev_hid_command(struct ihidev_softc * | |||
324 | 324 | |||
325 | switch (hidcmd) { | 325 | switch (hidcmd) { | |
326 | case I2C_HID_CMD_DESCR: { | 326 | case I2C_HID_CMD_DESCR: { | |
327 | /* | 327 | /* | |
328 | * 5.2.2 - HID Descriptor Retrieval | 328 | * 5.2.2 - HID Descriptor Retrieval | |
329 | * register is passed from the controller | 329 | * register is passed from the controller | |
330 | */ | 330 | */ | |
331 | uint8_t cmd[] = { | 331 | uint8_t cmd[] = { | |
332 | htole16(sc->sc_hid_desc_addr) & 0xff, | 332 | htole16(sc->sc_hid_desc_addr) & 0xff, | |
333 | htole16(sc->sc_hid_desc_addr) >> 8, | 333 | htole16(sc->sc_hid_desc_addr) >> 8, | |
334 | }; | 334 | }; | |
335 | 335 | |||
336 | DPRINTF(("%s: HID command I2C_HID_CMD_DESCR at 0x%x\n", | 336 | DPRINTF(("%s: HID command I2C_HID_CMD_DESCR at 0x%x\n", | |
337 | sc->sc_dev.dv_xname, htole16(sc->sc_hid_desc_addr))); | 337 | device_xname(sc->sc_dev), htole16(sc->sc_hid_desc_addr))); | |
338 | 338 | |||
339 | /* 20 00 */ | 339 | /* 20 00 */ | |
340 | res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, | 340 | res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, | |
341 | &cmd, sizeof(cmd), &sc->hid_desc_buf, | 341 | &cmd, sizeof(cmd), &sc->hid_desc_buf, | |
342 | sizeof(struct i2c_hid_desc), flags); | 342 | sizeof(struct i2c_hid_desc), flags); | |
343 | 343 | |||
344 | DPRINTF(("%s: HID descriptor:", sc->sc_dev.dv_xname)); | 344 | DPRINTF(("%s: HID descriptor:", device_xname(sc->sc_dev))); | |
345 | for (i = 0; i < sizeof(struct i2c_hid_desc); i++) | 345 | for (i = 0; i < sizeof(struct i2c_hid_desc); i++) | |
346 | DPRINTF((" %.2x", sc->hid_desc_buf[i])); | 346 | DPRINTF((" %.2x", sc->hid_desc_buf[i])); | |
347 | DPRINTF(("\n")); | 347 | DPRINTF(("\n")); | |
348 | 348 | |||
349 | break; | 349 | break; | |
350 | } | 350 | } | |
351 | case I2C_HID_CMD_RESET: { | 351 | case I2C_HID_CMD_RESET: { | |
352 | uint8_t cmd[] = { | 352 | uint8_t cmd[] = { | |
353 | htole16(sc->hid_desc.wCommandRegister) & 0xff, | 353 | htole16(sc->hid_desc.wCommandRegister) & 0xff, | |
354 | htole16(sc->hid_desc.wCommandRegister) >> 8, | 354 | htole16(sc->hid_desc.wCommandRegister) >> 8, | |
355 | 0, | 355 | 0, | |
356 | I2C_HID_CMD_RESET, | 356 | I2C_HID_CMD_RESET, | |
357 | }; | 357 | }; | |
358 | 358 | |||
359 | DPRINTF(("%s: HID command I2C_HID_CMD_RESET\n", | 359 | DPRINTF(("%s: HID command I2C_HID_CMD_RESET\n", | |
360 | sc->sc_dev.dv_xname)); | 360 | device_xname(sc->sc_dev))); | |
361 | 361 | |||
362 | /* 22 00 00 01 */ | 362 | /* 22 00 00 01 */ | |
363 | res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, | 363 | res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, | |
364 | &cmd, sizeof(cmd), NULL, 0, flags); | 364 | &cmd, sizeof(cmd), NULL, 0, flags); | |
365 | 365 | |||
366 | break; | 366 | break; | |
367 | } | 367 | } | |
368 | case I2C_HID_CMD_GET_REPORT: { | 368 | case I2C_HID_CMD_GET_REPORT: { | |
369 | struct i2c_hid_report_request *rreq = | 369 | struct i2c_hid_report_request *rreq = | |
370 | (struct i2c_hid_report_request *)arg; | 370 | (struct i2c_hid_report_request *)arg; | |
371 | 371 | |||
372 | uint8_t cmd[] = { | 372 | uint8_t cmd[] = { | |
373 | htole16(sc->hid_desc.wCommandRegister) & 0xff, | 373 | htole16(sc->hid_desc.wCommandRegister) & 0xff, | |
@@ -375,27 +375,27 @@ ihidev_hid_command(struct ihidev_softc * | @@ -375,27 +375,27 @@ ihidev_hid_command(struct ihidev_softc * | |||
375 | 0, | 375 | 0, | |
376 | I2C_HID_CMD_GET_REPORT, | 376 | I2C_HID_CMD_GET_REPORT, | |
377 | 0, 0, 0, | 377 | 0, 0, 0, | |
378 | }; | 378 | }; | |
379 | int cmdlen = 7; | 379 | int cmdlen = 7; | |
380 | int dataoff = 4; | 380 | int dataoff = 4; | |
381 | int report_id = rreq->id; | 381 | int report_id = rreq->id; | |
382 | int report_id_len = 1; | 382 | int report_id_len = 1; | |
383 | int report_len = rreq->len + 2; | 383 | int report_len = rreq->len + 2; | |
384 | int d; | 384 | int d; | |
385 | uint8_t *tmprep; | 385 | uint8_t *tmprep; | |
386 | 386 | |||
387 | DPRINTF(("%s: HID command I2C_HID_CMD_GET_REPORT %d " | 387 | DPRINTF(("%s: HID command I2C_HID_CMD_GET_REPORT %d " | |
388 | "(type %d, len %d)\n", sc->sc_dev.dv_xname, report_id, | 388 | "(type %d, len %d)\n", device_xname(sc->sc_dev), report_id, | |
389 | rreq->type, rreq->len)); | 389 | rreq->type, rreq->len)); | |
390 | 390 | |||
391 | /* | 391 | /* | |
392 | * 7.2.2.4 - "The protocol is optimized for Report < 15. If a | 392 | * 7.2.2.4 - "The protocol is optimized for Report < 15. If a | |
393 | * report ID >= 15 is necessary, then the Report ID in the Low | 393 | * report ID >= 15 is necessary, then the Report ID in the Low | |
394 | * Byte must be set to 1111 and a Third Byte is appended to the | 394 | * Byte must be set to 1111 and a Third Byte is appended to the | |
395 | * protocol. This Third Byte contains the entire/actual report | 395 | * protocol. This Third Byte contains the entire/actual report | |
396 | * ID." | 396 | * ID." | |
397 | */ | 397 | */ | |
398 | if (report_id >= 15) { | 398 | if (report_id >= 15) { | |
399 | cmd[dataoff++] = report_id; | 399 | cmd[dataoff++] = report_id; | |
400 | report_id = 15; | 400 | report_id = 15; | |
401 | report_id_len = 2; | 401 | report_id_len = 2; | |
@@ -421,43 +421,43 @@ ihidev_hid_command(struct ihidev_softc * | @@ -421,43 +421,43 @@ ihidev_hid_command(struct ihidev_softc * | |||
421 | DPRINTF(("%s: out of memory\n", | 421 | DPRINTF(("%s: out of memory\n", | |
422 | device_xname(sc->sc_dev))); | 422 | device_xname(sc->sc_dev))); | |
423 | res = ENOMEM; | 423 | res = ENOMEM; | |
424 | break; | 424 | break; | |
425 | } | 425 | } | |
426 | 426 | |||
427 | /* type 3 id 8: 22 00 38 02 23 00 */ | 427 | /* type 3 id 8: 22 00 38 02 23 00 */ | |
428 | res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, | 428 | res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, | |
429 | &cmd, cmdlen, tmprep, report_len, flags); | 429 | &cmd, cmdlen, tmprep, report_len, flags); | |
430 | 430 | |||
431 | d = tmprep[0] | tmprep[1] << 8; | 431 | d = tmprep[0] | tmprep[1] << 8; | |
432 | if (d != report_len) { | 432 | if (d != report_len) { | |
433 | DPRINTF(("%s: response size %d != expected length %d\n", | 433 | DPRINTF(("%s: response size %d != expected length %d\n", | |
434 | sc->sc_dev.dv_xname, d, report_len)); | 434 | device_xname(sc->sc_dev), d, report_len)); | |
435 | } | 435 | } | |
436 | 436 | |||
437 | if (report_id_len == 2) | 437 | if (report_id_len == 2) | |
438 | d = tmprep[2] | tmprep[3] << 8; | 438 | d = tmprep[2] | tmprep[3] << 8; | |
439 | else | 439 | else | |
440 | d = tmprep[2]; | 440 | d = tmprep[2]; | |
441 | 441 | |||
442 | if (d != rreq->id) { | 442 | if (d != rreq->id) { | |
443 | DPRINTF(("%s: response report id %d != %d\n", | 443 | DPRINTF(("%s: response report id %d != %d\n", | |
444 | sc->sc_dev.dv_xname, d, rreq->id)); | 444 | device_xname(sc->sc_dev), d, rreq->id)); | |
445 | iic_release_bus(sc->sc_tag, 0); | 445 | iic_release_bus(sc->sc_tag, 0); | |
446 | kmem_free(tmprep, report_len); | 446 | kmem_free(tmprep, report_len); | |
447 | return (1); | 447 | return (1); | |
448 | } | 448 | } | |
449 | 449 | |||
450 | DPRINTF(("%s: response:", sc->sc_dev.dv_xname)); | 450 | DPRINTF(("%s: response:", device_xname(sc->sc_dev))); | |
451 | for (i = 0; i < report_len; i++) | 451 | for (i = 0; i < report_len; i++) | |
452 | DPRINTF((" %.2x", tmprep[i])); | 452 | DPRINTF((" %.2x", tmprep[i])); | |
453 | DPRINTF(("\n")); | 453 | DPRINTF(("\n")); | |
454 | 454 | |||
455 | memcpy(rreq->data, tmprep + 2 + report_id_len, rreq->len); | 455 | memcpy(rreq->data, tmprep + 2 + report_id_len, rreq->len); | |
456 | kmem_free(tmprep, report_len); | 456 | kmem_free(tmprep, report_len); | |
457 | 457 | |||
458 | break; | 458 | break; | |
459 | } | 459 | } | |
460 | case I2C_HID_CMD_SET_REPORT: { | 460 | case I2C_HID_CMD_SET_REPORT: { | |
461 | struct i2c_hid_report_request *rreq = | 461 | struct i2c_hid_report_request *rreq = | |
462 | (struct i2c_hid_report_request *)arg; | 462 | (struct i2c_hid_report_request *)arg; | |
463 | 463 | |||
@@ -465,27 +465,27 @@ ihidev_hid_command(struct ihidev_softc * | @@ -465,27 +465,27 @@ ihidev_hid_command(struct ihidev_softc * | |||
465 | htole16(sc->hid_desc.wCommandRegister) & 0xff, | 465 | htole16(sc->hid_desc.wCommandRegister) & 0xff, | |
466 | htole16(sc->hid_desc.wCommandRegister) >> 8, | 466 | htole16(sc->hid_desc.wCommandRegister) >> 8, | |
467 | 0, | 467 | 0, | |
468 | I2C_HID_CMD_SET_REPORT, | 468 | I2C_HID_CMD_SET_REPORT, | |
469 | 0, 0, 0, 0, 0, 0, | 469 | 0, 0, 0, 0, 0, 0, | |
470 | }; | 470 | }; | |
471 | int cmdlen = 10; | 471 | int cmdlen = 10; | |
472 | int report_id = rreq->id; | 472 | int report_id = rreq->id; | |
473 | int report_len = 2 + (report_id ? 1 : 0) + rreq->len; | 473 | int report_len = 2 + (report_id ? 1 : 0) + rreq->len; | |
474 | int dataoff; | 474 | int dataoff; | |
475 | uint8_t *finalcmd; | 475 | uint8_t *finalcmd; | |
476 | 476 | |||
477 | DPRINTF(("%s: HID command I2C_HID_CMD_SET_REPORT %d " | 477 | DPRINTF(("%s: HID command I2C_HID_CMD_SET_REPORT %d " | |
478 | "(type %d, len %d):", sc->sc_dev.dv_xname, report_id, | 478 | "(type %d, len %d):", device_xname(sc->sc_dev), report_id, | |
479 | rreq->type, rreq->len)); | 479 | rreq->type, rreq->len)); | |
480 | for (i = 0; i < rreq->len; i++) | 480 | for (i = 0; i < rreq->len; i++) | |
481 | DPRINTF((" %.2x", ((uint8_t *)rreq->data)[i])); | 481 | DPRINTF((" %.2x", ((uint8_t *)rreq->data)[i])); | |
482 | DPRINTF(("\n")); | 482 | DPRINTF(("\n")); | |
483 | 483 | |||
484 | /* | 484 | /* | |
485 | * 7.2.2.4 - "The protocol is optimized for Report < 15. If a | 485 | * 7.2.2.4 - "The protocol is optimized for Report < 15. If a | |
486 | * report ID >= 15 is necessary, then the Report ID in the Low | 486 | * report ID >= 15 is necessary, then the Report ID in the Low | |
487 | * Byte must be set to 1111 and a Third Byte is appended to the | 487 | * Byte must be set to 1111 and a Third Byte is appended to the | |
488 | * protocol. This Third Byte contains the entire/actual report | 488 | * protocol. This Third Byte contains the entire/actual report | |
489 | * ID." | 489 | * ID." | |
490 | */ | 490 | */ | |
491 | dataoff = 4; | 491 | dataoff = 4; | |
@@ -530,69 +530,70 @@ ihidev_hid_command(struct ihidev_softc * | @@ -530,69 +530,70 @@ ihidev_hid_command(struct ihidev_softc * | |||
530 | break; | 530 | break; | |
531 | } | 531 | } | |
532 | 532 | |||
533 | case I2C_HID_CMD_SET_POWER: { | 533 | case I2C_HID_CMD_SET_POWER: { | |
534 | int power = *(int *)arg; | 534 | int power = *(int *)arg; | |
535 | uint8_t cmd[] = { | 535 | uint8_t cmd[] = { | |
536 | htole16(sc->hid_desc.wCommandRegister) & 0xff, | 536 | htole16(sc->hid_desc.wCommandRegister) & 0xff, | |
537 | htole16(sc->hid_desc.wCommandRegister) >> 8, | 537 | htole16(sc->hid_desc.wCommandRegister) >> 8, | |
538 | power, | 538 | power, | |
539 | I2C_HID_CMD_SET_POWER, | 539 | I2C_HID_CMD_SET_POWER, | |
540 | }; | 540 | }; | |
541 | 541 | |||
542 | DPRINTF(("%s: HID command I2C_HID_CMD_SET_POWER(%d)\n", | 542 | DPRINTF(("%s: HID command I2C_HID_CMD_SET_POWER(%d)\n", | |
543 | sc->sc_dev.dv_xname, power)); | 543 | device_xname(sc->sc_dev), power)); | |
544 | 544 | |||
545 | /* 22 00 00 08 */ | 545 | /* 22 00 00 08 */ | |
546 | res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, | 546 | res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, | |
547 | &cmd, sizeof(cmd), NULL, 0, flags); | 547 | &cmd, sizeof(cmd), NULL, 0, flags); | |
548 | 548 | |||
549 | break; | 549 | break; | |
550 | } | 550 | } | |
551 | case I2C_HID_REPORT_DESCR: { | 551 | case I2C_HID_REPORT_DESCR: { | |
552 | uint8_t cmd[] = { | 552 | uint8_t cmd[] = { | |
553 | htole16(sc->hid_desc.wReportDescRegister) & 0xff, | 553 | htole16(sc->hid_desc.wReportDescRegister) & 0xff, | |
554 | htole16(sc->hid_desc.wReportDescRegister) >> 8, | 554 | htole16(sc->hid_desc.wReportDescRegister) >> 8, | |
555 | }; | 555 | }; | |
556 | 556 | |||
557 | DPRINTF(("%s: HID command I2C_HID_REPORT_DESCR at 0x%x with " | 557 | DPRINTF(("%s: HID command I2C_HID_REPORT_DESCR at 0x%x with " | |
558 | "size %d\n", sc->sc_dev.dv_xname, cmd[0], | 558 | "size %d\n", device_xname(sc->sc_dev), cmd[0], | |
559 | sc->sc_reportlen)); | 559 | sc->sc_reportlen)); | |
560 | 560 | |||
561 | /* 20 00 */ | 561 | /* 20 00 */ | |
562 | res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, | 562 | res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, | |
563 | &cmd, sizeof(cmd), sc->sc_report, sc->sc_reportlen, flags); | 563 | &cmd, sizeof(cmd), sc->sc_report, sc->sc_reportlen, flags); | |
564 | 564 | |||
565 | DPRINTF(("%s: HID report descriptor:", sc->sc_dev.dv_xname)); | 565 | DPRINTF(("%s: HID report descriptor:", | |
566 | device_xname(sc->sc_dev))); | |||
566 | for (i = 0; i < sc->sc_reportlen; i++) | 567 | for (i = 0; i < sc->sc_reportlen; i++) | |
567 | DPRINTF((" %.2x", sc->sc_report[i])); | 568 | DPRINTF((" %.2x", sc->sc_report[i])); | |
568 | DPRINTF(("\n")); | 569 | DPRINTF(("\n")); | |
569 | 570 | |||
570 | break; | 571 | break; | |
571 | } | 572 | } | |
572 | default: | 573 | default: | |
573 | aprint_error_dev(sc->sc_dev, "unknown command %d\n", | 574 | aprint_error_dev(sc->sc_dev, "unknown command %d\n", | |
574 | hidcmd); | 575 | hidcmd); | |
575 | } | 576 | } | |
576 | 577 | |||
577 | iic_release_bus(sc->sc_tag, flags); | 578 | iic_release_bus(sc->sc_tag, flags); | |
578 | 579 | |||
579 | return (res); | 580 | return (res); | |
580 | } | 581 | } | |
581 | 582 | |||
582 | static int | 583 | static int | |
583 | ihidev_reset(struct ihidev_softc *sc, bool poll) | 584 | ihidev_reset(struct ihidev_softc *sc, bool poll) | |
584 | { | 585 | { | |
585 | DPRINTF(("%s: resetting\n", sc->sc_dev.dv_xname)); | 586 | DPRINTF(("%s: resetting\n", device_xname(sc->sc_dev))); | |
586 | 587 | |||
587 | if (ihidev_hid_command(sc, I2C_HID_CMD_SET_POWER, | 588 | if (ihidev_hid_command(sc, I2C_HID_CMD_SET_POWER, | |
588 | &I2C_HID_POWER_ON, poll)) { | 589 | &I2C_HID_POWER_ON, poll)) { | |
589 | aprint_error_dev(sc->sc_dev, "failed to power on\n"); | 590 | aprint_error_dev(sc->sc_dev, "failed to power on\n"); | |
590 | return (1); | 591 | return (1); | |
591 | } | 592 | } | |
592 | 593 | |||
593 | DELAY(1000); | 594 | DELAY(1000); | |
594 | 595 | |||
595 | if (ihidev_hid_command(sc, I2C_HID_CMD_RESET, 0, poll)) { | 596 | if (ihidev_hid_command(sc, I2C_HID_CMD_RESET, 0, poll)) { | |
596 | aprint_error_dev(sc->sc_dev, "failed to reset hardware\n"); | 597 | aprint_error_dev(sc->sc_dev, "failed to reset hardware\n"); | |
597 | 598 | |||
598 | ihidev_hid_command(sc, I2C_HID_CMD_SET_POWER, | 599 | ihidev_hid_command(sc, I2C_HID_CMD_SET_POWER, | |
@@ -785,43 +786,43 @@ ihidev_work(struct work *wk, void *arg) | @@ -785,43 +786,43 @@ ihidev_work(struct work *wk, void *arg) | |||
785 | res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, NULL, 0, | 786 | res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, NULL, 0, | |
786 | sc->sc_ibuf, sc->sc_isize, 0); | 787 | sc->sc_ibuf, sc->sc_isize, 0); | |
787 | iic_release_bus(sc->sc_tag, 0); | 788 | iic_release_bus(sc->sc_tag, 0); | |
788 | if (res != 0) | 789 | if (res != 0) | |
789 | goto out; | 790 | goto out; | |
790 | 791 | |||
791 | /* | 792 | /* | |
792 | * 6.1.1 - First two bytes are the packet length, which must be less | 793 | * 6.1.1 - First two bytes are the packet length, which must be less | |
793 | * than or equal to wMaxInputLength | 794 | * than or equal to wMaxInputLength | |
794 | */ | 795 | */ | |
795 | psize = sc->sc_ibuf[0] | sc->sc_ibuf[1] << 8; | 796 | psize = sc->sc_ibuf[0] | sc->sc_ibuf[1] << 8; | |
796 | if (!psize || psize > sc->sc_isize) { | 797 | if (!psize || psize > sc->sc_isize) { | |
797 | DPRINTF(("%s: %s: invalid packet size (%d vs. %d)\n", | 798 | DPRINTF(("%s: %s: invalid packet size (%d vs. %d)\n", | |
798 | sc->sc_dev.dv_xname, __func__, psize, sc->sc_isize)); | 799 | device_xname(sc->sc_dev), __func__, psize, sc->sc_isize)); | |
799 | goto out; | 800 | goto out; | |
800 | } | 801 | } | |
801 | 802 | |||
802 | /* 3rd byte is the report id */ | 803 | /* 3rd byte is the report id */ | |
803 | p = sc->sc_ibuf + 2; | 804 | p = sc->sc_ibuf + 2; | |
804 | psize -= 2; | 805 | psize -= 2; | |
805 | if (sc->sc_nrepid != 1) | 806 | if (sc->sc_nrepid != 1) | |
806 | rep = *p++, psize--; | 807 | rep = *p++, psize--; | |
807 | 808 | |||
808 | if (rep >= sc->sc_nrepid) { | 809 | if (rep >= sc->sc_nrepid) { | |
809 | aprint_error_dev(sc->sc_dev, "%s: bad report id %d\n", | 810 | aprint_error_dev(sc->sc_dev, "%s: bad report id %d\n", | |
810 | __func__, rep); | 811 | __func__, rep); | |
811 | goto out; | 812 | goto out; | |
812 | } | 813 | } | |
813 | 814 | |||
814 | DPRINTF(("%s: %s: hid input (rep %d):", sc->sc_dev.dv_xname, | 815 | DPRINTF(("%s: %s: hid input (rep %d):", device_xname(sc->sc_dev), | |
815 | __func__, rep)); | 816 | __func__, rep)); | |
816 | for (i = 0; i < sc->sc_isize; i++) | 817 | for (i = 0; i < sc->sc_isize; i++) | |
817 | DPRINTF((" %.2x", sc->sc_ibuf[i])); | 818 | DPRINTF((" %.2x", sc->sc_ibuf[i])); | |
818 | DPRINTF(("\n")); | 819 | DPRINTF(("\n")); | |
819 | 820 | |||
820 | scd = sc->sc_subdevs[rep]; | 821 | scd = sc->sc_subdevs[rep]; | |
821 | if (scd == NULL || !(scd->sc_state & IHIDEV_OPEN)) | 822 | if (scd == NULL || !(scd->sc_state & IHIDEV_OPEN)) | |
822 | goto out; | 823 | goto out; | |
823 | 824 | |||
824 | scd->sc_intr(scd, p, psize); | 825 | scd->sc_intr(scd, p, psize); | |
825 | 826 | |||
826 | out: | 827 | out: | |
827 | mutex_exit(&sc->sc_lock); | 828 | mutex_exit(&sc->sc_lock); | |
@@ -874,27 +875,27 @@ ihidev_submatch(device_t parent, cfdata_ | @@ -874,27 +875,27 @@ ihidev_submatch(device_t parent, cfdata_ | |||
874 | if (cf->ihidevcf_reportid != IHIDEV_UNK_REPORTID && | 875 | if (cf->ihidevcf_reportid != IHIDEV_UNK_REPORTID && | |
875 | cf->ihidevcf_reportid != iha->reportid) | 876 | cf->ihidevcf_reportid != iha->reportid) | |
876 | return (0); | 877 | return (0); | |
877 | 878 | |||
878 | return config_match(parent, cf, aux); | 879 | return config_match(parent, cf, aux); | |
879 | } | 880 | } | |
880 | 881 | |||
881 | int | 882 | int | |
882 | ihidev_open(struct ihidev *scd) | 883 | ihidev_open(struct ihidev *scd) | |
883 | { | 884 | { | |
884 | struct ihidev_softc *sc = scd->sc_parent; | 885 | struct ihidev_softc *sc = scd->sc_parent; | |
885 | int error; | 886 | int error; | |
886 | 887 | |||
887 | DPRINTF(("%s: %s: state=%d refcnt=%d\n", sc->sc_dev.dv_xname, | 888 | DPRINTF(("%s: %s: state=%d refcnt=%d\n", device_xname(sc->sc_dev), | |
888 | __func__, scd->sc_state, sc->sc_refcnt)); | 889 | __func__, scd->sc_state, sc->sc_refcnt)); | |
889 | 890 | |||
890 | mutex_enter(&sc->sc_lock); | 891 | mutex_enter(&sc->sc_lock); | |
891 | 892 | |||
892 | if (scd->sc_state & IHIDEV_OPEN || sc->sc_refcnt == INT_MAX) { | 893 | if (scd->sc_state & IHIDEV_OPEN || sc->sc_refcnt == INT_MAX) { | |
893 | error = EBUSY; | 894 | error = EBUSY; | |
894 | goto out; | 895 | goto out; | |
895 | } | 896 | } | |
896 | 897 | |||
897 | scd->sc_state |= IHIDEV_OPEN; | 898 | scd->sc_state |= IHIDEV_OPEN; | |
898 | 899 | |||
899 | if (sc->sc_refcnt++ || sc->sc_isize == 0) { | 900 | if (sc->sc_refcnt++ || sc->sc_isize == 0) { | |
900 | error = 0; | 901 | error = 0; | |
@@ -904,27 +905,27 @@ ihidev_open(struct ihidev *scd) | @@ -904,27 +905,27 @@ ihidev_open(struct ihidev *scd) | |||
904 | /* power on */ | 905 | /* power on */ | |
905 | ihidev_reset(sc, false); | 906 | ihidev_reset(sc, false); | |
906 | error = 0; | 907 | error = 0; | |
907 | 908 | |||
908 | out: mutex_exit(&sc->sc_lock); | 909 | out: mutex_exit(&sc->sc_lock); | |
909 | return error; | 910 | return error; | |
910 | } | 911 | } | |
911 | 912 | |||
912 | void | 913 | void | |
913 | ihidev_close(struct ihidev *scd) | 914 | ihidev_close(struct ihidev *scd) | |
914 | { | 915 | { | |
915 | struct ihidev_softc *sc = scd->sc_parent; | 916 | struct ihidev_softc *sc = scd->sc_parent; | |
916 | 917 | |||
917 | DPRINTF(("%s: %s: state=%d refcnt=%d\n", sc->sc_dev.dv_xname, | 918 | DPRINTF(("%s: %s: state=%d refcnt=%d\n", device_xname(sc->sc_dev), | |
918 | __func__, scd->sc_state, sc->sc_refcnt)); | 919 | __func__, scd->sc_state, sc->sc_refcnt)); | |
919 | 920 | |||
920 | mutex_enter(&sc->sc_lock); | 921 | mutex_enter(&sc->sc_lock); | |
921 | 922 | |||
922 | KASSERTMSG(scd->sc_state & IHIDEV_OPEN, | 923 | KASSERTMSG(scd->sc_state & IHIDEV_OPEN, | |
923 | "%s: closing %s when not open", | 924 | "%s: closing %s when not open", | |
924 | device_xname(scd->sc_idev), | 925 | device_xname(scd->sc_idev), | |
925 | device_xname(sc->sc_dev)); | 926 | device_xname(sc->sc_dev)); | |
926 | scd->sc_state &= ~IHIDEV_OPEN; | 927 | scd->sc_state &= ~IHIDEV_OPEN; | |
927 | 928 | |||
928 | if (--sc->sc_refcnt) | 929 | if (--sc->sc_refcnt) | |
929 | goto out; | 930 | goto out; | |
930 | 931 |
--- src/sys/dev/i2c/pcagpio.c 2021/06/21 03:12:54 1.11
+++ src/sys/dev/i2c/pcagpio.c 2022/02/12 03:24:35 1.12
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pcagpio.c,v 1.11 2021/06/21 03:12:54 christos Exp $ */ | 1 | /* $NetBSD: pcagpio.c,v 1.12 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2020 Michael Lorenz | 4 | * Copyright (c) 2020 Michael Lorenz | |
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. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | /* | 29 | /* | |
30 | * a driver for Philips Semiconductor PCA9555 GPIO controllers | 30 | * a driver for Philips Semiconductor PCA9555 GPIO controllers | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.11 2021/06/21 03:12:54 christos Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.12 2022/02/12 03:24:35 riastradh Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | #ifdef PCAGPIO_DEBUG | 39 | #ifdef PCAGPIO_DEBUG | |
40 | #include <sys/kernel.h> | 40 | #include <sys/kernel.h> | |
41 | #endif | 41 | #endif | |
42 | #include <sys/conf.h> | 42 | #include <sys/conf.h> | |
43 | #include <sys/bus.h> | 43 | #include <sys/bus.h> | |
44 | 44 | |||
45 | #include <dev/i2c/i2cvar.h> | 45 | #include <dev/i2c/i2cvar.h> | |
46 | #include <dev/led.h> | 46 | #include <dev/led.h> | |
47 | 47 | |||
@@ -162,29 +162,29 @@ pcagpio_attach(device_t parent, device_t | @@ -162,29 +162,29 @@ pcagpio_attach(device_t parent, device_t | |||
162 | aprint_normal(": %s\n", sc->sc_is_16bit ? "PCA9555" : "PCA9556"); | 162 | aprint_normal(": %s\n", sc->sc_is_16bit ? "PCA9555" : "PCA9556"); | |
163 | 163 | |||
164 | sc->sc_state = pcagpio_readreg(sc, PCAGPIO_OUTPUT); | 164 | sc->sc_state = pcagpio_readreg(sc, PCAGPIO_OUTPUT); | |
165 | 165 | |||
166 | #ifdef PCAGPIO_DEBUG | 166 | #ifdef PCAGPIO_DEBUG | |
167 | uint32_t in, out; | 167 | uint32_t in, out; | |
168 | sc->sc_dir = pcagpio_readreg(sc, PCAGPIO_CONFIG); | 168 | sc->sc_dir = pcagpio_readreg(sc, PCAGPIO_CONFIG); | |
169 | sc->sc_in = pcagpio_readreg(sc, PCAGPIO_INPUT); | 169 | sc->sc_in = pcagpio_readreg(sc, PCAGPIO_INPUT); | |
170 | in = sc-> sc_in; | 170 | in = sc-> sc_in; | |
171 | out = sc->sc_state; | 171 | out = sc->sc_state; | |
172 | 172 | |||
173 | out &= ~sc->sc_dir; | 173 | out &= ~sc->sc_dir; | |
174 | in &= sc->sc_dir; | 174 | in &= sc->sc_dir; | |
175 | 175 | |||
176 | printdir(sc->sc_dev->dv_xname, in, sc->sc_dir, 'I'); | 176 | printdir(device_xname(sc->sc_dev), in, sc->sc_dir, 'I'); | |
177 | printdir(sc->sc_dev->dv_xname, out, ~sc->sc_dir, 'O'); | 177 | printdir(device_xname(sc->sc_dev), out, ~sc->sc_dir, 'O'); | |
178 | 178 | |||
179 | callout_init(&sc->sc_timer, CALLOUT_MPSAFE); | 179 | callout_init(&sc->sc_timer, CALLOUT_MPSAFE); | |
180 | callout_reset(&sc->sc_timer, hz*20, pcagpio_timeout, sc); | 180 | callout_reset(&sc->sc_timer, hz*20, pcagpio_timeout, sc); | |
181 | 181 | |||
182 | #endif | 182 | #endif | |
183 | 183 | |||
184 | pins = prop_dictionary_get(dict, "pins"); | 184 | pins = prop_dictionary_get(dict, "pins"); | |
185 | if (pins != NULL) { | 185 | if (pins != NULL) { | |
186 | int i, num, def; | 186 | int i, num, def; | |
187 | char name[32]; | 187 | char name[32]; | |
188 | const char *spptr, *nptr; | 188 | const char *spptr, *nptr; | |
189 | bool ok = TRUE, act; | 189 | bool ok = TRUE, act; | |
190 | 190 | |||
@@ -236,35 +236,35 @@ pcagpio_timeout(void *v) | @@ -236,35 +236,35 @@ pcagpio_timeout(void *v) | |||
236 | { | 236 | { | |
237 | struct pcagpio_softc *sc = v; | 237 | struct pcagpio_softc *sc = v; | |
238 | uint32_t out, dir, in, o_out, o_in; | 238 | uint32_t out, dir, in, o_out, o_in; | |
239 | 239 | |||
240 | out = pcagpio_readreg(sc, PCAGPIO_OUTPUT); | 240 | out = pcagpio_readreg(sc, PCAGPIO_OUTPUT); | |
241 | dir = pcagpio_readreg(sc, PCAGPIO_CONFIG); | 241 | dir = pcagpio_readreg(sc, PCAGPIO_CONFIG); | |
242 | in = pcagpio_readreg(sc, PCAGPIO_INPUT); | 242 | in = pcagpio_readreg(sc, PCAGPIO_INPUT); | |
243 | if (out != sc->sc_state || dir != sc->sc_dir || in != sc->sc_in) { | 243 | if (out != sc->sc_state || dir != sc->sc_dir || in != sc->sc_in) { | |
244 | aprint_normal_dev(sc->sc_dev, "status change\n"); | 244 | aprint_normal_dev(sc->sc_dev, "status change\n"); | |
245 | o_out = sc->sc_state; | 245 | o_out = sc->sc_state; | |
246 | o_in = sc->sc_in; | 246 | o_in = sc->sc_in; | |
247 | o_out &= ~sc->sc_dir; | 247 | o_out &= ~sc->sc_dir; | |
248 | o_in &= sc->sc_dir; | 248 | o_in &= sc->sc_dir; | |
249 | printdir(sc->sc_dev->dv_xname, o_in, sc->sc_dir, 'I'); | 249 | printdir(device_xname(sc->sc_dev), o_in, sc->sc_dir, 'I'); | |
250 | printdir(sc->sc_dev->dv_xname, o_out, ~sc->sc_dir, 'O'); | 250 | printdir(device_xname(sc->sc_dev), o_out, ~sc->sc_dir, 'O'); | |
251 | sc->sc_state = out; | 251 | sc->sc_state = out; | |
252 | sc->sc_dir = dir; | 252 | sc->sc_dir = dir; | |
253 | sc->sc_in = in; | 253 | sc->sc_in = in; | |
254 | out &= ~sc->sc_dir; | 254 | out &= ~sc->sc_dir; | |
255 | in &= sc->sc_dir; | 255 | in &= sc->sc_dir; | |
256 | printdir(sc->sc_dev->dv_xname, in, sc->sc_dir, 'I'); | 256 | printdir(device_xname(sc->sc_dev), in, sc->sc_dir, 'I'); | |
257 | printdir(sc->sc_dev->dv_xname, out, ~sc->sc_dir, 'O'); | 257 | printdir(device_xname(sc->sc_dev), out, ~sc->sc_dir, 'O'); | |
258 | } | 258 | } | |
259 | callout_reset(&sc->sc_timer, hz*60, pcagpio_timeout, sc); | 259 | callout_reset(&sc->sc_timer, hz*60, pcagpio_timeout, sc); | |
260 | } | 260 | } | |
261 | #endif | 261 | #endif | |
262 | 262 | |||
263 | static void | 263 | static void | |
264 | pcagpio_writereg(struct pcagpio_softc *sc, int reg, uint32_t val) | 264 | pcagpio_writereg(struct pcagpio_softc *sc, int reg, uint32_t val) | |
265 | { | 265 | { | |
266 | uint8_t cmd; | 266 | uint8_t cmd; | |
267 | 267 | |||
268 | iic_acquire_bus(sc->sc_i2c, 0); | 268 | iic_acquire_bus(sc->sc_i2c, 0); | |
269 | if (sc->sc_is_16bit) { | 269 | if (sc->sc_is_16bit) { | |
270 | uint16_t creg; | 270 | uint16_t creg; |
--- src/sys/dev/i2c/tsllux.c 2021/01/27 02:29:48 1.3
+++ src/sys/dev/i2c/tsllux.c 2022/02/12 03:24:35 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: tsllux.c,v 1.3 2021/01/27 02:29:48 thorpej Exp $ */ | 1 | /* $NetBSD: tsllux.c,v 1.4 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2018 Jason R. Thorpe | 4 | * Copyright (c) 2018 Jason R. Thorpe | |
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. | |
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: tsllux.c,v 1.3 2021/01/27 02:29:48 thorpej Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: tsllux.c,v 1.4 2022/02/12 03:24:35 riastradh Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/systm.h> | 33 | #include <sys/systm.h> | |
34 | #include <sys/device.h> | 34 | #include <sys/device.h> | |
35 | #include <sys/conf.h> | 35 | #include <sys/conf.h> | |
36 | #include <sys/bus.h> | 36 | #include <sys/bus.h> | |
37 | #include <sys/kernel.h> | 37 | #include <sys/kernel.h> | |
38 | #include <sys/kmem.h> | 38 | #include <sys/kmem.h> | |
39 | #include <sys/mutex.h> | 39 | #include <sys/mutex.h> | |
40 | #include <sys/proc.h> | 40 | #include <sys/proc.h> | |
41 | #include <sys/sysctl.h> | 41 | #include <sys/sysctl.h> | |
42 | 42 | |||
43 | #include <dev/i2c/i2cvar.h> | 43 | #include <dev/i2c/i2cvar.h> | |
@@ -144,28 +144,27 @@ static void | @@ -144,28 +144,27 @@ static void | |||
144 | tsllux_attach(device_t parent, device_t self, void *aux) | 144 | tsllux_attach(device_t parent, device_t self, void *aux) | |
145 | { | 145 | { | |
146 | struct tsllux_softc *sc = device_private(self); | 146 | struct tsllux_softc *sc = device_private(self); | |
147 | struct i2c_attach_args *ia = aux; | 147 | struct i2c_attach_args *ia = aux; | |
148 | bool have_i2c; | 148 | bool have_i2c; | |
149 | 149 | |||
150 | /* XXX IPL_NONE changes when we support threshold interrupts. */ | 150 | /* XXX IPL_NONE changes when we support threshold interrupts. */ | |
151 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); | 151 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); | |
152 | 152 | |||
153 | sc->sc_dev = self; | 153 | sc->sc_dev = self; | |
154 | sc->sc_i2c = ia->ia_tag; | 154 | sc->sc_i2c = ia->ia_tag; | |
155 | sc->sc_addr = ia->ia_addr; | 155 | sc->sc_addr = ia->ia_addr; | |
156 | 156 | |||
157 | if (self->dv_cfdata != NULL && | 157 | if (device_cfdata(self)->cf_flags & TSLLUX_F_CS_PACKAGE) | |
158 | self->dv_cfdata->cf_flags & TSLLUX_F_CS_PACKAGE) | |||
159 | sc->sc_cs_package = true; | 158 | sc->sc_cs_package = true; | |
160 | 159 | |||
161 | if (iic_acquire_bus(ia->ia_tag, 0) != 0) { | 160 | if (iic_acquire_bus(ia->ia_tag, 0) != 0) { | |
162 | return; | 161 | return; | |
163 | } | 162 | } | |
164 | 163 | |||
165 | have_i2c = true; | 164 | have_i2c = true; | |
166 | 165 | |||
167 | /* Power on the device and clear any pending interrupts. */ | 166 | /* Power on the device and clear any pending interrupts. */ | |
168 | if (tsllux_write1(sc, TSL256x_REG_CONTROL | COMMAND6x_CLEAR, | 167 | if (tsllux_write1(sc, TSL256x_REG_CONTROL | COMMAND6x_CLEAR, | |
169 | CONTROL6x_POWER_ON)) { | 168 | CONTROL6x_POWER_ON)) { | |
170 | aprint_error_dev(self, ": unable to power on device\n"); | 169 | aprint_error_dev(self, ": unable to power on device\n"); | |
171 | goto out; | 170 | goto out; |
--- src/sys/dev/isa/wss_isa.c 2019/05/08 13:40:18 1.30
+++ src/sys/dev/isa/wss_isa.c 2022/02/12 03:24:35 1.31
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: wss_isa.c,v 1.30 2019/05/08 13:40:18 isaki Exp $ */ | 1 | /* $NetBSD: wss_isa.c,v 1.31 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1994 John Brezak | 4 | * Copyright (c) 1994 John Brezak | |
5 | * Copyright (c) 1991-1993 Regents of the University of California. | 5 | * Copyright (c) 1991-1993 Regents of the University of California. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * MAD support: | 8 | * MAD support: | |
9 | * Copyright (c) 1996 Lennart Augustsson | 9 | * Copyright (c) 1996 Lennart Augustsson | |
10 | * Based on code which is | 10 | * Based on code which is | |
11 | * Copyright (c) 1994 Hannu Savolainen | 11 | * Copyright (c) 1994 Hannu Savolainen | |
12 | * | 12 | * | |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | |
14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | |
@@ -31,27 +31,27 @@ | @@ -31,27 +31,27 @@ | |||
31 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 31 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
32 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 32 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
33 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 33 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
34 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 34 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
35 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 35 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
36 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 36 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
37 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 37 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
38 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 38 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
39 | * SUCH DAMAGE. | 39 | * SUCH DAMAGE. | |
40 | * | 40 | * | |
41 | */ | 41 | */ | |
42 | 42 | |||
43 | #include <sys/cdefs.h> | 43 | #include <sys/cdefs.h> | |
44 | __KERNEL_RCSID(0, "$NetBSD: wss_isa.c,v 1.30 2019/05/08 13:40:18 isaki Exp $"); | 44 | __KERNEL_RCSID(0, "$NetBSD: wss_isa.c,v 1.31 2022/02/12 03:24:35 riastradh Exp $"); | |
45 | 45 | |||
46 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
47 | #include <sys/systm.h> | 47 | #include <sys/systm.h> | |
48 | #include <sys/device.h> | 48 | #include <sys/device.h> | |
49 | #include <sys/errno.h> | 49 | #include <sys/errno.h> | |
50 | 50 | |||
51 | #include <sys/cpu.h> | 51 | #include <sys/cpu.h> | |
52 | #include <sys/intr.h> | 52 | #include <sys/intr.h> | |
53 | #include <sys/bus.h> | 53 | #include <sys/bus.h> | |
54 | 54 | |||
55 | #include <sys/audioio.h> | 55 | #include <sys/audioio.h> | |
56 | #include <dev/audio/audio_if.h> | 56 | #include <dev/audio/audio_if.h> | |
57 | 57 | |||
@@ -61,91 +61,85 @@ __KERNEL_RCSID(0, "$NetBSD: wss_isa.c,v | @@ -61,91 +61,85 @@ __KERNEL_RCSID(0, "$NetBSD: wss_isa.c,v | |||
61 | #include <dev/ic/ad1848reg.h> | 61 | #include <dev/ic/ad1848reg.h> | |
62 | #include <dev/isa/ad1848var.h> | 62 | #include <dev/isa/ad1848var.h> | |
63 | #include <dev/isa/wssreg.h> | 63 | #include <dev/isa/wssreg.h> | |
64 | #include <dev/isa/wssvar.h> | 64 | #include <dev/isa/wssvar.h> | |
65 | #include <dev/isa/madreg.h> | 65 | #include <dev/isa/madreg.h> | |
66 | 66 | |||
67 | #ifdef AUDIO_DEBUG | 67 | #ifdef AUDIO_DEBUG | |
68 | #define DPRINTF(x) if (wssdebug) printf x | 68 | #define DPRINTF(x) if (wssdebug) printf x | |
69 | extern int wssdebug; | 69 | extern int wssdebug; | |
70 | #else | 70 | #else | |
71 | #define DPRINTF(x) | 71 | #define DPRINTF(x) | |
72 | #endif | 72 | #endif | |
73 | 73 | |||
74 | static int wssfind(device_t, struct wss_softc *, int, | 74 | static int wssfind(device_t, cfdata_t, struct wss_softc *, int, | |
75 | struct isa_attach_args *); | 75 | struct isa_attach_args *); | |
76 | 76 | |||
77 | static void madprobe(struct wss_softc *, int); | 77 | static void madprobe(struct wss_softc *, int); | |
78 | static void madunmap(struct wss_softc *); | 78 | static void madunmap(struct wss_softc *); | |
79 | static int detect_mad16(struct wss_softc *, int); | 79 | static int detect_mad16(struct wss_softc *, int); | |
80 | 80 | |||
81 | int wss_isa_probe(device_t, cfdata_t, void *); | 81 | int wss_isa_probe(device_t, cfdata_t, void *); | |
82 | void wss_isa_attach(device_t, device_t, void *); | 82 | void wss_isa_attach(device_t, device_t, void *); | |
83 | 83 | |||
84 | CFATTACH_DECL_NEW(wss_isa, sizeof(struct wss_softc), | 84 | CFATTACH_DECL_NEW(wss_isa, sizeof(struct wss_softc), | |
85 | wss_isa_probe, wss_isa_attach, NULL, NULL); | 85 | wss_isa_probe, wss_isa_attach, NULL, NULL); | |
86 | 86 | |||
87 | /* | 87 | /* | |
88 | * Probe for the Microsoft Sound System hardware. | 88 | * Probe for the Microsoft Sound System hardware. | |
89 | */ | 89 | */ | |
90 | int | 90 | int | |
91 | wss_isa_probe(device_t parent, cfdata_t match, void *aux) | 91 | wss_isa_probe(device_t parent, cfdata_t match, void *aux) | |
92 | { | 92 | { | |
93 | struct isa_attach_args *ia; | 93 | struct isa_attach_args *ia; | |
94 | struct device probedev; | |||
95 | struct wss_softc probesc, *sc; | 94 | struct wss_softc probesc, *sc; | |
96 | struct ad1848_softc *ac; | |||
97 | 95 | |||
98 | ia = aux; | 96 | ia = aux; | |
99 | if (ia->ia_nio < 1) | 97 | if (ia->ia_nio < 1) | |
100 | return 0; | 98 | return 0; | |
101 | if (ia->ia_nirq < 1) | 99 | if (ia->ia_nirq < 1) | |
102 | return 0; | 100 | return 0; | |
103 | if (ia->ia_ndrq < 1) | 101 | if (ia->ia_ndrq < 1) | |
104 | return 0; | 102 | return 0; | |
105 | 103 | |||
106 | if (ISA_DIRECT_CONFIG(ia)) | 104 | if (ISA_DIRECT_CONFIG(ia)) | |
107 | return 0; | 105 | return 0; | |
108 | 106 | |||
109 | memset(&probedev, 0, sizeof probedev); | |||
110 | memset(&probesc, 0, sizeof probesc); | 107 | memset(&probesc, 0, sizeof probesc); | |
111 | sc = &probesc; | 108 | sc = &probesc; | |
112 | ac = &sc->sc_ad1848.sc_ad1848; | 109 | if (wssfind(parent, match, sc, 1, aux)) { | |
113 | ac->sc_dev = &probedev; | |||
114 | ac->sc_dev->dv_cfdata = match; | |||
115 | if (wssfind(parent, sc, 1, aux)) { | |||
116 | bus_space_unmap(sc->sc_iot, sc->sc_ioh, WSS_CODEC); | 110 | bus_space_unmap(sc->sc_iot, sc->sc_ioh, WSS_CODEC); | |
117 | ad1848_isa_unmap(&sc->sc_ad1848); | 111 | ad1848_isa_unmap(&sc->sc_ad1848); | |
118 | madunmap(sc); | 112 | madunmap(sc); | |
119 | return 1; | 113 | return 1; | |
120 | } else | 114 | } else | |
121 | /* Everything is already unmapped */ | 115 | /* Everything is already unmapped */ | |
122 | return 0; | 116 | return 0; | |
123 | } | 117 | } | |
124 | 118 | |||
125 | static int | 119 | static int | |
126 | wssfind(device_t parent, struct wss_softc *sc, int probing, | 120 | wssfind(device_t parent, cfdata_t match, struct wss_softc *sc, int probing, | |
127 | struct isa_attach_args *ia) | 121 | struct isa_attach_args *ia) | |
128 | { | 122 | { | |
129 | static u_char interrupt_bits[12] = { | 123 | static u_char interrupt_bits[12] = { | |
130 | -1, -1, -1, -1, -1, -1, -1, 0x08, -1, 0x10, 0x18, 0x20 | 124 | -1, -1, -1, -1, -1, -1, -1, 0x08, -1, 0x10, 0x18, 0x20 | |
131 | }; | 125 | }; | |
132 | static u_char dma_bits[4] = {1, 2, 0, 3}; | 126 | static u_char dma_bits[4] = {1, 2, 0, 3}; | |
133 | struct ad1848_softc *ac; | 127 | struct ad1848_softc *ac; | |
134 | int ndrq, playdrq, recdrq; | 128 | int ndrq, playdrq, recdrq; | |
135 | 129 | |||
136 | ac = &sc->sc_ad1848.sc_ad1848; | 130 | ac = &sc->sc_ad1848.sc_ad1848; | |
137 | sc->sc_iot = ia->ia_iot; | 131 | sc->sc_iot = ia->ia_iot; | |
138 | if (device_cfdata(ac->sc_dev)->cf_flags & 1) | 132 | if (match->cf_flags & 1) | |
139 | madprobe(sc, ia->ia_io[0].ir_addr); | 133 | madprobe(sc, ia->ia_io[0].ir_addr); | |
140 | else | 134 | else | |
141 | sc->mad_chip_type = MAD_NONE; | 135 | sc->mad_chip_type = MAD_NONE; | |
142 | 136 | |||
143 | #if 0 | 137 | #if 0 | |
144 | if (!WSS_BASE_VALID(ia->ia_io[0].ir_addr)) { | 138 | if (!WSS_BASE_VALID(ia->ia_io[0].ir_addr)) { | |
145 | DPRINTF(("wss: configured iobase %x invalid\n", ia->ia_iobase)); | 139 | DPRINTF(("wss: configured iobase %x invalid\n", ia->ia_iobase)); | |
146 | goto bad1; | 140 | goto bad1; | |
147 | } | 141 | } | |
148 | #endif | 142 | #endif | |
149 | 143 | |||
150 | /* Map the ports upto the AD1848 port */ | 144 | /* Map the ports upto the AD1848 port */ | |
151 | if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, WSS_CODEC, | 145 | if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, WSS_CODEC, | |
@@ -235,27 +229,27 @@ bad1: | @@ -235,27 +229,27 @@ bad1: | |||
235 | * pseudo-device driver . | 229 | * pseudo-device driver . | |
236 | */ | 230 | */ | |
237 | void | 231 | void | |
238 | wss_isa_attach(device_t parent, device_t self, void *aux) | 232 | wss_isa_attach(device_t parent, device_t self, void *aux) | |
239 | { | 233 | { | |
240 | struct wss_softc *sc; | 234 | struct wss_softc *sc; | |
241 | struct ad1848_softc *ac; | 235 | struct ad1848_softc *ac; | |
242 | struct isa_attach_args *ia; | 236 | struct isa_attach_args *ia; | |
243 | 237 | |||
244 | sc = device_private(self); | 238 | sc = device_private(self); | |
245 | ac = &sc->sc_ad1848.sc_ad1848; | 239 | ac = &sc->sc_ad1848.sc_ad1848; | |
246 | ac->sc_dev = self; | 240 | ac->sc_dev = self; | |
247 | ia = aux; | 241 | ia = aux; | |
248 | if (!wssfind(parent, sc, 0, ia)) { | 242 | if (!wssfind(parent, device_cfdata(self), sc, 0, ia)) { | |
249 | aprint_error_dev(self, "wssfind failed\n"); | 243 | aprint_error_dev(self, "wssfind failed\n"); | |
250 | return; | 244 | return; | |
251 | } | 245 | } | |
252 | 246 | |||
253 | sc->wss_ic = ia->ia_ic; | 247 | sc->wss_ic = ia->ia_ic; | |
254 | 248 | |||
255 | wssattach(sc); | 249 | wssattach(sc); | |
256 | } | 250 | } | |
257 | 251 | |||
258 | /* | 252 | /* | |
259 | * Copyright by Hannu Savolainen 1994 | 253 | * Copyright by Hannu Savolainen 1994 | |
260 | * | 254 | * | |
261 | * Redistribution and use in source and binary forms, with or without | 255 | * Redistribution and use in source and binary forms, with or without |
--- src/sys/dev/marvell/if_mvxpe.c 2021/12/05 07:57:38 1.37
+++ src/sys/dev/marvell/if_mvxpe.c 2022/02/12 03:24:35 1.38
@@ -1,41 +1,41 @@ | @@ -1,41 +1,41 @@ | |||
1 | /* $NetBSD: if_mvxpe.c,v 1.37 2021/12/05 07:57:38 msaitoh Exp $ */ | 1 | /* $NetBSD: if_mvxpe.c,v 1.38 2022/02/12 03:24:35 riastradh Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 2015 Internet Initiative Japan Inc. | 3 | * Copyright (c) 2015 Internet Initiative Japan Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | 18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
23 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | 23 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
24 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 24 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
25 | * POSSIBILITY OF SUCH DAMAGE. | 25 | * POSSIBILITY OF SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | #include <sys/cdefs.h> | 27 | #include <sys/cdefs.h> | |
28 | __KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.37 2021/12/05 07:57:38 msaitoh Exp $"); | 28 | __KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.38 2022/02/12 03:24:35 riastradh Exp $"); | |
29 | 29 | |||
30 | #include "opt_multiprocessor.h" | 30 | #include "opt_multiprocessor.h" | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/bus.h> | 33 | #include <sys/bus.h> | |
34 | #include <sys/callout.h> | 34 | #include <sys/callout.h> | |
35 | #include <sys/device.h> | 35 | #include <sys/device.h> | |
36 | #include <sys/endian.h> | 36 | #include <sys/endian.h> | |
37 | #include <sys/errno.h> | 37 | #include <sys/errno.h> | |
38 | #include <sys/evcnt.h> | 38 | #include <sys/evcnt.h> | |
39 | #include <sys/kernel.h> | 39 | #include <sys/kernel.h> | |
40 | #include <sys/kmem.h> | 40 | #include <sys/kmem.h> | |
41 | #include <sys/mutex.h> | 41 | #include <sys/mutex.h> | |
@@ -472,27 +472,28 @@ mvxpe_attach(device_t parent, device_t s | @@ -472,27 +472,28 @@ mvxpe_attach(device_t parent, device_t s | |||
472 | } | 472 | } | |
473 | mii->mii_ifp = ifp; | 473 | mii->mii_ifp = ifp; | |
474 | mii->mii_readreg = mvxpe_miibus_readreg; | 474 | mii->mii_readreg = mvxpe_miibus_readreg; | |
475 | mii->mii_writereg = mvxpe_miibus_writereg; | 475 | mii->mii_writereg = mvxpe_miibus_writereg; | |
476 | mii->mii_statchg = mvxpe_miibus_statchg; | 476 | mii->mii_statchg = mvxpe_miibus_statchg; | |
477 | 477 | |||
478 | sc->sc_ethercom.ec_mii = mii; | 478 | sc->sc_ethercom.ec_mii = mii; | |
479 | ifmedia_init(&mii->mii_media, 0, mvxpe_mediachange, mvxpe_mediastatus); | 479 | ifmedia_init(&mii->mii_media, 0, mvxpe_mediachange, mvxpe_mediastatus); | |
480 | /* | 480 | /* | |
481 | * XXX: phy addressing highly depends on Board Design. | 481 | * XXX: phy addressing highly depends on Board Design. | |
482 | * we assume phyaddress == MAC unit number here, | 482 | * we assume phyaddress == MAC unit number here, | |
483 | * but some boards may not. | 483 | * but some boards may not. | |
484 | */ | 484 | */ | |
485 | mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, sc->sc_dev->dv_unit, 0); | 485 | mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, device_unit(sc->sc_dev), | |
486 | 0); | |||
486 | child = LIST_FIRST(&mii->mii_phys); | 487 | child = LIST_FIRST(&mii->mii_phys); | |
487 | if (child == NULL) { | 488 | if (child == NULL) { | |
488 | aprint_error_dev(self, "no PHY found!\n"); | 489 | aprint_error_dev(self, "no PHY found!\n"); | |
489 | ifmedia_add(&mii->mii_media, IFM_ETHER | IFM_MANUAL, 0, NULL); | 490 | ifmedia_add(&mii->mii_media, IFM_ETHER | IFM_MANUAL, 0, NULL); | |
490 | ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_MANUAL); | 491 | ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_MANUAL); | |
491 | } else { | 492 | } else { | |
492 | ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_AUTO); | 493 | ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_AUTO); | |
493 | phyaddr = MVXPE_PHYADDR_PHYAD(child->mii_phy); | 494 | phyaddr = MVXPE_PHYADDR_PHYAD(child->mii_phy); | |
494 | MVXPE_WRITE(sc, MVXPE_PHYADDR, phyaddr); | 495 | MVXPE_WRITE(sc, MVXPE_PHYADDR, phyaddr); | |
495 | DPRINTSC(sc, 1, "PHYADDR: %#x\n", MVXPE_READ(sc, MVXPE_PHYADDR)); | 496 | DPRINTSC(sc, 1, "PHYADDR: %#x\n", MVXPE_READ(sc, MVXPE_PHYADDR)); | |
496 | } | 497 | } | |
497 | 498 | |||
498 | /* | 499 | /* |
--- src/sys/dev/marvell/mvxpsec.c 2021/12/10 20:36:04 1.9
+++ src/sys/dev/marvell/mvxpsec.c 2022/02/12 03:24:36 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mvxpsec.c,v 1.9 2021/12/10 20:36:04 andvar Exp $ */ | 1 | /* $NetBSD: mvxpsec.c,v 1.10 2022/02/12 03:24:36 riastradh Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 2015 Internet Initiative Japan Inc. | 3 | * Copyright (c) 2015 Internet Initiative Japan Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
@@ -1026,27 +1026,27 @@ mvxpsec_dma_sync_packet(struct mvxpsec_s | @@ -1026,27 +1026,27 @@ mvxpsec_dma_sync_packet(struct mvxpsec_s | |||
1026 | /* | 1026 | /* | |
1027 | * Initialize MVXPSEC Internal SRAM | 1027 | * Initialize MVXPSEC Internal SRAM | |
1028 | * | 1028 | * | |
1029 | * - must be called after DMA initizlization. | 1029 | * - must be called after DMA initizlization. | |
1030 | * - make VM mapping for SRAM area on MBus. | 1030 | * - make VM mapping for SRAM area on MBus. | |
1031 | */ | 1031 | */ | |
1032 | STATIC int | 1032 | STATIC int | |
1033 | mvxpsec_init_sram(struct mvxpsec_softc *sc) | 1033 | mvxpsec_init_sram(struct mvxpsec_softc *sc) | |
1034 | { | 1034 | { | |
1035 | uint32_t tag, target, attr, base, size; | 1035 | uint32_t tag, target, attr, base, size; | |
1036 | vaddr_t va; | 1036 | vaddr_t va; | |
1037 | int window; | 1037 | int window; | |
1038 | 1038 | |||
1039 | switch (sc->sc_dev->dv_unit) { | 1039 | switch (device_unit(sc->sc_dev)) { | |
1040 | case 0: | 1040 | case 0: | |
1041 | tag = ARMADAXP_TAG_CRYPT0; | 1041 | tag = ARMADAXP_TAG_CRYPT0; | |
1042 | break; | 1042 | break; | |
1043 | case 1: | 1043 | case 1: | |
1044 | tag = ARMADAXP_TAG_CRYPT1; | 1044 | tag = ARMADAXP_TAG_CRYPT1; | |
1045 | break; | 1045 | break; | |
1046 | default: | 1046 | default: | |
1047 | aprint_error_dev(sc->sc_dev, "no internal SRAM mapping\n"); | 1047 | aprint_error_dev(sc->sc_dev, "no internal SRAM mapping\n"); | |
1048 | return -1; | 1048 | return -1; | |
1049 | } | 1049 | } | |
1050 | 1050 | |||
1051 | window = mvsoc_target(tag, &target, &attr, &base, &size); | 1051 | window = mvsoc_target(tag, &target, &attr, &base, &size); | |
1052 | if (window >= nwindow) { | 1052 | if (window >= nwindow) { |
--- src/sys/dev/pci/xmm7360.c 2021/10/18 08:15:00 1.13
+++ src/sys/dev/pci/xmm7360.c 2022/02/12 03:24:36 1.14
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: xmm7360.c,v 1.13 2021/10/18 08:15:00 hannken Exp $ */ | 1 | /* $NetBSD: xmm7360.c,v 1.14 2022/02/12 03:24:36 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Device driver for Intel XMM7360 LTE modems, eg. Fibocom L850-GL. | 4 | * Device driver for Intel XMM7360 LTE modems, eg. Fibocom L850-GL. | |
5 | * Written by James Wah | 5 | * Written by James Wah | |
6 | * james@laird-wah.net | 6 | * james@laird-wah.net | |
7 | * | 7 | * | |
8 | * Development of this driver was supported by genua GmbH | 8 | * Development of this driver was supported by genua GmbH | |
9 | * | 9 | * | |
10 | * Copyright (c) 2020 genua GmbH <info@genua.de> | 10 | * Copyright (c) 2020 genua GmbH <info@genua.de> | |
11 | * Copyright (c) 2020 James Wah <james@laird-wah.net> | 11 | * Copyright (c) 2020 James Wah <james@laird-wah.net> | |
12 | * | 12 | * | |
13 | * The OpenBSD and NetBSD support was written by Jaromir Dolecek for | 13 | * The OpenBSD and NetBSD support was written by Jaromir Dolecek for | |
14 | * Moritz Systems Technology Company Sp. z o.o. | 14 | * Moritz Systems Technology Company Sp. z o.o. | |
@@ -65,27 +65,27 @@ MODULE_DEVICE_TABLE(pci, xmm7360_ids); | @@ -65,27 +65,27 @@ MODULE_DEVICE_TABLE(pci, xmm7360_ids); | |||
65 | 65 | |||
66 | #endif | 66 | #endif | |
67 | 67 | |||
68 | #if defined(__OpenBSD__) || defined(__NetBSD__) | 68 | #if defined(__OpenBSD__) || defined(__NetBSD__) | |
69 | 69 | |||
70 | #ifdef __OpenBSD__ | 70 | #ifdef __OpenBSD__ | |
71 | #include "bpfilter.h" | 71 | #include "bpfilter.h" | |
72 | #endif | 72 | #endif | |
73 | #ifdef __NetBSD__ | 73 | #ifdef __NetBSD__ | |
74 | #include "opt_inet.h" | 74 | #include "opt_inet.h" | |
75 | #include "opt_gateway.h" | 75 | #include "opt_gateway.h" | |
76 | 76 | |||
77 | #include <sys/cdefs.h> | 77 | #include <sys/cdefs.h> | |
78 | __KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.13 2021/10/18 08:15:00 hannken Exp $"); | 78 | __KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.14 2022/02/12 03:24:36 riastradh Exp $"); | |
79 | #endif | 79 | #endif | |
80 | 80 | |||
81 | #include <sys/param.h> | 81 | #include <sys/param.h> | |
82 | #include <sys/systm.h> | 82 | #include <sys/systm.h> | |
83 | #include <sys/sockio.h> | 83 | #include <sys/sockio.h> | |
84 | #include <sys/mbuf.h> | 84 | #include <sys/mbuf.h> | |
85 | #include <sys/kernel.h> | 85 | #include <sys/kernel.h> | |
86 | #include <sys/device.h> | 86 | #include <sys/device.h> | |
87 | #include <sys/socket.h> | 87 | #include <sys/socket.h> | |
88 | #include <sys/mutex.h> | 88 | #include <sys/mutex.h> | |
89 | #include <sys/tty.h> | 89 | #include <sys/tty.h> | |
90 | #include <sys/conf.h> | 90 | #include <sys/conf.h> | |
91 | #include <sys/kthread.h> | 91 | #include <sys/kthread.h> | |
@@ -133,29 +133,29 @@ typedef uint32_t u32; | @@ -133,29 +133,29 @@ typedef uint32_t u32; | |||
133 | typedef bus_addr_t dma_addr_t; | 133 | typedef bus_addr_t dma_addr_t; | |
134 | typedef void * wait_queue_head_t; /* just address for tsleep() */ | 134 | typedef void * wait_queue_head_t; /* just address for tsleep() */ | |
135 | 135 | |||
136 | #define WWAN_BAR0 PCI_MAPREG_START | 136 | #define WWAN_BAR0 PCI_MAPREG_START | |
137 | #define WWAN_BAR1 (PCI_MAPREG_START + 4) | 137 | #define WWAN_BAR1 (PCI_MAPREG_START + 4) | |
138 | #define WWAN_BAR2 (PCI_MAPREG_START + 8) | 138 | #define WWAN_BAR2 (PCI_MAPREG_START + 8) | |
139 | 139 | |||
140 | #define BUG_ON(never_true) KASSERT(!(never_true)) | 140 | #define BUG_ON(never_true) KASSERT(!(never_true)) | |
141 | #define WARN_ON(x) /* nothing */ | 141 | #define WARN_ON(x) /* nothing */ | |
142 | 142 | |||
143 | #ifdef __OpenBSD__ | 143 | #ifdef __OpenBSD__ | |
144 | typedef struct mutex spinlock_t; | 144 | typedef struct mutex spinlock_t; | |
145 | #define dev_err(devp, fmt, ...) \ | 145 | #define dev_err(devp, fmt, ...) \ | |
146 | printf("%s: " fmt, (devp)->dv_xname, ##__VA_ARGS__) | 146 | printf("%s: " fmt, device_xname(devp), ##__VA_ARGS__) | |
147 | #define dev_info(devp, fmt, ...) \ | 147 | #define dev_info(devp, fmt, ...) \ | |
148 | printf("%s: " fmt, (devp)->dv_xname, ##__VA_ARGS__) | 148 | printf("%s: " fmt, device_xname(devp), ##__VA_ARGS__) | |
149 | #define kzalloc(size, flags) malloc(size, M_DEVBUF, M_WAITOK | M_ZERO) | 149 | #define kzalloc(size, flags) malloc(size, M_DEVBUF, M_WAITOK | M_ZERO) | |
150 | #define kfree(addr) free(addr, M_DEVBUF, 0) | 150 | #define kfree(addr) free(addr, M_DEVBUF, 0) | |
151 | #define mutex_init(lock) mtx_init(lock, IPL_TTY) | 151 | #define mutex_init(lock) mtx_init(lock, IPL_TTY) | |
152 | #define mutex_lock(lock) mtx_enter(lock) | 152 | #define mutex_lock(lock) mtx_enter(lock) | |
153 | #define mutex_unlock(lock) mtx_leave(lock) | 153 | #define mutex_unlock(lock) mtx_leave(lock) | |
154 | /* In OpenBSD every mutex is spin mutex, and it must not be held on sleep */ | 154 | /* In OpenBSD every mutex is spin mutex, and it must not be held on sleep */ | |
155 | #define spin_lock_irqsave(lock, flags) mtx_enter(lock) | 155 | #define spin_lock_irqsave(lock, flags) mtx_enter(lock) | |
156 | #define spin_unlock_irqrestore(lock, flags) mtx_leave(lock) | 156 | #define spin_unlock_irqrestore(lock, flags) mtx_leave(lock) | |
157 | 157 | |||
158 | /* Compat defines for NetBSD API */ | 158 | /* Compat defines for NetBSD API */ | |
159 | #define curlwp curproc | 159 | #define curlwp curproc | |
160 | #define LINESW(tp) (linesw[(tp)->t_line]) | 160 | #define LINESW(tp) (linesw[(tp)->t_line]) | |
161 | #define selnotify(sel, band, note) selwakeup(sel) | 161 | #define selnotify(sel, band, note) selwakeup(sel) | |
@@ -471,27 +471,29 @@ struct td_ring { | @@ -471,27 +471,29 @@ struct td_ring { | |||
471 | // One page of page_size per td | 471 | // One page of page_size per td | |
472 | void **pages; | 472 | void **pages; | |
473 | dma_addr_t *pages_phys; | 473 | dma_addr_t *pages_phys; | |
474 | }; | 474 | }; | |
475 | 475 | |||
476 | #define TD_MAX_PAGE_SIZE 16384 | 476 | #define TD_MAX_PAGE_SIZE 16384 | |
477 | 477 | |||
478 | struct queue_pair { | 478 | struct queue_pair { | |
479 | struct xmm_dev *xmm; | 479 | struct xmm_dev *xmm; | |
480 | u8 depth; | 480 | u8 depth; | |
481 | u16 page_size; | 481 | u16 page_size; | |
482 | int tty_index; | 482 | int tty_index; | |
483 | int tty_needs_wake; | 483 | int tty_needs_wake; | |
484 | #ifdef __linux__ | |||
484 | struct device dev; | 485 | struct device dev; | |
486 | #endif | |||
485 | int num; | 487 | int num; | |
486 | int open; | 488 | int open; | |
487 | struct mutex lock; | 489 | struct mutex lock; | |
488 | unsigned char user_buf[TD_MAX_PAGE_SIZE]; | 490 | unsigned char user_buf[TD_MAX_PAGE_SIZE]; | |
489 | wait_queue_head_t wq; | 491 | wait_queue_head_t wq; | |
490 | 492 | |||
491 | #ifdef __linux__ | 493 | #ifdef __linux__ | |
492 | struct cdev cdev; | 494 | struct cdev cdev; | |
493 | struct tty_port port; | 495 | struct tty_port port; | |
494 | #endif | 496 | #endif | |
495 | #if defined(__OpenBSD__) || defined(__NetBSD__) | 497 | #if defined(__OpenBSD__) || defined(__NetBSD__) | |
496 | struct selinfo selr, selw; | 498 | struct selinfo selr, selw; | |
497 | #endif | 499 | #endif | |
@@ -2210,29 +2212,29 @@ wwanc_attach(struct device *parent, stru | @@ -2210,29 +2212,29 @@ wwanc_attach(struct device *parent, stru | |||
2210 | #ifdef __NetBSD__ | 2212 | #ifdef __NetBSD__ | |
2211 | if (pci_intr_alloc(pa, &ih, NULL, 0)) { | 2213 | if (pci_intr_alloc(pa, &ih, NULL, 0)) { | |
2212 | printf(": can't map interrupt\n"); | 2214 | printf(": can't map interrupt\n"); | |
2213 | goto fail; | 2215 | goto fail; | |
2214 | } | 2216 | } | |
2215 | sc->sc_pih = ih[0]; | 2217 | sc->sc_pih = ih[0]; | |
2216 | intrstr = pci_intr_string(pa->pa_pc, ih[0], intrbuf, sizeof(intrbuf)); | 2218 | intrstr = pci_intr_string(pa->pa_pc, ih[0], intrbuf, sizeof(intrbuf)); | |
2217 | aprint_normal(": LTE modem\n"); | 2219 | aprint_normal(": LTE modem\n"); | |
2218 | aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); | 2220 | aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); | |
2219 | #endif | 2221 | #endif | |
2220 | 2222 | |||
2221 | /* Device initialized, can establish the interrupt now */ | 2223 | /* Device initialized, can establish the interrupt now */ | |
2222 | sc->sc_ih = pci_intr_establish(sc->sc_pc, sc->sc_pih, IPL_NET, | 2224 | sc->sc_ih = pci_intr_establish(sc->sc_pc, sc->sc_pih, IPL_NET, | |
2223 | wwanc_intr, sc, sc->sc_dev->dv_xname); | 2225 | wwanc_intr, sc, device_xname(sc->sc_dev)); | |
2224 | if (sc->sc_ih == NULL) { | 2226 | if (sc->sc_ih == NULL) { | |
2225 | printf("%s: can't establish interrupt\n", self->dv_xname); | 2227 | device_printf(self, "can't establish interrupt\n"); | |
2226 | return; | 2228 | return; | |
2227 | } | 2229 | } | |
2228 | 2230 | |||
2229 | #ifdef __NetBSD__ | 2231 | #ifdef __NetBSD__ | |
2230 | if (!pmf_device_register(self, wwanc_pmf_suspend, wwanc_pmf_resume)) | 2232 | if (!pmf_device_register(self, wwanc_pmf_suspend, wwanc_pmf_resume)) | |
2231 | aprint_error_dev(self, "couldn't establish power handler\n"); | 2233 | aprint_error_dev(self, "couldn't establish power handler\n"); | |
2232 | #endif | 2234 | #endif | |
2233 | 2235 | |||
2234 | /* | 2236 | /* | |
2235 | * Device initialization requires working interrupts, so need | 2237 | * Device initialization requires working interrupts, so need | |
2236 | * to postpone this until they are enabled. | 2238 | * to postpone this until they are enabled. | |
2237 | */ | 2239 | */ | |
2238 | config_mountroot(self, wwanc_attach_finish); | 2240 | config_mountroot(self, wwanc_attach_finish); | |
@@ -2343,28 +2345,28 @@ wwanc_defer_resume(void *xarg) | @@ -2343,28 +2345,28 @@ wwanc_defer_resume(void *xarg) | |||
2343 | 2345 | |||
2344 | static int | 2346 | static int | |
2345 | wwanc_activate(struct device *self, int act) | 2347 | wwanc_activate(struct device *self, int act) | |
2346 | { | 2348 | { | |
2347 | struct wwanc_softc *sc = device_private(self); | 2349 | struct wwanc_softc *sc = device_private(self); | |
2348 | 2350 | |||
2349 | switch (act) { | 2351 | switch (act) { | |
2350 | case DVACT_QUIESCE: | 2352 | case DVACT_QUIESCE: | |
2351 | (void)config_activate_children(self, act); | 2353 | (void)config_activate_children(self, act); | |
2352 | break; | 2354 | break; | |
2353 | case DVACT_SUSPEND: | 2355 | case DVACT_SUSPEND: | |
2354 | if (sc->sc_resume) { | 2356 | if (sc->sc_resume) { | |
2355 | /* Refuse to suspend if resume still ongoing */ | 2357 | /* Refuse to suspend if resume still ongoing */ | |
2356 | printf("%s: not suspending, resume still ongoing\n", | 2358 | device_printf(self, | |
2357 | self->dv_xname); | 2359 | "not suspending, resume still ongoing\n"); | |
2358 | return EBUSY; | 2360 | return EBUSY; | |
2359 | } | 2361 | } | |
2360 | 2362 | |||
2361 | (void)config_activate_children(self, act); | 2363 | (void)config_activate_children(self, act); | |
2362 | wwanc_suspend(self); | 2364 | wwanc_suspend(self); | |
2363 | break; | 2365 | break; | |
2364 | case DVACT_RESUME: | 2366 | case DVACT_RESUME: | |
2365 | /* | 2367 | /* | |
2366 | * Modem reinitialization can take several seconds, defer | 2368 | * Modem reinitialization can take several seconds, defer | |
2367 | * it via kernel thread to avoid blocking the resume. | 2369 | * it via kernel thread to avoid blocking the resume. | |
2368 | */ | 2370 | */ | |
2369 | sc->sc_resume = true; | 2371 | sc->sc_resume = true; | |
2370 | kthread_create(wwanc_defer_resume, self, NULL, "wwancres"); | 2372 | kthread_create(wwanc_defer_resume, self, NULL, "wwancres"); | |
@@ -2850,38 +2852,38 @@ wwanckqfilter(dev_t dev, struct knote *k | @@ -2850,38 +2852,38 @@ wwanckqfilter(dev_t dev, struct knote *k | |||
2850 | static void * | 2852 | static void * | |
2851 | dma_alloc_coherent(struct device *self, size_t sz, dma_addr_t *physp, int flags) | 2853 | dma_alloc_coherent(struct device *self, size_t sz, dma_addr_t *physp, int flags) | |
2852 | { | 2854 | { | |
2853 | struct wwanc_softc *sc = device_private(self); | 2855 | struct wwanc_softc *sc = device_private(self); | |
2854 | bus_dma_segment_t seg; | 2856 | bus_dma_segment_t seg; | |
2855 | int nsegs; | 2857 | int nsegs; | |
2856 | int error; | 2858 | int error; | |
2857 | caddr_t kva; | 2859 | caddr_t kva; | |
2858 | 2860 | |||
2859 | error = bus_dmamem_alloc(sc->sc_dmat, sz, 0, 0, &seg, 1, &nsegs, | 2861 | error = bus_dmamem_alloc(sc->sc_dmat, sz, 0, 0, &seg, 1, &nsegs, | |
2860 | BUS_DMA_WAITOK); | 2862 | BUS_DMA_WAITOK); | |
2861 | if (error) { | 2863 | if (error) { | |
2862 | panic("%s: bus_dmamem_alloc(%lu) failed %d\n", | 2864 | panic("%s: bus_dmamem_alloc(%lu) failed %d\n", | |
2863 | self->dv_xname, (unsigned long)sz, error); | 2865 | device_xname(self), (unsigned long)sz, error); | |
2864 | /* NOTREACHED */ | 2866 | /* NOTREACHED */ | |
2865 | } | 2867 | } | |
2866 | 2868 | |||
2867 | KASSERT(nsegs == 1); | 2869 | KASSERT(nsegs == 1); | |
2868 | KASSERT(seg.ds_len == round_page(sz)); | 2870 | KASSERT(seg.ds_len == round_page(sz)); | |
2869 | 2871 | |||
2870 | error = bus_dmamem_map(sc->sc_dmat, &seg, nsegs, sz, &kva, | 2872 | error = bus_dmamem_map(sc->sc_dmat, &seg, nsegs, sz, &kva, | |
2871 | BUS_DMA_WAITOK | BUS_DMA_COHERENT); | 2873 | BUS_DMA_WAITOK | BUS_DMA_COHERENT); | |
2872 | if (error) { | 2874 | if (error) { | |
2873 | panic("%s: bus_dmamem_alloc(%lu) failed %d\n", | 2875 | panic("%s: bus_dmamem_alloc(%lu) failed %d\n", | |
2874 | self->dv_xname, (unsigned long)sz, error); | 2876 | device_xname(self), (unsigned long)sz, error); | |
2875 | /* NOTREACHED */ | 2877 | /* NOTREACHED */ | |
2876 | } | 2878 | } | |
2877 | 2879 | |||
2878 | memset(kva, 0, sz); | 2880 | memset(kva, 0, sz); | |
2879 | *physp = seg.ds_addr; | 2881 | *physp = seg.ds_addr; | |
2880 | return (void *)kva; | 2882 | return (void *)kva; | |
2881 | } | 2883 | } | |
2882 | 2884 | |||
2883 | static void | 2885 | static void | |
2884 | dma_free_coherent(struct device *self, size_t sz, volatile void *vaddr, dma_addr_t phys) | 2886 | dma_free_coherent(struct device *self, size_t sz, volatile void *vaddr, dma_addr_t phys) | |
2885 | { | 2887 | { | |
2886 | struct wwanc_softc *sc = device_private(self); | 2888 | struct wwanc_softc *sc = device_private(self); | |
2887 | bus_dma_segment_t seg; | 2889 | bus_dma_segment_t seg; | |
@@ -3226,27 +3228,28 @@ wwan_attach(struct device *parent, struc | @@ -3226,27 +3228,28 @@ wwan_attach(struct device *parent, struc | |||
3226 | xmm7360_qp_start(xn->qp); | 3228 | xmm7360_qp_start(xn->qp); | |
3227 | xmm->net = xn; | 3229 | xmm->net = xn; | |
3228 | 3230 | |||
3229 | ifp->if_softc = sc_if; | 3231 | ifp->if_softc = sc_if; | |
3230 | ifp->if_flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST \ | 3232 | ifp->if_flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST \ | |
3231 | | IFF_SIMPLEX; | 3233 | | IFF_SIMPLEX; | |
3232 | ifp->if_ioctl = wwan_if_ioctl; | 3234 | ifp->if_ioctl = wwan_if_ioctl; | |
3233 | ifp->if_start = wwan_if_start; | 3235 | ifp->if_start = wwan_if_start; | |
3234 | ifp->if_mtu = 1500; | 3236 | ifp->if_mtu = 1500; | |
3235 | ifp->if_hardmtu = 1500; | 3237 | ifp->if_hardmtu = 1500; | |
3236 | ifp->if_type = IFT_OTHER; | 3238 | ifp->if_type = IFT_OTHER; | |
3237 | IFQ_SET_MAXLEN(&ifp->if_snd, xn->qp->depth); | 3239 | IFQ_SET_MAXLEN(&ifp->if_snd, xn->qp->depth); | |
3238 | IFQ_SET_READY(&ifp->if_snd); | 3240 | IFQ_SET_READY(&ifp->if_snd); | |
3239 | bcopy(sc_if->sc_dev->dv_xname, ifp->if_xname, IFNAMSIZ); | 3241 | CTASSERT(DEVICE_XNAME_SIZE == IFNAMSIZ); | |
3242 | bcopy(device_xname(sc_if->sc_dev), ifp->if_xname, IFNAMSIZ); | |||
3240 | 3243 | |||
3241 | /* Call MI attach routines. */ | 3244 | /* Call MI attach routines. */ | |
3242 | if_attach(ifp); | 3245 | if_attach(ifp); | |
3243 | 3246 | |||
3244 | /* Hook custom input and output processing, and dummy sadl */ | 3247 | /* Hook custom input and output processing, and dummy sadl */ | |
3245 | ifp->if_output = wwan_if_output; | 3248 | ifp->if_output = wwan_if_output; | |
3246 | if_ih_insert(ifp, wwan_if_input, NULL); | 3249 | if_ih_insert(ifp, wwan_if_input, NULL); | |
3247 | if_deferred_start_init(ifp, NULL); | 3250 | if_deferred_start_init(ifp, NULL); | |
3248 | if_alloc_sadl(ifp); | 3251 | if_alloc_sadl(ifp); | |
3249 | #if NBPFILTER > 0 | 3252 | #if NBPFILTER > 0 | |
3250 | #ifdef __OpenBSD__ | 3253 | #ifdef __OpenBSD__ | |
3251 | bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t)); | 3254 | bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t)); | |
3252 | #endif | 3255 | #endif |
--- src/sys/dev/usb/vhci.c 2021/08/07 16:19:17 1.22
+++ src/sys/dev/usb/vhci.c 2022/02/12 03:24:36 1.23
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vhci.c,v 1.22 2021/08/07 16:19:17 thorpej Exp $ */ | 1 | /* $NetBSD: vhci.c,v 1.23 2022/02/12 03:24:36 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2019-2020 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2019-2020 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 Maxime Villard. | 8 | * by Maxime Villard. | |
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. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
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 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.22 2021/08/07 16:19:17 thorpej Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.23 2022/02/12 03:24:36 riastradh Exp $"); | |
34 | 34 | |||
35 | #ifdef _KERNEL_OPT | 35 | #ifdef _KERNEL_OPT | |
36 | #include "opt_usb.h" | 36 | #include "opt_usb.h" | |
37 | #endif | 37 | #endif | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | 40 | |||
41 | #include <sys/bus.h> | 41 | #include <sys/bus.h> | |
42 | #include <sys/cpu.h> | 42 | #include <sys/cpu.h> | |
43 | #include <sys/conf.h> | 43 | #include <sys/conf.h> | |
44 | #include <sys/device.h> | 44 | #include <sys/device.h> | |
45 | #include <sys/kernel.h> | 45 | #include <sys/kernel.h> | |
46 | #include <sys/kmem.h> | 46 | #include <sys/kmem.h> | |
@@ -1289,27 +1289,27 @@ vhci_match(device_t parent, cfdata_t mat | @@ -1289,27 +1289,27 @@ vhci_match(device_t parent, cfdata_t mat | |||
1289 | } | 1289 | } | |
1290 | 1290 | |||
1291 | static void | 1291 | static void | |
1292 | vhci_attach(device_t parent, device_t self, void *aux) | 1292 | vhci_attach(device_t parent, device_t self, void *aux) | |
1293 | { | 1293 | { | |
1294 | vhci_softc_t *sc = device_private(self); | 1294 | vhci_softc_t *sc = device_private(self); | |
1295 | vhci_port_t *port; | 1295 | vhci_port_t *port; | |
1296 | uint8_t addr; | 1296 | uint8_t addr; | |
1297 | size_t i; | 1297 | size_t i; | |
1298 | 1298 | |||
1299 | sc->sc_dev = self; | 1299 | sc->sc_dev = self; | |
1300 | sc->sc_bus.ub_revision = USBREV_2_0; | 1300 | sc->sc_bus.ub_revision = USBREV_2_0; | |
1301 | sc->sc_bus.ub_hctype = USBHCTYPE_VHCI; | 1301 | sc->sc_bus.ub_hctype = USBHCTYPE_VHCI; | |
1302 | sc->sc_bus.ub_busnum = self->dv_unit; | 1302 | sc->sc_bus.ub_busnum = device_unit(self); | |
1303 | sc->sc_bus.ub_usedma = false; | 1303 | sc->sc_bus.ub_usedma = false; | |
1304 | sc->sc_bus.ub_methods = &vhci_bus_methods; | 1304 | sc->sc_bus.ub_methods = &vhci_bus_methods; | |
1305 | sc->sc_bus.ub_pipesize = sizeof(vhci_pipe_t); | 1305 | sc->sc_bus.ub_pipesize = sizeof(vhci_pipe_t); | |
1306 | sc->sc_bus.ub_hcpriv = sc; | 1306 | sc->sc_bus.ub_hcpriv = sc; | |
1307 | sc->sc_dying = false; | 1307 | sc->sc_dying = false; | |
1308 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB); | 1308 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB); | |
1309 | 1309 | |||
1310 | sc->sc_nports = VHCI_NPORTS; | 1310 | sc->sc_nports = VHCI_NPORTS; | |
1311 | for (i = 0; i < sc->sc_nports; i++) { | 1311 | for (i = 0; i < sc->sc_nports; i++) { | |
1312 | port = &sc->sc_port[i]; | 1312 | port = &sc->sc_port[i]; | |
1313 | mutex_init(&port->lock, MUTEX_DEFAULT, IPL_SOFTUSB); | 1313 | mutex_init(&port->lock, MUTEX_DEFAULT, IPL_SOFTUSB); | |
1314 | for (addr = 0; addr < VHCI_NADDRS; addr++) { | 1314 | for (addr = 0; addr < VHCI_NADDRS; addr++) { | |
1315 | TAILQ_INIT(&port->endpoints[addr].usb_to_host); | 1315 | TAILQ_INIT(&port->endpoints[addr].usb_to_host); |
--- src/sys/kern/kern_drvctl.c 2021/06/16 00:19:46 1.49
+++ src/sys/kern/kern_drvctl.c 2022/02/12 03:24:36 1.50
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: kern_drvctl.c,v 1.49 2021/06/16 00:19:46 riastradh Exp $ */ | 1 | /* $NetBSD: kern_drvctl.c,v 1.50 2022/02/12 03:24:36 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2004 | 4 | * Copyright (c) 2004 | |
5 | * Matthias Drochner. All rights reserved. | 5 | * Matthias Drochner. 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. | |
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * LIABILITY, 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 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: kern_drvctl.c,v 1.49 2021/06/16 00:19:46 riastradh Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: kern_drvctl.c,v 1.50 2022/02/12 03:24:36 riastradh Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/systm.h> | 33 | #include <sys/systm.h> | |
34 | #include <sys/kernel.h> | 34 | #include <sys/kernel.h> | |
35 | #include <sys/conf.h> | 35 | #include <sys/conf.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/event.h> | 37 | #include <sys/event.h> | |
38 | #include <sys/kmem.h> | 38 | #include <sys/kmem.h> | |
39 | #include <sys/ioctl.h> | 39 | #include <sys/ioctl.h> | |
40 | #include <sys/fcntl.h> | 40 | #include <sys/fcntl.h> | |
41 | #include <sys/file.h> | 41 | #include <sys/file.h> | |
42 | #include <sys/filedesc.h> | 42 | #include <sys/filedesc.h> | |
43 | #include <sys/select.h> | 43 | #include <sys/select.h> | |
@@ -267,27 +267,28 @@ detachdevbyname(const char *devname) | @@ -267,27 +267,28 @@ detachdevbyname(const char *devname) | |||
267 | } | 267 | } | |
268 | if (d == NULL) { | 268 | if (d == NULL) { | |
269 | error = ENXIO; | 269 | error = ENXIO; | |
270 | goto out; | 270 | goto out; | |
271 | } | 271 | } | |
272 | 272 | |||
273 | #ifndef XXXFULLRISK | 273 | #ifndef XXXFULLRISK | |
274 | /* | 274 | /* | |
275 | * If the parent cannot be notified, it might keep | 275 | * If the parent cannot be notified, it might keep | |
276 | * pointers to the detached device. | 276 | * pointers to the detached device. | |
277 | * There might be a private notification mechanism, | 277 | * There might be a private notification mechanism, | |
278 | * but better play it safe here. | 278 | * but better play it safe here. | |
279 | */ | 279 | */ | |
280 | if (d->dv_parent && !d->dv_parent->dv_cfattach->ca_childdetached) { | 280 | if (device_parent(d) && | |
281 | !device_cfattach(device_parent(d))->ca_childdetached) { | |||
281 | error = ENOTSUP; | 282 | error = ENOTSUP; | |
282 | goto out; | 283 | goto out; | |
283 | } | 284 | } | |
284 | #endif | 285 | #endif | |
285 | 286 | |||
286 | error = config_detach(d, 0); | 287 | error = config_detach(d, 0); | |
287 | out: deviter_release(&di); | 288 | out: deviter_release(&di); | |
288 | return error; | 289 | return error; | |
289 | } | 290 | } | |
290 | 291 | |||
291 | static int | 292 | static int | |
292 | rescanbus(const char *busname, const char *ifattr, | 293 | rescanbus(const char *busname, const char *ifattr, | |
293 | int numlocators, const int *locators) | 294 | int numlocators, const int *locators) | |
@@ -304,47 +305,47 @@ rescanbus(const char *busname, const cha | @@ -304,47 +305,47 @@ rescanbus(const char *busname, const cha | |||
304 | for (i = 0; i < MAXLOCATORS; i++) | 305 | for (i = 0; i < MAXLOCATORS; i++) | |
305 | locs[i] = -1; | 306 | locs[i] = -1; | |
306 | 307 | |||
307 | for (i = 0; i < numlocators;i++) | 308 | for (i = 0; i < numlocators;i++) | |
308 | locs[i] = locators[i]; | 309 | locs[i] = locators[i]; | |
309 | 310 | |||
310 | if ((d = device_find_by_xname(busname)) == NULL) | 311 | if ((d = device_find_by_xname(busname)) == NULL) | |
311 | return ENXIO; | 312 | return ENXIO; | |
312 | 313 | |||
313 | /* | 314 | /* | |
314 | * must support rescan, and must have something | 315 | * must support rescan, and must have something | |
315 | * to attach to | 316 | * to attach to | |
316 | */ | 317 | */ | |
317 | if (!d->dv_cfattach->ca_rescan || | 318 | if (!device_cfattach(d)->ca_rescan || | |
318 | !d->dv_cfdriver->cd_attrs) | 319 | !device_cfdriver(d)->cd_attrs) | |
319 | return ENODEV; | 320 | return ENODEV; | |
320 | 321 | |||
321 | /* rescan all ifattrs if none is specified */ | 322 | /* rescan all ifattrs if none is specified */ | |
322 | if (!ifattr) { | 323 | if (!ifattr) { | |
323 | rc = 0; | 324 | rc = 0; | |
324 | for (ap = d->dv_cfdriver->cd_attrs; *ap; ap++) { | 325 | for (ap = device_cfdriver(d)->cd_attrs; *ap; ap++) { | |
325 | rc = (*d->dv_cfattach->ca_rescan)(d, (*ap)->ci_name, | 326 | rc = (*device_cfattach(d)->ca_rescan)(d, | |
326 | locs); | 327 | (*ap)->ci_name, locs); | |
327 | if (rc) | 328 | if (rc) | |
328 | break; | 329 | break; | |
329 | } | 330 | } | |
330 | } else { | 331 | } else { | |
331 | /* check for valid attribute passed */ | 332 | /* check for valid attribute passed */ | |
332 | for (ap = d->dv_cfdriver->cd_attrs; *ap; ap++) | 333 | for (ap = device_cfdriver(d)->cd_attrs; *ap; ap++) | |
333 | if (!strcmp((*ap)->ci_name, ifattr)) | 334 | if (!strcmp((*ap)->ci_name, ifattr)) | |
334 | break; | 335 | break; | |
335 | if (!*ap) | 336 | if (!*ap) | |
336 | return EINVAL; | 337 | return EINVAL; | |
337 | rc = (*d->dv_cfattach->ca_rescan)(d, ifattr, locs); | 338 | rc = (*device_cfattach(d)->ca_rescan)(d, ifattr, locs); | |
338 | } | 339 | } | |
339 | 340 | |||
340 | config_deferred(NULL); | 341 | config_deferred(NULL); | |
341 | return rc; | 342 | return rc; | |
342 | } | 343 | } | |
343 | 344 | |||
344 | static int | 345 | static int | |
345 | drvctl_read(struct file *fp, off_t *offp, struct uio *uio, kauth_cred_t cred, | 346 | drvctl_read(struct file *fp, off_t *offp, struct uio *uio, kauth_cred_t cred, | |
346 | int flags) | 347 | int flags) | |
347 | { | 348 | { | |
348 | return ENODEV; | 349 | return ENODEV; | |
349 | } | 350 | } | |
350 | 351 |