1998-09-21 00:08:52 +04:00
|
|
|
/* $NetBSD: sbus.c,v 1.33 1998/09/20 20:08:52 pk Exp $ */
|
1998-03-22 01:03:33 +03:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Paul Kranenburg.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
1994-11-20 23:51:32 +03:00
|
|
|
|
1993-10-02 13:22:00 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1992, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* This software was developed by the Computer Systems Engineering group
|
|
|
|
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
|
|
|
* contributed to Berkeley.
|
|
|
|
*
|
|
|
|
* All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Lawrence Berkeley Laboratory.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)sbus.c 8.1 (Berkeley) 6/11/93
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sbus stuff.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
1997-04-09 00:08:20 +04:00
|
|
|
#include <sys/malloc.h>
|
1998-09-19 19:49:50 +04:00
|
|
|
#include <sys/kernel.h>
|
1996-03-14 22:44:30 +03:00
|
|
|
#include <sys/systm.h>
|
1993-10-02 13:22:00 +03:00
|
|
|
#include <sys/device.h>
|
1997-06-02 02:10:39 +04:00
|
|
|
#include <vm/vm.h>
|
1993-10-02 13:22:00 +03:00
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
#include <machine/bus.h>
|
1994-09-18 03:57:27 +04:00
|
|
|
#include <sparc/dev/sbusreg.h>
|
1998-07-28 02:34:48 +04:00
|
|
|
#include <dev/sbus/sbusvar.h>
|
|
|
|
#include <dev/sbus/xboxvar.h>
|
1993-10-02 13:22:00 +03:00
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
#include <sparc/sparc/iommuvar.h>
|
|
|
|
#include <machine/autoconf.h>
|
|
|
|
|
|
|
|
|
1996-03-17 05:00:30 +03:00
|
|
|
void sbusreset __P((int));
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
static bus_space_tag_t sbus_alloc_bustag __P((struct sbus_softc *));
|
1998-07-29 22:42:32 +04:00
|
|
|
static int sbus_get_intr __P((struct sbus_softc *, int,
|
|
|
|
struct sbus_intr **, int *));
|
1998-04-08 00:11:54 +04:00
|
|
|
static int sbus_bus_mmap __P((bus_space_tag_t, bus_type_t, bus_addr_t,
|
|
|
|
int, bus_space_handle_t *));
|
1998-03-22 01:03:33 +03:00
|
|
|
static int _sbus_bus_map __P((
|
1998-04-08 00:11:54 +04:00
|
|
|
bus_space_tag_t,
|
1998-03-22 01:03:33 +03:00
|
|
|
bus_type_t, /*slot*/
|
|
|
|
bus_addr_t, /*offset*/
|
|
|
|
bus_size_t, /*size*/
|
|
|
|
int, /*flags*/
|
1998-08-21 18:07:37 +04:00
|
|
|
vaddr_t, /*preferred virtual address */
|
1998-03-22 01:03:33 +03:00
|
|
|
bus_space_handle_t *));
|
1998-04-08 00:43:58 +04:00
|
|
|
static void *sbus_intr_establish __P((
|
|
|
|
bus_space_tag_t,
|
|
|
|
int, /*level*/
|
|
|
|
int, /*flags*/
|
|
|
|
int (*) __P((void *)), /*handler*/
|
|
|
|
void *)); /*handler arg*/
|
1998-03-21 22:55:31 +03:00
|
|
|
|
|
|
|
|
1993-10-02 13:22:00 +03:00
|
|
|
/* autoconfiguration driver */
|
1998-03-21 22:55:31 +03:00
|
|
|
int sbus_match_mainbus __P((struct device *, struct cfdata *, void *));
|
|
|
|
int sbus_match_iommu __P((struct device *, struct cfdata *, void *));
|
1998-04-18 23:00:17 +04:00
|
|
|
int sbus_match_xbox __P((struct device *, struct cfdata *, void *));
|
1998-03-21 22:55:31 +03:00
|
|
|
void sbus_attach_mainbus __P((struct device *, struct device *, void *));
|
|
|
|
void sbus_attach_iommu __P((struct device *, struct device *, void *));
|
1998-04-18 23:00:17 +04:00
|
|
|
void sbus_attach_xbox __P((struct device *, struct device *, void *));
|
1996-03-17 05:00:30 +03:00
|
|
|
|
1998-09-19 19:49:50 +04:00
|
|
|
static int sbus_error __P((void));
|
|
|
|
int (*sbuserr_handler) __P((void));
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
struct cfattach sbus_mainbus_ca = {
|
|
|
|
sizeof(struct sbus_softc), sbus_match_mainbus, sbus_attach_mainbus
|
|
|
|
};
|
|
|
|
struct cfattach sbus_iommu_ca = {
|
|
|
|
sizeof(struct sbus_softc), sbus_match_iommu, sbus_attach_iommu
|
1994-09-18 03:57:27 +04:00
|
|
|
};
|
1998-04-18 23:00:17 +04:00
|
|
|
struct cfattach sbus_xbox_ca = {
|
|
|
|
sizeof(struct sbus_softc), sbus_match_xbox, sbus_attach_xbox
|
|
|
|
};
|
1993-10-02 13:22:00 +03:00
|
|
|
|
1998-01-12 23:23:38 +03:00
|
|
|
extern struct cfdriver sbus_cd;
|
1996-03-14 22:44:30 +03:00
|
|
|
|
1998-09-19 19:49:50 +04:00
|
|
|
/* The "primary" Sbus */
|
|
|
|
struct sbus_softc *sbus_sc;
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
/* If the PROM does not provide the `ranges' property, we make up our own */
|
1998-07-29 22:42:32 +04:00
|
|
|
struct sbus_range sbus_translations[] = {
|
1998-03-21 22:55:31 +03:00
|
|
|
/* Assume a maximum of 4 Sbus slots, all mapped to on-board io space */
|
|
|
|
{ 0, 0, PMAP_OBIO, SBUS_ADDR(0,0), 1 << 25 },
|
|
|
|
{ 1, 0, PMAP_OBIO, SBUS_ADDR(1,0), 1 << 25 },
|
|
|
|
{ 2, 0, PMAP_OBIO, SBUS_ADDR(2,0), 1 << 25 },
|
|
|
|
{ 3, 0, PMAP_OBIO, SBUS_ADDR(3,0), 1 << 25 }
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Child devices receive the Sbus interrupt level in their attach
|
|
|
|
* arguments. We translate these to CPU IPLs using the following
|
|
|
|
* tables. Note: obio bus interrupt levels are identical to the
|
|
|
|
* processor IPL.
|
|
|
|
*
|
|
|
|
* The second set of tables is used when the Sbus interrupt level
|
|
|
|
* cannot be had from the PROM as an `interrupt' property. We then
|
|
|
|
* fall back on the `intr' property which contains the CPU IPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Translate Sbus interrupt level to processor IPL */
|
|
|
|
static int intr_sbus2ipl_4c[] = {
|
|
|
|
0, 1, 2, 3, 5, 7, 8, 9
|
|
|
|
};
|
|
|
|
static int intr_sbus2ipl_4m[] = {
|
|
|
|
0, 2, 3, 5, 7, 9, 11, 13
|
|
|
|
};
|
|
|
|
|
1998-03-22 01:03:33 +03:00
|
|
|
/*
|
|
|
|
* This value is or'ed into the attach args' interrupt level cookie
|
|
|
|
* if the interrupt level comes from an `intr' property, i.e. it is
|
|
|
|
* not an Sbus interrupt level.
|
|
|
|
*/
|
1998-03-21 22:55:31 +03:00
|
|
|
#define SBUS_INTR_COMPAT 0x80000000
|
|
|
|
|
|
|
|
|
1993-10-02 13:22:00 +03:00
|
|
|
/*
|
|
|
|
* Print the location of some sbus-attached device (called just
|
|
|
|
* before attaching that device). If `sbus' is not NULL, the
|
|
|
|
* device was found but not configured; print the sbus as well.
|
|
|
|
* Return UNCONF (config_find ignores this if the device was configured).
|
|
|
|
*/
|
|
|
|
int
|
1998-03-21 22:55:31 +03:00
|
|
|
sbus_print(args, busname)
|
1993-10-02 13:22:00 +03:00
|
|
|
void *args;
|
1998-03-21 22:55:31 +03:00
|
|
|
const char *busname;
|
1993-10-02 13:22:00 +03:00
|
|
|
{
|
1998-03-21 22:55:31 +03:00
|
|
|
struct sbus_attach_args *sa = args;
|
1998-07-29 22:42:32 +04:00
|
|
|
int i;
|
1998-03-21 22:55:31 +03:00
|
|
|
|
|
|
|
if (busname)
|
|
|
|
printf("%s at %s", sa->sa_name, busname);
|
|
|
|
printf(" slot %d offset 0x%x", sa->sa_slot, sa->sa_offset);
|
1998-07-29 22:42:32 +04:00
|
|
|
for (i = 0; i < sa->sa_nintr; i++) {
|
|
|
|
u_int32_t level = sa->sa_intr[i].sbi_pri;
|
1998-03-21 22:55:31 +03:00
|
|
|
struct sbus_softc *sc =
|
|
|
|
(struct sbus_softc *) sa->sa_bustag->cookie;
|
|
|
|
|
|
|
|
printf(" level %d", level & ~SBUS_INTR_COMPAT);
|
|
|
|
if ((level & SBUS_INTR_COMPAT) == 0) {
|
|
|
|
int ipl = sc->sc_intr2ipl[level];
|
|
|
|
if (ipl != level)
|
|
|
|
printf(" (ipl %d)", ipl);
|
|
|
|
}
|
|
|
|
}
|
1993-10-02 13:22:00 +03:00
|
|
|
return (UNCONF);
|
|
|
|
}
|
|
|
|
|
1994-10-03 00:59:56 +03:00
|
|
|
int
|
1998-03-21 22:55:31 +03:00
|
|
|
sbus_match_mainbus(parent, cf, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *cf;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct mainbus_attach_args *ma = aux;
|
|
|
|
|
|
|
|
if (CPU_ISSUN4)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
return (strcmp(cf->cf_driver->cd_name, ma->ma_name) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
sbus_match_iommu(parent, cf, aux)
|
1994-10-03 00:59:56 +03:00
|
|
|
struct device *parent;
|
1996-12-11 01:54:46 +03:00
|
|
|
struct cfdata *cf;
|
|
|
|
void *aux;
|
1994-10-03 00:59:56 +03:00
|
|
|
{
|
1998-03-21 22:55:31 +03:00
|
|
|
struct iommu_attach_args *ia = aux;
|
1994-10-03 00:59:56 +03:00
|
|
|
|
1996-04-01 02:27:15 +04:00
|
|
|
if (CPU_ISSUN4)
|
1994-10-03 00:59:56 +03:00
|
|
|
return (0);
|
1996-04-01 02:27:15 +04:00
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
return (strcmp(cf->cf_driver->cd_name, ia->iom_name) == 0);
|
1994-10-03 00:59:56 +03:00
|
|
|
}
|
|
|
|
|
1998-04-18 23:00:17 +04:00
|
|
|
int
|
|
|
|
sbus_match_xbox(parent, cf, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *cf;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct xbox_attach_args *xa = aux;
|
|
|
|
|
|
|
|
if (CPU_ISSUN4)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
return (strcmp(cf->cf_driver->cd_name, xa->xa_name) == 0);
|
|
|
|
}
|
|
|
|
|
1993-10-02 13:22:00 +03:00
|
|
|
/*
|
|
|
|
* Attach an Sbus.
|
|
|
|
*/
|
|
|
|
void
|
1998-03-21 22:55:31 +03:00
|
|
|
sbus_attach_mainbus(parent, self, aux)
|
1993-10-02 13:22:00 +03:00
|
|
|
struct device *parent;
|
|
|
|
struct device *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
1998-03-21 22:55:31 +03:00
|
|
|
struct sbus_softc *sc = (struct sbus_softc *)self;
|
|
|
|
struct mainbus_attach_args *ma = aux;
|
|
|
|
int node = ma->ma_node;
|
1993-10-02 13:22:00 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX there is only one Sbus, for now -- do not know how to
|
|
|
|
* address children on others
|
|
|
|
*/
|
|
|
|
if (sc->sc_dev.dv_unit > 0) {
|
1996-10-13 06:59:55 +04:00
|
|
|
printf(" unsupported\n");
|
1993-10-02 13:22:00 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
sc->sc_bustag = ma->ma_bustag;
|
|
|
|
sc->sc_dmatag = ma->ma_dmatag;
|
|
|
|
|
1998-09-21 00:08:52 +04:00
|
|
|
#if 0 /* sbus at mainbus (sun4c): `reg' prop is not control space */
|
1998-09-19 19:49:50 +04:00
|
|
|
if (ma->ma_size == 0)
|
|
|
|
printf("%s: no Sbus registers", self->dv_xname);
|
|
|
|
|
|
|
|
if (bus_space_map2(ma->ma_bustag,
|
|
|
|
(bus_type_t)ma->ma_iospace,
|
|
|
|
(bus_addr_t)ma->ma_paddr,
|
|
|
|
(bus_size_t)ma->ma_size,
|
|
|
|
BUS_SPACE_MAP_LINEAR,
|
|
|
|
0, &sc->sc_bh) != 0) {
|
|
|
|
panic("%s: can't map sbusbusreg", self->dv_xname);
|
|
|
|
}
|
1998-09-21 00:08:52 +04:00
|
|
|
#endif
|
1998-09-19 19:49:50 +04:00
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
/* Setup interrupt translation tables */
|
|
|
|
sc->sc_intr2ipl = CPU_ISSUN4C
|
|
|
|
? intr_sbus2ipl_4c
|
|
|
|
: intr_sbus2ipl_4m;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Record clock frequency for synchronous SCSI.
|
|
|
|
* IS THIS THE CORRECT DEFAULT??
|
|
|
|
*/
|
|
|
|
sc->sc_clockfreq = getpropint(node, "clock-frequency", 25*1000*1000);
|
|
|
|
printf(": clock = %s MHz\n", clockfreq(sc->sc_clockfreq));
|
|
|
|
|
1998-09-19 19:49:50 +04:00
|
|
|
sbus_sc = sc;
|
1998-09-06 02:15:51 +04:00
|
|
|
sbus_attach_common(sc, "sbus", node, ma->ma_bp, NULL);
|
1998-03-21 22:55:31 +03:00
|
|
|
}
|
|
|
|
|
1998-09-19 19:49:50 +04:00
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
void
|
|
|
|
sbus_attach_iommu(parent, self, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct device *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct sbus_softc *sc = (struct sbus_softc *)self;
|
|
|
|
struct iommu_attach_args *ia = aux;
|
|
|
|
int node = ia->iom_node;
|
|
|
|
|
|
|
|
sc->sc_bustag = ia->iom_bustag;
|
|
|
|
sc->sc_dmatag = ia->iom_dmatag;
|
|
|
|
|
1998-09-19 19:49:50 +04:00
|
|
|
if (ia->iom_nreg == 0)
|
|
|
|
panic("%s: no Sbus registers", self->dv_xname);
|
|
|
|
|
|
|
|
if (bus_space_map2(ia->iom_bustag,
|
|
|
|
(bus_type_t)ia->iom_reg[0].ior_iospace,
|
|
|
|
(bus_addr_t)ia->iom_reg[0].ior_pa,
|
|
|
|
(bus_size_t)ia->iom_reg[0].ior_size,
|
|
|
|
BUS_SPACE_MAP_LINEAR,
|
|
|
|
0, &sc->sc_bh) != 0) {
|
|
|
|
panic("%s: can't map sbusbusreg", self->dv_xname);
|
|
|
|
}
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
/* Setup interrupt translation tables */
|
|
|
|
sc->sc_intr2ipl = CPU_ISSUN4C ? intr_sbus2ipl_4c : intr_sbus2ipl_4m;
|
|
|
|
|
1993-10-02 13:22:00 +03:00
|
|
|
/*
|
|
|
|
* Record clock frequency for synchronous SCSI.
|
|
|
|
* IS THIS THE CORRECT DEFAULT??
|
|
|
|
*/
|
|
|
|
sc->sc_clockfreq = getpropint(node, "clock-frequency", 25*1000*1000);
|
1996-10-13 06:59:55 +04:00
|
|
|
printf(": clock = %s MHz\n", clockfreq(sc->sc_clockfreq));
|
1993-10-02 13:22:00 +03:00
|
|
|
|
1998-09-19 19:49:50 +04:00
|
|
|
sbus_sc = sc;
|
|
|
|
sbuserr_handler = sbus_error;
|
1998-09-06 02:15:51 +04:00
|
|
|
sbus_attach_common(sc, "sbus", node, ia->iom_bp, NULL);
|
1998-03-21 22:55:31 +03:00
|
|
|
}
|
|
|
|
|
1998-04-18 23:00:17 +04:00
|
|
|
void
|
|
|
|
sbus_attach_xbox(parent, self, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct device *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct sbus_softc *sc = (struct sbus_softc *)self;
|
|
|
|
struct xbox_attach_args *xa = aux;
|
|
|
|
int node = xa->xa_node;
|
|
|
|
|
|
|
|
sc->sc_bustag = xa->xa_bustag;
|
|
|
|
sc->sc_dmatag = xa->xa_dmatag;
|
|
|
|
|
|
|
|
/* Setup interrupt translation tables */
|
|
|
|
sc->sc_intr2ipl = CPU_ISSUN4C ? intr_sbus2ipl_4c : intr_sbus2ipl_4m;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Record clock frequency for synchronous SCSI.
|
|
|
|
* IS THIS THE CORRECT DEFAULT??
|
|
|
|
*/
|
|
|
|
sc->sc_clockfreq = getpropint(node, "clock-frequency", 25*1000*1000);
|
|
|
|
printf(": clock = %s MHz\n", clockfreq(sc->sc_clockfreq));
|
|
|
|
|
1998-09-06 02:15:51 +04:00
|
|
|
sbus_attach_common(sc, "sbus", node, xa->xa_bp, NULL);
|
1998-04-18 23:00:17 +04:00
|
|
|
}
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
void
|
1998-09-06 02:15:51 +04:00
|
|
|
sbus_attach_common(sc, busname, busnode, bp, specials)
|
1998-03-21 22:55:31 +03:00
|
|
|
struct sbus_softc *sc;
|
|
|
|
char *busname;
|
|
|
|
int busnode;
|
|
|
|
struct bootpath *bp;
|
|
|
|
const char * const *specials;
|
|
|
|
{
|
|
|
|
int node0, node, error;
|
|
|
|
const char *sp;
|
|
|
|
const char *const *ssp;
|
|
|
|
bus_space_tag_t sbt;
|
|
|
|
struct sbus_attach_args sa;
|
|
|
|
|
|
|
|
sbt = sbus_alloc_bustag(sc);
|
|
|
|
|
1996-04-22 06:34:53 +04:00
|
|
|
/*
|
|
|
|
* Get the SBus burst transfer size if burst transfers are supported
|
|
|
|
*/
|
1998-03-21 22:55:31 +03:00
|
|
|
sc->sc_burst = getpropint(busnode, "burst-sizes", 0);
|
1996-04-22 06:34:53 +04:00
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
/* Propagate bootpath */
|
|
|
|
if (bp != NULL && strcmp(bp->name, busname) == 0)
|
|
|
|
bp++;
|
1993-10-02 13:22:00 +03:00
|
|
|
else
|
1998-03-21 22:55:31 +03:00
|
|
|
bp = NULL;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Collect address translations from the OBP.
|
|
|
|
*/
|
1998-08-31 01:26:46 +04:00
|
|
|
error = getprop(busnode, "ranges", sizeof(struct rom_range),
|
|
|
|
&sc->sc_nrange, (void **)&sc->sc_range);
|
1998-03-21 22:55:31 +03:00
|
|
|
switch (error) {
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
case ENOENT:
|
|
|
|
/* Fall back to our own `range' construction */
|
|
|
|
sc->sc_range = sbus_translations;
|
|
|
|
sc->sc_nrange =
|
|
|
|
sizeof(sbus_translations)/sizeof(sbus_translations[0]);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
panic("%s: error getting ranges property", sc->sc_dev.dv_xname);
|
1997-04-09 00:08:20 +04:00
|
|
|
}
|
1996-04-01 02:27:15 +04:00
|
|
|
|
1993-10-02 13:22:00 +03:00
|
|
|
/*
|
|
|
|
* Loop through ROM children, fixing any relative addresses
|
|
|
|
* and then configuring each device.
|
1998-03-21 22:55:31 +03:00
|
|
|
* `specials' is an array of device names that are treated
|
|
|
|
* specially:
|
1993-10-02 13:22:00 +03:00
|
|
|
*/
|
1998-03-21 22:55:31 +03:00
|
|
|
node0 = firstchild(busnode);
|
|
|
|
for (ssp = specials ; ssp != NULL && *(sp = *ssp) != 0; ssp++) {
|
|
|
|
if ((node = findnode(node0, sp)) == 0) {
|
|
|
|
panic("could not find %s amongst %s devices",
|
|
|
|
sp, busname);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sbus_setup_attach_args(sc, sbt, sc->sc_dmatag,
|
|
|
|
node, bp, &sa) != 0) {
|
|
|
|
panic("sbus_attach: %s: incomplete", sp);
|
|
|
|
}
|
|
|
|
(void) config_found(&sc->sc_dev, (void *)&sa, sbus_print);
|
1998-07-29 22:42:32 +04:00
|
|
|
sbus_destroy_attach_args(&sa);
|
1998-03-21 22:55:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
for (node = node0; node; node = nextsibling(node)) {
|
|
|
|
char *name = getpropstring(node, "name");
|
|
|
|
for (ssp = specials, sp = NULL;
|
|
|
|
ssp != NULL && (sp = *ssp) != NULL;
|
|
|
|
ssp++)
|
|
|
|
if (strcmp(name, sp) == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (sp != NULL)
|
|
|
|
/* Already configured as an "early" device */
|
1993-10-02 13:22:00 +03:00
|
|
|
continue;
|
1996-04-01 02:27:15 +04:00
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
if (sbus_setup_attach_args(sc, sbt, sc->sc_dmatag,
|
|
|
|
node, bp, &sa) != 0) {
|
|
|
|
printf("sbus_attach: %s: incomplete\n", name);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
(void) config_found(&sc->sc_dev, (void *)&sa, sbus_print);
|
1998-07-29 22:42:32 +04:00
|
|
|
sbus_destroy_attach_args(&sa);
|
1996-04-01 02:27:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
int
|
|
|
|
sbus_setup_attach_args(sc, bustag, dmatag, node, bp, sa)
|
|
|
|
struct sbus_softc *sc;
|
|
|
|
bus_space_tag_t bustag;
|
|
|
|
bus_dma_tag_t dmatag;
|
|
|
|
int node;
|
|
|
|
struct bootpath *bp;
|
|
|
|
struct sbus_attach_args *sa;
|
1996-04-01 02:27:15 +04:00
|
|
|
{
|
1998-09-19 19:49:50 +04:00
|
|
|
int n, error;
|
1998-03-21 22:55:31 +03:00
|
|
|
|
|
|
|
bzero(sa, sizeof(struct sbus_attach_args));
|
1998-08-31 01:26:46 +04:00
|
|
|
error = getprop(node, "name", 1, &n, (void **)&sa->sa_name);
|
1998-07-29 22:42:32 +04:00
|
|
|
if (error != 0)
|
|
|
|
return (error);
|
|
|
|
sa->sa_name[n] = '\0';
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
sa->sa_bustag = bustag;
|
|
|
|
sa->sa_dmatag = dmatag;
|
|
|
|
sa->sa_node = node;
|
|
|
|
sa->sa_bp = bp;
|
|
|
|
|
1998-08-31 01:26:46 +04:00
|
|
|
error = getprop(node, "reg", sizeof(struct sbus_reg),
|
|
|
|
&sa->sa_nreg, (void **)&sa->sa_reg);
|
1998-07-29 22:42:32 +04:00
|
|
|
if (error != 0) {
|
|
|
|
char buf[32];
|
|
|
|
if (error != ENOENT ||
|
|
|
|
!node_has_property(node, "device_type") ||
|
|
|
|
strcmp(getpropstringA(node, "device_type", buf),
|
|
|
|
"hierarchical") != 0)
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
for (n = 0; n < sa->sa_nreg; n++) {
|
|
|
|
/* Convert to relative addressing, if necessary */
|
|
|
|
u_int32_t base = sa->sa_reg[n].sbr_offset;
|
|
|
|
if (SBUS_ABS(base)) {
|
|
|
|
sa->sa_reg[n].sbr_slot = SBUS_ABS_TO_SLOT(base);
|
|
|
|
sa->sa_reg[n].sbr_offset = SBUS_ABS_TO_OFFSET(base);
|
|
|
|
}
|
1998-03-21 22:55:31 +03:00
|
|
|
}
|
1996-04-01 02:27:15 +04:00
|
|
|
|
1998-07-29 22:42:32 +04:00
|
|
|
if ((error = sbus_get_intr(sc, node, &sa->sa_intr, &sa->sa_nintr)) != 0)
|
1998-03-21 22:55:31 +03:00
|
|
|
return (error);
|
|
|
|
|
1998-08-31 01:26:46 +04:00
|
|
|
error = getprop(node, "address", sizeof(u_int32_t),
|
1998-09-07 11:11:11 +04:00
|
|
|
&sa->sa_npromvaddrs, (void **)&sa->sa_promvaddrs);
|
1998-07-29 22:42:32 +04:00
|
|
|
if (error != 0 && error != ENOENT)
|
1998-03-21 22:55:31 +03:00
|
|
|
return (error);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1998-07-29 22:42:32 +04:00
|
|
|
void
|
|
|
|
sbus_destroy_attach_args(sa)
|
|
|
|
struct sbus_attach_args *sa;
|
|
|
|
{
|
|
|
|
if (sa->sa_name != NULL)
|
|
|
|
free(sa->sa_name, M_DEVBUF);
|
|
|
|
|
|
|
|
if (sa->sa_nreg != 0)
|
|
|
|
free(sa->sa_reg, M_DEVBUF);
|
|
|
|
|
|
|
|
if (sa->sa_intr)
|
|
|
|
free(sa->sa_intr, M_DEVBUF);
|
|
|
|
|
|
|
|
if (sa->sa_promvaddrs)
|
|
|
|
free(sa->sa_promvaddrs, M_DEVBUF);
|
|
|
|
|
|
|
|
bzero(sa, sizeof(struct sbus_attach_args));/*DEBUG*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
int
|
1998-04-08 00:11:54 +04:00
|
|
|
_sbus_bus_map(t, btype, offset, size, flags, vaddr, hp)
|
|
|
|
bus_space_tag_t t;
|
1998-03-22 01:03:33 +03:00
|
|
|
bus_type_t btype;
|
|
|
|
bus_addr_t offset;
|
|
|
|
bus_size_t size;
|
|
|
|
int flags;
|
1998-08-21 18:07:37 +04:00
|
|
|
vaddr_t vaddr;
|
1998-03-21 22:55:31 +03:00
|
|
|
bus_space_handle_t *hp;
|
|
|
|
{
|
1998-04-08 00:11:54 +04:00
|
|
|
struct sbus_softc *sc = t->cookie;
|
1998-03-22 01:03:33 +03:00
|
|
|
int slot = btype;
|
1998-03-21 22:55:31 +03:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < sc->sc_nrange; i++) {
|
|
|
|
bus_addr_t paddr;
|
|
|
|
bus_type_t iospace;
|
|
|
|
|
|
|
|
if (sc->sc_range[i].cspace != slot)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* We've found the connection to the parent bus */
|
|
|
|
paddr = sc->sc_range[i].poffset + offset;
|
|
|
|
iospace = sc->sc_range[i].pspace;
|
|
|
|
return (bus_space_map2(sc->sc_bustag, iospace, paddr,
|
|
|
|
size, flags, vaddr, hp));
|
1993-10-02 13:22:00 +03:00
|
|
|
}
|
1998-03-21 22:55:31 +03:00
|
|
|
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1998-04-08 00:11:54 +04:00
|
|
|
sbus_bus_mmap(t, btype, paddr, flags, hp)
|
|
|
|
bus_space_tag_t t;
|
1998-03-21 22:55:31 +03:00
|
|
|
bus_type_t btype;
|
|
|
|
bus_addr_t paddr;
|
|
|
|
int flags;
|
1998-04-08 00:11:54 +04:00
|
|
|
bus_space_handle_t *hp;
|
1998-03-21 22:55:31 +03:00
|
|
|
{
|
|
|
|
int slot = (int)btype;
|
|
|
|
int offset = (int)paddr;
|
1998-04-08 00:11:54 +04:00
|
|
|
struct sbus_softc *sc = t->cookie;
|
1998-03-21 22:55:31 +03:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < sc->sc_nrange; i++) {
|
|
|
|
bus_addr_t paddr;
|
|
|
|
bus_addr_t iospace;
|
|
|
|
|
|
|
|
if (sc->sc_range[i].cspace != slot)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
paddr = sc->sc_range[i].poffset + offset;
|
|
|
|
iospace = (bus_addr_t)sc->sc_range[i].pspace;
|
1998-04-08 00:11:54 +04:00
|
|
|
return (bus_space_mmap(sc->sc_bustag, iospace, paddr,
|
|
|
|
flags, hp));
|
1998-03-21 22:55:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return (-1);
|
1993-10-02 13:22:00 +03:00
|
|
|
}
|
|
|
|
|
1998-03-21 22:55:31 +03:00
|
|
|
|
1993-10-02 13:22:00 +03:00
|
|
|
/*
|
|
|
|
* Each attached device calls sbus_establish after it initializes
|
|
|
|
* its sbusdev portion.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
sbus_establish(sd, dev)
|
|
|
|
register struct sbusdev *sd;
|
|
|
|
register struct device *dev;
|
|
|
|
{
|
1996-04-01 02:27:15 +04:00
|
|
|
register struct sbus_softc *sc;
|
|
|
|
register struct device *curdev;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We have to look for the sbus by name, since it is not necessarily
|
|
|
|
* our immediate parent (i.e. sun4m /iommu/sbus/espdma/esp)
|
|
|
|
* We don't just use the device structure of the above-attached
|
|
|
|
* sbus, since we might (in the future) support multiple sbus's.
|
|
|
|
*/
|
|
|
|
for (curdev = dev->dv_parent; ; curdev = curdev->dv_parent) {
|
|
|
|
if (!curdev || !curdev->dv_xname)
|
1997-03-11 02:01:40 +03:00
|
|
|
panic("sbus_establish: can't find sbus parent for %s",
|
|
|
|
sd->sd_dev->dv_xname
|
|
|
|
? sd->sd_dev->dv_xname
|
|
|
|
: "<unknown>" );
|
1996-04-01 02:27:15 +04:00
|
|
|
|
|
|
|
if (strncmp(curdev->dv_xname, "sbus", 4) == 0)
|
1997-03-11 02:01:40 +03:00
|
|
|
break;
|
1996-04-01 02:27:15 +04:00
|
|
|
}
|
|
|
|
sc = (struct sbus_softc *) curdev;
|
1993-10-02 13:22:00 +03:00
|
|
|
|
|
|
|
sd->sd_dev = dev;
|
|
|
|
sd->sd_bchain = sc->sc_sbdev;
|
|
|
|
sc->sc_sbdev = sd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reset the given sbus. (???)
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
sbusreset(sbus)
|
|
|
|
int sbus;
|
|
|
|
{
|
|
|
|
register struct sbusdev *sd;
|
1996-03-17 05:00:30 +03:00
|
|
|
struct sbus_softc *sc = sbus_cd.cd_devs[sbus];
|
1993-10-02 13:22:00 +03:00
|
|
|
struct device *dev;
|
|
|
|
|
1996-10-13 06:59:55 +04:00
|
|
|
printf("reset %s:", sc->sc_dev.dv_xname);
|
1993-10-02 13:22:00 +03:00
|
|
|
for (sd = sc->sc_sbdev; sd != NULL; sd = sd->sd_bchain) {
|
|
|
|
if (sd->sd_reset) {
|
|
|
|
dev = sd->sd_dev;
|
|
|
|
(*sd->sd_reset)(dev);
|
1996-10-13 06:59:55 +04:00
|
|
|
printf(" %s", dev->dv_xname);
|
1993-10-02 13:22:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-03-21 22:55:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get interrupt attributes for an Sbus device.
|
|
|
|
*/
|
|
|
|
int
|
1998-07-29 22:42:32 +04:00
|
|
|
sbus_get_intr(sc, node, ipp, np)
|
1998-03-21 22:55:31 +03:00
|
|
|
struct sbus_softc *sc;
|
|
|
|
int node;
|
1998-07-29 22:42:32 +04:00
|
|
|
struct sbus_intr **ipp;
|
|
|
|
int *np;
|
1998-03-21 22:55:31 +03:00
|
|
|
{
|
1998-07-29 22:42:32 +04:00
|
|
|
int error, n;
|
|
|
|
u_int32_t *ipl = NULL;
|
1998-03-21 22:55:31 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The `interrupts' property contains the Sbus interrupt level.
|
|
|
|
*/
|
1998-08-31 01:26:46 +04:00
|
|
|
if (getprop(node, "interrupts", sizeof(int), np, (void **)&ipl) == 0) {
|
1998-07-29 22:42:32 +04:00
|
|
|
/* Change format to an `struct sbus_intr' array */
|
|
|
|
struct sbus_intr *ip;
|
|
|
|
ip = malloc(*np * sizeof(struct sbus_intr), M_DEVBUF, M_NOWAIT);
|
|
|
|
if (ip == NULL)
|
|
|
|
return (ENOMEM);
|
|
|
|
for (n = 0; n < *np; n++) {
|
|
|
|
ip[n].sbi_pri = ipl[n];
|
|
|
|
ip[n].sbi_vec = 0;
|
|
|
|
}
|
1998-03-21 22:55:31 +03:00
|
|
|
free(ipl, M_DEVBUF);
|
1998-07-29 22:42:32 +04:00
|
|
|
*ipp = ip;
|
1998-03-21 22:55:31 +03:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fall back on `intr' property.
|
|
|
|
*/
|
1998-07-29 22:42:32 +04:00
|
|
|
*ipp = NULL;
|
1998-08-31 01:26:46 +04:00
|
|
|
error = getprop(node, "intr", sizeof(struct sbus_intr),
|
|
|
|
np, (void **)ipp);
|
1998-07-29 22:42:32 +04:00
|
|
|
switch (error) {
|
1998-03-21 22:55:31 +03:00
|
|
|
case 0:
|
1998-07-29 22:42:32 +04:00
|
|
|
for (n = *np; n-- > 0;) {
|
|
|
|
(*ipp)[n].sbi_pri &= 0xf;
|
|
|
|
(*ipp)[n].sbi_pri |= SBUS_INTR_COMPAT;
|
|
|
|
}
|
|
|
|
break;
|
1998-03-21 22:55:31 +03:00
|
|
|
case ENOENT:
|
1998-07-29 22:42:32 +04:00
|
|
|
error = 0;
|
|
|
|
break;
|
1998-03-21 22:55:31 +03:00
|
|
|
}
|
|
|
|
|
1998-07-29 22:42:32 +04:00
|
|
|
return (error);
|
1998-03-21 22:55:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Install an interrupt handler for an Sbus device.
|
|
|
|
*/
|
|
|
|
void *
|
1998-04-08 00:11:54 +04:00
|
|
|
sbus_intr_establish(t, level, flags, handler, arg)
|
|
|
|
bus_space_tag_t t;
|
1998-03-21 22:55:31 +03:00
|
|
|
int level;
|
|
|
|
int flags;
|
|
|
|
int (*handler) __P((void *));
|
|
|
|
void *arg;
|
|
|
|
{
|
1998-04-08 00:11:54 +04:00
|
|
|
struct sbus_softc *sc = t->cookie;
|
1998-03-21 22:55:31 +03:00
|
|
|
struct intrhand *ih;
|
|
|
|
int ipl;
|
|
|
|
|
|
|
|
ih = (struct intrhand *)
|
|
|
|
malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT);
|
|
|
|
if (ih == NULL)
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
if ((flags & BUS_INTR_ESTABLISH_SOFTINTR) != 0)
|
|
|
|
ipl = level;
|
|
|
|
else if ((level & SBUS_INTR_COMPAT) != 0)
|
|
|
|
ipl = level & ~SBUS_INTR_COMPAT;
|
|
|
|
else
|
|
|
|
ipl = sc->sc_intr2ipl[level];
|
|
|
|
|
|
|
|
ih->ih_fun = handler;
|
|
|
|
ih->ih_arg = arg;
|
|
|
|
if ((flags & BUS_INTR_ESTABLISH_FASTTRAP) != 0)
|
|
|
|
intr_fasttrap(ipl, (void (*)__P((void)))handler);
|
|
|
|
else
|
|
|
|
intr_establish(ipl, ih);
|
|
|
|
return (ih);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bus_space_tag_t
|
|
|
|
sbus_alloc_bustag(sc)
|
|
|
|
struct sbus_softc *sc;
|
|
|
|
{
|
|
|
|
bus_space_tag_t sbt;
|
|
|
|
|
|
|
|
sbt = (bus_space_tag_t)
|
|
|
|
malloc(sizeof(struct sparc_bus_space_tag), M_DEVBUF, M_NOWAIT);
|
|
|
|
if (sbt == NULL)
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
bzero(sbt, sizeof *sbt);
|
|
|
|
sbt->cookie = sc;
|
1998-04-08 00:11:54 +04:00
|
|
|
sbt->parent = sc->sc_bustag;
|
1998-03-21 22:55:31 +03:00
|
|
|
sbt->sparc_bus_map = _sbus_bus_map;
|
|
|
|
sbt->sparc_bus_mmap = sbus_bus_mmap;
|
|
|
|
sbt->sparc_intr_establish = sbus_intr_establish;
|
|
|
|
return (sbt);
|
|
|
|
}
|
1998-09-19 19:49:50 +04:00
|
|
|
|
|
|
|
int
|
|
|
|
sbus_error()
|
|
|
|
{
|
|
|
|
struct sbus_softc *sc = sbus_sc;
|
|
|
|
bus_space_handle_t bh = sc->sc_bh;
|
|
|
|
u_int32_t afsr, afva;
|
|
|
|
char bits[64];
|
|
|
|
static int straytime, nstray;
|
|
|
|
int timesince;
|
|
|
|
|
|
|
|
afsr = bus_space_read_4(sc->sc_bustag, bh, SBUS_AFSR_REG);
|
|
|
|
afva = bus_space_read_4(sc->sc_bustag, bh, SBUS_AFAR_REG);
|
|
|
|
printf("sbus error:\n\tAFSR %s\n",
|
|
|
|
bitmask_snprintf(afsr, SBUS_AFSR_BITS, bits, sizeof(bits)));
|
|
|
|
printf("\taddress: 0x%x%x\n", afsr & SBUS_AFSR_PAH, afva);
|
|
|
|
|
|
|
|
/* For now, do the same dance as on stray interrupts */
|
|
|
|
timesince = time.tv_sec - straytime;
|
|
|
|
if (timesince <= 10) {
|
|
|
|
if (++nstray > 9)
|
|
|
|
panic("too many SBus errors");
|
|
|
|
} else {
|
|
|
|
straytime = time.tv_sec;
|
|
|
|
nstray = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Unlock registers and clear interrupt */
|
|
|
|
bus_space_write_4(sc->sc_bustag, bh, SBUS_AFSR_REG, afsr);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|