Centralize cpu_rootconf().diff -r1.6 -r1.7 src/sys/arch/evbppc/obs405/obs405_autoconf.c
(rin)
--- src/sys/arch/evbppc/obs405/Attic/obs405_autoconf.c 2012/07/29 18:05:42 1.6
+++ src/sys/arch/evbppc/obs405/Attic/obs405_autoconf.c 2021/03/29 13:17:53 1.7
@@ -1,70 +1,62 @@ | @@ -1,70 +1,62 @@ | |||
1 | /* $NetBSD: obs405_autoconf.c,v 1.6 2012/07/29 18:05:42 mlelstv Exp $ */ | 1 | /* $NetBSD: obs405_autoconf.c,v 1.7 2021/03/29 13:17:53 rin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2004 Shigeyuki Fukushima. | 4 | * Copyright 2004 Shigeyuki Fukushima. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Shigeyuki Fukushima for The NetBSD Project. | 7 | * Written by Shigeyuki Fukushima for The NetBSD Project. | |
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 | 14 | * 2. Redistributions in binary form must reproduce the above | |
15 | * copyright notice, this list of conditions and the following | 15 | * copyright notice, this list of conditions and the following | |
16 | * disclaimer in the documentation and/or other materials provided | 16 | * disclaimer in the documentation and/or other materials provided | |
17 | * with the distribution. | 17 | * with the distribution. | |
18 | * 3. The name of the author may not be used to endorse or promote | 18 | * 3. The name of the author may not be used to endorse or promote | |
19 | * products derived from this software without specific prior | 19 | * products derived from this software without specific prior | |
20 | * written permission. | 20 | * written permission. | |
21 | * | 21 | * | |
22 | * THIS SOFTWARE IS PROVIDED THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 22 | * THIS SOFTWARE IS PROVIDED THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 24 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE | 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | |
28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
29 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 29 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
30 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 30 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |
32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | |
33 | * DAMAGE. | 33 | * DAMAGE. | |
34 | */ | 34 | */ | |
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: obs405_autoconf.c,v 1.6 2012/07/29 18:05:42 mlelstv Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: obs405_autoconf.c,v 1.7 2021/03/29 13:17:53 rin Exp $"); | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/conf.h> | 39 | #include <sys/conf.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/device_if.h> | 41 | #include <sys/device_if.h> | |
42 | #include <sys/cpu.h> | 42 | #include <sys/cpu.h> | |
43 | 43 | |||
44 | #include <machine/obs405.h> | 44 | #include <machine/obs405.h> | |
45 | 45 | |||
46 | #include <powerpc/ibm4xx/cpu.h> | 46 | #include <powerpc/ibm4xx/cpu.h> | |
47 | #include <powerpc/ibm4xx/dev/comopbvar.h> | 47 | #include <powerpc/ibm4xx/dev/comopbvar.h> | |
48 | 48 | |||
49 | ||||
50 | void | |||
51 | cpu_rootconf(void) | |||
52 | { | |||
53 | ||||
54 | rootconf(); | |||
55 | } | |||
56 | ||||
57 | void | 49 | void | |
58 | obs405_device_register(device_t dev, void *aux, int com_freq) | 50 | obs405_device_register(device_t dev, void *aux, int com_freq) | |
59 | { | 51 | { | |
60 | device_t parent = device_parent(dev); | 52 | device_t parent = device_parent(dev); | |
61 | 53 | |||
62 | /* register "com" device */ | 54 | /* register "com" device */ | |
63 | if (device_is_a(dev, "com") && device_is_a(parent, "opb")) { | 55 | if (device_is_a(dev, "com") && device_is_a(parent, "opb")) { | |
64 | /* Set the frequency of the on-chip UART. */ | 56 | /* Set the frequency of the on-chip UART. */ | |
65 | com_opb_device_register(dev, com_freq); | 57 | com_opb_device_register(dev, com_freq); | |
66 | return; | 58 | return; | |
67 | } | 59 | } | |
68 | 60 | |||
69 | ibm4xx_device_register(dev, aux); | 61 | ibm4xx_device_register(dev, aux); | |
70 | } | 62 | } |
--- src/sys/arch/evbppc/walnut/autoconf.c 2014/07/30 19:33:56 1.22
+++ src/sys/arch/evbppc/walnut/autoconf.c 2021/03/29 13:17:53 1.23
@@ -1,108 +1,97 @@ | @@ -1,108 +1,97 @@ | |||
1 | /* $NetBSD: autoconf.c,v 1.22 2014/07/30 19:33:56 joerg Exp $ */ | 1 | /* $NetBSD: autoconf.c,v 1.23 2021/03/29 13:17:53 rin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
5 | * Copyright (C) 1995, 1996 TooLs GmbH. | 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
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 | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * 3. All advertising materials mentioning features or use of this software | 16 | * 3. All advertising materials mentioning features or use of this software | |
17 | * must display the following acknowledgement: | 17 | * must display the following acknowledgement: | |
18 | * This product includes software developed by TooLs GmbH. | 18 | * This product includes software developed by TooLs GmbH. | |
19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
20 | * derived from this software without specific prior written permission. | 20 | * derived from this software without specific prior written permission. | |
21 | * | 21 | * | |
22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <sys/cdefs.h> | 34 | #include <sys/cdefs.h> | |
35 | __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.22 2014/07/30 19:33:56 joerg Exp $"); | 35 | __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2021/03/29 13:17:53 rin Exp $"); | |
36 | 36 | |||
37 | #include <sys/param.h> | 37 | #include <sys/param.h> | |
38 | #include <sys/conf.h> | 38 | #include <sys/conf.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/cpu.h> | 41 | #include <sys/cpu.h> | |
42 | 42 | |||
43 | #include <dev/ic/comreg.h> /* For COM_FREQ */ | 43 | #include <dev/ic/comreg.h> /* For COM_FREQ */ | |
44 | 44 | |||
45 | #include <powerpc/ibm4xx/cpu.h> | 45 | #include <powerpc/ibm4xx/cpu.h> | |
46 | #include <powerpc/ibm4xx/dcr4xx.h> | 46 | #include <powerpc/ibm4xx/dcr4xx.h> | |
47 | #include <powerpc/ibm4xx/dev/plbvar.h> | 47 | #include <powerpc/ibm4xx/dev/plbvar.h> | |
48 | #include <powerpc/ibm4xx/spr.h> | 48 | #include <powerpc/ibm4xx/spr.h> | |
49 | 49 | |||
50 | /* | 50 | /* | |
51 | * List of port-specific devices to attach to the processor local bus. | 51 | * List of port-specific devices to attach to the processor local bus. | |
52 | */ | 52 | */ | |
53 | static const struct plb_dev local_plb_devs [] = { | 53 | static const struct plb_dev local_plb_devs [] = { | |
54 | { IBM405GP, "pbus", }, | 54 | { IBM405GP, "pbus", }, | |
55 | { 0, NULL } | 55 | { 0, NULL } | |
56 | }; | 56 | }; | |
57 | 57 | |||
58 | /* | 58 | /* | |
59 | * Determine device configuration for a machine. | 59 | * Determine device configuration for a machine. | |
60 | */ | 60 | */ | |
61 | void | 61 | void | |
62 | cpu_configure(void) | 62 | cpu_configure(void) | |
63 | { | 63 | { | |
64 | 64 | |||
65 | intr_init(); | 65 | intr_init(); | |
66 | calc_delayconst(); | 66 | calc_delayconst(); | |
67 | 67 | |||
68 | /* Make sure that timers run at CPU frequency */ | 68 | /* Make sure that timers run at CPU frequency */ | |
69 | mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE); | 69 | mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE); | |
70 | 70 | |||
71 | if (config_rootfound("plb", __UNCONST(&local_plb_devs)) == NULL) | 71 | if (config_rootfound("plb", __UNCONST(&local_plb_devs)) == NULL) | |
72 | panic("configure: plb not configured"); | 72 | panic("configure: plb not configured"); | |
73 | 73 | |||
74 | (void)spl0(); | 74 | (void)spl0(); | |
75 | } | 75 | } | |
76 | 76 | |||
77 | /* | |||
78 | * Setup root device. | |||
79 | * Configure swap area. | |||
80 | */ | |||
81 | void | |||
82 | cpu_rootconf(void) | |||
83 | { | |||
84 | ||||
85 | rootconf(); | |||
86 | } | |||
87 | ||||
88 | void | 77 | void | |
89 | device_register(device_t dev, void *aux) | 78 | device_register(device_t dev, void *aux) | |
90 | { | 79 | { | |
91 | device_t parent = device_parent(dev); | 80 | device_t parent = device_parent(dev); | |
92 | 81 | |||
93 | if (device_is_a(dev, "com") && device_is_a(parent, "opb")) { | 82 | if (device_is_a(dev, "com") && device_is_a(parent, "opb")) { | |
94 | /* Set the frequency of the on-chip UART. */ | 83 | /* Set the frequency of the on-chip UART. */ | |
95 | prop_number_t pn = prop_number_create_integer(COM_FREQ * 6); | 84 | prop_number_t pn = prop_number_create_integer(COM_FREQ * 6); | |
96 | KASSERT(pn != NULL); | 85 | KASSERT(pn != NULL); | |
97 | 86 | |||
98 | if (prop_dictionary_set(device_properties(dev), | 87 | if (prop_dictionary_set(device_properties(dev), | |
99 | "clock-frequency", pn) == false) { | 88 | "clock-frequency", pn) == false) { | |
100 | printf("WARNING: unable to set clock-frequency " | 89 | printf("WARNING: unable to set clock-frequency " | |
101 | "property for %s\n", device_xname(dev)); | 90 | "property for %s\n", device_xname(dev)); | |
102 | } | 91 | } | |
103 | prop_object_release(pn); | 92 | prop_object_release(pn); | |
104 | return; | 93 | return; | |
105 | } | 94 | } | |
106 | 95 | |||
107 | ibm4xx_device_register(dev, aux); | 96 | ibm4xx_device_register(dev, aux); | |
108 | } | 97 | } |
--- src/sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 2011/06/18 06:41:41 1.15
+++ src/sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c 2021/03/29 13:17:53 1.16
@@ -1,87 +1,94 @@ | @@ -1,87 +1,94 @@ | |||
1 | /* $NetBSD: ibm4xx_autoconf.c,v 1.15 2011/06/18 06:41:41 matt Exp $ */ | 1 | /* $NetBSD: ibm4xx_autoconf.c,v 1.16 2021/03/29 13:17:53 rin Exp $ */ | |
2 | /* Original Tag: ibm4xxgpx_autoconf.c,v 1.2 2004/10/23 17:12:22 thorpej Exp $ */ | 2 | /* Original Tag: ibm4xxgpx_autoconf.c,v 1.2 2004/10/23 17:12:22 thorpej Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | 5 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
6 | * Copyright (C) 1995, 1996 TooLs GmbH. | 6 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
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 | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | 17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | 18 | * must display the following acknowledgement: | |
19 | * This product includes software developed by TooLs GmbH. | 19 | * This product includes software developed by TooLs GmbH. | |
20 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | 20 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
21 | * derived from this software without specific prior written permission. | 21 | * derived from this software without specific prior written permission. | |
22 | * | 22 | * | |
23 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | 23 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
25 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 25 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
26 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 26 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
28 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 28 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
29 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 29 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 30 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
31 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 31 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.15 2011/06/18 06:41:41 matt Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.16 2021/03/29 13:17:53 rin Exp $"); | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/conf.h> | 39 | #include <sys/conf.h> | |
40 | #include <sys/device.h> | 40 | #include <sys/device.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/cpu.h> | 42 | #include <sys/cpu.h> | |
43 | 43 | |||
44 | #include <net/if.h> | 44 | #include <net/if.h> | |
45 | #include <net/if_ether.h> | 45 | #include <net/if_ether.h> | |
46 | 46 | |||
47 | #include <powerpc/ibm4xx/cpu.h> | 47 | #include <powerpc/ibm4xx/cpu.h> | |
48 | #include <powerpc/ibm4xx/dev/opbvar.h> | 48 | #include <powerpc/ibm4xx/dev/opbvar.h> | |
49 | 49 | |||
50 | void | 50 | void | |
51 | cpu_rootconf(void) | |||
52 | { | |||
53 | ||||
54 | rootconf(); | |||
55 | } | |||
56 | ||||
57 | void | |||
51 | ibm4xx_device_register(device_t dev, void *aux) | 58 | ibm4xx_device_register(device_t dev, void *aux) | |
52 | { | 59 | { | |
53 | device_t parent = device_parent(dev); | 60 | device_t parent = device_parent(dev); | |
54 | 61 | |||
55 | if (device_is_a(dev, "emac") && device_is_a(parent, "opb")) { | 62 | if (device_is_a(dev, "emac") && device_is_a(parent, "opb")) { | |
56 | /* Set the mac-address of the on-chip Ethernet. */ | 63 | /* Set the mac-address of the on-chip Ethernet. */ | |
57 | struct opb_attach_args *oaa = aux; | 64 | struct opb_attach_args *oaa = aux; | |
58 | 65 | |||
59 | if (oaa->opb_instance < 10) { | 66 | if (oaa->opb_instance < 10) { | |
60 | prop_dictionary_t dict = device_properties(dev); | 67 | prop_dictionary_t dict = device_properties(dev); | |
61 | prop_data_t pd; | 68 | prop_data_t pd; | |
62 | prop_number_t pn; | 69 | prop_number_t pn; | |
63 | unsigned char prop_name[15]; | 70 | unsigned char prop_name[15]; | |
64 | 71 | |||
65 | snprintf(prop_name, sizeof(prop_name), | 72 | snprintf(prop_name, sizeof(prop_name), | |
66 | "emac%d-mac-addr", oaa->opb_instance); | 73 | "emac%d-mac-addr", oaa->opb_instance); | |
67 | pd = prop_dictionary_get(board_properties, prop_name); | 74 | pd = prop_dictionary_get(board_properties, prop_name); | |
68 | if (pd == NULL) { | 75 | if (pd == NULL) { | |
69 | printf("WARNING: unable to get mac-addr " | 76 | printf("WARNING: unable to get mac-addr " | |
70 | "property from board properties\n"); | 77 | "property from board properties\n"); | |
71 | return; | 78 | return; | |
72 | } | 79 | } | |
73 | if (prop_dictionary_set(dict, "mac-address", pd) == | 80 | if (prop_dictionary_set(dict, "mac-address", pd) == | |
74 | false) | 81 | false) | |
75 | printf("WARNING: unable to set mac-address " | 82 | printf("WARNING: unable to set mac-address " | |
76 | "property for %s\n", device_xname(dev)); | 83 | "property for %s\n", device_xname(dev)); | |
77 | 84 | |||
78 | snprintf(prop_name, sizeof(prop_name), | 85 | snprintf(prop_name, sizeof(prop_name), | |
79 | "emac%d-mii-phy", oaa->opb_instance); | 86 | "emac%d-mii-phy", oaa->opb_instance); | |
80 | pn = prop_dictionary_get(board_properties, prop_name); | 87 | pn = prop_dictionary_get(board_properties, prop_name); | |
81 | if (pn != NULL) | 88 | if (pn != NULL) | |
82 | prop_dictionary_set_uint32(dict, "mii-phy", | 89 | prop_dictionary_set_uint32(dict, "mii-phy", | |
83 | prop_number_integer_value(pn)); | 90 | prop_number_integer_value(pn)); | |
84 | } | 91 | } | |
85 | return; | 92 | return; | |
86 | } | 93 | } | |
87 | } | 94 | } |