OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-ia64/] [sn/] [sn2/] [shub_md.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *
3
 * This file is subject to the terms and conditions of the GNU General Public
4
 * License.  See the file "COPYING" in the main directory of this archive
5
 * for more details.
6
 *
7
 * Copyright (c) 2001, 2002-2003 Silicon Graphics, Inc.  All rights reserved.
8
 */
9
 
10
 
11
#ifndef _SHUB_MD_H
12
#define _SHUB_MD_H
13
 
14
/* SN2 supports a mostly-flat address space with 4 CPU-visible, evenly spaced,
15
   contiguous regions, or "software banks".  On SN2, software bank n begins at
16
   addresses n * 16GB, 0 <= n < 4.  Each bank has a 16GB address space.  If
17
   the 4 dimms do not use up this space there will be holes between the
18
   banks.  Even with these holes the whole memory space within a bank is
19
   not addressable address space.  The top 1/32 of each bank is directory
20
   memory space and is accessible through bist only.
21
 
22
   Physically a SN2 node board contains 2 daughter cards with 8 dimm sockets
23
   each.  A total of 16 dimm sockets arranged as 4 "DIMM banks" of 4 dimms
24
   each.  The data is stripped across the 4 memory busses so all dimms within
25
   a dimm bank must have identical capacity dimms.  Memory is increased or
26
   decreased in sets of 4.  Each dimm bank has 2 dimms on each side.
27
 
28
             Physical Dimm Bank layout.
29
                  DTR Card0
30
                 ------------
31
   Dimm Bank 3   |  MemYL3  |   CS 3
32
                 |  MemXL3  |
33
                 |----------|
34
   Dimm Bank 2   |  MemYL2  |   CS 2
35
                 |  MemXL2  |
36
                 |----------|
37
   Dimm Bank 1   |  MemYL1  |   CS 1
38
                 |  MemXL1  |
39
                 |----------|
40
   Dimm Bank 0   |  MemYL0  |   CS 0
41
                 |  MemXL0  |
42
                 ------------
43
                  |       |
44
                  BUS     BUS
45
                  XL      YL
46
                  |       |
47
                 ------------
48
                 |   SHUB   |
49
                 |    MD    |
50
                 ------------
51
                  |       |
52
                  BUS     BUS
53
                  XR      YR
54
                  |       |
55
                 ------------
56
   Dimm Bank 0   |  MemXR0  |   CS 0
57
                 |  MemYR0  |
58
                 |----------|
59
   Dimm Bank 1   |  MemXR1  |   CS 1
60
                 |  MemYR1  |
61
                 |----------|
62
   Dimm Bank 2   |  MemXR2  |   CS 2
63
                 |  MemYR2  |
64
                 |----------|
65
   Dimm Bank 3   |  MemXR3  |   CS 3
66
                 |  MemYR3  |
67
                 ------------
68
                  DTR Card1
69
 
70
   The dimms can be 1 or 2 sided dimms.  The size and bankness is defined
71
   separately for each dimm bank in the sh_[x,y,jnr]_dimm_cfg MMR register.
72
 
73
   Normally software bank 0 would map directly to physical dimm bank 0.  The
74
   software banks can map to the different physical dimm banks via the
75
   DIMM[0-3]_CS field in SH_[x,y,jnr]_DIMM_CFG for each dimm slot.
76
 
77
   All the PROM's data structures (promlog variables, klconfig, etc.)
78
   track memory by the physical dimm bank number.  The kernel usually
79
   tracks memory by the software bank number.
80
 
81
 */
82
 
83
 
84
/* Preprocessor macros */
85
#define MD_MEM_BANKS            4
86
#define MD_PHYS_BANKS_PER_DIMM  2                  /* dimms may be 2 sided. */
87
#define MD_NUM_PHYS_BANKS       (MD_MEM_BANKS * MD_PHYS_BANKS_PER_DIMM)
88
#define MD_DIMMS_IN_SLOT        4  /* 4 dimms in each dimm bank.  aka slot */
89
 
90
/* Address bits 35,34 control dimm bank access. */
91
#define MD_BANK_SHFT            34     
92
#define MD_BANK_MASK            (UINT64_CAST 0x3 << MD_BANK_SHFT )
93
#define MD_BANK_GET(addr)       (((addr) & MD_BANK_MASK) >> MD_BANK_SHFT)
94
#define MD_BANK_SIZE            (UINT64_CAST 0x1 << MD_BANK_SHFT ) /* 16 gb */
95
#define MD_BANK_OFFSET(_b)      (UINT64_CAST (_b) << MD_BANK_SHFT)
96
 
97
/*Address bit 12 selects side of dimm if 2bnk dimms present. */
98
#define MD_PHYS_BANK_SEL_SHFT   12
99
#define MD_PHYS_BANK_SEL_MASK   (UINT64_CAST 0x1 << MD_PHYS_BANK_SEL_SHFT)
100
 
101
/* Address bit 7 determines if data resides on X or Y memory system.
102
 * If addr Bit 7 is set the data resides on Y memory system and
103
 * the corresponing directory entry reside on the X.
104
 */
105
#define MD_X_OR_Y_SEL_SHFT      7       
106
#define MD_X_OR_Y_SEL_MASK      (1 << MD_X_OR_Y_SEL_SHFT)       
107
 
108
/* Address bit 8 determines which directory entry of the pair the address
109
 * corresponds to.  If addr Bit 8 is set DirB corresponds to the memory address.
110
 */
111
#define MD_DIRA_OR_DIRB_SEL_SHFT        8
112
#define MD_DIRA_OR_DIRB_SEL_MASK        (1 << MD_DIRA_OR_DIRB_SEL_SHFT) 
113
 
114
/* Address bit 11 determines if corresponding directory entry resides
115
 * on Left or Right memory bus.  If addr Bit 11 is set the corresponding
116
 * directory entry resides on Right memory bus.
117
 */
118
#define MD_L_OR_R_SEL_SHFT      11
119
#define MD_L_OR_R_SEL_MASK      (1 << MD_L_OR_R_SEL_SHFT)       
120
 
121
/* DRAM sizes. */
122
#define MD_SZ_64_Mb             0x0
123
#define MD_SZ_128_Mb            0x1
124
#define MD_SZ_256_Mb            0x2
125
#define MD_SZ_512_Mb            0x3
126
#define MD_SZ_1024_Mb           0x4
127
#define MD_SZ_2048_Mb           0x5
128
#define MD_SZ_UNUSED            0x7
129
 
130
#define MD_DIMM_SIZE_BYTES(_size, _2bk) (                                \
131
                ( (_size) == 7 ? 0 : ( 0x4000000L << (_size)) << (_2bk)))\
