Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / gpu / drm / nouveau / nvkm / engine / gr / gk208.c
blob1fc258163f25a0ef1386b1417ea807a3505b36f6
1 /*
2 * Copyright 2013 Red Hat Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
22 * Authors: Ben Skeggs <bskeggs@redhat.com>
24 #include "gf100.h"
25 #include "ctxgf100.h"
27 #include <subdev/timer.h>
29 #include <nvif/class.h>
31 /*******************************************************************************
32 * PGRAPH register lists
33 ******************************************************************************/
35 static const struct gf100_gr_init
36 gk208_gr_init_main_0[] = {
37 { 0x400080, 1, 0x04, 0x003083c2 },
38 { 0x400088, 1, 0x04, 0x0001bfe7 },
39 { 0x40008c, 1, 0x04, 0x00000000 },
40 { 0x400090, 1, 0x04, 0x00000030 },
41 { 0x40013c, 1, 0x04, 0x003901f7 },
42 { 0x400140, 1, 0x04, 0x00000100 },
43 { 0x400144, 1, 0x04, 0x00000000 },
44 { 0x400148, 1, 0x04, 0x00000110 },
45 { 0x400138, 1, 0x04, 0x00000000 },
46 { 0x400130, 2, 0x04, 0x00000000 },
47 { 0x400124, 1, 0x04, 0x00000002 },
51 static const struct gf100_gr_init
52 gk208_gr_init_ds_0[] = {
53 { 0x405844, 1, 0x04, 0x00ffffff },
54 { 0x405850, 1, 0x04, 0x00000000 },
55 { 0x405900, 1, 0x04, 0x00000000 },
56 { 0x405908, 1, 0x04, 0x00000000 },
57 { 0x405928, 2, 0x04, 0x00000000 },
61 const struct gf100_gr_init
62 gk208_gr_init_gpc_unk_0[] = {
63 { 0x418604, 1, 0x04, 0x00000000 },
64 { 0x418680, 1, 0x04, 0x00000000 },
65 { 0x418714, 1, 0x04, 0x00000000 },
66 { 0x418384, 2, 0x04, 0x00000000 },
70 static const struct gf100_gr_init
71 gk208_gr_init_setup_1[] = {
72 { 0x4188c8, 2, 0x04, 0x00000000 },
73 { 0x4188d0, 1, 0x04, 0x00010000 },
74 { 0x4188d4, 1, 0x04, 0x00000201 },
78 static const struct gf100_gr_init
79 gk208_gr_init_tex_0[] = {
80 { 0x419ab0, 1, 0x04, 0x00000000 },
81 { 0x419ac8, 1, 0x04, 0x00000000 },
82 { 0x419ab8, 1, 0x04, 0x000000e7 },
83 { 0x419abc, 2, 0x04, 0x00000000 },
84 { 0x419ab4, 1, 0x04, 0x00000000 },
85 { 0x419aa8, 2, 0x04, 0x00000000 },
89 static const struct gf100_gr_init
90 gk208_gr_init_l1c_0[] = {
91 { 0x419c98, 1, 0x04, 0x00000000 },
92 { 0x419ca8, 1, 0x04, 0x00000000 },
93 { 0x419cb0, 1, 0x04, 0x01000000 },
94 { 0x419cb4, 1, 0x04, 0x00000000 },
95 { 0x419cb8, 1, 0x04, 0x00b08bea },
96 { 0x419c84, 1, 0x04, 0x00010384 },
97 { 0x419cbc, 1, 0x04, 0x281b3646 },
98 { 0x419cc0, 2, 0x04, 0x00000000 },
99 { 0x419c80, 1, 0x04, 0x00000230 },
100 { 0x419ccc, 2, 0x04, 0x00000000 },
104 static const struct gf100_gr_pack
105 gk208_gr_pack_mmio[] = {
106 { gk208_gr_init_main_0 },
107 { gk110_gr_init_fe_0 },
108 { gf100_gr_init_pri_0 },
109 { gf100_gr_init_rstr2d_0 },
110 { gf119_gr_init_pd_0 },
111 { gk208_gr_init_ds_0 },
112 { gf100_gr_init_scc_0 },
113 { gk110_gr_init_sked_0 },
114 { gk110_gr_init_cwd_0 },
115 { gf119_gr_init_prop_0 },
116 { gk208_gr_init_gpc_unk_0 },
117 { gf100_gr_init_setup_0 },
118 { gf100_gr_init_crstr_0 },
119 { gk208_gr_init_setup_1 },
120 { gf100_gr_init_zcull_0 },
121 { gf119_gr_init_gpm_0 },
122 { gk110_gr_init_gpc_unk_1 },
123 { gf100_gr_init_gcc_0 },
124 { gk104_gr_init_tpccs_0 },
125 { gk208_gr_init_tex_0 },
126 { gk104_gr_init_pe_0 },
127 { gk208_gr_init_l1c_0 },
128 { gf100_gr_init_mpc_0 },
129 { gk110_gr_init_sm_0 },
130 { gf117_gr_init_pes_0 },
131 { gf117_gr_init_wwdx_0 },
132 { gf117_gr_init_cbm_0 },
133 { gk104_gr_init_be_0 },
134 { gf100_gr_init_fe_1 },
138 /*******************************************************************************
139 * PGRAPH engine/subdev functions
140 ******************************************************************************/
142 #include "fuc/hubgk208.fuc5.h"
144 static struct gf100_gr_ucode
145 gk208_gr_fecs_ucode = {
146 .code.data = gk208_grhub_code,
147 .code.size = sizeof(gk208_grhub_code),
148 .data.data = gk208_grhub_data,
149 .data.size = sizeof(gk208_grhub_data),
152 #include "fuc/gpcgk208.fuc5.h"
154 static struct gf100_gr_ucode
155 gk208_gr_gpccs_ucode = {
156 .code.data = gk208_grgpc_code,
157 .code.size = sizeof(gk208_grgpc_code),
158 .data.data = gk208_grgpc_data,
159 .data.size = sizeof(gk208_grgpc_data),
162 static const struct gf100_gr_func
163 gk208_gr = {
164 .init = gk104_gr_init,
165 .init_gpc_mmu = gf100_gr_init_gpc_mmu,
166 .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
167 .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
168 .mmio = gk208_gr_pack_mmio,
169 .fecs.ucode = &gk208_gr_fecs_ucode,
170 .gpccs.ucode = &gk208_gr_gpccs_ucode,
171 .rops = gf100_gr_rops,
172 .ppc_nr = 1,
173 .grctx = &gk208_grctx,
174 .sclass = {
175 { -1, -1, FERMI_TWOD_A },
176 { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
177 { -1, -1, KEPLER_B, &gf100_fermi },
178 { -1, -1, KEPLER_COMPUTE_B },
184 gk208_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
186 return gf100_gr_new_(&gk208_gr, device, index, pgr);