summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2016-12-27 05:01:00 -0500
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 05:35:06 -0500
commit7a81883a0d70c3a43ad2841ac235f6dc344c60fb (patch)
tree92923d2efccf90d1961071fa9acde59178a0d688 /drivers/gpu/nvgpu/gp106
parent505b442551a2e27aa3bc9e608c5a2bc9fccecbc4 (diff)
parent2aa3c85f8e82b3c07c39e677663abd3687c1822a (diff)
Merge remote-tracking branch 'remotes/origin/dev/merge-nvgpu-t18x-into-nvgpu' into dev-kernel
Merge T186 - gp10b/gp106 code into common nvgpu repo Bug 200266498 Change-Id: Ibf100ee38010cbed85c149b69b99147256f9a005 Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106')
-rw-r--r--drivers/gpu/nvgpu/gp106/acr_gp106.c1169
-rw-r--r--drivers/gpu/nvgpu/gp106/acr_gp106.h128
-rw-r--r--drivers/gpu/nvgpu/gp106/bios_gp106.c121
-rw-r--r--drivers/gpu/nvgpu/gp106/bios_gp106.h31
-rw-r--r--drivers/gpu/nvgpu/gp106/clk_arb_gp106.c105
-rw-r--r--drivers/gpu/nvgpu/gp106/clk_arb_gp106.h21
-rw-r--r--drivers/gpu/nvgpu/gp106/clk_gp106.c273
-rw-r--r--drivers/gpu/nvgpu/gp106/clk_gp106.h56
-rw-r--r--drivers/gpu/nvgpu/gp106/fb_gp106.c44
-rw-r--r--drivers/gpu/nvgpu/gp106/fb_gp106.h19
-rw-r--r--drivers/gpu/nvgpu/gp106/fifo_gp106.c30
-rw-r--r--drivers/gpu/nvgpu/gp106/fifo_gp106.h18
-rw-r--r--drivers/gpu/nvgpu/gp106/gp106_gating_reglist.c649
-rw-r--r--drivers/gpu/nvgpu/gp106/gp106_gating_reglist.h87
-rw-r--r--drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c50
-rw-r--r--drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h27
-rw-r--r--drivers/gpu/nvgpu/gp106/gr_gp106.c239
-rw-r--r--drivers/gpu/nvgpu/gp106/gr_gp106.h26
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c259
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.h21
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_bus_gp106.h193
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_ccsr_gp106.h125
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_ce_gp106.h81
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_ctxsw_prog_gp106.h289
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_fb_gp106.h609
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_fbpa_gp106.h61
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_fifo_gp106.h685
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_flush_gp106.h181
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_fuse_gp106.h217
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_gc6_gp106.h56
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_gmmu_gp106.h1261
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_gr_gp106.h4017
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_ltc_gp106.h553
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_mc_gp106.h245
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_pbdma_gp106.h513
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_perf_gp106.h205
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_pri_ringmaster_gp106.h145
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_pri_ringstation_sys_gp106.h69
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_proj_gp106.h165
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_psec_gp106.h609
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_pwr_gp106.h841
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_ram_gp106.h481
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_therm_gp106.h177
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_timer_gp106.h109
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_top_gp106.h221
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_trim_gp106.h189
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_xp_gp106.h137
-rw-r--r--drivers/gpu/nvgpu/gp106/hw_xve_gp106.h149
-rw-r--r--drivers/gpu/nvgpu/gp106/ltc_gp106.c29
-rw-r--r--drivers/gpu/nvgpu/gp106/ltc_gp106.h19
-rw-r--r--drivers/gpu/nvgpu/gp106/mm_gp106.c41
-rw-r--r--drivers/gpu/nvgpu/gp106/mm_gp106.h23
-rw-r--r--drivers/gpu/nvgpu/gp106/pmu_gp106.c296
-rw-r--r--drivers/gpu/nvgpu/gp106/pmu_gp106.h22
-rw-r--r--drivers/gpu/nvgpu/gp106/regops_gp106.c1815
-rw-r--r--drivers/gpu/nvgpu/gp106/regops_gp106.h24
-rw-r--r--drivers/gpu/nvgpu/gp106/sec2_gp106.c388
-rw-r--r--drivers/gpu/nvgpu/gp106/sec2_gp106.h29
-rw-r--r--drivers/gpu/nvgpu/gp106/therm_gp106.c128
-rw-r--r--drivers/gpu/nvgpu/gp106/therm_gp106.h22
-rw-r--r--drivers/gpu/nvgpu/gp106/xve_gp106.c623
-rw-r--r--drivers/gpu/nvgpu/gp106/xve_gp106.h99
62 files changed, 19514 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp106/acr_gp106.c b/drivers/gpu/nvgpu/gp106/acr_gp106.c
new file mode 100644
index 00000000..5ed6300c
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/acr_gp106.c
@@ -0,0 +1,1169 @@
1/*
2 * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include <linux/delay.h> /* for mdelay */
15#include <linux/firmware.h>
16#include <linux/clk.h>
17#include <linux/module.h>
18#include <linux/debugfs.h>
19#include <linux/dma-mapping.h>
20#include <linux/io.h>
21
22#include "gk20a/gk20a.h"
23#include "gk20a/pmu_gk20a.h"
24#include "gk20a/semaphore_gk20a.h"
25#include "gp106/hw_psec_gp106.h"
26#include "gp106/hw_pwr_gp106.h"
27#include "gm206/acr_gm206.h"
28#include "gm20b/acr_gm20b.h"
29#include "gm206/pmu_gm206.h"
30#include "sec2_gp106.h"
31#include "nvgpu_gpuid_t18x.h"
32#include "nvgpu_common.h"
33
34/*Defines*/
35#define gp106_dbg_pmu(fmt, arg...) \
36 gk20a_dbg(gpu_dbg_pmu, fmt, ##arg)
37
38typedef int (*get_ucode_details)(struct gk20a *g,
39 struct flcn_ucode_img_v1 *udata);
40
41/* Both size and address of WPR need to be 128K-aligned */
42#define WPR_ALIGNMENT 0x20000
43#define GP106_DGPU_NONWPR NVGPU_VIDMEM_BOOTSTRAP_ALLOCATOR_BASE
44#define GP106_DGPU_WPR_OFFSET 0x400000
45#define DGPU_WPR_SIZE 0x100000
46
47/*Externs*/
48
49/*Forwards*/
50static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img);
51static int fecs_ucode_details(struct gk20a *g,
52 struct flcn_ucode_img_v1 *p_img);
53static int gpccs_ucode_details(struct gk20a *g,
54 struct flcn_ucode_img_v1 *p_img);
55static int gp106_bootstrap_hs_flcn(struct gk20a *g);
56
57static int lsfm_discover_ucode_images(struct gk20a *g,
58 struct ls_flcn_mgr_v1 *plsfm);
59static int lsfm_add_ucode_img(struct gk20a *g, struct ls_flcn_mgr_v1 *plsfm,
60 struct flcn_ucode_img_v1 *ucode_image, u32 falcon_id);
61static void lsfm_free_ucode_img_res(struct flcn_ucode_img_v1 *p_img);
62static void lsfm_free_nonpmu_ucode_img_res(struct flcn_ucode_img_v1 *p_img);
63static int lsf_gen_wpr_requirements(struct gk20a *g,
64 struct ls_flcn_mgr_v1 *plsfm);
65static void lsfm_init_wpr_contents(struct gk20a *g,
66 struct ls_flcn_mgr_v1 *plsfm, struct mem_desc *nonwpr);
67static void free_acr_resources(struct gk20a *g, struct ls_flcn_mgr_v1 *plsfm);
68static int gp106_pmu_populate_loader_cfg(struct gk20a *g,
69 void *lsfm, u32 *p_bl_gen_desc_size);
70static int gp106_flcn_populate_bl_dmem_desc(struct gk20a *g,
71 void *lsfm, u32 *p_bl_gen_desc_size, u32 falconid);
72static int gp106_prepare_ucode_blob(struct gk20a *g);
73
74/*Globals*/
75static get_ucode_details pmu_acr_supp_ucode_list[] = {
76 pmu_ucode_details,
77 fecs_ucode_details,
78 gpccs_ucode_details,
79};
80
81static void gp106_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf)
82{
83 inf->nonwpr_base = g->mm.vidmem.bootstrap_base;
84 inf->wpr_base = inf->nonwpr_base + GP106_DGPU_WPR_OFFSET;
85 inf->size = DGPU_WPR_SIZE;
86}
87
88static void flcn64_set_dma(struct falc_u64 *dma_addr, u64 value)
89{
90 dma_addr->lo |= u64_lo32(value);
91 dma_addr->hi |= u64_hi32(value);
92}
93
94static int gp106_alloc_blob_space(struct gk20a *g,
95 size_t size, struct mem_desc *mem)
96{
97 struct wpr_carveout_info wpr_inf;
98 int err;
99
100 if (mem->size)
101 return 0;
102
103 g->ops.pmu.get_wpr(g, &wpr_inf);
104
105 /*
106 * Even though this mem_desc wouldn't be used, the wpr region needs to
107 * be reserved in the allocator.
108 */
109 err = gk20a_gmmu_alloc_attr_vid_at(g, 0, wpr_inf.size,
110 &g->acr.wpr_dummy, wpr_inf.wpr_base);
111 if (err)
112 return err;
113
114 return gk20a_gmmu_alloc_attr_vid_at(g, 0, wpr_inf.size, mem,
115 wpr_inf.nonwpr_base);
116}
117
118void gp106_init_secure_pmu(struct gpu_ops *gops)
119{
120 gops->pmu.prepare_ucode = gp106_prepare_ucode_blob;
121 gops->pmu.pmu_setup_hw_and_bootstrap = gp106_bootstrap_hs_flcn;
122 gops->pmu.is_lazy_bootstrap = gm206_is_lazy_bootstrap;
123 gops->pmu.is_priv_load = gm206_is_priv_load;
124 gops->pmu.get_wpr = gp106_wpr_info;
125 gops->pmu.alloc_blob_space = gp106_alloc_blob_space;
126 gops->pmu.pmu_populate_loader_cfg = gp106_pmu_populate_loader_cfg;
127 gops->pmu.flcn_populate_bl_dmem_desc = gp106_flcn_populate_bl_dmem_desc;
128 gops->pmu.falcon_wait_for_halt = sec2_wait_for_halt;
129 gops->pmu.falcon_clear_halt_interrupt_status =
130 sec2_clear_halt_interrupt_status;
131 gops->pmu.init_falcon_setup_hw = init_sec2_setup_hw1;
132}
133/* TODO - check if any free blob res needed*/
134
135static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img)
136{
137 const struct firmware *pmu_fw, *pmu_desc, *pmu_sig;
138 struct pmu_gk20a *pmu = &g->pmu;
139 struct lsf_ucode_desc_v1 *lsf_desc;
140 int err;
141
142 gp106_dbg_pmu("requesting PMU ucode in gp106\n");
143 pmu_fw = nvgpu_request_firmware(g, GM20B_PMU_UCODE_IMAGE,
144 NVGPU_REQUEST_FIRMWARE_NO_SOC);
145 if (!pmu_fw) {
146 gk20a_err(dev_from_gk20a(g), "failed to load pmu ucode!!");
147 return -ENOENT;
148 }
149 g->acr.pmu_fw = pmu_fw;
150 gp106_dbg_pmu("Loaded PMU ucode in for blob preparation");
151
152 gp106_dbg_pmu("requesting PMU ucode desc in GM20B\n");
153 pmu_desc = nvgpu_request_firmware(g, GM20B_PMU_UCODE_DESC,
154 NVGPU_REQUEST_FIRMWARE_NO_SOC);
155 if (!pmu_desc) {
156 gk20a_err(dev_from_gk20a(g), "failed to load pmu ucode desc!!");
157 err = -ENOENT;
158 goto release_img_fw;
159 }
160 pmu_sig = nvgpu_request_firmware(g, GM20B_PMU_UCODE_SIG,
161 NVGPU_REQUEST_FIRMWARE_NO_SOC);
162 if (!pmu_sig) {
163 gk20a_err(dev_from_gk20a(g), "failed to load pmu sig!!");
164 err = -ENOENT;
165 goto release_desc;
166 }
167 pmu->desc_v1 = (struct pmu_ucode_desc_v1 *)pmu_desc->data;
168 pmu->ucode_image = (u32 *)pmu_fw->data;
169 g->acr.pmu_desc = pmu_desc;
170
171 err = gk20a_init_pmu(pmu);
172 if (err) {
173 gp106_dbg_pmu("failed to set function pointers\n");
174 goto release_sig;
175 }
176
177 lsf_desc = kzalloc(sizeof(struct lsf_ucode_desc_v1), GFP_KERNEL);
178 if (!lsf_desc) {
179 err = -ENOMEM;
180 goto release_sig;
181 }
182 memcpy(lsf_desc, (void *)pmu_sig->data, sizeof(struct lsf_ucode_desc_v1));
183 lsf_desc->falcon_id = LSF_FALCON_ID_PMU;
184
185 p_img->desc = pmu->desc_v1;
186 p_img->data = pmu->ucode_image;
187 p_img->data_size = pmu->desc_v1->app_start_offset
188 + pmu->desc_v1->app_size;
189 p_img->fw_ver = NULL;
190 p_img->header = NULL;
191 p_img->lsf_desc = (struct lsf_ucode_desc_v1 *)lsf_desc;
192 gp106_dbg_pmu("requesting PMU ucode in GM20B exit\n");
193
194 release_firmware(pmu_sig);
195 return 0;
196release_sig:
197 release_firmware(pmu_sig);
198release_desc:
199 release_firmware(pmu_desc);
200release_img_fw:
201 release_firmware(pmu_fw);
202 return err;
203}
204
205static int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img)
206{
207 u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl;
208 struct lsf_ucode_desc_v1 *lsf_desc;
209 const struct firmware *fecs_sig = NULL;
210 int err;
211
212 switch (ver) {
213 case NVGPU_GPUID_GP104:
214 fecs_sig = nvgpu_request_firmware(g,
215 GP104_FECS_UCODE_SIG,
216 NVGPU_REQUEST_FIRMWARE_NO_SOC);
217 break;
218 case NVGPU_GPUID_GP106:
219 fecs_sig = nvgpu_request_firmware(g,
220 GP106_FECS_UCODE_SIG,
221 NVGPU_REQUEST_FIRMWARE_NO_SOC);
222 break;
223 default:
224 gk20a_err(g->dev, "no support for GPUID %x", ver);
225 }
226
227 if (!fecs_sig) {
228 gk20a_err(dev_from_gk20a(g), "failed to load fecs sig");
229 return -ENOENT;
230 }
231 lsf_desc = kzalloc(sizeof(struct lsf_ucode_desc_v1), GFP_KERNEL);
232 if (!lsf_desc) {
233 err = -ENOMEM;
234 goto rel_sig;
235 }
236 memcpy(lsf_desc, (void *)fecs_sig->data, sizeof(struct lsf_ucode_desc_v1));
237 lsf_desc->falcon_id = LSF_FALCON_ID_FECS;
238
239 p_img->desc = kzalloc(sizeof(struct pmu_ucode_desc_v1), GFP_KERNEL);
240 if (p_img->desc == NULL) {
241 err = -ENOMEM;
242 goto free_lsf_desc;
243 }
244
245 p_img->desc->bootloader_start_offset =
246 g->ctxsw_ucode_info.fecs.boot.offset;
247 p_img->desc->bootloader_size =
248 ALIGN(g->ctxsw_ucode_info.fecs.boot.size, 256);
249 p_img->desc->bootloader_imem_offset =
250 g->ctxsw_ucode_info.fecs.boot_imem_offset;
251 p_img->desc->bootloader_entry_point =
252 g->ctxsw_ucode_info.fecs.boot_entry;
253
254 p_img->desc->image_size =
255 ALIGN(g->ctxsw_ucode_info.fecs.boot.size, 256) +
256 ALIGN(g->ctxsw_ucode_info.fecs.code.size, 256) +
257 ALIGN(g->ctxsw_ucode_info.fecs.data.size, 256);
258 p_img->desc->app_size = ALIGN(g->ctxsw_ucode_info.fecs.code.size, 256) +
259 ALIGN(g->ctxsw_ucode_info.fecs.data.size, 256);
260 p_img->desc->app_start_offset = g->ctxsw_ucode_info.fecs.code.offset;
261 p_img->desc->app_imem_offset = 0;
262 p_img->desc->app_imem_entry = 0;
263 p_img->desc->app_dmem_offset = 0;
264 p_img->desc->app_resident_code_offset = 0;
265 p_img->desc->app_resident_code_size =
266 g->ctxsw_ucode_info.fecs.code.size;
267 p_img->desc->app_resident_data_offset =
268 g->ctxsw_ucode_info.fecs.data.offset -
269 g->ctxsw_ucode_info.fecs.code.offset;
270 p_img->desc->app_resident_data_size =
271 g->ctxsw_ucode_info.fecs.data.size;
272 p_img->data = g->ctxsw_ucode_info.surface_desc.cpu_va;
273 p_img->data_size = p_img->desc->image_size;
274
275 p_img->fw_ver = NULL;
276 p_img->header = NULL;
277 p_img->lsf_desc = (struct lsf_ucode_desc_v1 *)lsf_desc;
278 gp106_dbg_pmu("fecs fw loaded\n");
279 release_firmware(fecs_sig);
280 return 0;
281free_lsf_desc:
282 kfree(lsf_desc);
283rel_sig:
284 release_firmware(fecs_sig);
285 return err;
286}
287
288static int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img)
289{
290 u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl;
291 struct lsf_ucode_desc_v1 *lsf_desc;
292 const struct firmware *gpccs_sig = NULL;
293 int err;
294
295 if (g->ops.securegpccs == false)
296 return -ENOENT;
297
298 switch (ver) {
299 case NVGPU_GPUID_GP104:
300 gpccs_sig = nvgpu_request_firmware(g,
301 GP104_GPCCS_UCODE_SIG,
302 NVGPU_REQUEST_FIRMWARE_NO_SOC);
303 break;
304 case NVGPU_GPUID_GP106:
305 gpccs_sig = nvgpu_request_firmware(g,
306 GP106_GPCCS_UCODE_SIG,
307 NVGPU_REQUEST_FIRMWARE_NO_SOC);
308 break;
309 default:
310 gk20a_err(g->dev, "no support for GPUID %x", ver);
311 }
312
313 if (!gpccs_sig) {
314 gk20a_err(dev_from_gk20a(g), "failed to load gpccs sig");
315 return -ENOENT;
316 }
317 lsf_desc = kzalloc(sizeof(struct lsf_ucode_desc_v1), GFP_KERNEL);
318 if (!lsf_desc) {
319 err = -ENOMEM;
320 goto rel_sig;
321 }
322 memcpy(lsf_desc, (void *)gpccs_sig->data,
323 sizeof(struct lsf_ucode_desc_v1));
324 lsf_desc->falcon_id = LSF_FALCON_ID_GPCCS;
325
326 p_img->desc = kzalloc(sizeof(struct pmu_ucode_desc_v1), GFP_KERNEL);
327 if (p_img->desc == NULL) {
328 err = -ENOMEM;
329 goto free_lsf_desc;
330 }
331
332 p_img->desc->bootloader_start_offset =
333 0;
334 p_img->desc->bootloader_size =
335 ALIGN(g->ctxsw_ucode_info.gpccs.boot.size, 256);
336 p_img->desc->bootloader_imem_offset =
337 g->ctxsw_ucode_info.gpccs.boot_imem_offset;
338 p_img->desc->bootloader_entry_point =
339 g->ctxsw_ucode_info.gpccs.boot_entry;
340
341 p_img->desc->image_size =
342 ALIGN(g->ctxsw_ucode_info.gpccs.boot.size, 256) +
343 ALIGN(g->ctxsw_ucode_info.gpccs.code.size, 256) +
344 ALIGN(g->ctxsw_ucode_info.gpccs.data.size, 256);
345 p_img->desc->app_size = ALIGN(g->ctxsw_ucode_info.gpccs.code.size, 256)
346 + ALIGN(g->ctxsw_ucode_info.gpccs.data.size, 256);
347 p_img->desc->app_start_offset = p_img->desc->bootloader_size;
348 p_img->desc->app_imem_offset = 0;
349 p_img->desc->app_imem_entry = 0;
350 p_img->desc->app_dmem_offset = 0;
351 p_img->desc->app_resident_code_offset = 0;
352 p_img->desc->app_resident_code_size =
353 ALIGN(g->ctxsw_ucode_info.gpccs.code.size, 256);
354 p_img->desc->app_resident_data_offset =
355 ALIGN(g->ctxsw_ucode_info.gpccs.data.offset, 256) -
356 ALIGN(g->ctxsw_ucode_info.gpccs.code.offset, 256);
357 p_img->desc->app_resident_data_size =
358 ALIGN(g->ctxsw_ucode_info.gpccs.data.size, 256);
359 p_img->data = (u32 *)((u8 *)g->ctxsw_ucode_info.surface_desc.cpu_va +
360 g->ctxsw_ucode_info.gpccs.boot.offset);
361 p_img->data_size = ALIGN(p_img->desc->image_size, 256);
362 p_img->fw_ver = NULL;
363 p_img->header = NULL;
364 p_img->lsf_desc = (struct lsf_ucode_desc_v1 *)lsf_desc;
365 gp106_dbg_pmu("gpccs fw loaded\n");
366 release_firmware(gpccs_sig);
367 return 0;
368free_lsf_desc:
369 kfree(lsf_desc);
370rel_sig:
371 release_firmware(gpccs_sig);
372 return err;
373}
374
375static int gp106_prepare_ucode_blob(struct gk20a *g)
376{
377
378 int err;
379 struct ls_flcn_mgr_v1 lsfm_l, *plsfm;
380 struct pmu_gk20a *pmu = &g->pmu;
381 struct wpr_carveout_info wpr_inf;
382
383 if (g->acr.ucode_blob.cpu_va) {
384 /*Recovery case, we do not need to form
385 non WPR blob of ucodes*/
386 err = gk20a_init_pmu(pmu);
387 if (err) {
388 gp106_dbg_pmu("failed to set function pointers\n");
389 return err;
390 }
391 return 0;
392 }
393 plsfm = &lsfm_l;
394 memset((void *)plsfm, 0, sizeof(struct ls_flcn_mgr_v1));
395 gp106_dbg_pmu("fetching GMMU regs\n");
396 gm20b_mm_mmu_vpr_info_fetch(g);
397 gr_gk20a_init_ctxsw_ucode(g);
398
399 g->ops.pmu.get_wpr(g, &wpr_inf);
400 gp106_dbg_pmu("wpr carveout base:%llx\n", (wpr_inf.wpr_base));
401 gp106_dbg_pmu("wpr carveout size :%x\n", (u32)wpr_inf.size);
402
403 /* Discover all managed falcons*/
404 err = lsfm_discover_ucode_images(g, plsfm);
405 gp106_dbg_pmu(" Managed Falcon cnt %d\n", plsfm->managed_flcn_cnt);
406 if (err)
407 goto exit_err;
408
409 if (plsfm->managed_flcn_cnt && !g->acr.ucode_blob.cpu_va) {
410 /* Generate WPR requirements*/
411 err = lsf_gen_wpr_requirements(g, plsfm);
412 if (err)
413 goto exit_err;
414
415 /*Alloc memory to hold ucode blob contents*/
416 err = g->ops.pmu.alloc_blob_space(g, plsfm->wpr_size
417 ,&g->acr.ucode_blob);
418 if (err)
419 goto exit_err;
420
421 gp106_dbg_pmu("managed LS falcon %d, WPR size %d bytes.\n",
422 plsfm->managed_flcn_cnt, plsfm->wpr_size);
423
424 lsfm_init_wpr_contents(g, plsfm, &g->acr.ucode_blob);
425 } else {
426 gp106_dbg_pmu("LSFM is managing no falcons.\n");
427 }
428 gp106_dbg_pmu("prepare ucode blob return 0\n");
429 free_acr_resources(g, plsfm);
430
431 exit_err:
432 return err;
433}
434
435static u8 lsfm_falcon_disabled(struct gk20a *g, struct ls_flcn_mgr_v1 *plsfm,
436 u32 falcon_id)
437{
438 return (plsfm->disable_mask >> falcon_id) & 0x1;
439}
440
441/* Discover all managed falcon ucode images */
442static int lsfm_discover_ucode_images(struct gk20a *g,
443 struct ls_flcn_mgr_v1 *plsfm)
444{
445 struct pmu_gk20a *pmu = &g->pmu;
446 struct flcn_ucode_img_v1 ucode_img;
447 u32 falcon_id;
448 u32 i;
449 int status;
450
451 /* LSFM requires a secure PMU, discover it first.*/
452 /* Obtain the PMU ucode image and add it to the list if required*/
453 memset(&ucode_img, 0, sizeof(ucode_img));
454 status = pmu_ucode_details(g, &ucode_img);
455 if (status == 0) {
456 if (ucode_img.lsf_desc != NULL) {
457 /* The falon_id is formed by grabbing the static base
458 * falon_id from the image and adding the
459 * engine-designated falcon instance.*/
460 pmu->pmu_mode |= PMU_SECURE_MODE;
461 falcon_id = ucode_img.lsf_desc->falcon_id +
462 ucode_img.flcn_inst;
463
464 if (!lsfm_falcon_disabled(g, plsfm, falcon_id)) {
465 pmu->falcon_id = falcon_id;
466 if (lsfm_add_ucode_img(g, plsfm, &ucode_img,
467 pmu->falcon_id) == 0)
468 pmu->pmu_mode |= PMU_LSFM_MANAGED;
469
470 plsfm->managed_flcn_cnt++;
471 } else {
472 gp106_dbg_pmu("id not managed %d\n",
473 ucode_img.lsf_desc->falcon_id);
474 }
475 }
476
477 /*Free any ucode image resources if not managing this falcon*/
478 if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) {
479 gp106_dbg_pmu("pmu is not LSFM managed\n");
480 lsfm_free_ucode_img_res(&ucode_img);
481 }
482 }
483
484 /* Enumerate all constructed falcon objects,
485 as we need the ucode image info and total falcon count.*/
486
487 /*0th index is always PMU which is already handled in earlier
488 if condition*/
489 for (i = 1; i < (MAX_SUPPORTED_LSFM); i++) {
490 memset(&ucode_img, 0, sizeof(ucode_img));
491 if (pmu_acr_supp_ucode_list[i](g, &ucode_img) == 0) {
492 if (ucode_img.lsf_desc != NULL) {
493 /* We have engine sigs, ensure that this falcon
494 is aware of the secure mode expectations
495 (ACR status)*/
496
497 /* falon_id is formed by grabbing the static
498 base falonId from the image and adding the
499 engine-designated falcon instance. */
500 falcon_id = ucode_img.lsf_desc->falcon_id +
501 ucode_img.flcn_inst;
502
503 if (!lsfm_falcon_disabled(g, plsfm,
504 falcon_id)) {
505 /* Do not manage non-FB ucode*/
506 if (lsfm_add_ucode_img(g,
507 plsfm, &ucode_img, falcon_id)
508 == 0)
509 plsfm->managed_flcn_cnt++;
510 } else {
511 gp106_dbg_pmu("not managed %d\n",
512 ucode_img.lsf_desc->falcon_id);
513 lsfm_free_nonpmu_ucode_img_res(
514 &ucode_img);
515 }
516 }
517 } else {
518 /* Consumed all available falcon objects */
519 gp106_dbg_pmu("Done checking for ucodes %d\n", i);
520 break;
521 }
522 }
523 return 0;
524}
525
526static int gp106_pmu_populate_loader_cfg(struct gk20a *g,
527 void *lsfm, u32 *p_bl_gen_desc_size)
528{
529 struct wpr_carveout_info wpr_inf;
530 struct pmu_gk20a *pmu = &g->pmu;
531 struct lsfm_managed_ucode_img_v2 *p_lsfm =
532 (struct lsfm_managed_ucode_img_v2 *)lsfm;
533 struct flcn_ucode_img_v1 *p_img = &(p_lsfm->ucode_img);
534 struct flcn_bl_dmem_desc_v1 *ldr_cfg =
535 &(p_lsfm->bl_gen_desc.bl_dmem_desc_v1);
536 u64 addr_base;
537 struct pmu_ucode_desc_v1 *desc;
538 u64 addr_code, addr_data;
539 u32 addr_args;
540
541 if (p_img->desc == NULL) /*This means its a header based ucode,
542 and so we do not fill BL gen desc structure*/
543 return -EINVAL;
544 desc = p_img->desc;
545 /*
546 Calculate physical and virtual addresses for various portions of
547 the PMU ucode image
548 Calculate the 32-bit addresses for the application code, application
549 data, and bootloader code. These values are all based on IM_BASE.
550 The 32-bit addresses will be the upper 32-bits of the virtual or
551 physical addresses of each respective segment.
552 */
553 addr_base = p_lsfm->lsb_header.ucode_off;
554 g->ops.pmu.get_wpr(g, &wpr_inf);
555 addr_base += (wpr_inf.wpr_base);
556
557 gp106_dbg_pmu("pmu loader cfg u32 addrbase %x\n", (u32)addr_base);
558 /*From linux*/
559 addr_code = u64_lo32((addr_base +
560 desc->app_start_offset +
561 desc->app_resident_code_offset) );
562 gp106_dbg_pmu("app start %d app res code off %d\n",
563 desc->app_start_offset, desc->app_resident_code_offset);
564 addr_data = u64_lo32((addr_base +
565 desc->app_start_offset +
566 desc->app_resident_data_offset) );
567 gp106_dbg_pmu("app res data offset%d\n",
568 desc->app_resident_data_offset);
569 gp106_dbg_pmu("bl start off %d\n", desc->bootloader_start_offset);
570
571 addr_args = ((pwr_falcon_hwcfg_dmem_size_v(
572 gk20a_readl(g, pwr_falcon_hwcfg_r())))
573 << GK20A_PMU_DMEM_BLKSIZE2);
574
575 addr_args -= g->ops.pmu_ver.get_pmu_cmdline_args_size(pmu);
576
577 gp106_dbg_pmu("addr_args %x\n", addr_args);
578
579 /* Populate the LOADER_CONFIG state */
580 memset((void *) ldr_cfg, 0, sizeof(struct flcn_bl_dmem_desc_v1));
581 ldr_cfg->ctx_dma = GK20A_PMU_DMAIDX_UCODE;
582 flcn64_set_dma(&ldr_cfg->code_dma_base, addr_code);
583 ldr_cfg->non_sec_code_off = desc->app_resident_code_offset;
584 ldr_cfg->non_sec_code_size = desc->app_resident_code_size;
585 flcn64_set_dma(&ldr_cfg->data_dma_base, addr_data);
586 ldr_cfg->data_size = desc->app_resident_data_size;
587 ldr_cfg->code_entry_point = desc->app_imem_entry;
588
589 /* Update the argc/argv members*/
590 ldr_cfg->argc = 1;
591 ldr_cfg->argv = addr_args;
592
593 *p_bl_gen_desc_size = sizeof(struct flcn_bl_dmem_desc_v1);
594
595 g->acr.pmu_args = addr_args;
596 return 0;
597}
598
599static int gp106_flcn_populate_bl_dmem_desc(struct gk20a *g,
600 void *lsfm, u32 *p_bl_gen_desc_size, u32 falconid)
601{
602 struct wpr_carveout_info wpr_inf;
603 struct lsfm_managed_ucode_img_v2 *p_lsfm =
604 (struct lsfm_managed_ucode_img_v2 *)lsfm;
605 struct flcn_ucode_img_v1 *p_img = &(p_lsfm->ucode_img);
606 struct flcn_bl_dmem_desc_v1 *ldr_cfg =
607 &(p_lsfm->bl_gen_desc.bl_dmem_desc_v1);
608 u64 addr_base;
609 struct pmu_ucode_desc_v1 *desc;
610 u64 addr_code, addr_data;
611
612 if (p_img->desc == NULL) /*This means its a header based ucode,
613 and so we do not fill BL gen desc structure*/
614 return -EINVAL;
615 desc = p_img->desc;
616
617 /*
618 Calculate physical and virtual addresses for various portions of
619 the PMU ucode image
620 Calculate the 32-bit addresses for the application code, application
621 data, and bootloader code. These values are all based on IM_BASE.
622 The 32-bit addresses will be the upper 32-bits of the virtual or
623 physical addresses of each respective segment.
624 */
625 addr_base = p_lsfm->lsb_header.ucode_off;
626 g->ops.pmu.get_wpr(g, &wpr_inf);
627 addr_base += (wpr_inf.wpr_base);
628
629 gp106_dbg_pmu("gen loader cfg %x u32 addrbase %x ID\n", (u32)addr_base,
630 p_lsfm->wpr_header.falcon_id);
631 addr_code = u64_lo32((addr_base +
632 desc->app_start_offset +
633 desc->app_resident_code_offset) );
634 addr_data = u64_lo32((addr_base +
635 desc->app_start_offset +
636 desc->app_resident_data_offset) );
637
638 gp106_dbg_pmu("gen cfg %x u32 addrcode %x & data %x load offset %xID\n",
639 (u32)addr_code, (u32)addr_data, desc->bootloader_start_offset,
640 p_lsfm->wpr_header.falcon_id);
641
642 /* Populate the LOADER_CONFIG state */
643 memset((void *) ldr_cfg, 0, sizeof(struct flcn_bl_dmem_desc_v1));
644 ldr_cfg->ctx_dma = GK20A_PMU_DMAIDX_UCODE;
645 flcn64_set_dma(&ldr_cfg->code_dma_base, addr_code);
646 ldr_cfg->non_sec_code_size = desc->app_resident_code_size;
647 flcn64_set_dma(&ldr_cfg->data_dma_base, addr_data);
648 ldr_cfg->data_size = desc->app_resident_data_size;
649 ldr_cfg->code_entry_point = desc->app_imem_entry;
650
651 *p_bl_gen_desc_size = sizeof(struct flcn_bl_dmem_desc_v1);
652 return 0;
653}
654
655/* Populate falcon boot loader generic desc.*/
656static int lsfm_fill_flcn_bl_gen_desc(struct gk20a *g,
657 struct lsfm_managed_ucode_img_v2 *pnode)
658{
659
660 struct pmu_gk20a *pmu = &g->pmu;
661 if (pnode->wpr_header.falcon_id != pmu->falcon_id) {
662 gp106_dbg_pmu("non pmu. write flcn bl gen desc\n");
663 g->ops.pmu.flcn_populate_bl_dmem_desc(g,
664 pnode, &pnode->bl_gen_desc_size,
665 pnode->wpr_header.falcon_id);
666 return 0;
667 }
668
669 if (pmu->pmu_mode & PMU_LSFM_MANAGED) {
670 gp106_dbg_pmu("pmu write flcn bl gen desc\n");
671 if (pnode->wpr_header.falcon_id == pmu->falcon_id)
672 return g->ops.pmu.pmu_populate_loader_cfg(g, pnode,
673 &pnode->bl_gen_desc_size);
674 }
675
676 /* Failed to find the falcon requested. */
677 return -ENOENT;
678}
679
680/* Initialize WPR contents */
681static void lsfm_init_wpr_contents(struct gk20a *g,
682 struct ls_flcn_mgr_v1 *plsfm, struct mem_desc *ucode)
683{
684 struct lsfm_managed_ucode_img_v2 *pnode = plsfm->ucode_img_list;
685 u32 i;
686
687 /* The WPR array is at the base of the WPR */
688 pnode = plsfm->ucode_img_list;
689 i = 0;
690
691 /*
692 * Walk the managed falcons, flush WPR and LSB headers to FB.
693 * flush any bl args to the storage area relative to the
694 * ucode image (appended on the end as a DMEM area).
695 */
696 while (pnode) {
697 /* Flush WPR header to memory*/
698 gk20a_mem_wr_n(g, ucode, i * sizeof(pnode->wpr_header),
699 &pnode->wpr_header, sizeof(pnode->wpr_header));
700
701 gp106_dbg_pmu("wpr header");
702 gp106_dbg_pmu("falconid :%d",
703 pnode->wpr_header.falcon_id);
704 gp106_dbg_pmu("lsb_offset :%x",
705 pnode->wpr_header.lsb_offset);
706 gp106_dbg_pmu("bootstrap_owner :%d",
707 pnode->wpr_header.bootstrap_owner);
708 gp106_dbg_pmu("lazy_bootstrap :%d",
709 pnode->wpr_header.lazy_bootstrap);
710 gp106_dbg_pmu("status :%d",
711 pnode->wpr_header.status);
712
713 /*Flush LSB header to memory*/
714 gk20a_mem_wr_n(g, ucode, pnode->wpr_header.lsb_offset,
715 &pnode->lsb_header, sizeof(pnode->lsb_header));
716
717 gp106_dbg_pmu("lsb header");
718 gp106_dbg_pmu("ucode_off :%x",
719 pnode->lsb_header.ucode_off);
720 gp106_dbg_pmu("ucode_size :%x",
721 pnode->lsb_header.ucode_size);
722 gp106_dbg_pmu("data_size :%x",
723 pnode->lsb_header.data_size);
724 gp106_dbg_pmu("bl_code_size :%x",
725 pnode->lsb_header.bl_code_size);
726 gp106_dbg_pmu("bl_imem_off :%x",
727 pnode->lsb_header.bl_imem_off);
728 gp106_dbg_pmu("bl_data_off :%x",
729 pnode->lsb_header.bl_data_off);
730 gp106_dbg_pmu("bl_data_size :%x",
731 pnode->lsb_header.bl_data_size);
732 gp106_dbg_pmu("app_code_off :%x",
733 pnode->lsb_header.app_code_off);
734 gp106_dbg_pmu("app_code_size :%x",
735 pnode->lsb_header.app_code_size);
736 gp106_dbg_pmu("app_data_off :%x",
737 pnode->lsb_header.app_data_off);
738 gp106_dbg_pmu("app_data_size :%x",
739 pnode->lsb_header.app_data_size);
740 gp106_dbg_pmu("flags :%x",
741 pnode->lsb_header.flags);
742
743 /*If this falcon has a boot loader and related args,
744 * flush them.*/
745 if (!pnode->ucode_img.header) {
746 /*Populate gen bl and flush to memory*/
747 lsfm_fill_flcn_bl_gen_desc(g, pnode);
748 gk20a_mem_wr_n(g, ucode,
749 pnode->lsb_header.bl_data_off,
750 &pnode->bl_gen_desc,
751 pnode->bl_gen_desc_size);
752 }
753 /*Copying of ucode*/
754 gk20a_mem_wr_n(g, ucode, pnode->lsb_header.ucode_off,
755 pnode->ucode_img.data,
756 pnode->ucode_img.data_size);
757 pnode = pnode->next;
758 i++;
759 }
760
761 /* Tag the terminator WPR header with an invalid falcon ID. */
762 gk20a_mem_wr32(g, ucode,
763 plsfm->managed_flcn_cnt * sizeof(struct lsf_wpr_header) +
764 offsetof(struct lsf_wpr_header, falcon_id),
765 LSF_FALCON_ID_INVALID);
766}
767
768/*!
769 * lsfm_parse_no_loader_ucode: parses UCODE header of falcon
770 *
771 * @param[in] p_ucodehdr : UCODE header
772 * @param[out] lsb_hdr : updates values in LSB header
773 *
774 * @return 0
775 */
776static int lsfm_parse_no_loader_ucode(u32 *p_ucodehdr,
777 struct lsf_lsb_header_v1 *lsb_hdr)
778{
779
780 u32 code_size = 0;
781 u32 data_size = 0;
782 u32 i = 0;
783 u32 total_apps = p_ucodehdr[FLCN_NL_UCODE_HDR_NUM_APPS_IND];
784
785 /* Lets calculate code size*/
786 code_size += p_ucodehdr[FLCN_NL_UCODE_HDR_OS_CODE_SIZE_IND];
787 for (i = 0; i < total_apps; i++) {
788 code_size += p_ucodehdr[FLCN_NL_UCODE_HDR_APP_CODE_SIZE_IND
789 (total_apps, i)];
790 }
791 code_size += p_ucodehdr[FLCN_NL_UCODE_HDR_OS_OVL_SIZE_IND(total_apps)];
792
793 /* Calculate data size*/
794 data_size += p_ucodehdr[FLCN_NL_UCODE_HDR_OS_DATA_SIZE_IND];
795 for (i = 0; i < total_apps; i++) {
796 data_size += p_ucodehdr[FLCN_NL_UCODE_HDR_APP_DATA_SIZE_IND
797 (total_apps, i)];
798 }
799
800 lsb_hdr->ucode_size = code_size;
801 lsb_hdr->data_size = data_size;
802 lsb_hdr->bl_code_size = p_ucodehdr[FLCN_NL_UCODE_HDR_OS_CODE_SIZE_IND];
803 lsb_hdr->bl_imem_off = 0;
804 lsb_hdr->bl_data_off = p_ucodehdr[FLCN_NL_UCODE_HDR_OS_DATA_OFF_IND];
805 lsb_hdr->bl_data_size = p_ucodehdr[FLCN_NL_UCODE_HDR_OS_DATA_SIZE_IND];
806 return 0;
807}
808
809/*!
810 * @brief lsfm_fill_static_lsb_hdr_info
811 * Populate static LSB header infomation using the provided ucode image
812 */
813static void lsfm_fill_static_lsb_hdr_info(struct gk20a *g,
814 u32 falcon_id, struct lsfm_managed_ucode_img_v2 *pnode)
815{
816
817 struct pmu_gk20a *pmu = &g->pmu;
818 u32 full_app_size = 0;
819 u32 data = 0;
820
821 if (pnode->ucode_img.lsf_desc)
822 memcpy(&pnode->lsb_header.signature, pnode->ucode_img.lsf_desc,
823 sizeof(struct lsf_ucode_desc_v1));
824 pnode->lsb_header.ucode_size = pnode->ucode_img.data_size;
825
826 /* The remainder of the LSB depends on the loader usage */
827 if (pnode->ucode_img.header) {
828 /* Does not use a loader */
829 pnode->lsb_header.data_size = 0;
830 pnode->lsb_header.bl_code_size = 0;
831 pnode->lsb_header.bl_data_off = 0;
832 pnode->lsb_header.bl_data_size = 0;
833
834 lsfm_parse_no_loader_ucode(pnode->ucode_img.header,
835 &(pnode->lsb_header));
836
837 /* Load the first 256 bytes of IMEM. */
838 /* Set LOAD_CODE_AT_0 and DMACTL_REQ_CTX.
839 True for all method based falcons */
840 data = NV_FLCN_ACR_LSF_FLAG_LOAD_CODE_AT_0_TRUE |
841 NV_FLCN_ACR_LSF_FLAG_DMACTL_REQ_CTX_TRUE;
842 pnode->lsb_header.flags = data;
843 } else {
844 /* Uses a loader. that is has a desc */
845 pnode->lsb_header.data_size = 0;
846
847 /* The loader code size is already aligned (padded) such that
848 the code following it is aligned, but the size in the image
849 desc is not, bloat it up to be on a 256 byte alignment. */
850 pnode->lsb_header.bl_code_size = ALIGN(
851 pnode->ucode_img.desc->bootloader_size,
852 LSF_BL_CODE_SIZE_ALIGNMENT);
853 full_app_size = ALIGN(pnode->ucode_img.desc->app_size,
854 LSF_BL_CODE_SIZE_ALIGNMENT) +
855 pnode->lsb_header.bl_code_size;
856 pnode->lsb_header.ucode_size = ALIGN(
857 pnode->ucode_img.desc->app_resident_data_offset,
858 LSF_BL_CODE_SIZE_ALIGNMENT) +
859 pnode->lsb_header.bl_code_size;
860 pnode->lsb_header.data_size = full_app_size -
861 pnode->lsb_header.ucode_size;
862 /* Though the BL is located at 0th offset of the image, the VA
863 is different to make sure that it doesnt collide the actual OS
864 VA range */
865 pnode->lsb_header.bl_imem_off =
866 pnode->ucode_img.desc->bootloader_imem_offset;
867
868 /* TODO: OBJFLCN should export properties using which the below
869 flags should be populated.*/
870 pnode->lsb_header.flags = 0;
871
872 if (falcon_id == pmu->falcon_id) {
873 data = NV_FLCN_ACR_LSF_FLAG_DMACTL_REQ_CTX_TRUE;
874 pnode->lsb_header.flags = data;
875 }
876
877 if(g->ops.pmu.is_priv_load(falcon_id))
878 pnode->lsb_header.flags |=
879 NV_FLCN_ACR_LSF_FLAG_FORCE_PRIV_LOAD_TRUE;
880 }
881}
882
883/* Adds a ucode image to the list of managed ucode images managed. */
884static int lsfm_add_ucode_img(struct gk20a *g, struct ls_flcn_mgr_v1 *plsfm,
885 struct flcn_ucode_img_v1 *ucode_image, u32 falcon_id)
886{
887 struct lsfm_managed_ucode_img_v2 *pnode;
888
889 pnode = kzalloc(sizeof(struct lsfm_managed_ucode_img_v2), GFP_KERNEL);
890 if (pnode == NULL)
891 return -ENOMEM;
892
893 /* Keep a copy of the ucode image info locally */
894 memcpy(&pnode->ucode_img, ucode_image, sizeof(struct flcn_ucode_img_v1));
895
896 /* Fill in static WPR header info*/
897 pnode->wpr_header.falcon_id = falcon_id;
898 pnode->wpr_header.bootstrap_owner = 0x07; //LSF_BOOTSTRAP_OWNER_DEFAULT;
899 pnode->wpr_header.status = LSF_IMAGE_STATUS_COPY;
900
901 pnode->wpr_header.lazy_bootstrap =
902 g->ops.pmu.is_lazy_bootstrap(falcon_id);
903
904 /*TODO to check if PDB_PROP_FLCN_LAZY_BOOTSTRAP is to be supported by
905 Android */
906 /* Fill in static LSB header info elsewhere */
907 lsfm_fill_static_lsb_hdr_info(g, falcon_id, pnode);
908 pnode->wpr_header.bin_version = pnode->lsb_header.signature.version;
909 pnode->next = plsfm->ucode_img_list;
910 plsfm->ucode_img_list = pnode;
911 return 0;
912}
913
914/* Free any ucode image structure resources*/
915static void lsfm_free_ucode_img_res(struct flcn_ucode_img_v1 *p_img)
916{
917 if (p_img->lsf_desc != NULL) {
918 kfree(p_img->lsf_desc);
919 p_img->lsf_desc = NULL;
920 }
921}
922
923/* Free any ucode image structure resources*/
924static void lsfm_free_nonpmu_ucode_img_res(struct flcn_ucode_img_v1 *p_img)
925{
926 if (p_img->lsf_desc != NULL) {
927 kfree(p_img->lsf_desc);
928 p_img->lsf_desc = NULL;
929 }
930 if (p_img->desc != NULL) {
931 kfree(p_img->desc);
932 p_img->desc = NULL;
933 }
934}
935
936static void free_acr_resources(struct gk20a *g, struct ls_flcn_mgr_v1 *plsfm)
937{
938 u32 cnt = plsfm->managed_flcn_cnt;
939 struct lsfm_managed_ucode_img_v2 *mg_ucode_img;
940
941 while (cnt) {
942 mg_ucode_img = plsfm->ucode_img_list;
943 if (mg_ucode_img->ucode_img.lsf_desc->falcon_id ==
944 LSF_FALCON_ID_PMU)
945 lsfm_free_ucode_img_res(&mg_ucode_img->ucode_img);
946 else
947 lsfm_free_nonpmu_ucode_img_res(
948 &mg_ucode_img->ucode_img);
949 plsfm->ucode_img_list = mg_ucode_img->next;
950 kfree(mg_ucode_img);
951 cnt--;
952 }
953}
954
955/* Generate WPR requirements for ACR allocation request */
956static int lsf_gen_wpr_requirements(struct gk20a *g,
957 struct ls_flcn_mgr_v1 *plsfm)
958{
959 struct lsfm_managed_ucode_img_v2 *pnode = plsfm->ucode_img_list;
960 u32 wpr_offset;
961
962 /* Calculate WPR size required */
963
964 /* Start with an array of WPR headers at the base of the WPR.
965 The expectation here is that the secure falcon will do a single DMA
966 read of this array and cache it internally so it's OK to pack these.
967 Also, we add 1 to the falcon count to indicate the end of the array.*/
968 wpr_offset = sizeof(struct lsf_wpr_header_v1) *
969 (plsfm->managed_flcn_cnt+1);
970
971 /* Walk the managed falcons, accounting for the LSB structs
972 as well as the ucode images. */
973 while (pnode) {
974 /* Align, save off, and include an LSB header size */
975 wpr_offset = ALIGN(wpr_offset,
976 LSF_LSB_HEADER_ALIGNMENT);
977 pnode->wpr_header.lsb_offset = wpr_offset;
978 wpr_offset += sizeof(struct lsf_lsb_header_v1);
979
980 /* Align, save off, and include the original (static)
981 ucode image size */
982 wpr_offset = ALIGN(wpr_offset,
983 LSF_UCODE_DATA_ALIGNMENT);
984 pnode->lsb_header.ucode_off = wpr_offset;
985 wpr_offset += pnode->ucode_img.data_size;
986
987 /* For falcons that use a boot loader (BL), we append a loader
988 desc structure on the end of the ucode image and consider this
989 the boot loader data. The host will then copy the loader desc
990 args to this space within the WPR region (before locking down)
991 and the HS bin will then copy them to DMEM 0 for the loader. */
992 if (!pnode->ucode_img.header) {
993 /* Track the size for LSB details filled in later
994 Note that at this point we don't know what kind of i
995 boot loader desc, so we just take the size of the
996 generic one, which is the largest it will will ever be.
997 */
998 /* Align (size bloat) and save off generic
999 descriptor size*/
1000 pnode->lsb_header.bl_data_size = ALIGN(
1001 sizeof(pnode->bl_gen_desc),
1002 LSF_BL_DATA_SIZE_ALIGNMENT);
1003
1004 /*Align, save off, and include the additional BL data*/
1005 wpr_offset = ALIGN(wpr_offset,
1006 LSF_BL_DATA_ALIGNMENT);
1007 pnode->lsb_header.bl_data_off = wpr_offset;
1008 wpr_offset += pnode->lsb_header.bl_data_size;
1009 } else {
1010 /* bl_data_off is already assigned in static
1011 information. But that is from start of the image */
1012 pnode->lsb_header.bl_data_off +=
1013 (wpr_offset - pnode->ucode_img.data_size);
1014 }
1015
1016 /* Finally, update ucode surface size to include updates */
1017 pnode->full_ucode_size = wpr_offset -
1018 pnode->lsb_header.ucode_off;
1019 if (pnode->wpr_header.falcon_id != LSF_FALCON_ID_PMU) {
1020 pnode->lsb_header.app_code_off =
1021 pnode->lsb_header.bl_code_size;
1022 pnode->lsb_header.app_code_size =
1023 pnode->lsb_header.ucode_size -
1024 pnode->lsb_header.bl_code_size;
1025 pnode->lsb_header.app_data_off =
1026 pnode->lsb_header.ucode_size;
1027 pnode->lsb_header.app_data_size =
1028 pnode->lsb_header.data_size;
1029 }
1030 pnode = pnode->next;
1031 }
1032 plsfm->wpr_size = wpr_offset;
1033 return 0;
1034}
1035
1036/*Loads ACR bin to FB mem and bootstraps PMU with bootloader code
1037 * start and end are addresses of ucode blob in non-WPR region*/
1038static int gp106_bootstrap_hs_flcn(struct gk20a *g)
1039{
1040 struct mm_gk20a *mm = &g->mm;
1041 struct vm_gk20a *vm = &mm->pmu.vm;
1042 int err = 0;
1043 u64 *acr_dmem;
1044 u32 img_size_in_bytes = 0;
1045 u32 status;
1046 struct acr_desc *acr = &g->acr;
1047 const struct firmware *acr_fw = acr->acr_fw;
1048 struct flcn_bl_dmem_desc_v1 *bl_dmem_desc = &acr->bl_dmem_desc_v1;
1049 u32 *acr_ucode_header_t210_load;
1050 u32 *acr_ucode_data_t210_load;
1051 struct wpr_carveout_info wpr_inf;
1052
1053 gp106_dbg_pmu("");
1054
1055 if (!acr_fw) {
1056 /*First time init case*/
1057 acr_fw = nvgpu_request_firmware(g,
1058 GM20B_HSBIN_PMU_UCODE_IMAGE,
1059 NVGPU_REQUEST_FIRMWARE_NO_SOC);
1060 if (!acr_fw) {
1061 gk20a_err(dev_from_gk20a(g), "pmu ucode get fail");
1062 return -ENOENT;
1063 }
1064 acr->acr_fw = acr_fw;
1065 acr->hsbin_hdr = (struct bin_hdr *)acr_fw->data;
1066 acr->fw_hdr = (struct acr_fw_header *)(acr_fw->data +
1067 acr->hsbin_hdr->header_offset);
1068 acr_ucode_data_t210_load = (u32 *)(acr_fw->data +
1069 acr->hsbin_hdr->data_offset);
1070 acr_ucode_header_t210_load = (u32 *)(acr_fw->data +
1071 acr->fw_hdr->hdr_offset);
1072 img_size_in_bytes = ALIGN((acr->hsbin_hdr->data_size), 256);
1073
1074 /* Lets patch the signatures first.. */
1075 if (acr_ucode_patch_sig(g, acr_ucode_data_t210_load,
1076 (u32 *)(acr_fw->data +
1077 acr->fw_hdr->sig_prod_offset),
1078 (u32 *)(acr_fw->data +
1079 acr->fw_hdr->sig_dbg_offset),
1080 (u32 *)(acr_fw->data +
1081 acr->fw_hdr->patch_loc),
1082 (u32 *)(acr_fw->data +
1083 acr->fw_hdr->patch_sig)) < 0) {
1084 gk20a_err(dev_from_gk20a(g), "patch signatures fail");
1085 err = -1;
1086 goto err_release_acr_fw;
1087 }
1088 err = gk20a_gmmu_alloc_map_sys(vm, img_size_in_bytes,
1089 &acr->acr_ucode);
1090 if (err) {
1091 err = -ENOMEM;
1092 goto err_release_acr_fw;
1093 }
1094
1095 g->ops.pmu.get_wpr(g, &wpr_inf);
1096
1097 acr_dmem = (u64 *)
1098 &(((u8 *)acr_ucode_data_t210_load)[
1099 acr_ucode_header_t210_load[2]]);
1100 acr->acr_dmem_desc_v1 = (struct flcn_acr_desc_v1 *)((u8 *)(
1101 acr->acr_ucode.cpu_va) + acr_ucode_header_t210_load[2]);
1102 ((struct flcn_acr_desc_v1 *)acr_dmem)->nonwpr_ucode_blob_start =
1103 wpr_inf.nonwpr_base;
1104 ((struct flcn_acr_desc_v1 *)acr_dmem)->nonwpr_ucode_blob_size =
1105 wpr_inf.size;
1106 ((struct flcn_acr_desc_v1 *)acr_dmem)->regions.no_regions = 1;
1107 ((struct flcn_acr_desc_v1 *)acr_dmem)->wpr_offset = 0;
1108
1109 ((struct flcn_acr_desc_v1 *)acr_dmem)->wpr_region_id = 1;
1110 ((struct flcn_acr_desc_v1 *)acr_dmem)->regions.region_props[
1111 0].region_id = 1;
1112 ((struct flcn_acr_desc_v1 *)acr_dmem)->regions.region_props[
1113 0].start_addr = (wpr_inf.wpr_base ) >> 8;
1114 ((struct flcn_acr_desc_v1 *)acr_dmem)->regions.region_props[
1115 0].end_addr = ((wpr_inf.wpr_base) + wpr_inf.size) >> 8;
1116 ((struct flcn_acr_desc_v1 *)acr_dmem)->regions.region_props[
1117 0].shadowmMem_startaddress = wpr_inf.nonwpr_base >> 8;
1118
1119 gk20a_mem_wr_n(g, &acr->acr_ucode, 0,
1120 acr_ucode_data_t210_load, img_size_in_bytes);
1121
1122 /*
1123 * In order to execute this binary, we will be using
1124 * a bootloader which will load this image into PMU IMEM/DMEM.
1125 * Fill up the bootloader descriptor for PMU HAL to use..
1126 * TODO: Use standard descriptor which the generic bootloader is
1127 * checked in.
1128 */
1129
1130 bl_dmem_desc->signature[0] = 0;
1131 bl_dmem_desc->signature[1] = 0;
1132 bl_dmem_desc->signature[2] = 0;
1133 bl_dmem_desc->signature[3] = 0;
1134 bl_dmem_desc->ctx_dma = GK20A_PMU_DMAIDX_VIRT;
1135 flcn64_set_dma( &bl_dmem_desc->code_dma_base,
1136 acr->acr_ucode.gpu_va);
1137 bl_dmem_desc->non_sec_code_off = acr_ucode_header_t210_load[0];
1138 bl_dmem_desc->non_sec_code_size = acr_ucode_header_t210_load[1];
1139 bl_dmem_desc->sec_code_off = acr_ucode_header_t210_load[5];
1140 bl_dmem_desc->sec_code_size = acr_ucode_header_t210_load[6];
1141 bl_dmem_desc->code_entry_point = 0; /* Start at 0th offset */
1142 flcn64_set_dma( &bl_dmem_desc->data_dma_base,
1143 acr->acr_ucode.gpu_va +
1144 (acr_ucode_header_t210_load[2]));
1145 bl_dmem_desc->data_size = acr_ucode_header_t210_load[3];
1146 } else
1147 acr->acr_dmem_desc->nonwpr_ucode_blob_size = 0;
1148
1149 status = pmu_exec_gen_bl(g, bl_dmem_desc, 1);
1150 if (status != 0) {
1151 err = status;
1152 goto err_free_ucode_map;
1153 }
1154
1155 /* sec2 reset - to keep it idle */
1156 gk20a_writel(g, psec_falcon_engine_r(),
1157 pwr_falcon_engine_reset_true_f());
1158 udelay(10);
1159 gk20a_writel(g, psec_falcon_engine_r(),
1160 pwr_falcon_engine_reset_false_f());
1161
1162 return 0;
1163err_free_ucode_map:
1164 gk20a_gmmu_unmap_free(vm, &acr->acr_ucode);
1165err_release_acr_fw:
1166 release_firmware(acr_fw);
1167 acr->acr_fw = NULL;
1168 return err;
1169}
diff --git a/drivers/gpu/nvgpu/gp106/acr_gp106.h b/drivers/gpu/nvgpu/gp106/acr_gp106.h
new file mode 100644
index 00000000..cd555eb8
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/acr_gp106.h
@@ -0,0 +1,128 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#ifndef __ACR_GP106_H_
15#define __ACR_GP106_H_
16
17#include "gm20b/acr_gm20b.h"
18#include "gm206/acr_gm206.h"
19
20#define GP106_FECS_UCODE_SIG "gp106/fecs_sig.bin"
21#define GP106_GPCCS_UCODE_SIG "gp106/gpccs_sig.bin"
22#define GP104_FECS_UCODE_SIG "gp104/fecs_sig.bin"
23#define GP104_GPCCS_UCODE_SIG "gp104/gpccs_sig.bin"
24
25struct lsf_ucode_desc_v1 {
26 u8 prd_keys[2][16];
27 u8 dbg_keys[2][16];
28 u32 b_prd_present;
29 u32 b_dbg_present;
30 u32 falcon_id;
31 u32 bsupports_versioning;
32 u32 version;
33 u32 dep_map_count;
34 u8 dep_map[LSF_FALCON_ID_END * 2 * 4];
35 u8 kdf[16];
36};
37
38struct lsf_wpr_header_v1 {
39 u32 falcon_id;
40 u32 lsb_offset;
41 u32 bootstrap_owner;
42 u32 lazy_bootstrap;
43 u32 bin_version;
44 u32 status;
45};
46
47struct lsf_lsb_header_v1 {
48 struct lsf_ucode_desc_v1 signature;
49 u32 ucode_off;
50 u32 ucode_size;
51 u32 data_size;
52 u32 bl_code_size;
53 u32 bl_imem_off;
54 u32 bl_data_off;
55 u32 bl_data_size;
56 u32 app_code_off;
57 u32 app_code_size;
58 u32 app_data_off;
59 u32 app_data_size;
60 u32 flags;
61};
62
63struct flcn_ucode_img_v1 {
64 u32 *header; /*only some falcons have header*/
65 u32 *data;
66 struct pmu_ucode_desc_v1 *desc; /*only some falcons have descriptor*/
67 u32 data_size;
68 void *fw_ver; /*NV2080_CTRL_GPU_GET_FIRMWARE_VERSION_PARAMS struct*/
69 u8 load_entire_os_data; /* load the whole osData section at boot time.*/
70 struct lsf_ucode_desc_v1 *lsf_desc; /* NULL if not a light secure falcon.*/
71 u8 free_res_allocs;/*True if there a resources to freed by the client.*/
72 u32 flcn_inst;
73};
74
75struct lsfm_managed_ucode_img_v2 {
76 struct lsfm_managed_ucode_img_v2 *next;
77 struct lsf_wpr_header_v1 wpr_header;
78 struct lsf_lsb_header_v1 lsb_header;
79 union flcn_bl_generic_desc_v1 bl_gen_desc;
80 u32 bl_gen_desc_size;
81 u32 full_ucode_size;
82 struct flcn_ucode_img_v1 ucode_img;
83};
84struct ls_flcn_mgr_v1 {
85 u16 managed_flcn_cnt;
86 u32 wpr_size;
87 u32 disable_mask;
88 struct lsfm_managed_ucode_img_v2 *ucode_img_list;
89 void *wpr_client_req_state;/*PACR_CLIENT_REQUEST_STATE originally*/
90};
91
92struct flcn_acr_region_prop_v1 {
93 u32 start_addr;
94 u32 end_addr;
95 u32 region_id;
96 u32 read_mask;
97 u32 write_mask;
98 u32 client_mask;
99 u32 shadowmMem_startaddress;
100};
101
102/*!
103 * no_regions - Number of regions used.
104 * region_props - Region properties
105 */
106struct flcn_acr_regions_v1 {
107 u32 no_regions;
108 struct flcn_acr_region_prop_v1 region_props[T210_FLCN_ACR_MAX_REGIONS];
109};
110
111struct flcn_acr_desc_v1 {
112 union {
113 u32 reserved_dmem[(LSF_BOOTSTRAP_OWNER_RESERVED_DMEM_SIZE/4)];
114 } ucode_reserved_space;
115 u32 signatures[4];
116 /*Always 1st*/
117 u32 wpr_region_id;
118 u32 wpr_offset;
119 u32 mmu_mem_range;
120 struct flcn_acr_regions_v1 regions;
121 u32 nonwpr_ucode_blob_size;
122 u64 nonwpr_ucode_blob_start;
123 u32 dummy[4]; //ACR_BSI_VPR_DESC
124};
125
126void gp106_init_secure_pmu(struct gpu_ops *gops);
127
128#endif /*__PMU_GP106_H_*/
diff --git a/drivers/gpu/nvgpu/gp106/bios_gp106.c b/drivers/gpu/nvgpu/gp106/bios_gp106.c
new file mode 100644
index 00000000..8be4314d
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/bios_gp106.c
@@ -0,0 +1,121 @@
1/*
2 * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include "gk20a/gk20a.h"
15#include "gm206/bios_gm206.h"
16#include "bios_gp106.h"
17#include "hw_gc6_gp106.h"
18
19static void gp106_init_xmemsel_zm_nv_reg_array(struct gk20a *g, bool *condition,
20 u32 reg, u32 stride, u32 count, u32 data_table_offset)
21{
22 u8 i;
23 u32 data, strap, index;
24
25 if (*condition) {
26
27 strap = gk20a_readl(g, gc6_sci_strap_r()) & 0xf;
28
29 index = g->bios.mem_strap_xlat_tbl_ptr ?
30 gm206_bios_read_u8(g, g->bios.mem_strap_xlat_tbl_ptr +
31 strap) : strap;
32
33 for (i = 0; i < count; i++) {
34 data = gm206_bios_read_u32(g, data_table_offset + ((i *
35 g->bios.mem_strap_data_count + index) *
36 sizeof(u32)));
37 gk20a_writel(g, reg, data);
38 reg += stride;
39 }
40 }
41}
42
43static void gp106_init_condition(struct gk20a *g, bool *condition,
44 u32 condition_id)
45{
46 struct condition_entry entry;
47
48 entry.cond_addr = gm206_bios_read_u32(g, g->bios.condition_table_ptr +
49 sizeof(entry)*condition_id);
50 entry.cond_mask = gm206_bios_read_u32(g, g->bios.condition_table_ptr +
51 sizeof(entry)*condition_id + 4);
52 entry.cond_compare = gm206_bios_read_u32(g, g->bios.condition_table_ptr +
53 sizeof(entry)*condition_id + 8);
54
55 if ((gk20a_readl(g, entry.cond_addr) & entry.cond_mask)
56 != entry.cond_compare) {
57 *condition = false;
58 }
59}
60
61static int gp106_execute_script(struct gk20a *g, u32 offset)
62{
63 u8 opcode;
64 u32 ip;
65 u32 operand[8];
66 bool condition, end;
67 int status = 0;
68
69 ip = offset;
70 condition = true;
71 end = false;
72
73 while (!end) {
74
75 opcode = gm206_bios_read_u8(g, ip++);
76
77 switch (opcode) {
78
79 case INIT_XMEMSEL_ZM_NV_REG_ARRAY:
80 operand[0] = gm206_bios_read_u32(g, ip);
81 operand[1] = gm206_bios_read_u8(g, ip+4);
82 operand[2] = gm206_bios_read_u8(g, ip+5);
83 ip += 6;
84
85 gp106_init_xmemsel_zm_nv_reg_array(g, &condition,
86 operand[0], operand[1], operand[2], ip);
87 ip += operand[2] * sizeof(u32) *
88 g->bios.mem_strap_data_count;
89 break;
90
91 case INIT_CONDITION:
92 operand[0] = gm206_bios_read_u8(g, ip);
93 ip++;
94
95 gp106_init_condition(g, &condition, operand[0]);
96 break;
97
98 case INIT_RESUME:
99 condition = true;
100 break;
101
102 case INIT_DONE:
103 end = true;
104 break;
105
106 default:
107 gk20a_err(dev_from_gk20a(g), "opcode: 0x%02x", opcode);
108 end = true;
109 status = -EINVAL;
110 break;
111 }
112 }
113
114 return status;
115}
116
117void gp106_init_bios(struct gpu_ops *gops)
118{
119 gm206_init_bios(gops);
120 gops->bios.execute_script = gp106_execute_script;
121}
diff --git a/drivers/gpu/nvgpu/gp106/bios_gp106.h b/drivers/gpu/nvgpu/gp106/bios_gp106.h
new file mode 100644
index 00000000..f47d11ca
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/bios_gp106.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#ifndef NVGPU_BIOS_GP106_H
15#define NVGPU_BIOS_GP106_H
16
17struct gpu_ops;
18
19#define INIT_DONE 0x71
20#define INIT_RESUME 0x72
21#define INIT_CONDITION 0x75
22#define INIT_XMEMSEL_ZM_NV_REG_ARRAY 0x8f
23
24struct condition_entry {
25 u32 cond_addr;
26 u32 cond_mask;
27 u32 cond_compare;
28} __packed;
29
30void gp106_init_bios(struct gpu_ops *gops);
31#endif
diff --git a/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c
new file mode 100644
index 00000000..b4d1afbc
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c
@@ -0,0 +1,105 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include "gk20a/gk20a.h"
15
16#include "clk/clk_arb.h"
17#include "clk_arb_gp106.h"
18
19static u32 gp106_get_arbiter_clk_domains(struct gk20a *g)
20{
21 (void)g;
22 return (CTRL_CLK_DOMAIN_MCLK|CTRL_CLK_DOMAIN_GPC2CLK);
23}
24
25static int gp106_get_arbiter_clk_range(struct gk20a *g, u32 api_domain,
26 u16 *min_mhz, u16 *max_mhz)
27{
28 enum nv_pmu_clk_clkwhich clkwhich;
29 struct clk_set_info *p0_info;
30 struct clk_set_info *p5_info;
31 struct avfsfllobjs *pfllobjs = &(g->clk_pmu.avfs_fllobjs);
32
33 u16 limit_min_mhz;
34
35 switch (api_domain) {
36 case CTRL_CLK_DOMAIN_MCLK:
37 clkwhich = clkwhich_mclk;
38 break;
39
40 case CTRL_CLK_DOMAIN_GPC2CLK:
41 clkwhich = clkwhich_gpc2clk;
42 break;
43
44 default:
45 return -EINVAL;
46 }
47
48 p5_info = pstate_get_clk_set_info(g,
49 CTRL_PERF_PSTATE_P5, clkwhich);
50 if (!p5_info)
51 return -EINVAL;
52
53 p0_info = pstate_get_clk_set_info(g,
54 CTRL_PERF_PSTATE_P0, clkwhich);
55 if (!p0_info)
56 return -EINVAL;
57
58 limit_min_mhz = p5_info->min_mhz;
59 /* WAR for DVCO min */
60 if (api_domain == CTRL_CLK_DOMAIN_GPC2CLK)
61 if ((pfllobjs->max_min_freq_mhz) &&
62 (pfllobjs->max_min_freq_mhz > limit_min_mhz))
63 limit_min_mhz = pfllobjs->max_min_freq_mhz;
64
65 *min_mhz = limit_min_mhz;
66 *max_mhz = p0_info->max_mhz;
67
68 return 0;
69}
70
71static int gp106_get_arbiter_clk_default(struct gk20a *g, u32 api_domain,
72 u16 *default_mhz)
73{
74 enum nv_pmu_clk_clkwhich clkwhich;
75 struct clk_set_info *p0_info;
76
77 switch (api_domain) {
78 case CTRL_CLK_DOMAIN_MCLK:
79 clkwhich = clkwhich_mclk;
80 break;
81
82 case CTRL_CLK_DOMAIN_GPC2CLK:
83 clkwhich = clkwhich_gpc2clk;
84 break;
85
86 default:
87 return -EINVAL;
88 }
89
90 p0_info = pstate_get_clk_set_info(g,
91 CTRL_PERF_PSTATE_P0, clkwhich);
92 if (!p0_info)
93 return -EINVAL;
94
95 *default_mhz = p0_info->max_mhz;
96
97 return 0;
98}
99
100void gp106_init_clk_arb_ops(struct gpu_ops *gops)
101{
102 gops->clk_arb.get_arbiter_clk_domains = gp106_get_arbiter_clk_domains;
103 gops->clk_arb.get_arbiter_clk_range = gp106_get_arbiter_clk_range;
104 gops->clk_arb.get_arbiter_clk_default = gp106_get_arbiter_clk_default;
105}
diff --git a/drivers/gpu/nvgpu/gp106/clk_arb_gp106.h b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.h
new file mode 100644
index 00000000..a9877199
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16#ifndef CLK_ARB_GP106_H
17#define CLK_ARB_GP106_H
18
19void gp106_init_clk_arb_ops(struct gpu_ops *gops);
20
21#endif /* CLK_ARB_GP106_H */
diff --git a/drivers/gpu/nvgpu/gp106/clk_gp106.c b/drivers/gpu/nvgpu/gp106/clk_gp106.c
new file mode 100644
index 00000000..4c9bc782
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/clk_gp106.c
@@ -0,0 +1,273 @@
1/*
2 * GP106 Clocks
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/clk.h>
20#include <linux/delay.h> /* for mdelay */
21#include <linux/module.h>
22#include <linux/debugfs.h>
23#include <linux/uaccess.h>
24#include <linux/clk/tegra.h>
25#include <linux/tegra-fuse.h>
26
27#include "gk20a/gk20a.h"
28#include "hw_trim_gp106.h"
29#include "clk_gp106.h"
30#include "clk/clk_arb.h"
31
32#define gk20a_dbg_clk(fmt, arg...) \
33 gk20a_dbg(gpu_dbg_clk, fmt, ##arg)
34
35#ifdef CONFIG_DEBUG_FS
36static int clk_gp106_debugfs_init(struct gk20a *g);
37#endif
38
39#define NUM_NAMEMAPS 4
40#define XTAL4X_KHZ 108000
41
42
43static u32 gp106_get_rate_cntr(struct gk20a *g, struct namemap_cfg *);
44static u16 gp106_clk_get_rate(struct gk20a *g, u32 api_domain);
45static u32 gp106_crystal_clk_hz(struct gk20a *g)
46{
47 return (XTAL4X_KHZ * 1000);
48}
49
50static u16 gp106_clk_get_rate(struct gk20a *g, u32 api_domain)
51{
52 struct clk_gk20a *clk = &g->clk;
53 u32 freq_khz;
54 u32 i;
55 struct namemap_cfg *c = NULL;
56
57 for (i = 0; i < clk->namemap_num; i++) {
58 if (api_domain == clk->namemap_xlat_table[i]) {
59 c = &clk->clk_namemap[i];
60 break;
61 }
62 }
63
64 if (!c)
65 return 0;
66
67 freq_khz = c->is_counter ? c->scale * gp106_get_rate_cntr(g, c) :
68 0; /* TODO: PLL read */
69
70 /* Convert to MHZ */
71 return (u16) (freq_khz/1000);
72}
73
74static int gp106_init_clk_support(struct gk20a *g) {
75 struct clk_gk20a *clk = &g->clk;
76 u32 err = 0;
77
78 gk20a_dbg_fn("");
79
80 mutex_init(&clk->clk_mutex);
81
82 clk->clk_namemap = (struct namemap_cfg *)
83 kzalloc(sizeof(struct namemap_cfg) * NUM_NAMEMAPS, GFP_KERNEL);
84
85 if (!clk->clk_namemap)
86 return -ENOMEM;
87
88 clk->namemap_xlat_table = kcalloc(NUM_NAMEMAPS, sizeof(u32),
89 GFP_KERNEL);
90
91 if (!clk->namemap_xlat_table) {
92 kfree(clk->clk_namemap);
93 return -ENOMEM;
94 }
95
96 clk->clk_namemap[0] = (struct namemap_cfg) {
97 .namemap = CLK_NAMEMAP_INDEX_GPC2CLK,
98 .is_enable = 1,
99 .is_counter = 1,
100 .g = g,
101 .cntr.reg_ctrl_addr = trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_r(),
102 .cntr.reg_ctrl_idx =
103 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_source_gpc2clk_f(),
104 .cntr.reg_cntr_addr = trim_gpc_bcast_clk_cntr_ncgpcclk_cnt_r(),
105 .name = "gpc2clk",
106 .scale = 1
107 };
108 clk->namemap_xlat_table[0] = CTRL_CLK_DOMAIN_GPC2CLK;
109 clk->clk_namemap[1] = (struct namemap_cfg) {
110 .namemap = CLK_NAMEMAP_INDEX_SYS2CLK,
111 .is_enable = 1,
112 .is_counter = 1,
113 .g = g,
114 .cntr.reg_ctrl_addr = trim_sys_clk_cntr_ncsyspll_cfg_r(),
115 .cntr.reg_ctrl_idx = trim_sys_clk_cntr_ncsyspll_cfg_source_sys2clk_f(),
116 .cntr.reg_cntr_addr = trim_sys_clk_cntr_ncsyspll_cnt_r(),
117 .name = "sys2clk",
118 .scale = 1
119 };
120 clk->namemap_xlat_table[1] = CTRL_CLK_DOMAIN_SYS2CLK;
121 clk->clk_namemap[2] = (struct namemap_cfg) {
122 .namemap = CLK_NAMEMAP_INDEX_XBAR2CLK,
123 .is_enable = 1,
124 .is_counter = 1,
125 .g = g,
126 .cntr.reg_ctrl_addr = trim_sys_clk_cntr_ncltcpll_cfg_r(),
127 .cntr.reg_ctrl_idx = trim_sys_clk_cntr_ncltcpll_cfg_source_xbar2clk_f(),
128 .cntr.reg_cntr_addr = trim_sys_clk_cntr_ncltcpll_cnt_r(),
129 .name = "xbar2clk",
130 .scale = 1
131 };
132 clk->namemap_xlat_table[2] = CTRL_CLK_DOMAIN_XBAR2CLK;
133 clk->clk_namemap[3] = (struct namemap_cfg) {
134 .namemap = CLK_NAMEMAP_INDEX_DRAMCLK,
135 .is_enable = 1,
136 .is_counter = 1,
137 .g = g,
138 .cntr.reg_ctrl_addr = trim_fbpa_bcast_clk_cntr_ncltcclk_cfg_r(),
139 .cntr.reg_ctrl_idx =
140 trim_fbpa_bcast_clk_cntr_ncltcclk_cfg_source_dramdiv4_rec_clk1_f(),
141 .cntr.reg_cntr_addr = trim_fbpa_bcast_clk_cntr_ncltcclk_cnt_r(),
142 .name = "dramdiv2_rec_clk1",
143 .scale = 2
144 };
145 clk->namemap_xlat_table[3] = CTRL_CLK_DOMAIN_MCLK;
146
147 clk->namemap_num = NUM_NAMEMAPS;
148
149 clk->g = g;
150
151#ifdef CONFIG_DEBUG_FS
152 if (!clk->debugfs_set) {
153 if (!clk_gp106_debugfs_init(g))
154 clk->debugfs_set = true;
155 }
156#endif
157 return err;
158}
159
160static u32 gp106_get_rate_cntr(struct gk20a *g, struct namemap_cfg *c) {
161 u32 save_reg;
162 u32 retries;
163 u32 cntr = 0;
164
165 struct clk_gk20a *clk = &g->clk;
166
167 if (!c || !c->cntr.reg_ctrl_addr || !c->cntr.reg_cntr_addr)
168 return 0;
169
170 mutex_lock(&clk->clk_mutex);
171
172 /* Save the register */
173 save_reg = gk20a_readl(g, c->cntr.reg_ctrl_addr);
174
175 /* Disable and reset the current clock */
176 gk20a_writel(g, c->cntr.reg_ctrl_addr,
177 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_asserted_f() |
178 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_deasserted_f());
179
180 /* Force wb() */
181 gk20a_readl(g, c->cntr.reg_ctrl_addr);
182
183 /* Wait for reset to happen */
184 retries = CLK_DEFAULT_CNTRL_SETTLE_RETRIES;
185 do {
186 udelay(CLK_DEFAULT_CNTRL_SETTLE_USECS);
187 } while ((--retries) && (cntr = gk20a_readl(g, c->cntr.reg_cntr_addr)));
188
189 if (!retries) {
190 gk20a_err(dev_from_gk20a(g),
191 "unable to settle counter reset, bailing");
192 goto read_err;
193 }
194 /* Program counter */
195 gk20a_writel(g, c->cntr.reg_ctrl_addr,
196 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_deasserted_f() |
197 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_asserted_f() |
198 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_asserted_f() |
199 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_asserted_f() |
200 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_asserted_f() |
201 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_noofipclks_f(XTAL_CNTR_CLKS) |
202 c->cntr.reg_ctrl_idx);
203 gk20a_readl(g, c->cntr.reg_ctrl_addr);
204
205 udelay(XTAL_CNTR_DELAY);
206
207 cntr = XTAL_SCALE_TO_KHZ * gk20a_readl(g, c->cntr.reg_cntr_addr);
208
209read_err:
210 /* reset and restore control register */
211 gk20a_writel(g, c->cntr.reg_ctrl_addr,
212 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_asserted_f() |
213 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_deasserted_f());
214 gk20a_readl(g, c->cntr.reg_ctrl_addr);
215 gk20a_writel(g, c->cntr.reg_ctrl_addr, save_reg);
216 gk20a_readl(g, c->cntr.reg_ctrl_addr);
217 mutex_unlock(&clk->clk_mutex);
218
219 return cntr;
220
221}
222
223#ifdef CONFIG_DEBUG_FS
224static int gp106_get_rate_show(void *data , u64 *val) {
225 struct namemap_cfg *c = (struct namemap_cfg *) data;
226 struct gk20a *g = c->g;
227
228 *val = c->is_counter ? gp106_get_rate_cntr(g, c) : 0 /* TODO PLL read */;
229 return 0;
230}
231DEFINE_SIMPLE_ATTRIBUTE(get_rate_fops, gp106_get_rate_show, NULL, "%llu\n");
232
233
234static int clk_gp106_debugfs_init(struct gk20a *g) {
235 struct gk20a_platform *platform = dev_get_drvdata(g->dev);
236
237 struct dentry *gpu_root = platform->debugfs;
238 struct dentry *clocks_root;
239 struct dentry *d;
240 unsigned int i;
241
242 if (NULL == (clocks_root = debugfs_create_dir("clocks", gpu_root)))
243 return -ENOMEM;
244
245 gk20a_dbg(gpu_dbg_info, "g=%p", g);
246
247 for (i = 0; i < g->clk.namemap_num; i++) {
248 if (g->clk.clk_namemap[i].is_enable) {
249 d = debugfs_create_file(
250 g->clk.clk_namemap[i].name,
251 S_IRUGO,
252 clocks_root,
253 &g->clk.clk_namemap[i],
254 &get_rate_fops);
255 if (!d)
256 goto err_out;
257 }
258 }
259 return 0;
260
261err_out:
262 pr_err("%s: Failed to make debugfs node\n", __func__);
263 debugfs_remove_recursive(clocks_root);
264 return -ENOMEM;
265}
266#endif /* CONFIG_DEBUG_FS */
267
268void gp106_init_clk_ops(struct gpu_ops *gops) {
269 gops->clk.init_clk_support = gp106_init_clk_support;
270 gops->clk.get_crystal_clk_hz = gp106_crystal_clk_hz;
271 gops->clk.get_rate = gp106_clk_get_rate;
272}
273
diff --git a/drivers/gpu/nvgpu/gp106/clk_gp106.h b/drivers/gpu/nvgpu/gp106/clk_gp106.h
new file mode 100644
index 00000000..7df4b974
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/clk_gp106.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16#ifndef CLK_GP106_H
17#define CLK_GP106_H
18
19#include <linux/mutex.h>
20
21#define CLK_NAMEMAP_INDEX_GPC2CLK 0x00
22#define CLK_NAMEMAP_INDEX_XBAR2CLK 0x02
23#define CLK_NAMEMAP_INDEX_SYS2CLK 0x07 /* SYSPLL */
24#define CLK_NAMEMAP_INDEX_DRAMCLK 0x20 /* DRAMPLL */
25
26#define CLK_DEFAULT_CNTRL_SETTLE_RETRIES 10
27#define CLK_DEFAULT_CNTRL_SETTLE_USECS 5
28
29#define XTAL_CNTR_CLKS 27000 /* 1000usec at 27KHz XTAL */
30#define XTAL_CNTR_DELAY 1000 /* we need acuracy up to the ms */
31#define XTAL_SCALE_TO_KHZ 1
32
33
34
35struct namemap_cfg {
36 u32 namemap;
37 u32 is_enable; /* Namemap enabled */
38 u32 is_counter; /* Using cntr */
39 struct gk20a *g;
40 union {
41 struct {
42 u32 reg_ctrl_addr;
43 u32 reg_ctrl_idx;
44 u32 reg_cntr_addr;
45 } cntr;
46 struct {
47 /* Todo */
48 } pll;
49 };
50 u32 scale;
51 char name[24];
52};
53
54void gp106_init_clk_ops(struct gpu_ops *gops);
55
56#endif /* CLK_GP106_H */
diff --git a/drivers/gpu/nvgpu/gp106/fb_gp106.c b/drivers/gpu/nvgpu/gp106/fb_gp106.c
new file mode 100644
index 00000000..ef9f1094
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/fb_gp106.c
@@ -0,0 +1,44 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include <linux/types.h>
15#include <linux/delay.h>
16
17#include "gk20a/gk20a.h"
18#include "gp10b/fb_gp10b.h"
19#include "hw_fb_gp106.h"
20
21#define HW_SCRUB_TIMEOUT_DEFAULT 100 /* usec */
22#define HW_SCRUB_TIMEOUT_MAX 2000000 /* usec */
23
24static void gp106_fb_reset(struct gk20a *g)
25{
26 int retries = HW_SCRUB_TIMEOUT_MAX / HW_SCRUB_TIMEOUT_DEFAULT;
27 /* wait for memory to be accessible */
28 do {
29 u32 w = gk20a_readl(g, fb_niso_scrub_status_r());
30 if (fb_niso_scrub_status_flag_v(w)) {
31 gk20a_dbg_fn("done");
32 break;
33 }
34 udelay(HW_SCRUB_TIMEOUT_DEFAULT);
35 } while (--retries);
36}
37
38void gp106_init_fb(struct gpu_ops *gops)
39{
40 gp10b_init_fb(gops);
41
42 gops->fb.init_fs_state = NULL;
43 gops->fb.reset = gp106_fb_reset;
44}
diff --git a/drivers/gpu/nvgpu/gp106/fb_gp106.h b/drivers/gpu/nvgpu/gp106/fb_gp106.h
new file mode 100644
index 00000000..87b371e1
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/fb_gp106.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#ifndef FB_GP106_H
15#define FB_GP106_H
16struct gpu_ops;
17
18void gp106_init_fb(struct gpu_ops *gops);
19#endif
diff --git a/drivers/gpu/nvgpu/gp106/fifo_gp106.c b/drivers/gpu/nvgpu/gp106/fifo_gp106.c
new file mode 100644
index 00000000..3c70d517
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/fifo_gp106.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include "gk20a/gk20a.h"
15#include "gp10b/fifo_gp10b.h"
16#include "fifo_gp106.h"
17#include "hw_ccsr_gp106.h"
18#include "hw_fifo_gp106.h"
19
20static u32 gp106_fifo_get_num_fifos(struct gk20a *g)
21{
22 return ccsr_channel__size_1_v();
23}
24
25void gp106_init_fifo(struct gpu_ops *gops)
26{
27 gp10b_init_fifo(gops);
28 gops->fifo.get_num_fifos = gp106_fifo_get_num_fifos;
29 gops->fifo.eng_runlist_base_size = fifo_eng_runlist_base__size_1_v;
30}
diff --git a/drivers/gpu/nvgpu/gp106/fifo_gp106.h b/drivers/gpu/nvgpu/gp106/fifo_gp106.h
new file mode 100644
index 00000000..1bcec9ef
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/fifo_gp106.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#ifndef NVGPU_FIFO_GP106_H
15#define NVGPU_FIFO_GP106_H
16struct gpu_ops;
17void gp106_init_fifo(struct gpu_ops *gops);
18#endif
diff --git a/drivers/gpu/nvgpu/gp106/gp106_gating_reglist.c b/drivers/gpu/nvgpu/gp106/gp106_gating_reglist.c
new file mode 100644
index 00000000..29870d60
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gp106_gating_reglist.c
@@ -0,0 +1,649 @@
1/*
2 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License.
7 *
8 * This program is distributed in the hope that 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
11 * more details.
12 *
13 * This file is autogenerated. Do not edit.
14 */
15
16#ifndef __gp106_gating_reglist_h__
17#define __gp106_gating_reglist_h__
18
19#include <linux/types.h>
20#include "gp106_gating_reglist.h"
21
22struct gating_desc {
23 u32 addr;
24 u32 prod;
25 u32 disable;
26};
27/* slcg bus */
28static const struct gating_desc gp106_slcg_bus[] = {
29 {.addr = 0x00001c04, .prod = 0x00000000, .disable = 0x000003fe},
30};
31
32/* slcg ce2 */
33static const struct gating_desc gp106_slcg_ce2[] = {
34 {.addr = 0x00104204, .prod = 0x00000000, .disable = 0x000007fe},
35};
36
37/* slcg chiplet */
38static const struct gating_desc gp106_slcg_chiplet[] = {
39 {.addr = 0x0010c07c, .prod = 0x00000000, .disable = 0x00000007},
40 {.addr = 0x0010c0fc, .prod = 0x00000000, .disable = 0x00000007},
41 {.addr = 0x0010c17c, .prod = 0x00000000, .disable = 0x00000007},
42 {.addr = 0x0010c1fc, .prod = 0x00000000, .disable = 0x00000007},
43 {.addr = 0x0010c27c, .prod = 0x00000000, .disable = 0x00000007},
44 {.addr = 0x0010c2fc, .prod = 0x00000000, .disable = 0x00000007},
45 {.addr = 0x0010e07c, .prod = 0x00000000, .disable = 0x00000007},
46 {.addr = 0x0010d07c, .prod = 0x00000000, .disable = 0x00000007},
47 {.addr = 0x0010d0fc, .prod = 0x00000000, .disable = 0x00000007},
48 {.addr = 0x0010d17c, .prod = 0x00000000, .disable = 0x00000007},
49 {.addr = 0x0010d1fc, .prod = 0x00000000, .disable = 0x00000007},
50 {.addr = 0x0010d27c, .prod = 0x00000000, .disable = 0x00000007},
51 {.addr = 0x0010d2fc, .prod = 0x00000000, .disable = 0x00000007},
52 {.addr = 0x0010e17c, .prod = 0x00000000, .disable = 0x00000007},
53};
54
55/* slcg fb */
56static const struct gating_desc gp106_slcg_fb[] = {
57 {.addr = 0x00100d14, .prod = 0x00000000, .disable = 0xfffffffe},
58 {.addr = 0x00100c9c, .prod = 0x00000000, .disable = 0x000001fe},
59};
60
61/* slcg fifo */
62static const struct gating_desc gp106_slcg_fifo[] = {
63 {.addr = 0x000026ac, .prod = 0x00000000, .disable = 0x0001fffe},
64};
65
66/* slcg gr */
67static const struct gating_desc gp106_slcg_gr[] = {
68 {.addr = 0x004041f4, .prod = 0x00000000, .disable = 0x07fffffe},
69 {.addr = 0x0040917c, .prod = 0x00020008, .disable = 0x0003fffe},
70 {.addr = 0x00409894, .prod = 0x00000040, .disable = 0x03fffffe},
71 {.addr = 0x004078c4, .prod = 0x00000000, .disable = 0x000001fe},
72 {.addr = 0x00406004, .prod = 0x00000000, .disable = 0x0001fffe},
73 {.addr = 0x00405864, .prod = 0x00000000, .disable = 0x000001fe},
74 {.addr = 0x00405910, .prod = 0xfffffff0, .disable = 0xfffffffe},
75 {.addr = 0x00408044, .prod = 0x00000000, .disable = 0x000007fe},
76 {.addr = 0x00407004, .prod = 0x00000000, .disable = 0x000001fe},
77 {.addr = 0x0041a17c, .prod = 0x00020008, .disable = 0x0003fffe},
78 {.addr = 0x0041a894, .prod = 0x00000040, .disable = 0x03fffffe},
79 {.addr = 0x00418504, .prod = 0x00000000, .disable = 0x0007fffe},
80 {.addr = 0x0041860c, .prod = 0x00000000, .disable = 0x000001fe},
81 {.addr = 0x0041868c, .prod = 0x00000000, .disable = 0x0000001e},
82 {.addr = 0x0041871c, .prod = 0x00000000, .disable = 0x000003fe},
83 {.addr = 0x00418388, .prod = 0x00000000, .disable = 0x00000001},
84 {.addr = 0x0041882c, .prod = 0x00000000, .disable = 0x0001fffe},
85 {.addr = 0x00418bc0, .prod = 0x00000000, .disable = 0x000001fe},
86 {.addr = 0x00418974, .prod = 0x00000000, .disable = 0x0001fffe},
87 {.addr = 0x00418c74, .prod = 0xffffff80, .disable = 0xfffffffe},
88 {.addr = 0x00418cf4, .prod = 0xfffffff8, .disable = 0xfffffffe},
89 {.addr = 0x00418d74, .prod = 0xffffffe0, .disable = 0xfffffffe},
90 {.addr = 0x00418f10, .prod = 0xffffffe0, .disable = 0xfffffffe},
91 {.addr = 0x00418e10, .prod = 0xfffffffe, .disable = 0xfffffffe},
92 {.addr = 0x00419024, .prod = 0x000001fe, .disable = 0x000001fe},
93 {.addr = 0x0041889c, .prod = 0x00000000, .disable = 0x000001fe},
94 {.addr = 0x00419d24, .prod = 0x00000000, .disable = 0x0000ffff},
95 {.addr = 0x00419a44, .prod = 0x00000000, .disable = 0x0000000e},
96 {.addr = 0x00419a4c, .prod = 0x00000000, .disable = 0x000001fe},
97 {.addr = 0x00419a54, .prod = 0x00000000, .disable = 0x0000003e},
98 {.addr = 0x00419a5c, .prod = 0x00000000, .disable = 0x0000000e},
99 {.addr = 0x00419a64, .prod = 0x00000000, .disable = 0x000001fe},
100 {.addr = 0x00419a6c, .prod = 0x00000000, .disable = 0x0000000e},
101 {.addr = 0x00419a74, .prod = 0x00000000, .disable = 0x0000000e},
102 {.addr = 0x00419a7c, .prod = 0x00000000, .disable = 0x0000003e},
103 {.addr = 0x00419a84, .prod = 0x00000000, .disable = 0x0000000e},
104 {.addr = 0x0041986c, .prod = 0x00000104, .disable = 0x00fffffe},
105 {.addr = 0x00419cd8, .prod = 0x00000000, .disable = 0x001ffffe},
106 {.addr = 0x00419ce0, .prod = 0x00000000, .disable = 0x001ffffe},
107 {.addr = 0x00419c74, .prod = 0x0000001e, .disable = 0x0000001e},
108 {.addr = 0x00419fd4, .prod = 0x00000000, .disable = 0x0003fffe},
109 {.addr = 0x00419fdc, .prod = 0xffedff00, .disable = 0xfffffffe},
110 {.addr = 0x00419fe4, .prod = 0x00001b00, .disable = 0x00001ffe},
111 {.addr = 0x00419ff4, .prod = 0x00000000, .disable = 0x00003ffe},
112 {.addr = 0x00419ffc, .prod = 0x00000000, .disable = 0x0001fffe},
113 {.addr = 0x0041be2c, .prod = 0x04115fc0, .disable = 0xfffffffe},
114 {.addr = 0x0041bfec, .prod = 0xfffffff0, .disable = 0xfffffffe},
115 {.addr = 0x0041bed4, .prod = 0xfffffff8, .disable = 0xfffffffe},
116 {.addr = 0x00412814, .prod = 0x00000000, .disable = 0x0001fffe},
117 {.addr = 0x00412a84, .prod = 0x00000000, .disable = 0x0001fffe},
118 {.addr = 0x004129ac, .prod = 0x00000000, .disable = 0x0001fffe},
119 {.addr = 0x00412a24, .prod = 0x00000000, .disable = 0x0000ffff},
120 {.addr = 0x00412c14, .prod = 0x00000000, .disable = 0x0001fffe},
121 {.addr = 0x00412e84, .prod = 0x00000000, .disable = 0x0001fffe},
122 {.addr = 0x00412dac, .prod = 0x00000000, .disable = 0x0001fffe},
123 {.addr = 0x00412e24, .prod = 0x00000000, .disable = 0x0000ffff},
124 {.addr = 0x00408814, .prod = 0x00000000, .disable = 0x0001fffe},
125 {.addr = 0x00408a84, .prod = 0x00000000, .disable = 0x0001fffe},
126 {.addr = 0x004089ac, .prod = 0x00000000, .disable = 0x0001fffe},
127 {.addr = 0x00408a24, .prod = 0x00000000, .disable = 0x0000ffff},
128};
129
130/* slcg ltc */
131static const struct gating_desc gp106_slcg_ltc[] = {
132 {.addr = 0x00154050, .prod = 0x00000000, .disable = 0xfffffffe},
133 {.addr = 0x0015455c, .prod = 0x00000000, .disable = 0xfffffffe},
134 {.addr = 0x0015475c, .prod = 0x00000000, .disable = 0xfffffffe},
135 {.addr = 0x0015435c, .prod = 0x00000000, .disable = 0xfffffffe},
136 {.addr = 0x00156050, .prod = 0x00000000, .disable = 0xfffffffe},
137 {.addr = 0x0015655c, .prod = 0x00000000, .disable = 0xfffffffe},
138 {.addr = 0x0015675c, .prod = 0x00000000, .disable = 0xfffffffe},
139 {.addr = 0x0015635c, .prod = 0x00000000, .disable = 0xfffffffe},
140 {.addr = 0x0017e050, .prod = 0x00000000, .disable = 0xfffffffe},
141 {.addr = 0x0017e35c, .prod = 0x00000000, .disable = 0xfffffffe},
142};
143
144/* slcg perf */
145static const struct gating_desc gp106_slcg_perf[] = {
146 {.addr = 0x001be018, .prod = 0x000001ff, .disable = 0x00000000},
147 {.addr = 0x001bc018, .prod = 0x000001ff, .disable = 0x00000000},
148 {.addr = 0x001bc218, .prod = 0x000001ff, .disable = 0x00000000},
149 {.addr = 0x001bc418, .prod = 0x000001ff, .disable = 0x00000000},
150 {.addr = 0x001bc618, .prod = 0x000001ff, .disable = 0x00000000},
151 {.addr = 0x001bc818, .prod = 0x000001ff, .disable = 0x00000000},
152 {.addr = 0x001bca18, .prod = 0x000001ff, .disable = 0x00000000},
153 {.addr = 0x001b8018, .prod = 0x000001ff, .disable = 0x00000000},
154 {.addr = 0x001b8218, .prod = 0x000001ff, .disable = 0x00000000},
155 {.addr = 0x001b8418, .prod = 0x000001ff, .disable = 0x00000000},
156 {.addr = 0x001b8618, .prod = 0x000001ff, .disable = 0x00000000},
157 {.addr = 0x001b8818, .prod = 0x000001ff, .disable = 0x00000000},
158 {.addr = 0x001b8a18, .prod = 0x000001ff, .disable = 0x00000000},
159 {.addr = 0x001b4124, .prod = 0x00000001, .disable = 0x00000000},
160};
161
162/* slcg PriRing */
163static const struct gating_desc gp106_slcg_priring[] = {
164 {.addr = 0x001200a8, .prod = 0x00000000, .disable = 0x00000001},
165};
166
167/* slcg pmu */
168static const struct gating_desc gp106_slcg_pmu[] = {
169 {.addr = 0x0010a134, .prod = 0x00020008, .disable = 0x0003fffe},
170 {.addr = 0x0010aa74, .prod = 0x00000000, .disable = 0x00007ffe},
171 {.addr = 0x0010ae74, .prod = 0x00000000, .disable = 0x0000000f},
172};
173
174/* therm gr */
175static const struct gating_desc gp106_slcg_therm[] = {
176 {.addr = 0x000206b8, .prod = 0x00000000, .disable = 0x0000000f},
177};
178
179/* slcg Xbar */
180static const struct gating_desc gp106_slcg_xbar[] = {
181 {.addr = 0x0013c824, .prod = 0x00000000, .disable = 0x7ffffffe},
182 {.addr = 0x0013dc08, .prod = 0x00000000, .disable = 0xfffffffe},
183 {.addr = 0x0013c924, .prod = 0x00000000, .disable = 0x7ffffffe},
184 {.addr = 0x0013cbe4, .prod = 0x00000000, .disable = 0x1ffffffe},
185 {.addr = 0x0013cc04, .prod = 0x00000000, .disable = 0x1ffffffe},
186 {.addr = 0x0013cc24, .prod = 0x00000000, .disable = 0x1ffffffe},
187 {.addr = 0x0013cc44, .prod = 0x00000000, .disable = 0x1ffffffe},
188 {.addr = 0x0013cc64, .prod = 0x00000000, .disable = 0x1ffffffe},
189 {.addr = 0x0013cc84, .prod = 0x00000000, .disable = 0x1ffffffe},
190 {.addr = 0x0013cca4, .prod = 0x00000000, .disable = 0x1ffffffe},
191};
192
193/* blcg bus */
194static const struct gating_desc gp106_blcg_bus[] = {
195 {.addr = 0x00001c00, .prod = 0x00000042, .disable = 0x00000000},
196};
197
198/* blcg ce */
199static const struct gating_desc gp106_blcg_ce[] = {
200 {.addr = 0x00104200, .prod = 0x0000c242, .disable = 0x00000000},
201};
202
203/* blcg fb */
204static const struct gating_desc gp106_blcg_fb[] = {
205 {.addr = 0x00100d10, .prod = 0x0000c242, .disable = 0x00000000},
206 {.addr = 0x00100d30, .prod = 0x0000c242, .disable = 0x00000000},
207 {.addr = 0x00100d3c, .prod = 0x00000242, .disable = 0x00000000},
208 {.addr = 0x00100d48, .prod = 0x0000c242, .disable = 0x00000000},
209 {.addr = 0x00100d1c, .prod = 0x00000042, .disable = 0x00000000},
210 {.addr = 0x00100c98, .prod = 0x00004242, .disable = 0x00000000},
211};
212
213/* blcg fifo */
214static const struct gating_desc gp106_blcg_fifo[] = {
215 {.addr = 0x000026a4, .prod = 0x0000c242, .disable = 0x00000000},
216};
217
218/* blcg gr */
219static const struct gating_desc gp106_blcg_gr[] = {
220 {.addr = 0x004041f0, .prod = 0x0000c646, .disable = 0x00000000},
221 {.addr = 0x00409890, .prod = 0x0000007f, .disable = 0x00000000},
222 {.addr = 0x004098b0, .prod = 0x0000007f, .disable = 0x00000000},
223 {.addr = 0x004078c0, .prod = 0x00004242, .disable = 0x00000000},
224 {.addr = 0x00406000, .prod = 0x0000c444, .disable = 0x00000000},
225 {.addr = 0x00405860, .prod = 0x0000c242, .disable = 0x00000000},
226 {.addr = 0x0040590c, .prod = 0x0000c444, .disable = 0x00000000},
227 {.addr = 0x00408040, .prod = 0x0000c444, .disable = 0x00000000},
228 {.addr = 0x00407000, .prod = 0x4000c242, .disable = 0x00000000},
229 {.addr = 0x00405bf0, .prod = 0x0000c444, .disable = 0x00000000},
230 {.addr = 0x0041a890, .prod = 0x0000427f, .disable = 0x00000000},
231 {.addr = 0x0041a8b0, .prod = 0x0000007f, .disable = 0x00000000},
232 {.addr = 0x00418500, .prod = 0x0000c244, .disable = 0x00000000},
233 {.addr = 0x00418608, .prod = 0x0000c242, .disable = 0x00000000},
234 {.addr = 0x00418688, .prod = 0x0000c242, .disable = 0x00000000},
235 {.addr = 0x00418718, .prod = 0x00000042, .disable = 0x00000000},
236 {.addr = 0x00418828, .prod = 0x00008444, .disable = 0x00000000},
237 {.addr = 0x00418bbc, .prod = 0x0000c242, .disable = 0x00000000},
238 {.addr = 0x00418970, .prod = 0x0000c242, .disable = 0x00000000},
239 {.addr = 0x00418c70, .prod = 0x0000c444, .disable = 0x00000000},
240 {.addr = 0x00418cf0, .prod = 0x0000c444, .disable = 0x00000000},
241 {.addr = 0x00418d70, .prod = 0x0000c444, .disable = 0x00000000},
242 {.addr = 0x00418f0c, .prod = 0x0000c444, .disable = 0x00000000},
243 {.addr = 0x00418e0c, .prod = 0x00008444, .disable = 0x00000000},
244 {.addr = 0x00419020, .prod = 0x0000c242, .disable = 0x00000000},
245 {.addr = 0x00419038, .prod = 0x00000042, .disable = 0x00000000},
246 {.addr = 0x00418898, .prod = 0x00004242, .disable = 0x00000000},
247 {.addr = 0x00419a40, .prod = 0x0000c242, .disable = 0x00000000},
248 {.addr = 0x00419a48, .prod = 0x0000c242, .disable = 0x00000000},
249 {.addr = 0x00419a50, .prod = 0x0000c242, .disable = 0x00000000},
250 {.addr = 0x00419a58, .prod = 0x0000c242, .disable = 0x00000000},
251 {.addr = 0x00419a60, .prod = 0x0000c242, .disable = 0x00000000},
252 {.addr = 0x00419a68, .prod = 0x0000c242, .disable = 0x00000000},
253 {.addr = 0x00419a70, .prod = 0x0000c242, .disable = 0x00000000},
254 {.addr = 0x00419a78, .prod = 0x0000c242, .disable = 0x00000000},
255 {.addr = 0x00419a80, .prod = 0x0000c242, .disable = 0x00000000},
256 {.addr = 0x00419868, .prod = 0x00008242, .disable = 0x00000000},
257 {.addr = 0x00419cd4, .prod = 0x00000002, .disable = 0x00000000},
258 {.addr = 0x00419cdc, .prod = 0x00000002, .disable = 0x00000000},
259 {.addr = 0x00419c70, .prod = 0x0000c444, .disable = 0x00000000},
260 {.addr = 0x00419fd0, .prod = 0x0000c044, .disable = 0x00000000},
261 {.addr = 0x00419fd8, .prod = 0x0000c046, .disable = 0x00000000},
262 {.addr = 0x00419fe0, .prod = 0x0000c044, .disable = 0x00000000},
263 {.addr = 0x00419fe8, .prod = 0x0000c042, .disable = 0x00000000},
264 {.addr = 0x00419ff0, .prod = 0x0000c045, .disable = 0x00000000},
265 {.addr = 0x00419ff8, .prod = 0x00000002, .disable = 0x00000000},
266 {.addr = 0x00419f90, .prod = 0x00000002, .disable = 0x00000000},
267 {.addr = 0x0041be28, .prod = 0x00008242, .disable = 0x00000000},
268 {.addr = 0x0041bfe8, .prod = 0x0000c444, .disable = 0x00000000},
269 {.addr = 0x0041bed0, .prod = 0x0000c444, .disable = 0x00000000},
270 {.addr = 0x00412810, .prod = 0x0000c242, .disable = 0x00000000},
271 {.addr = 0x00412a80, .prod = 0x0000c242, .disable = 0x00000000},
272 {.addr = 0x004129a8, .prod = 0x0000c242, .disable = 0x00000000},
273 {.addr = 0x00412c10, .prod = 0x0000c242, .disable = 0x00000000},
274 {.addr = 0x00412e80, .prod = 0x0000c242, .disable = 0x00000000},
275 {.addr = 0x00412da8, .prod = 0x0000c242, .disable = 0x00000000},
276 {.addr = 0x00408810, .prod = 0x0000c242, .disable = 0x00000000},
277 {.addr = 0x00408a80, .prod = 0x0000c242, .disable = 0x00000000},
278 {.addr = 0x004089a8, .prod = 0x0000c242, .disable = 0x00000000},
279};
280
281/* blcg ltc */
282static const struct gating_desc gp106_blcg_ltc[] = {
283 {.addr = 0x00154030, .prod = 0x00000044, .disable = 0x00000000},
284 {.addr = 0x00154040, .prod = 0x00000044, .disable = 0x00000000},
285 {.addr = 0x001545e0, .prod = 0x00000044, .disable = 0x00000000},
286 {.addr = 0x001545c8, .prod = 0x00000044, .disable = 0x00000000},
287 {.addr = 0x001547e0, .prod = 0x00000044, .disable = 0x00000000},
288 {.addr = 0x001547c8, .prod = 0x00000044, .disable = 0x00000000},
289 {.addr = 0x001543e0, .prod = 0x00000044, .disable = 0x00000000},
290 {.addr = 0x001543c8, .prod = 0x00000044, .disable = 0x00000000},
291 {.addr = 0x00156030, .prod = 0x00000044, .disable = 0x00000000},
292 {.addr = 0x00156040, .prod = 0x00000044, .disable = 0x00000000},
293 {.addr = 0x001565e0, .prod = 0x00000044, .disable = 0x00000000},
294 {.addr = 0x001565c8, .prod = 0x00000044, .disable = 0x00000000},
295 {.addr = 0x001567e0, .prod = 0x00000044, .disable = 0x00000000},
296 {.addr = 0x001567c8, .prod = 0x00000044, .disable = 0x00000000},
297 {.addr = 0x001563e0, .prod = 0x00000044, .disable = 0x00000000},
298 {.addr = 0x001563c8, .prod = 0x00000044, .disable = 0x00000000},
299 {.addr = 0x0017e030, .prod = 0x00000044, .disable = 0x00000000},
300 {.addr = 0x0017e040, .prod = 0x00000044, .disable = 0x00000000},
301 {.addr = 0x0017e3e0, .prod = 0x00000044, .disable = 0x00000000},
302 {.addr = 0x0017e3c8, .prod = 0x00000044, .disable = 0x00000000},
303};
304
305/* blcg pmu */
306static const struct gating_desc gp106_blcg_pmu[] = {
307 {.addr = 0x0010aa70, .prod = 0x00000045, .disable = 0x00000000},
308};
309
310/* blcg Xbar */
311static const struct gating_desc gp106_blcg_xbar[] = {
312 {.addr = 0x0013c820, .prod = 0x0001004a, .disable = 0x00000000},
313 {.addr = 0x0013dc04, .prod = 0x0001004a, .disable = 0x00000000},
314 {.addr = 0x0013c920, .prod = 0x0000004a, .disable = 0x00000000},
315 {.addr = 0x0013cbe0, .prod = 0x00000042, .disable = 0x00000000},
316 {.addr = 0x0013cc00, .prod = 0x00000042, .disable = 0x00000000},
317 {.addr = 0x0013cc20, .prod = 0x00000042, .disable = 0x00000000},
318 {.addr = 0x0013cc40, .prod = 0x00000042, .disable = 0x00000000},
319 {.addr = 0x0013cc60, .prod = 0x00000042, .disable = 0x00000000},
320 {.addr = 0x0013cc80, .prod = 0x00000042, .disable = 0x00000000},
321 {.addr = 0x0013cca0, .prod = 0x00000042, .disable = 0x00000000},
322};
323
324/* pg gr */
325static const struct gating_desc gp106_pg_gr[] = {
326};
327
328/* inline functions */
329void gp106_slcg_bus_load_gating_prod(struct gk20a *g,
330 bool prod)
331{
332 u32 i;
333 u32 size = sizeof(gp106_slcg_bus) / sizeof(struct gating_desc);
334 for (i = 0; i < size; i++) {
335 if (prod)
336 gk20a_writel(g, gp106_slcg_bus[i].addr,
337 gp106_slcg_bus[i].prod);
338 else
339 gk20a_writel(g, gp106_slcg_bus[i].addr,
340 gp106_slcg_bus[i].disable);
341 }
342}
343
344void gp106_slcg_ce2_load_gating_prod(struct gk20a *g,
345 bool prod)
346{
347 u32 i;
348 u32 size = sizeof(gp106_slcg_ce2) / sizeof(struct gating_desc);
349 for (i = 0; i < size; i++) {
350 if (prod)
351 gk20a_writel(g, gp106_slcg_ce2[i].addr,
352 gp106_slcg_ce2[i].prod);
353 else
354 gk20a_writel(g, gp106_slcg_ce2[i].addr,
355 gp106_slcg_ce2[i].disable);
356 }
357}
358
359void gp106_slcg_chiplet_load_gating_prod(struct gk20a *g,
360 bool prod)
361{
362 u32 i;
363 u32 size = sizeof(gp106_slcg_chiplet) / sizeof(struct gating_desc);
364 for (i = 0; i < size; i++) {
365 if (prod)
366 gk20a_writel(g, gp106_slcg_chiplet[i].addr,
367 gp106_slcg_chiplet[i].prod);
368 else
369 gk20a_writel(g, gp106_slcg_chiplet[i].addr,
370 gp106_slcg_chiplet[i].disable);
371 }
372}
373
374void gp106_slcg_ctxsw_firmware_load_gating_prod(struct gk20a *g,
375 bool prod)
376{
377}
378
379void gp106_slcg_fb_load_gating_prod(struct gk20a *g,
380 bool prod)
381{
382 u32 i;
383 u32 size = sizeof(gp106_slcg_fb) / sizeof(struct gating_desc);
384 for (i = 0; i < size; i++) {
385 if (prod)
386 gk20a_writel(g, gp106_slcg_fb[i].addr,
387 gp106_slcg_fb[i].prod);
388 else
389 gk20a_writel(g, gp106_slcg_fb[i].addr,
390 gp106_slcg_fb[i].disable);
391 }
392}
393
394void gp106_slcg_fifo_load_gating_prod(struct gk20a *g,
395 bool prod)
396{
397 u32 i;
398 u32 size = sizeof(gp106_slcg_fifo) / sizeof(struct gating_desc);
399 for (i = 0; i < size; i++) {
400 if (prod)
401 gk20a_writel(g, gp106_slcg_fifo[i].addr,
402 gp106_slcg_fifo[i].prod);
403 else
404 gk20a_writel(g, gp106_slcg_fifo[i].addr,
405 gp106_slcg_fifo[i].disable);
406 }
407}
408
409void gr_gp106_slcg_gr_load_gating_prod(struct gk20a *g,
410 bool prod)
411{
412 u32 i;
413 u32 size = sizeof(gp106_slcg_gr) / sizeof(struct gating_desc);
414 for (i = 0; i < size; i++) {
415 if (prod)
416 gk20a_writel(g, gp106_slcg_gr[i].addr,
417 gp106_slcg_gr[i].prod);
418 else
419 gk20a_writel(g, gp106_slcg_gr[i].addr,
420 gp106_slcg_gr[i].disable);
421 }
422}
423
424void ltc_gp106_slcg_ltc_load_gating_prod(struct gk20a *g,
425 bool prod)
426{
427 u32 i;
428 u32 size = sizeof(gp106_slcg_ltc) / sizeof(struct gating_desc);
429 for (i = 0; i < size; i++) {
430 if (prod)
431 gk20a_writel(g, gp106_slcg_ltc[i].addr,
432 gp106_slcg_ltc[i].prod);
433 else
434 gk20a_writel(g, gp106_slcg_ltc[i].addr,
435 gp106_slcg_ltc[i].disable);
436 }
437}
438
439void gp106_slcg_perf_load_gating_prod(struct gk20a *g,
440 bool prod)
441{
442 u32 i;
443 u32 size = sizeof(gp106_slcg_perf) / sizeof(struct gating_desc);
444 for (i = 0; i < size; i++) {
445 if (prod)
446 gk20a_writel(g, gp106_slcg_perf[i].addr,
447 gp106_slcg_perf[i].prod);
448 else
449 gk20a_writel(g, gp106_slcg_perf[i].addr,
450 gp106_slcg_perf[i].disable);
451 }
452}
453
454void gp106_slcg_priring_load_gating_prod(struct gk20a *g,
455 bool prod)
456{
457 u32 i;
458 u32 size = sizeof(gp106_slcg_priring) / sizeof(struct gating_desc);
459 for (i = 0; i < size; i++) {
460 if (prod)
461 gk20a_writel(g, gp106_slcg_priring[i].addr,
462 gp106_slcg_priring[i].prod);
463 else
464 gk20a_writel(g, gp106_slcg_priring[i].addr,
465 gp106_slcg_priring[i].disable);
466 }
467}
468
469void gp106_slcg_pmu_load_gating_prod(struct gk20a *g,
470 bool prod)
471{
472 u32 i;
473 u32 size = sizeof(gp106_slcg_pmu) / sizeof(struct gating_desc);
474 for (i = 0; i < size; i++) {
475 if (prod)
476 gk20a_writel(g, gp106_slcg_pmu[i].addr,
477 gp106_slcg_pmu[i].prod);
478 else
479 gk20a_writel(g, gp106_slcg_pmu[i].addr,
480 gp106_slcg_pmu[i].disable);
481 }
482}
483
484void gp106_slcg_therm_load_gating_prod(struct gk20a *g,
485 bool prod)
486{
487 u32 i;
488 u32 size = sizeof(gp106_slcg_therm) / sizeof(struct gating_desc);
489 for (i = 0; i < size; i++) {
490 if (prod)
491 gk20a_writel(g, gp106_slcg_therm[i].addr,
492 gp106_slcg_therm[i].prod);
493 else
494 gk20a_writel(g, gp106_slcg_therm[i].addr,
495 gp106_slcg_therm[i].disable);
496 }
497}
498
499void gp106_slcg_xbar_load_gating_prod(struct gk20a *g,
500 bool prod)
501{
502 u32 i;
503 u32 size = sizeof(gp106_slcg_xbar) / sizeof(struct gating_desc);
504 for (i = 0; i < size; i++) {
505 if (prod)
506 gk20a_writel(g, gp106_slcg_xbar[i].addr,
507 gp106_slcg_xbar[i].prod);
508 else
509 gk20a_writel(g, gp106_slcg_xbar[i].addr,
510 gp106_slcg_xbar[i].disable);
511 }
512}
513
514void gp106_blcg_bus_load_gating_prod(struct gk20a *g,
515 bool prod)
516{
517 u32 i;
518 u32 size = sizeof(gp106_blcg_bus) / sizeof(struct gating_desc);
519 for (i = 0; i < size; i++) {
520 if (prod)
521 gk20a_writel(g, gp106_blcg_bus[i].addr,
522 gp106_blcg_bus[i].prod);
523 else
524 gk20a_writel(g, gp106_blcg_bus[i].addr,
525 gp106_blcg_bus[i].disable);
526 }
527}
528
529void gp106_blcg_ce_load_gating_prod(struct gk20a *g,
530 bool prod)
531{
532 u32 i;
533 u32 size = sizeof(gp106_blcg_ce) / sizeof(struct gating_desc);
534 for (i = 0; i < size; i++) {
535 if (prod)
536 gk20a_writel(g, gp106_blcg_ce[i].addr,
537 gp106_blcg_ce[i].prod);
538 else
539 gk20a_writel(g, gp106_blcg_ce[i].addr,
540 gp106_blcg_ce[i].disable);
541 }
542}
543
544void gp106_blcg_fb_load_gating_prod(struct gk20a *g,
545 bool prod)
546{
547 u32 i;
548 u32 size = sizeof(gp106_blcg_fb) / sizeof(struct gating_desc);
549 for (i = 0; i < size; i++) {
550 if (prod)
551 gk20a_writel(g, gp106_blcg_fb[i].addr,
552 gp106_blcg_fb[i].prod);
553 else
554 gk20a_writel(g, gp106_blcg_fb[i].addr,
555 gp106_blcg_fb[i].disable);
556 }
557}
558
559void gp106_blcg_fifo_load_gating_prod(struct gk20a *g,
560 bool prod)
561{
562 u32 i;
563 u32 size = sizeof(gp106_blcg_fifo) / sizeof(struct gating_desc);
564 for (i = 0; i < size; i++) {
565 if (prod)
566 gk20a_writel(g, gp106_blcg_fifo[i].addr,
567 gp106_blcg_fifo[i].prod);
568 else
569 gk20a_writel(g, gp106_blcg_fifo[i].addr,
570 gp106_blcg_fifo[i].disable);
571 }
572}
573
574void gp106_blcg_gr_load_gating_prod(struct gk20a *g,
575 bool prod)
576{
577 u32 i;
578 u32 size = sizeof(gp106_blcg_gr) / sizeof(struct gating_desc);
579 for (i = 0; i < size; i++) {
580 if (prod)
581 gk20a_writel(g, gp106_blcg_gr[i].addr,
582 gp106_blcg_gr[i].prod);
583 else
584 gk20a_writel(g, gp106_blcg_gr[i].addr,
585 gp106_blcg_gr[i].disable);
586 }
587}
588
589void gp106_blcg_ltc_load_gating_prod(struct gk20a *g,
590 bool prod)
591{
592 u32 i;
593 u32 size = sizeof(gp106_blcg_ltc) / sizeof(struct gating_desc);
594 for (i = 0; i < size; i++) {
595 if (prod)
596 gk20a_writel(g, gp106_blcg_ltc[i].addr,
597 gp106_blcg_ltc[i].prod);
598 else
599 gk20a_writel(g, gp106_blcg_ltc[i].addr,
600 gp106_blcg_ltc[i].disable);
601 }
602}
603
604void gp106_blcg_pmu_load_gating_prod(struct gk20a *g,
605 bool prod)
606{
607 u32 i;
608 u32 size = sizeof(gp106_blcg_pmu) / sizeof(struct gating_desc);
609 for (i = 0; i < size; i++) {
610 if (prod)
611 gk20a_writel(g, gp106_blcg_pmu[i].addr,
612 gp106_blcg_pmu[i].prod);
613 else
614 gk20a_writel(g, gp106_blcg_pmu[i].addr,
615 gp106_blcg_pmu[i].disable);
616 }
617}
618
619void gp106_blcg_xbar_load_gating_prod(struct gk20a *g,
620 bool prod)
621{
622 u32 i;
623 u32 size = sizeof(gp106_blcg_xbar) / sizeof(struct gating_desc);
624 for (i = 0; i < size; i++) {
625 if (prod)
626 gk20a_writel(g, gp106_blcg_xbar[i].addr,
627 gp106_blcg_xbar[i].prod);
628 else
629 gk20a_writel(g, gp106_blcg_xbar[i].addr,
630 gp106_blcg_xbar[i].disable);
631 }
632}
633
634void gr_gp106_pg_gr_load_gating_prod(struct gk20a *g,
635 bool prod)
636{
637 u32 i;
638 u32 size = sizeof(gp106_pg_gr) / sizeof(struct gating_desc);
639 for (i = 0; i < size; i++) {
640 if (prod)
641 gk20a_writel(g, gp106_pg_gr[i].addr,
642 gp106_pg_gr[i].prod);
643 else
644 gk20a_writel(g, gp106_pg_gr[i].addr,
645 gp106_pg_gr[i].disable);
646 }
647}
648
649#endif /* __gp106_gating_reglist_h__ */
diff --git a/drivers/gpu/nvgpu/gp106/gp106_gating_reglist.h b/drivers/gpu/nvgpu/gp106/gp106_gating_reglist.h
new file mode 100644
index 00000000..423ccf54
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gp106_gating_reglist.h
@@ -0,0 +1,87 @@
1/*
2 * Copyright (c) 2015-2016, NVIDIA Corporation. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16
17#include "gk20a/gk20a.h"
18
19void gp106_slcg_bus_load_gating_prod(struct gk20a *g,
20 bool prod);
21
22void gp106_slcg_ce2_load_gating_prod(struct gk20a *g,
23 bool prod);
24
25void gp106_slcg_chiplet_load_gating_prod(struct gk20a *g,
26 bool prod);
27
28void gp106_slcg_ctxsw_firmware_load_gating_prod(struct gk20a *g,
29 bool prod);
30
31void gp106_slcg_fb_load_gating_prod(struct gk20a *g,
32 bool prod);
33
34void gp106_slcg_fifo_load_gating_prod(struct gk20a *g,
35 bool prod);
36
37void gr_gp106_slcg_gr_load_gating_prod(struct gk20a *g,
38 bool prod);
39
40void ltc_gp106_slcg_ltc_load_gating_prod(struct gk20a *g,
41 bool prod);
42
43void gp106_slcg_perf_load_gating_prod(struct gk20a *g,
44 bool prod);
45
46void gp106_slcg_priring_load_gating_prod(struct gk20a *g,
47 bool prod);
48
49void gp106_slcg_pmu_load_gating_prod(struct gk20a *g,
50 bool prod);
51
52void gp106_slcg_therm_load_gating_prod(struct gk20a *g,
53 bool prod);
54
55void gp106_slcg_xbar_load_gating_prod(struct gk20a *g,
56 bool prod);
57
58void gp106_blcg_bus_load_gating_prod(struct gk20a *g,
59 bool prod);
60
61void gp106_blcg_ce_load_gating_prod(struct gk20a *g,
62 bool prod);
63
64void gp106_blcg_ctxsw_firmware_load_gating_prod(struct gk20a *g,
65 bool prod);
66
67void gp106_blcg_fb_load_gating_prod(struct gk20a *g,
68 bool prod);
69
70void gp106_blcg_fifo_load_gating_prod(struct gk20a *g,
71 bool prod);
72
73void gp106_blcg_gr_load_gating_prod(struct gk20a *g,
74 bool prod);
75
76void gp106_blcg_ltc_load_gating_prod(struct gk20a *g,
77 bool prod);
78
79void gp106_blcg_pmu_load_gating_prod(struct gk20a *g,
80 bool prod);
81
82void gp106_blcg_xbar_load_gating_prod(struct gk20a *g,
83 bool prod);
84
85void gr_gp106_pg_gr_load_gating_prod(struct gk20a *g,
86 bool prod);
87
diff --git a/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c
new file mode 100644
index 00000000..1f47cc5a
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c
@@ -0,0 +1,50 @@
1/*
2 * GP106 Graphics Context
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include "gk20a/gk20a.h"
17#include "gr_ctx_gp106.h"
18#include "nvgpu_gpuid_t18x.h"
19
20static int gr_gp106_get_netlist_name(struct gk20a *g, int index, char *name)
21{
22 u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl;
23
24 switch (ver) {
25 case NVGPU_GPUID_GP104:
26 sprintf(name, "%s/%s", "gp104",
27 GP104_NETLIST_IMAGE_FW_NAME);
28 break;
29 case NVGPU_GPUID_GP106:
30 sprintf(name, "%s/%s", "gp106",
31 GP106_NETLIST_IMAGE_FW_NAME);
32 break;
33 default:
34 gk20a_err(g->dev, "no support for GPUID %x", ver);
35 }
36
37 return 0;
38}
39
40static bool gr_gp106_is_firmware_defined(void)
41{
42 return true;
43}
44
45void gp106_init_gr_ctx(struct gpu_ops *gops)
46{
47 gops->gr_ctx.get_netlist_name = gr_gp106_get_netlist_name;
48 gops->gr_ctx.is_fw_defined = gr_gp106_is_firmware_defined;
49 gops->gr_ctx.use_dma_for_fw_bootstrap = false;
50}
diff --git a/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h
new file mode 100644
index 00000000..fef80abb
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16#ifndef __GR_CTX_GP106_H__
17#define __GR_CTX_GP106_H__
18
19#include "gk20a/gr_ctx_gk20a.h"
20
21/* production netlist, one and only one from below */
22#define GP106_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_C
23#define GP104_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_D
24
25void gp106_init_gr_ctx(struct gpu_ops *gops);
26
27#endif /*__GR_CTX_GP106_H__*/
diff --git a/drivers/gpu/nvgpu/gp106/gr_gp106.c b/drivers/gpu/nvgpu/gp106/gr_gp106.c
new file mode 100644
index 00000000..8d8376d3
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_gp106.c
@@ -0,0 +1,239 @@
1/*
2 * GP106 GPU GR
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include "gk20a/gk20a.h" /* FERMI and MAXWELL classes defined here */
17
18#include "gk20a/gr_gk20a.h"
19
20#include "gm20b/gr_gm20b.h" /* for MAXWELL classes */
21#include "gp10b/gr_gp10b.h"
22#include "gr_gp106.h"
23#include "hw_gr_gp106.h"
24
25static bool gr_gp106_is_valid_class(struct gk20a *g, u32 class_num)
26{
27 bool valid = false;
28
29 switch (class_num) {
30 case PASCAL_COMPUTE_A:
31 case PASCAL_COMPUTE_B:
32 case PASCAL_A:
33 case PASCAL_B:
34 case PASCAL_DMA_COPY_A:
35 case PASCAL_DMA_COPY_B:
36 valid = true;
37 break;
38
39 case MAXWELL_COMPUTE_B:
40 case MAXWELL_B:
41 case FERMI_TWOD_A:
42 case KEPLER_DMA_COPY_A:
43 case MAXWELL_DMA_COPY_A:
44 valid = true;
45 break;
46
47 default:
48 break;
49 }
50 gk20a_dbg_info("class=0x%x valid=%d", class_num, valid);
51 return valid;
52}
53
54static u32 gr_gp106_pagepool_default_size(struct gk20a *g)
55{
56 return gr_scc_pagepool_total_pages_hwmax_value_v();
57}
58
59static void gr_gp106_set_go_idle_timeout(struct gk20a *g, u32 data)
60{
61 gk20a_writel(g, gr_fe_go_idle_timeout_r(), data);
62}
63
64static int gr_gp106_handle_sw_method(struct gk20a *g, u32 addr,
65 u32 class_num, u32 offset, u32 data)
66{
67 gk20a_dbg_fn("");
68
69 if (class_num == PASCAL_COMPUTE_B) {
70 switch (offset << 2) {
71 case NVC0C0_SET_SHADER_EXCEPTIONS:
72 gk20a_gr_set_shader_exceptions(g, data);
73 break;
74 default:
75 goto fail;
76 }
77 }
78
79 if (class_num == PASCAL_B) {
80 switch (offset << 2) {
81 case NVC097_SET_SHADER_EXCEPTIONS:
82 gk20a_gr_set_shader_exceptions(g, data);
83 break;
84 case NVC097_SET_CIRCULAR_BUFFER_SIZE:
85 g->ops.gr.set_circular_buffer_size(g, data);
86 break;
87 case NVC097_SET_ALPHA_CIRCULAR_BUFFER_SIZE:
88 g->ops.gr.set_alpha_circular_buffer_size(g, data);
89 break;
90 case NVC097_SET_GO_IDLE_TIMEOUT:
91 gr_gp106_set_go_idle_timeout(g, data);
92 break;
93 default:
94 goto fail;
95 }
96 }
97 return 0;
98
99fail:
100 return -EINVAL;
101}
102
103static void gr_gp106_cb_size_default(struct gk20a *g)
104{
105 struct gr_gk20a *gr = &g->gr;
106
107 if (!gr->attrib_cb_default_size)
108 gr->attrib_cb_default_size = 0x800;
109 gr->alpha_cb_default_size =
110 gr_gpc0_ppc0_cbm_alpha_cb_size_v_default_v();
111}
112
113static int gr_gp106_set_ctxsw_preemption_mode(struct gk20a *g,
114 struct gr_ctx_desc *gr_ctx,
115 struct vm_gk20a *vm, u32 class,
116 u32 graphics_preempt_mode,
117 u32 compute_preempt_mode)
118{
119 int err = 0;
120
121 if (class == PASCAL_B && g->gr.t18x.ctx_vars.force_preemption_gfxp)
122 graphics_preempt_mode = NVGPU_GRAPHICS_PREEMPTION_MODE_GFXP;
123
124 if (class == PASCAL_COMPUTE_B &&
125 g->gr.t18x.ctx_vars.force_preemption_cilp)
126 compute_preempt_mode = NVGPU_COMPUTE_PREEMPTION_MODE_CILP;
127
128 /* check for invalid combinations */
129 if ((graphics_preempt_mode == 0) && (compute_preempt_mode == 0))
130 return -EINVAL;
131
132 if ((graphics_preempt_mode == NVGPU_GRAPHICS_PREEMPTION_MODE_GFXP) &&
133 (compute_preempt_mode == NVGPU_COMPUTE_PREEMPTION_MODE_CILP))
134 return -EINVAL;
135
136 /* set preemption modes */
137 switch (graphics_preempt_mode) {
138 case NVGPU_GRAPHICS_PREEMPTION_MODE_GFXP:
139 {
140 u32 spill_size =
141 gr_gpc0_swdx_rm_spill_buffer_size_256b_default_v() *
142 gr_gpc0_swdx_rm_spill_buffer_size_256b_byte_granularity_v();
143 u32 pagepool_size = g->ops.gr.pagepool_default_size(g) *
144 gr_scc_pagepool_total_pages_byte_granularity_v();
145 u32 betacb_size = g->gr.attrib_cb_default_size +
146 (gr_gpc0_ppc0_cbm_beta_cb_size_v_gfxp_v() -
147 gr_gpc0_ppc0_cbm_beta_cb_size_v_default_v());
148 u32 attrib_cb_size = (betacb_size + g->gr.alpha_cb_size) *
149 gr_gpc0_ppc0_cbm_beta_cb_size_v_granularity_v() *
150 g->gr.max_tpc_count;
151 attrib_cb_size = ALIGN(attrib_cb_size, 128);
152
153 gk20a_dbg_info("gfxp context spill_size=%d", spill_size);
154 gk20a_dbg_info("gfxp context pagepool_size=%d", pagepool_size);
155 gk20a_dbg_info("gfxp context attrib_cb_size=%d",
156 attrib_cb_size);
157
158 err = gr_gp10b_alloc_buffer(vm,
159 g->gr.t18x.ctx_vars.preempt_image_size,
160 &gr_ctx->t18x.preempt_ctxsw_buffer);
161 if (err) {
162 gk20a_err(dev_from_gk20a(g),
163 "cannot allocate preempt buffer");
164 goto fail;
165 }
166
167 err = gr_gp10b_alloc_buffer(vm,
168 spill_size,
169 &gr_ctx->t18x.spill_ctxsw_buffer);
170 if (err) {
171 gk20a_err(dev_from_gk20a(g),
172 "cannot allocate spill buffer");
173 goto fail_free_preempt;
174 }
175
176 err = gr_gp10b_alloc_buffer(vm,
177 attrib_cb_size,
178 &gr_ctx->t18x.betacb_ctxsw_buffer);
179 if (err) {
180 gk20a_err(dev_from_gk20a(g),
181 "cannot allocate beta buffer");
182 goto fail_free_spill;
183 }
184
185 err = gr_gp10b_alloc_buffer(vm,
186 pagepool_size,
187 &gr_ctx->t18x.pagepool_ctxsw_buffer);
188 if (err) {
189 gk20a_err(dev_from_gk20a(g),
190 "cannot allocate page pool");
191 goto fail_free_betacb;
192 }
193
194 gr_ctx->graphics_preempt_mode = graphics_preempt_mode;
195 break;
196 }
197
198 case NVGPU_GRAPHICS_PREEMPTION_MODE_WFI:
199 gr_ctx->graphics_preempt_mode = graphics_preempt_mode;
200 break;
201
202 default:
203 break;
204 }
205
206 if (class == PASCAL_COMPUTE_B) {
207 switch (compute_preempt_mode) {
208 case NVGPU_COMPUTE_PREEMPTION_MODE_WFI:
209 case NVGPU_COMPUTE_PREEMPTION_MODE_CTA:
210 case NVGPU_COMPUTE_PREEMPTION_MODE_CILP:
211 gr_ctx->compute_preempt_mode = compute_preempt_mode;
212 break;
213 default:
214 break;
215 }
216 }
217
218 return 0;
219
220fail_free_betacb:
221 gk20a_gmmu_unmap_free(vm, &gr_ctx->t18x.betacb_ctxsw_buffer);
222fail_free_spill:
223 gk20a_gmmu_unmap_free(vm, &gr_ctx->t18x.spill_ctxsw_buffer);
224fail_free_preempt:
225 gk20a_gmmu_unmap_free(vm, &gr_ctx->t18x.preempt_ctxsw_buffer);
226fail:
227 return err;
228}
229
230void gp106_init_gr(struct gpu_ops *gops)
231{
232 gp10b_init_gr(gops);
233 gops->gr.is_valid_class = gr_gp106_is_valid_class;
234 gops->gr.pagepool_default_size = gr_gp106_pagepool_default_size;
235 gops->gr.handle_sw_method = gr_gp106_handle_sw_method;
236 gops->gr.cb_size_default = gr_gp106_cb_size_default;
237 gops->gr.init_preemption_state = NULL;
238 gops->gr.set_ctxsw_preemption_mode = gr_gp106_set_ctxsw_preemption_mode;
239}
diff --git a/drivers/gpu/nvgpu/gp106/gr_gp106.h b/drivers/gpu/nvgpu/gp106/gr_gp106.h
new file mode 100644
index 00000000..4fe22ee9
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_gp106.h
@@ -0,0 +1,26 @@
1/*
2 * GP106 GPU GR
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef _NVGPU_GR_GP106_H_
17#define _NVGPU_GR_GP106_H_
18
19enum {
20 PASCAL_B = 0xC197,
21 PASCAL_COMPUTE_B = 0xC1C0,
22};
23
24void gp106_init_gr(struct gpu_ops *gops);
25
26#endif
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
new file mode 100644
index 00000000..ee361953
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -0,0 +1,259 @@
1/*
2 * GP106 HAL interface
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include <linux/types.h>
17#include <linux/printk.h>
18
19#include <linux/types.h>
20
21#include "gk20a/gk20a.h"
22
23#include "gp10b/gr_gp10b.h"
24#include "gp10b/mc_gp10b.h"
25#include "gp106/ltc_gp106.h"
26#include "gp10b/mm_gp10b.h"
27#include "gp10b/ce_gp10b.h"
28#include "gp106/fifo_gp106.h"
29#include "gp106/regops_gp106.h"
30#include "gp10b/cde_gp10b.h"
31#include "gp106/therm_gp106.h"
32#include "gp106/xve_gp106.h"
33
34#include "gp106/bios_gp106.h"
35
36#include "gm20b/gr_gm20b.h"
37#include "gm20b/fifo_gm20b.h"
38#include "gm20b/pmu_gm20b.h"
39#include "gp106/clk_gp106.h"
40#include "gp106/clk_arb_gp106.h"
41
42#include "gp106/mm_gp106.h"
43#include "gp106/pmu_gp106.h"
44#include "gp106/gr_ctx_gp106.h"
45#include "gp106/gr_gp106.h"
46#include "gp106/fb_gp106.h"
47#include "gp106/gp106_gating_reglist.h"
48#include "nvgpu_gpuid_t18x.h"
49#include "hw_proj_gp106.h"
50#include "gk20a/dbg_gpu_gk20a.h"
51#include "gk20a/css_gr_gk20a.h"
52
53static struct gpu_ops gp106_ops = {
54 .clock_gating = {
55 .slcg_bus_load_gating_prod =
56 gp106_slcg_bus_load_gating_prod,
57 .slcg_ce2_load_gating_prod =
58 gp106_slcg_ce2_load_gating_prod,
59 .slcg_chiplet_load_gating_prod =
60 gp106_slcg_chiplet_load_gating_prod,
61 .slcg_ctxsw_firmware_load_gating_prod =
62 gp106_slcg_ctxsw_firmware_load_gating_prod,
63 .slcg_fb_load_gating_prod =
64 gp106_slcg_fb_load_gating_prod,
65 .slcg_fifo_load_gating_prod =
66 gp106_slcg_fifo_load_gating_prod,
67 .slcg_gr_load_gating_prod =
68 gr_gp106_slcg_gr_load_gating_prod,
69 .slcg_ltc_load_gating_prod =
70 ltc_gp106_slcg_ltc_load_gating_prod,
71 .slcg_perf_load_gating_prod =
72 gp106_slcg_perf_load_gating_prod,
73 .slcg_priring_load_gating_prod =
74 gp106_slcg_priring_load_gating_prod,
75 .slcg_pmu_load_gating_prod =
76 gp106_slcg_pmu_load_gating_prod,
77 .slcg_therm_load_gating_prod =
78 gp106_slcg_therm_load_gating_prod,
79 .slcg_xbar_load_gating_prod =
80 gp106_slcg_xbar_load_gating_prod,
81 .blcg_bus_load_gating_prod =
82 gp106_blcg_bus_load_gating_prod,
83 .blcg_ce_load_gating_prod =
84 gp106_blcg_ce_load_gating_prod,
85 .blcg_fb_load_gating_prod =
86 gp106_blcg_fb_load_gating_prod,
87 .blcg_fifo_load_gating_prod =
88 gp106_blcg_fifo_load_gating_prod,
89 .blcg_gr_load_gating_prod =
90 gp106_blcg_gr_load_gating_prod,
91 .blcg_ltc_load_gating_prod =
92 gp106_blcg_ltc_load_gating_prod,
93 .blcg_pmu_load_gating_prod =
94 gp106_blcg_pmu_load_gating_prod,
95 .blcg_xbar_load_gating_prod =
96 gp106_blcg_xbar_load_gating_prod,
97 .pg_gr_load_gating_prod =
98 gr_gp106_pg_gr_load_gating_prod,
99 }
100};
101
102static int gp106_get_litter_value(struct gk20a *g, int value)
103{
104 int ret = -EINVAL;
105
106 switch (value) {
107 case GPU_LIT_NUM_GPCS:
108 ret = proj_scal_litter_num_gpcs_v();
109 break;
110 case GPU_LIT_NUM_PES_PER_GPC:
111 ret = proj_scal_litter_num_pes_per_gpc_v();
112 break;
113 case GPU_LIT_NUM_ZCULL_BANKS:
114 ret = proj_scal_litter_num_zcull_banks_v();
115 break;
116 case GPU_LIT_NUM_TPC_PER_GPC:
117 ret = proj_scal_litter_num_tpc_per_gpc_v();
118 break;
119 case GPU_LIT_NUM_FBPS:
120 ret = proj_scal_litter_num_fbps_v();
121 break;
122 case GPU_LIT_GPC_BASE:
123 ret = proj_gpc_base_v();
124 break;
125 case GPU_LIT_GPC_STRIDE:
126 ret = proj_gpc_stride_v();
127 break;
128 case GPU_LIT_GPC_SHARED_BASE:
129 ret = proj_gpc_shared_base_v();
130 break;
131 case GPU_LIT_TPC_IN_GPC_BASE:
132 ret = proj_tpc_in_gpc_base_v();
133 break;
134 case GPU_LIT_TPC_IN_GPC_STRIDE:
135 ret = proj_tpc_in_gpc_stride_v();
136 break;
137 case GPU_LIT_TPC_IN_GPC_SHARED_BASE:
138 ret = proj_tpc_in_gpc_shared_base_v();
139 break;
140 case GPU_LIT_PPC_IN_GPC_BASE:
141 ret = proj_ppc_in_gpc_base_v();
142 break;
143 case GPU_LIT_PPC_IN_GPC_STRIDE:
144 ret = proj_ppc_in_gpc_stride_v();
145 break;
146 case GPU_LIT_PPC_IN_GPC_SHARED_BASE:
147 ret = proj_ppc_in_gpc_shared_base_v();
148 break;
149 case GPU_LIT_ROP_BASE:
150 ret = proj_rop_base_v();
151 break;
152 case GPU_LIT_ROP_STRIDE:
153 ret = proj_rop_stride_v();
154 break;
155 case GPU_LIT_ROP_SHARED_BASE:
156 ret = proj_rop_shared_base_v();
157 break;
158 case GPU_LIT_HOST_NUM_ENGINES:
159 ret = proj_host_num_engines_v();
160 break;
161 case GPU_LIT_HOST_NUM_PBDMA:
162 ret = proj_host_num_pbdma_v();
163 break;
164 case GPU_LIT_LTC_STRIDE:
165 ret = proj_ltc_stride_v();
166 break;
167 case GPU_LIT_LTS_STRIDE:
168 ret = proj_lts_stride_v();
169 break;
170 case GPU_LIT_NUM_FBPAS:
171 ret = proj_scal_litter_num_fbpas_v();
172 break;
173 case GPU_LIT_FBPA_SHARED_BASE:
174 ret = proj_fbpa_shared_base_v();
175 break;
176 case GPU_LIT_FBPA_BASE:
177 ret = proj_fbpa_base_v();
178 break;
179 case GPU_LIT_FBPA_STRIDE:
180 ret = proj_fbpa_stride_v();
181 break;
182 default:
183 BUG();
184 break;
185 }
186
187 return ret;
188}
189
190int gp106_init_gpu_characteristics(struct gk20a *g)
191{
192 struct nvgpu_gpu_characteristics *gpu = &g->gpu_characteristics;
193
194 int err;
195
196 err = gk20a_init_gpu_characteristics(g);
197 if (err)
198 return err;
199
200 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_GET_VOLTAGE |
201 NVGPU_GPU_FLAGS_SUPPORT_GET_CURRENT |
202 NVGPU_GPU_FLAGS_SUPPORT_GET_POWER |
203 NVGPU_GPU_FLAGS_SUPPORT_GET_TEMPERATURE;
204
205 return 0;
206}
207
208int gp106_init_hal(struct gk20a *g)
209{
210 struct gpu_ops *gops = &g->ops;
211 struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics;
212
213 gk20a_dbg_fn("");
214
215 *gops = gp106_ops;
216
217 gops->privsecurity = 1;
218 gops->securegpccs = 1;
219 gops->pmupstate = true;
220 gp10b_init_mc(gops);
221 gp106_init_gr(gops);
222 gp106_init_ltc(gops);
223 gp106_init_fb(gops);
224 gp106_init_fifo(gops);
225 gp10b_init_ce(gops);
226 gp106_init_gr_ctx(gops);
227 gp106_init_mm(gops);
228 gp106_init_pmu_ops(gops);
229 gk20a_init_debug_ops(gops);
230 gk20a_init_dbg_session_ops(gops);
231 gp106_init_clk_ops(gops);
232 gp106_init_clk_arb_ops(gops);
233 gp106_init_regops(gops);
234 gp10b_init_cde_ops(gops);
235 gk20a_init_tsg_ops(gops);
236#if defined(CONFIG_GK20A_CYCLE_STATS)
237 gk20a_init_css_ops(gops);
238#endif
239 gp106_init_bios(gops);
240 gp106_init_therm_ops(gops);
241 gp106_init_xve_ops(gops);
242
243 gops->name = "gp10x";
244 gops->get_litter_value = gp106_get_litter_value;
245 gops->chip_init_gpu_characteristics = gp106_init_gpu_characteristics;
246 gops->gr_ctx.use_dma_for_fw_bootstrap = true;
247 gops->read_ptimer = gk20a_read_ptimer;
248
249 c->twod_class = FERMI_TWOD_A;
250 c->threed_class = PASCAL_B;
251 c->compute_class = PASCAL_COMPUTE_B;
252 c->gpfifo_class = PASCAL_CHANNEL_GPFIFO_A;
253 c->inline_to_memory_class = KEPLER_INLINE_TO_MEMORY_B;
254 c->dma_copy_class = PASCAL_DMA_COPY_A;
255
256 gk20a_dbg_fn("done");
257
258 return 0;
259}
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.h b/drivers/gpu/nvgpu/gp106/hal_gp106.h
new file mode 100644
index 00000000..af91267b
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.h
@@ -0,0 +1,21 @@
1/*
2 * GP106 Tegra HAL interface
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef _NVGPU_HAL_GP106_H
17#define _NVGPU_HAL_GP106_H
18struct gk20a;
19
20int gp106_init_hal(struct gk20a *gops);
21#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_bus_gp106.h b/drivers/gpu/nvgpu/gp106/hw_bus_gp106.h
new file mode 100644
index 00000000..6d80b6a6
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_bus_gp106.h
@@ -0,0 +1,193 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_bus_gp106_h_
51#define _hw_bus_gp106_h_
52
53static inline u32 bus_bar1_block_r(void)
54{
55 return 0x00001704;
56}
57static inline u32 bus_bar1_block_ptr_f(u32 v)
58{
59 return (v & 0xfffffff) << 0;
60}
61static inline u32 bus_bar1_block_target_vid_mem_f(void)
62{
63 return 0x0;
64}
65static inline u32 bus_bar1_block_target_sys_mem_coh_f(void)
66{
67 return 0x20000000;
68}
69static inline u32 bus_bar1_block_target_sys_mem_ncoh_f(void)
70{
71 return 0x30000000;
72}
73static inline u32 bus_bar1_block_mode_virtual_f(void)
74{
75 return 0x80000000;
76}
77static inline u32 bus_bar2_block_r(void)
78{
79 return 0x00001714;
80}
81static inline u32 bus_bar2_block_ptr_f(u32 v)
82{
83 return (v & 0xfffffff) << 0;
84}
85static inline u32 bus_bar2_block_target_vid_mem_f(void)
86{
87 return 0x0;
88}
89static inline u32 bus_bar2_block_target_sys_mem_coh_f(void)
90{
91 return 0x20000000;
92}
93static inline u32 bus_bar2_block_target_sys_mem_ncoh_f(void)
94{
95 return 0x30000000;
96}
97static inline u32 bus_bar2_block_mode_virtual_f(void)
98{
99 return 0x80000000;
100}
101static inline u32 bus_bar1_block_ptr_shift_v(void)
102{
103 return 0x0000000c;
104}
105static inline u32 bus_bar2_block_ptr_shift_v(void)
106{
107 return 0x0000000c;
108}
109static inline u32 bus_bind_status_r(void)
110{
111 return 0x00001710;
112}
113static inline u32 bus_bind_status_bar1_pending_v(u32 r)
114{
115 return (r >> 0) & 0x1;
116}
117static inline u32 bus_bind_status_bar1_pending_empty_f(void)
118{
119 return 0x0;
120}
121static inline u32 bus_bind_status_bar1_pending_busy_f(void)
122{
123 return 0x1;
124}
125static inline u32 bus_bind_status_bar1_outstanding_v(u32 r)
126{
127 return (r >> 1) & 0x1;
128}
129static inline u32 bus_bind_status_bar1_outstanding_false_f(void)
130{
131 return 0x0;
132}
133static inline u32 bus_bind_status_bar1_outstanding_true_f(void)
134{
135 return 0x2;
136}
137static inline u32 bus_bind_status_bar2_pending_v(u32 r)
138{
139 return (r >> 2) & 0x1;
140}
141static inline u32 bus_bind_status_bar2_pending_empty_f(void)
142{
143 return 0x0;
144}
145static inline u32 bus_bind_status_bar2_pending_busy_f(void)
146{
147 return 0x4;
148}
149static inline u32 bus_bind_status_bar2_outstanding_v(u32 r)
150{
151 return (r >> 3) & 0x1;
152}
153static inline u32 bus_bind_status_bar2_outstanding_false_f(void)
154{
155 return 0x0;
156}
157static inline u32 bus_bind_status_bar2_outstanding_true_f(void)
158{
159 return 0x8;
160}
161static inline u32 bus_intr_0_r(void)
162{
163 return 0x00001100;
164}
165static inline u32 bus_intr_0_pri_squash_m(void)
166{
167 return 0x1 << 1;
168}
169static inline u32 bus_intr_0_pri_fecserr_m(void)
170{
171 return 0x1 << 2;
172}
173static inline u32 bus_intr_0_pri_timeout_m(void)
174{
175 return 0x1 << 3;
176}
177static inline u32 bus_intr_en_0_r(void)
178{
179 return 0x00001140;
180}
181static inline u32 bus_intr_en_0_pri_squash_m(void)
182{
183 return 0x1 << 1;
184}
185static inline u32 bus_intr_en_0_pri_fecserr_m(void)
186{
187 return 0x1 << 2;
188}
189static inline u32 bus_intr_en_0_pri_timeout_m(void)
190{
191 return 0x1 << 3;
192}
193#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_ccsr_gp106.h b/drivers/gpu/nvgpu/gp106/hw_ccsr_gp106.h
new file mode 100644
index 00000000..65146d39
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_ccsr_gp106.h
@@ -0,0 +1,125 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_ccsr_gp106_h_
51#define _hw_ccsr_gp106_h_
52
53static inline u32 ccsr_channel_inst_r(u32 i)
54{
55 return 0x00800000 + i*8;
56}
57static inline u32 ccsr_channel_inst__size_1_v(void)
58{
59 return 0x00001000;
60}
61static inline u32 ccsr_channel_inst_ptr_f(u32 v)
62{
63 return (v & 0xfffffff) << 0;
64}
65static inline u32 ccsr_channel_inst_target_vid_mem_f(void)
66{
67 return 0x0;
68}
69static inline u32 ccsr_channel_inst_target_sys_mem_coh_f(void)
70{
71 return 0x20000000;
72}
73static inline u32 ccsr_channel_inst_target_sys_mem_ncoh_f(void)
74{
75 return 0x30000000;
76}
77static inline u32 ccsr_channel_inst_bind_false_f(void)
78{
79 return 0x0;
80}
81static inline u32 ccsr_channel_inst_bind_true_f(void)
82{
83 return 0x80000000;
84}
85static inline u32 ccsr_channel_r(u32 i)
86{
87 return 0x00800004 + i*8;
88}
89static inline u32 ccsr_channel__size_1_v(void)
90{
91 return 0x00001000;
92}
93static inline u32 ccsr_channel_enable_v(u32 r)
94{
95 return (r >> 0) & 0x1;
96}
97static inline u32 ccsr_channel_enable_set_f(u32 v)
98{
99 return (v & 0x1) << 10;
100}
101static inline u32 ccsr_channel_enable_set_true_f(void)
102{
103 return 0x400;
104}
105static inline u32 ccsr_channel_enable_clr_true_f(void)
106{
107 return 0x800;
108}
109static inline u32 ccsr_channel_status_v(u32 r)
110{
111 return (r >> 24) & 0xf;
112}
113static inline u32 ccsr_channel_status_pending_ctx_reload_v(void)
114{
115 return 0x00000002;
116}
117static inline u32 ccsr_channel_busy_v(u32 r)
118{
119 return (r >> 28) & 0x1;
120}
121static inline u32 ccsr_channel_next_v(u32 r)
122{
123 return (r >> 1) & 0x1;
124}
125#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_ce_gp106.h b/drivers/gpu/nvgpu/gp106/hw_ce_gp106.h
new file mode 100644
index 00000000..36311136
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_ce_gp106.h
@@ -0,0 +1,81 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_ce_gp106_h_
51#define _hw_ce_gp106_h_
52
53static inline u32 ce_intr_status_r(u32 i)
54{
55 return 0x00104410 + i*128;
56}
57static inline u32 ce_intr_status_blockpipe_pending_f(void)
58{
59 return 0x1;
60}
61static inline u32 ce_intr_status_blockpipe_reset_f(void)
62{
63 return 0x1;
64}
65static inline u32 ce_intr_status_nonblockpipe_pending_f(void)
66{
67 return 0x2;
68}
69static inline u32 ce_intr_status_nonblockpipe_reset_f(void)
70{
71 return 0x2;
72}
73static inline u32 ce_intr_status_launcherr_pending_f(void)
74{
75 return 0x4;
76}
77static inline u32 ce_intr_status_launcherr_reset_f(void)
78{
79 return 0x4;
80}
81#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_ctxsw_prog_gp106.h b/drivers/gpu/nvgpu/gp106/hw_ctxsw_prog_gp106.h
new file mode 100644
index 00000000..ed3e6009
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_ctxsw_prog_gp106.h
@@ -0,0 +1,289 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_ctxsw_prog_gp106_h_
51#define _hw_ctxsw_prog_gp106_h_
52
53static inline u32 ctxsw_prog_fecs_header_v(void)
54{
55 return 0x00000100;
56}
57static inline u32 ctxsw_prog_main_image_num_gpcs_o(void)
58{
59 return 0x00000008;
60}
61static inline u32 ctxsw_prog_main_image_patch_count_o(void)
62{
63 return 0x00000010;
64}
65static inline u32 ctxsw_prog_main_image_patch_adr_lo_o(void)
66{
67 return 0x00000014;
68}
69static inline u32 ctxsw_prog_main_image_patch_adr_hi_o(void)
70{
71 return 0x00000018;
72}
73static inline u32 ctxsw_prog_main_image_zcull_o(void)
74{
75 return 0x0000001c;
76}
77static inline u32 ctxsw_prog_main_image_zcull_mode_no_ctxsw_v(void)
78{
79 return 0x00000001;
80}
81static inline u32 ctxsw_prog_main_image_zcull_mode_separate_buffer_v(void)
82{
83 return 0x00000002;
84}
85static inline u32 ctxsw_prog_main_image_zcull_ptr_o(void)
86{
87 return 0x00000020;
88}
89static inline u32 ctxsw_prog_main_image_pm_o(void)
90{
91 return 0x00000028;
92}
93static inline u32 ctxsw_prog_main_image_pm_mode_m(void)
94{
95 return 0x7 << 0;
96}
97static inline u32 ctxsw_prog_main_image_pm_mode_no_ctxsw_f(void)
98{
99 return 0x0;
100}
101static inline u32 ctxsw_prog_main_image_pm_smpc_mode_m(void)
102{
103 return 0x7 << 3;
104}
105static inline u32 ctxsw_prog_main_image_pm_smpc_mode_ctxsw_f(void)
106{
107 return 0x8;
108}
109static inline u32 ctxsw_prog_main_image_pm_smpc_mode_no_ctxsw_f(void)
110{
111 return 0x0;
112}
113static inline u32 ctxsw_prog_main_image_pm_ptr_o(void)
114{
115 return 0x0000002c;
116}
117static inline u32 ctxsw_prog_main_image_num_save_ops_o(void)
118{
119 return 0x000000f4;
120}
121static inline u32 ctxsw_prog_main_image_num_wfi_save_ops_o(void)
122{
123 return 0x000000d0;
124}
125static inline u32 ctxsw_prog_main_image_num_cta_save_ops_o(void)
126{
127 return 0x000000d4;
128}
129static inline u32 ctxsw_prog_main_image_num_gfxp_save_ops_o(void)
130{
131 return 0x000000d8;
132}
133static inline u32 ctxsw_prog_main_image_num_cilp_save_ops_o(void)
134{
135 return 0x000000dc;
136}
137static inline u32 ctxsw_prog_main_image_num_restore_ops_o(void)
138{
139 return 0x000000f8;
140}
141static inline u32 ctxsw_prog_main_image_magic_value_o(void)
142{
143 return 0x000000fc;
144}
145static inline u32 ctxsw_prog_main_image_magic_value_v_value_v(void)
146{
147 return 0x600dc0de;
148}
149static inline u32 ctxsw_prog_local_priv_register_ctl_o(void)
150{
151 return 0x0000000c;
152}
153static inline u32 ctxsw_prog_local_priv_register_ctl_offset_v(u32 r)
154{
155 return (r >> 0) & 0xffff;
156}
157static inline u32 ctxsw_prog_local_image_ppc_info_o(void)
158{
159 return 0x000000f4;
160}
161static inline u32 ctxsw_prog_local_image_ppc_info_num_ppcs_v(u32 r)
162{
163 return (r >> 0) & 0xffff;
164}
165static inline u32 ctxsw_prog_local_image_ppc_info_ppc_mask_v(u32 r)
166{
167 return (r >> 16) & 0xffff;
168}
169static inline u32 ctxsw_prog_local_image_num_tpcs_o(void)
170{
171 return 0x000000f8;
172}
173static inline u32 ctxsw_prog_local_magic_value_o(void)
174{
175 return 0x000000fc;
176}
177static inline u32 ctxsw_prog_local_magic_value_v_value_v(void)
178{
179 return 0xad0becab;
180}
181static inline u32 ctxsw_prog_main_extended_buffer_ctl_o(void)
182{
183 return 0x000000ec;
184}
185static inline u32 ctxsw_prog_main_extended_buffer_ctl_offset_v(u32 r)
186{
187 return (r >> 0) & 0xffff;
188}
189static inline u32 ctxsw_prog_main_extended_buffer_ctl_size_v(u32 r)
190{
191 return (r >> 16) & 0xff;
192}
193static inline u32 ctxsw_prog_extended_buffer_segments_size_in_bytes_v(void)
194{
195 return 0x00000100;
196}
197static inline u32 ctxsw_prog_extended_marker_size_in_bytes_v(void)
198{
199 return 0x00000004;
200}
201static inline u32 ctxsw_prog_extended_sm_dsm_perf_counter_register_stride_v(void)
202{
203 return 0x00000000;
204}
205static inline u32 ctxsw_prog_extended_sm_dsm_perf_counter_control_register_stride_v(void)
206{
207 return 0x00000002;
208}
209static inline u32 ctxsw_prog_main_image_priv_access_map_config_o(void)
210{
211 return 0x000000a0;
212}
213static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_s(void)
214{
215 return 2;
216}
217static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_f(u32 v)
218{
219 return (v & 0x3) << 0;
220}
221static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_m(void)
222{
223 return 0x3 << 0;
224}
225static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_v(u32 r)
226{
227 return (r >> 0) & 0x3;
228}
229static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_allow_all_f(void)
230{
231 return 0x0;
232}
233static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_use_map_f(void)
234{
235 return 0x2;
236}
237static inline u32 ctxsw_prog_main_image_priv_access_map_addr_lo_o(void)
238{
239 return 0x000000a4;
240}
241static inline u32 ctxsw_prog_main_image_priv_access_map_addr_hi_o(void)
242{
243 return 0x000000a8;
244}
245static inline u32 ctxsw_prog_main_image_misc_options_o(void)
246{
247 return 0x0000003c;
248}
249static inline u32 ctxsw_prog_main_image_misc_options_verif_features_m(void)
250{
251 return 0x1 << 3;
252}
253static inline u32 ctxsw_prog_main_image_misc_options_verif_features_disabled_f(void)
254{
255 return 0x0;
256}
257static inline u32 ctxsw_prog_main_image_graphics_preemption_options_o(void)
258{
259 return 0x00000080;
260}
261static inline u32 ctxsw_prog_main_image_graphics_preemption_options_control_f(u32 v)
262{
263 return (v & 0x3) << 0;
264}
265static inline u32 ctxsw_prog_main_image_graphics_preemption_options_control_gfxp_f(void)
266{
267 return 0x1;
268}
269static inline u32 ctxsw_prog_main_image_full_preemption_ptr_o(void)
270{
271 return 0x00000068;
272}
273static inline u32 ctxsw_prog_main_image_compute_preemption_options_o(void)
274{
275 return 0x00000084;
276}
277static inline u32 ctxsw_prog_main_image_compute_preemption_options_control_f(u32 v)
278{
279 return (v & 0x3) << 0;
280}
281static inline u32 ctxsw_prog_main_image_compute_preemption_options_control_cta_f(void)
282{
283 return 0x1;
284}
285static inline u32 ctxsw_prog_main_image_compute_preemption_options_control_cilp_f(void)
286{
287 return 0x2;
288}
289#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h
new file mode 100644
index 00000000..519679f5
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h
@@ -0,0 +1,609 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_fb_gp106_h_
51#define _hw_fb_gp106_h_
52
53static inline u32 fb_fbhub_num_active_ltcs_r(void)
54{
55 return 0x00100800;
56}
57static inline u32 fb_mmu_ctrl_r(void)
58{
59 return 0x00100c80;
60}
61static inline u32 fb_mmu_ctrl_vm_pg_size_f(u32 v)
62{
63 return (v & 0x1) << 0;
64}
65static inline u32 fb_mmu_ctrl_vm_pg_size_128kb_f(void)
66{
67 return 0x0;
68}
69static inline u32 fb_mmu_ctrl_vm_pg_size_64kb_f(void)
70{
71 return 0x1;
72}
73static inline u32 fb_mmu_ctrl_pri_fifo_empty_v(u32 r)
74{
75 return (r >> 15) & 0x1;
76}
77static inline u32 fb_mmu_ctrl_pri_fifo_empty_false_f(void)
78{
79 return 0x0;
80}
81static inline u32 fb_mmu_ctrl_pri_fifo_space_v(u32 r)
82{
83 return (r >> 16) & 0xff;
84}
85static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_v(u32 r)
86{
87 return (r >> 11) & 0x1;
88}
89static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_true_f(void)
90{
91 return 0x800;
92}
93static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_false_f(void)
94{
95 return 0x0;
96}
97static inline u32 fb_priv_mmu_phy_secure_r(void)
98{
99 return 0x00100ce4;
100}
101static inline u32 fb_mmu_invalidate_pdb_r(void)
102{
103 return 0x00100cb8;
104}
105static inline u32 fb_mmu_invalidate_pdb_aperture_vid_mem_f(void)
106{
107 return 0x0;
108}
109static inline u32 fb_mmu_invalidate_pdb_aperture_sys_mem_f(void)
110{
111 return 0x2;
112}
113static inline u32 fb_mmu_invalidate_pdb_addr_f(u32 v)
114{
115 return (v & 0xfffffff) << 4;
116}
117static inline u32 fb_mmu_invalidate_r(void)
118{
119 return 0x00100cbc;
120}
121static inline u32 fb_mmu_invalidate_all_va_true_f(void)
122{
123 return 0x1;
124}
125static inline u32 fb_mmu_invalidate_all_pdb_true_f(void)
126{
127 return 0x2;
128}
129static inline u32 fb_mmu_invalidate_hubtlb_only_s(void)
130{
131 return 1;
132}
133static inline u32 fb_mmu_invalidate_hubtlb_only_f(u32 v)
134{
135 return (v & 0x1) << 2;
136}
137static inline u32 fb_mmu_invalidate_hubtlb_only_m(void)
138{
139 return 0x1 << 2;
140}
141static inline u32 fb_mmu_invalidate_hubtlb_only_v(u32 r)
142{
143 return (r >> 2) & 0x1;
144}
145static inline u32 fb_mmu_invalidate_hubtlb_only_true_f(void)
146{
147 return 0x4;
148}
149static inline u32 fb_mmu_invalidate_replay_s(void)
150{
151 return 3;
152}
153static inline u32 fb_mmu_invalidate_replay_f(u32 v)
154{
155 return (v & 0x7) << 3;
156}
157static inline u32 fb_mmu_invalidate_replay_m(void)
158{
159 return 0x7 << 3;
160}
161static inline u32 fb_mmu_invalidate_replay_v(u32 r)
162{
163 return (r >> 3) & 0x7;
164}
165static inline u32 fb_mmu_invalidate_replay_none_f(void)
166{
167 return 0x0;
168}
169static inline u32 fb_mmu_invalidate_replay_start_f(void)
170{
171 return 0x8;
172}
173static inline u32 fb_mmu_invalidate_replay_start_ack_all_f(void)
174{
175 return 0x10;
176}
177static inline u32 fb_mmu_invalidate_replay_cancel_targeted_f(void)
178{
179 return 0x18;
180}
181static inline u32 fb_mmu_invalidate_replay_cancel_global_f(void)
182{
183 return 0x20;
184}
185static inline u32 fb_mmu_invalidate_replay_cancel_f(void)
186{
187 return 0x20;
188}
189static inline u32 fb_mmu_invalidate_sys_membar_s(void)
190{
191 return 1;
192}
193static inline u32 fb_mmu_invalidate_sys_membar_f(u32 v)
194{
195 return (v & 0x1) << 6;
196}
197static inline u32 fb_mmu_invalidate_sys_membar_m(void)
198{
199 return 0x1 << 6;
200}
201static inline u32 fb_mmu_invalidate_sys_membar_v(u32 r)
202{
203 return (r >> 6) & 0x1;
204}
205static inline u32 fb_mmu_invalidate_sys_membar_true_f(void)
206{
207 return 0x40;
208}
209static inline u32 fb_mmu_invalidate_ack_s(void)
210{
211 return 2;
212}
213static inline u32 fb_mmu_invalidate_ack_f(u32 v)
214{
215 return (v & 0x3) << 7;
216}
217static inline u32 fb_mmu_invalidate_ack_m(void)
218{
219 return 0x3 << 7;
220}
221static inline u32 fb_mmu_invalidate_ack_v(u32 r)
222{
223 return (r >> 7) & 0x3;
224}
225static inline u32 fb_mmu_invalidate_ack_ack_none_required_f(void)
226{
227 return 0x0;
228}
229static inline u32 fb_mmu_invalidate_ack_ack_intranode_f(void)
230{
231 return 0x100;
232}
233static inline u32 fb_mmu_invalidate_ack_ack_globally_f(void)
234{
235 return 0x80;
236}
237static inline u32 fb_mmu_invalidate_cancel_client_id_s(void)
238{
239 return 6;
240}
241static inline u32 fb_mmu_invalidate_cancel_client_id_f(u32 v)
242{
243 return (v & 0x3f) << 9;
244}
245static inline u32 fb_mmu_invalidate_cancel_client_id_m(void)
246{
247 return 0x3f << 9;
248}
249static inline u32 fb_mmu_invalidate_cancel_client_id_v(u32 r)
250{
251 return (r >> 9) & 0x3f;
252}
253static inline u32 fb_mmu_invalidate_cancel_gpc_id_s(void)
254{
255 return 5;
256}
257static inline u32 fb_mmu_invalidate_cancel_gpc_id_f(u32 v)
258{
259 return (v & 0x1f) << 15;
260}
261static inline u32 fb_mmu_invalidate_cancel_gpc_id_m(void)
262{
263 return 0x1f << 15;
264}
265static inline u32 fb_mmu_invalidate_cancel_gpc_id_v(u32 r)
266{
267 return (r >> 15) & 0x1f;
268}
269static inline u32 fb_mmu_invalidate_cancel_client_type_s(void)
270{
271 return 1;
272}
273static inline u32 fb_mmu_invalidate_cancel_client_type_f(u32 v)
274{
275 return (v & 0x1) << 20;
276}
277static inline u32 fb_mmu_invalidate_cancel_client_type_m(void)
278{
279 return 0x1 << 20;
280}
281static inline u32 fb_mmu_invalidate_cancel_client_type_v(u32 r)
282{
283 return (r >> 20) & 0x1;
284}
285static inline u32 fb_mmu_invalidate_cancel_client_type_gpc_f(void)
286{
287 return 0x0;
288}
289static inline u32 fb_mmu_invalidate_cancel_client_type_hub_f(void)
290{
291 return 0x100000;
292}
293static inline u32 fb_mmu_invalidate_cancel_cache_level_s(void)
294{
295 return 3;
296}
297static inline u32 fb_mmu_invalidate_cancel_cache_level_f(u32 v)
298{
299 return (v & 0x7) << 24;
300}
301static inline u32 fb_mmu_invalidate_cancel_cache_level_m(void)
302{
303 return 0x7 << 24;
304}
305static inline u32 fb_mmu_invalidate_cancel_cache_level_v(u32 r)
306{
307 return (r >> 24) & 0x7;
308}
309static inline u32 fb_mmu_invalidate_cancel_cache_level_all_f(void)
310{
311 return 0x0;
312}
313static inline u32 fb_mmu_invalidate_cancel_cache_level_pte_only_f(void)
314{
315 return 0x1000000;
316}
317static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde0_f(void)
318{
319 return 0x2000000;
320}
321static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde1_f(void)
322{
323 return 0x3000000;
324}
325static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde2_f(void)
326{
327 return 0x4000000;
328}
329static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde3_f(void)
330{
331 return 0x5000000;
332}
333static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde4_f(void)
334{
335 return 0x6000000;
336}
337static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde5_f(void)
338{
339 return 0x7000000;
340}
341static inline u32 fb_mmu_invalidate_trigger_s(void)
342{
343 return 1;
344}
345static inline u32 fb_mmu_invalidate_trigger_f(u32 v)
346{
347 return (v & 0x1) << 31;
348}
349static inline u32 fb_mmu_invalidate_trigger_m(void)
350{
351 return 0x1 << 31;
352}
353static inline u32 fb_mmu_invalidate_trigger_v(u32 r)
354{
355 return (r >> 31) & 0x1;
356}
357static inline u32 fb_mmu_invalidate_trigger_true_f(void)
358{
359 return 0x80000000;
360}
361static inline u32 fb_mmu_debug_wr_r(void)
362{
363 return 0x00100cc8;
364}
365static inline u32 fb_mmu_debug_wr_aperture_s(void)
366{
367 return 2;
368}
369static inline u32 fb_mmu_debug_wr_aperture_f(u32 v)
370{
371 return (v & 0x3) << 0;
372}
373static inline u32 fb_mmu_debug_wr_aperture_m(void)
374{
375 return 0x3 << 0;
376}
377static inline u32 fb_mmu_debug_wr_aperture_v(u32 r)
378{
379 return (r >> 0) & 0x3;
380}
381static inline u32 fb_mmu_debug_wr_aperture_vid_mem_f(void)
382{
383 return 0x0;
384}
385static inline u32 fb_mmu_debug_wr_aperture_sys_mem_coh_f(void)
386{
387 return 0x2;
388}
389static inline u32 fb_mmu_debug_wr_aperture_sys_mem_ncoh_f(void)
390{
391 return 0x3;
392}
393static inline u32 fb_mmu_debug_wr_vol_false_f(void)
394{
395 return 0x0;
396}
397static inline u32 fb_mmu_debug_wr_vol_true_v(void)
398{
399 return 0x00000001;
400}
401static inline u32 fb_mmu_debug_wr_vol_true_f(void)
402{
403 return 0x4;
404}
405static inline u32 fb_mmu_debug_wr_addr_f(u32 v)
406{
407 return (v & 0xfffffff) << 4;
408}
409static inline u32 fb_mmu_debug_wr_addr_alignment_v(void)
410{
411 return 0x0000000c;
412}
413static inline u32 fb_mmu_debug_rd_r(void)
414{
415 return 0x00100ccc;
416}
417static inline u32 fb_mmu_debug_rd_aperture_vid_mem_f(void)
418{
419 return 0x0;
420}
421static inline u32 fb_mmu_debug_rd_aperture_sys_mem_coh_f(void)
422{
423 return 0x2;
424}
425static inline u32 fb_mmu_debug_rd_aperture_sys_mem_ncoh_f(void)
426{
427 return 0x3;
428}
429static inline u32 fb_mmu_debug_rd_vol_false_f(void)
430{
431 return 0x0;
432}
433static inline u32 fb_mmu_debug_rd_addr_f(u32 v)
434{
435 return (v & 0xfffffff) << 4;
436}
437static inline u32 fb_mmu_debug_rd_addr_alignment_v(void)
438{
439 return 0x0000000c;
440}
441static inline u32 fb_mmu_debug_ctrl_r(void)
442{
443 return 0x00100cc4;
444}
445static inline u32 fb_mmu_debug_ctrl_debug_v(u32 r)
446{
447 return (r >> 16) & 0x1;
448}
449static inline u32 fb_mmu_debug_ctrl_debug_m(void)
450{
451 return 0x1 << 16;
452}
453static inline u32 fb_mmu_debug_ctrl_debug_enabled_v(void)
454{
455 return 0x00000001;
456}
457static inline u32 fb_mmu_debug_ctrl_debug_enabled_f(void)
458{
459 return 0x10000;
460}
461static inline u32 fb_mmu_debug_ctrl_debug_disabled_v(void)
462{
463 return 0x00000000;
464}
465static inline u32 fb_mmu_debug_ctrl_debug_disabled_f(void)
466{
467 return 0x0;
468}
469static inline u32 fb_mmu_vpr_info_r(void)
470{
471 return 0x00100cd0;
472}
473static inline u32 fb_mmu_vpr_info_fetch_v(u32 r)
474{
475 return (r >> 2) & 0x1;
476}
477static inline u32 fb_mmu_vpr_info_fetch_false_v(void)
478{
479 return 0x00000000;
480}
481static inline u32 fb_mmu_vpr_info_fetch_true_v(void)
482{
483 return 0x00000001;
484}
485static inline u32 fb_niso_flush_sysmem_addr_r(void)
486{
487 return 0x00100c10;
488}
489static inline u32 fb_mmu_local_memory_range_r(void)
490{
491 return 0x00100ce0;
492}
493static inline u32 fb_mmu_local_memory_range_lower_scale_v(u32 r)
494{
495 return (r >> 0) & 0xf;
496}
497static inline u32 fb_mmu_local_memory_range_lower_mag_v(u32 r)
498{
499 return (r >> 4) & 0x3f;
500}
501static inline u32 fb_mmu_local_memory_range_ecc_mode_v(u32 r)
502{
503 return (r >> 30) & 0x1;
504}
505static inline u32 fb_fbpa_fbio_delay_r(void)
506{
507 return 0x9a065c;
508}
509static inline u32 fb_fbpa_fbio_delay_src_m(void)
510{
511 return 0x7;
512}
513static inline u32 fb_fbpa_fbio_delay_src_v(u32 r)
514{
515 return (r >> 0) & 0x7;
516}
517static inline u32 fb_fbpa_fbio_delay_src_f(u32 v)
518{
519 return (v & 0x7) << 0;
520}
521static inline u32 fb_fbpa_fbio_delay_src_max_v(void)
522{
523 return 2;
524}
525static inline u32 fb_fbpa_fbio_delay_priv_m(void)
526{
527 return 0x7 << 4;
528}
529static inline u32 fb_fbpa_fbio_delay_priv_v(u32 r)
530{
531 return (r >> 4) & 0x7;
532}
533static inline u32 fb_fbpa_fbio_delay_priv_f(u32 v)
534{
535 return (v & 0x7) << 4;
536}
537static inline u32 fb_fbpa_fbio_delay_priv_max_v(void)
538{
539 return 2;
540}
541static inline u32 fb_fbpa_fbio_cmd_delay_r(void)
542{
543 return 0x9a08e0;
544}
545static inline u32 fb_fbpa_fbio_cmd_delay_cmd_src_m(void)
546{
547 return 0x7;
548}
549static inline u32 fb_fbpa_fbio_cmd_delay_cmd_src_v(u32 r)
550{
551 return (r >> 0) & 0x7;
552}
553static inline u32 fb_fbpa_fbio_cmd_delay_cmd_src_f(u32 v)
554{
555 return (v & 0x7) << 0;
556}
557static inline u32 fb_fbpa_fbio_cmd_delay_cmd_src_max_v(void)
558{
559 return 1;
560}
561static inline u32 fb_fbpa_fbio_cmd_delay_cmd_priv_m(void)
562{
563 return 0x7 << 4;
564}
565static inline u32 fb_fbpa_fbio_cmd_delay_cmd_priv_v(u32 r)
566{
567 return (r >> 4) & 0x7;
568}
569static inline u32 fb_fbpa_fbio_cmd_delay_cmd_priv_f(u32 v)
570{
571 return (v & 0x7) << 4;
572}
573static inline u32 fb_fbpa_fbio_cmd_delay_cmd_priv_max_v(void)
574{
575 return 1;
576}
577static inline u32 fb_niso_scrubber_status_r(void)
578{
579 return 0x00100b20;
580}
581static inline u32 fb_niso_scrubber_status_flag_s(void)
582{
583 return 1;
584}
585static inline u32 fb_niso_scrubber_status_flag_f(u32 v)
586{
587 return (v & 0x1) << 0;
588}
589static inline u32 fb_niso_scrubber_status_flag_m(void)
590{
591 return 0x1 << 0;
592}
593static inline u32 fb_niso_scrubber_status_flag_v(u32 r)
594{
595 return (r >> 0) & 0x1;
596}
597static inline u32 fb_niso_scrub_status_r(void)
598{
599 return 0x00100b20;
600}
601static inline u32 fb_niso_scrub_status_flag_v(u32 r)
602{
603 return (r >> 0) & 0x1;
604}
605static inline u32 fb_fbpa_fbio_iref_byte_rx_ctrl_r(void)
606{
607 return 0x009a0eb0;
608}
609#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_fbpa_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fbpa_gp106.h
new file mode 100644
index 00000000..7f02eeb6
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_fbpa_gp106.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_fbpa_gp106_h_
51#define _hw_fbpa_gp106_h_
52
53static inline u32 fbpa_cstatus_r(void)
54{
55 return 0x009a020c;
56}
57static inline u32 fbpa_cstatus_ramamount_v(u32 r)
58{
59 return (r >> 0) & 0x1ffff;
60}
61#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_fifo_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fifo_gp106.h
new file mode 100644
index 00000000..ec02257e
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_fifo_gp106.h
@@ -0,0 +1,685 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_fifo_gp106_h_
51#define _hw_fifo_gp106_h_
52
53static inline u32 fifo_bar1_base_r(void)
54{
55 return 0x00002254;
56}
57static inline u32 fifo_bar1_base_ptr_f(u32 v)
58{
59 return (v & 0xfffffff) << 0;
60}
61static inline u32 fifo_bar1_base_ptr_align_shift_v(void)
62{
63 return 0x0000000c;
64}
65static inline u32 fifo_bar1_base_valid_false_f(void)
66{
67 return 0x0;
68}
69static inline u32 fifo_bar1_base_valid_true_f(void)
70{
71 return 0x10000000;
72}
73static inline u32 fifo_runlist_base_r(void)
74{
75 return 0x00002270;
76}
77static inline u32 fifo_runlist_base_ptr_f(u32 v)
78{
79 return (v & 0xfffffff) << 0;
80}
81static inline u32 fifo_runlist_base_target_vid_mem_f(void)
82{
83 return 0x0;
84}
85static inline u32 fifo_runlist_base_target_sys_mem_coh_f(void)
86{
87 return 0x20000000;
88}
89static inline u32 fifo_runlist_base_target_sys_mem_ncoh_f(void)
90{
91 return 0x30000000;
92}
93static inline u32 fifo_runlist_r(void)
94{
95 return 0x00002274;
96}
97static inline u32 fifo_runlist_engine_f(u32 v)
98{
99 return (v & 0xf) << 20;
100}
101static inline u32 fifo_eng_runlist_base_r(u32 i)
102{
103 return 0x00002280 + i*8;
104}
105static inline u32 fifo_eng_runlist_base__size_1_v(void)
106{
107 return 0x00000007;
108}
109static inline u32 fifo_eng_runlist_r(u32 i)
110{
111 return 0x00002284 + i*8;
112}
113static inline u32 fifo_eng_runlist__size_1_v(void)
114{
115 return 0x00000007;
116}
117static inline u32 fifo_eng_runlist_length_f(u32 v)
118{
119 return (v & 0xffff) << 0;
120}
121static inline u32 fifo_eng_runlist_length_max_v(void)
122{
123 return 0x0000ffff;
124}
125static inline u32 fifo_eng_runlist_pending_true_f(void)
126{
127 return 0x100000;
128}
129static inline u32 fifo_pb_timeslice_r(u32 i)
130{
131 return 0x00002350 + i*4;
132}
133static inline u32 fifo_pb_timeslice_timeout_16_f(void)
134{
135 return 0x10;
136}
137static inline u32 fifo_pb_timeslice_timescale_0_f(void)
138{
139 return 0x0;
140}
141static inline u32 fifo_pb_timeslice_enable_true_f(void)
142{
143 return 0x10000000;
144}
145static inline u32 fifo_pbdma_map_r(u32 i)
146{
147 return 0x00002390 + i*4;
148}
149static inline u32 fifo_intr_0_r(void)
150{
151 return 0x00002100;
152}
153static inline u32 fifo_intr_0_bind_error_pending_f(void)
154{
155 return 0x1;
156}
157static inline u32 fifo_intr_0_bind_error_reset_f(void)
158{
159 return 0x1;
160}
161static inline u32 fifo_intr_0_sched_error_pending_f(void)
162{
163 return 0x100;
164}
165static inline u32 fifo_intr_0_sched_error_reset_f(void)
166{
167 return 0x100;
168}
169static inline u32 fifo_intr_0_chsw_error_pending_f(void)
170{
171 return 0x10000;
172}
173static inline u32 fifo_intr_0_chsw_error_reset_f(void)
174{
175 return 0x10000;
176}
177static inline u32 fifo_intr_0_fb_flush_timeout_pending_f(void)
178{
179 return 0x800000;
180}
181static inline u32 fifo_intr_0_fb_flush_timeout_reset_f(void)
182{
183 return 0x800000;
184}
185static inline u32 fifo_intr_0_lb_error_pending_f(void)
186{
187 return 0x1000000;
188}
189static inline u32 fifo_intr_0_lb_error_reset_f(void)
190{
191 return 0x1000000;
192}
193static inline u32 fifo_intr_0_replayable_fault_error_pending_f(void)
194{
195 return 0x2000000;
196}
197static inline u32 fifo_intr_0_dropped_mmu_fault_pending_f(void)
198{
199 return 0x8000000;
200}
201static inline u32 fifo_intr_0_dropped_mmu_fault_reset_f(void)
202{
203 return 0x8000000;
204}
205static inline u32 fifo_intr_0_mmu_fault_pending_f(void)
206{
207 return 0x10000000;
208}
209static inline u32 fifo_intr_0_pbdma_intr_pending_f(void)
210{
211 return 0x20000000;
212}
213static inline u32 fifo_intr_0_runlist_event_pending_f(void)
214{
215 return 0x40000000;
216}
217static inline u32 fifo_intr_0_channel_intr_pending_f(void)
218{
219 return 0x80000000;
220}
221static inline u32 fifo_intr_en_0_r(void)
222{
223 return 0x00002140;
224}
225static inline u32 fifo_intr_en_0_sched_error_f(u32 v)
226{
227 return (v & 0x1) << 8;
228}
229static inline u32 fifo_intr_en_0_sched_error_m(void)
230{
231 return 0x1 << 8;
232}
233static inline u32 fifo_intr_en_0_mmu_fault_f(u32 v)
234{
235 return (v & 0x1) << 28;
236}
237static inline u32 fifo_intr_en_0_mmu_fault_m(void)
238{
239 return 0x1 << 28;
240}
241static inline u32 fifo_intr_en_1_r(void)
242{
243 return 0x00002528;
244}
245static inline u32 fifo_intr_bind_error_r(void)
246{
247 return 0x0000252c;
248}
249static inline u32 fifo_intr_sched_error_r(void)
250{
251 return 0x0000254c;
252}
253static inline u32 fifo_intr_sched_error_code_f(u32 v)
254{
255 return (v & 0xff) << 0;
256}
257static inline u32 fifo_intr_sched_error_code_ctxsw_timeout_v(void)
258{
259 return 0x0000000a;
260}
261static inline u32 fifo_intr_chsw_error_r(void)
262{
263 return 0x0000256c;
264}
265static inline u32 fifo_intr_mmu_fault_id_r(void)
266{
267 return 0x0000259c;
268}
269static inline u32 fifo_intr_mmu_fault_eng_id_graphics_v(void)
270{
271 return 0x00000000;
272}
273static inline u32 fifo_intr_mmu_fault_eng_id_graphics_f(void)
274{
275 return 0x0;
276}
277static inline u32 fifo_intr_mmu_fault_inst_r(u32 i)
278{
279 return 0x00002800 + i*16;
280}
281static inline u32 fifo_intr_mmu_fault_inst_ptr_v(u32 r)
282{
283 return (r >> 0) & 0xfffffff;
284}
285static inline u32 fifo_intr_mmu_fault_inst_ptr_align_shift_v(void)
286{
287 return 0x0000000c;
288}
289static inline u32 fifo_intr_mmu_fault_lo_r(u32 i)
290{
291 return 0x00002804 + i*16;
292}
293static inline u32 fifo_intr_mmu_fault_hi_r(u32 i)
294{
295 return 0x00002808 + i*16;
296}
297static inline u32 fifo_intr_mmu_fault_info_r(u32 i)
298{
299 return 0x0000280c + i*16;
300}
301static inline u32 fifo_intr_mmu_fault_info_type_v(u32 r)
302{
303 return (r >> 0) & 0x1f;
304}
305static inline u32 fifo_intr_mmu_fault_info_client_type_v(u32 r)
306{
307 return (r >> 20) & 0x1;
308}
309static inline u32 fifo_intr_mmu_fault_info_client_type_gpc_v(void)
310{
311 return 0x00000000;
312}
313static inline u32 fifo_intr_mmu_fault_info_client_type_hub_v(void)
314{
315 return 0x00000001;
316}
317static inline u32 fifo_intr_mmu_fault_info_client_v(u32 r)
318{
319 return (r >> 8) & 0x7f;
320}
321static inline u32 fifo_intr_pbdma_id_r(void)
322{
323 return 0x000025a0;
324}
325static inline u32 fifo_intr_pbdma_id_status_f(u32 v, u32 i)
326{
327 return (v & 0x1) << (0 + i*1);
328}
329static inline u32 fifo_intr_pbdma_id_status__size_1_v(void)
330{
331 return 0x00000004;
332}
333static inline u32 fifo_intr_runlist_r(void)
334{
335 return 0x00002a00;
336}
337static inline u32 fifo_fb_timeout_r(void)
338{
339 return 0x00002a04;
340}
341static inline u32 fifo_fb_timeout_period_m(void)
342{
343 return 0x3fffffff << 0;
344}
345static inline u32 fifo_fb_timeout_period_max_f(void)
346{
347 return 0x3fffffff;
348}
349static inline u32 fifo_error_sched_disable_r(void)
350{
351 return 0x0000262c;
352}
353static inline u32 fifo_sched_disable_r(void)
354{
355 return 0x00002630;
356}
357static inline u32 fifo_sched_disable_runlist_f(u32 v, u32 i)
358{
359 return (v & 0x1) << (0 + i*1);
360}
361static inline u32 fifo_sched_disable_runlist_m(u32 i)
362{
363 return 0x1 << (0 + i*1);
364}
365static inline u32 fifo_sched_disable_true_v(void)
366{
367 return 0x00000001;
368}
369static inline u32 fifo_preempt_r(void)
370{
371 return 0x00002634;
372}
373static inline u32 fifo_preempt_pending_true_f(void)
374{
375 return 0x100000;
376}
377static inline u32 fifo_preempt_type_channel_f(void)
378{
379 return 0x0;
380}
381static inline u32 fifo_preempt_type_tsg_f(void)
382{
383 return 0x1000000;
384}
385static inline u32 fifo_preempt_chid_f(u32 v)
386{
387 return (v & 0xfff) << 0;
388}
389static inline u32 fifo_preempt_id_f(u32 v)
390{
391 return (v & 0xfff) << 0;
392}
393static inline u32 fifo_trigger_mmu_fault_r(u32 i)
394{
395 return 0x00002a30 + i*4;
396}
397static inline u32 fifo_trigger_mmu_fault_id_f(u32 v)
398{
399 return (v & 0x1f) << 0;
400}
401static inline u32 fifo_trigger_mmu_fault_enable_f(u32 v)
402{
403 return (v & 0x1) << 8;
404}
405static inline u32 fifo_engine_status_r(u32 i)
406{
407 return 0x00002640 + i*8;
408}
409static inline u32 fifo_engine_status__size_1_v(void)
410{
411 return 0x00000009;
412}
413static inline u32 fifo_engine_status_id_v(u32 r)
414{
415 return (r >> 0) & 0xfff;
416}
417static inline u32 fifo_engine_status_id_type_v(u32 r)
418{
419 return (r >> 12) & 0x1;
420}
421static inline u32 fifo_engine_status_id_type_chid_v(void)
422{
423 return 0x00000000;
424}
425static inline u32 fifo_engine_status_id_type_tsgid_v(void)
426{
427 return 0x00000001;
428}
429static inline u32 fifo_engine_status_ctx_status_v(u32 r)
430{
431 return (r >> 13) & 0x7;
432}
433static inline u32 fifo_engine_status_ctx_status_invalid_v(void)
434{
435 return 0x00000000;
436}
437static inline u32 fifo_engine_status_ctx_status_valid_v(void)
438{
439 return 0x00000001;
440}
441static inline u32 fifo_engine_status_ctx_status_ctxsw_load_v(void)
442{
443 return 0x00000005;
444}
445static inline u32 fifo_engine_status_ctx_status_ctxsw_save_v(void)
446{
447 return 0x00000006;
448}
449static inline u32 fifo_engine_status_ctx_status_ctxsw_switch_v(void)
450{
451 return 0x00000007;
452}
453static inline u32 fifo_engine_status_next_id_v(u32 r)
454{
455 return (r >> 16) & 0xfff;
456}
457static inline u32 fifo_engine_status_next_id_type_v(u32 r)
458{
459 return (r >> 28) & 0x1;
460}
461static inline u32 fifo_engine_status_next_id_type_chid_v(void)
462{
463 return 0x00000000;
464}
465static inline u32 fifo_engine_status_faulted_v(u32 r)
466{
467 return (r >> 30) & 0x1;
468}
469static inline u32 fifo_engine_status_faulted_true_v(void)
470{
471 return 0x00000001;
472}
473static inline u32 fifo_engine_status_engine_v(u32 r)
474{
475 return (r >> 31) & 0x1;
476}
477static inline u32 fifo_engine_status_engine_idle_v(void)
478{
479 return 0x00000000;
480}
481static inline u32 fifo_engine_status_engine_busy_v(void)
482{
483 return 0x00000001;
484}
485static inline u32 fifo_engine_status_ctxsw_v(u32 r)
486{
487 return (r >> 15) & 0x1;
488}
489static inline u32 fifo_engine_status_ctxsw_in_progress_v(void)
490{
491 return 0x00000001;
492}
493static inline u32 fifo_engine_status_ctxsw_in_progress_f(void)
494{
495 return 0x8000;
496}
497static inline u32 fifo_pbdma_status_r(u32 i)
498{
499 return 0x00003080 + i*4;
500}
501static inline u32 fifo_pbdma_status__size_1_v(void)
502{
503 return 0x00000004;
504}
505static inline u32 fifo_pbdma_status_id_v(u32 r)
506{
507 return (r >> 0) & 0xfff;
508}
509static inline u32 fifo_pbdma_status_id_type_v(u32 r)
510{
511 return (r >> 12) & 0x1;
512}
513static inline u32 fifo_pbdma_status_id_type_chid_v(void)
514{
515 return 0x00000000;
516}
517static inline u32 fifo_pbdma_status_id_type_tsgid_v(void)
518{
519 return 0x00000001;
520}
521static inline u32 fifo_pbdma_status_chan_status_v(u32 r)
522{
523 return (r >> 13) & 0x7;
524}
525static inline u32 fifo_pbdma_status_chan_status_valid_v(void)
526{
527 return 0x00000001;
528}
529static inline u32 fifo_pbdma_status_chan_status_chsw_load_v(void)
530{
531 return 0x00000005;
532}
533static inline u32 fifo_pbdma_status_chan_status_chsw_save_v(void)
534{
535 return 0x00000006;
536}
537static inline u32 fifo_pbdma_status_chan_status_chsw_switch_v(void)
538{
539 return 0x00000007;
540}
541static inline u32 fifo_pbdma_status_next_id_v(u32 r)
542{
543 return (r >> 16) & 0xfff;
544}
545static inline u32 fifo_pbdma_status_next_id_type_v(u32 r)
546{
547 return (r >> 28) & 0x1;
548}
549static inline u32 fifo_pbdma_status_next_id_type_chid_v(void)
550{
551 return 0x00000000;
552}
553static inline u32 fifo_pbdma_status_chsw_v(u32 r)
554{
555 return (r >> 15) & 0x1;
556}
557static inline u32 fifo_pbdma_status_chsw_in_progress_v(void)
558{
559 return 0x00000001;
560}
561static inline u32 fifo_replay_fault_buffer_lo_r(void)
562{
563 return 0x00002a70;
564}
565static inline u32 fifo_replay_fault_buffer_lo_enable_v(u32 r)
566{
567 return (r >> 0) & 0x1;
568}
569static inline u32 fifo_replay_fault_buffer_lo_enable_true_v(void)
570{
571 return 0x00000001;
572}
573static inline u32 fifo_replay_fault_buffer_lo_enable_false_v(void)
574{
575 return 0x00000000;
576}
577static inline u32 fifo_replay_fault_buffer_lo_base_f(u32 v)
578{
579 return (v & 0xfffff) << 12;
580}
581static inline u32 fifo_replay_fault_buffer_lo_base_reset_v(void)
582{
583 return 0x00000000;
584}
585static inline u32 fifo_replay_fault_buffer_hi_r(void)
586{
587 return 0x00002a74;
588}
589static inline u32 fifo_replay_fault_buffer_hi_base_f(u32 v)
590{
591 return (v & 0xff) << 0;
592}
593static inline u32 fifo_replay_fault_buffer_hi_base_reset_v(void)
594{
595 return 0x00000000;
596}
597static inline u32 fifo_replay_fault_buffer_size_r(void)
598{
599 return 0x00002a78;
600}
601static inline u32 fifo_replay_fault_buffer_size_hw_f(u32 v)
602{
603 return (v & 0x3fff) << 0;
604}
605static inline u32 fifo_replay_fault_buffer_size_hw_entries_v(void)
606{
607 return 0x00001200;
608}
609static inline u32 fifo_replay_fault_buffer_get_r(void)
610{
611 return 0x00002a7c;
612}
613static inline u32 fifo_replay_fault_buffer_get_offset_hw_f(u32 v)
614{
615 return (v & 0x3fff) << 0;
616}
617static inline u32 fifo_replay_fault_buffer_get_offset_hw_init_v(void)
618{
619 return 0x00000000;
620}
621static inline u32 fifo_replay_fault_buffer_put_r(void)
622{
623 return 0x00002a80;
624}
625static inline u32 fifo_replay_fault_buffer_put_offset_hw_f(u32 v)
626{
627 return (v & 0x3fff) << 0;
628}
629static inline u32 fifo_replay_fault_buffer_put_offset_hw_init_v(void)
630{
631 return 0x00000000;
632}
633static inline u32 fifo_replay_fault_buffer_info_r(void)
634{
635 return 0x00002a84;
636}
637static inline u32 fifo_replay_fault_buffer_info_overflow_f(u32 v)
638{
639 return (v & 0x1) << 0;
640}
641static inline u32 fifo_replay_fault_buffer_info_overflow_false_v(void)
642{
643 return 0x00000000;
644}
645static inline u32 fifo_replay_fault_buffer_info_overflow_true_v(void)
646{
647 return 0x00000001;
648}
649static inline u32 fifo_replay_fault_buffer_info_overflow_clear_v(void)
650{
651 return 0x00000001;
652}
653static inline u32 fifo_replay_fault_buffer_info_write_nack_f(u32 v)
654{
655 return (v & 0x1) << 24;
656}
657static inline u32 fifo_replay_fault_buffer_info_write_nack_false_v(void)
658{
659 return 0x00000000;
660}
661static inline u32 fifo_replay_fault_buffer_info_write_nack_true_v(void)
662{
663 return 0x00000001;
664}
665static inline u32 fifo_replay_fault_buffer_info_write_nack_clear_v(void)
666{
667 return 0x00000001;
668}
669static inline u32 fifo_replay_fault_buffer_info_fault_while_buffer_disabled_f(u32 v)
670{
671 return (v & 0x1) << 28;
672}
673static inline u32 fifo_replay_fault_buffer_info_fault_while_buffer_disabled_false_v(void)
674{
675 return 0x00000000;
676}
677static inline u32 fifo_replay_fault_buffer_info_fault_while_buffer_disabled_true_v(void)
678{
679 return 0x00000001;
680}
681static inline u32 fifo_replay_fault_buffer_info_fault_while_buffer_disabled_clear_v(void)
682{
683 return 0x00000001;
684}
685#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_flush_gp106.h b/drivers/gpu/nvgpu/gp106/hw_flush_gp106.h
new file mode 100644
index 00000000..83bd65bb
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_flush_gp106.h
@@ -0,0 +1,181 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_flush_gp106_h_
51#define _hw_flush_gp106_h_
52
53static inline u32 flush_l2_system_invalidate_r(void)
54{
55 return 0x00070004;
56}
57static inline u32 flush_l2_system_invalidate_pending_v(u32 r)
58{
59 return (r >> 0) & 0x1;
60}
61static inline u32 flush_l2_system_invalidate_pending_busy_v(void)
62{
63 return 0x00000001;
64}
65static inline u32 flush_l2_system_invalidate_pending_busy_f(void)
66{
67 return 0x1;
68}
69static inline u32 flush_l2_system_invalidate_outstanding_v(u32 r)
70{
71 return (r >> 1) & 0x1;
72}
73static inline u32 flush_l2_system_invalidate_outstanding_true_v(void)
74{
75 return 0x00000001;
76}
77static inline u32 flush_l2_flush_dirty_r(void)
78{
79 return 0x00070010;
80}
81static inline u32 flush_l2_flush_dirty_pending_v(u32 r)
82{
83 return (r >> 0) & 0x1;
84}
85static inline u32 flush_l2_flush_dirty_pending_empty_v(void)
86{
87 return 0x00000000;
88}
89static inline u32 flush_l2_flush_dirty_pending_empty_f(void)
90{
91 return 0x0;
92}
93static inline u32 flush_l2_flush_dirty_pending_busy_v(void)
94{
95 return 0x00000001;
96}
97static inline u32 flush_l2_flush_dirty_pending_busy_f(void)
98{
99 return 0x1;
100}
101static inline u32 flush_l2_flush_dirty_outstanding_v(u32 r)
102{
103 return (r >> 1) & 0x1;
104}
105static inline u32 flush_l2_flush_dirty_outstanding_false_v(void)
106{
107 return 0x00000000;
108}
109static inline u32 flush_l2_flush_dirty_outstanding_false_f(void)
110{
111 return 0x0;
112}
113static inline u32 flush_l2_flush_dirty_outstanding_true_v(void)
114{
115 return 0x00000001;
116}
117static inline u32 flush_l2_clean_comptags_r(void)
118{
119 return 0x0007000c;
120}
121static inline u32 flush_l2_clean_comptags_pending_v(u32 r)
122{
123 return (r >> 0) & 0x1;
124}
125static inline u32 flush_l2_clean_comptags_pending_empty_v(void)
126{
127 return 0x00000000;
128}
129static inline u32 flush_l2_clean_comptags_pending_empty_f(void)
130{
131 return 0x0;
132}
133static inline u32 flush_l2_clean_comptags_pending_busy_v(void)
134{
135 return 0x00000001;
136}
137static inline u32 flush_l2_clean_comptags_pending_busy_f(void)
138{
139 return 0x1;
140}
141static inline u32 flush_l2_clean_comptags_outstanding_v(u32 r)
142{
143 return (r >> 1) & 0x1;
144}
145static inline u32 flush_l2_clean_comptags_outstanding_false_v(void)
146{
147 return 0x00000000;
148}
149static inline u32 flush_l2_clean_comptags_outstanding_false_f(void)
150{
151 return 0x0;
152}
153static inline u32 flush_l2_clean_comptags_outstanding_true_v(void)
154{
155 return 0x00000001;
156}
157static inline u32 flush_fb_flush_r(void)
158{
159 return 0x00070000;
160}
161static inline u32 flush_fb_flush_pending_v(u32 r)
162{
163 return (r >> 0) & 0x1;
164}
165static inline u32 flush_fb_flush_pending_busy_v(void)
166{
167 return 0x00000001;
168}
169static inline u32 flush_fb_flush_pending_busy_f(void)
170{
171 return 0x1;
172}
173static inline u32 flush_fb_flush_outstanding_v(u32 r)
174{
175 return (r >> 1) & 0x1;
176}
177static inline u32 flush_fb_flush_outstanding_true_v(void)
178{
179 return 0x00000001;
180}
181#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_fuse_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fuse_gp106.h
new file mode 100644
index 00000000..32d8a4f2
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_fuse_gp106.h
@@ -0,0 +1,217 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_fuse_gp106_h_
51#define _hw_fuse_gp106_h_
52
53static inline u32 fuse_status_opt_tpc_gpc_r(u32 i)
54{
55 return 0x00021c38 + i*4;
56}
57static inline u32 fuse_ctrl_opt_tpc_gpc_r(u32 i)
58{
59 return 0x00021838 + i*4;
60}
61static inline u32 fuse_ctrl_opt_ram_svop_pdp_r(void)
62{
63 return 0x00021944;
64}
65static inline u32 fuse_ctrl_opt_ram_svop_pdp_data_f(u32 v)
66{
67 return (v & 0x3) << 0;
68}
69static inline u32 fuse_ctrl_opt_ram_svop_pdp_data_m(void)
70{
71 return 0x3 << 0;
72}
73static inline u32 fuse_ctrl_opt_ram_svop_pdp_data_v(u32 r)
74{
75 return (r >> 0) & 0x3;
76}
77static inline u32 fuse_ctrl_opt_ram_svop_pdp_override_r(void)
78{
79 return 0x00021948;
80}
81static inline u32 fuse_ctrl_opt_ram_svop_pdp_override_data_f(u32 v)
82{
83 return (v & 0x1) << 0;
84}
85static inline u32 fuse_ctrl_opt_ram_svop_pdp_override_data_m(void)
86{
87 return 0x1 << 0;
88}
89static inline u32 fuse_ctrl_opt_ram_svop_pdp_override_data_v(u32 r)
90{
91 return (r >> 0) & 0x1;
92}
93static inline u32 fuse_ctrl_opt_ram_svop_pdp_override_data_yes_f(void)
94{
95 return 0x1;
96}
97static inline u32 fuse_ctrl_opt_ram_svop_pdp_override_data_no_f(void)
98{
99 return 0x0;
100}
101static inline u32 fuse_status_opt_fbio_r(void)
102{
103 return 0x00021c14;
104}
105static inline u32 fuse_status_opt_fbio_data_f(u32 v)
106{
107 return (v & 0xffff) << 0;
108}
109static inline u32 fuse_status_opt_fbio_data_m(void)
110{
111 return 0xffff << 0;
112}
113static inline u32 fuse_status_opt_fbio_data_v(u32 r)
114{
115 return (r >> 0) & 0xffff;
116}
117static inline u32 fuse_status_opt_rop_l2_fbp_r(u32 i)
118{
119 return 0x00021d70 + i*4;
120}
121static inline u32 fuse_status_opt_fbp_r(void)
122{
123 return 0x00021d38;
124}
125static inline u32 fuse_status_opt_fbp_idx_v(u32 r, u32 i)
126{
127 return (r >> (0 + i*0)) & 0x1;
128}
129static inline u32 fuse_vin_cal_fuse_rev_r(void)
130{
131 return 0x0002164c;
132}
133static inline u32 fuse_vin_cal_fuse_rev_v(u32 r)
134{
135 return 0x3 & r;
136}
137static inline u32 fuse_vin_cal_gpc0_r(void)
138{
139 return 0x00021650;
140}
141static inline u32 fuse_vin_cal_gpc0_icpt_data_v(u32 r)
142{
143 return ((r & 0xFFFC000) >> 14);
144}
145static inline u32 fuse_vin_cal_gpc0_icpt_frac_size_v(void)
146{
147 return 2;
148}
149static inline u32 fuse_vin_cal_gpc0_slope_data_v(u32 r)
150{
151 return (r & 0x3FFF);
152}
153static inline u32 fuse_vin_cal_gpc0_slope_frac_size_v(void)
154{
155 return 10;
156}
157static inline u32 fuse_vin_cal_gpc1_delta_r(void)
158{
159 return 0x00021654;
160}
161static inline u32 fuse_vin_cal_gpc1_icpt_sign_f(void)
162{
163 return 0x400000;
164}
165static inline u32 fuse_vin_cal_gpc1_slope_sign_f(void)
166{
167 return 0x800;
168}
169static inline u32 fuse_vin_cal_gpc1_icpt_data_v(u32 r)
170{
171 return ((r & 0x3FF000) >> 12);
172}
173static inline u32 fuse_vin_cal_gpc1_icpt_frac_size_v(void)
174{
175 return 2;
176}
177static inline u32 fuse_vin_cal_gpc1_slope_data_v(u32 r)
178{
179 return (r & 0x7FF);
180}
181static inline u32 fuse_vin_cal_gpc1_slope_frac_size_v(void)
182{
183 return 10;
184}
185static inline u32 fuse_vin_cal_gpc2_delta_r(void)
186{
187 return 0x00021658;
188}
189static inline u32 fuse_vin_cal_gpc3_delta_r(void)
190{
191 return 0x0002165c;
192}
193static inline u32 fuse_vin_cal_gpc4_delta_r(void)
194{
195 return 0x00021660;
196}
197static inline u32 fuse_vin_cal_gpc5_delta_r(void)
198{
199 return 0x00021664;
200}
201static inline u32 fuse_vin_cal_shared_delta_r(void)
202{
203 return 0x00021668;
204}
205static inline u32 fuse_vin_cal_sram_delta_r(void)
206{
207 return 0x0002166c;
208}
209static inline u32 fuse_vin_cal_sram_icpt_data_v(u32 r)
210{
211 return ((r & 0x3FF000) >> 12);
212}
213static inline u32 fuse_vin_cal_sram_icpt_frac_size_v(void)
214{
215 return 1;
216}
217#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_gc6_gp106.h b/drivers/gpu/nvgpu/gp106/hw_gc6_gp106.h
new file mode 100644
index 00000000..25aca9b5
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_gc6_gp106.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_gc6_gp106_h_
51#define _hw_gc6_gp106_h_
52static inline u32 gc6_sci_strap_r(void)
53{
54 return 0x00010ebb0;
55}
56#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_gmmu_gp106.h b/drivers/gpu/nvgpu/gp106/hw_gmmu_gp106.h
new file mode 100644
index 00000000..96ab77df
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_gmmu_gp106.h
@@ -0,0 +1,1261 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_gmmu_gp106_h_
51#define _hw_gmmu_gp106_h_
52
53static inline u32 gmmu_new_pde_is_pte_w(void)
54{
55 return 0;
56}
57static inline u32 gmmu_new_pde_is_pte_false_f(void)
58{
59 return 0x0;
60}
61static inline u32 gmmu_new_pde_aperture_w(void)
62{
63 return 0;
64}
65static inline u32 gmmu_new_pde_aperture_invalid_f(void)
66{
67 return 0x0;
68}
69static inline u32 gmmu_new_pde_aperture_video_memory_f(void)
70{
71 return 0x2;
72}
73static inline u32 gmmu_new_pde_aperture_sys_mem_coh_f(void)
74{
75 return 0x4;
76}
77static inline u32 gmmu_new_pde_aperture_sys_mem_ncoh_f(void)
78{
79 return 0x6;
80}
81static inline u32 gmmu_new_pde_address_sys_f(u32 v)
82{
83 return (v & 0xffffff) << 8;
84}
85static inline u32 gmmu_new_pde_address_sys_w(void)
86{
87 return 0;
88}
89static inline u32 gmmu_new_pde_vol_w(void)
90{
91 return 0;
92}
93static inline u32 gmmu_new_pde_vol_true_f(void)
94{
95 return 0x8;
96}
97static inline u32 gmmu_new_pde_vol_false_f(void)
98{
99 return 0x0;
100}
101static inline u32 gmmu_new_pde_address_shift_v(void)
102{
103 return 0x0000000c;
104}
105static inline u32 gmmu_new_pde__size_v(void)
106{
107 return 0x00000008;
108}
109static inline u32 gmmu_new_dual_pde_is_pte_w(void)
110{
111 return 0;
112}
113static inline u32 gmmu_new_dual_pde_is_pte_false_f(void)
114{
115 return 0x0;
116}
117static inline u32 gmmu_new_dual_pde_aperture_big_w(void)
118{
119 return 0;
120}
121static inline u32 gmmu_new_dual_pde_aperture_big_invalid_f(void)
122{
123 return 0x0;
124}
125static inline u32 gmmu_new_dual_pde_aperture_big_video_memory_f(void)
126{
127 return 0x2;
128}
129static inline u32 gmmu_new_dual_pde_aperture_big_sys_mem_coh_f(void)
130{
131 return 0x4;
132}
133static inline u32 gmmu_new_dual_pde_aperture_big_sys_mem_ncoh_f(void)
134{
135 return 0x6;
136}
137static inline u32 gmmu_new_dual_pde_address_big_sys_f(u32 v)
138{
139 return (v & 0xfffffff) << 4;
140}
141static inline u32 gmmu_new_dual_pde_address_big_sys_w(void)
142{
143 return 0;
144}
145static inline u32 gmmu_new_dual_pde_aperture_small_w(void)
146{
147 return 2;
148}
149static inline u32 gmmu_new_dual_pde_aperture_small_invalid_f(void)
150{
151 return 0x0;
152}
153static inline u32 gmmu_new_dual_pde_aperture_small_video_memory_f(void)
154{
155 return 0x2;
156}
157static inline u32 gmmu_new_dual_pde_aperture_small_sys_mem_coh_f(void)
158{
159 return 0x4;
160}
161static inline u32 gmmu_new_dual_pde_aperture_small_sys_mem_ncoh_f(void)
162{
163 return 0x6;
164}
165static inline u32 gmmu_new_dual_pde_vol_small_w(void)
166{
167 return 2;
168}
169static inline u32 gmmu_new_dual_pde_vol_small_true_f(void)
170{
171 return 0x8;
172}
173static inline u32 gmmu_new_dual_pde_vol_small_false_f(void)
174{
175 return 0x0;
176}
177static inline u32 gmmu_new_dual_pde_vol_big_w(void)
178{
179 return 0;
180}
181static inline u32 gmmu_new_dual_pde_vol_big_true_f(void)
182{
183 return 0x8;
184}
185static inline u32 gmmu_new_dual_pde_vol_big_false_f(void)
186{
187 return 0x0;
188}
189static inline u32 gmmu_new_dual_pde_address_small_sys_f(u32 v)
190{
191 return (v & 0xffffff) << 8;
192}
193static inline u32 gmmu_new_dual_pde_address_small_sys_w(void)
194{
195 return 2;
196}
197static inline u32 gmmu_new_dual_pde_address_shift_v(void)
198{
199 return 0x0000000c;
200}
201static inline u32 gmmu_new_dual_pde_address_big_shift_v(void)
202{
203 return 0x00000008;
204}
205static inline u32 gmmu_new_dual_pde__size_v(void)
206{
207 return 0x00000010;
208}
209static inline u32 gmmu_new_pte__size_v(void)
210{
211 return 0x00000008;
212}
213static inline u32 gmmu_new_pte_valid_w(void)
214{
215 return 0;
216}
217static inline u32 gmmu_new_pte_valid_true_f(void)
218{
219 return 0x1;
220}
221static inline u32 gmmu_new_pte_valid_false_f(void)
222{
223 return 0x0;
224}
225static inline u32 gmmu_new_pte_privilege_w(void)
226{
227 return 0;
228}
229static inline u32 gmmu_new_pte_privilege_true_f(void)
230{
231 return 0x20;
232}
233static inline u32 gmmu_new_pte_privilege_false_f(void)
234{
235 return 0x0;
236}
237static inline u32 gmmu_new_pte_address_sys_f(u32 v)
238{
239 return (v & 0xffffff) << 8;
240}
241static inline u32 gmmu_new_pte_address_sys_w(void)
242{
243 return 0;
244}
245static inline u32 gmmu_new_pte_vol_w(void)
246{
247 return 0;
248}
249static inline u32 gmmu_new_pte_vol_true_f(void)
250{
251 return 0x8;
252}
253static inline u32 gmmu_new_pte_vol_false_f(void)
254{
255 return 0x0;
256}
257static inline u32 gmmu_new_pte_aperture_w(void)
258{
259 return 0;
260}
261static inline u32 gmmu_new_pte_aperture_video_memory_f(void)
262{
263 return 0x0;
264}
265static inline u32 gmmu_new_pte_aperture_sys_mem_coh_f(void)
266{
267 return 0x4;
268}
269static inline u32 gmmu_new_pte_aperture_sys_mem_ncoh_f(void)
270{
271 return 0x6;
272}
273static inline u32 gmmu_new_pte_read_only_w(void)
274{
275 return 0;
276}
277static inline u32 gmmu_new_pte_read_only_true_f(void)
278{
279 return 0x40;
280}
281static inline u32 gmmu_new_pte_comptagline_f(u32 v)
282{
283 return (v & 0x3ffff) << 4;
284}
285static inline u32 gmmu_new_pte_comptagline_w(void)
286{
287 return 1;
288}
289static inline u32 gmmu_new_pte_kind_f(u32 v)
290{
291 return (v & 0xff) << 24;
292}
293static inline u32 gmmu_new_pte_kind_w(void)
294{
295 return 1;
296}
297static inline u32 gmmu_new_pte_address_shift_v(void)
298{
299 return 0x0000000c;
300}
301static inline u32 gmmu_pte_kind_f(u32 v)
302{
303 return (v & 0xff) << 4;
304}
305static inline u32 gmmu_pte_kind_w(void)
306{
307 return 1;
308}
309static inline u32 gmmu_pte_kind_invalid_v(void)
310{
311 return 0x000000ff;
312}
313static inline u32 gmmu_pte_kind_pitch_v(void)
314{
315 return 0x00000000;
316}
317static inline u32 gmmu_pte_kind_z16_v(void)
318{
319 return 0x00000001;
320}
321static inline u32 gmmu_pte_kind_z16_2c_v(void)
322{
323 return 0x00000002;
324}
325static inline u32 gmmu_pte_kind_z16_ms2_2c_v(void)
326{
327 return 0x00000003;
328}
329static inline u32 gmmu_pte_kind_z16_ms4_2c_v(void)
330{
331 return 0x00000004;
332}
333static inline u32 gmmu_pte_kind_z16_ms8_2c_v(void)
334{
335 return 0x00000005;
336}
337static inline u32 gmmu_pte_kind_z16_ms16_2c_v(void)
338{
339 return 0x00000006;
340}
341static inline u32 gmmu_pte_kind_z16_2z_v(void)
342{
343 return 0x00000007;
344}
345static inline u32 gmmu_pte_kind_z16_ms2_2z_v(void)
346{
347 return 0x00000008;
348}
349static inline u32 gmmu_pte_kind_z16_ms4_2z_v(void)
350{
351 return 0x00000009;
352}
353static inline u32 gmmu_pte_kind_z16_ms8_2z_v(void)
354{
355 return 0x0000000a;
356}
357static inline u32 gmmu_pte_kind_z16_ms16_2z_v(void)
358{
359 return 0x0000000b;
360}
361static inline u32 gmmu_pte_kind_z16_2cz_v(void)
362{
363 return 0x00000036;
364}
365static inline u32 gmmu_pte_kind_z16_ms2_2cz_v(void)
366{
367 return 0x00000037;
368}
369static inline u32 gmmu_pte_kind_z16_ms4_2cz_v(void)
370{
371 return 0x00000038;
372}
373static inline u32 gmmu_pte_kind_z16_ms8_2cz_v(void)
374{
375 return 0x00000039;
376}
377static inline u32 gmmu_pte_kind_z16_ms16_2cz_v(void)
378{
379 return 0x0000005f;
380}
381static inline u32 gmmu_pte_kind_z16_4cz_v(void)
382{
383 return 0x0000000c;
384}
385static inline u32 gmmu_pte_kind_z16_ms2_4cz_v(void)
386{
387 return 0x0000000d;
388}
389static inline u32 gmmu_pte_kind_z16_ms4_4cz_v(void)
390{
391 return 0x0000000e;
392}
393static inline u32 gmmu_pte_kind_z16_ms8_4cz_v(void)
394{
395 return 0x0000000f;
396}
397static inline u32 gmmu_pte_kind_z16_ms16_4cz_v(void)
398{
399 return 0x00000010;
400}
401static inline u32 gmmu_pte_kind_s8z24_v(void)
402{
403 return 0x00000011;
404}
405static inline u32 gmmu_pte_kind_s8z24_1z_v(void)
406{
407 return 0x00000012;
408}
409static inline u32 gmmu_pte_kind_s8z24_ms2_1z_v(void)
410{
411 return 0x00000013;
412}
413static inline u32 gmmu_pte_kind_s8z24_ms4_1z_v(void)
414{
415 return 0x00000014;
416}
417static inline u32 gmmu_pte_kind_s8z24_ms8_1z_v(void)
418{
419 return 0x00000015;
420}
421static inline u32 gmmu_pte_kind_s8z24_ms16_1z_v(void)
422{
423 return 0x00000016;
424}
425static inline u32 gmmu_pte_kind_s8z24_2cz_v(void)
426{
427 return 0x00000017;
428}
429static inline u32 gmmu_pte_kind_s8z24_ms2_2cz_v(void)
430{
431 return 0x00000018;
432}
433static inline u32 gmmu_pte_kind_s8z24_ms4_2cz_v(void)
434{
435 return 0x00000019;
436}
437static inline u32 gmmu_pte_kind_s8z24_ms8_2cz_v(void)
438{
439 return 0x0000001a;
440}
441static inline u32 gmmu_pte_kind_s8z24_ms16_2cz_v(void)
442{
443 return 0x0000001b;
444}
445static inline u32 gmmu_pte_kind_s8z24_2cs_v(void)
446{
447 return 0x0000001c;
448}
449static inline u32 gmmu_pte_kind_s8z24_ms2_2cs_v(void)
450{
451 return 0x0000001d;
452}
453static inline u32 gmmu_pte_kind_s8z24_ms4_2cs_v(void)
454{
455 return 0x0000001e;
456}
457static inline u32 gmmu_pte_kind_s8z24_ms8_2cs_v(void)
458{
459 return 0x0000001f;
460}
461static inline u32 gmmu_pte_kind_s8z24_ms16_2cs_v(void)
462{
463 return 0x00000020;
464}
465static inline u32 gmmu_pte_kind_s8z24_4cszv_v(void)
466{
467 return 0x00000021;
468}
469static inline u32 gmmu_pte_kind_s8z24_ms2_4cszv_v(void)
470{
471 return 0x00000022;
472}
473static inline u32 gmmu_pte_kind_s8z24_ms4_4cszv_v(void)
474{
475 return 0x00000023;
476}
477static inline u32 gmmu_pte_kind_s8z24_ms8_4cszv_v(void)
478{
479 return 0x00000024;
480}
481static inline u32 gmmu_pte_kind_s8z24_ms16_4cszv_v(void)
482{
483 return 0x00000025;
484}
485static inline u32 gmmu_pte_kind_v8z24_ms4_vc12_v(void)
486{
487 return 0x00000026;
488}
489static inline u32 gmmu_pte_kind_v8z24_ms4_vc4_v(void)
490{
491 return 0x00000027;
492}
493static inline u32 gmmu_pte_kind_v8z24_ms8_vc8_v(void)
494{
495 return 0x00000028;
496}
497static inline u32 gmmu_pte_kind_v8z24_ms8_vc24_v(void)
498{
499 return 0x00000029;
500}
501static inline u32 gmmu_pte_kind_v8z24_ms4_vc12_1zv_v(void)
502{
503 return 0x0000002e;
504}
505static inline u32 gmmu_pte_kind_v8z24_ms4_vc4_1zv_v(void)
506{
507 return 0x0000002f;
508}
509static inline u32 gmmu_pte_kind_v8z24_ms8_vc8_1zv_v(void)
510{
511 return 0x00000030;
512}
513static inline u32 gmmu_pte_kind_v8z24_ms8_vc24_1zv_v(void)
514{
515 return 0x00000031;
516}
517static inline u32 gmmu_pte_kind_v8z24_ms4_vc12_2cs_v(void)
518{
519 return 0x00000032;
520}
521static inline u32 gmmu_pte_kind_v8z24_ms4_vc4_2cs_v(void)
522{
523 return 0x00000033;
524}
525static inline u32 gmmu_pte_kind_v8z24_ms8_vc8_2cs_v(void)
526{
527 return 0x00000034;
528}
529static inline u32 gmmu_pte_kind_v8z24_ms8_vc24_2cs_v(void)
530{
531 return 0x00000035;
532}
533static inline u32 gmmu_pte_kind_v8z24_ms4_vc12_2czv_v(void)
534{
535 return 0x0000003a;
536}
537static inline u32 gmmu_pte_kind_v8z24_ms4_vc4_2czv_v(void)
538{
539 return 0x0000003b;
540}
541static inline u32 gmmu_pte_kind_v8z24_ms8_vc8_2czv_v(void)
542{
543 return 0x0000003c;
544}
545static inline u32 gmmu_pte_kind_v8z24_ms8_vc24_2czv_v(void)
546{
547 return 0x0000003d;
548}
549static inline u32 gmmu_pte_kind_v8z24_ms4_vc12_2zv_v(void)
550{
551 return 0x0000003e;
552}
553static inline u32 gmmu_pte_kind_v8z24_ms4_vc4_2zv_v(void)
554{
555 return 0x0000003f;
556}
557static inline u32 gmmu_pte_kind_v8z24_ms8_vc8_2zv_v(void)
558{
559 return 0x00000040;
560}
561static inline u32 gmmu_pte_kind_v8z24_ms8_vc24_2zv_v(void)
562{
563 return 0x00000041;
564}
565static inline u32 gmmu_pte_kind_v8z24_ms4_vc12_4cszv_v(void)
566{
567 return 0x00000042;
568}
569static inline u32 gmmu_pte_kind_v8z24_ms4_vc4_4cszv_v(void)
570{
571 return 0x00000043;
572}
573static inline u32 gmmu_pte_kind_v8z24_ms8_vc8_4cszv_v(void)
574{
575 return 0x00000044;
576}
577static inline u32 gmmu_pte_kind_v8z24_ms8_vc24_4cszv_v(void)
578{
579 return 0x00000045;
580}
581static inline u32 gmmu_pte_kind_z24s8_v(void)
582{
583 return 0x00000046;
584}
585static inline u32 gmmu_pte_kind_z24s8_1z_v(void)
586{
587 return 0x00000047;
588}
589static inline u32 gmmu_pte_kind_z24s8_ms2_1z_v(void)
590{
591 return 0x00000048;
592}
593static inline u32 gmmu_pte_kind_z24s8_ms4_1z_v(void)
594{
595 return 0x00000049;
596}
597static inline u32 gmmu_pte_kind_z24s8_ms8_1z_v(void)
598{
599 return 0x0000004a;
600}
601static inline u32 gmmu_pte_kind_z24s8_ms16_1z_v(void)
602{
603 return 0x0000004b;
604}
605static inline u32 gmmu_pte_kind_z24s8_2cs_v(void)
606{
607 return 0x0000004c;
608}
609static inline u32 gmmu_pte_kind_z24s8_ms2_2cs_v(void)
610{
611 return 0x0000004d;
612}
613static inline u32 gmmu_pte_kind_z24s8_ms4_2cs_v(void)
614{
615 return 0x0000004e;
616}
617static inline u32 gmmu_pte_kind_z24s8_ms8_2cs_v(void)
618{
619 return 0x0000004f;
620}
621static inline u32 gmmu_pte_kind_z24s8_ms16_2cs_v(void)
622{
623 return 0x00000050;
624}
625static inline u32 gmmu_pte_kind_z24s8_2cz_v(void)
626{
627 return 0x00000051;
628}
629static inline u32 gmmu_pte_kind_z24s8_ms2_2cz_v(void)
630{
631 return 0x00000052;
632}
633static inline u32 gmmu_pte_kind_z24s8_ms4_2cz_v(void)
634{
635 return 0x00000053;
636}
637static inline u32 gmmu_pte_kind_z24s8_ms8_2cz_v(void)
638{
639 return 0x00000054;
640}
641static inline u32 gmmu_pte_kind_z24s8_ms16_2cz_v(void)
642{
643 return 0x00000055;
644}
645static inline u32 gmmu_pte_kind_z24s8_4cszv_v(void)
646{
647 return 0x00000056;
648}
649static inline u32 gmmu_pte_kind_z24s8_ms2_4cszv_v(void)
650{
651 return 0x00000057;
652}
653static inline u32 gmmu_pte_kind_z24s8_ms4_4cszv_v(void)
654{
655 return 0x00000058;
656}
657static inline u32 gmmu_pte_kind_z24s8_ms8_4cszv_v(void)
658{
659 return 0x00000059;
660}
661static inline u32 gmmu_pte_kind_z24s8_ms16_4cszv_v(void)
662{
663 return 0x0000005a;
664}
665static inline u32 gmmu_pte_kind_z24v8_ms4_vc12_v(void)
666{
667 return 0x0000005b;
668}
669static inline u32 gmmu_pte_kind_z24v8_ms4_vc4_v(void)
670{
671 return 0x0000005c;
672}
673static inline u32 gmmu_pte_kind_z24v8_ms8_vc8_v(void)
674{
675 return 0x0000005d;
676}
677static inline u32 gmmu_pte_kind_z24v8_ms8_vc24_v(void)
678{
679 return 0x0000005e;
680}
681static inline u32 gmmu_pte_kind_z24v8_ms4_vc12_1zv_v(void)
682{
683 return 0x00000063;
684}
685static inline u32 gmmu_pte_kind_z24v8_ms4_vc4_1zv_v(void)
686{
687 return 0x00000064;
688}
689static inline u32 gmmu_pte_kind_z24v8_ms8_vc8_1zv_v(void)
690{
691 return 0x00000065;
692}
693static inline u32 gmmu_pte_kind_z24v8_ms8_vc24_1zv_v(void)
694{
695 return 0x00000066;
696}
697static inline u32 gmmu_pte_kind_z24v8_ms4_vc12_2cs_v(void)
698{
699 return 0x00000067;
700}
701static inline u32 gmmu_pte_kind_z24v8_ms4_vc4_2cs_v(void)
702{
703 return 0x00000068;
704}
705static inline u32 gmmu_pte_kind_z24v8_ms8_vc8_2cs_v(void)
706{
707 return 0x00000069;
708}
709static inline u32 gmmu_pte_kind_z24v8_ms8_vc24_2cs_v(void)
710{
711 return 0x0000006a;
712}
713static inline u32 gmmu_pte_kind_z24v8_ms4_vc12_2czv_v(void)
714{
715 return 0x0000006f;
716}
717static inline u32 gmmu_pte_kind_z24v8_ms4_vc4_2czv_v(void)
718{
719 return 0x00000070;
720}
721static inline u32 gmmu_pte_kind_z24v8_ms8_vc8_2czv_v(void)
722{
723 return 0x00000071;
724}
725static inline u32 gmmu_pte_kind_z24v8_ms8_vc24_2czv_v(void)
726{
727 return 0x00000072;
728}
729static inline u32 gmmu_pte_kind_z24v8_ms4_vc12_2zv_v(void)
730{
731 return 0x00000073;
732}
733static inline u32 gmmu_pte_kind_z24v8_ms4_vc4_2zv_v(void)
734{
735 return 0x00000074;
736}
737static inline u32 gmmu_pte_kind_z24v8_ms8_vc8_2zv_v(void)
738{
739 return 0x00000075;
740}
741static inline u32 gmmu_pte_kind_z24v8_ms8_vc24_2zv_v(void)
742{
743 return 0x00000076;
744}
745static inline u32 gmmu_pte_kind_z24v8_ms4_vc12_4cszv_v(void)
746{
747 return 0x00000077;
748}
749static inline u32 gmmu_pte_kind_z24v8_ms4_vc4_4cszv_v(void)
750{
751 return 0x00000078;
752}
753static inline u32 gmmu_pte_kind_z24v8_ms8_vc8_4cszv_v(void)
754{
755 return 0x00000079;
756}
757static inline u32 gmmu_pte_kind_z24v8_ms8_vc24_4cszv_v(void)
758{
759 return 0x0000007a;
760}
761static inline u32 gmmu_pte_kind_zf32_v(void)
762{
763 return 0x0000007b;
764}
765static inline u32 gmmu_pte_kind_zf32_1z_v(void)
766{
767 return 0x0000007c;
768}
769static inline u32 gmmu_pte_kind_zf32_ms2_1z_v(void)
770{
771 return 0x0000007d;
772}
773static inline u32 gmmu_pte_kind_zf32_ms4_1z_v(void)
774{
775 return 0x0000007e;
776}
777static inline u32 gmmu_pte_kind_zf32_ms8_1z_v(void)
778{
779 return 0x0000007f;
780}
781static inline u32 gmmu_pte_kind_zf32_ms16_1z_v(void)
782{
783 return 0x00000080;
784}
785static inline u32 gmmu_pte_kind_zf32_2cs_v(void)
786{
787 return 0x00000081;
788}
789static inline u32 gmmu_pte_kind_zf32_ms2_2cs_v(void)
790{
791 return 0x00000082;
792}
793static inline u32 gmmu_pte_kind_zf32_ms4_2cs_v(void)
794{
795 return 0x00000083;
796}
797static inline u32 gmmu_pte_kind_zf32_ms8_2cs_v(void)
798{
799 return 0x00000084;
800}
801static inline u32 gmmu_pte_kind_zf32_ms16_2cs_v(void)
802{
803 return 0x00000085;
804}
805static inline u32 gmmu_pte_kind_zf32_2cz_v(void)
806{
807 return 0x00000086;
808}
809static inline u32 gmmu_pte_kind_zf32_ms2_2cz_v(void)
810{
811 return 0x00000087;
812}
813static inline u32 gmmu_pte_kind_zf32_ms4_2cz_v(void)
814{
815 return 0x00000088;
816}
817static inline u32 gmmu_pte_kind_zf32_ms8_2cz_v(void)
818{
819 return 0x00000089;
820}
821static inline u32 gmmu_pte_kind_zf32_ms16_2cz_v(void)
822{
823 return 0x0000008a;
824}
825static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc12_v(void)
826{
827 return 0x0000008b;
828}
829static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc4_v(void)
830{
831 return 0x0000008c;
832}
833static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc8_v(void)
834{
835 return 0x0000008d;
836}
837static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc24_v(void)
838{
839 return 0x0000008e;
840}
841static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc12_1cs_v(void)
842{
843 return 0x0000008f;
844}
845static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc4_1cs_v(void)
846{
847 return 0x00000090;
848}
849static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc8_1cs_v(void)
850{
851 return 0x00000091;
852}
853static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc24_1cs_v(void)
854{
855 return 0x00000092;
856}
857static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc12_1zv_v(void)
858{
859 return 0x00000097;
860}
861static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc4_1zv_v(void)
862{
863 return 0x00000098;
864}
865static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc8_1zv_v(void)
866{
867 return 0x00000099;
868}
869static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc24_1zv_v(void)
870{
871 return 0x0000009a;
872}
873static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc12_1czv_v(void)
874{
875 return 0x0000009b;
876}
877static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc4_1czv_v(void)
878{
879 return 0x0000009c;
880}
881static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc8_1czv_v(void)
882{
883 return 0x0000009d;
884}
885static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc24_1czv_v(void)
886{
887 return 0x0000009e;
888}
889static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc12_2cs_v(void)
890{
891 return 0x0000009f;
892}
893static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc4_2cs_v(void)
894{
895 return 0x000000a0;
896}
897static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc8_2cs_v(void)
898{
899 return 0x000000a1;
900}
901static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc24_2cs_v(void)
902{
903 return 0x000000a2;
904}
905static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc12_2cszv_v(void)
906{
907 return 0x000000a3;
908}
909static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms4_vc4_2cszv_v(void)
910{
911 return 0x000000a4;
912}
913static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc8_2cszv_v(void)
914{
915 return 0x000000a5;
916}
917static inline u32 gmmu_pte_kind_x8z24_x16v8s8_ms8_vc24_2cszv_v(void)
918{
919 return 0x000000a6;
920}
921static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc12_v(void)
922{
923 return 0x000000a7;
924}
925static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc4_v(void)
926{
927 return 0x000000a8;
928}
929static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc8_v(void)
930{
931 return 0x000000a9;
932}
933static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc24_v(void)
934{
935 return 0x000000aa;
936}
937static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc12_1cs_v(void)
938{
939 return 0x000000ab;
940}
941static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc4_1cs_v(void)
942{
943 return 0x000000ac;
944}
945static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc8_1cs_v(void)
946{
947 return 0x000000ad;
948}
949static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc24_1cs_v(void)
950{
951 return 0x000000ae;
952}
953static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc12_1zv_v(void)
954{
955 return 0x000000b3;
956}
957static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc4_1zv_v(void)
958{
959 return 0x000000b4;
960}
961static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc8_1zv_v(void)
962{
963 return 0x000000b5;
964}
965static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc24_1zv_v(void)
966{
967 return 0x000000b6;
968}
969static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc12_1czv_v(void)
970{
971 return 0x000000b7;
972}
973static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc4_1czv_v(void)
974{
975 return 0x000000b8;
976}
977static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc8_1czv_v(void)
978{
979 return 0x000000b9;
980}
981static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc24_1czv_v(void)
982{
983 return 0x000000ba;
984}
985static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc12_2cs_v(void)
986{
987 return 0x000000bb;
988}
989static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc4_2cs_v(void)
990{
991 return 0x000000bc;
992}
993static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc8_2cs_v(void)
994{
995 return 0x000000bd;
996}
997static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc24_2cs_v(void)
998{
999 return 0x000000be;
1000}
1001static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc12_2cszv_v(void)
1002{
1003 return 0x000000bf;
1004}
1005static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms4_vc4_2cszv_v(void)
1006{
1007 return 0x000000c0;
1008}
1009static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc8_2cszv_v(void)
1010{
1011 return 0x000000c1;
1012}
1013static inline u32 gmmu_pte_kind_zf32_x16v8s8_ms8_vc24_2cszv_v(void)
1014{
1015 return 0x000000c2;
1016}
1017static inline u32 gmmu_pte_kind_zf32_x24s8_v(void)
1018{
1019 return 0x000000c3;
1020}
1021static inline u32 gmmu_pte_kind_zf32_x24s8_1cs_v(void)
1022{
1023 return 0x000000c4;
1024}
1025static inline u32 gmmu_pte_kind_zf32_x24s8_ms2_1cs_v(void)
1026{
1027 return 0x000000c5;
1028}
1029static inline u32 gmmu_pte_kind_zf32_x24s8_ms4_1cs_v(void)
1030{
1031 return 0x000000c6;
1032}
1033static inline u32 gmmu_pte_kind_zf32_x24s8_ms8_1cs_v(void)
1034{
1035 return 0x000000c7;
1036}
1037static inline u32 gmmu_pte_kind_zf32_x24s8_ms16_1cs_v(void)
1038{
1039 return 0x000000c8;
1040}
1041static inline u32 gmmu_pte_kind_zf32_x24s8_2cszv_v(void)
1042{
1043 return 0x000000ce;
1044}
1045static inline u32 gmmu_pte_kind_zf32_x24s8_ms2_2cszv_v(void)
1046{
1047 return 0x000000cf;
1048}
1049static inline u32 gmmu_pte_kind_zf32_x24s8_ms4_2cszv_v(void)
1050{
1051 return 0x000000d0;
1052}
1053static inline u32 gmmu_pte_kind_zf32_x24s8_ms8_2cszv_v(void)
1054{
1055 return 0x000000d1;
1056}
1057static inline u32 gmmu_pte_kind_zf32_x24s8_ms16_2cszv_v(void)
1058{
1059 return 0x000000d2;
1060}
1061static inline u32 gmmu_pte_kind_zf32_x24s8_2cs_v(void)
1062{
1063 return 0x000000d3;
1064}
1065static inline u32 gmmu_pte_kind_zf32_x24s8_ms2_2cs_v(void)
1066{
1067 return 0x000000d4;
1068}
1069static inline u32 gmmu_pte_kind_zf32_x24s8_ms4_2cs_v(void)
1070{
1071 return 0x000000d5;
1072}
1073static inline u32 gmmu_pte_kind_zf32_x24s8_ms8_2cs_v(void)
1074{
1075 return 0x000000d6;
1076}
1077static inline u32 gmmu_pte_kind_zf32_x24s8_ms16_2cs_v(void)
1078{
1079 return 0x000000d7;
1080}
1081static inline u32 gmmu_pte_kind_generic_16bx2_v(void)
1082{
1083 return 0x000000fe;
1084}
1085static inline u32 gmmu_pte_kind_c32_2c_v(void)
1086{
1087 return 0x000000d8;
1088}
1089static inline u32 gmmu_pte_kind_c32_2cbr_v(void)
1090{
1091 return 0x000000d9;
1092}
1093static inline u32 gmmu_pte_kind_c32_2cba_v(void)
1094{
1095 return 0x000000da;
1096}
1097static inline u32 gmmu_pte_kind_c32_2cra_v(void)
1098{
1099 return 0x000000db;
1100}
1101static inline u32 gmmu_pte_kind_c32_2bra_v(void)
1102{
1103 return 0x000000dc;
1104}
1105static inline u32 gmmu_pte_kind_c32_ms2_2c_v(void)
1106{
1107 return 0x000000dd;
1108}
1109static inline u32 gmmu_pte_kind_c32_ms2_2cbr_v(void)
1110{
1111 return 0x000000de;
1112}
1113static inline u32 gmmu_pte_kind_c32_ms4_2c_v(void)
1114{
1115 return 0x000000df;
1116}
1117static inline u32 gmmu_pte_kind_c32_ms4_2cbr_v(void)
1118{
1119 return 0x000000e0;
1120}
1121static inline u32 gmmu_pte_kind_c32_ms4_2cba_v(void)
1122{
1123 return 0x000000e1;
1124}
1125static inline u32 gmmu_pte_kind_c32_ms4_2cra_v(void)
1126{
1127 return 0x000000e2;
1128}
1129static inline u32 gmmu_pte_kind_c32_ms4_2bra_v(void)
1130{
1131 return 0x000000e3;
1132}
1133static inline u32 gmmu_pte_kind_c32_ms4_4cbra_v(void)
1134{
1135 return 0x0000002c;
1136}
1137static inline u32 gmmu_pte_kind_c32_ms8_ms16_2c_v(void)
1138{
1139 return 0x000000e4;
1140}
1141static inline u32 gmmu_pte_kind_c32_ms8_ms16_2cra_v(void)
1142{
1143 return 0x000000e5;
1144}
1145static inline u32 gmmu_pte_kind_c64_2c_v(void)
1146{
1147 return 0x000000e6;
1148}
1149static inline u32 gmmu_pte_kind_c64_2cbr_v(void)
1150{
1151 return 0x000000e7;
1152}
1153static inline u32 gmmu_pte_kind_c64_2cba_v(void)
1154{
1155 return 0x000000e8;
1156}
1157static inline u32 gmmu_pte_kind_c64_2cra_v(void)
1158{
1159 return 0x000000e9;
1160}
1161static inline u32 gmmu_pte_kind_c64_2bra_v(void)
1162{
1163 return 0x000000ea;
1164}
1165static inline u32 gmmu_pte_kind_c64_ms2_2c_v(void)
1166{
1167 return 0x000000eb;
1168}
1169static inline u32 gmmu_pte_kind_c64_ms2_2cbr_v(void)
1170{
1171 return 0x000000ec;
1172}
1173static inline u32 gmmu_pte_kind_c64_ms4_2c_v(void)
1174{
1175 return 0x000000ed;
1176}
1177static inline u32 gmmu_pte_kind_c64_ms4_2cbr_v(void)
1178{
1179 return 0x000000ee;
1180}
1181static inline u32 gmmu_pte_kind_c64_ms4_2cba_v(void)
1182{
1183 return 0x000000ef;
1184}
1185static inline u32 gmmu_pte_kind_c64_ms4_2cra_v(void)
1186{
1187 return 0x000000f0;
1188}
1189static inline u32 gmmu_pte_kind_c64_ms4_2bra_v(void)
1190{
1191 return 0x000000f1;
1192}
1193static inline u32 gmmu_pte_kind_c64_ms4_4cbra_v(void)
1194{
1195 return 0x0000002d;
1196}
1197static inline u32 gmmu_pte_kind_c64_ms8_ms16_2c_v(void)
1198{
1199 return 0x000000f2;
1200}
1201static inline u32 gmmu_pte_kind_c64_ms8_ms16_2cra_v(void)
1202{
1203 return 0x000000f3;
1204}
1205static inline u32 gmmu_pte_kind_c128_2c_v(void)
1206{
1207 return 0x000000f4;
1208}
1209static inline u32 gmmu_pte_kind_c128_2cr_v(void)
1210{
1211 return 0x000000f5;
1212}
1213static inline u32 gmmu_pte_kind_c128_ms2_2c_v(void)
1214{
1215 return 0x000000f6;
1216}
1217static inline u32 gmmu_pte_kind_c128_ms2_2cr_v(void)
1218{
1219 return 0x000000f7;
1220}
1221static inline u32 gmmu_pte_kind_c128_ms4_2c_v(void)
1222{
1223 return 0x000000f8;
1224}
1225static inline u32 gmmu_pte_kind_c128_ms4_2cr_v(void)
1226{
1227 return 0x000000f9;
1228}
1229static inline u32 gmmu_pte_kind_c128_ms8_ms16_2c_v(void)
1230{
1231 return 0x000000fa;
1232}
1233static inline u32 gmmu_pte_kind_c128_ms8_ms16_2cr_v(void)
1234{
1235 return 0x000000fb;
1236}
1237static inline u32 gmmu_pte_kind_x8c24_v(void)
1238{
1239 return 0x000000fc;
1240}
1241static inline u32 gmmu_pte_kind_pitch_no_swizzle_v(void)
1242{
1243 return 0x000000fd;
1244}
1245static inline u32 gmmu_pte_kind_smsked_message_v(void)
1246{
1247 return 0x000000ca;
1248}
1249static inline u32 gmmu_pte_kind_smhost_message_v(void)
1250{
1251 return 0x000000cb;
1252}
1253static inline u32 gmmu_pte_kind_s8_v(void)
1254{
1255 return 0x0000002a;
1256}
1257static inline u32 gmmu_pte_kind_s8_2s_v(void)
1258{
1259 return 0x0000002b;
1260}
1261#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_gr_gp106.h b/drivers/gpu/nvgpu/gp106/hw_gr_gp106.h
new file mode 100644
index 00000000..bb1f9fa9
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_gr_gp106.h
@@ -0,0 +1,4017 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_gr_gp106_h_
51#define _hw_gr_gp106_h_
52
53static inline u32 gr_intr_r(void)
54{
55 return 0x00400100;
56}
57static inline u32 gr_intr_notify_pending_f(void)
58{
59 return 0x1;
60}
61static inline u32 gr_intr_notify_reset_f(void)
62{
63 return 0x1;
64}
65static inline u32 gr_intr_semaphore_pending_f(void)
66{
67 return 0x2;
68}
69static inline u32 gr_intr_semaphore_reset_f(void)
70{
71 return 0x2;
72}
73static inline u32 gr_intr_illegal_method_pending_f(void)
74{
75 return 0x10;
76}
77static inline u32 gr_intr_illegal_method_reset_f(void)
78{
79 return 0x10;
80}
81static inline u32 gr_intr_illegal_notify_pending_f(void)
82{
83 return 0x40;
84}
85static inline u32 gr_intr_illegal_notify_reset_f(void)
86{
87 return 0x40;
88}
89static inline u32 gr_intr_firmware_method_f(u32 v)
90{
91 return (v & 0x1) << 8;
92}
93static inline u32 gr_intr_firmware_method_pending_f(void)
94{
95 return 0x100;
96}
97static inline u32 gr_intr_firmware_method_reset_f(void)
98{
99 return 0x100;
100}
101static inline u32 gr_intr_illegal_class_pending_f(void)
102{
103 return 0x20;
104}
105static inline u32 gr_intr_illegal_class_reset_f(void)
106{
107 return 0x20;
108}
109static inline u32 gr_intr_fecs_error_pending_f(void)
110{
111 return 0x80000;
112}
113static inline u32 gr_intr_fecs_error_reset_f(void)
114{
115 return 0x80000;
116}
117static inline u32 gr_intr_class_error_pending_f(void)
118{
119 return 0x100000;
120}
121static inline u32 gr_intr_class_error_reset_f(void)
122{
123 return 0x100000;
124}
125static inline u32 gr_intr_exception_pending_f(void)
126{
127 return 0x200000;
128}
129static inline u32 gr_intr_exception_reset_f(void)
130{
131 return 0x200000;
132}
133static inline u32 gr_fecs_intr_r(void)
134{
135 return 0x00400144;
136}
137static inline u32 gr_class_error_r(void)
138{
139 return 0x00400110;
140}
141static inline u32 gr_class_error_code_v(u32 r)
142{
143 return (r >> 0) & 0xffff;
144}
145static inline u32 gr_intr_nonstall_r(void)
146{
147 return 0x00400120;
148}
149static inline u32 gr_intr_nonstall_trap_pending_f(void)
150{
151 return 0x2;
152}
153static inline u32 gr_intr_en_r(void)
154{
155 return 0x0040013c;
156}
157static inline u32 gr_exception_r(void)
158{
159 return 0x00400108;
160}
161static inline u32 gr_exception_fe_m(void)
162{
163 return 0x1 << 0;
164}
165static inline u32 gr_exception_gpc_m(void)
166{
167 return 0x1 << 24;
168}
169static inline u32 gr_exception_memfmt_m(void)
170{
171 return 0x1 << 1;
172}
173static inline u32 gr_exception_ds_m(void)
174{
175 return 0x1 << 4;
176}
177static inline u32 gr_exception1_r(void)
178{
179 return 0x00400118;
180}
181static inline u32 gr_exception1_gpc_0_pending_f(void)
182{
183 return 0x1;
184}
185static inline u32 gr_exception2_r(void)
186{
187 return 0x0040011c;
188}
189static inline u32 gr_exception_en_r(void)
190{
191 return 0x00400138;
192}
193static inline u32 gr_exception_en_fe_m(void)
194{
195 return 0x1 << 0;
196}
197static inline u32 gr_exception1_en_r(void)
198{
199 return 0x00400130;
200}
201static inline u32 gr_exception2_en_r(void)
202{
203 return 0x00400134;
204}
205static inline u32 gr_gpfifo_ctl_r(void)
206{
207 return 0x00400500;
208}
209static inline u32 gr_gpfifo_ctl_access_f(u32 v)
210{
211 return (v & 0x1) << 0;
212}
213static inline u32 gr_gpfifo_ctl_access_disabled_f(void)
214{
215 return 0x0;
216}
217static inline u32 gr_gpfifo_ctl_access_enabled_f(void)
218{
219 return 0x1;
220}
221static inline u32 gr_gpfifo_ctl_semaphore_access_f(u32 v)
222{
223 return (v & 0x1) << 16;
224}
225static inline u32 gr_gpfifo_ctl_semaphore_access_enabled_v(void)
226{
227 return 0x00000001;
228}
229static inline u32 gr_gpfifo_ctl_semaphore_access_enabled_f(void)
230{
231 return 0x10000;
232}
233static inline u32 gr_gpfifo_status_r(void)
234{
235 return 0x00400504;
236}
237static inline u32 gr_trapped_addr_r(void)
238{
239 return 0x00400704;
240}
241static inline u32 gr_trapped_addr_mthd_v(u32 r)
242{
243 return (r >> 2) & 0xfff;
244}
245static inline u32 gr_trapped_addr_subch_v(u32 r)
246{
247 return (r >> 16) & 0x7;
248}
249static inline u32 gr_trapped_data_lo_r(void)
250{
251 return 0x00400708;
252}
253static inline u32 gr_trapped_data_hi_r(void)
254{
255 return 0x0040070c;
256}
257static inline u32 gr_status_r(void)
258{
259 return 0x00400700;
260}
261static inline u32 gr_status_fe_method_upper_v(u32 r)
262{
263 return (r >> 1) & 0x1;
264}
265static inline u32 gr_status_fe_method_lower_v(u32 r)
266{
267 return (r >> 2) & 0x1;
268}
269static inline u32 gr_status_fe_method_lower_idle_v(void)
270{
271 return 0x00000000;
272}
273static inline u32 gr_status_fe_gi_v(u32 r)
274{
275 return (r >> 21) & 0x1;
276}
277static inline u32 gr_status_mask_r(void)
278{
279 return 0x00400610;
280}
281static inline u32 gr_status_1_r(void)
282{
283 return 0x00400604;
284}
285static inline u32 gr_status_2_r(void)
286{
287 return 0x00400608;
288}
289static inline u32 gr_engine_status_r(void)
290{
291 return 0x0040060c;
292}
293static inline u32 gr_engine_status_value_busy_f(void)
294{
295 return 0x1;
296}
297static inline u32 gr_pri_be0_becs_be_exception_r(void)
298{
299 return 0x00410204;
300}
301static inline u32 gr_pri_be0_becs_be_exception_en_r(void)
302{
303 return 0x00410208;
304}
305static inline u32 gr_pri_gpc0_gpccs_gpc_exception_r(void)
306{
307 return 0x00502c90;
308}
309static inline u32 gr_pri_gpc0_gpccs_gpc_exception_en_r(void)
310{
311 return 0x00502c94;
312}
313static inline u32 gr_pri_gpc0_tpc0_tpccs_tpc_exception_r(void)
314{
315 return 0x00504508;
316}
317static inline u32 gr_pri_gpc0_tpc0_tpccs_tpc_exception_en_r(void)
318{
319 return 0x0050450c;
320}
321static inline u32 gr_activity_0_r(void)
322{
323 return 0x00400380;
324}
325static inline u32 gr_activity_1_r(void)
326{
327 return 0x00400384;
328}
329static inline u32 gr_activity_2_r(void)
330{
331 return 0x00400388;
332}
333static inline u32 gr_activity_4_r(void)
334{
335 return 0x00400390;
336}
337static inline u32 gr_activity_4_gpc0_s(void)
338{
339 return 3;
340}
341static inline u32 gr_activity_4_gpc0_f(u32 v)
342{
343 return (v & 0x7) << 0;
344}
345static inline u32 gr_activity_4_gpc0_m(void)
346{
347 return 0x7 << 0;
348}
349static inline u32 gr_activity_4_gpc0_v(u32 r)
350{
351 return (r >> 0) & 0x7;
352}
353static inline u32 gr_activity_4_gpc0_empty_v(void)
354{
355 return 0x00000000;
356}
357static inline u32 gr_activity_4_gpc0_preempted_v(void)
358{
359 return 0x00000004;
360}
361static inline u32 gr_pri_gpc0_gcc_dbg_r(void)
362{
363 return 0x00501000;
364}
365static inline u32 gr_pri_gpcs_gcc_dbg_r(void)
366{
367 return 0x00419000;
368}
369static inline u32 gr_pri_gpcs_gcc_dbg_invalidate_m(void)
370{
371 return 0x1 << 1;
372}
373static inline u32 gr_pri_gpc0_tpc0_sm_cache_control_r(void)
374{
375 return 0x005046a4;
376}
377static inline u32 gr_pri_gpcs_tpcs_sm_cache_control_r(void)
378{
379 return 0x00419ea4;
380}
381static inline u32 gr_pri_gpcs_tpcs_sm_cache_control_invalidate_cache_m(void)
382{
383 return 0x1 << 0;
384}
385static inline u32 gr_pri_sked_activity_r(void)
386{
387 return 0x00407054;
388}
389static inline u32 gr_pri_gpc0_gpccs_gpc_activity0_r(void)
390{
391 return 0x00502c80;
392}
393static inline u32 gr_pri_gpc0_gpccs_gpc_activity1_r(void)
394{
395 return 0x00502c84;
396}
397static inline u32 gr_pri_gpc0_gpccs_gpc_activity2_r(void)
398{
399 return 0x00502c88;
400}
401static inline u32 gr_pri_gpc0_gpccs_gpc_activity3_r(void)
402{
403 return 0x00502c8c;
404}
405static inline u32 gr_pri_gpc0_tpc0_tpccs_tpc_activity_0_r(void)
406{
407 return 0x00504500;
408}
409static inline u32 gr_pri_gpc0_tpc1_tpccs_tpc_activity_0_r(void)
410{
411 return 0x00504d00;
412}
413static inline u32 gr_pri_gpc0_tpcs_tpccs_tpc_activity_0_r(void)
414{
415 return 0x00501d00;
416}
417static inline u32 gr_pri_gpcs_gpccs_gpc_activity_0_r(void)
418{
419 return 0x0041ac80;
420}
421static inline u32 gr_pri_gpcs_gpccs_gpc_activity_1_r(void)
422{
423 return 0x0041ac84;
424}
425static inline u32 gr_pri_gpcs_gpccs_gpc_activity_2_r(void)
426{
427 return 0x0041ac88;
428}
429static inline u32 gr_pri_gpcs_gpccs_gpc_activity_3_r(void)
430{
431 return 0x0041ac8c;
432}
433static inline u32 gr_pri_gpcs_tpc0_tpccs_tpc_activity_0_r(void)
434{
435 return 0x0041c500;
436}
437static inline u32 gr_pri_gpcs_tpc1_tpccs_tpc_activity_0_r(void)
438{
439 return 0x0041cd00;
440}
441static inline u32 gr_pri_gpcs_tpcs_tpccs_tpc_activity_0_r(void)
442{
443 return 0x00419d00;
444}
445static inline u32 gr_pri_be0_becs_be_activity0_r(void)
446{
447 return 0x00410200;
448}
449static inline u32 gr_pri_be1_becs_be_activity0_r(void)
450{
451 return 0x00410600;
452}
453static inline u32 gr_pri_bes_becs_be_activity0_r(void)
454{
455 return 0x00408a00;
456}
457static inline u32 gr_pri_ds_mpipe_status_r(void)
458{
459 return 0x00405858;
460}
461static inline u32 gr_pri_fe_go_idle_info_r(void)
462{
463 return 0x00404194;
464}
465static inline u32 gr_pri_gpc0_tpc0_tex_m_tex_subunits_status_r(void)
466{
467 return 0x00504238;
468}
469static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_r(void)
470{
471 return 0x005046b8;
472}
473static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_single_err_detected_qrfdp0_pending_f(void)
474{
475 return 0x10;
476}
477static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_single_err_detected_qrfdp1_pending_f(void)
478{
479 return 0x20;
480}
481static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_single_err_detected_qrfdp2_pending_f(void)
482{
483 return 0x40;
484}
485static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_single_err_detected_qrfdp3_pending_f(void)
486{
487 return 0x80;
488}
489static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_double_err_detected_qrfdp0_pending_f(void)
490{
491 return 0x100;
492}
493static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_double_err_detected_qrfdp1_pending_f(void)
494{
495 return 0x200;
496}
497static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_double_err_detected_qrfdp2_pending_f(void)
498{
499 return 0x400;
500}
501static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_status_double_err_detected_qrfdp3_pending_f(void)
502{
503 return 0x800;
504}
505static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_status_r(void)
506{
507 return 0x005044a0;
508}
509static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_status_single_err_corrected_shm0_pending_f(void)
510{
511 return 0x1;
512}
513static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_status_single_err_corrected_shm1_pending_f(void)
514{
515 return 0x2;
516}
517static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_status_single_err_detected_shm0_pending_f(void)
518{
519 return 0x10;
520}
521static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_status_single_err_detected_shm1_pending_f(void)
522{
523 return 0x20;
524}
525static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_status_double_err_detected_shm0_pending_f(void)
526{
527 return 0x100;
528}
529static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_status_double_err_detected_shm1_pending_f(void)
530{
531 return 0x200;
532}
533static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_single_err_count_r(void)
534{
535 return 0x005046bc;
536}
537static inline u32 gr_pri_gpc0_tpc0_sm_lrf_ecc_double_err_count_r(void)
538{
539 return 0x005046c0;
540}
541static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_err_count_r(void)
542{
543 return 0x005044a4;
544}
545static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_err_count_single_corrected_m(void)
546{
547 return 0xff << 0;
548}
549static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_err_count_single_corrected_v(u32 r)
550{
551 return (r >> 0) & 0xff;
552}
553static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_err_count_single_detected_m(void)
554{
555 return 0xff << 8;
556}
557static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_err_count_single_detected_v(u32 r)
558{
559 return (r >> 8) & 0xff;
560}
561static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_err_count_double_detected_m(void)
562{
563 return 0xff << 16;
564}
565static inline u32 gr_pri_gpc0_tpc0_sm_shm_ecc_err_count_double_detected_v(u32 r)
566{
567 return (r >> 16) & 0xff;
568}
569static inline u32 gr_pri_gpc0_tpc0_tex_m_routing_r(void)
570{
571 return 0x005042c4;
572}
573static inline u32 gr_pri_gpc0_tpc0_tex_m_routing_sel_default_f(void)
574{
575 return 0x0;
576}
577static inline u32 gr_pri_gpc0_tpc0_tex_m_routing_sel_pipe0_f(void)
578{
579 return 0x1;
580}
581static inline u32 gr_pri_gpc0_tpc0_tex_m_routing_sel_pipe1_f(void)
582{
583 return 0x2;
584}
585static inline u32 gr_pri_be0_crop_status1_r(void)
586{
587 return 0x00410134;
588}
589static inline u32 gr_pri_bes_crop_status1_r(void)
590{
591 return 0x00408934;
592}
593static inline u32 gr_pri_be0_zrop_status_r(void)
594{
595 return 0x00410048;
596}
597static inline u32 gr_pri_be0_zrop_status2_r(void)
598{
599 return 0x0041004c;
600}
601static inline u32 gr_pri_bes_zrop_status_r(void)
602{
603 return 0x00408848;
604}
605static inline u32 gr_pri_bes_zrop_status2_r(void)
606{
607 return 0x0040884c;
608}
609static inline u32 gr_pipe_bundle_address_r(void)
610{
611 return 0x00400200;
612}
613static inline u32 gr_pipe_bundle_address_value_v(u32 r)
614{
615 return (r >> 0) & 0xffff;
616}
617static inline u32 gr_pipe_bundle_data_r(void)
618{
619 return 0x00400204;
620}
621static inline u32 gr_pipe_bundle_config_r(void)
622{
623 return 0x00400208;
624}
625static inline u32 gr_pipe_bundle_config_override_pipe_mode_disabled_f(void)
626{
627 return 0x0;
628}
629static inline u32 gr_pipe_bundle_config_override_pipe_mode_enabled_f(void)
630{
631 return 0x80000000;
632}
633static inline u32 gr_fe_hww_esr_r(void)
634{
635 return 0x00404000;
636}
637static inline u32 gr_fe_hww_esr_reset_active_f(void)
638{
639 return 0x40000000;
640}
641static inline u32 gr_fe_hww_esr_en_enable_f(void)
642{
643 return 0x80000000;
644}
645static inline u32 gr_fe_go_idle_timeout_r(void)
646{
647 return 0x00404154;
648}
649static inline u32 gr_fe_go_idle_timeout_count_f(u32 v)
650{
651 return (v & 0xffffffff) << 0;
652}
653static inline u32 gr_fe_go_idle_timeout_count_disabled_f(void)
654{
655 return 0x0;
656}
657static inline u32 gr_fe_go_idle_timeout_count_prod_f(void)
658{
659 return 0x1800;
660}
661static inline u32 gr_fe_object_table_r(u32 i)
662{
663 return 0x00404200 + i*4;
664}
665static inline u32 gr_fe_object_table_nvclass_v(u32 r)
666{
667 return (r >> 0) & 0xffff;
668}
669static inline u32 gr_fe_tpc_fs_r(void)
670{
671 return 0x004041c4;
672}
673static inline u32 gr_pri_mme_shadow_raw_index_r(void)
674{
675 return 0x00404488;
676}
677static inline u32 gr_pri_mme_shadow_raw_index_write_trigger_f(void)
678{
679 return 0x80000000;
680}
681static inline u32 gr_pri_mme_shadow_raw_data_r(void)
682{
683 return 0x0040448c;
684}
685static inline u32 gr_mme_hww_esr_r(void)
686{
687 return 0x00404490;
688}
689static inline u32 gr_mme_hww_esr_reset_active_f(void)
690{
691 return 0x40000000;
692}
693static inline u32 gr_mme_hww_esr_en_enable_f(void)
694{
695 return 0x80000000;
696}
697static inline u32 gr_memfmt_hww_esr_r(void)
698{
699 return 0x00404600;
700}
701static inline u32 gr_memfmt_hww_esr_reset_active_f(void)
702{
703 return 0x40000000;
704}
705static inline u32 gr_memfmt_hww_esr_en_enable_f(void)
706{
707 return 0x80000000;
708}
709static inline u32 gr_fecs_cpuctl_r(void)
710{
711 return 0x00409100;
712}
713static inline u32 gr_fecs_cpuctl_startcpu_f(u32 v)
714{
715 return (v & 0x1) << 1;
716}
717static inline u32 gr_fecs_cpuctl_alias_r(void)
718{
719 return 0x00409130;
720}
721static inline u32 gr_fecs_cpuctl_alias_startcpu_f(u32 v)
722{
723 return (v & 0x1) << 1;
724}
725static inline u32 gr_fecs_dmactl_r(void)
726{
727 return 0x0040910c;
728}
729static inline u32 gr_fecs_dmactl_require_ctx_f(u32 v)
730{
731 return (v & 0x1) << 0;
732}
733static inline u32 gr_fecs_dmactl_dmem_scrubbing_m(void)
734{
735 return 0x1 << 1;
736}
737static inline u32 gr_fecs_dmactl_imem_scrubbing_m(void)
738{
739 return 0x1 << 2;
740}
741static inline u32 gr_fecs_os_r(void)
742{
743 return 0x00409080;
744}
745static inline u32 gr_fecs_idlestate_r(void)
746{
747 return 0x0040904c;
748}
749static inline u32 gr_fecs_mailbox0_r(void)
750{
751 return 0x00409040;
752}
753static inline u32 gr_fecs_mailbox1_r(void)
754{
755 return 0x00409044;
756}
757static inline u32 gr_fecs_irqstat_r(void)
758{
759 return 0x00409008;
760}
761static inline u32 gr_fecs_irqmode_r(void)
762{
763 return 0x0040900c;
764}
765static inline u32 gr_fecs_irqmask_r(void)
766{
767 return 0x00409018;
768}
769static inline u32 gr_fecs_irqdest_r(void)
770{
771 return 0x0040901c;
772}
773static inline u32 gr_fecs_curctx_r(void)
774{
775 return 0x00409050;
776}
777static inline u32 gr_fecs_nxtctx_r(void)
778{
779 return 0x00409054;
780}
781static inline u32 gr_fecs_engctl_r(void)
782{
783 return 0x004090a4;
784}
785static inline u32 gr_fecs_debug1_r(void)
786{
787 return 0x00409090;
788}
789static inline u32 gr_fecs_debuginfo_r(void)
790{
791 return 0x00409094;
792}
793static inline u32 gr_fecs_icd_cmd_r(void)
794{
795 return 0x00409200;
796}
797static inline u32 gr_fecs_icd_cmd_opc_s(void)
798{
799 return 4;
800}
801static inline u32 gr_fecs_icd_cmd_opc_f(u32 v)
802{
803 return (v & 0xf) << 0;
804}
805static inline u32 gr_fecs_icd_cmd_opc_m(void)
806{
807 return 0xf << 0;
808}
809static inline u32 gr_fecs_icd_cmd_opc_v(u32 r)
810{
811 return (r >> 0) & 0xf;
812}
813static inline u32 gr_fecs_icd_cmd_opc_rreg_f(void)
814{
815 return 0x8;
816}
817static inline u32 gr_fecs_icd_cmd_opc_rstat_f(void)
818{
819 return 0xe;
820}
821static inline u32 gr_fecs_icd_cmd_idx_f(u32 v)
822{
823 return (v & 0x1f) << 8;
824}
825static inline u32 gr_fecs_icd_rdata_r(void)
826{
827 return 0x0040920c;
828}
829static inline u32 gr_fecs_imemc_r(u32 i)
830{
831 return 0x00409180 + i*16;
832}
833static inline u32 gr_fecs_imemc_offs_f(u32 v)
834{
835 return (v & 0x3f) << 2;
836}
837static inline u32 gr_fecs_imemc_blk_f(u32 v)
838{
839 return (v & 0xff) << 8;
840}
841static inline u32 gr_fecs_imemc_aincw_f(u32 v)
842{
843 return (v & 0x1) << 24;
844}
845static inline u32 gr_fecs_imemd_r(u32 i)
846{
847 return 0x00409184 + i*16;
848}
849static inline u32 gr_fecs_imemt_r(u32 i)
850{
851 return 0x00409188 + i*16;
852}
853static inline u32 gr_fecs_imemt_tag_f(u32 v)
854{
855 return (v & 0xffff) << 0;
856}
857static inline u32 gr_fecs_dmemc_r(u32 i)
858{
859 return 0x004091c0 + i*8;
860}
861static inline u32 gr_fecs_dmemc_offs_s(void)
862{
863 return 6;
864}
865static inline u32 gr_fecs_dmemc_offs_f(u32 v)
866{
867 return (v & 0x3f) << 2;
868}
869static inline u32 gr_fecs_dmemc_offs_m(void)
870{
871 return 0x3f << 2;
872}
873static inline u32 gr_fecs_dmemc_offs_v(u32 r)
874{
875 return (r >> 2) & 0x3f;
876}
877static inline u32 gr_fecs_dmemc_blk_f(u32 v)
878{
879 return (v & 0xff) << 8;
880}
881static inline u32 gr_fecs_dmemc_aincw_f(u32 v)
882{
883 return (v & 0x1) << 24;
884}
885static inline u32 gr_fecs_dmemd_r(u32 i)
886{
887 return 0x004091c4 + i*8;
888}
889static inline u32 gr_fecs_dmatrfbase_r(void)
890{
891 return 0x00409110;
892}
893static inline u32 gr_fecs_dmatrfmoffs_r(void)
894{
895 return 0x00409114;
896}
897static inline u32 gr_fecs_dmatrffboffs_r(void)
898{
899 return 0x0040911c;
900}
901static inline u32 gr_fecs_dmatrfcmd_r(void)
902{
903 return 0x00409118;
904}
905static inline u32 gr_fecs_dmatrfcmd_imem_f(u32 v)
906{
907 return (v & 0x1) << 4;
908}
909static inline u32 gr_fecs_dmatrfcmd_write_f(u32 v)
910{
911 return (v & 0x1) << 5;
912}
913static inline u32 gr_fecs_dmatrfcmd_size_f(u32 v)
914{
915 return (v & 0x7) << 8;
916}
917static inline u32 gr_fecs_dmatrfcmd_ctxdma_f(u32 v)
918{
919 return (v & 0x7) << 12;
920}
921static inline u32 gr_fecs_bootvec_r(void)
922{
923 return 0x00409104;
924}
925static inline u32 gr_fecs_bootvec_vec_f(u32 v)
926{
927 return (v & 0xffffffff) << 0;
928}
929static inline u32 gr_fecs_falcon_hwcfg_r(void)
930{
931 return 0x00409108;
932}
933static inline u32 gr_gpcs_gpccs_falcon_hwcfg_r(void)
934{
935 return 0x0041a108;
936}
937static inline u32 gr_fecs_falcon_rm_r(void)
938{
939 return 0x00409084;
940}
941static inline u32 gr_fecs_current_ctx_r(void)
942{
943 return 0x00409b00;
944}
945static inline u32 gr_fecs_current_ctx_ptr_f(u32 v)
946{
947 return (v & 0xfffffff) << 0;
948}
949static inline u32 gr_fecs_current_ctx_ptr_v(u32 r)
950{
951 return (r >> 0) & 0xfffffff;
952}
953static inline u32 gr_fecs_current_ctx_target_s(void)
954{
955 return 2;
956}
957static inline u32 gr_fecs_current_ctx_target_f(u32 v)
958{
959 return (v & 0x3) << 28;
960}
961static inline u32 gr_fecs_current_ctx_target_m(void)
962{
963 return 0x3 << 28;
964}
965static inline u32 gr_fecs_current_ctx_target_v(u32 r)
966{
967 return (r >> 28) & 0x3;
968}
969static inline u32 gr_fecs_current_ctx_target_vid_mem_f(void)
970{
971 return 0x0;
972}
973static inline u32 gr_fecs_current_ctx_target_sys_mem_coh_f(void)
974{
975 return 0x20000000;
976}
977static inline u32 gr_fecs_current_ctx_target_sys_mem_ncoh_f(void)
978{
979 return 0x30000000;
980}
981static inline u32 gr_fecs_current_ctx_valid_s(void)
982{
983 return 1;
984}
985static inline u32 gr_fecs_current_ctx_valid_f(u32 v)
986{
987 return (v & 0x1) << 31;
988}
989static inline u32 gr_fecs_current_ctx_valid_m(void)
990{
991 return 0x1 << 31;
992}
993static inline u32 gr_fecs_current_ctx_valid_v(u32 r)
994{
995 return (r >> 31) & 0x1;
996}
997static inline u32 gr_fecs_current_ctx_valid_false_f(void)
998{
999 return 0x0;
1000}
1001static inline u32 gr_fecs_method_data_r(void)
1002{
1003 return 0x00409500;
1004}
1005static inline u32 gr_fecs_method_push_r(void)
1006{
1007 return 0x00409504;
1008}
1009static inline u32 gr_fecs_method_push_adr_f(u32 v)
1010{
1011 return (v & 0xfff) << 0;
1012}
1013static inline u32 gr_fecs_method_push_adr_bind_pointer_v(void)
1014{
1015 return 0x00000003;
1016}
1017static inline u32 gr_fecs_method_push_adr_bind_pointer_f(void)
1018{
1019 return 0x3;
1020}
1021static inline u32 gr_fecs_method_push_adr_discover_image_size_v(void)
1022{
1023 return 0x00000010;
1024}
1025static inline u32 gr_fecs_method_push_adr_wfi_golden_save_v(void)
1026{
1027 return 0x00000009;
1028}
1029static inline u32 gr_fecs_method_push_adr_restore_golden_v(void)
1030{
1031 return 0x00000015;
1032}
1033static inline u32 gr_fecs_method_push_adr_discover_zcull_image_size_v(void)
1034{
1035 return 0x00000016;
1036}
1037static inline u32 gr_fecs_method_push_adr_discover_pm_image_size_v(void)
1038{
1039 return 0x00000025;
1040}
1041static inline u32 gr_fecs_method_push_adr_discover_reglist_image_size_v(void)
1042{
1043 return 0x00000030;
1044}
1045static inline u32 gr_fecs_method_push_adr_set_reglist_bind_instance_v(void)
1046{
1047 return 0x00000031;
1048}
1049static inline u32 gr_fecs_method_push_adr_set_reglist_virtual_address_v(void)
1050{
1051 return 0x00000032;
1052}
1053static inline u32 gr_fecs_method_push_adr_stop_ctxsw_v(void)
1054{
1055 return 0x00000038;
1056}
1057static inline u32 gr_fecs_method_push_adr_start_ctxsw_v(void)
1058{
1059 return 0x00000039;
1060}
1061static inline u32 gr_fecs_method_push_adr_set_watchdog_timeout_f(void)
1062{
1063 return 0x21;
1064}
1065static inline u32 gr_fecs_method_push_adr_discover_preemption_image_size_v(void)
1066{
1067 return 0x0000001a;
1068}
1069static inline u32 gr_fecs_method_push_adr_halt_pipeline_v(void)
1070{
1071 return 0x00000004;
1072}
1073static inline u32 gr_fecs_host_int_status_r(void)
1074{
1075 return 0x00409c18;
1076}
1077static inline u32 gr_fecs_host_int_status_fault_during_ctxsw_f(u32 v)
1078{
1079 return (v & 0x1) << 16;
1080}
1081static inline u32 gr_fecs_host_int_status_umimp_firmware_method_f(u32 v)
1082{
1083 return (v & 0x1) << 17;
1084}
1085static inline u32 gr_fecs_host_int_status_umimp_illegal_method_f(u32 v)
1086{
1087 return (v & 0x1) << 18;
1088}
1089static inline u32 gr_fecs_host_int_clear_r(void)
1090{
1091 return 0x00409c20;
1092}
1093static inline u32 gr_fecs_host_int_enable_r(void)
1094{
1095 return 0x00409c24;
1096}
1097static inline u32 gr_fecs_host_int_enable_fault_during_ctxsw_enable_f(void)
1098{
1099 return 0x10000;
1100}
1101static inline u32 gr_fecs_host_int_enable_umimp_firmware_method_enable_f(void)
1102{
1103 return 0x20000;
1104}
1105static inline u32 gr_fecs_host_int_enable_umimp_illegal_method_enable_f(void)
1106{
1107 return 0x40000;
1108}
1109static inline u32 gr_fecs_host_int_enable_watchdog_enable_f(void)
1110{
1111 return 0x80000;
1112}
1113static inline u32 gr_fecs_ctxsw_reset_ctl_r(void)
1114{
1115 return 0x00409614;
1116}
1117static inline u32 gr_fecs_ctxsw_reset_ctl_sys_halt_disabled_f(void)
1118{
1119 return 0x0;
1120}
1121static inline u32 gr_fecs_ctxsw_reset_ctl_gpc_halt_disabled_f(void)
1122{
1123 return 0x0;
1124}
1125static inline u32 gr_fecs_ctxsw_reset_ctl_be_halt_disabled_f(void)
1126{
1127 return 0x0;
1128}
1129static inline u32 gr_fecs_ctxsw_reset_ctl_sys_engine_reset_disabled_f(void)
1130{
1131 return 0x10;
1132}
1133static inline u32 gr_fecs_ctxsw_reset_ctl_gpc_engine_reset_disabled_f(void)
1134{
1135 return 0x20;
1136}
1137static inline u32 gr_fecs_ctxsw_reset_ctl_be_engine_reset_disabled_f(void)
1138{
1139 return 0x40;
1140}
1141static inline u32 gr_fecs_ctxsw_reset_ctl_sys_context_reset_enabled_f(void)
1142{
1143 return 0x0;
1144}
1145static inline u32 gr_fecs_ctxsw_reset_ctl_sys_context_reset_disabled_f(void)
1146{
1147 return 0x100;
1148}
1149static inline u32 gr_fecs_ctxsw_reset_ctl_gpc_context_reset_enabled_f(void)
1150{
1151 return 0x0;
1152}
1153static inline u32 gr_fecs_ctxsw_reset_ctl_gpc_context_reset_disabled_f(void)
1154{
1155 return 0x200;
1156}
1157static inline u32 gr_fecs_ctxsw_reset_ctl_be_context_reset_s(void)
1158{
1159 return 1;
1160}
1161static inline u32 gr_fecs_ctxsw_reset_ctl_be_context_reset_f(u32 v)
1162{
1163 return (v & 0x1) << 10;
1164}
1165static inline u32 gr_fecs_ctxsw_reset_ctl_be_context_reset_m(void)
1166{
1167 return 0x1 << 10;
1168}
1169static inline u32 gr_fecs_ctxsw_reset_ctl_be_context_reset_v(u32 r)
1170{
1171 return (r >> 10) & 0x1;
1172}
1173static inline u32 gr_fecs_ctxsw_reset_ctl_be_context_reset_enabled_f(void)
1174{
1175 return 0x0;
1176}
1177static inline u32 gr_fecs_ctxsw_reset_ctl_be_context_reset_disabled_f(void)
1178{
1179 return 0x400;
1180}
1181static inline u32 gr_fecs_ctx_state_store_major_rev_id_r(void)
1182{
1183 return 0x0040960c;
1184}
1185static inline u32 gr_fecs_ctxsw_mailbox_r(u32 i)
1186{
1187 return 0x00409800 + i*4;
1188}
1189static inline u32 gr_fecs_ctxsw_mailbox__size_1_v(void)
1190{
1191 return 0x00000010;
1192}
1193static inline u32 gr_fecs_ctxsw_mailbox_value_f(u32 v)
1194{
1195 return (v & 0xffffffff) << 0;
1196}
1197static inline u32 gr_fecs_ctxsw_mailbox_value_pass_v(void)
1198{
1199 return 0x00000001;
1200}
1201static inline u32 gr_fecs_ctxsw_mailbox_value_fail_v(void)
1202{
1203 return 0x00000002;
1204}
1205static inline u32 gr_fecs_ctxsw_mailbox_set_r(u32 i)
1206{
1207 return 0x004098c0 + i*4;
1208}
1209static inline u32 gr_fecs_ctxsw_mailbox_set_value_f(u32 v)
1210{
1211 return (v & 0xffffffff) << 0;
1212}
1213static inline u32 gr_fecs_ctxsw_mailbox_clear_r(u32 i)
1214{
1215 return 0x00409840 + i*4;
1216}
1217static inline u32 gr_fecs_ctxsw_mailbox_clear_value_f(u32 v)
1218{
1219 return (v & 0xffffffff) << 0;
1220}
1221static inline u32 gr_fecs_fs_r(void)
1222{
1223 return 0x00409604;
1224}
1225static inline u32 gr_fecs_fs_num_available_gpcs_s(void)
1226{
1227 return 5;
1228}
1229static inline u32 gr_fecs_fs_num_available_gpcs_f(u32 v)
1230{
1231 return (v & 0x1f) << 0;
1232}
1233static inline u32 gr_fecs_fs_num_available_gpcs_m(void)
1234{
1235 return 0x1f << 0;
1236}
1237static inline u32 gr_fecs_fs_num_available_gpcs_v(u32 r)
1238{
1239 return (r >> 0) & 0x1f;
1240}
1241static inline u32 gr_fecs_fs_num_available_fbps_s(void)
1242{
1243 return 5;
1244}
1245static inline u32 gr_fecs_fs_num_available_fbps_f(u32 v)
1246{
1247 return (v & 0x1f) << 16;
1248}
1249static inline u32 gr_fecs_fs_num_available_fbps_m(void)
1250{
1251 return 0x1f << 16;
1252}
1253static inline u32 gr_fecs_fs_num_available_fbps_v(u32 r)
1254{
1255 return (r >> 16) & 0x1f;
1256}
1257static inline u32 gr_fecs_cfg_r(void)
1258{
1259 return 0x00409620;
1260}
1261static inline u32 gr_fecs_cfg_imem_sz_v(u32 r)
1262{
1263 return (r >> 0) & 0xff;
1264}
1265static inline u32 gr_fecs_rc_lanes_r(void)
1266{
1267 return 0x00409880;
1268}
1269static inline u32 gr_fecs_rc_lanes_num_chains_s(void)
1270{
1271 return 6;
1272}
1273static inline u32 gr_fecs_rc_lanes_num_chains_f(u32 v)
1274{
1275 return (v & 0x3f) << 0;
1276}
1277static inline u32 gr_fecs_rc_lanes_num_chains_m(void)
1278{
1279 return 0x3f << 0;
1280}
1281static inline u32 gr_fecs_rc_lanes_num_chains_v(u32 r)
1282{
1283 return (r >> 0) & 0x3f;
1284}
1285static inline u32 gr_fecs_ctxsw_status_1_r(void)
1286{
1287 return 0x00409400;
1288}
1289static inline u32 gr_fecs_ctxsw_status_1_arb_busy_s(void)
1290{
1291 return 1;
1292}
1293static inline u32 gr_fecs_ctxsw_status_1_arb_busy_f(u32 v)
1294{
1295 return (v & 0x1) << 12;
1296}
1297static inline u32 gr_fecs_ctxsw_status_1_arb_busy_m(void)
1298{
1299 return 0x1 << 12;
1300}
1301static inline u32 gr_fecs_ctxsw_status_1_arb_busy_v(u32 r)
1302{
1303 return (r >> 12) & 0x1;
1304}
1305static inline u32 gr_fecs_arb_ctx_adr_r(void)
1306{
1307 return 0x00409a24;
1308}
1309static inline u32 gr_fecs_new_ctx_r(void)
1310{
1311 return 0x00409b04;
1312}
1313static inline u32 gr_fecs_new_ctx_ptr_s(void)
1314{
1315 return 28;
1316}
1317static inline u32 gr_fecs_new_ctx_ptr_f(u32 v)
1318{
1319 return (v & 0xfffffff) << 0;
1320}
1321static inline u32 gr_fecs_new_ctx_ptr_m(void)
1322{
1323 return 0xfffffff << 0;
1324}
1325static inline u32 gr_fecs_new_ctx_ptr_v(u32 r)
1326{
1327 return (r >> 0) & 0xfffffff;
1328}
1329static inline u32 gr_fecs_new_ctx_target_s(void)
1330{
1331 return 2;
1332}
1333static inline u32 gr_fecs_new_ctx_target_f(u32 v)
1334{
1335 return (v & 0x3) << 28;
1336}
1337static inline u32 gr_fecs_new_ctx_target_m(void)
1338{
1339 return 0x3 << 28;
1340}
1341static inline u32 gr_fecs_new_ctx_target_v(u32 r)
1342{
1343 return (r >> 28) & 0x3;
1344}
1345static inline u32 gr_fecs_new_ctx_target_vid_mem_f(void)
1346{
1347 return 0x0;
1348}
1349static inline u32 gr_fecs_new_ctx_target_sys_mem_ncoh_f(void)
1350{
1351 return 0x30000000;
1352}
1353static inline u32 gr_fecs_new_ctx_valid_s(void)
1354{
1355 return 1;
1356}
1357static inline u32 gr_fecs_new_ctx_valid_f(u32 v)
1358{
1359 return (v & 0x1) << 31;
1360}
1361static inline u32 gr_fecs_new_ctx_valid_m(void)
1362{
1363 return 0x1 << 31;
1364}
1365static inline u32 gr_fecs_new_ctx_valid_v(u32 r)
1366{
1367 return (r >> 31) & 0x1;
1368}
1369static inline u32 gr_fecs_arb_ctx_ptr_r(void)
1370{
1371 return 0x00409a0c;
1372}
1373static inline u32 gr_fecs_arb_ctx_ptr_ptr_s(void)
1374{
1375 return 28;
1376}
1377static inline u32 gr_fecs_arb_ctx_ptr_ptr_f(u32 v)
1378{
1379 return (v & 0xfffffff) << 0;
1380}
1381static inline u32 gr_fecs_arb_ctx_ptr_ptr_m(void)
1382{
1383 return 0xfffffff << 0;
1384}
1385static inline u32 gr_fecs_arb_ctx_ptr_ptr_v(u32 r)
1386{
1387 return (r >> 0) & 0xfffffff;
1388}
1389static inline u32 gr_fecs_arb_ctx_ptr_target_s(void)
1390{
1391 return 2;
1392}
1393static inline u32 gr_fecs_arb_ctx_ptr_target_f(u32 v)
1394{
1395 return (v & 0x3) << 28;
1396}
1397static inline u32 gr_fecs_arb_ctx_ptr_target_m(void)
1398{
1399 return 0x3 << 28;
1400}
1401static inline u32 gr_fecs_arb_ctx_ptr_target_v(u32 r)
1402{
1403 return (r >> 28) & 0x3;
1404}
1405static inline u32 gr_fecs_arb_ctx_ptr_target_vid_mem_f(void)
1406{
1407 return 0x0;
1408}
1409static inline u32 gr_fecs_arb_ctx_ptr_target_sys_mem_ncoh_f(void)
1410{
1411 return 0x30000000;
1412}
1413static inline u32 gr_fecs_arb_ctx_cmd_r(void)
1414{
1415 return 0x00409a10;
1416}
1417static inline u32 gr_fecs_arb_ctx_cmd_cmd_s(void)
1418{
1419 return 5;
1420}
1421static inline u32 gr_fecs_arb_ctx_cmd_cmd_f(u32 v)
1422{
1423 return (v & 0x1f) << 0;
1424}
1425static inline u32 gr_fecs_arb_ctx_cmd_cmd_m(void)
1426{
1427 return 0x1f << 0;
1428}
1429static inline u32 gr_fecs_arb_ctx_cmd_cmd_v(u32 r)
1430{
1431 return (r >> 0) & 0x1f;
1432}
1433static inline u32 gr_fecs_ctxsw_status_fe_0_r(void)
1434{
1435 return 0x00409c00;
1436}
1437static inline u32 gr_gpc0_gpccs_ctxsw_status_gpc_0_r(void)
1438{
1439 return 0x00502c04;
1440}
1441static inline u32 gr_gpc0_gpccs_ctxsw_status_1_r(void)
1442{
1443 return 0x00502400;
1444}
1445static inline u32 gr_fecs_ctxsw_idlestate_r(void)
1446{
1447 return 0x00409420;
1448}
1449static inline u32 gr_fecs_feature_override_ecc_r(void)
1450{
1451 return 0x00409658;
1452}
1453static inline u32 gr_gpc0_gpccs_ctxsw_idlestate_r(void)
1454{
1455 return 0x00502420;
1456}
1457static inline u32 gr_rstr2d_gpc_map0_r(void)
1458{
1459 return 0x0040780c;
1460}
1461static inline u32 gr_rstr2d_gpc_map1_r(void)
1462{
1463 return 0x00407810;
1464}
1465static inline u32 gr_rstr2d_gpc_map2_r(void)
1466{
1467 return 0x00407814;
1468}
1469static inline u32 gr_rstr2d_gpc_map3_r(void)
1470{
1471 return 0x00407818;
1472}
1473static inline u32 gr_rstr2d_gpc_map4_r(void)
1474{
1475 return 0x0040781c;
1476}
1477static inline u32 gr_rstr2d_gpc_map5_r(void)
1478{
1479 return 0x00407820;
1480}
1481static inline u32 gr_rstr2d_map_table_cfg_r(void)
1482{
1483 return 0x004078bc;
1484}
1485static inline u32 gr_rstr2d_map_table_cfg_row_offset_f(u32 v)
1486{
1487 return (v & 0xff) << 0;
1488}
1489static inline u32 gr_rstr2d_map_table_cfg_num_entries_f(u32 v)
1490{
1491 return (v & 0xff) << 8;
1492}
1493static inline u32 gr_pd_hww_esr_r(void)
1494{
1495 return 0x00406018;
1496}
1497static inline u32 gr_pd_hww_esr_reset_active_f(void)
1498{
1499 return 0x40000000;
1500}
1501static inline u32 gr_pd_hww_esr_en_enable_f(void)
1502{
1503 return 0x80000000;
1504}
1505static inline u32 gr_pd_num_tpc_per_gpc_r(u32 i)
1506{
1507 return 0x00406028 + i*4;
1508}
1509static inline u32 gr_pd_num_tpc_per_gpc__size_1_v(void)
1510{
1511 return 0x00000004;
1512}
1513static inline u32 gr_pd_num_tpc_per_gpc_count0_f(u32 v)
1514{
1515 return (v & 0xf) << 0;
1516}
1517static inline u32 gr_pd_num_tpc_per_gpc_count1_f(u32 v)
1518{
1519 return (v & 0xf) << 4;
1520}
1521static inline u32 gr_pd_num_tpc_per_gpc_count2_f(u32 v)
1522{
1523 return (v & 0xf) << 8;
1524}
1525static inline u32 gr_pd_num_tpc_per_gpc_count3_f(u32 v)
1526{
1527 return (v & 0xf) << 12;
1528}
1529static inline u32 gr_pd_num_tpc_per_gpc_count4_f(u32 v)
1530{
1531 return (v & 0xf) << 16;
1532}
1533static inline u32 gr_pd_num_tpc_per_gpc_count5_f(u32 v)
1534{
1535 return (v & 0xf) << 20;
1536}
1537static inline u32 gr_pd_num_tpc_per_gpc_count6_f(u32 v)
1538{
1539 return (v & 0xf) << 24;
1540}
1541static inline u32 gr_pd_num_tpc_per_gpc_count7_f(u32 v)
1542{
1543 return (v & 0xf) << 28;
1544}
1545static inline u32 gr_pd_ab_dist_cfg0_r(void)
1546{
1547 return 0x004064c0;
1548}
1549static inline u32 gr_pd_ab_dist_cfg0_timeslice_enable_en_f(void)
1550{
1551 return 0x80000000;
1552}
1553static inline u32 gr_pd_ab_dist_cfg0_timeslice_enable_dis_f(void)
1554{
1555 return 0x0;
1556}
1557static inline u32 gr_pd_ab_dist_cfg1_r(void)
1558{
1559 return 0x004064c4;
1560}
1561static inline u32 gr_pd_ab_dist_cfg1_max_batches_init_f(void)
1562{
1563 return 0xffff;
1564}
1565static inline u32 gr_pd_ab_dist_cfg1_max_output_f(u32 v)
1566{
1567 return (v & 0xffff) << 16;
1568}
1569static inline u32 gr_pd_ab_dist_cfg1_max_output_granularity_v(void)
1570{
1571 return 0x00000080;
1572}
1573static inline u32 gr_pd_ab_dist_cfg2_r(void)
1574{
1575 return 0x004064c8;
1576}
1577static inline u32 gr_pd_ab_dist_cfg2_token_limit_f(u32 v)
1578{
1579 return (v & 0x1fff) << 0;
1580}
1581static inline u32 gr_pd_ab_dist_cfg2_token_limit_init_v(void)
1582{
1583 return 0x00000900;
1584}
1585static inline u32 gr_pd_ab_dist_cfg2_state_limit_f(u32 v)
1586{
1587 return (v & 0x1fff) << 16;
1588}
1589static inline u32 gr_pd_ab_dist_cfg2_state_limit_scc_bundle_granularity_v(void)
1590{
1591 return 0x00000020;
1592}
1593static inline u32 gr_pd_ab_dist_cfg2_state_limit_min_gpm_fifo_depths_v(void)
1594{
1595 return 0x00000900;
1596}
1597static inline u32 gr_pd_dist_skip_table_r(u32 i)
1598{
1599 return 0x004064d0 + i*4;
1600}
1601static inline u32 gr_pd_dist_skip_table__size_1_v(void)
1602{
1603 return 0x00000008;
1604}
1605static inline u32 gr_pd_dist_skip_table_gpc_4n0_mask_f(u32 v)
1606{
1607 return (v & 0xff) << 0;
1608}
1609static inline u32 gr_pd_dist_skip_table_gpc_4n1_mask_f(u32 v)
1610{
1611 return (v & 0xff) << 8;
1612}
1613static inline u32 gr_pd_dist_skip_table_gpc_4n2_mask_f(u32 v)
1614{
1615 return (v & 0xff) << 16;
1616}
1617static inline u32 gr_pd_dist_skip_table_gpc_4n3_mask_f(u32 v)
1618{
1619 return (v & 0xff) << 24;
1620}
1621static inline u32 gr_ds_debug_r(void)
1622{
1623 return 0x00405800;
1624}
1625static inline u32 gr_ds_debug_timeslice_mode_disable_f(void)
1626{
1627 return 0x0;
1628}
1629static inline u32 gr_ds_debug_timeslice_mode_enable_f(void)
1630{
1631 return 0x8000000;
1632}
1633static inline u32 gr_ds_zbc_color_r_r(void)
1634{
1635 return 0x00405804;
1636}
1637static inline u32 gr_ds_zbc_color_r_val_f(u32 v)
1638{
1639 return (v & 0xffffffff) << 0;
1640}
1641static inline u32 gr_ds_zbc_color_g_r(void)
1642{
1643 return 0x00405808;
1644}
1645static inline u32 gr_ds_zbc_color_g_val_f(u32 v)
1646{
1647 return (v & 0xffffffff) << 0;
1648}
1649static inline u32 gr_ds_zbc_color_b_r(void)
1650{
1651 return 0x0040580c;
1652}
1653static inline u32 gr_ds_zbc_color_b_val_f(u32 v)
1654{
1655 return (v & 0xffffffff) << 0;
1656}
1657static inline u32 gr_ds_zbc_color_a_r(void)
1658{
1659 return 0x00405810;
1660}
1661static inline u32 gr_ds_zbc_color_a_val_f(u32 v)
1662{
1663 return (v & 0xffffffff) << 0;
1664}
1665static inline u32 gr_ds_zbc_color_fmt_r(void)
1666{
1667 return 0x00405814;
1668}
1669static inline u32 gr_ds_zbc_color_fmt_val_f(u32 v)
1670{
1671 return (v & 0x7f) << 0;
1672}
1673static inline u32 gr_ds_zbc_color_fmt_val_invalid_f(void)
1674{
1675 return 0x0;
1676}
1677static inline u32 gr_ds_zbc_color_fmt_val_zero_v(void)
1678{
1679 return 0x00000001;
1680}
1681static inline u32 gr_ds_zbc_color_fmt_val_unorm_one_v(void)
1682{
1683 return 0x00000002;
1684}
1685static inline u32 gr_ds_zbc_color_fmt_val_rf32_gf32_bf32_af32_v(void)
1686{
1687 return 0x00000004;
1688}
1689static inline u32 gr_ds_zbc_color_fmt_val_a8_b8_g8_r8_v(void)
1690{
1691 return 0x00000028;
1692}
1693static inline u32 gr_ds_zbc_z_r(void)
1694{
1695 return 0x00405818;
1696}
1697static inline u32 gr_ds_zbc_z_val_s(void)
1698{
1699 return 32;
1700}
1701static inline u32 gr_ds_zbc_z_val_f(u32 v)
1702{
1703 return (v & 0xffffffff) << 0;
1704}
1705static inline u32 gr_ds_zbc_z_val_m(void)
1706{
1707 return 0xffffffff << 0;
1708}
1709static inline u32 gr_ds_zbc_z_val_v(u32 r)
1710{
1711 return (r >> 0) & 0xffffffff;
1712}
1713static inline u32 gr_ds_zbc_z_val__init_v(void)
1714{
1715 return 0x00000000;
1716}
1717static inline u32 gr_ds_zbc_z_val__init_f(void)
1718{
1719 return 0x0;
1720}
1721static inline u32 gr_ds_zbc_z_fmt_r(void)
1722{
1723 return 0x0040581c;
1724}
1725static inline u32 gr_ds_zbc_z_fmt_val_f(u32 v)
1726{
1727 return (v & 0x1) << 0;
1728}
1729static inline u32 gr_ds_zbc_z_fmt_val_invalid_f(void)
1730{
1731 return 0x0;
1732}
1733static inline u32 gr_ds_zbc_z_fmt_val_fp32_v(void)
1734{
1735 return 0x00000001;
1736}
1737static inline u32 gr_ds_zbc_tbl_index_r(void)
1738{
1739 return 0x00405820;
1740}
1741static inline u32 gr_ds_zbc_tbl_index_val_f(u32 v)
1742{
1743 return (v & 0xf) << 0;
1744}
1745static inline u32 gr_ds_zbc_tbl_ld_r(void)
1746{
1747 return 0x00405824;
1748}
1749static inline u32 gr_ds_zbc_tbl_ld_select_c_f(void)
1750{
1751 return 0x0;
1752}
1753static inline u32 gr_ds_zbc_tbl_ld_select_z_f(void)
1754{
1755 return 0x1;
1756}
1757static inline u32 gr_ds_zbc_tbl_ld_action_write_f(void)
1758{
1759 return 0x0;
1760}
1761static inline u32 gr_ds_zbc_tbl_ld_trigger_active_f(void)
1762{
1763 return 0x4;
1764}
1765static inline u32 gr_ds_tga_constraintlogic_beta_r(void)
1766{
1767 return 0x00405830;
1768}
1769static inline u32 gr_ds_tga_constraintlogic_beta_cbsize_f(u32 v)
1770{
1771 return (v & 0x3fffff) << 0;
1772}
1773static inline u32 gr_ds_tga_constraintlogic_alpha_r(void)
1774{
1775 return 0x0040585c;
1776}
1777static inline u32 gr_ds_tga_constraintlogic_alpha_cbsize_f(u32 v)
1778{
1779 return (v & 0xffff) << 0;
1780}
1781static inline u32 gr_ds_hww_esr_r(void)
1782{
1783 return 0x00405840;
1784}
1785static inline u32 gr_ds_hww_esr_reset_s(void)
1786{
1787 return 1;
1788}
1789static inline u32 gr_ds_hww_esr_reset_f(u32 v)
1790{
1791 return (v & 0x1) << 30;
1792}
1793static inline u32 gr_ds_hww_esr_reset_m(void)
1794{
1795 return 0x1 << 30;
1796}
1797static inline u32 gr_ds_hww_esr_reset_v(u32 r)
1798{
1799 return (r >> 30) & 0x1;
1800}
1801static inline u32 gr_ds_hww_esr_reset_task_v(void)
1802{
1803 return 0x00000001;
1804}
1805static inline u32 gr_ds_hww_esr_reset_task_f(void)
1806{
1807 return 0x40000000;
1808}
1809static inline u32 gr_ds_hww_esr_en_enabled_f(void)
1810{
1811 return 0x80000000;
1812}
1813static inline u32 gr_ds_hww_esr_2_r(void)
1814{
1815 return 0x00405848;
1816}
1817static inline u32 gr_ds_hww_esr_2_reset_s(void)
1818{
1819 return 1;
1820}
1821static inline u32 gr_ds_hww_esr_2_reset_f(u32 v)
1822{
1823 return (v & 0x1) << 30;
1824}
1825static inline u32 gr_ds_hww_esr_2_reset_m(void)
1826{
1827 return 0x1 << 30;
1828}
1829static inline u32 gr_ds_hww_esr_2_reset_v(u32 r)
1830{
1831 return (r >> 30) & 0x1;
1832}
1833static inline u32 gr_ds_hww_esr_2_reset_task_v(void)
1834{
1835 return 0x00000001;
1836}
1837static inline u32 gr_ds_hww_esr_2_reset_task_f(void)
1838{
1839 return 0x40000000;
1840}
1841static inline u32 gr_ds_hww_esr_2_en_enabled_f(void)
1842{
1843 return 0x80000000;
1844}
1845static inline u32 gr_ds_hww_report_mask_r(void)
1846{
1847 return 0x00405844;
1848}
1849static inline u32 gr_ds_hww_report_mask_sph0_err_report_f(void)
1850{
1851 return 0x1;
1852}
1853static inline u32 gr_ds_hww_report_mask_sph1_err_report_f(void)
1854{
1855 return 0x2;
1856}
1857static inline u32 gr_ds_hww_report_mask_sph2_err_report_f(void)
1858{
1859 return 0x4;
1860}
1861static inline u32 gr_ds_hww_report_mask_sph3_err_report_f(void)
1862{
1863 return 0x8;
1864}
1865static inline u32 gr_ds_hww_report_mask_sph4_err_report_f(void)
1866{
1867 return 0x10;
1868}
1869static inline u32 gr_ds_hww_report_mask_sph5_err_report_f(void)
1870{
1871 return 0x20;
1872}
1873static inline u32 gr_ds_hww_report_mask_sph6_err_report_f(void)
1874{
1875 return 0x40;
1876}
1877static inline u32 gr_ds_hww_report_mask_sph7_err_report_f(void)
1878{
1879 return 0x80;
1880}
1881static inline u32 gr_ds_hww_report_mask_sph8_err_report_f(void)
1882{
1883 return 0x100;
1884}
1885static inline u32 gr_ds_hww_report_mask_sph9_err_report_f(void)
1886{
1887 return 0x200;
1888}
1889static inline u32 gr_ds_hww_report_mask_sph10_err_report_f(void)
1890{
1891 return 0x400;
1892}
1893static inline u32 gr_ds_hww_report_mask_sph11_err_report_f(void)
1894{
1895 return 0x800;
1896}
1897static inline u32 gr_ds_hww_report_mask_sph12_err_report_f(void)
1898{
1899 return 0x1000;
1900}
1901static inline u32 gr_ds_hww_report_mask_sph13_err_report_f(void)
1902{
1903 return 0x2000;
1904}
1905static inline u32 gr_ds_hww_report_mask_sph14_err_report_f(void)
1906{
1907 return 0x4000;
1908}
1909static inline u32 gr_ds_hww_report_mask_sph15_err_report_f(void)
1910{
1911 return 0x8000;
1912}
1913static inline u32 gr_ds_hww_report_mask_sph16_err_report_f(void)
1914{
1915 return 0x10000;
1916}
1917static inline u32 gr_ds_hww_report_mask_sph17_err_report_f(void)
1918{
1919 return 0x20000;
1920}
1921static inline u32 gr_ds_hww_report_mask_sph18_err_report_f(void)
1922{
1923 return 0x40000;
1924}
1925static inline u32 gr_ds_hww_report_mask_sph19_err_report_f(void)
1926{
1927 return 0x80000;
1928}
1929static inline u32 gr_ds_hww_report_mask_sph20_err_report_f(void)
1930{
1931 return 0x100000;
1932}
1933static inline u32 gr_ds_hww_report_mask_sph21_err_report_f(void)
1934{
1935 return 0x200000;
1936}
1937static inline u32 gr_ds_hww_report_mask_sph22_err_report_f(void)
1938{
1939 return 0x400000;
1940}
1941static inline u32 gr_ds_hww_report_mask_sph23_err_report_f(void)
1942{
1943 return 0x800000;
1944}
1945static inline u32 gr_ds_hww_report_mask_2_r(void)
1946{
1947 return 0x0040584c;
1948}
1949static inline u32 gr_ds_hww_report_mask_2_sph24_err_report_f(void)
1950{
1951 return 0x1;
1952}
1953static inline u32 gr_ds_num_tpc_per_gpc_r(u32 i)
1954{
1955 return 0x00405870 + i*4;
1956}
1957static inline u32 gr_scc_bundle_cb_base_r(void)
1958{
1959 return 0x00408004;
1960}
1961static inline u32 gr_scc_bundle_cb_base_addr_39_8_f(u32 v)
1962{
1963 return (v & 0xffffffff) << 0;
1964}
1965static inline u32 gr_scc_bundle_cb_base_addr_39_8_align_bits_v(void)
1966{
1967 return 0x00000008;
1968}
1969static inline u32 gr_scc_bundle_cb_size_r(void)
1970{
1971 return 0x00408008;
1972}
1973static inline u32 gr_scc_bundle_cb_size_div_256b_f(u32 v)
1974{
1975 return (v & 0x7ff) << 0;
1976}
1977static inline u32 gr_scc_bundle_cb_size_div_256b__prod_v(void)
1978{
1979 return 0x00000030;
1980}
1981static inline u32 gr_scc_bundle_cb_size_div_256b_byte_granularity_v(void)
1982{
1983 return 0x00000100;
1984}
1985static inline u32 gr_scc_bundle_cb_size_valid_false_v(void)
1986{
1987 return 0x00000000;
1988}
1989static inline u32 gr_scc_bundle_cb_size_valid_false_f(void)
1990{
1991 return 0x0;
1992}
1993static inline u32 gr_scc_bundle_cb_size_valid_true_f(void)
1994{
1995 return 0x80000000;
1996}
1997static inline u32 gr_scc_pagepool_base_r(void)
1998{
1999 return 0x0040800c;
2000}
2001static inline u32 gr_scc_pagepool_base_addr_39_8_f(u32 v)
2002{
2003 return (v & 0xffffffff) << 0;
2004}
2005static inline u32 gr_scc_pagepool_base_addr_39_8_align_bits_v(void)
2006{
2007 return 0x00000008;
2008}
2009static inline u32 gr_scc_pagepool_r(void)
2010{
2011 return 0x00408010;
2012}
2013static inline u32 gr_scc_pagepool_total_pages_f(u32 v)
2014{
2015 return (v & 0x3ff) << 0;
2016}
2017static inline u32 gr_scc_pagepool_total_pages_hwmax_v(void)
2018{
2019 return 0x00000000;
2020}
2021static inline u32 gr_scc_pagepool_total_pages_hwmax_value_v(void)
2022{
2023 return 0x00000200;
2024}
2025static inline u32 gr_scc_pagepool_total_pages_byte_granularity_v(void)
2026{
2027 return 0x00000100;
2028}
2029static inline u32 gr_scc_pagepool_max_valid_pages_s(void)
2030{
2031 return 10;
2032}
2033static inline u32 gr_scc_pagepool_max_valid_pages_f(u32 v)
2034{
2035 return (v & 0x3ff) << 10;
2036}
2037static inline u32 gr_scc_pagepool_max_valid_pages_m(void)
2038{
2039 return 0x3ff << 10;
2040}
2041static inline u32 gr_scc_pagepool_max_valid_pages_v(u32 r)
2042{
2043 return (r >> 10) & 0x3ff;
2044}
2045static inline u32 gr_scc_pagepool_valid_true_f(void)
2046{
2047 return 0x80000000;
2048}
2049static inline u32 gr_scc_init_r(void)
2050{
2051 return 0x0040802c;
2052}
2053static inline u32 gr_scc_init_ram_trigger_f(void)
2054{
2055 return 0x1;
2056}
2057static inline u32 gr_scc_hww_esr_r(void)
2058{
2059 return 0x00408030;
2060}
2061static inline u32 gr_scc_hww_esr_reset_active_f(void)
2062{
2063 return 0x40000000;
2064}
2065static inline u32 gr_scc_hww_esr_en_enable_f(void)
2066{
2067 return 0x80000000;
2068}
2069static inline u32 gr_sked_hww_esr_r(void)
2070{
2071 return 0x00407020;
2072}
2073static inline u32 gr_sked_hww_esr_reset_active_f(void)
2074{
2075 return 0x40000000;
2076}
2077static inline u32 gr_cwd_fs_r(void)
2078{
2079 return 0x00405b00;
2080}
2081static inline u32 gr_cwd_fs_num_gpcs_f(u32 v)
2082{
2083 return (v & 0xff) << 0;
2084}
2085static inline u32 gr_cwd_fs_num_tpcs_f(u32 v)
2086{
2087 return (v & 0xff) << 8;
2088}
2089static inline u32 gr_cwd_gpc_tpc_id_r(u32 i)
2090{
2091 return 0x00405b60 + i*4;
2092}
2093static inline u32 gr_cwd_gpc_tpc_id_tpc0_f(u32 v)
2094{
2095 return (v & 0xf) << 0;
2096}
2097static inline u32 gr_cwd_gpc_tpc_id_tpc1_f(u32 v)
2098{
2099 return (v & 0xf) << 8;
2100}
2101static inline u32 gr_cwd_sm_id_r(u32 i)
2102{
2103 return 0x00405ba0 + i*4;
2104}
2105static inline u32 gr_cwd_sm_id_tpc0_f(u32 v)
2106{
2107 return (v & 0xff) << 0;
2108}
2109static inline u32 gr_cwd_sm_id_tpc1_f(u32 v)
2110{
2111 return (v & 0xff) << 8;
2112}
2113static inline u32 gr_gpc0_fs_gpc_r(void)
2114{
2115 return 0x00502608;
2116}
2117static inline u32 gr_gpc0_fs_gpc_num_available_tpcs_v(u32 r)
2118{
2119 return (r >> 0) & 0x1f;
2120}
2121static inline u32 gr_gpc0_fs_gpc_num_available_zculls_v(u32 r)
2122{
2123 return (r >> 16) & 0x1f;
2124}
2125static inline u32 gr_gpc0_cfg_r(void)
2126{
2127 return 0x00502620;
2128}
2129static inline u32 gr_gpc0_cfg_imem_sz_v(u32 r)
2130{
2131 return (r >> 0) & 0xff;
2132}
2133static inline u32 gr_gpccs_rc_lanes_r(void)
2134{
2135 return 0x00502880;
2136}
2137static inline u32 gr_gpccs_rc_lanes_num_chains_s(void)
2138{
2139 return 6;
2140}
2141static inline u32 gr_gpccs_rc_lanes_num_chains_f(u32 v)
2142{
2143 return (v & 0x3f) << 0;
2144}
2145static inline u32 gr_gpccs_rc_lanes_num_chains_m(void)
2146{
2147 return 0x3f << 0;
2148}
2149static inline u32 gr_gpccs_rc_lanes_num_chains_v(u32 r)
2150{
2151 return (r >> 0) & 0x3f;
2152}
2153static inline u32 gr_gpccs_rc_lane_size_r(void)
2154{
2155 return 0x00502910;
2156}
2157static inline u32 gr_gpccs_rc_lane_size_v_s(void)
2158{
2159 return 24;
2160}
2161static inline u32 gr_gpccs_rc_lane_size_v_f(u32 v)
2162{
2163 return (v & 0xffffff) << 0;
2164}
2165static inline u32 gr_gpccs_rc_lane_size_v_m(void)
2166{
2167 return 0xffffff << 0;
2168}
2169static inline u32 gr_gpccs_rc_lane_size_v_v(u32 r)
2170{
2171 return (r >> 0) & 0xffffff;
2172}
2173static inline u32 gr_gpccs_rc_lane_size_v_0_v(void)
2174{
2175 return 0x00000000;
2176}
2177static inline u32 gr_gpccs_rc_lane_size_v_0_f(void)
2178{
2179 return 0x0;
2180}
2181static inline u32 gr_gpc0_zcull_fs_r(void)
2182{
2183 return 0x00500910;
2184}
2185static inline u32 gr_gpc0_zcull_fs_num_sms_f(u32 v)
2186{
2187 return (v & 0x1ff) << 0;
2188}
2189static inline u32 gr_gpc0_zcull_fs_num_active_banks_f(u32 v)
2190{
2191 return (v & 0xf) << 16;
2192}
2193static inline u32 gr_gpc0_zcull_ram_addr_r(void)
2194{
2195 return 0x00500914;
2196}
2197static inline u32 gr_gpc0_zcull_ram_addr_tiles_per_hypertile_row_per_gpc_f(u32 v)
2198{
2199 return (v & 0xf) << 0;
2200}
2201static inline u32 gr_gpc0_zcull_ram_addr_row_offset_f(u32 v)
2202{
2203 return (v & 0xf) << 8;
2204}
2205static inline u32 gr_gpc0_zcull_sm_num_rcp_r(void)
2206{
2207 return 0x00500918;
2208}
2209static inline u32 gr_gpc0_zcull_sm_num_rcp_conservative_f(u32 v)
2210{
2211 return (v & 0xffffff) << 0;
2212}
2213static inline u32 gr_gpc0_zcull_sm_num_rcp_conservative__max_v(void)
2214{
2215 return 0x00800000;
2216}
2217static inline u32 gr_gpc0_zcull_total_ram_size_r(void)
2218{
2219 return 0x00500920;
2220}
2221static inline u32 gr_gpc0_zcull_total_ram_size_num_aliquots_f(u32 v)
2222{
2223 return (v & 0xffff) << 0;
2224}
2225static inline u32 gr_gpc0_zcull_zcsize_r(u32 i)
2226{
2227 return 0x00500a04 + i*32;
2228}
2229static inline u32 gr_gpc0_zcull_zcsize_height_subregion__multiple_v(void)
2230{
2231 return 0x00000040;
2232}
2233static inline u32 gr_gpc0_zcull_zcsize_width_subregion__multiple_v(void)
2234{
2235 return 0x00000010;
2236}
2237static inline u32 gr_gpc0_gpm_pd_sm_id_r(u32 i)
2238{
2239 return 0x00500c10 + i*4;
2240}
2241static inline u32 gr_gpc0_gpm_pd_sm_id_id_f(u32 v)
2242{
2243 return (v & 0xff) << 0;
2244}
2245static inline u32 gr_gpc0_gpm_pd_pes_tpc_id_mask_r(u32 i)
2246{
2247 return 0x00500c30 + i*4;
2248}
2249static inline u32 gr_gpc0_gpm_pd_pes_tpc_id_mask_mask_v(u32 r)
2250{
2251 return (r >> 0) & 0xff;
2252}
2253static inline u32 gr_gpc0_tpc0_pe_cfg_smid_r(void)
2254{
2255 return 0x00504088;
2256}
2257static inline u32 gr_gpc0_tpc0_pe_cfg_smid_value_f(u32 v)
2258{
2259 return (v & 0xffff) << 0;
2260}
2261static inline u32 gr_gpc0_tpc0_sm_cfg_r(void)
2262{
2263 return 0x00504698;
2264}
2265static inline u32 gr_gpc0_tpc0_sm_cfg_sm_id_f(u32 v)
2266{
2267 return (v & 0xffff) << 0;
2268}
2269static inline u32 gr_gpc0_tpc0_sm_arch_r(void)
2270{
2271 return 0x0050469c;
2272}
2273static inline u32 gr_gpc0_tpc0_sm_arch_warp_count_v(u32 r)
2274{
2275 return (r >> 0) & 0xff;
2276}
2277static inline u32 gr_gpc0_tpc0_sm_arch_spa_version_v(u32 r)
2278{
2279 return (r >> 8) & 0xfff;
2280}
2281static inline u32 gr_gpc0_tpc0_sm_arch_sm_version_v(u32 r)
2282{
2283 return (r >> 20) & 0xfff;
2284}
2285static inline u32 gr_gpc0_ppc0_pes_vsc_strem_r(void)
2286{
2287 return 0x00503018;
2288}
2289static inline u32 gr_gpc0_ppc0_pes_vsc_strem_master_pe_m(void)
2290{
2291 return 0x1 << 0;
2292}
2293static inline u32 gr_gpc0_ppc0_pes_vsc_strem_master_pe_true_f(void)
2294{
2295 return 0x1;
2296}
2297static inline u32 gr_gpc0_ppc0_cbm_beta_cb_size_r(void)
2298{
2299 return 0x005030c0;
2300}
2301static inline u32 gr_gpc0_ppc0_cbm_beta_cb_size_v_f(u32 v)
2302{
2303 return (v & 0x3fffff) << 0;
2304}
2305static inline u32 gr_gpc0_ppc0_cbm_beta_cb_size_v_m(void)
2306{
2307 return 0x3fffff << 0;
2308}
2309static inline u32 gr_gpc0_ppc0_cbm_beta_cb_size_v_default_v(void)
2310{
2311 return 0x00000320;
2312}
2313static inline u32 gr_gpc0_ppc0_cbm_beta_cb_size_v_gfxp_v(void)
2314{
2315 return 0x00000ba8;
2316}
2317static inline u32 gr_gpc0_ppc0_cbm_beta_cb_size_v_granularity_v(void)
2318{
2319 return 0x00000020;
2320}
2321static inline u32 gr_gpc0_ppc0_cbm_beta_cb_offset_r(void)
2322{
2323 return 0x005030f4;
2324}
2325static inline u32 gr_gpc0_ppc0_cbm_alpha_cb_size_r(void)
2326{
2327 return 0x005030e4;
2328}
2329static inline u32 gr_gpc0_ppc0_cbm_alpha_cb_size_v_f(u32 v)
2330{
2331 return (v & 0xffff) << 0;
2332}
2333static inline u32 gr_gpc0_ppc0_cbm_alpha_cb_size_v_m(void)
2334{
2335 return 0xffff << 0;
2336}
2337static inline u32 gr_gpc0_ppc0_cbm_alpha_cb_size_v_default_v(void)
2338{
2339 return 0x00000800;
2340}
2341static inline u32 gr_gpc0_ppc0_cbm_alpha_cb_size_v_granularity_v(void)
2342{
2343 return 0x00000020;
2344}
2345static inline u32 gr_gpc0_ppc0_cbm_alpha_cb_offset_r(void)
2346{
2347 return 0x005030f8;
2348}
2349static inline u32 gr_gpc0_ppc0_cbm_beta_steady_state_cb_size_r(void)
2350{
2351 return 0x005030f0;
2352}
2353static inline u32 gr_gpc0_ppc0_cbm_beta_steady_state_cb_size_v_f(u32 v)
2354{
2355 return (v & 0x3fffff) << 0;
2356}
2357static inline u32 gr_gpc0_ppc0_cbm_beta_steady_state_cb_size_v_default_v(void)
2358{
2359 return 0x00000320;
2360}
2361static inline u32 gr_gpcs_tpcs_tex_rm_cb_0_r(void)
2362{
2363 return 0x00419b00;
2364}
2365static inline u32 gr_gpcs_tpcs_tex_rm_cb_0_base_addr_43_12_f(u32 v)
2366{
2367 return (v & 0xffffffff) << 0;
2368}
2369static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_r(void)
2370{
2371 return 0x00419b04;
2372}
2373static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_size_div_128b_s(void)
2374{
2375 return 21;
2376}
2377static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_size_div_128b_f(u32 v)
2378{
2379 return (v & 0x1fffff) << 0;
2380}
2381static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_size_div_128b_m(void)
2382{
2383 return 0x1fffff << 0;
2384}
2385static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_size_div_128b_v(u32 r)
2386{
2387 return (r >> 0) & 0x1fffff;
2388}
2389static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_size_div_128b_granularity_f(void)
2390{
2391 return 0x80;
2392}
2393static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_valid_s(void)
2394{
2395 return 1;
2396}
2397static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_valid_f(u32 v)
2398{
2399 return (v & 0x1) << 31;
2400}
2401static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_valid_m(void)
2402{
2403 return 0x1 << 31;
2404}
2405static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_valid_v(u32 r)
2406{
2407 return (r >> 31) & 0x1;
2408}
2409static inline u32 gr_gpcs_tpcs_tex_rm_cb_1_valid_true_f(void)
2410{
2411 return 0x80000000;
2412}
2413static inline u32 gr_gpccs_falcon_addr_r(void)
2414{
2415 return 0x0041a0ac;
2416}
2417static inline u32 gr_gpccs_falcon_addr_lsb_s(void)
2418{
2419 return 6;
2420}
2421static inline u32 gr_gpccs_falcon_addr_lsb_f(u32 v)
2422{
2423 return (v & 0x3f) << 0;
2424}
2425static inline u32 gr_gpccs_falcon_addr_lsb_m(void)
2426{
2427 return 0x3f << 0;
2428}
2429static inline u32 gr_gpccs_falcon_addr_lsb_v(u32 r)
2430{
2431 return (r >> 0) & 0x3f;
2432}
2433static inline u32 gr_gpccs_falcon_addr_lsb_init_v(void)
2434{
2435 return 0x00000000;
2436}
2437static inline u32 gr_gpccs_falcon_addr_lsb_init_f(void)
2438{
2439 return 0x0;
2440}
2441static inline u32 gr_gpccs_falcon_addr_msb_s(void)
2442{
2443 return 6;
2444}
2445static inline u32 gr_gpccs_falcon_addr_msb_f(u32 v)
2446{
2447 return (v & 0x3f) << 6;
2448}
2449static inline u32 gr_gpccs_falcon_addr_msb_m(void)
2450{
2451 return 0x3f << 6;
2452}
2453static inline u32 gr_gpccs_falcon_addr_msb_v(u32 r)
2454{
2455 return (r >> 6) & 0x3f;
2456}
2457static inline u32 gr_gpccs_falcon_addr_msb_init_v(void)
2458{
2459 return 0x00000000;
2460}
2461static inline u32 gr_gpccs_falcon_addr_msb_init_f(void)
2462{
2463 return 0x0;
2464}
2465static inline u32 gr_gpccs_falcon_addr_ext_s(void)
2466{
2467 return 12;
2468}
2469static inline u32 gr_gpccs_falcon_addr_ext_f(u32 v)
2470{
2471 return (v & 0xfff) << 0;
2472}
2473static inline u32 gr_gpccs_falcon_addr_ext_m(void)
2474{
2475 return 0xfff << 0;
2476}
2477static inline u32 gr_gpccs_falcon_addr_ext_v(u32 r)
2478{
2479 return (r >> 0) & 0xfff;
2480}
2481static inline u32 gr_gpccs_cpuctl_r(void)
2482{
2483 return 0x0041a100;
2484}
2485static inline u32 gr_gpccs_cpuctl_startcpu_f(u32 v)
2486{
2487 return (v & 0x1) << 1;
2488}
2489static inline u32 gr_gpccs_dmactl_r(void)
2490{
2491 return 0x0041a10c;
2492}
2493static inline u32 gr_gpccs_dmactl_require_ctx_f(u32 v)
2494{
2495 return (v & 0x1) << 0;
2496}
2497static inline u32 gr_gpccs_dmactl_dmem_scrubbing_m(void)
2498{
2499 return 0x1 << 1;
2500}
2501static inline u32 gr_gpccs_dmactl_imem_scrubbing_m(void)
2502{
2503 return 0x1 << 2;
2504}
2505static inline u32 gr_gpccs_imemc_r(u32 i)
2506{
2507 return 0x0041a180 + i*16;
2508}
2509static inline u32 gr_gpccs_imemc_offs_f(u32 v)
2510{
2511 return (v & 0x3f) << 2;
2512}
2513static inline u32 gr_gpccs_imemc_blk_f(u32 v)
2514{
2515 return (v & 0xff) << 8;
2516}
2517static inline u32 gr_gpccs_imemc_aincw_f(u32 v)
2518{
2519 return (v & 0x1) << 24;
2520}
2521static inline u32 gr_gpccs_imemd_r(u32 i)
2522{
2523 return 0x0041a184 + i*16;
2524}
2525static inline u32 gr_gpccs_imemt_r(u32 i)
2526{
2527 return 0x0041a188 + i*16;
2528}
2529static inline u32 gr_gpccs_imemt__size_1_v(void)
2530{
2531 return 0x00000004;
2532}
2533static inline u32 gr_gpccs_imemt_tag_f(u32 v)
2534{
2535 return (v & 0xffff) << 0;
2536}
2537static inline u32 gr_gpccs_dmemc_r(u32 i)
2538{
2539 return 0x0041a1c0 + i*8;
2540}
2541static inline u32 gr_gpccs_dmemc_offs_f(u32 v)
2542{
2543 return (v & 0x3f) << 2;
2544}
2545static inline u32 gr_gpccs_dmemc_blk_f(u32 v)
2546{
2547 return (v & 0xff) << 8;
2548}
2549static inline u32 gr_gpccs_dmemc_aincw_f(u32 v)
2550{
2551 return (v & 0x1) << 24;
2552}
2553static inline u32 gr_gpccs_dmemd_r(u32 i)
2554{
2555 return 0x0041a1c4 + i*8;
2556}
2557static inline u32 gr_gpccs_ctxsw_mailbox_r(u32 i)
2558{
2559 return 0x0041a800 + i*4;
2560}
2561static inline u32 gr_gpccs_ctxsw_mailbox_value_f(u32 v)
2562{
2563 return (v & 0xffffffff) << 0;
2564}
2565static inline u32 gr_gpcs_swdx_bundle_cb_base_r(void)
2566{
2567 return 0x00418e24;
2568}
2569static inline u32 gr_gpcs_swdx_bundle_cb_base_addr_39_8_s(void)
2570{
2571 return 32;
2572}
2573static inline u32 gr_gpcs_swdx_bundle_cb_base_addr_39_8_f(u32 v)
2574{
2575 return (v & 0xffffffff) << 0;
2576}
2577static inline u32 gr_gpcs_swdx_bundle_cb_base_addr_39_8_m(void)
2578{
2579 return 0xffffffff << 0;
2580}
2581static inline u32 gr_gpcs_swdx_bundle_cb_base_addr_39_8_v(u32 r)
2582{
2583 return (r >> 0) & 0xffffffff;
2584}
2585static inline u32 gr_gpcs_swdx_bundle_cb_base_addr_39_8_init_v(void)
2586{
2587 return 0x00000000;
2588}
2589static inline u32 gr_gpcs_swdx_bundle_cb_base_addr_39_8_init_f(void)
2590{
2591 return 0x0;
2592}
2593static inline u32 gr_gpcs_swdx_bundle_cb_size_r(void)
2594{
2595 return 0x00418e28;
2596}
2597static inline u32 gr_gpcs_swdx_bundle_cb_size_div_256b_s(void)
2598{
2599 return 11;
2600}
2601static inline u32 gr_gpcs_swdx_bundle_cb_size_div_256b_f(u32 v)
2602{
2603 return (v & 0x7ff) << 0;
2604}
2605static inline u32 gr_gpcs_swdx_bundle_cb_size_div_256b_m(void)
2606{
2607 return 0x7ff << 0;
2608}
2609static inline u32 gr_gpcs_swdx_bundle_cb_size_div_256b_v(u32 r)
2610{
2611 return (r >> 0) & 0x7ff;
2612}
2613static inline u32 gr_gpcs_swdx_bundle_cb_size_div_256b_init_v(void)
2614{
2615 return 0x00000030;
2616}
2617static inline u32 gr_gpcs_swdx_bundle_cb_size_div_256b_init_f(void)
2618{
2619 return 0x30;
2620}
2621static inline u32 gr_gpcs_swdx_bundle_cb_size_valid_s(void)
2622{
2623 return 1;
2624}
2625static inline u32 gr_gpcs_swdx_bundle_cb_size_valid_f(u32 v)
2626{
2627 return (v & 0x1) << 31;
2628}
2629static inline u32 gr_gpcs_swdx_bundle_cb_size_valid_m(void)
2630{
2631 return 0x1 << 31;
2632}
2633static inline u32 gr_gpcs_swdx_bundle_cb_size_valid_v(u32 r)
2634{
2635 return (r >> 31) & 0x1;
2636}
2637static inline u32 gr_gpcs_swdx_bundle_cb_size_valid_false_v(void)
2638{
2639 return 0x00000000;
2640}
2641static inline u32 gr_gpcs_swdx_bundle_cb_size_valid_false_f(void)
2642{
2643 return 0x0;
2644}
2645static inline u32 gr_gpcs_swdx_bundle_cb_size_valid_true_v(void)
2646{
2647 return 0x00000001;
2648}
2649static inline u32 gr_gpcs_swdx_bundle_cb_size_valid_true_f(void)
2650{
2651 return 0x80000000;
2652}
2653static inline u32 gr_gpc0_swdx_rm_spill_buffer_size_r(void)
2654{
2655 return 0x005001dc;
2656}
2657static inline u32 gr_gpc0_swdx_rm_spill_buffer_size_256b_f(u32 v)
2658{
2659 return (v & 0xffff) << 0;
2660}
2661static inline u32 gr_gpc0_swdx_rm_spill_buffer_size_256b_default_v(void)
2662{
2663 return 0x00000de0;
2664}
2665static inline u32 gr_gpc0_swdx_rm_spill_buffer_size_256b_byte_granularity_v(void)
2666{
2667 return 0x00000100;
2668}
2669static inline u32 gr_gpc0_swdx_rm_spill_buffer_addr_r(void)
2670{
2671 return 0x005001d8;
2672}
2673static inline u32 gr_gpc0_swdx_rm_spill_buffer_addr_39_8_f(u32 v)
2674{
2675 return (v & 0xffffffff) << 0;
2676}
2677static inline u32 gr_gpc0_swdx_rm_spill_buffer_addr_39_8_align_bits_v(void)
2678{
2679 return 0x00000008;
2680}
2681static inline u32 gr_gpcs_swdx_beta_cb_ctrl_r(void)
2682{
2683 return 0x004181e4;
2684}
2685static inline u32 gr_gpcs_swdx_beta_cb_ctrl_cbes_reserve_f(u32 v)
2686{
2687 return (v & 0xfff) << 0;
2688}
2689static inline u32 gr_gpcs_swdx_beta_cb_ctrl_cbes_reserve_gfxp_v(void)
2690{
2691 return 0x00000100;
2692}
2693static inline u32 gr_gpcs_ppcs_cbm_beta_cb_ctrl_r(void)
2694{
2695 return 0x0041befc;
2696}
2697static inline u32 gr_gpcs_ppcs_cbm_beta_cb_ctrl_cbes_reserve_f(u32 v)
2698{
2699 return (v & 0xfff) << 0;
2700}
2701static inline u32 gr_gpcs_swdx_tc_beta_cb_size_r(u32 i)
2702{
2703 return 0x00418ea0 + i*4;
2704}
2705static inline u32 gr_gpcs_swdx_tc_beta_cb_size_v_f(u32 v)
2706{
2707 return (v & 0x3fffff) << 0;
2708}
2709static inline u32 gr_gpcs_swdx_tc_beta_cb_size_v_m(void)
2710{
2711 return 0x3fffff << 0;
2712}
2713static inline u32 gr_gpcs_swdx_dss_zbc_color_r_r(u32 i)
2714{
2715 return 0x00418010 + i*4;
2716}
2717static inline u32 gr_gpcs_swdx_dss_zbc_color_r_val_f(u32 v)
2718{
2719 return (v & 0xffffffff) << 0;
2720}
2721static inline u32 gr_gpcs_swdx_dss_zbc_color_g_r(u32 i)
2722{
2723 return 0x0041804c + i*4;
2724}
2725static inline u32 gr_gpcs_swdx_dss_zbc_color_g_val_f(u32 v)
2726{
2727 return (v & 0xffffffff) << 0;
2728}
2729static inline u32 gr_gpcs_swdx_dss_zbc_color_b_r(u32 i)
2730{
2731 return 0x00418088 + i*4;
2732}
2733static inline u32 gr_gpcs_swdx_dss_zbc_color_b_val_f(u32 v)
2734{
2735 return (v & 0xffffffff) << 0;
2736}
2737static inline u32 gr_gpcs_swdx_dss_zbc_color_a_r(u32 i)
2738{
2739 return 0x004180c4 + i*4;
2740}
2741static inline u32 gr_gpcs_swdx_dss_zbc_color_a_val_f(u32 v)
2742{
2743 return (v & 0xffffffff) << 0;
2744}
2745static inline u32 gr_gpcs_swdx_dss_zbc_c_01_to_04_format_r(void)
2746{
2747 return 0x00500100;
2748}
2749static inline u32 gr_gpcs_swdx_dss_zbc_z_r(u32 i)
2750{
2751 return 0x00418110 + i*4;
2752}
2753static inline u32 gr_gpcs_swdx_dss_zbc_z_val_f(u32 v)
2754{
2755 return (v & 0xffffffff) << 0;
2756}
2757static inline u32 gr_gpcs_swdx_dss_zbc_z_01_to_04_format_r(void)
2758{
2759 return 0x0050014c;
2760}
2761static inline u32 gr_gpcs_setup_attrib_cb_base_r(void)
2762{
2763 return 0x00418810;
2764}
2765static inline u32 gr_gpcs_setup_attrib_cb_base_addr_39_12_f(u32 v)
2766{
2767 return (v & 0xfffffff) << 0;
2768}
2769static inline u32 gr_gpcs_setup_attrib_cb_base_addr_39_12_align_bits_v(void)
2770{
2771 return 0x0000000c;
2772}
2773static inline u32 gr_gpcs_setup_attrib_cb_base_valid_true_f(void)
2774{
2775 return 0x80000000;
2776}
2777static inline u32 gr_crstr_gpc_map0_r(void)
2778{
2779 return 0x00418b08;
2780}
2781static inline u32 gr_crstr_gpc_map0_tile0_f(u32 v)
2782{
2783 return (v & 0x7) << 0;
2784}
2785static inline u32 gr_crstr_gpc_map0_tile1_f(u32 v)
2786{
2787 return (v & 0x7) << 5;
2788}
2789static inline u32 gr_crstr_gpc_map0_tile2_f(u32 v)
2790{
2791 return (v & 0x7) << 10;
2792}
2793static inline u32 gr_crstr_gpc_map0_tile3_f(u32 v)
2794{
2795 return (v & 0x7) << 15;
2796}
2797static inline u32 gr_crstr_gpc_map0_tile4_f(u32 v)
2798{
2799 return (v & 0x7) << 20;
2800}
2801static inline u32 gr_crstr_gpc_map0_tile5_f(u32 v)
2802{
2803 return (v & 0x7) << 25;
2804}
2805static inline u32 gr_crstr_gpc_map1_r(void)
2806{
2807 return 0x00418b0c;
2808}
2809static inline u32 gr_crstr_gpc_map1_tile6_f(u32 v)
2810{
2811 return (v & 0x7) << 0;
2812}
2813static inline u32 gr_crstr_gpc_map1_tile7_f(u32 v)
2814{
2815 return (v & 0x7) << 5;
2816}
2817static inline u32 gr_crstr_gpc_map1_tile8_f(u32 v)
2818{
2819 return (v & 0x7) << 10;
2820}
2821static inline u32 gr_crstr_gpc_map1_tile9_f(u32 v)
2822{
2823 return (v & 0x7) << 15;
2824}
2825static inline u32 gr_crstr_gpc_map1_tile10_f(u32 v)
2826{
2827 return (v & 0x7) << 20;
2828}
2829static inline u32 gr_crstr_gpc_map1_tile11_f(u32 v)
2830{
2831 return (v & 0x7) << 25;
2832}
2833static inline u32 gr_crstr_gpc_map2_r(void)
2834{
2835 return 0x00418b10;
2836}
2837static inline u32 gr_crstr_gpc_map2_tile12_f(u32 v)
2838{
2839 return (v & 0x7) << 0;
2840}
2841static inline u32 gr_crstr_gpc_map2_tile13_f(u32 v)
2842{
2843 return (v & 0x7) << 5;
2844}
2845static inline u32 gr_crstr_gpc_map2_tile14_f(u32 v)
2846{
2847 return (v & 0x7) << 10;
2848}
2849static inline u32 gr_crstr_gpc_map2_tile15_f(u32 v)
2850{
2851 return (v & 0x7) << 15;
2852}
2853static inline u32 gr_crstr_gpc_map2_tile16_f(u32 v)
2854{
2855 return (v & 0x7) << 20;
2856}
2857static inline u32 gr_crstr_gpc_map2_tile17_f(u32 v)
2858{
2859 return (v & 0x7) << 25;
2860}
2861static inline u32 gr_crstr_gpc_map3_r(void)
2862{
2863 return 0x00418b14;
2864}
2865static inline u32 gr_crstr_gpc_map3_tile18_f(u32 v)
2866{
2867 return (v & 0x7) << 0;
2868}
2869static inline u32 gr_crstr_gpc_map3_tile19_f(u32 v)
2870{
2871 return (v & 0x7) << 5;
2872}
2873static inline u32 gr_crstr_gpc_map3_tile20_f(u32 v)
2874{
2875 return (v & 0x7) << 10;
2876}
2877static inline u32 gr_crstr_gpc_map3_tile21_f(u32 v)
2878{
2879 return (v & 0x7) << 15;
2880}
2881static inline u32 gr_crstr_gpc_map3_tile22_f(u32 v)
2882{
2883 return (v & 0x7) << 20;
2884}
2885static inline u32 gr_crstr_gpc_map3_tile23_f(u32 v)
2886{
2887 return (v & 0x7) << 25;
2888}
2889static inline u32 gr_crstr_gpc_map4_r(void)
2890{
2891 return 0x00418b18;
2892}
2893static inline u32 gr_crstr_gpc_map4_tile24_f(u32 v)
2894{
2895 return (v & 0x7) << 0;
2896}
2897static inline u32 gr_crstr_gpc_map4_tile25_f(u32 v)
2898{
2899 return (v & 0x7) << 5;
2900}
2901static inline u32 gr_crstr_gpc_map4_tile26_f(u32 v)
2902{
2903 return (v & 0x7) << 10;
2904}
2905static inline u32 gr_crstr_gpc_map4_tile27_f(u32 v)
2906{
2907 return (v & 0x7) << 15;
2908}
2909static inline u32 gr_crstr_gpc_map4_tile28_f(u32 v)
2910{
2911 return (v & 0x7) << 20;
2912}
2913static inline u32 gr_crstr_gpc_map4_tile29_f(u32 v)
2914{
2915 return (v & 0x7) << 25;
2916}
2917static inline u32 gr_crstr_gpc_map5_r(void)
2918{
2919 return 0x00418b1c;
2920}
2921static inline u32 gr_crstr_gpc_map5_tile30_f(u32 v)
2922{
2923 return (v & 0x7) << 0;
2924}
2925static inline u32 gr_crstr_gpc_map5_tile31_f(u32 v)
2926{
2927 return (v & 0x7) << 5;
2928}
2929static inline u32 gr_crstr_gpc_map5_tile32_f(u32 v)
2930{
2931 return (v & 0x7) << 10;
2932}
2933static inline u32 gr_crstr_gpc_map5_tile33_f(u32 v)
2934{
2935 return (v & 0x7) << 15;
2936}
2937static inline u32 gr_crstr_gpc_map5_tile34_f(u32 v)
2938{
2939 return (v & 0x7) << 20;
2940}
2941static inline u32 gr_crstr_gpc_map5_tile35_f(u32 v)
2942{
2943 return (v & 0x7) << 25;
2944}
2945static inline u32 gr_crstr_map_table_cfg_r(void)
2946{
2947 return 0x00418bb8;
2948}
2949static inline u32 gr_crstr_map_table_cfg_row_offset_f(u32 v)
2950{
2951 return (v & 0xff) << 0;
2952}
2953static inline u32 gr_crstr_map_table_cfg_num_entries_f(u32 v)
2954{
2955 return (v & 0xff) << 8;
2956}
2957static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_r(void)
2958{
2959 return 0x00418980;
2960}
2961static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_tile_0_f(u32 v)
2962{
2963 return (v & 0x7) << 0;
2964}
2965static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_tile_1_f(u32 v)
2966{
2967 return (v & 0x7) << 4;
2968}
2969static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_tile_2_f(u32 v)
2970{
2971 return (v & 0x7) << 8;
2972}
2973static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_tile_3_f(u32 v)
2974{
2975 return (v & 0x7) << 12;
2976}
2977static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_tile_4_f(u32 v)
2978{
2979 return (v & 0x7) << 16;
2980}
2981static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_tile_5_f(u32 v)
2982{
2983 return (v & 0x7) << 20;
2984}
2985static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_tile_6_f(u32 v)
2986{
2987 return (v & 0x7) << 24;
2988}
2989static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map0_tile_7_f(u32 v)
2990{
2991 return (v & 0x7) << 28;
2992}
2993static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_r(void)
2994{
2995 return 0x00418984;
2996}
2997static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_tile_8_f(u32 v)
2998{
2999 return (v & 0x7) << 0;
3000}
3001static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_tile_9_f(u32 v)
3002{
3003 return (v & 0x7) << 4;
3004}
3005static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_tile_10_f(u32 v)
3006{
3007 return (v & 0x7) << 8;
3008}
3009static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_tile_11_f(u32 v)
3010{
3011 return (v & 0x7) << 12;
3012}
3013static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_tile_12_f(u32 v)
3014{
3015 return (v & 0x7) << 16;
3016}
3017static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_tile_13_f(u32 v)
3018{
3019 return (v & 0x7) << 20;
3020}
3021static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_tile_14_f(u32 v)
3022{
3023 return (v & 0x7) << 24;
3024}
3025static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map1_tile_15_f(u32 v)
3026{
3027 return (v & 0x7) << 28;
3028}
3029static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_r(void)
3030{
3031 return 0x00418988;
3032}
3033static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_16_f(u32 v)
3034{
3035 return (v & 0x7) << 0;
3036}
3037static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_17_f(u32 v)
3038{
3039 return (v & 0x7) << 4;
3040}
3041static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_18_f(u32 v)
3042{
3043 return (v & 0x7) << 8;
3044}
3045static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_19_f(u32 v)
3046{
3047 return (v & 0x7) << 12;
3048}
3049static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_20_f(u32 v)
3050{
3051 return (v & 0x7) << 16;
3052}
3053static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_21_f(u32 v)
3054{
3055 return (v & 0x7) << 20;
3056}
3057static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_22_f(u32 v)
3058{
3059 return (v & 0x7) << 24;
3060}
3061static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_23_s(void)
3062{
3063 return 3;
3064}
3065static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_23_f(u32 v)
3066{
3067 return (v & 0x7) << 28;
3068}
3069static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_23_m(void)
3070{
3071 return 0x7 << 28;
3072}
3073static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map2_tile_23_v(u32 r)
3074{
3075 return (r >> 28) & 0x7;
3076}
3077static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_r(void)
3078{
3079 return 0x0041898c;
3080}
3081static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_tile_24_f(u32 v)
3082{
3083 return (v & 0x7) << 0;
3084}
3085static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_tile_25_f(u32 v)
3086{
3087 return (v & 0x7) << 4;
3088}
3089static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_tile_26_f(u32 v)
3090{
3091 return (v & 0x7) << 8;
3092}
3093static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_tile_27_f(u32 v)
3094{
3095 return (v & 0x7) << 12;
3096}
3097static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_tile_28_f(u32 v)
3098{
3099 return (v & 0x7) << 16;
3100}
3101static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_tile_29_f(u32 v)
3102{
3103 return (v & 0x7) << 20;
3104}
3105static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_tile_30_f(u32 v)
3106{
3107 return (v & 0x7) << 24;
3108}
3109static inline u32 gr_gpcs_zcull_sm_in_gpc_number_map3_tile_31_f(u32 v)
3110{
3111 return (v & 0x7) << 28;
3112}
3113static inline u32 gr_gpcs_gpm_pd_cfg_r(void)
3114{
3115 return 0x00418c6c;
3116}
3117static inline u32 gr_gpcs_gpm_pd_cfg_timeslice_mode_disable_f(void)
3118{
3119 return 0x0;
3120}
3121static inline u32 gr_gpcs_gpm_pd_cfg_timeslice_mode_enable_f(void)
3122{
3123 return 0x1;
3124}
3125static inline u32 gr_gpcs_gcc_pagepool_base_r(void)
3126{
3127 return 0x00419004;
3128}
3129static inline u32 gr_gpcs_gcc_pagepool_base_addr_39_8_f(u32 v)
3130{
3131 return (v & 0xffffffff) << 0;
3132}
3133static inline u32 gr_gpcs_gcc_pagepool_r(void)
3134{
3135 return 0x00419008;
3136}
3137static inline u32 gr_gpcs_gcc_pagepool_total_pages_f(u32 v)
3138{
3139 return (v & 0x3ff) << 0;
3140}
3141static inline u32 gr_gpcs_tpcs_pe_vaf_r(void)
3142{
3143 return 0x0041980c;
3144}
3145static inline u32 gr_gpcs_tpcs_pe_vaf_fast_mode_switch_true_f(void)
3146{
3147 return 0x10;
3148}
3149static inline u32 gr_gpcs_tpcs_pe_pin_cb_global_base_addr_r(void)
3150{
3151 return 0x00419848;
3152}
3153static inline u32 gr_gpcs_tpcs_pe_pin_cb_global_base_addr_v_f(u32 v)
3154{
3155 return (v & 0xfffffff) << 0;
3156}
3157static inline u32 gr_gpcs_tpcs_pe_pin_cb_global_base_addr_valid_f(u32 v)
3158{
3159 return (v & 0x1) << 28;
3160}
3161static inline u32 gr_gpcs_tpcs_pe_pin_cb_global_base_addr_valid_true_f(void)
3162{
3163 return 0x10000000;
3164}
3165static inline u32 gr_gpcs_tpcs_mpc_vtg_debug_r(void)
3166{
3167 return 0x00419c00;
3168}
3169static inline u32 gr_gpcs_tpcs_mpc_vtg_debug_timeslice_mode_disabled_f(void)
3170{
3171 return 0x0;
3172}
3173static inline u32 gr_gpcs_tpcs_mpc_vtg_debug_timeslice_mode_enabled_f(void)
3174{
3175 return 0x8;
3176}
3177static inline u32 gr_gpcs_tpcs_mpc_vtg_cb_global_base_addr_r(void)
3178{
3179 return 0x00419c2c;
3180}
3181static inline u32 gr_gpcs_tpcs_mpc_vtg_cb_global_base_addr_v_f(u32 v)
3182{
3183 return (v & 0xfffffff) << 0;
3184}
3185static inline u32 gr_gpcs_tpcs_mpc_vtg_cb_global_base_addr_valid_f(u32 v)
3186{
3187 return (v & 0x1) << 28;
3188}
3189static inline u32 gr_gpcs_tpcs_mpc_vtg_cb_global_base_addr_valid_true_f(void)
3190{
3191 return 0x10000000;
3192}
3193static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_r(void)
3194{
3195 return 0x00419e44;
3196}
3197static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_stack_error_report_f(void)
3198{
3199 return 0x2;
3200}
3201static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_api_stack_error_report_f(void)
3202{
3203 return 0x4;
3204}
3205static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_ret_empty_stack_error_report_f(void)
3206{
3207 return 0x8;
3208}
3209static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_pc_wrap_report_f(void)
3210{
3211 return 0x10;
3212}
3213static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_misaligned_pc_report_f(void)
3214{
3215 return 0x20;
3216}
3217static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_pc_overflow_report_f(void)
3218{
3219 return 0x40;
3220}
3221static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_misaligned_immc_addr_report_f(void)
3222{
3223 return 0x80;
3224}
3225static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_misaligned_reg_report_f(void)
3226{
3227 return 0x100;
3228}
3229static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_illegal_instr_encoding_report_f(void)
3230{
3231 return 0x200;
3232}
3233static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_illegal_sph_instr_combo_report_f(void)
3234{
3235 return 0x400;
3236}
3237static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_illegal_instr_param_report_f(void)
3238{
3239 return 0x800;
3240}
3241static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_invalid_const_addr_report_f(void)
3242{
3243 return 0x1000;
3244}
3245static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_oor_reg_report_f(void)
3246{
3247 return 0x2000;
3248}
3249static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_oor_addr_report_f(void)
3250{
3251 return 0x4000;
3252}
3253static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_misaligned_addr_report_f(void)
3254{
3255 return 0x8000;
3256}
3257static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_invalid_addr_space_report_f(void)
3258{
3259 return 0x10000;
3260}
3261static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_illegal_instr_param2_report_f(void)
3262{
3263 return 0x20000;
3264}
3265static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_invalid_const_addr_ldc_report_f(void)
3266{
3267 return 0x40000;
3268}
3269static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_mmu_fault_report_f(void)
3270{
3271 return 0x800000;
3272}
3273static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_stack_overflow_report_f(void)
3274{
3275 return 0x400000;
3276}
3277static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_geometry_sm_error_report_f(void)
3278{
3279 return 0x80000;
3280}
3281static inline u32 gr_gpcs_tpcs_sm_hww_warp_esr_report_mask_divergent_report_f(void)
3282{
3283 return 0x100000;
3284}
3285static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_r(void)
3286{
3287 return 0x00419e4c;
3288}
3289static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_sm_to_sm_fault_report_f(void)
3290{
3291 return 0x1;
3292}
3293static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_l1_error_report_f(void)
3294{
3295 return 0x2;
3296}
3297static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_multiple_warp_errors_report_f(void)
3298{
3299 return 0x4;
3300}
3301static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_physical_stack_overflow_error_report_f(void)
3302{
3303 return 0x8;
3304}
3305static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_bpt_int_report_f(void)
3306{
3307 return 0x10;
3308}
3309static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_ecc_sec_error_report_f(void)
3310{
3311 return 0x20000000;
3312}
3313static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_ecc_ded_error_report_f(void)
3314{
3315 return 0x40000000;
3316}
3317static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_bpt_pause_report_f(void)
3318{
3319 return 0x20;
3320}
3321static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_report_mask_single_step_complete_report_f(void)
3322{
3323 return 0x40;
3324}
3325static inline u32 gr_gpcs_tpcs_tpccs_tpc_exception_en_r(void)
3326{
3327 return 0x00419d0c;
3328}
3329static inline u32 gr_gpcs_tpcs_tpccs_tpc_exception_en_sm_enabled_f(void)
3330{
3331 return 0x2;
3332}
3333static inline u32 gr_gpcs_tpcs_tpccs_tpc_exception_en_tex_enabled_f(void)
3334{
3335 return 0x1;
3336}
3337static inline u32 gr_gpc0_tpc0_tpccs_tpc_exception_en_r(void)
3338{
3339 return 0x0050450c;
3340}
3341static inline u32 gr_gpc0_tpc0_tpccs_tpc_exception_en_sm_v(u32 r)
3342{
3343 return (r >> 1) & 0x1;
3344}
3345static inline u32 gr_gpc0_tpc0_tpccs_tpc_exception_en_sm_enabled_f(void)
3346{
3347 return 0x2;
3348}
3349static inline u32 gr_gpcs_gpccs_gpc_exception_en_r(void)
3350{
3351 return 0x0041ac94;
3352}
3353static inline u32 gr_gpcs_gpccs_gpc_exception_en_tpc_f(u32 v)
3354{
3355 return (v & 0xff) << 16;
3356}
3357static inline u32 gr_gpc0_gpccs_gpc_exception_r(void)
3358{
3359 return 0x00502c90;
3360}
3361static inline u32 gr_gpc0_gpccs_gpc_exception_tpc_v(u32 r)
3362{
3363 return (r >> 16) & 0xff;
3364}
3365static inline u32 gr_gpc0_gpccs_gpc_exception_tpc_0_pending_v(void)
3366{
3367 return 0x00000001;
3368}
3369static inline u32 gr_gpc0_tpc0_tpccs_tpc_exception_r(void)
3370{
3371 return 0x00504508;
3372}
3373static inline u32 gr_gpc0_tpc0_tpccs_tpc_exception_tex_v(u32 r)
3374{
3375 return (r >> 0) & 0x1;
3376}
3377static inline u32 gr_gpc0_tpc0_tpccs_tpc_exception_tex_pending_v(void)
3378{
3379 return 0x00000001;
3380}
3381static inline u32 gr_gpc0_tpc0_tpccs_tpc_exception_sm_v(u32 r)
3382{
3383 return (r >> 1) & 0x1;
3384}
3385static inline u32 gr_gpc0_tpc0_tpccs_tpc_exception_sm_pending_v(void)
3386{
3387 return 0x00000001;
3388}
3389static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_r(void)
3390{
3391 return 0x00504610;
3392}
3393static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_debugger_mode_m(void)
3394{
3395 return 0x1 << 0;
3396}
3397static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_debugger_mode_v(u32 r)
3398{
3399 return (r >> 0) & 0x1;
3400}
3401static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_debugger_mode_on_v(void)
3402{
3403 return 0x00000001;
3404}
3405static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_debugger_mode_on_f(void)
3406{
3407 return 0x1;
3408}
3409static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_debugger_mode_off_v(void)
3410{
3411 return 0x00000000;
3412}
3413static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_debugger_mode_off_f(void)
3414{
3415 return 0x0;
3416}
3417static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_stop_trigger_enable_f(void)
3418{
3419 return 0x80000000;
3420}
3421static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_stop_trigger_disable_f(void)
3422{
3423 return 0x0;
3424}
3425static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_run_trigger_task_f(void)
3426{
3427 return 0x40000000;
3428}
3429static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_stop_on_any_warp_m(void)
3430{
3431 return 0x1 << 1;
3432}
3433static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_stop_on_any_warp_v(u32 r)
3434{
3435 return (r >> 1) & 0x1;
3436}
3437static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_stop_on_any_warp_disable_f(void)
3438{
3439 return 0x0;
3440}
3441static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_stop_on_any_sm_m(void)
3442{
3443 return 0x1 << 2;
3444}
3445static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_stop_on_any_sm_v(u32 r)
3446{
3447 return (r >> 2) & 0x1;
3448}
3449static inline u32 gr_gpc0_tpc0_sm_dbgr_control0_stop_on_any_sm_disable_f(void)
3450{
3451 return 0x0;
3452}
3453static inline u32 gr_gpc0_tpc0_sm_warp_valid_mask_r(void)
3454{
3455 return 0x00504614;
3456}
3457static inline u32 gr_gpc0_tpc0_sm_dbgr_bpt_pause_mask_r(void)
3458{
3459 return 0x00504624;
3460}
3461static inline u32 gr_gpc0_tpc0_sm_dbgr_bpt_trap_mask_r(void)
3462{
3463 return 0x00504634;
3464}
3465static inline u32 gr_gpcs_tpcs_sm_dbgr_bpt_pause_mask_r(void)
3466{
3467 return 0x00419e24;
3468}
3469static inline u32 gr_gpcs_tpcs_sm_dbgr_bpt_pause_mask_stop_on_any_warp_disable_v(void)
3470{
3471 return 0x00000000;
3472}
3473static inline u32 gr_gpcs_tpcs_sm_dbgr_bpt_pause_mask_stop_on_any_sm_disable_v(void)
3474{
3475 return 0x00000000;
3476}
3477static inline u32 gr_gpc0_tpc0_sm_dbgr_status0_r(void)
3478{
3479 return 0x0050460c;
3480}
3481static inline u32 gr_gpc0_tpc0_sm_dbgr_status0_sm_in_trap_mode_v(u32 r)
3482{
3483 return (r >> 0) & 0x1;
3484}
3485static inline u32 gr_gpc0_tpc0_sm_dbgr_status0_locked_down_v(u32 r)
3486{
3487 return (r >> 4) & 0x1;
3488}
3489static inline u32 gr_gpc0_tpc0_sm_dbgr_status0_locked_down_true_v(void)
3490{
3491 return 0x00000001;
3492}
3493static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_r(void)
3494{
3495 return 0x00419e50;
3496}
3497static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_bpt_int_pending_f(void)
3498{
3499 return 0x10;
3500}
3501static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_bpt_pause_pending_f(void)
3502{
3503 return 0x20;
3504}
3505static inline u32 gr_gpcs_tpcs_sm_hww_global_esr_single_step_complete_pending_f(void)
3506{
3507 return 0x40;
3508}
3509static inline u32 gr_gpc0_tpc0_sm_hww_global_esr_r(void)
3510{
3511 return 0x00504650;
3512}
3513static inline u32 gr_gpc0_tpc0_sm_hww_global_esr_bpt_int_pending_f(void)
3514{
3515 return 0x10;
3516}
3517static inline u32 gr_gpc0_tpc0_sm_hww_global_esr_ecc_sec_error_pending_f(void)
3518{
3519 return 0x20000000;
3520}
3521static inline u32 gr_gpc0_tpc0_sm_hww_global_esr_ecc_ded_error_pending_f(void)
3522{
3523 return 0x40000000;
3524}
3525static inline u32 gr_gpc0_tpc0_sm_hww_global_esr_bpt_pause_pending_f(void)
3526{
3527 return 0x20;
3528}
3529static inline u32 gr_gpc0_tpc0_sm_hww_global_esr_single_step_complete_pending_f(void)
3530{
3531 return 0x40;
3532}
3533static inline u32 gr_gpc0_tpc0_tex_m_hww_esr_r(void)
3534{
3535 return 0x00504224;
3536}
3537static inline u32 gr_gpc0_tpc0_tex_m_hww_esr_intr_pending_f(void)
3538{
3539 return 0x1;
3540}
3541static inline u32 gr_gpc0_tpc0_sm_hww_warp_esr_r(void)
3542{
3543 return 0x00504648;
3544}
3545static inline u32 gr_gpc0_tpc0_sm_hww_warp_esr_error_v(u32 r)
3546{
3547 return (r >> 0) & 0xffff;
3548}
3549static inline u32 gr_gpc0_tpc0_sm_hww_warp_esr_error_none_v(void)
3550{
3551 return 0x00000000;
3552}
3553static inline u32 gr_gpc0_tpc0_sm_hww_warp_esr_error_none_f(void)
3554{
3555 return 0x0;
3556}
3557static inline u32 gr_gpc0_tpc0_sm_halfctl_ctrl_r(void)
3558{
3559 return 0x00504770;
3560}
3561static inline u32 gr_gpcs_tpcs_sm_halfctl_ctrl_r(void)
3562{
3563 return 0x00419f70;
3564}
3565static inline u32 gr_gpcs_tpcs_sm_halfctl_ctrl_sctl_read_quad_ctl_m(void)
3566{
3567 return 0x1 << 4;
3568}
3569static inline u32 gr_gpcs_tpcs_sm_halfctl_ctrl_sctl_read_quad_ctl_f(u32 v)
3570{
3571 return (v & 0x1) << 4;
3572}
3573static inline u32 gr_gpc0_tpc0_sm_debug_sfe_control_r(void)
3574{
3575 return 0x0050477c;
3576}
3577static inline u32 gr_gpcs_tpcs_sm_debug_sfe_control_r(void)
3578{
3579 return 0x00419f7c;
3580}
3581static inline u32 gr_gpcs_tpcs_sm_debug_sfe_control_read_half_ctl_m(void)
3582{
3583 return 0x1 << 0;
3584}
3585static inline u32 gr_gpcs_tpcs_sm_debug_sfe_control_read_half_ctl_f(u32 v)
3586{
3587 return (v & 0x1) << 0;
3588}
3589static inline u32 gr_gpcs_tpcs_pes_vsc_vpc_r(void)
3590{
3591 return 0x0041be08;
3592}
3593static inline u32 gr_gpcs_tpcs_pes_vsc_vpc_fast_mode_switch_true_f(void)
3594{
3595 return 0x4;
3596}
3597static inline u32 gr_ppcs_wwdx_map_gpc_map0_r(void)
3598{
3599 return 0x0041bf00;
3600}
3601static inline u32 gr_ppcs_wwdx_map_gpc_map1_r(void)
3602{
3603 return 0x0041bf04;
3604}
3605static inline u32 gr_ppcs_wwdx_map_gpc_map2_r(void)
3606{
3607 return 0x0041bf08;
3608}
3609static inline u32 gr_ppcs_wwdx_map_gpc_map3_r(void)
3610{
3611 return 0x0041bf0c;
3612}
3613static inline u32 gr_ppcs_wwdx_map_gpc_map4_r(void)
3614{
3615 return 0x0041bf10;
3616}
3617static inline u32 gr_ppcs_wwdx_map_gpc_map5_r(void)
3618{
3619 return 0x0041bf14;
3620}
3621static inline u32 gr_ppcs_wwdx_map_table_cfg_r(void)
3622{
3623 return 0x0041bfd0;
3624}
3625static inline u32 gr_ppcs_wwdx_map_table_cfg_row_offset_f(u32 v)
3626{
3627 return (v & 0xff) << 0;
3628}
3629static inline u32 gr_ppcs_wwdx_map_table_cfg_num_entries_f(u32 v)
3630{
3631 return (v & 0xff) << 8;
3632}
3633static inline u32 gr_ppcs_wwdx_map_table_cfg_normalized_num_entries_f(u32 v)
3634{
3635 return (v & 0x1f) << 16;
3636}
3637static inline u32 gr_ppcs_wwdx_map_table_cfg_normalized_shift_value_f(u32 v)
3638{
3639 return (v & 0x7) << 21;
3640}
3641static inline u32 gr_ppcs_wwdx_map_table_cfg_coeff5_mod_value_f(u32 v)
3642{
3643 return (v & 0x1f) << 24;
3644}
3645static inline u32 gr_gpcs_ppcs_wwdx_sm_num_rcp_r(void)
3646{
3647 return 0x0041bfd4;
3648}
3649static inline u32 gr_gpcs_ppcs_wwdx_sm_num_rcp_conservative_f(u32 v)
3650{
3651 return (v & 0xffffff) << 0;
3652}
3653static inline u32 gr_ppcs_wwdx_map_table_cfg2_r(void)
3654{
3655 return 0x0041bfe4;
3656}
3657static inline u32 gr_ppcs_wwdx_map_table_cfg2_coeff6_mod_value_f(u32 v)
3658{
3659 return (v & 0x1f) << 0;
3660}
3661static inline u32 gr_ppcs_wwdx_map_table_cfg2_coeff7_mod_value_f(u32 v)
3662{
3663 return (v & 0x1f) << 5;
3664}
3665static inline u32 gr_ppcs_wwdx_map_table_cfg2_coeff8_mod_value_f(u32 v)
3666{
3667 return (v & 0x1f) << 10;
3668}
3669static inline u32 gr_ppcs_wwdx_map_table_cfg2_coeff9_mod_value_f(u32 v)
3670{
3671 return (v & 0x1f) << 15;
3672}
3673static inline u32 gr_ppcs_wwdx_map_table_cfg2_coeff10_mod_value_f(u32 v)
3674{
3675 return (v & 0x1f) << 20;
3676}
3677static inline u32 gr_ppcs_wwdx_map_table_cfg2_coeff11_mod_value_f(u32 v)
3678{
3679 return (v & 0x1f) << 25;
3680}
3681static inline u32 gr_bes_zrop_settings_r(void)
3682{
3683 return 0x00408850;
3684}
3685static inline u32 gr_bes_zrop_settings_num_active_ltcs_f(u32 v)
3686{
3687 return (v & 0xf) << 0;
3688}
3689static inline u32 gr_be0_crop_debug3_r(void)
3690{
3691 return 0x00410108;
3692}
3693static inline u32 gr_bes_crop_debug3_r(void)
3694{
3695 return 0x00408908;
3696}
3697static inline u32 gr_bes_crop_debug3_comp_vdc_4to2_disable_m(void)
3698{
3699 return 0x1 << 31;
3700}
3701static inline u32 gr_bes_crop_settings_r(void)
3702{
3703 return 0x00408958;
3704}
3705static inline u32 gr_bes_crop_settings_num_active_ltcs_f(u32 v)
3706{
3707 return (v & 0xf) << 0;
3708}
3709static inline u32 gr_zcull_bytes_per_aliquot_per_gpu_v(void)
3710{
3711 return 0x00000020;
3712}
3713static inline u32 gr_zcull_save_restore_header_bytes_per_gpc_v(void)
3714{
3715 return 0x00000020;
3716}
3717static inline u32 gr_zcull_save_restore_subregion_header_bytes_per_gpc_v(void)
3718{
3719 return 0x000000c0;
3720}
3721static inline u32 gr_zcull_subregion_qty_v(void)
3722{
3723 return 0x00000010;
3724}
3725static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_control_sel0_r(void)
3726{
3727 return 0x00504604;
3728}
3729static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_control_sel1_r(void)
3730{
3731 return 0x00504608;
3732}
3733static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_control0_r(void)
3734{
3735 return 0x0050465c;
3736}
3737static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_control1_r(void)
3738{
3739 return 0x00504660;
3740}
3741static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_control2_r(void)
3742{
3743 return 0x00504664;
3744}
3745static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_control3_r(void)
3746{
3747 return 0x00504668;
3748}
3749static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_control4_r(void)
3750{
3751 return 0x0050466c;
3752}
3753static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_control5_r(void)
3754{
3755 return 0x00504658;
3756}
3757static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter0_control_r(void)
3758{
3759 return 0x00504730;
3760}
3761static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter1_control_r(void)
3762{
3763 return 0x00504734;
3764}
3765static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter2_control_r(void)
3766{
3767 return 0x00504738;
3768}
3769static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter3_control_r(void)
3770{
3771 return 0x0050473c;
3772}
3773static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter4_control_r(void)
3774{
3775 return 0x00504740;
3776}
3777static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter5_control_r(void)
3778{
3779 return 0x00504744;
3780}
3781static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter6_control_r(void)
3782{
3783 return 0x00504748;
3784}
3785static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter7_control_r(void)
3786{
3787 return 0x0050474c;
3788}
3789static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_status_s1_r(void)
3790{
3791 return 0x00504678;
3792}
3793static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter_status1_r(void)
3794{
3795 return 0x00504694;
3796}
3797static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter0_s0_r(void)
3798{
3799 return 0x005046f0;
3800}
3801static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter0_s1_r(void)
3802{
3803 return 0x00504700;
3804}
3805static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter1_s0_r(void)
3806{
3807 return 0x005046f4;
3808}
3809static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter1_s1_r(void)
3810{
3811 return 0x00504704;
3812}
3813static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter2_s0_r(void)
3814{
3815 return 0x005046f8;
3816}
3817static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter2_s1_r(void)
3818{
3819 return 0x00504708;
3820}
3821static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter3_s0_r(void)
3822{
3823 return 0x005046fc;
3824}
3825static inline u32 gr_pri_gpc0_tpc0_sm_dsm_perf_counter3_s1_r(void)
3826{
3827 return 0x0050470c;
3828}
3829static inline u32 gr_fe_pwr_mode_r(void)
3830{
3831 return 0x00404170;
3832}
3833static inline u32 gr_fe_pwr_mode_mode_auto_f(void)
3834{
3835 return 0x0;
3836}
3837static inline u32 gr_fe_pwr_mode_mode_force_on_f(void)
3838{
3839 return 0x2;
3840}
3841static inline u32 gr_fe_pwr_mode_req_v(u32 r)
3842{
3843 return (r >> 4) & 0x1;
3844}
3845static inline u32 gr_fe_pwr_mode_req_send_f(void)
3846{
3847 return 0x10;
3848}
3849static inline u32 gr_fe_pwr_mode_req_done_v(void)
3850{
3851 return 0x00000000;
3852}
3853static inline u32 gr_gpcs_pri_mmu_ctrl_r(void)
3854{
3855 return 0x00418880;
3856}
3857static inline u32 gr_gpcs_pri_mmu_ctrl_vm_pg_size_m(void)
3858{
3859 return 0x1 << 0;
3860}
3861static inline u32 gr_gpcs_pri_mmu_ctrl_use_pdb_big_page_size_m(void)
3862{
3863 return 0x1 << 11;
3864}
3865static inline u32 gr_gpcs_pri_mmu_ctrl_vol_fault_m(void)
3866{
3867 return 0x1 << 1;
3868}
3869static inline u32 gr_gpcs_pri_mmu_ctrl_comp_fault_m(void)
3870{
3871 return 0x1 << 2;
3872}
3873static inline u32 gr_gpcs_pri_mmu_ctrl_miss_gran_m(void)
3874{
3875 return 0x3 << 3;
3876}
3877static inline u32 gr_gpcs_pri_mmu_ctrl_cache_mode_m(void)
3878{
3879 return 0x3 << 5;
3880}
3881static inline u32 gr_gpcs_pri_mmu_ctrl_mmu_aperture_m(void)
3882{
3883 return 0x3 << 28;
3884}
3885static inline u32 gr_gpcs_pri_mmu_ctrl_mmu_vol_m(void)
3886{
3887 return 0x1 << 30;
3888}
3889static inline u32 gr_gpcs_pri_mmu_ctrl_mmu_disable_m(void)
3890{
3891 return 0x1 << 31;
3892}
3893static inline u32 gr_gpcs_pri_mmu_pm_unit_mask_r(void)
3894{
3895 return 0x00418890;
3896}
3897static inline u32 gr_gpcs_pri_mmu_pm_req_mask_r(void)
3898{
3899 return 0x00418894;
3900}
3901static inline u32 gr_gpcs_pri_mmu_debug_ctrl_r(void)
3902{
3903 return 0x004188b0;
3904}
3905static inline u32 gr_gpcs_pri_mmu_debug_ctrl_debug_v(u32 r)
3906{
3907 return (r >> 16) & 0x1;
3908}
3909static inline u32 gr_gpcs_pri_mmu_debug_ctrl_debug_enabled_v(void)
3910{
3911 return 0x00000001;
3912}
3913static inline u32 gr_gpcs_pri_mmu_debug_wr_r(void)
3914{
3915 return 0x004188b4;
3916}
3917static inline u32 gr_gpcs_pri_mmu_debug_rd_r(void)
3918{
3919 return 0x004188b8;
3920}
3921static inline u32 gr_gpcs_mmu_num_active_ltcs_r(void)
3922{
3923 return 0x004188ac;
3924}
3925static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_r(void)
3926{
3927 return 0x00419e10;
3928}
3929static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_debugger_mode_f(u32 v)
3930{
3931 return (v & 0x1) << 0;
3932}
3933static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_debugger_mode_on_v(void)
3934{
3935 return 0x00000001;
3936}
3937static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_stop_trigger_m(void)
3938{
3939 return 0x1 << 31;
3940}
3941static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_stop_trigger_v(u32 r)
3942{
3943 return (r >> 31) & 0x1;
3944}
3945static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_stop_trigger_enable_f(void)
3946{
3947 return 0x80000000;
3948}
3949static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_stop_trigger_disable_f(void)
3950{
3951 return 0x0;
3952}
3953static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_run_trigger_m(void)
3954{
3955 return 0x1 << 30;
3956}
3957static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_run_trigger_v(u32 r)
3958{
3959 return (r >> 30) & 0x1;
3960}
3961static inline u32 gr_gpcs_tpcs_sm_dbgr_control0_run_trigger_task_f(void)
3962{
3963 return 0x40000000;
3964}
3965static inline u32 gr_fe_gfxp_wfi_timeout_r(void)
3966{
3967 return 0x004041c0;
3968}
3969static inline u32 gr_fe_gfxp_wfi_timeout_count_f(u32 v)
3970{
3971 return (v & 0xffffffff) << 0;
3972}
3973static inline u32 gr_fe_gfxp_wfi_timeout_count_disabled_f(void)
3974{
3975 return 0x0;
3976}
3977static inline u32 gr_gpcs_tpcs_sm_texio_control_r(void)
3978{
3979 return 0x00419c84;
3980}
3981static inline u32 gr_gpcs_tpcs_sm_texio_control_oor_addr_check_mode_f(u32 v)
3982{
3983 return (v & 0x7) << 8;
3984}
3985static inline u32 gr_gpcs_tpcs_sm_texio_control_oor_addr_check_mode_m(void)
3986{
3987 return 0x7 << 8;
3988}
3989static inline u32 gr_gpcs_tpcs_sm_texio_control_oor_addr_check_mode_arm_63_48_match_f(void)
3990{
3991 return 0x100;
3992}
3993static inline u32 gr_gpcs_tpcs_sm_disp_ctrl_r(void)
3994{
3995 return 0x00419f78;
3996}
3997static inline u32 gr_gpcs_tpcs_sm_disp_ctrl_re_suppress_m(void)
3998{
3999 return 0x3 << 11;
4000}
4001static inline u32 gr_gpcs_tpcs_sm_disp_ctrl_re_suppress_disable_f(void)
4002{
4003 return 0x1000;
4004}
4005static inline u32 gr_gpcs_tc_debug0_r(void)
4006{
4007 return 0x00418708;
4008}
4009static inline u32 gr_gpcs_tc_debug0_limit_coalesce_buffer_size_f(u32 v)
4010{
4011 return (v & 0x1ff) << 0;
4012}
4013static inline u32 gr_gpcs_tc_debug0_limit_coalesce_buffer_size_m(void)
4014{
4015 return 0x1ff << 0;
4016}
4017#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_ltc_gp106.h b/drivers/gpu/nvgpu/gp106/hw_ltc_gp106.h
new file mode 100644
index 00000000..d760b588
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_ltc_gp106.h
@@ -0,0 +1,553 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_ltc_gp106_h_
51#define _hw_ltc_gp106_h_
52
53static inline u32 ltc_ltcs_lts0_cbc_ctrl1_r(void)
54{
55 return 0x0014046c;
56}
57static inline u32 ltc_ltc0_lts0_dstg_cfg0_r(void)
58{
59 return 0x00140518;
60}
61static inline u32 ltc_ltcs_ltss_dstg_cfg0_r(void)
62{
63 return 0x0017e318;
64}
65static inline u32 ltc_ltcs_ltss_dstg_cfg0_vdc_4to2_disable_m(void)
66{
67 return 0x1 << 15;
68}
69static inline u32 ltc_ltc0_lts0_tstg_cfg1_r(void)
70{
71 return 0x00140494;
72}
73static inline u32 ltc_ltc0_lts0_tstg_cfg1_active_ways_v(u32 r)
74{
75 return (r >> 0) & 0xffff;
76}
77static inline u32 ltc_ltc0_lts0_tstg_cfg1_active_sets_v(u32 r)
78{
79 return (r >> 16) & 0x3;
80}
81static inline u32 ltc_ltc0_lts0_tstg_cfg1_active_sets_all_v(void)
82{
83 return 0x00000000;
84}
85static inline u32 ltc_ltc0_lts0_tstg_cfg1_active_sets_half_v(void)
86{
87 return 0x00000001;
88}
89static inline u32 ltc_ltc0_lts0_tstg_cfg1_active_sets_quarter_v(void)
90{
91 return 0x00000002;
92}
93static inline u32 ltc_ltcs_ltss_cbc_ctrl1_r(void)
94{
95 return 0x0017e26c;
96}
97static inline u32 ltc_ltcs_ltss_cbc_ctrl1_clean_active_f(void)
98{
99 return 0x1;
100}
101static inline u32 ltc_ltcs_ltss_cbc_ctrl1_invalidate_active_f(void)
102{
103 return 0x2;
104}
105static inline u32 ltc_ltcs_ltss_cbc_ctrl1_clear_v(u32 r)
106{
107 return (r >> 2) & 0x1;
108}
109static inline u32 ltc_ltcs_ltss_cbc_ctrl1_clear_active_v(void)
110{
111 return 0x00000001;
112}
113static inline u32 ltc_ltcs_ltss_cbc_ctrl1_clear_active_f(void)
114{
115 return 0x4;
116}
117static inline u32 ltc_ltc0_lts0_cbc_ctrl1_r(void)
118{
119 return 0x0014046c;
120}
121static inline u32 ltc_ltcs_ltss_cbc_ctrl2_r(void)
122{
123 return 0x0017e270;
124}
125static inline u32 ltc_ltcs_ltss_cbc_ctrl2_clear_lower_bound_f(u32 v)
126{
127 return (v & 0x3ffff) << 0;
128}
129static inline u32 ltc_ltcs_ltss_cbc_ctrl3_r(void)
130{
131 return 0x0017e274;
132}
133static inline u32 ltc_ltcs_ltss_cbc_ctrl3_clear_upper_bound_f(u32 v)
134{
135 return (v & 0x3ffff) << 0;
136}
137static inline u32 ltc_ltcs_ltss_cbc_ctrl3_clear_upper_bound_init_v(void)
138{
139 return 0x0003ffff;
140}
141static inline u32 ltc_ltcs_ltss_cbc_base_r(void)
142{
143 return 0x0017e278;
144}
145static inline u32 ltc_ltcs_ltss_cbc_base_alignment_shift_v(void)
146{
147 return 0x0000000b;
148}
149static inline u32 ltc_ltcs_ltss_cbc_base_address_v(u32 r)
150{
151 return (r >> 0) & 0x3ffffff;
152}
153static inline u32 ltc_ltcs_ltss_cbc_num_active_ltcs_r(void)
154{
155 return 0x0017e27c;
156}
157static inline u32 ltc_ltcs_misc_ltc_num_active_ltcs_r(void)
158{
159 return 0x0017e000;
160}
161static inline u32 ltc_ltcs_ltss_cbc_param_r(void)
162{
163 return 0x0017e280;
164}
165static inline u32 ltc_ltcs_ltss_cbc_param_comptags_per_cache_line_v(u32 r)
166{
167 return (r >> 0) & 0xffff;
168}
169static inline u32 ltc_ltcs_ltss_cbc_param_cache_line_size_v(u32 r)
170{
171 return (r >> 24) & 0xf;
172}
173static inline u32 ltc_ltcs_ltss_cbc_param_slices_per_ltc_v(u32 r)
174{
175 return (r >> 28) & 0xf;
176}
177static inline u32 ltc_ltcs_ltss_cbc_param2_r(void)
178{
179 return 0x0017e3f4;
180}
181static inline u32 ltc_ltcs_ltss_cbc_param2_gobs_per_comptagline_per_slice_v(u32 r)
182{
183 return (r >> 0) & 0xffff;
184}
185static inline u32 ltc_ltcs_ltss_tstg_set_mgmt_r(void)
186{
187 return 0x0017e2ac;
188}
189static inline u32 ltc_ltcs_ltss_tstg_set_mgmt_max_ways_evict_last_f(u32 v)
190{
191 return (v & 0x1f) << 16;
192}
193static inline u32 ltc_ltcs_ltss_dstg_zbc_index_r(void)
194{
195 return 0x0017e338;
196}
197static inline u32 ltc_ltcs_ltss_dstg_zbc_index_address_f(u32 v)
198{
199 return (v & 0xf) << 0;
200}
201static inline u32 ltc_ltcs_ltss_dstg_zbc_color_clear_value_r(u32 i)
202{
203 return 0x0017e33c + i*4;
204}
205static inline u32 ltc_ltcs_ltss_dstg_zbc_color_clear_value__size_1_v(void)
206{
207 return 0x00000004;
208}
209static inline u32 ltc_ltcs_ltss_dstg_zbc_depth_clear_value_r(void)
210{
211 return 0x0017e34c;
212}
213static inline u32 ltc_ltcs_ltss_dstg_zbc_depth_clear_value_field_s(void)
214{
215 return 32;
216}
217static inline u32 ltc_ltcs_ltss_dstg_zbc_depth_clear_value_field_f(u32 v)
218{
219 return (v & 0xffffffff) << 0;
220}
221static inline u32 ltc_ltcs_ltss_dstg_zbc_depth_clear_value_field_m(void)
222{
223 return 0xffffffff << 0;
224}
225static inline u32 ltc_ltcs_ltss_dstg_zbc_depth_clear_value_field_v(u32 r)
226{
227 return (r >> 0) & 0xffffffff;
228}
229static inline u32 ltc_ltcs_ltss_tstg_set_mgmt_2_r(void)
230{
231 return 0x0017e2b0;
232}
233static inline u32 ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f(void)
234{
235 return 0x10000000;
236}
237static inline u32 ltc_ltcs_ltss_g_elpg_r(void)
238{
239 return 0x0017e214;
240}
241static inline u32 ltc_ltcs_ltss_g_elpg_flush_v(u32 r)
242{
243 return (r >> 0) & 0x1;
244}
245static inline u32 ltc_ltcs_ltss_g_elpg_flush_pending_v(void)
246{
247 return 0x00000001;
248}
249static inline u32 ltc_ltcs_ltss_g_elpg_flush_pending_f(void)
250{
251 return 0x1;
252}
253static inline u32 ltc_ltc0_ltss_g_elpg_r(void)
254{
255 return 0x00140214;
256}
257static inline u32 ltc_ltc0_ltss_g_elpg_flush_v(u32 r)
258{
259 return (r >> 0) & 0x1;
260}
261static inline u32 ltc_ltc0_ltss_g_elpg_flush_pending_v(void)
262{
263 return 0x00000001;
264}
265static inline u32 ltc_ltc0_ltss_g_elpg_flush_pending_f(void)
266{
267 return 0x1;
268}
269static inline u32 ltc_ltc1_ltss_g_elpg_r(void)
270{
271 return 0x00142214;
272}
273static inline u32 ltc_ltc1_ltss_g_elpg_flush_v(u32 r)
274{
275 return (r >> 0) & 0x1;
276}
277static inline u32 ltc_ltc1_ltss_g_elpg_flush_pending_v(void)
278{
279 return 0x00000001;
280}
281static inline u32 ltc_ltc1_ltss_g_elpg_flush_pending_f(void)
282{
283 return 0x1;
284}
285static inline u32 ltc_ltcs_ltss_intr_r(void)
286{
287 return 0x0017e20c;
288}
289static inline u32 ltc_ltcs_ltss_intr_ecc_sec_error_pending_f(void)
290{
291 return 0x100;
292}
293static inline u32 ltc_ltcs_ltss_intr_ecc_ded_error_pending_f(void)
294{
295 return 0x200;
296}
297static inline u32 ltc_ltcs_ltss_intr_en_evicted_cb_m(void)
298{
299 return 0x1 << 20;
300}
301static inline u32 ltc_ltcs_ltss_intr_en_illegal_compstat_access_m(void)
302{
303 return 0x1 << 30;
304}
305static inline u32 ltc_ltcs_ltss_intr_en_ecc_sec_error_enabled_f(void)
306{
307 return 0x1000000;
308}
309static inline u32 ltc_ltcs_ltss_intr_en_ecc_ded_error_enabled_f(void)
310{
311 return 0x2000000;
312}
313static inline u32 ltc_ltc0_lts0_intr_r(void)
314{
315 return 0x0014040c;
316}
317static inline u32 ltc_ltc0_lts0_dstg_ecc_report_r(void)
318{
319 return 0x0014051c;
320}
321static inline u32 ltc_ltc0_lts0_dstg_ecc_report_sec_count_m(void)
322{
323 return 0xff << 0;
324}
325static inline u32 ltc_ltc0_lts0_dstg_ecc_report_sec_count_v(u32 r)
326{
327 return (r >> 0) & 0xff;
328}
329static inline u32 ltc_ltc0_lts0_dstg_ecc_report_ded_count_m(void)
330{
331 return 0xff << 16;
332}
333static inline u32 ltc_ltc0_lts0_dstg_ecc_report_ded_count_v(u32 r)
334{
335 return (r >> 16) & 0xff;
336}
337static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_r(void)
338{
339 return 0x0017e2a0;
340}
341static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_v(u32 r)
342{
343 return (r >> 0) & 0x1;
344}
345static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_pending_v(void)
346{
347 return 0x00000001;
348}
349static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_pending_f(void)
350{
351 return 0x1;
352}
353static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_max_cycles_between_invalidates_v(u32 r)
354{
355 return (r >> 8) & 0xf;
356}
357static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_max_cycles_between_invalidates_3_v(void)
358{
359 return 0x00000003;
360}
361static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_max_cycles_between_invalidates_3_f(void)
362{
363 return 0x300;
364}
365static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_last_class_v(u32 r)
366{
367 return (r >> 28) & 0x1;
368}
369static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_last_class_true_v(void)
370{
371 return 0x00000001;
372}
373static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_last_class_true_f(void)
374{
375 return 0x10000000;
376}
377static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_normal_class_v(u32 r)
378{
379 return (r >> 29) & 0x1;
380}
381static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_normal_class_true_v(void)
382{
383 return 0x00000001;
384}
385static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_normal_class_true_f(void)
386{
387 return 0x20000000;
388}
389static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_first_class_v(u32 r)
390{
391 return (r >> 30) & 0x1;
392}
393static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_first_class_true_v(void)
394{
395 return 0x00000001;
396}
397static inline u32 ltc_ltcs_ltss_tstg_cmgmt0_invalidate_evict_first_class_true_f(void)
398{
399 return 0x40000000;
400}
401static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_r(void)
402{
403 return 0x0017e2a4;
404}
405static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_v(u32 r)
406{
407 return (r >> 0) & 0x1;
408}
409static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_pending_v(void)
410{
411 return 0x00000001;
412}
413static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_pending_f(void)
414{
415 return 0x1;
416}
417static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_max_cycles_between_cleans_v(u32 r)
418{
419 return (r >> 8) & 0xf;
420}
421static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_max_cycles_between_cleans_3_v(void)
422{
423 return 0x00000003;
424}
425static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_max_cycles_between_cleans_3_f(void)
426{
427 return 0x300;
428}
429static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_wait_for_fb_to_pull_v(u32 r)
430{
431 return (r >> 16) & 0x1;
432}
433static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_wait_for_fb_to_pull_true_v(void)
434{
435 return 0x00000001;
436}
437static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_wait_for_fb_to_pull_true_f(void)
438{
439 return 0x10000;
440}
441static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_last_class_v(u32 r)
442{
443 return (r >> 28) & 0x1;
444}
445static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_last_class_true_v(void)
446{
447 return 0x00000001;
448}
449static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_last_class_true_f(void)
450{
451 return 0x10000000;
452}
453static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_normal_class_v(u32 r)
454{
455 return (r >> 29) & 0x1;
456}
457static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_normal_class_true_v(void)
458{
459 return 0x00000001;
460}
461static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_normal_class_true_f(void)
462{
463 return 0x20000000;
464}
465static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_first_class_v(u32 r)
466{
467 return (r >> 30) & 0x1;
468}
469static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_first_class_true_v(void)
470{
471 return 0x00000001;
472}
473static inline u32 ltc_ltcs_ltss_tstg_cmgmt1_clean_evict_first_class_true_f(void)
474{
475 return 0x40000000;
476}
477static inline u32 ltc_ltc0_ltss_tstg_cmgmt0_r(void)
478{
479 return 0x001402a0;
480}
481static inline u32 ltc_ltc0_ltss_tstg_cmgmt0_invalidate_v(u32 r)
482{
483 return (r >> 0) & 0x1;
484}
485static inline u32 ltc_ltc0_ltss_tstg_cmgmt0_invalidate_pending_v(void)
486{
487 return 0x00000001;
488}
489static inline u32 ltc_ltc0_ltss_tstg_cmgmt0_invalidate_pending_f(void)
490{
491 return 0x1;
492}
493static inline u32 ltc_ltc0_ltss_tstg_cmgmt1_r(void)
494{
495 return 0x001402a4;
496}
497static inline u32 ltc_ltc0_ltss_tstg_cmgmt1_clean_v(u32 r)
498{
499 return (r >> 0) & 0x1;
500}
501static inline u32 ltc_ltc0_ltss_tstg_cmgmt1_clean_pending_v(void)
502{
503 return 0x00000001;
504}
505static inline u32 ltc_ltc0_ltss_tstg_cmgmt1_clean_pending_f(void)
506{
507 return 0x1;
508}
509static inline u32 ltc_ltc1_ltss_tstg_cmgmt0_r(void)
510{
511 return 0x001422a0;
512}
513static inline u32 ltc_ltc1_ltss_tstg_cmgmt0_invalidate_v(u32 r)
514{
515 return (r >> 0) & 0x1;
516}
517static inline u32 ltc_ltc1_ltss_tstg_cmgmt0_invalidate_pending_v(void)
518{
519 return 0x00000001;
520}
521static inline u32 ltc_ltc1_ltss_tstg_cmgmt0_invalidate_pending_f(void)
522{
523 return 0x1;
524}
525static inline u32 ltc_ltc1_ltss_tstg_cmgmt1_r(void)
526{
527 return 0x001422a4;
528}
529static inline u32 ltc_ltc1_ltss_tstg_cmgmt1_clean_v(u32 r)
530{
531 return (r >> 0) & 0x1;
532}
533static inline u32 ltc_ltc1_ltss_tstg_cmgmt1_clean_pending_v(void)
534{
535 return 0x00000001;
536}
537static inline u32 ltc_ltc1_ltss_tstg_cmgmt1_clean_pending_f(void)
538{
539 return 0x1;
540}
541static inline u32 ltc_ltc0_lts0_tstg_info_1_r(void)
542{
543 return 0x0014058c;
544}
545static inline u32 ltc_ltc0_lts0_tstg_info_1_slice_size_in_kb_v(u32 r)
546{
547 return (r >> 0) & 0xffff;
548}
549static inline u32 ltc_ltc0_lts0_tstg_info_1_slices_per_l2_v(u32 r)
550{
551 return (r >> 16) & 0x1f;
552}
553#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_mc_gp106.h b/drivers/gpu/nvgpu/gp106/hw_mc_gp106.h
new file mode 100644
index 00000000..99ad8bc0
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_mc_gp106.h
@@ -0,0 +1,245 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_mc_gp106_h_
51#define _hw_mc_gp106_h_
52
53static inline u32 mc_boot_0_r(void)
54{
55 return 0x00000000;
56}
57static inline u32 mc_boot_0_architecture_v(u32 r)
58{
59 return (r >> 24) & 0x1f;
60}
61static inline u32 mc_boot_0_implementation_v(u32 r)
62{
63 return (r >> 20) & 0xf;
64}
65static inline u32 mc_boot_0_major_revision_v(u32 r)
66{
67 return (r >> 4) & 0xf;
68}
69static inline u32 mc_boot_0_minor_revision_v(u32 r)
70{
71 return (r >> 0) & 0xf;
72}
73static inline u32 mc_intr_r(u32 i)
74{
75 return 0x00000100 + i*4;
76}
77static inline u32 mc_intr_pfifo_pending_f(void)
78{
79 return 0x100;
80}
81static inline u32 mc_intr_replayable_fault_pending_f(void)
82{
83 return 0x200;
84}
85static inline u32 mc_intr_pgraph_pending_f(void)
86{
87 return 0x1000;
88}
89static inline u32 mc_intr_pmu_pending_f(void)
90{
91 return 0x1000000;
92}
93static inline u32 mc_intr_ltc_pending_f(void)
94{
95 return 0x2000000;
96}
97static inline u32 mc_intr_priv_ring_pending_f(void)
98{
99 return 0x40000000;
100}
101static inline u32 mc_intr_pbus_pending_f(void)
102{
103 return 0x10000000;
104}
105static inline u32 mc_intr_en_r(u32 i)
106{
107 return 0x00000140 + i*4;
108}
109static inline u32 mc_intr_en_set_r(u32 i)
110{
111 return 0x00000160 + i*4;
112}
113static inline u32 mc_intr_en_clear_r(u32 i)
114{
115 return 0x00000180 + i*4;
116}
117static inline u32 mc_enable_r(void)
118{
119 return 0x00000200;
120}
121static inline u32 mc_enable_xbar_enabled_f(void)
122{
123 return 0x4;
124}
125static inline u32 mc_enable_l2_enabled_f(void)
126{
127 return 0x8;
128}
129static inline u32 mc_enable_pmedia_s(void)
130{
131 return 1;
132}
133static inline u32 mc_enable_pmedia_f(u32 v)
134{
135 return (v & 0x1) << 4;
136}
137static inline u32 mc_enable_pmedia_m(void)
138{
139 return 0x1 << 4;
140}
141static inline u32 mc_enable_pmedia_v(u32 r)
142{
143 return (r >> 4) & 0x1;
144}
145static inline u32 mc_enable_priv_ring_enabled_f(void)
146{
147 return 0x20;
148}
149static inline u32 mc_enable_ce0_m(void)
150{
151 return 0x1 << 6;
152}
153static inline u32 mc_enable_pfifo_enabled_f(void)
154{
155 return 0x100;
156}
157static inline u32 mc_enable_pgraph_enabled_f(void)
158{
159 return 0x1000;
160}
161static inline u32 mc_enable_pwr_v(u32 r)
162{
163 return (r >> 13) & 0x1;
164}
165static inline u32 mc_enable_pwr_disabled_v(void)
166{
167 return 0x00000000;
168}
169static inline u32 mc_enable_pwr_enabled_f(void)
170{
171 return 0x2000;
172}
173static inline u32 mc_enable_pfb_enabled_f(void)
174{
175 return 0x100000;
176}
177static inline u32 mc_enable_ce2_m(void)
178{
179 return 0x1 << 21;
180}
181static inline u32 mc_enable_ce2_enabled_f(void)
182{
183 return 0x200000;
184}
185static inline u32 mc_enable_blg_enabled_f(void)
186{
187 return 0x8000000;
188}
189static inline u32 mc_enable_perfmon_enabled_f(void)
190{
191 return 0x10000000;
192}
193static inline u32 mc_enable_hub_enabled_f(void)
194{
195 return 0x20000000;
196}
197static inline u32 mc_intr_ltc_r(void)
198{
199 return 0x000001c0;
200}
201static inline u32 mc_enable_pb_r(void)
202{
203 return 0x00000204;
204}
205static inline u32 mc_enable_pb_0_s(void)
206{
207 return 1;
208}
209static inline u32 mc_enable_pb_0_f(u32 v)
210{
211 return (v & 0x1) << 0;
212}
213static inline u32 mc_enable_pb_0_m(void)
214{
215 return 0x1 << 0;
216}
217static inline u32 mc_enable_pb_0_v(u32 r)
218{
219 return (r >> 0) & 0x1;
220}
221static inline u32 mc_enable_pb_0_enabled_v(void)
222{
223 return 0x00000001;
224}
225static inline u32 mc_enable_pb_sel_f(u32 v, u32 i)
226{
227 return (v & 0x1) << (0 + i*1);
228}
229static inline u32 mc_elpg_enable_r(void)
230{
231 return 0x0000020c;
232}
233static inline u32 mc_elpg_enable_xbar_enabled_f(void)
234{
235 return 0x4;
236}
237static inline u32 mc_elpg_enable_pfb_enabled_f(void)
238{
239 return 0x100000;
240}
241static inline u32 mc_elpg_enable_hub_enabled_f(void)
242{
243 return 0x20000000;
244}
245#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_pbdma_gp106.h b/drivers/gpu/nvgpu/gp106/hw_pbdma_gp106.h
new file mode 100644
index 00000000..1e299bae
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_pbdma_gp106.h
@@ -0,0 +1,513 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_pbdma_gp106_h_
51#define _hw_pbdma_gp106_h_
52
53static inline u32 pbdma_gp_entry1_r(void)
54{
55 return 0x10000004;
56}
57static inline u32 pbdma_gp_entry1_get_hi_v(u32 r)
58{
59 return (r >> 0) & 0xff;
60}
61static inline u32 pbdma_gp_entry1_length_f(u32 v)
62{
63 return (v & 0x1fffff) << 10;
64}
65static inline u32 pbdma_gp_entry1_length_v(u32 r)
66{
67 return (r >> 10) & 0x1fffff;
68}
69static inline u32 pbdma_gp_base_r(u32 i)
70{
71 return 0x00040048 + i*8192;
72}
73static inline u32 pbdma_gp_base__size_1_v(void)
74{
75 return 0x00000004;
76}
77static inline u32 pbdma_gp_base_offset_f(u32 v)
78{
79 return (v & 0x1fffffff) << 3;
80}
81static inline u32 pbdma_gp_base_rsvd_s(void)
82{
83 return 3;
84}
85static inline u32 pbdma_gp_base_hi_r(u32 i)
86{
87 return 0x0004004c + i*8192;
88}
89static inline u32 pbdma_gp_base_hi_offset_f(u32 v)
90{
91 return (v & 0xff) << 0;
92}
93static inline u32 pbdma_gp_base_hi_limit2_f(u32 v)
94{
95 return (v & 0x1f) << 16;
96}
97static inline u32 pbdma_gp_fetch_r(u32 i)
98{
99 return 0x00040050 + i*8192;
100}
101static inline u32 pbdma_gp_get_r(u32 i)
102{
103 return 0x00040014 + i*8192;
104}
105static inline u32 pbdma_gp_put_r(u32 i)
106{
107 return 0x00040000 + i*8192;
108}
109static inline u32 pbdma_pb_fetch_r(u32 i)
110{
111 return 0x00040054 + i*8192;
112}
113static inline u32 pbdma_pb_fetch_hi_r(u32 i)
114{
115 return 0x00040058 + i*8192;
116}
117static inline u32 pbdma_get_r(u32 i)
118{
119 return 0x00040018 + i*8192;
120}
121static inline u32 pbdma_get_hi_r(u32 i)
122{
123 return 0x0004001c + i*8192;
124}
125static inline u32 pbdma_put_r(u32 i)
126{
127 return 0x0004005c + i*8192;
128}
129static inline u32 pbdma_put_hi_r(u32 i)
130{
131 return 0x00040060 + i*8192;
132}
133static inline u32 pbdma_formats_r(u32 i)
134{
135 return 0x0004009c + i*8192;
136}
137static inline u32 pbdma_formats_gp_fermi0_f(void)
138{
139 return 0x0;
140}
141static inline u32 pbdma_formats_pb_fermi1_f(void)
142{
143 return 0x100;
144}
145static inline u32 pbdma_formats_mp_fermi0_f(void)
146{
147 return 0x0;
148}
149static inline u32 pbdma_pb_header_r(u32 i)
150{
151 return 0x00040084 + i*8192;
152}
153static inline u32 pbdma_pb_header_priv_user_f(void)
154{
155 return 0x0;
156}
157static inline u32 pbdma_pb_header_method_zero_f(void)
158{
159 return 0x0;
160}
161static inline u32 pbdma_pb_header_subchannel_zero_f(void)
162{
163 return 0x0;
164}
165static inline u32 pbdma_pb_header_level_main_f(void)
166{
167 return 0x0;
168}
169static inline u32 pbdma_pb_header_first_true_f(void)
170{
171 return 0x400000;
172}
173static inline u32 pbdma_pb_header_type_inc_f(void)
174{
175 return 0x20000000;
176}
177static inline u32 pbdma_pb_header_type_non_inc_f(void)
178{
179 return 0x60000000;
180}
181static inline u32 pbdma_hdr_shadow_r(u32 i)
182{
183 return 0x00040118 + i*8192;
184}
185static inline u32 pbdma_subdevice_r(u32 i)
186{
187 return 0x00040094 + i*8192;
188}
189static inline u32 pbdma_subdevice_id_f(u32 v)
190{
191 return (v & 0xfff) << 0;
192}
193static inline u32 pbdma_subdevice_status_active_f(void)
194{
195 return 0x10000000;
196}
197static inline u32 pbdma_subdevice_channel_dma_enable_f(void)
198{
199 return 0x20000000;
200}
201static inline u32 pbdma_method0_r(u32 i)
202{
203 return 0x000400c0 + i*8192;
204}
205static inline u32 pbdma_method0_fifo_size_v(void)
206{
207 return 0x00000004;
208}
209static inline u32 pbdma_method0_addr_f(u32 v)
210{
211 return (v & 0xfff) << 2;
212}
213static inline u32 pbdma_method0_addr_v(u32 r)
214{
215 return (r >> 2) & 0xfff;
216}
217static inline u32 pbdma_method0_subch_v(u32 r)
218{
219 return (r >> 16) & 0x7;
220}
221static inline u32 pbdma_method0_first_true_f(void)
222{
223 return 0x400000;
224}
225static inline u32 pbdma_method0_valid_true_f(void)
226{
227 return 0x80000000;
228}
229static inline u32 pbdma_method1_r(u32 i)
230{
231 return 0x000400c8 + i*8192;
232}
233static inline u32 pbdma_method2_r(u32 i)
234{
235 return 0x000400d0 + i*8192;
236}
237static inline u32 pbdma_method3_r(u32 i)
238{
239 return 0x000400d8 + i*8192;
240}
241static inline u32 pbdma_data0_r(u32 i)
242{
243 return 0x000400c4 + i*8192;
244}
245static inline u32 pbdma_target_r(u32 i)
246{
247 return 0x000400ac + i*8192;
248}
249static inline u32 pbdma_target_engine_sw_f(void)
250{
251 return 0x1f;
252}
253static inline u32 pbdma_acquire_r(u32 i)
254{
255 return 0x00040030 + i*8192;
256}
257static inline u32 pbdma_acquire_retry_man_2_f(void)
258{
259 return 0x2;
260}
261static inline u32 pbdma_acquire_retry_exp_2_f(void)
262{
263 return 0x100;
264}
265static inline u32 pbdma_acquire_timeout_exp_max_f(void)
266{
267 return 0x7800;
268}
269static inline u32 pbdma_acquire_timeout_man_max_f(void)
270{
271 return 0x7fff8000;
272}
273static inline u32 pbdma_acquire_timeout_en_disable_f(void)
274{
275 return 0x0;
276}
277static inline u32 pbdma_status_r(u32 i)
278{
279 return 0x00040100 + i*8192;
280}
281static inline u32 pbdma_channel_r(u32 i)
282{
283 return 0x00040120 + i*8192;
284}
285static inline u32 pbdma_signature_r(u32 i)
286{
287 return 0x00040010 + i*8192;
288}
289static inline u32 pbdma_signature_hw_valid_f(void)
290{
291 return 0xface;
292}
293static inline u32 pbdma_signature_sw_zero_f(void)
294{
295 return 0x0;
296}
297static inline u32 pbdma_userd_r(u32 i)
298{
299 return 0x00040008 + i*8192;
300}
301static inline u32 pbdma_userd_target_vid_mem_f(void)
302{
303 return 0x0;
304}
305static inline u32 pbdma_userd_target_sys_mem_coh_f(void)
306{
307 return 0x2;
308}
309static inline u32 pbdma_userd_target_sys_mem_ncoh_f(void)
310{
311 return 0x3;
312}
313static inline u32 pbdma_userd_addr_f(u32 v)
314{
315 return (v & 0x7fffff) << 9;
316}
317static inline u32 pbdma_userd_hi_r(u32 i)
318{
319 return 0x0004000c + i*8192;
320}
321static inline u32 pbdma_userd_hi_addr_f(u32 v)
322{
323 return (v & 0xff) << 0;
324}
325static inline u32 pbdma_config_r(u32 i)
326{
327 return 0x000400f4 + i*8192;
328}
329static inline u32 pbdma_config_auth_level_privileged_f(void)
330{
331 return 0x100;
332}
333static inline u32 pbdma_hce_ctrl_r(u32 i)
334{
335 return 0x000400e4 + i*8192;
336}
337static inline u32 pbdma_hce_ctrl_hce_priv_mode_yes_f(void)
338{
339 return 0x20;
340}
341static inline u32 pbdma_intr_0_r(u32 i)
342{
343 return 0x00040108 + i*8192;
344}
345static inline u32 pbdma_intr_0_memreq_v(u32 r)
346{
347 return (r >> 0) & 0x1;
348}
349static inline u32 pbdma_intr_0_memreq_pending_f(void)
350{
351 return 0x1;
352}
353static inline u32 pbdma_intr_0_memack_timeout_pending_f(void)
354{
355 return 0x2;
356}
357static inline u32 pbdma_intr_0_memack_extra_pending_f(void)
358{
359 return 0x4;
360}
361static inline u32 pbdma_intr_0_memdat_timeout_pending_f(void)
362{
363 return 0x8;
364}
365static inline u32 pbdma_intr_0_memdat_extra_pending_f(void)
366{
367 return 0x10;
368}
369static inline u32 pbdma_intr_0_memflush_pending_f(void)
370{
371 return 0x20;
372}
373static inline u32 pbdma_intr_0_memop_pending_f(void)
374{
375 return 0x40;
376}
377static inline u32 pbdma_intr_0_lbconnect_pending_f(void)
378{
379 return 0x80;
380}
381static inline u32 pbdma_intr_0_lbreq_pending_f(void)
382{
383 return 0x100;
384}
385static inline u32 pbdma_intr_0_lback_timeout_pending_f(void)
386{
387 return 0x200;
388}
389static inline u32 pbdma_intr_0_lback_extra_pending_f(void)
390{
391 return 0x400;
392}
393static inline u32 pbdma_intr_0_lbdat_timeout_pending_f(void)
394{
395 return 0x800;
396}
397static inline u32 pbdma_intr_0_lbdat_extra_pending_f(void)
398{
399 return 0x1000;
400}
401static inline u32 pbdma_intr_0_gpfifo_pending_f(void)
402{
403 return 0x2000;
404}
405static inline u32 pbdma_intr_0_gpptr_pending_f(void)
406{
407 return 0x4000;
408}
409static inline u32 pbdma_intr_0_gpentry_pending_f(void)
410{
411 return 0x8000;
412}
413static inline u32 pbdma_intr_0_gpcrc_pending_f(void)
414{
415 return 0x10000;
416}
417static inline u32 pbdma_intr_0_pbptr_pending_f(void)
418{
419 return 0x20000;
420}
421static inline u32 pbdma_intr_0_pbentry_pending_f(void)
422{
423 return 0x40000;
424}
425static inline u32 pbdma_intr_0_pbcrc_pending_f(void)
426{
427 return 0x80000;
428}
429static inline u32 pbdma_intr_0_xbarconnect_pending_f(void)
430{
431 return 0x100000;
432}
433static inline u32 pbdma_intr_0_method_pending_f(void)
434{
435 return 0x200000;
436}
437static inline u32 pbdma_intr_0_methodcrc_pending_f(void)
438{
439 return 0x400000;
440}
441static inline u32 pbdma_intr_0_device_pending_f(void)
442{
443 return 0x800000;
444}
445static inline u32 pbdma_intr_0_semaphore_pending_f(void)
446{
447 return 0x2000000;
448}
449static inline u32 pbdma_intr_0_acquire_pending_f(void)
450{
451 return 0x4000000;
452}
453static inline u32 pbdma_intr_0_pri_pending_f(void)
454{
455 return 0x8000000;
456}
457static inline u32 pbdma_intr_0_no_ctxsw_seg_pending_f(void)
458{
459 return 0x20000000;
460}
461static inline u32 pbdma_intr_0_pbseg_pending_f(void)
462{
463 return 0x40000000;
464}
465static inline u32 pbdma_intr_0_signature_pending_f(void)
466{
467 return 0x80000000;
468}
469static inline u32 pbdma_intr_1_r(u32 i)
470{
471 return 0x00040148 + i*8192;
472}
473static inline u32 pbdma_intr_en_0_r(u32 i)
474{
475 return 0x0004010c + i*8192;
476}
477static inline u32 pbdma_intr_en_0_lbreq_enabled_f(void)
478{
479 return 0x100;
480}
481static inline u32 pbdma_intr_en_1_r(u32 i)
482{
483 return 0x0004014c + i*8192;
484}
485static inline u32 pbdma_intr_stall_r(u32 i)
486{
487 return 0x0004013c + i*8192;
488}
489static inline u32 pbdma_intr_stall_lbreq_enabled_f(void)
490{
491 return 0x100;
492}
493static inline u32 pbdma_udma_nop_r(void)
494{
495 return 0x00000008;
496}
497static inline u32 pbdma_runlist_timeslice_r(u32 i)
498{
499 return 0x000400f8 + i*8192;
500}
501static inline u32 pbdma_runlist_timeslice_timeout_128_f(void)
502{
503 return 0x80;
504}
505static inline u32 pbdma_runlist_timeslice_timescale_3_f(void)
506{
507 return 0x3000;
508}
509static inline u32 pbdma_runlist_timeslice_enable_true_f(void)
510{
511 return 0x10000000;
512}
513#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_perf_gp106.h b/drivers/gpu/nvgpu/gp106/hw_perf_gp106.h
new file mode 100644
index 00000000..cd3501a8
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_perf_gp106.h
@@ -0,0 +1,205 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_perf_gp106_h_
51#define _hw_perf_gp106_h_
52
53static inline u32 perf_pmasys_control_r(void)
54{
55 return 0x001b4000;
56}
57static inline u32 perf_pmasys_control_membuf_status_v(u32 r)
58{
59 return (r >> 4) & 0x1;
60}
61static inline u32 perf_pmasys_control_membuf_status_overflowed_v(void)
62{
63 return 0x00000001;
64}
65static inline u32 perf_pmasys_control_membuf_status_overflowed_f(void)
66{
67 return 0x10;
68}
69static inline u32 perf_pmasys_control_membuf_clear_status_f(u32 v)
70{
71 return (v & 0x1) << 5;
72}
73static inline u32 perf_pmasys_control_membuf_clear_status_v(u32 r)
74{
75 return (r >> 5) & 0x1;
76}
77static inline u32 perf_pmasys_control_membuf_clear_status_doit_v(void)
78{
79 return 0x00000001;
80}
81static inline u32 perf_pmasys_control_membuf_clear_status_doit_f(void)
82{
83 return 0x20;
84}
85static inline u32 perf_pmasys_mem_block_r(void)
86{
87 return 0x001b4070;
88}
89static inline u32 perf_pmasys_mem_block_base_f(u32 v)
90{
91 return (v & 0xfffffff) << 0;
92}
93static inline u32 perf_pmasys_mem_block_target_f(u32 v)
94{
95 return (v & 0x3) << 28;
96}
97static inline u32 perf_pmasys_mem_block_target_v(u32 r)
98{
99 return (r >> 28) & 0x3;
100}
101static inline u32 perf_pmasys_mem_block_target_lfb_v(void)
102{
103 return 0x00000000;
104}
105static inline u32 perf_pmasys_mem_block_target_lfb_f(void)
106{
107 return 0x0;
108}
109static inline u32 perf_pmasys_mem_block_target_sys_coh_v(void)
110{
111 return 0x00000002;
112}
113static inline u32 perf_pmasys_mem_block_target_sys_coh_f(void)
114{
115 return 0x20000000;
116}
117static inline u32 perf_pmasys_mem_block_target_sys_ncoh_v(void)
118{
119 return 0x00000003;
120}
121static inline u32 perf_pmasys_mem_block_target_sys_ncoh_f(void)
122{
123 return 0x30000000;
124}
125static inline u32 perf_pmasys_mem_block_valid_f(u32 v)
126{
127 return (v & 0x1) << 31;
128}
129static inline u32 perf_pmasys_mem_block_valid_v(u32 r)
130{
131 return (r >> 31) & 0x1;
132}
133static inline u32 perf_pmasys_mem_block_valid_true_v(void)
134{
135 return 0x00000001;
136}
137static inline u32 perf_pmasys_mem_block_valid_true_f(void)
138{
139 return 0x80000000;
140}
141static inline u32 perf_pmasys_mem_block_valid_false_v(void)
142{
143 return 0x00000000;
144}
145static inline u32 perf_pmasys_mem_block_valid_false_f(void)
146{
147 return 0x0;
148}
149static inline u32 perf_pmasys_outbase_r(void)
150{
151 return 0x001b4074;
152}
153static inline u32 perf_pmasys_outbase_ptr_f(u32 v)
154{
155 return (v & 0x7ffffff) << 5;
156}
157static inline u32 perf_pmasys_outbaseupper_r(void)
158{
159 return 0x001b4078;
160}
161static inline u32 perf_pmasys_outbaseupper_ptr_f(u32 v)
162{
163 return (v & 0xff) << 0;
164}
165static inline u32 perf_pmasys_outsize_r(void)
166{
167 return 0x001b407c;
168}
169static inline u32 perf_pmasys_outsize_numbytes_f(u32 v)
170{
171 return (v & 0x7ffffff) << 5;
172}
173static inline u32 perf_pmasys_mem_bytes_r(void)
174{
175 return 0x001b4084;
176}
177static inline u32 perf_pmasys_mem_bytes_numbytes_f(u32 v)
178{
179 return (v & 0xfffffff) << 4;
180}
181static inline u32 perf_pmasys_mem_bump_r(void)
182{
183 return 0x001b4088;
184}
185static inline u32 perf_pmasys_mem_bump_numbytes_f(u32 v)
186{
187 return (v & 0xfffffff) << 4;
188}
189static inline u32 perf_pmasys_enginestatus_r(void)
190{
191 return 0x001b40a4;
192}
193static inline u32 perf_pmasys_enginestatus_rbufempty_f(u32 v)
194{
195 return (v & 0x1) << 4;
196}
197static inline u32 perf_pmasys_enginestatus_rbufempty_empty_v(void)
198{
199 return 0x00000001;
200}
201static inline u32 perf_pmasys_enginestatus_rbufempty_empty_f(void)
202{
203 return 0x10;
204}
205#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_pri_ringmaster_gp106.h b/drivers/gpu/nvgpu/gp106/hw_pri_ringmaster_gp106.h
new file mode 100644
index 00000000..0eb2187a
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_pri_ringmaster_gp106.h
@@ -0,0 +1,145 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_pri_ringmaster_gp106_h_
51#define _hw_pri_ringmaster_gp106_h_
52
53static inline u32 pri_ringmaster_command_r(void)
54{
55 return 0x0012004c;
56}
57static inline u32 pri_ringmaster_command_cmd_m(void)
58{
59 return 0x3f << 0;
60}
61static inline u32 pri_ringmaster_command_cmd_v(u32 r)
62{
63 return (r >> 0) & 0x3f;
64}
65static inline u32 pri_ringmaster_command_cmd_no_cmd_v(void)
66{
67 return 0x00000000;
68}
69static inline u32 pri_ringmaster_command_cmd_start_ring_f(void)
70{
71 return 0x1;
72}
73static inline u32 pri_ringmaster_command_cmd_ack_interrupt_f(void)
74{
75 return 0x2;
76}
77static inline u32 pri_ringmaster_command_cmd_enumerate_stations_f(void)
78{
79 return 0x3;
80}
81static inline u32 pri_ringmaster_command_cmd_enumerate_stations_bc_grp_all_f(void)
82{
83 return 0x0;
84}
85static inline u32 pri_ringmaster_command_data_r(void)
86{
87 return 0x00120048;
88}
89static inline u32 pri_ringmaster_start_results_r(void)
90{
91 return 0x00120050;
92}
93static inline u32 pri_ringmaster_start_results_connectivity_v(u32 r)
94{
95 return (r >> 0) & 0x1;
96}
97static inline u32 pri_ringmaster_start_results_connectivity_pass_v(void)
98{
99 return 0x00000001;
100}
101static inline u32 pri_ringmaster_intr_status0_r(void)
102{
103 return 0x00120058;
104}
105static inline u32 pri_ringmaster_intr_status1_r(void)
106{
107 return 0x0012005c;
108}
109static inline u32 pri_ringmaster_global_ctl_r(void)
110{
111 return 0x00120060;
112}
113static inline u32 pri_ringmaster_global_ctl_ring_reset_asserted_f(void)
114{
115 return 0x1;
116}
117static inline u32 pri_ringmaster_global_ctl_ring_reset_deasserted_f(void)
118{
119 return 0x0;
120}
121static inline u32 pri_ringmaster_enum_fbp_r(void)
122{
123 return 0x00120074;
124}
125static inline u32 pri_ringmaster_enum_fbp_count_v(u32 r)
126{
127 return (r >> 0) & 0x1f;
128}
129static inline u32 pri_ringmaster_enum_gpc_r(void)
130{
131 return 0x00120078;
132}
133static inline u32 pri_ringmaster_enum_gpc_count_v(u32 r)
134{
135 return (r >> 0) & 0x1f;
136}
137static inline u32 pri_ringmaster_enum_ltc_r(void)
138{
139 return 0x0012006c;
140}
141static inline u32 pri_ringmaster_enum_ltc_count_v(u32 r)
142{
143 return (r >> 0) & 0x1f;
144}
145#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_pri_ringstation_sys_gp106.h b/drivers/gpu/nvgpu/gp106/hw_pri_ringstation_sys_gp106.h
new file mode 100644
index 00000000..a22d6a05
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_pri_ringstation_sys_gp106.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_pri_ringstation_sys_gp106_h_
51#define _hw_pri_ringstation_sys_gp106_h_
52
53static inline u32 pri_ringstation_sys_master_config_r(u32 i)
54{
55 return 0x00122300 + i*4;
56}
57static inline u32 pri_ringstation_sys_decode_config_r(void)
58{
59 return 0x00122204;
60}
61static inline u32 pri_ringstation_sys_decode_config_ring_m(void)
62{
63 return 0x7 << 0;
64}
65static inline u32 pri_ringstation_sys_decode_config_ring_drop_on_ring_not_started_f(void)
66{
67 return 0x1;
68}
69#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_proj_gp106.h b/drivers/gpu/nvgpu/gp106/hw_proj_gp106.h
new file mode 100644
index 00000000..8042bcae
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_proj_gp106.h
@@ -0,0 +1,165 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_proj_gp106_h_
51#define _hw_proj_gp106_h_
52
53static inline u32 proj_gpc_base_v(void)
54{
55 return 0x00500000;
56}
57static inline u32 proj_gpc_shared_base_v(void)
58{
59 return 0x00418000;
60}
61static inline u32 proj_gpc_stride_v(void)
62{
63 return 0x00008000;
64}
65static inline u32 proj_ltc_stride_v(void)
66{
67 return 0x00002000;
68}
69static inline u32 proj_lts_stride_v(void)
70{
71 return 0x00000200;
72}
73static inline u32 proj_fbpa_base_v(void)
74{
75 return 0x00900000;
76}
77static inline u32 proj_fbpa_shared_base_v(void)
78{
79 return 0x009a0000;
80}
81static inline u32 proj_fbpa_stride_v(void)
82{
83 return 0x00004000;
84}
85static inline u32 proj_ppc_in_gpc_base_v(void)
86{
87 return 0x00003000;
88}
89static inline u32 proj_ppc_in_gpc_shared_base_v(void)
90{
91 return 0x00003e00;
92}
93static inline u32 proj_ppc_in_gpc_stride_v(void)
94{
95 return 0x00000200;
96}
97static inline u32 proj_rop_base_v(void)
98{
99 return 0x00410000;
100}
101static inline u32 proj_rop_shared_base_v(void)
102{
103 return 0x00408800;
104}
105static inline u32 proj_rop_stride_v(void)
106{
107 return 0x00000400;
108}
109static inline u32 proj_tpc_in_gpc_base_v(void)
110{
111 return 0x00004000;
112}
113static inline u32 proj_tpc_in_gpc_stride_v(void)
114{
115 return 0x00000800;
116}
117static inline u32 proj_tpc_in_gpc_shared_base_v(void)
118{
119 return 0x00001800;
120}
121static inline u32 proj_host_num_engines_v(void)
122{
123 return 0x00000009;
124}
125static inline u32 proj_host_num_pbdma_v(void)
126{
127 return 0x00000004;
128}
129static inline u32 proj_scal_litter_num_tpc_per_gpc_v(void)
130{
131 return 0x00000005;
132}
133static inline u32 proj_scal_litter_num_fbps_v(void)
134{
135 return 0x00000006;
136}
137static inline u32 proj_scal_litter_num_fbpas_v(void)
138{
139 return 0x00000006;
140}
141static inline u32 proj_scal_litter_num_gpcs_v(void)
142{
143 return 0x00000006;
144}
145static inline u32 proj_scal_litter_num_pes_per_gpc_v(void)
146{
147 return 0x00000003;
148}
149static inline u32 proj_scal_litter_num_tpcs_per_pes_v(void)
150{
151 return 0x00000002;
152}
153static inline u32 proj_scal_litter_num_zcull_banks_v(void)
154{
155 return 0x00000004;
156}
157static inline u32 proj_scal_max_gpcs_v(void)
158{
159 return 0x00000020;
160}
161static inline u32 proj_scal_max_tpc_per_gpc_v(void)
162{
163 return 0x00000008;
164}
165#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_psec_gp106.h b/drivers/gpu/nvgpu/gp106/hw_psec_gp106.h
new file mode 100644
index 00000000..f9c9f69c
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_psec_gp106.h
@@ -0,0 +1,609 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_psec_gp106_h_
51#define _hw_psec_gp106_h_
52
53static inline u32 psec_falcon_irqsset_r(void)
54{
55 return 0x00087000;
56}
57static inline u32 psec_falcon_irqsset_swgen0_set_f(void)
58{
59 return 0x40;
60}
61static inline u32 psec_falcon_irqsclr_r(void)
62{
63 return 0x00087004;
64}
65static inline u32 psec_falcon_irqstat_r(void)
66{
67 return 0x00087008;
68}
69static inline u32 psec_falcon_irqstat_halt_true_f(void)
70{
71 return 0x10;
72}
73static inline u32 psec_falcon_irqstat_exterr_true_f(void)
74{
75 return 0x20;
76}
77static inline u32 psec_falcon_irqstat_swgen0_true_f(void)
78{
79 return 0x40;
80}
81static inline u32 psec_falcon_irqmode_r(void)
82{
83 return 0x0008700c;
84}
85static inline u32 psec_falcon_irqmset_r(void)
86{
87 return 0x00087010;
88}
89static inline u32 psec_falcon_irqmset_gptmr_f(u32 v)
90{
91 return (v & 0x1) << 0;
92}
93static inline u32 psec_falcon_irqmset_wdtmr_f(u32 v)
94{
95 return (v & 0x1) << 1;
96}
97static inline u32 psec_falcon_irqmset_mthd_f(u32 v)
98{
99 return (v & 0x1) << 2;
100}
101static inline u32 psec_falcon_irqmset_ctxsw_f(u32 v)
102{
103 return (v & 0x1) << 3;
104}
105static inline u32 psec_falcon_irqmset_halt_f(u32 v)
106{
107 return (v & 0x1) << 4;
108}
109static inline u32 psec_falcon_irqmset_exterr_f(u32 v)
110{
111 return (v & 0x1) << 5;
112}
113static inline u32 psec_falcon_irqmset_swgen0_f(u32 v)
114{
115 return (v & 0x1) << 6;
116}
117static inline u32 psec_falcon_irqmset_swgen1_f(u32 v)
118{
119 return (v & 0x1) << 7;
120}
121static inline u32 psec_falcon_irqmclr_r(void)
122{
123 return 0x00087014;
124}
125static inline u32 psec_falcon_irqmclr_gptmr_f(u32 v)
126{
127 return (v & 0x1) << 0;
128}
129static inline u32 psec_falcon_irqmclr_wdtmr_f(u32 v)
130{
131 return (v & 0x1) << 1;
132}
133static inline u32 psec_falcon_irqmclr_mthd_f(u32 v)
134{
135 return (v & 0x1) << 2;
136}
137static inline u32 psec_falcon_irqmclr_ctxsw_f(u32 v)
138{
139 return (v & 0x1) << 3;
140}
141static inline u32 psec_falcon_irqmclr_halt_f(u32 v)
142{
143 return (v & 0x1) << 4;
144}
145static inline u32 psec_falcon_irqmclr_exterr_f(u32 v)
146{
147 return (v & 0x1) << 5;
148}
149static inline u32 psec_falcon_irqmclr_swgen0_f(u32 v)
150{
151 return (v & 0x1) << 6;
152}
153static inline u32 psec_falcon_irqmclr_swgen1_f(u32 v)
154{
155 return (v & 0x1) << 7;
156}
157static inline u32 psec_falcon_irqmclr_ext_f(u32 v)
158{
159 return (v & 0xff) << 8;
160}
161static inline u32 psec_falcon_irqmask_r(void)
162{
163 return 0x00087018;
164}
165static inline u32 psec_falcon_irqdest_r(void)
166{
167 return 0x0008701c;
168}
169static inline u32 psec_falcon_irqdest_host_gptmr_f(u32 v)
170{
171 return (v & 0x1) << 0;
172}
173static inline u32 psec_falcon_irqdest_host_wdtmr_f(u32 v)
174{
175 return (v & 0x1) << 1;
176}
177static inline u32 psec_falcon_irqdest_host_mthd_f(u32 v)
178{
179 return (v & 0x1) << 2;
180}
181static inline u32 psec_falcon_irqdest_host_ctxsw_f(u32 v)
182{
183 return (v & 0x1) << 3;
184}
185static inline u32 psec_falcon_irqdest_host_halt_f(u32 v)
186{
187 return (v & 0x1) << 4;
188}
189static inline u32 psec_falcon_irqdest_host_exterr_f(u32 v)
190{
191 return (v & 0x1) << 5;
192}
193static inline u32 psec_falcon_irqdest_host_swgen0_f(u32 v)
194{
195 return (v & 0x1) << 6;
196}
197static inline u32 psec_falcon_irqdest_host_swgen1_f(u32 v)
198{
199 return (v & 0x1) << 7;
200}
201static inline u32 psec_falcon_irqdest_host_ext_f(u32 v)
202{
203 return (v & 0xff) << 8;
204}
205static inline u32 psec_falcon_irqdest_target_gptmr_f(u32 v)
206{
207 return (v & 0x1) << 16;
208}
209static inline u32 psec_falcon_irqdest_target_wdtmr_f(u32 v)
210{
211 return (v & 0x1) << 17;
212}
213static inline u32 psec_falcon_irqdest_target_mthd_f(u32 v)
214{
215 return (v & 0x1) << 18;
216}
217static inline u32 psec_falcon_irqdest_target_ctxsw_f(u32 v)
218{
219 return (v & 0x1) << 19;
220}
221static inline u32 psec_falcon_irqdest_target_halt_f(u32 v)
222{
223 return (v & 0x1) << 20;
224}
225static inline u32 psec_falcon_irqdest_target_exterr_f(u32 v)
226{
227 return (v & 0x1) << 21;
228}
229static inline u32 psec_falcon_irqdest_target_swgen0_f(u32 v)
230{
231 return (v & 0x1) << 22;
232}
233static inline u32 psec_falcon_irqdest_target_swgen1_f(u32 v)
234{
235 return (v & 0x1) << 23;
236}
237static inline u32 psec_falcon_irqdest_target_ext_f(u32 v)
238{
239 return (v & 0xff) << 24;
240}
241static inline u32 psec_falcon_curctx_r(void)
242{
243 return 0x00087050;
244}
245static inline u32 psec_falcon_nxtctx_r(void)
246{
247 return 0x00087054;
248}
249static inline u32 psec_falcon_mailbox0_r(void)
250{
251 return 0x00087040;
252}
253static inline u32 psec_falcon_mailbox1_r(void)
254{
255 return 0x00087044;
256}
257static inline u32 psec_falcon_itfen_r(void)
258{
259 return 0x00087048;
260}
261static inline u32 psec_falcon_itfen_ctxen_enable_f(void)
262{
263 return 0x1;
264}
265static inline u32 psec_falcon_idlestate_r(void)
266{
267 return 0x0008704c;
268}
269static inline u32 psec_falcon_idlestate_falcon_busy_v(u32 r)
270{
271 return (r >> 0) & 0x1;
272}
273static inline u32 psec_falcon_idlestate_ext_busy_v(u32 r)
274{
275 return (r >> 1) & 0x7fff;
276}
277static inline u32 psec_falcon_os_r(void)
278{
279 return 0x00087080;
280}
281static inline u32 psec_falcon_engctl_r(void)
282{
283 return 0x000870a4;
284}
285static inline u32 psec_falcon_cpuctl_r(void)
286{
287 return 0x00087100;
288}
289static inline u32 psec_falcon_cpuctl_startcpu_f(u32 v)
290{
291 return (v & 0x1) << 1;
292}
293static inline u32 psec_falcon_cpuctl_halt_intr_f(u32 v)
294{
295 return (v & 0x1) << 4;
296}
297static inline u32 psec_falcon_cpuctl_halt_intr_m(void)
298{
299 return 0x1 << 4;
300}
301static inline u32 psec_falcon_cpuctl_halt_intr_v(u32 r)
302{
303 return (r >> 4) & 0x1;
304}
305static inline u32 psec_falcon_cpuctl_cpuctl_alias_en_f(u32 v)
306{
307 return (v & 0x1) << 6;
308}
309static inline u32 psec_falcon_cpuctl_cpuctl_alias_en_m(void)
310{
311 return 0x1 << 6;
312}
313static inline u32 psec_falcon_cpuctl_cpuctl_alias_en_v(u32 r)
314{
315 return (r >> 6) & 0x1;
316}
317static inline u32 psec_falcon_cpuctl_alias_r(void)
318{
319 return 0x00087130;
320}
321static inline u32 psec_falcon_cpuctl_alias_startcpu_f(u32 v)
322{
323 return (v & 0x1) << 1;
324}
325static inline u32 psec_falcon_imemc_r(u32 i)
326{
327 return 0x00087180 + i*16;
328}
329static inline u32 psec_falcon_imemc_offs_f(u32 v)
330{
331 return (v & 0x3f) << 2;
332}
333static inline u32 psec_falcon_imemc_blk_f(u32 v)
334{
335 return (v & 0xff) << 8;
336}
337static inline u32 psec_falcon_imemc_aincw_f(u32 v)
338{
339 return (v & 0x1) << 24;
340}
341static inline u32 psec_falcon_imemd_r(u32 i)
342{
343 return 0x00087184 + i*16;
344}
345static inline u32 psec_falcon_imemt_r(u32 i)
346{
347 return 0x00087188 + i*16;
348}
349static inline u32 psec_falcon_sctl_r(void)
350{
351 return 0x00087240;
352}
353static inline u32 psec_falcon_mmu_phys_sec_r(void)
354{
355 return 0x00100ce4;
356}
357static inline u32 psec_falcon_bootvec_r(void)
358{
359 return 0x00087104;
360}
361static inline u32 psec_falcon_bootvec_vec_f(u32 v)
362{
363 return (v & 0xffffffff) << 0;
364}
365static inline u32 psec_falcon_dmactl_r(void)
366{
367 return 0x0008710c;
368}
369static inline u32 psec_falcon_dmactl_dmem_scrubbing_m(void)
370{
371 return 0x1 << 1;
372}
373static inline u32 psec_falcon_dmactl_imem_scrubbing_m(void)
374{
375 return 0x1 << 2;
376}
377static inline u32 psec_falcon_dmactl_require_ctx_f(u32 v)
378{
379 return (v & 0x1) << 0;
380}
381static inline u32 psec_falcon_hwcfg_r(void)
382{
383 return 0x00087108;
384}
385static inline u32 psec_falcon_hwcfg_imem_size_v(u32 r)
386{
387 return (r >> 0) & 0x1ff;
388}
389static inline u32 psec_falcon_hwcfg_dmem_size_v(u32 r)
390{
391 return (r >> 9) & 0x1ff;
392}
393static inline u32 psec_falcon_dmatrfbase_r(void)
394{
395 return 0x00087110;
396}
397static inline u32 psec_falcon_dmatrfbase1_r(void)
398{
399 return 0x00087128;
400}
401static inline u32 psec_falcon_dmatrfmoffs_r(void)
402{
403 return 0x00087114;
404}
405static inline u32 psec_falcon_dmatrfcmd_r(void)
406{
407 return 0x00087118;
408}
409static inline u32 psec_falcon_dmatrfcmd_imem_f(u32 v)
410{
411 return (v & 0x1) << 4;
412}
413static inline u32 psec_falcon_dmatrfcmd_write_f(u32 v)
414{
415 return (v & 0x1) << 5;
416}
417static inline u32 psec_falcon_dmatrfcmd_size_f(u32 v)
418{
419 return (v & 0x7) << 8;
420}
421static inline u32 psec_falcon_dmatrfcmd_ctxdma_f(u32 v)
422{
423 return (v & 0x7) << 12;
424}
425static inline u32 psec_falcon_dmatrffboffs_r(void)
426{
427 return 0x0008711c;
428}
429static inline u32 psec_falcon_exterraddr_r(void)
430{
431 return 0x00087168;
432}
433static inline u32 psec_falcon_exterrstat_r(void)
434{
435 return 0x0008716c;
436}
437static inline u32 psec_falcon_exterrstat_valid_m(void)
438{
439 return 0x1 << 31;
440}
441static inline u32 psec_falcon_exterrstat_valid_v(u32 r)
442{
443 return (r >> 31) & 0x1;
444}
445static inline u32 psec_falcon_exterrstat_valid_true_v(void)
446{
447 return 0x00000001;
448}
449static inline u32 psec_sec2_falcon_icd_cmd_r(void)
450{
451 return 0x00087200;
452}
453static inline u32 psec_sec2_falcon_icd_cmd_opc_s(void)
454{
455 return 4;
456}
457static inline u32 psec_sec2_falcon_icd_cmd_opc_f(u32 v)
458{
459 return (v & 0xf) << 0;
460}
461static inline u32 psec_sec2_falcon_icd_cmd_opc_m(void)
462{
463 return 0xf << 0;
464}
465static inline u32 psec_sec2_falcon_icd_cmd_opc_v(u32 r)
466{
467 return (r >> 0) & 0xf;
468}
469static inline u32 psec_sec2_falcon_icd_cmd_opc_rreg_f(void)
470{
471 return 0x8;
472}
473static inline u32 psec_sec2_falcon_icd_cmd_opc_rstat_f(void)
474{
475 return 0xe;
476}
477static inline u32 psec_sec2_falcon_icd_cmd_idx_f(u32 v)
478{
479 return (v & 0x1f) << 8;
480}
481static inline u32 psec_sec2_falcon_icd_rdata_r(void)
482{
483 return 0x0008720c;
484}
485static inline u32 psec_falcon_dmemc_r(u32 i)
486{
487 return 0x000871c0 + i*8;
488}
489static inline u32 psec_falcon_dmemc_offs_f(u32 v)
490{
491 return (v & 0x3f) << 2;
492}
493static inline u32 psec_falcon_dmemc_offs_m(void)
494{
495 return 0x3f << 2;
496}
497static inline u32 psec_falcon_dmemc_blk_f(u32 v)
498{
499 return (v & 0xff) << 8;
500}
501static inline u32 psec_falcon_dmemc_blk_m(void)
502{
503 return 0xff << 8;
504}
505static inline u32 psec_falcon_dmemc_aincw_f(u32 v)
506{
507 return (v & 0x1) << 24;
508}
509static inline u32 psec_falcon_dmemc_aincr_f(u32 v)
510{
511 return (v & 0x1) << 25;
512}
513static inline u32 psec_falcon_dmemd_r(u32 i)
514{
515 return 0x000871c4 + i*8;
516}
517static inline u32 psec_falcon_debug1_r(void)
518{
519 return 0x00087090;
520}
521static inline u32 psec_falcon_debug1_ctxsw_mode_s(void)
522{
523 return 1;
524}
525static inline u32 psec_falcon_debug1_ctxsw_mode_f(u32 v)
526{
527 return (v & 0x1) << 16;
528}
529static inline u32 psec_falcon_debug1_ctxsw_mode_m(void)
530{
531 return 0x1 << 16;
532}
533static inline u32 psec_falcon_debug1_ctxsw_mode_v(u32 r)
534{
535 return (r >> 16) & 0x1;
536}
537static inline u32 psec_falcon_debug1_ctxsw_mode_init_f(void)
538{
539 return 0x0;
540}
541static inline u32 psec_fbif_transcfg_r(u32 i)
542{
543 return 0x00087600 + i*4;
544}
545static inline u32 psec_fbif_transcfg_target_local_fb_f(void)
546{
547 return 0x0;
548}
549static inline u32 psec_fbif_transcfg_target_coherent_sysmem_f(void)
550{
551 return 0x1;
552}
553static inline u32 psec_fbif_transcfg_target_noncoherent_sysmem_f(void)
554{
555 return 0x2;
556}
557static inline u32 psec_fbif_transcfg_mem_type_s(void)
558{
559 return 1;
560}
561static inline u32 psec_fbif_transcfg_mem_type_f(u32 v)
562{
563 return (v & 0x1) << 2;
564}
565static inline u32 psec_fbif_transcfg_mem_type_m(void)
566{
567 return 0x1 << 2;
568}
569static inline u32 psec_fbif_transcfg_mem_type_v(u32 r)
570{
571 return (r >> 2) & 0x1;
572}
573static inline u32 psec_fbif_transcfg_mem_type_virtual_f(void)
574{
575 return 0x0;
576}
577static inline u32 psec_fbif_transcfg_mem_type_physical_f(void)
578{
579 return 0x4;
580}
581static inline u32 psec_falcon_engine_r(void)
582{
583 return 0x000873c0;
584}
585static inline u32 psec_falcon_engine_reset_true_f(void)
586{
587 return 0x1;
588}
589static inline u32 psec_falcon_engine_reset_false_f(void)
590{
591 return 0x0;
592}
593static inline u32 psec_fbif_ctl_r(void)
594{
595 return 0x00087624;
596}
597static inline u32 psec_fbif_ctl_allow_phys_no_ctx_init_f(void)
598{
599 return 0x0;
600}
601static inline u32 psec_fbif_ctl_allow_phys_no_ctx_disallow_f(void)
602{
603 return 0x0;
604}
605static inline u32 psec_fbif_ctl_allow_phys_no_ctx_allow_f(void)
606{
607 return 0x80;
608}
609#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_pwr_gp106.h b/drivers/gpu/nvgpu/gp106/hw_pwr_gp106.h
new file mode 100644
index 00000000..b4dfea0d
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_pwr_gp106.h
@@ -0,0 +1,841 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_pwr_gp106_h_
51#define _hw_pwr_gp106_h_
52
53static inline u32 pwr_falcon_irqsset_r(void)
54{
55 return 0x0010a000;
56}
57static inline u32 pwr_falcon_irqsset_swgen0_set_f(void)
58{
59 return 0x40;
60}
61static inline u32 pwr_falcon_irqsclr_r(void)
62{
63 return 0x0010a004;
64}
65static inline u32 pwr_falcon_irqstat_r(void)
66{
67 return 0x0010a008;
68}
69static inline u32 pwr_falcon_irqstat_halt_true_f(void)
70{
71 return 0x10;
72}
73static inline u32 pwr_falcon_irqstat_exterr_true_f(void)
74{
75 return 0x20;
76}
77static inline u32 pwr_falcon_irqstat_swgen0_true_f(void)
78{
79 return 0x40;
80}
81static inline u32 pwr_falcon_irqmode_r(void)
82{
83 return 0x0010a00c;
84}
85static inline u32 pwr_falcon_irqmset_r(void)
86{
87 return 0x0010a010;
88}
89static inline u32 pwr_falcon_irqmset_gptmr_f(u32 v)
90{
91 return (v & 0x1) << 0;
92}
93static inline u32 pwr_falcon_irqmset_wdtmr_f(u32 v)
94{
95 return (v & 0x1) << 1;
96}
97static inline u32 pwr_falcon_irqmset_mthd_f(u32 v)
98{
99 return (v & 0x1) << 2;
100}
101static inline u32 pwr_falcon_irqmset_ctxsw_f(u32 v)
102{
103 return (v & 0x1) << 3;
104}
105static inline u32 pwr_falcon_irqmset_halt_f(u32 v)
106{
107 return (v & 0x1) << 4;
108}
109static inline u32 pwr_falcon_irqmset_exterr_f(u32 v)
110{
111 return (v & 0x1) << 5;
112}
113static inline u32 pwr_falcon_irqmset_swgen0_f(u32 v)
114{
115 return (v & 0x1) << 6;
116}
117static inline u32 pwr_falcon_irqmset_swgen1_f(u32 v)
118{
119 return (v & 0x1) << 7;
120}
121static inline u32 pwr_falcon_irqmclr_r(void)
122{
123 return 0x0010a014;
124}
125static inline u32 pwr_falcon_irqmclr_gptmr_f(u32 v)
126{
127 return (v & 0x1) << 0;
128}
129static inline u32 pwr_falcon_irqmclr_wdtmr_f(u32 v)
130{
131 return (v & 0x1) << 1;
132}
133static inline u32 pwr_falcon_irqmclr_mthd_f(u32 v)
134{
135 return (v & 0x1) << 2;
136}
137static inline u32 pwr_falcon_irqmclr_ctxsw_f(u32 v)
138{
139 return (v & 0x1) << 3;
140}
141static inline u32 pwr_falcon_irqmclr_halt_f(u32 v)
142{
143 return (v & 0x1) << 4;
144}
145static inline u32 pwr_falcon_irqmclr_exterr_f(u32 v)
146{
147 return (v & 0x1) << 5;
148}
149static inline u32 pwr_falcon_irqmclr_swgen0_f(u32 v)
150{
151 return (v & 0x1) << 6;
152}
153static inline u32 pwr_falcon_irqmclr_swgen1_f(u32 v)
154{
155 return (v & 0x1) << 7;
156}
157static inline u32 pwr_falcon_irqmclr_ext_f(u32 v)
158{
159 return (v & 0xff) << 8;
160}
161static inline u32 pwr_falcon_irqmask_r(void)
162{
163 return 0x0010a018;
164}
165static inline u32 pwr_falcon_irqdest_r(void)
166{
167 return 0x0010a01c;
168}
169static inline u32 pwr_falcon_irqdest_host_gptmr_f(u32 v)
170{
171 return (v & 0x1) << 0;
172}
173static inline u32 pwr_falcon_irqdest_host_wdtmr_f(u32 v)
174{
175 return (v & 0x1) << 1;
176}
177static inline u32 pwr_falcon_irqdest_host_mthd_f(u32 v)
178{
179 return (v & 0x1) << 2;
180}
181static inline u32 pwr_falcon_irqdest_host_ctxsw_f(u32 v)
182{
183 return (v & 0x1) << 3;
184}
185static inline u32 pwr_falcon_irqdest_host_halt_f(u32 v)
186{
187 return (v & 0x1) << 4;
188}
189static inline u32 pwr_falcon_irqdest_host_exterr_f(u32 v)
190{
191 return (v & 0x1) << 5;
192}
193static inline u32 pwr_falcon_irqdest_host_swgen0_f(u32 v)
194{
195 return (v & 0x1) << 6;
196}
197static inline u32 pwr_falcon_irqdest_host_swgen1_f(u32 v)
198{
199 return (v & 0x1) << 7;
200}
201static inline u32 pwr_falcon_irqdest_host_ext_f(u32 v)
202{
203 return (v & 0xff) << 8;
204}
205static inline u32 pwr_falcon_irqdest_target_gptmr_f(u32 v)
206{
207 return (v & 0x1) << 16;
208}
209static inline u32 pwr_falcon_irqdest_target_wdtmr_f(u32 v)
210{
211 return (v & 0x1) << 17;
212}
213static inline u32 pwr_falcon_irqdest_target_mthd_f(u32 v)
214{
215 return (v & 0x1) << 18;
216}
217static inline u32 pwr_falcon_irqdest_target_ctxsw_f(u32 v)
218{
219 return (v & 0x1) << 19;
220}
221static inline u32 pwr_falcon_irqdest_target_halt_f(u32 v)
222{
223 return (v & 0x1) << 20;
224}
225static inline u32 pwr_falcon_irqdest_target_exterr_f(u32 v)
226{
227 return (v & 0x1) << 21;
228}
229static inline u32 pwr_falcon_irqdest_target_swgen0_f(u32 v)
230{
231 return (v & 0x1) << 22;
232}
233static inline u32 pwr_falcon_irqdest_target_swgen1_f(u32 v)
234{
235 return (v & 0x1) << 23;
236}
237static inline u32 pwr_falcon_irqdest_target_ext_f(u32 v)
238{
239 return (v & 0xff) << 24;
240}
241static inline u32 pwr_falcon_curctx_r(void)
242{
243 return 0x0010a050;
244}
245static inline u32 pwr_falcon_nxtctx_r(void)
246{
247 return 0x0010a054;
248}
249static inline u32 pwr_falcon_mailbox0_r(void)
250{
251 return 0x0010a040;
252}
253static inline u32 pwr_falcon_mailbox1_r(void)
254{
255 return 0x0010a044;
256}
257static inline u32 pwr_falcon_itfen_r(void)
258{
259 return 0x0010a048;
260}
261static inline u32 pwr_falcon_itfen_ctxen_enable_f(void)
262{
263 return 0x1;
264}
265static inline u32 pwr_falcon_idlestate_r(void)
266{
267 return 0x0010a04c;
268}
269static inline u32 pwr_falcon_idlestate_falcon_busy_v(u32 r)
270{
271 return (r >> 0) & 0x1;
272}
273static inline u32 pwr_falcon_idlestate_ext_busy_v(u32 r)
274{
275 return (r >> 1) & 0x7fff;
276}
277static inline u32 pwr_falcon_os_r(void)
278{
279 return 0x0010a080;
280}
281static inline u32 pwr_falcon_engctl_r(void)
282{
283 return 0x0010a0a4;
284}
285static inline u32 pwr_falcon_cpuctl_r(void)
286{
287 return 0x0010a100;
288}
289static inline u32 pwr_falcon_cpuctl_startcpu_f(u32 v)
290{
291 return (v & 0x1) << 1;
292}
293static inline u32 pwr_falcon_cpuctl_halt_intr_f(u32 v)
294{
295 return (v & 0x1) << 4;
296}
297static inline u32 pwr_falcon_cpuctl_halt_intr_m(void)
298{
299 return 0x1 << 4;
300}
301static inline u32 pwr_falcon_cpuctl_halt_intr_v(u32 r)
302{
303 return (r >> 4) & 0x1;
304}
305static inline u32 pwr_falcon_cpuctl_cpuctl_alias_en_f(u32 v)
306{
307 return (v & 0x1) << 6;
308}
309static inline u32 pwr_falcon_cpuctl_cpuctl_alias_en_m(void)
310{
311 return 0x1 << 6;
312}
313static inline u32 pwr_falcon_cpuctl_cpuctl_alias_en_v(u32 r)
314{
315 return (r >> 6) & 0x1;
316}
317static inline u32 pwr_falcon_cpuctl_alias_r(void)
318{
319 return 0x0010a130;
320}
321static inline u32 pwr_falcon_cpuctl_alias_startcpu_f(u32 v)
322{
323 return (v & 0x1) << 1;
324}
325static inline u32 pwr_pmu_scpctl_stat_r(void)
326{
327 return 0x0010ac08;
328}
329static inline u32 pwr_pmu_scpctl_stat_debug_mode_f(u32 v)
330{
331 return (v & 0x1) << 20;
332}
333static inline u32 pwr_pmu_scpctl_stat_debug_mode_m(void)
334{
335 return 0x1 << 20;
336}
337static inline u32 pwr_pmu_scpctl_stat_debug_mode_v(u32 r)
338{
339 return (r >> 20) & 0x1;
340}
341static inline u32 pwr_falcon_imemc_r(u32 i)
342{
343 return 0x0010a180 + i*16;
344}
345static inline u32 pwr_falcon_imemc_offs_f(u32 v)
346{
347 return (v & 0x3f) << 2;
348}
349static inline u32 pwr_falcon_imemc_blk_f(u32 v)
350{
351 return (v & 0xff) << 8;
352}
353static inline u32 pwr_falcon_imemc_aincw_f(u32 v)
354{
355 return (v & 0x1) << 24;
356}
357static inline u32 pwr_falcon_imemd_r(u32 i)
358{
359 return 0x0010a184 + i*16;
360}
361static inline u32 pwr_falcon_imemt_r(u32 i)
362{
363 return 0x0010a188 + i*16;
364}
365static inline u32 pwr_falcon_sctl_r(void)
366{
367 return 0x0010a240;
368}
369static inline u32 pwr_falcon_mmu_phys_sec_r(void)
370{
371 return 0x00100ce4;
372}
373static inline u32 pwr_falcon_bootvec_r(void)
374{
375 return 0x0010a104;
376}
377static inline u32 pwr_falcon_bootvec_vec_f(u32 v)
378{
379 return (v & 0xffffffff) << 0;
380}
381static inline u32 pwr_falcon_dmactl_r(void)
382{
383 return 0x0010a10c;
384}
385static inline u32 pwr_falcon_dmactl_dmem_scrubbing_m(void)
386{
387 return 0x1 << 1;
388}
389static inline u32 pwr_falcon_dmactl_imem_scrubbing_m(void)
390{
391 return 0x1 << 2;
392}
393static inline u32 pwr_falcon_dmactl_require_ctx_f(u32 v)
394{
395 return (v & 0x1) << 0;
396}
397static inline u32 pwr_falcon_hwcfg_r(void)
398{
399 return 0x0010a108;
400}
401static inline u32 pwr_falcon_hwcfg_imem_size_v(u32 r)
402{
403 return (r >> 0) & 0x1ff;
404}
405static inline u32 pwr_falcon_hwcfg_dmem_size_v(u32 r)
406{
407 return (r >> 9) & 0x1ff;
408}
409static inline u32 pwr_falcon_dmatrfbase_r(void)
410{
411 return 0x0010a110;
412}
413static inline u32 pwr_falcon_dmatrfbase1_r(void)
414{
415 return 0x0010a128;
416}
417static inline u32 pwr_falcon_dmatrfmoffs_r(void)
418{
419 return 0x0010a114;
420}
421static inline u32 pwr_falcon_dmatrfcmd_r(void)
422{
423 return 0x0010a118;
424}
425static inline u32 pwr_falcon_dmatrfcmd_imem_f(u32 v)
426{
427 return (v & 0x1) << 4;
428}
429static inline u32 pwr_falcon_dmatrfcmd_write_f(u32 v)
430{
431 return (v & 0x1) << 5;
432}
433static inline u32 pwr_falcon_dmatrfcmd_size_f(u32 v)
434{
435 return (v & 0x7) << 8;
436}
437static inline u32 pwr_falcon_dmatrfcmd_ctxdma_f(u32 v)
438{
439 return (v & 0x7) << 12;
440}
441static inline u32 pwr_falcon_dmatrffboffs_r(void)
442{
443 return 0x0010a11c;
444}
445static inline u32 pwr_falcon_exterraddr_r(void)
446{
447 return 0x0010a168;
448}
449static inline u32 pwr_falcon_exterrstat_r(void)
450{
451 return 0x0010a16c;
452}
453static inline u32 pwr_falcon_exterrstat_valid_m(void)
454{
455 return 0x1 << 31;
456}
457static inline u32 pwr_falcon_exterrstat_valid_v(u32 r)
458{
459 return (r >> 31) & 0x1;
460}
461static inline u32 pwr_falcon_exterrstat_valid_true_v(void)
462{
463 return 0x00000001;
464}
465static inline u32 pwr_pmu_falcon_icd_cmd_r(void)
466{
467 return 0x0010a200;
468}
469static inline u32 pwr_pmu_falcon_icd_cmd_opc_s(void)
470{
471 return 4;
472}
473static inline u32 pwr_pmu_falcon_icd_cmd_opc_f(u32 v)
474{
475 return (v & 0xf) << 0;
476}
477static inline u32 pwr_pmu_falcon_icd_cmd_opc_m(void)
478{
479 return 0xf << 0;
480}
481static inline u32 pwr_pmu_falcon_icd_cmd_opc_v(u32 r)
482{
483 return (r >> 0) & 0xf;
484}
485static inline u32 pwr_pmu_falcon_icd_cmd_opc_rreg_f(void)
486{
487 return 0x8;
488}
489static inline u32 pwr_pmu_falcon_icd_cmd_opc_rstat_f(void)
490{
491 return 0xe;
492}
493static inline u32 pwr_pmu_falcon_icd_cmd_idx_f(u32 v)
494{
495 return (v & 0x1f) << 8;
496}
497static inline u32 pwr_pmu_falcon_icd_rdata_r(void)
498{
499 return 0x0010a20c;
500}
501static inline u32 pwr_falcon_dmemc_r(u32 i)
502{
503 return 0x0010a1c0 + i*8;
504}
505static inline u32 pwr_falcon_dmemc_offs_f(u32 v)
506{
507 return (v & 0x3f) << 2;
508}
509static inline u32 pwr_falcon_dmemc_offs_m(void)
510{
511 return 0x3f << 2;
512}
513static inline u32 pwr_falcon_dmemc_blk_f(u32 v)
514{
515 return (v & 0xff) << 8;
516}
517static inline u32 pwr_falcon_dmemc_blk_m(void)
518{
519 return 0xff << 8;
520}
521static inline u32 pwr_falcon_dmemc_aincw_f(u32 v)
522{
523 return (v & 0x1) << 24;
524}
525static inline u32 pwr_falcon_dmemc_aincr_f(u32 v)
526{
527 return (v & 0x1) << 25;
528}
529static inline u32 pwr_falcon_dmemd_r(u32 i)
530{
531 return 0x0010a1c4 + i*8;
532}
533static inline u32 pwr_pmu_new_instblk_r(void)
534{
535 return 0x0010a480;
536}
537static inline u32 pwr_pmu_new_instblk_ptr_f(u32 v)
538{
539 return (v & 0xfffffff) << 0;
540}
541static inline u32 pwr_pmu_new_instblk_target_fb_f(void)
542{
543 return 0x0;
544}
545static inline u32 pwr_pmu_new_instblk_target_sys_coh_f(void)
546{
547 return 0x20000000;
548}
549static inline u32 pwr_pmu_new_instblk_target_sys_ncoh_f(void)
550{
551 return 0x30000000;
552}
553static inline u32 pwr_pmu_new_instblk_valid_f(u32 v)
554{
555 return (v & 0x1) << 30;
556}
557static inline u32 pwr_pmu_mutex_id_r(void)
558{
559 return 0x0010a488;
560}
561static inline u32 pwr_pmu_mutex_id_value_v(u32 r)
562{
563 return (r >> 0) & 0xff;
564}
565static inline u32 pwr_pmu_mutex_id_value_init_v(void)
566{
567 return 0x00000000;
568}
569static inline u32 pwr_pmu_mutex_id_value_not_avail_v(void)
570{
571 return 0x000000ff;
572}
573static inline u32 pwr_pmu_mutex_id_release_r(void)
574{
575 return 0x0010a48c;
576}
577static inline u32 pwr_pmu_mutex_id_release_value_f(u32 v)
578{
579 return (v & 0xff) << 0;
580}
581static inline u32 pwr_pmu_mutex_id_release_value_m(void)
582{
583 return 0xff << 0;
584}
585static inline u32 pwr_pmu_mutex_id_release_value_init_v(void)
586{
587 return 0x00000000;
588}
589static inline u32 pwr_pmu_mutex_id_release_value_init_f(void)
590{
591 return 0x0;
592}
593static inline u32 pwr_pmu_mutex_r(u32 i)
594{
595 return 0x0010a580 + i*4;
596}
597static inline u32 pwr_pmu_mutex__size_1_v(void)
598{
599 return 0x00000010;
600}
601static inline u32 pwr_pmu_mutex_value_f(u32 v)
602{
603 return (v & 0xff) << 0;
604}
605static inline u32 pwr_pmu_mutex_value_v(u32 r)
606{
607 return (r >> 0) & 0xff;
608}
609static inline u32 pwr_pmu_mutex_value_initial_lock_f(void)
610{
611 return 0x0;
612}
613static inline u32 pwr_pmu_queue_head_r(u32 i)
614{
615 return 0x0010a4a0 + i*4;
616}
617static inline u32 pwr_pmu_queue_head__size_1_v(void)
618{
619 return 0x00000004;
620}
621static inline u32 pwr_pmu_queue_head_address_f(u32 v)
622{
623 return (v & 0xffffffff) << 0;
624}
625static inline u32 pwr_pmu_queue_head_address_v(u32 r)
626{
627 return (r >> 0) & 0xffffffff;
628}
629static inline u32 pwr_pmu_queue_tail_r(u32 i)
630{
631 return 0x0010a4b0 + i*4;
632}
633static inline u32 pwr_pmu_queue_tail__size_1_v(void)
634{
635 return 0x00000004;
636}
637static inline u32 pwr_pmu_queue_tail_address_f(u32 v)
638{
639 return (v & 0xffffffff) << 0;
640}
641static inline u32 pwr_pmu_queue_tail_address_v(u32 r)
642{
643 return (r >> 0) & 0xffffffff;
644}
645static inline u32 pwr_pmu_msgq_head_r(void)
646{
647 return 0x0010a4c8;
648}
649static inline u32 pwr_pmu_msgq_head_val_f(u32 v)
650{
651 return (v & 0xffffffff) << 0;
652}
653static inline u32 pwr_pmu_msgq_head_val_v(u32 r)
654{
655 return (r >> 0) & 0xffffffff;
656}
657static inline u32 pwr_pmu_msgq_tail_r(void)
658{
659 return 0x0010a4cc;
660}
661static inline u32 pwr_pmu_msgq_tail_val_f(u32 v)
662{
663 return (v & 0xffffffff) << 0;
664}
665static inline u32 pwr_pmu_msgq_tail_val_v(u32 r)
666{
667 return (r >> 0) & 0xffffffff;
668}
669static inline u32 pwr_pmu_idle_mask_r(u32 i)
670{
671 return 0x0010a504 + i*16;
672}
673static inline u32 pwr_pmu_idle_mask_gr_enabled_f(void)
674{
675 return 0x1;
676}
677static inline u32 pwr_pmu_idle_mask_ce_2_enabled_f(void)
678{
679 return 0x200000;
680}
681static inline u32 pwr_pmu_idle_count_r(u32 i)
682{
683 return 0x0010a508 + i*16;
684}
685static inline u32 pwr_pmu_idle_count_value_f(u32 v)
686{
687 return (v & 0x7fffffff) << 0;
688}
689static inline u32 pwr_pmu_idle_count_value_v(u32 r)
690{
691 return (r >> 0) & 0x7fffffff;
692}
693static inline u32 pwr_pmu_idle_count_reset_f(u32 v)
694{
695 return (v & 0x1) << 31;
696}
697static inline u32 pwr_pmu_idle_ctrl_r(u32 i)
698{
699 return 0x0010a50c + i*16;
700}
701static inline u32 pwr_pmu_idle_ctrl_value_m(void)
702{
703 return 0x3 << 0;
704}
705static inline u32 pwr_pmu_idle_ctrl_value_busy_f(void)
706{
707 return 0x2;
708}
709static inline u32 pwr_pmu_idle_ctrl_value_always_f(void)
710{
711 return 0x3;
712}
713static inline u32 pwr_pmu_idle_ctrl_filter_m(void)
714{
715 return 0x1 << 2;
716}
717static inline u32 pwr_pmu_idle_ctrl_filter_disabled_f(void)
718{
719 return 0x0;
720}
721static inline u32 pwr_pmu_idle_mask_supp_r(u32 i)
722{
723 return 0x0010a9f0 + i*8;
724}
725static inline u32 pwr_pmu_idle_mask_1_supp_r(u32 i)
726{
727 return 0x0010a9f4 + i*8;
728}
729static inline u32 pwr_pmu_idle_ctrl_supp_r(u32 i)
730{
731 return 0x0010aa30 + i*8;
732}
733static inline u32 pwr_pmu_debug_r(u32 i)
734{
735 return 0x0010a5c0 + i*4;
736}
737static inline u32 pwr_pmu_debug__size_1_v(void)
738{
739 return 0x00000004;
740}
741static inline u32 pwr_pmu_mailbox_r(u32 i)
742{
743 return 0x0010a450 + i*4;
744}
745static inline u32 pwr_pmu_mailbox__size_1_v(void)
746{
747 return 0x0000000c;
748}
749static inline u32 pwr_pmu_bar0_addr_r(void)
750{
751 return 0x0010a7a0;
752}
753static inline u32 pwr_pmu_bar0_data_r(void)
754{
755 return 0x0010a7a4;
756}
757static inline u32 pwr_pmu_bar0_ctl_r(void)
758{
759 return 0x0010a7ac;
760}
761static inline u32 pwr_pmu_bar0_timeout_r(void)
762{
763 return 0x0010a7a8;
764}
765static inline u32 pwr_pmu_bar0_fecs_error_r(void)
766{
767 return 0x0010a988;
768}
769static inline u32 pwr_pmu_bar0_error_status_r(void)
770{
771 return 0x0010a7b0;
772}
773static inline u32 pwr_pmu_pg_idlefilth_r(u32 i)
774{
775 return 0x0010a6c0 + i*4;
776}
777static inline u32 pwr_pmu_pg_ppuidlefilth_r(u32 i)
778{
779 return 0x0010a6e8 + i*4;
780}
781static inline u32 pwr_pmu_pg_idle_cnt_r(u32 i)
782{
783 return 0x0010a710 + i*4;
784}
785static inline u32 pwr_pmu_pg_intren_r(u32 i)
786{
787 return 0x0010a760 + i*4;
788}
789static inline u32 pwr_fbif_transcfg_r(u32 i)
790{
791 return 0x0010ae00 + i*4;
792}
793static inline u32 pwr_fbif_transcfg_target_local_fb_f(void)
794{
795 return 0x0;
796}
797static inline u32 pwr_fbif_transcfg_target_coherent_sysmem_f(void)
798{
799 return 0x1;
800}
801static inline u32 pwr_fbif_transcfg_target_noncoherent_sysmem_f(void)
802{
803 return 0x2;
804}
805static inline u32 pwr_fbif_transcfg_mem_type_s(void)
806{
807 return 1;
808}
809static inline u32 pwr_fbif_transcfg_mem_type_f(u32 v)
810{
811 return (v & 0x1) << 2;
812}
813static inline u32 pwr_fbif_transcfg_mem_type_m(void)
814{
815 return 0x1 << 2;
816}
817static inline u32 pwr_fbif_transcfg_mem_type_v(u32 r)
818{
819 return (r >> 2) & 0x1;
820}
821static inline u32 pwr_fbif_transcfg_mem_type_virtual_f(void)
822{
823 return 0x0;
824}
825static inline u32 pwr_fbif_transcfg_mem_type_physical_f(void)
826{
827 return 0x4;
828}
829static inline u32 pwr_falcon_engine_r(void)
830{
831 return 0x0010a3c0;
832}
833static inline u32 pwr_falcon_engine_reset_true_f(void)
834{
835 return 0x1;
836}
837static inline u32 pwr_falcon_engine_reset_false_f(void)
838{
839 return 0x0;
840}
841#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_ram_gp106.h b/drivers/gpu/nvgpu/gp106/hw_ram_gp106.h
new file mode 100644
index 00000000..eb02ac28
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_ram_gp106.h
@@ -0,0 +1,481 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_ram_gp106_h_
51#define _hw_ram_gp106_h_
52
53static inline u32 ram_in_ramfc_s(void)
54{
55 return 4096;
56}
57static inline u32 ram_in_ramfc_w(void)
58{
59 return 0;
60}
61static inline u32 ram_in_page_dir_base_target_f(u32 v)
62{
63 return (v & 0x3) << 0;
64}
65static inline u32 ram_in_page_dir_base_target_w(void)
66{
67 return 128;
68}
69static inline u32 ram_in_page_dir_base_target_vid_mem_f(void)
70{
71 return 0x0;
72}
73static inline u32 ram_in_page_dir_base_target_sys_mem_coh_f(void)
74{
75 return 0x2;
76}
77static inline u32 ram_in_page_dir_base_target_sys_mem_ncoh_f(void)
78{
79 return 0x3;
80}
81static inline u32 ram_in_page_dir_base_vol_w(void)
82{
83 return 128;
84}
85static inline u32 ram_in_page_dir_base_vol_true_f(void)
86{
87 return 0x4;
88}
89static inline u32 ram_in_page_dir_base_fault_replay_tex_f(u32 v)
90{
91 return (v & 0x1) << 4;
92}
93static inline u32 ram_in_page_dir_base_fault_replay_tex_m(void)
94{
95 return 0x1 << 4;
96}
97static inline u32 ram_in_page_dir_base_fault_replay_tex_w(void)
98{
99 return 128;
100}
101static inline u32 ram_in_page_dir_base_fault_replay_tex_true_f(void)
102{
103 return 0x10;
104}
105static inline u32 ram_in_page_dir_base_fault_replay_gcc_f(u32 v)
106{
107 return (v & 0x1) << 5;
108}
109static inline u32 ram_in_page_dir_base_fault_replay_gcc_m(void)
110{
111 return 0x1 << 5;
112}
113static inline u32 ram_in_page_dir_base_fault_replay_gcc_w(void)
114{
115 return 128;
116}
117static inline u32 ram_in_page_dir_base_fault_replay_gcc_true_f(void)
118{
119 return 0x20;
120}
121static inline u32 ram_in_big_page_size_f(u32 v)
122{
123 return (v & 0x1) << 11;
124}
125static inline u32 ram_in_big_page_size_m(void)
126{
127 return 0x1 << 11;
128}
129static inline u32 ram_in_big_page_size_w(void)
130{
131 return 128;
132}
133static inline u32 ram_in_big_page_size_128kb_f(void)
134{
135 return 0x0;
136}
137static inline u32 ram_in_big_page_size_64kb_f(void)
138{
139 return 0x800;
140}
141static inline u32 ram_in_page_dir_base_lo_f(u32 v)
142{
143 return (v & 0xfffff) << 12;
144}
145static inline u32 ram_in_page_dir_base_lo_w(void)
146{
147 return 128;
148}
149static inline u32 ram_in_page_dir_base_hi_f(u32 v)
150{
151 return (v & 0xffffffff) << 0;
152}
153static inline u32 ram_in_page_dir_base_hi_w(void)
154{
155 return 129;
156}
157static inline u32 ram_in_adr_limit_lo_f(u32 v)
158{
159 return (v & 0xfffff) << 12;
160}
161static inline u32 ram_in_adr_limit_lo_w(void)
162{
163 return 130;
164}
165static inline u32 ram_in_adr_limit_hi_f(u32 v)
166{
167 return (v & 0xffffffff) << 0;
168}
169static inline u32 ram_in_adr_limit_hi_w(void)
170{
171 return 131;
172}
173static inline u32 ram_in_engine_cs_w(void)
174{
175 return 132;
176}
177static inline u32 ram_in_engine_cs_wfi_v(void)
178{
179 return 0x00000000;
180}
181static inline u32 ram_in_engine_cs_wfi_f(void)
182{
183 return 0x0;
184}
185static inline u32 ram_in_engine_cs_fg_v(void)
186{
187 return 0x00000001;
188}
189static inline u32 ram_in_engine_cs_fg_f(void)
190{
191 return 0x8;
192}
193static inline u32 ram_in_gr_cs_w(void)
194{
195 return 132;
196}
197static inline u32 ram_in_gr_cs_wfi_f(void)
198{
199 return 0x0;
200}
201static inline u32 ram_in_gr_wfi_target_w(void)
202{
203 return 132;
204}
205static inline u32 ram_in_gr_wfi_mode_w(void)
206{
207 return 132;
208}
209static inline u32 ram_in_gr_wfi_mode_physical_v(void)
210{
211 return 0x00000000;
212}
213static inline u32 ram_in_gr_wfi_mode_physical_f(void)
214{
215 return 0x0;
216}
217static inline u32 ram_in_gr_wfi_mode_virtual_v(void)
218{
219 return 0x00000001;
220}
221static inline u32 ram_in_gr_wfi_mode_virtual_f(void)
222{
223 return 0x4;
224}
225static inline u32 ram_in_gr_wfi_ptr_lo_f(u32 v)
226{
227 return (v & 0xfffff) << 12;
228}
229static inline u32 ram_in_gr_wfi_ptr_lo_w(void)
230{
231 return 132;
232}
233static inline u32 ram_in_gr_wfi_ptr_hi_f(u32 v)
234{
235 return (v & 0xff) << 0;
236}
237static inline u32 ram_in_gr_wfi_ptr_hi_w(void)
238{
239 return 133;
240}
241static inline u32 ram_in_base_shift_v(void)
242{
243 return 0x0000000c;
244}
245static inline u32 ram_in_alloc_size_v(void)
246{
247 return 0x00001000;
248}
249static inline u32 ram_fc_size_val_v(void)
250{
251 return 0x00000200;
252}
253static inline u32 ram_fc_gp_put_w(void)
254{
255 return 0;
256}
257static inline u32 ram_fc_userd_w(void)
258{
259 return 2;
260}
261static inline u32 ram_fc_userd_hi_w(void)
262{
263 return 3;
264}
265static inline u32 ram_fc_signature_w(void)
266{
267 return 4;
268}
269static inline u32 ram_fc_gp_get_w(void)
270{
271 return 5;
272}
273static inline u32 ram_fc_pb_get_w(void)
274{
275 return 6;
276}
277static inline u32 ram_fc_pb_get_hi_w(void)
278{
279 return 7;
280}
281static inline u32 ram_fc_pb_top_level_get_w(void)
282{
283 return 8;
284}
285static inline u32 ram_fc_pb_top_level_get_hi_w(void)
286{
287 return 9;
288}
289static inline u32 ram_fc_acquire_w(void)
290{
291 return 12;
292}
293static inline u32 ram_fc_semaphorea_w(void)
294{
295 return 14;
296}
297static inline u32 ram_fc_semaphoreb_w(void)
298{
299 return 15;
300}
301static inline u32 ram_fc_semaphorec_w(void)
302{
303 return 16;
304}
305static inline u32 ram_fc_semaphored_w(void)
306{
307 return 17;
308}
309static inline u32 ram_fc_gp_base_w(void)
310{
311 return 18;
312}
313static inline u32 ram_fc_gp_base_hi_w(void)
314{
315 return 19;
316}
317static inline u32 ram_fc_gp_fetch_w(void)
318{
319 return 20;
320}
321static inline u32 ram_fc_pb_fetch_w(void)
322{
323 return 21;
324}
325static inline u32 ram_fc_pb_fetch_hi_w(void)
326{
327 return 22;
328}
329static inline u32 ram_fc_pb_put_w(void)
330{
331 return 23;
332}
333static inline u32 ram_fc_pb_put_hi_w(void)
334{
335 return 24;
336}
337static inline u32 ram_fc_pb_header_w(void)
338{
339 return 33;
340}
341static inline u32 ram_fc_pb_count_w(void)
342{
343 return 34;
344}
345static inline u32 ram_fc_subdevice_w(void)
346{
347 return 37;
348}
349static inline u32 ram_fc_formats_w(void)
350{
351 return 39;
352}
353static inline u32 ram_fc_target_w(void)
354{
355 return 43;
356}
357static inline u32 ram_fc_hce_ctrl_w(void)
358{
359 return 57;
360}
361static inline u32 ram_fc_chid_w(void)
362{
363 return 58;
364}
365static inline u32 ram_fc_chid_id_f(u32 v)
366{
367 return (v & 0xfff) << 0;
368}
369static inline u32 ram_fc_chid_id_w(void)
370{
371 return 0;
372}
373static inline u32 ram_fc_config_w(void)
374{
375 return 61;
376}
377static inline u32 ram_fc_runlist_timeslice_w(void)
378{
379 return 62;
380}
381static inline u32 ram_userd_base_shift_v(void)
382{
383 return 0x00000009;
384}
385static inline u32 ram_userd_chan_size_v(void)
386{
387 return 0x00000200;
388}
389static inline u32 ram_userd_put_w(void)
390{
391 return 16;
392}
393static inline u32 ram_userd_get_w(void)
394{
395 return 17;
396}
397static inline u32 ram_userd_ref_w(void)
398{
399 return 18;
400}
401static inline u32 ram_userd_put_hi_w(void)
402{
403 return 19;
404}
405static inline u32 ram_userd_ref_threshold_w(void)
406{
407 return 20;
408}
409static inline u32 ram_userd_top_level_get_w(void)
410{
411 return 22;
412}
413static inline u32 ram_userd_top_level_get_hi_w(void)
414{
415 return 23;
416}
417static inline u32 ram_userd_get_hi_w(void)
418{
419 return 24;
420}
421static inline u32 ram_userd_gp_get_w(void)
422{
423 return 34;
424}
425static inline u32 ram_userd_gp_put_w(void)
426{
427 return 35;
428}
429static inline u32 ram_userd_gp_top_level_get_w(void)
430{
431 return 22;
432}
433static inline u32 ram_userd_gp_top_level_get_hi_w(void)
434{
435 return 23;
436}
437static inline u32 ram_rl_entry_size_v(void)
438{
439 return 0x00000008;
440}
441static inline u32 ram_rl_entry_chid_f(u32 v)
442{
443 return (v & 0xfff) << 0;
444}
445static inline u32 ram_rl_entry_id_f(u32 v)
446{
447 return (v & 0xfff) << 0;
448}
449static inline u32 ram_rl_entry_type_f(u32 v)
450{
451 return (v & 0x1) << 13;
452}
453static inline u32 ram_rl_entry_type_chid_f(void)
454{
455 return 0x0;
456}
457static inline u32 ram_rl_entry_type_tsg_f(void)
458{
459 return 0x2000;
460}
461static inline u32 ram_rl_entry_timeslice_scale_f(u32 v)
462{
463 return (v & 0xf) << 14;
464}
465static inline u32 ram_rl_entry_timeslice_scale_3_f(void)
466{
467 return 0xc000;
468}
469static inline u32 ram_rl_entry_timeslice_timeout_f(u32 v)
470{
471 return (v & 0xff) << 18;
472}
473static inline u32 ram_rl_entry_timeslice_timeout_128_f(void)
474{
475 return 0x2000000;
476}
477static inline u32 ram_rl_entry_tsg_length_f(u32 v)
478{
479 return (v & 0x3f) << 26;
480}
481#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_therm_gp106.h b/drivers/gpu/nvgpu/gp106/hw_therm_gp106.h
new file mode 100644
index 00000000..36ffcc7a
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_therm_gp106.h
@@ -0,0 +1,177 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_therm_gp106_h_
51#define _hw_therm_gp106_h_
52
53static inline u32 therm_temp_sensor_tsense_r(void)
54{
55 return 0x00020460;
56}
57static inline u32 therm_temp_sensor_tsense_fixed_point_f(u32 v)
58{
59 return (v & 0x3fff) << 3;
60}
61static inline u32 therm_temp_sensor_tsense_fixed_point_m(void)
62{
63 return 0x3fff << 3;
64}
65static inline u32 therm_temp_sensor_tsense_fixed_point_v(u32 r)
66{
67 return (r >> 3) & 0x3fff;
68}
69static inline u32 therm_temp_sensor_tsense_fixed_point_min_v(void)
70{
71 return 0x00003b00;
72}
73static inline u32 therm_temp_sensor_tsense_fixed_point_max_v(void)
74{
75 return 0x000010e0;
76}
77static inline u32 therm_temp_sensor_tsense_state_f(u32 v)
78{
79 return (v & 0x3) << 29;
80}
81static inline u32 therm_temp_sensor_tsense_state_m(void)
82{
83 return 0x3 << 29;
84}
85static inline u32 therm_temp_sensor_tsense_state_v(u32 r)
86{
87 return (r >> 29) & 0x3;
88}
89static inline u32 therm_temp_sensor_tsense_state_valid_v(void)
90{
91 return 0x00000001;
92}
93static inline u32 therm_temp_sensor_tsense_state_shadow_v(void)
94{
95 return 0x00000002;
96}
97static inline u32 therm_gate_ctrl_r(u32 i)
98{
99 return 0x00020200 + i*4;
100}
101static inline u32 therm_gate_ctrl_eng_clk_m(void)
102{
103 return 0x3 << 0;
104}
105static inline u32 therm_gate_ctrl_eng_clk_run_f(void)
106{
107 return 0x0;
108}
109static inline u32 therm_gate_ctrl_eng_clk_auto_f(void)
110{
111 return 0x1;
112}
113static inline u32 therm_gate_ctrl_eng_clk_stop_f(void)
114{
115 return 0x2;
116}
117static inline u32 therm_gate_ctrl_blk_clk_m(void)
118{
119 return 0x3 << 2;
120}
121static inline u32 therm_gate_ctrl_blk_clk_run_f(void)
122{
123 return 0x0;
124}
125static inline u32 therm_gate_ctrl_blk_clk_auto_f(void)
126{
127 return 0x4;
128}
129static inline u32 therm_gate_ctrl_eng_idle_filt_exp_f(u32 v)
130{
131 return (v & 0x1f) << 8;
132}
133static inline u32 therm_gate_ctrl_eng_idle_filt_exp_m(void)
134{
135 return 0x1f << 8;
136}
137static inline u32 therm_gate_ctrl_eng_idle_filt_mant_f(u32 v)
138{
139 return (v & 0x7) << 13;
140}
141static inline u32 therm_gate_ctrl_eng_idle_filt_mant_m(void)
142{
143 return 0x7 << 13;
144}
145static inline u32 therm_gate_ctrl_eng_delay_before_f(u32 v)
146{
147 return (v & 0xf) << 16;
148}
149static inline u32 therm_gate_ctrl_eng_delay_before_m(void)
150{
151 return 0xf << 16;
152}
153static inline u32 therm_gate_ctrl_eng_delay_after_f(u32 v)
154{
155 return (v & 0xf) << 20;
156}
157static inline u32 therm_gate_ctrl_eng_delay_after_m(void)
158{
159 return 0xf << 20;
160}
161static inline u32 therm_fecs_idle_filter_r(void)
162{
163 return 0x00020288;
164}
165static inline u32 therm_fecs_idle_filter_value_m(void)
166{
167 return 0xffffffff << 0;
168}
169static inline u32 therm_hubmmu_idle_filter_r(void)
170{
171 return 0x0002028c;
172}
173static inline u32 therm_hubmmu_idle_filter_value_m(void)
174{
175 return 0xffffffff << 0;
176}
177#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_timer_gp106.h b/drivers/gpu/nvgpu/gp106/hw_timer_gp106.h
new file mode 100644
index 00000000..62771628
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_timer_gp106.h
@@ -0,0 +1,109 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_timer_gp106_h_
51#define _hw_timer_gp106_h_
52
53static inline u32 timer_pri_timeout_r(void)
54{
55 return 0x00009080;
56}
57static inline u32 timer_pri_timeout_period_f(u32 v)
58{
59 return (v & 0xffffff) << 0;
60}
61static inline u32 timer_pri_timeout_period_m(void)
62{
63 return 0xffffff << 0;
64}
65static inline u32 timer_pri_timeout_period_v(u32 r)
66{
67 return (r >> 0) & 0xffffff;
68}
69static inline u32 timer_pri_timeout_en_f(u32 v)
70{
71 return (v & 0x1) << 31;
72}
73static inline u32 timer_pri_timeout_en_m(void)
74{
75 return 0x1 << 31;
76}
77static inline u32 timer_pri_timeout_en_v(u32 r)
78{
79 return (r >> 31) & 0x1;
80}
81static inline u32 timer_pri_timeout_en_en_enabled_f(void)
82{
83 return 0x80000000;
84}
85static inline u32 timer_pri_timeout_en_en_disabled_f(void)
86{
87 return 0x0;
88}
89static inline u32 timer_pri_timeout_save_0_r(void)
90{
91 return 0x00009084;
92}
93static inline u32 timer_pri_timeout_save_1_r(void)
94{
95 return 0x00009088;
96}
97static inline u32 timer_pri_timeout_fecs_errcode_r(void)
98{
99 return 0x0000908c;
100}
101static inline u32 timer_time_0_r(void)
102{
103 return 0x00009400;
104}
105static inline u32 timer_time_1_r(void)
106{
107 return 0x00009410;
108}
109#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_top_gp106.h b/drivers/gpu/nvgpu/gp106/hw_top_gp106.h
new file mode 100644
index 00000000..85350954
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_top_gp106.h
@@ -0,0 +1,221 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_top_gp106_h_
51#define _hw_top_gp106_h_
52
53static inline u32 top_num_gpcs_r(void)
54{
55 return 0x00022430;
56}
57static inline u32 top_num_gpcs_value_v(u32 r)
58{
59 return (r >> 0) & 0x1f;
60}
61static inline u32 top_tpc_per_gpc_r(void)
62{
63 return 0x00022434;
64}
65static inline u32 top_tpc_per_gpc_value_v(u32 r)
66{
67 return (r >> 0) & 0x1f;
68}
69static inline u32 top_num_fbps_r(void)
70{
71 return 0x00022438;
72}
73static inline u32 top_num_fbps_value_v(u32 r)
74{
75 return (r >> 0) & 0x1f;
76}
77static inline u32 top_num_fbpas_r(void)
78{
79 return 0x0002243c;
80}
81static inline u32 top_num_fbpas_value_v(u32 r)
82{
83 return (r >> 0) & 0x1f;
84}
85static inline u32 top_ltc_per_fbp_r(void)
86{
87 return 0x00022450;
88}
89static inline u32 top_ltc_per_fbp_value_v(u32 r)
90{
91 return (r >> 0) & 0x1f;
92}
93static inline u32 top_slices_per_ltc_r(void)
94{
95 return 0x0002245c;
96}
97static inline u32 top_slices_per_ltc_value_v(u32 r)
98{
99 return (r >> 0) & 0x1f;
100}
101static inline u32 top_num_ltcs_r(void)
102{
103 return 0x00022454;
104}
105static inline u32 top_device_info_r(u32 i)
106{
107 return 0x00022700 + i*4;
108}
109static inline u32 top_device_info__size_1_v(void)
110{
111 return 0x00000040;
112}
113static inline u32 top_device_info_chain_v(u32 r)
114{
115 return (r >> 31) & 0x1;
116}
117static inline u32 top_device_info_chain_enable_v(void)
118{
119 return 0x00000001;
120}
121static inline u32 top_device_info_engine_enum_v(u32 r)
122{
123 return (r >> 26) & 0xf;
124}
125static inline u32 top_device_info_runlist_enum_v(u32 r)
126{
127 return (r >> 21) & 0xf;
128}
129static inline u32 top_device_info_intr_enum_v(u32 r)
130{
131 return (r >> 15) & 0x1f;
132}
133static inline u32 top_device_info_reset_enum_v(u32 r)
134{
135 return (r >> 9) & 0x1f;
136}
137static inline u32 top_device_info_type_enum_v(u32 r)
138{
139 return (r >> 2) & 0x1fffffff;
140}
141static inline u32 top_device_info_type_enum_graphics_v(void)
142{
143 return 0x00000000;
144}
145static inline u32 top_device_info_type_enum_graphics_f(void)
146{
147 return 0x0;
148}
149static inline u32 top_device_info_type_enum_copy0_v(void)
150{
151 return 0x00000001;
152}
153static inline u32 top_device_info_type_enum_copy0_f(void)
154{
155 return 0x4;
156}
157static inline u32 top_device_info_type_enum_lce_v(void)
158{
159 return 0x00000013;
160}
161static inline u32 top_device_info_type_enum_lce_f(void)
162{
163 return 0x4c;
164}
165static inline u32 top_device_info_entry_v(u32 r)
166{
167 return (r >> 0) & 0x3;
168}
169static inline u32 top_device_info_entry_not_valid_v(void)
170{
171 return 0x00000000;
172}
173static inline u32 top_device_info_entry_enum_v(void)
174{
175 return 0x00000002;
176}
177static inline u32 top_device_info_entry_data_v(void)
178{
179 return 0x00000001;
180}
181static inline u32 top_device_info_data_type_v(u32 r)
182{
183 return (r >> 30) & 0x1;
184}
185static inline u32 top_device_info_data_type_enum2_v(void)
186{
187 return 0x00000000;
188}
189static inline u32 top_device_info_data_inst_id_v(u32 r)
190{
191 return (r >> 26) & 0xf;
192}
193static inline u32 top_device_info_data_pri_base_v(u32 r)
194{
195 return (r >> 12) & 0xfff;
196}
197static inline u32 top_device_info_data_pri_base_align_v(void)
198{
199 return 0x0000000c;
200}
201static inline u32 top_device_info_data_fault_id_enum_v(u32 r)
202{
203 return (r >> 3) & 0x1f;
204}
205static inline u32 top_device_info_data_fault_id_v(u32 r)
206{
207 return (r >> 2) & 0x1;
208}
209static inline u32 top_device_info_data_fault_id_valid_v(void)
210{
211 return 0x00000001;
212}
213static inline u32 top_scratch1_r(void)
214{
215 return 0x0002240c;
216}
217static inline u32 top_scratch1_devinit_completed_v(u32 r)
218{
219 return (r >> 1) & 0x1;
220}
221#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_trim_gp106.h b/drivers/gpu/nvgpu/gp106/hw_trim_gp106.h
new file mode 100644
index 00000000..42d3fd32
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_trim_gp106.h
@@ -0,0 +1,189 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_trim_gp106_h_
51#define _hw_trim_gp106_h_
52static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_r(void)
53{
54 return 0x00132924;
55}
56static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_noofipclks_s(void)
57{
58 return 16;
59}
60static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_noofipclks_f(u32 v)
61{
62 return (v & 0xffff) << 0;
63}
64static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_noofipclks_m(void)
65{
66 return 0xffff << 0;
67}
68static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_noofipclks_v(u32 r)
69{
70 return (r >> 0) & 0xffff;
71}
72static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_s(void)
73{
74 return 1;
75}
76static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_f(u32 v)
77{
78 return (v & 0x1) << 16;
79}
80static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_m(void)
81{
82 return 0x1 << 16;
83}
84static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_v(u32 r)
85{
86 return (r >> 16) & 0x1;
87}
88static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_deasserted_f(void)
89{
90 return 0;
91}
92static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_write_en_asserted_f(void)
93{
94 return 0x10000;
95}
96static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_s(void)
97{
98 return 1;
99}
100static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_f(u32 v)
101{
102 return (v & 0x1) << 20;
103}
104static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_m(void)
105{
106 return 0x1 << 20;
107}
108static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_v(u32 r)
109{
110 return (r >> 20) & 0x1;
111}
112static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_deasserted_f(void)
113{
114 return 0;
115}
116static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_enable_asserted_f(void)
117{
118 return 0x100000;
119}
120static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_s(void)
121{
122 return 1;
123}
124static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_f(u32 v)
125{
126 return (v & 0x1) << 24;
127}
128static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_m(void)
129{
130 return 0x1 << 24;
131}
132static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_v(u32 r)
133{
134 return (r >> 24) & 0x1;
135}
136static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_deasserted_f(void)
137{
138 return 0;
139}
140static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_reset_asserted_f(void)
141{
142 return 0x1000000;
143}
144static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cfg_source_gpc2clk_f(void)
145{
146 return 0x70000000;
147}
148static inline u32 trim_gpc_bcast_clk_cntr_ncgpcclk_cnt_r(void)
149{
150 return 0x00132928;
151}
152static inline u32 trim_fbpa_bcast_clk_cntr_ncltcclk_cfg_r(void)
153{
154 return 0x00132128;
155}
156static inline u32 trim_fbpa_bcast_clk_cntr_ncltcclk_cfg_source_dramdiv4_rec_clk1_f(void)
157{
158 return 0x20000000;
159}
160static inline u32 trim_fbpa_bcast_clk_cntr_ncltcclk_cnt_r(void)
161{
162 return 0x0013212c;
163}
164static inline u32 trim_sys_clk_cntr_ncltcpll_cfg_r(void)
165{
166 return 0x001373c0;
167}
168static inline u32 trim_sys_clk_cntr_ncltcpll_cfg_source_xbar2clk_f(void)
169{
170 return 0x20000000;
171}
172static inline u32 trim_sys_clk_cntr_ncltcpll_cnt_r(void)
173{
174 return 0x001373c4;
175}
176static inline u32 trim_sys_clk_cntr_ncsyspll_cfg_r(void)
177{
178 return 0x001373b0;
179}
180static inline u32 trim_sys_clk_cntr_ncsyspll_cfg_source_sys2clk_f(void)
181{
182 return 0x0;
183}
184static inline u32 trim_sys_clk_cntr_ncsyspll_cnt_r(void)
185{
186 return 0x001373b4;
187}
188
189#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_xp_gp106.h b/drivers/gpu/nvgpu/gp106/hw_xp_gp106.h
new file mode 100644
index 00000000..40b14da1
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_xp_gp106.h
@@ -0,0 +1,137 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_xp_gp106_h_
51#define _hw_xp_gp106_h_
52
53static inline u32 xp_dl_mgr_r(u32 i)
54{
55 return 0x0008b8c0 + i*4;
56}
57static inline u32 xp_dl_mgr_safe_timing_f(u32 v)
58{
59 return (v & 0x1) << 2;
60}
61static inline u32 xp_pl_link_config_r(u32 i)
62{
63 return 0x0008c040 + i*4;
64}
65static inline u32 xp_pl_link_config_ltssm_status_f(u32 v)
66{
67 return (v & 0x1) << 4;
68}
69static inline u32 xp_pl_link_config_ltssm_status_idle_v(void)
70{
71 return 0x00000000;
72}
73static inline u32 xp_pl_link_config_ltssm_directive_f(u32 v)
74{
75 return (v & 0xf) << 0;
76}
77static inline u32 xp_pl_link_config_ltssm_directive_m(void)
78{
79 return 0xf << 0;
80}
81static inline u32 xp_pl_link_config_ltssm_directive_normal_operations_v(void)
82{
83 return 0x00000000;
84}
85static inline u32 xp_pl_link_config_ltssm_directive_change_speed_v(void)
86{
87 return 0x00000001;
88}
89static inline u32 xp_pl_link_config_max_link_rate_f(u32 v)
90{
91 return (v & 0x3) << 18;
92}
93static inline u32 xp_pl_link_config_max_link_rate_m(void)
94{
95 return 0x3 << 18;
96}
97static inline u32 xp_pl_link_config_max_link_rate_2500_mtps_v(void)
98{
99 return 0x00000002;
100}
101static inline u32 xp_pl_link_config_max_link_rate_5000_mtps_v(void)
102{
103 return 0x00000001;
104}
105static inline u32 xp_pl_link_config_max_link_rate_8000_mtps_v(void)
106{
107 return 0x00000000;
108}
109static inline u32 xp_pl_link_config_target_tx_width_f(u32 v)
110{
111 return (v & 0x7) << 20;
112}
113static inline u32 xp_pl_link_config_target_tx_width_m(void)
114{
115 return 0x7 << 20;
116}
117static inline u32 xp_pl_link_config_target_tx_width_x1_v(void)
118{
119 return 0x00000007;
120}
121static inline u32 xp_pl_link_config_target_tx_width_x2_v(void)
122{
123 return 0x00000006;
124}
125static inline u32 xp_pl_link_config_target_tx_width_x4_v(void)
126{
127 return 0x00000005;
128}
129static inline u32 xp_pl_link_config_target_tx_width_x8_v(void)
130{
131 return 0x00000004;
132}
133static inline u32 xp_pl_link_config_target_tx_width_x16_v(void)
134{
135 return 0x00000000;
136}
137#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_xve_gp106.h b/drivers/gpu/nvgpu/gp106/hw_xve_gp106.h
new file mode 100644
index 00000000..24434ae0
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_xve_gp106.h
@@ -0,0 +1,149 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16/*
17 * Function naming determines intended use:
18 *
19 * <x>_r(void) : Returns the offset for register <x>.
20 *
21 * <x>_o(void) : Returns the offset for element <x>.
22 *
23 * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
24 *
25 * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
26 *
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
30 * register <x>.
31 *
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
34 * register <x>.
35 *
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>.
39 *
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>.
44 *
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>
48 * of register <x>.
49 */
50#ifndef _hw_xve_gp106_h_
51#define _hw_xve_gp106_h_
52
53static inline u32 xve_rom_ctrl_r(void)
54{
55 return 0x00000050;
56}
57static inline u32 xve_rom_ctrl_rom_shadow_f(u32 v)
58{
59 return (v & 0x1) << 0;
60}
61static inline u32 xve_rom_ctrl_rom_shadow_disabled_f(void)
62{
63 return 0x0;
64}
65static inline u32 xve_rom_ctrl_rom_shadow_enabled_f(void)
66{
67 return 0x1;
68}
69static inline u32 xve_link_control_status_r(void)
70{
71 return 0x00000088;
72}
73static inline u32 xve_link_control_status_link_speed_m(void)
74{
75 return 0xf << 16;
76}
77static inline u32 xve_link_control_status_link_speed_v(u32 r)
78{
79 return (r >> 16) & 0xf;
80}
81static inline u32 xve_link_control_status_link_speed_link_speed_2p5_v(void)
82{
83 return 0x00000001;
84}
85static inline u32 xve_link_control_status_link_speed_link_speed_5p0_v(void)
86{
87 return 0x00000002;
88}
89static inline u32 xve_link_control_status_link_speed_link_speed_8p0_v(void)
90{
91 return 0x00000003;
92}
93static inline u32 xve_link_control_status_link_width_m(void)
94{
95 return 0x3f << 20;
96}
97static inline u32 xve_link_control_status_link_width_v(u32 r)
98{
99 return (r >> 20) & 0x3f;
100}
101static inline u32 xve_link_control_status_link_width_x1_v(void)
102{
103 return 0x00000001;
104}
105static inline u32 xve_link_control_status_link_width_x2_v(void)
106{
107 return 0x00000002;
108}
109static inline u32 xve_link_control_status_link_width_x4_v(void)
110{
111 return 0x00000004;
112}
113static inline u32 xve_link_control_status_link_width_x8_v(void)
114{
115 return 0x00000008;
116}
117static inline u32 xve_link_control_status_link_width_x16_v(void)
118{
119 return 0x00000010;
120}
121static inline u32 xve_priv_xv_r(void)
122{
123 return 0x00000150;
124}
125static inline u32 xve_priv_xv_cya_l0s_enable_f(u32 v)
126{
127 return (v & 0x1) << 7;
128}
129static inline u32 xve_priv_xv_cya_l0s_enable_m(void)
130{
131 return 0x1 << 7;
132}
133static inline u32 xve_priv_xv_cya_l0s_enable_v(u32 r)
134{
135 return (r >> 7) & 0x1;
136}
137static inline u32 xve_priv_xv_cya_l1_enable_f(u32 v)
138{
139 return (v & 0x1) << 8;
140}
141static inline u32 xve_priv_xv_cya_l1_enable_m(void)
142{
143 return 0x1 << 8;
144}
145static inline u32 xve_priv_xv_cya_l1_enable_v(u32 r)
146{
147 return (r >> 8) & 0x1;
148}
149#endif
diff --git a/drivers/gpu/nvgpu/gp106/ltc_gp106.c b/drivers/gpu/nvgpu/gp106/ltc_gp106.c
new file mode 100644
index 00000000..b162ddb3
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/ltc_gp106.c
@@ -0,0 +1,29 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include <linux/types.h>
15
16#include "gk20a/gk20a.h"
17#include "gm20b/ltc_gm20b.h"
18#include "gp10b/ltc_gp10b.h"
19#include "gp106/ltc_gp106.h"
20
21void gp106_init_ltc(struct gpu_ops *gops)
22{
23 gp10b_init_ltc(gops);
24
25 /* dGPU does not need the LTC hack */
26 gops->ltc.cbc_fix_config = NULL;
27 gops->ltc.init_cbc = NULL;
28 gops->ltc.init_fs_state = gm20b_ltc_init_fs_state;
29}
diff --git a/drivers/gpu/nvgpu/gp106/ltc_gp106.h b/drivers/gpu/nvgpu/gp106/ltc_gp106.h
new file mode 100644
index 00000000..4720d7a1
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/ltc_gp106.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#ifndef LTC_GP106_H
15#define LTC_GP106_H
16struct gpu_ops;
17
18void gp106_init_ltc(struct gpu_ops *gops);
19#endif
diff --git a/drivers/gpu/nvgpu/gp106/mm_gp106.c b/drivers/gpu/nvgpu/gp106/mm_gp106.c
new file mode 100644
index 00000000..3309a0d7
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/mm_gp106.c
@@ -0,0 +1,41 @@
1/*
2 * GP106 memory management
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include "gk20a/gk20a.h"
17#include "gp10b/mm_gp10b.h"
18#include "gp106/mm_gp106.h"
19
20#include "hw_fb_gp106.h"
21
22static size_t gp106_mm_get_vidmem_size(struct gk20a *g)
23{
24 u32 range = gk20a_readl(g, fb_mmu_local_memory_range_r());
25 u32 mag = fb_mmu_local_memory_range_lower_mag_v(range);
26 u32 scale = fb_mmu_local_memory_range_lower_scale_v(range);
27 u32 ecc = fb_mmu_local_memory_range_ecc_mode_v(range);
28 size_t bytes = ((size_t)mag << scale) * SZ_1M;
29
30 if (ecc)
31 bytes = bytes / 16 * 15;
32
33 return bytes;
34}
35
36void gp106_init_mm(struct gpu_ops *gops)
37{
38 gp10b_init_mm(gops);
39 gops->mm.get_vidmem_size = gp106_mm_get_vidmem_size;
40 gops->mm.get_physical_addr_bits = NULL;
41}
diff --git a/drivers/gpu/nvgpu/gp106/mm_gp106.h b/drivers/gpu/nvgpu/gp106/mm_gp106.h
new file mode 100644
index 00000000..36a89a11
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/mm_gp106.h
@@ -0,0 +1,23 @@
1/*
2 * GP106 memory management
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef MM_GP106_H
17#define MM_GP106_H
18
19struct gpu_ops;
20
21void gp106_init_mm(struct gpu_ops *gops);
22
23#endif
diff --git a/drivers/gpu/nvgpu/gp106/pmu_gp106.c b/drivers/gpu/nvgpu/gp106/pmu_gp106.c
new file mode 100644
index 00000000..eecd7351
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/pmu_gp106.c
@@ -0,0 +1,296 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include <linux/delay.h> /* for udelay */
15#include "gk20a/gk20a.h"
16#include "gk20a/pmu_gk20a.h"
17
18#include "gm206/pmu_gm206.h"
19#include "gm20b/pmu_gm20b.h"
20#include "gp10b/pmu_gp10b.h"
21#include "gp106/pmu_gp106.h"
22#include "gp106/acr_gp106.h"
23#include "gp106/hw_psec_gp106.h"
24#include "clk/clk_mclk.h"
25#include "hw_mc_gp106.h"
26#include "hw_pwr_gp106.h"
27#include "lpwr/lpwr.h"
28#include "lpwr/rppg.h"
29
30#define PMU_MEM_SCRUBBING_TIMEOUT_MAX 1000
31#define PMU_MEM_SCRUBBING_TIMEOUT_DEFAULT 10
32
33static int gp106_pmu_enable_hw(struct pmu_gk20a *pmu, bool enable)
34{
35 struct gk20a *g = gk20a_from_pmu(pmu);
36
37 gk20a_dbg_fn("");
38
39 /*
40 * From GP10X onwards, we are using PPWR_FALCON_ENGINE for reset. And as
41 * it may come into same behaviour, reading NV_PPWR_FALCON_ENGINE again
42 * after Reset.
43 */
44
45 if (enable) {
46 int retries = PMU_MEM_SCRUBBING_TIMEOUT_MAX /
47 PMU_MEM_SCRUBBING_TIMEOUT_DEFAULT;
48 gk20a_writel(g, pwr_falcon_engine_r(),
49 pwr_falcon_engine_reset_false_f());
50 gk20a_readl(g, pwr_falcon_engine_r());
51
52 /* make sure ELPG is in a good state */
53 if (g->ops.clock_gating.slcg_pmu_load_gating_prod)
54 g->ops.clock_gating.slcg_pmu_load_gating_prod(g,
55 g->slcg_enabled);
56 if (g->ops.clock_gating.blcg_pmu_load_gating_prod)
57 g->ops.clock_gating.blcg_pmu_load_gating_prod(g,
58 g->blcg_enabled);
59
60 /* wait for Scrubbing to complete */
61 do {
62 u32 w = gk20a_readl(g, pwr_falcon_dmactl_r()) &
63 (pwr_falcon_dmactl_dmem_scrubbing_m() |
64 pwr_falcon_dmactl_imem_scrubbing_m());
65
66 if (!w) {
67 gk20a_dbg_fn("done");
68 return 0;
69 }
70 udelay(PMU_MEM_SCRUBBING_TIMEOUT_DEFAULT);
71 } while (--retries || !tegra_platform_is_silicon());
72
73 /* If scrubbing timeout, keep PMU in reset state */
74 gk20a_writel(g, pwr_falcon_engine_r(),
75 pwr_falcon_engine_reset_true_f());
76 gk20a_readl(g, pwr_falcon_engine_r());
77 gk20a_err(dev_from_gk20a(g), "Falcon mem scrubbing timeout");
78 return -ETIMEDOUT;
79 } else {
80 /* DISBALE */
81 gk20a_writel(g, pwr_falcon_engine_r(),
82 pwr_falcon_engine_reset_true_f());
83 gk20a_readl(g, pwr_falcon_engine_r());
84 return 0;
85 }
86}
87
88static int pmu_enable(struct pmu_gk20a *pmu, bool enable)
89{
90 struct gk20a *g = gk20a_from_pmu(pmu);
91 u32 reg_reset;
92 int err;
93
94 gk20a_dbg_fn("");
95
96 if (!enable) {
97 reg_reset = gk20a_readl(g, pwr_falcon_engine_r());
98 if (reg_reset !=
99 pwr_falcon_engine_reset_true_f()) {
100
101 pmu_enable_irq(pmu, false);
102 gp106_pmu_enable_hw(pmu, false);
103 udelay(10);
104 }
105 } else {
106 gp106_pmu_enable_hw(pmu, true);
107 /* TBD: post reset */
108
109 /*idle the PMU and enable interrupts on the Falcon*/
110 err = pmu_idle(pmu);
111 if (err)
112 return err;
113 udelay(5);
114 pmu_enable_irq(pmu, true);
115 }
116
117 gk20a_dbg_fn("done");
118 return 0;
119}
120
121static int gp106_pmu_reset(struct gk20a *g)
122{
123 struct pmu_gk20a *pmu = &g->pmu;
124 int err = 0;
125
126 gk20a_dbg_fn("");
127
128 err = pmu_idle(pmu);
129 if (err)
130 return err;
131
132 /* TBD: release pmu hw mutex */
133
134 err = pmu_enable(pmu, false);
135 if (err)
136 return err;
137
138 /* TBD: cancel all sequences */
139 /* TBD: init all sequences and state tables */
140 /* TBD: restore pre-init message handler */
141
142 err = pmu_enable(pmu, true);
143 if (err)
144 return err;
145
146 return err;
147}
148
149static int gp106_sec2_reset(struct gk20a *g)
150{
151 gk20a_dbg_fn("");
152 //sec2 reset
153 gk20a_writel(g, psec_falcon_engine_r(),
154 pwr_falcon_engine_reset_true_f());
155 udelay(10);
156 gk20a_writel(g, psec_falcon_engine_r(),
157 pwr_falcon_engine_reset_false_f());
158
159 gk20a_dbg_fn("done");
160 return 0;
161}
162
163static int gp106_falcon_reset(struct gk20a *g)
164{
165 gk20a_dbg_fn("");
166
167 gp106_pmu_reset(g);
168 gp106_sec2_reset(g);
169
170 gk20a_dbg_fn("done");
171 return 0;
172}
173
174static bool gp106_is_pmu_supported(struct gk20a *g)
175{
176 return true;
177}
178
179static u32 gp106_pmu_pg_feature_list(struct gk20a *g, u32 pg_engine_id)
180{
181 if (pg_engine_id == PMU_PG_ELPG_ENGINE_ID_GRAPHICS)
182 return PMU_PG_FEATURE_GR_RPPG_ENABLED;
183
184 if (pg_engine_id == PMU_PG_ELPG_ENGINE_ID_MS)
185 return NVGPU_PMU_MS_FEATURE_MASK_ALL;
186
187 return 0;
188}
189
190static u32 gp106_pmu_pg_engines_list(struct gk20a *g)
191{
192 return BIT(PMU_PG_ELPG_ENGINE_ID_GRAPHICS) |
193 BIT(PMU_PG_ELPG_ENGINE_ID_MS);
194}
195
196static void pmu_handle_param_msg(struct gk20a *g, struct pmu_msg *msg,
197 void *param, u32 handle, u32 status)
198{
199 gk20a_dbg_fn("");
200
201 if (status != 0) {
202 gk20a_err(dev_from_gk20a(g), "PG PARAM cmd aborted");
203 return;
204 }
205
206 gp106_dbg_pmu("PG PARAM is acknowledged from PMU %x",
207 msg->msg.pg.msg_type);
208}
209
210static int gp106_pg_param_init(struct gk20a *g, u32 pg_engine_id)
211{
212 struct pmu_gk20a *pmu = &g->pmu;
213 struct pmu_cmd cmd;
214 u32 seq;
215 u32 status;
216
217 memset(&cmd, 0, sizeof(struct pmu_cmd));
218 if (pg_engine_id == PMU_PG_ELPG_ENGINE_ID_GRAPHICS) {
219
220 status = init_rppg(g);
221 if (status != 0) {
222 gk20a_err(dev_from_gk20a(g), "RPPG init Failed");
223 return -1;
224 }
225
226 cmd.hdr.unit_id = PMU_UNIT_PG;
227 cmd.hdr.size = PMU_CMD_HDR_SIZE +
228 sizeof(struct pmu_pg_cmd_gr_init_param);
229 cmd.cmd.pg.gr_init_param.cmd_type =
230 PMU_PG_CMD_ID_PG_PARAM;
231 cmd.cmd.pg.gr_init_param.sub_cmd_id =
232 PMU_PG_PARAM_CMD_GR_INIT_PARAM;
233 cmd.cmd.pg.gr_init_param.featuremask =
234 PMU_PG_FEATURE_GR_RPPG_ENABLED;
235
236 gp106_dbg_pmu("cmd post GR PMU_PG_CMD_ID_PG_PARAM");
237 gk20a_pmu_cmd_post(g, &cmd, NULL, NULL, PMU_COMMAND_QUEUE_HPQ,
238 pmu_handle_param_msg, pmu, &seq, ~0);
239 } else if (pg_engine_id == PMU_PG_ELPG_ENGINE_ID_MS) {
240 cmd.hdr.unit_id = PMU_UNIT_PG;
241 cmd.hdr.size = PMU_CMD_HDR_SIZE +
242 sizeof(struct pmu_pg_cmd_ms_init_param);
243 cmd.cmd.pg.ms_init_param.cmd_type =
244 PMU_PG_CMD_ID_PG_PARAM;
245 cmd.cmd.pg.ms_init_param.cmd_id =
246 PMU_PG_PARAM_CMD_MS_INIT_PARAM;
247 cmd.cmd.pg.ms_init_param.support_mask =
248 NVGPU_PMU_MS_FEATURE_MASK_CLOCK_GATING |
249 NVGPU_PMU_MS_FEATURE_MASK_SW_ASR |
250 NVGPU_PMU_MS_FEATURE_MASK_RPPG |
251 NVGPU_PMU_MS_FEATURE_MASK_FB_TRAINING;
252
253 gp106_dbg_pmu("cmd post MS PMU_PG_CMD_ID_PG_PARAM");
254 gk20a_pmu_cmd_post(g, &cmd, NULL, NULL, PMU_COMMAND_QUEUE_HPQ,
255 pmu_handle_param_msg, pmu, &seq, ~0);
256 }
257
258 return 0;
259}
260
261void gp106_init_pmu_ops(struct gpu_ops *gops)
262{
263 gk20a_dbg_fn("");
264
265 if (gops->privsecurity) {
266 gp106_init_secure_pmu(gops);
267 gops->pmu.init_wpr_region = gm20b_pmu_init_acr;
268 gops->pmu.load_lsfalcon_ucode = gm206_load_falcon_ucode;
269 gops->pmu.is_lazy_bootstrap = gm206_is_lazy_bootstrap;
270 gops->pmu.is_priv_load = gm206_is_priv_load;
271 } else {
272 gk20a_init_pmu_ops(gops);
273 gops->pmu.pmu_setup_hw_and_bootstrap =
274 gm20b_init_nspmu_setup_hw1;
275 gops->pmu.load_lsfalcon_ucode = NULL;
276 gops->pmu.init_wpr_region = NULL;
277 }
278 gops->pmu.pmu_setup_elpg = NULL;
279 gops->pmu.lspmuwprinitdone = 0;
280 gops->pmu.fecsbootstrapdone = false;
281 gops->pmu.write_dmatrfbase = gp10b_write_dmatrfbase;
282 gops->pmu.pmu_elpg_statistics = gp10b_pmu_elpg_statistics;
283 gops->pmu.pmu_pg_init_param = gp106_pg_param_init;
284 gops->pmu.pmu_pg_supported_engines_list = gp106_pmu_pg_engines_list;
285 gops->pmu.pmu_pg_engines_feature_list = gp106_pmu_pg_feature_list;
286 gops->pmu.pmu_lpwr_enable_pg = nvgpu_lpwr_enable_pg;
287 gops->pmu.pmu_lpwr_disable_pg = nvgpu_lpwr_disable_pg;
288 gops->pmu.pmu_pg_param_post_init = nvgpu_lpwr_post_init;
289 gops->pmu.send_lrf_tex_ltc_dram_overide_en_dis_cmd = NULL;
290 gops->pmu.dump_secure_fuses = NULL;
291 gops->pmu.reset = gp106_falcon_reset;
292 gops->pmu.mclk_init = clk_mclkseq_init_mclk_gddr5;
293 gops->pmu.is_pmu_supported = gp106_is_pmu_supported;
294
295 gk20a_dbg_fn("done");
296}
diff --git a/drivers/gpu/nvgpu/gp106/pmu_gp106.h b/drivers/gpu/nvgpu/gp106/pmu_gp106.h
new file mode 100644
index 00000000..a42ff620
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/pmu_gp106.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#ifndef __PMU_GP106_H_
15#define __PMU_GP106_H_
16
17#define gp106_dbg_pmu(fmt, arg...) \
18 gk20a_dbg(gpu_dbg_pmu, fmt, ##arg)
19
20void gp106_init_pmu_ops(struct gpu_ops *gops);
21
22#endif /*__PMU_GP106_H_*/
diff --git a/drivers/gpu/nvgpu/gp106/regops_gp106.c b/drivers/gpu/nvgpu/gp106/regops_gp106.c
new file mode 100644
index 00000000..5b6897c1
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/regops_gp106.c
@@ -0,0 +1,1815 @@
1/*
2 * Tegra GP106 GPU Debugger Driver Register Ops
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/slab.h>
20#include <linux/err.h>
21#include <linux/bsearch.h>
22#include <uapi/linux/nvgpu.h>
23
24#include "gk20a/gk20a.h"
25#include "gk20a/dbg_gpu_gk20a.h"
26#include "gk20a/regops_gk20a.h"
27#include "regops_gp106.h"
28
29static const struct regop_offset_range gp106_global_whitelist_ranges[] = {
30 { 0x000004f0, 1},
31 { 0x00001a00, 3},
32 { 0x00002800, 128},
33 { 0x00009400, 1},
34 { 0x00009410, 1},
35 { 0x00009480, 1},
36 { 0x00020200, 24},
37 { 0x00021c04, 3},
38 { 0x00021c14, 3},
39 { 0x00021c24, 71},
40 { 0x00021d44, 1},
41 { 0x00021d4c, 1},
42 { 0x00021d54, 1},
43 { 0x00021d5c, 1},
44 { 0x00021d68, 19},
45 { 0x00021dbc, 16},
46 { 0x00022430, 7},
47 { 0x00022450, 1},
48 { 0x0002245c, 2},
49 { 0x00070000, 5},
50 { 0x000840a8, 1},
51 { 0x00084b5c, 1},
52 { 0x000870a8, 1},
53 { 0x000884e0, 1},
54 { 0x000884f4, 1},
55 { 0x0008e00c, 1},
56 { 0x00100c18, 3},
57 { 0x00100c84, 1},
58 { 0x0010a0a8, 1},
59 { 0x0010a4f0, 1},
60 { 0x0013c808, 2},
61 { 0x0013cc14, 1},
62 { 0x0013cc34, 1},
63 { 0x0013cc54, 1},
64 { 0x0013cc74, 1},
65 { 0x0013cc94, 1},
66 { 0x0013ccb4, 1},
67 { 0x0013ec18, 1},
68 { 0x00140028, 1},
69 { 0x00140280, 1},
70 { 0x001402a0, 1},
71 { 0x00140350, 1},
72 { 0x00140480, 1},
73 { 0x001404a0, 1},
74 { 0x00140550, 1},
75 { 0x00140680, 1},
76 { 0x001406a0, 1},
77 { 0x00140750, 1},
78 { 0x00142028, 1},
79 { 0x00142280, 1},
80 { 0x001422a0, 1},
81 { 0x00142350, 1},
82 { 0x00142480, 1},
83 { 0x001424a0, 1},
84 { 0x00142550, 1},
85 { 0x00142680, 1},
86 { 0x001426a0, 1},
87 { 0x00142750, 1},
88 { 0x00144028, 1},
89 { 0x00144280, 1},
90 { 0x00144350, 1},
91 { 0x00144480, 1},
92 { 0x00144550, 1},
93 { 0x00144680, 1},
94 { 0x00144750, 1},
95 { 0x00146028, 1},
96 { 0x00146280, 1},
97 { 0x00146350, 1},
98 { 0x00146480, 1},
99 { 0x00146550, 1},
100 { 0x00146680, 1},
101 { 0x00146750, 1},
102 { 0x00148028, 1},
103 { 0x00148280, 1},
104 { 0x00148350, 1},
105 { 0x00148480, 1},
106 { 0x00148550, 1},
107 { 0x00148680, 1},
108 { 0x00148750, 1},
109 { 0x0014a028, 1},
110 { 0x0014a280, 1},
111 { 0x0014a350, 1},
112 { 0x0014a480, 1},
113 { 0x0014a550, 1},
114 { 0x0014a680, 1},
115 { 0x0014a750, 1},
116 { 0x0014c028, 1},
117 { 0x0014c280, 1},
118 { 0x0014c350, 1},
119 { 0x0014c480, 1},
120 { 0x0014c550, 1},
121 { 0x0014c680, 1},
122 { 0x0014c750, 1},
123 { 0x0014e028, 1},
124 { 0x0014e280, 1},
125 { 0x0014e350, 1},
126 { 0x0014e480, 1},
127 { 0x0014e550, 1},
128 { 0x0014e680, 1},
129 { 0x0014e750, 1},
130 { 0x00150028, 1},
131 { 0x00150280, 1},
132 { 0x00150350, 1},
133 { 0x00150480, 1},
134 { 0x00150550, 1},
135 { 0x00150680, 1},
136 { 0x00150750, 1},
137 { 0x00152028, 1},
138 { 0x00152280, 1},
139 { 0x00152350, 1},
140 { 0x00152480, 1},
141 { 0x00152550, 1},
142 { 0x00152680, 1},
143 { 0x00152750, 1},
144 { 0x00154028, 1},
145 { 0x00154280, 1},
146 { 0x00154350, 1},
147 { 0x00154480, 1},
148 { 0x00154550, 1},
149 { 0x00154680, 1},
150 { 0x00154750, 1},
151 { 0x00156028, 1},
152 { 0x00156280, 1},
153 { 0x00156350, 1},
154 { 0x00156480, 1},
155 { 0x00156550, 1},
156 { 0x00156680, 1},
157 { 0x00156750, 1},
158 { 0x0017e028, 1},
159 { 0x0017e280, 1},
160 { 0x0017e294, 1},
161 { 0x0017e29c, 2},
162 { 0x0017e2ac, 1},
163 { 0x0017e350, 1},
164 { 0x0017e39c, 1},
165 { 0x0017e480, 1},
166 { 0x0017e4a0, 1},
167 { 0x0017e550, 1},
168 { 0x0017e680, 1},
169 { 0x0017e6a0, 1},
170 { 0x0017e750, 1},
171 { 0x00180040, 41},
172 { 0x001800ec, 1},
173 { 0x001800f8, 7},
174 { 0x00180240, 41},
175 { 0x001802ec, 1},
176 { 0x001802f8, 7},
177 { 0x00180440, 41},
178 { 0x001804ec, 1},
179 { 0x001804f8, 7},
180 { 0x00180640, 41},
181 { 0x001806ec, 1},
182 { 0x001806f8, 7},
183 { 0x00180840, 41},
184 { 0x001808ec, 1},
185 { 0x001808f8, 7},
186 { 0x00180a40, 41},
187 { 0x00180aec, 1},
188 { 0x00180af8, 7},
189 { 0x00180c40, 41},
190 { 0x00180cec, 1},
191 { 0x00180cf8, 7},
192 { 0x00180e40, 41},
193 { 0x00180eec, 1},
194 { 0x00180ef8, 7},
195 { 0x00181040, 41},
196 { 0x001810ec, 1},
197 { 0x001810f8, 7},
198 { 0x00181240, 41},
199 { 0x001812ec, 1},
200 { 0x001812f8, 7},
201 { 0x00181440, 41},
202 { 0x001814ec, 1},
203 { 0x001814f8, 7},
204 { 0x00181640, 41},
205 { 0x001816ec, 1},
206 { 0x001816f8, 7},
207 { 0x00181840, 41},
208 { 0x001818ec, 1},
209 { 0x001818f8, 7},
210 { 0x00181a40, 41},
211 { 0x00181aec, 1},
212 { 0x00181af8, 7},
213 { 0x00181c40, 41},
214 { 0x00181cec, 1},
215 { 0x00181cf8, 7},
216 { 0x00181e40, 41},
217 { 0x00181eec, 1},
218 { 0x00181ef8, 7},
219 { 0x00182040, 41},
220 { 0x001820ec, 1},
221 { 0x001820f8, 7},
222 { 0x00182240, 41},
223 { 0x001822ec, 1},
224 { 0x001822f8, 7},
225 { 0x00182440, 41},
226 { 0x001824ec, 1},
227 { 0x001824f8, 7},
228 { 0x00182640, 41},
229 { 0x001826ec, 1},
230 { 0x001826f8, 7},
231 { 0x00182840, 41},
232 { 0x001828ec, 1},
233 { 0x001828f8, 7},
234 { 0x00182a40, 41},
235 { 0x00182aec, 1},
236 { 0x00182af8, 7},
237 { 0x00182c40, 41},
238 { 0x00182cec, 1},
239 { 0x00182cf8, 7},
240 { 0x00182e40, 41},
241 { 0x00182eec, 1},
242 { 0x00182ef8, 7},
243 { 0x00183040, 41},
244 { 0x001830ec, 1},
245 { 0x001830f8, 7},
246 { 0x00183240, 41},
247 { 0x001832ec, 1},
248 { 0x001832f8, 7},
249 { 0x00183440, 41},
250 { 0x001834ec, 1},
251 { 0x001834f8, 7},
252 { 0x00183640, 41},
253 { 0x001836ec, 1},
254 { 0x001836f8, 7},
255 { 0x00183840, 41},
256 { 0x001838ec, 1},
257 { 0x001838f8, 7},
258 { 0x00183a40, 41},
259 { 0x00183aec, 1},
260 { 0x00183af8, 7},
261 { 0x00183c40, 41},
262 { 0x00183cec, 1},
263 { 0x00183cf8, 7},
264 { 0x00183e40, 41},
265 { 0x00183eec, 1},
266 { 0x00183ef8, 7},
267 { 0x00184040, 41},
268 { 0x001840ec, 1},
269 { 0x001840f8, 7},
270 { 0x00184240, 41},
271 { 0x001842ec, 1},
272 { 0x001842f8, 7},
273 { 0x00184440, 41},
274 { 0x001844ec, 1},
275 { 0x001844f8, 7},
276 { 0x00184640, 41},
277 { 0x001846ec, 1},
278 { 0x001846f8, 7},
279 { 0x00184840, 41},
280 { 0x001848ec, 1},
281 { 0x001848f8, 7},
282 { 0x00184a40, 41},
283 { 0x00184aec, 1},
284 { 0x00184af8, 7},
285 { 0x00184c40, 41},
286 { 0x00184cec, 1},
287 { 0x00184cf8, 7},
288 { 0x00184e40, 41},
289 { 0x00184eec, 1},
290 { 0x00184ef8, 7},
291 { 0x00185040, 41},
292 { 0x001850ec, 1},
293 { 0x001850f8, 7},
294 { 0x00185240, 41},
295 { 0x001852ec, 1},
296 { 0x001852f8, 7},
297 { 0x00185440, 41},
298 { 0x001854ec, 1},
299 { 0x001854f8, 7},
300 { 0x00185640, 41},
301 { 0x001856ec, 1},
302 { 0x001856f8, 7},
303 { 0x00185840, 41},
304 { 0x001858ec, 1},
305 { 0x001858f8, 7},
306 { 0x00185a40, 41},
307 { 0x00185aec, 1},
308 { 0x00185af8, 7},
309 { 0x00185c40, 41},
310 { 0x00185cec, 1},
311 { 0x00185cf8, 7},
312 { 0x00185e40, 41},
313 { 0x00185eec, 1},
314 { 0x00185ef8, 7},
315 { 0x001a0040, 41},
316 { 0x001a00ec, 1},
317 { 0x001a00f8, 7},
318 { 0x001a0240, 41},
319 { 0x001a02ec, 1},
320 { 0x001a02f8, 7},
321 { 0x001a0440, 41},
322 { 0x001a04ec, 1},
323 { 0x001a04f8, 7},
324 { 0x001a0640, 41},
325 { 0x001a06ec, 1},
326 { 0x001a06f8, 7},
327 { 0x001a0840, 41},
328 { 0x001a08ec, 1},
329 { 0x001a08f8, 7},
330 { 0x001a0a40, 41},
331 { 0x001a0aec, 1},
332 { 0x001a0af8, 7},
333 { 0x001a0c40, 41},
334 { 0x001a0cec, 1},
335 { 0x001a0cf8, 7},
336 { 0x001a0e40, 41},
337 { 0x001a0eec, 1},
338 { 0x001a0ef8, 7},
339 { 0x001a1040, 41},
340 { 0x001a10ec, 1},
341 { 0x001a10f8, 7},
342 { 0x001a1240, 41},
343 { 0x001a12ec, 1},
344 { 0x001a12f8, 7},
345 { 0x001a1440, 41},
346 { 0x001a14ec, 1},
347 { 0x001a14f8, 7},
348 { 0x001a1640, 41},
349 { 0x001a16ec, 1},
350 { 0x001a16f8, 7},
351 { 0x001a1840, 41},
352 { 0x001a18ec, 1},
353 { 0x001a18f8, 7},
354 { 0x001a1a40, 41},
355 { 0x001a1aec, 1},
356 { 0x001a1af8, 7},
357 { 0x001a1c40, 41},
358 { 0x001a1cec, 1},
359 { 0x001a1cf8, 7},
360 { 0x001a1e40, 41},
361 { 0x001a1eec, 1},
362 { 0x001a1ef8, 7},
363 { 0x001a2040, 41},
364 { 0x001a20ec, 1},
365 { 0x001a20f8, 7},
366 { 0x001a2240, 41},
367 { 0x001a22ec, 1},
368 { 0x001a22f8, 7},
369 { 0x001a2440, 41},
370 { 0x001a24ec, 1},
371 { 0x001a24f8, 7},
372 { 0x001a2640, 41},
373 { 0x001a26ec, 1},
374 { 0x001a26f8, 7},
375 { 0x001a2840, 41},
376 { 0x001a28ec, 1},
377 { 0x001a28f8, 7},
378 { 0x001a2a40, 41},
379 { 0x001a2aec, 1},
380 { 0x001a2af8, 7},
381 { 0x001a2c40, 41},
382 { 0x001a2cec, 1},
383 { 0x001a2cf8, 7},
384 { 0x001a2e40, 41},
385 { 0x001a2eec, 1},
386 { 0x001a2ef8, 7},
387 { 0x001a3040, 41},
388 { 0x001a30ec, 1},
389 { 0x001a30f8, 7},
390 { 0x001a3240, 41},
391 { 0x001a32ec, 1},
392 { 0x001a32f8, 7},
393 { 0x001a3440, 41},
394 { 0x001a34ec, 1},
395 { 0x001a34f8, 7},
396 { 0x001a3640, 41},
397 { 0x001a36ec, 1},
398 { 0x001a36f8, 7},
399 { 0x001a3840, 41},
400 { 0x001a38ec, 1},
401 { 0x001a38f8, 7},
402 { 0x001a3a40, 41},
403 { 0x001a3aec, 1},
404 { 0x001a3af8, 7},
405 { 0x001a3c40, 41},
406 { 0x001a3cec, 1},
407 { 0x001a3cf8, 7},
408 { 0x001a3e40, 41},
409 { 0x001a3eec, 1},
410 { 0x001a3ef8, 7},
411 { 0x001a4040, 41},
412 { 0x001a40ec, 1},
413 { 0x001a40f8, 7},
414 { 0x001a4240, 41},
415 { 0x001a42ec, 1},
416 { 0x001a42f8, 7},
417 { 0x001a4440, 41},
418 { 0x001a44ec, 1},
419 { 0x001a44f8, 7},
420 { 0x001a4640, 41},
421 { 0x001a46ec, 1},
422 { 0x001a46f8, 7},
423 { 0x001a4840, 41},
424 { 0x001a48ec, 1},
425 { 0x001a48f8, 7},
426 { 0x001a4a40, 41},
427 { 0x001a4aec, 1},
428 { 0x001a4af8, 7},
429 { 0x001a4c40, 41},
430 { 0x001a4cec, 1},
431 { 0x001a4cf8, 7},
432 { 0x001a4e40, 41},
433 { 0x001a4eec, 1},
434 { 0x001a4ef8, 7},
435 { 0x001a5040, 41},
436 { 0x001a50ec, 1},
437 { 0x001a50f8, 7},
438 { 0x001a5240, 41},
439 { 0x001a52ec, 1},
440 { 0x001a52f8, 7},
441 { 0x001a5440, 41},
442 { 0x001a54ec, 1},
443 { 0x001a54f8, 7},
444 { 0x001a5640, 41},
445 { 0x001a56ec, 1},
446 { 0x001a56f8, 7},
447 { 0x001a5840, 41},
448 { 0x001a58ec, 1},
449 { 0x001a58f8, 7},
450 { 0x001a5a40, 41},
451 { 0x001a5aec, 1},
452 { 0x001a5af8, 7},
453 { 0x001a5c40, 41},
454 { 0x001a5cec, 1},
455 { 0x001a5cf8, 7},
456 { 0x001a5e40, 41},
457 { 0x001a5eec, 1},
458 { 0x001a5ef8, 7},
459 { 0x001b0040, 41},
460 { 0x001b00ec, 1},
461 { 0x001b00f8, 7},
462 { 0x001b0240, 41},
463 { 0x001b02ec, 1},
464 { 0x001b02f8, 7},
465 { 0x001b0440, 41},
466 { 0x001b04ec, 1},
467 { 0x001b04f8, 7},
468 { 0x001b0640, 41},
469 { 0x001b06ec, 1},
470 { 0x001b06f8, 7},
471 { 0x001b0840, 41},
472 { 0x001b08ec, 1},
473 { 0x001b08f8, 7},
474 { 0x001b0a40, 41},
475 { 0x001b0aec, 1},
476 { 0x001b0af8, 7},
477 { 0x001b0c40, 41},
478 { 0x001b0cec, 1},
479 { 0x001b0cf8, 7},
480 { 0x001b0e40, 41},
481 { 0x001b0eec, 1},
482 { 0x001b0ef8, 7},
483 { 0x001b4000, 1},
484 { 0x001b4008, 1},
485 { 0x001b4010, 3},
486 { 0x001b4020, 3},
487 { 0x001b4030, 3},
488 { 0x001b4040, 3},
489 { 0x001b4050, 3},
490 { 0x001b4060, 4},
491 { 0x001b4074, 7},
492 { 0x001b4094, 3},
493 { 0x001b40a4, 1},
494 { 0x001b4100, 6},
495 { 0x001b4124, 2},
496 { 0x001b8000, 1},
497 { 0x001b8008, 1},
498 { 0x001b8010, 3},
499 { 0x001b8200, 1},
500 { 0x001b8208, 1},
501 { 0x001b8210, 3},
502 { 0x001b8400, 1},
503 { 0x001b8408, 1},
504 { 0x001b8410, 3},
505 { 0x001b8600, 1},
506 { 0x001b8608, 1},
507 { 0x001b8610, 3},
508 { 0x001b8800, 1},
509 { 0x001b8808, 1},
510 { 0x001b8810, 3},
511 { 0x001b8a00, 1},
512 { 0x001b8a08, 1},
513 { 0x001b8a10, 3},
514 { 0x001bc000, 1},
515 { 0x001bc008, 1},
516 { 0x001bc010, 3},
517 { 0x001bc200, 1},
518 { 0x001bc208, 1},
519 { 0x001bc210, 3},
520 { 0x001bc400, 1},
521 { 0x001bc408, 1},
522 { 0x001bc410, 3},
523 { 0x001bc600, 1},
524 { 0x001bc608, 1},
525 { 0x001bc610, 3},
526 { 0x001bc800, 1},
527 { 0x001bc808, 1},
528 { 0x001bc810, 3},
529 { 0x001bca00, 1},
530 { 0x001bca08, 1},
531 { 0x001bca10, 3},
532 { 0x001bd218, 1},
533 { 0x001be000, 1},
534 { 0x001be008, 1},
535 { 0x001be010, 3},
536 { 0x001be218, 1},
537 { 0x001bf218, 1},
538 { 0x001c0218, 1},
539 { 0x001c1218, 1},
540 { 0x001c80a8, 1},
541 { 0x001c9100, 1},
542 { 0x001cc0a8, 1},
543 { 0x001cd100, 1},
544 { 0x00400500, 1},
545 { 0x0040415c, 1},
546 { 0x00404468, 1},
547 { 0x00404498, 1},
548 { 0x00405800, 1},
549 { 0x00405840, 2},
550 { 0x00405850, 1},
551 { 0x00405908, 1},
552 { 0x00405a00, 1},
553 { 0x00405b40, 1},
554 { 0x00405b50, 1},
555 { 0x00406024, 5},
556 { 0x00407010, 1},
557 { 0x00407808, 1},
558 { 0x0040803c, 1},
559 { 0x00408804, 1},
560 { 0x0040880c, 1},
561 { 0x00408900, 2},
562 { 0x00408910, 1},
563 { 0x00408944, 1},
564 { 0x00408984, 1},
565 { 0x004090a8, 1},
566 { 0x004098a0, 1},
567 { 0x00409b00, 1},
568 { 0x0041000c, 1},
569 { 0x00410110, 1},
570 { 0x00410184, 1},
571 { 0x0041040c, 1},
572 { 0x00410510, 1},
573 { 0x00410584, 1},
574 { 0x0041080c, 1},
575 { 0x00410910, 1},
576 { 0x00410984, 1},
577 { 0x00410c0c, 1},
578 { 0x00410d10, 1},
579 { 0x00410d84, 1},
580 { 0x0041100c, 1},
581 { 0x00411110, 1},
582 { 0x00411184, 1},
583 { 0x0041140c, 1},
584 { 0x00411510, 1},
585 { 0x00411584, 1},
586 { 0x0041180c, 1},
587 { 0x00411910, 1},
588 { 0x00411984, 1},
589 { 0x00411c0c, 1},
590 { 0x00411d10, 1},
591 { 0x00411d84, 1},
592 { 0x0041200c, 1},
593 { 0x00412110, 1},
594 { 0x00412184, 1},
595 { 0x0041240c, 1},
596 { 0x00412510, 1},
597 { 0x00412584, 1},
598 { 0x0041280c, 1},
599 { 0x00412910, 1},
600 { 0x00412984, 1},
601 { 0x00412c0c, 1},
602 { 0x00412d10, 1},
603 { 0x00412d84, 1},
604 { 0x00418000, 1},
605 { 0x00418008, 1},
606 { 0x00418380, 2},
607 { 0x00418400, 2},
608 { 0x004184a0, 1},
609 { 0x00418604, 1},
610 { 0x00418680, 1},
611 { 0x00418704, 1},
612 { 0x00418714, 1},
613 { 0x00418800, 1},
614 { 0x0041881c, 1},
615 { 0x00418830, 1},
616 { 0x00418884, 1},
617 { 0x004188b0, 1},
618 { 0x004188c8, 3},
619 { 0x004188fc, 1},
620 { 0x00418b04, 1},
621 { 0x00418c04, 1},
622 { 0x00418c10, 8},
623 { 0x00418c88, 1},
624 { 0x00418d00, 1},
625 { 0x00418e00, 1},
626 { 0x00418e08, 1},
627 { 0x00418e34, 1},
628 { 0x00418e40, 4},
629 { 0x00418e58, 16},
630 { 0x00418f08, 1},
631 { 0x00419000, 1},
632 { 0x0041900c, 1},
633 { 0x00419018, 1},
634 { 0x00419854, 1},
635 { 0x00419864, 1},
636 { 0x00419a04, 2},
637 { 0x00419a14, 1},
638 { 0x00419ab0, 1},
639 { 0x00419ab8, 3},
640 { 0x00419c0c, 1},
641 { 0x00419c8c, 2},
642 { 0x00419d00, 1},
643 { 0x00419d08, 2},
644 { 0x00419e00, 11},
645 { 0x00419e34, 2},
646 { 0x00419e44, 11},
647 { 0x00419e74, 10},
648 { 0x00419ea4, 1},
649 { 0x00419eac, 2},
650 { 0x00419ee8, 1},
651 { 0x00419ef0, 28},
652 { 0x00419f70, 1},
653 { 0x00419f78, 2},
654 { 0x00419f98, 2},
655 { 0x00419fdc, 1},
656 { 0x0041a02c, 2},
657 { 0x0041a0a0, 1},
658 { 0x0041a0a8, 1},
659 { 0x0041a890, 2},
660 { 0x0041a8a0, 3},
661 { 0x0041a8b0, 2},
662 { 0x0041b014, 1},
663 { 0x0041b0cc, 1},
664 { 0x0041b1dc, 1},
665 { 0x0041b214, 1},
666 { 0x0041b2cc, 1},
667 { 0x0041b3dc, 1},
668 { 0x0041b414, 1},
669 { 0x0041b4cc, 1},
670 { 0x0041b5dc, 1},
671 { 0x0041be0c, 3},
672 { 0x0041becc, 1},
673 { 0x0041bfdc, 1},
674 { 0x0041c054, 1},
675 { 0x0041c2b0, 1},
676 { 0x0041c2b8, 3},
677 { 0x0041c40c, 1},
678 { 0x0041c48c, 2},
679 { 0x0041c500, 1},
680 { 0x0041c508, 2},
681 { 0x0041c600, 11},
682 { 0x0041c634, 2},
683 { 0x0041c644, 11},
684 { 0x0041c674, 10},
685 { 0x0041c6a4, 1},
686 { 0x0041c6ac, 2},
687 { 0x0041c6e8, 1},
688 { 0x0041c6f0, 28},
689 { 0x0041c770, 1},
690 { 0x0041c778, 2},
691 { 0x0041c798, 2},
692 { 0x0041c7dc, 1},
693 { 0x0041c854, 1},
694 { 0x0041cab0, 1},
695 { 0x0041cab8, 3},
696 { 0x0041cc0c, 1},
697 { 0x0041cc8c, 2},
698 { 0x0041cd00, 1},
699 { 0x0041cd08, 2},
700 { 0x0041ce00, 11},
701 { 0x0041ce34, 2},
702 { 0x0041ce44, 11},
703 { 0x0041ce74, 10},
704 { 0x0041cea4, 1},
705 { 0x0041ceac, 2},
706 { 0x0041cee8, 1},
707 { 0x0041cef0, 28},
708 { 0x0041cf70, 1},
709 { 0x0041cf78, 2},
710 { 0x0041cf98, 2},
711 { 0x0041cfdc, 1},
712 { 0x0041d054, 1},
713 { 0x0041d2b0, 1},
714 { 0x0041d2b8, 3},
715 { 0x0041d40c, 1},
716 { 0x0041d48c, 2},
717 { 0x0041d500, 1},
718 { 0x0041d508, 2},
719 { 0x0041d600, 11},
720 { 0x0041d634, 2},
721 { 0x0041d644, 11},
722 { 0x0041d674, 10},
723 { 0x0041d6a4, 1},
724 { 0x0041d6ac, 2},
725 { 0x0041d6e8, 1},
726 { 0x0041d6f0, 28},
727 { 0x0041d770, 1},
728 { 0x0041d778, 2},
729 { 0x0041d798, 2},
730 { 0x0041d7dc, 1},
731 { 0x0041d854, 1},
732 { 0x0041dab0, 1},
733 { 0x0041dab8, 3},
734 { 0x0041dc0c, 1},
735 { 0x0041dc8c, 2},
736 { 0x0041dd00, 1},
737 { 0x0041dd08, 2},
738 { 0x0041de00, 11},
739 { 0x0041de34, 2},
740 { 0x0041de44, 11},
741 { 0x0041de74, 10},
742 { 0x0041dea4, 1},
743 { 0x0041deac, 2},
744 { 0x0041dee8, 1},
745 { 0x0041def0, 28},
746 { 0x0041df70, 1},
747 { 0x0041df78, 2},
748 { 0x0041df98, 2},
749 { 0x0041dfdc, 1},
750 { 0x0041e054, 1},
751 { 0x0041e2b0, 1},
752 { 0x0041e2b8, 3},
753 { 0x0041e40c, 1},
754 { 0x0041e48c, 2},
755 { 0x0041e500, 1},
756 { 0x0041e508, 2},
757 { 0x0041e600, 11},
758 { 0x0041e634, 2},
759 { 0x0041e644, 11},
760 { 0x0041e674, 10},
761 { 0x0041e6a4, 1},
762 { 0x0041e6ac, 2},
763 { 0x0041e6e8, 1},
764 { 0x0041e6f0, 28},
765 { 0x0041e770, 1},
766 { 0x0041e778, 2},
767 { 0x0041e798, 2},
768 { 0x0041e7dc, 1},
769 { 0x00500384, 1},
770 { 0x005004a0, 1},
771 { 0x00500604, 1},
772 { 0x00500680, 1},
773 { 0x00500714, 1},
774 { 0x0050081c, 1},
775 { 0x00500884, 1},
776 { 0x005008b0, 1},
777 { 0x005008c8, 3},
778 { 0x005008fc, 1},
779 { 0x00500b04, 1},
780 { 0x00500c04, 1},
781 { 0x00500c10, 8},
782 { 0x00500c88, 1},
783 { 0x00500d00, 1},
784 { 0x00500e08, 1},
785 { 0x00500f08, 1},
786 { 0x00501000, 1},
787 { 0x0050100c, 1},
788 { 0x00501018, 1},
789 { 0x00501854, 1},
790 { 0x00501ab0, 1},
791 { 0x00501ab8, 3},
792 { 0x00501c0c, 1},
793 { 0x00501c8c, 2},
794 { 0x00501d00, 1},
795 { 0x00501d08, 2},
796 { 0x00501e00, 11},
797 { 0x00501e34, 2},
798 { 0x00501e44, 11},
799 { 0x00501e74, 10},
800 { 0x00501ea4, 1},
801 { 0x00501eac, 2},
802 { 0x00501ee8, 1},
803 { 0x00501ef0, 28},
804 { 0x00501f70, 1},
805 { 0x00501f78, 2},
806 { 0x00501f98, 2},
807 { 0x00501fdc, 1},
808 { 0x0050202c, 2},
809 { 0x005020a0, 1},
810 { 0x005020a8, 1},
811 { 0x00502890, 2},
812 { 0x005028a0, 3},
813 { 0x005028b0, 2},
814 { 0x00503014, 1},
815 { 0x005030cc, 1},
816 { 0x005031dc, 1},
817 { 0x00503214, 1},
818 { 0x005032cc, 1},
819 { 0x005033dc, 1},
820 { 0x00503414, 1},
821 { 0x005034cc, 1},
822 { 0x005035dc, 1},
823 { 0x00503e14, 1},
824 { 0x00503ecc, 1},
825 { 0x00503fdc, 1},
826 { 0x00504054, 1},
827 { 0x005042b0, 1},
828 { 0x005042b8, 3},
829 { 0x0050440c, 1},
830 { 0x0050448c, 2},
831 { 0x00504500, 1},
832 { 0x00504508, 2},
833 { 0x00504600, 11},
834 { 0x00504634, 2},
835 { 0x00504644, 11},
836 { 0x00504674, 10},
837 { 0x005046a4, 1},
838 { 0x005046ac, 2},
839 { 0x005046e8, 1},
840 { 0x005046f0, 28},
841 { 0x00504770, 1},
842 { 0x00504778, 2},
843 { 0x00504798, 2},
844 { 0x005047dc, 1},
845 { 0x00504854, 1},
846 { 0x00504ab0, 1},
847 { 0x00504ab8, 3},
848 { 0x00504c0c, 1},
849 { 0x00504c8c, 2},
850 { 0x00504d00, 1},
851 { 0x00504d08, 2},
852 { 0x00504e00, 11},
853 { 0x00504e34, 2},
854 { 0x00504e44, 11},
855 { 0x00504e74, 10},
856 { 0x00504ea4, 1},
857 { 0x00504eac, 2},
858 { 0x00504ee8, 1},
859 { 0x00504ef0, 28},
860 { 0x00504f70, 1},
861 { 0x00504f78, 2},
862 { 0x00504f98, 2},
863 { 0x00504fdc, 1},
864 { 0x00505054, 1},
865 { 0x005052b0, 1},
866 { 0x005052b8, 3},
867 { 0x0050540c, 1},
868 { 0x0050548c, 2},
869 { 0x00505500, 1},
870 { 0x00505508, 2},
871 { 0x00505600, 11},
872 { 0x00505634, 2},
873 { 0x00505644, 11},
874 { 0x00505674, 10},
875 { 0x005056a4, 1},
876 { 0x005056ac, 2},
877 { 0x005056e8, 1},
878 { 0x005056f0, 28},
879 { 0x00505770, 1},
880 { 0x00505778, 2},
881 { 0x00505798, 2},
882 { 0x005057dc, 1},
883 { 0x00505854, 1},
884 { 0x00505ab0, 1},
885 { 0x00505ab8, 3},
886 { 0x00505c0c, 1},
887 { 0x00505c8c, 2},
888 { 0x00505d00, 1},
889 { 0x00505d08, 2},
890 { 0x00505e00, 11},
891 { 0x00505e34, 2},
892 { 0x00505e44, 11},
893 { 0x00505e74, 10},
894 { 0x00505ea4, 1},
895 { 0x00505eac, 2},
896 { 0x00505ee8, 1},
897 { 0x00505ef0, 28},
898 { 0x00505f70, 1},
899 { 0x00505f78, 2},
900 { 0x00505f98, 2},
901 { 0x00505fdc, 1},
902 { 0x00506054, 1},
903 { 0x005062b0, 1},
904 { 0x005062b8, 3},
905 { 0x0050640c, 1},
906 { 0x0050648c, 2},
907 { 0x00506500, 1},
908 { 0x00506508, 2},
909 { 0x00506600, 11},
910 { 0x00506634, 2},
911 { 0x00506644, 11},
912 { 0x00506674, 10},
913 { 0x005066a4, 1},
914 { 0x005066ac, 2},
915 { 0x005066e8, 1},
916 { 0x005066f0, 28},
917 { 0x00506770, 1},
918 { 0x00506778, 2},
919 { 0x00506798, 2},
920 { 0x005067dc, 1},
921 { 0x00508384, 1},
922 { 0x005084a0, 1},
923 { 0x00508604, 1},
924 { 0x00508680, 1},
925 { 0x00508714, 1},
926 { 0x0050881c, 1},
927 { 0x00508884, 1},
928 { 0x005088b0, 1},
929 { 0x005088c8, 2},
930 { 0x00508b04, 1},
931 { 0x00508c04, 1},
932 { 0x00508c10, 8},
933 { 0x00508c88, 1},
934 { 0x00508d00, 1},
935 { 0x00508e08, 1},
936 { 0x00508f08, 1},
937 { 0x00509000, 1},
938 { 0x0050900c, 1},
939 { 0x00509018, 1},
940 { 0x00509854, 1},
941 { 0x00509ab0, 1},
942 { 0x00509ab8, 3},
943 { 0x00509c0c, 1},
944 { 0x00509c8c, 2},
945 { 0x00509d00, 1},
946 { 0x00509d08, 2},
947 { 0x00509e00, 11},
948 { 0x00509e34, 2},
949 { 0x00509e44, 11},
950 { 0x00509e74, 10},
951 { 0x00509ea4, 1},
952 { 0x00509eac, 2},
953 { 0x00509ee8, 1},
954 { 0x00509ef0, 28},
955 { 0x00509f70, 1},
956 { 0x00509f78, 2},
957 { 0x00509f98, 2},
958 { 0x00509fdc, 1},
959 { 0x0050a02c, 2},
960 { 0x0050a0a0, 1},
961 { 0x0050a0a8, 1},
962 { 0x0050a890, 2},
963 { 0x0050a8a0, 3},
964 { 0x0050a8b0, 2},
965 { 0x0050b014, 1},
966 { 0x0050b0cc, 1},
967 { 0x0050b1dc, 1},
968 { 0x0050b214, 1},
969 { 0x0050b2cc, 1},
970 { 0x0050b3dc, 1},
971 { 0x0050b414, 1},
972 { 0x0050b4cc, 1},
973 { 0x0050b5dc, 1},
974 { 0x0050be14, 1},
975 { 0x0050becc, 1},
976 { 0x0050bfdc, 1},
977 { 0x0050c054, 1},
978 { 0x0050c2b0, 1},
979 { 0x0050c2b8, 3},
980 { 0x0050c40c, 1},
981 { 0x0050c48c, 2},
982 { 0x0050c500, 1},
983 { 0x0050c508, 2},
984 { 0x0050c600, 11},
985 { 0x0050c634, 2},
986 { 0x0050c644, 11},
987 { 0x0050c674, 10},
988 { 0x0050c6a4, 1},
989 { 0x0050c6ac, 2},
990 { 0x0050c6e8, 1},
991 { 0x0050c6f0, 28},
992 { 0x0050c770, 1},
993 { 0x0050c778, 2},
994 { 0x0050c798, 2},
995 { 0x0050c7dc, 1},
996 { 0x0050c854, 1},
997 { 0x0050cab0, 1},
998 { 0x0050cab8, 3},
999 { 0x0050cc0c, 1},
1000 { 0x0050cc8c, 2},
1001 { 0x0050cd00, 1},
1002 { 0x0050cd08, 2},
1003 { 0x0050ce00, 11},
1004 { 0x0050ce34, 2},
1005 { 0x0050ce44, 11},
1006 { 0x0050ce74, 10},
1007 { 0x0050cea4, 1},
1008 { 0x0050ceac, 2},
1009 { 0x0050cee8, 1},
1010 { 0x0050cef0, 28},
1011 { 0x0050cf70, 1},
1012 { 0x0050cf78, 2},
1013 { 0x0050cf98, 2},
1014 { 0x0050cfdc, 1},
1015 { 0x0050d054, 1},
1016 { 0x0050d2b0, 1},
1017 { 0x0050d2b8, 3},
1018 { 0x0050d40c, 1},
1019 { 0x0050d48c, 2},
1020 { 0x0050d500, 1},
1021 { 0x0050d508, 2},
1022 { 0x0050d600, 11},
1023 { 0x0050d634, 2},
1024 { 0x0050d644, 11},
1025 { 0x0050d674, 10},
1026 { 0x0050d6a4, 1},
1027 { 0x0050d6ac, 2},
1028 { 0x0050d6e8, 1},
1029 { 0x0050d6f0, 28},
1030 { 0x0050d770, 1},
1031 { 0x0050d778, 2},
1032 { 0x0050d798, 2},
1033 { 0x0050d7dc, 1},
1034 { 0x0050d854, 1},
1035 { 0x0050dab0, 1},
1036 { 0x0050dab8, 3},
1037 { 0x0050dc0c, 1},
1038 { 0x0050dc8c, 2},
1039 { 0x0050dd00, 1},
1040 { 0x0050dd08, 2},
1041 { 0x0050de00, 11},
1042 { 0x0050de34, 2},
1043 { 0x0050de44, 11},
1044 { 0x0050de74, 10},
1045 { 0x0050dea4, 1},
1046 { 0x0050deac, 2},
1047 { 0x0050dee8, 1},
1048 { 0x0050def0, 28},
1049 { 0x0050df70, 1},
1050 { 0x0050df78, 2},
1051 { 0x0050df98, 2},
1052 { 0x0050dfdc, 1},
1053 { 0x0050e054, 1},
1054 { 0x0050e2b0, 1},
1055 { 0x0050e2b8, 3},
1056 { 0x0050e40c, 1},
1057 { 0x0050e48c, 2},
1058 { 0x0050e500, 1},
1059 { 0x0050e508, 2},
1060 { 0x0050e600, 11},
1061 { 0x0050e634, 2},
1062 { 0x0050e644, 11},
1063 { 0x0050e674, 10},
1064 { 0x0050e6a4, 1},
1065 { 0x0050e6ac, 2},
1066 { 0x0050e6e8, 1},
1067 { 0x0050e6f0, 28},
1068 { 0x0050e770, 1},
1069 { 0x0050e778, 2},
1070 { 0x0050e798, 2},
1071 { 0x0050e7dc, 1},
1072 { 0x00510384, 1},
1073 { 0x005104a0, 1},
1074 { 0x00510604, 1},
1075 { 0x00510680, 1},
1076 { 0x00510714, 1},
1077 { 0x0051081c, 1},
1078 { 0x00510884, 1},
1079 { 0x005108b0, 1},
1080 { 0x005108c8, 2},
1081 { 0x00510b04, 1},
1082 { 0x00510c04, 1},
1083 { 0x00510c10, 8},
1084 { 0x00510c88, 1},
1085 { 0x00510d00, 1},
1086 { 0x00510e08, 1},
1087 { 0x00510f08, 1},
1088 { 0x00511000, 1},
1089 { 0x0051100c, 1},
1090 { 0x00511018, 1},
1091 { 0x00511854, 1},
1092 { 0x00511ab0, 1},
1093 { 0x00511ab8, 3},
1094 { 0x00511c0c, 1},
1095 { 0x00511c8c, 2},
1096 { 0x00511d00, 1},
1097 { 0x00511d08, 2},
1098 { 0x00511e00, 11},
1099 { 0x00511e34, 2},
1100 { 0x00511e44, 11},
1101 { 0x00511e74, 10},
1102 { 0x00511ea4, 1},
1103 { 0x00511eac, 2},
1104 { 0x00511ee8, 1},
1105 { 0x00511ef0, 28},
1106 { 0x00511f70, 1},
1107 { 0x00511f78, 2},
1108 { 0x00511f98, 2},
1109 { 0x00511fdc, 1},
1110 { 0x0051202c, 2},
1111 { 0x005120a0, 1},
1112 { 0x005120a8, 1},
1113 { 0x00512890, 2},
1114 { 0x005128a0, 3},
1115 { 0x005128b0, 2},
1116 { 0x00513014, 1},
1117 { 0x005130cc, 1},
1118 { 0x005131dc, 1},
1119 { 0x00513214, 1},
1120 { 0x005132cc, 1},
1121 { 0x005133dc, 1},
1122 { 0x00513414, 1},
1123 { 0x005134cc, 1},
1124 { 0x005135dc, 1},
1125 { 0x00513e14, 1},
1126 { 0x00513ecc, 1},
1127 { 0x00513fdc, 1},
1128 { 0x00514054, 1},
1129 { 0x005142b0, 1},
1130 { 0x005142b8, 3},
1131 { 0x0051440c, 1},
1132 { 0x0051448c, 2},
1133 { 0x00514500, 1},
1134 { 0x00514508, 2},
1135 { 0x00514600, 11},
1136 { 0x00514634, 2},
1137 { 0x00514644, 11},
1138 { 0x00514674, 10},
1139 { 0x005146a4, 1},
1140 { 0x005146ac, 2},
1141 { 0x005146e8, 1},
1142 { 0x005146f0, 28},
1143 { 0x00514770, 1},
1144 { 0x00514778, 2},
1145 { 0x00514798, 2},
1146 { 0x005147dc, 1},
1147 { 0x00514854, 1},
1148 { 0x00514ab0, 1},
1149 { 0x00514ab8, 3},
1150 { 0x00514c0c, 1},
1151 { 0x00514c8c, 2},
1152 { 0x00514d00, 1},
1153 { 0x00514d08, 2},
1154 { 0x00514e00, 11},
1155 { 0x00514e34, 2},
1156 { 0x00514e44, 11},
1157 { 0x00514e74, 10},
1158 { 0x00514ea4, 1},
1159 { 0x00514eac, 2},
1160 { 0x00514ee8, 1},
1161 { 0x00514ef0, 28},
1162 { 0x00514f70, 1},
1163 { 0x00514f78, 2},
1164 { 0x00514f98, 2},
1165 { 0x00514fdc, 1},
1166 { 0x00515054, 1},
1167 { 0x005152b0, 1},
1168 { 0x005152b8, 3},
1169 { 0x0051540c, 1},
1170 { 0x0051548c, 2},
1171 { 0x00515500, 1},
1172 { 0x00515508, 2},
1173 { 0x00515600, 11},
1174 { 0x00515634, 2},
1175 { 0x00515644, 11},
1176 { 0x00515674, 10},
1177 { 0x005156a4, 1},
1178 { 0x005156ac, 2},
1179 { 0x005156e8, 1},
1180 { 0x005156f0, 28},
1181 { 0x00515770, 1},
1182 { 0x00515778, 2},
1183 { 0x00515798, 2},
1184 { 0x005157dc, 1},
1185 { 0x00515854, 1},
1186 { 0x00515ab0, 1},
1187 { 0x00515ab8, 3},
1188 { 0x00515c0c, 1},
1189 { 0x00515c8c, 2},
1190 { 0x00515d00, 1},
1191 { 0x00515d08, 2},
1192 { 0x00515e00, 11},
1193 { 0x00515e34, 2},
1194 { 0x00515e44, 11},
1195 { 0x00515e74, 10},
1196 { 0x00515ea4, 1},
1197 { 0x00515eac, 2},
1198 { 0x00515ee8, 1},
1199 { 0x00515ef0, 28},
1200 { 0x00515f70, 1},
1201 { 0x00515f78, 2},
1202 { 0x00515f98, 2},
1203 { 0x00515fdc, 1},
1204 { 0x00516054, 1},
1205 { 0x005162b0, 1},
1206 { 0x005162b8, 3},
1207 { 0x0051640c, 1},
1208 { 0x0051648c, 2},
1209 { 0x00516500, 1},
1210 { 0x00516508, 2},
1211 { 0x00516600, 11},
1212 { 0x00516634, 2},
1213 { 0x00516644, 11},
1214 { 0x00516674, 10},
1215 { 0x005166a4, 1},
1216 { 0x005166ac, 2},
1217 { 0x005166e8, 1},
1218 { 0x005166f0, 28},
1219 { 0x00516770, 1},
1220 { 0x00516778, 2},
1221 { 0x00516798, 2},
1222 { 0x005167dc, 1},
1223 { 0x00518384, 1},
1224 { 0x005184a0, 1},
1225 { 0x00518604, 1},
1226 { 0x00518680, 1},
1227 { 0x00518714, 1},
1228 { 0x0051881c, 1},
1229 { 0x00518884, 1},
1230 { 0x005188b0, 1},
1231 { 0x005188c8, 2},
1232 { 0x00518b04, 1},
1233 { 0x00518c04, 1},
1234 { 0x00518c10, 8},
1235 { 0x00518c88, 1},
1236 { 0x00518d00, 1},
1237 { 0x00518e08, 1},
1238 { 0x00518f08, 1},
1239 { 0x00519000, 1},
1240 { 0x0051900c, 1},
1241 { 0x00519018, 1},
1242 { 0x00519854, 1},
1243 { 0x00519ab0, 1},
1244 { 0x00519ab8, 3},
1245 { 0x00519c0c, 1},
1246 { 0x00519c8c, 2},
1247 { 0x00519d00, 1},
1248 { 0x00519d08, 2},
1249 { 0x00519e00, 11},
1250 { 0x00519e34, 2},
1251 { 0x00519e44, 11},
1252 { 0x00519e74, 10},
1253 { 0x00519ea4, 1},
1254 { 0x00519eac, 2},
1255 { 0x00519ee8, 1},
1256 { 0x00519ef0, 28},
1257 { 0x00519f70, 1},
1258 { 0x00519f78, 2},
1259 { 0x00519f98, 2},
1260 { 0x00519fdc, 1},
1261 { 0x0051a02c, 2},
1262 { 0x0051a0a0, 1},
1263 { 0x0051a0a8, 1},
1264 { 0x0051a890, 2},
1265 { 0x0051a8a0, 3},
1266 { 0x0051a8b0, 2},
1267 { 0x0051b014, 1},
1268 { 0x0051b0cc, 1},
1269 { 0x0051b1dc, 1},
1270 { 0x0051b214, 1},
1271 { 0x0051b2cc, 1},
1272 { 0x0051b3dc, 1},
1273 { 0x0051b414, 1},
1274 { 0x0051b4cc, 1},
1275 { 0x0051b5dc, 1},
1276 { 0x0051be14, 1},
1277 { 0x0051becc, 1},
1278 { 0x0051bfdc, 1},
1279 { 0x0051c054, 1},
1280 { 0x0051c2b0, 1},
1281 { 0x0051c2b8, 3},
1282 { 0x0051c40c, 1},
1283 { 0x0051c48c, 2},
1284 { 0x0051c500, 1},
1285 { 0x0051c508, 2},
1286 { 0x0051c600, 11},
1287 { 0x0051c634, 2},
1288 { 0x0051c644, 11},
1289 { 0x0051c674, 10},
1290 { 0x0051c6a4, 1},
1291 { 0x0051c6ac, 2},
1292 { 0x0051c6e8, 1},
1293 { 0x0051c6f0, 28},
1294 { 0x0051c770, 1},
1295 { 0x0051c778, 2},
1296 { 0x0051c798, 2},
1297 { 0x0051c7dc, 1},
1298 { 0x0051c854, 1},
1299 { 0x0051cab0, 1},
1300 { 0x0051cab8, 3},
1301 { 0x0051cc0c, 1},
1302 { 0x0051cc8c, 2},
1303 { 0x0051cd00, 1},
1304 { 0x0051cd08, 2},
1305 { 0x0051ce00, 11},
1306 { 0x0051ce34, 2},
1307 { 0x0051ce44, 11},
1308 { 0x0051ce74, 10},
1309 { 0x0051cea4, 1},
1310 { 0x0051ceac, 2},
1311 { 0x0051cee8, 1},
1312 { 0x0051cef0, 28},
1313 { 0x0051cf70, 1},
1314 { 0x0051cf78, 2},
1315 { 0x0051cf98, 2},
1316 { 0x0051cfdc, 1},
1317 { 0x0051d054, 1},
1318 { 0x0051d2b0, 1},
1319 { 0x0051d2b8, 3},
1320 { 0x0051d40c, 1},
1321 { 0x0051d48c, 2},
1322 { 0x0051d500, 1},
1323 { 0x0051d508, 2},
1324 { 0x0051d600, 11},
1325 { 0x0051d634, 2},
1326 { 0x0051d644, 11},
1327 { 0x0051d674, 10},
1328 { 0x0051d6a4, 1},
1329 { 0x0051d6ac, 2},
1330 { 0x0051d6e8, 1},
1331 { 0x0051d6f0, 28},
1332 { 0x0051d770, 1},
1333 { 0x0051d778, 2},
1334 { 0x0051d798, 2},
1335 { 0x0051d7dc, 1},
1336 { 0x0051d854, 1},
1337 { 0x0051dab0, 1},
1338 { 0x0051dab8, 3},
1339 { 0x0051dc0c, 1},
1340 { 0x0051dc8c, 2},
1341 { 0x0051dd00, 1},
1342 { 0x0051dd08, 2},
1343 { 0x0051de00, 11},
1344 { 0x0051de34, 2},
1345 { 0x0051de44, 11},
1346 { 0x0051de74, 10},
1347 { 0x0051dea4, 1},
1348 { 0x0051deac, 2},
1349 { 0x0051dee8, 1},
1350 { 0x0051def0, 28},
1351 { 0x0051df70, 1},
1352 { 0x0051df78, 2},
1353 { 0x0051df98, 2},
1354 { 0x0051dfdc, 1},
1355 { 0x0051e054, 1},
1356 { 0x0051e2b0, 1},
1357 { 0x0051e2b8, 3},
1358 { 0x0051e40c, 1},
1359 { 0x0051e48c, 2},
1360 { 0x0051e500, 1},
1361 { 0x0051e508, 2},
1362 { 0x0051e600, 11},
1363 { 0x0051e634, 2},
1364 { 0x0051e644, 11},
1365 { 0x0051e674, 10},
1366 { 0x0051e6a4, 1},
1367 { 0x0051e6ac, 2},
1368 { 0x0051e6e8, 1},
1369 { 0x0051e6f0, 28},
1370 { 0x0051e770, 1},
1371 { 0x0051e778, 2},
1372 { 0x0051e798, 2},
1373 { 0x0051e7dc, 1},
1374 { 0x00520384, 1},
1375 { 0x005204a0, 1},
1376 { 0x00520604, 1},
1377 { 0x00520680, 1},
1378 { 0x00520714, 1},
1379 { 0x0052081c, 1},
1380 { 0x00520884, 1},
1381 { 0x005208b0, 1},
1382 { 0x005208c8, 2},
1383 { 0x00520b04, 1},
1384 { 0x00520c04, 1},
1385 { 0x00520c10, 8},
1386 { 0x00520c88, 1},
1387 { 0x00520d00, 1},
1388 { 0x00520e08, 1},
1389 { 0x00520f08, 1},
1390 { 0x00521000, 1},
1391 { 0x0052100c, 1},
1392 { 0x00521018, 1},
1393 { 0x00521854, 1},
1394 { 0x00521ab0, 1},
1395 { 0x00521ab8, 3},
1396 { 0x00521c0c, 1},
1397 { 0x00521c8c, 2},
1398 { 0x00521d00, 1},
1399 { 0x00521d08, 2},
1400 { 0x00521e00, 11},
1401 { 0x00521e34, 2},
1402 { 0x00521e44, 11},
1403 { 0x00521e74, 10},
1404 { 0x00521ea4, 1},
1405 { 0x00521eac, 2},
1406 { 0x00521ee8, 1},
1407 { 0x00521ef0, 28},
1408 { 0x00521f70, 1},
1409 { 0x00521f78, 2},
1410 { 0x00521f98, 2},
1411 { 0x00521fdc, 1},
1412 { 0x0052202c, 2},
1413 { 0x005220a0, 1},
1414 { 0x005220a8, 1},
1415 { 0x00522890, 2},
1416 { 0x005228a0, 3},
1417 { 0x005228b0, 2},
1418 { 0x00523014, 1},
1419 { 0x005230cc, 1},
1420 { 0x005231dc, 1},
1421 { 0x00523214, 1},
1422 { 0x005232cc, 1},
1423 { 0x005233dc, 1},
1424 { 0x00523414, 1},
1425 { 0x005234cc, 1},
1426 { 0x005235dc, 1},
1427 { 0x00523e14, 1},
1428 { 0x00523ecc, 1},
1429 { 0x00523fdc, 1},
1430 { 0x00524054, 1},
1431 { 0x005242b0, 1},
1432 { 0x005242b8, 3},
1433 { 0x0052440c, 1},
1434 { 0x0052448c, 2},
1435 { 0x00524500, 1},
1436 { 0x00524508, 2},
1437 { 0x00524600, 11},
1438 { 0x00524634, 2},
1439 { 0x00524644, 11},
1440 { 0x00524674, 10},
1441 { 0x005246a4, 1},
1442 { 0x005246ac, 2},
1443 { 0x005246e8, 1},
1444 { 0x005246f0, 28},
1445 { 0x00524770, 1},
1446 { 0x00524778, 2},
1447 { 0x00524798, 2},
1448 { 0x005247dc, 1},
1449 { 0x00524854, 1},
1450 { 0x00524ab0, 1},
1451 { 0x00524ab8, 3},
1452 { 0x00524c0c, 1},
1453 { 0x00524c8c, 2},
1454 { 0x00524d00, 1},
1455 { 0x00524d08, 2},
1456 { 0x00524e00, 11},
1457 { 0x00524e34, 2},
1458 { 0x00524e44, 11},
1459 { 0x00524e74, 10},
1460 { 0x00524ea4, 1},
1461 { 0x00524eac, 2},
1462 { 0x00524ee8, 1},
1463 { 0x00524ef0, 28},
1464 { 0x00524f70, 1},
1465 { 0x00524f78, 2},
1466 { 0x00524f98, 2},
1467 { 0x00524fdc, 1},
1468 { 0x00525054, 1},
1469 { 0x005252b0, 1},
1470 { 0x005252b8, 3},
1471 { 0x0052540c, 1},
1472 { 0x0052548c, 2},
1473 { 0x00525500, 1},
1474 { 0x00525508, 2},
1475 { 0x00525600, 11},
1476 { 0x00525634, 2},
1477 { 0x00525644, 11},
1478 { 0x00525674, 10},
1479 { 0x005256a4, 1},
1480 { 0x005256ac, 2},
1481 { 0x005256e8, 1},
1482 { 0x005256f0, 28},
1483 { 0x00525770, 1},
1484 { 0x00525778, 2},
1485 { 0x00525798, 2},
1486 { 0x005257dc, 1},
1487 { 0x00525854, 1},
1488 { 0x00525ab0, 1},
1489 { 0x00525ab8, 3},
1490 { 0x00525c0c, 1},
1491 { 0x00525c8c, 2},
1492 { 0x00525d00, 1},
1493 { 0x00525d08, 2},
1494 { 0x00525e00, 11},
1495 { 0x00525e34, 2},
1496 { 0x00525e44, 11},
1497 { 0x00525e74, 10},
1498 { 0x00525ea4, 1},
1499 { 0x00525eac, 2},
1500 { 0x00525ee8, 1},
1501 { 0x00525ef0, 28},
1502 { 0x00525f70, 1},
1503 { 0x00525f78, 2},
1504 { 0x00525f98, 2},
1505 { 0x00525fdc, 1},
1506 { 0x00526054, 1},
1507 { 0x005262b0, 1},
1508 { 0x005262b8, 3},
1509 { 0x0052640c, 1},
1510 { 0x0052648c, 2},
1511 { 0x00526500, 1},
1512 { 0x00526508, 2},
1513 { 0x00526600, 11},
1514 { 0x00526634, 2},
1515 { 0x00526644, 11},
1516 { 0x00526674, 10},
1517 { 0x005266a4, 1},
1518 { 0x005266ac, 2},
1519 { 0x005266e8, 1},
1520 { 0x005266f0, 28},
1521 { 0x00526770, 1},
1522 { 0x00526778, 2},
1523 { 0x00526798, 2},
1524 { 0x005267dc, 1},
1525 { 0x00528384, 1},
1526 { 0x005284a0, 1},
1527 { 0x00528604, 1},
1528 { 0x00528680, 1},
1529 { 0x00528714, 1},
1530 { 0x0052881c, 1},
1531 { 0x00528884, 1},
1532 { 0x005288b0, 1},
1533 { 0x005288c8, 2},
1534 { 0x00528b04, 1},
1535 { 0x00528c04, 1},
1536 { 0x00528c10, 8},
1537 { 0x00528c88, 1},
1538 { 0x00528d00, 1},
1539 { 0x00528e08, 1},
1540 { 0x00528f08, 1},
1541 { 0x00529000, 1},
1542 { 0x0052900c, 1},
1543 { 0x00529018, 1},
1544 { 0x00529854, 1},
1545 { 0x00529ab0, 1},
1546 { 0x00529ab8, 3},
1547 { 0x00529c0c, 1},
1548 { 0x00529c8c, 2},
1549 { 0x00529d00, 1},
1550 { 0x00529d08, 2},
1551 { 0x00529e00, 11},
1552 { 0x00529e34, 2},
1553 { 0x00529e44, 11},
1554 { 0x00529e74, 10},
1555 { 0x00529ea4, 1},
1556 { 0x00529eac, 2},
1557 { 0x00529ee8, 1},
1558 { 0x00529ef0, 28},
1559 { 0x00529f70, 1},
1560 { 0x00529f78, 2},
1561 { 0x00529f98, 2},
1562 { 0x00529fdc, 1},
1563 { 0x0052a02c, 2},
1564 { 0x0052a0a0, 1},
1565 { 0x0052a0a8, 1},
1566 { 0x0052a890, 2},
1567 { 0x0052a8a0, 3},
1568 { 0x0052a8b0, 2},
1569 { 0x0052b014, 1},
1570 { 0x0052b0cc, 1},
1571 { 0x0052b1dc, 1},
1572 { 0x0052b214, 1},
1573 { 0x0052b2cc, 1},
1574 { 0x0052b3dc, 1},
1575 { 0x0052b414, 1},
1576 { 0x0052b4cc, 1},
1577 { 0x0052b5dc, 1},
1578 { 0x0052be14, 1},
1579 { 0x0052becc, 1},
1580 { 0x0052bfdc, 1},
1581 { 0x0052c054, 1},
1582 { 0x0052c2b0, 1},
1583 { 0x0052c2b8, 3},
1584 { 0x0052c40c, 1},
1585 { 0x0052c48c, 2},
1586 { 0x0052c500, 1},
1587 { 0x0052c508, 2},
1588 { 0x0052c600, 11},
1589 { 0x0052c634, 2},
1590 { 0x0052c644, 11},
1591 { 0x0052c674, 10},
1592 { 0x0052c6a4, 1},
1593 { 0x0052c6ac, 2},
1594 { 0x0052c6e8, 1},
1595 { 0x0052c6f0, 28},
1596 { 0x0052c770, 1},
1597 { 0x0052c778, 2},
1598 { 0x0052c798, 2},
1599 { 0x0052c7dc, 1},
1600 { 0x0052c854, 1},
1601 { 0x0052cab0, 1},
1602 { 0x0052cab8, 3},
1603 { 0x0052cc0c, 1},
1604 { 0x0052cc8c, 2},
1605 { 0x0052cd00, 1},
1606 { 0x0052cd08, 2},
1607 { 0x0052ce00, 11},
1608 { 0x0052ce34, 2},
1609 { 0x0052ce44, 11},
1610 { 0x0052ce74, 10},
1611 { 0x0052cea4, 1},
1612 { 0x0052ceac, 2},
1613 { 0x0052cee8, 1},
1614 { 0x0052cef0, 28},
1615 { 0x0052cf70, 1},
1616 { 0x0052cf78, 2},
1617 { 0x0052cf98, 2},
1618 { 0x0052cfdc, 1},
1619 { 0x0052d054, 1},
1620 { 0x0052d2b0, 1},
1621 { 0x0052d2b8, 3},
1622 { 0x0052d40c, 1},
1623 { 0x0052d48c, 2},
1624 { 0x0052d500, 1},
1625 { 0x0052d508, 2},
1626 { 0x0052d600, 11},
1627 { 0x0052d634, 2},
1628 { 0x0052d644, 11},
1629 { 0x0052d674, 10},
1630 { 0x0052d6a4, 1},
1631 { 0x0052d6ac, 2},
1632 { 0x0052d6e8, 1},
1633 { 0x0052d6f0, 28},
1634 { 0x0052d770, 1},
1635 { 0x0052d778, 2},
1636 { 0x0052d798, 2},
1637 { 0x0052d7dc, 1},
1638 { 0x0052d854, 1},
1639 { 0x0052dab0, 1},
1640 { 0x0052dab8, 3},
1641 { 0x0052dc0c, 1},
1642 { 0x0052dc8c, 2},
1643 { 0x0052dd00, 1},
1644 { 0x0052dd08, 2},
1645 { 0x0052de00, 11},
1646 { 0x0052de34, 2},
1647 { 0x0052de44, 11},
1648 { 0x0052de74, 10},
1649 { 0x0052dea4, 1},
1650 { 0x0052deac, 2},
1651 { 0x0052dee8, 1},
1652 { 0x0052def0, 28},
1653 { 0x0052df70, 1},
1654 { 0x0052df78, 2},
1655 { 0x0052df98, 2},
1656 { 0x0052dfdc, 1},
1657 { 0x0052e054, 1},
1658 { 0x0052e2b0, 1},
1659 { 0x0052e2b8, 3},
1660 { 0x0052e40c, 1},
1661 { 0x0052e48c, 2},
1662 { 0x0052e500, 1},
1663 { 0x0052e508, 2},
1664 { 0x0052e600, 11},
1665 { 0x0052e634, 2},
1666 { 0x0052e644, 11},
1667 { 0x0052e674, 10},
1668 { 0x0052e6a4, 1},
1669 { 0x0052e6ac, 2},
1670 { 0x0052e6e8, 1},
1671 { 0x0052e6f0, 28},
1672 { 0x0052e770, 1},
1673 { 0x0052e778, 2},
1674 { 0x0052e798, 2},
1675 { 0x0052e7dc, 1},
1676 { 0x00900100, 1},
1677 { 0x00904100, 1},
1678 { 0x00908100, 1},
1679 { 0x0090c100, 1},
1680 { 0x00910100, 1},
1681 { 0x00914100, 1},
1682 { 0x009a0100, 1},
1683};
1684
1685
1686static const u32 gp106_global_whitelist_ranges_count =
1687 ARRAY_SIZE(gp106_global_whitelist_ranges);
1688
1689/* context */
1690
1691/* runcontrol */
1692static const u32 gp106_runcontrol_whitelist[] = {
1693};
1694static const u32 gp106_runcontrol_whitelist_count =
1695 ARRAY_SIZE(gp106_runcontrol_whitelist);
1696
1697static const struct regop_offset_range gp106_runcontrol_whitelist_ranges[] = {
1698};
1699static const u32 gp106_runcontrol_whitelist_ranges_count =
1700 ARRAY_SIZE(gp106_runcontrol_whitelist_ranges);
1701
1702
1703/* quad ctl */
1704static const u32 gp106_qctl_whitelist[] = {
1705};
1706static const u32 gp106_qctl_whitelist_count =
1707 ARRAY_SIZE(gp106_qctl_whitelist);
1708
1709static const struct regop_offset_range gp106_qctl_whitelist_ranges[] = {
1710};
1711static const u32 gp106_qctl_whitelist_ranges_count =
1712 ARRAY_SIZE(gp106_qctl_whitelist_ranges);
1713
1714static const struct regop_offset_range *gp106_get_global_whitelist_ranges(void)
1715{
1716 return gp106_global_whitelist_ranges;
1717}
1718
1719static int gp106_get_global_whitelist_ranges_count(void)
1720{
1721 return gp106_global_whitelist_ranges_count;
1722}
1723
1724static const struct regop_offset_range *gp106_get_context_whitelist_ranges(void)
1725{
1726 return gp106_global_whitelist_ranges;
1727}
1728
1729static int gp106_get_context_whitelist_ranges_count(void)
1730{
1731 return gp106_global_whitelist_ranges_count;
1732}
1733
1734static const u32 *gp106_get_runcontrol_whitelist(void)
1735{
1736 return gp106_runcontrol_whitelist;
1737}
1738
1739static int gp106_get_runcontrol_whitelist_count(void)
1740{
1741 return gp106_runcontrol_whitelist_count;
1742}
1743
1744static const
1745struct regop_offset_range *gp106_get_runcontrol_whitelist_ranges(void)
1746{
1747 return gp106_runcontrol_whitelist_ranges;
1748}
1749
1750static int gp106_get_runcontrol_whitelist_ranges_count(void)
1751{
1752 return gp106_runcontrol_whitelist_ranges_count;
1753}
1754
1755static const u32 *gp106_get_qctl_whitelist(void)
1756{
1757 return gp106_qctl_whitelist;
1758}
1759
1760static int gp106_get_qctl_whitelist_count(void)
1761{
1762 return gp106_qctl_whitelist_count;
1763}
1764
1765static const struct regop_offset_range *gp106_get_qctl_whitelist_ranges(void)
1766{
1767 return gp106_qctl_whitelist_ranges;
1768}
1769
1770static int gp106_get_qctl_whitelist_ranges_count(void)
1771{
1772 return gp106_qctl_whitelist_ranges_count;
1773}
1774
1775static int gp106_apply_smpc_war(struct dbg_session_gk20a *dbg_s)
1776{
1777 /* Not needed on gp106 */
1778 return 0;
1779}
1780
1781void gp106_init_regops(struct gpu_ops *gops)
1782{
1783 gops->regops.get_global_whitelist_ranges =
1784 gp106_get_global_whitelist_ranges;
1785 gops->regops.get_global_whitelist_ranges_count =
1786 gp106_get_global_whitelist_ranges_count;
1787
1788 gops->regops.get_context_whitelist_ranges =
1789 gp106_get_context_whitelist_ranges;
1790 gops->regops.get_context_whitelist_ranges_count =
1791 gp106_get_context_whitelist_ranges_count;
1792
1793 gops->regops.get_runcontrol_whitelist =
1794 gp106_get_runcontrol_whitelist;
1795 gops->regops.get_runcontrol_whitelist_count =
1796 gp106_get_runcontrol_whitelist_count;
1797
1798 gops->regops.get_runcontrol_whitelist_ranges =
1799 gp106_get_runcontrol_whitelist_ranges;
1800 gops->regops.get_runcontrol_whitelist_ranges_count =
1801 gp106_get_runcontrol_whitelist_ranges_count;
1802
1803 gops->regops.get_qctl_whitelist =
1804 gp106_get_qctl_whitelist;
1805 gops->regops.get_qctl_whitelist_count =
1806 gp106_get_qctl_whitelist_count;
1807
1808 gops->regops.get_qctl_whitelist_ranges =
1809 gp106_get_qctl_whitelist_ranges;
1810 gops->regops.get_qctl_whitelist_ranges_count =
1811 gp106_get_qctl_whitelist_ranges_count;
1812
1813 gops->regops.apply_smpc_war =
1814 gp106_apply_smpc_war;
1815}
diff --git a/drivers/gpu/nvgpu/gp106/regops_gp106.h b/drivers/gpu/nvgpu/gp106/regops_gp106.h
new file mode 100644
index 00000000..7f6b6861
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/regops_gp106.h
@@ -0,0 +1,24 @@
1/*
2 *
3 * Tegra GP106 GPU Debugger Driver Register Ops
4 *
5 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef __REGOPS_GP106_H_
20#define __REGOPS_GP106_H_
21
22void gp106_init_regops(struct gpu_ops *gops);
23
24#endif /* __REGOPS_GP106_H_ */
diff --git a/drivers/gpu/nvgpu/gp106/sec2_gp106.c b/drivers/gpu/nvgpu/gp106/sec2_gp106.c
new file mode 100644
index 00000000..8f34edd1
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/sec2_gp106.c
@@ -0,0 +1,388 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include <linux/delay.h> /* for udelay */
15#include <linux/clk.h>
16#include "gk20a/gk20a.h"
17#include "gk20a/pmu_gk20a.h"
18
19#include "gm206/pmu_gm206.h"
20#include "gm20b/pmu_gm20b.h"
21#include "gp10b/pmu_gp10b.h"
22#include "gp106/pmu_gp106.h"
23#include "gp106/acr_gp106.h"
24#include "gp106/hw_mc_gp106.h"
25#include "gp106/hw_pwr_gp106.h"
26#include "gp106/hw_psec_gp106.h"
27#include "sec2_gp106.h"
28#include "acr.h"
29
30/*Defines*/
31#define gm20b_dbg_pmu(fmt, arg...) \
32 gk20a_dbg(gpu_dbg_pmu, fmt, ##arg)
33
34int sec2_clear_halt_interrupt_status(struct gk20a *g, unsigned int timeout)
35{
36 u32 data = 0;
37 unsigned long end_jiffies = jiffies + msecs_to_jiffies(timeout);
38
39 while (time_before(jiffies, end_jiffies) ||
40 !tegra_platform_is_silicon()) {
41 gk20a_writel(g, psec_falcon_irqsclr_r(),
42 gk20a_readl(g, psec_falcon_irqsclr_r()) | (0x10));
43 data = gk20a_readl(g, psec_falcon_irqstat_r());
44 if ((data & psec_falcon_irqstat_halt_true_f()) !=
45 psec_falcon_irqstat_halt_true_f())
46 /*halt irq is clear*/
47 break;
48 timeout--;
49 udelay(1);
50 }
51 if (timeout == 0)
52 return -EBUSY;
53 return 0;
54}
55
56int sec2_wait_for_halt(struct gk20a *g, unsigned int timeout)
57{
58 u32 data = 0;
59 int completion = -EBUSY;
60 unsigned long end_jiffies = jiffies + msecs_to_jiffies(timeout);
61
62 while (time_before(jiffies, end_jiffies) ||
63 !tegra_platform_is_silicon()) {
64 data = gk20a_readl(g, psec_falcon_cpuctl_r());
65 if (data & psec_falcon_cpuctl_halt_intr_m()) {
66 /*CPU is halted break*/
67 completion = 0;
68 break;
69 }
70 udelay(1);
71 }
72 if (completion){
73 gk20a_err(dev_from_gk20a(g), "ACR boot timed out");
74 }
75 else {
76
77 g->acr.capabilities = gk20a_readl(g, psec_falcon_mailbox1_r());
78 gm20b_dbg_pmu("ACR capabilities %x\n", g->acr.capabilities);
79 data = gk20a_readl(g, psec_falcon_mailbox0_r());
80 if (data) {
81
82 gk20a_err(dev_from_gk20a(g),
83 "ACR boot failed, err %x", data);
84 completion = -EAGAIN;
85 }
86 }
87
88 init_pmu_setup_hw1(g);
89
90 return completion;
91}
92
93void sec2_copy_to_dmem(struct pmu_gk20a *pmu,
94 u32 dst, u8 *src, u32 size, u8 port)
95{
96 struct gk20a *g = gk20a_from_pmu(pmu);
97 u32 i, words, bytes;
98 u32 data, addr_mask;
99 u32 *src_u32 = (u32*)src;
100
101 if (size == 0) {
102 gk20a_err(dev_from_gk20a(g),
103 "size is zero");
104 return;
105 }
106
107 if (dst & 0x3) {
108 gk20a_err(dev_from_gk20a(g),
109 "dst (0x%08x) not 4-byte aligned", dst);
110 return;
111 }
112
113 mutex_lock(&pmu->pmu_copy_lock);
114
115 words = size >> 2;
116 bytes = size & 0x3;
117
118 addr_mask = psec_falcon_dmemc_offs_m() |
119 psec_falcon_dmemc_blk_m();
120
121 dst &= addr_mask;
122
123 gk20a_writel(g, psec_falcon_dmemc_r(port),
124 dst | psec_falcon_dmemc_aincw_f(1));
125
126 for (i = 0; i < words; i++)
127 gk20a_writel(g, psec_falcon_dmemd_r(port), src_u32[i]);
128
129 if (bytes > 0) {
130 data = 0;
131 for (i = 0; i < bytes; i++)
132 ((u8 *)&data)[i] = src[(words << 2) + i];
133 gk20a_writel(g, psec_falcon_dmemd_r(port), data);
134 }
135
136 data = gk20a_readl(g, psec_falcon_dmemc_r(port)) & addr_mask;
137 size = ALIGN(size, 4);
138 if (data != dst + size) {
139 gk20a_err(dev_from_gk20a(g),
140 "copy failed. bytes written %d, expected %d",
141 data - dst, size);
142 }
143 mutex_unlock(&pmu->pmu_copy_lock);
144 return;
145}
146
147int bl_bootstrap_sec2(struct pmu_gk20a *pmu,
148 void *desc, u32 bl_sz)
149{
150 struct gk20a *g = gk20a_from_pmu(pmu);
151 struct acr_desc *acr = &g->acr;
152 struct mm_gk20a *mm = &g->mm;
153 u32 imem_dst_blk = 0;
154 u32 virt_addr = 0;
155 u32 tag = 0;
156 u32 index = 0;
157 struct hsflcn_bl_desc *pmu_bl_gm10x_desc = g->acr.pmu_hsbl_desc;
158 u32 *bl_ucode;
159 u32 data = 0;
160
161 gk20a_dbg_fn("");
162
163 /* SEC2 Config */
164 gk20a_writel(g, psec_falcon_itfen_r(),
165 gk20a_readl(g, psec_falcon_itfen_r()) |
166 psec_falcon_itfen_ctxen_enable_f());
167
168 gk20a_writel(g, psec_falcon_nxtctx_r(),
169 pwr_pmu_new_instblk_ptr_f(
170 gk20a_mm_inst_block_addr(g, &mm->pmu.inst_block) >> 12) |
171 pwr_pmu_new_instblk_valid_f(1) |
172 gk20a_aperture_mask(g, &mm->pmu.inst_block,
173 pwr_pmu_new_instblk_target_sys_coh_f(),
174 pwr_pmu_new_instblk_target_fb_f()));
175
176 data = gk20a_readl(g, psec_falcon_debug1_r());
177 data |= psec_falcon_debug1_ctxsw_mode_m();
178 gk20a_writel(g, psec_falcon_debug1_r(), data);
179
180 data = gk20a_readl(g, psec_falcon_engctl_r());
181 data |= (1 << 3);
182 gk20a_writel(g, psec_falcon_engctl_r(), data);
183
184 /* TBD: load all other surfaces */
185 /*copy bootloader interface structure to dmem*/
186 gk20a_writel(g, psec_falcon_dmemc_r(0),
187 psec_falcon_dmemc_offs_f(0) |
188 psec_falcon_dmemc_blk_f(0) |
189 psec_falcon_dmemc_aincw_f(1));
190 sec2_copy_to_dmem(pmu, 0, (u8 *)desc,
191 sizeof(struct flcn_bl_dmem_desc), 0);
192 /*TODO This had to be copied to bl_desc_dmem_load_off, but since
193 * this is 0, so ok for now*/
194
195 /* Now copy bootloader to TOP of IMEM */
196 imem_dst_blk = (psec_falcon_hwcfg_imem_size_v(
197 gk20a_readl(g, psec_falcon_hwcfg_r()))) - bl_sz/256;
198
199 /* Set Auto-Increment on write */
200 gk20a_writel(g, psec_falcon_imemc_r(0),
201 psec_falcon_imemc_offs_f(0) |
202 psec_falcon_imemc_blk_f(imem_dst_blk) |
203 psec_falcon_imemc_aincw_f(1));
204 virt_addr = pmu_bl_gm10x_desc->bl_start_tag << 8;
205 tag = virt_addr >> 8; /* tag is always 256B aligned */
206 bl_ucode = (u32 *)(acr->hsbl_ucode.cpu_va);
207 for (index = 0; index < bl_sz/4; index++) {
208 if ((index % 64) == 0) {
209 gk20a_writel(g, psec_falcon_imemt_r(0),
210 (tag & 0xffff) << 0);
211 tag++;
212 }
213 gk20a_writel(g, psec_falcon_imemd_r(0),
214 bl_ucode[index] & 0xffffffff);
215 }
216 gk20a_writel(g, psec_falcon_imemt_r(0), (0 & 0xffff) << 0);
217
218 gm20b_dbg_pmu("Before starting falcon with BL\n");
219
220 gk20a_writel(g, psec_falcon_mailbox0_r(), 0xDEADA5A5);
221
222 gk20a_writel(g, psec_falcon_bootvec_r(),
223 psec_falcon_bootvec_vec_f(virt_addr));
224
225 gk20a_writel(g, psec_falcon_cpuctl_r(),
226 psec_falcon_cpuctl_startcpu_f(1));
227
228 return 0;
229}
230
231void sec_enable_irq(struct pmu_gk20a *pmu, bool enable)
232{
233 struct gk20a *g = gk20a_from_pmu(pmu);
234
235 gk20a_dbg_fn("");
236
237 gk20a_writel(g, psec_falcon_irqmclr_r(),
238 psec_falcon_irqmclr_gptmr_f(1) |
239 psec_falcon_irqmclr_wdtmr_f(1) |
240 psec_falcon_irqmclr_mthd_f(1) |
241 psec_falcon_irqmclr_ctxsw_f(1) |
242 psec_falcon_irqmclr_halt_f(1) |
243 psec_falcon_irqmclr_exterr_f(1) |
244 psec_falcon_irqmclr_swgen0_f(1) |
245 psec_falcon_irqmclr_swgen1_f(1) |
246 psec_falcon_irqmclr_ext_f(0xff));
247
248 if (enable) {
249 /* dest 0=falcon, 1=host; level 0=irq0, 1=irq1 */
250 gk20a_writel(g, psec_falcon_irqdest_r(),
251 psec_falcon_irqdest_host_gptmr_f(0) |
252 psec_falcon_irqdest_host_wdtmr_f(1) |
253 psec_falcon_irqdest_host_mthd_f(0) |
254 psec_falcon_irqdest_host_ctxsw_f(0) |
255 psec_falcon_irqdest_host_halt_f(1) |
256 psec_falcon_irqdest_host_exterr_f(0) |
257 psec_falcon_irqdest_host_swgen0_f(1) |
258 psec_falcon_irqdest_host_swgen1_f(0) |
259 psec_falcon_irqdest_host_ext_f(0xff) |
260 psec_falcon_irqdest_target_gptmr_f(1) |
261 psec_falcon_irqdest_target_wdtmr_f(0) |
262 psec_falcon_irqdest_target_mthd_f(0) |
263 psec_falcon_irqdest_target_ctxsw_f(0) |
264 psec_falcon_irqdest_target_halt_f(0) |
265 psec_falcon_irqdest_target_exterr_f(0) |
266 psec_falcon_irqdest_target_swgen0_f(0) |
267 psec_falcon_irqdest_target_swgen1_f(1) |
268 psec_falcon_irqdest_target_ext_f(0xff));
269
270 /* 0=disable, 1=enable */
271 gk20a_writel(g, psec_falcon_irqmset_r(),
272 psec_falcon_irqmset_gptmr_f(1) |
273 psec_falcon_irqmset_wdtmr_f(1) |
274 psec_falcon_irqmset_mthd_f(0) |
275 psec_falcon_irqmset_ctxsw_f(0) |
276 psec_falcon_irqmset_halt_f(1) |
277 psec_falcon_irqmset_exterr_f(1) |
278 psec_falcon_irqmset_swgen0_f(1) |
279 psec_falcon_irqmset_swgen1_f(1));
280
281 }
282
283 gk20a_dbg_fn("done");
284}
285
286void init_pmu_setup_hw1(struct gk20a *g)
287{
288 struct mm_gk20a *mm = &g->mm;
289 struct pmu_gk20a *pmu = &g->pmu;
290 struct gk20a_platform *platform = dev_get_drvdata(g->dev);
291
292 /* PMU TRANSCFG */
293 /* setup apertures - virtual */
294 gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_UCODE),
295 pwr_fbif_transcfg_mem_type_physical_f() |
296 pwr_fbif_transcfg_target_local_fb_f());
297 gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_VIRT),
298 pwr_fbif_transcfg_mem_type_virtual_f());
299 /* setup apertures - physical */
300 gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_VID),
301 pwr_fbif_transcfg_mem_type_physical_f() |
302 pwr_fbif_transcfg_target_local_fb_f());
303 gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_COH),
304 pwr_fbif_transcfg_mem_type_physical_f() |
305 pwr_fbif_transcfg_target_coherent_sysmem_f());
306 gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_NCOH),
307 pwr_fbif_transcfg_mem_type_physical_f() |
308 pwr_fbif_transcfg_target_noncoherent_sysmem_f());
309
310 /* PMU Config */
311 gk20a_writel(g, pwr_falcon_itfen_r(),
312 gk20a_readl(g, pwr_falcon_itfen_r()) |
313 pwr_falcon_itfen_ctxen_enable_f());
314 gk20a_writel(g, pwr_pmu_new_instblk_r(),
315 pwr_pmu_new_instblk_ptr_f(
316 gk20a_mm_inst_block_addr(g, &mm->pmu.inst_block) >> 12) |
317 pwr_pmu_new_instblk_valid_f(1) |
318 gk20a_aperture_mask(g, &mm->pmu.inst_block,
319 pwr_pmu_new_instblk_target_sys_coh_f(),
320 pwr_pmu_new_instblk_target_fb_f()));
321
322 /*Copying pmu cmdline args*/
323 g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq(pmu,
324 clk_get_rate(platform->clk[1]));
325 g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode(pmu, 1);
326 g->ops.pmu_ver.set_pmu_cmdline_args_trace_size(
327 pmu, GK20A_PMU_TRACE_BUFSIZE);
328 g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base(pmu);
329 g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx(
330 pmu, GK20A_PMU_DMAIDX_VIRT);
331
332 pmu_copy_to_dmem(pmu, g->acr.pmu_args,
333 (u8 *)(g->ops.pmu_ver.get_pmu_cmdline_args_ptr(pmu)),
334 g->ops.pmu_ver.get_pmu_cmdline_args_size(pmu), 0);
335
336}
337
338int init_sec2_setup_hw1(struct gk20a *g,
339 void *desc, u32 bl_sz)
340{
341 struct pmu_gk20a *pmu = &g->pmu;
342 int err;
343 u32 data = 0;
344
345 gk20a_dbg_fn("");
346
347 mutex_lock(&pmu->isr_mutex);
348 g->ops.pmu.reset(g);
349 pmu->isr_enabled = true;
350 mutex_unlock(&pmu->isr_mutex);
351
352 data = gk20a_readl(g, psec_fbif_ctl_r());
353 data |= psec_fbif_ctl_allow_phys_no_ctx_allow_f();
354 gk20a_writel(g, psec_fbif_ctl_r(), data);
355
356 data = gk20a_readl(g, psec_falcon_dmactl_r());
357 data &= ~(psec_falcon_dmactl_require_ctx_f(1));
358 gk20a_writel(g, psec_falcon_dmactl_r(), data);
359
360 /* setup apertures - virtual */
361 gk20a_writel(g, psec_fbif_transcfg_r(GK20A_PMU_DMAIDX_UCODE),
362 psec_fbif_transcfg_mem_type_physical_f() |
363 psec_fbif_transcfg_target_local_fb_f());
364 gk20a_writel(g, psec_fbif_transcfg_r(GK20A_PMU_DMAIDX_VIRT),
365 psec_fbif_transcfg_mem_type_virtual_f());
366 /* setup apertures - physical */
367 gk20a_writel(g, psec_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_VID),
368 psec_fbif_transcfg_mem_type_physical_f() |
369 psec_fbif_transcfg_target_local_fb_f());
370 gk20a_writel(g, psec_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_COH),
371 psec_fbif_transcfg_mem_type_physical_f() |
372 psec_fbif_transcfg_target_coherent_sysmem_f());
373 gk20a_writel(g, psec_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_NCOH),
374 psec_fbif_transcfg_mem_type_physical_f() |
375 psec_fbif_transcfg_target_noncoherent_sysmem_f());
376
377 /*disable irqs for hs falcon booting as we will poll for halt*/
378 mutex_lock(&pmu->isr_mutex);
379 pmu_enable_irq(pmu, false);
380 sec_enable_irq(pmu, false);
381 pmu->isr_enabled = false;
382 mutex_unlock(&pmu->isr_mutex);
383 err = bl_bootstrap_sec2(pmu, desc, bl_sz);
384 if (err)
385 return err;
386
387 return 0;
388}
diff --git a/drivers/gpu/nvgpu/gp106/sec2_gp106.h b/drivers/gpu/nvgpu/gp106/sec2_gp106.h
new file mode 100644
index 00000000..336bb0f0
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/sec2_gp106.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#ifndef __SEC2_H_
15#define __SEC2_H_
16
17int sec2_clear_halt_interrupt_status(struct gk20a *g, unsigned int timeout);
18int sec2_wait_for_halt(struct gk20a *g, unsigned int timeout);
19void sec2_copy_to_dmem(struct pmu_gk20a *pmu,
20 u32 dst, u8 *src, u32 size, u8 port);
21void sec2_dump_falcon_stats(struct pmu_gk20a *pmu);
22int bl_bootstrap_sec2(struct pmu_gk20a *pmu,
23 void *desc, u32 bl_sz);
24void sec_enable_irq(struct pmu_gk20a *pmu, bool enable);
25void init_pmu_setup_hw1(struct gk20a *g);
26int init_sec2_setup_hw1(struct gk20a *g,
27 void *desc, u32 bl_sz);
28
29#endif /*__SEC2_H_*/
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.c b/drivers/gpu/nvgpu/gp106/therm_gp106.c
new file mode 100644
index 00000000..7bdf0b9e
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/therm_gp106.c
@@ -0,0 +1,128 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 */
13
14#include "therm_gp106.h"
15#include <linux/debugfs.h>
16#include "hw_therm_gp106.h"
17
18static void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8)
19{
20 *max_24_8 = (0x87 << 8);
21 *min_24_8 = ((-216) << 8);
22}
23
24static int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8)
25{
26 int err = 0;
27 u32 readval;
28
29 readval = gk20a_readl(g, therm_temp_sensor_tsense_r());
30
31 if (!(therm_temp_sensor_tsense_state_v(readval) &
32 therm_temp_sensor_tsense_state_valid_v())) {
33 gk20a_err(dev_from_gk20a(g),
34 "Attempt to read temperature while sensor is OFF!\n");
35 err = -EINVAL;
36 } else if (therm_temp_sensor_tsense_state_v(readval) &
37 therm_temp_sensor_tsense_state_shadow_v()) {
38 gk20a_err(dev_from_gk20a(g),
39 "Reading temperature from SHADOWed sensor!\n");
40 }
41
42 // Convert from F9.5 -> F27.5 -> F24.8.
43 readval &= therm_temp_sensor_tsense_fixed_point_m();
44
45 *temp_f24_8 = readval;
46
47 return err;
48}
49
50#ifdef CONFIG_DEBUG_FS
51static int therm_get_internal_sensor_curr_temp(void *data, u64 *val)
52{
53 struct gk20a *g = (struct gk20a *)data;
54 u32 readval;
55 int err;
56
57 err = gp106_get_internal_sensor_curr_temp(g, &readval);
58 if (!err)
59 *val = readval;
60
61 return err;
62}
63DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n");
64
65static void gp106_therm_debugfs_init(struct gk20a *g) {
66 struct gk20a_platform *platform = dev_get_drvdata(g->dev);
67 struct dentry *dbgentry;
68
69 dbgentry = debugfs_create_file(
70 "temp", S_IRUGO, platform->debugfs, g, &therm_ctrl_fops);
71 if (!dbgentry)
72 gk20a_err(dev_from_gk20a(g), "debugfs entry create failed for therm_curr_temp");
73}
74#endif
75
76static int gp106_elcg_init_idle_filters(struct gk20a *g)
77{
78 u32 gate_ctrl, idle_filter;
79 u32 engine_id;
80 u32 active_engine_id = 0;
81 struct fifo_gk20a *f = &g->fifo;
82
83 gk20a_dbg_fn("");
84
85 for (engine_id = 0; engine_id < f->num_engines; engine_id++) {
86 active_engine_id = f->active_engines_list[engine_id];
87 gate_ctrl = gk20a_readl(g, therm_gate_ctrl_r(active_engine_id));
88
89 if (tegra_platform_is_linsim()) {
90 gate_ctrl = set_field(gate_ctrl,
91 therm_gate_ctrl_eng_delay_after_m(),
92 therm_gate_ctrl_eng_delay_after_f(4));
93 }
94
95 gate_ctrl = set_field(gate_ctrl,
96 therm_gate_ctrl_eng_idle_filt_exp_m(),
97 therm_gate_ctrl_eng_idle_filt_exp_f(2));
98 gate_ctrl = set_field(gate_ctrl,
99 therm_gate_ctrl_eng_idle_filt_mant_m(),
100 therm_gate_ctrl_eng_idle_filt_mant_f(1));
101 gate_ctrl = set_field(gate_ctrl,
102 therm_gate_ctrl_eng_delay_before_m(),
103 therm_gate_ctrl_eng_delay_before_f(0));
104 gk20a_writel(g, therm_gate_ctrl_r(active_engine_id), gate_ctrl);
105 }
106
107 /* default fecs_idle_filter to 0 */
108 idle_filter = gk20a_readl(g, therm_fecs_idle_filter_r());
109 idle_filter &= ~therm_fecs_idle_filter_value_m();
110 gk20a_writel(g, therm_fecs_idle_filter_r(), idle_filter);
111 /* default hubmmu_idle_filter to 0 */
112 idle_filter = gk20a_readl(g, therm_hubmmu_idle_filter_r());
113 idle_filter &= ~therm_hubmmu_idle_filter_value_m();
114 gk20a_writel(g, therm_hubmmu_idle_filter_r(), idle_filter);
115
116 gk20a_dbg_fn("done");
117 return 0;
118}
119
120void gp106_init_therm_ops(struct gpu_ops *gops) {
121#ifdef CONFIG_DEBUG_FS
122 gops->therm.therm_debugfs_init = gp106_therm_debugfs_init;
123#endif
124 gops->therm.elcg_init_idle_filters = gp106_elcg_init_idle_filters;
125 gops->therm.get_internal_sensor_curr_temp = gp106_get_internal_sensor_curr_temp;
126 gops->therm.get_internal_sensor_limits =
127 gp106_get_internal_sensor_limits;
128}
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.h b/drivers/gpu/nvgpu/gp106/therm_gp106.h
new file mode 100644
index 00000000..6db17c47
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/therm_gp106.h
@@ -0,0 +1,22 @@
1/*
2 * general thermal control structures & definitions
3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef NVGPU_THERM_GP106_H
17#define NVGPU_THERM_GP106_H
18
19#include "gk20a/gk20a.h"
20
21void gp106_init_therm_ops(struct gpu_ops *gops);
22#endif
diff --git a/drivers/gpu/nvgpu/gp106/xve_gp106.c b/drivers/gpu/nvgpu/gp106/xve_gp106.c
new file mode 100644
index 00000000..23a02fbd
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/xve_gp106.c
@@ -0,0 +1,623 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16
17#include <linux/delay.h>
18#include <linux/kernel.h>
19#include <linux/debugfs.h>
20
21#include "gk20a/gk20a.h"
22#include "gm206/bios_gm206.h"
23#include "gp106/xve_gp106.h"
24
25#include "gp106/hw_xp_gp106.h"
26#include "gp106/hw_xve_gp106.h"
27
28/**
29 * Init a timer and place the timeout data in @timeout.
30 */
31static void init_timeout(u32 timeout_ms, u32 *timeout)
32{
33 *timeout = jiffies + msecs_to_jiffies(timeout_ms);
34}
35
36/**
37 * Returns 1 if the current time is after @timeout i.e: the timer timed
38 * out. Returns 0 if the timer still has time left.
39 */
40static int check_timeout(u32 *timeout)
41{
42 unsigned long now = jiffies;
43 unsigned long timeout_l = (unsigned long)*timeout;
44
45 if (time_after(now, timeout_l))
46 return 1;
47
48 return 0;
49}
50
51static void xve_xve_writel_gp106(struct gk20a *g, u32 reg, u32 val)
52{
53 gk20a_writel(g, NV_PCFG + reg, val);
54}
55
56static u32 xve_xve_readl_gp106(struct gk20a *g, u32 reg)
57{
58 return gk20a_readl(g, NV_PCFG + reg);
59}
60
61/**
62 * Places one of:
63 *
64 * %GPU_XVE_SPEED_2P5
65 * %GPU_XVE_SPEED_5P0
66 * %GPU_XVE_SPEED_8P0
67 *
68 * in the u32 pointed to by @xve_link_speed. If for some reason an unknown PCIe
69 * bus speed is detected then *@xve_link_speed is not touched and -ENODEV is
70 * returned.
71 */
72static int xve_get_speed_gp106(struct gk20a *g, u32 *xve_link_speed)
73{
74 u32 status;
75 u32 link_speed, real_link_speed = 0;
76
77 status = g->ops.xve.xve_readl(g, xve_link_control_status_r());
78
79 link_speed = xve_link_control_status_link_speed_v(status);
80
81 /*
82 * Can't use a switch statement becuase switch statements dont work with
83 * function calls.
84 */
85 if (link_speed == xve_link_control_status_link_speed_link_speed_2p5_v())
86 real_link_speed = GPU_XVE_SPEED_2P5;
87 if (link_speed == xve_link_control_status_link_speed_link_speed_5p0_v())
88 real_link_speed = GPU_XVE_SPEED_5P0;
89 if (link_speed == xve_link_control_status_link_speed_link_speed_8p0_v())
90 real_link_speed = GPU_XVE_SPEED_8P0;
91
92 if (!real_link_speed) {
93 pr_warn("%s: Unknown PCIe bus speed!\n", __func__);
94 return -ENODEV;
95 }
96
97 *xve_link_speed = real_link_speed;
98 return 0;
99}
100
101/**
102 * Set the mask for L0s in the XVE.
103 *
104 * When @status is non-zero the mask for L0s is set which _disables_ L0s. When
105 * @status is zero L0s is no longer masked and may be enabled.
106 */
107static void set_xve_l0s_mask(struct gk20a *g, bool status)
108{
109 u32 xve_priv;
110 u32 status_bit = status ? 1 : 0;
111
112 xve_priv = g->ops.xve.xve_readl(g, xve_priv_xv_r());
113
114 xve_priv = set_field(xve_priv,
115 xve_priv_xv_cya_l0s_enable_m(),
116 xve_priv_xv_cya_l0s_enable_f(status_bit));
117
118 g->ops.xve.xve_writel(g, xve_priv_xv_r(), xve_priv);
119}
120
121/**
122 * Set the mask for L1 in the XVE.
123 *
124 * When @status is non-zero the mask for L1 is set which _disables_ L0s. When
125 * @status is zero L1 is no longer masked and may be enabled.
126 */
127static void set_xve_l1_mask(struct gk20a *g, int status)
128{
129 u32 xve_priv;
130 u32 status_bit = status ? 1 : 0;
131
132 xve_priv = g->ops.xve.xve_readl(g, xve_priv_xv_r());
133
134 xve_priv = set_field(xve_priv,
135 xve_priv_xv_cya_l1_enable_m(),
136 xve_priv_xv_cya_l1_enable_f(status_bit));
137
138 g->ops.xve.xve_writel(g, xve_priv_xv_r(), xve_priv);
139}
140
141/**
142 * When doing the speed change disable power saving features.
143 */
144static void disable_aspm_gp106(struct gk20a *g)
145{
146 u32 xve_priv;
147
148 xve_priv = g->ops.xve.xve_readl(g, xve_priv_xv_r());
149
150 /*
151 * Store prior ASPM state so we can restore it later on.
152 */
153 g->xve_l0s = xve_priv_xv_cya_l0s_enable_v(xve_priv);
154 g->xve_l1 = xve_priv_xv_cya_l1_enable_v(xve_priv);
155
156 set_xve_l0s_mask(g, true);
157 set_xve_l1_mask(g, true);
158}
159
160/**
161 * Restore the state saved by disable_aspm_gp106().
162 */
163static void enable_aspm_gp106(struct gk20a *g)
164{
165 set_xve_l0s_mask(g, g->xve_l0s);
166 set_xve_l1_mask(g, g->xve_l1);
167}
168
169/*
170 * Error checking is done in xve_set_speed_gp106.
171 */
172static int __do_xve_set_speed_gp106(struct gk20a *g, u32 next_link_speed)
173{
174 u32 current_link_speed, new_link_speed;
175 u32 dl_mgr, saved_dl_mgr;
176 u32 pl_link_config;
177 u32 link_control_status, link_speed_setting, link_width;
178 u32 timeout;
179 int attempts = 10, err_status = 0;
180
181 g->ops.xve.get_speed(g, &current_link_speed);
182 xv_sc_dbg(PRE_CHANGE, "Executing PCIe link change.");
183 xv_sc_dbg(PRE_CHANGE, " Current speed: %s",
184 xve_speed_to_str(current_link_speed));
185 xv_sc_dbg(PRE_CHANGE, " Next speed: %s",
186 xve_speed_to_str(next_link_speed));
187 xv_sc_dbg(PRE_CHANGE, " PL_LINK_CONFIG: 0x%08x",
188 gk20a_readl(g, xp_pl_link_config_r(0)));
189
190 xv_sc_dbg(DISABLE_ASPM, "Disabling ASPM...");
191 disable_aspm_gp106(g);
192 xv_sc_dbg(DISABLE_ASPM, " Done!");
193
194 xv_sc_dbg(DL_SAFE_MODE, "Putting DL in safe mode...");
195 saved_dl_mgr = gk20a_readl(g, xp_dl_mgr_r(0));
196
197 /*
198 * Put the DL in safe mode.
199 */
200 dl_mgr = saved_dl_mgr;
201 dl_mgr |= xp_dl_mgr_safe_timing_f(1);
202 gk20a_writel(g, xp_dl_mgr_r(0), dl_mgr);
203 xv_sc_dbg(DL_SAFE_MODE, " Done!");
204
205 init_timeout(GPU_XVE_TIMEOUT_MS, &timeout);
206
207 xv_sc_dbg(CHECK_LINK, "Checking for link idle...");
208 while (1) {
209 pl_link_config = gk20a_readl(g, xp_pl_link_config_r(0));
210 if ((xp_pl_link_config_ltssm_status_f(pl_link_config) ==
211 xp_pl_link_config_ltssm_status_idle_v()) &&
212 (xp_pl_link_config_ltssm_directive_f(pl_link_config) ==
213 xp_pl_link_config_ltssm_directive_normal_operations_v()))
214 break;
215
216 if (check_timeout(&timeout)) {
217 err_status = -ETIMEDOUT;
218 break;
219 }
220 }
221
222 if (err_status == -ETIMEDOUT)
223 /* TODO: debug message. */
224 goto done;
225
226 xv_sc_dbg(CHECK_LINK, " Done");
227
228 xv_sc_dbg(LINK_SETTINGS, "Preparing next link settings");
229 pl_link_config &= ~xp_pl_link_config_max_link_rate_m();
230 switch (next_link_speed) {
231 case GPU_XVE_SPEED_2P5:
232 link_speed_setting =
233 xve_link_control_status_link_speed_link_speed_2p5_v();
234 pl_link_config |= xp_pl_link_config_max_link_rate_f(
235 xp_pl_link_config_max_link_rate_2500_mtps_v());
236 break;
237 case GPU_XVE_SPEED_5P0:
238 link_speed_setting =
239 xve_link_control_status_link_speed_link_speed_5p0_v();
240 pl_link_config |= xp_pl_link_config_max_link_rate_f(
241 xp_pl_link_config_max_link_rate_5000_mtps_v());
242 break;
243 case GPU_XVE_SPEED_8P0:
244 link_speed_setting =
245 xve_link_control_status_link_speed_link_speed_8p0_v();
246 pl_link_config |= xp_pl_link_config_max_link_rate_f(
247 xp_pl_link_config_max_link_rate_8000_mtps_v());
248 break;
249 default:
250 BUG(); /* Should never be hit. */
251 }
252
253 link_control_status =
254 g->ops.xve.xve_readl(g, xve_link_control_status_r());
255 link_width = xve_link_control_status_link_width_v(link_control_status);
256
257 pl_link_config &= ~xp_pl_link_config_target_tx_width_m();
258
259 /* Can't use a switch due to oddities in register definitions. */
260 if (link_width == xve_link_control_status_link_width_x1_v())
261 pl_link_config |= xp_pl_link_config_target_tx_width_f(
262 xp_pl_link_config_target_tx_width_x1_v());
263 else if (link_width == xve_link_control_status_link_width_x2_v())
264 pl_link_config |= xp_pl_link_config_target_tx_width_f(
265 xp_pl_link_config_target_tx_width_x2_v());
266 else if (link_width == xve_link_control_status_link_width_x4_v())
267 pl_link_config |= xp_pl_link_config_target_tx_width_f(
268 xp_pl_link_config_target_tx_width_x4_v());
269 else if (link_width == xve_link_control_status_link_width_x8_v())
270 pl_link_config |= xp_pl_link_config_target_tx_width_f(
271 xp_pl_link_config_target_tx_width_x8_v());
272 else if (link_width == xve_link_control_status_link_width_x16_v())
273 pl_link_config |= xp_pl_link_config_target_tx_width_f(
274 xp_pl_link_config_target_tx_width_x16_v());
275 else
276 BUG();
277
278 xv_sc_dbg(LINK_SETTINGS, " pl_link_config = 0x%08x", pl_link_config);
279 xv_sc_dbg(LINK_SETTINGS, " Done");
280
281 xv_sc_dbg(EXEC_CHANGE, "Running link speed change...");
282
283 init_timeout(GPU_XVE_TIMEOUT_MS, &timeout);
284 while (1) {
285 gk20a_writel(g, xp_pl_link_config_r(0), pl_link_config);
286 if (pl_link_config ==
287 gk20a_readl(g, xp_pl_link_config_r(0)))
288 break;
289
290 if (check_timeout(&timeout)) {
291 err_status = -ETIMEDOUT;
292 break;
293 }
294 }
295
296 if (err_status == -ETIMEDOUT)
297 goto done;
298
299 xv_sc_dbg(EXEC_CHANGE, " Wrote PL_LINK_CONFIG.");
300
301 pl_link_config = gk20a_readl(g, xp_pl_link_config_r(0));
302
303 do {
304 pl_link_config = set_field(pl_link_config,
305 xp_pl_link_config_ltssm_directive_m(),
306 xp_pl_link_config_ltssm_directive_f(
307 xp_pl_link_config_ltssm_directive_change_speed_v()));
308
309 xv_sc_dbg(EXEC_CHANGE, " Executing change (0x%08x)!",
310 pl_link_config);
311 gk20a_writel(g, xp_pl_link_config_r(0), pl_link_config);
312
313 /*
314 * Read NV_XP_PL_LINK_CONFIG until the link has swapped to
315 * the target speed.
316 */
317 init_timeout(GPU_XVE_TIMEOUT_MS, &timeout);
318 while (1) {
319 pl_link_config = gk20a_readl(g, xp_pl_link_config_r(0));
320 if (pl_link_config != 0xfffffff &&
321 (xp_pl_link_config_ltssm_status_f(pl_link_config) ==
322 xp_pl_link_config_ltssm_status_idle_v()) &&
323 (xp_pl_link_config_ltssm_directive_f(pl_link_config) ==
324 xp_pl_link_config_ltssm_directive_normal_operations_v()))
325 break;
326
327 if (check_timeout(&timeout)) {
328 err_status = -ETIMEDOUT;
329 xv_sc_dbg(EXEC_CHANGE, " timeout; pl_link_config = 0x%x",
330 pl_link_config);
331 break;
332 }
333 }
334
335 xv_sc_dbg(EXEC_CHANGE, " Change done... Checking status");
336
337 if (pl_link_config == 0xffffffff) {
338 WARN(1, "GPU fell of PCI bus!?");
339
340 /*
341 * The rest of the driver is probably about to
342 * explode...
343 */
344 BUG();
345 }
346
347 link_control_status =
348 g->ops.xve.xve_readl(g, xve_link_control_status_r());
349 xv_sc_dbg(EXEC_CHANGE, " target %d vs current %d",
350 link_speed_setting,
351 xve_link_control_status_link_speed_v(link_control_status));
352
353 if (err_status == -ETIMEDOUT)
354 xv_sc_dbg(EXEC_CHANGE, " Oops timed out?");
355 } while (attempts-- > 0 &&
356 link_speed_setting !=
357 xve_link_control_status_link_speed_v(link_control_status));
358
359 xv_sc_dbg(EXEC_VERIF, "Verifying speed change...");
360
361 /*
362 * Check that the new link speed is actually active. If we failed to
363 * change to the new link speed then return to the link speed setting
364 * pre-speed change.
365 */
366 new_link_speed = xve_link_control_status_link_speed_v(
367 link_control_status);
368 if (link_speed_setting != new_link_speed) {
369 u32 link_config = gk20a_readl(g, xp_pl_link_config_r(0));
370
371 xv_sc_dbg(EXEC_VERIF, " Current and target speeds mismatch!");
372 xv_sc_dbg(EXEC_VERIF, " LINK_CONTROL_STATUS: 0x%08x",
373 g->ops.xve.xve_readl(g, xve_link_control_status_r()));
374 xv_sc_dbg(EXEC_VERIF, " Link speed is %s - should be %s",
375 xve_speed_to_str(new_link_speed),
376 xve_speed_to_str(link_speed_setting));
377
378 link_config &= ~xp_pl_link_config_max_link_rate_m();
379 if (new_link_speed ==
380 xve_link_control_status_link_speed_link_speed_2p5_v())
381 link_config |= xp_pl_link_config_max_link_rate_f(
382 xp_pl_link_config_max_link_rate_2500_mtps_v());
383 else if (new_link_speed ==
384 xve_link_control_status_link_speed_link_speed_5p0_v())
385 link_config |= xp_pl_link_config_max_link_rate_f(
386 xp_pl_link_config_max_link_rate_5000_mtps_v());
387 else if (new_link_speed ==
388 xve_link_control_status_link_speed_link_speed_8p0_v())
389 link_config |= xp_pl_link_config_max_link_rate_f(
390 xp_pl_link_config_max_link_rate_8000_mtps_v());
391 else
392 link_config |= xp_pl_link_config_max_link_rate_f(
393 xp_pl_link_config_max_link_rate_2500_mtps_v());
394
395 gk20a_writel(g, xp_pl_link_config_r(0), link_config);
396 err_status = -ENODEV;
397 } else {
398 xv_sc_dbg(EXEC_VERIF, " Current and target speeds match!");
399 err_status = 0;
400 }
401
402done:
403 /* Restore safe timings. */
404 xv_sc_dbg(CLEANUP, "Restoring saved DL settings...");
405 gk20a_writel(g, xp_dl_mgr_r(0), saved_dl_mgr);
406 xv_sc_dbg(CLEANUP, " Done");
407
408 xv_sc_dbg(CLEANUP, "Re-enabling ASPM settings...");
409 enable_aspm_gp106(g);
410 xv_sc_dbg(CLEANUP, " Done");
411
412 return err_status;
413}
414
415/**
416 * Sets the PCIe link speed to @xve_link_speed which must be one of:
417 *
418 * %GPU_XVE_SPEED_2P5
419 * %GPU_XVE_SPEED_5P0
420 * %GPU_XVE_SPEED_8P0
421 *
422 * If an error is encountered an appropriate error will be returned.
423 */
424static int xve_set_speed_gp106(struct gk20a *g, u32 next_link_speed)
425{
426 u32 current_link_speed;
427 int err;
428
429 if ((next_link_speed & GPU_XVE_SPEED_MASK) == 0)
430 return -EINVAL;
431
432 err = g->ops.xve.get_speed(g, &current_link_speed);
433 if (err)
434 return err;
435
436 /* No-op. */
437 if (current_link_speed == next_link_speed)
438 return 0;
439
440 return __do_xve_set_speed_gp106(g, next_link_speed);
441}
442
443/**
444 * Places a bitmask of available speeds for gp106 in @speed_mask.
445 */
446static void xve_available_speeds_gp106(struct gk20a *g, u32 *speed_mask)
447{
448 *speed_mask = GPU_XVE_SPEED_2P5 | GPU_XVE_SPEED_5P0;
449}
450
451static ssize_t xve_link_speed_write(struct file *filp,
452 const char __user *buff,
453 size_t len, loff_t *off)
454{
455 struct gk20a *g = ((struct seq_file *)filp->private_data)->private;
456 char kbuff[16];
457 u32 buff_size, check_len;
458 u32 link_speed = 0;
459 int ret;
460
461 buff_size = min_t(size_t, 16, len);
462
463 memset(kbuff, 0, 16);
464 if (copy_from_user(kbuff, buff, buff_size))
465 return -EFAULT;
466
467 check_len = strlen("Gen1");
468 if (strncmp(kbuff, "Gen1", check_len) == 0)
469 link_speed = GPU_XVE_SPEED_2P5;
470 else if (strncmp(kbuff, "Gen2", check_len) == 0)
471 link_speed = GPU_XVE_SPEED_5P0;
472 else if (strncmp(kbuff, "Gen3", check_len) == 0)
473 link_speed = GPU_XVE_SPEED_8P0;
474 else
475 gk20a_err(g->dev, "%s: Unknown PCIe speed: %s\n",
476 __func__, kbuff);
477
478 if (!link_speed)
479 return -EINVAL;
480
481 /* Brief pause... To help rate limit this. */
482 msleep(250);
483
484 /*
485 * And actually set the speed. Yay.
486 */
487 ret = g->ops.xve.set_speed(g, link_speed);
488 if (ret)
489 return ret;
490
491 return len;
492}
493
494static int xve_link_speed_show(struct seq_file *s, void *unused)
495{
496 struct gk20a *g = s->private;
497 u32 speed;
498 int err;
499
500 err = g->ops.xve.get_speed(g, &speed);
501 if (err)
502 return err;
503
504 seq_printf(s, "Current PCIe speed:\n %s\n", xve_speed_to_str(speed));
505
506 return 0;
507}
508
509static int xve_link_speed_open(struct inode *inode, struct file *file)
510{
511 return single_open(file, xve_link_speed_show, inode->i_private);
512}
513
514static const struct file_operations xve_link_speed_fops = {
515 .open = xve_link_speed_open,
516 .read = seq_read,
517 .write = xve_link_speed_write,
518 .llseek = seq_lseek,
519 .release = single_release,
520};
521
522static int xve_available_speeds_show(struct seq_file *s, void *unused)
523{
524 struct gk20a *g = s->private;
525 u32 available_speeds;
526
527 g->ops.xve.available_speeds(g, &available_speeds);
528
529 seq_puts(s, "Available PCIe bus speeds:\n");
530 if (available_speeds & GPU_XVE_SPEED_2P5)
531 seq_puts(s, " Gen1\n");
532 if (available_speeds & GPU_XVE_SPEED_5P0)
533 seq_puts(s, " Gen2\n");
534 if (available_speeds & GPU_XVE_SPEED_8P0)
535 seq_puts(s, " Gen3\n");
536
537 return 0;
538}
539
540static int xve_available_speeds_open(struct inode *inode, struct file *file)
541{
542 return single_open(file, xve_available_speeds_show, inode->i_private);
543}
544
545static const struct file_operations xve_available_speeds_fops = {
546 .open = xve_available_speeds_open,
547 .read = seq_read,
548 .llseek = seq_lseek,
549 .release = single_release,
550};
551
552static int xve_link_control_status_show(struct seq_file *s, void *unused)
553{
554 struct gk20a *g = s->private;
555 u32 link_status;
556
557 link_status = g->ops.xve.xve_readl(g, xve_link_control_status_r());
558 seq_printf(s, "0x%08x\n", link_status);
559
560 return 0;
561}
562
563static int xve_link_control_status_open(struct inode *inode, struct file *file)
564{
565 return single_open(file, xve_link_control_status_show, inode->i_private);
566}
567
568static const struct file_operations xve_link_control_status_fops = {
569 .open = xve_link_control_status_open,
570 .read = seq_read,
571 .llseek = seq_lseek,
572 .release = single_release,
573};
574
575static int xve_sw_init_gp106(struct device *dev)
576{
577 int err = -ENODEV;
578#ifdef CONFIG_DEBUG_FS
579 struct gk20a *g = get_gk20a(dev);
580 struct gk20a_platform *plat = gk20a_get_platform(dev);
581 struct dentry *gpu_root = plat->debugfs;
582
583 g->debugfs_xve = debugfs_create_dir("xve", gpu_root);
584 if (IS_ERR_OR_NULL(g->debugfs_xve))
585 goto fail;
586
587 /*
588 * These are just debug nodes. If they fail to get made it's not worth
589 * worrying the higher level SW.
590 */
591 debugfs_create_file("link_speed", S_IRUGO,
592 g->debugfs_xve, g,
593 &xve_link_speed_fops);
594 debugfs_create_file("available_speeds", S_IRUGO,
595 g->debugfs_xve, g,
596 &xve_available_speeds_fops);
597 debugfs_create_file("link_control_status", S_IRUGO,
598 g->debugfs_xve, g,
599 &xve_link_control_status_fops);
600
601 err = 0;
602fail:
603 return err;
604#else
605 return err;
606#endif
607}
608
609/*
610 * Init the HAL functions and what not. xve_sw_init_gp106() is for initializing
611 * all the other stuff like debugfs nodes, etc.
612 */
613int gp106_init_xve_ops(struct gpu_ops *gops)
614{
615 gops->xve.sw_init = xve_sw_init_gp106;
616 gops->xve.get_speed = xve_get_speed_gp106;
617 gops->xve.set_speed = xve_set_speed_gp106;
618 gops->xve.available_speeds = xve_available_speeds_gp106;
619 gops->xve.xve_readl = xve_xve_readl_gp106;
620 gops->xve.xve_writel = xve_xve_writel_gp106;
621
622 return 0;
623}
diff --git a/drivers/gpu/nvgpu/gp106/xve_gp106.h b/drivers/gpu/nvgpu/gp106/xve_gp106.h
new file mode 100644
index 00000000..65c75bf0
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/xve_gp106.h
@@ -0,0 +1,99 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
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.
7 *
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
11 * more details.
12 *
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/>.
15 */
16
17#ifndef __XVE_GP106_H__
18#define __XVE_GP106_H__
19
20#include "gk20a/gk20a.h"
21
22int gp106_init_xve_ops(struct gpu_ops *gops);
23
24/*
25 * Best guess for a reasonable timeout.
26 */
27#define GPU_XVE_TIMEOUT_MS 500
28
29/*
30 * For the available speeds bitmap.
31 */
32#define GPU_XVE_SPEED_2P5 (1 << 0)
33#define GPU_XVE_SPEED_5P0 (1 << 1)
34#define GPU_XVE_SPEED_8P0 (1 << 2)
35#define GPU_XVE_NR_SPEEDS 3
36
37#define GPU_XVE_SPEED_MASK (GPU_XVE_SPEED_2P5 | \
38 GPU_XVE_SPEED_5P0 | \
39 GPU_XVE_SPEED_8P0)
40
41/*
42 * The HW uses a 2 bit field where speed is defined by a number:
43 *
44 * NV_XVE_LINK_CONTROL_STATUS_LINK_SPEED_2P5 = 1
45 * NV_XVE_LINK_CONTROL_STATUS_LINK_SPEED_5P0 = 2
46 * NV_XVE_LINK_CONTROL_STATUS_LINK_SPEED_8P0 = 3
47 *
48 * This isn't ideal for a bitmap with available speeds. So the external
49 * APIs think about speeds as a bit in a bitmap and this function converts
50 * from those bits to the actual HW speed setting.
51 *
52 * @speed_bit must have only 1 bit set and must be one of the 3 available
53 * HW speeds. Not all chips support all speeds so use available_speeds() to
54 * determine what a given chip supports.
55 */
56static inline u32 xve_speed_to_hw_speed_setting(u32 speed_bit)
57{
58 if (!speed_bit ||
59 !is_power_of_2(speed_bit) ||
60 !(speed_bit & GPU_XVE_SPEED_MASK))
61 return -EINVAL;
62
63 return ilog2(speed_bit) + 1;
64}
65
66static inline const char *xve_speed_to_str(u32 speed)
67{
68 if (!speed || !is_power_of_2(speed) ||
69 !(speed & GPU_XVE_SPEED_MASK))
70 return "Unknown ???";
71
72 return speed & GPU_XVE_SPEED_2P5 ? "Gen1" :
73 speed & GPU_XVE_SPEED_5P0 ? "Gen2" :
74 speed & GPU_XVE_SPEED_8P0 ? "Gen3" :
75 "Unknown ???";
76}
77
78/*
79 * Debugging for the speed change.
80 */
81enum xv_speed_change_steps {
82 PRE_CHANGE = 0,
83 DISABLE_ASPM,
84 DL_SAFE_MODE,
85 CHECK_LINK,
86 LINK_SETTINGS,
87 EXEC_CHANGE,
88 EXEC_VERIF,
89 CLEANUP
90};
91
92#define xv_dbg(fmt, args...) \
93 gk20a_dbg(gpu_dbg_xv, fmt, ##args)
94
95#define xv_sc_dbg(step, fmt, args...) \
96 xv_dbg("[%d] %15s | " fmt, step, __stringify(step), ##args)
97
98
99#endif