aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ia64/sn
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ia64/sn')
-rw-r--r--include/asm-ia64/sn/addrs.h238
-rw-r--r--include/asm-ia64/sn/arch.h52
-rw-r--r--include/asm-ia64/sn/bte.h148
-rw-r--r--include/asm-ia64/sn/clksupport.h28
-rw-r--r--include/asm-ia64/sn/fetchop.h85
-rw-r--r--include/asm-ia64/sn/geo.h124
-rw-r--r--include/asm-ia64/sn/intr.h56
-rw-r--r--include/asm-ia64/sn/io.h265
-rw-r--r--include/asm-ia64/sn/klconfig.h272
-rw-r--r--include/asm-ia64/sn/l1.h36
-rw-r--r--include/asm-ia64/sn/leds.h33
-rw-r--r--include/asm-ia64/sn/module.h127
-rw-r--r--include/asm-ia64/sn/nodepda.h86
-rw-r--r--include/asm-ia64/sn/pda.h80
-rw-r--r--include/asm-ia64/sn/rw_mmr.h74
-rw-r--r--include/asm-ia64/sn/shub_mmr.h441
-rw-r--r--include/asm-ia64/sn/shubio.h3476
-rw-r--r--include/asm-ia64/sn/simulator.h27
-rw-r--r--include/asm-ia64/sn/sn2/sn_hwperf.h226
-rw-r--r--include/asm-ia64/sn/sn_cpuid.h144
-rw-r--r--include/asm-ia64/sn/sn_fru.h44
-rw-r--r--include/asm-ia64/sn/sn_sal.h1015
-rw-r--r--include/asm-ia64/sn/sndrv.h47
-rw-r--r--include/asm-ia64/sn/types.h25
24 files changed, 7149 insertions, 0 deletions
diff --git a/include/asm-ia64/sn/addrs.h b/include/asm-ia64/sn/addrs.h
new file mode 100644
index 000000000000..c916bd22767a
--- /dev/null
+++ b/include/asm-ia64/sn/addrs.h
@@ -0,0 +1,238 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 1992-1999,2001-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#ifndef _ASM_IA64_SN_ADDRS_H
10#define _ASM_IA64_SN_ADDRS_H
11
12#include <asm/percpu.h>
13#include <asm/sn/types.h>
14#include <asm/sn/arch.h>
15#include <asm/sn/pda.h>
16
17/*
18 * Memory/SHUB Address Format:
19 * +-+---------+--+--------------+
20 * |0| NASID |AS| NodeOffset |
21 * +-+---------+--+--------------+
22 *
23 * NASID: (low NASID bit is 0) Memory and SHUB MMRs
24 * AS: 2-bit Address Space Identifier. Used only if low NASID bit is 0
25 * 00: Local Resources and MMR space
26 * Top bit of NodeOffset
27 * 0: Local resources space
28 * node id:
29 * 0: IA64/NT compatibility space
30 * 2: Local MMR Space
31 * 4: Local memory, regardless of local node id
32 * 1: Global MMR space
33 * 01: GET space.
34 * 10: AMO space.
35 * 11: Cacheable memory space.
36 *
37 * NodeOffset: byte offset
38 *
39 *
40 * TIO address format:
41 * +-+----------+--+--------------+
42 * |0| NASID |AS| Nodeoffset |
43 * +-+----------+--+--------------+
44 *
45 * NASID: (low NASID bit is 1) TIO
46 * AS: 2-bit Chiplet Identifier
47 * 00: TIO LB (Indicates TIO MMR access.)
48 * 01: TIO ICE (indicates coretalk space access.)
49 *
50 * NodeOffset: top bit must be set.
51 *
52 *
53 * Note that in both of the above address formats, the low
54 * NASID bit indicates if the reference is to the SHUB or TIO MMRs.
55 */
56
57
58/*
59 * Define basic shift & mask constants for manipulating NASIDs and AS values.
60 */
61#define NASID_BITMASK (sn_hub_info->nasid_bitmask)
62#define NASID_SHIFT (sn_hub_info->nasid_shift)
63#define AS_SHIFT (sn_hub_info->as_shift)
64#define AS_BITMASK 0x3UL
65
66#define NASID_MASK ((u64)NASID_BITMASK << NASID_SHIFT)
67#define AS_MASK ((u64)AS_BITMASK << AS_SHIFT)
68#define REGION_BITS 0xe000000000000000UL
69
70
71/*
72 * AS values. These are the same on both SHUB1 & SHUB2.
73 */
74#define AS_GET_VAL 1UL
75#define AS_AMO_VAL 2UL
76#define AS_CAC_VAL 3UL
77#define AS_GET_SPACE (AS_GET_VAL << AS_SHIFT)
78#define AS_AMO_SPACE (AS_AMO_VAL << AS_SHIFT)
79#define AS_CAC_SPACE (AS_CAC_VAL << AS_SHIFT)
80
81
82/*
83 * Base addresses for various address ranges.
84 */
85#define CACHED 0xe000000000000000UL
86#define UNCACHED 0xc000000000000000UL
87#define UNCACHED_PHYS 0x8000000000000000UL
88
89
90/*
91 * Virtual Mode Local & Global MMR space.
92 */
93#define SH1_LOCAL_MMR_OFFSET 0x8000000000UL
94#define SH2_LOCAL_MMR_OFFSET 0x0200000000UL
95#define LOCAL_MMR_OFFSET (is_shub2() ? SH2_LOCAL_MMR_OFFSET : SH1_LOCAL_MMR_OFFSET)
96#define LOCAL_MMR_SPACE (UNCACHED | LOCAL_MMR_OFFSET)
97#define LOCAL_PHYS_MMR_SPACE (UNCACHED_PHYS | LOCAL_MMR_OFFSET)
98
99#define SH1_GLOBAL_MMR_OFFSET 0x0800000000UL
100#define SH2_GLOBAL_MMR_OFFSET 0x0300000000UL
101#define GLOBAL_MMR_OFFSET (is_shub2() ? SH2_GLOBAL_MMR_OFFSET : SH1_GLOBAL_MMR_OFFSET)
102#define GLOBAL_MMR_SPACE (UNCACHED | GLOBAL_MMR_OFFSET)
103
104/*
105 * Physical mode addresses
106 */
107#define GLOBAL_PHYS_MMR_SPACE (UNCACHED_PHYS | GLOBAL_MMR_OFFSET)
108
109
110/*
111 * Clear region & AS bits.
112 */
113#define TO_PHYS_MASK (~(REGION_BITS | AS_MASK))
114
115
116/*
117 * Misc NASID manipulation.
118 */
119#define NASID_SPACE(n) ((u64)(n) << NASID_SHIFT)
120#define REMOTE_ADDR(n,a) (NASID_SPACE(n) | (a))
121#define NODE_OFFSET(x) ((x) & (NODE_ADDRSPACE_SIZE - 1))
122#define NODE_ADDRSPACE_SIZE (1UL << AS_SHIFT)
123#define NASID_GET(x) (int) (((u64) (x) >> NASID_SHIFT) & NASID_BITMASK)
124#define LOCAL_MMR_ADDR(a) (LOCAL_MMR_SPACE | (a))
125#define GLOBAL_MMR_ADDR(n,a) (GLOBAL_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))
128#define CHANGE_NASID(n,x) ((void *)(((u64)(x) & ~NASID_MASK) | NASID_SPACE(n)))
129
130
131/* non-II mmr's start at top of big window space (4G) */
132#define BWIN_TOP 0x0000000100000000UL
133
134/*
135 * general address defines
136 */
137#define CAC_BASE (CACHED | AS_CAC_SPACE)
138#define AMO_BASE (UNCACHED | AS_AMO_SPACE)
139#define GET_BASE (CACHED | AS_GET_SPACE)
140
141/*
142 * Convert Memory addresses between various addressing modes.
143 */
144#define TO_PHYS(x) (TO_PHYS_MASK & (x))
145#define TO_CAC(x) (CAC_BASE | TO_PHYS(x))
146#define TO_AMO(x) (AMO_BASE | TO_PHYS(x))
147#define TO_GET(x) (GET_BASE | TO_PHYS(x))
148
149
150/*
151 * Covert from processor physical address to II/TIO physical address:
152 * II - squeeze out the AS bits
153 * TIO- requires a chiplet id in bits 38-39. For DMA to memory,
154 * the chiplet id is zero. If we implement TIO-TIO dma, we might need
155 * to insert a chiplet id into this macro. However, it is our belief
156 * right now that this chiplet id will be ICE, which is also zero.
157 */
158#define PHYS_TO_TIODMA(x) ( (((u64)(x) & NASID_MASK) << 2) | NODE_OFFSET(x))
159#define PHYS_TO_DMA(x) ( (((u64)(x) & NASID_MASK) >> 2) | NODE_OFFSET(x))
160
161
162/*
163 * The following definitions pertain to the IO special address
164 * space. They define the location of the big and little windows
165 * of any given node.
166 */
167#define BWIN_SIZE_BITS 29 /* big window size: 512M */
168#define TIO_BWIN_SIZE_BITS 30 /* big window size: 1G */
169#define NODE_SWIN_BASE(n, w) ((w == 0) ? NODE_BWIN_BASE((n), SWIN0_BIGWIN) \
170 : RAW_NODE_SWIN_BASE(n, w))
171#define NODE_IO_BASE(n) (GLOBAL_MMR_SPACE | NASID_SPACE(n))
172#define BWIN_SIZE (1UL << BWIN_SIZE_BITS)
173#define NODE_BWIN_BASE0(n) (NODE_IO_BASE(n) + BWIN_SIZE)
174#define NODE_BWIN_BASE(n, w) (NODE_BWIN_BASE0(n) + ((u64) (w) << BWIN_SIZE_BITS))
175#define RAW_NODE_SWIN_BASE(n, w) (NODE_IO_BASE(n) + ((u64) (w) << SWIN_SIZE_BITS))
176#define BWIN_WIDGET_MASK 0x7
177#define BWIN_WINDOWNUM(x) (((x) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK)
178
179#define TIO_BWIN_WINDOW_SELECT_MASK 0x7
180#define TIO_BWIN_WINDOWNUM(x) (((x) >> TIO_BWIN_SIZE_BITS) & TIO_BWIN_WINDOW_SELECT_MASK)
181
182
183
184/*
185 * The following definitions pertain to the IO special address
186 * space. They define the location of the big and little windows
187 * of any given node.
188 */
189
190#define SWIN_SIZE_BITS 24
191#define SWIN_WIDGET_MASK 0xF
192
193#define TIO_SWIN_SIZE_BITS 28
194#define TIO_SWIN_SIZE (1UL << TIO_SWIN_SIZE_BITS)
195#define TIO_SWIN_WIDGET_MASK 0x3
196
197/*
198 * Convert smallwindow address to xtalk address.
199 *
200 * 'addr' can be physical or virtual address, but will be converted
201 * to Xtalk address in the range 0 -> SWINZ_SIZEMASK
202 */
203#define SWIN_WIDGETNUM(x) (((x) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK)
204#define TIO_SWIN_WIDGETNUM(x) (((x) >> TIO_SWIN_SIZE_BITS) & TIO_SWIN_WIDGET_MASK)
205
206
207/*
208 * The following macros produce the correct base virtual address for
209 * the hub registers. The REMOTE_HUB_* macro produce
210 * the address for the specified hub's registers. The intent is
211 * that the appropriate PI, MD, NI, or II register would be substituted
212 * for x.
213 *
214 * WARNING:
215 * When certain Hub chip workaround are defined, it's not sufficient
216 * to dereference the *_HUB_ADDR() macros. You should instead use
217 * HUB_L() and HUB_S() if you must deal with pointers to hub registers.
218 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S().
219 * They're always safe.
220 */
221#define REMOTE_HUB_ADDR(n,x) \
222 ((n & 1) ? \
223 /* TIO: */ \
224 ((volatile u64 *)(GLOBAL_MMR_ADDR(n,x))) \
225 : /* SHUB: */ \
226 (((x) & BWIN_TOP) ? ((volatile u64 *)(GLOBAL_MMR_ADDR(n,x)))\
227 : ((volatile u64 *)(NODE_SWIN_BASE(n,1) + 0x800000 + (x)))))
228
229
230
231#define HUB_L(x) (*((volatile typeof(*x) *)x))
232#define HUB_S(x,d) (*((volatile typeof(*x) *)x) = (d))
233
234#define REMOTE_HUB_L(n, a) HUB_L(REMOTE_HUB_ADDR((n), (a)))
235#define REMOTE_HUB_S(n, a, d) HUB_S(REMOTE_HUB_ADDR((n), (a)), (d))
236
237
238#endif /* _ASM_IA64_SN_ADDRS_H */
diff --git a/include/asm-ia64/sn/arch.h b/include/asm-ia64/sn/arch.h
new file mode 100644
index 000000000000..7c349f07916a
--- /dev/null
+++ b/include/asm-ia64/sn/arch.h
@@ -0,0 +1,52 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI specific setup.
7 *
8 * Copyright (C) 1995-1997,1999,2001-2004 Silicon Graphics, Inc. All rights reserved.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_IA64_SN_ARCH_H
12#define _ASM_IA64_SN_ARCH_H
13
14#include <asm/types.h>
15#include <asm/percpu.h>
16#include <asm/sn/types.h>
17#include <asm/sn/sn_cpuid.h>
18
19/*
20 * The following defines attributes of the HUB chip. These attributes are
21 * frequently referenced. They are kept in the per-cpu data areas of each cpu.
22 * They are kept together in a struct to minimize cache misses.
23 */
24struct sn_hub_info_s {
25 u8 shub2;
26 u8 nasid_shift;
27 u8 as_shift;
28 u8 shub_1_1_found;
29 u16 nasid_bitmask;
30};
31DECLARE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
32#define sn_hub_info (&__get_cpu_var(__sn_hub_info))
33#define is_shub2() (sn_hub_info->shub2)
34#define is_shub1() (sn_hub_info->shub2 == 0)
35
36/*
37 * Use this macro to test if shub 1.1 wars should be enabled
38 */
39#define enable_shub_wars_1_1() (sn_hub_info->shub_1_1_found)
40
41
42/*
43 * This is the maximum number of nodes that can be part of a kernel.
44 * Effectively, it's the maximum number of compact node ids (cnodeid_t).
45 * This is not necessarily the same as MAX_NASIDS.
46 */
47#define MAX_COMPACT_NODES 2048
48#define CPUS_PER_NODE 4
49
50extern void sn_flush_all_caches(long addr, long bytes);
51
52#endif /* _ASM_IA64_SN_ARCH_H */
diff --git a/include/asm-ia64/sn/bte.h b/include/asm-ia64/sn/bte.h
new file mode 100644
index 000000000000..0ec27f99c181
--- /dev/null
+++ b/include/asm-ia64/sn/bte.h
@@ -0,0 +1,148 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9
10#ifndef _ASM_IA64_SN_BTE_H
11#define _ASM_IA64_SN_BTE_H
12
13#include <linux/timer.h>
14#include <linux/spinlock.h>
15#include <linux/cache.h>
16#include <asm/sn/types.h>
17
18
19/* #define BTE_DEBUG */
20/* #define BTE_DEBUG_VERBOSE */
21
22#ifdef BTE_DEBUG
23# define BTE_PRINTK(x) printk x /* Terse */
24# ifdef BTE_DEBUG_VERBOSE
25# define BTE_PRINTKV(x) printk x /* Verbose */
26# else
27# define BTE_PRINTKV(x)
28# endif /* BTE_DEBUG_VERBOSE */
29#else
30# define BTE_PRINTK(x)
31# define BTE_PRINTKV(x)
32#endif /* BTE_DEBUG */
33
34
35/* BTE status register only supports 16 bits for length field */
36#define BTE_LEN_BITS (16)
37#define BTE_LEN_MASK ((1 << BTE_LEN_BITS) - 1)
38#define BTE_MAX_XFER ((1 << BTE_LEN_BITS) * L1_CACHE_BYTES)
39
40
41/* Define hardware */
42#define BTES_PER_NODE 2
43
44
45/* Define hardware modes */
46#define BTE_NOTIFY (IBCT_NOTIFY)
47#define BTE_NORMAL BTE_NOTIFY
48#define BTE_ZERO_FILL (BTE_NOTIFY | IBCT_ZFIL_MODE)
49/* Use a reserved bit to let the caller specify a wait for any BTE */
50#define BTE_WACQUIRE (0x4000)
51/* Use the BTE on the node with the destination memory */
52#define BTE_USE_DEST (BTE_WACQUIRE << 1)
53/* Use any available BTE interface on any node for the transfer */
54#define BTE_USE_ANY (BTE_USE_DEST << 1)
55/* macro to force the IBCT0 value valid */
56#define BTE_VALID_MODE(x) ((x) & (IBCT_NOTIFY | IBCT_ZFIL_MODE))
57
58#define BTE_ACTIVE (IBLS_BUSY | IBLS_ERROR)
59#define BTE_WORD_AVAILABLE (IBLS_BUSY << 1)
60#define BTE_WORD_BUSY (~BTE_WORD_AVAILABLE)
61
62/*
63 * Some macros to simplify reading.
64 * Start with macros to locate the BTE control registers.
65 */
66#define BTE_LNSTAT_LOAD(_bte) \
67 HUB_L(_bte->bte_base_addr)
68#define BTE_LNSTAT_STORE(_bte, _x) \
69 HUB_S(_bte->bte_base_addr, (_x))
70#define BTE_SRC_STORE(_bte, _x) \
71 HUB_S(_bte->bte_base_addr + (BTEOFF_SRC/8), (_x))
72#define BTE_DEST_STORE(_bte, _x) \
73 HUB_S(_bte->bte_base_addr + (BTEOFF_DEST/8), (_x))
74#define BTE_CTRL_STORE(_bte, _x) \
75 HUB_S(_bte->bte_base_addr + (BTEOFF_CTRL/8), (_x))
76#define BTE_NOTIF_STORE(_bte, _x) \
77 HUB_S(_bte->bte_base_addr + (BTEOFF_NOTIFY/8), (_x))
78
79
80/* Possible results from bte_copy and bte_unaligned_copy */
81/* The following error codes map into the BTE hardware codes
82 * IIO_ICRB_ECODE_* (in shubio.h). The hardware uses
83 * an error code of 0 (IIO_ICRB_ECODE_DERR), but we want zero
84 * to mean BTE_SUCCESS, so add one (BTEFAIL_OFFSET) to the error
85 * codes to give the following error codes.
86 */
87#define BTEFAIL_OFFSET 1
88
89typedef enum {
90 BTE_SUCCESS, /* 0 is success */
91 BTEFAIL_DIR, /* Directory error due to IIO access*/
92 BTEFAIL_POISON, /* poison error on IO access (write to poison page) */
93 BTEFAIL_WERR, /* Write error (ie WINV to a Read only line) */
94 BTEFAIL_ACCESS, /* access error (protection violation) */
95 BTEFAIL_PWERR, /* Partial Write Error */
96 BTEFAIL_PRERR, /* Partial Read Error */
97 BTEFAIL_TOUT, /* CRB Time out */
98 BTEFAIL_XTERR, /* Incoming xtalk pkt had error bit */
99 BTEFAIL_NOTAVAIL, /* BTE not available */
100} bte_result_t;
101
102
103/*
104 * Structure defining a bte. An instance of this
105 * structure is created in the nodepda for each
106 * bte on that node (as defined by BTES_PER_NODE)
107 * This structure contains everything necessary
108 * to work with a BTE.
109 */
110struct bteinfo_s {
111 volatile u64 notify ____cacheline_aligned;
112 u64 *bte_base_addr ____cacheline_aligned;
113 spinlock_t spinlock;
114 cnodeid_t bte_cnode; /* cnode */
115 int bte_error_count; /* Number of errors encountered */
116 int bte_num; /* 0 --> BTE0, 1 --> BTE1 */
117 int cleanup_active; /* Interface is locked for cleanup */
118 volatile bte_result_t bh_error; /* error while processing */
119 volatile u64 *most_rcnt_na;
120};
121
122
123/*
124 * Function prototypes (functions defined in bte.c, used elsewhere)
125 */
126extern bte_result_t bte_copy(u64, u64, u64, u64, void *);
127extern bte_result_t bte_unaligned_copy(u64, u64, u64, u64);
128extern void bte_error_handler(unsigned long);
129
130#define bte_zero(dest, len, mode, notification) \
131 bte_copy(0, dest, len, ((mode) | BTE_ZERO_FILL), notification)
132
133/*
134 * The following is the prefered way of calling bte_unaligned_copy
135 * If the copy is fully cache line aligned, then bte_copy is
136 * used instead. Since bte_copy is inlined, this saves a call
137 * stack. NOTE: bte_copy is called synchronously and does block
138 * until the transfer is complete. In order to get the asynch
139 * version of bte_copy, you must perform this check yourself.
140 */
141#define BTE_UNALIGNED_COPY(src, dest, len, mode) \
142 (((len & L1_CACHE_MASK) || (src & L1_CACHE_MASK) || \
143 (dest & L1_CACHE_MASK)) ? \
144 bte_unaligned_copy(src, dest, len, mode) : \
145 bte_copy(src, dest, len, mode, NULL))
146
147
148#endif /* _ASM_IA64_SN_BTE_H */
diff --git a/include/asm-ia64/sn/clksupport.h b/include/asm-ia64/sn/clksupport.h
new file mode 100644
index 000000000000..d340c365a824
--- /dev/null
+++ b/include/asm-ia64/sn/clksupport.h
@@ -0,0 +1,28 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8
9/*
10 * This file contains definitions for accessing a platform supported high resolution
11 * clock. The clock is monitonically increasing and can be accessed from any node
12 * in the system. The clock is synchronized across nodes - all nodes see the
13 * same value.
14 *
15 * RTC_COUNTER_ADDR - contains the address of the counter
16 *
17 */
18
19#ifndef _ASM_IA64_SN_CLKSUPPORT_H
20#define _ASM_IA64_SN_CLKSUPPORT_H
21
22extern unsigned long sn_rtc_cycles_per_second;
23
24#define RTC_COUNTER_ADDR ((long *)LOCAL_MMR_ADDR(SH_RTC))
25
26#define rtc_time() (*RTC_COUNTER_ADDR)
27
28#endif /* _ASM_IA64_SN_CLKSUPPORT_H */
diff --git a/include/asm-ia64/sn/fetchop.h b/include/asm-ia64/sn/fetchop.h
new file mode 100644
index 000000000000..5f4ad8f4b5d2
--- /dev/null
+++ b/include/asm-ia64/sn/fetchop.h
@@ -0,0 +1,85 @@
1/*
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-2004 Silicon Graphics, Inc. All rights reserved.
8 */
9
10#ifndef _ASM_IA64_SN_FETCHOP_H
11#define _ASM_IA64_SN_FETCHOP_H
12
13#include <linux/config.h>
14
15#define FETCHOP_BASENAME "sgi_fetchop"
16#define FETCHOP_FULLNAME "/dev/sgi_fetchop"
17
18
19
20#define FETCHOP_VAR_SIZE 64 /* 64 byte per fetchop variable */
21
22#define FETCHOP_LOAD 0
23#define FETCHOP_INCREMENT 8
24#define FETCHOP_DECREMENT 16
25#define FETCHOP_CLEAR 24
26
27#define FETCHOP_STORE 0
28#define FETCHOP_AND 24
29#define FETCHOP_OR 32
30
31#define FETCHOP_CLEAR_CACHE 56
32
33#define FETCHOP_LOAD_OP(addr, op) ( \
34 *(volatile long *)((char*) (addr) + (op)))
35
36#define FETCHOP_STORE_OP(addr, op, x) ( \
37 *(volatile long *)((char*) (addr) + (op)) = (long) (x))
38
39#ifdef __KERNEL__
40
41/*
42 * Convert a region 6 (kaddr) address to the address of the fetchop variable
43 */
44#define FETCHOP_KADDR_TO_MSPEC_ADDR(kaddr) TO_MSPEC(kaddr)
45
46
47/*
48 * Each Atomic Memory Operation (AMO formerly known as fetchop)
49 * variable is 64 bytes long. The first 8 bytes are used. The
50 * remaining 56 bytes are unaddressable due to the operation taking
51 * that portion of the address.
52 *
53 * NOTE: The AMO_t _MUST_ be placed in either the first or second half
54 * of the cache line. The cache line _MUST NOT_ be used for anything
55 * other than additional AMO_t entries. This is because there are two
56 * addresses which reference the same physical cache line. One will
57 * be a cached entry with the memory type bits all set. This address
58 * may be loaded into processor cache. The AMO_t will be referenced
59 * uncached via the memory special memory type. If any portion of the
60 * cached cache-line is modified, when that line is flushed, it will
61 * overwrite the uncached value in physical memory and lead to
62 * inconsistency.
63 */
64typedef struct {
65 u64 variable;
66 u64 unused[7];
67} AMO_t;
68
69
70/*
71 * The following APIs are externalized to the kernel to allocate/free pages of
72 * fetchop variables.
73 * fetchop_kalloc_page - Allocate/initialize 1 fetchop page on the
74 * specified cnode.
75 * fetchop_kfree_page - Free a previously allocated fetchop page
76 */
77
78unsigned long fetchop_kalloc_page(int nid);
79void fetchop_kfree_page(unsigned long maddr);
80
81
82#endif /* __KERNEL__ */
83
84#endif /* _ASM_IA64_SN_FETCHOP_H */
85
diff --git a/include/asm-ia64/sn/geo.h b/include/asm-ia64/sn/geo.h
new file mode 100644
index 000000000000..f566343d25f8
--- /dev/null
+++ b/include/asm-ia64/sn/geo.h
@@ -0,0 +1,124 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#ifndef _ASM_IA64_SN_GEO_H
10#define _ASM_IA64_SN_GEO_H
11
12/* The geoid_t implementation below is based loosely on the pcfg_t
13 implementation in sys/SN/promcfg.h. */
14
15/* Type declaractions */
16
17/* Size of a geoid_t structure (must be before decl. of geoid_u) */
18#define GEOID_SIZE 8 /* Would 16 be better? The size can
19 be different on different platforms. */
20
21#define MAX_SLABS 0xe /* slabs per module */
22
23typedef unsigned char geo_type_t;
24
25/* Fields common to all substructures */
26typedef struct geo_any_s {
27 moduleid_t module; /* The module (box) this h/w lives in */
28 geo_type_t type; /* What type of h/w is named by this geoid_t */
29 slabid_t slab; /* The logical assembly within the module */
30} geo_any_t;
31
32/* Additional fields for particular types of hardware */
33typedef struct geo_node_s {
34 geo_any_t any; /* No additional fields needed */
35} geo_node_t;
36
37typedef struct geo_rtr_s {
38 geo_any_t any; /* No additional fields needed */
39} geo_rtr_t;
40
41typedef struct geo_iocntl_s {
42 geo_any_t any; /* No additional fields needed */
43} geo_iocntl_t;
44
45typedef struct geo_pcicard_s {
46 geo_iocntl_t any;
47 char bus; /* Bus/widget number */
48 char slot; /* PCI slot number */
49} geo_pcicard_t;
50
51/* Subcomponents of a node */
52typedef struct geo_cpu_s {
53 geo_node_t node;
54 char slice; /* Which CPU on the node */
55} geo_cpu_t;
56
57typedef struct geo_mem_s {
58 geo_node_t node;
59 char membus; /* The memory bus on the node */
60 char memslot; /* The memory slot on the bus */
61} geo_mem_t;
62
63
64typedef union geoid_u {
65 geo_any_t any;
66 geo_node_t node;
67 geo_iocntl_t iocntl;
68 geo_pcicard_t pcicard;
69 geo_rtr_t rtr;
70 geo_cpu_t cpu;
71 geo_mem_t mem;
72 char padsize[GEOID_SIZE];
73} geoid_t;
74
75
76/* Preprocessor macros */
77
78#define GEO_MAX_LEN 48 /* max. formatted length, plus some pad:
79 module/001c07/slab/5/node/memory/2/slot/4 */
80
81/* Values for geo_type_t */
82#define GEO_TYPE_INVALID 0
83#define GEO_TYPE_MODULE 1
84#define GEO_TYPE_NODE 2
85#define GEO_TYPE_RTR 3
86#define GEO_TYPE_IOCNTL 4
87#define GEO_TYPE_IOCARD 5
88#define GEO_TYPE_CPU 6
89#define GEO_TYPE_MEM 7
90#define GEO_TYPE_MAX (GEO_TYPE_MEM+1)
91
92/* Parameter for hwcfg_format_geoid_compt() */
93#define GEO_COMPT_MODULE 1
94#define GEO_COMPT_SLAB 2
95#define GEO_COMPT_IOBUS 3
96#define GEO_COMPT_IOSLOT 4
97#define GEO_COMPT_CPU 5
98#define GEO_COMPT_MEMBUS 6
99#define GEO_COMPT_MEMSLOT 7
100
101#define GEO_INVALID_STR "<invalid>"
102
103#define INVALID_NASID ((nasid_t)-1)
104#define INVALID_CNODEID ((cnodeid_t)-1)
105#define INVALID_PNODEID ((pnodeid_t)-1)
106#define INVALID_SLAB (slabid_t)-1
107#define INVALID_MODULE ((moduleid_t)-1)
108#define INVALID_PARTID ((partid_t)-1)
109
110static inline slabid_t geo_slab(geoid_t g)
111{
112 return (g.any.type == GEO_TYPE_INVALID) ?
113 INVALID_SLAB : g.any.slab;
114}
115
116static inline moduleid_t geo_module(geoid_t g)
117{
118 return (g.any.type == GEO_TYPE_INVALID) ?
119 INVALID_MODULE : g.any.module;
120}
121
122extern geoid_t cnodeid_get_geoid(cnodeid_t cnode);
123
124#endif /* _ASM_IA64_SN_GEO_H */
diff --git a/include/asm-ia64/sn/intr.h b/include/asm-ia64/sn/intr.h
new file mode 100644
index 000000000000..e51471fb0867
--- /dev/null
+++ b/include/asm-ia64/sn/intr.h
@@ -0,0 +1,56 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#ifndef _ASM_IA64_SN_INTR_H
10#define _ASM_IA64_SN_INTR_H
11
12#define SGI_UART_VECTOR (0xe9)
13#define SGI_PCIBR_ERROR (0x33)
14
15/* Reserved IRQs : Note, not to exceed IA64_SN2_FIRST_DEVICE_VECTOR */
16#define SGI_XPC_ACTIVATE (0x30)
17#define SGI_II_ERROR (0x31)
18#define SGI_XBOW_ERROR (0x32)
19#define SGI_PCIBR_ERROR (0x33)
20#define SGI_ACPI_SCI_INT (0x34)
21#define SGI_TIOCA_ERROR (0x35)
22#define SGI_TIO_ERROR (0x36)
23#define SGI_TIOCX_ERROR (0x37)
24#define SGI_MMTIMER_VECTOR (0x38)
25#define SGI_XPC_NOTIFY (0xe7)
26
27#define IA64_SN2_FIRST_DEVICE_VECTOR (0x3c)
28#define IA64_SN2_LAST_DEVICE_VECTOR (0xe6)
29
30#define SN2_IRQ_RESERVED (0x1)
31#define SN2_IRQ_CONNECTED (0x2)
32#define SN2_IRQ_SHARED (0x4)
33
34// The SN PROM irq struct
35struct sn_irq_info {
36 struct sn_irq_info *irq_next; /* sharing irq list */
37 short irq_nasid; /* Nasid IRQ is assigned to */
38 int irq_slice; /* slice IRQ is assigned to */
39 int irq_cpuid; /* kernel logical cpuid */
40 int irq_irq; /* the IRQ number */
41 int irq_int_bit; /* Bridge interrupt pin */
42 uint64_t irq_xtalkaddr; /* xtalkaddr IRQ is sent to */
43 int irq_bridge_type;/* pciio asic type (pciio.h) */
44 void *irq_bridge; /* bridge generating irq */
45 void *irq_pciioinfo; /* associated pciio_info_t */
46 int irq_last_intr; /* For Shub lb lost intr WAR */
47 int irq_cookie; /* unique cookie */
48 int irq_flags; /* flags */
49 int irq_share_cnt; /* num devices sharing IRQ */
50};
51
52extern void sn_send_IPI_phys(int, long, int, int);
53
54#define CPU_VECTOR_TO_IRQ(cpuid,vector) (vector)
55
56#endif /* _ASM_IA64_SN_INTR_H */
diff --git a/include/asm-ia64/sn/io.h b/include/asm-ia64/sn/io.h
new file mode 100644
index 000000000000..42209733f6b1
--- /dev/null
+++ b/include/asm-ia64/sn/io.h
@@ -0,0 +1,265 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#ifndef _ASM_SN_IO_H
10#define _ASM_SN_IO_H
11#include <linux/compiler.h>
12#include <asm/intrinsics.h>
13
14extern void * sn_io_addr(unsigned long port) __attribute_const__; /* Forward definition */
15extern void __sn_mmiowb(void); /* Forward definition */
16
17extern int numionodes;
18
19#define __sn_mf_a() ia64_mfa()
20
21extern void sn_dma_flush(unsigned long);
22
23#define __sn_inb ___sn_inb
24#define __sn_inw ___sn_inw
25#define __sn_inl ___sn_inl
26#define __sn_outb ___sn_outb
27#define __sn_outw ___sn_outw
28#define __sn_outl ___sn_outl
29#define __sn_readb ___sn_readb
30#define __sn_readw ___sn_readw
31#define __sn_readl ___sn_readl
32#define __sn_readq ___sn_readq
33#define __sn_readb_relaxed ___sn_readb_relaxed
34#define __sn_readw_relaxed ___sn_readw_relaxed
35#define __sn_readl_relaxed ___sn_readl_relaxed
36#define __sn_readq_relaxed ___sn_readq_relaxed
37
38/*
39 * The following routines are SN Platform specific, called when
40 * a reference is made to inX/outX set macros. SN Platform
41 * inX set of macros ensures that Posted DMA writes on the
42 * Bridge is flushed.
43 *
44 * The routines should be self explainatory.
45 */
46
47static inline unsigned int
48___sn_inb (unsigned long port)
49{
50 volatile unsigned char *addr;
51 unsigned char ret = -1;
52
53 if ((addr = sn_io_addr(port))) {
54 ret = *addr;
55 __sn_mf_a();
56 sn_dma_flush((unsigned long)addr);
57 }
58 return ret;
59}
60
61static inline unsigned int
62___sn_inw (unsigned long port)
63{
64 volatile unsigned short *addr;
65 unsigned short ret = -1;
66
67 if ((addr = sn_io_addr(port))) {
68 ret = *addr;
69 __sn_mf_a();
70 sn_dma_flush((unsigned long)addr);
71 }
72 return ret;
73}
74
75static inline unsigned int
76___sn_inl (unsigned long port)
77{
78 volatile unsigned int *addr;
79 unsigned int ret = -1;
80
81 if ((addr = sn_io_addr(port))) {
82 ret = *addr;
83 __sn_mf_a();
84 sn_dma_flush((unsigned long)addr);
85 }
86 return ret;
87}
88
89static inline void
90___sn_outb (unsigned char val, unsigned long port)
91{
92 volatile unsigned char *addr;
93
94 if ((addr = sn_io_addr(port))) {
95 *addr = val;
96 __sn_mmiowb();
97 }
98}
99
100static inline void
101___sn_outw (unsigned short val, unsigned long port)
102{
103 volatile unsigned short *addr;
104
105 if ((addr = sn_io_addr(port))) {
106 *addr = val;
107 __sn_mmiowb();
108 }
109}
110
111static inline void
112___sn_outl (unsigned int val, unsigned long port)
113{
114 volatile unsigned int *addr;
115
116 if ((addr = sn_io_addr(port))) {
117 *addr = val;
118 __sn_mmiowb();
119 }
120}
121
122/*
123 * The following routines are SN Platform specific, called when
124 * a reference is made to readX/writeX set macros. SN Platform
125 * readX set of macros ensures that Posted DMA writes on the
126 * Bridge is flushed.
127 *
128 * The routines should be self explainatory.
129 */
130
131static inline unsigned char
132___sn_readb (const volatile void __iomem *addr)
133{
134 unsigned char val;
135
136 val = *(volatile unsigned char __force *)addr;
137 __sn_mf_a();
138 sn_dma_flush((unsigned long)addr);
139 return val;
140}
141
142static inline unsigned short
143___sn_readw (const volatile void __iomem *addr)
144{
145 unsigned short val;
146
147 val = *(volatile unsigned short __force *)addr;
148 __sn_mf_a();
149 sn_dma_flush((unsigned long)addr);
150 return val;
151}
152
153static inline unsigned int
154___sn_readl (const volatile void __iomem *addr)
155{
156 unsigned int val;
157
158 val = *(volatile unsigned int __force *)addr;
159 __sn_mf_a();
160 sn_dma_flush((unsigned long)addr);
161 return val;
162}
163
164static inline unsigned long
165___sn_readq (const volatile void __iomem *addr)
166{
167 unsigned long val;
168
169 val = *(volatile unsigned long __force *)addr;
170 __sn_mf_a();
171 sn_dma_flush((unsigned long)addr);
172 return val;
173}
174
175/*
176 * For generic and SN2 kernels, we have a set of fast access
177 * PIO macros. These macros are provided on SN Platform
178 * because the normal inX and readX macros perform an
179 * additional task of flushing Post DMA request on the Bridge.
180 *
181 * These routines should be self explainatory.
182 */
183
184static inline unsigned int
185sn_inb_fast (unsigned long port)
186{
187 volatile unsigned char *addr = (unsigned char *)port;
188 unsigned char ret;
189
190 ret = *addr;
191 __sn_mf_a();
192 return ret;
193}
194
195static inline unsigned int
196sn_inw_fast (unsigned long port)
197{
198 volatile unsigned short *addr = (unsigned short *)port;
199 unsigned short ret;
200
201 ret = *addr;
202 __sn_mf_a();
203 return ret;
204}
205
206static inline unsigned int
207sn_inl_fast (unsigned long port)
208{
209 volatile unsigned int *addr = (unsigned int *)port;
210 unsigned int ret;
211
212 ret = *addr;
213 __sn_mf_a();
214 return ret;
215}
216
217static inline unsigned char
218___sn_readb_relaxed (const volatile void __iomem *addr)
219{
220 return *(volatile unsigned char __force *)addr;
221}
222
223static inline unsigned short
224___sn_readw_relaxed (const volatile void __iomem *addr)
225{
226 return *(volatile unsigned short __force *)addr;
227}
228
229static inline unsigned int
230___sn_readl_relaxed (const volatile void __iomem *addr)
231{
232 return *(volatile unsigned int __force *) addr;
233}
234
235static inline unsigned long
236___sn_readq_relaxed (const volatile void __iomem *addr)
237{
238 return *(volatile unsigned long __force *) addr;
239}
240
241struct pci_dev;
242
243static inline int
244sn_pci_set_vchan(struct pci_dev *pci_dev, unsigned long *addr, int vchan)
245{
246
247 if (vchan > 1) {
248 return -1;
249 }
250
251 if (!(*addr >> 32)) /* Using a mask here would be cleaner */
252 return 0; /* but this generates better code */
253
254 if (vchan == 1) {
255 /* Set Bit 57 */
256 *addr |= (1UL << 57);
257 } else {
258 /* Clear Bit 57 */
259 *addr &= ~(1UL << 57);
260 }
261
262 return 0;
263}
264
265#endif /* _ASM_SN_IO_H */
diff --git a/include/asm-ia64/sn/klconfig.h b/include/asm-ia64/sn/klconfig.h
new file mode 100644
index 000000000000..9f920c70a62a
--- /dev/null
+++ b/include/asm-ia64/sn/klconfig.h
@@ -0,0 +1,272 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/klconfig.h>.
7 *
8 * Copyright (C) 1992-1997,1999,2001-2004 Silicon Graphics, Inc. All Rights Reserved.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_IA64_SN_KLCONFIG_H
12#define _ASM_IA64_SN_KLCONFIG_H
13
14/*
15 * The KLCONFIG structures store info about the various BOARDs found
16 * during Hardware Discovery. In addition, it stores info about the
17 * components found on the BOARDs.
18 */
19
20typedef s32 klconf_off_t;
21
22
23/* Functions/macros needed to use this structure */
24
25typedef struct kl_config_hdr {
26 char pad[20];
27 klconf_off_t ch_board_info; /* the link list of boards */
28 char pad0[88];
29} kl_config_hdr_t;
30
31
32#define NODE_OFFSET_TO_LBOARD(nasid,off) (lboard_t*)(GLOBAL_CAC_ADDR((nasid), (off)))
33
34/*
35 * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD
36 * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to
37 * the LOCAL/current NODE. REMOTE means it is attached to a different
38 * node.(TBD - Need a way to treat ROUTER boards.)
39 *
40 * There are 2 different structures to represent these boards -
41 * lboard - Local board, rboard - remote board. These 2 structures
42 * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer
43 * Figure below). The first byte of the rboard or lboard structure
44 * is used to find out its type - no unions are used.
45 * If it is a lboard, then the config info of this board will be found
46 * on the local node. (LOCAL NODE BASE + offset value gives pointer to
47 * the structure.
48 * If it is a rboard, the local structure contains the node number
49 * and the offset of the beginning of the LINKED LIST on the remote node.
50 * The details of the hardware on a remote node can be built locally,
51 * if required, by reading the LINKED LIST on the remote node and
52 * ignoring all the rboards on that node.
53 *
54 * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the
55 * First board info on the remote node. The remote node list is
56 * traversed as the local list, using the REMOTE BASE ADDRESS and not
57 * the local base address and ignoring all rboard values.
58 *
59 *
60 KLCONFIG
61
62 +------------+ +------------+ +------------+ +------------+
63 | lboard | +-->| lboard | +-->| rboard | +-->| lboard |
64 +------------+ | +------------+ | +------------+ | +------------+
65 | board info | | | board info | | |errinfo,bptr| | | board info |
66 +------------+ | +------------+ | +------------+ | +------------+
67 | offset |--+ | offset |--+ | offset |--+ |offset=NULL |
68 +------------+ +------------+ +------------+ +------------+
69
70
71 +------------+
72 | board info |
73 +------------+ +--------------------------------+
74 | compt 1 |------>| type, rev, diaginfo, size ... | (CPU)
75 +------------+ +--------------------------------+
76 | compt 2 |--+
77 +------------+ | +--------------------------------+
78 | ... | +--->| type, rev, diaginfo, size ... | (MEM_BANK)
79 +------------+ +--------------------------------+
80 | errinfo |--+
81 +------------+ | +--------------------------------+
82 +--->|r/l brd errinfo,compt err flags |
83 +--------------------------------+
84
85 *
86 * Each BOARD consists of COMPONENTs and the BOARD structure has
87 * pointers (offsets) to its COMPONENT structure.
88 * The COMPONENT structure has version info, size and speed info, revision,
89 * error info and the NIC info. This structure can accommodate any
90 * BOARD with arbitrary COMPONENT composition.
91 *
92 * The ERRORINFO part of each BOARD has error information
93 * that describes errors about the BOARD itself. It also has flags to
94 * indicate the COMPONENT(s) on the board that have errors. The error
95 * information specific to the COMPONENT is present in the respective
96 * COMPONENT structure.
97 *
98 * The ERRORINFO structure is also treated like a COMPONENT, ie. the
99 * BOARD has pointers(offset) to the ERRORINFO structure. The rboard
100 * structure also has a pointer to the ERRORINFO structure. This is
101 * the place to store ERRORINFO about a REMOTE NODE, if the HUB on
102 * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where
103 * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can
104 * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info
105 * which is present on the REMOTE NODE.(TBD)
106 * REMOTE ERRINFO can be stored on any of the nearest nodes
107 * or on all the nearest nodes.(TBD)
108 * Like BOARD structures, REMOTE ERRINFO structures can be built locally
109 * using the rboard errinfo pointer.
110 *
111 * In order to get useful information from this Data organization, a set of
112 * interface routines are provided (TBD). The important thing to remember while
113 * manipulating the structures, is that, the NODE number information should
114 * be used. If the NODE is non-zero (remote) then each offset should
115 * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR.
116 * This includes offsets for BOARDS, COMPONENTS and ERRORINFO.
117 *
118 * Note that these structures do not provide much info about connectivity.
119 * That info will be part of HWGRAPH, which is an extension of the cfg_t
120 * data structure. (ref IP27prom/cfg.h) It has to be extended to include
121 * the IO part of the Network(TBD).
122 *
123 * The data structures below define the above concepts.
124 */
125
126
127/*
128 * BOARD classes
129 */
130
131#define KLCLASS_MASK 0xf0
132#define KLCLASS_NONE 0x00
133#define KLCLASS_NODE 0x10 /* CPU, Memory and HUB board */
134#define KLCLASS_CPU KLCLASS_NODE
135#define KLCLASS_IO 0x20 /* BaseIO, 4 ch SCSI, ethernet, FDDI
136 and the non-graphics widget boards */
137#define KLCLASS_ROUTER 0x30 /* Router board */
138#define KLCLASS_MIDPLANE 0x40 /* We need to treat this as a board
139 so that we can record error info */
140#define KLCLASS_IOBRICK 0x70 /* IP35 iobrick */
141#define KLCLASS_MAX 8 /* Bump this if a new CLASS is added */
142
143#define KLCLASS(_x) ((_x) & KLCLASS_MASK)
144
145
146/*
147 * board types
148 */
149
150#define KLTYPE_MASK 0x0f
151#define KLTYPE(_x) ((_x) & KLTYPE_MASK)
152
153#define KLTYPE_SNIA (KLCLASS_CPU | 0x1)
154#define KLTYPE_TIO (KLCLASS_CPU | 0x2)
155
156#define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1)
157#define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3)
158#define KLTYPE_REPEATER_ROUTER (KLCLASS_ROUTER | 0x4)
159
160#define KLTYPE_IOBRICK_XBOW (KLCLASS_MIDPLANE | 0x2)
161
162#define KLTYPE_IOBRICK (KLCLASS_IOBRICK | 0x0)
163#define KLTYPE_NBRICK (KLCLASS_IOBRICK | 0x4)
164#define KLTYPE_PXBRICK (KLCLASS_IOBRICK | 0x6)
165#define KLTYPE_IXBRICK (KLCLASS_IOBRICK | 0x7)
166#define KLTYPE_CGBRICK (KLCLASS_IOBRICK | 0x8)
167#define KLTYPE_OPUSBRICK (KLCLASS_IOBRICK | 0x9)
168#define KLTYPE_SABRICK (KLCLASS_IOBRICK | 0xa)
169#define KLTYPE_IABRICK (KLCLASS_IOBRICK | 0xb)
170#define KLTYPE_PABRICK (KLCLASS_IOBRICK | 0xc)
171#define KLTYPE_GABRICK (KLCLASS_IOBRICK | 0xd)
172
173
174/*
175 * board structures
176 */
177
178#define MAX_COMPTS_PER_BRD 24
179
180typedef struct lboard_s {
181 klconf_off_t brd_next_any; /* Next BOARD */
182 unsigned char struct_type; /* type of structure, local or remote */
183 unsigned char brd_type; /* type+class */
184 unsigned char brd_sversion; /* version of this structure */
185 unsigned char brd_brevision; /* board revision */
186 unsigned char brd_promver; /* board prom version, if any */
187 unsigned char brd_flags; /* Enabled, Disabled etc */
188 unsigned char brd_slot; /* slot number */
189 unsigned short brd_debugsw; /* Debug switches */
190 geoid_t brd_geoid; /* geo id */
191 partid_t brd_partition; /* Partition number */
192 unsigned short brd_diagval; /* diagnostic value */
193 unsigned short brd_diagparm; /* diagnostic parameter */
194 unsigned char brd_inventory; /* inventory history */
195 unsigned char brd_numcompts; /* Number of components */
196 nic_t brd_nic; /* Number in CAN */
197 nasid_t brd_nasid; /* passed parameter */
198 klconf_off_t brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */
199 klconf_off_t brd_errinfo; /* Board's error information */
200 struct lboard_s *brd_parent; /* Logical parent for this brd */
201 char pad0[4];
202 unsigned char brd_confidence; /* confidence that the board is bad */
203 nasid_t brd_owner; /* who owns this board */
204 unsigned char brd_nic_flags; /* To handle 8 more NICs */
205 char pad1[24]; /* future expansion */
206 char brd_name[32];
207 nasid_t brd_next_same_host; /* host of next brd w/same nasid */
208 klconf_off_t brd_next_same; /* Next BOARD with same nasid */
209} lboard_t;
210
211#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts)
212#define NODE_OFFSET_TO_KLINFO(n,off) ((klinfo_t*) TO_NODE_CAC(n,off))
213#define KLCF_NEXT(_brd) \
214 ((_brd)->brd_next_same ? \
215 (NODE_OFFSET_TO_LBOARD((_brd)->brd_next_same_host, (_brd)->brd_next_same)): NULL)
216#define KLCF_NEXT_ANY(_brd) \
217 ((_brd)->brd_next_any ? \
218 (NODE_OFFSET_TO_LBOARD(NASID_GET(_brd), (_brd)->brd_next_any)): NULL)
219#define KLCF_COMP(_brd, _ndx) \
220 ((((_brd)->brd_compts[(_ndx)]) == 0) ? 0 : \
221 (NODE_OFFSET_TO_KLINFO(NASID_GET(_brd), (_brd)->brd_compts[(_ndx)])))
222
223
224/*
225 * Generic info structure. This stores common info about a
226 * component.
227 */
228
229typedef struct klinfo_s { /* Generic info */
230 unsigned char struct_type; /* type of this structure */
231 unsigned char struct_version; /* version of this structure */
232 unsigned char flags; /* Enabled, disabled etc */
233 unsigned char revision; /* component revision */
234 unsigned short diagval; /* result of diagnostics */
235 unsigned short diagparm; /* diagnostic parameter */
236 unsigned char inventory; /* previous inventory status */
237 unsigned short partid; /* widget part number */
238 nic_t nic; /* MUst be aligned properly */
239 unsigned char physid; /* physical id of component */
240 unsigned int virtid; /* virtual id as seen by system */
241 unsigned char widid; /* Widget id - if applicable */
242 nasid_t nasid; /* node number - from parent */
243 char pad1; /* pad out structure. */
244 char pad2; /* pad out structure. */
245 void *data;
246 klconf_off_t errinfo; /* component specific errors */
247 unsigned short pad3; /* pci fields have moved over to */
248 unsigned short pad4; /* klbri_t */
249} klinfo_t ;
250
251
252static inline lboard_t *find_lboard_any(lboard_t * start, unsigned char brd_type)
253{
254 /* Search all boards stored on this node. */
255
256 while (start) {
257 if (start->brd_type == brd_type)
258 return start;
259 start = KLCF_NEXT_ANY(start);
260 }
261 /* Didn't find it. */
262 return (lboard_t *) NULL;
263}
264
265
266/* external declarations of Linux kernel functions. */
267
268extern lboard_t *root_lboard[];
269extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
270extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
271
272#endif /* _ASM_IA64_SN_KLCONFIG_H */
diff --git a/include/asm-ia64/sn/l1.h b/include/asm-ia64/sn/l1.h
new file mode 100644
index 000000000000..d5dbd55e44b5
--- /dev/null
+++ b/include/asm-ia64/sn/l1.h
@@ -0,0 +1,36 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992-1997,2000-2004 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#ifndef _ASM_IA64_SN_L1_H
10#define _ASM_IA64_SN_L1_H
11
12/* brick type response codes */
13#define L1_BRICKTYPE_PX 0x23 /* # */
14#define L1_BRICKTYPE_PE 0x25 /* % */
15#define L1_BRICKTYPE_N_p0 0x26 /* & */
16#define L1_BRICKTYPE_IP45 0x34 /* 4 */
17#define L1_BRICKTYPE_IP41 0x35 /* 5 */
18#define L1_BRICKTYPE_TWISTER 0x36 /* 6 */ /* IP53 & ROUTER */
19#define L1_BRICKTYPE_IX 0x3d /* = */
20#define L1_BRICKTYPE_IP34 0x61 /* a */
21#define L1_BRICKTYPE_GA 0x62 /* b */
22#define L1_BRICKTYPE_C 0x63 /* c */
23#define L1_BRICKTYPE_OPUS_TIO 0x66 /* f */
24#define L1_BRICKTYPE_I 0x69 /* i */
25#define L1_BRICKTYPE_N 0x6e /* n */
26#define L1_BRICKTYPE_OPUS 0x6f /* o */
27#define L1_BRICKTYPE_P 0x70 /* p */
28#define L1_BRICKTYPE_R 0x72 /* r */
29#define L1_BRICKTYPE_CHI_CG 0x76 /* v */
30#define L1_BRICKTYPE_X 0x78 /* x */
31#define L1_BRICKTYPE_X2 0x79 /* y */
32#define L1_BRICKTYPE_SA 0x5e /* ^ */ /* TIO bringup brick */
33#define L1_BRICKTYPE_PA 0x6a /* j */
34#define L1_BRICKTYPE_IA 0x6b /* k */
35
36#endif /* _ASM_IA64_SN_L1_H */
diff --git a/include/asm-ia64/sn/leds.h b/include/asm-ia64/sn/leds.h
new file mode 100644
index 000000000000..66cf8c4d92c9
--- /dev/null
+++ b/include/asm-ia64/sn/leds.h
@@ -0,0 +1,33 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 * Copyright (C) 2000-2004 Silicon Graphics, Inc. All rights reserved.
6 */
7#ifndef _ASM_IA64_SN_LEDS_H
8#define _ASM_IA64_SN_LEDS_H
9
10#include <asm/sn/addrs.h>
11#include <asm/sn/pda.h>
12#include <asm/sn/shub_mmr.h>
13
14#define LED0 (LOCAL_MMR_ADDR(SH_REAL_JUNK_BUS_LED0))
15#define LED_CPU_SHIFT 16
16
17#define LED_CPU_HEARTBEAT 0x01
18#define LED_CPU_ACTIVITY 0x02
19#define LED_ALWAYS_SET 0x00
20
21/*
22 * Basic macros for flashing the LEDS on an SGI SN.
23 */
24
25static __inline__ void
26set_led_bits(u8 value, u8 mask)
27{
28 pda->led_state = (pda->led_state & ~mask) | (value & mask);
29 *pda->led_address = (short) pda->led_state;
30}
31
32#endif /* _ASM_IA64_SN_LEDS_H */
33
diff --git a/include/asm-ia64/sn/module.h b/include/asm-ia64/sn/module.h
new file mode 100644
index 000000000000..734e980ece2f
--- /dev/null
+++ b/include/asm-ia64/sn/module.h
@@ -0,0 +1,127 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_MODULE_H
9#define _ASM_IA64_SN_MODULE_H
10
11/* parameter for format_module_id() */
12#define MODULE_FORMAT_BRIEF 1
13#define MODULE_FORMAT_LONG 2
14#define MODULE_FORMAT_LCD 3
15
16/*
17 * Module id format
18 *
19 * 31-16 Rack ID (encoded class, group, number - 16-bit unsigned int)
20 * 15-8 Brick type (8-bit ascii character)
21 * 7-0 Bay (brick position in rack (0-63) - 8-bit unsigned int)
22 *
23 */
24
25/*
26 * Macros for getting the brick type
27 */
28#define MODULE_BTYPE_MASK 0xff00
29#define MODULE_BTYPE_SHFT 8
30#define MODULE_GET_BTYPE(_m) (((_m) & MODULE_BTYPE_MASK) >> MODULE_BTYPE_SHFT)
31#define MODULE_BT_TO_CHAR(_b) ((char)(_b))
32#define MODULE_GET_BTCHAR(_m) (MODULE_BT_TO_CHAR(MODULE_GET_BTYPE(_m)))
33
34/*
35 * Macros for getting the rack ID.
36 */
37#define MODULE_RACK_MASK 0xffff0000
38#define MODULE_RACK_SHFT 16
39#define MODULE_GET_RACK(_m) (((_m) & MODULE_RACK_MASK) >> MODULE_RACK_SHFT)
40
41/*
42 * Macros for getting the brick position
43 */
44#define MODULE_BPOS_MASK 0x00ff
45#define MODULE_BPOS_SHFT 0
46#define MODULE_GET_BPOS(_m) (((_m) & MODULE_BPOS_MASK) >> MODULE_BPOS_SHFT)
47
48/*
49 * Macros for encoding and decoding rack IDs
50 * A rack number consists of three parts:
51 * class (0==CPU/mixed, 1==I/O), group, number
52 *
53 * Rack number is stored just as it is displayed on the screen:
54 * a 3-decimal-digit number.
55 */
56#define RACK_CLASS_DVDR 100
57#define RACK_GROUP_DVDR 10
58#define RACK_NUM_DVDR 1
59
60#define RACK_CREATE_RACKID(_c, _g, _n) ((_c) * RACK_CLASS_DVDR + \
61 (_g) * RACK_GROUP_DVDR + (_n) * RACK_NUM_DVDR)
62
63#define RACK_GET_CLASS(_r) ((_r) / RACK_CLASS_DVDR)
64#define RACK_GET_GROUP(_r) (((_r) - RACK_GET_CLASS(_r) * \
65 RACK_CLASS_DVDR) / RACK_GROUP_DVDR)
66#define RACK_GET_NUM(_r) (((_r) - RACK_GET_CLASS(_r) * \
67 RACK_CLASS_DVDR - RACK_GET_GROUP(_r) * \
68 RACK_GROUP_DVDR) / RACK_NUM_DVDR)
69
70/*
71 * Macros for encoding and decoding rack IDs
72 * A rack number consists of three parts:
73 * class 1 bit, 0==CPU/mixed, 1==I/O
74 * group 2 bits for CPU/mixed, 3 bits for I/O
75 * number 3 bits for CPU/mixed, 2 bits for I/O (1 based)
76 */
77#define RACK_GROUP_BITS(_r) (RACK_GET_CLASS(_r) ? 3 : 2)
78#define RACK_NUM_BITS(_r) (RACK_GET_CLASS(_r) ? 2 : 3)
79
80#define RACK_CLASS_MASK(_r) 0x20
81#define RACK_CLASS_SHFT(_r) 5
82#define RACK_ADD_CLASS(_r, _c) \
83 ((_r) |= (_c) << RACK_CLASS_SHFT(_r) & RACK_CLASS_MASK(_r))
84
85#define RACK_GROUP_SHFT(_r) RACK_NUM_BITS(_r)
86#define RACK_GROUP_MASK(_r) \
87 ( (((unsigned)1<<RACK_GROUP_BITS(_r)) - 1) << RACK_GROUP_SHFT(_r) )
88#define RACK_ADD_GROUP(_r, _g) \
89 ((_r) |= (_g) << RACK_GROUP_SHFT(_r) & RACK_GROUP_MASK(_r))
90
91#define RACK_NUM_SHFT(_r) 0
92#define RACK_NUM_MASK(_r) \
93 ( (((unsigned)1<<RACK_NUM_BITS(_r)) - 1) << RACK_NUM_SHFT(_r) )
94#define RACK_ADD_NUM(_r, _n) \
95 ((_r) |= ((_n) - 1) << RACK_NUM_SHFT(_r) & RACK_NUM_MASK(_r))
96
97
98/*
99 * Brick type definitions
100 */
101#define MAX_BRICK_TYPES 256 /* brick type is stored as uchar */
102
103extern char brick_types[];
104
105#define MODULE_CBRICK 0
106#define MODULE_RBRICK 1
107#define MODULE_IBRICK 2
108#define MODULE_KBRICK 3
109#define MODULE_XBRICK 4
110#define MODULE_DBRICK 5
111#define MODULE_PBRICK 6
112#define MODULE_NBRICK 7
113#define MODULE_PEBRICK 8
114#define MODULE_PXBRICK 9
115#define MODULE_IXBRICK 10
116#define MODULE_CGBRICK 11
117#define MODULE_OPUSBRICK 12
118#define MODULE_SABRICK 13 /* TIO BringUp Brick */
119#define MODULE_IABRICK 14
120#define MODULE_PABRICK 15
121#define MODULE_GABRICK 16
122#define MODULE_OPUS_TIO 17 /* OPUS TIO Riser */
123
124extern char brick_types[];
125extern void format_module_id(char *, moduleid_t, int);
126
127#endif /* _ASM_IA64_SN_MODULE_H */
diff --git a/include/asm-ia64/sn/nodepda.h b/include/asm-ia64/sn/nodepda.h
new file mode 100644
index 000000000000..2fbde33656e6
--- /dev/null
+++ b/include/asm-ia64/sn/nodepda.h
@@ -0,0 +1,86 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_NODEPDA_H
9#define _ASM_IA64_SN_NODEPDA_H
10
11
12#include <asm/semaphore.h>
13#include <asm/irq.h>
14#include <asm/sn/arch.h>
15#include <asm/sn/intr.h>
16#include <asm/sn/pda.h>
17#include <asm/sn/bte.h>
18
19/*
20 * NUMA Node-Specific Data structures are defined in this file.
21 * In particular, this is the location of the node PDA.
22 * A pointer to the right node PDA is saved in each CPU PDA.
23 */
24
25/*
26 * Node-specific data structure.
27 *
28 * One of these structures is allocated on each node of a NUMA system.
29 *
30 * This structure provides a convenient way of keeping together
31 * all per-node data structures.
32 */
33struct phys_cpuid {
34 short nasid;
35 char subnode;
36 char slice;
37};
38
39struct nodepda_s {
40 void *pdinfo; /* Platform-dependent per-node info */
41 spinlock_t bist_lock;
42
43 /*
44 * The BTEs on this node are shared by the local cpus
45 */
46 struct bteinfo_s bte_if[BTES_PER_NODE]; /* Virtual Interface */
47 struct timer_list bte_recovery_timer;
48 spinlock_t bte_recovery_lock;
49
50 /*
51 * Array of pointers to the nodepdas for each node.
52 */
53 struct nodepda_s *pernode_pdaindr[MAX_COMPACT_NODES];
54
55 /*
56 * Array of physical cpu identifiers. Indexed by cpuid.
57 */
58 struct phys_cpuid phys_cpuid[NR_CPUS];
59};
60
61typedef struct nodepda_s nodepda_t;
62
63/*
64 * Access Functions for node PDA.
65 * Since there is one nodepda for each node, we need a convenient mechanism
66 * to access these nodepdas without cluttering code with #ifdefs.
67 * The next set of definitions provides this.
68 * Routines are expected to use
69 *
70 * nodepda -> to access node PDA for the node on which code is running
71 * subnodepda -> to access subnode PDA for the subnode on which code is running
72 *
73 * NODEPDA(cnode) -> to access node PDA for cnodeid
74 * SUBNODEPDA(cnode,sn) -> to access subnode PDA for cnodeid/subnode
75 */
76
77#define nodepda pda->p_nodepda /* Ptr to this node's PDA */
78#define NODEPDA(cnode) (nodepda->pernode_pdaindr[cnode])
79
80/*
81 * Check if given a compact node id the corresponding node has all the
82 * cpus disabled.
83 */
84#define is_headless_node(cnode) (nr_cpus_node(cnode) == 0)
85
86#endif /* _ASM_IA64_SN_NODEPDA_H */
diff --git a/include/asm-ia64/sn/pda.h b/include/asm-ia64/sn/pda.h
new file mode 100644
index 000000000000..e940d3647c80
--- /dev/null
+++ b/include/asm-ia64/sn/pda.h
@@ -0,0 +1,80 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_PDA_H
9#define _ASM_IA64_SN_PDA_H
10
11#include <linux/cache.h>
12#include <asm/percpu.h>
13#include <asm/system.h>
14#include <asm/sn/bte.h>
15
16
17/*
18 * CPU-specific data structure.
19 *
20 * One of these structures is allocated for each cpu of a NUMA system.
21 *
22 * This structure provides a convenient way of keeping together
23 * all SN per-cpu data structures.
24 */
25
26typedef struct pda_s {
27
28 /* Having a pointer in the begining of PDA tends to increase
29 * the chance of having this pointer in cache. (Yes something
30 * else gets pushed out). Doing this reduces the number of memory
31 * access to all nodepda variables to be one
32 */
33 struct nodepda_s *p_nodepda; /* Pointer to Per node PDA */
34 struct subnodepda_s *p_subnodepda; /* Pointer to CPU subnode PDA */
35
36 /*
37 * Support for SN LEDs
38 */
39 volatile short *led_address;
40 u8 led_state;
41 u8 hb_state; /* supports blinking heartbeat leds */
42 unsigned int hb_count;
43
44 unsigned int idle_flag;
45
46 volatile unsigned long *bedrock_rev_id;
47 volatile unsigned long *pio_write_status_addr;
48 unsigned long pio_write_status_val;
49 volatile unsigned long *pio_shub_war_cam_addr;
50
51 unsigned long sn_soft_irr[4];
52 unsigned long sn_in_service_ivecs[4];
53 short cnodeid_to_nasid_table[MAX_NUMNODES];
54 int sn_lb_int_war_ticks;
55 int sn_last_irq;
56 int sn_first_irq;
57} pda_t;
58
59
60#define CACHE_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1))
61
62/*
63 * PDA
64 * Per-cpu private data area for each cpu. The PDA is located immediately after
65 * the IA64 cpu_data area. A full page is allocated for the cp_data area for each
66 * cpu but only a small amout of the page is actually used. We put the SNIA PDA
67 * in the same page as the cpu_data area. Note that there is a check in the setup
68 * code to verify that we don't overflow the page.
69 *
70 * Seems like we should should cache-line align the pda so that any changes in the
71 * size of the cpu_data area don't change cache layout. Should we align to 32, 64, 128
72 * or 512 boundary. Each has merits. For now, pick 128 but should be revisited later.
73 */
74DECLARE_PER_CPU(struct pda_s, pda_percpu);
75
76#define pda (&__ia64_per_cpu_var(pda_percpu))
77
78#define pdacpu(cpu) (&per_cpu(pda_percpu, cpu))
79
80#endif /* _ASM_IA64_SN_PDA_H */
diff --git a/include/asm-ia64/sn/rw_mmr.h b/include/asm-ia64/sn/rw_mmr.h
new file mode 100644
index 000000000000..f40fd1a5510d
--- /dev/null
+++ b/include/asm-ia64/sn/rw_mmr.h
@@ -0,0 +1,74 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002-2004 Silicon Graphics, Inc. All Rights Reserved.
7 */
8#ifndef _ASM_IA64_SN_RW_MMR_H
9#define _ASM_IA64_SN_RW_MMR_H
10
11
12/*
13 * This file contains macros used to access MMR registers via
14 * uncached physical addresses.
15 * pio_phys_read_mmr - read an MMR
16 * pio_phys_write_mmr - write an MMR
17 * pio_atomic_phys_write_mmrs - atomically write 1 or 2 MMRs with psr.ic=0
18 * Second MMR will be skipped if address is NULL
19 *
20 * Addresses passed to these routines should be uncached physical addresses
21 * ie., 0x80000....
22 */
23
24
25extern inline long
26pio_phys_read_mmr(volatile long *mmr)
27{
28 long val;
29 asm volatile
30 ("mov r2=psr;;"
31 "rsm psr.i | psr.dt;;"
32 "srlz.i;;"
33 "ld8.acq %0=[%1];;"
34 "mov psr.l=r2;;"
35 "srlz.i;;"
36 : "=r"(val)
37 : "r"(mmr)
38 : "r2");
39 return val;
40}
41
42
43
44extern inline void
45pio_phys_write_mmr(volatile long *mmr, long val)
46{
47 asm volatile
48 ("mov r2=psr;;"
49 "rsm psr.i | psr.dt;;"
50 "srlz.i;;"
51 "st8.rel [%0]=%1;;"
52 "mov psr.l=r2;;"
53 "srlz.i;;"
54 :: "r"(mmr), "r"(val)
55 : "r2", "memory");
56}
57
58extern inline void
59pio_atomic_phys_write_mmrs(volatile long *mmr1, long val1, volatile long *mmr2, long val2)
60{
61 asm volatile
62 ("mov r2=psr;;"
63 "rsm psr.i | psr.dt | psr.ic;;"
64 "cmp.ne p9,p0=%2,r0;"
65 "srlz.i;;"
66 "st8.rel [%0]=%1;"
67 "(p9) st8.rel [%2]=%3;;"
68 "mov psr.l=r2;;"
69 "srlz.i;;"
70 :: "r"(mmr1), "r"(val1), "r"(mmr2), "r"(val2)
71 : "p9", "r2", "memory");
72}
73
74#endif /* _ASM_IA64_SN_RW_MMR_H */
diff --git a/include/asm-ia64/sn/shub_mmr.h b/include/asm-ia64/sn/shub_mmr.h
new file mode 100644
index 000000000000..5c2fcf13d5ce
--- /dev/null
+++ b/include/asm-ia64/sn/shub_mmr.h
@@ -0,0 +1,441 @@
1/*
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-2004 Silicon Graphics, Inc. All rights reserved.
8 */
9
10#ifndef _ASM_IA64_SN_SHUB_MMR_H
11#define _ASM_IA64_SN_SHUB_MMR_H
12
13/* ==================================================================== */
14/* Register "SH_IPI_INT" */
15/* SHub Inter-Processor Interrupt Registers */
16/* ==================================================================== */
17#define SH1_IPI_INT 0x0000000110000380
18#define SH2_IPI_INT 0x0000000010000380
19
20/* SH_IPI_INT_TYPE */
21/* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */
22#define SH_IPI_INT_TYPE_SHFT 0
23#define SH_IPI_INT_TYPE_MASK 0x0000000000000007
24
25/* SH_IPI_INT_AGT */
26/* Description: Agent, must be 0 for SHub */
27#define SH_IPI_INT_AGT_SHFT 3
28#define SH_IPI_INT_AGT_MASK 0x0000000000000008
29
30/* SH_IPI_INT_PID */
31/* Description: Processor ID, same setting as on targeted McKinley */
32#define SH_IPI_INT_PID_SHFT 4
33#define SH_IPI_INT_PID_MASK 0x00000000000ffff0
34
35/* SH_IPI_INT_BASE */
36/* Description: Optional interrupt vector area, 2MB aligned */
37#define SH_IPI_INT_BASE_SHFT 21
38#define SH_IPI_INT_BASE_MASK 0x0003ffffffe00000
39
40/* SH_IPI_INT_IDX */
41/* Description: Targeted McKinley interrupt vector */
42#define SH_IPI_INT_IDX_SHFT 52
43#define SH_IPI_INT_IDX_MASK 0x0ff0000000000000
44
45/* SH_IPI_INT_SEND */
46/* Description: Send Interrupt Message to PI, This generates a puls */
47#define SH_IPI_INT_SEND_SHFT 63
48#define SH_IPI_INT_SEND_MASK 0x8000000000000000
49
50/* ==================================================================== */
51/* Register "SH_EVENT_OCCURRED" */
52/* SHub Interrupt Event Occurred */
53/* ==================================================================== */
54#define SH1_EVENT_OCCURRED 0x0000000110010000
55#define SH1_EVENT_OCCURRED_ALIAS 0x0000000110010008
56#define SH2_EVENT_OCCURRED 0x0000000010010000
57#define SH2_EVENT_OCCURRED_ALIAS 0x0000000010010008
58
59/* ==================================================================== */
60/* Register "SH_PI_CAM_CONTROL" */
61/* CRB CAM MMR Access Control */
62/* ==================================================================== */
63#define SH1_PI_CAM_CONTROL 0x0000000120050300
64
65/* ==================================================================== */
66/* Register "SH_SHUB_ID" */
67/* SHub ID Number */
68/* ==================================================================== */
69#define SH1_SHUB_ID 0x0000000110060580
70#define SH1_SHUB_ID_REVISION_SHFT 28
71#define SH1_SHUB_ID_REVISION_MASK 0x00000000f0000000
72
73/* ==================================================================== */
74/* Register "SH_RTC" */
75/* Real-time Clock */
76/* ==================================================================== */
77#define SH1_RTC 0x00000001101c0000
78#define SH2_RTC 0x00000002101c0000
79#define SH_RTC_MASK 0x007fffffffffffff
80
81/* ==================================================================== */
82/* Register "SH_PIO_WRITE_STATUS_0|1" */
83/* PIO Write Status for CPU 0 & 1 */
84/* ==================================================================== */
85#define SH1_PIO_WRITE_STATUS_0 0x0000000120070200
86#define SH1_PIO_WRITE_STATUS_1 0x0000000120070280
87#define SH2_PIO_WRITE_STATUS_0 0x0000000020070200
88#define SH2_PIO_WRITE_STATUS_1 0x0000000020070280
89#define SH2_PIO_WRITE_STATUS_2 0x0000000020070300
90#define SH2_PIO_WRITE_STATUS_3 0x0000000020070380
91
92/* SH_PIO_WRITE_STATUS_0_WRITE_DEADLOCK */
93/* Description: Deadlock response detected */
94#define SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_SHFT 1
95#define SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_MASK 0x0000000000000002
96
97/* SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT */
98/* Description: Count of currently pending PIO writes */
99#define SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_SHFT 56
100#define SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK 0x3f00000000000000
101
102/* ==================================================================== */
103/* Register "SH_PIO_WRITE_STATUS_0_ALIAS" */
104/* ==================================================================== */
105#define SH1_PIO_WRITE_STATUS_0_ALIAS 0x0000000120070208
106#define SH2_PIO_WRITE_STATUS_0_ALIAS 0x0000000020070208
107
108/* ==================================================================== */
109/* Register "SH_EVENT_OCCURRED" */
110/* SHub Interrupt Event Occurred */
111/* ==================================================================== */
112/* SH_EVENT_OCCURRED_UART_INT */
113/* Description: Pending Junk Bus UART Interrupt */
114#define SH_EVENT_OCCURRED_UART_INT_SHFT 20
115#define SH_EVENT_OCCURRED_UART_INT_MASK 0x0000000000100000
116
117/* SH_EVENT_OCCURRED_IPI_INT */
118/* Description: Pending IPI Interrupt */
119#define SH_EVENT_OCCURRED_IPI_INT_SHFT 28
120#define SH_EVENT_OCCURRED_IPI_INT_MASK 0x0000000010000000
121
122/* SH_EVENT_OCCURRED_II_INT0 */
123/* Description: Pending II 0 Interrupt */
124#define SH_EVENT_OCCURRED_II_INT0_SHFT 29
125#define SH_EVENT_OCCURRED_II_INT0_MASK 0x0000000020000000
126
127/* SH_EVENT_OCCURRED_II_INT1 */
128/* Description: Pending II 1 Interrupt */
129#define SH_EVENT_OCCURRED_II_INT1_SHFT 30
130#define SH_EVENT_OCCURRED_II_INT1_MASK 0x0000000040000000
131
132/* ==================================================================== */
133/* LEDS */
134/* ==================================================================== */
135#define SH1_REAL_JUNK_BUS_LED0 0x7fed00000UL
136#define SH1_REAL_JUNK_BUS_LED1 0x7fed10000UL
137#define SH1_REAL_JUNK_BUS_LED2 0x7fed20000UL
138#define SH1_REAL_JUNK_BUS_LED3 0x7fed30000UL
139
140#define SH2_REAL_JUNK_BUS_LED0 0xf0000000UL
141#define SH2_REAL_JUNK_BUS_LED1 0xf0010000UL
142#define SH2_REAL_JUNK_BUS_LED2 0xf0020000UL
143#define SH2_REAL_JUNK_BUS_LED3 0xf0030000UL
144
145/* ==================================================================== */
146/* Register "SH1_PTC_0" */
147/* Puge Translation Cache Message Configuration Information */
148/* ==================================================================== */
149#define SH1_PTC_0 0x00000001101a0000
150
151/* SH1_PTC_0_A */
152/* Description: Type */
153#define SH1_PTC_0_A_SHFT 0
154
155/* SH1_PTC_0_PS */
156/* Description: Page Size */
157#define SH1_PTC_0_PS_SHFT 2
158
159/* SH1_PTC_0_RID */
160/* Description: Region ID */
161#define SH1_PTC_0_RID_SHFT 8
162
163/* SH1_PTC_0_START */
164/* Description: Start */
165#define SH1_PTC_0_START_SHFT 63
166
167/* ==================================================================== */
168/* Register "SH1_PTC_1" */
169/* Puge Translation Cache Message Configuration Information */
170/* ==================================================================== */
171#define SH1_PTC_1 0x00000001101a0080
172
173/* SH1_PTC_1_START */
174/* Description: PTC_1 Start */
175#define SH1_PTC_1_START_SHFT 63
176
177
178/* ==================================================================== */
179/* Register "SH2_PTC" */
180/* Puge Translation Cache Message Configuration Information */
181/* ==================================================================== */
182#define SH2_PTC 0x0000000170000000
183
184/* SH2_PTC_A */
185/* Description: Type */
186#define SH2_PTC_A_SHFT 0
187
188/* SH2_PTC_PS */
189/* Description: Page Size */
190#define SH2_PTC_PS_SHFT 2
191
192/* SH2_PTC_RID */
193/* Description: Region ID */
194#define SH2_PTC_RID_SHFT 4
195
196/* SH2_PTC_START */
197/* Description: Start */
198#define SH2_PTC_START_SHFT 63
199
200/* SH2_PTC_ADDR_RID */
201/* Description: Region ID */
202#define SH2_PTC_ADDR_SHFT 4
203#define SH2_PTC_ADDR_MASK 0x1ffffffffffff000
204
205/* ==================================================================== */
206/* Register "SH_RTC1_INT_CONFIG" */
207/* SHub RTC 1 Interrupt Config Registers */
208/* ==================================================================== */
209
210#define SH1_RTC1_INT_CONFIG 0x0000000110001480
211#define SH2_RTC1_INT_CONFIG 0x0000000010001480
212#define SH_RTC1_INT_CONFIG_MASK 0x0ff3ffffffefffff
213#define SH_RTC1_INT_CONFIG_INIT 0x0000000000000000
214
215/* SH_RTC1_INT_CONFIG_TYPE */
216/* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */
217#define SH_RTC1_INT_CONFIG_TYPE_SHFT 0
218#define SH_RTC1_INT_CONFIG_TYPE_MASK 0x0000000000000007
219
220/* SH_RTC1_INT_CONFIG_AGT */
221/* Description: Agent, must be 0 for SHub */
222#define SH_RTC1_INT_CONFIG_AGT_SHFT 3
223#define SH_RTC1_INT_CONFIG_AGT_MASK 0x0000000000000008
224
225/* SH_RTC1_INT_CONFIG_PID */
226/* Description: Processor ID, same setting as on targeted McKinley */
227#define SH_RTC1_INT_CONFIG_PID_SHFT 4
228#define SH_RTC1_INT_CONFIG_PID_MASK 0x00000000000ffff0
229
230/* SH_RTC1_INT_CONFIG_BASE */
231/* Description: Optional interrupt vector area, 2MB aligned */
232#define SH_RTC1_INT_CONFIG_BASE_SHFT 21
233#define SH_RTC1_INT_CONFIG_BASE_MASK 0x0003ffffffe00000
234
235/* SH_RTC1_INT_CONFIG_IDX */
236/* Description: Targeted McKinley interrupt vector */
237#define SH_RTC1_INT_CONFIG_IDX_SHFT 52
238#define SH_RTC1_INT_CONFIG_IDX_MASK 0x0ff0000000000000
239
240/* ==================================================================== */
241/* Register "SH_RTC1_INT_ENABLE" */
242/* SHub RTC 1 Interrupt Enable Registers */
243/* ==================================================================== */
244
245#define SH1_RTC1_INT_ENABLE 0x0000000110001500
246#define SH2_RTC1_INT_ENABLE 0x0000000010001500
247#define SH_RTC1_INT_ENABLE_MASK 0x0000000000000001
248#define SH_RTC1_INT_ENABLE_INIT 0x0000000000000000
249
250/* SH_RTC1_INT_ENABLE_RTC1_ENABLE */
251/* Description: Enable RTC 1 Interrupt */
252#define SH_RTC1_INT_ENABLE_RTC1_ENABLE_SHFT 0
253#define SH_RTC1_INT_ENABLE_RTC1_ENABLE_MASK 0x0000000000000001
254
255/* ==================================================================== */
256/* Register "SH_RTC2_INT_CONFIG" */
257/* SHub RTC 2 Interrupt Config Registers */
258/* ==================================================================== */
259
260#define SH1_RTC2_INT_CONFIG 0x0000000110001580
261#define SH2_RTC2_INT_CONFIG 0x0000000010001580
262#define SH_RTC2_INT_CONFIG_MASK 0x0ff3ffffffefffff
263#define SH_RTC2_INT_CONFIG_INIT 0x0000000000000000
264
265/* SH_RTC2_INT_CONFIG_TYPE */
266/* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */
267#define SH_RTC2_INT_CONFIG_TYPE_SHFT 0
268#define SH_RTC2_INT_CONFIG_TYPE_MASK 0x0000000000000007
269
270/* SH_RTC2_INT_CONFIG_AGT */
271/* Description: Agent, must be 0 for SHub */
272#define SH_RTC2_INT_CONFIG_AGT_SHFT 3
273#define SH_RTC2_INT_CONFIG_AGT_MASK 0x0000000000000008
274
275/* SH_RTC2_INT_CONFIG_PID */
276/* Description: Processor ID, same setting as on targeted McKinley */
277#define SH_RTC2_INT_CONFIG_PID_SHFT 4
278#define SH_RTC2_INT_CONFIG_PID_MASK 0x00000000000ffff0
279
280/* SH_RTC2_INT_CONFIG_BASE */
281/* Description: Optional interrupt vector area, 2MB aligned */
282#define SH_RTC2_INT_CONFIG_BASE_SHFT 21
283#define SH_RTC2_INT_CONFIG_BASE_MASK 0x0003ffffffe00000
284
285/* SH_RTC2_INT_CONFIG_IDX */
286/* Description: Targeted McKinley interrupt vector */
287#define SH_RTC2_INT_CONFIG_IDX_SHFT 52
288#define SH_RTC2_INT_CONFIG_IDX_MASK 0x0ff0000000000000
289
290/* ==================================================================== */
291/* Register "SH_RTC2_INT_ENABLE" */
292/* SHub RTC 2 Interrupt Enable Registers */
293/* ==================================================================== */
294
295#define SH1_RTC2_INT_ENABLE 0x0000000110001600
296#define SH2_RTC2_INT_ENABLE 0x0000000010001600
297#define SH_RTC2_INT_ENABLE_MASK 0x0000000000000001
298#define SH_RTC2_INT_ENABLE_INIT 0x0000000000000000
299
300/* SH_RTC2_INT_ENABLE_RTC2_ENABLE */
301/* Description: Enable RTC 2 Interrupt */
302#define SH_RTC2_INT_ENABLE_RTC2_ENABLE_SHFT 0
303#define SH_RTC2_INT_ENABLE_RTC2_ENABLE_MASK 0x0000000000000001
304
305/* ==================================================================== */
306/* Register "SH_RTC3_INT_CONFIG" */
307/* SHub RTC 3 Interrupt Config Registers */
308/* ==================================================================== */
309
310#define SH1_RTC3_INT_CONFIG 0x0000000110001680
311#define SH2_RTC3_INT_CONFIG 0x0000000010001680
312#define SH_RTC3_INT_CONFIG_MASK 0x0ff3ffffffefffff
313#define SH_RTC3_INT_CONFIG_INIT 0x0000000000000000
314
315/* SH_RTC3_INT_CONFIG_TYPE */
316/* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */
317#define SH_RTC3_INT_CONFIG_TYPE_SHFT 0
318#define SH_RTC3_INT_CONFIG_TYPE_MASK 0x0000000000000007
319
320/* SH_RTC3_INT_CONFIG_AGT */
321/* Description: Agent, must be 0 for SHub */
322#define SH_RTC3_INT_CONFIG_AGT_SHFT 3
323#define SH_RTC3_INT_CONFIG_AGT_MASK 0x0000000000000008
324
325/* SH_RTC3_INT_CONFIG_PID */
326/* Description: Processor ID, same setting as on targeted McKinley */
327#define SH_RTC3_INT_CONFIG_PID_SHFT 4
328#define SH_RTC3_INT_CONFIG_PID_MASK 0x00000000000ffff0
329
330/* SH_RTC3_INT_CONFIG_BASE */
331/* Description: Optional interrupt vector area, 2MB aligned */
332#define SH_RTC3_INT_CONFIG_BASE_SHFT 21
333#define SH_RTC3_INT_CONFIG_BASE_MASK 0x0003ffffffe00000
334
335/* SH_RTC3_INT_CONFIG_IDX */
336/* Description: Targeted McKinley interrupt vector */
337#define SH_RTC3_INT_CONFIG_IDX_SHFT 52
338#define SH_RTC3_INT_CONFIG_IDX_MASK 0x0ff0000000000000
339
340/* ==================================================================== */
341/* Register "SH_RTC3_INT_ENABLE" */
342/* SHub RTC 3 Interrupt Enable Registers */
343/* ==================================================================== */
344
345#define SH1_RTC3_INT_ENABLE 0x0000000110001700
346#define SH2_RTC3_INT_ENABLE 0x0000000010001700
347#define SH_RTC3_INT_ENABLE_MASK 0x0000000000000001
348#define SH_RTC3_INT_ENABLE_INIT 0x0000000000000000
349
350/* SH_RTC3_INT_ENABLE_RTC3_ENABLE */
351/* Description: Enable RTC 3 Interrupt */
352#define SH_RTC3_INT_ENABLE_RTC3_ENABLE_SHFT 0
353#define SH_RTC3_INT_ENABLE_RTC3_ENABLE_MASK 0x0000000000000001
354
355/* SH_EVENT_OCCURRED_RTC1_INT */
356/* Description: Pending RTC 1 Interrupt */
357#define SH_EVENT_OCCURRED_RTC1_INT_SHFT 24
358#define SH_EVENT_OCCURRED_RTC1_INT_MASK 0x0000000001000000
359
360/* SH_EVENT_OCCURRED_RTC2_INT */
361/* Description: Pending RTC 2 Interrupt */
362#define SH_EVENT_OCCURRED_RTC2_INT_SHFT 25
363#define SH_EVENT_OCCURRED_RTC2_INT_MASK 0x0000000002000000
364
365/* SH_EVENT_OCCURRED_RTC3_INT */
366/* Description: Pending RTC 3 Interrupt */
367#define SH_EVENT_OCCURRED_RTC3_INT_SHFT 26
368#define SH_EVENT_OCCURRED_RTC3_INT_MASK 0x0000000004000000
369
370/* ==================================================================== */
371/* Register "SH_INT_CMPB" */
372/* RTC Compare Value for Processor B */
373/* ==================================================================== */
374
375#define SH1_INT_CMPB 0x00000001101b0080
376#define SH2_INT_CMPB 0x00000000101b0080
377#define SH_INT_CMPB_MASK 0x007fffffffffffff
378#define SH_INT_CMPB_INIT 0x0000000000000000
379
380/* SH_INT_CMPB_REAL_TIME_CMPB */
381/* Description: Real Time Clock Compare */
382#define SH_INT_CMPB_REAL_TIME_CMPB_SHFT 0
383#define SH_INT_CMPB_REAL_TIME_CMPB_MASK 0x007fffffffffffff
384
385/* ==================================================================== */
386/* Register "SH_INT_CMPC" */
387/* RTC Compare Value for Processor C */
388/* ==================================================================== */
389
390#define SH1_INT_CMPC 0x00000001101b0100
391#define SH2_INT_CMPC 0x00000000101b0100
392#define SH_INT_CMPC_MASK 0x007fffffffffffff
393#define SH_INT_CMPC_INIT 0x0000000000000000
394
395/* SH_INT_CMPC_REAL_TIME_CMPC */
396/* Description: Real Time Clock Compare */
397#define SH_INT_CMPC_REAL_TIME_CMPC_SHFT 0
398#define SH_INT_CMPC_REAL_TIME_CMPC_MASK 0x007fffffffffffff
399
400/* ==================================================================== */
401/* Register "SH_INT_CMPD" */
402/* RTC Compare Value for Processor D */
403/* ==================================================================== */
404
405#define SH1_INT_CMPD 0x00000001101b0180
406#define SH2_INT_CMPD 0x00000000101b0180
407#define SH_INT_CMPD_MASK 0x007fffffffffffff
408#define SH_INT_CMPD_INIT 0x0000000000000000
409
410/* SH_INT_CMPD_REAL_TIME_CMPD */
411/* Description: Real Time Clock Compare */
412#define SH_INT_CMPD_REAL_TIME_CMPD_SHFT 0
413#define SH_INT_CMPD_REAL_TIME_CMPD_MASK 0x007fffffffffffff
414
415
416/* ==================================================================== */
417/* Some MMRs are functionally identical (or close enough) on both SHUB1 */
418/* and SHUB2 that it makes sense to define a geberic name for the MMR. */
419/* It is acceptible to use (for example) SH_IPI_INT to reference the */
420/* the IPI MMR. The value of SH_IPI_INT is determined at runtime based */
421/* on the type of the SHUB. Do not use these #defines in performance */
422/* critical code or loops - there is a small performance penalty. */
423/* ==================================================================== */
424#define shubmmr(a,b) (is_shub2() ? a##2_##b : a##1_##b)
425
426#define SH_REAL_JUNK_BUS_LED0 shubmmr(SH, REAL_JUNK_BUS_LED0)
427#define SH_IPI_INT shubmmr(SH, IPI_INT)
428#define SH_EVENT_OCCURRED shubmmr(SH, EVENT_OCCURRED)
429#define SH_EVENT_OCCURRED_ALIAS shubmmr(SH, EVENT_OCCURRED_ALIAS)
430#define SH_RTC shubmmr(SH, RTC)
431#define SH_RTC1_INT_CONFIG shubmmr(SH, RTC1_INT_CONFIG)
432#define SH_RTC1_INT_ENABLE shubmmr(SH, RTC1_INT_ENABLE)
433#define SH_RTC2_INT_CONFIG shubmmr(SH, RTC2_INT_CONFIG)
434#define SH_RTC2_INT_ENABLE shubmmr(SH, RTC2_INT_ENABLE)
435#define SH_RTC3_INT_CONFIG shubmmr(SH, RTC3_INT_CONFIG)
436#define SH_RTC3_INT_ENABLE shubmmr(SH, RTC3_INT_ENABLE)
437#define SH_INT_CMPB shubmmr(SH, INT_CMPB)
438#define SH_INT_CMPC shubmmr(SH, INT_CMPC)
439#define SH_INT_CMPD shubmmr(SH, INT_CMPD)
440
441#endif /* _ASM_IA64_SN_SHUB_MMR_H */
diff --git a/include/asm-ia64/sn/shubio.h b/include/asm-ia64/sn/shubio.h
new file mode 100644
index 000000000000..fbd880e6bb96
--- /dev/null
+++ b/include/asm-ia64/sn/shubio.h
@@ -0,0 +1,3476 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#ifndef _ASM_IA64_SN_SHUBIO_H
10#define _ASM_IA64_SN_SHUBIO_H
11
12#define HUB_WIDGET_ID_MAX 0xf
13#define IIO_NUM_ITTES 7
14#define HUB_NUM_BIG_WINDOW (IIO_NUM_ITTES - 1)
15
16#define IIO_WID 0x00400000 /* Crosstalk Widget Identification */
17 /* This register is also accessible from
18 * Crosstalk at address 0x0. */
19#define IIO_WSTAT 0x00400008 /* Crosstalk Widget Status */
20#define IIO_WCR 0x00400020 /* Crosstalk Widget Control Register */
21#define IIO_ILAPR 0x00400100 /* IO Local Access Protection Register */
22#define IIO_ILAPO 0x00400108 /* IO Local Access Protection Override */
23#define IIO_IOWA 0x00400110 /* IO Outbound Widget Access */
24#define IIO_IIWA 0x00400118 /* IO Inbound Widget Access */
25#define IIO_IIDEM 0x00400120 /* IO Inbound Device Error Mask */
26#define IIO_ILCSR 0x00400128 /* IO LLP Control and Status Register */
27#define IIO_ILLR 0x00400130 /* IO LLP Log Register */
28#define IIO_IIDSR 0x00400138 /* IO Interrupt Destination */
29
30#define IIO_IGFX0 0x00400140 /* IO Graphics Node-Widget Map 0 */
31#define IIO_IGFX1 0x00400148 /* IO Graphics Node-Widget Map 1 */
32
33#define IIO_ISCR0 0x00400150 /* IO Scratch Register 0 */
34#define IIO_ISCR1 0x00400158 /* IO Scratch Register 1 */
35
36#define IIO_ITTE1 0x00400160 /* IO Translation Table Entry 1 */
37#define IIO_ITTE2 0x00400168 /* IO Translation Table Entry 2 */
38#define IIO_ITTE3 0x00400170 /* IO Translation Table Entry 3 */
39#define IIO_ITTE4 0x00400178 /* IO Translation Table Entry 4 */
40#define IIO_ITTE5 0x00400180 /* IO Translation Table Entry 5 */
41#define IIO_ITTE6 0x00400188 /* IO Translation Table Entry 6 */
42#define IIO_ITTE7 0x00400190 /* IO Translation Table Entry 7 */
43
44#define IIO_IPRB0 0x00400198 /* IO PRB Entry 0 */
45#define IIO_IPRB8 0x004001A0 /* IO PRB Entry 8 */
46#define IIO_IPRB9 0x004001A8 /* IO PRB Entry 9 */
47#define IIO_IPRBA 0x004001B0 /* IO PRB Entry A */
48#define IIO_IPRBB 0x004001B8 /* IO PRB Entry B */
49#define IIO_IPRBC 0x004001C0 /* IO PRB Entry C */
50#define IIO_IPRBD 0x004001C8 /* IO PRB Entry D */
51#define IIO_IPRBE 0x004001D0 /* IO PRB Entry E */
52#define IIO_IPRBF 0x004001D8 /* IO PRB Entry F */
53
54#define IIO_IXCC 0x004001E0 /* IO Crosstalk Credit Count Timeout */
55#define IIO_IMEM 0x004001E8 /* IO Miscellaneous Error Mask */
56#define IIO_IXTT 0x004001F0 /* IO Crosstalk Timeout Threshold */
57#define IIO_IECLR 0x004001F8 /* IO Error Clear Register */
58#define IIO_IBCR 0x00400200 /* IO BTE Control Register */
59
60#define IIO_IXSM 0x00400208 /* IO Crosstalk Spurious Message */
61#define IIO_IXSS 0x00400210 /* IO Crosstalk Spurious Sideband */
62
63#define IIO_ILCT 0x00400218 /* IO LLP Channel Test */
64
65#define IIO_IIEPH1 0x00400220 /* IO Incoming Error Packet Header, Part 1 */
66#define IIO_IIEPH2 0x00400228 /* IO Incoming Error Packet Header, Part 2 */
67
68
69#define IIO_ISLAPR 0x00400230 /* IO SXB Local Access Protection Regster */
70#define IIO_ISLAPO 0x00400238 /* IO SXB Local Access Protection Override */
71
72#define IIO_IWI 0x00400240 /* IO Wrapper Interrupt Register */
73#define IIO_IWEL 0x00400248 /* IO Wrapper Error Log Register */
74#define IIO_IWC 0x00400250 /* IO Wrapper Control Register */
75#define IIO_IWS 0x00400258 /* IO Wrapper Status Register */
76#define IIO_IWEIM 0x00400260 /* IO Wrapper Error Interrupt Masking Register */
77
78#define IIO_IPCA 0x00400300 /* IO PRB Counter Adjust */
79
80#define IIO_IPRTE0_A 0x00400308 /* IO PIO Read Address Table Entry 0, Part A */
81#define IIO_IPRTE1_A 0x00400310 /* IO PIO Read Address Table Entry 1, Part A */
82#define IIO_IPRTE2_A 0x00400318 /* IO PIO Read Address Table Entry 2, Part A */
83#define IIO_IPRTE3_A 0x00400320 /* IO PIO Read Address Table Entry 3, Part A */
84#define IIO_IPRTE4_A 0x00400328 /* IO PIO Read Address Table Entry 4, Part A */
85#define IIO_IPRTE5_A 0x00400330 /* IO PIO Read Address Table Entry 5, Part A */
86#define IIO_IPRTE6_A 0x00400338 /* IO PIO Read Address Table Entry 6, Part A */
87#define IIO_IPRTE7_A 0x00400340 /* IO PIO Read Address Table Entry 7, Part A */
88
89#define IIO_IPRTE0_B 0x00400348 /* IO PIO Read Address Table Entry 0, Part B */
90#define IIO_IPRTE1_B 0x00400350 /* IO PIO Read Address Table Entry 1, Part B */
91#define IIO_IPRTE2_B 0x00400358 /* IO PIO Read Address Table Entry 2, Part B */
92#define IIO_IPRTE3_B 0x00400360 /* IO PIO Read Address Table Entry 3, Part B */
93#define IIO_IPRTE4_B 0x00400368 /* IO PIO Read Address Table Entry 4, Part B */
94#define IIO_IPRTE5_B 0x00400370 /* IO PIO Read Address Table Entry 5, Part B */
95#define IIO_IPRTE6_B 0x00400378 /* IO PIO Read Address Table Entry 6, Part B */
96#define IIO_IPRTE7_B 0x00400380 /* IO PIO Read Address Table Entry 7, Part B */
97
98#define IIO_IPDR 0x00400388 /* IO PIO Deallocation Register */
99#define IIO_ICDR 0x00400390 /* IO CRB Entry Deallocation Register */
100#define IIO_IFDR 0x00400398 /* IO IOQ FIFO Depth Register */
101#define IIO_IIAP 0x004003A0 /* IO IIQ Arbitration Parameters */
102#define IIO_ICMR 0x004003A8 /* IO CRB Management Register */
103#define IIO_ICCR 0x004003B0 /* IO CRB Control Register */
104#define IIO_ICTO 0x004003B8 /* IO CRB Timeout */
105#define IIO_ICTP 0x004003C0 /* IO CRB Timeout Prescalar */
106
107#define IIO_ICRB0_A 0x00400400 /* IO CRB Entry 0_A */
108#define IIO_ICRB0_B 0x00400408 /* IO CRB Entry 0_B */
109#define IIO_ICRB0_C 0x00400410 /* IO CRB Entry 0_C */
110#define IIO_ICRB0_D 0x00400418 /* IO CRB Entry 0_D */
111#define IIO_ICRB0_E 0x00400420 /* IO CRB Entry 0_E */
112
113#define IIO_ICRB1_A 0x00400430 /* IO CRB Entry 1_A */
114#define IIO_ICRB1_B 0x00400438 /* IO CRB Entry 1_B */
115#define IIO_ICRB1_C 0x00400440 /* IO CRB Entry 1_C */
116#define IIO_ICRB1_D 0x00400448 /* IO CRB Entry 1_D */
117#define IIO_ICRB1_E 0x00400450 /* IO CRB Entry 1_E */
118
119#define IIO_ICRB2_A 0x00400460 /* IO CRB Entry 2_A */
120#define IIO_ICRB2_B 0x00400468 /* IO CRB Entry 2_B */
121#define IIO_ICRB2_C 0x00400470 /* IO CRB Entry 2_C */
122#define IIO_ICRB2_D 0x00400478 /* IO CRB Entry 2_D */
123#define IIO_ICRB2_E 0x00400480 /* IO CRB Entry 2_E */
124
125#define IIO_ICRB3_A 0x00400490 /* IO CRB Entry 3_A */
126#define IIO_ICRB3_B 0x00400498 /* IO CRB Entry 3_B */
127#define IIO_ICRB3_C 0x004004a0 /* IO CRB Entry 3_C */
128#define IIO_ICRB3_D 0x004004a8 /* IO CRB Entry 3_D */
129#define IIO_ICRB3_E 0x004004b0 /* IO CRB Entry 3_E */
130
131#define IIO_ICRB4_A 0x004004c0 /* IO CRB Entry 4_A */
132#define IIO_ICRB4_B 0x004004c8 /* IO CRB Entry 4_B */
133#define IIO_ICRB4_C 0x004004d0 /* IO CRB Entry 4_C */
134#define IIO_ICRB4_D 0x004004d8 /* IO CRB Entry 4_D */
135#define IIO_ICRB4_E 0x004004e0 /* IO CRB Entry 4_E */
136
137#define IIO_ICRB5_A 0x004004f0 /* IO CRB Entry 5_A */
138#define IIO_ICRB5_B 0x004004f8 /* IO CRB Entry 5_B */
139#define IIO_ICRB5_C 0x00400500 /* IO CRB Entry 5_C */
140#define IIO_ICRB5_D 0x00400508 /* IO CRB Entry 5_D */
141#define IIO_ICRB5_E 0x00400510 /* IO CRB Entry 5_E */
142
143#define IIO_ICRB6_A 0x00400520 /* IO CRB Entry 6_A */
144#define IIO_ICRB6_B 0x00400528 /* IO CRB Entry 6_B */
145#define IIO_ICRB6_C 0x00400530 /* IO CRB Entry 6_C */
146#define IIO_ICRB6_D 0x00400538 /* IO CRB Entry 6_D */
147#define IIO_ICRB6_E 0x00400540 /* IO CRB Entry 6_E */
148
149#define IIO_ICRB7_A 0x00400550 /* IO CRB Entry 7_A */
150#define IIO_ICRB7_B 0x00400558 /* IO CRB Entry 7_B */
151#define IIO_ICRB7_C 0x00400560 /* IO CRB Entry 7_C */
152#define IIO_ICRB7_D 0x00400568 /* IO CRB Entry 7_D */
153#define IIO_ICRB7_E 0x00400570 /* IO CRB Entry 7_E */
154
155#define IIO_ICRB8_A 0x00400580 /* IO CRB Entry 8_A */
156#define IIO_ICRB8_B 0x00400588 /* IO CRB Entry 8_B */
157#define IIO_ICRB8_C 0x00400590 /* IO CRB Entry 8_C */
158#define IIO_ICRB8_D 0x00400598 /* IO CRB Entry 8_D */
159#define IIO_ICRB8_E 0x004005a0 /* IO CRB Entry 8_E */
160
161#define IIO_ICRB9_A 0x004005b0 /* IO CRB Entry 9_A */
162#define IIO_ICRB9_B 0x004005b8 /* IO CRB Entry 9_B */
163#define IIO_ICRB9_C 0x004005c0 /* IO CRB Entry 9_C */
164#define IIO_ICRB9_D 0x004005c8 /* IO CRB Entry 9_D */
165#define IIO_ICRB9_E 0x004005d0 /* IO CRB Entry 9_E */
166
167#define IIO_ICRBA_A 0x004005e0 /* IO CRB Entry A_A */
168#define IIO_ICRBA_B 0x004005e8 /* IO CRB Entry A_B */
169#define IIO_ICRBA_C 0x004005f0 /* IO CRB Entry A_C */
170#define IIO_ICRBA_D 0x004005f8 /* IO CRB Entry A_D */
171#define IIO_ICRBA_E 0x00400600 /* IO CRB Entry A_E */
172
173#define IIO_ICRBB_A 0x00400610 /* IO CRB Entry B_A */
174#define IIO_ICRBB_B 0x00400618 /* IO CRB Entry B_B */
175#define IIO_ICRBB_C 0x00400620 /* IO CRB Entry B_C */
176#define IIO_ICRBB_D 0x00400628 /* IO CRB Entry B_D */
177#define IIO_ICRBB_E 0x00400630 /* IO CRB Entry B_E */
178
179#define IIO_ICRBC_A 0x00400640 /* IO CRB Entry C_A */
180#define IIO_ICRBC_B 0x00400648 /* IO CRB Entry C_B */
181#define IIO_ICRBC_C 0x00400650 /* IO CRB Entry C_C */
182#define IIO_ICRBC_D 0x00400658 /* IO CRB Entry C_D */
183#define IIO_ICRBC_E 0x00400660 /* IO CRB Entry C_E */
184
185#define IIO_ICRBD_A 0x00400670 /* IO CRB Entry D_A */
186#define IIO_ICRBD_B 0x00400678 /* IO CRB Entry D_B */
187#define IIO_ICRBD_C 0x00400680 /* IO CRB Entry D_C */
188#define IIO_ICRBD_D 0x00400688 /* IO CRB Entry D_D */
189#define IIO_ICRBD_E 0x00400690 /* IO CRB Entry D_E */
190
191#define IIO_ICRBE_A 0x004006a0 /* IO CRB Entry E_A */
192#define IIO_ICRBE_B 0x004006a8 /* IO CRB Entry E_B */
193#define IIO_ICRBE_C 0x004006b0 /* IO CRB Entry E_C */
194#define IIO_ICRBE_D 0x004006b8 /* IO CRB Entry E_D */
195#define IIO_ICRBE_E 0x004006c0 /* IO CRB Entry E_E */
196
197#define IIO_ICSML 0x00400700 /* IO CRB Spurious Message Low */
198#define IIO_ICSMM 0x00400708 /* IO CRB Spurious Message Middle */
199#define IIO_ICSMH 0x00400710 /* IO CRB Spurious Message High */
200
201#define IIO_IDBSS 0x00400718 /* IO Debug Submenu Select */
202
203#define IIO_IBLS0 0x00410000 /* IO BTE Length Status 0 */
204#define IIO_IBSA0 0x00410008 /* IO BTE Source Address 0 */
205#define IIO_IBDA0 0x00410010 /* IO BTE Destination Address 0 */
206#define IIO_IBCT0 0x00410018 /* IO BTE Control Terminate 0 */
207#define IIO_IBNA0 0x00410020 /* IO BTE Notification Address 0 */
208#define IIO_IBIA0 0x00410028 /* IO BTE Interrupt Address 0 */
209#define IIO_IBLS1 0x00420000 /* IO BTE Length Status 1 */
210#define IIO_IBSA1 0x00420008 /* IO BTE Source Address 1 */
211#define IIO_IBDA1 0x00420010 /* IO BTE Destination Address 1 */
212#define IIO_IBCT1 0x00420018 /* IO BTE Control Terminate 1 */
213#define IIO_IBNA1 0x00420020 /* IO BTE Notification Address 1 */
214#define IIO_IBIA1 0x00420028 /* IO BTE Interrupt Address 1 */
215
216#define IIO_IPCR 0x00430000 /* IO Performance Control */
217#define IIO_IPPR 0x00430008 /* IO Performance Profiling */
218
219
220/************************************************************************
221 * *
222 * Description: This register echoes some information from the *
223 * LB_REV_ID register. It is available through Crosstalk as described *
224 * above. The REV_NUM and MFG_NUM fields receive their values from *
225 * the REVISION and MANUFACTURER fields in the LB_REV_ID register. *
226 * The PART_NUM field's value is the Crosstalk device ID number that *
227 * Steve Miller assigned to the SHub chip. *
228 * *
229 ************************************************************************/
230
231typedef union ii_wid_u {
232 uint64_t ii_wid_regval;
233 struct {
234 uint64_t w_rsvd_1 : 1;
235 uint64_t w_mfg_num : 11;
236 uint64_t w_part_num : 16;
237 uint64_t w_rev_num : 4;
238 uint64_t w_rsvd : 32;
239 } ii_wid_fld_s;
240} ii_wid_u_t;
241
242
243/************************************************************************
244 * *
245 * The fields in this register are set upon detection of an error *
246 * and cleared by various mechanisms, as explained in the *
247 * description. *
248 * *
249 ************************************************************************/
250
251typedef union ii_wstat_u {
252 uint64_t ii_wstat_regval;
253 struct {
254 uint64_t w_pending : 4;
255 uint64_t w_xt_crd_to : 1;
256 uint64_t w_xt_tail_to : 1;
257 uint64_t w_rsvd_3 : 3;
258 uint64_t w_tx_mx_rty : 1;
259 uint64_t w_rsvd_2 : 6;
260 uint64_t w_llp_tx_cnt : 8;
261 uint64_t w_rsvd_1 : 8;
262 uint64_t w_crazy : 1;
263 uint64_t w_rsvd : 31;
264 } ii_wstat_fld_s;
265} ii_wstat_u_t;
266
267
268/************************************************************************
269 * *
270 * Description: This is a read-write enabled register. It controls *
271 * various aspects of the Crosstalk flow control. *
272 * *
273 ************************************************************************/
274
275typedef union ii_wcr_u {
276 uint64_t ii_wcr_regval;
277 struct {
278 uint64_t w_wid : 4;
279 uint64_t w_tag : 1;
280 uint64_t w_rsvd_1 : 8;
281 uint64_t w_dst_crd : 3;
282 uint64_t w_f_bad_pkt : 1;
283 uint64_t w_dir_con : 1;
284 uint64_t w_e_thresh : 5;
285 uint64_t w_rsvd : 41;
286 } ii_wcr_fld_s;
287} ii_wcr_u_t;
288
289
290/************************************************************************
291 * *
292 * Description: This register's value is a bit vector that guards *
293 * access to local registers within the II as well as to external *
294 * Crosstalk widgets. Each bit in the register corresponds to a *
295 * particular region in the system; a region consists of one, two or *
296 * four nodes (depending on the value of the REGION_SIZE field in the *
297 * LB_REV_ID register, which is documented in Section 8.3.1.1). The *
298 * protection provided by this register applies to PIO read *
299 * operations as well as PIO write operations. The II will perform a *
300 * PIO read or write request only if the bit for the requestor's *
301 * region is set; otherwise, the II will not perform the requested *
302 * operation and will return an error response. When a PIO read or *
303 * write request targets an external Crosstalk widget, then not only *
304 * must the bit for the requestor's region be set in the ILAPR, but *
305 * also the target widget's bit in the IOWA register must be set in *
306 * order for the II to perform the requested operation; otherwise, *
307 * the II will return an error response. Hence, the protection *
308 * provided by the IOWA register supplements the protection provided *
309 * by the ILAPR for requests that target external Crosstalk widgets. *
310 * This register itself can be accessed only by the nodes whose *
311 * region ID bits are enabled in this same register. It can also be *
312 * accessed through the IAlias space by the local processors. *
313 * The reset value of this register allows access by all nodes. *
314 * *
315 ************************************************************************/
316
317typedef union ii_ilapr_u {
318 uint64_t ii_ilapr_regval;
319 struct {
320 uint64_t i_region : 64;
321 } ii_ilapr_fld_s;
322} ii_ilapr_u_t;
323
324
325
326
327/************************************************************************
328 * *
329 * Description: A write to this register of the 64-bit value *
330 * "SGIrules" in ASCII, will cause the bit in the ILAPR register *
331 * corresponding to the region of the requestor to be set (allow *
332 * access). A write of any other value will be ignored. Access *
333 * protection for this register is "SGIrules". *
334 * This register can also be accessed through the IAlias space. *
335 * However, this access will not change the access permissions in the *
336 * ILAPR. *
337 * *
338 ************************************************************************/
339
340typedef union ii_ilapo_u {
341 uint64_t ii_ilapo_regval;
342 struct {
343 uint64_t i_io_ovrride : 64;
344 } ii_ilapo_fld_s;
345} ii_ilapo_u_t;
346
347
348
349/************************************************************************
350 * *
351 * This register qualifies all the PIO and Graphics writes launched *
352 * from the SHUB towards a widget. *
353 * *
354 ************************************************************************/
355
356typedef union ii_iowa_u {
357 uint64_t ii_iowa_regval;
358 struct {
359 uint64_t i_w0_oac : 1;
360 uint64_t i_rsvd_1 : 7;
361 uint64_t i_wx_oac : 8;
362 uint64_t i_rsvd : 48;
363 } ii_iowa_fld_s;
364} ii_iowa_u_t;
365
366
367/************************************************************************
368 * *
369 * Description: This register qualifies all the requests launched *
370 * from a widget towards the Shub. This register is intended to be *
371 * used by software in case of misbehaving widgets. *
372 * *
373 * *
374 ************************************************************************/
375
376typedef union ii_iiwa_u {
377 uint64_t ii_iiwa_regval;
378 struct {
379 uint64_t i_w0_iac : 1;
380 uint64_t i_rsvd_1 : 7;
381 uint64_t i_wx_iac : 8;
382 uint64_t i_rsvd : 48;
383 } ii_iiwa_fld_s;
384} ii_iiwa_u_t;
385
386
387
388/************************************************************************
389 * *
390 * Description: This register qualifies all the operations launched *
391 * from a widget towards the SHub. It allows individual access *
392 * control for up to 8 devices per widget. A device refers to *
393 * individual DMA master hosted by a widget. *
394 * The bits in each field of this register are cleared by the Shub *
395 * upon detection of an error which requires the device to be *
396 * disabled. These fields assume that 0=TNUM=7 (i.e., Bridge-centric *
397 * Crosstalk). Whether or not a device has access rights to this *
398 * Shub is determined by an AND of the device enable bit in the *
399 * appropriate field of this register and the corresponding bit in *
400 * the Wx_IAC field (for the widget which this device belongs to). *
401 * The bits in this field are set by writing a 1 to them. Incoming *
402 * replies from Crosstalk are not subject to this access control *
403 * mechanism. *
404 * *
405 ************************************************************************/
406
407typedef union ii_iidem_u {
408 uint64_t ii_iidem_regval;
409 struct {
410 uint64_t i_w8_dxs : 8;
411 uint64_t i_w9_dxs : 8;
412 uint64_t i_wa_dxs : 8;
413 uint64_t i_wb_dxs : 8;
414 uint64_t i_wc_dxs : 8;
415 uint64_t i_wd_dxs : 8;
416 uint64_t i_we_dxs : 8;
417 uint64_t i_wf_dxs : 8;
418 } ii_iidem_fld_s;
419} ii_iidem_u_t;
420
421
422/************************************************************************
423 * *
424 * This register contains the various programmable fields necessary *
425 * for controlling and observing the LLP signals. *
426 * *
427 ************************************************************************/
428
429typedef union ii_ilcsr_u {
430 uint64_t ii_ilcsr_regval;
431 struct {
432 uint64_t i_nullto : 6;
433 uint64_t i_rsvd_4 : 2;
434 uint64_t i_wrmrst : 1;
435 uint64_t i_rsvd_3 : 1;
436 uint64_t i_llp_en : 1;
437 uint64_t i_bm8 : 1;
438 uint64_t i_llp_stat : 2;
439 uint64_t i_remote_power : 1;
440 uint64_t i_rsvd_2 : 1;
441 uint64_t i_maxrtry : 10;
442 uint64_t i_d_avail_sel : 2;
443 uint64_t i_rsvd_1 : 4;
444 uint64_t i_maxbrst : 10;
445 uint64_t i_rsvd : 22;
446
447 } ii_ilcsr_fld_s;
448} ii_ilcsr_u_t;
449
450
451/************************************************************************
452 * *
453 * This is simply a status registers that monitors the LLP error *
454 * rate. *
455 * *
456 ************************************************************************/
457
458typedef union ii_illr_u {
459 uint64_t ii_illr_regval;
460 struct {
461 uint64_t i_sn_cnt : 16;
462 uint64_t i_cb_cnt : 16;
463 uint64_t i_rsvd : 32;
464 } ii_illr_fld_s;
465} ii_illr_u_t;
466
467
468/************************************************************************
469 * *
470 * Description: All II-detected non-BTE error interrupts are *
471 * specified via this register. *
472 * NOTE: The PI interrupt register address is hardcoded in the II. If *
473 * PI_ID==0, then the II sends an interrupt request (Duplonet PWRI *
474 * packet) to address offset 0x0180_0090 within the local register *
475 * address space of PI0 on the node specified by the NODE field. If *
476 * PI_ID==1, then the II sends the interrupt request to address *
477 * offset 0x01A0_0090 within the local register address space of PI1 *
478 * on the node specified by the NODE field. *
479 * *
480 ************************************************************************/
481
482typedef union ii_iidsr_u {
483 uint64_t ii_iidsr_regval;
484 struct {
485 uint64_t i_level : 8;
486 uint64_t i_pi_id : 1;
487 uint64_t i_node : 11;
488 uint64_t i_rsvd_3 : 4;
489 uint64_t i_enable : 1;
490 uint64_t i_rsvd_2 : 3;
491 uint64_t i_int_sent : 2;
492 uint64_t i_rsvd_1 : 2;
493 uint64_t i_pi0_forward_int : 1;
494 uint64_t i_pi1_forward_int : 1;
495 uint64_t i_rsvd : 30;
496 } ii_iidsr_fld_s;
497} ii_iidsr_u_t;
498
499
500
501/************************************************************************
502 * *
503 * There are two instances of this register. This register is used *
504 * for matching up the incoming responses from the graphics widget to *
505 * the processor that initiated the graphics operation. The *
506 * write-responses are converted to graphics credits and returned to *
507 * the processor so that the processor interface can manage the flow *
508 * control. *
509 * *
510 ************************************************************************/
511
512typedef union ii_igfx0_u {
513 uint64_t ii_igfx0_regval;
514 struct {
515 uint64_t i_w_num : 4;
516 uint64_t i_pi_id : 1;
517 uint64_t i_n_num : 12;
518 uint64_t i_p_num : 1;
519 uint64_t i_rsvd : 46;
520 } ii_igfx0_fld_s;
521} ii_igfx0_u_t;
522
523
524/************************************************************************
525 * *
526 * There are two instances of this register. This register is used *
527 * for matching up the incoming responses from the graphics widget to *
528 * the processor that initiated the graphics operation. The *
529 * write-responses are converted to graphics credits and returned to *
530 * the processor so that the processor interface can manage the flow *
531 * control. *
532 * *
533 ************************************************************************/
534
535typedef union ii_igfx1_u {
536 uint64_t ii_igfx1_regval;
537 struct {
538 uint64_t i_w_num : 4;
539 uint64_t i_pi_id : 1;
540 uint64_t i_n_num : 12;
541 uint64_t i_p_num : 1;
542 uint64_t i_rsvd : 46;
543 } ii_igfx1_fld_s;
544} ii_igfx1_u_t;
545
546
547/************************************************************************
548 * *
549 * There are two instances of this registers. These registers are *
550 * used as scratch registers for software use. *
551 * *
552 ************************************************************************/
553
554typedef union ii_iscr0_u {
555 uint64_t ii_iscr0_regval;
556 struct {
557 uint64_t i_scratch : 64;
558 } ii_iscr0_fld_s;
559} ii_iscr0_u_t;
560
561
562
563/************************************************************************
564 * *
565 * There are two instances of this registers. These registers are *
566 * used as scratch registers for software use. *
567 * *
568 ************************************************************************/
569
570typedef union ii_iscr1_u {
571 uint64_t ii_iscr1_regval;
572 struct {
573 uint64_t i_scratch : 64;
574 } ii_iscr1_fld_s;
575} ii_iscr1_u_t;
576
577
578/************************************************************************
579 * *
580 * Description: There are seven instances of translation table entry *
581 * registers. Each register maps a Shub Big Window to a 48-bit *
582 * address on Crosstalk. *
583 * For M-mode (128 nodes, 8 GBytes/node), SysAD[31:29] (Big Window *
584 * number) are used to select one of these 7 registers. The Widget *
585 * number field is then derived from the W_NUM field for synthesizing *
586 * a Crosstalk packet. The 5 bits of OFFSET are concatenated with *
587 * SysAD[28:0] to form Crosstalk[33:0]. The upper Crosstalk[47:34] *
588 * are padded with zeros. Although the maximum Crosstalk space *
589 * addressable by the SHub is thus the lower 16 GBytes per widget *
590 * (M-mode), however only <SUP >7</SUP>/<SUB >32nds</SUB> of this *
591 * space can be accessed. *
592 * For the N-mode (256 nodes, 4 GBytes/node), SysAD[30:28] (Big *
593 * Window number) are used to select one of these 7 registers. The *
594 * Widget number field is then derived from the W_NUM field for *
595 * synthesizing a Crosstalk packet. The 5 bits of OFFSET are *
596 * concatenated with SysAD[27:0] to form Crosstalk[33:0]. The IOSP *
597 * field is used as Crosstalk[47], and remainder of the Crosstalk *
598 * address bits (Crosstalk[46:34]) are always zero. While the maximum *
599 * Crosstalk space addressable by the Shub is thus the lower *
600 * 8-GBytes per widget (N-mode), only <SUP >7</SUP>/<SUB >32nds</SUB> *
601 * of this space can be accessed. *
602 * *
603 ************************************************************************/
604
605typedef union ii_itte1_u {
606 uint64_t ii_itte1_regval;
607 struct {
608 uint64_t i_offset : 5;
609 uint64_t i_rsvd_1 : 3;
610 uint64_t i_w_num : 4;
611 uint64_t i_iosp : 1;
612 uint64_t i_rsvd : 51;
613 } ii_itte1_fld_s;
614} ii_itte1_u_t;
615
616
617/************************************************************************
618 * *
619 * Description: There are seven instances of translation table entry *
620 * registers. Each register maps a Shub Big Window to a 48-bit *
621 * address on Crosstalk. *
622 * For M-mode (128 nodes, 8 GBytes/node), SysAD[31:29] (Big Window *
623 * number) are used to select one of these 7 registers. The Widget *
624 * number field is then derived from the W_NUM field for synthesizing *
625 * a Crosstalk packet. The 5 bits of OFFSET are concatenated with *
626 * SysAD[28:0] to form Crosstalk[33:0]. The upper Crosstalk[47:34] *
627 * are padded with zeros. Although the maximum Crosstalk space *
628 * addressable by the Shub is thus the lower 16 GBytes per widget *
629 * (M-mode), however only <SUP >7</SUP>/<SUB >32nds</SUB> of this *
630 * space can be accessed. *
631 * For the N-mode (256 nodes, 4 GBytes/node), SysAD[30:28] (Big *
632 * Window number) are used to select one of these 7 registers. The *
633 * Widget number field is then derived from the W_NUM field for *
634 * synthesizing a Crosstalk packet. The 5 bits of OFFSET are *
635 * concatenated with SysAD[27:0] to form Crosstalk[33:0]. The IOSP *
636 * field is used as Crosstalk[47], and remainder of the Crosstalk *
637 * address bits (Crosstalk[46:34]) are always zero. While the maximum *
638 * Crosstalk space addressable by the Shub is thus the lower *
639 * 8-GBytes per widget (N-mode), only <SUP >7</SUP>/<SUB >32nds</SUB> *
640 * of this space can be accessed. *
641 * *
642 ************************************************************************/
643
644typedef union ii_itte2_u {
645 uint64_t ii_itte2_regval;
646 struct {
647 uint64_t i_offset : 5;
648 uint64_t i_rsvd_1 : 3;
649 uint64_t i_w_num : 4;
650 uint64_t i_iosp : 1;
651 uint64_t i_rsvd : 51;
652 } ii_itte2_fld_s;
653} ii_itte2_u_t;
654
655
656/************************************************************************
657 * *
658 * Description: There are seven instances of translation table entry *
659 * registers. Each register maps a Shub Big Window to a 48-bit *
660 * address on Crosstalk. *
661 * For M-mode (128 nodes, 8 GBytes/node), SysAD[31:29] (Big Window *
662 * number) are used to select one of these 7 registers. The Widget *
663 * number field is then derived from the W_NUM field for synthesizing *
664 * a Crosstalk packet. The 5 bits of OFFSET are concatenated with *
665 * SysAD[28:0] to form Crosstalk[33:0]. The upper Crosstalk[47:34] *
666 * are padded with zeros. Although the maximum Crosstalk space *
667 * addressable by the Shub is thus the lower 16 GBytes per widget *
668 * (M-mode), however only <SUP >7</SUP>/<SUB >32nds</SUB> of this *
669 * space can be accessed. *
670 * For the N-mode (256 nodes, 4 GBytes/node), SysAD[30:28] (Big *
671 * Window number) are used to select one of these 7 registers. The *
672 * Widget number field is then derived from the W_NUM field for *
673 * synthesizing a Crosstalk packet. The 5 bits of OFFSET are *
674 * concatenated with SysAD[27:0] to form Crosstalk[33:0]. The IOSP *
675 * field is used as Crosstalk[47], and remainder of the Crosstalk *
676 * address bits (Crosstalk[46:34]) are always zero. While the maximum *
677 * Crosstalk space addressable by the SHub is thus the lower *
678 * 8-GBytes per widget (N-mode), only <SUP >7</SUP>/<SUB >32nds</SUB> *
679 * of this space can be accessed. *
680 * *
681 ************************************************************************/
682
683typedef union ii_itte3_u {
684 uint64_t ii_itte3_regval;
685 struct {
686 uint64_t i_offset : 5;
687 uint64_t i_rsvd_1 : 3;
688 uint64_t i_w_num : 4;
689 uint64_t i_iosp : 1;
690 uint64_t i_rsvd : 51;
691 } ii_itte3_fld_s;
692} ii_itte3_u_t;
693
694
695/************************************************************************
696 * *
697 * Description: There are seven instances of translation table entry *
698 * registers. Each register maps a SHub Big Window to a 48-bit *
699 * address on Crosstalk. *
700 * For M-mode (128 nodes, 8 GBytes/node), SysAD[31:29] (Big Window *
701 * number) are used to select one of these 7 registers. The Widget *
702 * number field is then derived from the W_NUM field for synthesizing *
703 * a Crosstalk packet. The 5 bits of OFFSET are concatenated with *
704 * SysAD[28:0] to form Crosstalk[33:0]. The upper Crosstalk[47:34] *
705 * are padded with zeros. Although the maximum Crosstalk space *
706 * addressable by the SHub is thus the lower 16 GBytes per widget *
707 * (M-mode), however only <SUP >7</SUP>/<SUB >32nds</SUB> of this *
708 * space can be accessed. *
709 * For the N-mode (256 nodes, 4 GBytes/node), SysAD[30:28] (Big *
710 * Window number) are used to select one of these 7 registers. The *
711 * Widget number field is then derived from the W_NUM field for *
712 * synthesizing a Crosstalk packet. The 5 bits of OFFSET are *
713 * concatenated with SysAD[27:0] to form Crosstalk[33:0]. The IOSP *
714 * field is used as Crosstalk[47], and remainder of the Crosstalk *
715 * address bits (Crosstalk[46:34]) are always zero. While the maximum *
716 * Crosstalk space addressable by the SHub is thus the lower *
717 * 8-GBytes per widget (N-mode), only <SUP >7</SUP>/<SUB >32nds</SUB> *
718 * of this space can be accessed. *
719 * *
720 ************************************************************************/
721
722typedef union ii_itte4_u {
723 uint64_t ii_itte4_regval;
724 struct {
725 uint64_t i_offset : 5;
726 uint64_t i_rsvd_1 : 3;
727 uint64_t i_w_num : 4;
728 uint64_t i_iosp : 1;
729 uint64_t i_rsvd : 51;
730 } ii_itte4_fld_s;
731} ii_itte4_u_t;
732
733
734/************************************************************************
735 * *
736 * Description: There are seven instances of translation table entry *
737 * registers. Each register maps a SHub Big Window to a 48-bit *
738 * address on Crosstalk. *
739 * For M-mode (128 nodes, 8 GBytes/node), SysAD[31:29] (Big Window *
740 * number) are used to select one of these 7 registers. The Widget *
741 * number field is then derived from the W_NUM field for synthesizing *
742 * a Crosstalk packet. The 5 bits of OFFSET are concatenated with *
743 * SysAD[28:0] to form Crosstalk[33:0]. The upper Crosstalk[47:34] *
744 * are padded with zeros. Although the maximum Crosstalk space *
745 * addressable by the Shub is thus the lower 16 GBytes per widget *
746 * (M-mode), however only <SUP >7</SUP>/<SUB >32nds</SUB> of this *
747 * space can be accessed. *
748 * For the N-mode (256 nodes, 4 GBytes/node), SysAD[30:28] (Big *
749 * Window number) are used to select one of these 7 registers. The *
750 * Widget number field is then derived from the W_NUM field for *
751 * synthesizing a Crosstalk packet. The 5 bits of OFFSET are *
752 * concatenated with SysAD[27:0] to form Crosstalk[33:0]. The IOSP *
753 * field is used as Crosstalk[47], and remainder of the Crosstalk *
754 * address bits (Crosstalk[46:34]) are always zero. While the maximum *
755 * Crosstalk space addressable by the Shub is thus the lower *
756 * 8-GBytes per widget (N-mode), only <SUP >7</SUP>/<SUB >32nds</SUB> *
757 * of this space can be accessed. *
758 * *
759 ************************************************************************/
760
761typedef union ii_itte5_u {
762 uint64_t ii_itte5_regval;
763 struct {
764 uint64_t i_offset : 5;
765 uint64_t i_rsvd_1 : 3;
766 uint64_t i_w_num : 4;
767 uint64_t i_iosp : 1;
768 uint64_t i_rsvd : 51;
769 } ii_itte5_fld_s;
770} ii_itte5_u_t;
771
772
773/************************************************************************
774 * *
775 * Description: There are seven instances of translation table entry *
776 * registers. Each register maps a Shub Big Window to a 48-bit *
777 * address on Crosstalk. *
778 * For M-mode (128 nodes, 8 GBytes/node), SysAD[31:29] (Big Window *
779 * number) are used to select one of these 7 registers. The Widget *
780 * number field is then derived from the W_NUM field for synthesizing *
781 * a Crosstalk packet. The 5 bits of OFFSET are concatenated with *
782 * SysAD[28:0] to form Crosstalk[33:0]. The upper Crosstalk[47:34] *
783 * are padded with zeros. Although the maximum Crosstalk space *
784 * addressable by the Shub is thus the lower 16 GBytes per widget *
785 * (M-mode), however only <SUP >7</SUP>/<SUB >32nds</SUB> of this *
786 * space can be accessed. *
787 * For the N-mode (256 nodes, 4 GBytes/node), SysAD[30:28] (Big *
788 * Window number) are used to select one of these 7 registers. The *
789 * Widget number field is then derived from the W_NUM field for *
790 * synthesizing a Crosstalk packet. The 5 bits of OFFSET are *
791 * concatenated with SysAD[27:0] to form Crosstalk[33:0]. The IOSP *
792 * field is used as Crosstalk[47], and remainder of the Crosstalk *
793 * address bits (Crosstalk[46:34]) are always zero. While the maximum *
794 * Crosstalk space addressable by the Shub is thus the lower *
795 * 8-GBytes per widget (N-mode), only <SUP >7</SUP>/<SUB >32nds</SUB> *
796 * of this space can be accessed. *
797 * *
798 ************************************************************************/
799
800typedef union ii_itte6_u {
801 uint64_t ii_itte6_regval;
802 struct {
803 uint64_t i_offset : 5;
804 uint64_t i_rsvd_1 : 3;
805 uint64_t i_w_num : 4;
806 uint64_t i_iosp : 1;
807 uint64_t i_rsvd : 51;
808 } ii_itte6_fld_s;
809} ii_itte6_u_t;
810
811
812/************************************************************************
813 * *
814 * Description: There are seven instances of translation table entry *
815 * registers. Each register maps a Shub Big Window to a 48-bit *
816 * address on Crosstalk. *
817 * For M-mode (128 nodes, 8 GBytes/node), SysAD[31:29] (Big Window *
818 * number) are used to select one of these 7 registers. The Widget *
819 * number field is then derived from the W_NUM field for synthesizing *
820 * a Crosstalk packet. The 5 bits of OFFSET are concatenated with *
821 * SysAD[28:0] to form Crosstalk[33:0]. The upper Crosstalk[47:34] *
822 * are padded with zeros. Although the maximum Crosstalk space *
823 * addressable by the Shub is thus the lower 16 GBytes per widget *
824 * (M-mode), however only <SUP >7</SUP>/<SUB >32nds</SUB> of this *
825 * space can be accessed. *
826 * For the N-mode (256 nodes, 4 GBytes/node), SysAD[30:28] (Big *
827 * Window number) are used to select one of these 7 registers. The *
828 * Widget number field is then derived from the W_NUM field for *
829 * synthesizing a Crosstalk packet. The 5 bits of OFFSET are *
830 * concatenated with SysAD[27:0] to form Crosstalk[33:0]. The IOSP *
831 * field is used as Crosstalk[47], and remainder of the Crosstalk *
832 * address bits (Crosstalk[46:34]) are always zero. While the maximum *
833 * Crosstalk space addressable by the SHub is thus the lower *
834 * 8-GBytes per widget (N-mode), only <SUP >7</SUP>/<SUB >32nds</SUB> *
835 * of this space can be accessed. *
836 * *
837 ************************************************************************/
838
839typedef union ii_itte7_u {
840 uint64_t ii_itte7_regval;
841 struct {
842 uint64_t i_offset : 5;
843 uint64_t i_rsvd_1 : 3;
844 uint64_t i_w_num : 4;
845 uint64_t i_iosp : 1;
846 uint64_t i_rsvd : 51;
847 } ii_itte7_fld_s;
848} ii_itte7_u_t;
849
850
851/************************************************************************
852 * *
853 * Description: There are 9 instances of this register, one per *
854 * actual widget in this implementation of SHub and Crossbow. *
855 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
856 * refers to Crossbow's internal space. *
857 * This register contains the state elements per widget that are *
858 * necessary to manage the PIO flow control on Crosstalk and on the *
859 * Router Network. See the PIO Flow Control chapter for a complete *
860 * description of this register *
861 * The SPUR_WR bit requires some explanation. When this register is *
862 * written, the new value of the C field is captured in an internal *
863 * register so the hardware can remember what the programmer wrote *
864 * into the credit counter. The SPUR_WR bit sets whenever the C field *
865 * increments above this stored value, which indicates that there *
866 * have been more responses received than requests sent. The SPUR_WR *
867 * bit cannot be cleared until a value is written to the IPRBx *
868 * register; the write will correct the C field and capture its new *
869 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
870 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
871 * . *
872 * *
873 ************************************************************************/
874
875typedef union ii_iprb0_u {
876 uint64_t ii_iprb0_regval;
877 struct {
878 uint64_t i_c : 8;
879 uint64_t i_na : 14;
880 uint64_t i_rsvd_2 : 2;
881 uint64_t i_nb : 14;
882 uint64_t i_rsvd_1 : 2;
883 uint64_t i_m : 2;
884 uint64_t i_f : 1;
885 uint64_t i_of_cnt : 5;
886 uint64_t i_error : 1;
887 uint64_t i_rd_to : 1;
888 uint64_t i_spur_wr : 1;
889 uint64_t i_spur_rd : 1;
890 uint64_t i_rsvd : 11;
891 uint64_t i_mult_err : 1;
892 } ii_iprb0_fld_s;
893} ii_iprb0_u_t;
894
895
896/************************************************************************
897 * *
898 * Description: There are 9 instances of this register, one per *
899 * actual widget in this implementation of SHub and Crossbow. *
900 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
901 * refers to Crossbow's internal space. *
902 * This register contains the state elements per widget that are *
903 * necessary to manage the PIO flow control on Crosstalk and on the *
904 * Router Network. See the PIO Flow Control chapter for a complete *
905 * description of this register *
906 * The SPUR_WR bit requires some explanation. When this register is *
907 * written, the new value of the C field is captured in an internal *
908 * register so the hardware can remember what the programmer wrote *
909 * into the credit counter. The SPUR_WR bit sets whenever the C field *
910 * increments above this stored value, which indicates that there *
911 * have been more responses received than requests sent. The SPUR_WR *
912 * bit cannot be cleared until a value is written to the IPRBx *
913 * register; the write will correct the C field and capture its new *
914 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
915 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
916 * . *
917 * *
918 ************************************************************************/
919
920typedef union ii_iprb8_u {
921 uint64_t ii_iprb8_regval;
922 struct {
923 uint64_t i_c : 8;
924 uint64_t i_na : 14;
925 uint64_t i_rsvd_2 : 2;
926 uint64_t i_nb : 14;
927 uint64_t i_rsvd_1 : 2;
928 uint64_t i_m : 2;
929 uint64_t i_f : 1;
930 uint64_t i_of_cnt : 5;
931 uint64_t i_error : 1;
932 uint64_t i_rd_to : 1;
933 uint64_t i_spur_wr : 1;
934 uint64_t i_spur_rd : 1;
935 uint64_t i_rsvd : 11;
936 uint64_t i_mult_err : 1;
937 } ii_iprb8_fld_s;
938} ii_iprb8_u_t;
939
940
941/************************************************************************
942 * *
943 * Description: There are 9 instances of this register, one per *
944 * actual widget in this implementation of SHub and Crossbow. *
945 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
946 * refers to Crossbow's internal space. *
947 * This register contains the state elements per widget that are *
948 * necessary to manage the PIO flow control on Crosstalk and on the *
949 * Router Network. See the PIO Flow Control chapter for a complete *
950 * description of this register *
951 * The SPUR_WR bit requires some explanation. When this register is *
952 * written, the new value of the C field is captured in an internal *
953 * register so the hardware can remember what the programmer wrote *
954 * into the credit counter. The SPUR_WR bit sets whenever the C field *
955 * increments above this stored value, which indicates that there *
956 * have been more responses received than requests sent. The SPUR_WR *
957 * bit cannot be cleared until a value is written to the IPRBx *
958 * register; the write will correct the C field and capture its new *
959 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
960 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
961 * . *
962 * *
963 ************************************************************************/
964
965typedef union ii_iprb9_u {
966 uint64_t ii_iprb9_regval;
967 struct {
968 uint64_t i_c : 8;
969 uint64_t i_na : 14;
970 uint64_t i_rsvd_2 : 2;
971 uint64_t i_nb : 14;
972 uint64_t i_rsvd_1 : 2;
973 uint64_t i_m : 2;
974 uint64_t i_f : 1;
975 uint64_t i_of_cnt : 5;
976 uint64_t i_error : 1;
977 uint64_t i_rd_to : 1;
978 uint64_t i_spur_wr : 1;
979 uint64_t i_spur_rd : 1;
980 uint64_t i_rsvd : 11;
981 uint64_t i_mult_err : 1;
982 } ii_iprb9_fld_s;
983} ii_iprb9_u_t;
984
985
986/************************************************************************
987 * *
988 * Description: There are 9 instances of this register, one per *
989 * actual widget in this implementation of SHub and Crossbow. *
990 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
991 * refers to Crossbow's internal space. *
992 * This register contains the state elements per widget that are *
993 * necessary to manage the PIO flow control on Crosstalk and on the *
994 * Router Network. See the PIO Flow Control chapter for a complete *
995 * description of this register *
996 * The SPUR_WR bit requires some explanation. When this register is *
997 * written, the new value of the C field is captured in an internal *
998 * register so the hardware can remember what the programmer wrote *
999 * into the credit counter. The SPUR_WR bit sets whenever the C field *
1000 * increments above this stored value, which indicates that there *
1001 * have been more responses received than requests sent. The SPUR_WR *
1002 * bit cannot be cleared until a value is written to the IPRBx *
1003 * register; the write will correct the C field and capture its new *
1004 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
1005 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
1006 * *
1007 * *
1008 ************************************************************************/
1009
1010typedef union ii_iprba_u {
1011 uint64_t ii_iprba_regval;
1012 struct {
1013 uint64_t i_c : 8;
1014 uint64_t i_na : 14;
1015 uint64_t i_rsvd_2 : 2;
1016 uint64_t i_nb : 14;
1017 uint64_t i_rsvd_1 : 2;
1018 uint64_t i_m : 2;
1019 uint64_t i_f : 1;
1020 uint64_t i_of_cnt : 5;
1021 uint64_t i_error : 1;
1022 uint64_t i_rd_to : 1;
1023 uint64_t i_spur_wr : 1;
1024 uint64_t i_spur_rd : 1;
1025 uint64_t i_rsvd : 11;
1026 uint64_t i_mult_err : 1;
1027 } ii_iprba_fld_s;
1028} ii_iprba_u_t;
1029
1030
1031/************************************************************************
1032 * *
1033 * Description: There are 9 instances of this register, one per *
1034 * actual widget in this implementation of SHub and Crossbow. *
1035 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
1036 * refers to Crossbow's internal space. *
1037 * This register contains the state elements per widget that are *
1038 * necessary to manage the PIO flow control on Crosstalk and on the *
1039 * Router Network. See the PIO Flow Control chapter for a complete *
1040 * description of this register *
1041 * The SPUR_WR bit requires some explanation. When this register is *
1042 * written, the new value of the C field is captured in an internal *
1043 * register so the hardware can remember what the programmer wrote *
1044 * into the credit counter. The SPUR_WR bit sets whenever the C field *
1045 * increments above this stored value, which indicates that there *
1046 * have been more responses received than requests sent. The SPUR_WR *
1047 * bit cannot be cleared until a value is written to the IPRBx *
1048 * register; the write will correct the C field and capture its new *
1049 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
1050 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
1051 * . *
1052 * *
1053 ************************************************************************/
1054
1055typedef union ii_iprbb_u {
1056 uint64_t ii_iprbb_regval;
1057 struct {
1058 uint64_t i_c : 8;
1059 uint64_t i_na : 14;
1060 uint64_t i_rsvd_2 : 2;
1061 uint64_t i_nb : 14;
1062 uint64_t i_rsvd_1 : 2;
1063 uint64_t i_m : 2;
1064 uint64_t i_f : 1;
1065 uint64_t i_of_cnt : 5;
1066 uint64_t i_error : 1;
1067 uint64_t i_rd_to : 1;
1068 uint64_t i_spur_wr : 1;
1069 uint64_t i_spur_rd : 1;
1070 uint64_t i_rsvd : 11;
1071 uint64_t i_mult_err : 1;
1072 } ii_iprbb_fld_s;
1073} ii_iprbb_u_t;
1074
1075
1076/************************************************************************
1077 * *
1078 * Description: There are 9 instances of this register, one per *
1079 * actual widget in this implementation of SHub and Crossbow. *
1080 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
1081 * refers to Crossbow's internal space. *
1082 * This register contains the state elements per widget that are *
1083 * necessary to manage the PIO flow control on Crosstalk and on the *
1084 * Router Network. See the PIO Flow Control chapter for a complete *
1085 * description of this register *
1086 * The SPUR_WR bit requires some explanation. When this register is *
1087 * written, the new value of the C field is captured in an internal *
1088 * register so the hardware can remember what the programmer wrote *
1089 * into the credit counter. The SPUR_WR bit sets whenever the C field *
1090 * increments above this stored value, which indicates that there *
1091 * have been more responses received than requests sent. The SPUR_WR *
1092 * bit cannot be cleared until a value is written to the IPRBx *
1093 * register; the write will correct the C field and capture its new *
1094 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
1095 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
1096 * . *
1097 * *
1098 ************************************************************************/
1099
1100typedef union ii_iprbc_u {
1101 uint64_t ii_iprbc_regval;
1102 struct {
1103 uint64_t i_c : 8;
1104 uint64_t i_na : 14;
1105 uint64_t i_rsvd_2 : 2;
1106 uint64_t i_nb : 14;
1107 uint64_t i_rsvd_1 : 2;
1108 uint64_t i_m : 2;
1109 uint64_t i_f : 1;
1110 uint64_t i_of_cnt : 5;
1111 uint64_t i_error : 1;
1112 uint64_t i_rd_to : 1;
1113 uint64_t i_spur_wr : 1;
1114 uint64_t i_spur_rd : 1;
1115 uint64_t i_rsvd : 11;
1116 uint64_t i_mult_err : 1;
1117 } ii_iprbc_fld_s;
1118} ii_iprbc_u_t;
1119
1120
1121/************************************************************************
1122 * *
1123 * Description: There are 9 instances of this register, one per *
1124 * actual widget in this implementation of SHub and Crossbow. *
1125 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
1126 * refers to Crossbow's internal space. *
1127 * This register contains the state elements per widget that are *
1128 * necessary to manage the PIO flow control on Crosstalk and on the *
1129 * Router Network. See the PIO Flow Control chapter for a complete *
1130 * description of this register *
1131 * The SPUR_WR bit requires some explanation. When this register is *
1132 * written, the new value of the C field is captured in an internal *
1133 * register so the hardware can remember what the programmer wrote *
1134 * into the credit counter. The SPUR_WR bit sets whenever the C field *
1135 * increments above this stored value, which indicates that there *
1136 * have been more responses received than requests sent. The SPUR_WR *
1137 * bit cannot be cleared until a value is written to the IPRBx *
1138 * register; the write will correct the C field and capture its new *
1139 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
1140 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
1141 * . *
1142 * *
1143 ************************************************************************/
1144
1145typedef union ii_iprbd_u {
1146 uint64_t ii_iprbd_regval;
1147 struct {
1148 uint64_t i_c : 8;
1149 uint64_t i_na : 14;
1150 uint64_t i_rsvd_2 : 2;
1151 uint64_t i_nb : 14;
1152 uint64_t i_rsvd_1 : 2;
1153 uint64_t i_m : 2;
1154 uint64_t i_f : 1;
1155 uint64_t i_of_cnt : 5;
1156 uint64_t i_error : 1;
1157 uint64_t i_rd_to : 1;
1158 uint64_t i_spur_wr : 1;
1159 uint64_t i_spur_rd : 1;
1160 uint64_t i_rsvd : 11;
1161 uint64_t i_mult_err : 1;
1162 } ii_iprbd_fld_s;
1163} ii_iprbd_u_t;
1164
1165
1166/************************************************************************
1167 * *
1168 * Description: There are 9 instances of this register, one per *
1169 * actual widget in this implementation of SHub and Crossbow. *
1170 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
1171 * refers to Crossbow's internal space. *
1172 * This register contains the state elements per widget that are *
1173 * necessary to manage the PIO flow control on Crosstalk and on the *
1174 * Router Network. See the PIO Flow Control chapter for a complete *
1175 * description of this register *
1176 * The SPUR_WR bit requires some explanation. When this register is *
1177 * written, the new value of the C field is captured in an internal *
1178 * register so the hardware can remember what the programmer wrote *
1179 * into the credit counter. The SPUR_WR bit sets whenever the C field *
1180 * increments above this stored value, which indicates that there *
1181 * have been more responses received than requests sent. The SPUR_WR *
1182 * bit cannot be cleared until a value is written to the IPRBx *
1183 * register; the write will correct the C field and capture its new *
1184 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
1185 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
1186 * . *
1187 * *
1188 ************************************************************************/
1189
1190typedef union ii_iprbe_u {
1191 uint64_t ii_iprbe_regval;
1192 struct {
1193 uint64_t i_c : 8;
1194 uint64_t i_na : 14;
1195 uint64_t i_rsvd_2 : 2;
1196 uint64_t i_nb : 14;
1197 uint64_t i_rsvd_1 : 2;
1198 uint64_t i_m : 2;
1199 uint64_t i_f : 1;
1200 uint64_t i_of_cnt : 5;
1201 uint64_t i_error : 1;
1202 uint64_t i_rd_to : 1;
1203 uint64_t i_spur_wr : 1;
1204 uint64_t i_spur_rd : 1;
1205 uint64_t i_rsvd : 11;
1206 uint64_t i_mult_err : 1;
1207 } ii_iprbe_fld_s;
1208} ii_iprbe_u_t;
1209
1210
1211/************************************************************************
1212 * *
1213 * Description: There are 9 instances of this register, one per *
1214 * actual widget in this implementation of Shub and Crossbow. *
1215 * Note: Crossbow only has ports for Widgets 8 through F, widget 0 *
1216 * refers to Crossbow's internal space. *
1217 * This register contains the state elements per widget that are *
1218 * necessary to manage the PIO flow control on Crosstalk and on the *
1219 * Router Network. See the PIO Flow Control chapter for a complete *
1220 * description of this register *
1221 * The SPUR_WR bit requires some explanation. When this register is *
1222 * written, the new value of the C field is captured in an internal *
1223 * register so the hardware can remember what the programmer wrote *
1224 * into the credit counter. The SPUR_WR bit sets whenever the C field *
1225 * increments above this stored value, which indicates that there *
1226 * have been more responses received than requests sent. The SPUR_WR *
1227 * bit cannot be cleared until a value is written to the IPRBx *
1228 * register; the write will correct the C field and capture its new *
1229 * value in the internal register. Even if IECLR[E_PRB_x] is set, the *
1230 * SPUR_WR bit will persist if IPRBx hasn't yet been written. *
1231 * . *
1232 * *
1233 ************************************************************************/
1234
1235typedef union ii_iprbf_u {
1236 uint64_t ii_iprbf_regval;
1237 struct {
1238 uint64_t i_c : 8;
1239 uint64_t i_na : 14;
1240 uint64_t i_rsvd_2 : 2;
1241 uint64_t i_nb : 14;
1242 uint64_t i_rsvd_1 : 2;
1243 uint64_t i_m : 2;
1244 uint64_t i_f : 1;
1245 uint64_t i_of_cnt : 5;
1246 uint64_t i_error : 1;
1247 uint64_t i_rd_to : 1;
1248 uint64_t i_spur_wr : 1;
1249 uint64_t i_spur_rd : 1;
1250 uint64_t i_rsvd : 11;
1251 uint64_t i_mult_err : 1;
1252 } ii_iprbe_fld_s;
1253} ii_iprbf_u_t;
1254
1255
1256/************************************************************************
1257 * *
1258 * This register specifies the timeout value to use for monitoring *
1259 * Crosstalk credits which are used outbound to Crosstalk. An *
1260 * internal counter called the Crosstalk Credit Timeout Counter *
1261 * increments every 128 II clocks. The counter starts counting *
1262 * anytime the credit count drops below a threshold, and resets to *
1263 * zero (stops counting) anytime the credit count is at or above the *
1264 * threshold. The threshold is 1 credit in direct connect mode and 2 *
1265 * in Crossbow connect mode. When the internal Crosstalk Credit *
1266 * Timeout Counter reaches the value programmed in this register, a *
1267 * Crosstalk Credit Timeout has occurred. The internal counter is not *
1268 * readable from software, and stops counting at its maximum value, *
1269 * so it cannot cause more than one interrupt. *
1270 * *
1271 ************************************************************************/
1272
1273typedef union ii_ixcc_u {
1274 uint64_t ii_ixcc_regval;
1275 struct {
1276 uint64_t i_time_out : 26;
1277 uint64_t i_rsvd : 38;
1278 } ii_ixcc_fld_s;
1279} ii_ixcc_u_t;
1280
1281
1282/************************************************************************
1283 * *
1284 * Description: This register qualifies all the PIO and DMA *
1285 * operations launched from widget 0 towards the SHub. In *
1286 * addition, it also qualifies accesses by the BTE streams. *
1287 * The bits in each field of this register are cleared by the SHub *
1288 * upon detection of an error which requires widget 0 or the BTE *
1289 * streams to be terminated. Whether or not widget x has access *
1290 * rights to this SHub is determined by an AND of the device *
1291 * enable bit in the appropriate field of this register and bit 0 in *
1292 * the Wx_IAC field. The bits in this field are set by writing a 1 to *
1293 * them. Incoming replies from Crosstalk are not subject to this *
1294 * access control mechanism. *
1295 * *
1296 ************************************************************************/
1297
1298typedef union ii_imem_u {
1299 uint64_t ii_imem_regval;
1300 struct {
1301 uint64_t i_w0_esd : 1;
1302 uint64_t i_rsvd_3 : 3;
1303 uint64_t i_b0_esd : 1;
1304 uint64_t i_rsvd_2 : 3;
1305 uint64_t i_b1_esd : 1;
1306 uint64_t i_rsvd_1 : 3;
1307 uint64_t i_clr_precise : 1;
1308 uint64_t i_rsvd : 51;
1309 } ii_imem_fld_s;
1310} ii_imem_u_t;
1311
1312
1313
1314/************************************************************************
1315 * *
1316 * Description: This register specifies the timeout value to use for *
1317 * monitoring Crosstalk tail flits coming into the Shub in the *
1318 * TAIL_TO field. An internal counter associated with this register *
1319 * is incremented every 128 II internal clocks (7 bits). The counter *
1320 * starts counting anytime a header micropacket is received and stops *
1321 * counting (and resets to zero) any time a micropacket with a Tail *
1322 * bit is received. Once the counter reaches the threshold value *
1323 * programmed in this register, it generates an interrupt to the *
1324 * processor that is programmed into the IIDSR. The counter saturates *
1325 * (does not roll over) at its maximum value, so it cannot cause *
1326 * another interrupt until after it is cleared. *
1327 * The register also contains the Read Response Timeout values. The *
1328 * Prescalar is 23 bits, and counts II clocks. An internal counter *
1329 * increments on every II clock and when it reaches the value in the *
1330 * Prescalar field, all IPRTE registers with their valid bits set *
1331 * have their Read Response timers bumped. Whenever any of them match *
1332 * the value in the RRSP_TO field, a Read Response Timeout has *
1333 * occurred, and error handling occurs as described in the Error *
1334 * Handling section of this document. *
1335 * *
1336 ************************************************************************/
1337
1338typedef union ii_ixtt_u {
1339 uint64_t ii_ixtt_regval;
1340 struct {
1341 uint64_t i_tail_to : 26;
1342 uint64_t i_rsvd_1 : 6;
1343 uint64_t i_rrsp_ps : 23;
1344 uint64_t i_rrsp_to : 5;
1345 uint64_t i_rsvd : 4;
1346 } ii_ixtt_fld_s;
1347} ii_ixtt_u_t;
1348
1349
1350/************************************************************************
1351 * *
1352 * Writing a 1 to the fields of this register clears the appropriate *
1353 * error bits in other areas of SHub. Note that when the *
1354 * E_PRB_x bits are used to clear error bits in PRB registers, *
1355 * SPUR_RD and SPUR_WR may persist, because they require additional *
1356 * action to clear them. See the IPRBx and IXSS Register *
1357 * specifications. *
1358 * *
1359 ************************************************************************/
1360
1361typedef union ii_ieclr_u {
1362 uint64_t ii_ieclr_regval;
1363 struct {
1364 uint64_t i_e_prb_0 : 1;
1365 uint64_t i_rsvd : 7;
1366 uint64_t i_e_prb_8 : 1;
1367 uint64_t i_e_prb_9 : 1;
1368 uint64_t i_e_prb_a : 1;
1369 uint64_t i_e_prb_b : 1;
1370 uint64_t i_e_prb_c : 1;
1371 uint64_t i_e_prb_d : 1;
1372 uint64_t i_e_prb_e : 1;
1373 uint64_t i_e_prb_f : 1;
1374 uint64_t i_e_crazy : 1;
1375 uint64_t i_e_bte_0 : 1;
1376 uint64_t i_e_bte_1 : 1;
1377 uint64_t i_reserved_1 : 10;
1378 uint64_t i_spur_rd_hdr : 1;
1379 uint64_t i_cam_intr_to : 1;
1380 uint64_t i_cam_overflow : 1;
1381 uint64_t i_cam_read_miss : 1;
1382 uint64_t i_ioq_rep_underflow : 1;
1383 uint64_t i_ioq_req_underflow : 1;
1384 uint64_t i_ioq_rep_overflow : 1;
1385 uint64_t i_ioq_req_overflow : 1;
1386 uint64_t i_iiq_rep_overflow : 1;
1387 uint64_t i_iiq_req_overflow : 1;
1388 uint64_t i_ii_xn_rep_cred_overflow : 1;
1389 uint64_t i_ii_xn_req_cred_overflow : 1;
1390 uint64_t i_ii_xn_invalid_cmd : 1;
1391 uint64_t i_xn_ii_invalid_cmd : 1;
1392 uint64_t i_reserved_2 : 21;
1393 } ii_ieclr_fld_s;
1394} ii_ieclr_u_t;
1395
1396
1397/************************************************************************
1398 * *
1399 * This register controls both BTEs. SOFT_RESET is intended for *
1400 * recovery after an error. COUNT controls the total number of CRBs *
1401 * that both BTEs (combined) can use, which affects total BTE *
1402 * bandwidth. *
1403 * *
1404 ************************************************************************/
1405
1406typedef union ii_ibcr_u {
1407 uint64_t ii_ibcr_regval;
1408 struct {
1409 uint64_t i_count : 4;
1410 uint64_t i_rsvd_1 : 4;
1411 uint64_t i_soft_reset : 1;
1412 uint64_t i_rsvd : 55;
1413 } ii_ibcr_fld_s;
1414} ii_ibcr_u_t;
1415
1416
1417/************************************************************************
1418 * *
1419 * This register contains the header of a spurious read response *
1420 * received from Crosstalk. A spurious read response is defined as a *
1421 * read response received by II from a widget for which (1) the SIDN *
1422 * has a value between 1 and 7, inclusive (II never sends requests to *
1423 * these widgets (2) there is no valid IPRTE register which *
1424 * corresponds to the TNUM, or (3) the widget indicated in SIDN is *
1425 * not the same as the widget recorded in the IPRTE register *
1426 * referenced by the TNUM. If this condition is true, and if the *
1427 * IXSS[VALID] bit is clear, then the header of the spurious read *
1428 * response is capture in IXSM and IXSS, and IXSS[VALID] is set. The *
1429 * errant header is thereby captured, and no further spurious read *
1430 * respones are captured until IXSS[VALID] is cleared by setting the *
1431 * appropriate bit in IECLR.Everytime a spurious read response is *
1432 * detected, the SPUR_RD bit of the PRB corresponding to the incoming *
1433 * message's SIDN field is set. This always happens, regarless of *
1434 * whether a header is captured. The programmer should check *
1435 * IXSM[SIDN] to determine which widget sent the spurious response, *
1436 * because there may be more than one SPUR_RD bit set in the PRB *
1437 * registers. The widget indicated by IXSM[SIDN] was the first *
1438 * spurious read response to be received since the last time *
1439 * IXSS[VALID] was clear. The SPUR_RD bit of the corresponding PRB *
1440 * will be set. Any SPUR_RD bits in any other PRB registers indicate *
1441 * spurious messages from other widets which were detected after the *
1442 * header was captured.. *
1443 * *
1444 ************************************************************************/
1445
1446typedef union ii_ixsm_u {
1447 uint64_t ii_ixsm_regval;
1448 struct {
1449 uint64_t i_byte_en : 32;
1450 uint64_t i_reserved : 1;
1451 uint64_t i_tag : 3;
1452 uint64_t i_alt_pactyp : 4;
1453 uint64_t i_bo : 1;
1454 uint64_t i_error : 1;
1455 uint64_t i_vbpm : 1;
1456 uint64_t i_gbr : 1;
1457 uint64_t i_ds : 2;
1458 uint64_t i_ct : 1;
1459 uint64_t i_tnum : 5;
1460 uint64_t i_pactyp : 4;
1461 uint64_t i_sidn : 4;
1462 uint64_t i_didn : 4;
1463 } ii_ixsm_fld_s;
1464} ii_ixsm_u_t;
1465
1466
1467/************************************************************************
1468 * *
1469 * This register contains the sideband bits of a spurious read *
1470 * response received from Crosstalk. *
1471 * *
1472 ************************************************************************/
1473
1474typedef union ii_ixss_u {
1475 uint64_t ii_ixss_regval;
1476 struct {
1477 uint64_t i_sideband : 8;
1478 uint64_t i_rsvd : 55;
1479 uint64_t i_valid : 1;
1480 } ii_ixss_fld_s;
1481} ii_ixss_u_t;
1482
1483
1484/************************************************************************
1485 * *
1486 * This register enables software to access the II LLP's test port. *
1487 * Refer to the LLP 2.5 documentation for an explanation of the test *
1488 * port. Software can write to this register to program the values *
1489 * for the control fields (TestErrCapture, TestClear, TestFlit, *
1490 * TestMask and TestSeed). Similarly, software can read from this *
1491 * register to obtain the values of the test port's status outputs *
1492 * (TestCBerr, TestValid and TestData). *
1493 * *
1494 ************************************************************************/
1495
1496typedef union ii_ilct_u {
1497 uint64_t ii_ilct_regval;
1498 struct {
1499 uint64_t i_test_seed : 20;
1500 uint64_t i_test_mask : 8;
1501 uint64_t i_test_data : 20;
1502 uint64_t i_test_valid : 1;
1503 uint64_t i_test_cberr : 1;
1504 uint64_t i_test_flit : 3;
1505 uint64_t i_test_clear : 1;
1506 uint64_t i_test_err_capture : 1;
1507 uint64_t i_rsvd : 9;
1508 } ii_ilct_fld_s;
1509} ii_ilct_u_t;
1510
1511
1512/************************************************************************
1513 * *
1514 * If the II detects an illegal incoming Duplonet packet (request or *
1515 * reply) when VALID==0 in the IIEPH1 register, then it saves the *
1516 * contents of the packet's header flit in the IIEPH1 and IIEPH2 *
1517 * registers, sets the VALID bit in IIEPH1, clears the OVERRUN bit, *
1518 * and assigns a value to the ERR_TYPE field which indicates the *
1519 * specific nature of the error. The II recognizes four different *
1520 * types of errors: short request packets (ERR_TYPE==2), short reply *
1521 * packets (ERR_TYPE==3), long request packets (ERR_TYPE==4) and long *
1522 * reply packets (ERR_TYPE==5). The encodings for these types of *
1523 * errors were chosen to be consistent with the same types of errors *
1524 * indicated by the ERR_TYPE field in the LB_ERROR_HDR1 register (in *
1525 * the LB unit). If the II detects an illegal incoming Duplonet *
1526 * packet when VALID==1 in the IIEPH1 register, then it merely sets *
1527 * the OVERRUN bit to indicate that a subsequent error has happened, *
1528 * and does nothing further. *
1529 * *
1530 ************************************************************************/
1531
1532typedef union ii_iieph1_u {
1533 uint64_t ii_iieph1_regval;
1534 struct {
1535 uint64_t i_command : 7;
1536 uint64_t i_rsvd_5 : 1;
1537 uint64_t i_suppl : 14;
1538 uint64_t i_rsvd_4 : 1;
1539 uint64_t i_source : 14;
1540 uint64_t i_rsvd_3 : 1;
1541 uint64_t i_err_type : 4;
1542 uint64_t i_rsvd_2 : 4;
1543 uint64_t i_overrun : 1;
1544 uint64_t i_rsvd_1 : 3;
1545 uint64_t i_valid : 1;
1546 uint64_t i_rsvd : 13;
1547 } ii_iieph1_fld_s;
1548} ii_iieph1_u_t;
1549
1550
1551/************************************************************************
1552 * *
1553 * This register holds the Address field from the header flit of an *
1554 * incoming erroneous Duplonet packet, along with the tail bit which *
1555 * accompanied this header flit. This register is essentially an *
1556 * extension of IIEPH1. Two registers were necessary because the 64 *
1557 * bits available in only a single register were insufficient to *
1558 * capture the entire header flit of an erroneous packet. *
1559 * *
1560 ************************************************************************/
1561
1562typedef union ii_iieph2_u {
1563 uint64_t ii_iieph2_regval;
1564 struct {
1565 uint64_t i_rsvd_0 : 3;
1566 uint64_t i_address : 47;
1567 uint64_t i_rsvd_1 : 10;
1568 uint64_t i_tail : 1;
1569 uint64_t i_rsvd : 3;
1570 } ii_iieph2_fld_s;
1571} ii_iieph2_u_t;
1572
1573
1574/******************************/
1575
1576
1577
1578/************************************************************************
1579 * *
1580 * This register's value is a bit vector that guards access from SXBs *
1581 * to local registers within the II as well as to external Crosstalk *
1582 * widgets *
1583 * *
1584 ************************************************************************/
1585
1586typedef union ii_islapr_u {
1587 uint64_t ii_islapr_regval;
1588 struct {
1589 uint64_t i_region : 64;
1590 } ii_islapr_fld_s;
1591} ii_islapr_u_t;
1592
1593
1594/************************************************************************
1595 * *
1596 * A write to this register of the 56-bit value "Pup+Bun" will cause *
1597 * the bit in the ISLAPR register corresponding to the region of the *
1598 * requestor to be set (access allowed). (
1599 * *
1600 ************************************************************************/
1601
1602typedef union ii_islapo_u {
1603 uint64_t ii_islapo_regval;
1604 struct {
1605 uint64_t i_io_sbx_ovrride : 56;
1606 uint64_t i_rsvd : 8;
1607 } ii_islapo_fld_s;
1608} ii_islapo_u_t;
1609
1610/************************************************************************
1611 * *
1612 * Determines how long the wrapper will wait aftr an interrupt is *
1613 * initially issued from the II before it times out the outstanding *
1614 * interrupt and drops it from the interrupt queue. *
1615 * *
1616 ************************************************************************/
1617
1618typedef union ii_iwi_u {
1619 uint64_t ii_iwi_regval;
1620 struct {
1621 uint64_t i_prescale : 24;
1622 uint64_t i_rsvd : 8;
1623 uint64_t i_timeout : 8;
1624 uint64_t i_rsvd1 : 8;
1625 uint64_t i_intrpt_retry_period : 8;
1626 uint64_t i_rsvd2 : 8;
1627 } ii_iwi_fld_s;
1628} ii_iwi_u_t;
1629
1630/************************************************************************
1631 * *
1632 * Log errors which have occurred in the II wrapper. The errors are *
1633 * cleared by writing to the IECLR register. *
1634 * *
1635 ************************************************************************/
1636
1637typedef union ii_iwel_u {
1638 uint64_t ii_iwel_regval;
1639 struct {
1640 uint64_t i_intr_timed_out : 1;
1641 uint64_t i_rsvd : 7;
1642 uint64_t i_cam_overflow : 1;
1643 uint64_t i_cam_read_miss : 1;
1644 uint64_t i_rsvd1 : 2;
1645 uint64_t i_ioq_rep_underflow : 1;
1646 uint64_t i_ioq_req_underflow : 1;
1647 uint64_t i_ioq_rep_overflow : 1;
1648 uint64_t i_ioq_req_overflow : 1;
1649 uint64_t i_iiq_rep_overflow : 1;
1650 uint64_t i_iiq_req_overflow : 1;
1651 uint64_t i_rsvd2 : 6;
1652 uint64_t i_ii_xn_rep_cred_over_under: 1;
1653 uint64_t i_ii_xn_req_cred_over_under: 1;
1654 uint64_t i_rsvd3 : 6;
1655 uint64_t i_ii_xn_invalid_cmd : 1;
1656 uint64_t i_xn_ii_invalid_cmd : 1;
1657 uint64_t i_rsvd4 : 30;
1658 } ii_iwel_fld_s;
1659} ii_iwel_u_t;
1660
1661/************************************************************************
1662 * *
1663 * Controls the II wrapper. *
1664 * *
1665 ************************************************************************/
1666
1667typedef union ii_iwc_u {
1668 uint64_t ii_iwc_regval;
1669 struct {
1670 uint64_t i_dma_byte_swap : 1;
1671 uint64_t i_rsvd : 3;
1672 uint64_t i_cam_read_lines_reset : 1;
1673 uint64_t i_rsvd1 : 3;
1674 uint64_t i_ii_xn_cred_over_under_log: 1;
1675 uint64_t i_rsvd2 : 19;
1676 uint64_t i_xn_rep_iq_depth : 5;
1677 uint64_t i_rsvd3 : 3;
1678 uint64_t i_xn_req_iq_depth : 5;
1679 uint64_t i_rsvd4 : 3;
1680 uint64_t i_iiq_depth : 6;
1681 uint64_t i_rsvd5 : 12;
1682 uint64_t i_force_rep_cred : 1;
1683 uint64_t i_force_req_cred : 1;
1684 } ii_iwc_fld_s;
1685} ii_iwc_u_t;
1686
1687/************************************************************************
1688 * *
1689 * Status in the II wrapper. *
1690 * *
1691 ************************************************************************/
1692
1693typedef union ii_iws_u {
1694 uint64_t ii_iws_regval;
1695 struct {
1696 uint64_t i_xn_rep_iq_credits : 5;
1697 uint64_t i_rsvd : 3;
1698 uint64_t i_xn_req_iq_credits : 5;
1699 uint64_t i_rsvd1 : 51;
1700 } ii_iws_fld_s;
1701} ii_iws_u_t;
1702
1703/************************************************************************
1704 * *
1705 * Masks errors in the IWEL register. *
1706 * *
1707 ************************************************************************/
1708
1709typedef union ii_iweim_u {
1710 uint64_t ii_iweim_regval;
1711 struct {
1712 uint64_t i_intr_timed_out : 1;
1713 uint64_t i_rsvd : 7;
1714 uint64_t i_cam_overflow : 1;
1715 uint64_t i_cam_read_miss : 1;
1716 uint64_t i_rsvd1 : 2;
1717 uint64_t i_ioq_rep_underflow : 1;
1718 uint64_t i_ioq_req_underflow : 1;
1719 uint64_t i_ioq_rep_overflow : 1;
1720 uint64_t i_ioq_req_overflow : 1;
1721 uint64_t i_iiq_rep_overflow : 1;
1722 uint64_t i_iiq_req_overflow : 1;
1723 uint64_t i_rsvd2 : 6;
1724 uint64_t i_ii_xn_rep_cred_overflow : 1;
1725 uint64_t i_ii_xn_req_cred_overflow : 1;
1726 uint64_t i_rsvd3 : 6;
1727 uint64_t i_ii_xn_invalid_cmd : 1;
1728 uint64_t i_xn_ii_invalid_cmd : 1;
1729 uint64_t i_rsvd4 : 30;
1730 } ii_iweim_fld_s;
1731} ii_iweim_u_t;
1732
1733
1734/************************************************************************
1735 * *
1736 * A write to this register causes a particular field in the *
1737 * corresponding widget's PRB entry to be adjusted up or down by 1. *
1738 * This counter should be used when recovering from error and reset *
1739 * conditions. Note that software would be capable of causing *
1740 * inadvertent overflow or underflow of these counters. *
1741 * *
1742 ************************************************************************/
1743
1744typedef union ii_ipca_u {
1745 uint64_t ii_ipca_regval;
1746 struct {
1747 uint64_t i_wid : 4;
1748 uint64_t i_adjust : 1;
1749 uint64_t i_rsvd_1 : 3;
1750 uint64_t i_field : 2;
1751 uint64_t i_rsvd : 54;
1752 } ii_ipca_fld_s;
1753} ii_ipca_u_t;
1754
1755
1756/************************************************************************
1757 * *
1758 * There are 8 instances of this register. This register contains *
1759 * the information that the II has to remember once it has launched a *
1760 * PIO Read operation. The contents are used to form the correct *
1761 * Router Network packet and direct the Crosstalk reply to the *
1762 * appropriate processor. *
1763 * *
1764 ************************************************************************/
1765
1766
1767typedef union ii_iprte0a_u {
1768 uint64_t ii_iprte0a_regval;
1769 struct {
1770 uint64_t i_rsvd_1 : 54;
1771 uint64_t i_widget : 4;
1772 uint64_t i_to_cnt : 5;
1773 uint64_t i_vld : 1;
1774 } ii_iprte0a_fld_s;
1775} ii_iprte0a_u_t;
1776
1777
1778/************************************************************************
1779 * *
1780 * There are 8 instances of this register. This register contains *
1781 * the information that the II has to remember once it has launched a *
1782 * PIO Read operation. The contents are used to form the correct *
1783 * Router Network packet and direct the Crosstalk reply to the *
1784 * appropriate processor. *
1785 * *
1786 ************************************************************************/
1787
1788typedef union ii_iprte1a_u {
1789 uint64_t ii_iprte1a_regval;
1790 struct {
1791 uint64_t i_rsvd_1 : 54;
1792 uint64_t i_widget : 4;
1793 uint64_t i_to_cnt : 5;
1794 uint64_t i_vld : 1;
1795 } ii_iprte1a_fld_s;
1796} ii_iprte1a_u_t;
1797
1798
1799/************************************************************************
1800 * *
1801 * There are 8 instances of this register. This register contains *
1802 * the information that the II has to remember once it has launched a *
1803 * PIO Read operation. The contents are used to form the correct *
1804 * Router Network packet and direct the Crosstalk reply to the *
1805 * appropriate processor. *
1806 * *
1807 ************************************************************************/
1808
1809typedef union ii_iprte2a_u {
1810 uint64_t ii_iprte2a_regval;
1811 struct {
1812 uint64_t i_rsvd_1 : 54;
1813 uint64_t i_widget : 4;
1814 uint64_t i_to_cnt : 5;
1815 uint64_t i_vld : 1;
1816 } ii_iprte2a_fld_s;
1817} ii_iprte2a_u_t;
1818
1819
1820/************************************************************************
1821 * *
1822 * There are 8 instances of this register. This register contains *
1823 * the information that the II has to remember once it has launched a *
1824 * PIO Read operation. The contents are used to form the correct *
1825 * Router Network packet and direct the Crosstalk reply to the *
1826 * appropriate processor. *
1827 * *
1828 ************************************************************************/
1829
1830typedef union ii_iprte3a_u {
1831 uint64_t ii_iprte3a_regval;
1832 struct {
1833 uint64_t i_rsvd_1 : 54;
1834 uint64_t i_widget : 4;
1835 uint64_t i_to_cnt : 5;
1836 uint64_t i_vld : 1;
1837 } ii_iprte3a_fld_s;
1838} ii_iprte3a_u_t;
1839
1840
1841/************************************************************************
1842 * *
1843 * There are 8 instances of this register. This register contains *
1844 * the information that the II has to remember once it has launched a *
1845 * PIO Read operation. The contents are used to form the correct *
1846 * Router Network packet and direct the Crosstalk reply to the *
1847 * appropriate processor. *
1848 * *
1849 ************************************************************************/
1850
1851typedef union ii_iprte4a_u {
1852 uint64_t ii_iprte4a_regval;
1853 struct {
1854 uint64_t i_rsvd_1 : 54;
1855 uint64_t i_widget : 4;
1856 uint64_t i_to_cnt : 5;
1857 uint64_t i_vld : 1;
1858 } ii_iprte4a_fld_s;
1859} ii_iprte4a_u_t;
1860
1861
1862/************************************************************************
1863 * *
1864 * There are 8 instances of this register. This register contains *
1865 * the information that the II has to remember once it has launched a *
1866 * PIO Read operation. The contents are used to form the correct *
1867 * Router Network packet and direct the Crosstalk reply to the *
1868 * appropriate processor. *
1869 * *
1870 ************************************************************************/
1871
1872typedef union ii_iprte5a_u {
1873 uint64_t ii_iprte5a_regval;
1874 struct {
1875 uint64_t i_rsvd_1 : 54;
1876 uint64_t i_widget : 4;
1877 uint64_t i_to_cnt : 5;
1878 uint64_t i_vld : 1;
1879 } ii_iprte5a_fld_s;
1880} ii_iprte5a_u_t;
1881
1882
1883/************************************************************************
1884 * *
1885 * There are 8 instances of this register. This register contains *
1886 * the information that the II has to remember once it has launched a *
1887 * PIO Read operation. The contents are used to form the correct *
1888 * Router Network packet and direct the Crosstalk reply to the *
1889 * appropriate processor. *
1890 * *
1891 ************************************************************************/
1892
1893typedef union ii_iprte6a_u {
1894 uint64_t ii_iprte6a_regval;
1895 struct {
1896 uint64_t i_rsvd_1 : 54;
1897 uint64_t i_widget : 4;
1898 uint64_t i_to_cnt : 5;
1899 uint64_t i_vld : 1;
1900 } ii_iprte6a_fld_s;
1901} ii_iprte6a_u_t;
1902
1903
1904/************************************************************************
1905 * *
1906 * There are 8 instances of this register. This register contains *
1907 * the information that the II has to remember once it has launched a *
1908 * PIO Read operation. The contents are used to form the correct *
1909 * Router Network packet and direct the Crosstalk reply to the *
1910 * appropriate processor. *
1911 * *
1912 ************************************************************************/
1913
1914typedef union ii_iprte7a_u {
1915 uint64_t ii_iprte7a_regval;
1916 struct {
1917 uint64_t i_rsvd_1 : 54;
1918 uint64_t i_widget : 4;
1919 uint64_t i_to_cnt : 5;
1920 uint64_t i_vld : 1;
1921 } ii_iprtea7_fld_s;
1922} ii_iprte7a_u_t;
1923
1924
1925
1926/************************************************************************
1927 * *
1928 * There are 8 instances of this register. This register contains *
1929 * the information that the II has to remember once it has launched a *
1930 * PIO Read operation. The contents are used to form the correct *
1931 * Router Network packet and direct the Crosstalk reply to the *
1932 * appropriate processor. *
1933 * *
1934 ************************************************************************/
1935
1936
1937typedef union ii_iprte0b_u {
1938 uint64_t ii_iprte0b_regval;
1939 struct {
1940 uint64_t i_rsvd_1 : 3;
1941 uint64_t i_address : 47;
1942 uint64_t i_init : 3;
1943 uint64_t i_source : 11;
1944 } ii_iprte0b_fld_s;
1945} ii_iprte0b_u_t;
1946
1947
1948/************************************************************************
1949 * *
1950 * There are 8 instances of this register. This register contains *
1951 * the information that the II has to remember once it has launched a *
1952 * PIO Read operation. The contents are used to form the correct *
1953 * Router Network packet and direct the Crosstalk reply to the *
1954 * appropriate processor. *
1955 * *
1956 ************************************************************************/
1957
1958typedef union ii_iprte1b_u {
1959 uint64_t ii_iprte1b_regval;
1960 struct {
1961 uint64_t i_rsvd_1 : 3;
1962 uint64_t i_address : 47;
1963 uint64_t i_init : 3;
1964 uint64_t i_source : 11;
1965 } ii_iprte1b_fld_s;
1966} ii_iprte1b_u_t;
1967
1968
1969/************************************************************************
1970 * *
1971 * There are 8 instances of this register. This register contains *
1972 * the information that the II has to remember once it has launched a *
1973 * PIO Read operation. The contents are used to form the correct *
1974 * Router Network packet and direct the Crosstalk reply to the *
1975 * appropriate processor. *
1976 * *
1977 ************************************************************************/
1978
1979typedef union ii_iprte2b_u {
1980 uint64_t ii_iprte2b_regval;
1981 struct {
1982 uint64_t i_rsvd_1 : 3;
1983 uint64_t i_address : 47;
1984 uint64_t i_init : 3;
1985 uint64_t i_source : 11;
1986 } ii_iprte2b_fld_s;
1987} ii_iprte2b_u_t;
1988
1989
1990/************************************************************************
1991 * *
1992 * There are 8 instances of this register. This register contains *
1993 * the information that the II has to remember once it has launched a *
1994 * PIO Read operation. The contents are used to form the correct *
1995 * Router Network packet and direct the Crosstalk reply to the *
1996 * appropriate processor. *
1997 * *
1998 ************************************************************************/
1999
2000typedef union ii_iprte3b_u {
2001 uint64_t ii_iprte3b_regval;
2002 struct {
2003 uint64_t i_rsvd_1 : 3;
2004 uint64_t i_address : 47;
2005 uint64_t i_init : 3;
2006 uint64_t i_source : 11;
2007 } ii_iprte3b_fld_s;
2008} ii_iprte3b_u_t;
2009
2010
2011/************************************************************************
2012 * *
2013 * There are 8 instances of this register. This register contains *
2014 * the information that the II has to remember once it has launched a *
2015 * PIO Read operation. The contents are used to form the correct *
2016 * Router Network packet and direct the Crosstalk reply to the *
2017 * appropriate processor. *
2018 * *
2019 ************************************************************************/
2020
2021typedef union ii_iprte4b_u {
2022 uint64_t ii_iprte4b_regval;
2023 struct {
2024 uint64_t i_rsvd_1 : 3;
2025 uint64_t i_address : 47;
2026 uint64_t i_init : 3;
2027 uint64_t i_source : 11;
2028 } ii_iprte4b_fld_s;
2029} ii_iprte4b_u_t;
2030
2031
2032/************************************************************************
2033 * *
2034 * There are 8 instances of this register. This register contains *
2035 * the information that the II has to remember once it has launched a *
2036 * PIO Read operation. The contents are used to form the correct *
2037 * Router Network packet and direct the Crosstalk reply to the *
2038 * appropriate processor. *
2039 * *
2040 ************************************************************************/
2041
2042typedef union ii_iprte5b_u {
2043 uint64_t ii_iprte5b_regval;
2044 struct {
2045 uint64_t i_rsvd_1 : 3;
2046 uint64_t i_address : 47;
2047 uint64_t i_init : 3;
2048 uint64_t i_source : 11;
2049 } ii_iprte5b_fld_s;
2050} ii_iprte5b_u_t;
2051
2052
2053/************************************************************************
2054 * *
2055 * There are 8 instances of this register. This register contains *
2056 * the information that the II has to remember once it has launched a *
2057 * PIO Read operation. The contents are used to form the correct *
2058 * Router Network packet and direct the Crosstalk reply to the *
2059 * appropriate processor. *
2060 * *
2061 ************************************************************************/
2062
2063typedef union ii_iprte6b_u {
2064 uint64_t ii_iprte6b_regval;
2065 struct {
2066 uint64_t i_rsvd_1 : 3;
2067 uint64_t i_address : 47;
2068 uint64_t i_init : 3;
2069 uint64_t i_source : 11;
2070
2071 } ii_iprte6b_fld_s;
2072} ii_iprte6b_u_t;
2073
2074
2075/************************************************************************
2076 * *
2077 * There are 8 instances of this register. This register contains *
2078 * the information that the II has to remember once it has launched a *
2079 * PIO Read operation. The contents are used to form the correct *
2080 * Router Network packet and direct the Crosstalk reply to the *
2081 * appropriate processor. *
2082 * *
2083 ************************************************************************/
2084
2085typedef union ii_iprte7b_u {
2086 uint64_t ii_iprte7b_regval;
2087 struct {
2088 uint64_t i_rsvd_1 : 3;
2089 uint64_t i_address : 47;
2090 uint64_t i_init : 3;
2091 uint64_t i_source : 11;
2092 } ii_iprte7b_fld_s;
2093} ii_iprte7b_u_t;
2094
2095
2096/************************************************************************
2097 * *
2098 * Description: SHub II contains a feature which did not exist in *
2099 * the Hub which automatically cleans up after a Read Response *
2100 * timeout, including deallocation of the IPRTE and recovery of IBuf *
2101 * space. The inclusion of this register in SHub is for backward *
2102 * compatibility *
2103 * A write to this register causes an entry from the table of *
2104 * outstanding PIO Read Requests to be freed and returned to the *
2105 * stack of free entries. This register is used in handling the *
2106 * timeout errors that result in a PIO Reply never returning from *
2107 * Crosstalk. *
2108 * Note that this register does not affect the contents of the IPRTE *
2109 * registers. The Valid bits in those registers have to be *
2110 * specifically turned off by software. *
2111 * *
2112 ************************************************************************/
2113
2114typedef union ii_ipdr_u {
2115 uint64_t ii_ipdr_regval;
2116 struct {
2117 uint64_t i_te : 3;
2118 uint64_t i_rsvd_1 : 1;
2119 uint64_t i_pnd : 1;
2120 uint64_t i_init_rpcnt : 1;
2121 uint64_t i_rsvd : 58;
2122 } ii_ipdr_fld_s;
2123} ii_ipdr_u_t;
2124
2125
2126/************************************************************************
2127 * *
2128 * A write to this register causes a CRB entry to be returned to the *
2129 * queue of free CRBs. The entry should have previously been cleared *
2130 * (mark bit) via backdoor access to the pertinent CRB entry. This *
2131 * register is used in the last step of handling the errors that are *
2132 * captured and marked in CRB entries. Briefly: 1) first error for *
2133 * DMA write from a particular device, and first error for a *
2134 * particular BTE stream, lead to a marked CRB entry, and processor *
2135 * interrupt, 2) software reads the error information captured in the *
2136 * CRB entry, and presumably takes some corrective action, 3) *
2137 * software clears the mark bit, and finally 4) software writes to *
2138 * the ICDR register to return the CRB entry to the list of free CRB *
2139 * entries. *
2140 * *
2141 ************************************************************************/
2142
2143typedef union ii_icdr_u {
2144 uint64_t ii_icdr_regval;
2145 struct {
2146 uint64_t i_crb_num : 4;
2147 uint64_t i_pnd : 1;
2148 uint64_t i_rsvd : 59;
2149 } ii_icdr_fld_s;
2150} ii_icdr_u_t;
2151
2152
2153/************************************************************************
2154 * *
2155 * This register provides debug access to two FIFOs inside of II. *
2156 * Both IOQ_MAX* fields of this register contain the instantaneous *
2157 * depth (in units of the number of available entries) of the *
2158 * associated IOQ FIFO. A read of this register will return the *
2159 * number of free entries on each FIFO at the time of the read. So *
2160 * when a FIFO is idle, the associated field contains the maximum *
2161 * depth of the FIFO. This register is writable for debug reasons *
2162 * and is intended to be written with the maximum desired FIFO depth *
2163 * while the FIFO is idle. Software must assure that II is idle when *
2164 * this register is written. If there are any active entries in any *
2165 * of these FIFOs when this register is written, the results are *
2166 * undefined. *
2167 * *
2168 ************************************************************************/
2169
2170typedef union ii_ifdr_u {
2171 uint64_t ii_ifdr_regval;
2172 struct {
2173 uint64_t i_ioq_max_rq : 7;
2174 uint64_t i_set_ioq_rq : 1;
2175 uint64_t i_ioq_max_rp : 7;
2176 uint64_t i_set_ioq_rp : 1;
2177 uint64_t i_rsvd : 48;
2178 } ii_ifdr_fld_s;
2179} ii_ifdr_u_t;
2180
2181
2182/************************************************************************
2183 * *
2184 * This register allows the II to become sluggish in removing *
2185 * messages from its inbound queue (IIQ). This will cause messages to *
2186 * back up in either virtual channel. Disabling the "molasses" mode *
2187 * subsequently allows the II to be tested under stress. In the *
2188 * sluggish ("Molasses") mode, the localized effects of congestion *
2189 * can be observed. *
2190 * *
2191 ************************************************************************/
2192
2193typedef union ii_iiap_u {
2194 uint64_t ii_iiap_regval;
2195 struct {
2196 uint64_t i_rq_mls : 6;
2197 uint64_t i_rsvd_1 : 2;
2198 uint64_t i_rp_mls : 6;
2199 uint64_t i_rsvd : 50;
2200 } ii_iiap_fld_s;
2201} ii_iiap_u_t;
2202
2203
2204/************************************************************************
2205 * *
2206 * This register allows several parameters of CRB operation to be *
2207 * set. Note that writing to this register can have catastrophic side *
2208 * effects, if the CRB is not quiescent, i.e. if the CRB is *
2209 * processing protocol messages when the write occurs. *
2210 * *
2211 ************************************************************************/
2212
2213typedef union ii_icmr_u {
2214 uint64_t ii_icmr_regval;
2215 struct {
2216 uint64_t i_sp_msg : 1;
2217 uint64_t i_rd_hdr : 1;
2218 uint64_t i_rsvd_4 : 2;
2219 uint64_t i_c_cnt : 4;
2220 uint64_t i_rsvd_3 : 4;
2221 uint64_t i_clr_rqpd : 1;
2222 uint64_t i_clr_rppd : 1;
2223 uint64_t i_rsvd_2 : 2;
2224 uint64_t i_fc_cnt : 4;
2225 uint64_t i_crb_vld : 15;
2226 uint64_t i_crb_mark : 15;
2227 uint64_t i_rsvd_1 : 2;
2228 uint64_t i_precise : 1;
2229 uint64_t i_rsvd : 11;
2230 } ii_icmr_fld_s;
2231} ii_icmr_u_t;
2232
2233
2234/************************************************************************
2235 * *
2236 * This register allows control of the table portion of the CRB *
2237 * logic via software. Control operations from this register have *
2238 * priority over all incoming Crosstalk or BTE requests. *
2239 * *
2240 ************************************************************************/
2241
2242typedef union ii_iccr_u {
2243 uint64_t ii_iccr_regval;
2244 struct {
2245 uint64_t i_crb_num : 4;
2246 uint64_t i_rsvd_1 : 4;
2247 uint64_t i_cmd : 8;
2248 uint64_t i_pending : 1;
2249 uint64_t i_rsvd : 47;
2250 } ii_iccr_fld_s;
2251} ii_iccr_u_t;
2252
2253
2254/************************************************************************
2255 * *
2256 * This register allows the maximum timeout value to be programmed. *
2257 * *
2258 ************************************************************************/
2259
2260typedef union ii_icto_u {
2261 uint64_t ii_icto_regval;
2262 struct {
2263 uint64_t i_timeout : 8;
2264 uint64_t i_rsvd : 56;
2265 } ii_icto_fld_s;
2266} ii_icto_u_t;
2267
2268
2269/************************************************************************
2270 * *
2271 * This register allows the timeout prescalar to be programmed. An *
2272 * internal counter is associated with this register. When the *
2273 * internal counter reaches the value of the PRESCALE field, the *
2274 * timer registers in all valid CRBs are incremented (CRBx_D[TIMEOUT] *
2275 * field). The internal counter resets to zero, and then continues *
2276 * counting. *
2277 * *
2278 ************************************************************************/
2279
2280typedef union ii_ictp_u {
2281 uint64_t ii_ictp_regval;
2282 struct {
2283 uint64_t i_prescale : 24;
2284 uint64_t i_rsvd : 40;
2285 } ii_ictp_fld_s;
2286} ii_ictp_u_t;
2287
2288
2289/************************************************************************
2290 * *
2291 * Description: There are 15 CRB Entries (ICRB0 to ICRBE) that are *
2292 * used for Crosstalk operations (both cacheline and partial *
2293 * operations) or BTE/IO. Because the CRB entries are very wide, five *
2294 * registers (_A to _E) are required to read and write each entry. *
2295 * The CRB Entry registers can be conceptualized as rows and columns *
2296 * (illustrated in the table above). Each row contains the 4 *
2297 * registers required for a single CRB Entry. The first doubleword *
2298 * (column) for each entry is labeled A, and the second doubleword *
2299 * (higher address) is labeled B, the third doubleword is labeled C, *
2300 * the fourth doubleword is labeled D and the fifth doubleword is *
2301 * labeled E. All CRB entries have their addresses on a quarter *
2302 * cacheline aligned boundary. *
2303 * Upon reset, only the following fields are initialized: valid *
2304 * (VLD), priority count, timeout, timeout valid, and context valid. *
2305 * All other bits should be cleared by software before use (after *
2306 * recovering any potential error state from before the reset). *
2307 * The following four tables summarize the format for the four *
2308 * registers that are used for each ICRB# Entry. *
2309 * *
2310 ************************************************************************/
2311
2312typedef union ii_icrb0_a_u {
2313 uint64_t ii_icrb0_a_regval;
2314 struct {
2315 uint64_t ia_iow : 1;
2316 uint64_t ia_vld : 1;
2317 uint64_t ia_addr : 47;
2318 uint64_t ia_tnum : 5;
2319 uint64_t ia_sidn : 4;
2320 uint64_t ia_rsvd : 6;
2321 } ii_icrb0_a_fld_s;
2322} ii_icrb0_a_u_t;
2323
2324
2325/************************************************************************
2326 * *
2327 * Description: There are 15 CRB Entries (ICRB0 to ICRBE) that are *
2328 * used for Crosstalk operations (both cacheline and partial *
2329 * operations) or BTE/IO. Because the CRB entries are very wide, five *
2330 * registers (_A to _E) are required to read and write each entry. *
2331 * *
2332 ************************************************************************/
2333
2334typedef union ii_icrb0_b_u {
2335 uint64_t ii_icrb0_b_regval;
2336 struct {
2337 uint64_t ib_xt_err : 1;
2338 uint64_t ib_mark : 1;
2339 uint64_t ib_ln_uce : 1;
2340 uint64_t ib_errcode : 3;
2341 uint64_t ib_error : 1;
2342 uint64_t ib_stall__bte_1 : 1;
2343 uint64_t ib_stall__bte_0 : 1;
2344 uint64_t ib_stall__intr : 1;
2345 uint64_t ib_stall_ib : 1;
2346 uint64_t ib_intvn : 1;
2347 uint64_t ib_wb : 1;
2348 uint64_t ib_hold : 1;
2349 uint64_t ib_ack : 1;
2350 uint64_t ib_resp : 1;
2351 uint64_t ib_ack_cnt : 11;
2352 uint64_t ib_rsvd : 7;
2353 uint64_t ib_exc : 5;
2354 uint64_t ib_init : 3;
2355 uint64_t ib_imsg : 8;
2356 uint64_t ib_imsgtype : 2;
2357 uint64_t ib_use_old : 1;
2358 uint64_t ib_rsvd_1 : 11;
2359 } ii_icrb0_b_fld_s;
2360} ii_icrb0_b_u_t;
2361
2362
2363/************************************************************************
2364 * *
2365 * Description: There are 15 CRB Entries (ICRB0 to ICRBE) that are *
2366 * used for Crosstalk operations (both cacheline and partial *
2367 * operations) or BTE/IO. Because the CRB entries are very wide, five *
2368 * registers (_A to _E) are required to read and write each entry. *
2369 * *
2370 ************************************************************************/
2371
2372typedef union ii_icrb0_c_u {
2373 uint64_t ii_icrb0_c_regval;
2374 struct {
2375 uint64_t ic_source : 15;
2376 uint64_t ic_size : 2;
2377 uint64_t ic_ct : 1;
2378 uint64_t ic_bte_num : 1;
2379 uint64_t ic_gbr : 1;
2380 uint64_t ic_resprqd : 1;
2381 uint64_t ic_bo : 1;
2382 uint64_t ic_suppl : 15;
2383 uint64_t ic_rsvd : 27;
2384 } ii_icrb0_c_fld_s;
2385} ii_icrb0_c_u_t;
2386
2387
2388/************************************************************************
2389 * *
2390 * Description: There are 15 CRB Entries (ICRB0 to ICRBE) that are *
2391 * used for Crosstalk operations (both cacheline and partial *
2392 * operations) or BTE/IO. Because the CRB entries are very wide, five *
2393 * registers (_A to _E) are required to read and write each entry. *
2394 * *
2395 ************************************************************************/
2396
2397typedef union ii_icrb0_d_u {
2398 uint64_t ii_icrb0_d_regval;
2399 struct {
2400 uint64_t id_pa_be : 43;
2401 uint64_t id_bte_op : 1;
2402 uint64_t id_pr_psc : 4;
2403 uint64_t id_pr_cnt : 4;
2404 uint64_t id_sleep : 1;
2405 uint64_t id_rsvd : 11;
2406 } ii_icrb0_d_fld_s;
2407} ii_icrb0_d_u_t;
2408
2409
2410/************************************************************************
2411 * *
2412 * Description: There are 15 CRB Entries (ICRB0 to ICRBE) that are *
2413 * used for Crosstalk operations (both cacheline and partial *
2414 * operations) or BTE/IO. Because the CRB entries are very wide, five *
2415 * registers (_A to _E) are required to read and write each entry. *
2416 * *
2417 ************************************************************************/
2418
2419typedef union ii_icrb0_e_u {
2420 uint64_t ii_icrb0_e_regval;
2421 struct {
2422 uint64_t ie_timeout : 8;
2423 uint64_t ie_context : 15;
2424 uint64_t ie_rsvd : 1;
2425 uint64_t ie_tvld : 1;
2426 uint64_t ie_cvld : 1;
2427 uint64_t ie_rsvd_0 : 38;
2428 } ii_icrb0_e_fld_s;
2429} ii_icrb0_e_u_t;
2430
2431
2432/************************************************************************
2433 * *
2434 * This register contains the lower 64 bits of the header of the *
2435 * spurious message captured by II. Valid when the SP_MSG bit in ICMR *
2436 * register is set. *
2437 * *
2438 ************************************************************************/
2439
2440typedef union ii_icsml_u {
2441 uint64_t ii_icsml_regval;
2442 struct {
2443 uint64_t i_tt_addr : 47;
2444 uint64_t i_newsuppl_ex : 14;
2445 uint64_t i_reserved : 2;
2446 uint64_t i_overflow : 1;
2447 } ii_icsml_fld_s;
2448} ii_icsml_u_t;
2449
2450
2451/************************************************************************
2452 * *
2453 * This register contains the middle 64 bits of the header of the *
2454 * spurious message captured by II. Valid when the SP_MSG bit in ICMR *
2455 * register is set. *
2456 * *
2457 ************************************************************************/
2458
2459typedef union ii_icsmm_u {
2460 uint64_t ii_icsmm_regval;
2461 struct {
2462 uint64_t i_tt_ack_cnt : 11;
2463 uint64_t i_reserved : 53;
2464 } ii_icsmm_fld_s;
2465} ii_icsmm_u_t;
2466
2467
2468/************************************************************************
2469 * *
2470 * This register contains the microscopic state, all the inputs to *
2471 * the protocol table, captured with the spurious message. Valid when *
2472 * the SP_MSG bit in the ICMR register is set. *
2473 * *
2474 ************************************************************************/
2475
2476typedef union ii_icsmh_u {
2477 uint64_t ii_icsmh_regval;
2478 struct {
2479 uint64_t i_tt_vld : 1;
2480 uint64_t i_xerr : 1;
2481 uint64_t i_ft_cwact_o : 1;
2482 uint64_t i_ft_wact_o : 1;
2483 uint64_t i_ft_active_o : 1;
2484 uint64_t i_sync : 1;
2485 uint64_t i_mnusg : 1;
2486 uint64_t i_mnusz : 1;
2487 uint64_t i_plusz : 1;
2488 uint64_t i_plusg : 1;
2489 uint64_t i_tt_exc : 5;
2490 uint64_t i_tt_wb : 1;
2491 uint64_t i_tt_hold : 1;
2492 uint64_t i_tt_ack : 1;
2493 uint64_t i_tt_resp : 1;
2494 uint64_t i_tt_intvn : 1;
2495 uint64_t i_g_stall_bte1 : 1;
2496 uint64_t i_g_stall_bte0 : 1;
2497 uint64_t i_g_stall_il : 1;
2498 uint64_t i_g_stall_ib : 1;
2499 uint64_t i_tt_imsg : 8;
2500 uint64_t i_tt_imsgtype : 2;
2501 uint64_t i_tt_use_old : 1;
2502 uint64_t i_tt_respreqd : 1;
2503 uint64_t i_tt_bte_num : 1;
2504 uint64_t i_cbn : 1;
2505 uint64_t i_match : 1;
2506 uint64_t i_rpcnt_lt_34 : 1;
2507 uint64_t i_rpcnt_ge_34 : 1;
2508 uint64_t i_rpcnt_lt_18 : 1;
2509 uint64_t i_rpcnt_ge_18 : 1;
2510 uint64_t i_rpcnt_lt_2 : 1;
2511 uint64_t i_rpcnt_ge_2 : 1;
2512 uint64_t i_rqcnt_lt_18 : 1;
2513 uint64_t i_rqcnt_ge_18 : 1;
2514 uint64_t i_rqcnt_lt_2 : 1;
2515 uint64_t i_rqcnt_ge_2 : 1;
2516 uint64_t i_tt_device : 7;
2517 uint64_t i_tt_init : 3;
2518 uint64_t i_reserved : 5;
2519 } ii_icsmh_fld_s;
2520} ii_icsmh_u_t;
2521
2522
2523/************************************************************************
2524 * *
2525 * The Shub DEBUG unit provides a 3-bit selection signal to the *
2526 * II core and a 3-bit selection signal to the fsbclk domain in the II *
2527 * wrapper. *
2528 * *
2529 ************************************************************************/
2530
2531typedef union ii_idbss_u {
2532 uint64_t ii_idbss_regval;
2533 struct {
2534 uint64_t i_iioclk_core_submenu : 3;
2535 uint64_t i_rsvd : 5;
2536 uint64_t i_fsbclk_wrapper_submenu : 3;
2537 uint64_t i_rsvd_1 : 5;
2538 uint64_t i_iioclk_menu : 5;
2539 uint64_t i_rsvd_2 : 43;
2540 } ii_idbss_fld_s;
2541} ii_idbss_u_t;
2542
2543
2544/************************************************************************
2545 * *
2546 * Description: This register is used to set up the length for a *
2547 * transfer and then to monitor the progress of that transfer. This *
2548 * register needs to be initialized before a transfer is started. A *
2549 * legitimate write to this register will set the Busy bit, clear the *
2550 * Error bit, and initialize the length to the value desired. *
2551 * While the transfer is in progress, hardware will decrement the *
2552 * length field with each successful block that is copied. Once the *
2553 * transfer completes, hardware will clear the Busy bit. The length *
2554 * field will also contain the number of cache lines left to be *
2555 * transferred. *
2556 * *
2557 ************************************************************************/
2558
2559typedef union ii_ibls0_u {
2560 uint64_t ii_ibls0_regval;
2561 struct {
2562 uint64_t i_length : 16;
2563 uint64_t i_error : 1;
2564 uint64_t i_rsvd_1 : 3;
2565 uint64_t i_busy : 1;
2566 uint64_t i_rsvd : 43;
2567 } ii_ibls0_fld_s;
2568} ii_ibls0_u_t;
2569
2570
2571/************************************************************************
2572 * *
2573 * This register should be loaded before a transfer is started. The *
2574 * address to be loaded in bits 39:0 is the 40-bit TRex+ physical *
2575 * address as described in Section 1.3, Figure2 and Figure3. Since *
2576 * the bottom 7 bits of the address are always taken to be zero, BTE *
2577 * transfers are always cacheline-aligned. *
2578 * *
2579 ************************************************************************/
2580
2581typedef union ii_ibsa0_u {
2582 uint64_t ii_ibsa0_regval;
2583 struct {
2584 uint64_t i_rsvd_1 : 7;
2585 uint64_t i_addr : 42;
2586 uint64_t i_rsvd : 15;
2587 } ii_ibsa0_fld_s;
2588} ii_ibsa0_u_t;
2589
2590
2591/************************************************************************
2592 * *
2593 * This register should be loaded before a transfer is started. The *
2594 * address to be loaded in bits 39:0 is the 40-bit TRex+ physical *
2595 * address as described in Section 1.3, Figure2 and Figure3. Since *
2596 * the bottom 7 bits of the address are always taken to be zero, BTE *
2597 * transfers are always cacheline-aligned. *
2598 * *
2599 ************************************************************************/
2600
2601typedef union ii_ibda0_u {
2602 uint64_t ii_ibda0_regval;
2603 struct {
2604 uint64_t i_rsvd_1 : 7;
2605 uint64_t i_addr : 42;
2606 uint64_t i_rsvd : 15;
2607 } ii_ibda0_fld_s;
2608} ii_ibda0_u_t;
2609
2610
2611/************************************************************************
2612 * *
2613 * Writing to this register sets up the attributes of the transfer *
2614 * and initiates the transfer operation. Reading this register has *
2615 * the side effect of terminating any transfer in progress. Note: *
2616 * stopping a transfer midstream could have an adverse impact on the *
2617 * other BTE. If a BTE stream has to be stopped (due to error *
2618 * handling for example), both BTE streams should be stopped and *
2619 * their transfers discarded. *
2620 * *
2621 ************************************************************************/
2622
2623typedef union ii_ibct0_u {
2624 uint64_t ii_ibct0_regval;
2625 struct {
2626 uint64_t i_zerofill : 1;
2627 uint64_t i_rsvd_2 : 3;
2628 uint64_t i_notify : 1;
2629 uint64_t i_rsvd_1 : 3;
2630 uint64_t i_poison : 1;
2631 uint64_t i_rsvd : 55;
2632 } ii_ibct0_fld_s;
2633} ii_ibct0_u_t;
2634
2635
2636/************************************************************************
2637 * *
2638 * This register contains the address to which the WINV is sent. *
2639 * This address has to be cache line aligned. *
2640 * *
2641 ************************************************************************/
2642
2643typedef union ii_ibna0_u {
2644 uint64_t ii_ibna0_regval;
2645 struct {
2646 uint64_t i_rsvd_1 : 7;
2647 uint64_t i_addr : 42;
2648 uint64_t i_rsvd : 15;
2649 } ii_ibna0_fld_s;
2650} ii_ibna0_u_t;
2651
2652
2653/************************************************************************
2654 * *
2655 * This register contains the programmable level as well as the node *
2656 * ID and PI unit of the processor to which the interrupt will be *
2657 * sent. *
2658 * *
2659 ************************************************************************/
2660
2661typedef union ii_ibia0_u {
2662 uint64_t ii_ibia0_regval;
2663 struct {
2664 uint64_t i_rsvd_2 : 1;
2665 uint64_t i_node_id : 11;
2666 uint64_t i_rsvd_1 : 4;
2667 uint64_t i_level : 7;
2668 uint64_t i_rsvd : 41;
2669 } ii_ibia0_fld_s;
2670} ii_ibia0_u_t;
2671
2672
2673/************************************************************************
2674 * *
2675 * Description: This register is used to set up the length for a *
2676 * transfer and then to monitor the progress of that transfer. This *
2677 * register needs to be initialized before a transfer is started. A *
2678 * legitimate write to this register will set the Busy bit, clear the *
2679 * Error bit, and initialize the length to the value desired. *
2680 * While the transfer is in progress, hardware will decrement the *
2681 * length field with each successful block that is copied. Once the *
2682 * transfer completes, hardware will clear the Busy bit. The length *
2683 * field will also contain the number of cache lines left to be *
2684 * transferred. *
2685 * *
2686 ************************************************************************/
2687
2688typedef union ii_ibls1_u {
2689 uint64_t ii_ibls1_regval;
2690 struct {
2691 uint64_t i_length : 16;
2692 uint64_t i_error : 1;
2693 uint64_t i_rsvd_1 : 3;
2694 uint64_t i_busy : 1;
2695 uint64_t i_rsvd : 43;
2696 } ii_ibls1_fld_s;
2697} ii_ibls1_u_t;
2698
2699
2700/************************************************************************
2701 * *
2702 * This register should be loaded before a transfer is started. The *
2703 * address to be loaded in bits 39:0 is the 40-bit TRex+ physical *
2704 * address as described in Section 1.3, Figure2 and Figure3. Since *
2705 * the bottom 7 bits of the address are always taken to be zero, BTE *
2706 * transfers are always cacheline-aligned. *
2707 * *
2708 ************************************************************************/
2709
2710typedef union ii_ibsa1_u {
2711 uint64_t ii_ibsa1_regval;
2712 struct {
2713 uint64_t i_rsvd_1 : 7;
2714 uint64_t i_addr : 33;
2715 uint64_t i_rsvd : 24;
2716 } ii_ibsa1_fld_s;
2717} ii_ibsa1_u_t;
2718
2719
2720/************************************************************************
2721 * *
2722 * This register should be loaded before a transfer is started. The *
2723 * address to be loaded in bits 39:0 is the 40-bit TRex+ physical *
2724 * address as described in Section 1.3, Figure2 and Figure3. Since *
2725 * the bottom 7 bits of the address are always taken to be zero, BTE *
2726 * transfers are always cacheline-aligned. *
2727 * *
2728 ************************************************************************/
2729
2730typedef union ii_ibda1_u {
2731 uint64_t ii_ibda1_regval;
2732 struct {
2733 uint64_t i_rsvd_1 : 7;
2734 uint64_t i_addr : 33;
2735 uint64_t i_rsvd : 24;
2736 } ii_ibda1_fld_s;
2737} ii_ibda1_u_t;
2738
2739
2740/************************************************************************
2741 * *
2742 * Writing to this register sets up the attributes of the transfer *
2743 * and initiates the transfer operation. Reading this register has *
2744 * the side effect of terminating any transfer in progress. Note: *
2745 * stopping a transfer midstream could have an adverse impact on the *
2746 * other BTE. If a BTE stream has to be stopped (due to error *
2747 * handling for example), both BTE streams should be stopped and *
2748 * their transfers discarded. *
2749 * *
2750 ************************************************************************/
2751
2752typedef union ii_ibct1_u {
2753 uint64_t ii_ibct1_regval;
2754 struct {
2755 uint64_t i_zerofill : 1;
2756 uint64_t i_rsvd_2 : 3;
2757 uint64_t i_notify : 1;
2758 uint64_t i_rsvd_1 : 3;
2759 uint64_t i_poison : 1;
2760 uint64_t i_rsvd : 55;
2761 } ii_ibct1_fld_s;
2762} ii_ibct1_u_t;
2763
2764
2765/************************************************************************
2766 * *
2767 * This register contains the address to which the WINV is sent. *
2768 * This address has to be cache line aligned. *
2769 * *
2770 ************************************************************************/
2771
2772typedef union ii_ibna1_u {
2773 uint64_t ii_ibna1_regval;
2774 struct {
2775 uint64_t i_rsvd_1 : 7;
2776 uint64_t i_addr : 33;
2777 uint64_t i_rsvd : 24;
2778 } ii_ibna1_fld_s;
2779} ii_ibna1_u_t;
2780
2781
2782/************************************************************************
2783 * *
2784 * This register contains the programmable level as well as the node *
2785 * ID and PI unit of the processor to which the interrupt will be *
2786 * sent. *
2787 * *
2788 ************************************************************************/
2789
2790typedef union ii_ibia1_u {
2791 uint64_t ii_ibia1_regval;
2792 struct {
2793 uint64_t i_pi_id : 1;
2794 uint64_t i_node_id : 8;
2795 uint64_t i_rsvd_1 : 7;
2796 uint64_t i_level : 7;
2797 uint64_t i_rsvd : 41;
2798 } ii_ibia1_fld_s;
2799} ii_ibia1_u_t;
2800
2801
2802/************************************************************************
2803 * *
2804 * This register defines the resources that feed information into *
2805 * the two performance counters located in the IO Performance *
2806 * Profiling Register. There are 17 different quantities that can be *
2807 * measured. Given these 17 different options, the two performance *
2808 * counters have 15 of them in common; menu selections 0 through 0xE *
2809 * are identical for each performance counter. As for the other two *
2810 * options, one is available from one performance counter and the *
2811 * other is available from the other performance counter. Hence, the *
2812 * II supports all 17*16=272 possible combinations of quantities to *
2813 * measure. *
2814 * *
2815 ************************************************************************/
2816
2817typedef union ii_ipcr_u {
2818 uint64_t ii_ipcr_regval;
2819 struct {
2820 uint64_t i_ippr0_c : 4;
2821 uint64_t i_ippr1_c : 4;
2822 uint64_t i_icct : 8;
2823 uint64_t i_rsvd : 48;
2824 } ii_ipcr_fld_s;
2825} ii_ipcr_u_t;
2826
2827
2828/************************************************************************
2829 * *
2830 * *
2831 * *
2832 ************************************************************************/
2833
2834typedef union ii_ippr_u {
2835 uint64_t ii_ippr_regval;
2836 struct {
2837 uint64_t i_ippr0 : 32;
2838 uint64_t i_ippr1 : 32;
2839 } ii_ippr_fld_s;
2840} ii_ippr_u_t;
2841
2842
2843
2844/**************************************************************************
2845 * *
2846 * The following defines which were not formed into structures are *
2847 * probably indentical to another register, and the name of the *
2848 * register is provided against each of these registers. This *
2849 * information needs to be checked carefully *
2850 * *
2851 * IIO_ICRB1_A IIO_ICRB0_A *
2852 * IIO_ICRB1_B IIO_ICRB0_B *
2853 * IIO_ICRB1_C IIO_ICRB0_C *
2854 * IIO_ICRB1_D IIO_ICRB0_D *
2855 * IIO_ICRB1_E IIO_ICRB0_E *
2856 * IIO_ICRB2_A IIO_ICRB0_A *
2857 * IIO_ICRB2_B IIO_ICRB0_B *
2858 * IIO_ICRB2_C IIO_ICRB0_C *
2859 * IIO_ICRB2_D IIO_ICRB0_D *
2860 * IIO_ICRB2_E IIO_ICRB0_E *
2861 * IIO_ICRB3_A IIO_ICRB0_A *
2862 * IIO_ICRB3_B IIO_ICRB0_B *
2863 * IIO_ICRB3_C IIO_ICRB0_C *
2864 * IIO_ICRB3_D IIO_ICRB0_D *
2865 * IIO_ICRB3_E IIO_ICRB0_E *
2866 * IIO_ICRB4_A IIO_ICRB0_A *
2867 * IIO_ICRB4_B IIO_ICRB0_B *
2868 * IIO_ICRB4_C IIO_ICRB0_C *
2869 * IIO_ICRB4_D IIO_ICRB0_D *
2870 * IIO_ICRB4_E IIO_ICRB0_E *
2871 * IIO_ICRB5_A IIO_ICRB0_A *
2872 * IIO_ICRB5_B IIO_ICRB0_B *
2873 * IIO_ICRB5_C IIO_ICRB0_C *
2874 * IIO_ICRB5_D IIO_ICRB0_D *
2875 * IIO_ICRB5_E IIO_ICRB0_E *
2876 * IIO_ICRB6_A IIO_ICRB0_A *
2877 * IIO_ICRB6_B IIO_ICRB0_B *
2878 * IIO_ICRB6_C IIO_ICRB0_C *
2879 * IIO_ICRB6_D IIO_ICRB0_D *
2880 * IIO_ICRB6_E IIO_ICRB0_E *
2881 * IIO_ICRB7_A IIO_ICRB0_A *
2882 * IIO_ICRB7_B IIO_ICRB0_B *
2883 * IIO_ICRB7_C IIO_ICRB0_C *
2884 * IIO_ICRB7_D IIO_ICRB0_D *
2885 * IIO_ICRB7_E IIO_ICRB0_E *
2886 * IIO_ICRB8_A IIO_ICRB0_A *
2887 * IIO_ICRB8_B IIO_ICRB0_B *
2888 * IIO_ICRB8_C IIO_ICRB0_C *
2889 * IIO_ICRB8_D IIO_ICRB0_D *
2890 * IIO_ICRB8_E IIO_ICRB0_E *
2891 * IIO_ICRB9_A IIO_ICRB0_A *
2892 * IIO_ICRB9_B IIO_ICRB0_B *
2893 * IIO_ICRB9_C IIO_ICRB0_C *
2894 * IIO_ICRB9_D IIO_ICRB0_D *
2895 * IIO_ICRB9_E IIO_ICRB0_E *
2896 * IIO_ICRBA_A IIO_ICRB0_A *
2897 * IIO_ICRBA_B IIO_ICRB0_B *
2898 * IIO_ICRBA_C IIO_ICRB0_C *
2899 * IIO_ICRBA_D IIO_ICRB0_D *
2900 * IIO_ICRBA_E IIO_ICRB0_E *
2901 * IIO_ICRBB_A IIO_ICRB0_A *
2902 * IIO_ICRBB_B IIO_ICRB0_B *
2903 * IIO_ICRBB_C IIO_ICRB0_C *
2904 * IIO_ICRBB_D IIO_ICRB0_D *
2905 * IIO_ICRBB_E IIO_ICRB0_E *
2906 * IIO_ICRBC_A IIO_ICRB0_A *
2907 * IIO_ICRBC_B IIO_ICRB0_B *
2908 * IIO_ICRBC_C IIO_ICRB0_C *
2909 * IIO_ICRBC_D IIO_ICRB0_D *
2910 * IIO_ICRBC_E IIO_ICRB0_E *
2911 * IIO_ICRBD_A IIO_ICRB0_A *
2912 * IIO_ICRBD_B IIO_ICRB0_B *
2913 * IIO_ICRBD_C IIO_ICRB0_C *
2914 * IIO_ICRBD_D IIO_ICRB0_D *
2915 * IIO_ICRBD_E IIO_ICRB0_E *
2916 * IIO_ICRBE_A IIO_ICRB0_A *
2917 * IIO_ICRBE_B IIO_ICRB0_B *
2918 * IIO_ICRBE_C IIO_ICRB0_C *
2919 * IIO_ICRBE_D IIO_ICRB0_D *
2920 * IIO_ICRBE_E IIO_ICRB0_E *
2921 * *
2922 **************************************************************************/
2923
2924
2925/*
2926 * Slightly friendlier names for some common registers.
2927 */
2928#define IIO_WIDGET IIO_WID /* Widget identification */
2929#define IIO_WIDGET_STAT IIO_WSTAT /* Widget status register */
2930#define IIO_WIDGET_CTRL IIO_WCR /* Widget control register */
2931#define IIO_PROTECT IIO_ILAPR /* IO interface protection */
2932#define IIO_PROTECT_OVRRD IIO_ILAPO /* IO protect override */
2933#define IIO_OUTWIDGET_ACCESS IIO_IOWA /* Outbound widget access */
2934#define IIO_INWIDGET_ACCESS IIO_IIWA /* Inbound widget access */
2935#define IIO_INDEV_ERR_MASK IIO_IIDEM /* Inbound device error mask */
2936#define IIO_LLP_CSR IIO_ILCSR /* LLP control and status */
2937#define IIO_LLP_LOG IIO_ILLR /* LLP log */
2938#define IIO_XTALKCC_TOUT IIO_IXCC /* Xtalk credit count timeout*/
2939#define IIO_XTALKTT_TOUT IIO_IXTT /* Xtalk tail timeout */
2940#define IIO_IO_ERR_CLR IIO_IECLR /* IO error clear */
2941#define IIO_IGFX_0 IIO_IGFX0
2942#define IIO_IGFX_1 IIO_IGFX1
2943#define IIO_IBCT_0 IIO_IBCT0
2944#define IIO_IBCT_1 IIO_IBCT1
2945#define IIO_IBLS_0 IIO_IBLS0
2946#define IIO_IBLS_1 IIO_IBLS1
2947#define IIO_IBSA_0 IIO_IBSA0
2948#define IIO_IBSA_1 IIO_IBSA1
2949#define IIO_IBDA_0 IIO_IBDA0
2950#define IIO_IBDA_1 IIO_IBDA1
2951#define IIO_IBNA_0 IIO_IBNA0
2952#define IIO_IBNA_1 IIO_IBNA1
2953#define IIO_IBIA_0 IIO_IBIA0
2954#define IIO_IBIA_1 IIO_IBIA1
2955#define IIO_IOPRB_0 IIO_IPRB0
2956
2957#define IIO_PRTE_A(_x) (IIO_IPRTE0_A + (8 * (_x)))
2958#define IIO_PRTE_B(_x) (IIO_IPRTE0_B + (8 * (_x)))
2959#define IIO_NUM_PRTES 8 /* Total number of PRB table entries */
2960#define IIO_WIDPRTE_A(x) IIO_PRTE_A(((x) - 8)) /* widget ID to its PRTE num */
2961#define IIO_WIDPRTE_B(x) IIO_PRTE_B(((x) - 8)) /* widget ID to its PRTE num */
2962
2963#define IIO_NUM_IPRBS (9)
2964
2965#define IIO_LLP_CSR_IS_UP 0x00002000
2966#define IIO_LLP_CSR_LLP_STAT_MASK 0x00003000
2967#define IIO_LLP_CSR_LLP_STAT_SHFT 12
2968
2969#define IIO_LLP_CB_MAX 0xffff /* in ILLR CB_CNT, Max Check Bit errors */
2970#define IIO_LLP_SN_MAX 0xffff /* in ILLR SN_CNT, Max Sequence Number errors */
2971
2972/* key to IIO_PROTECT_OVRRD */
2973#define IIO_PROTECT_OVRRD_KEY 0x53474972756c6573ull /* "SGIrules" */
2974
2975/* BTE register names */
2976#define IIO_BTE_STAT_0 IIO_IBLS_0 /* Also BTE length/status 0 */
2977#define IIO_BTE_SRC_0 IIO_IBSA_0 /* Also BTE source address 0 */
2978#define IIO_BTE_DEST_0 IIO_IBDA_0 /* Also BTE dest. address 0 */
2979#define IIO_BTE_CTRL_0 IIO_IBCT_0 /* Also BTE control/terminate 0 */
2980#define IIO_BTE_NOTIFY_0 IIO_IBNA_0 /* Also BTE notification 0 */
2981#define IIO_BTE_INT_0 IIO_IBIA_0 /* Also BTE interrupt 0 */
2982#define IIO_BTE_OFF_0 0 /* Base offset from BTE 0 regs. */
2983#define IIO_BTE_OFF_1 (IIO_IBLS_1 - IIO_IBLS_0) /* Offset from base to BTE 1 */
2984
2985/* BTE register offsets from base */
2986#define BTEOFF_STAT 0
2987#define BTEOFF_SRC (IIO_BTE_SRC_0 - IIO_BTE_STAT_0)
2988#define BTEOFF_DEST (IIO_BTE_DEST_0 - IIO_BTE_STAT_0)
2989#define BTEOFF_CTRL (IIO_BTE_CTRL_0 - IIO_BTE_STAT_0)
2990#define BTEOFF_NOTIFY (IIO_BTE_NOTIFY_0 - IIO_BTE_STAT_0)
2991#define BTEOFF_INT (IIO_BTE_INT_0 - IIO_BTE_STAT_0)
2992
2993
2994/* names used in shub diags */
2995#define IIO_BASE_BTE0 IIO_IBLS_0
2996#define IIO_BASE_BTE1 IIO_IBLS_1
2997
2998/*
2999 * Macro which takes the widget number, and returns the
3000 * IO PRB address of that widget.
3001 * value _x is expected to be a widget number in the range
3002 * 0, 8 - 0xF
3003 */
3004#define IIO_IOPRB(_x) (IIO_IOPRB_0 + ( ( (_x) < HUB_WIDGET_ID_MIN ? \
3005 (_x) : \
3006 (_x) - (HUB_WIDGET_ID_MIN-1)) << 3) )
3007
3008
3009/* GFX Flow Control Node/Widget Register */
3010#define IIO_IGFX_W_NUM_BITS 4 /* size of widget num field */
3011#define IIO_IGFX_W_NUM_MASK ((1<<IIO_IGFX_W_NUM_BITS)-1)
3012#define IIO_IGFX_W_NUM_SHIFT 0
3013#define IIO_IGFX_PI_NUM_BITS 1 /* size of PI num field */
3014#define IIO_IGFX_PI_NUM_MASK ((1<<IIO_IGFX_PI_NUM_BITS)-1)
3015#define IIO_IGFX_PI_NUM_SHIFT 4
3016#define IIO_IGFX_N_NUM_BITS 8 /* size of node num field */
3017#define IIO_IGFX_N_NUM_MASK ((1<<IIO_IGFX_N_NUM_BITS)-1)
3018#define IIO_IGFX_N_NUM_SHIFT 5
3019#define IIO_IGFX_P_NUM_BITS 1 /* size of processor num field */
3020#define IIO_IGFX_P_NUM_MASK ((1<<IIO_IGFX_P_NUM_BITS)-1)
3021#define IIO_IGFX_P_NUM_SHIFT 16
3022#define IIO_IGFX_INIT(widget, pi, node, cpu) (\
3023 (((widget) & IIO_IGFX_W_NUM_MASK) << IIO_IGFX_W_NUM_SHIFT) | \
3024 (((pi) & IIO_IGFX_PI_NUM_MASK)<< IIO_IGFX_PI_NUM_SHIFT)| \
3025 (((node) & IIO_IGFX_N_NUM_MASK) << IIO_IGFX_N_NUM_SHIFT) | \
3026 (((cpu) & IIO_IGFX_P_NUM_MASK) << IIO_IGFX_P_NUM_SHIFT))
3027
3028
3029/* Scratch registers (all bits available) */
3030#define IIO_SCRATCH_REG0 IIO_ISCR0
3031#define IIO_SCRATCH_REG1 IIO_ISCR1
3032#define IIO_SCRATCH_MASK 0xffffffffffffffffUL
3033
3034#define IIO_SCRATCH_BIT0_0 0x0000000000000001UL
3035#define IIO_SCRATCH_BIT0_1 0x0000000000000002UL
3036#define IIO_SCRATCH_BIT0_2 0x0000000000000004UL
3037#define IIO_SCRATCH_BIT0_3 0x0000000000000008UL
3038#define IIO_SCRATCH_BIT0_4 0x0000000000000010UL
3039#define IIO_SCRATCH_BIT0_5 0x0000000000000020UL
3040#define IIO_SCRATCH_BIT0_6 0x0000000000000040UL
3041#define IIO_SCRATCH_BIT0_7 0x0000000000000080UL
3042#define IIO_SCRATCH_BIT0_8 0x0000000000000100UL
3043#define IIO_SCRATCH_BIT0_9 0x0000000000000200UL
3044#define IIO_SCRATCH_BIT0_A 0x0000000000000400UL
3045
3046#define IIO_SCRATCH_BIT1_0 0x0000000000000001UL
3047#define IIO_SCRATCH_BIT1_1 0x0000000000000002UL
3048/* IO Translation Table Entries */
3049#define IIO_NUM_ITTES 7 /* ITTEs numbered 0..6 */
3050 /* Hw manuals number them 1..7! */
3051/*
3052 * IIO_IMEM Register fields.
3053 */
3054#define IIO_IMEM_W0ESD 0x1UL /* Widget 0 shut down due to error */
3055#define IIO_IMEM_B0ESD (1UL << 4) /* BTE 0 shut down due to error */
3056#define IIO_IMEM_B1ESD (1UL << 8) /* BTE 1 Shut down due to error */
3057
3058/*
3059 * As a permanent workaround for a bug in the PI side of the shub, we've
3060 * redefined big window 7 as small window 0.
3061 XXX does this still apply for SN1??
3062 */
3063#define HUB_NUM_BIG_WINDOW (IIO_NUM_ITTES - 1)
3064
3065/*
3066 * Use the top big window as a surrogate for the first small window
3067 */
3068#define SWIN0_BIGWIN HUB_NUM_BIG_WINDOW
3069
3070#define ILCSR_WARM_RESET 0x100
3071
3072/*
3073 * CRB manipulation macros
3074 * The CRB macros are slightly complicated, since there are up to
3075 * four registers associated with each CRB entry.
3076 */
3077#define IIO_NUM_CRBS 15 /* Number of CRBs */
3078#define IIO_NUM_PC_CRBS 4 /* Number of partial cache CRBs */
3079#define IIO_ICRB_OFFSET 8
3080#define IIO_ICRB_0 IIO_ICRB0_A
3081#define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */
3082/* XXX - This is now tuneable:
3083 #define IIO_FIRST_PC_ENTRY 12
3084 */
3085
3086#define IIO_ICRB_A(_x) ((u64)(IIO_ICRB_0 + (6 * IIO_ICRB_OFFSET * (_x))))
3087#define IIO_ICRB_B(_x) ((u64)((char *)IIO_ICRB_A(_x) + 1*IIO_ICRB_OFFSET))
3088#define IIO_ICRB_C(_x) ((u64)((char *)IIO_ICRB_A(_x) + 2*IIO_ICRB_OFFSET))
3089#define IIO_ICRB_D(_x) ((u64)((char *)IIO_ICRB_A(_x) + 3*IIO_ICRB_OFFSET))
3090#define IIO_ICRB_E(_x) ((u64)((char *)IIO_ICRB_A(_x) + 4*IIO_ICRB_OFFSET))
3091
3092#define TNUM_TO_WIDGET_DEV(_tnum) (_tnum & 0x7)
3093
3094/*
3095 * values for "ecode" field
3096 */
3097#define IIO_ICRB_ECODE_DERR 0 /* Directory error due to IIO access */
3098#define IIO_ICRB_ECODE_PERR 1 /* Poison error on IO access */
3099#define IIO_ICRB_ECODE_WERR 2 /* Write error by IIO access
3100 * e.g. WINV to a Read only line. */
3101#define IIO_ICRB_ECODE_AERR 3 /* Access error caused by IIO access */
3102#define IIO_ICRB_ECODE_PWERR 4 /* Error on partial write */
3103#define IIO_ICRB_ECODE_PRERR 5 /* Error on partial read */
3104#define IIO_ICRB_ECODE_TOUT 6 /* CRB timeout before deallocating */
3105#define IIO_ICRB_ECODE_XTERR 7 /* Incoming xtalk pkt had error bit */
3106
3107/*
3108 * Values for field imsgtype
3109 */
3110#define IIO_ICRB_IMSGT_XTALK 0 /* Incoming Meessage from Xtalk */
3111#define IIO_ICRB_IMSGT_BTE 1 /* Incoming message from BTE */
3112#define IIO_ICRB_IMSGT_SN1NET 2 /* Incoming message from SN1 net */
3113#define IIO_ICRB_IMSGT_CRB 3 /* Incoming message from CRB ??? */
3114
3115/*
3116 * values for field initiator.
3117 */
3118#define IIO_ICRB_INIT_XTALK 0 /* Message originated in xtalk */
3119#define IIO_ICRB_INIT_BTE0 0x1 /* Message originated in BTE 0 */
3120#define IIO_ICRB_INIT_SN1NET 0x2 /* Message originated in SN1net */
3121#define IIO_ICRB_INIT_CRB 0x3 /* Message originated in CRB ? */
3122#define IIO_ICRB_INIT_BTE1 0x5 /* MEssage originated in BTE 1 */
3123
3124/*
3125 * Number of credits Hub widget has while sending req/response to
3126 * xbow.
3127 * Value of 3 is required by Xbow 1.1
3128 * We may be able to increase this to 4 with Xbow 1.2.
3129 */
3130#define HUBII_XBOW_CREDIT 3
3131#define HUBII_XBOW_REV2_CREDIT 4
3132
3133/*
3134 * Number of credits that xtalk devices should use when communicating
3135 * with a SHub (depth of SHub's queue).
3136 */
3137#define HUB_CREDIT 4
3138
3139/*
3140 * Some IIO_PRB fields
3141 */
3142#define IIO_PRB_MULTI_ERR (1LL << 63)
3143#define IIO_PRB_SPUR_RD (1LL << 51)
3144#define IIO_PRB_SPUR_WR (1LL << 50)
3145#define IIO_PRB_RD_TO (1LL << 49)
3146#define IIO_PRB_ERROR (1LL << 48)
3147
3148/*************************************************************************
3149
3150 Some of the IIO field masks and shifts are defined here.
3151 This is in order to maintain compatibility in SN0 and SN1 code
3152
3153**************************************************************************/
3154
3155/*
3156 * ICMR register fields
3157 * (Note: the IIO_ICMR_P_CNT and IIO_ICMR_PC_VLD from Hub are not
3158 * present in SHub)
3159 */
3160
3161#define IIO_ICMR_CRB_VLD_SHFT 20
3162#define IIO_ICMR_CRB_VLD_MASK (0x7fffUL << IIO_ICMR_CRB_VLD_SHFT)
3163
3164#define IIO_ICMR_FC_CNT_SHFT 16
3165#define IIO_ICMR_FC_CNT_MASK (0xf << IIO_ICMR_FC_CNT_SHFT)
3166
3167#define IIO_ICMR_C_CNT_SHFT 4
3168#define IIO_ICMR_C_CNT_MASK (0xf << IIO_ICMR_C_CNT_SHFT)
3169
3170#define IIO_ICMR_PRECISE (1UL << 52)
3171#define IIO_ICMR_CLR_RPPD (1UL << 13)
3172#define IIO_ICMR_CLR_RQPD (1UL << 12)
3173
3174/*
3175 * IIO PIO Deallocation register field masks : (IIO_IPDR)
3176 XXX present but not needed in bedrock? See the manual.
3177 */
3178#define IIO_IPDR_PND (1 << 4)
3179
3180/*
3181 * IIO CRB deallocation register field masks: (IIO_ICDR)
3182 */
3183#define IIO_ICDR_PND (1 << 4)
3184
3185/*
3186 * IO BTE Length/Status (IIO_IBLS) register bit field definitions
3187 */
3188#define IBLS_BUSY (0x1UL << 20)
3189#define IBLS_ERROR_SHFT 16
3190#define IBLS_ERROR (0x1UL << IBLS_ERROR_SHFT)
3191#define IBLS_LENGTH_MASK 0xffff
3192
3193/*
3194 * IO BTE Control/Terminate register (IBCT) register bit field definitions
3195 */
3196#define IBCT_POISON (0x1UL << 8)
3197#define IBCT_NOTIFY (0x1UL << 4)
3198#define IBCT_ZFIL_MODE (0x1UL << 0)
3199
3200/*
3201 * IIO Incoming Error Packet Header (IIO_IIEPH1/IIO_IIEPH2)
3202 */
3203#define IIEPH1_VALID (1UL << 44)
3204#define IIEPH1_OVERRUN (1UL << 40)
3205#define IIEPH1_ERR_TYPE_SHFT 32
3206#define IIEPH1_ERR_TYPE_MASK 0xf
3207#define IIEPH1_SOURCE_SHFT 20
3208#define IIEPH1_SOURCE_MASK 11
3209#define IIEPH1_SUPPL_SHFT 8
3210#define IIEPH1_SUPPL_MASK 11
3211#define IIEPH1_CMD_SHFT 0
3212#define IIEPH1_CMD_MASK 7
3213
3214#define IIEPH2_TAIL (1UL << 40)
3215#define IIEPH2_ADDRESS_SHFT 0
3216#define IIEPH2_ADDRESS_MASK 38
3217
3218#define IIEPH1_ERR_SHORT_REQ 2
3219#define IIEPH1_ERR_SHORT_REPLY 3
3220#define IIEPH1_ERR_LONG_REQ 4
3221#define IIEPH1_ERR_LONG_REPLY 5
3222
3223/*
3224 * IO Error Clear register bit field definitions
3225 */
3226#define IECLR_PI1_FWD_INT (1UL << 31) /* clear PI1_FORWARD_INT in iidsr */
3227#define IECLR_PI0_FWD_INT (1UL << 30) /* clear PI0_FORWARD_INT in iidsr */
3228#define IECLR_SPUR_RD_HDR (1UL << 29) /* clear valid bit in ixss reg */
3229#define IECLR_BTE1 (1UL << 18) /* clear bte error 1 */
3230#define IECLR_BTE0 (1UL << 17) /* clear bte error 0 */
3231#define IECLR_CRAZY (1UL << 16) /* clear crazy bit in wstat reg */
3232#define IECLR_PRB_F (1UL << 15) /* clear err bit in PRB_F reg */
3233#define IECLR_PRB_E (1UL << 14) /* clear err bit in PRB_E reg */
3234#define IECLR_PRB_D (1UL << 13) /* clear err bit in PRB_D reg */
3235#define IECLR_PRB_C (1UL << 12) /* clear err bit in PRB_C reg */
3236#define IECLR_PRB_B (1UL << 11) /* clear err bit in PRB_B reg */
3237#define IECLR_PRB_A (1UL << 10) /* clear err bit in PRB_A reg */
3238#define IECLR_PRB_9 (1UL << 9) /* clear err bit in PRB_9 reg */
3239#define IECLR_PRB_8 (1UL << 8) /* clear err bit in PRB_8 reg */
3240#define IECLR_PRB_0 (1UL << 0) /* clear err bit in PRB_0 reg */
3241
3242/*
3243 * IIO CRB control register Fields: IIO_ICCR
3244 */
3245#define IIO_ICCR_PENDING (0x10000)
3246#define IIO_ICCR_CMD_MASK (0xFF)
3247#define IIO_ICCR_CMD_SHFT (7)
3248#define IIO_ICCR_CMD_NOP (0x0) /* No Op */
3249#define IIO_ICCR_CMD_WAKE (0x100) /* Reactivate CRB entry and process */
3250#define IIO_ICCR_CMD_TIMEOUT (0x200) /* Make CRB timeout & mark invalid */
3251#define IIO_ICCR_CMD_EJECT (0x400) /* Contents of entry written to memory
3252 * via a WB
3253 */
3254#define IIO_ICCR_CMD_FLUSH (0x800)
3255
3256/*
3257 *
3258 * CRB Register description.
3259 *
3260 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
3261 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
3262 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
3263 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
3264 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
3265 *
3266 * Many of the fields in CRB are status bits used by hardware
3267 * for implementation of the protocol. It's very dangerous to
3268 * mess around with the CRB registers.
3269 *
3270 * It's OK to read the CRB registers and try to make sense out of the
3271 * fields in CRB.
3272 *
3273 * Updating CRB requires all activities in Hub IIO to be quiesced.
3274 * otherwise, a write to CRB could corrupt other CRB entries.
3275 * CRBs are here only as a back door peek to shub IIO's status.
3276 * Quiescing implies no dmas no PIOs
3277 * either directly from the cpu or from sn0net.
3278 * this is not something that can be done easily. So, AVOID updating
3279 * CRBs.
3280 */
3281
3282/*
3283 * Easy access macros for CRBs, all 5 registers (A-E)
3284 */
3285typedef ii_icrb0_a_u_t icrba_t;
3286#define a_sidn ii_icrb0_a_fld_s.ia_sidn
3287#define a_tnum ii_icrb0_a_fld_s.ia_tnum
3288#define a_addr ii_icrb0_a_fld_s.ia_addr
3289#define a_valid ii_icrb0_a_fld_s.ia_vld
3290#define a_iow ii_icrb0_a_fld_s.ia_iow
3291#define a_regvalue ii_icrb0_a_regval
3292
3293typedef ii_icrb0_b_u_t icrbb_t;
3294#define b_use_old ii_icrb0_b_fld_s.ib_use_old
3295#define b_imsgtype ii_icrb0_b_fld_s.ib_imsgtype
3296#define b_imsg ii_icrb0_b_fld_s.ib_imsg
3297#define b_initiator ii_icrb0_b_fld_s.ib_init
3298#define b_exc ii_icrb0_b_fld_s.ib_exc
3299#define b_ackcnt ii_icrb0_b_fld_s.ib_ack_cnt
3300#define b_resp ii_icrb0_b_fld_s.ib_resp
3301#define b_ack ii_icrb0_b_fld_s.ib_ack
3302#define b_hold ii_icrb0_b_fld_s.ib_hold
3303#define b_wb ii_icrb0_b_fld_s.ib_wb
3304#define b_intvn ii_icrb0_b_fld_s.ib_intvn
3305#define b_stall_ib ii_icrb0_b_fld_s.ib_stall_ib
3306#define b_stall_int ii_icrb0_b_fld_s.ib_stall__intr
3307#define b_stall_bte_0 ii_icrb0_b_fld_s.ib_stall__bte_0
3308#define b_stall_bte_1 ii_icrb0_b_fld_s.ib_stall__bte_1
3309#define b_error ii_icrb0_b_fld_s.ib_error
3310#define b_ecode ii_icrb0_b_fld_s.ib_errcode
3311#define b_lnetuce ii_icrb0_b_fld_s.ib_ln_uce
3312#define b_mark ii_icrb0_b_fld_s.ib_mark
3313#define b_xerr ii_icrb0_b_fld_s.ib_xt_err
3314#define b_regvalue ii_icrb0_b_regval
3315
3316typedef ii_icrb0_c_u_t icrbc_t;
3317#define c_suppl ii_icrb0_c_fld_s.ic_suppl
3318#define c_barrop ii_icrb0_c_fld_s.ic_bo
3319#define c_doresp ii_icrb0_c_fld_s.ic_resprqd
3320#define c_gbr ii_icrb0_c_fld_s.ic_gbr
3321#define c_btenum ii_icrb0_c_fld_s.ic_bte_num
3322#define c_cohtrans ii_icrb0_c_fld_s.ic_ct
3323#define c_xtsize ii_icrb0_c_fld_s.ic_size
3324#define c_source ii_icrb0_c_fld_s.ic_source
3325#define c_regvalue ii_icrb0_c_regval
3326
3327
3328typedef ii_icrb0_d_u_t icrbd_t;
3329#define d_sleep ii_icrb0_d_fld_s.id_sleep
3330#define d_pricnt ii_icrb0_d_fld_s.id_pr_cnt
3331#define d_pripsc ii_icrb0_d_fld_s.id_pr_psc
3332#define d_bteop ii_icrb0_d_fld_s.id_bte_op
3333#define d_bteaddr ii_icrb0_d_fld_s.id_pa_be /* ic_pa_be fld has 2 names*/
3334#define d_benable ii_icrb0_d_fld_s.id_pa_be /* ic_pa_be fld has 2 names*/
3335#define d_regvalue ii_icrb0_d_regval
3336
3337typedef ii_icrb0_e_u_t icrbe_t;
3338#define icrbe_ctxtvld ii_icrb0_e_fld_s.ie_cvld
3339#define icrbe_toutvld ii_icrb0_e_fld_s.ie_tvld
3340#define icrbe_context ii_icrb0_e_fld_s.ie_context
3341#define icrbe_timeout ii_icrb0_e_fld_s.ie_timeout
3342#define e_regvalue ii_icrb0_e_regval
3343
3344
3345/* Number of widgets supported by shub */
3346#define HUB_NUM_WIDGET 9
3347#define HUB_WIDGET_ID_MIN 0x8
3348#define HUB_WIDGET_ID_MAX 0xf
3349
3350#define HUB_WIDGET_PART_NUM 0xc120
3351#define MAX_HUBS_PER_XBOW 2
3352
3353/* A few more #defines for backwards compatibility */
3354#define iprb_t ii_iprb0_u_t
3355#define iprb_regval ii_iprb0_regval
3356#define iprb_mult_err ii_iprb0_fld_s.i_mult_err
3357#define iprb_spur_rd ii_iprb0_fld_s.i_spur_rd
3358#define iprb_spur_wr ii_iprb0_fld_s.i_spur_wr
3359#define iprb_rd_to ii_iprb0_fld_s.i_rd_to
3360#define iprb_ovflow ii_iprb0_fld_s.i_of_cnt
3361#define iprb_error ii_iprb0_fld_s.i_error
3362#define iprb_ff ii_iprb0_fld_s.i_f
3363#define iprb_mode ii_iprb0_fld_s.i_m
3364#define iprb_bnakctr ii_iprb0_fld_s.i_nb
3365#define iprb_anakctr ii_iprb0_fld_s.i_na
3366#define iprb_xtalkctr ii_iprb0_fld_s.i_c
3367
3368#define LNK_STAT_WORKING 0x2 /* LLP is working */
3369
3370#define IIO_WSTAT_ECRAZY (1ULL << 32) /* Hub gone crazy */
3371#define IIO_WSTAT_TXRETRY (1ULL << 9) /* Hub Tx Retry timeout */
3372#define IIO_WSTAT_TXRETRY_MASK (0x7F) /* should be 0xFF?? */
3373#define IIO_WSTAT_TXRETRY_SHFT (16)
3374#define IIO_WSTAT_TXRETRY_CNT(w) (((w) >> IIO_WSTAT_TXRETRY_SHFT) & \
3375 IIO_WSTAT_TXRETRY_MASK)
3376
3377/* Number of II perf. counters we can multiplex at once */
3378
3379#define IO_PERF_SETS 32
3380
3381/* Bit for the widget in inbound access register */
3382#define IIO_IIWA_WIDGET(_w) ((uint64_t)(1ULL << _w))
3383/* Bit for the widget in outbound access register */
3384#define IIO_IOWA_WIDGET(_w) ((uint64_t)(1ULL << _w))
3385
3386/* NOTE: The following define assumes that we are going to get
3387 * widget numbers from 8 thru F and the device numbers within
3388 * widget from 0 thru 7.
3389 */
3390#define IIO_IIDEM_WIDGETDEV_MASK(w, d) ((uint64_t)(1ULL << (8 * ((w) - 8) + (d))))
3391
3392/* IO Interrupt Destination Register */
3393#define IIO_IIDSR_SENT_SHIFT 28
3394#define IIO_IIDSR_SENT_MASK 0x30000000
3395#define IIO_IIDSR_ENB_SHIFT 24
3396#define IIO_IIDSR_ENB_MASK 0x01000000
3397#define IIO_IIDSR_NODE_SHIFT 9
3398#define IIO_IIDSR_NODE_MASK 0x000ff700
3399#define IIO_IIDSR_PI_ID_SHIFT 8
3400#define IIO_IIDSR_PI_ID_MASK 0x00000100
3401#define IIO_IIDSR_LVL_SHIFT 0
3402#define IIO_IIDSR_LVL_MASK 0x000000ff
3403
3404/* Xtalk timeout threshhold register (IIO_IXTT) */
3405#define IXTT_RRSP_TO_SHFT 55 /* read response timeout */
3406#define IXTT_RRSP_TO_MASK (0x1FULL << IXTT_RRSP_TO_SHFT)
3407#define IXTT_RRSP_PS_SHFT 32 /* read responsed TO prescalar */
3408#define IXTT_RRSP_PS_MASK (0x7FFFFFULL << IXTT_RRSP_PS_SHFT)
3409#define IXTT_TAIL_TO_SHFT 0 /* tail timeout counter threshold */
3410#define IXTT_TAIL_TO_MASK (0x3FFFFFFULL << IXTT_TAIL_TO_SHFT)
3411
3412/*
3413 * The IO LLP control status register and widget control register
3414 */
3415
3416typedef union hubii_wcr_u {
3417 uint64_t wcr_reg_value;
3418 struct {
3419 uint64_t wcr_widget_id: 4, /* LLP crossbar credit */
3420 wcr_tag_mode: 1, /* Tag mode */
3421 wcr_rsvd1: 8, /* Reserved */
3422 wcr_xbar_crd: 3, /* LLP crossbar credit */
3423 wcr_f_bad_pkt: 1, /* Force bad llp pkt enable */
3424 wcr_dir_con: 1, /* widget direct connect */
3425 wcr_e_thresh: 5, /* elasticity threshold */
3426 wcr_rsvd: 41; /* unused */
3427 } wcr_fields_s;
3428} hubii_wcr_t;
3429
3430#define iwcr_dir_con wcr_fields_s.wcr_dir_con
3431
3432/* The structures below are defined to extract and modify the ii
3433performance registers */
3434
3435/* io_perf_sel allows the caller to specify what tests will be
3436 performed */
3437
3438typedef union io_perf_sel {
3439 uint64_t perf_sel_reg;
3440 struct {
3441 uint64_t perf_ippr0 : 4,
3442 perf_ippr1 : 4,
3443 perf_icct : 8,
3444 perf_rsvd : 48;
3445 } perf_sel_bits;
3446} io_perf_sel_t;
3447
3448/* io_perf_cnt is to extract the count from the shub registers. Due to
3449 hardware problems there is only one counter, not two. */
3450
3451typedef union io_perf_cnt {
3452 uint64_t perf_cnt;
3453 struct {
3454 uint64_t perf_cnt : 20,
3455 perf_rsvd2 : 12,
3456 perf_rsvd1 : 32;
3457 } perf_cnt_bits;
3458
3459} io_perf_cnt_t;
3460
3461typedef union iprte_a {
3462 uint64_t entry;
3463 struct {
3464 uint64_t i_rsvd_1 : 3;
3465 uint64_t i_addr : 38;
3466 uint64_t i_init : 3;
3467 uint64_t i_source : 8;
3468 uint64_t i_rsvd : 2;
3469 uint64_t i_widget : 4;
3470 uint64_t i_to_cnt : 5;
3471 uint64_t i_vld : 1;
3472 } iprte_fields;
3473} iprte_a_t;
3474
3475#endif /* _ASM_IA64_SN_SHUBIO_H */
3476
diff --git a/include/asm-ia64/sn/simulator.h b/include/asm-ia64/sn/simulator.h
new file mode 100644
index 000000000000..78eb4f869c8b
--- /dev/null
+++ b/include/asm-ia64/sn/simulator.h
@@ -0,0 +1,27 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 * Copyright (C) 2000-2004 Silicon Graphics, Inc. All rights reserved.
6 */
7
8#ifndef _ASM_IA64_SN_SIMULATOR_H
9#define _ASM_IA64_SN_SIMULATOR_H
10
11#include <linux/config.h>
12
13#ifdef CONFIG_IA64_SGI_SN_SIM
14
15#define SNMAGIC 0xaeeeeeee8badbeefL
16#define IS_RUNNING_ON_SIMULATOR() ({long sn; asm("mov %0=cpuid[%1]" : "=r"(sn) : "r"(2)); sn == SNMAGIC;})
17
18#define SIMULATOR_SLEEP() asm("nop.i 0x8beef")
19
20#else
21
22#define IS_RUNNING_ON_SIMULATOR() (0)
23#define SIMULATOR_SLEEP()
24
25#endif
26
27#endif /* _ASM_IA64_SN_SIMULATOR_H */
diff --git a/include/asm-ia64/sn/sn2/sn_hwperf.h b/include/asm-ia64/sn/sn2/sn_hwperf.h
new file mode 100644
index 000000000000..b0c4d6dd77ba
--- /dev/null
+++ b/include/asm-ia64/sn/sn2/sn_hwperf.h
@@ -0,0 +1,226 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
7 *
8 * Data types used by the SN_SAL_HWPERF_OP SAL call for monitoring
9 * SGI Altix node and router hardware
10 *
11 * Mark Goodwin <markgw@sgi.com> Mon Aug 30 12:23:46 EST 2004
12 */
13
14#ifndef SN_HWPERF_H
15#define SN_HWPERF_H
16
17/*
18 * object structure. SN_HWPERF_ENUM_OBJECTS and SN_HWPERF_GET_CPU_INFO
19 * return an array of these. Do not change this without also
20 * changing the corresponding SAL code.
21 */
22#define SN_HWPERF_MAXSTRING 128
23struct sn_hwperf_object_info {
24 u32 id;
25 union {
26 struct {
27 u64 this_part:1;
28 u64 is_shared:1;
29 } fields;
30 struct {
31 u64 flags;
32 u64 reserved;
33 } b;
34 } f;
35 char name[SN_HWPERF_MAXSTRING];
36 char location[SN_HWPERF_MAXSTRING];
37 u32 ports;
38};
39
40#define sn_hwp_this_part f.fields.this_part
41#define sn_hwp_is_shared f.fields.is_shared
42#define sn_hwp_flags f.b.flags
43
44/* macros for object classification */
45#define SN_HWPERF_IS_NODE(x) ((x) && strstr((x)->name, "SHub"))
46#define SN_HWPERF_IS_IONODE(x) ((x) && strstr((x)->name, "TIO"))
47#define SN_HWPERF_IS_ROUTER(x) ((x) && strstr((x)->name, "Router"))
48#define SN_HWPERF_IS_NL3ROUTER(x) ((x) && strstr((x)->name, "NL3Router"))
49#define SN_HWPERF_FOREIGN(x) ((x) && !(x)->sn_hwp_this_part && !(x)->sn_hwp_is_shared)
50#define SN_HWPERF_SAME_OBJTYPE(x,y) ((SN_HWPERF_IS_NODE(x) && SN_HWPERF_IS_NODE(y)) ||\
51 (SN_HWPERF_IS_IONODE(x) && SN_HWPERF_IS_IONODE(y)) ||\
52 (SN_HWPERF_IS_ROUTER(x) && SN_HWPERF_IS_ROUTER(y)))
53
54/* numa port structure, SN_HWPERF_ENUM_PORTS returns an array of these */
55struct sn_hwperf_port_info {
56 u32 port;
57 u32 conn_id;
58 u32 conn_port;
59};
60
61/* for HWPERF_{GET,SET}_MMRS */
62struct sn_hwperf_data {
63 u64 addr;
64 u64 data;
65};
66
67/* user ioctl() argument, see below */
68struct sn_hwperf_ioctl_args {
69 u64 arg; /* argument, usually an object id */
70 u64 sz; /* size of transfer */
71 void *ptr; /* pointer to source/target */
72 u32 v0; /* second return value */
73};
74
75/*
76 * For SN_HWPERF_{GET,SET}_MMRS and SN_HWPERF_OBJECT_DISTANCE,
77 * sn_hwperf_ioctl_args.arg can be used to specify a CPU on which
78 * to call SAL, and whether to use an interprocessor interrupt
79 * or task migration in order to do so. If the CPU specified is
80 * SN_HWPERF_ARG_ANY_CPU, then the current CPU will be used.
81 */
82#define SN_HWPERF_ARG_ANY_CPU 0x7fffffffUL
83#define SN_HWPERF_ARG_CPU_MASK 0x7fffffff00000000ULL
84#define SN_HWPERF_ARG_USE_IPI_MASK 0x8000000000000000ULL
85#define SN_HWPERF_ARG_OBJID_MASK 0x00000000ffffffffULL
86
87/*
88 * ioctl requests on the "sn_hwperf" misc device that call SAL.
89 */
90#define SN_HWPERF_OP_MEM_COPYIN 0x1000
91#define SN_HWPERF_OP_MEM_COPYOUT 0x2000
92#define SN_HWPERF_OP_MASK 0x0fff
93
94/*
95 * Determine mem requirement.
96 * arg don't care
97 * sz 8
98 * p pointer to u64 integer
99 */
100#define SN_HWPERF_GET_HEAPSIZE 1
101
102/*
103 * Install mem for SAL drvr
104 * arg don't care
105 * sz sizeof buffer pointed to by p
106 * p pointer to buffer for scratch area
107 */
108#define SN_HWPERF_INSTALL_HEAP 2
109
110/*
111 * Determine number of objects
112 * arg don't care
113 * sz 8
114 * p pointer to u64 integer
115 */
116#define SN_HWPERF_OBJECT_COUNT (10|SN_HWPERF_OP_MEM_COPYOUT)
117
118/*
119 * Determine object "distance", relative to a cpu. This operation can
120 * execute on a designated logical cpu number, using either an IPI or
121 * via task migration. If the cpu number is SN_HWPERF_ANY_CPU, then
122 * the current CPU is used. See the SN_HWPERF_ARG_* macros above.
123 *
124 * arg bitmap of IPI flag, cpu number and object id
125 * sz 8
126 * p pointer to u64 integer
127 */
128#define SN_HWPERF_OBJECT_DISTANCE (11|SN_HWPERF_OP_MEM_COPYOUT)
129
130/*
131 * Enumerate objects. Special case if sz == 8, returns the required
132 * buffer size.
133 * arg don't care
134 * sz sizeof buffer pointed to by p
135 * p pointer to array of struct sn_hwperf_object_info
136 */
137#define SN_HWPERF_ENUM_OBJECTS (12|SN_HWPERF_OP_MEM_COPYOUT)
138
139/*
140 * Enumerate NumaLink ports for an object. Special case if sz == 8,
141 * returns the required buffer size.
142 * arg object id
143 * sz sizeof buffer pointed to by p
144 * p pointer to array of struct sn_hwperf_port_info
145 */
146#define SN_HWPERF_ENUM_PORTS (13|SN_HWPERF_OP_MEM_COPYOUT)
147
148/*
149 * SET/GET memory mapped registers. These operations can execute
150 * on a designated logical cpu number, using either an IPI or via
151 * task migration. If the cpu number is SN_HWPERF_ANY_CPU, then
152 * the current CPU is used. See the SN_HWPERF_ARG_* macros above.
153 *
154 * arg bitmap of ipi flag, cpu number and object id
155 * sz sizeof buffer pointed to by p
156 * p pointer to array of struct sn_hwperf_data
157 */
158#define SN_HWPERF_SET_MMRS (14|SN_HWPERF_OP_MEM_COPYIN)
159#define SN_HWPERF_GET_MMRS (15|SN_HWPERF_OP_MEM_COPYOUT| \
160 SN_HWPERF_OP_MEM_COPYIN)
161/*
162 * Lock a shared object
163 * arg object id
164 * sz don't care
165 * p don't care
166 */
167#define SN_HWPERF_ACQUIRE 16
168
169/*
170 * Unlock a shared object
171 * arg object id
172 * sz don't care
173 * p don't care
174 */
175#define SN_HWPERF_RELEASE 17
176
177/*
178 * Break a lock on a shared object
179 * arg object id
180 * sz don't care
181 * p don't care
182 */
183#define SN_HWPERF_FORCE_RELEASE 18
184
185/*
186 * ioctl requests on "sn_hwperf" that do not call SAL
187 */
188
189/*
190 * get cpu info as an array of hwperf_object_info_t.
191 * id is logical CPU number, name is description, location
192 * is geoid (e.g. 001c04#1c). Special case if sz == 8,
193 * returns the required buffer size.
194 *
195 * arg don't care
196 * sz sizeof buffer pointed to by p
197 * p pointer to array of struct sn_hwperf_object_info
198 */
199#define SN_HWPERF_GET_CPU_INFO (100|SN_HWPERF_OP_MEM_COPYOUT)
200
201/*
202 * Given an object id, return it's node number (aka cnode).
203 * arg object id
204 * sz 8
205 * p pointer to u64 integer
206 */
207#define SN_HWPERF_GET_OBJ_NODE (101|SN_HWPERF_OP_MEM_COPYOUT)
208
209/*
210 * Given a node number (cnode), return it's nasid.
211 * arg ordinal node number (aka cnodeid)
212 * sz 8
213 * p pointer to u64 integer
214 */
215#define SN_HWPERF_GET_NODE_NASID (102|SN_HWPERF_OP_MEM_COPYOUT)
216
217/* return codes */
218#define SN_HWPERF_OP_OK 0
219#define SN_HWPERF_OP_NOMEM 1
220#define SN_HWPERF_OP_NO_PERM 2
221#define SN_HWPERF_OP_IO_ERROR 3
222#define SN_HWPERF_OP_BUSY 4
223#define SN_HWPERF_OP_RECONFIGURE 253
224#define SN_HWPERF_OP_INVAL 254
225
226#endif /* SN_HWPERF_H */
diff --git a/include/asm-ia64/sn/sn_cpuid.h b/include/asm-ia64/sn/sn_cpuid.h
new file mode 100644
index 000000000000..685435af170d
--- /dev/null
+++ b/include/asm-ia64/sn/sn_cpuid.h
@@ -0,0 +1,144 @@
1/*
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) 2000-2004 Silicon Graphics, Inc. All rights reserved.
8 */
9
10
11#ifndef _ASM_IA64_SN_SN_CPUID_H
12#define _ASM_IA64_SN_SN_CPUID_H
13
14#include <linux/config.h>
15#include <linux/smp.h>
16#include <asm/sn/addrs.h>
17#include <asm/sn/pda.h>
18#include <asm/intrinsics.h>
19
20
21/*
22 * Functions for converting between cpuids, nodeids and NASIDs.
23 *
24 * These are for SGI platforms only.
25 *
26 */
27
28
29
30
31/*
32 * Definitions of terms (these definitions are for IA64 ONLY. Other architectures
33 * use cpuid/cpunum quite defferently):
34 *
35 * CPUID - a number in range of 0..NR_CPUS-1 that uniquely identifies
36 * the cpu. The value cpuid has no significance on IA64 other than
37 * the boot cpu is 0.
38 * smp_processor_id() returns the cpuid of the current cpu.
39 *
40 * CPU_PHYSICAL_ID (also known as HARD_PROCESSOR_ID)
41 * This is the same as 31:24 of the processor LID register
42 * hard_smp_processor_id()- cpu_physical_id of current processor
43 * cpu_physical_id(cpuid) - convert a <cpuid> to a <physical_cpuid>
44 * cpu_logical_id(phy_id) - convert a <physical_cpuid> to a <cpuid>
45 * * not real efficient - don't use in perf critical code
46 *
47 * SLICE - a number in the range of 0 - 3 (typically) that represents the
48 * cpu number on a brick.
49 *
50 * SUBNODE - (almost obsolete) the number of the FSB that a cpu is
51 * connected to. This is also the same as the PI number. Usually 0 or 1.
52 *
53 * NOTE!!!: the value of the bits in the cpu physical id (SAPICid or LID) of a cpu has no
54 * significance. The SAPIC id (LID) is a 16-bit cookie that has meaning only to the PROM.
55 *
56 *
57 * The macros convert between cpu physical ids & slice/nasid/cnodeid.
58 * These terms are described below:
59 *
60 *
61 * Brick
62 * ----- ----- ----- ----- CPU
63 * | 0 | | 1 | | 0 | | 1 | SLICE
64 * ----- ----- ----- -----
65 * | | | |
66 * | | | |
67 * 0 | | 2 0 | | 2 FSB SLOT
68 * ------- -------
69 * | |
70 * | |
71 * | |
72 * ------------ -------------
73 * | | | |
74 * | SHUB | | SHUB | NASID (0..MAX_NASIDS)
75 * | |----- | | CNODEID (0..num_compact_nodes-1)
76 * | | | |
77 * | | | |
78 * ------------ -------------
79 * | |
80 *
81 *
82 */
83
84#ifndef CONFIG_SMP
85#define cpu_physical_id(cpuid) ((ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff)
86#endif
87
88
89#define get_node_number(addr) NASID_GET(addr)
90
91/*
92 * NOTE: on non-MP systems, only cpuid 0 exists
93 */
94
95extern short physical_node_map[]; /* indexed by nasid to get cnode */
96
97/*
98 * Macros for retrieving info about current cpu
99 */
100#define get_nasid() (nodepda->phys_cpuid[smp_processor_id()].nasid)
101#define get_subnode() (nodepda->phys_cpuid[smp_processor_id()].subnode)
102#define get_slice() (nodepda->phys_cpuid[smp_processor_id()].slice)
103#define get_cnode() (nodepda->phys_cpuid[smp_processor_id()].cnode)
104#define get_sapicid() ((ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff)
105
106/*
107 * Macros for retrieving info about an arbitrary cpu
108 * cpuid - logical cpu id
109 */
110#define cpuid_to_nasid(cpuid) (nodepda->phys_cpuid[cpuid].nasid)
111#define cpuid_to_subnode(cpuid) (nodepda->phys_cpuid[cpuid].subnode)
112#define cpuid_to_slice(cpuid) (nodepda->phys_cpuid[cpuid].slice)
113#define cpuid_to_cnodeid(cpuid) (physical_node_map[cpuid_to_nasid(cpuid)])
114
115
116/*
117 * Dont use the following in performance critical code. They require scans
118 * of potentially large tables.
119 */
120extern int nasid_slice_to_cpuid(int, int);
121#define nasid_slice_to_cpu_physical_id(nasid, slice) \
122 cpu_physical_id(nasid_slice_to_cpuid(nasid, slice))
123
124/*
125 * cnodeid_to_nasid - convert a cnodeid to a NASID
126 * Macro relies on pg_data for a node being on the node itself.
127 * Just extract the NASID from the pointer.
128 *
129 */
130#define cnodeid_to_nasid(cnodeid) pda->cnodeid_to_nasid_table[cnodeid]
131
132/*
133 * nasid_to_cnodeid - convert a NASID to a cnodeid
134 */
135#define nasid_to_cnodeid(nasid) (physical_node_map[nasid])
136
137/*
138 * partition_coherence_id - get the coherence ID of the current partition
139 */
140extern u8 sn_coherency_id;
141#define partition_coherence_id() (sn_coherency_id)
142
143#endif /* _ASM_IA64_SN_SN_CPUID_H */
144
diff --git a/include/asm-ia64/sn/sn_fru.h b/include/asm-ia64/sn/sn_fru.h
new file mode 100644
index 000000000000..8c21ac3f0156
--- /dev/null
+++ b/include/asm-ia64/sn/sn_fru.h
@@ -0,0 +1,44 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992-1997,1999-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_SN_FRU_H
9#define _ASM_IA64_SN_SN_FRU_H
10
11#define MAX_DIMMS 8 /* max # of dimm banks */
12#define MAX_PCIDEV 8 /* max # of pci devices on a pci bus */
13
14typedef unsigned char confidence_t;
15
16typedef struct kf_mem_s {
17 confidence_t km_confidence; /* confidence level that the memory is bad
18 * is this necessary ?
19 */
20 confidence_t km_dimm[MAX_DIMMS];
21 /* confidence level that dimm[i] is bad
22 *I think this is the right number
23 */
24
25} kf_mem_t;
26
27typedef struct kf_cpu_s {
28 confidence_t kc_confidence; /* confidence level that cpu is bad */
29 confidence_t kc_icache; /* confidence level that instr. cache is bad */
30 confidence_t kc_dcache; /* confidence level that data cache is bad */
31 confidence_t kc_scache; /* confidence level that sec. cache is bad */
32 confidence_t kc_sysbus; /* confidence level that sysad/cmd/state bus is bad */
33} kf_cpu_t;
34
35
36typedef struct kf_pci_bus_s {
37 confidence_t kpb_belief; /* confidence level that the pci bus is bad */
38 confidence_t kpb_pcidev_belief[MAX_PCIDEV];
39 /* confidence level that the pci dev is bad */
40} kf_pci_bus_t;
41
42
43#endif /* _ASM_IA64_SN_SN_FRU_H */
44
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
new file mode 100644
index 000000000000..88c31b53dc09
--- /dev/null
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -0,0 +1,1015 @@
1#ifndef _ASM_IA64_SN_SN_SAL_H
2#define _ASM_IA64_SN_SN_SAL_H
3
4/*
5 * System Abstraction Layer definitions for IA64
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All rights reserved.
12 */
13
14
15#include <linux/config.h>
16#include <asm/sal.h>
17#include <asm/sn/sn_cpuid.h>
18#include <asm/sn/arch.h>
19#include <asm/sn/geo.h>
20#include <asm/sn/nodepda.h>
21#include <asm/sn/shub_mmr.h>
22
23// SGI Specific Calls
24#define SN_SAL_POD_MODE 0x02000001
25#define SN_SAL_SYSTEM_RESET 0x02000002
26#define SN_SAL_PROBE 0x02000003
27#define SN_SAL_GET_MASTER_NASID 0x02000004
28#define SN_SAL_GET_KLCONFIG_ADDR 0x02000005
29#define SN_SAL_LOG_CE 0x02000006
30#define SN_SAL_REGISTER_CE 0x02000007
31#define SN_SAL_GET_PARTITION_ADDR 0x02000009
32#define SN_SAL_XP_ADDR_REGION 0x0200000f
33#define SN_SAL_NO_FAULT_ZONE_VIRTUAL 0x02000010
34#define SN_SAL_NO_FAULT_ZONE_PHYSICAL 0x02000011
35#define SN_SAL_PRINT_ERROR 0x02000012
36#define SN_SAL_SET_ERROR_HANDLING_FEATURES 0x0200001a // reentrant
37#define SN_SAL_GET_FIT_COMPT 0x0200001b // reentrant
38#define SN_SAL_GET_SN_INFO 0x0200001c
39#define SN_SAL_GET_SAPIC_INFO 0x0200001d
40#define SN_SAL_CONSOLE_PUTC 0x02000021
41#define SN_SAL_CONSOLE_GETC 0x02000022
42#define SN_SAL_CONSOLE_PUTS 0x02000023
43#define SN_SAL_CONSOLE_GETS 0x02000024
44#define SN_SAL_CONSOLE_GETS_TIMEOUT 0x02000025
45#define SN_SAL_CONSOLE_POLL 0x02000026
46#define SN_SAL_CONSOLE_INTR 0x02000027
47#define SN_SAL_CONSOLE_PUTB 0x02000028
48#define SN_SAL_CONSOLE_XMIT_CHARS 0x0200002a
49#define SN_SAL_CONSOLE_READC 0x0200002b
50#define SN_SAL_SYSCTL_MODID_GET 0x02000031
51#define SN_SAL_SYSCTL_GET 0x02000032
52#define SN_SAL_SYSCTL_IOBRICK_MODULE_GET 0x02000033
53#define SN_SAL_SYSCTL_IO_PORTSPEED_GET 0x02000035
54#define SN_SAL_SYSCTL_SLAB_GET 0x02000036
55#define SN_SAL_BUS_CONFIG 0x02000037
56#define SN_SAL_SYS_SERIAL_GET 0x02000038
57#define SN_SAL_PARTITION_SERIAL_GET 0x02000039
58#define SN_SAL_SYSCTL_PARTITION_GET 0x0200003a
59#define SN_SAL_SYSTEM_POWER_DOWN 0x0200003b
60#define SN_SAL_GET_MASTER_BASEIO_NASID 0x0200003c
61#define SN_SAL_COHERENCE 0x0200003d
62#define SN_SAL_MEMPROTECT 0x0200003e
63#define SN_SAL_SYSCTL_FRU_CAPTURE 0x0200003f
64
65#define SN_SAL_SYSCTL_IOBRICK_PCI_OP 0x02000042 // reentrant
66#define SN_SAL_IROUTER_OP 0x02000043
67#define SN_SAL_IOIF_INTERRUPT 0x0200004a
68#define SN_SAL_HWPERF_OP 0x02000050 // lock
69#define SN_SAL_IOIF_ERROR_INTERRUPT 0x02000051
70
71#define SN_SAL_IOIF_SLOT_ENABLE 0x02000053
72#define SN_SAL_IOIF_SLOT_DISABLE 0x02000054
73#define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055
74#define SN_SAL_IOIF_GET_PCIBUS_INFO 0x02000056
75#define SN_SAL_IOIF_GET_PCIDEV_INFO 0x02000057
76#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058
77
78#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060
79
80
81/*
82 * Service-specific constants
83 */
84
85/* Console interrupt manipulation */
86 /* action codes */
87#define SAL_CONSOLE_INTR_OFF 0 /* turn the interrupt off */
88#define SAL_CONSOLE_INTR_ON 1 /* turn the interrupt on */
89#define SAL_CONSOLE_INTR_STATUS 2 /* retrieve the interrupt status */
90 /* interrupt specification & status return codes */
91#define SAL_CONSOLE_INTR_XMIT 1 /* output interrupt */
92#define SAL_CONSOLE_INTR_RECV 2 /* input interrupt */
93
94/* interrupt handling */
95#define SAL_INTR_ALLOC 1
96#define SAL_INTR_FREE 2
97
98/*
99 * IRouter (i.e. generalized system controller) operations
100 */
101#define SAL_IROUTER_OPEN 0 /* open a subchannel */
102#define SAL_IROUTER_CLOSE 1 /* close a subchannel */
103#define SAL_IROUTER_SEND 2 /* send part of an IRouter packet */
104#define SAL_IROUTER_RECV 3 /* receive part of an IRouter packet */
105#define SAL_IROUTER_INTR_STATUS 4 /* check the interrupt status for
106 * an open subchannel
107 */
108#define SAL_IROUTER_INTR_ON 5 /* enable an interrupt */
109#define SAL_IROUTER_INTR_OFF 6 /* disable an interrupt */
110#define SAL_IROUTER_INIT 7 /* initialize IRouter driver */
111
112/* IRouter interrupt mask bits */
113#define SAL_IROUTER_INTR_XMIT SAL_CONSOLE_INTR_XMIT
114#define SAL_IROUTER_INTR_RECV SAL_CONSOLE_INTR_RECV
115
116
117/*
118 * SAL Error Codes
119 */
120#define SALRET_MORE_PASSES 1
121#define SALRET_OK 0
122#define SALRET_NOT_IMPLEMENTED (-1)
123#define SALRET_INVALID_ARG (-2)
124#define SALRET_ERROR (-3)
125
126
127/**
128 * sn_sal_rev_major - get the major SGI SAL revision number
129 *
130 * The SGI PROM stores its version in sal_[ab]_rev_(major|minor).
131 * This routine simply extracts the major value from the
132 * @ia64_sal_systab structure constructed by ia64_sal_init().
133 */
134static inline int
135sn_sal_rev_major(void)
136{
137 struct ia64_sal_systab *systab = efi.sal_systab;
138
139 return (int)systab->sal_b_rev_major;
140}
141
142/**
143 * sn_sal_rev_minor - get the minor SGI SAL revision number
144 *
145 * The SGI PROM stores its version in sal_[ab]_rev_(major|minor).
146 * This routine simply extracts the minor value from the
147 * @ia64_sal_systab structure constructed by ia64_sal_init().
148 */
149static inline int
150sn_sal_rev_minor(void)
151{
152 struct ia64_sal_systab *systab = efi.sal_systab;
153
154 return (int)systab->sal_b_rev_minor;
155}
156
157/*
158 * Specify the minimum PROM revsion required for this kernel.
159 * Note that they're stored in hex format...
160 */
161#define SN_SAL_MIN_MAJOR 0x4 /* SN2 kernels need at least PROM 4.0 */
162#define SN_SAL_MIN_MINOR 0x0
163
164/*
165 * Returns the master console nasid, if the call fails, return an illegal
166 * value.
167 */
168static inline u64
169ia64_sn_get_console_nasid(void)
170{
171 struct ia64_sal_retval ret_stuff;
172
173 ret_stuff.status = 0;
174 ret_stuff.v0 = 0;
175 ret_stuff.v1 = 0;
176 ret_stuff.v2 = 0;
177 SAL_CALL(ret_stuff, SN_SAL_GET_MASTER_NASID, 0, 0, 0, 0, 0, 0, 0);
178
179 if (ret_stuff.status < 0)
180 return ret_stuff.status;
181
182 /* Master console nasid is in 'v0' */
183 return ret_stuff.v0;
184}
185
186/*
187 * Returns the master baseio nasid, if the call fails, return an illegal
188 * value.
189 */
190static inline u64
191ia64_sn_get_master_baseio_nasid(void)
192{
193 struct ia64_sal_retval ret_stuff;
194
195 ret_stuff.status = 0;
196 ret_stuff.v0 = 0;
197 ret_stuff.v1 = 0;
198 ret_stuff.v2 = 0;
199 SAL_CALL(ret_stuff, SN_SAL_GET_MASTER_BASEIO_NASID, 0, 0, 0, 0, 0, 0, 0);
200
201 if (ret_stuff.status < 0)
202 return ret_stuff.status;
203
204 /* Master baseio nasid is in 'v0' */
205 return ret_stuff.v0;
206}
207
208static inline char *
209ia64_sn_get_klconfig_addr(nasid_t nasid)
210{
211 struct ia64_sal_retval ret_stuff;
212 int cnodeid;
213
214 cnodeid = nasid_to_cnodeid(nasid);
215 ret_stuff.status = 0;
216 ret_stuff.v0 = 0;
217 ret_stuff.v1 = 0;
218 ret_stuff.v2 = 0;
219 SAL_CALL(ret_stuff, SN_SAL_GET_KLCONFIG_ADDR, (u64)nasid, 0, 0, 0, 0, 0, 0);
220
221 /*
222 * We should panic if a valid cnode nasid does not produce
223 * a klconfig address.
224 */
225 if (ret_stuff.status != 0) {
226 panic("ia64_sn_get_klconfig_addr: Returned error %lx\n", ret_stuff.status);
227 }
228 return ret_stuff.v0 ? __va(ret_stuff.v0) : NULL;
229}
230
231/*
232 * Returns the next console character.
233 */
234static inline u64
235ia64_sn_console_getc(int *ch)
236{
237 struct ia64_sal_retval ret_stuff;
238
239 ret_stuff.status = 0;
240 ret_stuff.v0 = 0;
241 ret_stuff.v1 = 0;
242 ret_stuff.v2 = 0;
243 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_GETC, 0, 0, 0, 0, 0, 0, 0);
244
245 /* character is in 'v0' */
246 *ch = (int)ret_stuff.v0;
247
248 return ret_stuff.status;
249}
250
251/*
252 * Read a character from the SAL console device, after a previous interrupt
253 * or poll operation has given us to know that a character is available
254 * to be read.
255 */
256static inline u64
257ia64_sn_console_readc(void)
258{
259 struct ia64_sal_retval ret_stuff;
260
261 ret_stuff.status = 0;
262 ret_stuff.v0 = 0;
263 ret_stuff.v1 = 0;
264 ret_stuff.v2 = 0;
265 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_READC, 0, 0, 0, 0, 0, 0, 0);
266
267 /* character is in 'v0' */
268 return ret_stuff.v0;
269}
270
271/*
272 * Sends the given character to the console.
273 */
274static inline u64
275ia64_sn_console_putc(char ch)
276{
277 struct ia64_sal_retval ret_stuff;
278
279 ret_stuff.status = 0;
280 ret_stuff.v0 = 0;
281 ret_stuff.v1 = 0;
282 ret_stuff.v2 = 0;
283 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTC, (uint64_t)ch, 0, 0, 0, 0, 0, 0);
284
285 return ret_stuff.status;
286}
287
288/*
289 * Sends the given buffer to the console.
290 */
291static inline u64
292ia64_sn_console_putb(const char *buf, int len)
293{
294 struct ia64_sal_retval ret_stuff;
295
296 ret_stuff.status = 0;
297 ret_stuff.v0 = 0;
298 ret_stuff.v1 = 0;
299 ret_stuff.v2 = 0;
300 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTB, (uint64_t)buf, (uint64_t)len, 0, 0, 0, 0, 0);
301
302 if ( ret_stuff.status == 0 ) {
303 return ret_stuff.v0;
304 }
305 return (u64)0;
306}
307
308/*
309 * Print a platform error record
310 */
311static inline u64
312ia64_sn_plat_specific_err_print(int (*hook)(const char*, ...), char *rec)
313{
314 struct ia64_sal_retval ret_stuff;
315
316 ret_stuff.status = 0;
317 ret_stuff.v0 = 0;
318 ret_stuff.v1 = 0;
319 ret_stuff.v2 = 0;
320 SAL_CALL_REENTRANT(ret_stuff, SN_SAL_PRINT_ERROR, (uint64_t)hook, (uint64_t)rec, 0, 0, 0, 0, 0);
321
322 return ret_stuff.status;
323}
324
325/*
326 * Check for Platform errors
327 */
328static inline u64
329ia64_sn_plat_cpei_handler(void)
330{
331 struct ia64_sal_retval ret_stuff;
332
333 ret_stuff.status = 0;
334 ret_stuff.v0 = 0;
335 ret_stuff.v1 = 0;
336 ret_stuff.v2 = 0;
337 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_LOG_CE, 0, 0, 0, 0, 0, 0, 0);
338
339 return ret_stuff.status;
340}
341
342/*
343 * Checks for console input.
344 */
345static inline u64
346ia64_sn_console_check(int *result)
347{
348 struct ia64_sal_retval ret_stuff;
349
350 ret_stuff.status = 0;
351 ret_stuff.v0 = 0;
352 ret_stuff.v1 = 0;
353 ret_stuff.v2 = 0;
354 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_POLL, 0, 0, 0, 0, 0, 0, 0);
355
356 /* result is in 'v0' */
357 *result = (int)ret_stuff.v0;
358
359 return ret_stuff.status;
360}
361
362/*
363 * Checks console interrupt status
364 */
365static inline u64
366ia64_sn_console_intr_status(void)
367{
368 struct ia64_sal_retval ret_stuff;
369
370 ret_stuff.status = 0;
371 ret_stuff.v0 = 0;
372 ret_stuff.v1 = 0;
373 ret_stuff.v2 = 0;
374 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_INTR,
375 0, SAL_CONSOLE_INTR_STATUS,
376 0, 0, 0, 0, 0);
377
378 if (ret_stuff.status == 0) {
379 return ret_stuff.v0;
380 }
381
382 return 0;
383}
384
385/*
386 * Enable an interrupt on the SAL console device.
387 */
388static inline void
389ia64_sn_console_intr_enable(uint64_t intr)
390{
391 struct ia64_sal_retval ret_stuff;
392
393 ret_stuff.status = 0;
394 ret_stuff.v0 = 0;
395 ret_stuff.v1 = 0;
396 ret_stuff.v2 = 0;
397 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_INTR,
398 intr, SAL_CONSOLE_INTR_ON,
399 0, 0, 0, 0, 0);
400}
401
402/*
403 * Disable an interrupt on the SAL console device.
404 */
405static inline void
406ia64_sn_console_intr_disable(uint64_t intr)
407{
408 struct ia64_sal_retval ret_stuff;
409
410 ret_stuff.status = 0;
411 ret_stuff.v0 = 0;
412 ret_stuff.v1 = 0;
413 ret_stuff.v2 = 0;
414 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_INTR,
415 intr, SAL_CONSOLE_INTR_OFF,
416 0, 0, 0, 0, 0);
417}
418
419/*
420 * Sends a character buffer to the console asynchronously.
421 */
422static inline u64
423ia64_sn_console_xmit_chars(char *buf, int len)
424{
425 struct ia64_sal_retval ret_stuff;
426
427 ret_stuff.status = 0;
428 ret_stuff.v0 = 0;
429 ret_stuff.v1 = 0;
430 ret_stuff.v2 = 0;
431 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_XMIT_CHARS,
432 (uint64_t)buf, (uint64_t)len,
433 0, 0, 0, 0, 0);
434
435 if (ret_stuff.status == 0) {
436 return ret_stuff.v0;
437 }
438
439 return 0;
440}
441
442/*
443 * Returns the iobrick module Id
444 */
445static inline u64
446ia64_sn_sysctl_iobrick_module_get(nasid_t nasid, int *result)
447{
448 struct ia64_sal_retval ret_stuff;
449
450 ret_stuff.status = 0;
451 ret_stuff.v0 = 0;
452 ret_stuff.v1 = 0;
453 ret_stuff.v2 = 0;
454 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_SYSCTL_IOBRICK_MODULE_GET, nasid, 0, 0, 0, 0, 0, 0);
455
456 /* result is in 'v0' */
457 *result = (int)ret_stuff.v0;
458
459 return ret_stuff.status;
460}
461
462/**
463 * ia64_sn_pod_mode - call the SN_SAL_POD_MODE function
464 *
465 * SN_SAL_POD_MODE actually takes an argument, but it's always
466 * 0 when we call it from the kernel, so we don't have to expose
467 * it to the caller.
468 */
469static inline u64
470ia64_sn_pod_mode(void)
471{
472 struct ia64_sal_retval isrv;
473 SAL_CALL(isrv, SN_SAL_POD_MODE, 0, 0, 0, 0, 0, 0, 0);
474 if (isrv.status)
475 return 0;
476 return isrv.v0;
477}
478
479/**
480 * ia64_sn_probe_mem - read from memory safely
481 * @addr: address to probe
482 * @size: number bytes to read (1,2,4,8)
483 * @data_ptr: address to store value read by probe (-1 returned if probe fails)
484 *
485 * Call into the SAL to do a memory read. If the read generates a machine
486 * check, this routine will recover gracefully and return -1 to the caller.
487 * @addr is usually a kernel virtual address in uncached space (i.e. the
488 * address starts with 0xc), but if called in physical mode, @addr should
489 * be a physical address.
490 *
491 * Return values:
492 * 0 - probe successful
493 * 1 - probe failed (generated MCA)
494 * 2 - Bad arg
495 * <0 - PAL error
496 */
497static inline u64
498ia64_sn_probe_mem(long addr, long size, void *data_ptr)
499{
500 struct ia64_sal_retval isrv;
501
502 SAL_CALL(isrv, SN_SAL_PROBE, addr, size, 0, 0, 0, 0, 0);
503
504 if (data_ptr) {
505 switch (size) {
506 case 1:
507 *((u8*)data_ptr) = (u8)isrv.v0;
508 break;
509 case 2:
510 *((u16*)data_ptr) = (u16)isrv.v0;
511 break;
512 case 4:
513 *((u32*)data_ptr) = (u32)isrv.v0;
514 break;
515 case 8:
516 *((u64*)data_ptr) = (u64)isrv.v0;
517 break;
518 default:
519 isrv.status = 2;
520 }
521 }
522 return isrv.status;
523}
524
525/*
526 * Retrieve the system serial number as an ASCII string.
527 */
528static inline u64
529ia64_sn_sys_serial_get(char *buf)
530{
531 struct ia64_sal_retval ret_stuff;
532 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_SYS_SERIAL_GET, buf, 0, 0, 0, 0, 0, 0);
533 return ret_stuff.status;
534}
535
536extern char sn_system_serial_number_string[];
537extern u64 sn_partition_serial_number;
538
539static inline char *
540sn_system_serial_number(void) {
541 if (sn_system_serial_number_string[0]) {
542 return(sn_system_serial_number_string);
543 } else {
544 ia64_sn_sys_serial_get(sn_system_serial_number_string);
545 return(sn_system_serial_number_string);
546 }
547}
548
549
550/*
551 * Returns a unique id number for this system and partition (suitable for
552 * use with license managers), based in part on the system serial number.
553 */
554static inline u64
555ia64_sn_partition_serial_get(void)
556{
557 struct ia64_sal_retval ret_stuff;
558 SAL_CALL(ret_stuff, SN_SAL_PARTITION_SERIAL_GET, 0, 0, 0, 0, 0, 0, 0);
559 if (ret_stuff.status != 0)
560 return 0;
561 return ret_stuff.v0;
562}
563
564static inline u64
565sn_partition_serial_number_val(void) {
566 if (sn_partition_serial_number) {
567 return(sn_partition_serial_number);
568 } else {
569 return(sn_partition_serial_number = ia64_sn_partition_serial_get());
570 }
571}
572
573/*
574 * Returns the partition id of the nasid passed in as an argument,
575 * or INVALID_PARTID if the partition id cannot be retrieved.
576 */
577static inline partid_t
578ia64_sn_sysctl_partition_get(nasid_t nasid)
579{
580 struct ia64_sal_retval ret_stuff;
581 SAL_CALL(ret_stuff, SN_SAL_SYSCTL_PARTITION_GET, nasid,
582 0, 0, 0, 0, 0, 0);
583 if (ret_stuff.status != 0)
584 return INVALID_PARTID;
585 return ((partid_t)ret_stuff.v0);
586}
587
588/*
589 * Returns the partition id of the current processor.
590 */
591
592extern partid_t sn_partid;
593
594static inline partid_t
595sn_local_partid(void) {
596 if (sn_partid < 0) {
597 return (sn_partid = ia64_sn_sysctl_partition_get(cpuid_to_nasid(smp_processor_id())));
598 } else {
599 return sn_partid;
600 }
601}
602
603/*
604 * Register or unregister a physical address range being referenced across
605 * a partition boundary for which certain SAL errors should be scanned for,
606 * cleaned up and ignored. This is of value for kernel partitioning code only.
607 * Values for the operation argument:
608 * 1 = register this address range with SAL
609 * 0 = unregister this address range with SAL
610 *
611 * SAL maintains a reference count on an address range in case it is registered
612 * multiple times.
613 *
614 * On success, returns the reference count of the address range after the SAL
615 * call has performed the current registration/unregistration. Returns a
616 * negative value if an error occurred.
617 */
618static inline int
619sn_register_xp_addr_region(u64 paddr, u64 len, int operation)
620{
621 struct ia64_sal_retval ret_stuff;
622 SAL_CALL(ret_stuff, SN_SAL_XP_ADDR_REGION, paddr, len, (u64)operation,
623 0, 0, 0, 0);
624 return ret_stuff.status;
625}
626
627/*
628 * Register or unregister an instruction range for which SAL errors should
629 * be ignored. If an error occurs while in the registered range, SAL jumps
630 * to return_addr after ignoring the error. Values for the operation argument:
631 * 1 = register this instruction range with SAL
632 * 0 = unregister this instruction range with SAL
633 *
634 * Returns 0 on success, or a negative value if an error occurred.
635 */
636static inline int
637sn_register_nofault_code(u64 start_addr, u64 end_addr, u64 return_addr,
638 int virtual, int operation)
639{
640 struct ia64_sal_retval ret_stuff;
641 u64 call;
642 if (virtual) {
643 call = SN_SAL_NO_FAULT_ZONE_VIRTUAL;
644 } else {
645 call = SN_SAL_NO_FAULT_ZONE_PHYSICAL;
646 }
647 SAL_CALL(ret_stuff, call, start_addr, end_addr, return_addr, (u64)1,
648 0, 0, 0);
649 return ret_stuff.status;
650}
651
652/*
653 * Change or query the coherence domain for this partition. Each cpu-based
654 * nasid is represented by a bit in an array of 64-bit words:
655 * 0 = not in this partition's coherency domain
656 * 1 = in this partition's coherency domain
657 *
658 * It is not possible for the local system's nasids to be removed from
659 * the coherency domain. Purpose of the domain arguments:
660 * new_domain = set the coherence domain to the given nasids
661 * old_domain = return the current coherence domain
662 *
663 * Returns 0 on success, or a negative value if an error occurred.
664 */
665static inline int
666sn_change_coherence(u64 *new_domain, u64 *old_domain)
667{
668 struct ia64_sal_retval ret_stuff;
669 SAL_CALL(ret_stuff, SN_SAL_COHERENCE, new_domain, old_domain, 0, 0,
670 0, 0, 0);
671 return ret_stuff.status;
672}
673
674/*
675 * Change memory access protections for a physical address range.
676 * nasid_array is not used on Altix, but may be in future architectures.
677 * Available memory protection access classes are defined after the function.
678 */
679static inline int
680sn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array)
681{
682 struct ia64_sal_retval ret_stuff;
683 int cnodeid;
684 unsigned long irq_flags;
685
686 cnodeid = nasid_to_cnodeid(get_node_number(paddr));
687 // spin_lock(&NODEPDA(cnodeid)->bist_lock);
688 local_irq_save(irq_flags);
689 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_MEMPROTECT, paddr, len, nasid_array,
690 perms, 0, 0, 0);
691 local_irq_restore(irq_flags);
692 // spin_unlock(&NODEPDA(cnodeid)->bist_lock);
693 return ret_stuff.status;
694}
695#define SN_MEMPROT_ACCESS_CLASS_0 0x14a080
696#define SN_MEMPROT_ACCESS_CLASS_1 0x2520c2
697#define SN_MEMPROT_ACCESS_CLASS_2 0x14a1ca
698#define SN_MEMPROT_ACCESS_CLASS_3 0x14a290
699#define SN_MEMPROT_ACCESS_CLASS_6 0x084080
700#define SN_MEMPROT_ACCESS_CLASS_7 0x021080
701
702/*
703 * Turns off system power.
704 */
705static inline void
706ia64_sn_power_down(void)
707{
708 struct ia64_sal_retval ret_stuff;
709 SAL_CALL(ret_stuff, SN_SAL_SYSTEM_POWER_DOWN, 0, 0, 0, 0, 0, 0, 0);
710 while(1);
711 /* never returns */
712}
713
714/**
715 * ia64_sn_fru_capture - tell the system controller to capture hw state
716 *
717 * This routine will call the SAL which will tell the system controller(s)
718 * to capture hw mmr information from each SHub in the system.
719 */
720static inline u64
721ia64_sn_fru_capture(void)
722{
723 struct ia64_sal_retval isrv;
724 SAL_CALL(isrv, SN_SAL_SYSCTL_FRU_CAPTURE, 0, 0, 0, 0, 0, 0, 0);
725 if (isrv.status)
726 return 0;
727 return isrv.v0;
728}
729
730/*
731 * Performs an operation on a PCI bus or slot -- power up, power down
732 * or reset.
733 */
734static inline u64
735ia64_sn_sysctl_iobrick_pci_op(nasid_t n, u64 connection_type,
736 u64 bus, char slot,
737 u64 action)
738{
739 struct ia64_sal_retval rv = {0, 0, 0, 0};
740
741 SAL_CALL_NOLOCK(rv, SN_SAL_SYSCTL_IOBRICK_PCI_OP, connection_type, n, action,
742 bus, (u64) slot, 0, 0);
743 if (rv.status)
744 return rv.v0;
745 return 0;
746}
747
748
749/*
750 * Open a subchannel for sending arbitrary data to the system
751 * controller network via the system controller device associated with
752 * 'nasid'. Return the subchannel number or a negative error code.
753 */
754static inline int
755ia64_sn_irtr_open(nasid_t nasid)
756{
757 struct ia64_sal_retval rv;
758 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_OPEN, nasid,
759 0, 0, 0, 0, 0);
760 return (int) rv.v0;
761}
762
763/*
764 * Close system controller subchannel 'subch' previously opened on 'nasid'.
765 */
766static inline int
767ia64_sn_irtr_close(nasid_t nasid, int subch)
768{
769 struct ia64_sal_retval rv;
770 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_CLOSE,
771 (u64) nasid, (u64) subch, 0, 0, 0, 0);
772 return (int) rv.status;
773}
774
775/*
776 * Read data from system controller associated with 'nasid' on
777 * subchannel 'subch'. The buffer to be filled is pointed to by
778 * 'buf', and its capacity is in the integer pointed to by 'len'. The
779 * referent of 'len' is set to the number of bytes read by the SAL
780 * call. The return value is either SALRET_OK (for bytes read) or
781 * SALRET_ERROR (for error or "no data available").
782 */
783static inline int
784ia64_sn_irtr_recv(nasid_t nasid, int subch, char *buf, int *len)
785{
786 struct ia64_sal_retval rv;
787 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_RECV,
788 (u64) nasid, (u64) subch, (u64) buf, (u64) len,
789 0, 0);
790 return (int) rv.status;
791}
792
793/*
794 * Write data to the system controller network via the system
795 * controller associated with 'nasid' on suchannel 'subch'. The
796 * buffer to be written out is pointed to by 'buf', and 'len' is the
797 * number of bytes to be written. The return value is either the
798 * number of bytes written (which could be zero) or a negative error
799 * code.
800 */
801static inline int
802ia64_sn_irtr_send(nasid_t nasid, int subch, char *buf, int len)
803{
804 struct ia64_sal_retval rv;
805 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_SEND,
806 (u64) nasid, (u64) subch, (u64) buf, (u64) len,
807 0, 0);
808 return (int) rv.v0;
809}
810
811/*
812 * Check whether any interrupts are pending for the system controller
813 * associated with 'nasid' and its subchannel 'subch'. The return
814 * value is a mask of pending interrupts (SAL_IROUTER_INTR_XMIT and/or
815 * SAL_IROUTER_INTR_RECV).
816 */
817static inline int
818ia64_sn_irtr_intr(nasid_t nasid, int subch)
819{
820 struct ia64_sal_retval rv;
821 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_STATUS,
822 (u64) nasid, (u64) subch, 0, 0, 0, 0);
823 return (int) rv.v0;
824}
825
826/*
827 * Enable the interrupt indicated by the intr parameter (either
828 * SAL_IROUTER_INTR_XMIT or SAL_IROUTER_INTR_RECV).
829 */
830static inline int
831ia64_sn_irtr_intr_enable(nasid_t nasid, int subch, u64 intr)
832{
833 struct ia64_sal_retval rv;
834 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_ON,
835 (u64) nasid, (u64) subch, intr, 0, 0, 0);
836 return (int) rv.v0;
837}
838
839/*
840 * Disable the interrupt indicated by the intr parameter (either
841 * SAL_IROUTER_INTR_XMIT or SAL_IROUTER_INTR_RECV).
842 */
843static inline int
844ia64_sn_irtr_intr_disable(nasid_t nasid, int subch, u64 intr)
845{
846 struct ia64_sal_retval rv;
847 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_OFF,
848 (u64) nasid, (u64) subch, intr, 0, 0, 0);
849 return (int) rv.v0;
850}
851
852/**
853 * ia64_sn_get_fit_compt - read a FIT entry from the PROM header
854 * @nasid: NASID of node to read
855 * @index: FIT entry index to be retrieved (0..n)
856 * @fitentry: 16 byte buffer where FIT entry will be stored.
857 * @banbuf: optional buffer for retrieving banner
858 * @banlen: length of banner buffer
859 *
860 * Access to the physical PROM chips needs to be serialized since reads and
861 * writes can't occur at the same time, so we need to call into the SAL when
862 * we want to look at the FIT entries on the chips.
863 *
864 * Returns:
865 * %SALRET_OK if ok
866 * %SALRET_INVALID_ARG if index too big
867 * %SALRET_NOT_IMPLEMENTED if running on older PROM
868 * ??? if nasid invalid OR banner buffer not large enough
869 */
870static inline int
871ia64_sn_get_fit_compt(u64 nasid, u64 index, void *fitentry, void *banbuf,
872 u64 banlen)
873{
874 struct ia64_sal_retval rv;
875 SAL_CALL_NOLOCK(rv, SN_SAL_GET_FIT_COMPT, nasid, index, fitentry,
876 banbuf, banlen, 0, 0);
877 return (int) rv.status;
878}
879
880/*
881 * Initialize the SAL components of the system controller
882 * communication driver; specifically pass in a sizable buffer that
883 * can be used for allocation of subchannel queues as new subchannels
884 * are opened. "buf" points to the buffer, and "len" specifies its
885 * length.
886 */
887static inline int
888ia64_sn_irtr_init(nasid_t nasid, void *buf, int len)
889{
890 struct ia64_sal_retval rv;
891 SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INIT,
892 (u64) nasid, (u64) buf, (u64) len, 0, 0, 0);
893 return (int) rv.status;
894}
895
896/*
897 * Returns the nasid, subnode & slice corresponding to a SAPIC ID
898 *
899 * In:
900 * arg0 - SN_SAL_GET_SAPIC_INFO
901 * arg1 - sapicid (lid >> 16)
902 * Out:
903 * v0 - nasid
904 * v1 - subnode
905 * v2 - slice
906 */
907static inline u64
908ia64_sn_get_sapic_info(int sapicid, int *nasid, int *subnode, int *slice)
909{
910 struct ia64_sal_retval ret_stuff;
911
912 ret_stuff.status = 0;
913 ret_stuff.v0 = 0;
914 ret_stuff.v1 = 0;
915 ret_stuff.v2 = 0;
916 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SAPIC_INFO, sapicid, 0, 0, 0, 0, 0, 0);
917
918/***** BEGIN HACK - temp til old proms no longer supported ********/
919 if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) {
920 if (nasid) *nasid = sapicid & 0xfff;
921 if (subnode) *subnode = (sapicid >> 13) & 1;
922 if (slice) *slice = (sapicid >> 12) & 3;
923 return 0;
924 }
925/***** END HACK *******/
926
927 if (ret_stuff.status < 0)
928 return ret_stuff.status;
929
930 if (nasid) *nasid = (int) ret_stuff.v0;
931 if (subnode) *subnode = (int) ret_stuff.v1;
932 if (slice) *slice = (int) ret_stuff.v2;
933 return 0;
934}
935
936/*
937 * Returns information about the HUB/SHUB.
938 * In:
939 * arg0 - SN_SAL_GET_SN_INFO
940 * arg1 - 0 (other values reserved for future use)
941 * Out:
942 * v0
943 * [7:0] - shub type (0=shub1, 1=shub2)
944 * [15:8] - Log2 max number of nodes in entire system (includes
945 * C-bricks, I-bricks, etc)
946 * [23:16] - Log2 of nodes per sharing domain
947 * [31:24] - partition ID
948 * [39:32] - coherency_id
949 * [47:40] - regionsize
950 * v1
951 * [15:0] - nasid mask (ex., 0x7ff for 11 bit nasid)
952 * [23:15] - bit position of low nasid bit
953 */
954static inline u64
955ia64_sn_get_sn_info(int fc, u8 *shubtype, u16 *nasid_bitmask, u8 *nasid_shift,
956 u8 *systemsize, u8 *sharing_domain_size, u8 *partid, u8 *coher, u8 *reg)
957{
958 struct ia64_sal_retval ret_stuff;
959
960 ret_stuff.status = 0;
961 ret_stuff.v0 = 0;
962 ret_stuff.v1 = 0;
963 ret_stuff.v2 = 0;
964 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_GET_SN_INFO, fc, 0, 0, 0, 0, 0, 0);
965
966/***** BEGIN HACK - temp til old proms no longer supported ********/
967 if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) {
968 int nasid = get_sapicid() & 0xfff;;
969#define SH_SHUB_ID_NODES_PER_BIT_MASK 0x001f000000000000UL
970#define SH_SHUB_ID_NODES_PER_BIT_SHFT 48
971 if (shubtype) *shubtype = 0;
972 if (nasid_bitmask) *nasid_bitmask = 0x7ff;
973 if (nasid_shift) *nasid_shift = 38;
974 if (systemsize) *systemsize = 11;
975 if (sharing_domain_size) *sharing_domain_size = 9;
976 if (partid) *partid = ia64_sn_sysctl_partition_get(nasid);
977 if (coher) *coher = nasid >> 9;
978 if (reg) *reg = (HUB_L((u64 *) LOCAL_MMR_ADDR(SH1_SHUB_ID)) & SH_SHUB_ID_NODES_PER_BIT_MASK) >>
979 SH_SHUB_ID_NODES_PER_BIT_SHFT;
980 return 0;
981 }
982/***** END HACK *******/
983
984 if (ret_stuff.status < 0)
985 return ret_stuff.status;
986
987 if (shubtype) *shubtype = ret_stuff.v0 & 0xff;
988 if (systemsize) *systemsize = (ret_stuff.v0 >> 8) & 0xff;
989 if (sharing_domain_size) *sharing_domain_size = (ret_stuff.v0 >> 16) & 0xff;
990 if (partid) *partid = (ret_stuff.v0 >> 24) & 0xff;
991 if (coher) *coher = (ret_stuff.v0 >> 32) & 0xff;
992 if (reg) *reg = (ret_stuff.v0 >> 40) & 0xff;
993 if (nasid_bitmask) *nasid_bitmask = (ret_stuff.v1 & 0xffff);
994 if (nasid_shift) *nasid_shift = (ret_stuff.v1 >> 16) & 0xff;
995 return 0;
996}
997
998/*
999 * This is the access point to the Altix PROM hardware performance
1000 * and status monitoring interface. For info on using this, see
1001 * include/asm-ia64/sn/sn2/sn_hwperf.h
1002 */
1003static inline int
1004ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2,
1005 u64 a3, u64 a4, int *v0)
1006{
1007 struct ia64_sal_retval rv;
1008 SAL_CALL_NOLOCK(rv, SN_SAL_HWPERF_OP, (u64)nasid,
1009 opcode, a0, a1, a2, a3, a4);
1010 if (v0)
1011 *v0 = (int) rv.v0;
1012 return (int) rv.status;
1013}
1014
1015#endif /* _ASM_IA64_SN_SN_SAL_H */
diff --git a/include/asm-ia64/sn/sndrv.h b/include/asm-ia64/sn/sndrv.h
new file mode 100644
index 000000000000..aa00d42cde32
--- /dev/null
+++ b/include/asm-ia64/sn/sndrv.h
@@ -0,0 +1,47 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2002-2004 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9#ifndef _ASM_IA64_SN_SNDRV_H
10#define _ASM_IA64_SN_SNDRV_H
11
12/* ioctl commands */
13#define SNDRV_GET_ROUTERINFO 1
14#define SNDRV_GET_INFOSIZE 2
15#define SNDRV_GET_HUBINFO 3
16#define SNDRV_GET_FLASHLOGSIZE 4
17#define SNDRV_SET_FLASHSYNC 5
18#define SNDRV_GET_FLASHLOGDATA 6
19#define SNDRV_GET_FLASHLOGALL 7
20
21#define SNDRV_SET_HISTOGRAM_TYPE 14
22
23#define SNDRV_ELSC_COMMAND 19
24#define SNDRV_CLEAR_LOG 20
25#define SNDRV_INIT_LOG 21
26#define SNDRV_GET_PIMM_PSC 22
27#define SNDRV_SET_PARTITION 23
28#define SNDRV_GET_PARTITION 24
29
30/* see synergy_perf_ioctl() */
31#define SNDRV_GET_SYNERGY_VERSION 30
32#define SNDRV_GET_SYNERGY_STATUS 31
33#define SNDRV_GET_SYNERGYINFO 32
34#define SNDRV_SYNERGY_APPEND 33
35#define SNDRV_SYNERGY_ENABLE 34
36#define SNDRV_SYNERGY_FREQ 35
37
38/* Devices */
39#define SNDRV_UKNOWN_DEVICE -1
40#define SNDRV_ROUTER_DEVICE 1
41#define SNDRV_HUB_DEVICE 2
42#define SNDRV_ELSC_NVRAM_DEVICE 3
43#define SNDRV_ELSC_CONTROLLER_DEVICE 4
44#define SNDRV_SYSCTL_SUBCH 5
45#define SNDRV_SYNERGY_DEVICE 6
46
47#endif /* _ASM_IA64_SN_SNDRV_H */
diff --git a/include/asm-ia64/sn/types.h b/include/asm-ia64/sn/types.h
new file mode 100644
index 000000000000..586ed47cae9c
--- /dev/null
+++ b/include/asm-ia64/sn/types.h
@@ -0,0 +1,25 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999,2001-2003 Silicon Graphics, Inc. All Rights Reserved.
7 * Copyright (C) 1999 by Ralf Baechle
8 */
9#ifndef _ASM_IA64_SN_TYPES_H
10#define _ASM_IA64_SN_TYPES_H
11
12#include <linux/types.h>
13
14typedef unsigned long cpuid_t;
15typedef signed short nasid_t; /* node id in numa-as-id space */
16typedef signed char partid_t; /* partition ID type */
17typedef unsigned int moduleid_t; /* user-visible module number type */
18typedef unsigned int cmoduleid_t; /* kernel compact module id type */
19typedef signed char slabid_t;
20typedef u64 nic_t;
21typedef unsigned long iopaddr_t;
22typedef unsigned long paddr_t;
23typedef short cnodeid_t;
24
25#endif /* _ASM_IA64_SN_TYPES_H */