Home | History | Annotate | Line # | Download | only in pci
dwlpx.c revision 1.23.2.2
      1  1.23.2.2  nathanw /* $NetBSD: dwlpx.c,v 1.23.2.2 2002/06/20 03:37:40 nathanw Exp $ */
      2  1.23.2.2  nathanw 
      3  1.23.2.2  nathanw /*
      4  1.23.2.2  nathanw  * Copyright (c) 1997 by Matthew Jacob
      5  1.23.2.2  nathanw  * NASA AMES Research Center.
      6  1.23.2.2  nathanw  * All rights reserved.
      7  1.23.2.2  nathanw  *
      8  1.23.2.2  nathanw  * Redistribution and use in source and binary forms, with or without
      9  1.23.2.2  nathanw  * modification, are permitted provided that the following conditions
     10  1.23.2.2  nathanw  * are met:
     11  1.23.2.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     12  1.23.2.2  nathanw  *    notice immediately at the beginning of the file, without modification,
     13  1.23.2.2  nathanw  *    this list of conditions, and the following disclaimer.
     14  1.23.2.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.23.2.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     16  1.23.2.2  nathanw  *    documentation and/or other materials provided with the distribution.
     17  1.23.2.2  nathanw  * 3. The name of the author may not be used to endorse or promote products
     18  1.23.2.2  nathanw  *    derived from this software without specific prior written permission.
     19  1.23.2.2  nathanw  *
     20  1.23.2.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     21  1.23.2.2  nathanw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     22  1.23.2.2  nathanw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     23  1.23.2.2  nathanw  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
     24  1.23.2.2  nathanw  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     25  1.23.2.2  nathanw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     26  1.23.2.2  nathanw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     27  1.23.2.2  nathanw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     28  1.23.2.2  nathanw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     29  1.23.2.2  nathanw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     30  1.23.2.2  nathanw  * SUCH DAMAGE.
     31  1.23.2.2  nathanw  */
     32  1.23.2.2  nathanw 
     33  1.23.2.2  nathanw #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
     34  1.23.2.2  nathanw 
     35  1.23.2.2  nathanw __KERNEL_RCSID(0, "$NetBSD: dwlpx.c,v 1.23.2.2 2002/06/20 03:37:40 nathanw Exp $");
     36  1.23.2.2  nathanw 
     37  1.23.2.2  nathanw #include <sys/param.h>
     38  1.23.2.2  nathanw #include <sys/systm.h>
     39  1.23.2.2  nathanw #include <sys/kernel.h>
     40  1.23.2.2  nathanw #include <sys/device.h>
     41  1.23.2.2  nathanw 
     42  1.23.2.2  nathanw #include <uvm/uvm_extern.h>
     43  1.23.2.2  nathanw 
     44  1.23.2.2  nathanw #include <machine/autoconf.h>
     45  1.23.2.2  nathanw 
     46  1.23.2.2  nathanw #include <dev/pci/pcireg.h>
     47  1.23.2.2  nathanw #include <dev/pci/pcivar.h>
     48  1.23.2.2  nathanw 
     49  1.23.2.2  nathanw #include <alpha/tlsb/tlsbreg.h>
     50  1.23.2.2  nathanw #include <alpha/tlsb/kftxxvar.h>
     51  1.23.2.2  nathanw #include <alpha/tlsb/kftxxreg.h>
     52  1.23.2.2  nathanw #include <alpha/pci/dwlpxreg.h>
     53  1.23.2.2  nathanw #include <alpha/pci/dwlpxvar.h>
     54  1.23.2.2  nathanw #include <alpha/pci/pci_kn8ae.h>
     55  1.23.2.2  nathanw 
     56  1.23.2.2  nathanw #define	KV(_addr)	((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr)))
     57  1.23.2.2  nathanw #define	DWLPX_SYSBASE(sc)	\
     58  1.23.2.2  nathanw 	    ((((unsigned long)((sc)->dwlpx_node - 4))	<< 36) |	\
     59  1.23.2.2  nathanw 	     (((unsigned long) (sc)->dwlpx_hosenum)	<< 34) |	\
     60  1.23.2.2  nathanw 	     (1LL					<< 39))
     61  1.23.2.2  nathanw 
     62  1.23.2.2  nathanw 
     63  1.23.2.2  nathanw static int	dwlpxmatch __P((struct device *, struct cfdata *, void *));
     64  1.23.2.2  nathanw static void	dwlpxattach __P((struct device *, struct device *, void *));
     65  1.23.2.2  nathanw struct cfattach dwlpx_ca = {
     66  1.23.2.2  nathanw 	sizeof(struct dwlpx_softc), dwlpxmatch, dwlpxattach
     67  1.23.2.2  nathanw };
     68  1.23.2.2  nathanw 
     69  1.23.2.2  nathanw extern struct cfdriver dwlpx_cd;
     70  1.23.2.2  nathanw 
     71  1.23.2.2  nathanw static int	dwlpxprint __P((void *, const char *));
     72  1.23.2.2  nathanw 
     73  1.23.2.2  nathanw void	dwlpx_errintr(void *, u_long vec);
     74  1.23.2.2  nathanw 
     75  1.23.2.2  nathanw static int
     76  1.23.2.2  nathanw dwlpxprint(aux, pnp)
     77  1.23.2.2  nathanw 	void *aux;
     78  1.23.2.2  nathanw 	const char *pnp;
     79  1.23.2.2  nathanw {
     80  1.23.2.2  nathanw 	register struct pcibus_attach_args *pba = aux;
     81  1.23.2.2  nathanw 	/* only PCIs can attach to DWLPX's; easy. */
     82  1.23.2.2  nathanw 	if (pnp)
     83  1.23.2.2  nathanw 		printf("%s at %s", pba->pba_busname, pnp);
     84  1.23.2.2  nathanw 	printf(" bus %d", pba->pba_bus);
     85  1.23.2.2  nathanw 	return (UNCONF);
     86  1.23.2.2  nathanw }
     87  1.23.2.2  nathanw 
     88  1.23.2.2  nathanw static int
     89  1.23.2.2  nathanw dwlpxmatch(parent, cf, aux)
     90  1.23.2.2  nathanw 	struct device *parent;
     91  1.23.2.2  nathanw 	struct cfdata *cf;
     92  1.23.2.2  nathanw 	void *aux;
     93  1.23.2.2  nathanw {
     94  1.23.2.2  nathanw 	struct kft_dev_attach_args *ka = aux;
     95  1.23.2.2  nathanw 
     96  1.23.2.2  nathanw 	if (strcmp(ka->ka_name, dwlpx_cd.cd_name) != 0)
     97  1.23.2.2  nathanw 		return (0);
     98  1.23.2.2  nathanw 	return (1);
     99  1.23.2.2  nathanw }
    100  1.23.2.2  nathanw 
    101  1.23.2.2  nathanw static void
    102  1.23.2.2  nathanw dwlpxattach(parent, self, aux)
    103  1.23.2.2  nathanw 	struct device *parent;
    104  1.23.2.2  nathanw 	struct device *self;
    105  1.23.2.2  nathanw 	void *aux;
    106  1.23.2.2  nathanw {
    107  1.23.2.2  nathanw 	static int once = 0;
    108  1.23.2.2  nathanw 	struct dwlpx_softc *sc = (struct dwlpx_softc *)self;
    109  1.23.2.2  nathanw 	struct dwlpx_config *ccp = &sc->dwlpx_cc;
    110  1.23.2.2  nathanw 	struct kft_dev_attach_args *ka = aux;
    111  1.23.2.2  nathanw 	struct pcibus_attach_args pba;
    112  1.23.2.2  nathanw 	u_int32_t pcia_present;
    113  1.23.2.2  nathanw 
    114  1.23.2.2  nathanw 	sc->dwlpx_node = ka->ka_node;
    115  1.23.2.2  nathanw 	sc->dwlpx_dtype = ka->ka_dtype;
    116  1.23.2.2  nathanw 	sc->dwlpx_hosenum = ka->ka_hosenum;
    117  1.23.2.2  nathanw 
    118  1.23.2.2  nathanw 	dwlpx_init(sc);
    119  1.23.2.2  nathanw 	dwlpx_dma_init(ccp);
    120  1.23.2.2  nathanw 
    121  1.23.2.2  nathanw 	pcia_present = REGVAL(PCIA_PRESENT + ccp->cc_sysbase);
    122  1.23.2.2  nathanw 	printf(": PCIA rev. %d, STD I/O %spresent, %dK S/G entries\n",
    123  1.23.2.2  nathanw 	    (pcia_present >> PCIA_PRESENT_REVSHIFT) & PCIA_PRESENT_REVMASK,
    124  1.23.2.2  nathanw 	    (pcia_present & PCIA_PRESENT_STDIO) == 0 ? "not " : "",
    125  1.23.2.2  nathanw 	    sc->dwlpx_sgmapsz == DWLPX_SG128K ? 128 : 32);
    126  1.23.2.2  nathanw 
    127  1.23.2.2  nathanw #if 0
    128  1.23.2.2  nathanw 	{
    129  1.23.2.2  nathanw 		int hpc, slot, slotval;
    130  1.23.2.2  nathanw 		const char *str;
    131  1.23.2.2  nathanw 		for (hpc = 0; hpc < sc->dwlpx_nhpc; hpc++) {
    132  1.23.2.2  nathanw 			for (slot = 0; slot < 4; slot++) {
    133  1.23.2.2  nathanw 				slotval = (pcia_present >>
    134  1.23.2.2  nathanw 				    PCIA_PRESENT_SLOTSHIFT(hpc, slot)) &
    135  1.23.2.2  nathanw 				    PCIA_PRESENT_SLOT_MASK;
    136  1.23.2.2  nathanw 				if (slotval == PCIA_PRESENT_SLOT_NONE)
    137  1.23.2.2  nathanw 					continue;
    138  1.23.2.2  nathanw 				switch (slotval) {
    139  1.23.2.2  nathanw 				case PCIA_PRESENT_SLOT_25W:
    140  1.23.2.2  nathanw 					str = "25";
    141  1.23.2.2  nathanw 					break;
    142  1.23.2.2  nathanw 				case PCIA_PRESENT_SLOT_15W:
    143  1.23.2.2  nathanw 					str = "15";
    144  1.23.2.2  nathanw 					break;
    145  1.23.2.2  nathanw 				case PCIA_PRESENT_SLOW_7W:
    146  1.23.2.2  nathanw 				default:		/* XXX gcc */
    147  1.23.2.2  nathanw 					str = "7.5";
    148  1.23.2.2  nathanw 					break;
    149  1.23.2.2  nathanw 				}
    150  1.23.2.2  nathanw 				printf("%s: hpc %d slot %d: %s watt module\n",
    151  1.23.2.2  nathanw 				    sc->dwlpx_dev.dv_xname, hpc, slot, str);
    152  1.23.2.2  nathanw 			}
    153  1.23.2.2  nathanw 		}
    154  1.23.2.2  nathanw 	}
    155  1.23.2.2  nathanw #endif
    156  1.23.2.2  nathanw 
    157  1.23.2.2  nathanw 	if (once == 0) {
    158  1.23.2.2  nathanw 		/*
    159  1.23.2.2  nathanw 		 * Set up interrupts
    160  1.23.2.2  nathanw 		 */
    161  1.23.2.2  nathanw 		pci_kn8ae_pickintr(&sc->dwlpx_cc, 1);
    162  1.23.2.2  nathanw 		once++;
    163  1.23.2.2  nathanw 	} else {
    164  1.23.2.2  nathanw 		pci_kn8ae_pickintr(&sc->dwlpx_cc, 0);
    165  1.23.2.2  nathanw 	}
    166  1.23.2.2  nathanw 
    167  1.23.2.2  nathanw 	/*
    168  1.23.2.2  nathanw 	 * Attach PCI bus
    169  1.23.2.2  nathanw 	 */
    170  1.23.2.2  nathanw 	pba.pba_busname = "pci";
    171  1.23.2.2  nathanw 	pba.pba_iot = &sc->dwlpx_cc.cc_iot;
    172  1.23.2.2  nathanw 	pba.pba_memt = &sc->dwlpx_cc.cc_memt;
    173  1.23.2.2  nathanw 	pba.pba_dmat =	/* start with direct, may change... */
    174  1.23.2.2  nathanw 	    alphabus_dma_get_tag(&sc->dwlpx_cc.cc_dmat_direct, ALPHA_BUS_PCI);
    175  1.23.2.2  nathanw 	pba.pba_pc = &sc->dwlpx_cc.cc_pc;
    176  1.23.2.2  nathanw 	pba.pba_bus = 0;
    177  1.23.2.2  nathanw 	pba.pba_bridgetag = NULL;
    178  1.23.2.2  nathanw 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
    179  1.23.2.2  nathanw 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
    180  1.23.2.2  nathanw 	config_found(self, &pba, dwlpxprint);
    181  1.23.2.2  nathanw }
    182  1.23.2.2  nathanw 
    183  1.23.2.2  nathanw void
    184  1.23.2.2  nathanw dwlpx_init(sc)
    185  1.23.2.2  nathanw 	struct dwlpx_softc *sc;
    186  1.23.2.2  nathanw {
    187  1.23.2.2  nathanw 	u_int32_t ctl;
    188  1.23.2.2  nathanw 	struct dwlpx_config *ccp = &sc->dwlpx_cc;
    189  1.23.2.2  nathanw 	unsigned long vec, ls = DWLPX_SYSBASE(sc);
    190  1.23.2.2  nathanw 	int i;
    191  1.23.2.2  nathanw 
    192  1.23.2.2  nathanw 	if (ccp->cc_initted == 0) {
    193  1.23.2.2  nathanw 		/*
    194  1.23.2.2  nathanw 		 * On reads, you get a fault if you read a nonexisted HPC.
    195  1.23.2.2  nathanw 		 * We know the internal KFTIA hose (hose 0) has only 2 HPCs,
    196  1.23.2.2  nathanw 		 * but we can also actually probe for HPCs.
    197  1.23.2.2  nathanw 		 * Assume at least one.
    198  1.23.2.2  nathanw 		 */
    199  1.23.2.2  nathanw 		for (sc->dwlpx_nhpc = 1; sc->dwlpx_nhpc < NHPC;
    200  1.23.2.2  nathanw 		    sc->dwlpx_nhpc++) {
    201  1.23.2.2  nathanw 			if (badaddr(KV(PCIA_CTL(sc->dwlpx_nhpc) + ls),
    202  1.23.2.2  nathanw 			    sizeof (ctl)) != 0) {
    203  1.23.2.2  nathanw 				break;
    204  1.23.2.2  nathanw 			}
    205  1.23.2.2  nathanw 		}
    206  1.23.2.2  nathanw 		if (sc->dwlpx_nhpc != NHPC) {
    207  1.23.2.2  nathanw 			/* clear (potential) Illegal CSR Address Error */
    208  1.23.2.2  nathanw 			REGVAL(PCIA_ERR(0) + DWLPX_SYSBASE(sc)) =
    209  1.23.2.2  nathanw 				PCIA_ERR_ALLERR;
    210  1.23.2.2  nathanw 		}
    211  1.23.2.2  nathanw 
    212  1.23.2.2  nathanw 		dwlpx_bus_io_init(&ccp->cc_iot, ccp);
    213  1.23.2.2  nathanw 		dwlpx_bus_mem_init(&ccp->cc_memt, ccp);
    214  1.23.2.2  nathanw 	}
    215  1.23.2.2  nathanw 	dwlpx_pci_init(&ccp->cc_pc, ccp);
    216  1.23.2.2  nathanw 	ccp->cc_sc = sc;
    217  1.23.2.2  nathanw 
    218  1.23.2.2  nathanw 	/*
    219  1.23.2.2  nathanw 	 * Establish a precalculated base for convenience's sake.
    220  1.23.2.2  nathanw 	 */
    221  1.23.2.2  nathanw 	ccp->cc_sysbase = ls;
    222  1.23.2.2  nathanw 
    223  1.23.2.2  nathanw 	/*
    224  1.23.2.2  nathanw 	 * If there are only 2 HPCs, then the 'present' register is not
    225  1.23.2.2  nathanw 	 * implemented, so there will only ever be 32K SG entries. Otherwise
    226  1.23.2.2  nathanw 	 * any revision greater than zero will have 128K entries.
    227  1.23.2.2  nathanw 	 */
    228  1.23.2.2  nathanw 	ctl = REGVAL(PCIA_PRESENT + ccp->cc_sysbase);
    229  1.23.2.2  nathanw 	if (sc->dwlpx_nhpc == 2) {
    230  1.23.2.2  nathanw 		sc->dwlpx_sgmapsz = DWLPX_SG32K;
    231  1.23.2.2  nathanw #if 0
    232  1.23.2.2  nathanw 	/*
    233  1.23.2.2  nathanw 	 * As of 2/25/98- When I enable SG128K, and then have to flip
    234  1.23.2.2  nathanw 	 * TBIT below, I get bad SGRAM errors. We'll fix this later
    235  1.23.2.2  nathanw 	 * if this gets important.
    236  1.23.2.2  nathanw 	 */
    237  1.23.2.2  nathanw 	} else if ((ctl >> PCIA_PRESENT_REVSHIFT) & PCIA_PRESENT_REVMASK) {
    238  1.23.2.2  nathanw 		sc->dwlpx_sgmapsz = DWLPX_SG128K;
    239  1.23.2.2  nathanw #endif
    240  1.23.2.2  nathanw 	} else {
    241  1.23.2.2  nathanw 		sc->dwlpx_sgmapsz = DWLPX_SG32K;
    242  1.23.2.2  nathanw 	}
    243  1.23.2.2  nathanw 
    244  1.23.2.2  nathanw 	/*
    245  1.23.2.2  nathanw 	 * Set up interrupt stuff for this DWLPX.
    246  1.23.2.2  nathanw 	 *
    247  1.23.2.2  nathanw 	 * Note that all PCI interrupt pins are disabled at this time.
    248  1.23.2.2  nathanw 	 *
    249  1.23.2.2  nathanw 	 * Do this even for all HPCs- even for the nonexistent
    250  1.23.2.2  nathanw 	 * one on hose zero of a KFTIA.
    251  1.23.2.2  nathanw 	 */
    252  1.23.2.2  nathanw 	vec = scb_alloc(dwlpx_errintr, sc);
    253  1.23.2.2  nathanw 	if (vec == SCB_ALLOC_FAILED)
    254  1.23.2.2  nathanw 		panic("%s: unable to allocate error vector",
    255  1.23.2.2  nathanw 		    sc->dwlpx_dev.dv_xname);
    256  1.23.2.2  nathanw 	printf("%s: error interrupt at vector 0x%lx\n",
    257  1.23.2.2  nathanw 	    sc->dwlpx_dev.dv_xname, vec);
    258  1.23.2.2  nathanw 	for (i = 0; i < NHPC; i++) {
    259  1.23.2.2  nathanw 		REGVAL(PCIA_IMASK(i) + ccp->cc_sysbase) = DWLPX_IMASK_DFLT;
    260  1.23.2.2  nathanw 		REGVAL(PCIA_ERRVEC(i) + ccp->cc_sysbase) = vec;
    261  1.23.2.2  nathanw 	}
    262  1.23.2.2  nathanw 
    263  1.23.2.2  nathanw 	/*
    264  1.23.2.2  nathanw 	 * Establish HAE values, as well as make sure of sanity elsewhere.
    265  1.23.2.2  nathanw 	 */
    266  1.23.2.2  nathanw 	for (i = 0; i < sc->dwlpx_nhpc; i++) {
    267  1.23.2.2  nathanw 		ctl = REGVAL(PCIA_CTL(i) + ccp->cc_sysbase);
    268  1.23.2.2  nathanw 		ctl &= 0x0fffffff;
    269  1.23.2.2  nathanw 		ctl &= ~(PCIA_CTL_MHAE(0x1f) | PCIA_CTL_IHAE(0x1f));
    270  1.23.2.2  nathanw 		/*
    271  1.23.2.2  nathanw 		 * I originally also had it or'ing in 3, which makes no sense.
    272  1.23.2.2  nathanw 		 */
    273  1.23.2.2  nathanw 
    274  1.23.2.2  nathanw 		ctl |= PCIA_CTL_RMMENA | PCIA_CTL_RMMARB;
    275  1.23.2.2  nathanw 
    276  1.23.2.2  nathanw 		/*
    277  1.23.2.2  nathanw 		 * Only valid if we're attached to a KFTIA or a KTHA.
    278  1.23.2.2  nathanw 		 */
    279  1.23.2.2  nathanw 		ctl |= PCIA_CTL_3UP;
    280  1.23.2.2  nathanw 
    281  1.23.2.2  nathanw 		ctl |= PCIA_CTL_CUTENA;
    282  1.23.2.2  nathanw 
    283  1.23.2.2  nathanw 		/*
    284  1.23.2.2  nathanw 		 * Fit in appropriate S/G Map Ram size.
    285  1.23.2.2  nathanw 		 */
    286  1.23.2.2  nathanw 		if (sc->dwlpx_sgmapsz == DWLPX_SG32K)
    287  1.23.2.2  nathanw 			ctl |= PCIA_CTL_SG32K;
    288  1.23.2.2  nathanw 		else if (sc->dwlpx_sgmapsz == DWLPX_SG128K)
    289  1.23.2.2  nathanw 			ctl |= PCIA_CTL_SG128K;
    290  1.23.2.2  nathanw 		else
    291  1.23.2.2  nathanw 			ctl |= PCIA_CTL_SG32K;
    292  1.23.2.2  nathanw 
    293  1.23.2.2  nathanw 		REGVAL(PCIA_CTL(i) + ccp->cc_sysbase) = ctl;
    294  1.23.2.2  nathanw 	}
    295  1.23.2.2  nathanw 	/*
    296  1.23.2.2  nathanw 	 * Enable TBIT if required
    297  1.23.2.2  nathanw 	 */
    298  1.23.2.2  nathanw 	if (sc->dwlpx_sgmapsz == DWLPX_SG128K)
    299  1.23.2.2  nathanw 		REGVAL(PCIA_TBIT + ccp->cc_sysbase) = 1;
    300  1.23.2.2  nathanw 	alpha_mb();
    301  1.23.2.2  nathanw 	ccp->cc_initted = 1;
    302  1.23.2.2  nathanw }
    303  1.23.2.2  nathanw 
    304  1.23.2.2  nathanw void
    305  1.23.2.2  nathanw dwlpx_errintr(arg, vec)
    306  1.23.2.2  nathanw 	void *arg;
    307  1.23.2.2  nathanw 	unsigned long vec;
    308  1.23.2.2  nathanw {
    309  1.23.2.2  nathanw 	struct dwlpx_softc *sc = arg;
    310  1.23.2.2  nathanw 	struct dwlpx_config *ccp = &sc->dwlpx_cc;
    311  1.23.2.2  nathanw 	int i;
    312  1.23.2.2  nathanw 	struct {
    313  1.23.2.2  nathanw 		u_int32_t err;
    314  1.23.2.2  nathanw 		u_int32_t addr;
    315  1.23.2.2  nathanw 	} hpcs[NHPC];
    316  1.23.2.2  nathanw 
    317  1.23.2.2  nathanw 	for (i = 0; i < sc->dwlpx_nhpc; i++) {
    318  1.23.2.2  nathanw 		hpcs[i].err = REGVAL(PCIA_ERR(i) + ccp->cc_sysbase);
    319  1.23.2.2  nathanw 		hpcs[i].addr = REGVAL(PCIA_FADR(i) + ccp->cc_sysbase);
    320  1.23.2.2  nathanw 	}
    321  1.23.2.2  nathanw 	printf("%s: node %d hose %d error interrupt\n",
    322  1.23.2.2  nathanw 	    sc->dwlpx_dev.dv_xname, sc->dwlpx_node, sc->dwlpx_hosenum);
    323  1.23.2.2  nathanw 
    324  1.23.2.2  nathanw 	for (i = 0; i < sc->dwlpx_nhpc; i++) {
    325  1.23.2.2  nathanw 		if ((hpcs[i].err & PCIA_ERR_ERROR) == 0)
    326  1.23.2.2  nathanw 			continue;
    327  1.23.2.2  nathanw 		printf("\tHPC %d: ERR=0x%08x; DMA %s Memory, "
    328  1.23.2.2  nathanw 			"Failing Address 0x%x\n",
    329  1.23.2.2  nathanw 			i, hpcs[i].err, hpcs[i].addr & 0x1? "write to" :
    330  1.23.2.2  nathanw 			"read from", hpcs[i].addr & ~3);
    331  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_SERR_L)
    332  1.23.2.2  nathanw 			printf("\t       PCI device asserted SERR_L\n");
    333  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_ILAT)
    334  1.23.2.2  nathanw 			printf("\t       Incremental Latency Exceeded\n");
    335  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_SGPRTY)
    336  1.23.2.2  nathanw 			printf("\t       CPU access of SG RAM Parity Error\n");
    337  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_ILLCSR)
    338  1.23.2.2  nathanw 			printf("\t       Illegal CSR Address Error\n");
    339  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_PCINXM)
    340  1.23.2.2  nathanw 			printf("\t       Nonexistent PCI Address Error\n");
    341  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_DSCERR)
    342  1.23.2.2  nathanw 			printf("\t       PCI Target Disconnect Error\n");
    343  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_ABRT)
    344  1.23.2.2  nathanw 			printf("\t       PCI Target Abort Error\n");
    345  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_WPRTY)
    346  1.23.2.2  nathanw 			printf("\t       PCI Write Parity Error\n");
    347  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_DPERR)
    348  1.23.2.2  nathanw 			printf("\t       PCI Data Parity Error\n");
    349  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_APERR)
    350  1.23.2.2  nathanw 			printf("\t       PCI Address Parity Error\n");
    351  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_DFLT)
    352  1.23.2.2  nathanw 			printf("\t       SG Map RAM Invalid Entry Error\n");
    353  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_DPRTY)
    354  1.23.2.2  nathanw 			printf("\t       DMA access of SG RAM Parity Error\n");
    355  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_DRPERR)
    356  1.23.2.2  nathanw 			printf("\t       DMA Read Return Parity Error\n");
    357  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_MABRT)
    358  1.23.2.2  nathanw 			printf("\t       PCI Master Abort Error\n");
    359  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_CPRTY)
    360  1.23.2.2  nathanw 			printf("\t       CSR Parity Error\n");
    361  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_COVR)
    362  1.23.2.2  nathanw 			printf("\t       CSR Overrun Error\n");
    363  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_MBPERR)
    364  1.23.2.2  nathanw 			printf("\t       Mailbox Parity Error\n");
    365  1.23.2.2  nathanw 		if (hpcs[i].err & PCIA_ERR_MBILI)
    366  1.23.2.2  nathanw 			printf("\t       Mailbox Illegal Length Error\n");
    367  1.23.2.2  nathanw 		REGVAL(PCIA_ERR(i) + ccp->cc_sysbase) = hpcs[i].err;
    368  1.23.2.2  nathanw 	}
    369  1.23.2.2  nathanw }
    370