Sun Jan 4 12:14:30 2015 UTC ()
Pull up following revision(s) (requested by phx in ticket #380):
	sys/arch/ofppc/ofppc/mainbus.c: revision 1.30
Make it compile with GCC48.


(martin)
diff -r1.29 -r1.29.10.1 src/sys/arch/ofppc/ofppc/mainbus.c

cvs diff -r1.29 -r1.29.10.1 src/sys/arch/ofppc/ofppc/mainbus.c (expand / switch to unified diff)

--- src/sys/arch/ofppc/ofppc/mainbus.c 2013/04/21 15:42:11 1.29
+++ src/sys/arch/ofppc/ofppc/mainbus.c 2015/01/04 12:14:30 1.29.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mainbus.c,v 1.29 2013/04/21 15:42:11 kiyohara Exp $ */ 1/* $NetBSD: mainbus.c,v 1.29.10.1 2015/01/04 12:14:30 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 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 Tim Rightnour 8 * by Tim Rightnour
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: mainbus.c,v 1.29 2013/04/21 15:42:11 kiyohara Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.29.10.1 2015/01/04 12:14:30 martin Exp $");
34 34
35#include "opt_interrupt.h" 35#include "opt_interrupt.h"
36#include "opt_multiprocessor.h" 36#include "opt_multiprocessor.h"
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41 41
42#include <dev/pci/pcivar.h> 42#include <dev/pci/pcivar.h>
43#include <dev/ofw/openfirm.h> 43#include <dev/ofw/openfirm.h>
44#include <dev/ofw/ofw_pci.h> 44#include <dev/ofw/ofw_pci.h>
45#include <arch/powerpc/pic/picvar.h> 45#include <arch/powerpc/pic/picvar.h>
46#ifdef MULTIPROCESSOR 46#ifdef MULTIPROCESSOR
@@ -90,30 +90,35 @@ init_prepivr(int node) @@ -90,30 +90,35 @@ init_prepivr(int node)
90 90
91 return setup_prepivr(PIC_IVR_MOT); 91 return setup_prepivr(PIC_IVR_MOT);
92} 92}
93#endif 93#endif
94 94
95static int 95static int
96init_openpic(int node) 96init_openpic(int node)
97{ 97{
98 struct ofw_pci_register aadr; 98 struct ofw_pci_register aadr;
99 struct ranges { 99 struct ranges {
100 uint32_t pci_hi, pci_mid, pci_lo; 100 uint32_t pci_hi, pci_mid, pci_lo;
101 uint32_t host; 101 uint32_t host;
102 uint32_t size_hi, size_lo; 102 uint32_t size_hi, size_lo;
103 } ranges[6], *rp = ranges; 103 } ranges[6];
104 unsigned char *baseaddr = NULL; 
105 uint32_t reg[12]; 104 uint32_t reg[12];
106 int parent, len; 105 int parent, len;
 106#if defined(PIC_OPENPIC) || defined(PIC_DISTOPENPIC)
 107 unsigned char *baseaddr;
 108#endif
 109#ifdef PIC_OPENPIC
 110 struct ranges *rp = ranges;
 111#endif
107#ifdef PIC_DISTOPENPIC 112#ifdef PIC_DISTOPENPIC
108 unsigned char *isu[OPENPIC_MAX_ISUS]; 113 unsigned char *isu[OPENPIC_MAX_ISUS];
109 int i, j; 114 int i, j;
110 int isumap[OPENPIC_MAX_ISUS]; 115 int isumap[OPENPIC_MAX_ISUS];
111#endif 116#endif
112 117
113 if (OF_getprop(node, "assigned-addresses", &aadr, sizeof(aadr)) 118 if (OF_getprop(node, "assigned-addresses", &aadr, sizeof(aadr))
114 != sizeof(aadr)) 119 != sizeof(aadr))
115 goto noaadr; 120 goto noaadr;
116 121
117 parent = OF_parent(node); 122 parent = OF_parent(node);
118 len = OF_getprop(parent, "ranges", ranges, sizeof(ranges)); 123 len = OF_getprop(parent, "ranges", ranges, sizeof(ranges));
119 if (len == -1) 124 if (len == -1)
@@ -134,38 +139,37 @@ init_openpic(int node) @@ -134,38 +139,37 @@ init_openpic(int node)
134 ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL); 139 ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL);
135 for (i=1; i < ncpu; i++) { 140 for (i=1; i < ncpu; i++) {
136 aprint_verbose("Enabling interrupts " 141 aprint_verbose("Enabling interrupts "
137 "for cpu%d\n", i); 142 "for cpu%d\n", i);
138 openpic_set_priority(i, 0); 143 openpic_set_priority(i, 0);
139 } 144 }
140#endif 145#endif
141 return TRUE; 146 return TRUE;
142 } 147 }
143 rp++; 148 rp++;
144 len -= sizeof(ranges[0]); 149 len -= sizeof(ranges[0]);
145 } 150 }
146#endif 151#endif
147 rp = 0; /* satisfy -Wall */ 
148 return FALSE; 152 return FALSE;
149 noaadr: 153 noaadr:
150 /* this isn't a PCI-attached openpic */ 154 /* this isn't a PCI-attached openpic */
151 len = OF_getprop(node, "reg", &reg, sizeof(reg)); 155 len = OF_getprop(node, "reg", &reg, sizeof(reg));
152 if (len < sizeof(int)*2) 156 if (len < sizeof(int)*2)
153 return FALSE; 157 return FALSE;
154 158
155 if (len == sizeof(int)*2) { 159 if (len == sizeof(int)*2) {
156 baseaddr = (unsigned char *)mapiodev(reg[0], reg[1], false); 
157 aprint_verbose("Found openpic at %08x\n", reg[0]); 160 aprint_verbose("Found openpic at %08x\n", reg[0]);
158#ifdef PIC_OPENPIC 161#ifdef PIC_OPENPIC
 162 baseaddr = (unsigned char *)mapiodev(reg[0], reg[1], false);
159 (void)setup_openpic(baseaddr, 0); 163 (void)setup_openpic(baseaddr, 0);
160#ifdef MULTIPROCESSOR 164#ifdef MULTIPROCESSOR
161 setup_openpic_ipi(); 165 setup_openpic_ipi();
162 ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL); 166 ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL);
163 for (i=1; i < ncpu; i++) { 167 for (i=1; i < ncpu; i++) {
164 aprint_verbose("Enabling interrupts for cpu%d\n", i); 168 aprint_verbose("Enabling interrupts for cpu%d\n", i);
165 openpic_set_priority(i, 0); 169 openpic_set_priority(i, 0);
166 } 170 }
167#endif 171#endif
168 return TRUE; 172 return TRUE;
169#else 173#else
170 aprint_error("No openpic support compiled into kernel!"); 174 aprint_error("No openpic support compiled into kernel!");
171 return FALSE; 175 return FALSE;