2 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Function naming determines intended use:
19 * <x>_r(void) : Returns the offset for register <x>.
21 * <x>_o(void) : Returns the offset for element <x>.
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
27 * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted
28 * and masked to place it at field <y> of register <x>. This value
29 * can be |'d with others to produce a full register value for
32 * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This
33 * value can be ~'d and then &'d to clear the value of field <y> for
36 * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted
37 * to place it at field <y> of register <x>. This value can be |'d
38 * with others to produce a full register value for <x>.
40 * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register
41 * <x> value 'r' after being shifted to place its LSB at bit 0.
42 * This value is suitable for direct comparison with other unshifted
43 * values appropriate for use in field <y> of register <x>.
45 * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for
46 * field <y> of register <x>. This value is suitable for direct
47 * comparison with unshifted values appropriate for use in field <y>
50 #ifndef _hw_ctxsw_prog_gm20b_h_
51 #define _hw_ctxsw_prog_gm20b_h_
53 static inline u32 ctxsw_prog_fecs_header_v(void)
57 static inline u32 ctxsw_prog_main_image_num_gpcs_o(void)
61 static inline u32 ctxsw_prog_main_image_patch_count_o(void)
65 static inline u32 ctxsw_prog_main_image_patch_adr_lo_o(void)
69 static inline u32 ctxsw_prog_main_image_patch_adr_hi_o(void)
73 static inline u32 ctxsw_prog_main_image_zcull_o(void)
77 static inline u32 ctxsw_prog_main_image_zcull_mode_no_ctxsw_v(void)
81 static inline u32 ctxsw_prog_main_image_zcull_mode_separate_buffer_v(void)
85 static inline u32 ctxsw_prog_main_image_zcull_ptr_o(void)
89 static inline u32 ctxsw_prog_main_image_pm_o(void)
93 static inline u32 ctxsw_prog_main_image_pm_mode_m(void)
97 static inline u32 ctxsw_prog_main_image_pm_mode_no_ctxsw_f(void)
101 static inline u32 ctxsw_prog_main_image_pm_smpc_mode_m(void)
105 static inline u32 ctxsw_prog_main_image_pm_smpc_mode_ctxsw_f(void)
109 static inline u32 ctxsw_prog_main_image_pm_smpc_mode_no_ctxsw_f(void)
113 static inline u32 ctxsw_prog_main_image_pm_pc_sampling_f(u32 v)
115 return (v & 0x1) << 6;
117 static inline u32 ctxsw_prog_main_image_pm_pc_sampling_m(void)
121 static inline u32 ctxsw_prog_main_image_pm_ptr_o(void)
125 static inline u32 ctxsw_prog_main_image_num_save_ops_o(void)
129 static inline u32 ctxsw_prog_main_image_num_restore_ops_o(void)
133 static inline u32 ctxsw_prog_main_image_magic_value_o(void)
137 static inline u32 ctxsw_prog_main_image_magic_value_v_value_v(void)
141 static inline u32 ctxsw_prog_local_priv_register_ctl_o(void)
145 static inline u32 ctxsw_prog_local_priv_register_ctl_offset_v(u32 r)
147 return (r >> 0) & 0xffff;
149 static inline u32 ctxsw_prog_local_image_ppc_info_o(void)
153 static inline u32 ctxsw_prog_local_image_ppc_info_num_ppcs_v(u32 r)
155 return (r >> 0) & 0xffff;
157 static inline u32 ctxsw_prog_local_image_ppc_info_ppc_mask_v(u32 r)
159 return (r >> 16) & 0xffff;
161 static inline u32 ctxsw_prog_local_image_num_tpcs_o(void)
165 static inline u32 ctxsw_prog_local_magic_value_o(void)
169 static inline u32 ctxsw_prog_local_magic_value_v_value_v(void)
173 static inline u32 ctxsw_prog_main_extended_buffer_ctl_o(void)
177 static inline u32 ctxsw_prog_main_extended_buffer_ctl_offset_v(u32 r)
179 return (r >> 0) & 0xffff;
181 static inline u32 ctxsw_prog_main_extended_buffer_ctl_size_v(u32 r)
183 return (r >> 16) & 0xff;
185 static inline u32 ctxsw_prog_extended_buffer_segments_size_in_bytes_v(void)
189 static inline u32 ctxsw_prog_extended_marker_size_in_bytes_v(void)
193 static inline u32 ctxsw_prog_extended_sm_dsm_perf_counter_register_stride_v(void)
197 static inline u32 ctxsw_prog_extended_sm_dsm_perf_counter_control_register_stride_v(void)
201 static inline u32 ctxsw_prog_main_image_priv_access_map_config_o(void)
205 static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_s(void)
209 static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_f(u32 v)
211 return (v & 0x3) << 0;
213 static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_m(void)
217 static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_v(u32 r)
219 return (r >> 0) & 0x3;
221 static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_allow_all_f(void)
225 static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_use_map_f(void)
229 static inline u32 ctxsw_prog_main_image_priv_access_map_addr_lo_o(void)
233 static inline u32 ctxsw_prog_main_image_priv_access_map_addr_hi_o(void)
237 static inline u32 ctxsw_prog_main_image_misc_options_o(void)
241 static inline u32 ctxsw_prog_main_image_misc_options_verif_features_m(void)
245 static inline u32 ctxsw_prog_main_image_misc_options_verif_features_disabled_f(void)
249 static inline u32 ctxsw_prog_main_image_preemption_options_o(void)
253 static inline u32 ctxsw_prog_main_image_preemption_options_control_f(u32 v)
255 return (v & 0x3) << 0;
257 static inline u32 ctxsw_prog_main_image_preemption_options_control_cta_enabled_f(void)