use device_private(). thanks to jmcneill for pointing this out.diff -r1.1 -r1.2 src/sys/arch/sparc64/dev/central.c
(mrg)
--- src/sys/arch/sparc64/dev/central.c 2011/07/29 08:37:36 1.1
+++ src/sys/arch/sparc64/dev/central.c 2011/08/01 08:36:39 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: central.c,v 1.1 2011/07/29 08:37:36 mrg Exp $ */ | 1 | /* $NetBSD: central.c,v 1.2 2011/08/01 08:36:39 mrg Exp $ */ | |
2 | /* $OpenBSD: central.c,v 1.7 2010/11/11 17:58:23 miod Exp $ */ | 2 | /* $OpenBSD: central.c,v 1.7 2010/11/11 17:58:23 miod Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2004 Jason L. Wright (jason@thought.net) | 5 | * Copyright (c) 2004 Jason L. Wright (jason@thought.net) | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -70,27 +70,27 @@ static int _central_bus_map( | @@ -70,27 +70,27 @@ static int _central_bus_map( | |||
70 | static int | 70 | static int | |
71 | central_match(device_t parent, cfdata_t match, void *aux) | 71 | central_match(device_t parent, cfdata_t match, void *aux) | |
72 | { | 72 | { | |
73 | struct mainbus_attach_args *ma = aux; | 73 | struct mainbus_attach_args *ma = aux; | |
74 | 74 | |||
75 | if (strcmp(ma->ma_name, "central") == 0) | 75 | if (strcmp(ma->ma_name, "central") == 0) | |
76 | return (1); | 76 | return (1); | |
77 | return (0); | 77 | return (0); | |
78 | } | 78 | } | |
79 | 79 | |||
80 | static void | 80 | static void | |
81 | central_attach(device_t parent, device_t self, void *aux) | 81 | central_attach(device_t parent, device_t self, void *aux) | |
82 | { | 82 | { | |
83 | struct central_softc *sc = (struct central_softc *)self; | 83 | struct central_softc *sc = device_private(self); | |
84 | struct mainbus_attach_args *ma = aux; | 84 | struct mainbus_attach_args *ma = aux; | |
85 | int node0, node; | 85 | int node0, node; | |
86 | 86 | |||
87 | sc->sc_bt = ma->ma_bustag; | 87 | sc->sc_bt = ma->ma_bustag; | |
88 | sc->sc_node = ma->ma_node; | 88 | sc->sc_node = ma->ma_node; | |
89 | sc->sc_cbt = central_alloc_bus_tag(sc); | 89 | sc->sc_cbt = central_alloc_bus_tag(sc); | |
90 | 90 | |||
91 | prom_getprop(sc->sc_node, "ranges", sizeof(struct central_range), | 91 | prom_getprop(sc->sc_node, "ranges", sizeof(struct central_range), | |
92 | &sc->sc_nrange, (void **)&sc->sc_range); | 92 | &sc->sc_nrange, (void **)&sc->sc_range); | |
93 | 93 | |||
94 | printf("\n"); | 94 | printf("\n"); | |
95 | 95 | |||
96 | node0 = firstchild(sc->sc_node); | 96 | node0 = firstchild(sc->sc_node); |
--- src/sys/arch/sparc64/dev/fhc_central.c 2011/07/29 08:37:36 1.1
+++ src/sys/arch/sparc64/dev/fhc_central.c 2011/08/01 08:36:39 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: fhc_central.c,v 1.1 2011/07/29 08:37:36 mrg Exp $ */ | 1 | /* $NetBSD: fhc_central.c,v 1.2 2011/08/01 08:36:39 mrg Exp $ */ | |
2 | /* $OpenBSD: fhc_central.c,v 1.5 2004/09/27 18:32:35 jason Exp $ */ | 2 | /* $OpenBSD: fhc_central.c,v 1.5 2004/09/27 18:32:35 jason Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2004 Jason L. Wright (jason@thought.net). | 5 | * Copyright (c) 2004 Jason L. Wright (jason@thought.net). | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -51,27 +51,27 @@ CFATTACH_DECL_NEW(fhc_central, sizeof(st | @@ -51,27 +51,27 @@ CFATTACH_DECL_NEW(fhc_central, sizeof(st | |||
51 | int | 51 | int | |
52 | fhc_central_match(device_t parent, cfdata_t match, void *aux) | 52 | fhc_central_match(device_t parent, cfdata_t match, void *aux) | |
53 | { | 53 | { | |
54 | struct central_attach_args *ca = aux; | 54 | struct central_attach_args *ca = aux; | |
55 | 55 | |||
56 | if (strcmp(ca->ca_name, "fhc") == 0) | 56 | if (strcmp(ca->ca_name, "fhc") == 0) | |
57 | return (1); | 57 | return (1); | |
58 | return (0); | 58 | return (0); | |
59 | } | 59 | } | |
60 | 60 | |||
61 | void | 61 | void | |
62 | fhc_central_attach(device_t parent, device_t self, void *aux) | 62 | fhc_central_attach(device_t parent, device_t self, void *aux) | |
63 | { | 63 | { | |
64 | struct fhc_softc *sc = (struct fhc_softc *)self; | 64 | struct fhc_softc *sc = device_private(self); | |
65 | struct central_attach_args *ca = aux; | 65 | struct central_attach_args *ca = aux; | |
66 | u_int32_t board; | 66 | u_int32_t board; | |
67 | 67 | |||
68 | sc->sc_node = ca->ca_node; | 68 | sc->sc_node = ca->ca_node; | |
69 | sc->sc_bt = ca->ca_bustag; | 69 | sc->sc_bt = ca->ca_bustag; | |
70 | sc->sc_is_central = 1; | 70 | sc->sc_is_central = 1; | |
71 | 71 | |||
72 | if (central_bus_map(sc->sc_bt, ca->ca_reg[0].cbr_slot, | 72 | if (central_bus_map(sc->sc_bt, ca->ca_reg[0].cbr_slot, | |
73 | ca->ca_reg[0].cbr_offset, ca->ca_reg[0].cbr_size, 0, | 73 | ca->ca_reg[0].cbr_offset, ca->ca_reg[0].cbr_size, 0, | |
74 | &sc->sc_preg)) { | 74 | &sc->sc_preg)) { | |
75 | printf(": failed to map preg\n"); | 75 | printf(": failed to map preg\n"); | |
76 | return; | 76 | return; | |
77 | } | 77 | } |
--- src/sys/arch/sparc64/dev/fhc_mainbus.c 2011/07/29 08:37:36 1.1
+++ src/sys/arch/sparc64/dev/fhc_mainbus.c 2011/08/01 08:36:39 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: fhc_mainbus.c,v 1.1 2011/07/29 08:37:36 mrg Exp $ */ | 1 | /* $NetBSD: fhc_mainbus.c,v 1.2 2011/08/01 08:36:39 mrg Exp $ */ | |
2 | /* $OpenBSD: fhc_mainbus.c,v 1.4 2004/09/27 18:32:35 jason Exp $ */ | 2 | /* $OpenBSD: fhc_mainbus.c,v 1.4 2004/09/27 18:32:35 jason Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2004 Jason L. Wright (jason@thought.net). | 5 | * Copyright (c) 2004 Jason L. Wright (jason@thought.net). | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -49,27 +49,27 @@ CFATTACH_DECL_NEW(fhc_mainbus, sizeof(st | @@ -49,27 +49,27 @@ CFATTACH_DECL_NEW(fhc_mainbus, sizeof(st | |||
49 | int | 49 | int | |
50 | fhc_mainbus_match(device_t parent, cfdata_t match, void *aux) | 50 | fhc_mainbus_match(device_t parent, cfdata_t match, void *aux) | |
51 | { | 51 | { | |
52 | struct mainbus_attach_args *ma = aux; | 52 | struct mainbus_attach_args *ma = aux; | |
53 | 53 | |||
54 | if (strcmp(ma->ma_name, "fhc") == 0) | 54 | if (strcmp(ma->ma_name, "fhc") == 0) | |
55 | return (1); | 55 | return (1); | |
56 | return (0); | 56 | return (0); | |
57 | } | 57 | } | |
58 | 58 | |||
59 | void | 59 | void | |
60 | fhc_mainbus_attach(device_t parent, device_t self, void *aux) | 60 | fhc_mainbus_attach(device_t parent, device_t self, void *aux) | |
61 | { | 61 | { | |
62 | struct fhc_softc *sc = (struct fhc_softc *)self; | 62 | struct fhc_softc *sc = device_private(self); | |
63 | struct mainbus_attach_args *ma = aux; | 63 | struct mainbus_attach_args *ma = aux; | |
64 | 64 | |||
65 | sc->sc_node = ma->ma_node; | 65 | sc->sc_node = ma->ma_node; | |
66 | sc->sc_bt = ma->ma_bustag; | 66 | sc->sc_bt = ma->ma_bustag; | |
67 | sc->sc_is_central = 0; | 67 | sc->sc_is_central = 0; | |
68 | 68 | |||
69 | if (bus_space_map(sc->sc_bt, ma->ma_reg[0].ur_paddr, | 69 | if (bus_space_map(sc->sc_bt, ma->ma_reg[0].ur_paddr, | |
70 | ma->ma_reg[0].ur_len, 0, &sc->sc_preg)) { | 70 | ma->ma_reg[0].ur_len, 0, &sc->sc_preg)) { | |
71 | printf(": failed to map preg\n"); | 71 | printf(": failed to map preg\n"); | |
72 | return; | 72 | return; | |
73 | } | 73 | } | |
74 | 74 | |||
75 | if (bus_space_map(sc->sc_bt, ma->ma_reg[1].ur_paddr, | 75 | if (bus_space_map(sc->sc_bt, ma->ma_reg[1].ur_paddr, |