Linux-2.6.12-rc2
[linux-2.6/next.git] / include / asm-ia64 / sn / sn2 / sn_hwperf.h
blobb0c4d6dd77baf396e59c51b48972fe663ee1ea22
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.
6 * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
8 * Data types used by the SN_SAL_HWPERF_OP SAL call for monitoring
9 * SGI Altix node and router hardware
11 * Mark Goodwin <markgw@sgi.com> Mon Aug 30 12:23:46 EST 2004
14 #ifndef SN_HWPERF_H
15 #define SN_HWPERF_H
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.
22 #define SN_HWPERF_MAXSTRING 128
23 struct 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;
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
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)))
54 /* numa port structure, SN_HWPERF_ENUM_PORTS returns an array of these */
55 struct sn_hwperf_port_info {
56 u32 port;
57 u32 conn_id;
58 u32 conn_port;
61 /* for HWPERF_{GET,SET}_MMRS */
62 struct sn_hwperf_data {
63 u64 addr;
64 u64 data;
67 /* user ioctl() argument, see below */
68 struct 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 */
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.
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
87 /*
88 * ioctl requests on the "sn_hwperf" misc device that call SAL.
90 #define SN_HWPERF_OP_MEM_COPYIN 0x1000
91 #define SN_HWPERF_OP_MEM_COPYOUT 0x2000
92 #define SN_HWPERF_OP_MASK 0x0fff
95 * Determine mem requirement.
96 * arg don't care
97 * sz 8
98 * p pointer to u64 integer
100 #define SN_HWPERF_GET_HEAPSIZE 1
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
108 #define SN_HWPERF_INSTALL_HEAP 2
111 * Determine number of objects
112 * arg don't care
113 * sz 8
114 * p pointer to u64 integer
116 #define SN_HWPERF_OBJECT_COUNT (10|SN_HWPERF_OP_MEM_COPYOUT)
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.
124 * arg bitmap of IPI flag, cpu number and object id
125 * sz 8
126 * p pointer to u64 integer
128 #define SN_HWPERF_OBJECT_DISTANCE (11|SN_HWPERF_OP_MEM_COPYOUT)
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
137 #define SN_HWPERF_ENUM_OBJECTS (12|SN_HWPERF_OP_MEM_COPYOUT)
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
146 #define SN_HWPERF_ENUM_PORTS (13|SN_HWPERF_OP_MEM_COPYOUT)
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.
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
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)
162 * Lock a shared object
163 * arg object id
164 * sz don't care
165 * p don't care
167 #define SN_HWPERF_ACQUIRE 16
170 * Unlock a shared object
171 * arg object id
172 * sz don't care
173 * p don't care
175 #define SN_HWPERF_RELEASE 17
178 * Break a lock on a shared object
179 * arg object id
180 * sz don't care
181 * p don't care
183 #define SN_HWPERF_FORCE_RELEASE 18
186 * ioctl requests on "sn_hwperf" that do not call SAL
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.
195 * arg don't care
196 * sz sizeof buffer pointed to by p
197 * p pointer to array of struct sn_hwperf_object_info
199 #define SN_HWPERF_GET_CPU_INFO (100|SN_HWPERF_OP_MEM_COPYOUT)
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
207 #define SN_HWPERF_GET_OBJ_NODE (101|SN_HWPERF_OP_MEM_COPYOUT)
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
215 #define SN_HWPERF_GET_NODE_NASID (102|SN_HWPERF_OP_MEM_COPYOUT)
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
226 #endif /* SN_HWPERF_H */