This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-ia64 / sn / sn2 / sn_hwperf.h
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
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;
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 #define SN_HWPERF_FOREIGN(x)    (!(x)->sn_hwp_this_part && !(x)->sn_hwp_is_shared)
45
46 /* numa port structure, SN_HWPERF_ENUM_PORTS returns an array of these */
47 struct sn_hwperf_port_info {
48         u32 port;
49         u32 conn_id;
50         u32 conn_port;
51 };
52
53 /* for HWPERF_{GET,SET}_MMRS */
54 struct sn_hwperf_data {
55         u64 addr;
56         u64 data;
57 };
58
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 */
65 };
66
67 /*
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.
73  */
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
78
79 /* 
80  * ioctl requests on the "sn_hwperf" misc device that call SAL.
81  */
82 #define SN_HWPERF_OP_MEM_COPYIN         0x1000
83 #define SN_HWPERF_OP_MEM_COPYOUT        0x2000
84 #define SN_HWPERF_OP_MASK               0x0fff
85
86 /*
87  * Determine mem requirement.
88  * arg  don't care
89  * sz   8
90  * p    pointer to u64 integer
91  */
92 #define SN_HWPERF_GET_HEAPSIZE          1
93
94 /*
95  * Install mem for SAL drvr
96  * arg  don't care
97  * sz   sizeof buffer pointed to by p
98  * p    pointer to buffer for scratch area
99  */
100 #define SN_HWPERF_INSTALL_HEAP          2
101
102 /*
103  * Determine number of objects
104  * arg  don't care
105  * sz   8
106  * p    pointer to u64 integer
107  */
108 #define SN_HWPERF_OBJECT_COUNT          (10|SN_HWPERF_OP_MEM_COPYOUT)
109
110 /*
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.
115  *
116  * arg  bitmap of IPI flag, cpu number and object id
117  * sz   8
118  * p    pointer to u64 integer
119  */
120 #define SN_HWPERF_OBJECT_DISTANCE       (11|SN_HWPERF_OP_MEM_COPYOUT)
121
122 /*
123  * Enumerate objects. Special case if sz == 8, returns the required
124  * buffer size.
125  * arg  don't care
126  * sz   sizeof buffer pointed to by p
127  * p    pointer to array of struct sn_hwperf_object_info
128  */
129 #define SN_HWPERF_ENUM_OBJECTS          (12|SN_HWPERF_OP_MEM_COPYOUT)
130
131 /*
132  * Enumerate NumaLink ports for an object. Special case if sz == 8,
133  * returns the required buffer size.
134  * arg  object id
135  * sz   sizeof buffer pointed to by p
136  * p    pointer to array of struct sn_hwperf_port_info
137  */
138 #define SN_HWPERF_ENUM_PORTS            (13|SN_HWPERF_OP_MEM_COPYOUT)
139
140 /*
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.
145  *
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
149  */
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)
153 /*
154  * Lock a shared object
155  * arg  object id
156  * sz   don't care
157  * p    don't care
158  */
159 #define SN_HWPERF_ACQUIRE               16
160
161 /*
162  * Unlock a shared object
163  * arg  object id
164  * sz   don't care
165  * p    don't care
166  */
167 #define SN_HWPERF_RELEASE               17
168
169 /*
170  * Break a lock on a shared object
171  * arg  object id
172  * sz   don't care
173  * p    don't care
174  */
175 #define SN_HWPERF_FORCE_RELEASE         18
176
177 /*
178  * ioctl requests on "sn_hwperf" that do not call SAL
179  */
180
181 /*
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.
186  *
187  * arg  don't care
188  * sz   sizeof buffer pointed to by p
189  * p    pointer to array of struct sn_hwperf_object_info
190  */
191 #define SN_HWPERF_GET_CPU_INFO          (100|SN_HWPERF_OP_MEM_COPYOUT)
192
193 /*
194  * Given an object id, return it's node number (aka cnode).
195  * arg  object id
196  * sz   8
197  * p    pointer to u64 integer
198  */
199 #define SN_HWPERF_GET_OBJ_NODE          (101|SN_HWPERF_OP_MEM_COPYOUT)
200
201 /*
202  * Given a node number (cnode), return it's nasid.
203  * arg  ordinal node number (aka cnodeid)
204  * sz   8
205  * p    pointer to u64 integer
206  */
207 #define SN_HWPERF_GET_NODE_NASID        (102|SN_HWPERF_OP_MEM_COPYOUT)
208
209 /* return codes */
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
217
218 #endif                          /* SN_HWPERF_H */