Home | History | Annotate | Line # | Download | only in rmi
rmixlvar.h revision 1.1.2.27
      1  1.1.2.27   matt /*	rmixlvar.h,v 1.1.2.26 2012/01/19 08:03:22 matt Exp	*/
      2   1.1.2.1  cliff 
      3   1.1.2.1  cliff /*
      4   1.1.2.1  cliff  * Copyright 2002 Wasabi Systems, Inc.
      5   1.1.2.1  cliff  * All rights reserved.
      6   1.1.2.1  cliff  *
      7   1.1.2.1  cliff  * Written by Simon Burge for Wasabi Systems, Inc.
      8   1.1.2.1  cliff  *
      9   1.1.2.1  cliff  * Redistribution and use in source and binary forms, with or without
     10   1.1.2.1  cliff  * modification, are permitted provided that the following conditions
     11   1.1.2.1  cliff  * are met:
     12   1.1.2.1  cliff  * 1. Redistributions of source code must retain the above copyright
     13   1.1.2.1  cliff  *    notice, this list of conditions and the following disclaimer.
     14   1.1.2.1  cliff  * 2. Redistributions in binary form must reproduce the above copyright
     15   1.1.2.1  cliff  *    notice, this list of conditions and the following disclaimer in the
     16   1.1.2.1  cliff  *    documentation and/or other materials provided with the distribution.
     17   1.1.2.1  cliff  * 3. All advertising materials mentioning features or use of this software
     18   1.1.2.1  cliff  *    must display the following acknowledgement:
     19   1.1.2.1  cliff  *      This product includes software developed for the NetBSD Project by
     20   1.1.2.1  cliff  *      Wasabi Systems, Inc.
     21   1.1.2.1  cliff  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22   1.1.2.1  cliff  *    or promote products derived from this software without specific prior
     23   1.1.2.1  cliff  *    written permission.
     24   1.1.2.1  cliff  *
     25   1.1.2.1  cliff  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26   1.1.2.1  cliff  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27   1.1.2.1  cliff  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28   1.1.2.1  cliff  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29   1.1.2.1  cliff  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30   1.1.2.1  cliff  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31   1.1.2.1  cliff  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32   1.1.2.1  cliff  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33   1.1.2.1  cliff  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34   1.1.2.1  cliff  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35   1.1.2.1  cliff  * POSSIBILITY OF SUCH DAMAGE.
     36   1.1.2.1  cliff  */
     37   1.1.2.1  cliff 
     38   1.1.2.6  cliff #ifndef _MIPS_RMI_RMIXLVAR_H_
     39   1.1.2.6  cliff #define _MIPS_RMI_RMIXLVAR_H_
     40   1.1.2.6  cliff 
     41  1.1.2.21   matt #include <sys/bus.h>
     42  1.1.2.21   matt #include <sys/extent.h>
     43  1.1.2.21   matt 
     44  1.1.2.21   matt #include <dev/pci/pcivar.h>
     45  1.1.2.21   matt 
     46   1.1.2.6  cliff #include <mips/cpu.h>
     47  1.1.2.14   matt #include <mips/locore.h>
     48   1.1.2.1  cliff 
     49  1.1.2.21   matt #include <mips/rmi/rmixl_firmware.h>
     50  1.1.2.21   matt #include <mips/rmi/rmixlreg.h>
     51  1.1.2.14   matt 
     52  1.1.2.21   matt void rmixl_pcr_init_core(bool);
     53  1.1.2.14   matt 
     54  1.1.2.21   matt static inline int
     55  1.1.2.21   matt cpu_rmixl_chip_type(const struct pridtab *ct)
     56  1.1.2.21   matt {
     57  1.1.2.21   matt 	return ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE;
     58  1.1.2.21   matt }
     59  1.1.2.19  cliff 
     60   1.1.2.6  cliff static inline bool
     61   1.1.2.6  cliff cpu_rmixl(const struct pridtab *ct)
     62   1.1.2.6  cliff {
     63  1.1.2.21   matt 	return ct->cpu_cid == MIPS_PRID_CID_RMI;
     64   1.1.2.6  cliff }
     65   1.1.2.6  cliff 
     66   1.1.2.6  cliff static inline bool
     67   1.1.2.6  cliff cpu_rmixlr(const struct pridtab *ct)
     68   1.1.2.6  cliff {
     69  1.1.2.25   matt #ifdef MIPS64_XLR
     70  1.1.2.26   matt #if (MIPS64_XLS + MIPS64_XLP) == 0
     71  1.1.2.26   matt 	return true;
     72  1.1.2.26   matt #else
     73  1.1.2.21   matt 	return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLR;
     74  1.1.2.26   matt #endif
     75  1.1.2.25   matt #else
     76  1.1.2.25   matt 	return false;
     77  1.1.2.25   matt #endif
     78   1.1.2.6  cliff }
     79   1.1.2.6  cliff 
     80   1.1.2.6  cliff static inline bool
     81   1.1.2.6  cliff cpu_rmixls(const struct pridtab *ct)
     82   1.1.2.6  cliff {
     83  1.1.2.25   matt #ifdef MIPS64_XLS
     84  1.1.2.26   matt #if (MIPS64_XLR + MIPS64_XLP) == 0
     85  1.1.2.26   matt 	return true;
     86  1.1.2.26   matt #else
     87  1.1.2.21   matt 	return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLS;
     88  1.1.2.26   matt #endif
     89  1.1.2.25   matt #else
     90  1.1.2.25   matt 	return false;
     91  1.1.2.25   matt #endif
     92   1.1.2.6  cliff }
     93   1.1.2.6  cliff 
     94   1.1.2.6  cliff static inline bool
     95   1.1.2.6  cliff cpu_rmixlp(const struct pridtab *ct)
     96   1.1.2.6  cliff {
     97  1.1.2.25   matt #ifdef MIPS64_XLP
     98  1.1.2.26   matt #if (MIPS64_XLR + MIPS64_XLS) == 0
     99  1.1.2.26   matt 	return true;
    100  1.1.2.26   matt #else
    101  1.1.2.21   matt 	return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLP;
    102  1.1.2.26   matt #endif
    103  1.1.2.25   matt #else
    104  1.1.2.25   matt 	return false;
    105  1.1.2.25   matt #endif
    106  1.1.2.16  cliff }
    107  1.1.2.16  cliff 
    108  1.1.2.13  cliff typedef enum {
    109  1.1.2.13  cliff 	PSB_TYPE_UNKNOWN=0,
    110  1.1.2.13  cliff 	PSB_TYPE_RMI,
    111  1.1.2.13  cliff 	PSB_TYPE_DELL,
    112  1.1.2.13  cliff } rmixlfw_psb_type_t;
    113  1.1.2.13  cliff 
    114  1.1.2.13  cliff static inline const char *
    115  1.1.2.13  cliff rmixlfw_psb_type_name(rmixlfw_psb_type_t type)
    116  1.1.2.13  cliff {
    117  1.1.2.13  cliff 	switch(type) {
    118  1.1.2.13  cliff 	case PSB_TYPE_UNKNOWN:
    119  1.1.2.13  cliff 		return "unknown";
    120  1.1.2.13  cliff 	case PSB_TYPE_RMI:
    121  1.1.2.13  cliff 		return "RMI";
    122  1.1.2.13  cliff 	case PSB_TYPE_DELL:
    123  1.1.2.13  cliff 		return "DELL";
    124  1.1.2.13  cliff 	default:
    125  1.1.2.13  cliff 		return "undefined";
    126  1.1.2.13  cliff 	}
    127  1.1.2.13  cliff }
    128  1.1.2.13  cliff 
    129  1.1.2.21   matt typedef enum {
    130  1.1.2.21   matt 	RMIXLP_8XX,
    131  1.1.2.21   matt 	RMIXLP_4XX,
    132  1.1.2.21   matt 	/* These next 4 need to be in this order */
    133  1.1.2.21   matt 	RMIXLP_3XX,
    134  1.1.2.21   matt 	RMIXLP_3XXL,
    135  1.1.2.21   matt 	RMIXLP_3XXH,
    136  1.1.2.21   matt 	RMIXLP_3XXQ,
    137  1.1.2.27   matt 	RMIXLP_2XX,
    138  1.1.2.27   matt 	RMIXLP_1XX,
    139  1.1.2.21   matt 	RMIXLP_ANY,		/* must be last */
    140  1.1.2.21   matt } rmixlp_variant_t;
    141  1.1.2.21   matt 
    142  1.1.2.25   matt #define	RMIXLP_8XX_P	(RMIXLP_8XX <= rmixl_configuration.rc_xlp_variant \
    143  1.1.2.25   matt 			 && rmixl_configuration.rc_xlp_variant <= RMIXLP_4XX)
    144  1.1.2.25   matt #define	RMIXLP_3XX_P	(RMIXLP_3XX <= rmixl_configuration.rc_xlp_variant \
    145  1.1.2.25   matt 			 && rmixl_configuration.rc_xlp_variant <= RMIXLP_3XXQ)
    146  1.1.2.27   matt #define	RMIXLP_2XX_P	(RMIXLP_2XX <= rmixl_configuration.rc_xlp_variant \
    147  1.1.2.27   matt 			 && rmixl_configuration.rc_xlp_variant <= RMIXLP_1XX)
    148  1.1.2.25   matt 
    149  1.1.2.21   matt struct rmixl_region {
    150  1.1.2.21   matt 	bus_addr_t		r_pbase;
    151  1.1.2.21   matt 	bus_size_t		r_size;
    152  1.1.2.21   matt };
    153  1.1.2.21   matt 
    154   1.1.2.1  cliff struct rmixl_config {
    155  1.1.2.21   matt 	struct rmixl_region	rc_io;
    156  1.1.2.23   matt 	struct rmixl_region	rc_flash[RMIXLP_SBC_NFLASH]; /* FLASH_BAR */
    157  1.1.2.21   matt 	struct rmixl_region	rc_pci_cfg;
    158  1.1.2.21   matt 	struct rmixl_region	rc_pci_ecfg;
    159  1.1.2.21   matt 	struct rmixl_region	rc_pci_mem;
    160  1.1.2.21   matt 	struct rmixl_region	rc_pci_io;
    161  1.1.2.23   matt 	struct rmixl_region	rc_pci_link_mem[RMIXLP_SBC_NPCIE_MEM];
    162  1.1.2.23   matt 	struct rmixl_region	rc_pci_link_io[RMIXLP_SBC_NPCIE_IO];
    163  1.1.2.21   matt 	struct rmixl_region	rc_srio_mem;
    164  1.1.2.23   matt 	struct rmixl_region	rc_norflash[RMIXLP_NOR_NCS]; /* XLP */
    165  1.1.2.21   matt 	struct mips_bus_space	rc_obio_eb_memt; 	/* DEVIO -eb */
    166  1.1.2.21   matt 	struct mips_bus_space	rc_obio_el_memt; 	/* DEVIO -el */
    167  1.1.2.21   matt 	struct mips_bus_space	rc_iobus_memt; 		/* Peripherals IO Bus */
    168  1.1.2.21   matt 	struct mips_bus_space	rc_pci_cfg_memt; 	/* PCI CFG */
    169  1.1.2.21   matt 	struct mips_bus_space	rc_pci_ecfg_eb_memt; 	/* PCI ECFG */
    170  1.1.2.21   matt 	struct mips_bus_space	rc_pci_ecfg_el_memt; 	/* PCI ECFG */
    171  1.1.2.21   matt 	struct mips_bus_space	rc_pci_memt; 		/* PCI MEM */
    172  1.1.2.21   matt 	struct mips_bus_space	rc_pci_iot; 		/* PCI IO */
    173  1.1.2.21   matt 	struct mips_bus_space	rc_srio_memt; 		/* SRIO MEM */
    174  1.1.2.21   matt 	struct mips_bus_dma_tag	rc_dma_tag;
    175  1.1.2.21   matt 	struct mips_pci_chipset rc_pci_chipset;		/* pci_chipset_t */
    176  1.1.2.21   matt 	bus_space_handle_t	rc_pci_cfg_memh;
    177  1.1.2.21   matt 	bus_space_handle_t	rc_pci_ecfg_eb_memh;
    178  1.1.2.21   matt 	bus_space_handle_t	rc_pci_ecfg_el_memh;
    179  1.1.2.21   matt 	bus_dma_tag_t		rc_dmat64;
    180  1.1.2.21   matt 	bus_dma_tag_t		rc_dmat32;
    181  1.1.2.21   matt 	bus_dma_tag_t		rc_dmat29;
    182  1.1.2.21   matt 	struct extent *		rc_phys_ex;		/* Note: MB units */
    183  1.1.2.21   matt 	struct extent *		rc_obio_eb_ex;
    184  1.1.2.21   matt 	struct extent *		rc_obio_el_ex;
    185  1.1.2.21   matt 	struct extent *		rc_iobus_ex;
    186  1.1.2.21   matt 	struct extent *		rc_pci_mem_ex;
    187  1.1.2.21   matt 	struct extent *		rc_pci_io_ex;
    188  1.1.2.21   matt 	struct extent *		rc_srio_mem_ex;
    189  1.1.2.24   matt 	uint64_t		rc_gpio_available;
    190  1.1.2.21   matt 	rmixlfw_info_t 		rc_psb_info;
    191  1.1.2.21   matt 	rmixlfw_psb_type_t	rc_psb_type;
    192  1.1.2.21   matt 	volatile struct rmixlfw_cpu_wakeup_info *
    193  1.1.2.21   matt 				rc_cpu_wakeup_info;
    194  1.1.2.21   matt 	const void *		rc_cpu_wakeup_end;
    195  1.1.2.25   matt 	const char *		rc_cpuname;
    196  1.1.2.25   matt 	int			rc_mallocsafe;
    197  1.1.2.25   matt 	rmixlp_variant_t	rc_xlp_variant;
    198  1.1.2.25   matt 	uint8_t			rc_ncores;
    199   1.1.2.1  cliff };
    200   1.1.2.1  cliff 
    201   1.1.2.1  cliff extern struct rmixl_config rmixl_configuration;
    202   1.1.2.1  cliff 
    203  1.1.2.25   matt void	rmixl_flash_eb_bus_mem_init(bus_space_tag_t, void *);
    204  1.1.2.25   matt void	rmixl_flash_el_bus_mem_init(bus_space_tag_t, void *);
    205  1.1.2.25   matt void	rmixl_iobus_bus_mem_init(bus_space_tag_t, void *);
    206  1.1.2.25   matt void	rmixl_obio_eb_bus_mem_init(bus_space_tag_t, void *);
    207  1.1.2.25   matt void	rmixl_obio_el_bus_mem_init(bus_space_tag_t, void *);
    208  1.1.2.25   matt void	rmixl_pci_cfg_el_bus_mem_init(bus_space_tag_t, void *);
    209  1.1.2.25   matt void	rmixl_pci_cfg_eb_bus_mem_init(bus_space_tag_t, void *);
    210  1.1.2.25   matt void	rmixl_pci_ecfg_el_bus_mem_init(bus_space_tag_t, void *);
    211  1.1.2.25   matt void	rmixl_pci_ecfg_eb_bus_mem_init(bus_space_tag_t, void *);
    212  1.1.2.25   matt void	rmixl_pci_eb_bus_mem_init(bus_space_tag_t, void *);
    213  1.1.2.25   matt void	rmixl_pci_el_bus_mem_init(bus_space_tag_t, void *);
    214  1.1.2.25   matt void	rmixl_pci_bus_io_init(bus_space_tag_t, void *);
    215   1.1.2.1  cliff 
    216  1.1.2.21   matt void	rmixlp_pcie_pc_init(void);
    217  1.1.2.21   matt 
    218  1.1.2.25   matt void	rmixl_addr_error_init(void);
    219  1.1.2.25   matt int	rmixl_addr_error_check(void);
    220   1.1.2.5  cliff 
    221  1.1.2.25   matt uint64_t rmixl_mfcr(u_int);
    222  1.1.2.25   matt void	rmixl_mtcr(uint64_t, u_int);
    223  1.1.2.21   matt 
    224  1.1.2.25   matt void	rmixl_eirr_ack(uint64_t, uint64_t, uint64_t);
    225   1.1.2.5  cliff 
    226  1.1.2.25   matt void	rmixl_fmn_init(void);
    227  1.1.2.25   matt 
    228  1.1.2.25   matt void	rmixl_init_early_cons(struct rmixl_config *, bool);
    229  1.1.2.25   matt void	rmixl_mach_xlp_init(struct rmixl_config *);
    230  1.1.2.25   matt void	rmixl_mach_xlsxlr_init(struct rmixl_config *);
    231  1.1.2.25   matt void	rmixl_mach_freq_init(struct rmixl_config *, bool, bool);
    232  1.1.2.25   matt void	rmixl_mach_init_parse_args(int, char **);
    233  1.1.2.25   matt void	rmixl_mach_init_common(struct rmixl_config *, vaddr_t, uint64_t,
    234  1.1.2.25   matt 	    bool, bool);
    235  1.1.2.25   matt uint64_t rmixl_physaddr_init(void);
    236  1.1.2.25   matt uint64_t rmixlfw_init(int64_t);
    237  1.1.2.13  cliff 
    238  1.1.2.13  cliff /*
    239  1.1.2.13  cliff  * rmixl_cache_err_dis:
    240  1.1.2.13  cliff  * - disable Cache, Data ECC, Snoop Tag Parity, Tag Parity errors
    241  1.1.2.13  cliff  * - clear the cache error log
    242  1.1.2.13  cliff  * - return previous value from RMIXL_PCR_L1D_CONFIG0
    243  1.1.2.13  cliff  */
    244  1.1.2.13  cliff static inline uint64_t
    245  1.1.2.13  cliff rmixl_cache_err_dis(void)
    246  1.1.2.13  cliff {
    247  1.1.2.13  cliff 	uint64_t r;
    248  1.1.2.13  cliff 
    249  1.1.2.13  cliff 	r = rmixl_mfcr(RMIXL_PCR_L1D_CONFIG0);
    250  1.1.2.13  cliff 	rmixl_mtcr(RMIXL_PCR_L1D_CONFIG0, r & ~0x2e);
    251  1.1.2.13  cliff 	rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0);
    252  1.1.2.13  cliff 	return r;
    253  1.1.2.13  cliff }
    254  1.1.2.13  cliff 
    255  1.1.2.13  cliff /*
    256  1.1.2.13  cliff  * rmixl_cache_err_restore:
    257  1.1.2.13  cliff  * - clear the cache error log, cache error overflow log,
    258  1.1.2.13  cliff  *   and cache interrupt registers
    259  1.1.2.13  cliff  * - restore previous value to RMIXL_PCR_L1D_CONFIG0
    260  1.1.2.13  cliff  */
    261  1.1.2.13  cliff static inline void
    262  1.1.2.13  cliff rmixl_cache_err_restore(uint64_t r)
    263  1.1.2.13  cliff {
    264  1.1.2.13  cliff 	rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0);
    265  1.1.2.13  cliff 	rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_OVF_LO, 0);
    266  1.1.2.13  cliff 	rmixl_mtcr(RMIXL_PCR_L1D_CACHE_INTERRUPT, 0);
    267  1.1.2.13  cliff 	rmixl_mtcr(RMIXL_PCR_L1D_CONFIG0, r);
    268  1.1.2.13  cliff }
    269  1.1.2.13  cliff 
    270  1.1.2.13  cliff static inline uint64_t
    271  1.1.2.13  cliff rmixl_cache_err_check(void)
    272  1.1.2.13  cliff {
    273  1.1.2.13  cliff 	return rmixl_mfcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG);
    274  1.1.2.13  cliff }
    275  1.1.2.13  cliff 
    276  1.1.2.13  cliff static inline int
    277  1.1.2.13  cliff rmixl_probe_4(volatile uint32_t *va)
    278  1.1.2.13  cliff {
    279  1.1.2.13  cliff 	uint32_t tmp;
    280  1.1.2.13  cliff 	uint32_t r;
    281  1.1.2.13  cliff 	int err;
    282  1.1.2.13  cliff 	int s;
    283  1.1.2.13  cliff 
    284  1.1.2.13  cliff 	s = splhigh();
    285  1.1.2.13  cliff 	r = rmixl_cache_err_dis();
    286  1.1.2.13  cliff 	tmp = *va;			/* probe */
    287  1.1.2.13  cliff 	err = rmixl_cache_err_check();
    288  1.1.2.13  cliff 	rmixl_cache_err_restore(r);
    289  1.1.2.13  cliff 	splx(s);
    290  1.1.2.13  cliff 
    291  1.1.2.13  cliff 	return (err == 0);
    292  1.1.2.13  cliff }
    293  1.1.2.13  cliff 
    294  1.1.2.21   matt static inline uint32_t
    295  1.1.2.21   matt rmixlp_read_4(uint32_t tag, bus_size_t offset)
    296  1.1.2.21   matt {
    297  1.1.2.21   matt #if 0
    298  1.1.2.21   matt 	const struct rmixl_config * const rcp = &rmixl_configuration;
    299  1.1.2.21   matt 
    300  1.1.2.21   matt 	return bus_space_read_4(rcp->rc_pci_ecfg_memt, rcp->rc_pci_ecfg_memh,
    301  1.1.2.21   matt 	    offset);
    302  1.1.2.21   matt #else
    303  1.1.2.21   matt 	const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase
    304  1.1.2.21   matt 	    + tag + offset;
    305  1.1.2.21   matt 
    306  1.1.2.21   matt 	return be32toh(*(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr));
    307  1.1.2.21   matt #endif
    308  1.1.2.21   matt }
    309  1.1.2.21   matt 
    310  1.1.2.21   matt static inline uint64_t
    311  1.1.2.21   matt rmixlp_read_8(uint32_t tag, bus_size_t offset)
    312  1.1.2.21   matt {
    313  1.1.2.21   matt #if 0
    314  1.1.2.21   matt 	const struct rmixl_config * const rcp = &rmixl_configuration;
    315  1.1.2.21   matt 
    316  1.1.2.21   matt 	return bus_space_read_8(rcp->rc_pci_ecfg_memt, rcp->rc_pci_ecfg_memh,
    317  1.1.2.21   matt 	    offset);
    318  1.1.2.21   matt #else
    319  1.1.2.21   matt 	const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase
    320  1.1.2.21   matt 	    + tag + offset;
    321  1.1.2.21   matt 
    322  1.1.2.21   matt 	return be64toh(*(volatile uint64_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr));
    323  1.1.2.21   matt #endif
    324  1.1.2.21   matt }
    325  1.1.2.21   matt 
    326  1.1.2.21   matt static inline void
    327  1.1.2.21   matt rmixlp_write_4(uint32_t tag, bus_size_t offset, uint32_t v)
    328  1.1.2.21   matt {
    329  1.1.2.21   matt 	const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase
    330  1.1.2.21   matt 	    + tag + offset;
    331  1.1.2.21   matt 
    332  1.1.2.21   matt 	*(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr) = htobe32(v);
    333  1.1.2.21   matt 	__asm __volatile("sync");
    334  1.1.2.21   matt }
    335  1.1.2.21   matt 
    336  1.1.2.21   matt static inline void
    337  1.1.2.21   matt rmixlp_write_8(uint32_t tag, bus_size_t offset, uint64_t v)
    338  1.1.2.21   matt {
    339  1.1.2.21   matt 	const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase
    340  1.1.2.21   matt 	    + tag + offset;
    341  1.1.2.21   matt 
    342  1.1.2.21   matt 	*(volatile uint64_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr) = htobe64(v);
    343  1.1.2.21   matt 	__asm __volatile("sync");
    344  1.1.2.21   matt }
    345  1.1.2.21   matt 
    346  1.1.2.21   matt static inline void
    347  1.1.2.21   matt rmixl_physaddr_add(struct extent *ext, const char *name,
    348  1.1.2.21   matt     struct rmixl_region *rp, bus_addr_t xpbase, bus_size_t xsize)
    349  1.1.2.21   matt {
    350  1.1.2.21   matt 	rp->r_pbase = xpbase;
    351  1.1.2.21   matt 	rp->r_size = xsize;
    352  1.1.2.21   matt 	u_long base = xpbase >> 20;
    353  1.1.2.21   matt 	u_long size = xsize >> 20;
    354  1.1.2.21   matt 	if (extent_alloc_region(ext, base, size, EX_NOWAIT) != 0) {
    355  1.1.2.21   matt 		panic("%s: %s: extent_alloc_region(%p, %#lx, %#lx, %#x) "
    356  1.1.2.21   matt 		    "failed", __func__, name, ext, base, size, EX_NOWAIT);
    357  1.1.2.21   matt 	}
    358  1.1.2.21   matt }
    359  1.1.2.21   matt 
    360   1.1.2.6  cliff #endif	/* _MIPS_RMI_RMIXLVAR_H_ */
    361