xref: /csrg-svn/sys/hp300/include/cpu.h (revision 45755)
141474Smckusick /*
241474Smckusick  * Copyright (c) 1988 University of Utah.
341474Smckusick  * Copyright (c) 1982, 1990 The Regents of the University of California.
441474Smckusick  * All rights reserved.
541474Smckusick  *
641474Smckusick  * This code is derived from software contributed to Berkeley by
741474Smckusick  * the Systems Programming Group of the University of Utah Computer
841474Smckusick  * Science Department.
941474Smckusick  *
1041474Smckusick  * %sccs.include.redist.c%
1141474Smckusick  *
1241474Smckusick  * from: Utah $Hdr: cpu.h 1.13 89/06/23$
1341474Smckusick  *
14*45755Smckusick  *	@(#)cpu.h	7.3 (Berkeley) 12/05/90
1541474Smckusick  */
1641474Smckusick 
1741474Smckusick /* values for machineid */
18*45755Smckusick #define	HP_320		0	/* 16Mhz 68020+HP MMU+16K external cache */
19*45755Smckusick #define	HP_330		1	/* 16Mhz 68020+68851 MMU */
20*45755Smckusick #define	HP_350		2	/* 25Mhz 68020+HP MMU+32K external cache */
21*45755Smckusick #define	HP_360		3	/* 25Mhz 68030 */
22*45755Smckusick #define	HP_370		4	/* 33Mhz 68030+64K external cache */
23*45755Smckusick #define	HP_340		5	/* 16Mhz 68030 */
24*45755Smckusick #define	HP_375		6	/* 50Mhz 68030+32K external cache */
2541474Smckusick 
2641474Smckusick /* values for mmutype (assigned for quick testing) */
27*45755Smckusick #define	MMU_68030	-1	/* 68030 on-chip subset of 68851 */
28*45755Smckusick #define	MMU_HP		0	/* HP proprietary */
29*45755Smckusick #define	MMU_68851	1	/* Motorola 68851 */
3041474Smckusick 
3141474Smckusick /* values for ectype */
32*45755Smckusick #define	EC_PHYS		-1	/* external physical address cache */
33*45755Smckusick #define	EC_NONE		0	/* no external cache */
34*45755Smckusick #define	EC_VIRT		1	/* external virtual address cache */
3541474Smckusick 
3641474Smckusick /* values for cpuspeed (not really related to clock speed due to caches) */
37*45755Smckusick #define	MHZ_8		1
38*45755Smckusick #define	MHZ_16		2
39*45755Smckusick #define	MHZ_25		3
40*45755Smckusick #define	MHZ_33		4
41*45755Smckusick #define	MHZ_50		6
4241474Smckusick 
4341474Smckusick #ifdef KERNEL
4441474Smckusick extern	int machineid, mmutype, ectype;
45*45755Smckusick extern	unsigned long DIObase;
4641474Smckusick 
4741474Smckusick /* what is this supposed to do? i.e. how is it different than startrtclock? */
4841474Smckusick #define	enablertclock()
4941474Smckusick 
5041474Smckusick #endif
5141474Smckusick 
5241474Smckusick /* physical memory sections */
53*45755Smckusick #define	ROMBASE		(0x00000000)
54*45755Smckusick #define	IOBASE		(0x00200000)
55*45755Smckusick #define	IOTOP		(0x01000000)
56*45755Smckusick #define	MAXADDR		(0xFFFFF000)
5741474Smckusick 
58*45755Smckusick /* DIO space stuff */
59*45755Smckusick #define	INTERNALHPIB	(0x00478000)
60*45755Smckusick #define	EXTIOBASE	(0x00600000)
6141474Smckusick #define	IOCARDSIZE	(0x10000)
6241474Smckusick #define	IOMAPSIZE	(btoc(IOTOP-IOBASE))
6341474Smckusick #define	IOP(x)		((x) - IOBASE)
64*45755Smckusick #define	IOV(x)		(((x) - IOBASE) + DIObase)
65*45755Smckusick #define	UNIOV(x)	((x) - DIObase + IOBASE)
6641474Smckusick 
6741474Smckusick /* DIO II uncached address space */
68*45755Smckusick #define	DIOIIBASE	(0x01000000)
69*45755Smckusick #define	DIOIITOP	(0x20000000)
70*45755Smckusick #define	DIOIICSIZE	(0x00400000)
7141474Smckusick 
72*45755Smckusick /* base/offsets for longword read/write (for locore.s) */
73*45755Smckusick #define	MMUBASE		IOP(0x5F4000)
74*45755Smckusick #define	MMUSSTP		0x0
75*45755Smckusick #define	MMUUSTP		0x4
76*45755Smckusick #define	MMUTBINVAL	0x8
77*45755Smckusick #define	MMUSTAT		0xC
7841474Smckusick #define	MMUCMD		MMUSTAT
7941474Smckusick 
80*45755Smckusick #define	MMU_UMEN	0x0001	/* enable user mapping */
81*45755Smckusick #define	MMU_SMEN	0x0002	/* enable supervisor mapping */
82*45755Smckusick #define	MMU_CEN		0x0004	/* enable data cache */
83*45755Smckusick #define	MMU_BERR	0x0008	/* bus error */
84*45755Smckusick #define	MMU_IEN		0x0020	/* enable instruction cache */
85*45755Smckusick #define	MMU_FPE		0x0040	/* enable 68881 FP coprocessor */
86*45755Smckusick #define	MMU_WPF		0x2000	/* write protect fault */
87*45755Smckusick #define	MMU_PF		0x4000	/* page fault */
88*45755Smckusick #define	MMU_PTF		0x8000	/* page table fault */
8941474Smckusick 
90*45755Smckusick #define	MMU_FAULT	(MMU_PTF|MMU_PF|MMU_WPF|MMU_BERR)
91*45755Smckusick #define	MMU_ENAB	(MMU_UMEN|MMU_SMEN|MMU_IEN|MMU_FPE)
9241474Smckusick 
93*45755Smckusick #define	PMMU_LVLMASK	0x0007
94*45755Smckusick #define	PMMU_INV	0x0400
95*45755Smckusick #define	PMMU_WP		0x0800
96*45755Smckusick #define	PMMU_ALV	0x1000
97*45755Smckusick #define	PMMU_SO		0x2000
98*45755Smckusick #define	PMMU_LV		0x4000
99*45755Smckusick #define	PMMU_BE		0x8000
10041474Smckusick 
101*45755Smckusick #define	PMMU_FAULT	(PMMU_WP|PMMU_INV)
10241474Smckusick 
103*45755Smckusick /* 680X0 function codes */
104*45755Smckusick #define	FC_USERD	1	/* user data space */
105*45755Smckusick #define	FC_USERP	2	/* user program space */
106*45755Smckusick #define	FC_PURGE	3	/* HPMMU: clear TLB entries */
107*45755Smckusick #define	FC_SUPERD	5	/* supervisor data space */
108*45755Smckusick #define	FC_SUPERP	6	/* supervisor program space */
109*45755Smckusick #define	FC_CPU		7	/* CPU space */
11041474Smckusick 
11141474Smckusick /* fields in the 68020 cache control register */
112*45755Smckusick #define	IC_ENABLE	0x0001	/* enable instruction cache */
113*45755Smckusick #define	IC_FREEZE	0x0002	/* freeze instruction cache */
114*45755Smckusick #define	IC_CE		0x0004	/* clear instruction cache entry */
115*45755Smckusick #define	IC_CLR		0x0008	/* clear entire instruction cache */
11641474Smckusick 
11741474Smckusick /* additional fields in the 68030 cache control register */
118*45755Smckusick #define	IC_BE		0x0010	/* instruction burst enable */
119*45755Smckusick #define	DC_ENABLE	0x0100	/* data cache enable */
120*45755Smckusick #define	DC_FREEZE	0x0200	/* data cache freeze */
121*45755Smckusick #define	DC_CE		0x0400	/* clear data cache entry */
122*45755Smckusick #define	DC_CLR		0x0800	/* clear entire data cache */
123*45755Smckusick #define	DC_BE		0x1000	/* data burst enable */
124*45755Smckusick #define	DC_WA		0x2000	/* write allocate */
12541474Smckusick 
126*45755Smckusick #define	CACHE_ON	(DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
127*45755Smckusick #define	CACHE_OFF	(DC_CLR|IC_CLR)
128*45755Smckusick #define	CACHE_CLR	(CACHE_ON)
129*45755Smckusick #define	IC_CLEAR	(DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
130*45755Smckusick #define	DC_CLEAR	(DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE)
131