Home | History | Annotate | Line # | Download | only in pci
mpt_pci.c revision 1.8.10.1
      1  1.8.10.1     yamt /*	$NetBSD: mpt_pci.c,v 1.8.10.1 2006/10/22 06:06:18 yamt Exp $	*/
      2       1.1  thorpej 
      3       1.1  thorpej /*
      4       1.1  thorpej  * Copyright (c) 2003 Wasabi Systems, Inc.
      5       1.1  thorpej  * All rights reserved.
      6       1.1  thorpej  *
      7       1.1  thorpej  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
      8       1.1  thorpej  *
      9       1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     10       1.1  thorpej  * modification, are permitted provided that the following conditions
     11       1.1  thorpej  * are met:
     12       1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     13       1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     14       1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     15       1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     16       1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     17       1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     18       1.1  thorpej  *    must display the following acknowledgement:
     19       1.1  thorpej  *	This product includes software developed for the NetBSD Project by
     20       1.1  thorpej  *	Wasabi Systems, Inc.
     21       1.1  thorpej  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22       1.1  thorpej  *    or promote products derived from this software without specific prior
     23       1.1  thorpej  *    written permission.
     24       1.1  thorpej  *
     25       1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26       1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27       1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28       1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29       1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30       1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31       1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32       1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33       1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34       1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35       1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     36       1.1  thorpej  */
     37       1.1  thorpej 
     38       1.5    perry /*
     39       1.1  thorpej  * mpt_pci.c:
     40       1.1  thorpej  *
     41       1.1  thorpej  * NetBSD PCI-specific routines for LSI Fusion adapters.
     42       1.5    perry  */
     43       1.2    lukem 
     44       1.2    lukem #include <sys/cdefs.h>
     45  1.8.10.1     yamt __KERNEL_RCSID(0, "$NetBSD: mpt_pci.c,v 1.8.10.1 2006/10/22 06:06:18 yamt Exp $");
     46       1.1  thorpej 
     47       1.1  thorpej #include <dev/ic/mpt.h>			/* pulls in all headers */
     48       1.1  thorpej 
     49       1.1  thorpej #include <dev/pci/pcireg.h>
     50       1.1  thorpej #include <dev/pci/pcivar.h>
     51       1.1  thorpej #include <dev/pci/pcidevs.h>
     52       1.1  thorpej 
     53       1.1  thorpej #define	MPT_PCI_MMBA		(PCI_MAPREG_START+0x04)
     54       1.1  thorpej 
     55       1.1  thorpej struct mpt_pci_softc {
     56       1.1  thorpej 	mpt_softc_t sc_mpt;
     57       1.1  thorpej 
     58       1.1  thorpej 	pci_chipset_tag_t sc_pc;
     59       1.1  thorpej 	pcitag_t sc_tag;
     60       1.1  thorpej 
     61       1.1  thorpej 	void *sc_ih;
     62       1.1  thorpej 
     63       1.1  thorpej 	/* Saved volatile PCI configuration registers. */
     64       1.1  thorpej 	pcireg_t sc_pci_csr;
     65       1.1  thorpej 	pcireg_t sc_pci_bhlc;
     66       1.1  thorpej 	pcireg_t sc_pci_io_bar;
     67       1.1  thorpej 	pcireg_t sc_pci_mem0_bar[2];
     68       1.1  thorpej 	pcireg_t sc_pci_mem1_bar[2];
     69       1.1  thorpej 	pcireg_t sc_pci_rom_bar;
     70       1.1  thorpej 	pcireg_t sc_pci_int;
     71       1.1  thorpej 	pcireg_t sc_pci_pmcsr;
     72       1.1  thorpej };
     73       1.1  thorpej 
     74       1.1  thorpej static void	mpt_pci_link_peer(mpt_softc_t *);
     75       1.1  thorpej static void	mpt_pci_read_config_regs(mpt_softc_t *);
     76       1.1  thorpej static void	mpt_pci_set_config_regs(mpt_softc_t *);
     77       1.1  thorpej 
     78       1.1  thorpej #define	MPP_F_FC	0x01	/* Fibre Channel adapter */
     79       1.1  thorpej #define	MPP_F_DUAL	0x02	/* Dual port adapter */
     80       1.1  thorpej 
     81       1.1  thorpej static const struct mpt_pci_product {
     82       1.1  thorpej 	pci_vendor_id_t		mpp_vendor;
     83       1.1  thorpej 	pci_product_id_t	mpp_product;
     84       1.1  thorpej 	int			mpp_flags;
     85       1.1  thorpej 	const char		*mpp_name;
     86       1.1  thorpej } mpt_pci_products[] = {
     87       1.1  thorpej 	{ PCI_VENDOR_SYMBIOS,	PCI_PRODUCT_SYMBIOS_1030,
     88       1.1  thorpej 	  MPP_F_DUAL,
     89       1.1  thorpej 	  "LSI Logic 53c1030 Ultra320 SCSI" },
     90       1.1  thorpej 
     91       1.1  thorpej 	{ PCI_VENDOR_SYMBIOS,	PCI_PRODUCT_SYMBIOS_FC909,
     92       1.1  thorpej 	  MPP_F_FC,
     93       1.1  thorpej 	  "LSI Logic FC909 FC Adapter" },
     94       1.1  thorpej 	{ PCI_VENDOR_SYMBIOS,	PCI_PRODUCT_SYMBIOS_FC909A,
     95       1.1  thorpej 	  MPP_F_FC,
     96       1.1  thorpej 	  "LSI Logic FC909A FC Adapter" },
     97       1.1  thorpej 	{ PCI_VENDOR_SYMBIOS,	PCI_PRODUCT_SYMBIOS_FC929,
     98       1.1  thorpej 	  MPP_F_FC | MPP_F_DUAL,
     99       1.1  thorpej 	  "LSI Logic FC929 FC Adapter" },
    100       1.1  thorpej 	{ PCI_VENDOR_SYMBIOS,	PCI_PRODUCT_SYMBIOS_FC929_1,
    101       1.1  thorpej 	  MPP_F_FC | MPP_F_DUAL,
    102       1.1  thorpej 	  "LSI Logic FC929 FC Adapter" },
    103       1.1  thorpej 	{ PCI_VENDOR_SYMBIOS,	PCI_PRODUCT_SYMBIOS_FC919,
    104       1.1  thorpej 	  MPP_F_FC,
    105       1.1  thorpej 	  "LSI Logic FC919 FC Adapter" },
    106       1.1  thorpej 	{ PCI_VENDOR_SYMBIOS,	PCI_PRODUCT_SYMBIOS_FC919_1,
    107       1.1  thorpej 	  MPP_F_FC,
    108       1.1  thorpej 	  "LSI Logic FC919 FC Adapter" },
    109       1.3   martin 	{ PCI_VENDOR_SYMBIOS,   PCI_PRODUCT_SYMBIOS_FC929X,
    110       1.3   martin 	  MPP_F_FC | MPP_F_DUAL,
    111       1.3   martin 	  "LSI Logic FC929X FC Adapter" },
    112       1.4       he 	{ PCI_VENDOR_SYMBIOS,	PCI_PRODUCT_SYMBIOS_FC919X,
    113       1.4       he 	  MPP_F_FC,
    114       1.4       he 	  "LSI Logic FC919X FC Adapter" },
    115       1.1  thorpej 
    116       1.1  thorpej 	{ 0,			0,
    117       1.1  thorpej 	  0,
    118       1.1  thorpej 	  NULL },
    119       1.1  thorpej };
    120       1.1  thorpej 
    121       1.1  thorpej static const struct mpt_pci_product *
    122       1.1  thorpej mpt_pci_lookup(const struct pci_attach_args *pa)
    123       1.1  thorpej {
    124       1.1  thorpej 	const struct mpt_pci_product *mpp;
    125       1.1  thorpej 
    126       1.1  thorpej 	for (mpp = mpt_pci_products; mpp->mpp_name != NULL; mpp++) {
    127       1.1  thorpej 		if (PCI_VENDOR(pa->pa_id) == mpp->mpp_vendor &&
    128       1.1  thorpej 		    PCI_PRODUCT(pa->pa_id) == mpp->mpp_product)
    129       1.1  thorpej 			return (mpp);
    130       1.1  thorpej 	}
    131       1.1  thorpej 	return (NULL);
    132       1.1  thorpej }
    133       1.1  thorpej 
    134       1.1  thorpej static int
    135  1.8.10.1     yamt mpt_pci_match(struct device *parent __unused, struct cfdata *cf __unused,
    136  1.8.10.1     yamt     void *aux)
    137       1.1  thorpej {
    138       1.1  thorpej 	struct pci_attach_args *pa = aux;
    139       1.1  thorpej 
    140       1.1  thorpej 	if (mpt_pci_lookup(pa) != NULL)
    141       1.1  thorpej 		return (1);
    142       1.1  thorpej 
    143       1.1  thorpej 	return (0);
    144       1.1  thorpej }
    145       1.1  thorpej 
    146       1.1  thorpej static void
    147  1.8.10.1     yamt mpt_pci_attach(struct device *parent __unused, struct device *self, void *aux)
    148       1.1  thorpej {
    149       1.1  thorpej 	struct mpt_pci_softc *psc = (void *) self;
    150       1.1  thorpej 	mpt_softc_t *mpt = &psc->sc_mpt;
    151       1.1  thorpej 	struct pci_attach_args *pa = aux;
    152       1.1  thorpej 	const struct mpt_pci_product *mpp;
    153       1.1  thorpej 	pci_intr_handle_t ih;
    154       1.1  thorpej 	const char *intrstr;
    155       1.1  thorpej 	pcireg_t reg, memtype;
    156       1.1  thorpej 	bus_space_tag_t memt;
    157       1.1  thorpej 	bus_space_handle_t memh;
    158       1.1  thorpej 	int memh_valid;
    159       1.1  thorpej 
    160       1.1  thorpej 	mpp = mpt_pci_lookup(pa);
    161       1.1  thorpej 	if (mpp == NULL) {
    162       1.1  thorpej 		printf("\n");
    163       1.1  thorpej 		panic("mpt_pci_attach");
    164       1.1  thorpej 	}
    165       1.1  thorpej 
    166       1.1  thorpej 	if (mpp->mpp_flags & MPP_F_FC) {
    167       1.1  thorpej 		mpt->is_fc = 1;
    168       1.1  thorpej 		aprint_naive(": Fibre Channel controller\n");
    169       1.1  thorpej 	} else
    170       1.1  thorpej 		aprint_naive(": SCSI controller\n");
    171       1.1  thorpej 	aprint_normal(": %s\n", mpp->mpp_name);
    172       1.1  thorpej 
    173       1.1  thorpej 	psc->sc_pc = pa->pa_pc;
    174       1.1  thorpej 	psc->sc_tag = pa->pa_tag;
    175       1.1  thorpej 
    176       1.1  thorpej 	mpt->sc_dmat = pa->pa_dmat;
    177       1.1  thorpej 	mpt->sc_set_config_regs = mpt_pci_set_config_regs;
    178       1.1  thorpej 
    179       1.1  thorpej 	/*
    180       1.1  thorpej 	 * Map the device.
    181       1.1  thorpej 	 */
    182       1.1  thorpej 	memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, MPT_PCI_MMBA);
    183       1.1  thorpej 	switch (memtype) {
    184       1.1  thorpej 	case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT:
    185       1.1  thorpej 	case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT:
    186       1.1  thorpej 		memh_valid = (pci_mapreg_map(pa, MPT_PCI_MMBA,
    187       1.1  thorpej 		    memtype, 0, &memt, &memh, NULL, NULL) == 0);
    188       1.1  thorpej 		break;
    189       1.1  thorpej 
    190       1.1  thorpej 	default:
    191       1.1  thorpej 		memh_valid = 0;
    192       1.1  thorpej 	}
    193       1.1  thorpej 
    194       1.1  thorpej 	if (memh_valid) {
    195       1.1  thorpej 		mpt->sc_st = memt;
    196       1.1  thorpej 		mpt->sc_sh = memh;
    197       1.1  thorpej 	} else {
    198       1.1  thorpej 		aprint_error("%s: unable to map device registers\n",
    199       1.1  thorpej 		    mpt->sc_dev.dv_xname);
    200       1.1  thorpej 		return;
    201       1.1  thorpej 	}
    202       1.1  thorpej 
    203       1.1  thorpej 	/*
    204       1.1  thorpej 	 * Make sure the PCI command register is properly configured.
    205       1.1  thorpej 	 */
    206       1.1  thorpej 	reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
    207       1.1  thorpej 	reg |= PCI_COMMAND_MASTER_ENABLE;
    208       1.1  thorpej 	/* XXX PCI_COMMAND_INVALIDATE_ENABLE */
    209       1.1  thorpej 	/* XXX PCI_COMMAND_PARITY_ENABLE */
    210       1.1  thorpej 	/* XXX PCI_COMMAND_SERR_ENABLE */
    211       1.1  thorpej 	pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, reg);
    212       1.1  thorpej 
    213       1.1  thorpej 	/*
    214       1.1  thorpej 	 * Ensure that the ROM is diabled.
    215       1.1  thorpej 	 */
    216       1.1  thorpej 	reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_MAPREG_ROM);
    217       1.1  thorpej 	reg &= ~1;
    218       1.1  thorpej 	pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_MAPREG_ROM, reg);
    219       1.1  thorpej 
    220       1.1  thorpej 	/*
    221       1.1  thorpej 	 * Map and establish our interrupt.
    222       1.1  thorpej 	 */
    223       1.1  thorpej 	if (pci_intr_map(pa, &ih) != 0) {
    224       1.1  thorpej 		aprint_error("%s: unable to map interrupt\n",
    225       1.1  thorpej 		    mpt->sc_dev.dv_xname);
    226       1.1  thorpej 		return;
    227       1.1  thorpej 	}
    228       1.1  thorpej 	intrstr = pci_intr_string(pa->pa_pc, ih);
    229       1.1  thorpej 	psc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, mpt_intr, mpt);
    230       1.1  thorpej 	if (psc->sc_ih == NULL) {
    231       1.1  thorpej 		aprint_error("%s: unable to establish interrupt",
    232       1.1  thorpej 		    mpt->sc_dev.dv_xname);
    233       1.1  thorpej 		if (intrstr != NULL)
    234       1.1  thorpej 			aprint_normal(" at %s", intrstr);
    235       1.1  thorpej 		aprint_normal("\n");
    236       1.1  thorpej 		return;
    237       1.1  thorpej 	}
    238       1.1  thorpej 	aprint_normal("%s: interrupting at %s\n", mpt->sc_dev.dv_xname,
    239       1.1  thorpej 	    intrstr);
    240       1.1  thorpej 
    241       1.1  thorpej 	/* Disable interrupts on the part. */
    242       1.1  thorpej 	mpt_disable_ints(mpt);
    243       1.1  thorpej 
    244       1.1  thorpej 	/* Allocate DMA memory. */
    245       1.1  thorpej 	if (mpt_dma_mem_alloc(mpt) != 0) {
    246       1.1  thorpej 		aprint_error("%s: unable to allocate DMA memory\n",
    247       1.1  thorpej 		    mpt->sc_dev.dv_xname);
    248       1.1  thorpej 		return;
    249       1.1  thorpej 	}
    250       1.1  thorpej 
    251       1.1  thorpej 	/*
    252       1.1  thorpej 	 * Save the PCI config register values.
    253       1.1  thorpej 	 *
    254       1.1  thorpej 	 * Hard resets are known to screw up the BAR for diagnostic
    255       1.1  thorpej 	 * memory accesses (Mem1).
    256       1.1  thorpej 	 *
    257       1.1  thorpej 	 * Using Mem1 is know to make the chip stop responding to
    258       1.1  thorpej 	 * configuration cycles, so we need to save it now.
    259       1.1  thorpej 	 */
    260       1.1  thorpej 	mpt_pci_read_config_regs(mpt);
    261       1.1  thorpej 
    262       1.1  thorpej 	/*
    263       1.1  thorpej 	 * If we're a dual-port adapter, try to find our peer.  We
    264       1.1  thorpej 	 * need to fix his PCI config registers, too.
    265       1.1  thorpej 	 */
    266       1.1  thorpej 	if (mpp->mpp_flags & MPP_F_DUAL)
    267       1.1  thorpej 		mpt_pci_link_peer(mpt);
    268       1.1  thorpej 
    269       1.1  thorpej 	/* Initialize the hardware. */
    270       1.1  thorpej 	if (mpt_init(mpt, MPT_DB_INIT_HOST) != 0) {
    271       1.1  thorpej 		/* Error message already printed. */
    272       1.1  thorpej 		return;
    273       1.1  thorpej 	}
    274       1.1  thorpej 
    275       1.1  thorpej 	/* Attach to scsipi. */
    276       1.1  thorpej 	mpt_scsipi_attach(mpt);
    277       1.1  thorpej }
    278       1.1  thorpej 
    279       1.1  thorpej CFATTACH_DECL(mpt_pci, sizeof(struct mpt_pci_softc),
    280       1.1  thorpej     mpt_pci_match, mpt_pci_attach, NULL, NULL);
    281       1.1  thorpej 
    282       1.1  thorpej /*
    283       1.1  thorpej  * Find and remember our peer PCI function on a dual-port device.
    284       1.1  thorpej  */
    285       1.1  thorpej static void
    286       1.1  thorpej mpt_pci_link_peer(mpt_softc_t *mpt)
    287       1.1  thorpej {
    288       1.1  thorpej 	extern struct cfdriver mpt_cd;
    289       1.1  thorpej 
    290       1.1  thorpej 	struct mpt_pci_softc *peer_psc, *psc = (void *) mpt;
    291       1.1  thorpej 	struct device *dev;
    292       1.1  thorpej 	int unit, b, d, f, peer_b, peer_d, peer_f;
    293       1.1  thorpej 
    294       1.1  thorpej 	pci_decompose_tag(psc->sc_pc, psc->sc_tag, &b, &d, &f);
    295       1.1  thorpej 
    296       1.1  thorpej 	for (unit = 0; unit < mpt_cd.cd_ndevs; unit++) {
    297       1.7  thorpej 		if (unit == device_unit(&mpt->sc_dev))
    298       1.1  thorpej 			continue;
    299       1.1  thorpej 		dev = device_lookup(&mpt_cd, unit);
    300       1.1  thorpej 		if (dev == NULL)
    301       1.1  thorpej 			continue;
    302       1.8  thorpej 		if (device_parent(&mpt->sc_dev) != device_parent(dev))
    303       1.1  thorpej 			continue;
    304       1.8  thorpej 		/*
    305       1.8  thorpej 		 * If we have the same parent, we know the other one
    306       1.8  thorpej 		 * is attached with mpt_pci.
    307       1.8  thorpej 		 */
    308       1.1  thorpej 		peer_psc = (void *) dev;
    309       1.1  thorpej 		if (peer_psc->sc_pc != psc->sc_pc)
    310       1.1  thorpej 			continue;
    311       1.1  thorpej 		pci_decompose_tag(peer_psc->sc_pc, peer_psc->sc_tag,
    312       1.1  thorpej 		    &peer_b, &peer_d, &peer_f);
    313       1.1  thorpej 		if (peer_b == b && peer_d == d) {
    314       1.1  thorpej 			if (mpt->verbose)
    315       1.1  thorpej 				mpt_prt(mpt, "linking with peer: %s",
    316       1.1  thorpej 				    peer_psc->sc_mpt.sc_dev.dv_xname);
    317       1.1  thorpej 			mpt->mpt2 = (mpt_softc_t *) peer_psc;
    318       1.1  thorpej 			peer_psc->sc_mpt.mpt2 = mpt;
    319       1.1  thorpej 			return;
    320       1.1  thorpej 		}
    321       1.1  thorpej 	}
    322       1.1  thorpej }
    323       1.1  thorpej 
    324       1.1  thorpej /*
    325       1.1  thorpej  * Save the volatile PCI configuration registers.
    326       1.1  thorpej  */
    327       1.1  thorpej static void
    328       1.1  thorpej mpt_pci_read_config_regs(mpt_softc_t *mpt)
    329       1.1  thorpej {
    330       1.1  thorpej 	struct mpt_pci_softc *psc = (void *) mpt;
    331       1.1  thorpej 
    332       1.1  thorpej 	psc->sc_pci_csr = pci_conf_read(psc->sc_pc, psc->sc_tag,
    333       1.1  thorpej 	    PCI_COMMAND_STATUS_REG);
    334       1.1  thorpej 	psc->sc_pci_bhlc = pci_conf_read(psc->sc_pc, psc->sc_tag,
    335       1.1  thorpej 	    PCI_BHLC_REG);
    336       1.1  thorpej 	psc->sc_pci_io_bar = pci_conf_read(psc->sc_pc, psc->sc_tag,
    337       1.1  thorpej 	    PCI_MAPREG_START);
    338       1.1  thorpej 	psc->sc_pci_mem0_bar[0] = pci_conf_read(psc->sc_pc, psc->sc_tag,
    339       1.1  thorpej 	    PCI_MAPREG_START+0x04);
    340       1.1  thorpej 	psc->sc_pci_mem0_bar[1] = pci_conf_read(psc->sc_pc, psc->sc_tag,
    341       1.1  thorpej 	    PCI_MAPREG_START+0x08);
    342       1.1  thorpej 	psc->sc_pci_mem1_bar[0] = pci_conf_read(psc->sc_pc, psc->sc_tag,
    343       1.1  thorpej 	    PCI_MAPREG_START+0x0c);
    344       1.1  thorpej 	psc->sc_pci_mem1_bar[1] = pci_conf_read(psc->sc_pc, psc->sc_tag,
    345       1.1  thorpej 	    PCI_MAPREG_START+0x10);
    346       1.1  thorpej 	psc->sc_pci_rom_bar = pci_conf_read(psc->sc_pc, psc->sc_tag,
    347       1.1  thorpej 	    PCI_MAPREG_ROM);
    348       1.1  thorpej 	psc->sc_pci_int = pci_conf_read(psc->sc_pc, psc->sc_tag,
    349       1.1  thorpej 	    PCI_INTERRUPT_REG);
    350       1.1  thorpej 	psc->sc_pci_pmcsr = pci_conf_read(psc->sc_pc, psc->sc_tag, 0x44);
    351       1.1  thorpej }
    352       1.1  thorpej 
    353       1.1  thorpej /*
    354       1.1  thorpej  * Restore the volatile PCI configuration registers.
    355       1.1  thorpej  */
    356       1.1  thorpej static void
    357       1.1  thorpej mpt_pci_set_config_regs(mpt_softc_t *mpt)
    358       1.1  thorpej {
    359       1.1  thorpej 	struct mpt_pci_softc *psc = (void *) mpt;
    360       1.1  thorpej 
    361       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_COMMAND_STATUS_REG,
    362       1.1  thorpej 	    psc->sc_pci_csr);
    363       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_BHLC_REG,
    364       1.1  thorpej 	    psc->sc_pci_bhlc);
    365       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_MAPREG_START,
    366       1.1  thorpej 	    psc->sc_pci_io_bar);
    367       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_MAPREG_START+0x04,
    368       1.1  thorpej 	    psc->sc_pci_mem0_bar[0]);
    369       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_MAPREG_START+0x08,
    370       1.1  thorpej 	    psc->sc_pci_mem0_bar[1]);
    371       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_MAPREG_START+0x0c,
    372       1.1  thorpej 	    psc->sc_pci_mem1_bar[0]);
    373       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_MAPREG_START+0x10,
    374       1.1  thorpej 	    psc->sc_pci_mem1_bar[1]);
    375       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_MAPREG_ROM,
    376       1.1  thorpej 	    psc->sc_pci_rom_bar);
    377       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, PCI_INTERRUPT_REG,
    378       1.1  thorpej 	    psc->sc_pci_int);
    379       1.1  thorpej 	pci_conf_write(psc->sc_pc, psc->sc_tag, 0x44, psc->sc_pci_pmcsr);
    380       1.1  thorpej }
    381