Home | History | Annotate | Line # | Download | only in include
locore.h revision 1.78.36.1.2.21
      1  1.78.36.1.2.21      matt /* $NetBSD: locore.h,v 1.78.36.1.2.21 2010/03/01 23:54:49 matt Exp $ */
      2  1.78.36.1.2.14      matt 
      3  1.78.36.1.2.14      matt /*
      4  1.78.36.1.2.14      matt  * This file should not be included by MI code!!!
      5  1.78.36.1.2.14      matt  */
      6             1.1  jonathan 
      7             1.1  jonathan /*
      8             1.1  jonathan  * Copyright 1996 The Board of Trustees of The Leland Stanford
      9             1.1  jonathan  * Junior University. All Rights Reserved.
     10             1.1  jonathan  *
     11             1.1  jonathan  * Permission to use, copy, modify, and distribute this
     12             1.1  jonathan  * software and its documentation for any purpose and without
     13             1.1  jonathan  * fee is hereby granted, provided that the above copyright
     14             1.1  jonathan  * notice appear in all copies.  Stanford University
     15             1.1  jonathan  * makes no representations about the suitability of this
     16             1.1  jonathan  * software for any purpose.  It is provided "as is" without
     17             1.1  jonathan  * express or implied warranty.
     18             1.1  jonathan  */
     19             1.1  jonathan 
     20             1.1  jonathan /*
     21            1.68       wiz  * Jump table for MIPS CPU locore functions that are implemented
     22             1.1  jonathan  * differently on different generations, or instruction-level
     23             1.1  jonathan  * archtecture (ISA) level, the Mips family.
     24             1.1  jonathan  *
     25            1.33     soren  * We currently provide support for MIPS I and MIPS III.
     26             1.1  jonathan  */
     27             1.1  jonathan 
     28             1.1  jonathan #ifndef _MIPS_LOCORE_H
     29            1.70   tsutsui #define _MIPS_LOCORE_H
     30             1.2  jonathan 
     31            1.17    castor #ifndef _LKM
     32            1.32     soren #include "opt_cputype.h"
     33            1.17    castor #endif
     34            1.16    castor 
     35            1.59    simonb #include <mips/cpuregs.h>
     36  1.78.36.1.2.11      matt #include <mips/reg.h>
     37            1.59    simonb 
     38   1.78.36.1.2.8      matt struct tlbmask;
     39            1.38       cgd 
     40            1.59    simonb uint32_t mips_cp0_cause_read(void);
     41            1.59    simonb void	mips_cp0_cause_write(uint32_t);
     42            1.59    simonb uint32_t mips_cp0_status_read(void);
     43            1.59    simonb void	mips_cp0_status_write(uint32_t);
     44            1.29    simonb 
     45  1.78.36.1.2.16      matt void	softint_process(uint32_t);
     46  1.78.36.1.2.16      matt void	softint_fast_dispatch(struct lwp *, int);
     47  1.78.36.1.2.16      matt 
     48  1.78.36.1.2.19      matt /*
     49  1.78.36.1.2.19      matt  * Convert an address to an offset used in a MIPS jump instruction.  The offset
     50  1.78.36.1.2.19      matt  * contains the low 28 bits (allowing a jump to anywhere within the same 256MB
     51  1.78.36.1.2.19      matt  * segment of address space) of the address but since mips instructions are
     52  1.78.36.1.2.19      matt  * always on a 4 byte boundary the low 2 bits are always zero so the 28 bits
     53  1.78.36.1.2.19      matt  * get shifted right by 2 bits leaving us with a 26 bit result.  To make the
     54  1.78.36.1.2.19      matt  * offset, we shift left to clear the upper four bits and then right by 6.
     55  1.78.36.1.2.19      matt  */
     56  1.78.36.1.2.19      matt #define	fixup_addr2offset(x)	((((uint32_t)(uintptr_t)(x)) << 4) >> 6)
     57  1.78.36.1.2.16      matt typedef bool (*mips_fixup_callback_t)(int32_t, uint32_t [2]);
     58  1.78.36.1.2.19      matt struct mips_jump_fixup_info {
     59  1.78.36.1.2.19      matt 	uint32_t jfi_stub;
     60  1.78.36.1.2.19      matt 	uint32_t jfi_real;
     61  1.78.36.1.2.19      matt };
     62  1.78.36.1.2.16      matt 
     63  1.78.36.1.2.17      matt void	fixup_splcalls(void);				/* splstubs.c */
     64  1.78.36.1.2.16      matt bool	mips_fixup_exceptions(mips_fixup_callback_t);
     65  1.78.36.1.2.16      matt bool	mips_fixup_zero_relative(int32_t, uint32_t [2]);
     66  1.78.36.1.2.19      matt void	mips_fixup_stubs(uint32_t *, uint32_t *,
     67  1.78.36.1.2.19      matt 	    const struct mips_jump_fixup_info *, size_t);
     68  1.78.36.1.2.17      matt void	fixup_mips_cpu_switch_resume(void);
     69  1.78.36.1.2.17      matt 
     70  1.78.36.1.2.17      matt void	mips_cpu_switch_resume(struct lwp *);
     71            1.77   tsutsui 
     72            1.59    simonb #ifdef MIPS1
     73   1.78.36.1.2.8      matt void	mips1_tlb_set_asid(uint32_t);
     74  1.78.36.1.2.14      matt void	mips1_tlb_invalidate_all(void);
     75  1.78.36.1.2.14      matt void	mips1_tlb_invalidate_globals(void);
     76  1.78.36.1.2.14      matt void	mips1_tlb_invalidate_asids(uint32_t, uint32_t);
     77   1.78.36.1.2.8      matt void	mips1_tlb_invalidate_addr(vaddr_t);
     78  1.78.36.1.2.15      matt u_int	mips1_tlb_record_asids(u_long *, uint32_t);
     79   1.78.36.1.2.8      matt int	mips1_tlb_update(vaddr_t, uint32_t);
     80  1.78.36.1.2.16      matt void	mips1_tlb_enter(size_t, vaddr_t, uint32_t);
     81   1.78.36.1.2.8      matt void	mips1_tlb_read_indexed(size_t, struct tlbmask *);
     82            1.38       cgd void	mips1_wbflush(void);
     83            1.76      yamt void	mips1_lwp_trampoline(void);
     84       1.78.36.1       snj void	mips1_setfunc_trampoline(void);
     85  1.78.36.1.2.16      matt void	mips1_cpu_switch_resume(struct lwp *);
     86            1.38       cgd 
     87            1.58   thorpej uint32_t tx3900_cp0_config_read(void);
     88            1.59    simonb #endif
     89            1.38       cgd 
     90            1.59    simonb #if defined(MIPS3) || defined(MIPS4)
     91   1.78.36.1.2.8      matt void	mips3_tlb_set_asid(uint32_t);
     92  1.78.36.1.2.14      matt void	mips3_tlb_invalidate_all(void);
     93  1.78.36.1.2.14      matt void	mips3_tlb_invalidate_globals(void);
     94  1.78.36.1.2.14      matt void	mips3_tlb_invalidate_asids(uint32_t, uint32_t);
     95   1.78.36.1.2.8      matt void	mips3_tlb_invalidate_addr(vaddr_t);
     96  1.78.36.1.2.15      matt u_int	mips3_tlb_record_asids(u_long *, uint32_t);
     97   1.78.36.1.2.8      matt int	mips3_tlb_update(vaddr_t, uint32_t);
     98  1.78.36.1.2.16      matt void	mips3_tlb_enter(size_t, vaddr_t, uint32_t);
     99   1.78.36.1.2.8      matt void	mips3_tlb_read_indexed(size_t, struct tlbmask *);
    100   1.78.36.1.2.8      matt void	mips3_tlb_write_indexed_VPS(size_t, struct tlbmask *);
    101            1.38       cgd void	mips3_wbflush(void);
    102            1.76      yamt void	mips3_lwp_trampoline(void);
    103       1.78.36.1       snj void	mips3_setfunc_trampoline(void);
    104  1.78.36.1.2.16      matt void	mips3_cpu_switch_resume(struct lwp *);
    105            1.75  christos void	mips3_pagezero(void *dst);
    106            1.38       cgd 
    107            1.59    simonb #ifdef MIPS3_5900
    108   1.78.36.1.2.8      matt void	mips5900_tlb_set_asid(uint32_t);
    109  1.78.36.1.2.14      matt void	mips5900_tlb_invalidate_all(void);
    110  1.78.36.1.2.14      matt void	mips5900_tlb_invalidate_globals(void);
    111  1.78.36.1.2.14      matt void	mips5900_tlb_invalidate_asids(uint32_t, uint32_t);
    112   1.78.36.1.2.8      matt void	mips5900_tlb_invalidate_addr(vaddr_t);
    113  1.78.36.1.2.15      matt u_int	mips5900_tlb_record_asids(u_long *, uint32_t);
    114   1.78.36.1.2.8      matt int	mips5900_tlb_update(vaddr_t, uint32_t);
    115  1.78.36.1.2.16      matt void	mips5900_tlb_enter(size_t, vaddr_t, uint32_t);
    116   1.78.36.1.2.8      matt void	mips5900_tlb_read_indexed(size_t, struct tlbmask *);
    117   1.78.36.1.2.8      matt void	mips5900_tlb_write_indexed_VPS(size_t, struct tlbmask *);
    118            1.59    simonb void	mips5900_wbflush(void);
    119            1.76      yamt void	mips5900_lwp_trampoline(void);
    120       1.78.36.1       snj void	mips5900_setfunc_trampoline(void);
    121  1.78.36.1.2.16      matt void	mips5900_cpu_switch_resume(struct lwp *);
    122            1.75  christos void	mips5900_pagezero(void *dst);
    123            1.59    simonb #endif
    124            1.59    simonb #endif
    125            1.49       cgd 
    126            1.59    simonb #ifdef MIPS32
    127   1.78.36.1.2.8      matt void	mips32_tlb_set_asid(uint32_t);
    128  1.78.36.1.2.14      matt void	mips32_tlb_invalidate_all(void);
    129  1.78.36.1.2.14      matt void	mips32_tlb_invalidate_globals(void);
    130  1.78.36.1.2.14      matt void	mips32_tlb_invalidate_asids(uint32_t, uint32_t);
    131   1.78.36.1.2.8      matt void	mips32_tlb_invalidate_addr(vaddr_t);
    132  1.78.36.1.2.15      matt u_int	mips32_tlb_record_asids(u_long *, uint32_t);
    133   1.78.36.1.2.8      matt int	mips32_tlb_update(vaddr_t, uint32_t);
    134  1.78.36.1.2.16      matt void	mips32_tlb_enter(size_t, vaddr_t, uint32_t);
    135   1.78.36.1.2.8      matt void	mips32_tlb_read_indexed(size_t, struct tlbmask *);
    136   1.78.36.1.2.8      matt void	mips32_tlb_write_indexed_VPS(size_t, struct tlbmask *);
    137            1.59    simonb void	mips32_wbflush(void);
    138            1.76      yamt void	mips32_lwp_trampoline(void);
    139       1.78.36.1       snj void	mips32_setfunc_trampoline(void);
    140  1.78.36.1.2.16      matt void	mips32_cpu_switch_resume(struct lwp *);
    141            1.59    simonb #endif
    142            1.59    simonb 
    143            1.59    simonb #ifdef MIPS64
    144   1.78.36.1.2.8      matt void	mips64_tlb_set_asid(uint32_t);
    145  1.78.36.1.2.14      matt void	mips64_tlb_invalidate_all(void);
    146  1.78.36.1.2.14      matt void	mips64_tlb_invalidate_globals(void);
    147  1.78.36.1.2.14      matt void	mips64_tlb_invalidate_asids(uint32_t, uint32_t);
    148   1.78.36.1.2.8      matt void	mips64_tlb_invalidate_addr(vaddr_t);
    149  1.78.36.1.2.15      matt u_int	mips64_tlb_record_asids(u_long *, uint32_t);
    150   1.78.36.1.2.8      matt int	mips64_tlb_update(vaddr_t, uint32_t);
    151  1.78.36.1.2.16      matt void	mips64_tlb_enter(size_t, vaddr_t, uint32_t);
    152   1.78.36.1.2.8      matt void	mips64_tlb_read_indexed(size_t, struct tlbmask *);
    153   1.78.36.1.2.8      matt void	mips64_tlb_write_indexed_VPS(size_t, struct tlbmask *);
    154            1.59    simonb void	mips64_wbflush(void);
    155            1.76      yamt void	mips64_lwp_trampoline(void);
    156       1.78.36.1       snj void	mips64_setfunc_trampoline(void);
    157  1.78.36.1.2.16      matt void	mips64_cpu_switch_resume(struct lwp *);
    158            1.75  christos void	mips64_pagezero(void *dst);
    159            1.59    simonb #endif
    160            1.49       cgd 
    161            1.63    simonb #if defined(MIPS3) || defined(MIPS4) || defined(MIPS32) || defined(MIPS64)
    162            1.59    simonb uint32_t mips3_cp0_compare_read(void);
    163            1.59    simonb void	mips3_cp0_compare_write(uint32_t);
    164            1.49       cgd 
    165            1.59    simonb uint32_t mips3_cp0_config_read(void);
    166            1.59    simonb void	mips3_cp0_config_write(uint32_t);
    167            1.63    simonb #if defined(MIPS32) || defined(MIPS64)
    168            1.59    simonb uint32_t mipsNN_cp0_config1_read(void);
    169            1.59    simonb void	mipsNN_cp0_config1_write(uint32_t);
    170            1.63    simonb uint32_t mipsNN_cp0_config2_read(void);
    171            1.63    simonb uint32_t mipsNN_cp0_config3_read(void);
    172            1.63    simonb #endif
    173            1.59    simonb 
    174            1.59    simonb uint32_t mips3_cp0_count_read(void);
    175            1.59    simonb void	mips3_cp0_count_write(uint32_t);
    176            1.59    simonb 
    177            1.59    simonb uint32_t mips3_cp0_wired_read(void);
    178            1.59    simonb void	mips3_cp0_wired_write(uint32_t);
    179            1.69   tsutsui void	mips3_cp0_pg_mask_write(uint32_t);
    180            1.59    simonb 
    181   1.78.36.1.2.1      matt #if defined(__GNUC__) && !defined(__mips_o32)
    182   1.78.36.1.2.1      matt static inline uint64_t
    183   1.78.36.1.2.5      matt mips3_ld(const volatile uint64_t *va)
    184   1.78.36.1.2.1      matt {
    185   1.78.36.1.2.1      matt 	uint64_t rv;
    186   1.78.36.1.2.1      matt #if defined(__mips_o32)
    187   1.78.36.1.2.1      matt 	uint32_t sr;
    188   1.78.36.1.2.1      matt 
    189   1.78.36.1.2.1      matt 	sr = mips_cp0_status_read();
    190   1.78.36.1.2.1      matt 	mips_cp0_status_write(sr & ~MIPS_SR_INT_IE);
    191   1.78.36.1.2.1      matt 
    192   1.78.36.1.2.1      matt 	__asm volatile(
    193   1.78.36.1.2.1      matt 		".set push		\n\t"
    194   1.78.36.1.2.1      matt 		".set mips3		\n\t"
    195   1.78.36.1.2.1      matt 		".set noreorder		\n\t"
    196   1.78.36.1.2.1      matt 		".set noat		\n\t"
    197   1.78.36.1.2.1      matt 		"ld	%M0,0(%1)	\n\t"
    198   1.78.36.1.2.1      matt 		"dsll32	%L0,%M0,0	\n\t"
    199   1.78.36.1.2.1      matt 		"dsra32	%M0,%M0,0	\n\t"		/* high word */
    200   1.78.36.1.2.1      matt 		"dsra32	%L0,%L0,0	\n\t"		/* low word */
    201   1.78.36.1.2.1      matt 		"ld	%0,0(%1)	\n\t"
    202   1.78.36.1.2.1      matt 		".set pop"
    203   1.78.36.1.2.1      matt 	    : "=d"(rv)
    204   1.78.36.1.2.1      matt 	    : "r"(va));
    205   1.78.36.1.2.1      matt 
    206   1.78.36.1.2.1      matt 	mips_cp0_status_write(sr);
    207   1.78.36.1.2.1      matt #elif defined(_LP64)
    208   1.78.36.1.2.1      matt 	rv = *va;
    209   1.78.36.1.2.1      matt #else
    210   1.78.36.1.2.1      matt 	__asm volatile("ld	%0,0(%1)" : "=d"(rv) : "r"(va));
    211   1.78.36.1.2.1      matt #endif
    212   1.78.36.1.2.1      matt 
    213   1.78.36.1.2.1      matt 	return rv;
    214   1.78.36.1.2.1      matt }
    215   1.78.36.1.2.1      matt static inline void
    216   1.78.36.1.2.5      matt mips3_sd(volatile uint64_t *va, uint64_t v)
    217   1.78.36.1.2.1      matt {
    218   1.78.36.1.2.1      matt #if defined(__mips_o32)
    219   1.78.36.1.2.1      matt 	uint32_t sr;
    220   1.78.36.1.2.1      matt 
    221   1.78.36.1.2.1      matt 	sr = mips_cp0_status_read();
    222   1.78.36.1.2.1      matt 	mips_cp0_status_write(sr & ~MIPS_SR_INT_IE);
    223   1.78.36.1.2.1      matt 
    224   1.78.36.1.2.1      matt 	__asm volatile(
    225   1.78.36.1.2.1      matt 		".set push		\n\t"
    226   1.78.36.1.2.1      matt 		".set mips3		\n\t"
    227   1.78.36.1.2.1      matt 		".set noreorder		\n\t"
    228   1.78.36.1.2.1      matt 		".set noat		\n\t"
    229   1.78.36.1.2.1      matt 		"dsll32	%M0,%M0,0	\n\t"
    230   1.78.36.1.2.1      matt 		"dsll32	%L0,%L0,0	\n\t"
    231   1.78.36.1.2.1      matt 		"dsrl32	%L0,%L0,0	\n\t"
    232   1.78.36.1.2.1      matt 		"or	%0,%L0,%M0	\n\t"
    233   1.78.36.1.2.1      matt 		"sd	%0,0(%1)	\n\t"
    234   1.78.36.1.2.1      matt 		".set pop"
    235   1.78.36.1.2.1      matt 	    : "=d"(v) : "0"(v), "r"(va));
    236   1.78.36.1.2.1      matt 
    237   1.78.36.1.2.1      matt 	mips_cp0_status_write(sr);
    238   1.78.36.1.2.1      matt #elif defined(_LP64)
    239   1.78.36.1.2.1      matt 	*va = v;
    240   1.78.36.1.2.1      matt #else
    241   1.78.36.1.2.1      matt 	__asm volatile("sd	%0,0(%1)" :: "r"(v), "r"(va));
    242   1.78.36.1.2.1      matt #endif
    243   1.78.36.1.2.1      matt }
    244   1.78.36.1.2.1      matt #else
    245   1.78.36.1.2.5      matt uint64_t mips3_ld(volatile uint64_t *va);
    246   1.78.36.1.2.5      matt void	mips3_sd(volatile uint64_t *, uint64_t);
    247   1.78.36.1.2.1      matt #endif	/* __GNUC__ */
    248            1.63    simonb #endif	/* MIPS3 || MIPS4 || MIPS32 || MIPS64 */
    249            1.59    simonb 
    250            1.63    simonb #if defined(MIPS3) || defined(MIPS4) || defined(MIPS64)
    251            1.74     perry static __inline uint32_t	mips3_lw_a64(uint64_t addr)
    252            1.59    simonb 		    __attribute__((__unused__));
    253            1.74     perry static __inline void	mips3_sw_a64(uint64_t addr, uint32_t val)
    254            1.59    simonb 		    __attribute__ ((__unused__));
    255            1.59    simonb 
    256            1.74     perry static __inline uint32_t
    257            1.59    simonb mips3_lw_a64(uint64_t addr)
    258            1.59    simonb {
    259            1.59    simonb 	uint32_t rv;
    260   1.78.36.1.2.1      matt #if defined(__mips_o32)
    261            1.59    simonb 	uint32_t sr;
    262            1.59    simonb 
    263            1.59    simonb 	sr = mips_cp0_status_read();
    264   1.78.36.1.2.1      matt 	mips_cp0_status_write((sr & ~MIPS_SR_INT_IE) | MIPS3_SR_KX);
    265            1.59    simonb 
    266   1.78.36.1.2.1      matt 	__asm volatile (
    267   1.78.36.1.2.1      matt 		".set push		\n\t"
    268   1.78.36.1.2.1      matt 		".set mips3		\n\t"
    269   1.78.36.1.2.1      matt 		".set noreorder		\n\t"
    270   1.78.36.1.2.1      matt 		".set noat		\n\t"
    271   1.78.36.1.2.1      matt 		"dsll32	%M1,%M1,0	\n\t"
    272   1.78.36.1.2.1      matt 		"dsll32	%L1,%L1,0	\n\t"
    273  1.78.36.1.2.10     cyber 		"dsrl32	%L1,%L1,0	\n\t"
    274   1.78.36.1.2.1      matt 		"or	%1,%M1,%L1	\n\t"
    275   1.78.36.1.2.1      matt 		"lw	%0, 0(%1)	\n\t"
    276   1.78.36.1.2.1      matt 		".set pop"
    277   1.78.36.1.2.1      matt 	    : "=r"(rv), "=d"(addr)
    278   1.78.36.1.2.1      matt 	    : "1"(addr)
    279   1.78.36.1.2.1      matt 	    );
    280            1.59    simonb 
    281            1.59    simonb 	mips_cp0_status_write(sr);
    282   1.78.36.1.2.1      matt #elif defined(_LP64)
    283   1.78.36.1.2.1      matt 	rv = *(const uint32_t *)addr;
    284   1.78.36.1.2.1      matt #else
    285   1.78.36.1.2.1      matt 	__asm volatile("lw	%0, 0(%1)" : "=r"(rv) : "d"(addr));
    286   1.78.36.1.2.1      matt #endif
    287            1.59    simonb 	return (rv);
    288            1.59    simonb }
    289            1.59    simonb 
    290            1.74     perry static __inline void
    291            1.59    simonb mips3_sw_a64(uint64_t addr, uint32_t val)
    292            1.59    simonb {
    293   1.78.36.1.2.1      matt #if defined(__mips_o32)
    294            1.59    simonb 	uint32_t sr;
    295            1.59    simonb 
    296            1.59    simonb 	sr = mips_cp0_status_read();
    297   1.78.36.1.2.1      matt 	mips_cp0_status_write((sr & ~MIPS_SR_INT_IE) | MIPS3_SR_KX);
    298            1.59    simonb 
    299   1.78.36.1.2.1      matt 	__asm volatile (
    300   1.78.36.1.2.1      matt 		".set push		\n\t"
    301   1.78.36.1.2.1      matt 		".set mips3		\n\t"
    302   1.78.36.1.2.1      matt 		".set noreorder		\n\t"
    303   1.78.36.1.2.1      matt 		".set noat		\n\t"
    304   1.78.36.1.2.1      matt 		"dsll32	%M0,%M0,0	\n\t"
    305   1.78.36.1.2.1      matt 		"dsll32	%L0,%L0,0	\n\t"
    306  1.78.36.1.2.10     cyber 		"dsrl32	%L0,%L0,0	\n\t"
    307   1.78.36.1.2.1      matt 		"or	%0,%M0,%L0	\n\t"
    308   1.78.36.1.2.1      matt 		"sw	%1, 0(%0)	\n\t"
    309   1.78.36.1.2.1      matt 		".set pop"
    310   1.78.36.1.2.1      matt 	    : "=d"(addr): "r"(val), "0"(addr)
    311   1.78.36.1.2.1      matt 	    );
    312            1.44       cgd 
    313            1.59    simonb 	mips_cp0_status_write(sr);
    314   1.78.36.1.2.1      matt #elif defined(_LP64)
    315   1.78.36.1.2.1      matt 	*(uint32_t *)addr = val;
    316   1.78.36.1.2.1      matt #else
    317   1.78.36.1.2.1      matt 	__asm volatile("sw	%1, 0(%0)" :: "d"(addr), "r"(val));
    318   1.78.36.1.2.1      matt #endif
    319            1.59    simonb }
    320            1.63    simonb #endif	/* MIPS3 || MIPS4 || MIPS64 */
    321             1.7  jonathan 
    322             1.1  jonathan /*
    323            1.58   thorpej  * A vector with an entry for each mips-ISA-level dependent
    324             1.1  jonathan  * locore function, and macros which jump through it.
    325             1.1  jonathan  */
    326             1.1  jonathan typedef struct  {
    327  1.78.36.1.2.16      matt 	void	(*ljv_tlb_set_asid)(uint32_t pid);
    328  1.78.36.1.2.16      matt 	void	(*ljv_tlb_invalidate_asids)(uint32_t, uint32_t);
    329  1.78.36.1.2.16      matt 	void	(*ljv_tlb_invalidate_addr)(vaddr_t);
    330  1.78.36.1.2.16      matt 	void	(*ljv_tlb_invalidate_globals)(void);
    331  1.78.36.1.2.16      matt 	void	(*ljv_tlb_invalidate_all)(void);
    332  1.78.36.1.2.16      matt 	u_int	(*ljv_tlb_record_asids)(u_long *, uint32_t);
    333  1.78.36.1.2.16      matt 	int	(*ljv_tlb_update)(vaddr_t, uint32_t);
    334  1.78.36.1.2.16      matt 	void	(*ljv_tlb_enter)(size_t, vaddr_t, uint32_t);
    335  1.78.36.1.2.16      matt 	void	(*ljv_tlb_read_indexed)(size_t, struct tlbmask *);
    336  1.78.36.1.2.16      matt 	void	(*ljv_wbflush)(void);
    337             1.1  jonathan } mips_locore_jumpvec_t;
    338            1.13  jonathan 
    339            1.38       cgd void	mips_set_wbflush(void (*)(void));
    340            1.62    simonb void	mips_wait_idle(void);
    341             1.1  jonathan 
    342            1.38       cgd void	stacktrace(void);
    343            1.38       cgd void	logstacktrace(void);
    344             1.1  jonathan 
    345   1.78.36.1.2.2      matt struct locoresw {
    346  1.78.36.1.2.16      matt 	void		(*lsw_cpu_switch_resume)(struct lwp *);
    347  1.78.36.1.2.16      matt 	uintptr_t	lsw_lwp_trampoline;
    348  1.78.36.1.2.16      matt 	void		(*lsw_cpu_idle)(void);
    349  1.78.36.1.2.16      matt 	uintptr_t	lsw_setfunc_trampoline;
    350  1.78.36.1.2.16      matt 	int		(*lsw_send_ipi)(struct cpu_info *, int);
    351  1.78.36.1.2.16      matt 	void		(*lsw_cpu_offline_md)(void);
    352  1.78.36.1.2.21      matt 	void		(*lsw_cpu_init)(struct cpu_info *);
    353   1.78.36.1.2.2      matt };
    354   1.78.36.1.2.2      matt 
    355   1.78.36.1.2.7      matt struct mips_vmfreelist {
    356   1.78.36.1.2.7      matt 	paddr_t fl_start;
    357   1.78.36.1.2.7      matt 	paddr_t fl_end;
    358   1.78.36.1.2.7      matt 	int fl_freelist;
    359   1.78.36.1.2.7      matt };
    360   1.78.36.1.2.7      matt 
    361             1.1  jonathan /*
    362             1.1  jonathan  * The "active" locore-fuction vector, and
    363             1.1  jonathan  */
    364             1.1  jonathan extern mips_locore_jumpvec_t mips_locore_jumpvec;
    365   1.78.36.1.2.2      matt extern struct locoresw mips_locoresw;
    366             1.1  jonathan 
    367            1.59    simonb #if    defined(MIPS1) && !defined(MIPS3) && !defined(MIPS32) && !defined(MIPS64)
    368   1.78.36.1.2.8      matt #define tlb_set_asid		mips1_tlb_set_asid
    369  1.78.36.1.2.14      matt #define tlb_invalidate_asids	mips1_tlb_invalidate_asids
    370   1.78.36.1.2.8      matt #define tlb_invalidate_addr	mips1_tlb_invalidate_addr
    371  1.78.36.1.2.14      matt #define tlb_invalidate_globals	mips1_tlb_invalidate_globals
    372  1.78.36.1.2.14      matt #define tlb_invalidate_all	mips1_tlb_invalidate_all
    373  1.78.36.1.2.15      matt #define tlb_record_asids	mips1_tlb_record_asids
    374   1.78.36.1.2.8      matt #define tlb_update		mips1_tlb_update
    375  1.78.36.1.2.16      matt #define tlb_enter		mips1_tlb_enter
    376   1.78.36.1.2.8      matt #define tlb_read_indexed	mips1_tlb_read_indexed
    377  1.78.36.1.2.14      matt #define wbflush			mips1_wbflush
    378            1.76      yamt #define lwp_trampoline		mips1_lwp_trampoline
    379       1.78.36.1       snj #define setfunc_trampoline	mips1_setfunc_trampoline
    380            1.60       uch #elif !defined(MIPS1) &&  defined(MIPS3) && !defined(MIPS32) && !defined(MIPS64) && !defined(MIPS3_5900)
    381   1.78.36.1.2.8      matt #define tlb_set_asid		mips3_tlb_set_asid
    382  1.78.36.1.2.14      matt #define tlb_invalidate_asids	mips3_tlb_invalidate_asids
    383   1.78.36.1.2.8      matt #define tlb_invalidate_addr	mips3_tlb_invalidate_addr
    384  1.78.36.1.2.14      matt #define tlb_invalidate_globals	mips3_tlb_invalidate_globals
    385  1.78.36.1.2.14      matt #define tlb_invalidate_all	mips3_tlb_invalidate_all
    386  1.78.36.1.2.15      matt #define tlb_record_asids	mips3_tlb_record_asids
    387   1.78.36.1.2.8      matt #define tlb_update		mips3_tlb_update
    388  1.78.36.1.2.16      matt #define tlb_enter		mips3_tlb_enter
    389   1.78.36.1.2.8      matt #define tlb_read_indexed	mips3_tlb_read_indexed
    390   1.78.36.1.2.8      matt #define tlb_write_indexed_VPS	mips3_tlb_write_indexed_VPS
    391            1.76      yamt #define lwp_trampoline		mips3_lwp_trampoline
    392       1.78.36.1       snj #define setfunc_trampoline	mips3_setfunc_trampoline
    393  1.78.36.1.2.14      matt #define wbflush			mips3_wbflush
    394            1.59    simonb #elif !defined(MIPS1) && !defined(MIPS3) &&  defined(MIPS32) && !defined(MIPS64)
    395   1.78.36.1.2.8      matt #define tlb_set_asid		mips32_tlb_set_asid
    396  1.78.36.1.2.14      matt #define tlb_invalidate_asids	mips32_tlb_invalidate_asids
    397   1.78.36.1.2.8      matt #define tlb_invalidate_addr	mips32_tlb_invalidate_addr
    398  1.78.36.1.2.14      matt #define tlb_invalidate_globals	mips32_tlb_invalidate_globals
    399  1.78.36.1.2.14      matt #define tlb_invalidate_all	mips32_tlb_invalidate_all
    400  1.78.36.1.2.15      matt #define tlb_record_asids	mips32_tlb_record_asids
    401   1.78.36.1.2.8      matt #define tlb_update		mips32_tlb_update
    402  1.78.36.1.2.16      matt #define tlb_enter		mips32_tlb_enter
    403   1.78.36.1.2.8      matt #define tlb_read_indexed	mips32_tlb_read_indexed
    404   1.78.36.1.2.8      matt #define tlb_write_indexed_VPS	mips32_tlb_write_indexed_VPS
    405            1.76      yamt #define lwp_trampoline		mips32_lwp_trampoline
    406       1.78.36.1       snj #define setfunc_trampoline	mips32_setfunc_trampoline
    407  1.78.36.1.2.14      matt #define wbflush			mips32_wbflush
    408            1.59    simonb #elif !defined(MIPS1) && !defined(MIPS3) && !defined(MIPS32) &&  defined(MIPS64)
    409            1.59    simonb  /* all common with mips3 */
    410   1.78.36.1.2.8      matt #define tlb_set_asid		mips64_tlb_set_asid
    411  1.78.36.1.2.14      matt #define tlb_invalidate_asids	mips64_tlb_invalidate_asids
    412   1.78.36.1.2.8      matt #define tlb_invalidate_addr	mips64_tlb_invalidate_addr
    413  1.78.36.1.2.14      matt #define tlb_invalidate_globals	mips64_tlb_invalidate_globals
    414  1.78.36.1.2.14      matt #define tlb_invalidate_all	mips64_tlb_invalidate_all
    415  1.78.36.1.2.15      matt #define tlb_record_asids	mips64_tlb_record_asids
    416   1.78.36.1.2.8      matt #define tlb_update		mips64_tlb_update
    417  1.78.36.1.2.16      matt #define tlb_enter		mips64_tlb_enter
    418   1.78.36.1.2.8      matt #define tlb_read_indexed	mips64_tlb_read_indexed
    419   1.78.36.1.2.8      matt #define tlb_write_indexed_VPS	mips64_tlb_write_indexed_VPS
    420            1.76      yamt #define lwp_trampoline		mips64_lwp_trampoline
    421       1.78.36.1       snj #define setfunc_trampoline	mips64_setfunc_trampoline
    422  1.78.36.1.2.14      matt #define wbflush			mips64_wbflush
    423            1.60       uch #elif !defined(MIPS1) &&  defined(MIPS3) && !defined(MIPS32) && !defined(MIPS64) && defined(MIPS3_5900)
    424   1.78.36.1.2.8      matt #define tlb_set_asid		mips5900_tlb_set_asid
    425  1.78.36.1.2.14      matt #define tlb_invalidate_asids	mips5900_tlb_invalidate_asids
    426   1.78.36.1.2.8      matt #define tlb_invalidate_addr	mips5900_tlb_invalidate_addr
    427  1.78.36.1.2.14      matt #define tlb_invalidate_globals	mips5900_tlb_invalidate_globals
    428  1.78.36.1.2.14      matt #define tlb_invalidate_all	mips5900_tlb_invalidate_all
    429  1.78.36.1.2.15      matt #define tlb_record_asids	mips5900_tlb_record_asids
    430   1.78.36.1.2.8      matt #define tlb_update		mips5900_tlb_update
    431  1.78.36.1.2.16      matt #define tlb_enter		mips5900_tlb_enter
    432   1.78.36.1.2.8      matt #define tlb_read_indexed	mips5900_tlb_read_indexed
    433   1.78.36.1.2.8      matt #define tlb_write_indexed_VPS	mips5900_tlb_write_indexed_VPS
    434            1.76      yamt #define lwp_trampoline		mips5900_lwp_trampoline
    435       1.78.36.1       snj #define setfunc_trampoline	mips5900_setfunc_trampoline
    436  1.78.36.1.2.14      matt #define wbflush			mips5900_wbflush
    437            1.59    simonb #else
    438  1.78.36.1.2.14      matt #define tlb_set_asid		(*mips_locore_jumpvec.ljv_tlb_set_asid)
    439  1.78.36.1.2.14      matt #define tlb_invalidate_asids	(*mips_locore_jumpvec.ljv_tlb_invalidate_asids)
    440  1.78.36.1.2.14      matt #define tlb_invalidate_addr	(*mips_locore_jumpvec.ljv_tlb_invalidate_addr)
    441  1.78.36.1.2.14      matt #define tlb_invalidate_globals	(*mips_locore_jumpvec.ljv_tlb_invalidate_globals)
    442  1.78.36.1.2.14      matt #define tlb_invalidate_all	(*mips_locore_jumpvec.ljv_tlb_invalidate_all)
    443  1.78.36.1.2.15      matt #define tlb_record_asids	(*mips_locore_jumpvec.ljv_tlb_record_asids)
    444  1.78.36.1.2.14      matt #define tlb_update		(*mips_locore_jumpvec.ljv_tlb_update)
    445  1.78.36.1.2.16      matt #define tlb_enter		(*mips_locore_jumpvec.ljv_tlb_enter)
    446  1.78.36.1.2.14      matt #define tlb_read_indexed	(*mips_locore_jumpvec.ljv_tlb_read_indexed)
    447  1.78.36.1.2.14      matt #define wbflush			(*mips_locore_jumpvec.ljv_wbflush)
    448   1.78.36.1.2.2      matt #define lwp_trampoline		mips_locoresw.lsw_lwp_trampoline
    449   1.78.36.1.2.2      matt #define setfunc_trampoline	mips_locoresw.lsw_setfunc_trampoline
    450            1.11  jonathan #endif
    451            1.31  nisimura 
    452   1.78.36.1.2.2      matt #define CPU_IDLE		mips_locoresw.lsw_cpu_idle
    453            1.11  jonathan 
    454            1.16    castor /* cpu_switch_resume is called inside locore.S */
    455             1.7  jonathan 
    456             1.7  jonathan /*
    457             1.7  jonathan  * CPU identification, from PRID register.
    458             1.7  jonathan  */
    459            1.70   tsutsui #define MIPS_PRID_REV(x)	(((x) >>  0) & 0x00ff)
    460            1.70   tsutsui #define MIPS_PRID_IMPL(x)	(((x) >>  8) & 0x00ff)
    461            1.45       cgd 
    462            1.59    simonb /* pre-MIPS32/64 */
    463            1.70   tsutsui #define MIPS_PRID_RSVD(x)	(((x) >> 16) & 0xffff)
    464            1.70   tsutsui #define MIPS_PRID_REV_MIN(x)	((MIPS_PRID_REV(x) >> 0) & 0x0f)
    465            1.70   tsutsui #define MIPS_PRID_REV_MAJ(x)	((MIPS_PRID_REV(x) >> 4) & 0x0f)
    466            1.45       cgd 
    467            1.59    simonb /* MIPS32/64 */
    468            1.70   tsutsui #define MIPS_PRID_CID(x)	(((x) >> 16) & 0x00ff)	/* Company ID */
    469            1.70   tsutsui #define     MIPS_PRID_CID_PREHISTORIC	0x00	/* Not MIPS32/64 */
    470            1.70   tsutsui #define     MIPS_PRID_CID_MTI		0x01	/* MIPS Technologies, Inc. */
    471            1.70   tsutsui #define     MIPS_PRID_CID_BROADCOM	0x02	/* Broadcom */
    472            1.70   tsutsui #define     MIPS_PRID_CID_ALCHEMY	0x03	/* Alchemy Semiconductor */
    473            1.70   tsutsui #define     MIPS_PRID_CID_SIBYTE	0x04	/* SiByte */
    474            1.70   tsutsui #define     MIPS_PRID_CID_SANDCRAFT	0x05	/* SandCraft */
    475            1.70   tsutsui #define     MIPS_PRID_CID_PHILIPS	0x06	/* Philips */
    476            1.70   tsutsui #define     MIPS_PRID_CID_TOSHIBA	0x07	/* Toshiba */
    477            1.70   tsutsui #define     MIPS_PRID_CID_LSI		0x08	/* LSI */
    478            1.67    simonb 				/*	0x09	unannounced */
    479            1.67    simonb 				/*	0x0a	unannounced */
    480            1.70   tsutsui #define     MIPS_PRID_CID_LEXRA		0x0b	/* Lexra */
    481   1.78.36.1.2.3      matt #define     MIPS_PRID_CID_RMI		0x0c	/* RMI / NetLogic */
    482            1.70   tsutsui #define MIPS_PRID_COPTS(x)	(((x) >> 24) & 0x00ff)	/* Company Options */
    483             1.6  jonathan 
    484             1.6  jonathan #ifdef _KERNEL
    485             1.6  jonathan /*
    486             1.6  jonathan  * Global variables used to communicate CPU type, and parameters
    487             1.6  jonathan  * such as cache size, from locore to higher-level code (e.g., pmap).
    488             1.6  jonathan  */
    489            1.75  christos void mips_pagecopy(void *dst, void *src);
    490            1.75  christos void mips_pagezero(void *dst);
    491            1.19  jonathan 
    492            1.59    simonb #ifdef __HAVE_MIPS_MACHDEP_CACHE_CONFIG
    493            1.59    simonb void mips_machdep_cache_config(void);
    494            1.59    simonb #endif
    495            1.59    simonb 
    496            1.19  jonathan /*
    497            1.20    simonb  * trapframe argument passed to trap()
    498            1.19  jonathan  */
    499            1.64   thorpej 
    500  1.78.36.1.2.11      matt #if 0
    501  1.78.36.1.2.11      matt #define TF_AST		0		/* really zero */
    502  1.78.36.1.2.11      matt #define TF_V0		_R_V0
    503  1.78.36.1.2.11      matt #define TF_V1		_R_V1
    504  1.78.36.1.2.11      matt #define TF_A0		_R_A0
    505  1.78.36.1.2.11      matt #define TF_A1		_R_A1
    506  1.78.36.1.2.11      matt #define TF_A2		_R_A2
    507  1.78.36.1.2.11      matt #define TF_A3		_R_A3
    508  1.78.36.1.2.11      matt #define TF_T0		_R_T0
    509  1.78.36.1.2.11      matt #define TF_T1		_R_T1
    510  1.78.36.1.2.11      matt #define TF_T2		_R_T2
    511  1.78.36.1.2.11      matt #define TF_T3		_R_T3
    512            1.64   thorpej 
    513            1.64   thorpej #if defined(__mips_n32) || defined(__mips_n64)
    514  1.78.36.1.2.11      matt #define TF_A4		_R_A4
    515  1.78.36.1.2.11      matt #define TF_A5		_R_A5
    516  1.78.36.1.2.11      matt #define TF_A6		_R_A6
    517  1.78.36.1.2.11      matt #define TF_A7		_R_A7
    518            1.64   thorpej #else
    519  1.78.36.1.2.11      matt #define TF_T4		_R_T4
    520  1.78.36.1.2.11      matt #define TF_T5		_R_T5
    521  1.78.36.1.2.11      matt #define TF_T6		_R_T6
    522  1.78.36.1.2.11      matt #define TF_T7		_R_T7
    523            1.64   thorpej #endif /* __mips_n32 || __mips_n64 */
    524            1.64   thorpej 
    525  1.78.36.1.2.11      matt #define TF_TA0		_R_TA0
    526  1.78.36.1.2.11      matt #define TF_TA1		_R_TA1
    527  1.78.36.1.2.11      matt #define TF_TA2		_R_TA2
    528  1.78.36.1.2.11      matt #define TF_TA3		_R_TA3
    529  1.78.36.1.2.11      matt 
    530  1.78.36.1.2.11      matt #define TF_T8		_R_T8
    531  1.78.36.1.2.11      matt #define TF_T9		_R_T9
    532  1.78.36.1.2.11      matt 
    533  1.78.36.1.2.11      matt #define TF_RA		_R_RA
    534  1.78.36.1.2.11      matt #define TF_SR		_R_SR
    535  1.78.36.1.2.11      matt #define TF_MULLO	_R_MULLO
    536  1.78.36.1.2.11      matt #define TF_MULHI	_R_MULLO
    537  1.78.36.1.2.11      matt #define TF_EPC		_R_PC		/* may be changed by trap() call */
    538            1.65   thorpej 
    539  1.78.36.1.2.11      matt #define	TF_NREGS	(sizeof(struct reg) / sizeof(mips_reg_t))
    540  1.78.36.1.2.11      matt #endif
    541            1.64   thorpej 
    542            1.19  jonathan struct trapframe {
    543  1.78.36.1.2.11      matt 	struct reg tf_registers;
    544  1.78.36.1.2.11      matt #define	tf_regs	tf_registers.r_regs
    545   1.78.36.1.2.2      matt 	uint32_t   tf_ppl;		/* previous priority level */
    546   1.78.36.1.2.2      matt 	mips_reg_t tf_pad;		/* for 8 byte aligned */
    547            1.19  jonathan };
    548            1.19  jonathan 
    549  1.78.36.1.2.11      matt CTASSERT(sizeof(struct trapframe) % (4*sizeof(mips_reg_t)) == 0);
    550  1.78.36.1.2.11      matt 
    551            1.19  jonathan /*
    552            1.19  jonathan  * Stack frame for kernel traps. four args passed in registers.
    553            1.19  jonathan  * A trapframe is pointed to by the 5th arg, and a dummy sixth argument
    554            1.19  jonathan  * is used to avoid alignment problems
    555            1.19  jonathan  */
    556            1.19  jonathan 
    557            1.19  jonathan struct kernframe {
    558   1.78.36.1.2.1      matt #if defined(__mips_o32) || defined(__mips_o64)
    559            1.19  jonathan 	register_t cf_args[4 + 1];
    560   1.78.36.1.2.1      matt #if defined(__mips_o32)
    561  1.78.36.1.2.11      matt 	register_t cf_pad;		/* (for 8 byte alignment) */
    562   1.78.36.1.2.1      matt #endif
    563   1.78.36.1.2.1      matt #endif
    564   1.78.36.1.2.1      matt #if defined(__mips_n32) || defined(__mips_n64)
    565   1.78.36.1.2.4      matt 	register_t cf_pad[2];		/* for 16 byte alignment */
    566   1.78.36.1.2.1      matt #endif
    567            1.19  jonathan 	register_t cf_sp;
    568            1.19  jonathan 	register_t cf_ra;
    569            1.19  jonathan 	struct trapframe cf_frame;
    570            1.19  jonathan };
    571  1.78.36.1.2.11      matt 
    572  1.78.36.1.2.11      matt CTASSERT(sizeof(struct kernframe) % (2*sizeof(mips_reg_t)) == 0);
    573  1.78.36.1.2.11      matt 
    574  1.78.36.1.2.18      matt /*
    575  1.78.36.1.2.18      matt  * PRocessor IDentity TABle
    576  1.78.36.1.2.18      matt  */
    577  1.78.36.1.2.18      matt 
    578  1.78.36.1.2.18      matt struct pridtab {
    579  1.78.36.1.2.18      matt 	int	cpu_cid;
    580  1.78.36.1.2.18      matt 	int	cpu_pid;
    581  1.78.36.1.2.18      matt 	int	cpu_rev;	/* -1 == wildcard */
    582  1.78.36.1.2.18      matt 	int	cpu_copts;	/* -1 == wildcard */
    583  1.78.36.1.2.18      matt 	int	cpu_isa;	/* -1 == probed (mips32/mips64) */
    584  1.78.36.1.2.18      matt 	int	cpu_ntlb;	/* -1 == unknown, 0 == probed */
    585  1.78.36.1.2.18      matt 	int	cpu_flags;
    586  1.78.36.1.2.18      matt 	u_int	cpu_cp0flags;	/* presence of some cp0 regs */
    587  1.78.36.1.2.18      matt 	u_int	cpu_cidflags;	/* company-specific flags */
    588  1.78.36.1.2.18      matt 	const char	*cpu_name;
    589  1.78.36.1.2.18      matt };
    590  1.78.36.1.2.18      matt 
    591  1.78.36.1.2.18      matt /*
    592  1.78.36.1.2.18      matt  * bitfield defines for cpu_cp0flags
    593  1.78.36.1.2.18      matt  */
    594  1.78.36.1.2.18      matt #define  MIPS_CP0FL_USE		__BIT(0)	/* use these flags */
    595  1.78.36.1.2.18      matt #define  MIPS_CP0FL_ECC		__BIT(1)
    596  1.78.36.1.2.18      matt #define  MIPS_CP0FL_CACHE_ERR	__BIT(2)
    597  1.78.36.1.2.18      matt #define  MIPS_CP0FL_EIRR	__BIT(3)
    598  1.78.36.1.2.18      matt #define  MIPS_CP0FL_EIMR	__BIT(4)
    599  1.78.36.1.2.18      matt #define  MIPS_CP0FL_EBASE	__BIT(5)
    600  1.78.36.1.2.18      matt #define  MIPS_CP0FL_CONFIG	__BIT(6)
    601  1.78.36.1.2.18      matt #define  MIPS_CP0FL_CONFIGn(n)	(__BIT(7) << ((n) & 7))
    602  1.78.36.1.2.18      matt 
    603  1.78.36.1.2.18      matt /*
    604  1.78.36.1.2.18      matt  * cpu_cidflags defines, by company
    605  1.78.36.1.2.18      matt  */
    606  1.78.36.1.2.18      matt /*
    607  1.78.36.1.2.18      matt  * RMI company-specific cpu_cidflags
    608  1.78.36.1.2.18      matt  */
    609  1.78.36.1.2.18      matt #define MIPS_CIDFL_RMI_TYPE     	__BITS(2,0)
    610  1.78.36.1.2.18      matt # define  CIDFL_RMI_TYPE_XLR     	0
    611  1.78.36.1.2.18      matt # define  CIDFL_RMI_TYPE_XLS     	1
    612  1.78.36.1.2.18      matt # define  CIDFL_RMI_TYPE_XLP     	2
    613  1.78.36.1.2.18      matt #define MIPS_CIDFL_RMI_THREADS_MASK	__BITS(6,3)
    614  1.78.36.1.2.18      matt # define MIPS_CIDFL_RMI_THREADS_SHIFT	3
    615  1.78.36.1.2.18      matt #define MIPS_CIDFL_RMI_CORES_MASK	__BITS(10,7)
    616  1.78.36.1.2.18      matt # define MIPS_CIDFL_RMI_CORES_SHIFT	7
    617  1.78.36.1.2.18      matt # define LOG2_1	0
    618  1.78.36.1.2.18      matt # define LOG2_2	1
    619  1.78.36.1.2.18      matt # define LOG2_4	2
    620  1.78.36.1.2.18      matt # define LOG2_8	3
    621  1.78.36.1.2.18      matt # define MIPS_CIDFL_RMI_CPUS(ncores, nthreads)				\
    622  1.78.36.1.2.18      matt 		((LOG2_ ## ncores << MIPS_CIDFL_RMI_CORES_SHIFT)	\
    623  1.78.36.1.2.18      matt 		|(LOG2_ ## nthreads << MIPS_CIDFL_RMI_THREADS_SHIFT))
    624  1.78.36.1.2.18      matt # define MIPS_CIDFL_RMI_NTHREADS(cidfl)					\
    625  1.78.36.1.2.18      matt 		(1 << (((cidfl) & MIPS_CIDFL_RMI_THREADS_MASK)		\
    626  1.78.36.1.2.18      matt 			>> MIPS_CIDFL_RMI_THREADS_SHIFT))
    627  1.78.36.1.2.18      matt # define MIPS_CIDFL_RMI_NCORES(cidfl)					\
    628  1.78.36.1.2.18      matt 		(1 << (((cidfl) & MIPS_CIDFL_RMI_CORES_MASK)		\
    629  1.78.36.1.2.18      matt 			>> MIPS_CIDFL_RMI_CORES_SHIFT))
    630  1.78.36.1.2.18      matt #define MIPS_CIDFL_RMI_L2SZ_MASK	__BITS(14,11)
    631  1.78.36.1.2.18      matt # define MIPS_CIDFL_RMI_L2SZ_SHIFT	11
    632  1.78.36.1.2.18      matt # define RMI_L2SZ_256KB	 0
    633  1.78.36.1.2.18      matt # define RMI_L2SZ_512KB  1
    634  1.78.36.1.2.18      matt # define RMI_L2SZ_1MB    2
    635  1.78.36.1.2.18      matt # define RMI_L2SZ_2MB    3
    636  1.78.36.1.2.18      matt # define RMI_L2SZ_4MB    4
    637  1.78.36.1.2.18      matt # define MIPS_CIDFL_RMI_L2(l2sz)					\
    638  1.78.36.1.2.18      matt 		(RMI_L2SZ_ ## l2sz << MIPS_CIDFL_RMI_L2SZ_SHIFT)
    639  1.78.36.1.2.18      matt # define MIPS_CIDFL_RMI_L2SZ(cidfl)					\
    640  1.78.36.1.2.18      matt 		((256*1024) << (((cidfl) & MIPS_CIDFL_RMI_L2SZ_MASK)	\
    641  1.78.36.1.2.18      matt 			>> MIPS_CIDFL_RMI_L2SZ_SHIFT))
    642  1.78.36.1.2.18      matt 
    643            1.61    simonb #endif	/* _KERNEL */
    644             1.1  jonathan #endif	/* _MIPS_LOCORE_H */
    645