Thu Sep 3 06:42:29 2020 UTC ()
The TC device addresses are defined in KSEG1, but this confuses
bus_space(9) which expects bus addresses and not kernel virtual
addresses.  Pull the addresses back to bus addresses with
MIPS_KSEG1_TO_PHYS().

XXX: Fix this properly one day (without storing KSEG1 addrs in
the TC device configuration).

Fixes problem with TURBOchannel pmaxes panicing during
autoconfiguartion.


(simonb)
diff -r1.22 -r1.23 src/sys/arch/pmax/tc/ioasic.c

cvs diff -r1.22 -r1.23 src/sys/arch/pmax/tc/ioasic.c (expand / switch to unified diff)

--- src/sys/arch/pmax/tc/ioasic.c 2013/11/10 20:09:53 1.22
+++ src/sys/arch/pmax/tc/ioasic.c 2020/09/03 06:42:29 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ioasic.c,v 1.22 2013/11/10 20:09:53 christos Exp $ */ 1/* $NetBSD: ioasic.c,v 1.23 2020/09/03 06:42:29 simonb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1994, 1995 Carnegie-Mellon University. 4 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Author: Keith Bostic, Chris G. Demetriou, Jonathan Stone 7 * Author: Keith Bostic, Chris G. Demetriou, Jonathan Stone
8 * 8 *
9 * Permission to use, copy, modify and distribute this software and 9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright 10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the 11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions 12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation. 13 * thereof, and that both notices appear in supporting documentation.
14 * 14 *
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * 18 *
19 * Carnegie Mellon requests users of this software to return to 19 * Carnegie Mellon requests users of this software to return to
20 * 20 *
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science 22 * School of Computer Science
23 * Carnegie Mellon University 23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890 24 * Pittsburgh PA 15213-3890
25 * 25 *
26 * any improvements or extensions that they make and grant Carnegie the 26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes. 27 * rights to redistribute these changes.
28 */ 28 */
29 29
30#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 30#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
31__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.22 2013/11/10 20:09:53 christos Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.23 2020/09/03 06:42:29 simonb Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/systm.h> 34#include <sys/systm.h>
35#include <sys/device.h> 35#include <sys/device.h>
36 36
37#include <dev/tc/tcvar.h> 37#include <dev/tc/tcvar.h>
38#include <dev/tc/ioasicreg.h> 38#include <dev/tc/ioasicreg.h>
39#include <dev/tc/ioasicvar.h> 39#include <dev/tc/ioasicvar.h>
40 40
41#include <pmax/sysconf.h> 41#include <pmax/sysconf.h>
42 42
43#include <pmax/pmax/pmaxtype.h> 43#include <pmax/pmax/pmaxtype.h>
44#include <pmax/pmax/kmin.h> 44#include <pmax/pmax/kmin.h>
@@ -123,27 +123,34 @@ ioasicmatch(device_t parent, cfdata_t cf @@ -123,27 +123,34 @@ ioasicmatch(device_t parent, cfdata_t cf
123 123
124static void 124static void
125ioasicattach(device_t parent, device_t self, void *aux) 125ioasicattach(device_t parent, device_t self, void *aux)
126{ 126{
127 struct ioasic_softc *sc = device_private(self); 127 struct ioasic_softc *sc = device_private(self);
128 struct tc_attach_args *ta = aux; 128 struct tc_attach_args *ta = aux;
129 struct ioasic_dev *ioasic_devs; 129 struct ioasic_dev *ioasic_devs;
130 int ioasic_ndevs, builtin_ndevs; 130 int ioasic_ndevs, builtin_ndevs;
131 131
132 ioasicfound = 1; 132 ioasicfound = 1;
133 133
134 sc->sc_dev = self; 134 sc->sc_dev = self;
135 sc->sc_bst = ta->ta_memt; 135 sc->sc_bst = ta->ta_memt;
136 if (bus_space_map(ta->ta_memt, ta->ta_addr, 136 /*
 137 * XXX
 138 * The TC device addresses are defined in KSEG1, but this
 139 * confuses bus_space(9) which expects bus addresses and
 140 * not kernel virtual addresses. Pull the addresses back
 141 * to bus addresses with MIPS_KSEG1_TO_PHYS().
 142 */
 143 if (bus_space_map(ta->ta_memt, MIPS_KSEG1_TO_PHYS(ta->ta_addr),
137 0x400000, 0, &sc->sc_bsh)) { 144 0x400000, 0, &sc->sc_bsh)) {
138 printf("%s: unable to map device\n", device_xname(self)); 145 printf("%s: unable to map device\n", device_xname(self));
139 return; 146 return;
140 } 147 }
141 sc->sc_dmat = ta->ta_dmat; 148 sc->sc_dmat = ta->ta_dmat;
142 149
143 sc->sc_base = ta->ta_addr; /* XXX XXX XXX */ 150 sc->sc_base = ta->ta_addr; /* XXX XXX XXX */
144 151
145 printf("\n"); 152 printf("\n");
146 153
147 switch (systype) { 154 switch (systype) {
148#if defined(DEC_3MIN) 155#if defined(DEC_3MIN)
149 case DS_3MIN: 156 case DS_3MIN: