diff options
Diffstat (limited to 'include/gk20a/hw_perf_gk20a.h')
-rw-r--r-- | include/gk20a/hw_perf_gk20a.h | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/include/gk20a/hw_perf_gk20a.h b/include/gk20a/hw_perf_gk20a.h new file mode 100644 index 0000000..a93560f --- /dev/null +++ b/include/gk20a/hw_perf_gk20a.h | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | * DEALINGS IN THE SOFTWARE. | ||
21 | */ | ||
22 | /* | ||
23 | * Function naming determines intended use: | ||
24 | * | ||
25 | * <x>_r(void) : Returns the offset for register <x>. | ||
26 | * | ||
27 | * <x>_o(void) : Returns the offset for element <x>. | ||
28 | * | ||
29 | * <x>_w(void) : Returns the word offset for word (4 byte) element <x>. | ||
30 | * | ||
31 | * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits. | ||
32 | * | ||
33 | * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted | ||
34 | * and masked to place it at field <y> of register <x>. This value | ||
35 | * can be |'d with others to produce a full register value for | ||
36 | * register <x>. | ||
37 | * | ||
38 | * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This | ||
39 | * value can be ~'d and then &'d to clear the value of field <y> for | ||
40 | * register <x>. | ||
41 | * | ||
42 | * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted | ||
43 | * to place it at field <y> of register <x>. This value can be |'d | ||
44 | * with others to produce a full register value for <x>. | ||
45 | * | ||
46 | * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register | ||
47 | * <x> value 'r' after being shifted to place its LSB at bit 0. | ||
48 | * This value is suitable for direct comparison with other unshifted | ||
49 | * values appropriate for use in field <y> of register <x>. | ||
50 | * | ||
51 | * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for | ||
52 | * field <y> of register <x>. This value is suitable for direct | ||
53 | * comparison with unshifted values appropriate for use in field <y> | ||
54 | * of register <x>. | ||
55 | */ | ||
56 | #ifndef _hw_perf_gk20a_h_ | ||
57 | #define _hw_perf_gk20a_h_ | ||
58 | |||
59 | static inline u32 perf_pmasys_control_r(void) | ||
60 | { | ||
61 | return 0x001b4000U; | ||
62 | } | ||
63 | static inline u32 perf_pmasys_control_membuf_status_v(u32 r) | ||
64 | { | ||
65 | return (r >> 4U) & 0x1U; | ||
66 | } | ||
67 | static inline u32 perf_pmasys_control_membuf_status_overflowed_v(void) | ||
68 | { | ||
69 | return 0x00000001U; | ||
70 | } | ||
71 | static inline u32 perf_pmasys_control_membuf_status_overflowed_f(void) | ||
72 | { | ||
73 | return 0x10U; | ||
74 | } | ||
75 | static inline u32 perf_pmasys_control_membuf_clear_status_f(u32 v) | ||
76 | { | ||
77 | return (v & 0x1U) << 5U; | ||
78 | } | ||
79 | static inline u32 perf_pmasys_control_membuf_clear_status_v(u32 r) | ||
80 | { | ||
81 | return (r >> 5U) & 0x1U; | ||
82 | } | ||
83 | static inline u32 perf_pmasys_control_membuf_clear_status_doit_v(void) | ||
84 | { | ||
85 | return 0x00000001U; | ||
86 | } | ||
87 | static inline u32 perf_pmasys_control_membuf_clear_status_doit_f(void) | ||
88 | { | ||
89 | return 0x20U; | ||
90 | } | ||
91 | static inline u32 perf_pmasys_mem_block_r(void) | ||
92 | { | ||
93 | return 0x001b4070U; | ||
94 | } | ||
95 | static inline u32 perf_pmasys_mem_block_base_f(u32 v) | ||
96 | { | ||
97 | return (v & 0xfffffffU) << 0U; | ||
98 | } | ||
99 | static inline u32 perf_pmasys_mem_block_target_f(u32 v) | ||
100 | { | ||
101 | return (v & 0x3U) << 28U; | ||
102 | } | ||
103 | static inline u32 perf_pmasys_mem_block_target_v(u32 r) | ||
104 | { | ||
105 | return (r >> 28U) & 0x3U; | ||
106 | } | ||
107 | static inline u32 perf_pmasys_mem_block_target_lfb_v(void) | ||
108 | { | ||
109 | return 0x00000000U; | ||
110 | } | ||
111 | static inline u32 perf_pmasys_mem_block_target_lfb_f(void) | ||
112 | { | ||
113 | return 0x0U; | ||
114 | } | ||
115 | static inline u32 perf_pmasys_mem_block_target_sys_coh_v(void) | ||
116 | { | ||
117 | return 0x00000002U; | ||
118 | } | ||
119 | static inline u32 perf_pmasys_mem_block_target_sys_coh_f(void) | ||
120 | { | ||
121 | return 0x20000000U; | ||
122 | } | ||
123 | static inline u32 perf_pmasys_mem_block_target_sys_ncoh_v(void) | ||
124 | { | ||
125 | return 0x00000003U; | ||
126 | } | ||
127 | static inline u32 perf_pmasys_mem_block_target_sys_ncoh_f(void) | ||
128 | { | ||
129 | return 0x30000000U; | ||
130 | } | ||
131 | static inline u32 perf_pmasys_mem_block_valid_f(u32 v) | ||
132 | { | ||
133 | return (v & 0x1U) << 31U; | ||
134 | } | ||
135 | static inline u32 perf_pmasys_mem_block_valid_v(u32 r) | ||
136 | { | ||
137 | return (r >> 31U) & 0x1U; | ||
138 | } | ||
139 | static inline u32 perf_pmasys_mem_block_valid_true_v(void) | ||
140 | { | ||
141 | return 0x00000001U; | ||
142 | } | ||
143 | static inline u32 perf_pmasys_mem_block_valid_true_f(void) | ||
144 | { | ||
145 | return 0x80000000U; | ||
146 | } | ||
147 | static inline u32 perf_pmasys_mem_block_valid_false_v(void) | ||
148 | { | ||
149 | return 0x00000000U; | ||
150 | } | ||
151 | static inline u32 perf_pmasys_mem_block_valid_false_f(void) | ||
152 | { | ||
153 | return 0x0U; | ||
154 | } | ||
155 | static inline u32 perf_pmasys_outbase_r(void) | ||
156 | { | ||
157 | return 0x001b4074U; | ||
158 | } | ||
159 | static inline u32 perf_pmasys_outbase_ptr_f(u32 v) | ||
160 | { | ||
161 | return (v & 0x7ffffffU) << 5U; | ||
162 | } | ||
163 | static inline u32 perf_pmasys_outbaseupper_r(void) | ||
164 | { | ||
165 | return 0x001b4078U; | ||
166 | } | ||
167 | static inline u32 perf_pmasys_outbaseupper_ptr_f(u32 v) | ||
168 | { | ||
169 | return (v & 0xffU) << 0U; | ||
170 | } | ||
171 | static inline u32 perf_pmasys_outsize_r(void) | ||
172 | { | ||
173 | return 0x001b407cU; | ||
174 | } | ||
175 | static inline u32 perf_pmasys_outsize_numbytes_f(u32 v) | ||
176 | { | ||
177 | return (v & 0x7ffffffU) << 5U; | ||
178 | } | ||
179 | static inline u32 perf_pmasys_mem_bytes_r(void) | ||
180 | { | ||
181 | return 0x001b4084U; | ||
182 | } | ||
183 | static inline u32 perf_pmasys_mem_bytes_numbytes_f(u32 v) | ||
184 | { | ||
185 | return (v & 0xfffffffU) << 4U; | ||
186 | } | ||
187 | static inline u32 perf_pmasys_mem_bump_r(void) | ||
188 | { | ||
189 | return 0x001b4088U; | ||
190 | } | ||
191 | static inline u32 perf_pmasys_mem_bump_numbytes_f(u32 v) | ||
192 | { | ||
193 | return (v & 0xfffffffU) << 4U; | ||
194 | } | ||
195 | static inline u32 perf_pmasys_enginestatus_r(void) | ||
196 | { | ||
197 | return 0x001b40a4U; | ||
198 | } | ||
199 | static inline u32 perf_pmasys_enginestatus_rbufempty_f(u32 v) | ||
200 | { | ||
201 | return (v & 0x1U) << 4U; | ||
202 | } | ||
203 | static inline u32 perf_pmasys_enginestatus_rbufempty_empty_v(void) | ||
204 | { | ||
205 | return 0x00000001U; | ||
206 | } | ||
207 | static inline u32 perf_pmasys_enginestatus_rbufempty_empty_f(void) | ||
208 | { | ||
209 | return 0x10U; | ||
210 | } | ||
211 | #endif | ||