Home | History | Annotate | Line # | Download | only in xscale
becc.c revision 1.3
      1  1.3  thorpej /*	$NetBSD: becc.c,v 1.3 2003/04/20 17:17:01 thorpej Exp $	*/
      2  1.1  thorpej 
      3  1.1  thorpej /*
      4  1.2  thorpej  * Copyright (c) 2002, 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.1  thorpej /*
     39  1.1  thorpej  * Autoconfiguration support for the ADI Engineering Big Endian
     40  1.1  thorpej  * Companion Chip.
     41  1.1  thorpej  */
     42  1.1  thorpej 
     43  1.1  thorpej #include <sys/param.h>
     44  1.1  thorpej #include <sys/systm.h>
     45  1.1  thorpej #include <sys/device.h>
     46  1.1  thorpej 
     47  1.1  thorpej #define	_ARM32_BUS_DMA_PRIVATE
     48  1.1  thorpej #include <machine/bus.h>
     49  1.1  thorpej 
     50  1.1  thorpej #include <arm/xscale/i80200reg.h>
     51  1.1  thorpej #include <arm/xscale/beccreg.h>
     52  1.1  thorpej #include <arm/xscale/beccvar.h>
     53  1.1  thorpej 
     54  1.1  thorpej /*
     55  1.1  thorpej  * Virtual address at which the BECC is mapped.  This is filled in
     56  1.1  thorpej  * by machine-dependent code.
     57  1.1  thorpej  */
     58  1.1  thorpej vaddr_t becc_vaddr;
     59  1.1  thorpej 
     60  1.1  thorpej /*
     61  1.1  thorpej  * BECC revision number.  This is initialized by early bootstrap code.
     62  1.1  thorpej  */
     63  1.1  thorpej int becc_rev;
     64  1.1  thorpej const char *becc_revisions[] = {
     65  1.1  thorpej 	"<= 7",
     66  1.1  thorpej 	"8",
     67  1.1  thorpej 	">= 9",
     68  1.1  thorpej };
     69  1.1  thorpej 
     70  1.1  thorpej /*
     71  1.1  thorpej  * There can be only one BECC, so we keep a global pointer to
     72  1.1  thorpej  * the softc, so board-specific code can use features of the
     73  1.1  thorpej  * BECC without having to have a handle on the softc itself.
     74  1.1  thorpej  */
     75  1.1  thorpej struct becc_softc *becc_softc;
     76  1.1  thorpej 
     77  1.1  thorpej static int becc_pcibus_print(void *, const char *);
     78  1.1  thorpej 
     79  1.2  thorpej static int becc_search(struct device *, struct cfdata *, void *);
     80  1.2  thorpej static int becc_print(void *, const char *);
     81  1.2  thorpej 
     82  1.1  thorpej static void becc_pci_dma_init(struct becc_softc *);
     83  1.2  thorpej static void becc_local_dma_init(struct becc_softc *);
     84  1.1  thorpej 
     85  1.1  thorpej /*
     86  1.1  thorpej  * becc_attach:
     87  1.1  thorpej  *
     88  1.1  thorpej  *	Board-independent attach routine for the BECC.
     89  1.1  thorpej  */
     90  1.1  thorpej void
     91  1.1  thorpej becc_attach(struct becc_softc *sc)
     92  1.1  thorpej {
     93  1.1  thorpej 	struct pcibus_attach_args pba;
     94  1.1  thorpej 	uint32_t reg;
     95  1.1  thorpej 
     96  1.1  thorpej 	becc_softc = sc;
     97  1.1  thorpej 
     98  1.1  thorpej 	/*
     99  1.1  thorpej 	 * Set the AF bit in the BCUMOD since the BECC will honor it.
    100  1.1  thorpej 	 * This allows the BECC to return the requested 4-byte word
    101  1.1  thorpej 	 * first when filling a cache line.
    102  1.1  thorpej 	 */
    103  1.2  thorpej 	__asm __volatile("mrc p13, 0, %0, c1, c1, 0" : "=r" (reg));
    104  1.1  thorpej 	__asm __volatile("mcr p13, 0, %0, c1, c1, 0" : : "r" (reg | BCUMOD_AF));
    105  1.1  thorpej 
    106  1.1  thorpej 	/*
    107  1.1  thorpej 	 * Program the address windows of the PCI core.  Note
    108  1.1  thorpej 	 * that PCI master and target cycles must be disabled
    109  1.1  thorpej 	 * while we configure the windows.
    110  1.1  thorpej 	 */
    111  1.1  thorpej 	reg = becc_pcicore_read(sc, PCI_COMMAND_STATUS_REG);
    112  1.1  thorpej 	reg &= ~(PCI_COMMAND_MEM_ENABLE|PCI_COMMAND_MASTER_ENABLE);
    113  1.1  thorpej 	becc_pcicore_write(sc, PCI_COMMAND_STATUS_REG, reg);
    114  1.1  thorpej 
    115  1.1  thorpej 	/*
    116  1.1  thorpej 	 * Program the two inbound PCI memory windows.
    117  1.1  thorpej 	 */
    118  1.1  thorpej 	becc_pcicore_write(sc, PCI_MAPREG_START + 0,
    119  1.1  thorpej 	    sc->sc_iwin[0].iwin_base | PCI_MAPREG_MEM_TYPE_32BIT |
    120  1.1  thorpej 	    PCI_MAPREG_MEM_PREFETCHABLE_MASK);
    121  1.1  thorpej 	reg = becc_pcicore_read(sc, PCI_MAPREG_START + 0);
    122  1.1  thorpej 	BECC_CSR_WRITE(BECC_PSTR0, sc->sc_iwin[0].iwin_xlate & PSTRx_ADDRMASK);
    123  1.1  thorpej 
    124  1.1  thorpej 	becc_pcicore_write(sc, PCI_MAPREG_START + 4,
    125  1.1  thorpej 	    sc->sc_iwin[1].iwin_base | PCI_MAPREG_MEM_TYPE_32BIT |
    126  1.1  thorpej 	    PCI_MAPREG_MEM_PREFETCHABLE_MASK);
    127  1.1  thorpej 	reg = becc_pcicore_read(sc, PCI_MAPREG_START + 4);
    128  1.1  thorpej 	BECC_CSR_WRITE(BECC_PSTR1, sc->sc_iwin[1].iwin_xlate & PSTRx_ADDRMASK);
    129  1.1  thorpej 
    130  1.1  thorpej 	/*
    131  1.1  thorpej 	 * ...and the third on v8 and later.
    132  1.1  thorpej 	 */
    133  1.1  thorpej 	if (becc_rev >= BECC_REV_V8) {
    134  1.1  thorpej 		becc_pcicore_write(sc, PCI_MAPREG_START + 8,
    135  1.1  thorpej 		    sc->sc_iwin[2].iwin_base | PCI_MAPREG_MEM_TYPE_32BIT |
    136  1.1  thorpej 		    PCI_MAPREG_MEM_PREFETCHABLE_MASK);
    137  1.1  thorpej 		reg = becc_pcicore_read(sc, PCI_MAPREG_START + 8);
    138  1.3  thorpej 		BECC_CSR_WRITE(BECC_PSTR2,
    139  1.1  thorpej 		    sc->sc_iwin[2].iwin_xlate & PSTR2_ADDRMASK);
    140  1.1  thorpej 	}
    141  1.1  thorpej 
    142  1.1  thorpej 	/*
    143  1.1  thorpej 	 * Program the two outbound PCI memory windows.  On a
    144  1.1  thorpej 	 * big-endian system, we byte-swap the first window.
    145  1.1  thorpej 	 * The second window is used for STREAM transfers.
    146  1.1  thorpej 	 *
    147  1.1  thorpej 	 * There's a third window on v9 and later, but we don't
    148  1.1  thorpej 	 * use it for anything; program it anyway, just to be
    149  1.1  thorpej 	 * safe.
    150  1.1  thorpej 	 */
    151  1.1  thorpej #ifdef __ARMEB__
    152  1.1  thorpej 	BECC_CSR_WRITE(BECC_POMR1, sc->sc_owin_xlate[0] /* | POMRx_F32 */ |
    153  1.1  thorpej 	    POMRx_BEE);
    154  1.1  thorpej #else
    155  1.1  thorpej 	BECC_CSR_WRITE(BECC_POMR1, sc->sc_owin_xlate[0] /* | POMRx_F32 */);
    156  1.1  thorpej #endif
    157  1.1  thorpej 	BECC_CSR_WRITE(BECC_POMR2, sc->sc_owin_xlate[1] /* | POMRx_F32 */);
    158  1.1  thorpej 
    159  1.1  thorpej 	if (becc_rev >= BECC_REV_V9)
    160  1.1  thorpej 		BECC_CSR_WRITE(BECC_POMR3,
    161  1.1  thorpej 		    sc->sc_owin_xlate[2] /* | POMRx_F32 */);
    162  1.1  thorpej 
    163  1.1  thorpej 	/*
    164  1.1  thorpej 	 * Program the PCI I/O window.  On a big-endian system,
    165  1.1  thorpej 	 * we do byte-swapping.
    166  1.1  thorpej 	 *
    167  1.1  thorpej 	 * XXX What about STREAM transfers?
    168  1.1  thorpej 	 */
    169  1.1  thorpej #ifdef __ARMEB__
    170  1.1  thorpej 	BECC_CSR_WRITE(BECC_POIR, sc->sc_ioout_xlate | POIR_BEE);
    171  1.1  thorpej #else
    172  1.1  thorpej 	BECC_CSR_WRITE(BECC_POIR, sc->sc_ioout_xlate);
    173  1.1  thorpej #endif
    174  1.1  thorpej 
    175  1.1  thorpej 	/*
    176  1.1  thorpej 	 * Configure PCI configuration cycle access.
    177  1.1  thorpej 	 */
    178  1.1  thorpej 	BECC_CSR_WRITE(BECC_POCR, 0);
    179  1.1  thorpej 
    180  1.1  thorpej 	/*
    181  1.1  thorpej 	 * ...and now reenable PCI access.
    182  1.1  thorpej 	 */
    183  1.1  thorpej 	reg = becc_pcicore_read(sc, PCI_COMMAND_STATUS_REG);
    184  1.1  thorpej 	reg |= PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE |
    185  1.1  thorpej 	    PCI_COMMAND_PARITY_ENABLE | PCI_COMMAND_SERR_ENABLE;
    186  1.1  thorpej 	becc_pcicore_write(sc, PCI_COMMAND_STATUS_REG, reg);
    187  1.1  thorpej 
    188  1.1  thorpej 	/* Initialize the bus space tags. */
    189  1.1  thorpej 	becc_io_bs_init(&sc->sc_pci_iot, sc);
    190  1.1  thorpej 	becc_mem_bs_init(&sc->sc_pci_memt, sc);
    191  1.1  thorpej 
    192  1.1  thorpej 	/* Initialize the PCI chipset tag. */
    193  1.1  thorpej 	becc_pci_init(&sc->sc_pci_chipset, sc);
    194  1.1  thorpej 
    195  1.1  thorpej 	/* Initialize the DMA tags. */
    196  1.1  thorpej 	becc_pci_dma_init(sc);
    197  1.2  thorpej 	becc_local_dma_init(sc);
    198  1.2  thorpej 
    199  1.2  thorpej 	/*
    200  1.2  thorpej 	 * Attach any on-chip peripherals.  We used indirect config, since
    201  1.2  thorpej 	 * the BECC is a soft-core with a variety of peripherals, depending
    202  1.2  thorpej 	 * on configuration.
    203  1.2  thorpej 	 */
    204  1.2  thorpej 	config_search(becc_search, &sc->sc_dev, NULL);
    205  1.1  thorpej 
    206  1.1  thorpej 	/*
    207  1.1  thorpej 	 * Attach the PCI bus.
    208  1.1  thorpej 	 */
    209  1.1  thorpej 	pba.pba_busname = "pci";
    210  1.1  thorpej 	pba.pba_iot = &sc->sc_pci_iot;
    211  1.1  thorpej 	pba.pba_memt = &sc->sc_pci_memt;
    212  1.1  thorpej 	pba.pba_dmat = &sc->sc_pci_dmat;
    213  1.1  thorpej 	pba.pba_pc = &sc->sc_pci_chipset;
    214  1.1  thorpej 	pba.pba_bus = 0;
    215  1.1  thorpej 	pba.pba_bridgetag = NULL;
    216  1.1  thorpej 	pba.pba_intrswiz = 0;
    217  1.1  thorpej 	pba.pba_intrtag = 0;
    218  1.1  thorpej 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
    219  1.1  thorpej 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
    220  1.1  thorpej 	(void) config_found(&sc->sc_dev, &pba, becc_pcibus_print);
    221  1.1  thorpej }
    222  1.1  thorpej 
    223  1.1  thorpej /*
    224  1.1  thorpej  * becc_pcibus_print:
    225  1.1  thorpej  *
    226  1.1  thorpej  *	Autoconfiguration cfprint routine when attaching
    227  1.1  thorpej  *	to the "pcibus" attribute.
    228  1.1  thorpej  */
    229  1.1  thorpej static int
    230  1.1  thorpej becc_pcibus_print(void *aux, const char *pnp)
    231  1.1  thorpej {
    232  1.1  thorpej 	struct pcibus_attach_args *pba = aux;
    233  1.1  thorpej 
    234  1.1  thorpej 	if (pnp)
    235  1.1  thorpej 		printf("%s at %s", pba->pba_busname, pnp);
    236  1.1  thorpej 
    237  1.1  thorpej 	printf(" bus %d", pba->pba_bus);
    238  1.1  thorpej 
    239  1.1  thorpej 	return (UNCONF);
    240  1.1  thorpej }
    241  1.1  thorpej 
    242  1.1  thorpej /*
    243  1.2  thorpej  * becc_search:
    244  1.2  thorpej  *
    245  1.2  thorpej  *	Indirect autoconfiguration glue for BECC.
    246  1.2  thorpej  */
    247  1.2  thorpej static int
    248  1.2  thorpej becc_search(struct device *parent, struct cfdata *cf, void *aux)
    249  1.2  thorpej {
    250  1.2  thorpej 	struct becc_softc *sc = (void *) parent;
    251  1.2  thorpej 	struct becc_attach_args ba;
    252  1.2  thorpej 
    253  1.2  thorpej 	ba.ba_dmat = &sc->sc_local_dmat;
    254  1.2  thorpej 
    255  1.2  thorpej 	if (config_match(parent, cf, &ba) > 0)
    256  1.2  thorpej 		config_attach(parent, cf, &ba, becc_print);
    257  1.2  thorpej 
    258  1.2  thorpej 	return (0);
    259  1.2  thorpej }
    260  1.2  thorpej 
    261  1.2  thorpej /*
    262  1.2  thorpej  * becc_print:
    263  1.2  thorpej  *
    264  1.2  thorpej  *	Autoconfiguration cfprint routine when attaching
    265  1.2  thorpej  *	to the BECC.
    266  1.2  thorpej  */
    267  1.2  thorpej static int
    268  1.2  thorpej becc_print(void *aux, const char *pnp)
    269  1.2  thorpej {
    270  1.2  thorpej 
    271  1.2  thorpej 	return (UNCONF);
    272  1.2  thorpej }
    273  1.2  thorpej 
    274  1.2  thorpej /*
    275  1.1  thorpej  * becc_pci_dma_init:
    276  1.1  thorpej  *
    277  1.1  thorpej  *	Initialize the PCI DMA tag.
    278  1.1  thorpej  */
    279  1.1  thorpej static void
    280  1.1  thorpej becc_pci_dma_init(struct becc_softc *sc)
    281  1.1  thorpej {
    282  1.1  thorpej 	bus_dma_tag_t dmat = &sc->sc_pci_dmat;
    283  1.1  thorpej 	struct arm32_dma_range *dr = sc->sc_pci_dma_range;
    284  1.1  thorpej 	int i = 0;
    285  1.1  thorpej 
    286  1.1  thorpej 	/*
    287  1.1  thorpej 	 * If we have the 128MB window, put it first, since it
    288  1.1  thorpej 	 * will always cover the entire memory range.
    289  1.1  thorpej 	 */
    290  1.1  thorpej 	if (becc_rev >= BECC_REV_V8) {
    291  1.1  thorpej 		dr[i].dr_sysbase = sc->sc_iwin[2].iwin_xlate;
    292  1.1  thorpej 		dr[i].dr_busbase = sc->sc_iwin[2].iwin_base;
    293  1.1  thorpej 		dr[i].dr_len = (128U * 1024 * 1024);
    294  1.1  thorpej 		i++;
    295  1.1  thorpej 	}
    296  1.1  thorpej 
    297  1.1  thorpej 	dr[i].dr_sysbase = sc->sc_iwin[0].iwin_xlate;
    298  1.1  thorpej 	dr[i].dr_busbase = sc->sc_iwin[0].iwin_base;
    299  1.1  thorpej 	dr[i].dr_len = (32U * 1024 * 1024);
    300  1.1  thorpej 	i++;
    301  1.1  thorpej 
    302  1.1  thorpej 	dr[i].dr_sysbase = sc->sc_iwin[1].iwin_xlate;
    303  1.1  thorpej 	dr[i].dr_busbase = sc->sc_iwin[1].iwin_base;
    304  1.1  thorpej 	dr[i].dr_len = (32U * 1024 * 1024);
    305  1.1  thorpej 	i++;
    306  1.1  thorpej 
    307  1.1  thorpej 	dmat->_ranges = dr;
    308  1.1  thorpej 	dmat->_nranges = i;
    309  1.2  thorpej 
    310  1.2  thorpej 	dmat->_dmamap_create = _bus_dmamap_create;
    311  1.2  thorpej 	dmat->_dmamap_destroy = _bus_dmamap_destroy;
    312  1.2  thorpej 	dmat->_dmamap_load = _bus_dmamap_load;
    313  1.2  thorpej 	dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
    314  1.2  thorpej 	dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
    315  1.2  thorpej 	dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
    316  1.2  thorpej 	dmat->_dmamap_unload = _bus_dmamap_unload;
    317  1.2  thorpej 	dmat->_dmamap_sync_pre = _bus_dmamap_sync;
    318  1.2  thorpej 	dmat->_dmamap_sync_post = NULL;
    319  1.2  thorpej 
    320  1.2  thorpej 	dmat->_dmamem_alloc = _bus_dmamem_alloc;
    321  1.2  thorpej 	dmat->_dmamem_free = _bus_dmamem_free;
    322  1.2  thorpej 	dmat->_dmamem_map = _bus_dmamem_map;
    323  1.2  thorpej 	dmat->_dmamem_unmap = _bus_dmamem_unmap;
    324  1.2  thorpej 	dmat->_dmamem_mmap = _bus_dmamem_mmap;
    325  1.2  thorpej }
    326  1.2  thorpej 
    327  1.2  thorpej /*
    328  1.2  thorpej  * becc_local_dma_init:
    329  1.2  thorpej  *
    330  1.2  thorpej  *	Initialize the local DMA tag.
    331  1.2  thorpej  */
    332  1.2  thorpej static void
    333  1.2  thorpej becc_local_dma_init(struct becc_softc *sc)
    334  1.2  thorpej {
    335  1.2  thorpej 	bus_dma_tag_t dmat = &sc->sc_local_dmat;
    336  1.2  thorpej 
    337  1.2  thorpej 	dmat->_ranges = NULL;
    338  1.2  thorpej 	dmat->_nranges = 0;
    339  1.1  thorpej 
    340  1.1  thorpej 	dmat->_dmamap_create = _bus_dmamap_create;
    341  1.1  thorpej 	dmat->_dmamap_destroy = _bus_dmamap_destroy;
    342  1.1  thorpej 	dmat->_dmamap_load = _bus_dmamap_load;
    343  1.1  thorpej 	dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
    344  1.1  thorpej 	dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
    345  1.1  thorpej 	dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
    346  1.1  thorpej 	dmat->_dmamap_unload = _bus_dmamap_unload;
    347  1.1  thorpej 	dmat->_dmamap_sync_pre = _bus_dmamap_sync;
    348  1.1  thorpej 	dmat->_dmamap_sync_post = NULL;
    349  1.1  thorpej 
    350  1.1  thorpej 	dmat->_dmamem_alloc = _bus_dmamem_alloc;
    351  1.1  thorpej 	dmat->_dmamem_free = _bus_dmamem_free;
    352  1.1  thorpej 	dmat->_dmamem_map = _bus_dmamem_map;
    353  1.1  thorpej 	dmat->_dmamem_unmap = _bus_dmamem_unmap;
    354  1.1  thorpej 	dmat->_dmamem_mmap = _bus_dmamem_mmap;
    355  1.1  thorpej }
    356  1.1  thorpej 
    357  1.1  thorpej uint32_t
    358  1.1  thorpej becc_pcicore_read(struct becc_softc *sc, bus_addr_t reg)
    359  1.1  thorpej {
    360  1.1  thorpej 	vaddr_t va = sc->sc_pci_cfg_base | (1U << BECC_IDSEL_BIT) | reg;
    361  1.1  thorpej 
    362  1.1  thorpej 	return (*(__volatile uint32_t *) va);
    363  1.1  thorpej }
    364  1.1  thorpej 
    365  1.1  thorpej void
    366  1.1  thorpej becc_pcicore_write(struct becc_softc *sc, bus_addr_t reg, uint32_t val)
    367  1.1  thorpej {
    368  1.1  thorpej 	vaddr_t va = sc->sc_pci_cfg_base | (1U << BECC_IDSEL_BIT) | reg;
    369  1.1  thorpej 
    370  1.1  thorpej 	*(__volatile uint32_t *) va = val;
    371  1.1  thorpej }
    372