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
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
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 {
35 char name[SN_HWPERF_MAXSTRING];
36 char location[SN_HWPERF_MAXSTRING];
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 #define SN_HWPERF_FOREIGN(x) (!(x)->sn_hwp_this_part && !(x)->sn_hwp_is_shared)
46 /* numa port structure, SN_HWPERF_ENUM_PORTS returns an array of these */
47 struct sn_hwperf_port_info {
53 /* for HWPERF_{GET,SET}_MMRS */
54 struct sn_hwperf_data {
59 /* user ioctl() argument, see below */
60 struct sn_hwperf_ioctl_args {
61 u64 arg; /* argument, usually an object id */
62 u64 sz; /* size of transfer */
63 void *ptr; /* pointer to source/target */
64 u32 v0; /* second return value */
68 * For SN_HWPERF_{GET,SET}_MMRS and SN_HWPERF_OBJECT_DISTANCE,
69 * sn_hwperf_ioctl_args.arg can be used to specify a CPU on which
70 * to call SAL, and whether to use an interprocessor interrupt
71 * or task migration in order to do so. If the CPU specified is
72 * SN_HWPERF_ARG_ANY_CPU, then the current CPU will be used.
74 #define SN_HWPERF_ARG_ANY_CPU 0x7fffffffUL
75 #define SN_HWPERF_ARG_CPU_MASK 0x7fffffff00000000ULL
76 #define SN_HWPERF_ARG_USE_IPI_MASK 0x8000000000000000ULL
77 #define SN_HWPERF_ARG_OBJID_MASK 0x00000000ffffffffULL
80 * ioctl requests on the "sn_hwperf" misc device that call SAL.
82 #define SN_HWPERF_OP_MEM_COPYIN 0x1000
83 #define SN_HWPERF_OP_MEM_COPYOUT 0x2000
84 #define SN_HWPERF_OP_MASK 0x0fff
87 * Determine mem requirement.
90 * p pointer to u64 integer
92 #define SN_HWPERF_GET_HEAPSIZE 1
95 * Install mem for SAL drvr
97 * sz sizeof buffer pointed to by p
98 * p pointer to buffer for scratch area
100 #define SN_HWPERF_INSTALL_HEAP 2
103 * Determine number of objects
106 * p pointer to u64 integer
108 #define SN_HWPERF_OBJECT_COUNT (10|SN_HWPERF_OP_MEM_COPYOUT)
111 * Determine object "distance", relative to a cpu. This operation can
112 * execute on a designated logical cpu number, using either an IPI or
113 * via task migration. If the cpu number is SN_HWPERF_ANY_CPU, then
114 * the current CPU is used. See the SN_HWPERF_ARG_* macros above.
116 * arg bitmap of IPI flag, cpu number and object id
118 * p pointer to u64 integer
120 #define SN_HWPERF_OBJECT_DISTANCE (11|SN_HWPERF_OP_MEM_COPYOUT)
123 * Enumerate objects. Special case if sz == 8, returns the required
126 * sz sizeof buffer pointed to by p
127 * p pointer to array of struct sn_hwperf_object_info
129 #define SN_HWPERF_ENUM_OBJECTS (12|SN_HWPERF_OP_MEM_COPYOUT)
132 * Enumerate NumaLink ports for an object. Special case if sz == 8,
133 * returns the required buffer size.
135 * sz sizeof buffer pointed to by p
136 * p pointer to array of struct sn_hwperf_port_info
138 #define SN_HWPERF_ENUM_PORTS (13|SN_HWPERF_OP_MEM_COPYOUT)
141 * SET/GET memory mapped registers. These operations can execute
142 * on a designated logical cpu number, using either an IPI or via
143 * task migration. If the cpu number is SN_HWPERF_ANY_CPU, then
144 * the current CPU is used. See the SN_HWPERF_ARG_* macros above.
146 * arg bitmap of ipi flag, cpu number and object id
147 * sz sizeof buffer pointed to by p
148 * p pointer to array of struct sn_hwperf_data
150 #define SN_HWPERF_SET_MMRS (14|SN_HWPERF_OP_MEM_COPYIN)
151 #define SN_HWPERF_GET_MMRS (15|SN_HWPERF_OP_MEM_COPYOUT| \
152 SN_HWPERF_OP_MEM_COPYIN)
154 * Lock a shared object
159 #define SN_HWPERF_ACQUIRE 16
162 * Unlock a shared object
167 #define SN_HWPERF_RELEASE 17
170 * Break a lock on a shared object
175 #define SN_HWPERF_FORCE_RELEASE 18
178 * ioctl requests on "sn_hwperf" that do not call SAL
182 * get cpu info as an array of hwperf_object_info_t.
183 * id is logical CPU number, name is description, location
184 * is geoid (e.g. 001c04#1c). Special case if sz == 8,
185 * returns the required buffer size.
188 * sz sizeof buffer pointed to by p
189 * p pointer to array of struct sn_hwperf_object_info
191 #define SN_HWPERF_GET_CPU_INFO (100|SN_HWPERF_OP_MEM_COPYOUT)
194 * Given an object id, return it's node number (aka cnode).
197 * p pointer to u64 integer
199 #define SN_HWPERF_GET_OBJ_NODE (101|SN_HWPERF_OP_MEM_COPYOUT)
202 * Given a node number (cnode), return it's nasid.
203 * arg ordinal node number (aka cnodeid)
205 * p pointer to u64 integer
207 #define SN_HWPERF_GET_NODE_NASID (102|SN_HWPERF_OP_MEM_COPYOUT)
210 #define SN_HWPERF_OP_OK 0
211 #define SN_HWPERF_OP_NOMEM 1
212 #define SN_HWPERF_OP_NO_PERM 2
213 #define SN_HWPERF_OP_IO_ERROR 3
214 #define SN_HWPERF_OP_BUSY 4
215 #define SN_HWPERF_OP_RECONFIGURE 253
216 #define SN_HWPERF_OP_INVAL 254
218 #endif /* SN_HWPERF_H */