Home | History | Annotate | Line # | Download | only in include
locore.h revision 1.81.6.1
      1  1.81.6.1    bouyer /* $NetBSD: locore.h,v 1.81.6.1 2011/02/08 16:19:28 bouyer Exp $ */
      2       1.1  jonathan 
      3       1.1  jonathan /*
      4       1.1  jonathan  * Copyright 1996 The Board of Trustees of The Leland Stanford
      5       1.1  jonathan  * Junior University. All Rights Reserved.
      6       1.1  jonathan  *
      7       1.1  jonathan  * Permission to use, copy, modify, and distribute this
      8       1.1  jonathan  * software and its documentation for any purpose and without
      9       1.1  jonathan  * fee is hereby granted, provided that the above copyright
     10       1.1  jonathan  * notice appear in all copies.  Stanford University
     11       1.1  jonathan  * makes no representations about the suitability of this
     12       1.1  jonathan  * software for any purpose.  It is provided "as is" without
     13       1.1  jonathan  * express or implied warranty.
     14       1.1  jonathan  */
     15       1.1  jonathan 
     16       1.1  jonathan /*
     17      1.68       wiz  * Jump table for MIPS CPU locore functions that are implemented
     18       1.1  jonathan  * differently on different generations, or instruction-level
     19      1.81       snj  * architecture (ISA) level, the Mips family.
     20       1.1  jonathan  *
     21      1.33     soren  * We currently provide support for MIPS I and MIPS III.
     22       1.1  jonathan  */
     23       1.1  jonathan 
     24       1.1  jonathan #ifndef _MIPS_LOCORE_H
     25      1.70   tsutsui #define _MIPS_LOCORE_H
     26       1.2  jonathan 
     27      1.17    castor #ifndef _LKM
     28      1.32     soren #include "opt_cputype.h"
     29      1.17    castor #endif
     30      1.16    castor 
     31      1.59    simonb #include <mips/cpuregs.h>
     32      1.59    simonb 
     33      1.38       cgd struct tlb;
     34      1.38       cgd 
     35      1.59    simonb uint32_t mips_cp0_cause_read(void);
     36      1.59    simonb void	mips_cp0_cause_write(uint32_t);
     37      1.59    simonb uint32_t mips_cp0_status_read(void);
     38      1.59    simonb void	mips_cp0_status_write(uint32_t);
     39      1.29    simonb 
     40      1.77   tsutsui int _splraise(int);
     41      1.77   tsutsui int _spllower(int);
     42      1.77   tsutsui int _splset(int);
     43      1.77   tsutsui int _splget(void);
     44      1.77   tsutsui void _splnone(void);
     45      1.77   tsutsui void _setsoftintr(int);
     46      1.77   tsutsui void _clrsoftintr(int);
     47      1.77   tsutsui 
     48      1.59    simonb #ifdef MIPS1
     49      1.54    simonb void	mips1_SetPID(int);
     50      1.38       cgd void	mips1_TBIA(int);
     51      1.38       cgd void	mips1_TBIAP(int);
     52      1.38       cgd void	mips1_TBIS(vaddr_t);
     53      1.80      matt int	mips1_TLBUpdate(vaddr_t, uint32_t);
     54      1.38       cgd void	mips1_wbflush(void);
     55      1.76      yamt void	mips1_lwp_trampoline(void);
     56      1.79    martin void	mips1_setfunc_trampoline(void);
     57      1.38       cgd void	mips1_cpu_switch_resume(void);
     58      1.38       cgd 
     59      1.58   thorpej uint32_t tx3900_cp0_config_read(void);
     60      1.59    simonb #endif
     61      1.38       cgd 
     62      1.59    simonb #if defined(MIPS3) || defined(MIPS4)
     63      1.54    simonb void	mips3_SetPID(int);
     64      1.38       cgd void	mips3_TBIA(int);
     65      1.38       cgd void	mips3_TBIAP(int);
     66      1.38       cgd void	mips3_TBIS(vaddr_t);
     67      1.80      matt int	mips3_TLBUpdate(vaddr_t, uint32_t);
     68      1.38       cgd void	mips3_TLBRead(int, struct tlb *);
     69      1.71   tsutsui void	mips3_TLBWriteIndexedVPS(int, struct tlb *);
     70      1.38       cgd void	mips3_wbflush(void);
     71      1.76      yamt void	mips3_lwp_trampoline(void);
     72      1.79    martin void	mips3_setfunc_trampoline(void);
     73      1.38       cgd void	mips3_cpu_switch_resume(void);
     74      1.75  christos void	mips3_pagezero(void *dst);
     75      1.38       cgd 
     76      1.59    simonb #ifdef MIPS3_5900
     77      1.59    simonb void	mips5900_SetPID(int);
     78      1.59    simonb void	mips5900_TBIA(int);
     79      1.59    simonb void	mips5900_TBIAP(int);
     80      1.59    simonb void	mips5900_TBIS(vaddr_t);
     81      1.80      matt int	mips5900_TLBUpdate(vaddr_t, uint32_t);
     82      1.59    simonb void	mips5900_TLBRead(int, struct tlb *);
     83      1.71   tsutsui void	mips5900_TLBWriteIndexedVPS(int, struct tlb *);
     84      1.59    simonb void	mips5900_wbflush(void);
     85      1.76      yamt void	mips5900_lwp_trampoline(void);
     86      1.79    martin void	mips5900_setfunc_trampoline(void);
     87      1.59    simonb void	mips5900_cpu_switch_resume(void);
     88      1.75  christos void	mips5900_pagezero(void *dst);
     89      1.59    simonb #endif
     90      1.59    simonb #endif
     91      1.49       cgd 
     92      1.59    simonb #ifdef MIPS32
     93      1.59    simonb void	mips32_SetPID(int);
     94      1.59    simonb void	mips32_TBIA(int);
     95      1.59    simonb void	mips32_TBIAP(int);
     96      1.59    simonb void	mips32_TBIS(vaddr_t);
     97      1.80      matt int	mips32_TLBUpdate(vaddr_t, uint32_t);
     98      1.59    simonb void	mips32_TLBRead(int, struct tlb *);
     99      1.71   tsutsui void	mips32_TLBWriteIndexedVPS(int, struct tlb *);
    100      1.59    simonb void	mips32_wbflush(void);
    101      1.76      yamt void	mips32_lwp_trampoline(void);
    102      1.79    martin void	mips32_setfunc_trampoline(void);
    103      1.59    simonb void	mips32_cpu_switch_resume(void);
    104      1.59    simonb #endif
    105      1.59    simonb 
    106      1.59    simonb #ifdef MIPS64
    107      1.59    simonb void	mips64_SetPID(int);
    108      1.59    simonb void	mips64_TBIA(int);
    109      1.59    simonb void	mips64_TBIAP(int);
    110      1.59    simonb void	mips64_TBIS(vaddr_t);
    111      1.80      matt int	mips64_TLBUpdate(vaddr_t, uint32_t);
    112      1.59    simonb void	mips64_TLBRead(int, struct tlb *);
    113      1.71   tsutsui void	mips64_TLBWriteIndexedVPS(int, struct tlb *);
    114      1.59    simonb void	mips64_wbflush(void);
    115      1.76      yamt void	mips64_lwp_trampoline(void);
    116      1.79    martin void	mips64_setfunc_trampoline(void);
    117      1.59    simonb void	mips64_cpu_switch_resume(void);
    118      1.75  christos void	mips64_pagezero(void *dst);
    119      1.59    simonb #endif
    120      1.49       cgd 
    121      1.63    simonb #if defined(MIPS3) || defined(MIPS4) || defined(MIPS32) || defined(MIPS64)
    122      1.59    simonb uint32_t mips3_cp0_compare_read(void);
    123      1.59    simonb void	mips3_cp0_compare_write(uint32_t);
    124      1.49       cgd 
    125      1.59    simonb uint32_t mips3_cp0_config_read(void);
    126      1.59    simonb void	mips3_cp0_config_write(uint32_t);
    127      1.63    simonb #if defined(MIPS32) || defined(MIPS64)
    128      1.59    simonb uint32_t mipsNN_cp0_config1_read(void);
    129      1.59    simonb void	mipsNN_cp0_config1_write(uint32_t);
    130      1.63    simonb uint32_t mipsNN_cp0_config2_read(void);
    131      1.63    simonb uint32_t mipsNN_cp0_config3_read(void);
    132      1.63    simonb #endif
    133      1.59    simonb 
    134      1.59    simonb uint32_t mips3_cp0_count_read(void);
    135      1.59    simonb void	mips3_cp0_count_write(uint32_t);
    136      1.59    simonb 
    137      1.59    simonb uint32_t mips3_cp0_wired_read(void);
    138      1.59    simonb void	mips3_cp0_wired_write(uint32_t);
    139      1.69   tsutsui void	mips3_cp0_pg_mask_write(uint32_t);
    140      1.59    simonb 
    141      1.80      matt #if defined(__GNUC__) && !defined(__mips_o32)
    142      1.80      matt static inline uint64_t
    143      1.80      matt mips3_ld(const volatile uint64_t *va)
    144      1.80      matt {
    145      1.80      matt 	uint64_t rv;
    146      1.80      matt #if defined(__mips_o32)
    147      1.80      matt 	uint32_t sr;
    148      1.80      matt 
    149      1.80      matt 	sr = mips_cp0_status_read();
    150      1.80      matt 	mips_cp0_status_write(sr & ~MIPS_SR_INT_IE);
    151      1.80      matt 
    152      1.80      matt 	__asm volatile(
    153      1.80      matt 		".set push		\n\t"
    154      1.80      matt 		".set mips3		\n\t"
    155      1.80      matt 		".set noreorder		\n\t"
    156      1.80      matt 		".set noat		\n\t"
    157      1.80      matt 		"ld	%M0,0(%1)	\n\t"
    158      1.80      matt 		"dsll32	%L0,%M0,0	\n\t"
    159      1.80      matt 		"dsra32	%M0,%M0,0	\n\t"		/* high word */
    160      1.80      matt 		"dsra32	%L0,%L0,0	\n\t"		/* low word */
    161      1.80      matt 		"ld	%0,0(%1)	\n\t"
    162      1.80      matt 		".set pop"
    163      1.80      matt 	    : "=d"(rv)
    164      1.80      matt 	    : "r"(va));
    165      1.80      matt 
    166      1.80      matt 	mips_cp0_status_write(sr);
    167      1.80      matt #elif defined(_LP64)
    168      1.80      matt 	rv = *va;
    169      1.80      matt #else
    170      1.80      matt 	__asm volatile("ld	%0,0(%1)" : "=d"(rv) : "r"(va));
    171      1.80      matt #endif
    172      1.80      matt 
    173      1.80      matt 	return rv;
    174      1.80      matt }
    175      1.80      matt static inline void
    176      1.80      matt mips3_sd(volatile uint64_t *va, uint64_t v)
    177      1.80      matt {
    178      1.80      matt #if defined(__mips_o32)
    179      1.80      matt 	uint32_t sr;
    180      1.80      matt 
    181      1.80      matt 	sr = mips_cp0_status_read();
    182      1.80      matt 	mips_cp0_status_write(sr & ~MIPS_SR_INT_IE);
    183      1.80      matt 
    184      1.80      matt 	__asm volatile(
    185      1.80      matt 		".set push		\n\t"
    186      1.80      matt 		".set mips3		\n\t"
    187      1.80      matt 		".set noreorder		\n\t"
    188      1.80      matt 		".set noat		\n\t"
    189      1.80      matt 		"dsll32	%M0,%M0,0	\n\t"
    190      1.80      matt 		"dsll32	%L0,%L0,0	\n\t"
    191      1.80      matt 		"dsrl32	%L0,%L0,0	\n\t"
    192      1.80      matt 		"or	%0,%L0,%M0	\n\t"
    193      1.80      matt 		"sd	%0,0(%1)	\n\t"
    194      1.80      matt 		".set pop"
    195      1.80      matt 	    : "=d"(v) : "0"(v), "r"(va));
    196      1.80      matt 
    197      1.80      matt 	mips_cp0_status_write(sr);
    198      1.80      matt #elif defined(_LP64)
    199      1.80      matt 	*va = v;
    200      1.80      matt #else
    201      1.80      matt 	__asm volatile("sd	%0,0(%1)" :: "r"(v), "r"(va));
    202      1.80      matt #endif
    203      1.80      matt }
    204      1.80      matt #else
    205      1.80      matt uint64_t mips3_ld(volatile uint64_t *va);
    206      1.80      matt void	mips3_sd(volatile uint64_t *, uint64_t);
    207      1.80      matt #endif	/* __GNUC__ */
    208      1.63    simonb #endif	/* MIPS3 || MIPS4 || MIPS32 || MIPS64 */
    209      1.59    simonb 
    210      1.63    simonb #if defined(MIPS3) || defined(MIPS4) || defined(MIPS64)
    211      1.74     perry static __inline uint32_t	mips3_lw_a64(uint64_t addr)
    212      1.59    simonb 		    __attribute__((__unused__));
    213      1.74     perry static __inline void	mips3_sw_a64(uint64_t addr, uint32_t val)
    214      1.59    simonb 		    __attribute__ ((__unused__));
    215      1.59    simonb 
    216      1.74     perry static __inline uint32_t
    217      1.59    simonb mips3_lw_a64(uint64_t addr)
    218      1.59    simonb {
    219      1.59    simonb 	uint32_t rv;
    220      1.80      matt #if defined(__mips_o32)
    221      1.59    simonb 	uint32_t sr;
    222      1.59    simonb 
    223      1.59    simonb 	sr = mips_cp0_status_read();
    224      1.80      matt 	mips_cp0_status_write((sr & ~MIPS_SR_INT_IE) | MIPS3_SR_KX);
    225      1.59    simonb 
    226      1.80      matt 	__asm volatile (
    227      1.80      matt 		".set push		\n\t"
    228      1.80      matt 		".set mips3		\n\t"
    229      1.80      matt 		".set noreorder		\n\t"
    230      1.80      matt 		".set noat		\n\t"
    231      1.80      matt 		"dsll32	%M1,%M1,0	\n\t"
    232      1.80      matt 		"dsll32	%L1,%L1,0	\n\t"
    233      1.80      matt 		"dsrl32	$L1,%L1,0	\n\t"
    234      1.80      matt 		"or	%1,%M1,%L1	\n\t"
    235      1.80      matt 		"lw	%0, 0(%1)	\n\t"
    236      1.80      matt 		".set pop"
    237      1.80      matt 	    : "=r"(rv), "=d"(addr)
    238      1.80      matt 	    : "1"(addr)
    239      1.80      matt 	    );
    240      1.59    simonb 
    241      1.59    simonb 	mips_cp0_status_write(sr);
    242      1.80      matt #elif defined(_LP64)
    243      1.80      matt 	rv = *(const uint32_t *)addr;
    244      1.80      matt #else
    245      1.80      matt 	__asm volatile("lw	%0, 0(%1)" : "=r"(rv) : "d"(addr));
    246      1.80      matt #endif
    247      1.59    simonb 	return (rv);
    248      1.59    simonb }
    249      1.59    simonb 
    250      1.74     perry static __inline void
    251      1.59    simonb mips3_sw_a64(uint64_t addr, uint32_t val)
    252      1.59    simonb {
    253      1.80      matt #if defined(__mips_o32)
    254      1.59    simonb 	uint32_t sr;
    255      1.59    simonb 
    256      1.59    simonb 	sr = mips_cp0_status_read();
    257      1.80      matt 	mips_cp0_status_write((sr & ~MIPS_SR_INT_IE) | MIPS3_SR_KX);
    258      1.59    simonb 
    259      1.80      matt 	__asm volatile (
    260      1.80      matt 		".set push		\n\t"
    261      1.80      matt 		".set mips3		\n\t"
    262      1.80      matt 		".set noreorder		\n\t"
    263      1.80      matt 		".set noat		\n\t"
    264      1.80      matt 		"dsll32	%M0,%M0,0	\n\t"
    265      1.80      matt 		"dsll32	%L0,%L0,0	\n\t"
    266      1.80      matt 		"dsrl32	$L0,%L0,0	\n\t"
    267      1.80      matt 		"or	%0,%M0,%L0	\n\t"
    268      1.80      matt 		"sw	%1, 0(%0)	\n\t"
    269      1.80      matt 		".set pop"
    270      1.80      matt 	    : "=d"(addr): "r"(val), "0"(addr)
    271      1.80      matt 	    );
    272      1.44       cgd 
    273      1.59    simonb 	mips_cp0_status_write(sr);
    274      1.80      matt #elif defined(_LP64)
    275      1.80      matt 	*(uint32_t *)addr = val;
    276      1.80      matt #else
    277      1.80      matt 	__asm volatile("sw	%1, 0(%0)" :: "d"(addr), "r"(val));
    278      1.80      matt #endif
    279      1.59    simonb }
    280      1.63    simonb #endif	/* MIPS3 || MIPS4 || MIPS64 */
    281       1.7  jonathan 
    282       1.1  jonathan /*
    283      1.58   thorpej  * A vector with an entry for each mips-ISA-level dependent
    284       1.1  jonathan  * locore function, and macros which jump through it.
    285      1.58   thorpej  *
    286       1.1  jonathan  * XXX the macro names are chosen to be compatible with the old
    287      1.58   thorpej  * XXX Sprite coding-convention names used in 4.4bsd/pmax.
    288       1.1  jonathan  */
    289       1.1  jonathan typedef struct  {
    290      1.38       cgd 	void (*setTLBpid)(int pid);
    291      1.38       cgd 	void (*TBIAP)(int);
    292      1.38       cgd 	void (*TBIS)(vaddr_t);
    293      1.80      matt 	int  (*tlbUpdate)(vaddr_t, uint32_t);
    294      1.38       cgd 	void (*wbflush)(void);
    295       1.1  jonathan } mips_locore_jumpvec_t;
    296      1.13  jonathan 
    297      1.38       cgd void	mips_set_wbflush(void (*)(void));
    298      1.62    simonb void	mips_wait_idle(void);
    299       1.1  jonathan 
    300      1.38       cgd void	stacktrace(void);
    301      1.38       cgd void	logstacktrace(void);
    302       1.1  jonathan 
    303      1.80      matt struct locoresw {
    304      1.80      matt 	uintptr_t lsw_cpu_switch_resume;
    305      1.80      matt 	uintptr_t lsw_lwp_trampoline;
    306      1.80      matt 	void (*lsw_cpu_idle)(void);
    307      1.80      matt 	uintptr_t lsw_setfunc_trampoline;
    308      1.80      matt };
    309      1.80      matt 
    310       1.1  jonathan /*
    311      1.81       snj  * The "active" locore-function vector, and
    312       1.1  jonathan  */
    313       1.1  jonathan extern mips_locore_jumpvec_t mips_locore_jumpvec;
    314      1.80      matt extern struct locoresw mips_locoresw;
    315       1.1  jonathan 
    316      1.59    simonb #if    defined(MIPS1) && !defined(MIPS3) && !defined(MIPS32) && !defined(MIPS64)
    317      1.11  jonathan #define MachSetPID		mips1_SetPID
    318      1.30  nisimura #define MIPS_TBIAP()		mips1_TBIAP(mips_num_tlb_entries)
    319      1.30  nisimura #define MIPS_TBIS		mips1_TBIS
    320      1.11  jonathan #define MachTLBUpdate		mips1_TLBUpdate
    321      1.22  nisimura #define wbflush()		mips1_wbflush()
    322      1.76      yamt #define lwp_trampoline		mips1_lwp_trampoline
    323      1.79    martin #define setfunc_trampoline	mips1_setfunc_trampoline
    324      1.60       uch #elif !defined(MIPS1) &&  defined(MIPS3) && !defined(MIPS32) && !defined(MIPS64) && !defined(MIPS3_5900)
    325      1.59    simonb #define MachSetPID		mips3_SetPID
    326      1.59    simonb #define MIPS_TBIAP()		mips3_TBIAP(mips_num_tlb_entries)
    327      1.59    simonb #define MIPS_TBIS		mips3_TBIS
    328      1.59    simonb #define MachTLBUpdate		mips3_TLBUpdate
    329      1.71   tsutsui #define MachTLBWriteIndexedVPS	mips3_TLBWriteIndexedVPS
    330      1.76      yamt #define lwp_trampoline		mips3_lwp_trampoline
    331      1.79    martin #define setfunc_trampoline	mips3_setfunc_trampoline
    332      1.59    simonb #define wbflush()		mips3_wbflush()
    333      1.59    simonb #elif !defined(MIPS1) && !defined(MIPS3) &&  defined(MIPS32) && !defined(MIPS64)
    334      1.70   tsutsui #define MachSetPID		mips32_SetPID
    335      1.70   tsutsui #define MIPS_TBIAP()		mips32_TBIAP(mips_num_tlb_entries)
    336      1.70   tsutsui #define MIPS_TBIS		mips32_TBIS
    337      1.70   tsutsui #define MachTLBUpdate		mips32_TLBUpdate
    338      1.71   tsutsui #define MachTLBWriteIndexedVPS	mips32_TLBWriteIndexedVPS
    339      1.76      yamt #define lwp_trampoline		mips32_lwp_trampoline
    340      1.79    martin #define setfunc_trampoline	mips32_setfunc_trampoline
    341      1.59    simonb #define wbflush()		mips32_wbflush()
    342      1.59    simonb #elif !defined(MIPS1) && !defined(MIPS3) && !defined(MIPS32) &&  defined(MIPS64)
    343      1.59    simonb  /* all common with mips3 */
    344      1.59    simonb #define MachSetPID		mips64_SetPID
    345      1.59    simonb #define MIPS_TBIAP()		mips64_TBIAP(mips_num_tlb_entries)
    346      1.59    simonb #define MIPS_TBIS		mips64_TBIS
    347      1.59    simonb #define MachTLBUpdate		mips64_TLBUpdate
    348      1.71   tsutsui #define MachTLBWriteIndexedVPS	mips64_TLBWriteIndexedVPS
    349      1.76      yamt #define lwp_trampoline		mips64_lwp_trampoline
    350      1.79    martin #define setfunc_trampoline	mips64_setfunc_trampoline
    351      1.59    simonb #define wbflush()		mips64_wbflush()
    352      1.60       uch #elif !defined(MIPS1) &&  defined(MIPS3) && !defined(MIPS32) && !defined(MIPS64) && defined(MIPS3_5900)
    353      1.60       uch #define MachSetPID		mips5900_SetPID
    354      1.60       uch #define MIPS_TBIAP()		mips5900_TBIAP(mips_num_tlb_entries)
    355      1.60       uch #define MIPS_TBIS		mips5900_TBIS
    356      1.60       uch #define MachTLBUpdate		mips5900_TLBUpdate
    357      1.71   tsutsui #define MachTLBWriteIndexedVPS	mips5900_TLBWriteIndexedVPS
    358      1.76      yamt #define lwp_trampoline		mips5900_lwp_trampoline
    359      1.79    martin #define setfunc_trampoline	mips5900_setfunc_trampoline
    360      1.60       uch #define wbflush()		mips5900_wbflush()
    361      1.59    simonb #else
    362       1.1  jonathan #define MachSetPID		(*(mips_locore_jumpvec.setTLBpid))
    363      1.31  nisimura #define MIPS_TBIAP()		(*(mips_locore_jumpvec.TBIAP))(mips_num_tlb_entries)
    364      1.31  nisimura #define MIPS_TBIS		(*(mips_locore_jumpvec.TBIS))
    365       1.1  jonathan #define MachTLBUpdate		(*(mips_locore_jumpvec.tlbUpdate))
    366      1.22  nisimura #define wbflush()		(*(mips_locore_jumpvec.wbflush))()
    367      1.80      matt #define lwp_trampoline		mips_locoresw.lsw_lwp_trampoline
    368      1.80      matt #define setfunc_trampoline	mips_locoresw.lsw_setfunc_trampoline
    369      1.11  jonathan #endif
    370      1.31  nisimura 
    371      1.80      matt #define CPU_IDLE		mips_locoresw.lsw_cpu_idle
    372      1.11  jonathan 
    373      1.16    castor /* cpu_switch_resume is called inside locore.S */
    374       1.7  jonathan 
    375       1.7  jonathan /*
    376       1.7  jonathan  * CPU identification, from PRID register.
    377       1.7  jonathan  */
    378      1.40       cgd typedef int mips_prid_t;
    379      1.40       cgd 
    380      1.70   tsutsui #define MIPS_PRID_REV(x)	(((x) >>  0) & 0x00ff)
    381      1.70   tsutsui #define MIPS_PRID_IMPL(x)	(((x) >>  8) & 0x00ff)
    382      1.45       cgd 
    383      1.59    simonb /* pre-MIPS32/64 */
    384      1.70   tsutsui #define MIPS_PRID_RSVD(x)	(((x) >> 16) & 0xffff)
    385      1.70   tsutsui #define MIPS_PRID_REV_MIN(x)	((MIPS_PRID_REV(x) >> 0) & 0x0f)
    386      1.70   tsutsui #define MIPS_PRID_REV_MAJ(x)	((MIPS_PRID_REV(x) >> 4) & 0x0f)
    387      1.45       cgd 
    388      1.59    simonb /* MIPS32/64 */
    389      1.70   tsutsui #define MIPS_PRID_CID(x)	(((x) >> 16) & 0x00ff)	/* Company ID */
    390      1.70   tsutsui #define     MIPS_PRID_CID_PREHISTORIC	0x00	/* Not MIPS32/64 */
    391      1.70   tsutsui #define     MIPS_PRID_CID_MTI		0x01	/* MIPS Technologies, Inc. */
    392      1.70   tsutsui #define     MIPS_PRID_CID_BROADCOM	0x02	/* Broadcom */
    393      1.70   tsutsui #define     MIPS_PRID_CID_ALCHEMY	0x03	/* Alchemy Semiconductor */
    394      1.70   tsutsui #define     MIPS_PRID_CID_SIBYTE	0x04	/* SiByte */
    395      1.70   tsutsui #define     MIPS_PRID_CID_SANDCRAFT	0x05	/* SandCraft */
    396      1.70   tsutsui #define     MIPS_PRID_CID_PHILIPS	0x06	/* Philips */
    397      1.70   tsutsui #define     MIPS_PRID_CID_TOSHIBA	0x07	/* Toshiba */
    398  1.81.6.1    bouyer #define     MIPS_PRID_CID_MICROSOFT	0x07	/* Microsoft also, sigh */
    399      1.70   tsutsui #define     MIPS_PRID_CID_LSI		0x08	/* LSI */
    400      1.67    simonb 				/*	0x09	unannounced */
    401      1.67    simonb 				/*	0x0a	unannounced */
    402      1.70   tsutsui #define     MIPS_PRID_CID_LEXRA		0x0b	/* Lexra */
    403      1.80      matt #define     MIPS_PRID_CID_RMI		0x0c	/* RMI / NetLogic */
    404      1.70   tsutsui #define MIPS_PRID_COPTS(x)	(((x) >> 24) & 0x00ff)	/* Company Options */
    405       1.6  jonathan 
    406       1.6  jonathan #ifdef _KERNEL
    407       1.6  jonathan /*
    408       1.6  jonathan  * Global variables used to communicate CPU type, and parameters
    409       1.6  jonathan  * such as cache size, from locore to higher-level code (e.g., pmap).
    410       1.6  jonathan  */
    411      1.40       cgd 
    412      1.40       cgd extern mips_prid_t cpu_id;
    413      1.40       cgd extern mips_prid_t fpu_id;
    414      1.14  jonathan extern int	mips_num_tlb_entries;
    415      1.52     jeffs 
    416      1.75  christos void mips_pagecopy(void *dst, void *src);
    417      1.75  christos void mips_pagezero(void *dst);
    418      1.19  jonathan 
    419      1.59    simonb #ifdef __HAVE_MIPS_MACHDEP_CACHE_CONFIG
    420      1.59    simonb void mips_machdep_cache_config(void);
    421      1.59    simonb #endif
    422      1.59    simonb 
    423      1.19  jonathan /*
    424      1.20    simonb  * trapframe argument passed to trap()
    425      1.19  jonathan  */
    426      1.64   thorpej 
    427      1.70   tsutsui #define TF_AST		0
    428      1.70   tsutsui #define TF_V0		1
    429      1.70   tsutsui #define TF_V1		2
    430      1.70   tsutsui #define TF_A0		3
    431      1.70   tsutsui #define TF_A1		4
    432      1.70   tsutsui #define TF_A2		5
    433      1.70   tsutsui #define TF_A3		6
    434      1.70   tsutsui #define TF_T0		7
    435      1.70   tsutsui #define TF_T1		8
    436      1.70   tsutsui #define TF_T2		9
    437      1.70   tsutsui #define TF_T3		10
    438      1.64   thorpej 
    439      1.64   thorpej #if defined(__mips_n32) || defined(__mips_n64)
    440      1.70   tsutsui #define TF_A4		11
    441      1.70   tsutsui #define TF_A5		12
    442      1.70   tsutsui #define TF_A6		13
    443      1.70   tsutsui #define TF_A7		14
    444      1.64   thorpej #else
    445      1.70   tsutsui #define TF_T4		11
    446      1.70   tsutsui #define TF_T5		12
    447      1.70   tsutsui #define TF_T6		13
    448      1.70   tsutsui #define TF_T7		14
    449      1.64   thorpej #endif /* __mips_n32 || __mips_n64 */
    450      1.64   thorpej 
    451      1.70   tsutsui #define TF_TA0		11
    452      1.70   tsutsui #define TF_TA1		12
    453      1.70   tsutsui #define TF_TA2		13
    454      1.70   tsutsui #define TF_TA3		14
    455      1.70   tsutsui 
    456      1.70   tsutsui #define TF_T8		15
    457      1.70   tsutsui #define TF_T9		16
    458      1.70   tsutsui 
    459      1.70   tsutsui #define TF_RA		17
    460      1.70   tsutsui #define TF_SR		18
    461      1.70   tsutsui #define TF_MULLO	19
    462      1.70   tsutsui #define TF_MULHI	20
    463      1.70   tsutsui #define TF_EPC		21		/* may be changed by trap() call */
    464      1.65   thorpej 
    465      1.70   tsutsui #define TF_NREGS	22
    466      1.64   thorpej 
    467      1.19  jonathan struct trapframe {
    468      1.64   thorpej 	mips_reg_t tf_regs[TF_NREGS];
    469      1.80      matt 	uint32_t   tf_ppl;		/* previous priority level */
    470      1.80      matt 	mips_reg_t tf_pad;		/* for 8 byte aligned */
    471      1.19  jonathan };
    472      1.19  jonathan 
    473      1.19  jonathan /*
    474      1.19  jonathan  * Stack frame for kernel traps. four args passed in registers.
    475      1.19  jonathan  * A trapframe is pointed to by the 5th arg, and a dummy sixth argument
    476      1.19  jonathan  * is used to avoid alignment problems
    477      1.19  jonathan  */
    478      1.19  jonathan 
    479      1.19  jonathan struct kernframe {
    480      1.80      matt #if defined(__mips_o32) || defined(__mips_o64)
    481      1.19  jonathan 	register_t cf_args[4 + 1];
    482      1.80      matt #if defined(__mips_o32)
    483      1.19  jonathan 	register_t cf_pad;		/* (for 8 word alignment) */
    484      1.80      matt #endif
    485      1.80      matt #endif
    486      1.80      matt #if defined(__mips_n32) || defined(__mips_n64)
    487      1.80      matt 	register_t cf_pad[2];		/* for 16 byte alignment */
    488      1.80      matt #endif
    489      1.19  jonathan 	register_t cf_sp;
    490      1.19  jonathan 	register_t cf_ra;
    491      1.19  jonathan 	struct trapframe cf_frame;
    492      1.19  jonathan };
    493      1.61    simonb #endif	/* _KERNEL */
    494       1.1  jonathan #endif	/* _MIPS_LOCORE_H */
    495