Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / n2_piu / include / defs.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: defs.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23
24/*
25 * this file includes complete/dummy definitions of structures used by legion.
26 * the idea is to implement only those variables that are actually
27 * accessed by piu, initialized with either arbitrary values or
28 * those that make sense from SAM's perspective.
29 */
30
31/////////////////////////////////////////////////////////////////////
32
33////////////////////////////////////////////////////////////////
34
35 /*
36 * Generic physical and virtual address types.
37 *
38 * Core design is 64 bit addressing, however some
39 * chips & cores may use 32bits in which case the
40 * bit widths should be explicit, but for the general
41 * infrastructure types use these two.
42 */
43
44typedef uint64_t tpaddr_t;
45typedef uint64_t tvaddr_t;
46
47////////////////////////////////////////////////////////////////
48
49/*
50 * below lifted from legions' src/include/simcore.h
51 */
52
53 /*
54 * Op fields for memory access operations
55 *
56 * Note: These field values are used by the core for embedding
57 * in decoded instructions. However, processor modules may also
58 * choose additional specific encodings that are restricted to
59 * those modules only and are defined elsewhere.
60 *
61 * Care should be taken when modifying these codes as not to
62 * tread on value defined elsewhere (values >= 0x100 && < 0xfff0).
63 *
64 * Processor specific modules should use the value
65 * MA_Non_Gen_Base as the base for their specific definitions.
66 *
67 * The generic core values reside in no more than 8 bits
68 * and are used to define basic load, store and cas operations.
69 */
70
71enum MACCESS {
72 MA_Size_Mask = 0xf,
73
74 MA_Size8 = 0x0,
75 MA_Size16 = 0x1,
76 MA_Size32 = 0x2,
77 MA_Size64 = 0x3,
78 MA_Size128 = 0x4,
79 MA_Size256 = 0x5,
80 MA_Size512 = 0x6,
81
82 MA_Op_MaskGeneric = 0xf0,
83 MA_Op_Mask = 0xfff0,
84
85 MA_Ld = 0x00,
86 MA_LdSigned = 0x10,
87 MA_LdDouble = 0x20, /* SPARC only ? */
88 MA_LdFloat = 0x30,
89 MA_St = 0x40,
90 MA_StFloat = 0x50,
91 MA_CAS = 0x60,
92 MA_StDouble = 0x70, /* SPARC only ? */
93 MA_LdSt = 0x80,
94 MA_Swap = 0x90,
95
96 MA_Non_Gen_Base = 0x100, /* First non generic useable value */
97 MA_Non_Gen_Skip = 0x10, /* skip value for non-generic codes */
98
99 MA_ldu8 = MA_Size8 | MA_Ld,
100 MA_ldu16 = MA_Size16 | MA_Ld,
101 MA_ldu32 = MA_Size32 | MA_Ld,
102 MA_ldu64 = MA_Size64 | MA_Ld,
103
104 MA_lddu64 = MA_Size64 | MA_LdDouble, /* loads 64 bit value 64 bit aligned */
105 MA_stdu64 = MA_Size64 | MA_StDouble,
106
107 MA_lddu128 = MA_Size128 | MA_LdDouble, /* loads 2x64 bit
108 values atomically
109 128 bit aligned */
110
111 MA_lds8 = MA_Size8 | MA_LdSigned,
112 MA_lds16 = MA_Size16 | MA_LdSigned,
113 MA_lds32 = MA_Size32 | MA_LdSigned,
114 MA_lds64 = MA_Size64 | MA_LdSigned,
115
116 MA_st8 = MA_Size8 | MA_St,
117 MA_st16 = MA_Size16 | MA_St,
118 MA_st32 = MA_Size32 | MA_St,
119 MA_st64 = MA_Size64 | MA_St,
120
121 MA_ldfp8 = MA_Size8 | MA_LdFloat,
122 MA_ldfp16 = MA_Size16 | MA_LdFloat,
123 MA_ldfp32 = MA_Size32 | MA_LdFloat,
124 MA_ldfp64 = MA_Size64 | MA_LdFloat,
125 MA_ldfp128 = MA_Size128 | MA_LdFloat,
126
127 MA_stfp8 = MA_Size8 | MA_StFloat,
128 MA_stfp16 = MA_Size16 | MA_StFloat,
129 MA_stfp32 = MA_Size32 | MA_StFloat,
130 MA_stfp64 = MA_Size64 | MA_StFloat,
131 MA_stfp128 = MA_Size128 | MA_StFloat,
132
133 MA_cas32 = MA_Size32 | MA_CAS,
134 MA_cas64 = MA_Size64 | MA_CAS,
135
136 /* Are these generic ? FIXME */
137 MA_ldstub = MA_Size8 | MA_LdSt,
138 MA_swap = MA_Size32 | MA_Swap
139};
140
141typedef enum MACCESS maccess_t;
142
143/*
144 * These macros must be passed an op masked with MA_Op_Mask.
145 * It is intended that they be included as part of a architecture
146 * specific form, hence the underscore prefix.
147 */
148#define _IS_MA_LOAD(_op) \
149 (MA_Ld == (_op) || MA_LdSigned == (_op) || \
150 MA_LdDouble == (_op) || MA_LdFloat == (_op) || \
151 MA_LdSt == (_op) || MA_CAS == (_op) || MA_Swap == (_op))
152#define _IS_MA_STORE(_op) \
153 (MA_St == (_op) || MA_StDouble == (_op) || \
154 MA_StFloat == (_op) || \
155 MA_LdSt == (_op) || MA_CAS == (_op) || MA_Swap == (_op))
156#define _IS_MA_ATOMIC(_op) \
157 (MA_LdSt == (_op) || MA_CAS == (_op) || MA_Swap == (_op))
158
159
160
161
162///////////////////////////////////////////////////////////////
163//
164 /* definitions from src/parser/include/config.h */
165
166
167typedef enum {
168 PIU_REGION_CFGIO = 0,
169 PIU_REGION_MEM32 = 1,
170 PIU_REGION_MEM64 = 2,
171 PIU_REGION_8MB = 3,
172 PIU_REGION_UNMAPPED
173} piu_region_t;
174
175typedef enum {
176 DA_Load = 0x1,
177 DA_Store = 0x2,
178 DA_Atomic = 0x3, /* bit fields - atomic considered load | store */
179 DA_Instn = 0x4,
180 DA_Other = 0x8
181} dev_access_t;
182
183
184///////////////////////////////////////////////////////////////
185// other hash defines.
186
187#define MASK64( _high, _low ) ( ( (uint64_t)((~(uint64_t)0)>>(63-(_high))) ) & ( (uint64_t)( (~(uint64_t)0)<<(_low)) ) )
188#define GETMASK64(x, hi, lo) (((uint64_t)(x) & MASK64((hi), (lo)))>>(lo))
189
190#define PHYS_ADDR_NCU 0x8000000000
191#define PHYS_ADDR_CCU 0x8300000000
192#define PHYS_ADDR_MCU 0x8400000000
193#define PHYS_ADDR_HWDBG 0x8600000000
194#define PHYS_ADDR_DMU 0x8800000000
195#define PHYS_ADDR_RCU 0x8900000000
196#define PHYS_ADDR_L2C 0xA000000000
197#define PHYS_ADDR_PIU_LB 0xC000000000
198#define PHYS_ADDR_PIU_UB 0xCF00000000
199#define PHYS_ADDR_SSI 0xFF00000000
200#define PHYS_ADDR_JTAG 0x9000000000
201
202#define PHYS_ADDR_MASK 0xFF00000000
203/*
204 * DMU 8MB configu region address map
205 */
206#define DMU_8MB_GAP_MASK MASK64(31,23)
207#define DMU_8MB_OFFSET_MASK MASK64(22,0)
208
209
210/*
211 * PCIE Mondo interrupt
212 */
213typedef struct PCIE_MONDO {
214 int thread_id;
215 uint64_t data[8];
216} pcie_mondo_t;
217
218
219
220typedef enum {
221 ES_IDLE,
222 ES_RESUME,
223 ES_RESET,
224 ES_SSI,
225 ES_JBUS,
226 ES_SPOR,
227 ES_XIR,
228 ES_NIU,
229 ES_PCIE
230} ext_sig_t;
231
232
233typedef enum {
234 PCIE_IS32 = 0,
235 PCIE_IS64 = 1
236} dev_mode_t;
237
238typedef enum {
239 _PCIE_CFG = 0,
240 _PCIE_IO = 1,
241 _PCIE_MEM32 = 2,
242 _PCIE_MEM64 = 3
243} pcie_space_t;
244
245struct config_dev_t{
246 uint64_t dummy;
247};
248
249struct config_proc_t{
250 uint64_t dummy;
251};