132
 
133
#define MD_DIMM_SIZE_MBYTES(_size, _2bk) (                               \
134
                ( (_size) == 7 ? 0 : ( 0x40L << (_size) ) << (_2bk)))     \
135
 
136
/* The top 1/32 of each bank is directory memory, and not accessible
137
 * via normal reads and writes */
138
#define MD_DIMM_USER_SIZE(_size)        ((_size) * 31 / 32)
139
 
140
/* Minimum size of a populated bank is 64M (62M usable) */
141
#define MIN_BANK_SIZE           MD_DIMM_USER_SIZE((64 * 0x100000))
142
#define MIN_BANK_STRING         "62"
143
 
144
 
145
/*Possible values for FREQ field in sh_[x,y,jnr]_dimm_cfg regs */
146
#define MD_DIMM_100_CL2_0       0x0
147
#define MD_DIMM_133_CL2_0       0x1
148
#define MD_DIMM_133_CL2_5       0x2
149
#define MD_DIMM_160_CL2_0       0x3
150
#define MD_DIMM_160_CL2_5       0x4
151
#define MD_DIMM_160_CL3_0       0x5
152
#define MD_DIMM_200_CL2_0       0x6
153
#define MD_DIMM_200_CL2_5       0x7
154
#define MD_DIMM_200_CL3_0       0x8
155
 
