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 #include <nvif/class.h>
28 
29 /*******************************************************************************
30  * Graphics object classes
31  ******************************************************************************/
32 
33 struct nvkm_oclass
34 gf110_gr_sclass[] = {
35 	{ FERMI_TWOD_A, &nvkm_object_ofuncs },
36 	{ FERMI_MEMORY_TO_MEMORY_FORMAT_A, &nvkm_object_ofuncs },
37 	{ FERMI_A, &gf100_fermi_ofuncs, gf100_gr_9097_omthds },
38 	{ FERMI_B, &gf100_fermi_ofuncs, gf100_gr_9097_omthds },
39 	{ FERMI_C, &gf100_fermi_ofuncs, gf100_gr_9097_omthds },
40 	{ FERMI_COMPUTE_A, &nvkm_object_ofuncs, gf100_gr_90c0_omthds },
41 	{}
42 };
43 
44 /*******************************************************************************
45  * PGRAPH register lists
46  ******************************************************************************/
47 
48 static const struct gf100_gr_init
49 gf110_gr_init_sm_0[] = {
50 	{ 0x419e00,   1, 0x04, 0x00000000 },
51 	{ 0x419ea0,   1, 0x04, 0x00000000 },
52 	{ 0x419ea4,   1, 0x04, 0x00000100 },
53 	{ 0x419ea8,   1, 0x04, 0x00001100 },
54 	{ 0x419eac,   1, 0x04, 0x11100f02 },
55 	{ 0x419eb0,   1, 0x04, 0x00000003 },
56 	{ 0x419eb4,   4, 0x04, 0x00000000 },
57 	{ 0x419ec8,   1, 0x04, 0x06060618 },
58 	{ 0x419ed0,   1, 0x04, 0x0eff0e38 },
59 	{ 0x419ed4,   1, 0x04, 0x011104f1 },
60 	{ 0x419edc,   1, 0x04, 0x00000000 },
61 	{ 0x419f00,   1, 0x04, 0x00000000 },
62 	{ 0x419f2c,   1, 0x04, 0x00000000 },
63 	{}
64 };
65 
66 static const struct gf100_gr_pack
67 gf110_gr_pack_mmio[] = {
68 	{ gf100_gr_init_main_0 },
69 	{ gf100_gr_init_fe_0 },
70 	{ gf100_gr_init_pri_0 },
71 	{ gf100_gr_init_rstr2d_0 },
72 	{ gf100_gr_init_pd_0 },
73 	{ gf100_gr_init_ds_0 },
74 	{ gf100_gr_init_scc_0 },
75 	{ gf100_gr_init_prop_0 },
76 	{ gf100_gr_init_gpc_unk_0 },
77 	{ gf100_gr_init_setup_0 },
78 	{ gf100_gr_init_crstr_0 },
79 	{ gf108_gr_init_setup_1 },
80 	{ gf100_gr_init_zcull_0 },
81 	{ gf100_gr_init_gpm_0 },
82 	{ gf100_gr_init_gpc_unk_1 },
83 	{ gf100_gr_init_gcc_0 },
84 	{ gf100_gr_init_tpccs_0 },
85 	{ gf100_gr_init_tex_0 },
86 	{ gf100_gr_init_pe_0 },
87 	{ gf100_gr_init_l1c_0 },
88 	{ gf100_gr_init_wwdx_0 },
89 	{ gf100_gr_init_tpccs_1 },
90 	{ gf100_gr_init_mpc_0 },
91 	{ gf110_gr_init_sm_0 },
92 	{ gf100_gr_init_be_0 },
93 	{ gf100_gr_init_fe_1 },
94 	{ gf100_gr_init_pe_1 },
95 	{}
96 };
97 
98 /*******************************************************************************
99  * PGRAPH engine/subdev functions
100  ******************************************************************************/
101 
102 struct nvkm_oclass *
103 gf110_gr_oclass = &(struct gf100_gr_oclass) {
104 	.base.handle = NV_ENGINE(GR, 0xc8),
105 	.base.ofuncs = &(struct nvkm_ofuncs) {
106 		.ctor = gf100_gr_ctor,
107 		.dtor = gf100_gr_dtor,
108 		.init = gf100_gr_init,
109 		.fini = _nvkm_gr_fini,
110 	},
111 	.cclass = &gf110_grctx_oclass,
112 	.sclass = gf110_gr_sclass,
113 	.mmio = gf110_gr_pack_mmio,
114 	.fecs.ucode = &gf100_gr_fecs_ucode,
115 	.gpccs.ucode = &gf100_gr_gpccs_ucode,
116 }.base;
117