Mon Mar 29 13:17:53 2021 UTC ()
Centralize cpu_rootconf().


(rin)
diff -r1.6 -r1.7 src/sys/arch/evbppc/obs405/obs405_autoconf.c
diff -r1.22 -r1.23 src/sys/arch/evbppc/walnut/autoconf.c
diff -r1.15 -r1.16 src/sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c

cvs diff -r1.6 -r1.7 src/sys/arch/evbppc/obs405/Attic/obs405_autoconf.c (expand / switch to unified diff)

--- 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,14 +1,14 @@ @@ -1,14 +1,14 @@
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
@@ -23,47 +23,39 @@ @@ -23,47 +23,39 @@
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 
50void 
51cpu_rootconf(void) 
52{ 
53 
54 rootconf(); 
55} 
56 
57void 49void
58obs405_device_register(device_t dev, void *aux, int com_freq) 50obs405_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);

cvs diff -r1.22 -r1.23 src/sys/arch/evbppc/walnut/autoconf.c (expand / switch to unified diff)

--- 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,14 +1,14 @@ @@ -1,14 +1,14 @@
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
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
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>
@@ -64,37 +64,26 @@ cpu_configure(void) @@ -64,37 +64,26 @@ cpu_configure(void)
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 */ 
81void 
82cpu_rootconf(void) 
83{ 
84 
85 rootconf(); 
86} 
87 
88void 77void
89device_register(device_t dev, void *aux) 78device_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 "

cvs diff -r1.15 -r1.16 src/sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c (expand / switch to unified diff)

--- 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,14 +1,14 @@ @@ -1,14 +1,14 @@
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
@@ -23,41 +23,48 @@ @@ -23,41 +23,48 @@
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
50void 50void
 51cpu_rootconf(void)
 52{
 53
 54 rootconf();
 55}
 56
 57void
51ibm4xx_device_register(device_t dev, void *aux) 58ibm4xx_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];