aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ia64/sn/addrs.h
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2005-08-29 18:48:51 -0400
committerTony Luck <tony.luck@intel.com>2005-08-29 18:48:51 -0400
commitbcdd3a911499abd65bf1f123b2a6ad9c1d5611ea (patch)
treea72709cf2686dbfb390f4e8d43be221058562b19 /include/asm-ia64/sn/addrs.h
parentb946ecbb11145ae2f375d2d7289a6e7280462b02 (diff)
parentd1e079b3fc90c7c114f46771e983a72ac8740882 (diff)
Pull ngam-maule-steiner into release branch
Diffstat (limited to 'include/asm-ia64/sn/addrs.h')
-rw-r--r--include/asm-ia64/sn/addrs.h79
1 files changed, 59 insertions, 20 deletions
diff --git a/include/asm-ia64/sn/addrs.h b/include/asm-ia64/sn/addrs.h
index 103d745dc5f2..8881882ccafb 100644
--- a/include/asm-ia64/sn/addrs.h
+++ b/include/asm-ia64/sn/addrs.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 1992-1999,2001-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (c) 1992-1999,2001-2005 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#ifndef _ASM_IA64_SN_ADDRS_H 9#ifndef _ASM_IA64_SN_ADDRS_H
@@ -126,6 +126,7 @@
126#define GLOBAL_MMR_PHYS_ADDR(n,a) (GLOBAL_PHYS_MMR_SPACE | REMOTE_ADDR(n,a)) 126#define GLOBAL_MMR_PHYS_ADDR(n,a) (GLOBAL_PHYS_MMR_SPACE | REMOTE_ADDR(n,a))
127#define GLOBAL_CAC_ADDR(n,a) (CAC_BASE | REMOTE_ADDR(n,a)) 127#define GLOBAL_CAC_ADDR(n,a) (CAC_BASE | REMOTE_ADDR(n,a))
128#define CHANGE_NASID(n,x) ((void *)(((u64)(x) & ~NASID_MASK) | NASID_SPACE(n))) 128#define CHANGE_NASID(n,x) ((void *)(((u64)(x) & ~NASID_MASK) | NASID_SPACE(n)))
129#define IS_TIO_NASID(n) ((n) & 1)
129 130
130 131
131/* non-II mmr's start at top of big window space (4G) */ 132/* non-II mmr's start at top of big window space (4G) */
@@ -155,10 +156,28 @@
155 * the chiplet id is zero. If we implement TIO-TIO dma, we might need 156 * the chiplet id is zero. If we implement TIO-TIO dma, we might need
156 * to insert a chiplet id into this macro. However, it is our belief 157 * to insert a chiplet id into this macro. However, it is our belief
157 * right now that this chiplet id will be ICE, which is also zero. 158 * right now that this chiplet id will be ICE, which is also zero.
158 * Nasid starts on bit 40.
159 */ 159 */
160#define PHYS_TO_TIODMA(x) ( (((u64)(NASID_GET(x))) << 40) | NODE_OFFSET(x)) 160#define SH1_TIO_PHYS_TO_DMA(x) \
161#define PHYS_TO_DMA(x) ( (((u64)(x) & NASID_MASK) >> 2) | NODE_OFFSET(x)) 161 ((((u64)(NASID_GET(x))) << 40) | NODE_OFFSET(x))
162
163#define SH2_NETWORK_BANK_OFFSET(x) \
164 ((u64)(x) & ((1UL << (sn_hub_info->nasid_shift - 4)) -1))
165
166#define SH2_NETWORK_BANK_SELECT(x) \
167 ((((u64)(x) & (0x3UL << (sn_hub_info->nasid_shift - 4))) \
168 >> (sn_hub_info->nasid_shift - 4)) << 36)
169
170#define SH2_NETWORK_ADDRESS(x) \
171 (SH2_NETWORK_BANK_OFFSET(x) | SH2_NETWORK_BANK_SELECT(x))
172
173#define SH2_TIO_PHYS_TO_DMA(x) \
174 (((u64)(NASID_GET(x)) << 40) | SH2_NETWORK_ADDRESS(x))
175
176#define PHYS_TO_TIODMA(x) \
177 (is_shub1() ? SH1_TIO_PHYS_TO_DMA(x) : SH2_TIO_PHYS_TO_DMA(x))
178
179#define PHYS_TO_DMA(x) \
180 ((((u64)(x) & NASID_MASK) >> 2) | NODE_OFFSET(x))
162 181
163 182
164/* 183/*
@@ -187,11 +206,13 @@
187#define RAW_NODE_SWIN_BASE(n, w) (NODE_IO_BASE(n) + ((u64) (w) << SWIN_SIZE_BITS)) 206#define RAW_NODE_SWIN_BASE(n, w) (NODE_IO_BASE(n) + ((u64) (w) << SWIN_SIZE_BITS))
188#define BWIN_WIDGET_MASK 0x7 207#define BWIN_WIDGET_MASK 0x7
189#define BWIN_WINDOWNUM(x) (((x) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK) 208#define BWIN_WINDOWNUM(x) (((x) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK)
209#define SH1_IS_BIG_WINDOW_ADDR(x) ((x) & BWIN_TOP)
190 210
191#define TIO_BWIN_WINDOW_SELECT_MASK 0x7 211#define TIO_BWIN_WINDOW_SELECT_MASK 0x7
192#define TIO_BWIN_WINDOWNUM(x) (((x) >> TIO_BWIN_SIZE_BITS) & TIO_BWIN_WINDOW_SELECT_MASK) 212#define TIO_BWIN_WINDOWNUM(x) (((x) >> TIO_BWIN_SIZE_BITS) & TIO_BWIN_WINDOW_SELECT_MASK)
193 213
194 214#define TIO_HWIN_SHIFT_BITS 33
215#define TIO_HWIN(x) (NODE_OFFSET(x) >> TIO_HWIN_SHIFT_BITS)
195 216
196/* 217/*
197 * The following definitions pertain to the IO special address 218 * The following definitions pertain to the IO special address
@@ -216,10 +237,6 @@
216#define TIO_SWIN_WIDGETNUM(x) (((x) >> TIO_SWIN_SIZE_BITS) & TIO_SWIN_WIDGET_MASK) 237#define TIO_SWIN_WIDGETNUM(x) (((x) >> TIO_SWIN_SIZE_BITS) & TIO_SWIN_WIDGET_MASK)
217 238
218 239
219#define TIO_IOSPACE_ADDR(n,x) \
220 /* Move in the Chiplet ID for TIO Local Block MMR */ \
221 (REMOTE_ADDR(n,x) | 1UL << (NASID_SHIFT - 2))
222
223/* 240/*
224 * The following macros produce the correct base virtual address for 241 * The following macros produce the correct base virtual address for
225 * the hub registers. The REMOTE_HUB_* macro produce 242 * the hub registers. The REMOTE_HUB_* macro produce
@@ -234,18 +251,40 @@
234 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S(). 251 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S().
235 * They're always safe. 252 * They're always safe.
236 */ 253 */
254/* Shub1 TIO & MMR addressing macros */
255#define SH1_TIO_IOSPACE_ADDR(n,x) \
256 GLOBAL_MMR_ADDR(n,x)
257
258#define SH1_REMOTE_BWIN_MMR(n,x) \
259 GLOBAL_MMR_ADDR(n,x)
260
261#define SH1_REMOTE_SWIN_MMR(n,x) \
262 (NODE_SWIN_BASE(n,1) + 0x800000UL + (x))
263
264#define SH1_REMOTE_MMR(n,x) \
265 (SH1_IS_BIG_WINDOW_ADDR(x) ? SH1_REMOTE_BWIN_MMR(n,x) : \
266 SH1_REMOTE_SWIN_MMR(n,x))
267
268/* Shub1 TIO & MMR addressing macros */
269#define SH2_TIO_IOSPACE_ADDR(n,x) \
270 ((UNCACHED | REMOTE_ADDR(n,x) | 1UL << (NASID_SHIFT - 2)))
271
272#define SH2_REMOTE_MMR(n,x) \
273 GLOBAL_MMR_ADDR(n,x)
274
275
276/* TIO & MMR addressing macros that work on both shub1 & shub2 */
277#define TIO_IOSPACE_ADDR(n,x) \
278 ((u64 *)(is_shub1() ? SH1_TIO_IOSPACE_ADDR(n,x) : \
279 SH2_TIO_IOSPACE_ADDR(n,x)))
280
281#define SH_REMOTE_MMR(n,x) \
282 (is_shub1() ? SH1_REMOTE_MMR(n,x) : SH2_REMOTE_MMR(n,x))
283
237#define REMOTE_HUB_ADDR(n,x) \ 284#define REMOTE_HUB_ADDR(n,x) \
238 ((n & 1) ? \ 285 (IS_TIO_NASID(n) ? ((volatile u64*)TIO_IOSPACE_ADDR(n,x)) : \
239 /* TIO: */ \ 286 ((volatile u64*)SH_REMOTE_MMR(n,x)))
240 (is_shub2() ? \ 287
241 /* TIO on Shub2 */ \
242 (volatile u64 *)(TIO_IOSPACE_ADDR(n,x)) \
243 : /* TIO on shub1 */ \
244 (volatile u64 *)(GLOBAL_MMR_ADDR(n,x))) \
245 \
246 : /* SHUB1 and SHUB2 MMRs: */ \
247 (((x) & BWIN_TOP) ? ((volatile u64 *)(GLOBAL_MMR_ADDR(n,x))) \
248 : ((volatile u64 *)(NODE_SWIN_BASE(n,1) + 0x800000 + (x)))))
249 288
250#define HUB_L(x) (*((volatile typeof(*x) *)x)) 289#define HUB_L(x) (*((volatile typeof(*x) *)x))
251#define HUB_S(x,d) (*((volatile typeof(*x) *)x) = (d)) 290#define HUB_S(x,d) (*((volatile typeof(*x) *)x) = (d))