Home | History | Annotate | Line # | Download | only in pci
cia.c revision 1.70.2.1
      1  1.70.2.1    jruoho /* $NetBSD: cia.c,v 1.70.2.1 2011/06/06 09:04:44 jruoho Exp $ */
      2      1.42   thorpej 
      3      1.42   thorpej /*-
      4      1.53   thorpej  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
      5      1.42   thorpej  * All rights reserved.
      6      1.42   thorpej  *
      7      1.42   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8      1.42   thorpej  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9      1.42   thorpej  * NASA Ames Research Center.
     10      1.42   thorpej  *
     11      1.42   thorpej  * Redistribution and use in source and binary forms, with or without
     12      1.42   thorpej  * modification, are permitted provided that the following conditions
     13      1.42   thorpej  * are met:
     14      1.42   thorpej  * 1. Redistributions of source code must retain the above copyright
     15      1.42   thorpej  *    notice, this list of conditions and the following disclaimer.
     16      1.42   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17      1.42   thorpej  *    notice, this list of conditions and the following disclaimer in the
     18      1.42   thorpej  *    documentation and/or other materials provided with the distribution.
     19      1.42   thorpej  *
     20      1.42   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21      1.42   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22      1.42   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23      1.42   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24      1.42   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25      1.42   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26      1.42   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27      1.42   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28      1.42   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29      1.42   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30      1.42   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     31      1.42   thorpej  */
     32       1.1       cgd 
     33       1.1       cgd /*
     34       1.4       cgd  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
     35       1.1       cgd  * All rights reserved.
     36       1.1       cgd  *
     37       1.1       cgd  * Author: Chris G. Demetriou
     38       1.1       cgd  *
     39       1.1       cgd  * Permission to use, copy, modify and distribute this software and
     40       1.1       cgd  * its documentation is hereby granted, provided that both the copyright
     41       1.1       cgd  * notice and this permission notice appear in all copies of the
     42       1.1       cgd  * software, derivative works or modified versions, and any portions
     43       1.1       cgd  * thereof, and that both notices appear in supporting documentation.
     44       1.1       cgd  *
     45       1.1       cgd  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     46       1.1       cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     47       1.1       cgd  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     48       1.1       cgd  *
     49       1.1       cgd  * Carnegie Mellon requests users of this software to return to
     50       1.1       cgd  *
     51       1.1       cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     52       1.1       cgd  *  School of Computer Science
     53       1.1       cgd  *  Carnegie Mellon University
     54       1.1       cgd  *  Pittsburgh PA 15213-3890
     55       1.1       cgd  *
     56       1.1       cgd  * any improvements or extensions that they make and grant Carnegie the
     57       1.1       cgd  * rights to redistribute these changes.
     58       1.1       cgd  */
     59      1.18       cgd 
     60      1.25   thorpej #include "opt_dec_eb164.h"
     61      1.25   thorpej #include "opt_dec_kn20aa.h"
     62      1.39   thorpej #include "opt_dec_550.h"
     63      1.44      ross #include "opt_dec_1000a.h"
     64      1.45      ross #include "opt_dec_1000.h"
     65      1.25   thorpej 
     66      1.19       cgd #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
     67      1.19       cgd 
     68  1.70.2.1    jruoho __KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.70.2.1 2011/06/06 09:04:44 jruoho Exp $");
     69       1.1       cgd 
     70       1.1       cgd #include <sys/param.h>
     71       1.1       cgd #include <sys/systm.h>
     72       1.1       cgd #include <sys/kernel.h>
     73       1.1       cgd #include <sys/malloc.h>
     74       1.1       cgd #include <sys/device.h>
     75      1.56       mrg 
     76       1.1       cgd #include <machine/autoconf.h>
     77       1.1       cgd #include <machine/rpb.h>
     78      1.53   thorpej #include <machine/sysarch.h>
     79      1.57      ross #include <machine/alpha.h>
     80       1.1       cgd 
     81       1.1       cgd #include <dev/isa/isareg.h>
     82       1.1       cgd #include <dev/isa/isavar.h>
     83       1.1       cgd 
     84       1.1       cgd #include <dev/pci/pcireg.h>
     85       1.1       cgd #include <dev/pci/pcivar.h>
     86       1.1       cgd #include <alpha/pci/ciareg.h>
     87       1.1       cgd #include <alpha/pci/ciavar.h>
     88      1.45      ross 
     89      1.17       cgd #ifdef DEC_KN20AA
     90       1.1       cgd #include <alpha/pci/pci_kn20aa.h>
     91       1.1       cgd #endif
     92      1.17       cgd #ifdef DEC_EB164
     93      1.13       cgd #include <alpha/pci/pci_eb164.h>
     94      1.13       cgd #endif
     95      1.39   thorpej #ifdef DEC_550
     96      1.39   thorpej #include <alpha/pci/pci_550.h>
     97      1.39   thorpej #endif
     98      1.44      ross #ifdef DEC_1000A
     99      1.44      ross #include <alpha/pci/pci_1000a.h>
    100      1.44      ross #endif
    101      1.45      ross #ifdef DEC_1000
    102      1.45      ross #include <alpha/pci/pci_1000.h>
    103      1.45      ross #endif
    104       1.1       cgd 
    105      1.67       dsl int	ciamatch(struct device *, struct cfdata *, void *);
    106      1.67       dsl void	ciaattach(struct device *, struct device *, void *);
    107       1.1       cgd 
    108      1.60   thorpej CFATTACH_DECL(cia, sizeof(struct cia_softc),
    109      1.60   thorpej     ciamatch, ciaattach, NULL, NULL);
    110       1.5       cgd 
    111      1.29   thorpej extern struct cfdriver cia_cd;
    112       1.1       cgd 
    113      1.67       dsl int	cia_bus_get_window(int, int,
    114      1.67       dsl 	    struct alpha_bus_space_translation *);
    115      1.53   thorpej 
    116       1.1       cgd /* There can be only one. */
    117       1.1       cgd int ciafound;
    118       1.1       cgd struct cia_config cia_configuration;
    119       1.1       cgd 
    120      1.37   thorpej /*
    121      1.37   thorpej  * This determines if we attempt to use BWX for PCI bus and config space
    122      1.37   thorpej  * access.  Some systems, notably with Pyxis, don't fare so well unless
    123      1.37   thorpej  * BWX is used.
    124      1.46   thorpej  *
    125      1.46   thorpej  * EXCEPT!  Some devices have a really hard time if BWX is used (WHY?!).
    126      1.46   thorpej  * So, we decouple the uses for PCI config space and PCI bus space.
    127      1.50   thorpej  *
    128      1.50   thorpej  * FURTHERMORE!  The Pyxis, most notably earlier revs, really don't
    129      1.50   thorpej  * do so well if you don't use BWX for bus access.  So we default to
    130      1.50   thorpej  * forcing BWX on those chips.
    131      1.50   thorpej  *
    132      1.50   thorpej  * Geez.
    133      1.37   thorpej  */
    134      1.46   thorpej 
    135      1.46   thorpej #ifndef CIA_PCI_USE_BWX
    136      1.46   thorpej #define	CIA_PCI_USE_BWX	1
    137      1.46   thorpej #endif
    138      1.46   thorpej 
    139      1.46   thorpej #ifndef	CIA_BUS_USE_BWX
    140      1.46   thorpej #define	CIA_BUS_USE_BWX	0
    141      1.37   thorpej #endif
    142      1.37   thorpej 
    143      1.50   thorpej #ifndef CIA_PYXIS_FORCE_BWX
    144      1.52   thorpej #define	CIA_PYXIS_FORCE_BWX 0
    145      1.50   thorpej #endif
    146      1.50   thorpej 
    147      1.46   thorpej int	cia_pci_use_bwx = CIA_PCI_USE_BWX;
    148      1.46   thorpej int	cia_bus_use_bwx = CIA_BUS_USE_BWX;
    149      1.50   thorpej int	cia_pyxis_force_bwx = CIA_PYXIS_FORCE_BWX;
    150      1.37   thorpej 
    151       1.1       cgd int
    152      1.68       dsl ciamatch(struct device *parent, struct cfdata *match, void *aux)
    153       1.1       cgd {
    154      1.35   thorpej 	struct mainbus_attach_args *ma = aux;
    155       1.1       cgd 
    156       1.1       cgd 	/* Make sure that we're looking for a CIA. */
    157      1.35   thorpej 	if (strcmp(ma->ma_name, cia_cd.cd_name) != 0)
    158       1.1       cgd 		return (0);
    159       1.1       cgd 
    160       1.1       cgd 	if (ciafound)
    161       1.1       cgd 		return (0);
    162       1.1       cgd 
    163       1.1       cgd 	return (1);
    164       1.1       cgd }
    165       1.1       cgd 
    166       1.1       cgd /*
    167       1.1       cgd  * Set up the chipset's function pointers.
    168       1.1       cgd  */
    169       1.1       cgd void
    170      1.68       dsl cia_init(struct cia_config *ccp, int mallocsafe)
    171       1.1       cgd {
    172      1.50   thorpej 	int pci_use_bwx = cia_pci_use_bwx;
    173      1.50   thorpej 	int bus_use_bwx = cia_bus_use_bwx;
    174       1.1       cgd 
    175       1.6       cgd 	ccp->cc_hae_mem = REGVAL(CIA_CSR_HAE_MEM);
    176       1.6       cgd 	ccp->cc_hae_io = REGVAL(CIA_CSR_HAE_IO);
    177      1.36   thorpej 	ccp->cc_rev = REGVAL(CIA_CSR_REV) & REV_MASK;
    178      1.36   thorpej 
    179      1.36   thorpej 	/*
    180      1.36   thorpej 	 * Determine if we have a Pyxis.  Only two systypes can
    181      1.36   thorpej 	 * have this: the EB164 systype (AlphaPC164LX and AlphaPC164SX)
    182      1.36   thorpej 	 * and the DEC_550 systype (Miata).
    183      1.36   thorpej 	 */
    184      1.47       cgd 	if ((cputype == ST_EB164 &&
    185      1.36   thorpej 	     (hwrpb->rpb_variation & SV_ST_MASK) >= SV_ST_ALPHAPC164LX_400) ||
    186      1.50   thorpej 	    cputype == ST_DEC_550) {
    187      1.36   thorpej 		ccp->cc_flags |= CCF_ISPYXIS;
    188      1.50   thorpej 		if (cia_pyxis_force_bwx)
    189      1.50   thorpej 			pci_use_bwx = bus_use_bwx = 1;
    190      1.50   thorpej 	}
    191      1.27   thorpej 
    192      1.27   thorpej 	/*
    193      1.40   thorpej 	 * ALCOR/ALCOR2 Revisions >= 2 and Pyxis have the CNFG register.
    194      1.27   thorpej 	 */
    195      1.40   thorpej 	if (ccp->cc_rev >= 2 || (ccp->cc_flags & CCF_ISPYXIS) != 0)
    196      1.27   thorpej 		ccp->cc_cnfg = REGVAL(CIA_CSR_CNFG);
    197      1.27   thorpej 	else
    198      1.27   thorpej 		ccp->cc_cnfg = 0;
    199      1.12       cgd 
    200      1.37   thorpej 	/*
    201      1.37   thorpej 	 * Use BWX iff:
    202      1.37   thorpej 	 *
    203      1.37   thorpej 	 *	- It hasn't been disbled by the user,
    204      1.37   thorpej 	 *	- it's enabled in CNFG,
    205      1.37   thorpej 	 *	- we're implementation version ev5,
    206      1.57      ross 	 *	- BWX is enabled in the CPU's capabilities mask
    207      1.37   thorpej 	 */
    208      1.50   thorpej 	if ((pci_use_bwx || bus_use_bwx) &&
    209      1.37   thorpej 	    (ccp->cc_cnfg & CNFG_BWEN) != 0 &&
    210      1.55   thorpej 	    (cpu_amask & ALPHA_AMASK_BWX) != 0) {
    211      1.38   thorpej 		u_int32_t ctrl;
    212      1.38   thorpej 
    213      1.50   thorpej 		if (pci_use_bwx)
    214      1.46   thorpej 			ccp->cc_flags |= CCF_PCI_USE_BWX;
    215      1.50   thorpej 		if (bus_use_bwx)
    216      1.46   thorpej 			ccp->cc_flags |= CCF_BUS_USE_BWX;
    217      1.38   thorpej 
    218      1.38   thorpej 		/*
    219      1.38   thorpej 		 * For whatever reason, the firmware seems to enable PCI
    220      1.38   thorpej 		 * loopback mode if it also enables BWX.  Make sure it's
    221      1.38   thorpej 		 * enabled if we have an old, buggy firmware rev.
    222      1.38   thorpej 		 */
    223      1.38   thorpej 		alpha_mb();
    224      1.38   thorpej 		ctrl = REGVAL(CIA_CSR_CTRL);
    225      1.38   thorpej 		if ((ctrl & CTRL_PCI_LOOP_EN) == 0) {
    226      1.38   thorpej 			REGVAL(CIA_CSR_CTRL) = ctrl | CTRL_PCI_LOOP_EN;
    227      1.38   thorpej 			alpha_mb();
    228      1.38   thorpej 		}
    229      1.38   thorpej 	}
    230      1.37   thorpej 
    231      1.14       cgd 	if (!ccp->cc_initted) {
    232      1.14       cgd 		/* don't do these twice since they set up extents */
    233      1.46   thorpej 		if (ccp->cc_flags & CCF_BUS_USE_BWX) {
    234      1.37   thorpej 			cia_bwx_bus_io_init(&ccp->cc_iot, ccp);
    235      1.37   thorpej 			cia_bwx_bus_mem_init(&ccp->cc_memt, ccp);
    236      1.53   thorpej 
    237      1.53   thorpej 			/*
    238      1.53   thorpej 			 * We have one window for both PCI I/O and MEM
    239      1.53   thorpej 			 * in BWX mode.
    240      1.53   thorpej 			 */
    241      1.53   thorpej 			alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_IO] = 1;
    242      1.53   thorpej 			alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_MEM] = 1;
    243      1.37   thorpej 		} else {
    244      1.37   thorpej 			cia_swiz_bus_io_init(&ccp->cc_iot, ccp);
    245      1.37   thorpej 			cia_swiz_bus_mem_init(&ccp->cc_memt, ccp);
    246      1.53   thorpej 
    247      1.53   thorpej 			/*
    248      1.53   thorpej 			 * We have two I/O windows and 4 MEM windows in
    249      1.53   thorpej 			 * SWIZ mode.
    250      1.53   thorpej 			 */
    251      1.53   thorpej 			alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_IO] = 2;
    252      1.53   thorpej 			alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_MEM] = 4;
    253      1.37   thorpej 		}
    254      1.53   thorpej 		alpha_bus_get_window = cia_bus_get_window;
    255      1.14       cgd 	}
    256      1.14       cgd 	ccp->cc_mallocsafe = mallocsafe;
    257      1.14       cgd 
    258      1.14       cgd 	cia_pci_init(&ccp->cc_pc, ccp);
    259      1.53   thorpej 	alpha_pci_chipset = &ccp->cc_pc;
    260      1.14       cgd 
    261      1.14       cgd 	ccp->cc_initted = 1;
    262       1.1       cgd }
    263       1.1       cgd 
    264       1.1       cgd void
    265      1.69       dsl ciaattach(struct device *parent, struct device *self, void *aux)
    266       1.1       cgd {
    267       1.1       cgd 	struct cia_softc *sc = (struct cia_softc *)self;
    268       1.1       cgd 	struct cia_config *ccp;
    269       1.5       cgd 	struct pcibus_attach_args pba;
    270      1.28   thorpej 	char bits[64];
    271      1.43   thorpej 	const char *name;
    272      1.43   thorpej 	int pass;
    273       1.1       cgd 
    274       1.1       cgd 	/* note that we've attached the chipset; can't have 2 CIAs. */
    275       1.1       cgd 	ciafound = 1;
    276       1.1       cgd 
    277       1.1       cgd 	/*
    278       1.1       cgd 	 * set up the chipset's info; done once at console init time
    279      1.21   thorpej 	 * (maybe), but we must do it here as well to take care of things
    280      1.21   thorpej 	 * that need to use memory allocation.
    281       1.1       cgd 	 */
    282       1.1       cgd 	ccp = sc->sc_ccp = &cia_configuration;
    283      1.14       cgd 	cia_init(ccp, 1);
    284       1.1       cgd 
    285      1.43   thorpej 	if (ccp->cc_flags & CCF_ISPYXIS) {
    286      1.43   thorpej 		name = "Pyxis";
    287      1.43   thorpej 		pass = ccp->cc_rev;
    288      1.43   thorpej 	} else {
    289      1.43   thorpej 		name = "ALCOR/ALCOR2";
    290      1.43   thorpej 		pass = ccp->cc_rev + 1;
    291      1.43   thorpej 	}
    292      1.43   thorpej 
    293      1.36   thorpej 	printf(": DECchip 2117x Core Logic Chipset (%s), pass %d\n",
    294      1.43   thorpej 	    name, pass);
    295      1.66  christos 	if (ccp->cc_cnfg) {
    296      1.66  christos 		snprintb(bits, sizeof(bits), CIA_CSR_CNFG_BITS, ccp->cc_cnfg);
    297      1.66  christos 		printf("%s: extended capabilities: %s\n", self->dv_xname, bits);
    298      1.66  christos 	}
    299      1.46   thorpej 
    300      1.46   thorpej 	switch (ccp->cc_flags & (CCF_PCI_USE_BWX|CCF_BUS_USE_BWX)) {
    301      1.46   thorpej 	case CCF_PCI_USE_BWX|CCF_BUS_USE_BWX:
    302      1.46   thorpej 		name = "PCI config and bus";
    303      1.46   thorpej 		break;
    304      1.46   thorpej 	case CCF_PCI_USE_BWX:
    305      1.46   thorpej 		name = "PCI config";
    306      1.46   thorpej 		break;
    307      1.46   thorpej 	case CCF_BUS_USE_BWX:
    308      1.46   thorpej 		name = "bus";
    309      1.46   thorpej 		break;
    310      1.46   thorpej 	default:
    311      1.46   thorpej 		name = NULL;
    312      1.46   thorpej 		break;
    313      1.46   thorpej 	}
    314      1.46   thorpej 	if (name != NULL)
    315      1.46   thorpej 		printf("%s: using BWX for %s access\n", self->dv_xname, name);
    316      1.41   thorpej 
    317      1.42   thorpej #ifdef DEC_550
    318      1.47       cgd 	if (cputype == ST_DEC_550 &&
    319      1.42   thorpej 	    (hwrpb->rpb_variation & SV_ST_MASK) < SV_ST_MIATA_1_5) {
    320      1.41   thorpej 		/*
    321      1.42   thorpej 		 * Miata 1 systems have a bug: DMA cannot cross
    322      1.41   thorpej 		 * an 8k boundary!  Make sure PCI read prefetching
    323      1.41   thorpej 		 * is disabled on these chips.  Note that secondary
    324      1.41   thorpej 		 * PCI busses don't have this problem, because of
    325      1.41   thorpej 		 * the way PPBs handle PCI read requests.
    326      1.41   thorpej 		 *
    327      1.42   thorpej 		 * In the 21174 Technical Reference Manual, this is
    328      1.42   thorpej 		 * actually documented as "Pyxis Pass 1", but apparently
    329      1.42   thorpej 		 * there are chips that report themselves as "Pass 1"
    330      1.42   thorpej 		 * which do not have the bug!  Miatas with the Cypress
    331      1.42   thorpej 		 * PCI-ISA bridge (i.e. Miata 1.5 and Miata 2) do not
    332      1.42   thorpej 		 * have the bug, so we use this check.
    333      1.42   thorpej 		 *
    334      1.51   thorpej 		 * NOTE: This bug is actually worked around in cia_dma.c,
    335      1.51   thorpej 		 * when direct-mapped DMA maps are created.
    336      1.51   thorpej 		 *
    337      1.51   thorpej 		 * XXX WE NEED TO THINK ABOUT HOW TO HANDLE THIS FOR
    338      1.51   thorpej 		 * XXX SGMAP DMA MAPPINGS!
    339      1.41   thorpej 		 */
    340      1.41   thorpej 		u_int32_t ctrl;
    341      1.41   thorpej 
    342      1.41   thorpej 		/* XXX no bets... */
    343      1.41   thorpej 		printf("%s: WARNING: Pyxis pass 1 DMA bug; no bets...\n",
    344      1.41   thorpej 		    self->dv_xname);
    345      1.41   thorpej 
    346      1.49   thorpej 		ccp->cc_flags |= CCF_PYXISBUG;
    347      1.49   thorpej 
    348      1.41   thorpej 		alpha_mb();
    349      1.41   thorpej 		ctrl = REGVAL(CIA_CSR_CTRL);
    350      1.41   thorpej 		ctrl &= ~(CTRL_RD_TYPE|CTRL_RL_TYPE|CTRL_RM_TYPE);
    351      1.41   thorpej 		REGVAL(CIA_CSR_CTRL) = ctrl;
    352      1.41   thorpej 		alpha_mb();
    353      1.41   thorpej 	}
    354      1.42   thorpej #endif /* DEC_550 */
    355      1.43   thorpej 
    356      1.43   thorpej 	cia_dma_init(ccp);
    357       1.1       cgd 
    358      1.47       cgd 	switch (cputype) {
    359      1.17       cgd #ifdef DEC_KN20AA
    360       1.1       cgd 	case ST_DEC_KN20AA:
    361       1.5       cgd 		pci_kn20aa_pickintr(ccp);
    362       1.1       cgd 		break;
    363       1.1       cgd #endif
    364      1.13       cgd 
    365      1.17       cgd #ifdef DEC_EB164
    366      1.13       cgd 	case ST_EB164:
    367      1.13       cgd 		pci_eb164_pickintr(ccp);
    368      1.39   thorpej 		break;
    369      1.39   thorpej #endif
    370      1.39   thorpej 
    371      1.39   thorpej #ifdef DEC_550
    372      1.39   thorpej 	case ST_DEC_550:
    373      1.39   thorpej 		pci_550_pickintr(ccp);
    374      1.44      ross 		break;
    375      1.44      ross #endif
    376      1.44      ross 
    377      1.44      ross #ifdef DEC_1000A
    378      1.44      ross 	case ST_DEC_1000A:
    379      1.44      ross 		pci_1000a_pickintr(ccp, &ccp->cc_iot, &ccp->cc_memt,
    380      1.44      ross 			&ccp->cc_pc);
    381      1.45      ross 		break;
    382      1.13       cgd #endif
    383      1.45      ross 
    384      1.45      ross #ifdef DEC_1000
    385      1.45      ross 	case ST_DEC_1000:
    386      1.45      ross 		pci_1000_pickintr(ccp, &ccp->cc_iot, &ccp->cc_memt,
    387      1.45      ross 			&ccp->cc_pc);
    388      1.13       cgd 		break;
    389      1.13       cgd #endif
    390      1.13       cgd 
    391       1.1       cgd 	default:
    392       1.1       cgd 		panic("ciaattach: shouldn't be here, really...");
    393       1.1       cgd 	}
    394       1.1       cgd 
    395      1.23   thorpej 	pba.pba_iot = &ccp->cc_iot;
    396      1.23   thorpej 	pba.pba_memt = &ccp->cc_memt;
    397      1.30   thorpej 	pba.pba_dmat =
    398      1.30   thorpej 	    alphabus_dma_get_tag(&ccp->cc_dmat_direct, ALPHA_BUS_PCI);
    399      1.62      fvdl 	pba.pba_dmat64 = NULL;
    400       1.5       cgd 	pba.pba_pc = &ccp->cc_pc;
    401       1.5       cgd 	pba.pba_bus = 0;
    402      1.58   thorpej 	pba.pba_bridgetag = NULL;
    403  1.70.2.1    jruoho 	pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY;
    404      1.49   thorpej 	if ((ccp->cc_flags & CCF_PYXISBUG) == 0)
    405      1.49   thorpej 		pba.pba_flags |= PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY |
    406      1.49   thorpej 		    PCI_FLAGS_MWI_OKAY;
    407      1.63  drochner 	config_found_ia(self, "pcibus", &pba, pcibusprint);
    408      1.53   thorpej }
    409      1.53   thorpej 
    410      1.53   thorpej int
    411      1.69       dsl cia_bus_get_window(int type, int window, struct alpha_bus_space_translation *abst)
    412      1.53   thorpej {
    413      1.53   thorpej 	struct cia_config *ccp = &cia_configuration;
    414      1.53   thorpej 	bus_space_tag_t st;
    415      1.53   thorpej 
    416      1.53   thorpej 	switch (type) {
    417      1.53   thorpej 	case ALPHA_BUS_TYPE_PCI_IO:
    418      1.53   thorpej 		st = &ccp->cc_iot;
    419      1.53   thorpej 		break;
    420      1.53   thorpej 
    421      1.53   thorpej 	case ALPHA_BUS_TYPE_PCI_MEM:
    422      1.53   thorpej 		st = &ccp->cc_memt;
    423      1.53   thorpej 		break;
    424      1.53   thorpej 
    425      1.53   thorpej 	default:
    426      1.53   thorpej 		panic("cia_bus_get_window");
    427      1.53   thorpej 	}
    428      1.53   thorpej 
    429      1.53   thorpej 	return (alpha_bus_space_get_window(st, window, abst));
    430      1.54   thorpej }
    431      1.54   thorpej 
    432      1.54   thorpej void
    433      1.69       dsl cia_pyxis_intr_enable(int irq, int onoff)
    434      1.54   thorpej {
    435      1.54   thorpej 	u_int64_t imask;
    436      1.54   thorpej 	int s;
    437      1.54   thorpej 
    438      1.54   thorpej #if 0
    439      1.54   thorpej 	printf("cia_pyxis_intr_enable: %s %d\n",
    440      1.54   thorpej 	    onoff ? "enabling" : "disabling", irq);
    441      1.54   thorpej #endif
    442      1.54   thorpej 
    443      1.54   thorpej 	s = splhigh();
    444      1.54   thorpej 	alpha_mb();
    445      1.54   thorpej 	imask = REGVAL64(PYXIS_INT_MASK);
    446      1.54   thorpej 	if (onoff)
    447      1.54   thorpej 		imask |= (1UL << irq);
    448      1.54   thorpej 	else
    449      1.54   thorpej 		imask &= ~(1UL << irq);
    450      1.54   thorpej 	REGVAL64(PYXIS_INT_MASK) = imask;
    451      1.54   thorpej 	alpha_mb();
    452      1.54   thorpej 	splx(s);
    453       1.1       cgd }
    454