1/*	$NetBSD: nouveau_nvkm_engine_pm_g84.c,v 1.3 2021/12/18 23:45:37 riastradh Exp $	*/
2
3/*
4 * Copyright 2013 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors: Ben Skeggs
25 */
26#include <sys/cdefs.h>
27__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_pm_g84.c,v 1.3 2021/12/18 23:45:37 riastradh Exp $");
28
29#include "nv40.h"
30
31const struct nvkm_specsrc
32g84_vfetch_sources[] = {
33	{ 0x400c0c, (const struct nvkm_specmux[]) {
34			{ 0x3, 0, "unk0" },
35			{}
36		}, "pgraph_vfetch_unk0c" },
37	{}
38};
39
40static const struct nvkm_specsrc
41g84_prop_sources[] = {
42	{ 0x408e50, (const struct nvkm_specmux[]) {
43			{ 0x1f, 0, "sel", true },
44			{}
45		}, "pgraph_tpc0_prop_pm_mux" },
46	{}
47};
48
49static const struct nvkm_specsrc
50g84_crop_sources[] = {
51	{ 0x407008, (const struct nvkm_specmux[]) {
52			{ 0xf, 0, "sel0", true },
53			{ 0x7, 16, "sel1", true },
54			{}
55		}, "pgraph_rop0_crop_pm_mux" },
56	{}
57};
58
59static const struct nvkm_specsrc
60g84_tex_sources[] = {
61	{ 0x408808, (const struct nvkm_specmux[]) {
62			{ 0xfffff, 0, "unk0" },
63			{}
64		}, "pgraph_tpc0_tex_unk08" },
65	{}
66};
67
68static const struct nvkm_specdom
69g84_pm[] = {
70	{ 0x20, (const struct nvkm_specsig[]) {
71			{}
72		}, &nv40_perfctr_func },
73	{ 0xf0, (const struct nvkm_specsig[]) {
74			{ 0xbd, "pc01_gr_idle" },
75			{ 0x5e, "pc01_strmout_00" },
76			{ 0x5f, "pc01_strmout_01" },
77			{ 0xd2, "pc01_trast_00" },
78			{ 0xd3, "pc01_trast_01" },
79			{ 0xd4, "pc01_trast_02" },
80			{ 0xd5, "pc01_trast_03" },
81			{ 0xd8, "pc01_trast_04" },
82			{ 0xd9, "pc01_trast_05" },
83			{ 0x5c, "pc01_vattr_00" },
84			{ 0x5d, "pc01_vattr_01" },
85			{ 0x66, "pc01_vfetch_00", g84_vfetch_sources },
86			{ 0x67, "pc01_vfetch_01", g84_vfetch_sources },
87			{ 0x68, "pc01_vfetch_02", g84_vfetch_sources },
88			{ 0x69, "pc01_vfetch_03", g84_vfetch_sources },
89			{ 0x6a, "pc01_vfetch_04", g84_vfetch_sources },
90			{ 0x6b, "pc01_vfetch_05", g84_vfetch_sources },
91			{ 0x6c, "pc01_vfetch_06", g84_vfetch_sources },
92			{ 0x6d, "pc01_vfetch_07", g84_vfetch_sources },
93			{ 0x6e, "pc01_vfetch_08", g84_vfetch_sources },
94			{ 0x6f, "pc01_vfetch_09", g84_vfetch_sources },
95			{ 0x70, "pc01_vfetch_0a", g84_vfetch_sources },
96			{ 0x71, "pc01_vfetch_0b", g84_vfetch_sources },
97			{ 0x72, "pc01_vfetch_0c", g84_vfetch_sources },
98			{ 0x73, "pc01_vfetch_0d", g84_vfetch_sources },
99			{ 0x74, "pc01_vfetch_0e", g84_vfetch_sources },
100			{ 0x75, "pc01_vfetch_0f", g84_vfetch_sources },
101			{ 0x76, "pc01_vfetch_10", g84_vfetch_sources },
102			{ 0x77, "pc01_vfetch_11", g84_vfetch_sources },
103			{ 0x78, "pc01_vfetch_12", g84_vfetch_sources },
104			{ 0x79, "pc01_vfetch_13", g84_vfetch_sources },
105			{ 0x7a, "pc01_vfetch_14", g84_vfetch_sources },
106			{ 0x7b, "pc01_vfetch_15", g84_vfetch_sources },
107			{ 0x7c, "pc01_vfetch_16", g84_vfetch_sources },
108			{ 0x7d, "pc01_vfetch_17", g84_vfetch_sources },
109			{ 0x7e, "pc01_vfetch_18", g84_vfetch_sources },
110			{ 0x7f, "pc01_vfetch_19", g84_vfetch_sources },
111			{ 0x07, "pc01_zcull_00", nv50_zcull_sources },
112			{ 0x08, "pc01_zcull_01", nv50_zcull_sources },
113			{ 0x09, "pc01_zcull_02", nv50_zcull_sources },
114			{ 0x0a, "pc01_zcull_03", nv50_zcull_sources },
115			{ 0x0b, "pc01_zcull_04", nv50_zcull_sources },
116			{ 0x0c, "pc01_zcull_05", nv50_zcull_sources },
117			{ 0xa4, "pc01_unk00" },
118			{ 0xec, "pc01_trailer" },
119			{}
120		}, &nv40_perfctr_func },
121	{ 0xa0, (const struct nvkm_specsig[]) {
122			{ 0x30, "pc02_crop_00", g84_crop_sources },
123			{ 0x31, "pc02_crop_01", g84_crop_sources },
124			{ 0x32, "pc02_crop_02", g84_crop_sources },
125			{ 0x33, "pc02_crop_03", g84_crop_sources },
126			{ 0x00, "pc02_prop_00", g84_prop_sources },
127			{ 0x01, "pc02_prop_01", g84_prop_sources },
128			{ 0x02, "pc02_prop_02", g84_prop_sources },
129			{ 0x03, "pc02_prop_03", g84_prop_sources },
130			{ 0x04, "pc02_prop_04", g84_prop_sources },
131			{ 0x05, "pc02_prop_05", g84_prop_sources },
132			{ 0x06, "pc02_prop_06", g84_prop_sources },
133			{ 0x07, "pc02_prop_07", g84_prop_sources },
134			{ 0x48, "pc02_tex_00", g84_tex_sources },
135			{ 0x49, "pc02_tex_01", g84_tex_sources },
136			{ 0x4a, "pc02_tex_02", g84_tex_sources },
137			{ 0x4b, "pc02_tex_03", g84_tex_sources },
138			{ 0x1a, "pc02_tex_04", g84_tex_sources },
139			{ 0x1b, "pc02_tex_05", g84_tex_sources },
140			{ 0x1c, "pc02_tex_06", g84_tex_sources },
141			{ 0x44, "pc02_zrop_00", nv50_zrop_sources },
142			{ 0x45, "pc02_zrop_01", nv50_zrop_sources },
143			{ 0x46, "pc02_zrop_02", nv50_zrop_sources },
144			{ 0x47, "pc02_zrop_03", nv50_zrop_sources },
145			{ 0x8c, "pc02_trailer" },
146			{}
147		}, &nv40_perfctr_func },
148	{ 0x20, (const struct nvkm_specsig[]) {
149			{}
150		}, &nv40_perfctr_func },
151	{ 0x20, (const struct nvkm_specsig[]) {
152			{}
153		}, &nv40_perfctr_func },
154	{ 0x20, (const struct nvkm_specsig[]) {
155			{}
156		}, &nv40_perfctr_func },
157	{ 0x20, (const struct nvkm_specsig[]) {
158			{}
159		}, &nv40_perfctr_func },
160	{ 0x20, (const struct nvkm_specsig[]) {
161			{}
162		}, &nv40_perfctr_func },
163	{}
164};
165
166int
167g84_pm_new(struct nvkm_device *device, int index, struct nvkm_pm **ppm)
168{
169	return nv40_pm_new_(g84_pm, device, index, ppm);
170}
171