xref: /csrg-svn/sys/pmax/include/machConst.h (revision 63217)
152131Smckusick /*
2*63217Sbostic  * Copyright (c) 1992, 1993
3*63217Sbostic  *	The Regents of the University of California.  All rights reserved.
452131Smckusick  *
552131Smckusick  * This code is derived from software contributed to Berkeley by
656821Sralph  * Ralph Campbell and Rick Macklem.
752131Smckusick  *
852131Smckusick  * %sccs.include.redist.c%
952131Smckusick  *
10*63217Sbostic  *	@(#)machConst.h	8.1 (Berkeley) 06/10/93
1152131Smckusick  *
1252131Smckusick  * machConst.h --
1352131Smckusick  *
1452131Smckusick  *	Machine dependent constants.
1552131Smckusick  *
1652131Smckusick  *	Copyright (C) 1989 Digital Equipment Corporation.
1752131Smckusick  *	Permission to use, copy, modify, and distribute this software and
1852131Smckusick  *	its documentation for any purpose and without fee is hereby granted,
1952131Smckusick  *	provided that the above copyright notice appears in all copies.
2052131Smckusick  *	Digital Equipment Corporation makes no representations about the
2152131Smckusick  *	suitability of this software for any purpose.  It is provided "as is"
2252131Smckusick  *	without express or implied warranty.
2352131Smckusick  *
2452131Smckusick  * from: $Header: /sprite/src/kernel/mach/ds3100.md/RCS/machConst.h,
2552131Smckusick  *	v 9.2 89/10/21 15:55:22 jhh Exp $ SPRITE (DECWRL)
2652131Smckusick  * from: $Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAddrs.h,
2752131Smckusick  *	v 1.2 89/08/15 18:28:21 rab Exp $ SPRITE (DECWRL)
2852131Smckusick  * from: $Header: /sprite/src/kernel/vm/ds3100.md/RCS/vmPmaxConst.h,
2952131Smckusick  *	v 9.1 89/09/18 17:33:00 shirriff Exp $ SPRITE (DECWRL)
3052131Smckusick  */
3152131Smckusick 
3252131Smckusick #ifndef _MACHCONST
3352131Smckusick #define _MACHCONST
3452131Smckusick 
3552131Smckusick #define MACH_KUSEG_ADDR			0x0
3652131Smckusick #define MACH_CACHED_MEMORY_ADDR		0x80000000
3752746Sralph #define MACH_UNCACHED_MEMORY_ADDR	0xa0000000
3852746Sralph #define MACH_KSEG2_ADDR			0xc0000000
3956821Sralph #define MACH_MAX_MEM_ADDR		0xbe000000
4056821Sralph #define	MACH_RESERVED_ADDR		0xbfc80000
4152746Sralph 
4252746Sralph #define	MACH_CACHED_TO_PHYS(x)	((unsigned)(x) & 0x1fffffff)
4352746Sralph #define	MACH_PHYS_TO_CACHED(x)	((unsigned)(x) | MACH_CACHED_MEMORY_ADDR)
4452746Sralph #define	MACH_UNCACHED_TO_PHYS(x) ((unsigned)(x) & 0x1fffffff)
4552746Sralph #define	MACH_PHYS_TO_UNCACHED(x) ((unsigned)(x) | MACH_UNCACHED_MEMORY_ADDR)
4652746Sralph 
4752131Smckusick #define MACH_CODE_START			0x80030000
4852131Smckusick 
4952131Smckusick /*
5052131Smckusick  * The bits in the cause register.
5152131Smckusick  *
5252131Smckusick  *	MACH_CR_BR_DELAY	Exception happened in branch delay slot.
5352131Smckusick  *	MACH_CR_COP_ERR		Coprocessor error.
5452131Smckusick  *				Interrupt pending bits defined below.
5552131Smckusick  *	MACH_CR_EXC_CODE	The exception type (see exception codes below).
5652131Smckusick  */
5752131Smckusick #define MACH_CR_BR_DELAY	0x80000000
5852131Smckusick #define MACH_CR_COP_ERR		0x30000000
5952131Smckusick #define MACH_CR_EXC_CODE	0x0000003C
6052131Smckusick #define MACH_CR_EXC_CODE_SHIFT	2
6152131Smckusick 
6252131Smckusick /*
6352131Smckusick  * The bits in the status register.  All bits are active when set to 1.
6452131Smckusick  *
6552131Smckusick  *	MACH_SR_CO_USABILITY	Control the usability of the four coprocessors.
6652131Smckusick  *	MACH_SR_BOOT_EXC_VEC	Use alternate exception vectors.
6752131Smckusick  *	MACH_SR_TLB_SHUTDOWN	TLB disabled.
6852131Smckusick  *	MACH_SR_PARITY_ERR	Parity error.
6952131Smckusick  *	MACH_SR_CACHE_MISS	Most recent D-cache load resulted in a miss.
7052131Smckusick  *	MACH_SR_PARITY_ZERO	Zero replaces outgoing parity bits.
7152131Smckusick  *	MACH_SR_SWAP_CACHES	Swap I-cache and D-cache.
7252131Smckusick  *	MACH_SR_ISOL_CACHES	Isolate D-cache from main memory.
7352131Smckusick  *				Interrupt enable bits defined below.
7452131Smckusick  *	MACH_SR_KU_OLD		Old kernel/user mode bit. 1 => user mode.
7552131Smckusick  *	MACH_SR_INT_ENA_OLD	Old interrupt enable bit.
7652131Smckusick  *	MACH_SR_KU_PREV		Previous kernel/user mode bit. 1 => user mode.
7752131Smckusick  *	MACH_SR_INT_ENA_PREV	Previous interrupt enable bit.
7852131Smckusick  *	MACH_SR_KU_CUR		Current kernel/user mode bit. 1 => user mode.
7952131Smckusick  *	MACH_SR_INT_ENA_CUR	Current interrupt enable bit.
8052131Smckusick  */
8152131Smckusick #define MACH_SR_COP_USABILITY	0xf0000000
8252131Smckusick #define MACH_SR_COP_0_BIT	0x10000000
8352131Smckusick #define MACH_SR_COP_1_BIT	0x20000000
8452131Smckusick #define MACH_SR_BOOT_EXC_VEC	0x00400000
8552131Smckusick #define MACH_SR_TLB_SHUTDOWN	0x00200000
8652131Smckusick #define MACH_SR_PARITY_ERR	0x00100000
8752131Smckusick #define MACH_SR_CACHE_MISS	0x00080000
8852131Smckusick #define MACH_SR_PARITY_ZERO	0x00040000
8952131Smckusick #define MACH_SR_SWAP_CACHES	0x00020000
9052131Smckusick #define MACH_SR_ISOL_CACHES	0x00010000
9152131Smckusick #define MACH_SR_KU_OLD		0x00000020
9252131Smckusick #define MACH_SR_INT_ENA_OLD	0x00000010
9352131Smckusick #define MACH_SR_KU_PREV		0x00000008
9452131Smckusick #define MACH_SR_INT_ENA_PREV	0x00000004
9552131Smckusick #define MACH_SR_KU_CUR		0x00000002
9652131Smckusick #define MACH_SR_INT_ENA_CUR	0x00000001
9752131Smckusick #define MACH_SR_MBZ		0x0f8000c0
9852131Smckusick 
9952131Smckusick /*
10052131Smckusick  * The interrupt masks.
10152131Smckusick  * If a bit in the mask is 1 then the interrupt is enabled (or pending).
10252131Smckusick  */
10352131Smckusick #define MACH_INT_MASK		0xff00
10452131Smckusick #define MACH_INT_MASK_5		0x8000
10552131Smckusick #define MACH_INT_MASK_4		0x4000
10652131Smckusick #define MACH_INT_MASK_3		0x2000
10752131Smckusick #define MACH_INT_MASK_2		0x1000
10852131Smckusick #define MACH_INT_MASK_1		0x0800
10952131Smckusick #define MACH_INT_MASK_0		0x0400
11052131Smckusick #define MACH_HARD_INT_MASK	0xfc00
11152131Smckusick #define MACH_SOFT_INT_MASK_1	0x0200
11252131Smckusick #define MACH_SOFT_INT_MASK_0	0x0100
11352131Smckusick 
11452131Smckusick /*
11552131Smckusick  * The bits in the context register.
11652131Smckusick  */
11752131Smckusick #define MACH_CNTXT_PTE_BASE	0xFFE00000
11852131Smckusick #define MACH_CNTXT_BAD_VPN	0x001FFFFC
11952131Smckusick 
12052131Smckusick /*
12152131Smckusick  * Location of exception vectors.
12252131Smckusick  */
12352131Smckusick #define MACH_RESET_EXC_VEC	0xBFC00000
12452131Smckusick #define MACH_UTLB_MISS_EXC_VEC	0x80000000
12552131Smckusick #define MACH_GEN_EXC_VEC	0x80000080
12652131Smckusick 
12752131Smckusick /*
12852131Smckusick  * Coprocessor 0 registers:
12952131Smckusick  *
13052131Smckusick  *	MACH_COP_0_TLB_INDEX	TLB index.
13152131Smckusick  *	MACH_COP_0_TLB_RANDOM	TLB random.
13252131Smckusick  *	MACH_COP_0_TLB_LOW	TLB entry low.
13352131Smckusick  *	MACH_COP_0_TLB_CONTEXT	TLB context.
13452131Smckusick  *	MACH_COP_0_BAD_VADDR	Bad virtual address.
13552131Smckusick  *	MACH_COP_0_TLB_HI	TLB entry high.
13652131Smckusick  *	MACH_COP_0_STATUS_REG	Status register.
13752131Smckusick  *	MACH_COP_0_CAUSE_REG	Exception cause register.
13852131Smckusick  *	MACH_COP_0_EXC_PC	Exception PC.
13952131Smckusick  *	MACH_COP_0_PRID		Processor revision identifier.
14052131Smckusick  */
14152131Smckusick #define MACH_COP_0_TLB_INDEX	$0
14252131Smckusick #define MACH_COP_0_TLB_RANDOM	$1
14352131Smckusick #define MACH_COP_0_TLB_LOW	$2
14452131Smckusick #define MACH_COP_0_TLB_CONTEXT	$4
14552131Smckusick #define MACH_COP_0_BAD_VADDR	$8
14652131Smckusick #define MACH_COP_0_TLB_HI	$10
14752131Smckusick #define MACH_COP_0_STATUS_REG	$12
14852131Smckusick #define MACH_COP_0_CAUSE_REG	$13
14952131Smckusick #define MACH_COP_0_EXC_PC	$14
15052131Smckusick #define MACH_COP_0_PRID		$15
15152131Smckusick 
15252131Smckusick /*
15352131Smckusick  * Values for the code field in a break instruction.
15452131Smckusick  */
15552746Sralph #define MACH_BREAK_INSTR	0x0000000d
15652746Sralph #define MACH_BREAK_VAL_MASK	0x03ff0000
15752746Sralph #define MACH_BREAK_VAL_SHIFT	16
15852746Sralph #define MACH_BREAK_KDB_VAL	512
15952746Sralph #define MACH_BREAK_SSTEP_VAL	513
16052746Sralph #define MACH_BREAK_BRKPT_VAL	514
16152746Sralph #define MACH_BREAK_KDB		(MACH_BREAK_INSTR | \
16252746Sralph 				(MACH_BREAK_KDB_VAL << MACH_BREAK_VAL_SHIFT))
16352746Sralph #define MACH_BREAK_SSTEP	(MACH_BREAK_INSTR | \
16452746Sralph 				(MACH_BREAK_SSTEP_VAL << MACH_BREAK_VAL_SHIFT))
16552746Sralph #define MACH_BREAK_BRKPT	(MACH_BREAK_INSTR | \
16652746Sralph 				(MACH_BREAK_BRKPT_VAL << MACH_BREAK_VAL_SHIFT))
16752131Smckusick 
16852131Smckusick /*
16952131Smckusick  * Mininum and maximum cache sizes.
17052131Smckusick  */
17152131Smckusick #define MACH_MIN_CACHE_SIZE	(16 * 1024)
17252746Sralph #define MACH_MAX_CACHE_SIZE	(256 * 1024)
17352131Smckusick 
17452131Smckusick /*
17552131Smckusick  * The floating point version and status registers.
17652131Smckusick  */
17752131Smckusick #define	MACH_FPC_ID	$0
17852131Smckusick #define	MACH_FPC_CSR	$31
17952131Smckusick 
18052131Smckusick /*
18152131Smckusick  * The floating point coprocessor status register bits.
18252131Smckusick  */
18352131Smckusick #define MACH_FPC_ROUNDING_BITS		0x00000003
18452131Smckusick #define MACH_FPC_ROUND_RN		0x00000000
18552131Smckusick #define MACH_FPC_ROUND_RZ		0x00000001
18652131Smckusick #define MACH_FPC_ROUND_RP		0x00000002
18752131Smckusick #define MACH_FPC_ROUND_RM		0x00000003
18852131Smckusick #define MACH_FPC_STICKY_BITS		0x0000007c
18952131Smckusick #define MACH_FPC_STICKY_INEXACT		0x00000004
19052131Smckusick #define MACH_FPC_STICKY_UNDERFLOW	0x00000008
19152131Smckusick #define MACH_FPC_STICKY_OVERFLOW	0x00000010
19252131Smckusick #define MACH_FPC_STICKY_DIV0		0x00000020
19352131Smckusick #define MACH_FPC_STICKY_INVALID		0x00000040
19452131Smckusick #define MACH_FPC_ENABLE_BITS		0x00000f80
19552131Smckusick #define MACH_FPC_ENABLE_INEXACT		0x00000080
19652131Smckusick #define MACH_FPC_ENABLE_UNDERFLOW	0x00000100
19752131Smckusick #define MACH_FPC_ENABLE_OVERFLOW	0x00000200
19852131Smckusick #define MACH_FPC_ENABLE_DIV0		0x00000400
19952131Smckusick #define MACH_FPC_ENABLE_INVALID		0x00000800
20052131Smckusick #define MACH_FPC_EXCEPTION_BITS		0x0003f000
20152131Smckusick #define MACH_FPC_EXCEPTION_INEXACT	0x00001000
20252131Smckusick #define MACH_FPC_EXCEPTION_UNDERFLOW	0x00002000
20352131Smckusick #define MACH_FPC_EXCEPTION_OVERFLOW	0x00004000
20452131Smckusick #define MACH_FPC_EXCEPTION_DIV0		0x00008000
20552131Smckusick #define MACH_FPC_EXCEPTION_INVALID	0x00010000
20652131Smckusick #define MACH_FPC_EXCEPTION_UNIMPL	0x00020000
20752131Smckusick #define MACH_FPC_COND_BIT		0x00800000
20852131Smckusick #define MACH_FPC_MBZ_BITS		0xff7c0000
20952131Smckusick 
21052131Smckusick /*
21152131Smckusick  * Constants to determine if have a floating point instruction.
21252131Smckusick  */
21352131Smckusick #define MACH_OPCODE_SHIFT	26
21452131Smckusick #define MACH_OPCODE_C1		0x11
21552131Smckusick 
21652131Smckusick /*
21752131Smckusick  * The low part of the TLB entry.
21852131Smckusick  */
21952131Smckusick #define VMMACH_TLB_PF_NUM		0xfffff000
22052131Smckusick #define VMMACH_TLB_NON_CACHEABLE_BIT	0x00000800
22152131Smckusick #define VMMACH_TLB_MOD_BIT		0x00000400
22252131Smckusick #define VMMACH_TLB_VALID_BIT		0x00000200
22352131Smckusick #define VMMACH_TLB_GLOBAL_BIT		0x00000100
22452131Smckusick 
22552131Smckusick #define VMMACH_TLB_PHYS_PAGE_SHIFT	12
22652131Smckusick 
22752131Smckusick /*
22852131Smckusick  * The high part of the TLB entry.
22952131Smckusick  */
23052131Smckusick #define VMMACH_TLB_VIRT_PAGE_NUM	0xfffff000
23152131Smckusick #define VMMACH_TLB_PID			0x00000fc0
23252131Smckusick #define VMMACH_TLB_PID_SHIFT		6
23352131Smckusick #define VMMACH_TLB_VIRT_PAGE_SHIFT	12
23452131Smckusick 
23552131Smckusick /*
23652131Smckusick  * The shift to put the index in the right spot.
23752131Smckusick  */
23852131Smckusick #define VMMACH_TLB_INDEX_SHIFT		8
23952131Smckusick 
24052131Smckusick /*
24152131Smckusick  * The number of TLB entries and the first one that write random hits.
24252131Smckusick  */
24352131Smckusick #define VMMACH_NUM_TLB_ENTRIES		64
24452131Smckusick #define VMMACH_FIRST_RAND_ENTRY 	8
24552131Smckusick 
24652131Smckusick /*
24752131Smckusick  * The number of process id entries.
24852131Smckusick  */
24952131Smckusick #define	VMMACH_NUM_PIDS			64
25052131Smckusick 
25152131Smckusick /*
25252131Smckusick  * TLB probe return codes.
25352131Smckusick  */
25452131Smckusick #define VMMACH_TLB_NOT_FOUND		0
25552131Smckusick #define VMMACH_TLB_FOUND		1
25652131Smckusick #define VMMACH_TLB_FOUND_WITH_PATCH	2
25752131Smckusick #define VMMACH_TLB_PROBE_ERROR		3
25852131Smckusick 
25952131Smckusick /*
26052131Smckusick  * Kernel virtual address for user page table entries
26152131Smckusick  * (i.e., the address for the context register).
26252131Smckusick  */
26352131Smckusick #define VMMACH_PTE_BASE		0xFFC00000
26452131Smckusick 
26552131Smckusick #endif /* _MACHCONST */
266