Home | History | Annotate | Line # | Download | only in uba
uba_sbi.c revision 1.12.8.5
      1  1.12.8.5  nathanw /*	$NetBSD: uba_sbi.c,v 1.12.8.5 2002/10/18 02:40:33 nathanw Exp $	   */
      2  1.12.8.2  nathanw /*
      3  1.12.8.2  nathanw  * Copyright (c) 1996 Jonathan Stone.
      4  1.12.8.2  nathanw  * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
      5  1.12.8.2  nathanw  * Copyright (c) 1982, 1986 The Regents of the University of California.
      6  1.12.8.2  nathanw  * All rights reserved.
      7  1.12.8.2  nathanw  *
      8  1.12.8.2  nathanw  * Redistribution and use in source and binary forms, with or without
      9  1.12.8.2  nathanw  * modification, are permitted provided that the following conditions
     10  1.12.8.2  nathanw  * are met:
     11  1.12.8.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     12  1.12.8.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     13  1.12.8.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.12.8.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     15  1.12.8.2  nathanw  *    documentation and/or other materials provided with the distribution.
     16  1.12.8.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     17  1.12.8.2  nathanw  *    must display the following acknowledgement:
     18  1.12.8.2  nathanw  *	This product includes software developed by the University of
     19  1.12.8.2  nathanw  *	California, Berkeley and its contributors.
     20  1.12.8.2  nathanw  * 4. Neither the name of the University nor the names of its contributors
     21  1.12.8.2  nathanw  *    may be used to endorse or promote products derived from this software
     22  1.12.8.2  nathanw  *    without specific prior written permission.
     23  1.12.8.2  nathanw  *
     24  1.12.8.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  1.12.8.2  nathanw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  1.12.8.2  nathanw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  1.12.8.2  nathanw  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  1.12.8.2  nathanw  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  1.12.8.2  nathanw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  1.12.8.2  nathanw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  1.12.8.2  nathanw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  1.12.8.2  nathanw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  1.12.8.2  nathanw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  1.12.8.2  nathanw  * SUCH DAMAGE.
     35  1.12.8.2  nathanw  *
     36  1.12.8.2  nathanw  *	@(#)uba.c	7.10 (Berkeley) 12/16/90
     37  1.12.8.2  nathanw  *	@(#)autoconf.c	7.20 (Berkeley) 5/9/91
     38  1.12.8.2  nathanw  */
     39  1.12.8.2  nathanw 
     40  1.12.8.2  nathanw #include <sys/param.h>
     41  1.12.8.2  nathanw #include <sys/device.h>
     42  1.12.8.2  nathanw #include <sys/systm.h>
     43  1.12.8.2  nathanw #include <sys/kernel.h>
     44  1.12.8.2  nathanw 
     45  1.12.8.2  nathanw #define _VAX_BUS_DMA_PRIVATE
     46  1.12.8.2  nathanw #include <machine/bus.h>
     47  1.12.8.2  nathanw #include <machine/mtpr.h>
     48  1.12.8.2  nathanw #include <machine/nexus.h>
     49  1.12.8.2  nathanw #include <machine/cpu.h>
     50  1.12.8.2  nathanw #include <machine/sgmap.h>
     51  1.12.8.2  nathanw #include <machine/scb.h>
     52  1.12.8.2  nathanw 
     53  1.12.8.2  nathanw #include <dev/qbus/ubavar.h>
     54  1.12.8.2  nathanw 
     55  1.12.8.2  nathanw #include <vax/uba/uba_common.h>
     56  1.12.8.2  nathanw 
     57  1.12.8.2  nathanw #include "locators.h"
     58  1.12.8.2  nathanw #include "ioconf.h"
     59  1.12.8.2  nathanw 
     60  1.12.8.2  nathanw /* Some SBI-specific defines */
     61  1.12.8.2  nathanw #define UBASIZE		(UBAPAGES * VAX_NBPG)
     62  1.12.8.2  nathanw #define UMEMA8600(i)   	(0x20100000+(i)*0x40000)
     63  1.12.8.2  nathanw #define	UMEMB8600(i)	(0x22100000+(i)*0x40000)
     64  1.12.8.2  nathanw 
     65  1.12.8.2  nathanw /*
     66  1.12.8.2  nathanw  * Some status registers.
     67  1.12.8.2  nathanw  */
     68  1.12.8.2  nathanw #define UBACNFGR_UBIC  0x00010000      /* unibus init complete */
     69  1.12.8.2  nathanw #define UBACNFGR_BITS \
     70  1.12.8.2  nathanw "\40\40PARFLT\37WSQFLT\36URDFLT\35ISQFLT\34MXTFLT\33XMTFLT\30ADPDN\27ADPUP\23UBINIT\22UBPDN\21UBIC"
     71  1.12.8.2  nathanw 
     72  1.12.8.2  nathanw #define UBACR_IFS      0x00000040      /* interrupt field switch */
     73  1.12.8.2  nathanw #define UBACR_BRIE     0x00000020      /* BR interrupt enable */
     74  1.12.8.2  nathanw #define UBACR_USEFIE   0x00000010      /* UNIBUS to SBI error field IE */
     75  1.12.8.2  nathanw #define UBACR_SUEFIE   0x00000008      /* SBI to UNIBUS error field IE */
     76  1.12.8.2  nathanw #define UBACR_ADINIT   0x00000001      /* adapter init */
     77  1.12.8.2  nathanw 
     78  1.12.8.2  nathanw #define UBADPR_BNE     0x80000000      /* buffer not empty - purge */
     79  1.12.8.2  nathanw 
     80  1.12.8.2  nathanw #define UBABRRVR_DIV    0x0000ffff      /* device interrupt vector field */
     81  1.12.8.2  nathanw 
     82  1.12.8.2  nathanw #define UBASR_BITS \
     83  1.12.8.2  nathanw "\20\13RDTO\12RDS\11CRD\10CXTER\7CXTMO\6DPPE\5IVMR\4MRPF\3LEB\2UBSTO\1UBSSYNTO"
     84  1.12.8.2  nathanw 
     85  1.12.8.2  nathanw char    ubasr_bits[] = UBASR_BITS;
     86  1.12.8.2  nathanw 
     87  1.12.8.2  nathanw /*
     88  1.12.8.2  nathanw  * The DW780 are directly connected to the SBI on 11/780 and 8600.
     89  1.12.8.2  nathanw  */
     90  1.12.8.2  nathanw static	int	dw780_match(struct device *, struct cfdata *, void *);
     91  1.12.8.2  nathanw static	void	dw780_attach(struct device *, struct device *, void *);
     92  1.12.8.2  nathanw static	void	dw780_init(struct uba_softc*);
     93  1.12.8.2  nathanw static	void    dw780_beforescan(struct uba_softc *);
     94  1.12.8.2  nathanw static	void    dw780_afterscan(struct uba_softc *);
     95  1.12.8.2  nathanw static	int     dw780_errchk(struct uba_softc *);
     96  1.12.8.2  nathanw static	void    uba_dw780int(void *);
     97  1.12.8.2  nathanw static  void	ubaerror(struct uba_softc *, int *, int *);
     98  1.12.8.2  nathanw #ifdef notyet
     99  1.12.8.2  nathanw static	void	dw780_purge(struct uba_softc *, int);
    100  1.12.8.2  nathanw #endif
    101  1.12.8.2  nathanw 
    102  1.12.8.5  nathanw CFATTACH_DECL(uba_sbi, sizeof(struct uba_vsoftc),
    103  1.12.8.5  nathanw     dw780_match, dw780_attach, NULL, NULL);
    104  1.12.8.2  nathanw 
    105  1.12.8.3  nathanw static struct evcnt strayint = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "uba","stray intr");
    106  1.12.8.3  nathanw static int strayinit = 0;
    107  1.12.8.3  nathanw 
    108  1.12.8.2  nathanw extern	struct vax_bus_space vax_mem_bus_space;
    109  1.12.8.2  nathanw 
    110  1.12.8.2  nathanw int
    111  1.12.8.2  nathanw dw780_match(struct device *parent, struct cfdata *cf, void *aux)
    112  1.12.8.2  nathanw {
    113  1.12.8.2  nathanw 	struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
    114  1.12.8.2  nathanw 
    115  1.12.8.2  nathanw 	if (cf->cf_loc[SBICF_TR] != sa->sa_nexnum &&
    116  1.12.8.2  nathanw 	    cf->cf_loc[SBICF_TR] != SBICF_TR_DEFAULT)
    117  1.12.8.2  nathanw 		return 0;
    118  1.12.8.2  nathanw 	/*
    119  1.12.8.2  nathanw 	 * The uba type is actually only telling where the uba
    120  1.12.8.2  nathanw 	 * space is in nexus space.
    121  1.12.8.2  nathanw 	 */
    122  1.12.8.2  nathanw 	if ((sa->sa_type & ~3) != NEX_UBA0)
    123  1.12.8.2  nathanw 		return 0;
    124  1.12.8.2  nathanw 
    125  1.12.8.2  nathanw 	return 1;
    126  1.12.8.2  nathanw }
    127  1.12.8.2  nathanw 
    128  1.12.8.2  nathanw void
    129  1.12.8.2  nathanw dw780_attach(struct device *parent, struct device *self, void *aux)
    130  1.12.8.2  nathanw {
    131  1.12.8.2  nathanw 	struct uba_vsoftc *sc = (void *)self;
    132  1.12.8.2  nathanw 	struct sbi_attach_args *sa = aux;
    133  1.12.8.2  nathanw 	int ubaddr = sa->sa_type & 3;
    134  1.12.8.2  nathanw 	int i;
    135  1.12.8.2  nathanw 
    136  1.12.8.2  nathanw 	printf(": DW780\n");
    137  1.12.8.2  nathanw 	/*
    138  1.12.8.2  nathanw 	 * Fill in bus specific data.
    139  1.12.8.2  nathanw 	 */
    140  1.12.8.2  nathanw 	sc->uv_sc.uh_ubainit = dw780_init;
    141  1.12.8.2  nathanw #ifdef notyet
    142  1.12.8.2  nathanw 	sc->uv_sc.uh_ubapurge = dw780_purge;
    143  1.12.8.2  nathanw #endif
    144  1.12.8.2  nathanw 	sc->uv_sc.uh_beforescan = dw780_beforescan;
    145  1.12.8.2  nathanw 	sc->uv_sc.uh_afterscan = dw780_afterscan;
    146  1.12.8.2  nathanw 	sc->uv_sc.uh_errchk = dw780_errchk;
    147  1.12.8.2  nathanw 	sc->uv_sc.uh_iot = &vax_mem_bus_space;
    148  1.12.8.2  nathanw 	sc->uv_sc.uh_dmat = &sc->uv_dmat;
    149  1.12.8.4  nathanw 	sc->uv_sc.uh_nr = ubaddr;
    150  1.12.8.2  nathanw 	sc->uv_uba = (void *)sa->sa_ioh;
    151  1.12.8.2  nathanw 	sc->uh_ibase = VAX_NBPG + ubaddr * VAX_NBPG;
    152  1.12.8.2  nathanw 	sc->uv_sc.uh_type = UBA_UBA;
    153  1.12.8.2  nathanw 
    154  1.12.8.3  nathanw 	if (strayinit++ == 0) evcnt_attach_static(&strayint); /* Setup stray
    155  1.12.8.3  nathanw 							         interrupt
    156  1.12.8.3  nathanw 							         counter. */
    157  1.12.8.3  nathanw 
    158  1.12.8.2  nathanw 	/*
    159  1.12.8.2  nathanw 	 * Set up dispatch vectors for DW780.
    160  1.12.8.2  nathanw 	 */
    161  1.12.8.2  nathanw 	for (i = 0x14; i < 0x18; i++)
    162  1.12.8.2  nathanw 		scb_vecalloc(vecnum(0, i, sa->sa_nexnum), uba_dw780int,
    163  1.12.8.2  nathanw 		    sc, SCB_ISTACK, &sc->uv_sc.uh_intrcnt);
    164  1.12.8.2  nathanw 	evcnt_attach_dynamic(&sc->uv_sc.uh_intrcnt, EVCNT_TYPE_INTR, NULL,
    165  1.12.8.2  nathanw 		sc->uv_sc.uh_dev.dv_xname, "intr");
    166  1.12.8.2  nathanw 
    167  1.12.8.2  nathanw 	/*
    168  1.12.8.2  nathanw 	 * Fill in variables used by the sgmap system.
    169  1.12.8.2  nathanw 	 */
    170  1.12.8.2  nathanw 	sc->uv_size = UBASIZE;		/* Size in bytes of Unibus space */
    171  1.12.8.2  nathanw 
    172  1.12.8.2  nathanw 	uba_dma_init(sc);
    173  1.12.8.2  nathanw 	uba_attach(&sc->uv_sc, (sa->sa_sbinum ? UMEMB8600(ubaddr) :
    174  1.12.8.2  nathanw 	    UMEMA8600(ubaddr)) + (UBAPAGES * VAX_NBPG));
    175  1.12.8.2  nathanw }
    176  1.12.8.2  nathanw 
    177  1.12.8.2  nathanw void
    178  1.12.8.2  nathanw dw780_beforescan(struct uba_softc *sc)
    179  1.12.8.2  nathanw {
    180  1.12.8.2  nathanw 	struct uba_vsoftc *vc = (void *)sc;
    181  1.12.8.2  nathanw 	volatile int *hej = &vc->uv_uba->uba_sr;
    182  1.12.8.2  nathanw 
    183  1.12.8.2  nathanw 	*hej = *hej;
    184  1.12.8.2  nathanw 	vc->uv_uba->uba_cr = UBACR_IFS|UBACR_BRIE;
    185  1.12.8.2  nathanw }
    186  1.12.8.2  nathanw 
    187  1.12.8.2  nathanw void
    188  1.12.8.2  nathanw dw780_afterscan(struct uba_softc *sc)
    189  1.12.8.2  nathanw {
    190  1.12.8.2  nathanw 	struct uba_vsoftc *vc = (void *)sc;
    191  1.12.8.2  nathanw 
    192  1.12.8.2  nathanw 	vc->uv_uba->uba_cr = UBACR_IFS | UBACR_BRIE |
    193  1.12.8.2  nathanw 	    UBACR_USEFIE | UBACR_SUEFIE |
    194  1.12.8.2  nathanw 	    (vc->uv_uba->uba_cr & 0x7c000000);
    195  1.12.8.2  nathanw }
    196  1.12.8.2  nathanw 
    197  1.12.8.2  nathanw 
    198  1.12.8.2  nathanw int
    199  1.12.8.2  nathanw dw780_errchk(struct uba_softc *sc)
    200  1.12.8.2  nathanw {
    201  1.12.8.2  nathanw 	struct uba_vsoftc *vc = (void *)sc;
    202  1.12.8.2  nathanw 	volatile int *hej = &vc->uv_uba->uba_sr;
    203  1.12.8.2  nathanw 
    204  1.12.8.2  nathanw 	if (*hej) {
    205  1.12.8.2  nathanw 		*hej = *hej;
    206  1.12.8.2  nathanw 		return 1;
    207  1.12.8.2  nathanw 	}
    208  1.12.8.2  nathanw 	return 0;
    209  1.12.8.2  nathanw }
    210  1.12.8.2  nathanw 
    211  1.12.8.2  nathanw void
    212  1.12.8.2  nathanw uba_dw780int(void *arg)
    213  1.12.8.2  nathanw {
    214  1.12.8.2  nathanw 	extern	void scb_stray(void *);
    215  1.12.8.2  nathanw 	struct	uba_vsoftc *vc = arg;
    216  1.12.8.2  nathanw 	struct	uba_regs *ur = vc->uv_uba;
    217  1.12.8.2  nathanw 	struct	ivec_dsp *ivec;
    218  1.12.8.3  nathanw 	struct  evcnt *uvec;
    219  1.12.8.2  nathanw 	int	br, vec;
    220  1.12.8.2  nathanw 
    221  1.12.8.2  nathanw 	br = mfpr(PR_IPL);
    222  1.12.8.3  nathanw 	uvec = &vc->uv_sc.uh_intrcnt;
    223  1.12.8.2  nathanw 	vec = ur->uba_brrvr[br - 0x14];
    224  1.12.8.2  nathanw 	if (vec <= 0) {
    225  1.12.8.2  nathanw 		ubaerror(&vc->uv_sc, &br, &vec);
    226  1.12.8.2  nathanw 		if (vec == 0)
    227  1.12.8.2  nathanw 			return;
    228  1.12.8.2  nathanw 	}
    229  1.12.8.2  nathanw 
    230  1.12.8.3  nathanw 	uvec->ev_count--;	/* This interrupt should not be counted against
    231  1.12.8.3  nathanw 				   the uba. */
    232  1.12.8.3  nathanw 	ivec = &scb_vec[(vc->uh_ibase + vec)/4];
    233  1.12.8.3  nathanw 	if (cold && *ivec->hoppaddr == scb_stray) {
    234  1.12.8.2  nathanw 		scb_fake(vec + vc->uh_ibase, br);
    235  1.12.8.2  nathanw 	} else {
    236  1.12.8.3  nathanw 		if (*ivec->hoppaddr == scb_stray)
    237  1.12.8.3  nathanw 			strayint.ev_count++; /* Count against stray int */
    238  1.12.8.3  nathanw 		else
    239  1.12.8.3  nathanw 			ivec->ev->ev_count++; /* Count against device */
    240  1.12.8.2  nathanw 		(*ivec->hoppaddr)(ivec->pushlarg);
    241  1.12.8.2  nathanw 	}
    242  1.12.8.2  nathanw }
    243  1.12.8.2  nathanw 
    244  1.12.8.2  nathanw void
    245  1.12.8.2  nathanw dw780_init(struct uba_softc *sc)
    246  1.12.8.2  nathanw {
    247  1.12.8.2  nathanw 	struct uba_vsoftc *vc = (void *)sc;
    248  1.12.8.2  nathanw 
    249  1.12.8.2  nathanw 	vc->uv_uba->uba_cr = UBACR_ADINIT;
    250  1.12.8.2  nathanw 	vc->uv_uba->uba_cr = UBACR_IFS|UBACR_BRIE|UBACR_USEFIE|UBACR_SUEFIE;
    251  1.12.8.2  nathanw 	while ((vc->uv_uba->uba_cnfgr & UBACNFGR_UBIC) == 0)
    252  1.12.8.2  nathanw 		;
    253  1.12.8.2  nathanw }
    254  1.12.8.2  nathanw 
    255  1.12.8.2  nathanw #ifdef notyet
    256  1.12.8.2  nathanw void
    257  1.12.8.2  nathanw dw780_purge(sc, bdp)
    258  1.12.8.2  nathanw 	struct uba_softc *sc;
    259  1.12.8.2  nathanw 	int bdp;
    260  1.12.8.2  nathanw {
    261  1.12.8.2  nathanw 	struct uba_vsoftc *vc = (void *)sc;
    262  1.12.8.2  nathanw 
    263  1.12.8.2  nathanw 	vc->uv_uba->uba_dpr[bdp] |= UBADPR_BNE;
    264  1.12.8.2  nathanw }
    265  1.12.8.2  nathanw #endif
    266  1.12.8.2  nathanw 
    267  1.12.8.2  nathanw int	ubawedgecnt = 10;
    268  1.12.8.2  nathanw int	ubacrazy = 500;
    269  1.12.8.2  nathanw int	zvcnt_max = 5000;	/* in 8 sec */
    270  1.12.8.2  nathanw int	ubaerrcnt;
    271  1.12.8.2  nathanw /*
    272  1.12.8.2  nathanw  * This routine is called by the locore code to process a UBA
    273  1.12.8.2  nathanw  * error on an 11/780 or 8600.	The arguments are passed
    274  1.12.8.2  nathanw  * on the stack, and value-result (through some trickery).
    275  1.12.8.2  nathanw  * In particular, the uvec argument is used for further
    276  1.12.8.2  nathanw  * uba processing so the result aspect of it is very important.
    277  1.12.8.2  nathanw  */
    278  1.12.8.2  nathanw /*ARGSUSED*/
    279  1.12.8.2  nathanw void
    280  1.12.8.2  nathanw ubaerror(struct uba_softc *uh, int *ipl, int *uvec)
    281  1.12.8.2  nathanw {
    282  1.12.8.2  nathanw 	struct uba_vsoftc *vc = (void *)uh;
    283  1.12.8.2  nathanw 	struct	uba_regs *uba = vc->uv_uba;
    284  1.12.8.2  nathanw 	int sr, s;
    285  1.12.8.2  nathanw 	char sbuf[256], sbuf2[256];
    286  1.12.8.2  nathanw 
    287  1.12.8.2  nathanw 	if (*uvec == 0) {
    288  1.12.8.2  nathanw 		/*
    289  1.12.8.2  nathanw 		 * Declare dt as unsigned so that negative values
    290  1.12.8.2  nathanw 		 * are handled as >8 below, in case time was set back.
    291  1.12.8.2  nathanw 		 */
    292  1.12.8.2  nathanw 		u_long	dt = time.tv_sec - vc->uh_zvtime;
    293  1.12.8.2  nathanw 
    294  1.12.8.2  nathanw 		vc->uh_zvtotal++;
    295  1.12.8.2  nathanw 		if (dt > 8) {
    296  1.12.8.2  nathanw 			vc->uh_zvtime = time.tv_sec;
    297  1.12.8.2  nathanw 			vc->uh_zvcnt = 0;
    298  1.12.8.2  nathanw 		}
    299  1.12.8.2  nathanw 		if (++vc->uh_zvcnt > zvcnt_max) {
    300  1.12.8.2  nathanw 			printf("%s: too many zero vectors (%d in <%d sec)\n",
    301  1.12.8.2  nathanw 				vc->uv_sc.uh_dev.dv_xname, vc->uh_zvcnt, (int)dt + 1);
    302  1.12.8.2  nathanw 
    303  1.12.8.2  nathanw 			bitmask_snprintf(uba->uba_cnfgr&(~0xff), UBACNFGR_BITS,
    304  1.12.8.2  nathanw 					 sbuf, sizeof(sbuf));
    305  1.12.8.2  nathanw 			printf("\tIPL 0x%x\n\tcnfgr: %s	 Adapter Code: 0x%x\n",
    306  1.12.8.2  nathanw 				*ipl, sbuf, uba->uba_cnfgr&0xff);
    307  1.12.8.2  nathanw 
    308  1.12.8.2  nathanw 			bitmask_snprintf(uba->uba_sr, ubasr_bits, sbuf, sizeof(sbuf));
    309  1.12.8.2  nathanw 			printf("\tsr: %s\n\tdcr: %x (MIC %sOK)\n",
    310  1.12.8.2  nathanw 				sbuf, uba->uba_dcr,
    311  1.12.8.2  nathanw 				(uba->uba_dcr&0x8000000)?"":"NOT ");
    312  1.12.8.2  nathanw 
    313  1.12.8.2  nathanw 			ubareset(&vc->uv_sc);
    314  1.12.8.2  nathanw 		}
    315  1.12.8.2  nathanw 		return;
    316  1.12.8.2  nathanw 	}
    317  1.12.8.2  nathanw 	if (uba->uba_cnfgr & NEX_CFGFLT) {
    318  1.12.8.2  nathanw 		bitmask_snprintf(uba->uba_sr, ubasr_bits, sbuf, sizeof(sbuf));
    319  1.12.8.2  nathanw 		bitmask_snprintf(uba->uba_cnfgr, NEXFLT_BITS, sbuf2, sizeof(sbuf2));
    320  1.12.8.2  nathanw 		printf("%s: sbi fault sr=%s cnfgr=%s\n",
    321  1.12.8.2  nathanw 		    vc->uv_sc.uh_dev.dv_xname, sbuf, sbuf2);
    322  1.12.8.2  nathanw 		ubareset(&vc->uv_sc);
    323  1.12.8.2  nathanw 		*uvec = 0;
    324  1.12.8.2  nathanw 		return;
    325  1.12.8.2  nathanw 	}
    326  1.12.8.2  nathanw 	sr = uba->uba_sr;
    327  1.12.8.2  nathanw 	s = spluba();
    328  1.12.8.2  nathanw 	bitmask_snprintf(uba->uba_sr, ubasr_bits, sbuf, sizeof(sbuf));
    329  1.12.8.2  nathanw 	printf("%s: uba error sr=%s fmer=%x fubar=%o\n", vc->uv_sc.uh_dev.dv_xname,
    330  1.12.8.2  nathanw 	    sbuf, uba->uba_fmer, 4*uba->uba_fubar);
    331  1.12.8.2  nathanw 	splx(s);
    332  1.12.8.2  nathanw 	uba->uba_sr = sr;
    333  1.12.8.2  nathanw 	*uvec &= UBABRRVR_DIV;
    334  1.12.8.2  nathanw 	if (++ubaerrcnt % ubawedgecnt == 0) {
    335  1.12.8.2  nathanw 		if (ubaerrcnt > ubacrazy)
    336  1.12.8.2  nathanw 			panic("uba crazy");
    337  1.12.8.2  nathanw 		printf("ERROR LIMIT ");
    338  1.12.8.2  nathanw 		ubareset(&vc->uv_sc);
    339  1.12.8.2  nathanw 		*uvec = 0;
    340  1.12.8.2  nathanw 	}
    341  1.12.8.2  nathanw }
    342