156
/* DIMM_CFG fields */
157
#define MD_DIMM_SHFT(_dimm)     ((_dimm) << 3)
158
#define MD_DIMM_SIZE_MASK(_dimm)                                        \
159
                (SH_JNR_DIMM_CFG_DIMM0_SIZE_MASK <<                     \
160
                (MD_DIMM_SHFT(_dimm)))
161
 
162
#define MD_DIMM_2BK_MASK(_dimm)                                         \
163
                (SH_JNR_DIMM_CFG_DIMM0_2BK_MASK <<                      \
164
                MD_DIMM_SHFT(_dimm))
165
 
166
#define MD_DIMM_REV_MASK(_dimm)                                         \
167
                (SH_JNR_DIMM_CFG_DIMM0_REV_MASK <<                      \
168
                MD_DIMM_SHFT(_dimm))
169
 
170
#define MD_DIMM_CS_MASK(_dimm)                                          \
171
                (SH_JNR_DIMM_CFG_DIMM0_CS_MASK <<                       \
172
                MD_DIMM_SHFT(_dimm))
173
 
174
#define MD_DIMM_SIZE(_dimm, _cfg)                                       \
175
                (((_cfg) & MD_DIMM_SIZE_MASK(_dimm))                    \
176
                >> (MD_DIMM_SHFT(_dimm)+SH_JNR_DIMM_CFG_DIMM0_SIZE_SHFT))
177
 
178
#define MD_DIMM_TWO_SIDED(_dimm,_cfg)                                   \
179
                ( ((_cfg) & MD_DIMM_2BK_MASK(_dimm))                    \
180
                >> (MD_DIMM_SHFT(_dimm)+SH_JNR_DIMM_CFG_DIMM0_2BK_SHFT))
181
 
182
#define MD_DIMM_REVERSED(_dimm,_cfg)                                    \
183
                (((_cfg) & MD_DIMM_REV_MASK(_dimm))                     \
184
                >> (MD_DIMM_SHFT(_dimm)+SH_JNR_DIMM_CFG_DIMM0_REV_SHFT))
185
 
186
#define MD_DIMM_CS(_dimm,_cfg)                                          \
187
                (((_cfg) & MD_DIMM_CS_MASK(_dimm))                      \
188
                >> (MD_DIMM_SHFT(_dimm)+SH_JNR_DIMM_CFG_DIMM0_CS_SHFT))
189
 
190
 
191
 
192
/* Macros to set MMRs that must be set identically to others. */
193
#define MD_SET_DIMM_CFG(_n, _value) {                                   \
194
                REMOTE_HUB_S(_n, SH_X_DIMM_CFG,_value);                 \
195
                REMOTE_HUB_S(_n, SH_Y_DIMM_CFG, _value);                \
196
                REMOTE_HUB_S(_n, SH_JNR_DIMM_CFG, _value);}
197
 
198
#define MD_SET_DQCT_CFG(_n, _value) {                                   \
199
                REMOTE_HUB_S(_n, SH_X_DQCT_CFG,_value);                 \
200
                REMOTE_HUB_S(_n, SH_Y_DQCT_CFG,_value); }
201
 
202
#define MD_SET_CFG(_n, _value) {                                        \
203
                REMOTE_HUB_S(_n, SH_X_CFG,_value);                      \
204
                REMOTE_HUB_S(_n, SH_Y_CFG,_value);}
205
 
206
#define MD_SET_REFRESH_CONTROL(_n, _value) {                            \
207
                REMOTE_HUB_S(_n, SH_X_REFRESH_CONTROL, _value);         \
208
                REMOTE_HUB_S(_n, SH_Y_REFRESH_CONTROL, _value);}
209
 
210
#define MD_SET_DQ_MMR_DIR_COFIG(_n, _value) {                           \
211
                REMOTE_HUB_S(_n, SH_MD_DQLP_MMR_DIR_CONFIG, _value);    \
212
                REMOTE_HUB_S(_n, SH_MD_DQRP_MMR_DIR_CONFIG, _value);}
213
 
214
#define MD_SET_PIOWD_DIR_ENTRYS(_n, _value) {                           \
215
                REMOTE_HUB_S(_n, SH_MD_DQLP_MMR_PIOWD_DIR_ENTRY, _value);\
