xref: /original-bsd/sys/hp300/include/cpu.h (revision 9f9a0d6d)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1982, 1990 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * the Systems Programming Group of the University of Utah Computer
8  * Science Department.
9  *
10  * %sccs.include.redist.c%
11  *
12  * from: Utah $Hdr: cpu.h 1.13 89/06/23$
13  *
14  *	@(#)cpu.h	7.2 (Berkeley) 05/25/90
15  */
16 
17 /* values for machineid */
18 #define HP_320		0	/* 16Mhz 68020+HP MMU+16K external cache */
19 #define HP_330		1	/* 16Mhz 68020+68851 MMU */
20 #define HP_350		2	/* 25Mhz 68020+HP MMU+32K external cache */
21 #define HP_360		3	/* 25Mhz 68030 */
22 #define HP_370		4	/* 33Mhz 68030+64K external cache */
23 #define HP_340		5	/* 16Mhz 68030 */
24 #define HP_375		6	/* 50Mhz 68030+32K external cache */
25 
26 /* values for mmutype (assigned for quick testing) */
27 #define MMU_68030	-1	/* 68030 on-chip subset of 68851 */
28 #define MMU_HP		0	/* HP proprietary */
29 #define MMU_68851	1	/* Motorola 68851 */
30 
31 /* values for ectype */
32 #define EC_PHYS		-1	/* external physical address cache */
33 #define EC_NONE		0	/* no external cache */
34 #define EC_VIRT		1	/* external virtual address cache */
35 
36 /* values for cpuspeed (not really related to clock speed due to caches) */
37 #define MHZ_8		1
38 #define MHZ_16		2
39 #define MHZ_25		3
40 #define MHZ_33		4
41 #define MHZ_50		6
42 
43 #ifdef KERNEL
44 extern	int machineid, mmutype, ectype;
45 extern	int IObase;
46 
47 /* what is this supposed to do? i.e. how is it different than startrtclock? */
48 #define	enablertclock()
49 
50 #endif
51 
52 /* physical memory sections */
53 #define ROMBASE		(0x00000000)
54 #define IOBASE		(0x00200000)
55 #define IOTOP		(0x01000000)
56 #define MAXADDR		(0xFFFFF000)
57 
58 /* IO space stuff */
59 #define EXTIOBASE	(0x00600000)
60 #define	IOCARDSIZE	(0x10000)
61 #define	IOMAPSIZE	(btoc(IOTOP-IOBASE))
62 #define	IOP(x)		((x) - IOBASE)
63 #define	IOV(x)		(((x) - IOBASE) + (int)&IObase)
64 #define UNIOV(x)	((x) - (int)&IObase + IOBASE)
65 
66 /* DIO II uncached address space */
67 #define DIOIIBASE	(0x01000000)
68 #define DIOIITOP	(0x20000000)
69 #define DIOIICSIZE	(0x00400000)
70 
71 /* offsets for longword read/write */
72 #define	MMUSSTP		IOP(0x5F4000)
73 #define	MMUUSTP		IOP(0x5F4004)
74 #define	MMUTBINVAL	IOP(0x5F4008)
75 #define	MMUSTAT		IOP(0x5F400C)
76 #define	MMUCMD		MMUSTAT
77 
78 #define MMU_UMEN	0x0001	/* enable user mapping */
79 #define MMU_SMEN	0x0002	/* enable supervisor mapping */
80 #define MMU_CEN		0x0004	/* enable data cache */
81 #define MMU_BERR	0x0008	/* bus error */
82 #define MMU_IEN		0x0020	/* enable instruction cache */
83 #define MMU_FPE		0x0040	/* enable 68881 FP coprocessor */
84 #define MMU_WPF		0x2000	/* write protect fault */
85 #define MMU_PF		0x4000	/* page fault */
86 #define MMU_PTF		0x8000	/* page table fault */
87 
88 #define MMU_FAULT	(MMU_PTF|MMU_PF|MMU_WPF|MMU_BERR)
89 #define MMU_ENAB	(MMU_UMEN|MMU_SMEN|MMU_IEN|MMU_FPE)
90 
91 #define PMMU_LVLMASK	0x0007
92 #define PMMU_INV	0x0400
93 #define PMMU_WP		0x0800
94 #define PMMU_ALV	0x1000
95 #define PMMU_SO		0x2000
96 #define PMMU_LV		0x4000
97 #define PMMU_BE		0x8000
98 
99 #define PMMU_FAULT	(PMMU_WP|PMMU_INV)
100 
101 /* function code for user data space */
102 #define	FC_USERD	1
103 /* methinks the following is used to selectively clear TLB entries */
104 #define FC_PURGE	3
105 
106 /* fields in the 68020 cache control register */
107 #define IC_ENABLE	0x0001	/* enable instruction cache */
108 #define IC_FREEZE	0x0002	/* freeze instruction cache */
109 #define IC_CE		0x0004	/* clear instruction cache entry */
110 #define IC_CLR		0x0008	/* clear entire instruction cache */
111 
112 /* additional fields in the 68030 cache control register */
113 #define IC_BE		0x0010	/* instruction burst enable */
114 #define DC_ENABLE	0x0100	/* data cache enable */
115 #define DC_FREEZE	0x0200	/* data cache freeze */
116 #define DC_CE		0x0400	/* clear data cache entry */
117 #define DC_CLR		0x0800	/* clear entire data cache */
118 #define DC_BE		0x1000	/* data burst enable */
119 #define DC_WA		0x2000	/* write allocate */
120 
121 #define CACHE_ON	(DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
122 #define CACHE_OFF	(DC_CLR|IC_CLR)
123 #define CACHE_CLR	(CACHE_ON)
124 #define IC_CLEAR	(DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
125 #define DC_CLEAR	(DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE)
126