Home | History | Annotate | Line # | Download | only in include
ctlreg.h revision 1.8
      1  1.8       pk /*	$NetBSD: ctlreg.h,v 1.8 1995/06/25 21:35:05 pk Exp $ */
      2  1.6  deraadt 
      3  1.1  deraadt /*
      4  1.1  deraadt  * Copyright (c) 1992, 1993
      5  1.1  deraadt  *	The Regents of the University of California.  All rights reserved.
      6  1.1  deraadt  *
      7  1.1  deraadt  * This software was developed by the Computer Systems Engineering group
      8  1.1  deraadt  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
      9  1.1  deraadt  * contributed to Berkeley.
     10  1.1  deraadt  *
     11  1.1  deraadt  * All advertising materials mentioning features or use of this software
     12  1.1  deraadt  * must display the following acknowledgement:
     13  1.1  deraadt  *	This product includes software developed by the University of
     14  1.1  deraadt  *	California, Lawrence Berkeley Laboratory.
     15  1.1  deraadt  *
     16  1.1  deraadt  * Redistribution and use in source and binary forms, with or without
     17  1.1  deraadt  * modification, are permitted provided that the following conditions
     18  1.1  deraadt  * are met:
     19  1.1  deraadt  * 1. Redistributions of source code must retain the above copyright
     20  1.1  deraadt  *    notice, this list of conditions and the following disclaimer.
     21  1.1  deraadt  * 2. Redistributions in binary form must reproduce the above copyright
     22  1.1  deraadt  *    notice, this list of conditions and the following disclaimer in the
     23  1.1  deraadt  *    documentation and/or other materials provided with the distribution.
     24  1.1  deraadt  * 3. All advertising materials mentioning features or use of this software
     25  1.1  deraadt  *    must display the following acknowledgement:
     26  1.1  deraadt  *	This product includes software developed by the University of
     27  1.1  deraadt  *	California, Berkeley and its contributors.
     28  1.1  deraadt  * 4. Neither the name of the University nor the names of its contributors
     29  1.1  deraadt  *    may be used to endorse or promote products derived from this software
     30  1.1  deraadt  *    without specific prior written permission.
     31  1.1  deraadt  *
     32  1.1  deraadt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     33  1.1  deraadt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     34  1.1  deraadt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     35  1.1  deraadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     36  1.1  deraadt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  1.1  deraadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  1.1  deraadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  1.1  deraadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     40  1.1  deraadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     41  1.1  deraadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     42  1.1  deraadt  * SUCH DAMAGE.
     43  1.1  deraadt  *
     44  1.1  deraadt  *	@(#)ctlreg.h	8.1 (Berkeley) 6/11/93
     45  1.1  deraadt  */
     46  1.1  deraadt 
     47  1.1  deraadt /*
     48  1.2  deraadt  * Sun-4, 4c, and 4m control registers. (includes address space definitions
     49  1.2  deraadt  * and some registers in control space).
     50  1.1  deraadt  */
     51  1.1  deraadt 
     52  1.2  deraadt /*			0x00	   unused */
     53  1.2  deraadt /*			0x01	   unused */
     54  1.2  deraadt #if defined(SUN4C) || defined(SUN4)
     55  1.2  deraadt #define	ASI_CONTROL	0x02	/* cache enable, context reg, etc */
     56  1.2  deraadt #define	ASI_SEGMAP	0x03	/* segment maps (so we can reach each pmeg) */
     57  1.2  deraadt #define	ASI_PTE		0x04	/* PTE space (pmegs) */
     58  1.7       pk #define	ASI_REGMAP	0x06	/* region maps (3 level MMUs only) */
     59  1.2  deraadt #define	ASI_HWFLUSHSEG	0x05	/* hardware assisted version of FLUSHSEG */
     60  1.2  deraadt #define	ASI_HWFLUSHPG	0x06	/* hardware assisted version of FLUSHPG */
     61  1.2  deraadt #define	ASI_HWFLUSHCTX	0x07	/* hardware assisted version of FLUSHCTX */
     62  1.2  deraadt #endif
     63  1.5  deraadt #if defined(SUN4M)
     64  1.2  deraadt #define ASI_SRMMUFP	0x03	/* ref mmu flush/probe */
     65  1.3  deraadt #define ASI_SRMMUFP_L3	(0<<8)	/* probe L3	| flush L3 PTE */
     66  1.3  deraadt #define ASI_SRMMUFP_L2	(1<<8)	/* probe L2	| flush L2/L3 PTE/PTD's */
     67  1.3  deraadt #define ASI_SRMMUFP_L1	(2<<8)	/* probe L1	| flush L1/L2/L3 PTE/PTD's*/
     68  1.3  deraadt #define ASI_SRMMUFP_L0	(3<<8)	/* probe L0	| flush L0/L1/L2/L3 PTE/PTD's */
     69  1.3  deraadt #define ASI_SRMMUFP_LN	(4<<8)	/* probe all	| flush all levels */
     70  1.3  deraadt 
     71  1.2  deraadt #define ASI_SRMMU	0x04	/* ref mmu registers */
     72  1.2  deraadt #define ASI_SRMMUDIAG	0x06
     73  1.2  deraadt #endif
     74  1.2  deraadt 
     75  1.2  deraadt #define	ASI_USERI	0x08	/* I-space (user) */
     76  1.2  deraadt #define	ASI_KERNELI	0x09	/* I-space (kernel) */
     77  1.2  deraadt #define	ASI_USERD	0x0a	/* D-space (user) */
     78  1.2  deraadt #define	ASI_KERNELD	0x0b	/* D-space (kernel) */
     79  1.2  deraadt 
     80  1.2  deraadt #if defined(SUN4C) || defined(SUN4)
     81  1.7       pk #define	ASI_FLUSHREG	0x7	/* causes hardware to flush cache region */
     82  1.2  deraadt #define	ASI_FLUSHSEG	0x0c	/* causes hardware to flush cache segment */
     83  1.2  deraadt #define	ASI_FLUSHPG	0x0d	/* causes hardware to flush cache page */
     84  1.2  deraadt #define	ASI_FLUSHCTX	0x0e	/* causes hardware to flush cache context */
     85  1.5  deraadt #endif
     86  1.2  deraadt #if defined(SUN4)
     87  1.2  deraadt #define	ASI_DCACHE	0x0f	/* flush data cache; not used on 4c */
     88  1.2  deraadt #endif
     89  1.1  deraadt 
     90  1.2  deraadt #if defined(SUN4M)
     91  1.2  deraadt #define ASI_ICACHETAG	0x0c	/* instruction cache tag */
     92  1.2  deraadt #define ASI_ICACHEDATA	0x0d	/* instruction cache data */
     93  1.2  deraadt #define ASI_DCACHETAG	0x0e	/* data cache tag */
     94  1.2  deraadt #define ASI_DCACHEDATA	0x0f	/* data cache data */
     95  1.2  deraadt #define ASI_IDCACHELFP	0x10	/* ms2 only: flush i&d cache line (page) */
     96  1.2  deraadt #define ASI_IDCACHELFS	0x11	/* ms2 only: flush i&d cache line (seg) */
     97  1.2  deraadt #define ASI_IDCACHELFR	0x12	/* ms2 only: flush i&d cache line (reg) */
     98  1.2  deraadt #define ASI_IDCACHELFC	0x13	/* ms2 only: flush i&d cache line (ctxt) */
     99  1.2  deraadt #define ASI_IDCACHELFU	0x14	/* ms2 only: flush i&d cache line (user) */
    100  1.8       pk #define ASI_BYPASS	0x20	/* sun ref mmu bypass, ie. direct phys access */
    101  1.2  deraadt #define ASI_ICACHECLR	0x36	/* ms1 only: instruction cache flash clear */
    102  1.2  deraadt #define ASI_DCACHECLR	0x37	/* ms1 only: data cache clear */
    103  1.2  deraadt #define ASI_DCACHEDIAG	0x39	/* data cache diagnostic register access */
    104  1.2  deraadt #endif
    105  1.2  deraadt 
    106  1.5  deraadt #if defined(SUN4C) || defined(SUN4)
    107  1.1  deraadt /* registers in the control space */
    108  1.1  deraadt #define	AC_CONTEXT	0x30000000	/* context register (byte) */
    109  1.1  deraadt #define	AC_SYSENABLE	0x40000000	/* system enable register (byte) */
    110  1.1  deraadt #define	AC_CACHETAGS	0x80000000	/* cache tag base address */
    111  1.1  deraadt #define	AC_SERIAL	0xf0000000	/* special serial port sneakiness */
    112  1.1  deraadt 	/* AC_SERIAL is not used in the kernel (it is for the PROM) */
    113  1.2  deraadt #endif
    114  1.1  deraadt 
    115  1.2  deraadt #if defined(SUN4)
    116  1.4  deraadt #define	AC_IDPROM	0x00000000	/* ID PROM */
    117  1.1  deraadt #define	AC_DVMA_ENABLE	0x50000000	/* enable user dvma */
    118  1.1  deraadt #define	AC_BUS_ERR	0x60000000	/* bus error register */
    119  1.1  deraadt #define	AC_DIAG_REG	0x70000000	/* diagnostic reg */
    120  1.1  deraadt #define	AC_DVMA_MAP	0xd0000000	/* user dvma map entries */
    121  1.5  deraadt #define AC_VMEINTVEC	0xe0000000	/* vme interrupt vector */
    122  1.4  deraadt 
    123  1.5  deraadt /* XXX: does not belong here */
    124  1.4  deraadt #define	ME_REG_IERR	0x80		/* memory err ctrl reg error intr pending bit */
    125  1.1  deraadt #endif
    126  1.1  deraadt 
    127  1.2  deraadt #if defined(SUN4C)
    128  1.1  deraadt #define	AC_SYNC_ERR	0x60000000	/* sync (memory) error reg */
    129  1.1  deraadt #define	AC_SYNC_VA	0x60000004	/* sync error virtual addr */
    130  1.1  deraadt #define	AC_ASYNC_ERR	0x60000008	/* async error reg */
    131  1.1  deraadt #define	AC_ASYNC_VA	0x6000000c	/* async error virtual addr */
    132  1.1  deraadt #define	AC_CACHEDATA	0x90000000	/* cached data */
    133  1.4  deraadt #endif
    134  1.1  deraadt 
    135  1.5  deraadt #if defined(SUN4C) || defined(SUN4)
    136  1.1  deraadt /*
    137  1.1  deraadt  * Bits in sync error register.  Reading the register clears these;
    138  1.1  deraadt  * otherwise they accumulate.  The error(s) occurred at the virtual
    139  1.1  deraadt  * address stored in the sync error address register, and may have
    140  1.1  deraadt  * been due to, e.g., what would usually be called a page fault.
    141  1.1  deraadt  * Worse, the bits accumulate during instruction prefetch, so
    142  1.1  deraadt  * various bits can be on that should be off.
    143  1.1  deraadt  */
    144  1.1  deraadt #define	SER_WRITE	0x8000		/* error occurred during write */
    145  1.1  deraadt #define	SER_INVAL	0x80		/* PTE had PG_V off */
    146  1.1  deraadt #define	SER_PROT	0x40		/* operation violated PTE prot */
    147  1.1  deraadt #define	SER_TIMEOUT	0x20		/* bus timeout (non-existent mem) */
    148  1.1  deraadt #define	SER_SBUSERR	0x10		/* S-Bus bus error */
    149  1.1  deraadt #define	SER_MEMERR	0x08		/* memory ecc/parity error */
    150  1.1  deraadt #define	SER_SZERR	0x02		/* size error, whatever that is */
    151  1.1  deraadt #define	SER_WATCHDOG	0x01		/* watchdog reset (never see this) */
    152  1.1  deraadt 
    153  1.1  deraadt #define	SER_BITS \
    154  1.1  deraadt "\20\20WRITE\10INVAL\7PROT\6TIMEOUT\5SBUSERR\4MEMERR\2SZERR\1WATCHDOG"
    155  1.1  deraadt 
    156  1.1  deraadt /*
    157  1.1  deraadt  * Bits in async error register (errors from DVMA or Sun-4 cache
    158  1.1  deraadt  * writeback).  The corresponding bit is also set in the sync error reg.
    159  1.1  deraadt  *
    160  1.1  deraadt  * A writeback invalid error means there is a bug in the PTE manager.
    161  1.1  deraadt  *
    162  1.1  deraadt  * The word is that the async error register does not work right.
    163  1.1  deraadt  */
    164  1.1  deraadt #define	AER_WBINVAL	0x80		/* writeback found PTE without PG_V */
    165  1.1  deraadt #define	AER_TIMEOUT	0x20		/* bus timeout */
    166  1.1  deraadt #define	AER_DVMAERR	0x10		/* bus error during DVMA */
    167  1.1  deraadt 
    168  1.1  deraadt #define	AER_BITS	"\20\10WBINVAL\6TIMEOUT\5DVMAERR"
    169  1.1  deraadt 
    170  1.1  deraadt /*
    171  1.1  deraadt  * Bits in system enable register.
    172  1.1  deraadt  */
    173  1.8       pk #define	SYSEN_DVMA	0x20		/* Enable dvma */
    174  1.8       pk #define	SYSEN_CACHE	0x10		/* Enable cache */
    175  1.8       pk #define	SYSEN_IOCACHE	0x40		/* Enable IO cache */
    176  1.8       pk #define	SYSEN_RESET	0x04		/* Reset the hardware */
    177  1.8       pk #define	SYSEN_RESETVME	0x02		/* Reset the VME bus */
    178  1.2  deraadt #endif
    179  1.2  deraadt 
    180  1.2  deraadt #if defined(SUN4M)
    181  1.8       pk #define SRMMU_PCR	0x00000000	/* Processor control register */
    182  1.8       pk #define SRMMU_CXTPTR	0x00000100	/* Context table pointer register */
    183  1.8       pk #define SRMMU_CXR	0x00000200	/* Context register */
    184  1.8       pk #define SRMMU_SFSTAT	0x00000300	/* Synchronous fault status reg */
    185  1.8       pk #define SRMMU_SFADDR	0x00000400	/* Synchronous fault address reg */
    186  1.2  deraadt #define SRMMU_TLBCTRL	0x00001000	/* TLB replacement control reg */
    187  1.8       pk 
    188  1.8       pk /* Synchronous Fault Status Register bits */
    189  1.8       pk #define SFSR_CS		0x00010000	/* Control Space error */
    190  1.8       pk #define SFSR_PERR	0x00006000	/* Parity error code */
    191  1.8       pk #define SFSR_TO		0x00000800	/* S-Bus timeout */
    192  1.8       pk #define SFSR_BE		0x00000400	/* S-Bus bus error */
    193  1.8       pk #define SFSR_LVL	0x00000300	/* Pagetable level causing the fault */
    194  1.8       pk #define SFSR_AT		0x000000e0	/* Access type */
    195  1.8       pk #define SFSR_FT		0x0000001c	/* Fault type */
    196  1.8       pk #define SFSR_FAV	0x00000002	/* Fault Address is valid */
    197  1.8       pk #define SFSR_OW		0x00000001	/* Overwritten with new fault */
    198  1.8       pk 
    199  1.8       pk /* TLB Replacement Control Register bits */
    200  1.8       pk #define TLBC_DISABLE	0x00000020	/* Disable replacement counter */
    201  1.8       pk #define TLBC_RCNTMASK	0x0000001f	/* Replacement counter (0-31) */
    202  1.2  deraadt #endif
    203