216
                REMOTE_HUB_S(_n, SH_MD_DQRP_MMR_PIOWD_DIR_ENTRY, _value);}
217
 
218
/*
219
 * There are 12 Node Presence MMRs, 4 in each primary DQ and 4 in the
220
 * LB.  The data in the left and right DQ MMRs and the LB must match.
221
 */
222
#define MD_SET_PRESENT_VEC(_n, _vec, _value) {                             \
223
                REMOTE_HUB_S(_n, SH_MD_DQLP_MMR_DIR_PRESVEC0+((_vec)*0x10),\
224
                         _value);                                          \
225
                REMOTE_HUB_S(_n, SH_MD_DQRP_MMR_DIR_PRESVEC0+((_vec)*0x10),\
226
                         _value);                                          \
227
                REMOTE_HUB_S(_n, SH_SHUBS_PRESENT0+((_vec)*0x80), _value);}
228
/*
229
 * There are 16 Privilege Vector MMRs, 8 in each primary DQ.  The data
230
 * in the corresponding left and right DQ MMRs must match.  Each MMR
231
 * pair is used for a single partition.
232
 */
233
#define MD_SET_PRI_VEC(_n, _vec, _value) {                                \
234
                REMOTE_HUB_S(_n, SH_MD_DQLP_MMR_DIR_PRIVEC0+((_vec)*0x10),\
235
                         _value);                                         \
236
                REMOTE_HUB_S(_n, SH_MD_DQRP_MMR_DIR_PRIVEC0+((_vec)*0x10),\
237
                         _value);}
238
/*
239
 * There are 16 Local/Remote MMRs, 8 in each primary DQ.  The data in
240
 * the corresponding left and right DQ MMRs must match.  Each MMR pair
241
 * is used for a single partition.
242
 */
243
#define MD_SET_LOC_VEC(_n, _vec, _value) {                              \
244
                REMOTE_HUB_S(_n, SH_MD_DQLP_MMR_DIR_LOCVEC0+((_vec)*0x10),\
245
                         _value);                                       \
246
                REMOTE_HUB_S(_n, SH_MD_DQRP_MMR_DIR_LOCVEC0+((_vec)*0x10),\
247
                         _value);}
248
 
249
/* Memory BIST CMDS */
250
#define MD_DIMM_INIT_MODE_SET   0x0
251
#define MD_DIMM_INIT_REFRESH    0x1
252
#define MD_DIMM_INIT_PRECHARGE  0x2
253
#define MD_DIMM_INIT_BURST_TERM 0x6
254
#define MD_DIMM_INIT_NOP        0x7
255
#define MD_DIMM_BIST_READ       0x10
256
#define MD_FILL_DIR             0x20
257
#define MD_FILL_DATA            0x30
258
#define MD_FILL_DIR_ACCESS      0X40
259
#define MD_READ_DIR_PAIR        0x50
260
#define MD_READ_DIR_TAG         0x60
261
 
262
/* SH_MMRBIST_CTL macros */
263
#define MD_BIST_FAIL(_n) (REMOTE_HUB_L(_n, SH_MMRBIST_CTL) &            \
264
                SH_MMRBIST_CTL_FAIL_MASK)
265
 
266
#define MD_BIST_IN_PROGRESS(_n) (REMOTE_HUB_L(_n, SH_MMRBIST_CTL) &     \
267
                SH_MMRBIST_CTL_IN_PROGRESS_MASK)
268
 
269
#define MD_BIST_MEM_IDLE(_n); (REMOTE_HUB_L(_n, SH_MMRBIST_CTL) &       \
270
                SH_MMRBIST_CTL_MEM_IDLE_MASK)
271
 
272
/* SH_MMRBIST_ERR macros */
273
#define MD_BIST_MISCOMPARE(_n) (REMOTE_HUB_L(_n, SH_MMRBIST_ERR) &      \
274
                SH_MMRBIST_ERR_DETECTED_MASK)
275
 
276
#endif  /* _SHUB_MD_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.