mips: Use device_set_private in a few drivers.diff -r1.5 -r1.6 src/sys/arch/evbmips/gdium/bonito_mainbus.c
(riastradh)
--- src/sys/arch/evbmips/gdium/bonito_mainbus.c 2021/08/07 16:18:51 1.5
+++ src/sys/arch/evbmips/gdium/bonito_mainbus.c 2022/03/03 06:27:20 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: bonito_mainbus.c,v 1.5 2021/08/07 16:18:51 thorpej Exp $ */ | 1 | /* $NetBSD: bonito_mainbus.c,v 1.6 2022/03/03 06:27:20 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001 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 Jason R. Thorpe. | 8 | * by Jason R. Thorpe. | |
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: bonito_mainbus.c,v 1.5 2021/08/07 16:18:51 thorpej Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: bonito_mainbus.c,v 1.6 2022/03/03 06:27:20 riastradh Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/systm.h> | 36 | #include <sys/systm.h> | |
37 | #include <sys/conf.h> | 37 | #include <sys/conf.h> | |
38 | #include <sys/reboot.h> | 38 | #include <sys/reboot.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | 40 | |||
41 | #include <sys/bus.h> | 41 | #include <sys/bus.h> | |
42 | 42 | |||
43 | #include <mips/bonito/bonitoreg.h> | 43 | #include <mips/bonito/bonitoreg.h> | |
44 | 44 | |||
45 | #include <evbmips/gdium/gdiumvar.h> | 45 | #include <evbmips/gdium/gdiumvar.h> | |
46 | 46 | |||
@@ -60,27 +60,27 @@ bonito_mainbus_match(device_t parent, cf | @@ -60,27 +60,27 @@ bonito_mainbus_match(device_t parent, cf | |||
60 | if (strcmp(maa->maa_name, bonito_cd.cd_name) == 0) | 60 | if (strcmp(maa->maa_name, bonito_cd.cd_name) == 0) | |
61 | return (1); | 61 | return (1); | |
62 | 62 | |||
63 | return (0); | 63 | return (0); | |
64 | } | 64 | } | |
65 | 65 | |||
66 | void | 66 | void | |
67 | bonito_mainbus_attach(device_t parent, device_t self, void *aux) | 67 | bonito_mainbus_attach(device_t parent, device_t self, void *aux) | |
68 | { | 68 | { | |
69 | struct pcibus_attach_args pba; | 69 | struct pcibus_attach_args pba; | |
70 | struct gdium_config * const gc = &gdium_configuration; | 70 | struct gdium_config * const gc = &gdium_configuration; | |
71 | pcireg_t rev; | 71 | pcireg_t rev; | |
72 | 72 | |||
73 | self->dv_private = &gc->gc_bonito; | 73 | device_set_private(self, &gc->gc_bonito); | |
74 | 74 | |||
75 | /* | 75 | /* | |
76 | * There is only one PCI controller on a Loongson chip. | 76 | * There is only one PCI controller on a Loongson chip. | |
77 | */ | 77 | */ | |
78 | 78 | |||
79 | rev = PCI_REVISION(REGVAL(BONITO_PCICLASS)); | 79 | rev = PCI_REVISION(REGVAL(BONITO_PCICLASS)); | |
80 | 80 | |||
81 | printf(": BONITO Memory and PCI controller, %s rev. %d.%d\n", | 81 | printf(": BONITO Memory and PCI controller, %s rev. %d.%d\n", | |
82 | BONITO_REV_FPGA(rev) ? "FPGA" : "ASIC", | 82 | BONITO_REV_FPGA(rev) ? "FPGA" : "ASIC", | |
83 | BONITO_REV_MAJOR(rev), BONITO_REV_MINOR(rev)); | 83 | BONITO_REV_MAJOR(rev), BONITO_REV_MINOR(rev)); | |
84 | 84 | |||
85 | pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | 85 | pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | |
86 | pba.pba_bus = 0; | 86 | pba.pba_bus = 0; |
--- src/sys/arch/evbmips/loongson/bonito_mainbus.c 2021/08/07 16:18:51 1.5
+++ src/sys/arch/evbmips/loongson/bonito_mainbus.c 2022/03/03 06:27:21 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: bonito_mainbus.c,v 1.5 2021/08/07 16:18:51 thorpej Exp $ */ | 1 | /* $NetBSD: bonito_mainbus.c,v 1.6 2022/03/03 06:27:21 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001 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 Jason R. Thorpe. | 8 | * by Jason R. Thorpe. | |
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: bonito_mainbus.c,v 1.5 2021/08/07 16:18:51 thorpej Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: bonito_mainbus.c,v 1.6 2022/03/03 06:27:21 riastradh Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/systm.h> | 36 | #include <sys/systm.h> | |
37 | #include <sys/conf.h> | 37 | #include <sys/conf.h> | |
38 | #include <sys/reboot.h> | 38 | #include <sys/reboot.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | 40 | |||
41 | #include <sys/bus.h> | 41 | #include <sys/bus.h> | |
42 | 42 | |||
43 | #include <mips/cpuregs.h> | 43 | #include <mips/cpuregs.h> | |
44 | #include <mips/bonito/bonitoreg.h> | 44 | #include <mips/bonito/bonitoreg.h> | |
45 | 45 | |||
46 | #include <evbmips/loongson/autoconf.h> | 46 | #include <evbmips/loongson/autoconf.h> | |
@@ -63,27 +63,27 @@ bonito_mainbus_match(device_t parent, cf | @@ -63,27 +63,27 @@ bonito_mainbus_match(device_t parent, cf | |||
63 | if (strcmp(maa->maa_name, bonito_cd.cd_name) == 0) | 63 | if (strcmp(maa->maa_name, bonito_cd.cd_name) == 0) | |
64 | return (1); | 64 | return (1); | |
65 | 65 | |||
66 | return (0); | 66 | return (0); | |
67 | } | 67 | } | |
68 | 68 | |||
69 | void | 69 | void | |
70 | bonito_mainbus_attach(device_t parent, device_t self, void *aux) | 70 | bonito_mainbus_attach(device_t parent, device_t self, void *aux) | |
71 | { | 71 | { | |
72 | struct pcibus_attach_args pba; | 72 | struct pcibus_attach_args pba; | |
73 | pcireg_t rev; | 73 | pcireg_t rev; | |
74 | bool compatible; | 74 | bool compatible; | |
75 | 75 | |||
76 | self->dv_private = __UNCONST(&sys_platform->bonito_config); | 76 | device_set_private(self, __UNCONST(&sys_platform->bonito_config)); | |
77 | 77 | |||
78 | /* | 78 | /* | |
79 | * Loongson 2F processors do not use a real Bonito64 chip but | 79 | * Loongson 2F processors do not use a real Bonito64 chip but | |
80 | * their own derivative, which is no longer 100% compatible. | 80 | * their own derivative, which is no longer 100% compatible. | |
81 | * We need to make sure we never try to access an unimplemented | 81 | * We need to make sure we never try to access an unimplemented | |
82 | * register... | 82 | * register... | |
83 | */ | 83 | */ | |
84 | if (loongson_ver >= 0x2f) | 84 | if (loongson_ver >= 0x2f) | |
85 | compatible = false; | 85 | compatible = false; | |
86 | else | 86 | else | |
87 | compatible = true; | 87 | compatible = true; | |
88 | 88 | |||
89 | /* | 89 | /* |
--- src/sys/arch/mips/sibyte/pci/sbbrz.c 2022/01/22 15:10:31 1.8
+++ src/sys/arch/mips/sibyte/pci/sbbrz.c 2022/03/03 06:27:21 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sbbrz.c,v 1.8 2022/01/22 15:10:31 skrll Exp $ */ | 1 | /* $NetBSD: sbbrz.c,v 1.9 2022/03/03 06:27:21 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2000, 2001 | 4 | * Copyright 2000, 2001 | |
5 | * Broadcom Corporation. All rights reserved. | 5 | * Broadcom Corporation. All rights reserved. | |
6 | * | 6 | * | |
7 | * This software is furnished under license and may be used and copied only | 7 | * This software is furnished under license and may be used and copied only | |
8 | * in accordance with the following terms and conditions. Subject to these | 8 | * in accordance with the following terms and conditions. Subject to these | |
9 | * conditions, you may download, copy, install, use, modify and distribute | 9 | * conditions, you may download, copy, install, use, modify and distribute | |
10 | * modified or unmodified copies of this software in source and/or binary | 10 | * modified or unmodified copies of this software in source and/or binary | |
11 | * form. No title or ownership is transferred hereby. | 11 | * form. No title or ownership is transferred hereby. | |
12 | * | 12 | * | |
13 | * 1) Any source code used, modified or distributed must reproduce and | 13 | * 1) Any source code used, modified or distributed must reproduce and | |
14 | * retain this copyright notice and list of conditions as they appear in | 14 | * retain this copyright notice and list of conditions as they appear in | |
@@ -171,27 +171,27 @@ sbbrz_attach(device_t parent, device_t s | @@ -171,27 +171,27 @@ sbbrz_attach(device_t parent, device_t s | |||
171 | struct sbbrz_softc *sc = &sbbrz_softc; | 171 | struct sbbrz_softc *sc = &sbbrz_softc; | |
172 | struct pcibus_attach_args pba; | 172 | struct pcibus_attach_args pba; | |
173 | uint64_t regval; | 173 | uint64_t regval; | |
174 | bool host; | 174 | bool host; | |
175 | 175 | |||
176 | /* Tell the user whether it's host or device mode. */ | 176 | /* Tell the user whether it's host or device mode. */ | |
177 | regval = mips3_ld((register_t)MIPS_PHYS_TO_KSEG1(A_SCD_SYSTEM_CFG)); | 177 | regval = mips3_ld((register_t)MIPS_PHYS_TO_KSEG1(A_SCD_SYSTEM_CFG)); | |
178 | host = (regval & M_SYS_PCI_HOST) != 0; | 178 | host = (regval & M_SYS_PCI_HOST) != 0; | |
179 | 179 | |||
180 | aprint_normal(": %s pci mode\n", host ? "host" : "device"); | 180 | aprint_normal(": %s pci mode\n", host ? "host" : "device"); | |
181 | 181 | |||
182 | /* note that we've attached the bridge; can't have two. */ | 182 | /* note that we've attached the bridge; can't have two. */ | |
183 | sc->sc_dev = self; | 183 | sc->sc_dev = self; | |
184 | self->dv_private = sc; | 184 | device_set_private(self, sc); | |
185 | 185 | |||
186 | /* | 186 | /* | |
187 | * set up the bridge's info; done once at console init time | 187 | * set up the bridge's info; done once at console init time | |
188 | * (maybe), but doesn't hurt to do twice. | 188 | * (maybe), but doesn't hurt to do twice. | |
189 | */ | 189 | */ | |
190 | sbbrz_init(sc); | 190 | sbbrz_init(sc); | |
191 | 191 | |||
192 | #if _has_pba_busname | 192 | #if _has_pba_busname | |
193 | pba.pba_busname = "pci"; | 193 | pba.pba_busname = "pci"; | |
194 | #endif | 194 | #endif | |
195 | pba.pba_iot = &sc->sc_iot; | 195 | pba.pba_iot = &sc->sc_iot; | |
196 | pba.pba_memt = &sc->sc_memt; | 196 | pba.pba_memt = &sc->sc_memt; | |
197 | pba.pba_dmat64 = &sc->sc_dmat64; | 197 | pba.pba_dmat64 = &sc->sc_dmat64; |