playstation2: Fix some pre-device_t/softc-split device private sizes. Nothing appears to use device_private here, so let's not allocate anything or ask for sizeof(struct device).diff -r1.19 -r1.20 src/sys/arch/playstation2/dev/sbus.c
(riastradh)
--- src/sys/arch/playstation2/dev/sbus.c 2021/08/07 16:19:02 1.19
+++ src/sys/arch/playstation2/dev/sbus.c 2022/02/11 17:30:48 1.20
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sbus.c,v 1.19 2021/08/07 16:19:02 thorpej Exp $ */ | 1 | /* $NetBSD: sbus.c,v 1.20 2022/02/11 17:30:48 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 UCHIYAMA Yasushi. | 8 | * by UCHIYAMA Yasushi. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * PlayStation 2 internal PCMCIA/USB interface unit. | 33 | * PlayStation 2 internal PCMCIA/USB interface unit. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.19 2021/08/07 16:19:02 thorpej Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.20 2022/02/11 17:30:48 riastradh Exp $"); | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/device.h> | 40 | #include <sys/device.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | 42 | |||
43 | #include <machine/bootinfo.h> | 43 | #include <machine/bootinfo.h> | |
44 | #include <machine/autoconf.h> | 44 | #include <machine/autoconf.h> | |
45 | 45 | |||
46 | #include <playstation2/playstation2/interrupt.h> | 46 | #include <playstation2/playstation2/interrupt.h> | |
47 | 47 | |||
48 | #include <playstation2/ee/eevar.h> | 48 | #include <playstation2/ee/eevar.h> | |
49 | #include <playstation2/ee/intcvar.h> | 49 | #include <playstation2/ee/intcvar.h> | |
50 | #include <playstation2/dev/sbusvar.h> | 50 | #include <playstation2/dev/sbusvar.h> | |
@@ -75,27 +75,27 @@ STATIC int (*sbus_pcmcia_intr)(void *) = | @@ -75,27 +75,27 @@ STATIC int (*sbus_pcmcia_intr)(void *) = | |||
75 | STATIC void *sbus_pcmcia_context; | 75 | STATIC void *sbus_pcmcia_context; | |
76 | STATIC int (*sbus_usb_intr)(void *) = sbus_spurious_intr; | 76 | STATIC int (*sbus_usb_intr)(void *) = sbus_spurious_intr; | |
77 | STATIC void *sbus_usb_context; | 77 | STATIC void *sbus_usb_context; | |
78 | 78 | |||
79 | STATIC void sbus_init(int); | 79 | STATIC void sbus_init(int); | |
80 | STATIC int sbus_intr(void *); | 80 | STATIC int sbus_intr(void *); | |
81 | 81 | |||
82 | STATIC int sbus_match(device_t, cfdata_t, void *); | 82 | STATIC int sbus_match(device_t, cfdata_t, void *); | |
83 | STATIC void sbus_attach(device_t, device_t, void *); | 83 | STATIC void sbus_attach(device_t, device_t, void *); | |
84 | STATIC int sbus_search(device_t, cfdata_t, | 84 | STATIC int sbus_search(device_t, cfdata_t, | |
85 | const int *, void *); | 85 | const int *, void *); | |
86 | STATIC int sbus_print(void *, const char *); | 86 | STATIC int sbus_print(void *, const char *); | |
87 | 87 | |||
88 | CFATTACH_DECL_NEW(sbus, sizeof (struct device), | 88 | CFATTACH_DECL_NEW(sbus, 0, | |
89 | sbus_match, sbus_attach, NULL, NULL); | 89 | sbus_match, sbus_attach, NULL, NULL); | |
90 | 90 | |||
91 | extern struct cfdriver sbus_cd; | 91 | extern struct cfdriver sbus_cd; | |
92 | STATIC int __sbus_attached; | 92 | STATIC int __sbus_attached; | |
93 | 93 | |||
94 | int | 94 | int | |
95 | sbus_match(device_t parent, cfdata_t cf, void *aux) | 95 | sbus_match(device_t parent, cfdata_t cf, void *aux) | |
96 | { | 96 | { | |
97 | struct mainbus_attach_args *ma = aux; | 97 | struct mainbus_attach_args *ma = aux; | |
98 | 98 | |||
99 | if (strcmp(ma->ma_name, sbus_cd.cd_name) != 0) | 99 | if (strcmp(ma->ma_name, sbus_cd.cd_name) != 0) | |
100 | return (0); | 100 | return (0); | |
101 | 101 |
--- src/sys/arch/playstation2/dev/spd.c 2021/08/07 16:19:02 1.15
+++ src/sys/arch/playstation2/dev/spd.c 2022/02/11 17:30:48 1.16
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: spd.c,v 1.15 2021/08/07 16:19:02 thorpej Exp $ */ | 1 | /* $NetBSD: spd.c,v 1.16 2022/02/11 17:30:48 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 UCHIYAMA Yasushi. | 8 | * by UCHIYAMA Yasushi. | |
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: spd.c,v 1.15 2021/08/07 16:19:02 thorpej Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: spd.c,v 1.16 2022/02/11 17:30:48 riastradh Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | 38 | |||
39 | #include <machine/bootinfo.h> | 39 | #include <machine/bootinfo.h> | |
40 | 40 | |||
41 | #include <playstation2/ee/eevar.h> | 41 | #include <playstation2/ee/eevar.h> | |
42 | #include <playstation2/dev/sbusvar.h> | 42 | #include <playstation2/dev/sbusvar.h> | |
43 | #include <playstation2/dev/spdvar.h> | 43 | #include <playstation2/dev/spdvar.h> | |
44 | #include <playstation2/dev/spdreg.h> | 44 | #include <playstation2/dev/spdreg.h> | |
45 | 45 | |||
46 | #ifdef DEBUG | 46 | #ifdef DEBUG | |
@@ -53,27 +53,27 @@ STATIC int spd_match(device_t, cfdata_t, | @@ -53,27 +53,27 @@ STATIC int spd_match(device_t, cfdata_t, | |||
53 | STATIC void spd_attach(device_t, device_t, void *); | 53 | STATIC void spd_attach(device_t, device_t, void *); | |
54 | STATIC int spd_print(void *, const char *); | 54 | STATIC int spd_print(void *, const char *); | |
55 | STATIC int spd_intr(void *); | 55 | STATIC int spd_intr(void *); | |
56 | STATIC void __spd_eeprom_out(u_int8_t *, int); | 56 | STATIC void __spd_eeprom_out(u_int8_t *, int); | |
57 | STATIC int __spd_eeprom_in(u_int8_t *); | 57 | STATIC int __spd_eeprom_in(u_int8_t *); | |
58 | 58 | |||
59 | /* SPD device can't attach twice. because PS2 PC-Card slot is only one. */ | 59 | /* SPD device can't attach twice. because PS2 PC-Card slot is only one. */ | |
60 | STATIC struct { | 60 | STATIC struct { | |
61 | int (*func)(void *); | 61 | int (*func)(void *); | |
62 | void *arg; | 62 | void *arg; | |
63 | const char *name; | 63 | const char *name; | |
64 | } __spd_table[2]; | 64 | } __spd_table[2]; | |
65 | 65 | |||
66 | CFATTACH_DECL_NEW(spd, sizeof(struct device), | 66 | CFATTACH_DECL_NEW(spd, 0, | |
67 | spd_match, spd_attach, NULL, NULL); | 67 | spd_match, spd_attach, NULL, NULL); | |
68 | 68 | |||
69 | #ifdef DEBUG | 69 | #ifdef DEBUG | |
70 | #define LEGAL_SLOT(slot) ((slot) >= 0 && (slot) < 2) | 70 | #define LEGAL_SLOT(slot) ((slot) >= 0 && (slot) < 2) | |
71 | #endif | 71 | #endif | |
72 | 72 | |||
73 | int | 73 | int | |
74 | spd_match(device_t parent, cfdata_t cf, void *aux) | 74 | spd_match(device_t parent, cfdata_t cf, void *aux) | |
75 | { | 75 | { | |
76 | 76 | |||
77 | return ((BOOTINFO_REF(BOOTINFO_DEVCONF) == | 77 | return ((BOOTINFO_REF(BOOTINFO_DEVCONF) == | |
78 | BOOTINFO_DEVCONF_SPD_PRESENT)); | 78 | BOOTINFO_DEVCONF_SPD_PRESENT)); | |
79 | } | 79 | } |
--- src/sys/arch/playstation2/playstation2/mainbus.c 2021/08/07 16:19:02 1.18
+++ src/sys/arch/playstation2/playstation2/mainbus.c 2022/02/11 17:30:48 1.19
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.18 2021/08/07 16:19:02 thorpej Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.19 2022/02/11 17:30:48 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 | * 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,41 +17,41 @@ | @@ -17,41 +17,41 @@ | |||
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: mainbus.c,v 1.18 2021/08/07 16:19:02 thorpej Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.19 2022/02/11 17:30:48 riastradh Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/device.h> | 33 | #include <sys/device.h> | |
34 | #include <sys/systm.h> | 34 | #include <sys/systm.h> | |
35 | 35 | |||
36 | #include <machine/autoconf.h> | 36 | #include <machine/autoconf.h> | |
37 | 37 | |||
38 | static int mainbus_match(device_t, cfdata_t, void *); | 38 | static int mainbus_match(device_t, cfdata_t, void *); | |
39 | static void mainbus_attach(device_t, device_t, void *); | 39 | static void mainbus_attach(device_t, device_t, void *); | |
40 | static int mainbus_search(device_t, cfdata_t, | 40 | static int mainbus_search(device_t, cfdata_t, | |
41 | const int *, void *); | 41 | const int *, void *); | |
42 | static int mainbus_print(void *, const char *); | 42 | static int mainbus_print(void *, const char *); | |
43 | 43 | |||
44 | CFATTACH_DECL_NEW(mainbus, sizeof(struct device), | 44 | CFATTACH_DECL_NEW(mainbus, 0, | |
45 | mainbus_match, mainbus_attach, NULL, NULL); | 45 | mainbus_match, mainbus_attach, NULL, NULL); | |
46 | 46 | |||
47 | static int | 47 | static int | |
48 | mainbus_match(device_t parent, cfdata_t cf, void *aux) | 48 | mainbus_match(device_t parent, cfdata_t cf, void *aux) | |
49 | { | 49 | { | |
50 | 50 | |||
51 | return (1); | 51 | return (1); | |
52 | } | 52 | } | |
53 | 53 | |||
54 | static void | 54 | static void | |
55 | mainbus_attach(device_t parent, device_t self, void *aux) | 55 | mainbus_attach(device_t parent, device_t self, void *aux) | |
56 | { | 56 | { | |
57 | 57 |