tsreg.h revision 1.3.4.2 1 1.3.4.2 toshii /* $NetBSD: tsreg.h,v 1.3.4.2 2001/07/05 08:38:25 toshii Exp $ */
2 1.3.4.2 toshii
3 1.3.4.2 toshii /*-
4 1.3.4.2 toshii * Copyright (c) 1999 by Ross Harvey. All rights reserved.
5 1.3.4.2 toshii *
6 1.3.4.2 toshii * Redistribution and use in source and binary forms, with or without
7 1.3.4.2 toshii * modification, are permitted provided that the following conditions
8 1.3.4.2 toshii * are met:
9 1.3.4.2 toshii * 1. Redistributions of source code must retain the above copyright
10 1.3.4.2 toshii * notice, this list of conditions and the following disclaimer.
11 1.3.4.2 toshii * 2. Redistributions in binary form must reproduce the above copyright
12 1.3.4.2 toshii * notice, this list of conditions and the following disclaimer in the
13 1.3.4.2 toshii * documentation and/or other materials provided with the distribution.
14 1.3.4.2 toshii * 3. All advertising materials mentioning features or use of this software
15 1.3.4.2 toshii * must display the following acknowledgement:
16 1.3.4.2 toshii * This product includes software developed by Ross Harvey.
17 1.3.4.2 toshii * 4. The name of Ross Harvey may not be used to endorse or promote products
18 1.3.4.2 toshii * derived from this software without specific prior written permission.
19 1.3.4.2 toshii *
20 1.3.4.2 toshii * THIS SOFTWARE IS PROVIDED BY ROSS HARVEY ``AS IS'' AND ANY EXPRESS
21 1.3.4.2 toshii * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 1.3.4.2 toshii * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP0SE
23 1.3.4.2 toshii * ARE DISCLAIMED. IN NO EVENT SHALL ROSS HARVEY BE LIABLE FOR ANY
24 1.3.4.2 toshii * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 1.3.4.2 toshii * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 1.3.4.2 toshii * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 1.3.4.2 toshii * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 1.3.4.2 toshii * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 1.3.4.2 toshii * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 1.3.4.2 toshii * SUCH DAMAGE.
31 1.3.4.2 toshii *
32 1.3.4.2 toshii */
33 1.3.4.2 toshii
34 1.3.4.2 toshii /*
35 1.3.4.2 toshii * 21272 Core Logic registers and constants.
36 1.3.4.2 toshii */
37 1.3.4.2 toshii
38 1.3.4.2 toshii #define tsreg() { Generate ctags(1) key. }
39 1.3.4.2 toshii
40 1.3.4.2 toshii /*
41 1.3.4.2 toshii * Superpage pointer from physical address.
42 1.3.4.2 toshii */
43 1.3.4.2 toshii #define S_PAGE(phys) ((void *)ALPHA_PHYS_TO_K0SEG(phys))
44 1.3.4.2 toshii
45 1.3.4.2 toshii /*
46 1.3.4.2 toshii * {LD,ST}QP: LoaD and STore Quad Physical
47 1.3.4.2 toshii */
48 1.3.4.2 toshii #define LDQP(a) (*(volatile long *)ALPHA_PHYS_TO_K0SEG(a))
49 1.3.4.2 toshii #define STQP(a) LDQP(a)
50 1.3.4.2 toshii
51 1.3.4.2 toshii /*
52 1.3.4.2 toshii * Define extraction functions for bit fields via length and left,right bitno
53 1.3.4.2 toshii */
54 1.3.4.2 toshii #define TSFIELD(r,offs,len) (((r) >> (offs)) & (~0UL >> (64 - (len))))
55 1.3.4.2 toshii #define TSFIELDBB(r,lb,rb) TSFIELD((r), (rb), (lb) - (rb) + 1)
56 1.3.4.2 toshii
57 1.3.4.2 toshii /*
58 1.3.4.2 toshii * EV6 has a new superpage which can pass through 44 address bits. (Umm, a
59 1.3.4.2 toshii * superduperpage?) But, the firmware doesn't turn it on, so we use the old
60 1.3.4.2 toshii * one and let the HW sign extend va/pa<40> to get us the pa<43> that makes
61 1.3.4.2 toshii * the needed I/O space access. This is just as well; it means we don't have
62 1.3.4.2 toshii * to worry about which GENERIC code might get called on other CPU models.
63 1.3.4.2 toshii *
64 1.3.4.2 toshii * E.g., we want this: 0x0801##a000##0000
65 1.3.4.2 toshii * We use this: 0x0101##a000##0000
66 1.3.4.2 toshii * ...mix in the old SP: 0xffff##fc00##0000##0000
67 1.3.4.2 toshii * ...after PA sign ext: 0xffff##ff00##a000##0000
68 1.3.4.2 toshii * (PA<42:41> ignored)
69 1.3.4.2 toshii */
70 1.3.4.2 toshii
71 1.3.4.2 toshii /*
72 1.3.4.2 toshii * This hack allows us to map the I/O address space without using
73 1.3.4.2 toshii * the KSEG sign extension hack.
74 1.3.4.2 toshii */
75 1.3.4.2 toshii #define TS_PHYSADDR(x) \
76 1.3.4.2 toshii (((x) & ~0x0100##0000##0000) | 0x0800##0000##0000)
77 1.3.4.2 toshii
78 1.3.4.2 toshii /*
79 1.3.4.2 toshii * Cchip CSR Map
80 1.3.4.2 toshii */
81 1.3.4.2 toshii
82 1.3.4.2 toshii #define TS_C_CSC 0x101##a000##0000UL /* Cchip System Configuration */
83 1.3.4.2 toshii
84 1.3.4.2 toshii # define CSC_P1P (1L << 14)
85 1.3.4.2 toshii # define CSC_BC(r) TSFIELD((r), 0, 2)
86 1.3.4.2 toshii # define CSC_AW (1L << 8)
87 1.3.4.2 toshii
88 1.3.4.2 toshii #define TS_C_MTR 0x101##a000##0040UL
89 1.3.4.2 toshii
90 1.3.4.2 toshii #define TS_C_MISC 0x101##a000##0080UL /* Miscellaneous Register */
91 1.3.4.2 toshii
92 1.3.4.2 toshii # define MISC_REV(r) TSFIELD((r), 39, 8)
93 1.3.4.2 toshii
94 1.3.4.2 toshii #define TS_C_MPD 0x101##a000##00c0UL
95 1.3.4.2 toshii
96 1.3.4.2 toshii #define TS_C_AAR0 0x101##a000##0100UL
97 1.3.4.2 toshii #define TS_C_AAR1 0x101##a000##0140UL
98 1.3.4.2 toshii #define TS_C_AAR2 0x101##a000##0180UL
99 1.3.4.2 toshii #define TS_C_AAR3 0x101##a000##01c0UL
100 1.3.4.2 toshii
101 1.3.4.2 toshii # define AAR_ASIZ(r) TSFIELD((r), 12, 4)
102 1.3.4.2 toshii # define AAR_SPLIT (1L << 8)
103 1.3.4.2 toshii
104 1.3.4.2 toshii #define TS_C_DIM0 0x101##a000##0200UL
105 1.3.4.2 toshii #define TS_C_DIM1 0x101##a000##0240UL
106 1.3.4.2 toshii #define TS_C_DIR0 0x101##a000##0280UL
107 1.3.4.2 toshii #define TS_C_DIR1 0x101##a000##02c0UL
108 1.3.4.2 toshii #define TS_C_DRIR 0x101##a000##0300UL
109 1.3.4.2 toshii #define TS_C_PRBEN 0x101##a000##0340UL
110 1.3.4.2 toshii #define TS_C_IIC0 0x101##a000##0380UL
111 1.3.4.2 toshii #define TS_C_IIC1 0x101##a000##03c0UL
112 1.3.4.2 toshii #define TS_C_MPR0 0x101##a000##0400UL
113 1.3.4.2 toshii #define TS_C_MPR1 0x101##a000##0440UL
114 1.3.4.2 toshii #define TS_C_MPR2 0x101##a000##0480UL
115 1.3.4.2 toshii #define TS_C_MPR3 0x101##a000##04c0UL
116 1.3.4.2 toshii #define TS_C_MCTL 0x101##a000##0500UL
117 1.3.4.2 toshii
118 1.3.4.2 toshii #define TS_C_TTR 0x101##a000##0580UL
119 1.3.4.2 toshii #define TS_C_TDR 0x101##a000##05c0UL
120 1.3.4.2 toshii
121 1.3.4.2 toshii /*
122 1.3.4.2 toshii * Dchip CSR Map
123 1.3.4.2 toshii */
124 1.3.4.2 toshii
125 1.3.4.2 toshii #define TS_D_DSC 0x101##b000##0800UL
126 1.3.4.2 toshii #define TS_D_STR 0x101##b000##0840UL
127 1.3.4.2 toshii #define TS_D_DREV 0x101##b000##0880UL
128 1.3.4.2 toshii #define TS_D_DSC2 0x101##b000##08c0UL
129 1.3.4.2 toshii
130 1.3.4.2 toshii /*
131 1.3.4.2 toshii * Pchip CSR Offsets
132 1.3.4.2 toshii */
133 1.3.4.2 toshii
134 1.3.4.2 toshii #define P_WSBA0 0x0000
135 1.3.4.2 toshii #define P_WSBA1 0x0040
136 1.3.4.2 toshii #define P_WSBA2 0x0080
137 1.3.4.2 toshii #define P_WSBA3 0x00c0
138 1.3.4.2 toshii
139 1.3.4.2 toshii # define WSBA_ADDR(r) (TSFIELDBB((r), 31, 20) << 20)
140 1.3.4.2 toshii # define WSBA_SG 2
141 1.3.4.2 toshii # define WSBA_ENA 1
142 1.3.4.2 toshii
143 1.3.4.2 toshii #define P_WSM0 0x0100
144 1.3.4.2 toshii #define P_WSM1 0x0140
145 1.3.4.2 toshii #define P_WSM2 0x0180
146 1.3.4.2 toshii #define P_WSM3 0x01c0
147 1.3.4.2 toshii
148 1.3.4.2 toshii # define WSM_AM(r) TSFIELDBB((r), 31, 20)
149 1.3.4.2 toshii # define WSM_LEN(r) ((WSM_AM(r) + 1) << 20)
150 1.3.4.2 toshii
151 1.3.4.2 toshii #define P_TBA0 0x0200
152 1.3.4.2 toshii #define P_TBA1 0x0240
153 1.3.4.2 toshii #define P_TBA2 0x0280
154 1.3.4.2 toshii #define P_TBA3 0x02c0
155 1.3.4.2 toshii
156 1.3.4.2 toshii #define P_PCTL 0x0300
157 1.3.4.2 toshii #define P_PLAT 0x0340
158 1.3.4.2 toshii /* reserved 0x0380 */
159 1.3.4.2 toshii #define P_PERROR 0x03c0
160 1.3.4.2 toshii
161 1.3.4.2 toshii #define P_PERRMASK 0x0400
162 1.3.4.2 toshii #define P_PERRSET 0x0440
163 1.3.4.2 toshii #define P_TLBIV 0x0480
164 1.3.4.2 toshii #define P_TLBIA 0x04c0
165 1.3.4.2 toshii
166 1.3.4.2 toshii #define P_PMONCTL 0x0500
167 1.3.4.2 toshii #define P_PMONCNT 0x0540
168 1.3.4.2 toshii
169 1.3.4.2 toshii #define P_SPRST 0x0800
170 1.3.4.2 toshii
171 1.3.4.2 toshii #define TS_STEP 0x40
172 1.3.4.2 toshii
173 1.3.4.2 toshii /*
174 1.3.4.2 toshii * Pchip I/O offsets
175 1.3.4.2 toshii */
176 1.3.4.2 toshii
177 1.3.4.2 toshii #define P_CSRBASE 0x001##8000##0000UL
178 1.3.4.2 toshii #define P_PCI_MEM 0
179 1.3.4.2 toshii #define P_PCI_IO 0x001##fc00##0000UL
180 1.3.4.2 toshii #define P_PCI_CONFIG 0x001##fe00##0000UL
181 1.3.4.2 toshii
182 1.3.4.2 toshii /*
183 1.3.4.2 toshii * Construct EV6 I/O Space Address for Pchip 0 and Pchip 1.
184 1.3.4.2 toshii */
185 1.3.4.2 toshii
186 1.3.4.2 toshii #define TS_P0(offs) (0x100##0000##0000UL + (offs))
187 1.3.4.2 toshii #define TS_P1(offs) (0x102##0000##0000UL + (offs))
188 1.3.4.2 toshii #define TS_Pn(n, offs) (0x100##0000##0000UL + 0x2##0000##0000UL * (n) + (offs))
189 1.3.4.2 toshii
190 1.3.4.2 toshii /*
191 1.3.4.2 toshii * Tsunami Generic Register Type
192 1.3.4.2 toshii */
193 1.3.4.2 toshii typedef struct _ts_gr {
194 1.3.4.2 toshii volatile u_int64_t tsg_r;
195 1.3.4.2 toshii long tsg_deadspace[7];
196 1.3.4.2 toshii } TS_GR;
197 1.3.4.2 toshii
198 1.3.4.2 toshii /*
199 1.3.4.2 toshii * Tsunami Pchip
200 1.3.4.2 toshii */
201 1.3.4.2 toshii struct ts_pchip {
202 1.3.4.2 toshii TS_GR tsp_wsba[4]; /* Window Space Base Address */
203 1.3.4.2 toshii
204 1.3.4.2 toshii TS_GR tsp_wsm[4]; /* Window Space Mask */
205 1.3.4.2 toshii
206 1.3.4.2 toshii TS_GR tsp_tba[4]; /* Translated Base Address */
207 1.3.4.2 toshii
208 1.3.4.2 toshii TS_GR tsp_pctl; /* Pchip Control */
209 1.3.4.2 toshii TS_GR tsp_plat; /* Pchip Latency */
210 1.3.4.2 toshii TS_GR tsp_resA;
211 1.3.4.2 toshii TS_GR tsp_error; /* Pchip Error */
212 1.3.4.2 toshii
213 1.3.4.2 toshii TS_GR tsp_perrmask; /* Pchip Error Mask */
214 1.3.4.2 toshii TS_GR tsp_perrset; /* Pchip Error Set */
215 1.3.4.2 toshii TS_GR tsp_tlbiv; /* Translation Buffer Invalidate Virtual */
216 1.3.4.2 toshii TS_GR tsp_tlbia; /* Translation Buffer Invalidate All */
217 1.3.4.2 toshii
218 1.3.4.2 toshii TS_GR tsp_pmonctl; /* PChip Monitor Control */
219 1.3.4.2 toshii TS_GR tsp_pmoncnt; /* PChip Monitor Counters */
220 1.3.4.2 toshii TS_GR tsp_resB;
221 1.3.4.2 toshii TS_GR tsp_resC;
222 1.3.4.2 toshii
223 1.3.4.2 toshii TS_GR tsp_resD_K[8];
224 1.3.4.2 toshii
225 1.3.4.2 toshii TS_GR tsp_sprts; /* ??? */
226 1.3.4.2 toshii };
227