1 /*	$NetBSD: crimereg.h,v 1.10 2005/12/11 12:18:52 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 2000 Soren S. Jorvang
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *          This product includes software developed for the
18  *          NetBSD Project.  See http://www.NetBSD.org/ for
19  *          information about NetBSD.
20  * 4. The name of the author may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /*
36  * O2 CRIME register definitions
37  */
38 
39 #define CRIME_BASE	0x14000000	/* all registers 64-bit access */
40 
41 /* Offset 0x00 -- revision register */
42 #define CRIME_REV		0x00
43 #define CRIME_ID_IDBITS		0x000000f0
44 #define CRIME_ID_IDSHIFT	4
45 #define CRIME_ID_REV		0x0000000f
46 #define CRIME_REV_PETTY		0x00
47 #define CRIME_REV_11		0x11
48 #define CRIME_REV_13		0x13
49 #define CRIME_REV_14		0x14
50 
51 /* offset 0x08 -- control register.  Only lower 14 bits are valid */
52 #define CRIME_CONTROL			0x08
53 #define CRIME_CONTROL_TRITON_SYSADC	 0x2000
54 #define CRIME_CONTROL_CRIME_SYSADC	 0x1000
55 #define CRIME_CONTROL_HARD_RESET	 0x0800
56 #define CRIME_CONTROL_SOFT_RESET	 0x0400
57 #define CRIME_CONTROL_DOG_ENABLE	 0x0200
58 #define CRIME_CONTROL_ENDIANESS		 0x0100 /* assert for BE */
59 #define CRIME_CONTROL_CQUEUE_HWM	 0x000f
60 #define CRIME_CONTROL_CQUEUE_SHFT	 0
61 #define CRIME_CONTROL_WBUF_HWM		 0x00f0
62 #define CRIME_CONTROL_WBUF_SHFT		 8
63 
64 /*
65  * macros to manipulate CRIME High Water Mark bits in
66  * the CRIME control register.  Examples:
67  *
68  * foo = CRM_CONTROL_GET_CQUEUE_HWM(*(__uint64_t *)CRM_CONTROL)
69  * CRM_CONTROL_SET_CQUEUE_HWM(*(__uint64_t *)CRM_CONTROL, 4)
70  *
71  * foo = CRM_CONTROL_GET_WBUF_HWM(*(__uint64_t *)CRM_CONTROL)
72  * CRM_CONTROL_SET_WBUF_HWM(*(__uint64_t *)CRM_CONTROL, 4)
73  */
74 #define CRM_CONTROL_GET_CQUEUE_HWM(x)   \
75 	(((x) & CRM_CONTROL_CQUEUE_HWM) >> CRM_CONTROL_CQUEUE_SHFT)
76 #define CRM_CONTROL_SET_CQUEUE_HWM(x,v) \
77 	(((v) << CRM_CONTROL_CQUEUE_SHFT) | ((x) & ~CRM_CONTROL_CQUEUE_HWM))
78 
79 #define CRM_CONTROL_GET_WBUF_HWM(x)     \
80 	(((x) & CRM_CONTROL_WBUF_HWM) >> CRM_CONTROL_WBUF_SHFT)
81 #define CRM_CONTROL_SET_WBUF_HWM(x,v)   \
82 	(((v) << CRM_CONTROL_WBUF_SHFT) | ((x) & ~CRM_CONTROL_WBUF_HWM))
83 
84 
85 /* Offset 0x010 -- interrupt status register.  All 32 bits valid */
86 #define CRIME_INTSTAT		0x10
87 #define CRIME_INT_VICE		0x80000000
88 #define CRIME_INT_SOFT2		0x40000000 /* Also CPU_SysCorErr */
89 #define CRIME_INT_SOFT1		0x20000000
90 #define CRIME_INT_SOFT0		0x10000000
91 #define CRIME_INT_RE5		0x08000000
92 #define CRIME_INT_RE4		0x04000000
93 #define CRIME_INT_RE3		0x02000000
94 #define CRIME_INT_RE2		0x01000000
95 #define CRIME_INT_RE1		0x00800000
96 #define CRIME_INT_RE0		0x00400000
97 #define CRIME_INT_MEMERR	0x00200000
98 #define CRIME_INT_CRMERR	0x00100000
99 #define CRIME_INT_GBE3		0x00080000
100 #define CRIME_INT_GBE2		0x00040000
101 #define CRIME_INT_GBE1		0x00020000
102 #define CRIME_INT_GBE0		0x00010000
103 #define CRIME_INT_PCI_SHARED2	0x00008000 /* from here, actually mace irqs */
104 #define CRIME_INT_PCI_SHARED1	0x00004000
105 #define CRIME_INT_PCI_SHARED0	0x00002000
106 #define CRIME_INT_PCI_SLOT2	0x00001000
107 #define CRIME_INT_PCI_SLOT1	0x00000800
108 #define CRIME_INT_PCI_SLOT0	0x00000400
109 #define CRIME_INT_PCI_SCSI1	0x00000200
110 #define CRIME_INT_PCI_SCSI0	0x00000100
111 #define CRIME_INT_PCI_BRIDGE	0x00000080
112 #define CRIME_INT_PERIPH_AUD	0x00000040
113 #define CRIME_INT_PERIPH_MISC	0x00000020
114 #define CRIME_INT_PERIPH_SERIAL	0x00000010
115 #define CRIME_INT_ETHERNET	0x00000008
116 #define CRIME_INT_VID_OUT	0x00000004
117 #define CRIME_INT_VID_IN2	0x00000002
118 #define CRIME_INT_VID_IN1	0x00000001
119 
120 /* Masks, hard interrupts, soft interrupts.  */
121 #define CRIME_INTMASK		0x18
122 #define CRIME_SOFTINT		0x20
123 #define CRIME_HARDINT		0x28
124 
125 /*
126  * Offset 0x030 -- watchdog register.  33 bits are valid
127  * Bit 32:  power on reset
128  * Bit 31:  warm reset
129  * Write zero here to reset watchdog
130  */
131 
132 #define CRIME_DOG		0x30
133 #define CRIME_WATCHDOG		CRIME_DOG
134 #define CRIME_TIME		0x38
135 #define CRIME_TIME_MASK		0x0000ffffffffffffULL
136 #define CRIME_CPU_ERROR_ADDR	0x40
137 #define CRIME_CPU_ERROR_STAT	0x48
138 #define CRIME_CPU_ERROR_ENA	0x50
139 #define CRIME_VICE_ERROR_ADDR	0x58
140 #define CRIME_MEM_CONTROL	0x0200
141 #define CRIME_MEM_BANK_CTRL0	0x0208
142 #define CRIME_MEM_BANK_CTRL1	0x0218
143 #define CRIME_MEM_BANK_CTRL2	0x0210
144 #define CRIME_MEM_BANK_CTRL3	0x0228
145 #define CRIME_MEM_BANK_CTRL4	0x0220
146 #define CRIME_MEM_BANK_CTRL5	0x0238
147 #define CRIME_MEM_BANK_CTRL6	0x0230
148 #define CRIME_MEM_BANK_CTRL7	0x0248
149 #define CRIME_MEM_REFRESH_CNTR	0x0248
150 #define CRIME_MEM_ERROR_STAT	0x0250
151 #define CRIME_MEM_ERROR_ADDR	0x0258
152 #define CRIME_MEM_ERROR_ECC_SYN	0x0260
153 #define CRIME_MEM_ERROR_ECC_CHK	0x0268
154 #define CRIME_MEM_ERROR_ECC_REPL 0x0270
155 
156 #define McGriff CRIME_DOG /* Baseball compatibility */
157