1 /*
2  * Copyright 2013 Red Hat Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE 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.
21  *
22  * Authors: Ben Skeggs <bskeggs@redhat.com>
23  */
24 #include "gf100.h"
25 #include "ctxgf100.h"
26 
27 /*******************************************************************************
28  * PGRAPH register lists
29  ******************************************************************************/
30 
31 static const struct gf100_gr_init
32 gf117_gr_init_pe_0[] = {
33 	{ 0x41980c,   1, 0x04, 0x00000010 },
34 	{ 0x419844,   1, 0x04, 0x00000000 },
35 	{ 0x41984c,   1, 0x04, 0x00005bc8 },
36 	{ 0x419850,   3, 0x04, 0x00000000 },
37 	{}
38 };
39 
40 const struct gf100_gr_init
41 gf117_gr_init_pes_0[] = {
42 	{ 0x41be04,   1, 0x04, 0x00000000 },
43 	{ 0x41be08,   1, 0x04, 0x00000004 },
44 	{ 0x41be0c,   1, 0x04, 0x00000000 },
45 	{ 0x41be10,   1, 0x04, 0x003b8bc7 },
46 	{ 0x41be14,   2, 0x04, 0x00000000 },
47 	{}
48 };
49 
50 const struct gf100_gr_init
51 gf117_gr_init_wwdx_0[] = {
52 	{ 0x41bfd4,   1, 0x04, 0x00800000 },
53 	{ 0x41bfdc,   1, 0x04, 0x00000000 },
54 	{ 0x41bff8,   2, 0x04, 0x00000000 },
55 	{}
56 };
57 
58 const struct gf100_gr_init
59 gf117_gr_init_cbm_0[] = {
60 	{ 0x41becc,   1, 0x04, 0x00000000 },
61 	{ 0x41bee8,   2, 0x04, 0x00000000 },
62 	{}
63 };
64 
65 static const struct gf100_gr_pack
66 gf117_gr_pack_mmio[] = {
67 	{ gf100_gr_init_main_0 },
68 	{ gf100_gr_init_fe_0 },
69 	{ gf100_gr_init_pri_0 },
70 	{ gf100_gr_init_rstr2d_0 },
71 	{ gf119_gr_init_pd_0 },
72 	{ gf119_gr_init_ds_0 },
73 	{ gf100_gr_init_scc_0 },
74 	{ gf119_gr_init_prop_0 },
75 	{ gf108_gr_init_gpc_unk_0 },
76 	{ gf100_gr_init_setup_0 },
77 	{ gf100_gr_init_crstr_0 },
78 	{ gf108_gr_init_setup_1 },
79 	{ gf100_gr_init_zcull_0 },
80 	{ gf119_gr_init_gpm_0 },
81 	{ gf119_gr_init_gpc_unk_1 },
82 	{ gf100_gr_init_gcc_0 },
83 	{ gf100_gr_init_tpccs_0 },
84 	{ gf119_gr_init_tex_0 },
85 	{ gf117_gr_init_pe_0 },
86 	{ gf100_gr_init_l1c_0 },
87 	{ gf100_gr_init_mpc_0 },
88 	{ gf119_gr_init_sm_0 },
89 	{ gf117_gr_init_pes_0 },
90 	{ gf117_gr_init_wwdx_0 },
91 	{ gf117_gr_init_cbm_0 },
92 	{ gf100_gr_init_be_0 },
93 	{ gf119_gr_init_fe_1 },
94 	{}
95 };
96 
97 /*******************************************************************************
98  * PGRAPH engine/subdev functions
99  ******************************************************************************/
100 
101 #include "fuc/hubgf117.fuc3.h"
102 
103 struct gf100_gr_ucode
104 gf117_gr_fecs_ucode = {
105 	.code.data = gf117_grhub_code,
106 	.code.size = sizeof(gf117_grhub_code),
107 	.data.data = gf117_grhub_data,
108 	.data.size = sizeof(gf117_grhub_data),
109 };
110 
111 #include "fuc/gpcgf117.fuc3.h"
112 
113 struct gf100_gr_ucode
114 gf117_gr_gpccs_ucode = {
115 	.code.data = gf117_grgpc_code,
116 	.code.size = sizeof(gf117_grgpc_code),
117 	.data.data = gf117_grgpc_data,
118 	.data.size = sizeof(gf117_grgpc_data),
119 };
120 
121 struct nvkm_oclass *
122 gf117_gr_oclass = &(struct gf100_gr_oclass) {
123 	.base.handle = NV_ENGINE(GR, 0xd7),
124 	.base.ofuncs = &(struct nvkm_ofuncs) {
125 		.ctor = gf100_gr_ctor,
126 		.dtor = gf100_gr_dtor,
127 		.init = gf100_gr_init,
128 		.fini = _nvkm_gr_fini,
129 	},
130 	.cclass = &gf117_grctx_oclass,
131 	.sclass = gf110_gr_sclass,
132 	.mmio = gf117_gr_pack_mmio,
133 	.fecs.ucode = &gf117_gr_fecs_ucode,
134 	.gpccs.ucode = &gf117_gr_gpccs_ucode,
135 	.ppc_nr = 1,
136 }.base;
137